Commit 582367e7 authored by ZWT's avatar ZWT

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

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

BREAKING CHANGE: 无

Closes 无

[skip ci]
parent 7d6dab16
......@@ -6,15 +6,17 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import pps.cloud.system.service.SystemDictionaryService;
import pps.core.common.session.SysOrganization;
import pps.core.common.utils.PinyinUtil;
import pps.core.system.cache.SysDictionaryCache;
import pps.core.system.entity.*;
import pps.core.system.mapper.*;
import pps.core.system.entity.SysDictionaryEnt;
import pps.core.system.entity.SysDictionaryView;
import pps.core.system.entity.SysOrganizationDictionaryEnt;
import pps.core.system.entity.SysOrganizationRelEnt;
import pps.core.system.mapper.SysDictionaryMapper;
import pps.core.system.mapper.SysDictionaryViewMapper;
import pps.core.system.mapper.SysOrganizationDictionaryMapper;
import pps.core.system.mapper.SysOrganizationRelMapper;
import pps.core.system.service.data.sys_dictionary.*;
import pps.core.system.service.data.sys_menu.GetSysMenuInput;
import pps.core.system.service.data.sys_menu.QuerySysMenuOutputTree;
import xstartup.annotation.XService;
import xstartup.annotation.XText;
import xstartup.base.XContext;
......@@ -27,7 +29,6 @@ import xstartup.data.XPageResult;
import xstartup.data.XServiceResult;
import xstartup.data.XSingleResult;
import xstartup.error.XError;
import xstartup.feature.api.annotation.XApiAnonymous;
import xstartup.feature.api.annotation.XApiPost;
import xstartup.feature.mybatis.helper.XMapperHelper;
import xstartup.helper.XTransactionHelper;
......@@ -46,7 +47,7 @@ public class SysDictionaryService {
return XTransactionHelper.begin(context, () -> {
SysDictionaryMapper mapper = context.getBean(SysDictionaryMapper.class);
//如果输入的 alias 为空,查询新增项的上级alias
String alias = "";
String alias;
if (StringUtils.isNotBlank(input.getAlias())) {
alias = input.getAlias();
List<SysDictionaryCache> list1 = SysDictionaryCache.list(context, alias);
......@@ -134,15 +135,15 @@ public class SysDictionaryService {
XCopyUtils.copyObject(entity, sysDictionaryCache);
list.add(sysDictionaryCache);
SysDictionaryCache.set(context, alias, list);*/
SysDictionaryCache.deleteCache(context,alias);
SysDictionaryCache.deleteCache(context, alias);
QueryWrapper<SysDictionaryEnt> queryAlias = new QueryWrapper<>();
queryAlias.lambda().eq(SysDictionaryEnt::getAlias, alias).gt(SysDictionaryEnt::getEndTime,new Date());
queryAlias.lambda().eq(SysDictionaryEnt::getAlias, alias).gt(SysDictionaryEnt::getEndTime, new Date());
SysDictionaryEnt sysDictionaryEnt = mapper.selectOne(queryAlias);
if(ObjectUtils.isNotEmpty(sysDictionaryEnt)){
if (ObjectUtils.isNotEmpty(sysDictionaryEnt)) {
QueryWrapper<SysDictionaryEnt> queryAll = new QueryWrapper<>();
queryAll.lambda().eq(SysDictionaryEnt::getPid, sysDictionaryEnt.getId()).gt(SysDictionaryEnt::getEndTime,new Date());
queryAll.lambda().eq(SysDictionaryEnt::getPid, sysDictionaryEnt.getId()).gt(SysDictionaryEnt::getEndTime, new Date());
List<SysDictionaryEnt> sysDictionaryEnts = mapper.selectList(queryAll);
if(ObjectUtils.isNotEmpty(sysDictionaryEnts)){
if (ObjectUtils.isNotEmpty(sysDictionaryEnts)) {
sysDictionaryEnts.add(entity);
}
sysDictionaryEnts.add(sysDictionaryEnt);
......@@ -309,24 +310,24 @@ public class SysDictionaryService {
query.lambda().like(SysDictionaryEnt::getDicName, input.getDicName());
}
List<SysDictionaryEnt> sysDictionaryEnts = mapper.selectList(query);
if(ObjectUtils.isNotEmpty(sysDictionaryEnts)){
if (ObjectUtils.isNotEmpty(sysDictionaryEnts)) {
List<String> collect = sysDictionaryEnts.stream().map(p -> {
if (StringUtils.isNotBlank(p.getDicPath())) {
String[] split = p.getDicPath().split("/");
if (ObjectUtils.isNotEmpty(split) && split.length > 1) {
return split[1];
} else{
} else {
return null;
}
} else {
return p.getId();
}
}).distinct().collect(Collectors.toList());
queryWrapper.lambda().in(SysDictionaryEnt::getId,collect);
}else{
return XPageResult.success(new ArrayList<>(),1,1,0);
queryWrapper.lambda().in(SysDictionaryEnt::getId, collect);
} else {
return XPageResult.success(new ArrayList<>(), 1, 1, 0);
}
}else{
} else {
input.setPage(1);
input.setLimit(2000);
}
......@@ -380,7 +381,7 @@ public class SysDictionaryService {
@XText("分页条件查询字典")
@XApiPost
public XPageResult<QuerySysDictionaryOutput> querySysDictionaryOn(XContext context, QuerySysDictionaryInput input) {
if(XStringUtils.isNotEmpty(input.getCode()) || XStringUtils.isNotEmpty(input.getDicName())){
if (XStringUtils.isNotEmpty(input.getCode()) || XStringUtils.isNotEmpty(input.getDicName())) {
SysDictionaryViewMapper mapper = context.getBean(SysDictionaryViewMapper.class);
SysDictionaryView view = new SysDictionaryView();
if (StringUtils.isNotBlank(input.getCode())) {
......@@ -392,12 +393,12 @@ public class SysDictionaryService {
List<SysDictionaryView> viewList = mapper.selectTreeList(view);
List<QuerySysDictionaryOutput> list = XCopyUtils.copyNewList(viewList, QuerySysDictionaryOutput.class);
List<QuerySysDictionaryOutput> trees = new ArrayList<>();
int i = 0 ;
int i = 0;
for (QuerySysDictionaryOutput tree : list) {
tree.setBeHasChildren(null);
tree.setBeDefault(null);
tree.set_showChildren(null);
if(tree.getSort() == null)
if (tree.getSort() == null)
tree.setSort(0);
tree.setChildren(null);
if (tree.getPid() == null || "".equals(tree.getPid()) || "1".equals(tree.getPid())) {
......@@ -420,14 +421,14 @@ public class SysDictionaryService {
}
if (tree.getChildren() != null && tree.getChildren().size() > 1) {
List<QuerySysDictionaryOutput> children = tree.getChildren();
children=children.stream().sorted(Comparator.comparing(QuerySysDictionaryOutput::getXh)).collect(Collectors.toList());
children = children.stream().sorted(Comparator.comparing(QuerySysDictionaryOutput::getXh)).collect(Collectors.toList());
tree.setChildren(children);
}
}
trees=trees.stream().sorted(Comparator.comparing(QuerySysDictionaryOutput::getSort)).collect(Collectors.toList());
trees = trees.stream().sorted(Comparator.comparing(QuerySysDictionaryOutput::getSort)).collect(Collectors.toList());
PageInfo<QuerySysDictionaryOutput> pageInfo = new PageInfo<>(trees);
return XPageResult.success(trees,input,pageInfo.getTotal());
}else {
return XPageResult.success(trees, input, pageInfo.getTotal());
} else {
SysDictionaryMapper mapper = context.getBean(SysDictionaryMapper.class);
SysDictionaryViewMapper viewMapper = context.getBean(SysDictionaryViewMapper.class);
QueryWrapper<SysDictionaryEnt> queryWrapper = new QueryWrapper<>();
......@@ -446,24 +447,24 @@ public class SysDictionaryService {
query.lambda().like(SysDictionaryEnt::getDicName, input.getDicName());
}
List<SysDictionaryEnt> sysDictionaryEnts = mapper.selectList(query);
if(ObjectUtils.isNotEmpty(sysDictionaryEnts)){
if (ObjectUtils.isNotEmpty(sysDictionaryEnts)) {
List<String> collect = sysDictionaryEnts.stream().map(p -> {
if (StringUtils.isNotBlank(p.getDicPath())) {
String[] split = p.getDicPath().split("/");
if (ObjectUtils.isNotEmpty(split) && split.length > 1) {
return split[1];
} else{
} else {
return null;
}
} else {
return p.getId();
}
}).distinct().collect(Collectors.toList());
queryWrapper.lambda().in(SysDictionaryEnt::getId,collect);
}else{
return XPageResult.success(new ArrayList<>(),1,1,0);
queryWrapper.lambda().in(SysDictionaryEnt::getId, collect);
} else {
return XPageResult.success(new ArrayList<>(), 1, 1, 0);
}
}else{
} else {
input.setPage(1);
input.setLimit(2000);
}
......@@ -517,10 +518,10 @@ public class SysDictionaryService {
@XText("查询字典列表树")
@XApiPost
public XListResult<QuerySysDictionaryOutput> getSysDictionaryTree(XContext context, QuerySysDictionaryInput input){
public XListResult<QuerySysDictionaryOutput> getSysDictionaryTree(XContext context, QuerySysDictionaryInput input) {
SysDictionaryViewMapper mapper = context.getBean(SysDictionaryViewMapper.class);
if(XStringUtils.isEmpty(input.getCode()) && XStringUtils.isEmpty(input.getDicName()))
return XListResult.error(500 , "请输入查询参数");
if (XStringUtils.isEmpty(input.getCode()) && XStringUtils.isEmpty(input.getDicName()))
return XListResult.error(500, "请输入查询参数");
SysDictionaryView view = new SysDictionaryView();
if (StringUtils.isNotBlank(input.getCode())) {
view.setDicKey(input.getCode());
......@@ -546,7 +547,7 @@ public class SysDictionaryService {
}
if (tree.getChildren() != null && tree.getChildren().size() > 1) {
List<QuerySysDictionaryOutput> children = tree.getChildren();
children=children.stream().sorted(Comparator.comparing(QuerySysDictionaryOutput::getSort)).collect(Collectors.toList());
children = children.stream().sorted(Comparator.comparing(QuerySysDictionaryOutput::getSort)).collect(Collectors.toList());
tree.setChildren(children);
}
}
......@@ -607,7 +608,7 @@ public class SysDictionaryService {
SysOrganizationRelMapper orgRelMapper = context.getBean(SysOrganizationRelMapper.class);
List<SysDictionaryCache> list = SysDictionaryCache.list(context, input.getAlias());
QueryWrapper<SysDictionaryEnt> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SysDictionaryEnt::getAlias, input.getAlias()).gt(SysDictionaryEnt::getEndTime,new Date());
queryWrapper.lambda().eq(SysDictionaryEnt::getAlias, input.getAlias()).gt(SysDictionaryEnt::getEndTime, new Date());
SysDictionaryEnt sysDictionaryEnt = mapper.selectOne(queryWrapper);
list = list.stream().filter((SysDictionaryCache dic) -> StringUtils.equals(dic.getPid(), sysDictionaryEnt.getId()))
.collect(Collectors.toList());
......@@ -629,8 +630,8 @@ public class SysDictionaryService {
if (ObjectUtils.isNotEmpty(sysDictionary.getIsOrg()) && sysDictionary.getIsOrg() == 1) {
//查询当前登录人的组织机构层级路径
QueryWrapper<SysOrganizationRelEnt> queryOrgRel = new QueryWrapper<>();
queryOrgRel.lambda().eq(SysOrganizationRelEnt::getOuId,input.getOuId())
.gt(SysOrganizationRelEnt::getEndTime,new Date());
queryOrgRel.lambda().eq(SysOrganizationRelEnt::getOuId, input.getOuId())
.gt(SysOrganizationRelEnt::getEndTime, new Date());
SysOrganizationRelEnt sysOrganizationRelEnt = orgRelMapper.selectOne(queryOrgRel);
//根据字典id查询
QueryWrapper<SysOrganizationDictionaryEnt> queryOrgDic = new QueryWrapper();
......@@ -639,13 +640,13 @@ public class SysDictionaryService {
List<SysOrganizationDictionaryEnt> sysOrganizationDictionaryEnts = orgDicmapper.selectList(queryOrgDic);
String ouIdPath = sysOrganizationRelEnt.getOuIdPath();
String ouId = sysOrganizationRelEnt.getOuId();
if(StringUtils.isNotBlank(ouIdPath)){
if (StringUtils.isNotBlank(ouIdPath)) {
List<String> dicIds = sysOrganizationDictionaryEnts.stream().map(p -> {
if(ouIdPath.indexOf(p.getOuId())!= -1 && p.getUseLowerLevel()==1){
if (ouIdPath.indexOf(p.getOuId()) != -1 && p.getUseLowerLevel() == 1) {
return p.getDicCode();
}else if(ouId.indexOf(p.getOuId())!= -1){
} else if (ouId.indexOf(p.getOuId()) != -1) {
return p.getDicCode();
}else{
} else {
return "1";
}
}).collect(Collectors.toList());
......@@ -677,11 +678,11 @@ public class SysDictionaryService {
}
}
}
if(ObjectUtils.isNotEmpty(sysDictionaryEnt.getIsOrg()) && sysDictionaryEnt.getIsOrg() == 1){
if (ObjectUtils.isNotEmpty(sysDictionaryEnt.getIsOrg()) && sysDictionaryEnt.getIsOrg() == 1) {
//查询当前登录人的组织机构层级路径
QueryWrapper<SysOrganizationRelEnt> queryOrgRel = new QueryWrapper<>();
queryOrgRel.lambda().eq(SysOrganizationRelEnt::getOuId,input.getOuId())
.gt(SysOrganizationRelEnt::getEndTime,new Date());
queryOrgRel.lambda().eq(SysOrganizationRelEnt::getOuId, input.getOuId())
.gt(SysOrganizationRelEnt::getEndTime, new Date());
SysOrganizationRelEnt sysOrganizationRelEnt = orgRelMapper.selectOne(queryOrgRel);
//根据字典id查询
QueryWrapper<SysOrganizationDictionaryEnt> queryOrgDic = new QueryWrapper();
......@@ -690,17 +691,17 @@ public class SysDictionaryService {
List<SysOrganizationDictionaryEnt> sysOrganizationDictionaryEnts = orgDicmapper.selectList(queryOrgDic);
String ouIdPath = sysOrganizationRelEnt.getOuIdPath();
String ouId = sysOrganizationRelEnt.getOuId();
if(StringUtils.isNotBlank(ouIdPath)){
if (StringUtils.isNotBlank(ouIdPath)) {
List<String> dicIds = sysOrganizationDictionaryEnts.stream().map(p -> {
if(ouIdPath.indexOf(p.getOuId())!= -1 && p.getUseLowerLevel()==1){
if (ouIdPath.indexOf(p.getOuId()) != -1 && p.getUseLowerLevel() == 1) {
return p.getDicCode();
}else if(ouId.indexOf(p.getOuId())!= -1){
} else if (ouId.indexOf(p.getOuId()) != -1) {
return p.getDicCode();
}else{
} else {
return "1";
}
}).collect(Collectors.toList());
list = list.stream().filter(i->dicIds.contains(i.getId())).collect(Collectors.toList());
list = list.stream().filter(i -> dicIds.contains(i.getId())).collect(Collectors.toList());
}
}
......@@ -767,24 +768,28 @@ public class SysDictionaryService {
public XServiceResult updateBasePipelineParentPath(XContext context, List<SysDictionaryEnt> dics) {
SysDictionaryMapper mapper = context.getBean(SysDictionaryMapper.class);
List<String> list = dics.stream().map(p->{return p.getId();}).distinct().collect(Collectors.toList());
while (ObjectUtils.isNotEmpty(list)){
List<String> list = dics.stream().map(p -> {
return p.getId();
}).distinct().collect(Collectors.toList());
while (ObjectUtils.isNotEmpty(list)) {
//更新二级字典parentPath
QueryWrapper<SysDictionaryEnt> wrapper = new QueryWrapper<>();
wrapper.lambda().in(SysDictionaryEnt::getPid, list);
List<SysDictionaryEnt> sysDictionaryEnts = mapper.selectList(wrapper);
if(ObjectUtils.isNotEmpty(sysDictionaryEnts)){
for(SysDictionaryEnt entity:sysDictionaryEnts){
if (ObjectUtils.isNotEmpty(sysDictionaryEnts)) {
for (SysDictionaryEnt entity : sysDictionaryEnts) {
QueryWrapper<SysDictionaryEnt> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().in(SysDictionaryEnt::getId, entity.getPid());
SysDictionaryEnt pdic = mapper.selectOne(queryWrapper);
String parentPath = pdic.getDicPath() == null ? "/" + pdic.getId():pdic.getDicPath()+ "/" + pdic.getId();
String parentPath = pdic.getDicPath() == null ? "/" + pdic.getId() : pdic.getDicPath() + "/" + pdic.getId();
// String parentPath = entity.getDicPath() == null || entity.getDicPath() == "null" ? "/" + entity.getPid() : entity.getDicPath() + "/" + childDic.getId();
entity.setDicPath(parentPath);
mapper.updateById(entity);
}
list = sysDictionaryEnts.stream().map(p->{return p.getId();}).distinct().collect(Collectors.toList());
}else{
list = sysDictionaryEnts.stream().map(p -> {
return p.getId();
}).distinct().collect(Collectors.toList());
} else {
list = null;
}
}
......@@ -884,7 +889,7 @@ public class SysDictionaryService {
});
List<QueryRuleNumberOutput> outputs = XCopyUtils.copyNewList(sysDictionaryList, QueryRuleNumberOutput.class);
PageInfo<QueryRuleNumberOutput> pageInfo = new PageInfo<>(outputs);
return XPageResult.success(outputs,input,pageInfo.getTotal());
return XPageResult.success(outputs, input, pageInfo.getTotal());
}
}
}
......@@ -916,7 +921,7 @@ public class SysDictionaryService {
}
PageInfo<QueryRuleNumberOutput> pageInfo = new PageInfo<>(outputs);
return XPageResult.success(outputs,input,pageInfo.getTotal());
return XPageResult.success(outputs, input, pageInfo.getTotal());
}
@XText("新建规则编码")
......@@ -932,7 +937,7 @@ public class SysDictionaryService {
newEnt.setRemark(input.getRemark());
newEnt.setEffectTime(new Date());
newEnt.setEndTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse("9999-12-31 00:00:00"));
newEnt.setDicKey(PinyinUtil.getPinyin(input.getDicName(),"_"));
newEnt.setDicKey(PinyinUtil.getPinyin(input.getDicName(), "_"));
newEnt.updateCreateInfo(context);
mapper.insert(newEnt);
......@@ -943,9 +948,9 @@ public class SysDictionaryService {
@XText("查询规则编码变量")
@XApiPost
public XListResult<QuerySysDictionaryViewOutput> queryRuleNumberVars(XContext context){
public XListResult<QuerySysDictionaryViewOutput> queryRuleNumberVars(XContext context) {
CreateSysDictionaryInput input = new CreateSysDictionaryInput();
input.setAlias("CODE_GENERATOR_PARAM");
return querySysDictionarysByAlias(context,input );
return querySysDictionarysByAlias(context, input);
}
}
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