From b6ef015671d5fe68964dabb44d08703ac603feca Mon Sep 17 00:00:00 2001 From: ludc Date: 星期二, 03 九月 2024 10:58:18 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmFunctionQueryServicePlatformImpl.java | 334 +++++++++++++++++++++++++++ Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsQueryTemplateController.java | 39 +- Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/AttributeDefDTO.java | 39 +++ Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/QTDDTO.java | 46 +++ Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/MenuVO.java | 4 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsQueryTemplateImpl.java | 232 +++++++++++++++++++ Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsQuereyTemplateServiceI.java | 12 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/ISmFunctionQueryService.java | 9 8 files changed, 688 insertions(+), 27 deletions(-) diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/AttributeDefDTO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/AttributeDefDTO.java new file mode 100644 index 0000000..91427e5 --- /dev/null +++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/AttributeDefDTO.java @@ -0,0 +1,39 @@ +package com.vci.dto; + +import com.vci.corba.omd.atm.AttributeDef; +import lombok.Data; + +import java.util.ArrayList; +import java.util.List; + +/** + * 灞炴�т紶杈撳璞� + * @author yuxc + * @date 2024/09/02 10:15 + */ +@Data +public class AttributeDefDTO implements java.io.Serializable { + + /** + * 绂佹淇敼杩欎釜鍊� + */ + private static final long serialVersionUID = 2492852474710986720L; + public String oid; + public String name; + public String label; + public String vtDataType; + public String defValue; + public String ts; + public String creator; + public long createTime; + public String modifier; + public long modifyTime; + public String description; + public String rage; + public String other; + /** + * 灞傛暟 + */ + public int layersNum; + public List<AttributeDefDTO> attrs = new ArrayList<>(); +} diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/QTDDTO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/QTDDTO.java new file mode 100644 index 0000000..397138a --- /dev/null +++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/QTDDTO.java @@ -0,0 +1,46 @@ +package com.vci.dto; + +import com.vci.corba.omd.atm.AttributeDef; +import lombok.Data; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +/** + * 鏌ヨ妯℃澘浼犺緭瀵硅薄 + * @author weidy + * @date 2019/10/14 17:50 + */ +@Data +public class QTDDTO implements java.io.Serializable { + + /** + * 绂佹淇敼杩欎釜鍊� + */ + private static final long serialVersionUID = 2492852474710986720L; + /** + * 妯℃澘鍚嶇О + */ + public String name; + /** + * 鍒涘缓浜� + */ + public String creator; + /** + * 鍒涘缓鏃堕棿 + */ + public long createTime; + /** + * 涓氬姟绫诲瀷 + */ + public String btmName; + /** + * 閾炬帴绫诲瀷 + */ + public String linkTypeName; + /** + * 鎵�閫夋嫨鏌ヨ鐨勫瓧娈靛璞� + */ + public List<AttributeDefDTO> attrs = new ArrayList<>(); +} 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 66328b6..5c73e12 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 @@ -143,6 +143,10 @@ * 妯″潡涓嬪叧鑱旂殑鎿嶄綔绫诲瀷id */ private String operId; + /** + * 鏄惁鏈夋潈闄愶紝0娌℃湁锛�1鏈� + */ + private Integer havePermission; /** * 鍓嶇鏄惁闅愯棌 diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/ISmFunctionQueryService.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/ISmFunctionQueryService.java index 1be0596..9f04b2f 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/ISmFunctionQueryService.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/ISmFunctionQueryService.java @@ -62,6 +62,15 @@ * @throws VciBaseException */ List<MenuVO> getSysModelTreeMenuByPID(String parentId,String modeType,boolean isAll) throws VciBaseException; + /** + * 閫氳繃妯″潡ID鑾峰彇瀛愮骇鍒楄〃 + * @param parentId + * @param modeType 妯″潡绫诲瀷 + * @param isAll 鏄惁鍖呮嫭鏃犳晥鐨勬ā鍧楋紝true鍒欏寘鎷� + * @return + * @throws VciBaseException + */ + List<MenuVO> getSysModelAuthTreeMenuByPID(String parentId,String modeType,boolean isAll) throws VciBaseException, PLException; int checkChildObject(String moduleId) throws VciException; 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 8422fbc..7ee7870 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 @@ -4,13 +4,11 @@ import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONReader; import com.vci.client.ClientSession; +import com.vci.client.common.objects.RoleObject; import com.vci.common.exception.VciException; import com.vci.common.locale.LocaleDisplay; import com.vci.corba.common.PLException; -import com.vci.corba.framework.data.FuncOperationInfo; -import com.vci.corba.framework.data.FunctionInfo; -import com.vci.corba.framework.data.OperateInfo; -import com.vci.corba.framework.data.RoleRightInfo; +import com.vci.corba.framework.data.*; import com.vci.corba.omd.data.BusinessObject; import com.vci.corba.portal.data.PLUILayout; import com.vci.frameworkcore.compatibility.ISmFunctionQueryService; @@ -510,6 +508,80 @@ 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); + //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()); + } + @Override public UIContentVO getUIContentByBtmTypeAndId(TreeQueryObject treeQueryObject, ResourceControlTypeEnum resourceControlTypeEnum) throws PLException { SessionInfo sessionInfo = WebUtil.getCurrentUserSessionInfoNotException(); @@ -858,4 +930,258 @@ public void clearCache() { } + + + /** + * 閫氳繃妯″潡ID鑾峰彇瀛愮骇鍒楄〃 + * @param parentId + * @param modeType 妯″潡绫诲瀷 + * @param isAll 鏄惁鍖呮嫭鏃犳晥鐨勬ā鍧楋紝true鍒欏寘鎷� + * @return + * @throws VciBaseException + */ + @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; + } + SessionInfo sessionInfo = WebUtil.getCurrentUserSessionInfoNotException(); + boolean adminOrDeveloperOrRoot = rightControlUtil.isAdminOrDeveloperOrRoot(sessionInfo.getUserId()); + if (adminOrDeveloperOrRoot) { + //绯荤粺鑿滃崟 + parentId = SYSTEMMANAGMENTNODE; + } else if (rightControlUtil.isThreeAdminCurUser()) { + //涓夊憳杩斿洖绠$悊鍔熻兘妯″潡鐩稿叧鐨勮彍鍗� + parentId = SYSTEMMANAGMENTNODE; + } else { + //鏅�氱敤鎴峰彧杩斿洖涓氬姟鍔熻兘妯″潡鐩稿叧鐨勮彍鍗� + parentId = ROOT_MENU_ID; + } + List<MenuVO> functionVOList = new ArrayList<>(); + FunctionInfo[] moduleListByParentId = getModuleListByParentId(parentId, false); + for (FunctionInfo menu : moduleListByParentId) { + if(!menu.isValid){ + continue; + } + MenuVO functionVO = new MenuVO(); + functionVO.setId(menu.id); + functionVO.setSource(menu.image); + 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)); +// } 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); + } + + + + + 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); +// } + 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()); + + + + + +// +// +// +// +// boolean isFunctionObject = Func.isNotBlank(modeType) && modeType.equalsIgnoreCase("FunctionObject"); +// if(parentId.equals("systemManagmentNode") || parentId.equals("modelManagmentNode") || isFunctionObject){ +// int childType = this.checkChildObject(parentId); +// if(isFunctionObject){ +// try { +// /**鍒ゆ柇璇ユā鍧椾笅瀛愬璞℃槸妯″潡杩樻槸鎿嶄綔锛�0琛ㄧず鏃犲瓙鑺傜偣锛�1琛ㄧず鏄ā鍧楋紝2琛ㄧず鏄搷浣�**/ +// if(childType == 2){ +// try{ +// FuncOperationInfo[] infos = platformClientUtil.getFrameworkService().getFuncOperationByModule(parentId, "", false); +// if(Func.isNotEmpty(infos.length)){ +// childType = this.checkChildObject(infos[0].id); //閮芥槸鍚屼竴灞傛墍浠ュ彇绗竴涓嵆鍙煡璇㈡槸浠�涔堢被鍨� +// for(int i = 0;i < infos.length ;i++){ +// FuncOperationInfo info = infos[i]; +// MenuVO menuVO = new MenuVO(); +// menuVO.setChildType(childType); +// 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); +// menuVOList.add(menuVO); +// } +// } +// }catch (PLException e) { +// e.printStackTrace(); +// throw new VciBaseException(String.valueOf(e.code), e.messages); +// } +// }else if(childType == 1){ +// try{ +// FunctionInfo[] funcInfos = platformClientUtil.getFrameworkService().getModuleListByParentId(parentId, isAll); +// if(Func.isNotEmpty(funcInfos.length)){ +// childType = this.checkChildObject(funcInfos[0].id); //閮芥槸鍚屼竴灞傛墍浠ュ彇绗竴涓嵆鍙煡璇㈡槸浠�涔堢被鍨� +// for(int i = 0;i < funcInfos.length; i++){ +// FunctionInfo funcInfo = funcInfos[i]; +// MenuVO menuVO = this.functionInfoToMenuVO(funcInfo); +// menuVO.setChildType(childType); +// menuVO.setModeType("FunctionObject"); +// menuVOList.add(menuVO); +// } +// } +// }catch (PLException e) { +// e.printStackTrace(); +// throw new VciBaseException(String.valueOf(e.code),e.messages); +// } +// } +// } catch (Exception e) { +// e.printStackTrace(); +// throw new VciBaseException("妯″潡鏌ヨ鏃跺嚭鐜伴敊璇紝鍘熷洜锛�"+VciBaseUtil.getExceptionMessage(e)); +// } +// }else{ +// try{ +// MenuVO parentNode = null; +// //灏嗚繑鍥炵殑鑺傜偣澶栧眰濂椾笂褰撳墠鐖惰妭鐐� +// if("systemManagmentNode".equals(parentId)){ +// parentNode = JsonConfigReader.getSysModuleConf().getSystemManagmentNode(); +// }else if("modelManagmentNode".equals(parentId)){ +// parentNode = JsonConfigReader.getSysModuleConf().getModelManagmentNode(); +// } +// //濡傛灉鏌ヨ鐨勬槸绗竴灞傝妭鐐瑰氨闇�瑕佺洿鎺ヨ繑鍥瀞ystemManagmentNode鎴杕odelManagmentNode鑺傜偣 +// if(Func.isNotBlank(modeType) && modeType.equals("firstNode")){ +// menuVOList.add(parentNode); +// return menuVOList; +// } +// //鏌ヨ鐨勪笁绾ц妭鐐� +// FunctionInfo[] funcInfos = platformClientUtil.getFrameworkService().getModuleListByParentId(parentId, isAll); +// for(int i = 0;i < funcInfos.length; i++){ +// FunctionInfo funcInfo = funcInfos[i]; +// MenuVO menuVO = this.functionInfoToMenuVO(funcInfo); +// menuVO.setModeType("FunctionObject"); +// menuVO.setChildType(childType); +// menuVOList.add(menuVO); +// } +// return menuVOList; +// }catch (PLException e) { +// e.printStackTrace(); +// throw new VciBaseException(String.valueOf(e.code),e.messages); +// } +// } +// } +// else if(parentId.equals("operateNode")){ +// //鍔犺浇鎵�鏈夋搷浣� +// try{ +// //灏嗚繑鍥炵殑鑺傜偣澶栧眰濂椾笂褰撳墠鐖惰妭鐐� +// MenuVO parentNode = JsonConfigReader.getSysModuleConf().getOperateNode(); +// //濡傛灉鏌ヨ鐨勬槸绗竴灞傝妭鐐瑰氨闇�瑕佺洿鎺ヨ繑鍥瀞ysOptionNode鑺傜偣 +// if(Func.isNotBlank(modeType) && modeType.equals("firstNode")){ +// menuVOList.add(parentNode); +// return menuVOList; +// } +// OperateInfo[] operateInfos = platformClientUtil.getFrameworkService().getOperateTreeList(parentId); +// for(int i = 0; i < operateInfos.length;i++ ){ +// OperateInfo operateInfo = operateInfos[i]; +// MenuVO menuVO = new MenuVO(); +// menuVO.setId(operateInfo.id); +// menuVO.setName(operateInfo.name); +// menuVO.setCode(operateInfo.identify); +// menuVO.setAlias(operateInfo.alias); +// menuVO.setCategory(2); +// menuVO.setChildType(0); +// menuVO.setRemark(operateInfo.desc); +// menuVO.getMeta().put("keepAlive",false); +// menuVO.setSort((int) operateInfo.seq); +// menuVO.setModeType("operateObject"); +// menuVO.setHasChildren(false); +// menuVOList.add(menuVO); +// } +// }catch (PLException e) { +// e.printStackTrace(); +// throw new VciBaseException(String.valueOf(e.code),new String[]{VciBaseUtil.getExceptionMessage(e)}); +// } +// } +// return null; +// return menuVOList.stream().sorted(Comparator.comparing(s -> s.getSort())).collect(Collectors.toList()); + } + + + /** + * 閫氳繃妯″潡ID鑾峰彇瀛愮骇鍒楄〃 + * @param parentId + * @param isAll 鏄惁鍖呮嫭鏃犳晥鐨勬ā鍧楋紝true鍒欏寘鎷� + * @return + * @throws VciException + */ + public FunctionInfo[] getModuleListByParentId(String parentId,boolean isAll) throws PLException { + FunctionInfo[] funcInfos = null; + funcInfos = platformClientUtil.getFrameworkService().getModuleListByParentId(parentId, isAll); + return funcInfos; + } } 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 c2032a4..c81ec59 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 @@ -1,37 +1,23 @@ package com.vci.web.controller; import com.vci.corba.common.PLException; -import com.vci.corba.omd.ltm.LinkType; import com.vci.corba.omd.qtm.QTD; import com.vci.dto.QTInfoDTO; -import com.vci.pagemodel.OsBtmTypeAttributeVO; -import com.vci.pagemodel.OsBtmTypeVO; -import com.vci.pagemodel.OsLinkTypeAttributeVO; -import com.vci.pagemodel.OsLinkTypeVO; -import com.vci.starter.web.annotation.controller.VciUnCheckRight; -import com.vci.starter.web.annotation.log.VciBusinessLog; import com.vci.starter.web.exception.VciBaseException; -import com.vci.starter.web.pagemodel.BaseQueryObject; import com.vci.starter.web.pagemodel.BaseResult; -import com.vci.starter.web.pagemodel.DataGrid; import com.vci.starter.web.util.VciBaseUtil; -import com.vci.web.service.OsLinkTypeServiceI; import com.vci.web.service.OsQuereyTemplateServiceI; -import org.apache.commons.lang3.StringUtils; import org.dom4j.DocumentException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.Arrays; -import java.util.HashMap; import java.util.List; -import java.util.stream.Collectors; /** * 鏌ヨ妯℃澘鐨勬帶鍒跺櫒 @@ -63,6 +49,25 @@ public BaseResult queryTemplateList(String btmName,Boolean linkFlag){ try { return quereyTemplateServiceI.queryTemplateList(btmName,linkFlag); + } catch (PLException e) { + BaseResult objectBaseResult = new BaseResult<>(); + objectBaseResult.setCode(Integer.parseInt(e.code)); + objectBaseResult.setMsg(Arrays.toString(e.messages)); + return objectBaseResult; + } + } + + + /** + * 鏌ヨ妯℃澘鐨勫垪琛ㄦ坊鍔犱簡瀛楁鐨勭浉鍏冲睘鎬� + * @param btmName 绫诲瀷 + * @param linkFlag 鏄惁閾炬帴绫诲瀷 锛歵rue 閾炬帴绫诲瀷 锛宖alse 涓氬姟绫诲瀷 + * @return 鏌ヨ妯℃澘鐨勫垪琛� + */ + @GetMapping("/queryTemplateListByAttr") + public BaseResult queryTemplateListByAttr(String btmName,Boolean linkFlag, String direction){ + try { + return quereyTemplateServiceI.queryTemplateListByAttr(btmName,linkFlag,direction); } catch (PLException e) { BaseResult objectBaseResult = new BaseResult<>(); objectBaseResult.setCode(Integer.parseInt(e.code)); @@ -277,13 +282,13 @@ /** * 鏌ヨ鏂规鍒犻櫎 - * @param templateNames 鏌ヨ鏂规鍚� + * @param names 鏌ヨ鏂规鍚� * @return 鎿嶄綔缁撴灉 */ @DeleteMapping("/deleteLinkTemplate") - public BaseResult deleteLinkTemplate(@RequestBody List<String> templateNames){ + public BaseResult deleteLinkTemplate(String names){ try { - return quereyTemplateServiceI.deleteLinkTemplate(templateNames); + return quereyTemplateServiceI.deleteLinkTemplate(names); } catch (PLException e) { BaseResult objectBaseResult = new BaseResult<>(); objectBaseResult.setCode(Integer.parseInt(e.code)); 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 4b2f1fa..96d2986 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 @@ -102,10 +102,10 @@ BaseResult impLinkTemplate(MultipartFile file) throws IOException, ClassNotFoundException; /** * 鏌ヨ鏂规鍒犻櫎 - * @param templateNames 鏌ヨ鏂规鍚� + * @param names 鏌ヨ鏂规鍚� * @return 鎿嶄綔缁撴灉 */ - BaseResult deleteLinkTemplate(List<String> templateNames) throws PLException; + BaseResult deleteLinkTemplate(String names) throws PLException; /** * 鏌ヨ鏉′欢涓嬬殑鏌ヨ鎸夐挳 @@ -153,5 +153,11 @@ * @return 瀵煎叆缁撴灉 */ BaseResult impBtmTemplate(MultipartFile file) throws IOException, ClassNotFoundException; - + /** + * 鏌ヨ妯℃澘鐨勫垪琛ㄦ坊鍔犱簡瀛楁鐨勭浉鍏冲睘鎬� + * @param btmName 绫诲瀷 + * @param linkFlag 鏄惁閾炬帴绫诲瀷 锛歵rue 閾炬帴绫诲瀷 锛宖alse 涓氬姟绫诲瀷 + * @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 83fd63d..79a32e7 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,7 +16,10 @@ 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.omd.constants.SystemAttribute; import com.vci.omd.objects.OtherInfo; import com.vci.po.OsLinkTypePO; import com.vci.starter.poi.bo.ReadExcelOption; @@ -1332,12 +1335,16 @@ } /** * 鏌ヨ鏂规鍒犻櫎 - * @param templateNames 鏌ヨ鏂规鍚� + * @param names 鏌ヨ鏂规鍚� * @return 鎿嶄綔缁撴灉 */ @Override - public BaseResult deleteLinkTemplate(List<String> templateNames) throws PLException { - boolean b = platformClientUtil.getQTDService().deleteQTs(templateNames.toArray(new String[0])); + public BaseResult deleteLinkTemplate(String names) throws PLException { + if(StringUtils.isBlank(names)){ + return BaseResult.fail("璇烽�夋嫨鏌ヨ鏂规锛�"); + } + String[] nameSplit = names.split(","); + boolean b = platformClientUtil.getQTDService().deleteQTs(nameSplit); if(!b){ return BaseResult.fail("鍒犻櫎澶辫触锛侊紒锛�"); } @@ -1565,6 +1572,225 @@ return BaseResult.success(tree); } + @Override + public BaseResult queryTemplateListByAttr(String btmName, Boolean linkFlag, String direction) throws PLException { + //杩斿洖鐨勭晫闈笅鎷夋鏄剧ず鏍� + List<QTDDTO> qtddtos = new ArrayList<>(); + + 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); + 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); + if(att == null || "".equals(att.oid)){ + att = allSysAttr.get(abName.toLowerCase()); + } + if(direction != null) { + if (direction.equals(QTConstants.DIRECTION_POSITIVE)) { + att.name = "T_OID." + abName; + } else if (direction.equals(QTConstants.DIRECTION_OPPOSITE)) { + att.name = "F_OID." + abName; + } + }else{ + att.name = 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.setLayersNum(1); + attrDto.setRage(att.rage); + attrDto.setVtDataType(att.vtDataType); + attrDto.setOther(att.other); + qtddto.getAttrs().add(attrDto); + addNode(attrDto, allSysAttr); + } + qtddtos.add(qtddto); + } +// } + return BaseResult.dataList(Arrays.asList(qtddtos)); + } + private void addNode(AttributeDefDTO attributeDefByName, Map<String, AttributeDef> allSysAttr){ + + if(attributeDefByName.getLayersNum() >= 3){ + return; + } + String abName = attributeDefByName.name; + //鍙杗ode涓婄殑鏈�鍚庝竴涓睘鎬у悕 + if(abName.contains(".")){ + abName = abName.substring(abName.lastIndexOf(".") + 1); + } +// qtddto.getAttrs().add(attributeDefByName); + if(SystemAttribute.sysAttList().contains(abName.toUpperCase())){ + return; + } + AttributeDef abItem = null; + try { + abItem = platformClientUtil.getAttributeService().getAttributeDefByName(abName); + String other = abItem.other; +// String btmName = ApProvider.getInstance().getOtherValueByType(other, BTM); + OtherInfo otherInfo = OtherInfo.getOtherInfoByText(other); + int refFlag = otherInfo.getRefFlag(); + String refTypeName = otherInfo.getRefTypeName(); + if(refFlag != -1){ + //鍙傜収涓氬姟绫诲瀷 + if(refFlag == 0){ + //pName: 涓哄弬鐓у睘鎬у悕鍔犱笂璺緞 + String pName = attributeDefByName.name + "."; + String[] abNames = platformClientUtil.getBtmService().getAttributeNames(refTypeName); + for(int i = 0; i < abNames.length; i++){ + String abName_ = abNames[i]; + AttributeDef att = platformClientUtil.getAttributeService().getAttributeDefByName(abName_); + if(att == null || "".equals(att.oid)){ + att = allSysAttr.get(abName_.toLowerCase()); + } + att.name = pName + abName_ ; + AttributeDefDTO attrDto = new AttributeDefDTO(); + attrDto.setDescription(att.description); + attrDto.setLabel(att.label); + attrDto.setOid(att.oid); + attrDto.setLayersNum(attributeDefByName.getLayersNum() + 1); + attrDto.setCreator(att.creator); + attrDto.setName(att.name); + attrDto.setDefValue(att.defValue); + attrDto.setRage(att.rage); + attrDto.setVtDataType(att.vtDataType); + attrDto.setOther(att.other); + attributeDefByName.getAttrs().add(attrDto); + 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); + attrDto.setLabel(attributeDef.label); + attrDto.setOid(attributeDef.oid); + attrDto.setLayersNum(attributeDefByName.getLayersNum() + 1); + attrDto.setCreator(attributeDef.creator); + attrDto.setName(pName + SystemAttribute.bosysAttList().get(i)); + attrDto.setDefValue(attributeDef.defValue); + attrDto.setRage(attributeDef.rage); + attrDto.setVtDataType(attributeDef.vtDataType); + attrDto.setOther(attributeDef.other); + attributeDefByName.getAttrs().add(attrDto); + addNode(attrDto, allSysAttr); + } + //鍙傜収閾炬帴绫诲瀷 + }else if(refFlag == 1){ + //pName: 涓哄弬鐓у睘鎬у悕鍔犱笂璺緞 + String pName = attributeDefByName.name + "."; + LinkType link = null; + try { + link = platformClientUtil.getLinkTypeService().getLinkType(refTypeName); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (Throwable e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + if(link != null){ + 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()); + } + AttributeDefDTO attrDto = new AttributeDefDTO(); + attrDto.setDescription(att.description); + attrDto.setLabel(att.label); + attrDto.setOid(att.oid); + attrDto.setLayersNum(attributeDefByName.getLayersNum() + 1); + attrDto.setCreator(att.creator); + attrDto.setName(pName + abName_); + attrDto.setDefValue(att.defValue); + attrDto.setRage(att.rage); + attrDto.setVtDataType(att.vtDataType); + attrDto.setOther(att.other); + attributeDefByName.getAttrs().add(attrDto); + addNode(attrDto, allSysAttr); + } + //绯荤粺灞炴�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); + attrDto.setLabel(sysAttributeDefs.label); + attrDto.setOid(sysAttributeDefs.oid); + attrDto.setLayersNum(attributeDefByName.getLayersNum() + 1); + attrDto.setCreator(sysAttributeDefs.creator); + attrDto.setName(pName + SystemAttribute.losysAttList().get(i)); + attrDto.setDefValue(sysAttributeDefs.defValue); + attrDto.setRage(sysAttributeDefs.rage); + attrDto.setVtDataType(sysAttributeDefs.vtDataType); + attrDto.setOther(sysAttributeDefs.other); + attributeDefByName.getAttrs().add(attrDto); + addNode(attrDto, allSysAttr); + } + } + } + } + } catch (PLException e) { + e.printStackTrace(); + } + } // 鏁版嵁杩囨护 private void addImportBtmData(BtmQTExportData qtExportData, List<BizType> ltsNew, List<QTInfo> qTWrapperNew, Map<String/* 绫诲瀷鍚嶇О */, QTD[]/* 鏌ヨ妯℃澘瀹氫箟 */> norepQTDs) { -- Gitblit v1.9.3