From 4e753847d27ca5cb04866120e02394b7a59263f1 Mon Sep 17 00:00:00 2001 From: yuxc <yuxc@vci-tech.com> Date: 星期三, 04 九月 2024 18:08:22 +0800 Subject: [PATCH] 1、模板查询列表增加属性字段的类型。 2、权限管理树的查询接口。 --- Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/QTInfoDTO.java | 2 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmFunctionQueryServicePlatformImpl.java | 214 ++++++-------- Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsQueryTemplateController.java | 1 Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/LeafInfoDTO.java | 48 +++ Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/MenuVO.java | 3 Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/ConditionDTO.java | 59 ++++ Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/LeafValueDto.java | 35 ++ Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsQueryTemplateImpl.java | 186 +++++++++---- Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/QueryTemplateDTO.java | 164 +++++++++++ Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsQuereyTemplateServiceI.java | 1 Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/ConditionItemDTO.java | 57 ++++ Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/HMSysModConfigController.java | 19 + 12 files changed, 608 insertions(+), 181 deletions(-) diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/ConditionDTO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/ConditionDTO.java new file mode 100644 index 0000000..4d5b98e --- /dev/null +++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/ConditionDTO.java @@ -0,0 +1,59 @@ +package com.vci.dto; + +import com.vci.common.qt.object.ConditionItem; +import lombok.Data; + +import java.util.Iterator; +import java.util.Map; + +/** + * 鏉′欢浼犺緭瀵硅薄 + * @author yuxc + * @date 2024/9/4 + */ +@Data +public class ConditionDTO { + private String rootCIName; + private Map<String, ConditionItemDTO> ciMap; + + public ConditionDTO() { + } + + public String getRootCIName() { + return this.rootCIName; + } + + public void setRootCIName(String rootCIName) { + this.rootCIName = rootCIName; + } + + public String getRootCINameByCIMap(Map<String, ConditionItem> ciMap) { + String rootCIName = ""; + if (ciMap != null) { + Iterator<String> i = ciMap.keySet().iterator(); + + while(i.hasNext()) { + String ciName = (String)i.next(); + if (rootCIName.equals("")) { + rootCIName = ciName; + } else { + int rootInt = Integer.valueOf(rootCIName.substring(2)); + int ciInt = Integer.valueOf(ciName.substring(2)); + if (ciInt > rootInt) { + rootCIName = ciName; + } + } + } + } + + return rootCIName; + } + + public Map<String, ConditionItemDTO> getCIMap() { + return this.ciMap; + } + + public void setCIMap(Map<String, ConditionItemDTO> cIMap) { + this.ciMap = cIMap; + } +} diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/ConditionItemDTO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/ConditionItemDTO.java new file mode 100644 index 0000000..abe7f32 --- /dev/null +++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/ConditionItemDTO.java @@ -0,0 +1,57 @@ +package com.vci.dto; + +import com.vci.common.qt.object.ChildrenInfo; +import com.vci.common.qt.object.ConditionItem; +import com.vci.common.qt.object.LeafInfo; +import lombok.Data; + +import java.util.Iterator; +import java.util.Map; + +/** + * 鏉′欢鍒楄〃浼犺緭瀵硅薄 + * @author yuxc + * @date 2024/9/4 + */ +@Data +public class ConditionItemDTO { + private String id; + private LeafInfoDTO leafInfo; + private ChildrenInfo childrenInfo; + private boolean leafFlag; + + public ConditionItemDTO() { + } + + public String getId() { + return this.id; + } + + public void setId(String id) { + this.id = id; + } + + public LeafInfoDTO getLeafInfo() { + return this.leafInfo; + } + + public void setLeafInfo(LeafInfoDTO leafInfo) { + this.leafInfo = leafInfo; + } + + public ChildrenInfo getChildrenInfo() { + return this.childrenInfo; + } + + public void setChildrenInfo(ChildrenInfo childrenInfo) { + this.childrenInfo = childrenInfo; + } + + public boolean isLeaf() { + return this.leafFlag; + } + + public void setLeafFlag(boolean leafFlag) { + this.leafFlag = leafFlag; + } +} diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/LeafInfoDTO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/LeafInfoDTO.java new file mode 100644 index 0000000..5326fb2 --- /dev/null +++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/LeafInfoDTO.java @@ -0,0 +1,48 @@ +package com.vci.dto; + +import com.vci.common.qt.object.ConditionItem; +import com.vci.common.qt.object.LeafValue; +import lombok.Data; + +import java.util.Iterator; +import java.util.Map; + +/** + * 鍙跺瓙鏉′欢浼犺緭瀵硅薄 + * @author yuxc + * @date 2024/9/4 + */ +@Data +public class LeafInfoDTO { + private String clause; + private String operator; + private String type; + private LeafValueDto value; + + public LeafInfoDTO() { + } + + public String getClause() { + return this.clause; + } + + public void setClause(String clause) { + this.clause = clause; + } + + public String getOperator() { + return this.operator; + } + + public void setOperator(String operator) { + this.operator = operator; + } + + public LeafValueDto getValue() { + return this.value; + } + + public void setValue(LeafValueDto value) { + this.value = value; + } +} diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/LeafValueDto.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/LeafValueDto.java new file mode 100644 index 0000000..31e9269 --- /dev/null +++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/LeafValueDto.java @@ -0,0 +1,35 @@ +package com.vci.dto; + +import lombok.Data; + +/** + * 鍙跺瓙鍊间紶杈撳璞� + * @author yuxc + * @date 2024/9/4 + */ +@Data +public class LeafValueDto { + private String ordinaryValue; + private QueryTemplateDTO queryTemplate; + + public LeafValueDto() { + } + + public String getOrdinaryValue() { + return this.ordinaryValue; + } + + public void setOrdinaryValue(String ordinaryValue) { + this.ordinaryValue = ordinaryValue; + } + + public QueryTemplateDTO getQueryTemplate() { + return this.queryTemplate; + } + + public void setQueryTemplate(QueryTemplateDTO queryTemplate) { + this.queryTemplate = queryTemplate; + } + + +} diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/QTInfoDTO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/QTInfoDTO.java index 094b3db..485ebeb 100644 --- a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/QTInfoDTO.java +++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/QTInfoDTO.java @@ -31,7 +31,7 @@ //鏌ヨ妯℃澘鍚� private String qtText; //鏌ヨ妯℃澘淇℃伅 - private QueryTemplate queryTemplate; + private QueryTemplateDTO queryTemplate; //鏌ヨ鏉′欢锛屽悗绔繘琛岀浉鍏宠В鏋� private List<HashMap<String,String>> condition; private HashMap<String,Object> tree = new HashMap<>(); diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/QueryTemplateDTO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/QueryTemplateDTO.java new file mode 100644 index 0000000..e0036a1 --- /dev/null +++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/QueryTemplateDTO.java @@ -0,0 +1,164 @@ +package com.vci.dto; + + +import com.vci.common.qt.object.Condition; +import com.vci.common.qt.object.OrderInfo; +import com.vci.common.qt.object.PageInfo; +import lombok.Data; +import java.util.List; + +/** + * 鏌ヨ妯℃澘浼犺緭瀵硅薄 + * @author yuxc + * @date 2024/8/7 + */ +@Data +public class QueryTemplateDTO { + private String id; + private String type; + private List<String> clauseList; + private String linkType; + private String btmType; + private boolean queryChildrenFlag = false; + private boolean queryISLeaf = false; + private boolean rightFlag = true; + private boolean secretFlag = true; + private String direction = "positive"; + private ConditionDTO condition; + private int version = 0; + private PageInfo pageInfo; + private List<OrderInfo> orderInfoList; + private int level = 1; + private int recReturnMode = 1; + + public QueryTemplateDTO() { + } + + public String getLinkType() { + return this.linkType; + } + + public void setLinkType(String linkType) { + this.linkType = linkType; + } + + public String getBtmType() { + return this.btmType; + } + + public void setBtmType(String btmType) { + this.btmType = btmType; + } + + public boolean isQueryChildren() { + return this.queryChildrenFlag; + } + + public void setQueryChildrenFlag(boolean queryChildrenFlag) { + this.queryChildrenFlag = queryChildrenFlag; + } + + public String getId() { + return this.id; + } + + public void setId(String id) { + this.id = id; + } + + public String getType() { + return this.type; + } + + public void setType(String type) { + this.type = type; + } + + public List<String> getClauseList() { + return this.clauseList; + } + + public void setClauseList(List<String> clauseList) { + this.clauseList = clauseList; + } + + public ConditionDTO getCondition() { + return this.condition; + } + + public void setCondition(ConditionDTO condition) { + this.condition = condition; + } + + public int getVersion() { + return this.version; + } + + public void setVersion(int version) { + this.version = version; + } + + public String getDirection() { + return this.direction; + } + + public void setDirection(String direction) { + this.direction = direction; + } + + public PageInfo getPageInfo() { + return this.pageInfo; + } + + public void setPageInfo(PageInfo pageInfo) { + this.pageInfo = pageInfo; + } + + public List<OrderInfo> getOrderInfoList() { + return this.orderInfoList; + } + + public void setOrderInfoList(List<OrderInfo> orderInfoList) { + this.orderInfoList = orderInfoList; + } + + public int getLevel() { + return this.level; + } + + public void setLevel(int level) { + this.level = level; + } + + public int getRecReturnMode() { + return this.recReturnMode; + } + + public void setRecReturnMode(int recReturnMode) { + this.recReturnMode = recReturnMode; + } + + public boolean isQueryISLeaf() { + return this.queryISLeaf; + } + + public void setQueryISLeaf(boolean queryISLeaf) { + this.queryISLeaf = queryISLeaf; + } + + public boolean isRightFlag() { + return this.rightFlag; + } + + public void setRightFlag(boolean rightFlag) { + this.rightFlag = rightFlag; + } + + public boolean isSecretFlag() { + return this.secretFlag; + } + + public void setSecretFlag(boolean secretFlag) { + this.secretFlag = secretFlag; + } +} diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/MenuVO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/MenuVO.java index 5c73e12..06cda7c 100644 --- a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/MenuVO.java +++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/MenuVO.java @@ -3,6 +3,7 @@ import java.io.Serializable; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -27,7 +28,7 @@ /** * 瀛愬瓩鑺傜偣 */ - private List<MenuVO> children; + private List<MenuVO> children = new ArrayList<>(); /** * 鏄惁鏈夊瓙瀛欒妭鐐� diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmFunctionQueryServicePlatformImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmFunctionQueryServicePlatformImpl.java index 7ee7870..daa7f5c 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmFunctionQueryServicePlatformImpl.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmFunctionQueryServicePlatformImpl.java @@ -508,78 +508,47 @@ return functionVOList.stream().sorted(Comparator.comparing(s -> s.getSort())).collect(Collectors.toList()); } - public List<MenuVO> findChildAuthFunctionVO(String parentId,MenuVO functionVO) throws PLException { -// List<FunctionInfo> menus = map.get(parentOid); + public void findChildAuthFunctionVO(MenuVO functionVO, boolean isAll) throws PLException { //0琛ㄧず娌℃湁妯″潡涔熸病鏈夋搷浣滐紝1琛ㄧず鏈夋ā鍧楋紝2琛ㄧず鏈夋搷浣� - long l = platformClientUtil.getFrameworkService().checkChildObject(parentId); - -// funcObj.setFuncType(funcType); -// -// if(funcType == 1){ -// FunctionObject[] funcObjs = new FunctionClientDelegate().getModuleListByParentId(funcObj.getId(),false); -// for(int i=0;i<funcObjs.length;i++){ -// VCIBaseTreeNode curNode = new VCIBaseTreeNode(funcObjs[i].getName(), funcObjs[i]); -// treeModel.insertNodeInto(curNode, node,node.getChildCount()); -// setChildNode(curNode,funcObjs[i]); -// } -// }else if(funcType == 2){ -// FuncOperationObject[] funcOperateObjs = new FuncOperationClientDelegate().getFuncOperationByModuleId(funcObj.getId(), "", true); -// for (int j = 0; j < funcOperateObjs.length; j++) { -// VCIBaseTreeNode childNode = new VCIBaseTreeNode(funcOperateObjs[j].getOperAlias(),funcOperateObjs[j]); -// UserObject user = rightManagementClient.fetchUserInfoByName(PLTApplication.getUserEntityObject().getUserName()); -//// if(user.getUserType() == 0 || childNode.toString().equals("鏌ョ湅")){ -//// treeModel.insertNodeInto(childNode, node,node.getChildCount()); -//// childNode.setLeaf(true); -//// }else{ -//// boolean res = initRoleRightByType(childNode); -//// if(res){ -// treeModel.insertNodeInto(childNode, node,node.getChildCount()); -// childNode.setLeaf(true); -//// } -//// } -// } -// }else{ -// functionVO.setHasChildren(false); -// } -// -// -// -// -// -// int funcType = funcDel.checkChildObject(funcObj.getId()); -// funcObj.setFuncType(funcType); -// -// - List<MenuVO> functionVOList = new ArrayList<>(); -// if(menus == null){ -// return functionVOList; -// } -// for (FunctionInfo menu : menus) { -// if(!menu.isValid){ -// continue; -// } -// MenuVO functionVO = new MenuVO(); -// functionVO.setId(menu.id); -// functionVO.setSource(menu.image); -//// if(StringUtils.isBlank(menu.resourceB) ){ -//// continue; -//// } -// functionVO.setPath(menu.resourceB); -// functionVO.setCode(menu.aliasName); -// functionVO.setAlias(menu.aliasName); -// functionVO.setParentId(menu.parentId); -// functionVO.setName(menu.name); -// functionVO.getMeta().put("keepAlive",false); -// functionVO.setSort((int) menu.seq); -// functionVO.setChildren(findChildAuthFunctionVO(menu.id,functionVO)); -// if(functionVO.getChildren().size() > 0){ -// functionVO.setHasChildren(true); -// }else { -// functionVO.setHasChildren(false); -// } -// functionVOList.add(functionVO); -// } - return functionVOList.stream().sorted(Comparator.comparing(s -> s.getSort())).collect(Collectors.toList()); + long type = platformClientUtil.getFrameworkService().checkChildObject(functionVO.getId()); + if(type == 1){ + FunctionInfo[] funcObjs = platformClientUtil.getFrameworkService().getModuleListByParentId(functionVO.getId(), isAll); + for (FunctionInfo funcObj : funcObjs) { + MenuVO menuVO = new MenuVO(); + menuVO.setId(funcObj.id); + menuVO.setSource(funcObj.image); + menuVO.setPath(funcObj.resourceB); + menuVO.setCode(funcObj.aliasName); + menuVO.setAlias(funcObj.aliasName); + menuVO.setParentId(funcObj.parentId); + menuVO.setChildType((int) type); + menuVO.setName(funcObj.name); + menuVO.getMeta().put("keepAlive",false); + menuVO.setSort((int) funcObj.seq); + findChildAuthFunctionVO(menuVO, isAll); + functionVO.getChildren().add(menuVO); + } + }else if(type == 2){ + FuncOperationInfo[] infos = platformClientUtil.getFrameworkService().getFuncOperationByModule(functionVO.getId(), "", true); + for (FuncOperationInfo info : infos) { + MenuVO menuVO = new MenuVO(); + menuVO.setChildType((int) type); + menuVO.setId(info.id); + menuVO.setFuncId(info.funcId); + menuVO.setCode(info.operIndentify); + menuVO.setOperId(info.operId); + menuVO.setName(info.operName); + menuVO.setAlias(info.operAlias); + menuVO.setRemark(info.operDesc); + menuVO.setSort((int) info.number); + menuVO.setModeType("FunctionObject"); + menuVO.setIsValid(info.isValid); + menuVO.setHasChildren(false); + functionVO.getChildren().add(menuVO); + } + }else{ + functionVO.setHasChildren(false); + } } @Override @@ -943,9 +912,9 @@ @Override public List<MenuVO> getSysModelAuthTreeMenuByPID(String parentId,String modeType,boolean isAll) throws VciBaseException, PLException { List<MenuVO> menuVOList = new ArrayList<>(); - if(Func.isBlank(parentId)){ - return menuVOList; - } +// if(Func.isBlank(parentId)){ +// return menuVOList; +// } SessionInfo sessionInfo = WebUtil.getCurrentUserSessionInfoNotException(); boolean adminOrDeveloperOrRoot = rightControlUtil.isAdminOrDeveloperOrRoot(sessionInfo.getUserId()); if (adminOrDeveloperOrRoot) { @@ -974,6 +943,7 @@ functionVO.setName(menu.name); functionVO.getMeta().put("keepAlive",false); functionVO.setSort((int) menu.seq); + findChildAuthFunctionVO(functionVO, isAll); // try { // functionVO.setChildren(findChildAuthFunctionVO(menu.id)); // } catch (PLException e) { @@ -989,58 +959,58 @@ } functionVOList.add(functionVO); } + return functionVOList; - - RoleRightInfo[] userRoleRights = rightControlUtil.getRoleRightByUserName(sessionInfo.getUserId()); - Map<String, List<FunctionInfo>> map = rightControlUtil.getAllChildrenFunctionsByUserName( - parentId, sessionInfo.getUserId(), userRoleRights); - - if(Func.isEmpty(map.get(parentId))) { - return functionVOList; - } - for (FunctionInfo menu : map.get(parentId)) { - if(!menu.isValid){ - continue; - } - MenuVO functionVO = new MenuVO(); - functionVO.setId(menu.id); - functionVO.setSource(menu.image); - //if(StringUtils.isBlank(menu.resourceB)){ - // continue; - //} - functionVO.setPath(menu.resourceB); - functionVO.setParentId(menu.parentId); - functionVO.setCode(menu.aliasName); - functionVO.setAlias(menu.aliasName); - functionVO.setName(menu.name); - functionVO.getMeta().put("keepAlive",false); - functionVO.setSort((int) menu.seq); -// try { -// functionVO.setChildren(findChildAuthFunctionVO(menu.id, map)); -// } catch (PLException e) { -// e.printStackTrace(); -// String errorMsg = "鑿滃崟鏌ヨ鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e); -// logger.error(errorMsg); -// throw new VciBaseException(errorMsg); +// RoleRightInfo[] userRoleRights = rightControlUtil.getRoleRightByUserName(sessionInfo.getUserId()); +// Map<String, List<FunctionInfo>> map = rightControlUtil.getAllChildrenFunctionsByUserName( +// parentId, sessionInfo.getUserId(), userRoleRights); +// +// if(Func.isEmpty(map.get(parentId))) { +// return functionVOList; +// } +// for (FunctionInfo menu : map.get(parentId)) { +// if(!menu.isValid){ +// continue; // } - if(functionVO.getChildren().size() > 0){ - functionVO.setHasChildren(true); - }else { - functionVO.setHasChildren(false); - } - functionVOList.add(functionVO); - } - //濡傛灉鏄紑鍙戞垨鑰呮祴璇曠敤鎴凤紝闇�鍝熻幏鍙栫郴缁熸ā鍧楅厤缃彍鍗� - if(adminOrDeveloperOrRoot){ - //鑾峰彇棣栭〉绯荤粺妯″潡閰嶇疆鑿滃崟 - MenuVO menuVO = JsonConfigReader.getSysModuleConf().getSysModuleNode(); - if(Func.isNotEmpty(menuVO)){ - functionVOList.add(menuVO); - } - } - return functionVOList.stream().sorted(Comparator.comparing(s -> s.getSort())).collect(Collectors.toList()); +// MenuVO functionVO = new MenuVO(); +// functionVO.setId(menu.id); +// functionVO.setSource(menu.image); +// //if(StringUtils.isBlank(menu.resourceB)){ +// // continue; +// //} +// functionVO.setPath(menu.resourceB); +// functionVO.setParentId(menu.parentId); +// functionVO.setCode(menu.aliasName); +// functionVO.setAlias(menu.aliasName); +// functionVO.setName(menu.name); +// functionVO.getMeta().put("keepAlive",false); +// functionVO.setSort((int) menu.seq); +//// try { +//// functionVO.setChildren(findChildAuthFunctionVO(menu.id, map)); +//// } catch (PLException e) { +//// e.printStackTrace(); +//// String errorMsg = "鑿滃崟鏌ヨ鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e); +//// logger.error(errorMsg); +//// throw new VciBaseException(errorMsg); +//// } +// if(functionVO.getChildren().size() > 0){ +// functionVO.setHasChildren(true); +// }else { +// functionVO.setHasChildren(false); +// } +// functionVOList.add(functionVO); +// } +// //濡傛灉鏄紑鍙戞垨鑰呮祴璇曠敤鎴凤紝闇�鍝熻幏鍙栫郴缁熸ā鍧楅厤缃彍鍗� +// if(adminOrDeveloperOrRoot){ +// //鑾峰彇棣栭〉绯荤粺妯″潡閰嶇疆鑿滃崟 +// MenuVO menuVO = JsonConfigReader.getSysModuleConf().getSysModuleNode(); +// if(Func.isNotEmpty(menuVO)){ +// functionVOList.add(menuVO); +// } +// } +// return functionVOList.stream().sorted(Comparator.comparing(s -> s.getSort())).collect(Collectors.toList()); diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/HMSysModConfigController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/HMSysModConfigController.java index 01f81e0..8f42517 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/HMSysModConfigController.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/HMSysModConfigController.java @@ -72,6 +72,25 @@ } } + + /** + * 鑾峰彇褰撳墠妯″潡涓嬬殑瀛愭ā鍧� + * @param parentId + * @param modeType + * @return + */ + @GetMapping("/getSysModelAuthTreeMenuByPID") + public BaseResult<List<MenuVO>> getSysModelAuthTreeMenuByPID(String parentId, String modeType) { + try { + return BaseResult.dataList(functionQueryService.getSysModelAuthTreeMenuByPID(parentId,modeType,true)); + }catch (Exception e){ + e.printStackTrace(); + String errorMsg = "鏌ヨ瀛愭ā鍧楁椂鍑虹幇閿欒锛屽師鍥狅細"+ VciBaseUtil.getExceptionMessage(e); + logger.error(errorMsg); + throw new VciBaseException(errorMsg); + } + } + /** * 娣诲姞妯″潡 * @param menuVO diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsQueryTemplateController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsQueryTemplateController.java index c81ec59..2db280d 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsQueryTemplateController.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsQueryTemplateController.java @@ -62,6 +62,7 @@ * 鏌ヨ妯℃澘鐨勫垪琛ㄦ坊鍔犱簡瀛楁鐨勭浉鍏冲睘鎬� * @param btmName 绫诲瀷 * @param linkFlag 鏄惁閾炬帴绫诲瀷 锛歵rue 閾炬帴绫诲瀷 锛宖alse 涓氬姟绫诲瀷 + * @param direction 姝e弽鏂瑰悜 * @return 鏌ヨ妯℃澘鐨勫垪琛� */ @GetMapping("/queryTemplateListByAttr") diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsQuereyTemplateServiceI.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsQuereyTemplateServiceI.java index 96d2986..7f0b927 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsQuereyTemplateServiceI.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsQuereyTemplateServiceI.java @@ -157,6 +157,7 @@ * 鏌ヨ妯℃澘鐨勫垪琛ㄦ坊鍔犱簡瀛楁鐨勭浉鍏冲睘鎬� * @param btmName 绫诲瀷 * @param linkFlag 鏄惁閾炬帴绫诲瀷 锛歵rue 閾炬帴绫诲瀷 锛宖alse 涓氬姟绫诲瀷 + * @param direction 姝e弽鏂瑰悜 * @return 鏌ヨ妯℃澘鐨勫垪琛� */ BaseResult queryTemplateListByAttr(String btmName, Boolean linkFlag, String direction) throws PLException; diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsQueryTemplateImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsQueryTemplateImpl.java index 79a32e7..5b993f0 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsQueryTemplateImpl.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsQueryTemplateImpl.java @@ -16,9 +16,7 @@ import com.vci.corba.omd.ltm.LinkType; import com.vci.corba.omd.qtm.QTD; import com.vci.corba.omd.qtm.QTInfo; -import com.vci.dto.AttributeDefDTO; -import com.vci.dto.QTDDTO; -import com.vci.dto.QTInfoDTO; +import com.vci.dto.*; import com.vci.omd.constants.SystemAttribute; import com.vci.omd.objects.OtherInfo; import com.vci.po.OsLinkTypePO; @@ -196,6 +194,9 @@ VciBaseUtil.alertNotNull(btName,"绫诲瀷鍚�"); QTInfo[] objTypeQTs = platformClientUtil.getQTDService().getObjTypeQTs(btName); List<QTInfoDTO> dtos = new ArrayList<>(); + Map<String, AttributeDef> allSysAttr = Arrays.stream(platformClientUtil.getBtmService().getSysAttributeDefs()).collect(Collectors.toMap(e -> e.name, e -> e)); + allSysAttr.putAll(Arrays.stream(platformClientUtil.getLinkTypeService().getSysAttributeDefs()).collect(Collectors.toMap(e -> e.name, e -> e))); + for (QTInfo obj : objTypeQTs) { QTInfoDTO qtInfoDTO = new QTInfoDTO(); qtInfoDTO.setCreator(obj.creator); @@ -206,13 +207,84 @@ qtInfoDTO.setQtUIText(obj.qtUIText); if(StringUtils.isNotBlank(obj.qtUIText)){ //灏嗙粰瀹氱殑String鏂囨湰瑙f瀽涓篨ML鏂囨。骞惰繑鍥炴柊鍒涘缓鐨刣ocument - qtInfoDTO.setTree(analysisXml(obj)); + qtInfoDTO.setTree(analysisXml(obj, allSysAttr)); } - qtInfoDTO.setQueryTemplate(OQTool.getQTByDoc(DocumentHelper.parseText(obj.qtText), obj.qtName)); + QueryTemplate qtByDoc = OQTool.getQTByDoc(DocumentHelper.parseText(obj.qtText), obj.qtName); + qtInfoDTO.setQueryTemplate(queryTemplateToDto(qtByDoc, allSysAttr)); qtInfoDTO.setCreateTimeText(DateFormatUtils.format(new Date(obj.createTime), DateUtil.PATTERN_DATETIME)); dtos.add(qtInfoDTO); } return BaseResult.dataList(dtos); + } + + /** + * 瀵硅薄杞崲 + * @param qtByDoc 妯℃澘瀵硅薄 + * @param allSysAttr 鎵�鏈夌郴缁熷睘鎬� + * @return 妯℃澘浼犺緭瀵硅薄 + * @throws PLException + */ + private QueryTemplateDTO queryTemplateToDto(QueryTemplate qtByDoc, Map<String, AttributeDef> allSysAttr) throws PLException { + QueryTemplateDTO dto = new QueryTemplateDTO(); + dto.setId(qtByDoc.getId()); + dto.setBtmType(qtByDoc.getBtmType()); + dto.setDirection(qtByDoc.getDirection()); + dto.setLevel(qtByDoc.getLevel()); + dto.setQueryChildrenFlag(qtByDoc.isQueryChildren()); + dto.setQueryISLeaf(qtByDoc.isQueryISLeaf()); + dto.setClauseList(qtByDoc.getClauseList()); + dto.setPageInfo(qtByDoc.getPageInfo()); + dto.setLinkType(qtByDoc.getLinkType()); + dto.setVersion(qtByDoc.getVersion()); + dto.setType(qtByDoc.getType()); + dto.setSecretFlag(qtByDoc.isSecretFlag()); + dto.setRightFlag(qtByDoc.isRightFlag()); + dto.setOrderInfoList(qtByDoc.getOrderInfoList()); + dto.setRecReturnMode(qtByDoc.getRecReturnMode()); + Condition con = qtByDoc.getCondition(); + if(con != null){ + ConditionDTO conDto = new ConditionDTO(); + conDto.setRootCIName(con.getRootCIName()); + Map<String, ConditionItem> ciMap = con.getCIMap(); + Map<String, ConditionItemDTO> ciMapDto = new HashMap<>(); + for (String key : ciMap.keySet()) { + ConditionItem item = ciMap.get(key); + LeafInfo leafInfo = item.getLeafInfo(); + ConditionItemDTO itemDTO = new ConditionItemDTO(); + itemDTO.setChildrenInfo(item.getChildrenInfo()); + itemDTO.setId(item.getId()); + itemDTO.setLeafFlag(item.isLeaf()); + ciMapDto.put(key, itemDTO); + if(leafInfo == null){ + continue; + } + LeafInfoDTO leafInfoDTO = new LeafInfoDTO(); + itemDTO.setLeafInfo(leafInfoDTO); + //澶勭悊鏌ヨ瀛楁绫诲瀷 + String column = leafInfo.getClause(); + if(column.contains(".")){ + column = StringUtils.substringAfterLast(column, "."); + } + AttributeDef att = platformClientUtil.getAttributeService().getAttributeDefByName(column); + if(att == null || "".equals(att.oid)){ + att = allSysAttr.get(column.toLowerCase()); + } + leafInfoDTO.setClause(leafInfo.getClause()); + + leafInfoDTO.setOperator(leafInfo.getOperator()); + leafInfoDTO.setType(att.vtDataType); + if(leafInfo.getValue() != null ){ + LeafValueDto valueDto = new LeafValueDto(); + valueDto.setOrdinaryValue(leafInfo.getValue().getOrdinaryValue()); + valueDto.setQueryTemplate(leafInfo.getValue().getQueryTemplate() != null ? queryTemplateToDto(leafInfo.getValue().getQueryTemplate(),allSysAttr) : null); + leafInfoDTO.setValue(valueDto); + } + + } + conDto.setCIMap(ciMapDto); + dto.setCondition(conDto); + } + return dto; } /** @@ -221,14 +293,13 @@ * @return * @throws DocumentException */ - private HashMap<String,Object> analysisXml(QTInfo obj) throws DocumentException { + private HashMap<String,Object> analysisXml(QTInfo obj, Map<String, AttributeDef> allSysAttr) throws DocumentException, PLException { org.dom4j.Document document = DocumentHelper.parseText(obj.qtUIText); if(document == null){ return null; } //鑾峰彇鏍硅妭鐐�,鍦ㄤ緥瀛愪腑灏辨槸responsedata鑺傜偣 Element root = document.getRootElement(); - List<HashMap<String,Object>> treeList = new ArrayList<>(); HashMap<String,Object> treeMap = new HashMap<>(); treeMap.put("connector",root.getText()); List<Element> children = root.elements(); @@ -236,9 +307,20 @@ for(Iterator<Element> i = children.iterator(); i.hasNext();){ Element child = i.next(); if(AND.equals(child.getText()) || OR.equals(child.getText())){ - childList.add(addDefaultMutableTree(child)); + childList.add(addDefaultMutableTree(child, allSysAttr)); }else { - childList.add(child.getText().trim()); + String column = StringUtils.substringBefore(child.getText().trim(), " "); + + if(column.contains(".")){ + column = StringUtils.substringAfterLast(column, "."); + } + AttributeDef att = platformClientUtil.getAttributeService().getAttributeDefByName(column); + if(att == null || "".equals(att.oid)){ + att = allSysAttr.get(column.toLowerCase()); + } + HashMap<String, String> data = new HashMap<>(); + data.put("column",child.getText().trim()); + data.put("type",att.vtDataType); } } treeMap.put("child",childList); @@ -249,7 +331,7 @@ * 灏嗗瓙鑺傜偣杞负map缁撴瀯 * @param element */ - public Map<String, Object> addDefaultMutableTree(Element element){ + public Map<String, Object> addDefaultMutableTree(Element element, Map<String, AttributeDef> allSysAttr) throws PLException { List<Object> childList = new ArrayList<>(); List<Element> children = element.elements(); HashMap<String,Object> treeMap = new HashMap<>(); @@ -257,9 +339,21 @@ for(Iterator<Element> i = children.iterator(); i.hasNext();){ Element child = i.next(); if(AND.equals(child.getText()) || OR.equals(child.getText())){ - childList.add(addDefaultMutableTree(child)); + childList.add(addDefaultMutableTree(child, allSysAttr)); }else { - childList.add(child.getText().trim()); + String column = StringUtils.substringBefore(child.getText().trim(), " "); + + if(column.contains(".")){ + column = StringUtils.substringAfterLast(column, "."); + } + AttributeDef att = platformClientUtil.getAttributeService().getAttributeDefByName(column); + if(att == null || "".equals(att.oid)){ + att = allSysAttr.get(column.toLowerCase()); + } + HashMap<String, String> data = new HashMap<>(); + data.put("column",child.getText().trim()); + data.put("type",att.vtDataType); + childList.add(data); } } treeMap.put("child",childList); @@ -1571,51 +1665,27 @@ tree.put("children", childList); return BaseResult.success(tree); } - + /** + * 鏌ヨ妯℃澘鐨勫垪琛ㄦ坊鍔犱簡瀛楁鐨勭浉鍏冲睘鎬� + * @param btmName 绫诲瀷 + * @param linkFlag 鏄惁閾炬帴绫诲瀷 锛歵rue 閾炬帴绫诲瀷 锛宖alse 涓氬姟绫诲瀷 + * @param direction 姝e弽鏂瑰悜 + * @return 鏌ヨ妯℃澘鐨勫垪琛� + */ @Override public BaseResult queryTemplateListByAttr(String btmName, Boolean linkFlag, String direction) throws PLException { //杩斿洖鐨勭晫闈笅鎷夋鏄剧ず鏍� List<QTDDTO> qtddtos = new ArrayList<>(); - + //灏嗛摼鎺ョ被鍨嬩笌涓氬姟绫诲瀷鐨勬墍鏈夐粯璁ゅ瓧娈垫煡璇㈠嚭鏉ユ斁鍒癿ap閲岄潰鏂逛究鍚庣画璋冪敤 Map<String, AttributeDef> allSysAttr = Arrays.stream(platformClientUtil.getBtmService().getSysAttributeDefs()).collect(Collectors.toMap(e -> e.name, e -> e)); - -// if(linkFlag){ -// QTD[] qtdArray = platformClientUtil.getQTDService().getLinkTypeQTDs(btmName); -// for (QTD qtd : qtdArray) { -// QTDDTO qtddto = new QTDDTO(); -// qtddto.setName(qtd.name); -// qtddto.setCreateTime(qtd.createTime); -// qtddto.setLinkTypeName(qtd.linkTypeName); -// qtddto.setBtmName(qtd.btmName); -// qtddto.setCreator(qtd.creator); -// for (String abName : qtd.abNames) { -// AttributeDef att = platformClientUtil.getAttributeService().getAttributeDefByName(abName); -// AttributeDefDTO attrDto = new AttributeDefDTO(); -// attrDto.setDescription(att.description); -// attrDto.setLabel(att.label); -// attrDto.setOid(att.oid); -// attrDto.setCreator(att.creator); -// attrDto.setName(att.name); -// attrDto.setDefValue(att.defValue); -// attrDto.setRage(att.rage); -// attrDto.setVtDataType(att.vtDataType); -// attrDto.setOther(att.other); -// qtddto.getAttrs().add(attrDto); -// } -// qtddtos.add(qtddto); -// } -// -// }else { -// Map<String, AttributeDef> lSysAttr = Arrays.stream(platformClientUtil.getLinkTypeService().getSysAttributeDefs()).collect(Collectors.toMap(e -> e.name, e -> e)); allSysAttr.putAll(Arrays.stream(platformClientUtil.getLinkTypeService().getSysAttributeDefs()).collect(Collectors.toMap(e -> e.name, e -> e))); QTD[] qtdArray = null; + //鏌ヨ鐩稿叧绫诲瀷鐨勬煡璇㈡ā鏉胯繘琛屽鐞� if(linkFlag){ qtdArray = platformClientUtil.getQTDService().getLinkTypeQTDs(btmName); }else { qtdArray = platformClientUtil.getQTDService().getBizTypeQTDs(btmName); } - -// QTD[] for (QTD qtd : qtdArray) { QTDDTO qtddto = new QTDDTO(); qtddto.setName(qtd.name); @@ -1625,13 +1695,20 @@ qtddto.setCreator(qtd.creator); for (String abName : qtd.abNames) { AttributeDef att = platformClientUtil.getAttributeService().getAttributeDefByName(abName); + //濡傛灉鍦ㄥ睘鎬ф帴鍙d腑娌℃湁鏌ュ埌鐩稿叧瀛楁搴旇灏卞湪榛樿瀛楁涓� if(att == null || "".equals(att.oid)){ att = allSysAttr.get(abName.toLowerCase()); } if(direction != null) { if (direction.equals(QTConstants.DIRECTION_POSITIVE)) { + if(att == null ){ + throw new PLException("500",new String[]{"灞炴�у瓧娈�:"+ abName +"鏈煡璇㈠埌锛岃纭锛�"}); + } att.name = "T_OID." + abName; } else if (direction.equals(QTConstants.DIRECTION_OPPOSITE)) { + if(att == null ){ + throw new PLException("500",new String[]{"灞炴�у瓧娈�:"+ abName +"鏈煡璇㈠埌锛岃纭锛�"}); + } att.name = "F_OID." + abName; } }else{ @@ -1653,9 +1730,14 @@ } qtddtos.add(qtddto); } -// } - return BaseResult.dataList(Arrays.asList(qtddtos)); + return BaseResult.dataList(qtddtos); } + + /** + * 瀛愯妭鐐瑰鐞� + * @param attributeDefByName 鐖惰妭鐐圭殑灞炴�т俊鎭� + * @param allSysAttr 鎵�鏈夐粯璁ゅ瓧娈� + */ private void addNode(AttributeDefDTO attributeDefByName, Map<String, AttributeDef> allSysAttr){ if(attributeDefByName.getLayersNum() >= 3){ @@ -1666,7 +1748,6 @@ if(abName.contains(".")){ abName = abName.substring(abName.lastIndexOf(".") + 1); } -// qtddto.getAttrs().add(attributeDefByName); if(SystemAttribute.sysAttList().contains(abName.toUpperCase())){ return; } @@ -1706,10 +1787,7 @@ addNode(attrDto, allSysAttr); } //绯荤粺灞炴�D,NAME,DESCRIPTION -// AttributeDef[] sysAttributeDefs = platformClientUtil.getBtmService().getSysAttributeDefs(); -// for (int i = 0; i < sysAttributeDefs.length; i++) { for (int i = 0; i < SystemAttribute.bosysAttList().size(); i++) { -// addNode(node, new DefaultMutableTreeNode(pName + SystemAttribute.bosysAttList().get(i))); AttributeDef attributeDef = allSysAttr.get(SystemAttribute.bosysAttList().get(i).toLowerCase()); AttributeDefDTO attrDto = new AttributeDefDTO(); attrDto.setDescription(attributeDef.description); @@ -1743,7 +1821,6 @@ String[] abNames = link.attributes; for(int i = 0; i < abNames.length; i++){ String abName_ = abNames[i]; -// DefaultMutableTreeNode node_ = new DefaultMutableTreeNode(pName + abName_); AttributeDef att = platformClientUtil.getAttributeService().getAttributeDefByName(abName_); if(att == null || att.oid.equals("")){ att = allSysAttr.get(abName_.toLowerCase()); @@ -1764,11 +1841,6 @@ } //绯荤粺灞炴�D,NAME,DESCRIPTION for (int i = 0; i < SystemAttribute.losysAttList().size(); i++) { -// addNode(node, new DefaultMutableTreeNode(pName + SystemAttribute.losysAttList().get(i))); -// } -// AttributeDef[] sysAttributeDefs = platformClientUtil.getLinkTypeService().getSysAttributeDefs(); -// for (int i = 0; i < sysAttributeDefs.length; i++) { -// addNode(node, new DefaultMutableTreeNode(pName + SystemAttribute.bosysAttList().get(i))); AttributeDef sysAttributeDefs = allSysAttr.get(SystemAttribute.losysAttList().get(i).toLowerCase()); AttributeDefDTO attrDto = new AttributeDefDTO(); attrDto.setDescription(sysAttributeDefs.description); -- Gitblit v1.9.3