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; } } 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; } } 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; } } 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; } } 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<>(); 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; } } 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<>(); /** * æ¯å¦æååèç¹ 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()); 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 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 æ¯å¦é¾æ¥ç±»å ï¼true 龿¥ç±»å ï¼false ä¸å¡ç±»å * @param direction æ£åæ¹å * @return æ¥è¯¢æ¨¡æ¿çå表 */ @GetMapping("/queryTemplateListByAttr") 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 æ¯å¦é¾æ¥ç±»å ï¼true 龿¥ç±»å ï¼false ä¸å¡ç±»å * @param direction æ£åæ¹å * @return æ¥è¯¢æ¨¡æ¿çå表 */ BaseResult queryTemplateListByAttr(String btmName, Boolean linkFlag, String direction) throws PLException; 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ææ¬è§£æä¸ºXMLææ¡£å¹¶è¿åæ°å建çdocument 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 æ¯å¦é¾æ¥ç±»å ï¼true 龿¥ç±»å ï¼false ä¸å¡ç±»å * @param direction æ£åæ¹å * @return æ¥è¯¢æ¨¡æ¿çå表 */ @Override public BaseResult queryTemplateListByAttr(String btmName, Boolean linkFlag, String direction) throws PLException { //è¿åççé¢ä¸ææ¡æ¾ç¤ºæ List<QTDDTO> qtddtos = new ArrayList<>(); //å°é¾æ¥ç±»åä¸ä¸å¡ç±»åçææé»è®¤å段æ¥è¯¢åºæ¥æ¾å°mapé颿¹ä¾¿åç»è°ç¨ 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); //妿å¨å±æ§æ¥å£ä¸æ²¡ææ¥å°ç¸å ³å段åºè¯¥å°±å¨é»è®¤åæ®µä¸ 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); } //ç³»ç»å±æ§ID,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 @@ } //ç³»ç»å±æ§ID,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);