From c528dc5a1ce4d08768c37eaaa84559cceea5ea64 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期五, 22 十一月 2024 15:10:19 +0800
Subject: [PATCH] 业务类型树查询接口,返回的attributes集合中增加链接表的属性。

---
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIDataServiceImpl.java |   37 ++++++++++++++++++++++++++++++-------
 1 files changed, 30 insertions(+), 7 deletions(-)

diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIDataServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIDataServiceImpl.java
index e07bba7..5497ddb 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIDataServiceImpl.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIDataServiceImpl.java
@@ -5,6 +5,7 @@
 import com.vci.corba.omd.btm.BizType;
 import com.vci.corba.omd.data.*;
 import com.vci.corba.omd.lcm.LifeCycle;
+import com.vci.corba.omd.ltm.LinkType;
 import com.vci.dto.*;
 import com.vci.frameworkcore.lcstatuspck.FrameworkDataLCStatus;
 import com.vci.frameworkcore.lcstatuspck.ReleaseDataLCStatus;
@@ -30,6 +31,7 @@
 import com.vci.web.query.UILinkTypeDataQuery;
 import com.vci.web.query.UITreeQuery;
 import com.vci.web.service.*;
+import com.vci.web.util.Func;
 import com.vci.web.util.PlatformClientUtil;
 import com.vci.web.util.WebUtil;
 import org.apache.commons.lang3.StringUtils;
@@ -185,7 +187,7 @@
         queryFieldList.add("creator_name");
         queryFieldList.add("lastmodifier_name");
         //鎴戜滑鍦ㄥ悗鍙版煡璇笟鍔℃暟鎹�
-        Map<String, String> replaceMap = wrapperReplaceMap( dataGridQuery.getSourceData());
+        Map<String, String> replaceMap = wrapperReplaceMap(dataGridQuery.getSourceData());
 
         if(dataGridQuery.isLinkTypeFlag()){
             UILinkTypeDataQuery linkTypeDataQuery = new UILinkTypeDataQuery();
@@ -367,7 +369,7 @@
         if(treeQuery.getExtandParamsMap() != null){
             treeQuery.getConditionMap().putAll(treeQuery.getExtandParamsMap());
         }
-        String parentFieldName = treeQuery.getParentFieldName();
+       String parentFieldName = treeQuery.getParentFieldName();
         if(parentFieldName.contains(",")){
             parentFieldName = parentFieldName.split(",")[0];
         }
@@ -410,7 +412,7 @@
                     if(StringUtils.isBlank(parentFieldNameAndValue) || !parentFieldNameAndValue.contains(",")){
                         throw new VciBaseException("閰嶇疆鐨勪俊鎭湁璇�傚湪娌℃湁鍦ㄨ彍鍗曟垨鑰呮潵婧愭暟鎹缃牴鑺傜偣鐨勬煡璇㈡ā鏉挎椂锛岃鍦ㄦ爲鐨勩�愬弬鐓ф爲銆戜笂璁剧疆涓婄骇瀛楁鐨勫悕绉板拰鏍硅妭鐐圭殑鏌ヨ鐨勫�笺�傛瘮濡倄xxx,yyy銆傚叾涓瓁xxx鏄笂绾у瓧娈佃嫳鏂囧悕绉�");
                     }
-                    parentFieldName= parentFieldNameAndValue.split(",")[0];
+                    parentFieldName = parentFieldNameAndValue.split(",")[0];
                     String rootQueryValue = parentFieldNameAndValue.split(",")[1];
                     treeQuery.getConditionMap().put(parentFieldName,rootQueryValue);
                     replaceMap.put(parentFieldName,rootQueryValue);
@@ -445,8 +447,10 @@
                 return cbo2Trees(thisChildren, valueField, textField, parentFieldName, treeQuery.isShowCheckBox(), null);
             }
         }else{
-            OsLinkTypeVO linkTypeVO = linkTypeService.getLinkTypeById(treeDefineVO.getLinkType());
-            queryFieldList.addAll(linkTypeVO.getAttributes().stream().map(OsLinkTypeAttributeVO::getId).collect(Collectors.toList()));
+            //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);
@@ -704,9 +708,28 @@
             clo = boAndLO.lo;
             Map<String,String> cloMap = loService.clo2Map(clo);
             Map<String,String> cbo2Map = boService.cbo2Map(cbo);
+            //灏嗛摼鎺ョ被鍨嬬殑灞炴�т篃鏀捐繘杩涜杩斿洖
+            String linkName = Func.isNotBlank(cloMap.get("linktypename")) ? cloMap.get("linktypename"):parentFieldName;
+            Map<String, String> returnMap = new HashMap<>();
+            cloMap.forEach((key,value)->{
+                //杩囨护鎺夌┖鍊�
+                if(!returnMap.containsKey(linkName + key) && Func.isNotBlank(key) || Func.isNotBlank(value)){
+                    returnMap.put(linkName + key,value);
+                }
+            });
+            //杩囨护鎺夌┖鍊硷紝鐢ㄤ綔杩斿洖鐨刴ap
+           cbo2Map.entrySet().stream().forEach(entry -> {
+                String key = entry.getKey();
+                String value = entry.getValue();
+                if (!returnMap.containsKey(key) && Func.isNotBlank(key) && Func.isNotBlank(value)) {
+                    returnMap.put(key,value);
+                }
+            });
+
             if(!CollectionUtils.isEmpty(cbo2Map)){
                 cbo2Map.forEach((key,value)->{
-                    cloMap.put(parentFieldName + "." + key,value);
+                    //TODO: 杩欏効涓哄暐瑕佹嫾鎺ヤ笂parentFieldName锛屽鑷村悗闈reemarker琛ㄨ揪寮忔棤娉曟纭浛鎹�
+                    cloMap.put(/*parentFieldName + "." +*/ key,value);
                 });
             }
             tree.setOid(getValueByExpressForBOAndLO(cloMap,cbo2Map,valueField));
@@ -721,7 +744,7 @@
                 }
             }
 
-            tree.setAttributes(cbo2Map);
+            tree.setAttributes(returnMap);
             tree.setIndex(i[0] + "");
             i[0]++;
             tree.setChecked(showCheckBox);

--
Gitblit v1.9.3