Commit 66e473c2 authored by ZWT's avatar ZWT

feat(能源管理系统): 修改架构

1.修改架构添加cse;
2.修改各微服务服务名,启动验证,完成cse注册;
3.修改各模块pom及配置文件,解决服务间无法调用问题;
4.修改各服务配置,解决gateway模块跨域问题;
5.暂时删除部分编译错误代码,完成本地登录流程等基础功能测试,验证改造后链路是否正常;

BREAKING CHANGE: 无

Closes 无

[skip ci]
parent b956dd5a
package pps.core.common.cache; package pps.core.common.cache;
import xstartup.base.XContext; import xstartup.base.XContext;
import xstartup.base.util.XJsonUtils;
import xstartup.cache.XCacheLife; import xstartup.cache.XCacheLife;
import xstartup.cache.XCacheObject; import xstartup.cache.XCacheObject;
import xstartup.cache.XSingleCache; import xstartup.cache.XSingleCache;
...@@ -56,10 +55,10 @@ public class ConfigCache implements XCacheObject, XCacheLife { ...@@ -56,10 +55,10 @@ public class ConfigCache implements XCacheObject, XCacheLife {
ConfigCacheRefreshTool tool = ConfigCacheRefreshTool.get(ConfigCacheRefreshTool.class); ConfigCacheRefreshTool tool = ConfigCacheRefreshTool.get(ConfigCacheRefreshTool.class);
tool.setValueProvider(valueProvider); tool.setValueProvider(valueProvider);
ConfigCache cache = tool.find(context, configName, ConfigCache.class); ConfigCache cache = tool.find(context, configName, ConfigCache.class);
if( deleteOriginal){ if (deleteOriginal) {
try{ try {
tool.delete(context, cache); tool.delete(context, cache);
}catch(Exception e){ } catch (Exception e) {
context.getLogger().error("delete cache exception.", e); context.getLogger().error("delete cache exception.", e);
} }
cache = tool.find(context, configName, ConfigCache.class); cache = tool.find(context, configName, ConfigCache.class);
...@@ -83,7 +82,7 @@ public class ConfigCache implements XCacheObject, XCacheLife { ...@@ -83,7 +82,7 @@ public class ConfigCache implements XCacheObject, XCacheLife {
@Override @Override
protected ConfigCache restore(XContext context, String cacheKey) { protected ConfigCache restore(XContext context, String cacheKey) {
//生成缓存对象 //生成缓存对象
if(valueProvider != null){ if (valueProvider != null) {
ConfigCache cache = new ConfigCache(); ConfigCache cache = new ConfigCache();
cache.configName = cacheKey; cache.configName = cacheKey;
cache.configValue = valueProvider.get(); cache.configValue = valueProvider.get();
......
...@@ -16,7 +16,7 @@ import java.util.List; ...@@ -16,7 +16,7 @@ import java.util.List;
* 交易平台用户权限缓存 * 交易平台用户权限缓存
* 优先判断 用户权限,为空时判断角色权限 * 优先判断 用户权限,为空时判断角色权限
*/ */
public class TradeUserPermissionCache implements XCacheObject , XCacheLife { public class TradeUserPermissionCache implements XCacheObject, XCacheLife {
private String serviceName; private String serviceName;
private String methodName; private String methodName;
...@@ -46,7 +46,7 @@ public class TradeUserPermissionCache implements XCacheObject , XCacheLife { ...@@ -46,7 +46,7 @@ public class TradeUserPermissionCache implements XCacheObject , XCacheLife {
@Override @Override
public String getCacheKey() { public String getCacheKey() {
return this.serviceName+"#"+this.methodName; return this.serviceName + "#" + this.methodName;
} }
@Override @Override
...@@ -60,42 +60,46 @@ public class TradeUserPermissionCache implements XCacheObject , XCacheLife { ...@@ -60,42 +60,46 @@ public class TradeUserPermissionCache implements XCacheObject , XCacheLife {
/** /**
* 检查缓存是否存在指定的code * 检查缓存是否存在指定的code
*
* @param context * @param context
* @param roleId * @param roleId
* @param serviceName * @param serviceName
* @param methodName * @param methodName
* @return * @return
*/ */
public static boolean exist(XContext context, Long roleId, String serviceName,String methodName){ public static boolean exist(XContext context, Long roleId, String serviceName, String methodName) {
return Tool.get(Tool.class).exist(context, roleId.toString(), serviceName+"#"+methodName, TradeUserPermissionCache.class); return Tool.get(Tool.class).exist(context, roleId.toString(), serviceName + "#" + methodName, TradeUserPermissionCache.class);
} }
/** /**
* 从缓存中读取 * 从缓存中读取
*
* @param context * @param context
* @param roleId * @param roleId
* @return * @return
*/ */
public static List<TradeUserPermissionCache> list(XContext context, Long roleId){ public static List<TradeUserPermissionCache> list(XContext context, Long roleId) {
return Tool.get(Tool.class).list(context, roleId.toString(), TradeUserPermissionCache.class); return Tool.get(Tool.class).list(context, roleId.toString(), TradeUserPermissionCache.class);
} }
/** /**
* 设置缓存 * 设置缓存
*
* @param context * @param context
* @param roleId * @param roleId
* @param caches * @param caches
*/ */
public static void set(XContext context, Long roleId, List<TradeUserPermissionCache> caches){ public static void set(XContext context, Long roleId, List<TradeUserPermissionCache> caches) {
Tool.get(Tool.class).set(context, roleId.toString(), caches); Tool.get(Tool.class).set(context, roleId.toString(), caches);
} }
/** /**
* 删除缓存 * 删除缓存
*
* @param context * @param context
* @param roleId * @param roleId
*/ */
public static void delete(XContext context, Long roleId){ public static void delete(XContext context, Long roleId) {
Tool.get(Tool.class).delete(context, roleId.toString(), TradeUserPermissionCache.class); Tool.get(Tool.class).delete(context, roleId.toString(), TradeUserPermissionCache.class);
} }
...@@ -105,8 +109,8 @@ public class TradeUserPermissionCache implements XCacheObject , XCacheLife { ...@@ -105,8 +109,8 @@ public class TradeUserPermissionCache implements XCacheObject , XCacheLife {
SysTradeInterfaceWhiteMapper whiteMapper = context.getBean(SysTradeInterfaceWhiteMapper.class); SysTradeInterfaceWhiteMapper whiteMapper = context.getBean(SysTradeInterfaceWhiteMapper.class);
QueryWrapper<SysTradeInterfaceWhiteEnt> whiteEntQueryWrapper = new QueryWrapper<>(); QueryWrapper<SysTradeInterfaceWhiteEnt> whiteEntQueryWrapper = new QueryWrapper<>();
List<SysTradeInterfaceWhiteEnt> whiteEntList = whiteMapper.selectList(whiteEntQueryWrapper); List<SysTradeInterfaceWhiteEnt> whiteEntList = whiteMapper.selectList(whiteEntQueryWrapper);
if(!CollectionUtils.isEmpty(whiteEntList)){ if (!CollectionUtils.isEmpty(whiteEntList)) {
return XCopyUtils.copyNewList(whiteEntList,TradeUserPermissionCache.class); return XCopyUtils.copyNewList(whiteEntList, TradeUserPermissionCache.class);
} }
return null; return null;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment