From e51b66b8a4a502e31f3f0056012e4eb4863f3d8e Mon Sep 17 00:00:00 2001 From: ludc Date: 星期五, 06 十二月 2024 16:12:44 +0800 Subject: [PATCH] UI数据查询接口添加支持自定义类查询方式查询的代码逻辑 --- Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/uidataservice/impl/UIDataCommonServiceImpl.java | 362 +++++++++++++++++++++++++++------------------------ 1 files changed, 189 insertions(+), 173 deletions(-) diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/uidataservice/impl/UIDataCommonServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/uidataservice/impl/UIDataCommonServiceImpl.java index b2ccd03..ffcfde3 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/uidataservice/impl/UIDataCommonServiceImpl.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/uidataservice/impl/UIDataCommonServiceImpl.java @@ -258,7 +258,6 @@ } //鍏堝垽鏂煡璇㈡ā鏉挎槸鍚﹂厤缃簡鑷畾涔夋煡璇㈢被 UIComponentVO componentVO = uiEngineService.getComponentByOid(formQuery.getComponentOid(), null); - UIFormDefineVO formDefineVO = componentVO.getFormDefineVO(); //UIFormDefineVO formDefineVO = uiEngineService.getFormById(formQuery.getBtmName(),formQuery.getFormDefineId()); String bsCustQueryCLsOrUrl = componentVO.getBsCustQueryCLsOrUrl(); if(Func.isNotBlank(bsCustQueryCLsOrUrl) && isCustomClass(bsCustQueryCLsOrUrl)){ @@ -269,7 +268,7 @@ // 鍒涘缓绫荤殑瀹炰緥 Object instance = clazz.getDeclaredConstructor().newInstance(); // 鑾峰彇鏂规硶getDataForGrid锛堣鏂规硶鏄帴鍙d腑缁熶竴瀹氫箟鐨勬柟娉曪級 - Method method = clazz.getMethod("getDataForForm", UIDataGridQuery.class); + Method method = clazz.getMethod("getDataForForm", UIFormQuery.class); // 璋冪敤鏂规硶 UIFormDataVO uiFormDataVO = (UIFormDataVO) method.invoke(instance, formQuery); return uiFormDataVO; @@ -278,6 +277,7 @@ throw new VciBaseException("鑾峰彇琛ㄦ牸鏁版嵁鏃跺嚭鐜伴敊璇紝鍘熷洜锛�"+e.getMessage()); } }else{ + UIFormDefineVO formDefineVO = componentVO.getFormDefineVO(); String queryTemplate = !CollectionUtils.isEmpty(formQuery.getSourceData())? (String) formQuery.getSourceData().getOrDefault("querytemplate",formDefineVO.getQueryTemplateName()) :formDefineVO.getQueryTemplateName(); Set<String> queryFieldList = formDefineVO.getItems().stream().filter(s->!UIFieldTypeEnum.CUSTOM.getValue().equalsIgnoreCase(s.getType())).map(UIFormItemVO::getField).collect(Collectors.toSet()); //鑾峰彇鍙傜収 @@ -417,149 +417,195 @@ if(componentVO == null || StringUtils.isBlank(componentVO.getOid())){ throw new VciBaseException("鏍戠殑閰嶇疆淇℃伅娌℃湁鑾峰彇鍒�"); } - //鏍戝舰鏈変袱绉嶏紝涓�绉嶆槸涓氬姟绫诲瀷閲岃嚜鍙傜収锛屼竴绉嶆槸閾炬帴绫诲瀷 - UITreeDefineVO treeDefineVO = componentVO.getTreeDefineVO(); - if(treeDefineVO == null){ - throw new VciBaseException("杩欎釜缁勪欢涓嶆槸鏍�"); - } - if(!treeQuery.isLinkTypeFlag() && StringUtils.isBlank(treeQuery.getParentBtmName())){ - treeQuery.setParentBtmName(treeQuery.getBtmName()); - } - //TODO: 鏇挎崲鏍戝畾涔変笂鐨勬鍙嶅悜鏌ヨ灞炴�э紝鍥犱负姝e弽鍚戞煡璇㈡槸鐢遍摼鎺ョ被鍨嬫煡璇㈡ā鏉夸笂鎺у埗鐨� - boolean isOrientation = false; //鏄惁鍙嶅悜锛屼娇鐢ㄦā鏉夸笂閰嶇疆鐨� - String qtName = treeDefineVO.getQueryTemplateName(); - if(Func.isNotBlank(treeDefineVO.getLinkType()) && Func.isNotBlank(qtName)){ - QTInfo wrapper = platformClientUtil.getQTDService().getQT(qtName); - QueryTemplate qt = OQTool.getQTByDoc(DocumentHelper.parseText(wrapper.qtText), qtName); - isOrientation = qt.getDirection().equals("opposite"); - } - if(treeQuery.getConditionMap() == null){ - treeQuery.setConditionMap(new HashMap<>()); - } - if(treeQuery.getExtandParamsMap() != null){ - treeQuery.getConditionMap().putAll(treeQuery.getExtandParamsMap()); - } - String parentFieldName = treeQuery.getParentFieldName(); - if(parentFieldName.contains(",")){ - parentFieldName = parentFieldName.split(",")[0]; - } - if(StringUtils.isNotBlank(parentFieldName)){ - if(StringUtils.isNotBlank(treeQuery.getParentOid())){ - treeQuery.getConditionMap().put(parentFieldName,treeQuery.getParentOid()); - } - } - if(StringUtils.isNotBlank(treeQuery.getParentOid()) && treeQuery.getParentOid().contains(TREE_NODE_ID_SEP)){ - treeQuery.setParentOid(treeQuery.getParentOid().split(TREE_NODE_ID_SEP)[1]); - } - String queryTemplate = StringUtils.isNotBlank(treeQuery.getQueryTemplate())?treeQuery.getQueryTemplate():(!CollectionUtils.isEmpty(treeQuery.getSourceData())? (String) treeQuery.getSourceData().getOrDefault("querytemplate",treeDefineVO.getQueryTemplateName()) :treeDefineVO.getQueryTemplateName()); - String valueField = treeQuery.isLinkTypeFlag()?(!isOrientation?"${oid}" + TREE_NODE_ID_SEP + "${t_oid}":"${oid}" + TREE_NODE_ID_SEP + "${f_oid}"):(StringUtils.isNotBlank(treeQuery.getValueField())?treeQuery.getValueField():"oid"); - String textField = StringUtils.isNotBlank(treeDefineVO.getTreeNodeExpression())?treeDefineVO.getTreeNodeExpression():(StringUtils.isNotBlank(treeQuery.getTextField())?treeQuery.getTextField():"name"); - List<UIDataTree> rootTreeList = new ArrayList<>(); - List<String> queryFieldList = new ArrayList<>(); - queryFieldList.add("creator_name"); - queryFieldList.add("lastmodifier_name"); - String rootExpress = StringUtils.isNotBlank(treeQuery.getRootExpress())?treeQuery.getRootExpress():treeDefineVO.getRootContent(); - Map<String, Object> replaceMap = wrapperReplaceMap(treeQuery.getSourceData()); - if(StringUtils.isBlank(treeDefineVO.getLinkType())){ - //杩欎釜鏄笟鍔$被鍨嬬殑鑷弬鐓� - //浠ュ墠鐨勫钩鍙版病鏈夊鑷弬鐓ц繖绉嶆湁鍏ㄩ儴鏌ヨ鐨� - OsBtmTypeVO btmTypeVO = btmService.getBtmByName(treeDefineVO.getBtmType()); - queryFieldList.addAll(btmTypeVO.getAttributes().stream().map(OsBtmTypeAttributeVO::getId).collect(Collectors.toList())); - queryFieldList.addAll(WebBoServiceImpl.BO_BASE_FIELD_MAP.values()); - - addQueryField(queryFieldList,valueField); - addQueryField(queryFieldList,textField); - - if(treeQuery.isQueryRoot()){ - //鏄煡璇㈡牴鑺傜偣 - List<BusinessObject> rootCbos = null; - if(StringUtils.isNotBlank(queryTemplate)){ - //璇存槑鏄彍鍗曢噷瀹氫箟浜嗘煡璇㈡ā鏉跨殑 - rootCbos = boService.queryCBOByScheme(queryTemplate, null, replaceMap); - }else{ - //璇存槑娌℃湁浼犻�掞紝杩欓渶瑕佸吋瀹逛互鍓嶇殑鏂瑰紡锛屽氨鏄湪showLinkAps閲岃缃� - String parentFieldNameAndValue = treeDefineVO.getShowLinkAbs(); - if(StringUtils.isBlank(parentFieldNameAndValue) || !parentFieldNameAndValue.contains(",")){ - throw new VciBaseException("閰嶇疆鐨勪俊鎭湁璇�傚湪娌℃湁鍦ㄨ彍鍗曟垨鑰呮潵婧愭暟鎹缃牴鑺傜偣鐨勬煡璇㈡ā鏉挎椂锛岃鍦ㄦ爲鐨勩�愬弬鐓ф爲銆戜笂璁剧疆涓婄骇瀛楁鐨勫悕绉板拰鏍硅妭鐐圭殑鏌ヨ鐨勫�笺�傛瘮濡倄xxx,yyy銆傚叾涓瓁xxx鏄笂绾у瓧娈佃嫳鏂囧悕绉�"); - } - parentFieldName = parentFieldNameAndValue.split(",")[0]; - String rootQueryValue = parentFieldNameAndValue.split(",")[1]; - treeQuery.getConditionMap().put(parentFieldName,rootQueryValue); - replaceMap.put(parentFieldName,rootQueryValue); - replaceMap.put("f_oid",rootQueryValue); - if(StringUtils.isNotBlank(queryTemplate)){ - rootCbos = boService.queryCBOByScheme(queryTemplate,treeQuery.getConditionMap(),replaceMap,null,queryFieldList); - }else{ - rootCbos = boService.queryCBO(treeDefineVO.getBtmType(),treeQuery.getConditionMap(),null,queryFieldList); - } - } - if(!CollectionUtils.isEmpty(rootCbos)){ - rootTreeList = cbo2Trees(rootCbos,valueField,StringUtils.isBlank(rootExpress)?textField:rootExpress,parentFieldName,treeQuery.isShowCheckBox(),null); - TreeQueryObject treeQueryObject = new TreeQueryObject(); - treeQueryObject.setValueField(valueField); - treeQueryObject.setTextField(textField); - treeQueryObject.setParentFieldName(parentFieldName); - treeQueryObject.setShowCheckBox(treeQuery.isShowCheckBox()); - if(UITreeLoadTypeEnum.ALL.getValue().equalsIgnoreCase(treeDefineVO.getLoadType())){ - treeQueryObject.setQueryAllLevel(true); - } - queryTreeForBO(rootTreeList,treeDefineVO.getQueryTemplateName(),queryFieldList,treeQueryObject); - } - return rootTreeList; - }else{ - //杩欎釜涓嶆槸璺熻妭鐐癸紝浣嗘槸涓�鑸彧鏄鍔犱竴涓�愮骇鏌ヨ锛屽洜涓哄叏閮ㄦ煡璇㈢殑鏃跺�欙紝鍦ㄦ牴鑺傜偣宸茬粡鍏ㄩ儴鏌ヨ瀹屼簡 - List<BusinessObject> thisChildren = null; - if (StringUtils.isNotBlank(queryTemplate)) { - thisChildren = boService.queryCBOByScheme(queryTemplate, treeQuery.getConditionMap(), replaceMap, null, queryFieldList); - } else { - thisChildren = boService.queryCBO(treeQuery.getParentBtmName(), treeQuery.getConditionMap(), null, queryFieldList); - } - return cbo2Trees(thisChildren, valueField, textField, parentFieldName, treeQuery.isShowCheckBox(), null); + String bsCustQueryCLsOrUrl = componentVO.getBsCustQueryCLsOrUrl(); + if(Func.isNotBlank(bsCustQueryCLsOrUrl) && isCustomClass(bsCustQueryCLsOrUrl)){ + //閫氳繃鍙嶅皠璋冪敤bsCustQueryCLsOrUrl涓畾涔夌殑鏈嶅姟绫讳腑鐨勬煡璇㈡柟娉� + try { + // 鑾峰彇绫荤殑 Class 瀵硅薄 + Class<?> clazz = Class.forName(bsCustQueryCLsOrUrl.replace("@","")); + // 鍒涘缓绫荤殑瀹炰緥 + Object instance = clazz.getDeclaredConstructor().newInstance(); + // 鑾峰彇鏂规硶getDataForGrid锛堣鏂规硶鏄帴鍙d腑缁熶竴瀹氫箟鐨勬柟娉曪級 + Method method = clazz.getMethod("getDataForForm", UITreeQuery.class); + // 璋冪敤鏂规硶 + List<UIDataTree> uiDataTreeList = (List<UIDataTree>) method.invoke(instance, treeQuery); + return uiDataTreeList; + }catch (Exception e){ + e.printStackTrace(); + throw new VciBaseException("鑾峰彇琛ㄦ牸鏁版嵁鏃跺嚭鐜伴敊璇紝鍘熷洜锛�"+e.getMessage()); } }else{ - //OsLinkTypeVO linkTypeVO = linkTypeService.getLinkTypeById(treeDefineVO.getLinkType()); - LinkType linkType = platformClientUtil.getLinkTypeService().getLinkType(treeDefineVO.getLinkType()); - //queryFieldList.addAll(linkTypeVO.getAttributes().stream().map(OsLinkTypeAttributeVO::getId).collect(Collectors.toList())); - queryFieldList.addAll(Arrays.asList(linkType.attributes)); - queryFieldList.addAll(WebLoServiceImpl.LO_BASE_FIELD_MAP.values()); - - addQueryField(queryFieldList,valueField); - addQueryField(queryFieldList,textField); - UILinkTypeDataQuery linkTypeDataQuery = new UILinkTypeDataQuery(); - linkTypeDataQuery.setQueryTemplateName(queryTemplate); - linkTypeDataQuery.setReplaceMap(replaceMap); - linkTypeDataQuery.setConditionMap(treeQuery.getConditionMap()); - linkTypeDataQuery.setParentOid(treeQuery.getParentOid()); - linkTypeDataQuery.setClauseList(queryFieldList); - linkTypeDataQuery.setDirection(isOrientation); - linkTypeDataQuery.setToBtmType(treeDefineVO.getBtmType()); - linkTypeDataQuery.setLinkType(treeDefineVO.getLinkType()); - if(UITreeLoadTypeEnum.ALL.getValue().equalsIgnoreCase(treeDefineVO.getLoadType())){ - linkTypeDataQuery.setQueryAllLevel(true); + //鏍戝舰鏈変袱绉嶏紝涓�绉嶆槸涓氬姟绫诲瀷閲岃嚜鍙傜収锛屼竴绉嶆槸閾炬帴绫诲瀷 + UITreeDefineVO treeDefineVO = componentVO.getTreeDefineVO(); + if(treeDefineVO == null){ + throw new VciBaseException("杩欎釜缁勪欢涓嶆槸鏍�"); } - if(treeQuery.isQueryRoot()){ - //鏌ヨ鏍硅妭鐐�.鎴戜滑闇�瑕佸垽鏂槸鍚﹁缃簡鏍硅妭鐐圭殑鏌ヨ鏉′欢 - List<BOAndLO> rootCbos = null; - String parentFieldNameAndValue = treeDefineVO.getShowLinkAbs(); - if(StringUtils.isNotBlank(parentFieldNameAndValue)){ + if(!treeQuery.isLinkTypeFlag() && StringUtils.isBlank(treeQuery.getParentBtmName())){ + treeQuery.setParentBtmName(treeQuery.getBtmName()); + } + //TODO: 鏇挎崲鏍戝畾涔変笂鐨勬鍙嶅悜鏌ヨ灞炴�э紝鍥犱负姝e弽鍚戞煡璇㈡槸鐢遍摼鎺ョ被鍨嬫煡璇㈡ā鏉夸笂鎺у埗鐨� + boolean isOrientation = false; //鏄惁鍙嶅悜锛屼娇鐢ㄦā鏉夸笂閰嶇疆鐨� + String qtName = treeDefineVO.getQueryTemplateName(); + if(Func.isNotBlank(treeDefineVO.getLinkType()) && Func.isNotBlank(qtName)){ + QTInfo wrapper = platformClientUtil.getQTDService().getQT(qtName); + QueryTemplate qt = OQTool.getQTByDoc(DocumentHelper.parseText(wrapper.qtText), qtName); + isOrientation = qt.getDirection().equals("opposite"); + } + if(treeQuery.getConditionMap() == null){ + treeQuery.setConditionMap(new HashMap<>()); + } + if(treeQuery.getExtandParamsMap() != null){ + treeQuery.getConditionMap().putAll(treeQuery.getExtandParamsMap()); + } + String parentFieldName = treeQuery.getParentFieldName(); + if(parentFieldName.contains(",")){ + parentFieldName = parentFieldName.split(",")[0]; + } + if(StringUtils.isNotBlank(parentFieldName)){ + if(StringUtils.isNotBlank(treeQuery.getParentOid())){ + treeQuery.getConditionMap().put(parentFieldName,treeQuery.getParentOid()); + } + } + if(StringUtils.isNotBlank(treeQuery.getParentOid()) && treeQuery.getParentOid().contains(TREE_NODE_ID_SEP)){ + treeQuery.setParentOid(treeQuery.getParentOid().split(TREE_NODE_ID_SEP)[1]); + } + String queryTemplate = StringUtils.isNotBlank(treeQuery.getQueryTemplate())?treeQuery.getQueryTemplate():(!CollectionUtils.isEmpty(treeQuery.getSourceData())? (String) treeQuery.getSourceData().getOrDefault("querytemplate",treeDefineVO.getQueryTemplateName()) :treeDefineVO.getQueryTemplateName()); + String valueField = treeQuery.isLinkTypeFlag()?(!isOrientation?"${oid}" + TREE_NODE_ID_SEP + "${t_oid}":"${oid}" + TREE_NODE_ID_SEP + "${f_oid}"):(StringUtils.isNotBlank(treeQuery.getValueField())?treeQuery.getValueField():"oid"); + String textField = StringUtils.isNotBlank(treeDefineVO.getTreeNodeExpression())?treeDefineVO.getTreeNodeExpression():(StringUtils.isNotBlank(treeQuery.getTextField())?treeQuery.getTextField():"name"); + List<UIDataTree> rootTreeList = new ArrayList<>(); + List<String> queryFieldList = new ArrayList<>(); + queryFieldList.add("creator_name"); + queryFieldList.add("lastmodifier_name"); + String rootExpress = StringUtils.isNotBlank(treeQuery.getRootExpress())?treeQuery.getRootExpress():treeDefineVO.getRootContent(); + Map<String, Object> replaceMap = wrapperReplaceMap(treeQuery.getSourceData()); + if(StringUtils.isBlank(treeDefineVO.getLinkType())){ + //杩欎釜鏄笟鍔$被鍨嬬殑鑷弬鐓� + //浠ュ墠鐨勫钩鍙版病鏈夊鑷弬鐓ц繖绉嶆湁鍏ㄩ儴鏌ヨ鐨� + OsBtmTypeVO btmTypeVO = btmService.getBtmByName(treeDefineVO.getBtmType()); + queryFieldList.addAll(btmTypeVO.getAttributes().stream().map(OsBtmTypeAttributeVO::getId).collect(Collectors.toList())); + queryFieldList.addAll(WebBoServiceImpl.BO_BASE_FIELD_MAP.values()); + + addQueryField(queryFieldList,valueField); + addQueryField(queryFieldList,textField); + + if(treeQuery.isQueryRoot()){ + //鏄煡璇㈡牴鑺傜偣 + List<BusinessObject> rootCbos = null; if(StringUtils.isNotBlank(queryTemplate)){ - linkTypeDataQuery.setQueryAllLevel(false); - //鏍硅妭鐐瑰彧鏌ヨ涓�娆� - //浣跨敤鏌ヨ妯℃澘鏈韩璁剧疆鐨勫唴瀹� - linkTypeDataQuery.setToBtmType(null); - linkTypeDataQuery.setQueryTemplateName(queryTemplate); - rootCbos = loService.queryCLOAndBOBySchema(linkTypeDataQuery); + //璇存槑鏄彍鍗曢噷瀹氫箟浜嗘煡璇㈡ā鏉跨殑 + rootCbos = boService.queryCBOByScheme(queryTemplate, null, replaceMap); }else{ - String rootQueryValue = ""; + //璇存槑娌℃湁浼犻�掞紝杩欓渶瑕佸吋瀹逛互鍓嶇殑鏂瑰紡锛屽氨鏄湪showLinkAps閲岃缃� + String parentFieldNameAndValue = treeDefineVO.getShowLinkAbs(); + if(StringUtils.isBlank(parentFieldNameAndValue) || !parentFieldNameAndValue.contains(",")){ + throw new VciBaseException("閰嶇疆鐨勪俊鎭湁璇�傚湪娌℃湁鍦ㄨ彍鍗曟垨鑰呮潵婧愭暟鎹缃牴鑺傜偣鐨勬煡璇㈡ā鏉挎椂锛岃鍦ㄦ爲鐨勩�愬弬鐓ф爲銆戜笂璁剧疆涓婄骇瀛楁鐨勫悕绉板拰鏍硅妭鐐圭殑鏌ヨ鐨勫�笺�傛瘮濡倄xxx,yyy銆傚叾涓瓁xxx鏄笂绾у瓧娈佃嫳鏂囧悕绉�"); + } parentFieldName = parentFieldNameAndValue.split(",")[0]; - rootQueryValue = parentFieldNameAndValue.split(",")[1]; + String rootQueryValue = parentFieldNameAndValue.split(",")[1]; treeQuery.getConditionMap().put(parentFieldName,rootQueryValue); - linkTypeDataQuery.setQueryAllLevel(false); - linkTypeDataQuery.setLinkType(treeDefineVO.getLinkType()); - linkTypeDataQuery.setParentOid(rootQueryValue); - rootCbos = loService.queryCLOAndBoByLinkType(linkTypeDataQuery); + replaceMap.put(parentFieldName,rootQueryValue); + replaceMap.put("f_oid",rootQueryValue); + if(StringUtils.isNotBlank(queryTemplate)){ + rootCbos = boService.queryCBOByScheme(queryTemplate,treeQuery.getConditionMap(),replaceMap,null,queryFieldList); + }else{ + rootCbos = boService.queryCBO(treeDefineVO.getBtmType(),treeQuery.getConditionMap(),null,queryFieldList); + } } if(!CollectionUtils.isEmpty(rootCbos)){ + rootTreeList = cbo2Trees(rootCbos,valueField,StringUtils.isBlank(rootExpress)?textField:rootExpress,parentFieldName,treeQuery.isShowCheckBox(),null); + TreeQueryObject treeQueryObject = new TreeQueryObject(); + treeQueryObject.setValueField(valueField); + treeQueryObject.setTextField(textField); + treeQueryObject.setParentFieldName(parentFieldName); + treeQueryObject.setShowCheckBox(treeQuery.isShowCheckBox()); + if(UITreeLoadTypeEnum.ALL.getValue().equalsIgnoreCase(treeDefineVO.getLoadType())){ + treeQueryObject.setQueryAllLevel(true); + } + queryTreeForBO(rootTreeList,treeDefineVO.getQueryTemplateName(),queryFieldList,treeQueryObject); + } + return rootTreeList; + }else{ + //杩欎釜涓嶆槸璺熻妭鐐癸紝浣嗘槸涓�鑸彧鏄鍔犱竴涓�愮骇鏌ヨ锛屽洜涓哄叏閮ㄦ煡璇㈢殑鏃跺�欙紝鍦ㄦ牴鑺傜偣宸茬粡鍏ㄩ儴鏌ヨ瀹屼簡 + List<BusinessObject> thisChildren = null; + if (StringUtils.isNotBlank(queryTemplate)) { + thisChildren = boService.queryCBOByScheme(queryTemplate, treeQuery.getConditionMap(), replaceMap, null, queryFieldList); + } else { + thisChildren = boService.queryCBO(treeQuery.getParentBtmName(), treeQuery.getConditionMap(), null, queryFieldList); + } + return cbo2Trees(thisChildren, valueField, textField, parentFieldName, treeQuery.isShowCheckBox(), null); + } + }else{ + //OsLinkTypeVO linkTypeVO = linkTypeService.getLinkTypeById(treeDefineVO.getLinkType()); + LinkType linkType = platformClientUtil.getLinkTypeService().getLinkType(treeDefineVO.getLinkType()); + //queryFieldList.addAll(linkTypeVO.getAttributes().stream().map(OsLinkTypeAttributeVO::getId).collect(Collectors.toList())); + queryFieldList.addAll(Arrays.asList(linkType.attributes)); + queryFieldList.addAll(WebLoServiceImpl.LO_BASE_FIELD_MAP.values()); + + addQueryField(queryFieldList,valueField); + addQueryField(queryFieldList,textField); + UILinkTypeDataQuery linkTypeDataQuery = new UILinkTypeDataQuery(); + linkTypeDataQuery.setQueryTemplateName(queryTemplate); + linkTypeDataQuery.setReplaceMap(replaceMap); + linkTypeDataQuery.setConditionMap(treeQuery.getConditionMap()); + linkTypeDataQuery.setParentOid(treeQuery.getParentOid()); + linkTypeDataQuery.setClauseList(queryFieldList); + linkTypeDataQuery.setDirection(isOrientation); + linkTypeDataQuery.setToBtmType(treeDefineVO.getBtmType()); + linkTypeDataQuery.setLinkType(treeDefineVO.getLinkType()); + if(UITreeLoadTypeEnum.ALL.getValue().equalsIgnoreCase(treeDefineVO.getLoadType())){ + linkTypeDataQuery.setQueryAllLevel(true); + } + if(treeQuery.isQueryRoot()){ + //鏌ヨ鏍硅妭鐐�.鎴戜滑闇�瑕佸垽鏂槸鍚﹁缃簡鏍硅妭鐐圭殑鏌ヨ鏉′欢 + List<BOAndLO> rootCbos = null; + String parentFieldNameAndValue = treeDefineVO.getShowLinkAbs(); + if(StringUtils.isNotBlank(parentFieldNameAndValue)){ + if(StringUtils.isNotBlank(queryTemplate)){ + linkTypeDataQuery.setQueryAllLevel(false); + //鏍硅妭鐐瑰彧鏌ヨ涓�娆� + //浣跨敤鏌ヨ妯℃澘鏈韩璁剧疆鐨勫唴瀹� + linkTypeDataQuery.setToBtmType(null); + linkTypeDataQuery.setQueryTemplateName(queryTemplate); + rootCbos = loService.queryCLOAndBOBySchema(linkTypeDataQuery); + }else{ + String rootQueryValue = ""; + parentFieldName = parentFieldNameAndValue.split(",")[0]; + rootQueryValue = parentFieldNameAndValue.split(",")[1]; + treeQuery.getConditionMap().put(parentFieldName,rootQueryValue); + linkTypeDataQuery.setQueryAllLevel(false); + linkTypeDataQuery.setLinkType(treeDefineVO.getLinkType()); + linkTypeDataQuery.setParentOid(rootQueryValue); + rootCbos = loService.queryCLOAndBoByLinkType(linkTypeDataQuery); + } + if(!CollectionUtils.isEmpty(rootCbos)){ + if(StringUtils.isBlank(parentFieldName)){ + if(isOrientation){ + parentFieldName = "t_oid"; + }else{ + parentFieldName = "f_oid"; + } + } + rootTreeList = cloAndCbo2Trees(rootCbos,valueField,rootExpress,parentFieldName,treeQuery.isShowCheckBox(),null); + linkTypeDataQuery.setLinkType(treeDefineVO.getLinkType()); + linkTypeDataQuery.setQueryTemplateName(queryTemplate); + if(UITreeLoadTypeEnum.ALL.getValue().equalsIgnoreCase(treeDefineVO.getLoadType())){ + linkTypeDataQuery.setQueryAllLevel(true); + } + queryTreeForLO(rootTreeList,linkTypeDataQuery,parentFieldName,valueField,textField,treeQuery.isShowCheckBox()); + } + return rootTreeList; + }else{ + //娌℃湁璁剧疆鏌ヨ鏉′欢銆傞偅灏辨槸鎶婃潵婧愭暟鎹綔涓烘牴鑺傜偣 + if(CollectionUtils.isEmpty(replaceMap)){ + throw new VciBaseException("鏍硅妭鐐规病鏈夐厤缃煡璇㈡潯浠讹紝涔熸病鏈夋潵婧愭暟鎹�"); + } + UIDataTree root = new UIDataTree(); + root.setOid((String) replaceMap.getOrDefault("oid",replaceMap.getOrDefault("t_oid",""))); + root.setText(getValueByExpressForBOAndLO(new HashMap<>(),replaceMap,rootExpress)); + root.setAttributes(replaceMap); + root.setIndex("0"); + rootTreeList.add(root); + if(StringUtils.isBlank(parentFieldName)){ if(isOrientation){ parentFieldName = "t_oid"; @@ -567,51 +613,24 @@ parentFieldName = "f_oid"; } } - rootTreeList = cloAndCbo2Trees(rootCbos,valueField,rootExpress,parentFieldName,treeQuery.isShowCheckBox(),null); linkTypeDataQuery.setLinkType(treeDefineVO.getLinkType()); linkTypeDataQuery.setQueryTemplateName(queryTemplate); if(UITreeLoadTypeEnum.ALL.getValue().equalsIgnoreCase(treeDefineVO.getLoadType())){ linkTypeDataQuery.setQueryAllLevel(true); } queryTreeForLO(rootTreeList,linkTypeDataQuery,parentFieldName,valueField,textField,treeQuery.isShowCheckBox()); + return rootTreeList; } - return rootTreeList; }else{ - //娌℃湁璁剧疆鏌ヨ鏉′欢銆傞偅灏辨槸鎶婃潵婧愭暟鎹綔涓烘牴鑺傜偣 - if(CollectionUtils.isEmpty(replaceMap)){ - throw new VciBaseException("鏍硅妭鐐规病鏈夐厤缃煡璇㈡潯浠讹紝涔熸病鏈夋潵婧愭暟鎹�"); - } - UIDataTree root = new UIDataTree(); - root.setOid((String) replaceMap.getOrDefault("oid",replaceMap.getOrDefault("t_oid",""))); - root.setText(getValueByExpressForBOAndLO(new HashMap<>(),replaceMap,rootExpress)); - root.setAttributes(replaceMap); - root.setIndex("0"); - rootTreeList.add(root); - - if(StringUtils.isBlank(parentFieldName)){ - if(isOrientation){ - parentFieldName = "t_oid"; - }else{ - parentFieldName = "f_oid"; + if(StringUtils.isNotBlank(treeQuery.getParentOid())){ + //鏈変笂绾т簡銆傞偅replace鐨刦_oid灏卞簲璇ヨ缃负涓婄骇 + if(linkTypeDataQuery.getReplaceMap() == null){ + linkTypeDataQuery.setReplaceMap(new HashMap<>()); } + linkTypeDataQuery.getReplaceMap().put(isOrientation?"t_oid":"f_oid",treeQuery.getParentOid()); } - linkTypeDataQuery.setLinkType(treeDefineVO.getLinkType()); - linkTypeDataQuery.setQueryTemplateName(queryTemplate); - if(UITreeLoadTypeEnum.ALL.getValue().equalsIgnoreCase(treeDefineVO.getLoadType())){ - linkTypeDataQuery.setQueryAllLevel(true); - } - queryTreeForLO(rootTreeList,linkTypeDataQuery,parentFieldName,valueField,textField,treeQuery.isShowCheckBox()); - return rootTreeList; + return cloAndCbo2Trees(loService.queryCLOAndBoByLinkType(linkTypeDataQuery),valueField,textField,parentFieldName,treeQuery.isShowCheckBox(),treeQuery.getParentOid()); } - }else{ - if(StringUtils.isNotBlank(treeQuery.getParentOid())){ - //鏈変笂绾т簡銆傞偅replace鐨刦_oid灏卞簲璇ヨ缃负涓婄骇 - if(linkTypeDataQuery.getReplaceMap() == null){ - linkTypeDataQuery.setReplaceMap(new HashMap<>()); - } - linkTypeDataQuery.getReplaceMap().put(isOrientation?"t_oid":"f_oid",treeQuery.getParentOid()); - } - return cloAndCbo2Trees(loService.queryCLOAndBoByLinkType(linkTypeDataQuery),valueField,textField,parentFieldName,treeQuery.isShowCheckBox(),treeQuery.getParentOid()); } } } @@ -1275,7 +1294,6 @@ return result; } - /** * 灏佽cbo瀵硅薄 * @param formDataDTO 琛ㄥ崟鏁版嵁 @@ -1391,7 +1409,6 @@ } return data; } - /** * 閾炬帴鏁版嵁琛ㄥ崟瀵硅薄杞崲涓哄熀纭�鐨勫睘鎬� @@ -1984,7 +2001,6 @@ }); return BaseResult.success(clo); } - /** * 灏佽to绔殑鏁版嵁 -- Gitblit v1.9.3