From cdba4febf23c6f55346a474579361923aacf0bc9 Mon Sep 17 00:00:00 2001
From: wangting <675591594@qq.com>
Date: 星期一, 02 十二月 2024 14:54:11 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIDataServiceImpl.java |  170 +++++++++++++++++++++++++++++++-------------------------
 1 files changed, 95 insertions(+), 75 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 5497ddb..5d68461 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
@@ -1,11 +1,14 @@
 package com.vci.web.service.impl;
 
+import com.vci.client.common.oq.OQTool;
+import com.vci.common.qt.object.QueryTemplate;
 import com.vci.corba.common.PLException;
 import com.vci.corba.framework.data.UserInfo;
-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.corba.omd.qtm.QTInfo;
+import com.vci.corba.query.data.BOAndLO;
 import com.vci.dto.*;
 import com.vci.frameworkcore.lcstatuspck.FrameworkDataLCStatus;
 import com.vci.frameworkcore.lcstatuspck.ReleaseDataLCStatus;
@@ -35,6 +38,7 @@
 import com.vci.web.util.PlatformClientUtil;
 import com.vci.web.util.WebUtil;
 import org.apache.commons.lang3.StringUtils;
+import org.dom4j.DocumentHelper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -45,7 +49,6 @@
 import java.util.stream.Collectors;
 
 import static com.vci.constant.FrameWorkBusLangCodeConstant.DATA_OID_NOT_EXIST;
-
 
 /**
  * UI涓婄殑鏁版嵁鏌ヨ
@@ -142,7 +145,7 @@
         VciBaseUtil.alertNotNull(dataGridQuery,"鏌ヨ瀵硅薄",dataGridQuery.getBtmname(),"涓氬姟绫诲瀷",dataGridQuery.getTableDefineId());
         //鍏堝垽鏂煡璇㈡ā鏉�
         UITableDefineVO tableDefineVO = uiEngineService.getComponentByOid(dataGridQuery.getComponentOid(),null).getTableDefineVO();
-        String queryTemplate = !CollectionUtils.isEmpty(dataGridQuery.getSourceData())?dataGridQuery.getSourceData().getOrDefault("querytemplate",tableDefineVO.getQueryTemplateName()):tableDefineVO.getQueryTemplateName();
+        String queryTemplate = !CollectionUtils.isEmpty(dataGridQuery.getSourceData())? (String) dataGridQuery.getSourceData().getOrDefault("querytemplate",tableDefineVO.getQueryTemplateName()) :tableDefineVO.getQueryTemplateName();
         if(StringUtils.isBlank(queryTemplate)){
             //璇存槑娌℃湁璁剧疆鏌ヨ妯℃澘锛岄渶瑕佺湅鐪嬪湪杩欎釜琛ㄦ牸鎵�鍦ㄧ殑缁勪欢鏈夋病鏈夎缃�
             tableDefineVO = uiEngineService.getTableById(dataGridQuery.getBtmname(), dataGridQuery.getTableDefineId());
@@ -187,7 +190,7 @@
         queryFieldList.add("creator_name");
         queryFieldList.add("lastmodifier_name");
         //鎴戜滑鍦ㄥ悗鍙版煡璇笟鍔℃暟鎹�
-        Map<String, String> replaceMap = wrapperReplaceMap(dataGridQuery.getSourceData());
+        Map<String, Object> replaceMap = wrapperReplaceMap(dataGridQuery.getSourceData());
 
         if(dataGridQuery.isLinkTypeFlag()){
             UILinkTypeDataQuery linkTypeDataQuery = new UILinkTypeDataQuery();
@@ -220,7 +223,7 @@
     public UIFormDataVO getDataForForm(UIFormQuery formQuery) throws VciBaseException, PLException {
         VciBaseUtil.alertNotNull(formQuery,"琛ㄥ崟鐨勬煡璇㈠璞�",formQuery.getBtmname(),"涓氬姟绫诲瀷鐨勪俊鎭�",formQuery.getOid(),"涓氬姟鏁版嵁鐨勪富閿�",formQuery.getFormDefineId(),"琛ㄥ崟鐨勫畾涔夌紪鍙�");
         UIFormDefineVO formDefineVO = uiEngineService.getFormById(formQuery.getBtmname(),formQuery.getFormDefineId());
-        String queryTemplate = !CollectionUtils.isEmpty(formQuery.getSourceData())?formQuery.getSourceData().getOrDefault("querytemplate",formDefineVO.getQueryTemplateName()):formDefineVO.getQueryTemplateName();
+        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());
         //鑾峰彇鍙傜収
         List<UIFormItemVO> referFieldList = formDefineVO.getItems().stream().filter(s -> UIFieldTypeEnum.REFER.getValue().equalsIgnoreCase(s.getType())).collect(Collectors.toList());
@@ -253,7 +256,7 @@
         queryFieldList.add("creator_name");
         queryFieldList.add("lastmodifier_name");
         Map<String,String> conditionMap = WebUtil.getOidQuery(formQuery.getOid());
-        Map<String, String> replaceMap = wrapperReplaceMap(formQuery.getSourceData());
+        Map<String, Object> replaceMap = wrapperReplaceMap(formQuery.getSourceData());
         UIFormDataVO formDataVO = new UIFormDataVO();
         replaceMap.put("oid", formQuery.getOid().trim());
         if(!formDefineVO.isLinkTypeFlag()) {
@@ -323,13 +326,14 @@
      * @param sourceDataMap 鏉ユ簮鏁版嵁
      * @return 鏇挎崲鍚庣殑鍊�
      */
-    private Map<String,String> wrapperReplaceMap(Map<String,String> sourceDataMap){
-        Map<String,String> replaceMap =!CollectionUtils.isEmpty(sourceDataMap)? sourceDataMap:new HashMap<>();
+    private Map<String,Object> wrapperReplaceMap(Map<String,Object> sourceDataMap){
+        Map<String,Object> replaceMap =!CollectionUtils.isEmpty(sourceDataMap)? sourceDataMap:new HashMap<>();
         if(!replaceMap.containsKey("f_oid")){
             replaceMap.put("f_oid",replaceMap.getOrDefault("oid",""));
         }
-        if(replaceMap.get("f_oid").contains(TREE_NODE_ID_SEP)){
-            replaceMap.put("f_oid",replaceMap.get("f_oid").split(TREE_NODE_ID_SEP)[1]);
+        String fOid = replaceMap.get("f_oid").toString();
+        if(fOid.contains(TREE_NODE_ID_SEP)){
+            replaceMap.put("f_oid",fOid.split(TREE_NODE_ID_SEP)[1]);
         }
         return replaceMap;
     }
@@ -347,7 +351,7 @@
      * @throws VciBaseException 鏌ヨ鍑洪敊鐨勬椂鍊欎細鎶涘嚭寮傚父
      */
     @Override
-    public List<Tree> getDataForTree(UITreeQuery treeQuery) throws VciBaseException, PLException {
+    public List<UIDataTree> getDataForTree(UITreeQuery treeQuery) throws Exception {
         VciBaseUtil.alertNotNull(treeQuery,"琛ㄥ崟鐨勬煡璇㈠璞�",treeQuery.getBtmname(),"涓氬姟绫诲瀷鐨勪俊鎭�",treeQuery.getComponentOid(),"鏍戞墍鍦ㄧ殑缁勪欢鐨勪富閿�");
         Map<String, OsAttributeVO> attributeVOMap = attrService.selectAllAttributeMap();
         UIComponentVO componentVO = uiEngineService.getComponentByOid(treeQuery.getComponentOid(),attributeVOMap);
@@ -362,7 +366,14 @@
         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<>());
         }
@@ -381,15 +392,15 @@
         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())?treeQuery.getSourceData().getOrDefault("querytemplate",treeDefineVO.getQueryTemplateName()):treeDefineVO.getQueryTemplateName());
-        String valueField = treeQuery.isLinkTypeFlag()?(!treeDefineVO.isOrientation()?"${oid}" + TREE_NODE_ID_SEP + "${t_oid}":"${oid}" + TREE_NODE_ID_SEP + "${f_oid}"):(StringUtils.isNotBlank(treeQuery.getValueField())?treeQuery.getValueField():"oid");
+        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<Tree> rootTreeList = new ArrayList<>();
+        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, String> replaceMap = wrapperReplaceMap(treeQuery.getSourceData());
+        Map<String, Object> replaceMap = wrapperReplaceMap(treeQuery.getSourceData());
         if(StringUtils.isBlank(treeDefineVO.getLinkType())){
             //杩欎釜鏄笟鍔$被鍨嬬殑鑷弬鐓�
             //浠ュ墠鐨勫钩鍙版病鏈夊鑷弬鐓ц繖绉嶆湁鍏ㄩ儴鏌ヨ鐨�
@@ -461,7 +472,7 @@
             linkTypeDataQuery.setConditionMap(treeQuery.getConditionMap());
             linkTypeDataQuery.setParentOid(treeQuery.getParentOid());
             linkTypeDataQuery.setClauseList(queryFieldList);
-            linkTypeDataQuery.setDirection(treeDefineVO.isOrientation());
+            linkTypeDataQuery.setDirection(isOrientation);
             linkTypeDataQuery.setToBtmType(treeDefineVO.getBtmType());
             linkTypeDataQuery.setLinkType(treeDefineVO.getLinkType());
             if(UITreeLoadTypeEnum.ALL.getValue().equalsIgnoreCase(treeDefineVO.getLoadType())){
@@ -469,7 +480,7 @@
             }
             if(treeQuery.isQueryRoot()){
                 //鏌ヨ鏍硅妭鐐�.鎴戜滑闇�瑕佸垽鏂槸鍚﹁缃簡鏍硅妭鐐圭殑鏌ヨ鏉′欢
-                List<com.vci.corba.query.data.BOAndLO> rootCbos = null;
+                List<BOAndLO> rootCbos = null;
                 String parentFieldNameAndValue = treeDefineVO.getShowLinkAbs();
                 if(StringUtils.isNotBlank(parentFieldNameAndValue)){
                     if(StringUtils.isNotBlank(queryTemplate)){
@@ -491,7 +502,7 @@
                     }
                     if(!CollectionUtils.isEmpty(rootCbos)){
                         if(StringUtils.isBlank(parentFieldName)){
-                            if(treeDefineVO.isOrientation()){
+                            if(isOrientation){
                                 parentFieldName = "t_oid";
                             }else{
                                 parentFieldName = "f_oid";
@@ -511,15 +522,15 @@
                     if(CollectionUtils.isEmpty(replaceMap)){
                         throw new VciBaseException("鏍硅妭鐐规病鏈夐厤缃煡璇㈡潯浠讹紝涔熸病鏈夋潵婧愭暟鎹�");
                     }
-                    Tree root = new Tree();
-                    root.setOid(replaceMap.getOrDefault("oid",replaceMap.getOrDefault("t_oid","")));
+                    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(treeDefineVO.isOrientation()){
+                        if(isOrientation){
                             parentFieldName = "t_oid";
                         }else{
                             parentFieldName = "f_oid";
@@ -539,7 +550,7 @@
                     if(linkTypeDataQuery.getReplaceMap() == null){
                         linkTypeDataQuery.setReplaceMap(new HashMap<>());
                     }
-                    linkTypeDataQuery.getReplaceMap().put(treeDefineVO.isOrientation()?"t_oid":"f_oid",treeQuery.getParentOid());
+                    linkTypeDataQuery.getReplaceMap().put(isOrientation?"t_oid":"f_oid",treeQuery.getParentOid());
                 }
                 return cloAndCbo2Trees(loService.queryCLOAndBoByLinkType(linkTypeDataQuery),valueField,textField,parentFieldName,treeQuery.isShowCheckBox(),treeQuery.getParentOid());
             }
@@ -553,7 +564,7 @@
      * @throws VciBaseException 鏌ヨ鍑洪敊鐨勬椂鍊欎細鎶涘嚭寮傚父
      */
     @Override
-    public BaseResult getDataByTemp(UITreeQuery treeQuery) throws VciBaseException, PLException {
+    public BaseResult getDataByTemp(UITreeQuery treeQuery) throws Exception {
         VciBaseUtil.alertNotNull(treeQuery,"琛ㄥ崟鐨勬煡璇㈠璞�",treeQuery.getComponentOid(),"褰撳墠缁勪欢鐨勪富閿�");
         //1銆佸厛鏌ヨ椤甸潰瀹氫箟缁勪欢
         Map<String, OsAttributeVO> attributeVOMap = attrService.selectAllAttributeMap();
@@ -563,12 +574,19 @@
         }
         // 2銆佹牴鎹厤缃殑鏌ヨ妯℃澘鏌ヨ鏁版嵁(闇�瑕佽�冭檻鍏ㄩ潰涓�鐐�),
         // 杩欏効鏍规嵁褰撳墠绫诲瀷鏉ヨ幏鍙栨槸浠�涔堢被鍨嬬殑鏌ヨ妯℃澘锛岀劧鍚庡仛瀵瑰簲鐨勬煡璇㈠鐞�
-
+        //TODO: 鏇挎崲鏍戝畾涔変笂鐨勬鍙嶅悜鏌ヨ灞炴�э紝鍥犱负姝e弽鍚戞煡璇㈡槸鐢遍摼鎺ョ被鍨嬫煡璇㈡ā鏉夸笂鎺у埗鐨�
         UITreeDefineVO treeDefineVO = componentVO.getTreeDefineVO();
-        String queryTemplate = StringUtils.isNotBlank(treeQuery.getQueryTemplate())?treeQuery.getQueryTemplate():(!CollectionUtils.isEmpty(treeQuery.getSourceData())?treeQuery.getSourceData().getOrDefault("querytemplate",treeDefineVO.getQueryTemplateName()):treeDefineVO.getQueryTemplateName());
-        Map<String, String> replaceMap = wrapperReplaceMap(treeQuery.getSourceData());
+        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");
+        }
+        String queryTemplate = StringUtils.isNotBlank(treeQuery.getQueryTemplate())?treeQuery.getQueryTemplate():(!CollectionUtils.isEmpty(treeQuery.getSourceData())? (String) treeQuery.getSourceData().getOrDefault("querytemplate",treeDefineVO.getQueryTemplateName()) :treeDefineVO.getQueryTemplateName());
+        Map<String, Object> replaceMap = wrapperReplaceMap(treeQuery.getSourceData());
         List<String> queryFieldList = new ArrayList<>();
-        String valueField = treeQuery.isLinkTypeFlag()?(!treeDefineVO.isOrientation()?"${oid}" + TREE_NODE_ID_SEP + "${t_oid}":"${oid}" + TREE_NODE_ID_SEP + "${f_oid}"):(StringUtils.isNotBlank(treeQuery.getValueField())?treeQuery.getValueField():"oid");
+        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");
         String rootExpress = StringUtils.isNotBlank(treeQuery.getRootExpress())?treeQuery.getRootExpress():treeDefineVO.getRootContent();
         String parentFieldName = treeQuery.getParentFieldName();
@@ -586,7 +604,7 @@
         List<BusinessObject> rootCbos = boService.queryCBOByScheme(queryTemplate, null, replaceMap);
 
         //3銆佹牴鎹笉鍚岀殑缁勪欢杩斿洖涓嶅悓鐨勬暟鎹被鍨嬶紙鏍戙�佸垪琛ㄣ�佹爲琛ㄣ�佽嚜瀹氫箟妯℃澘銆佽〃鍗曠瓑锛�
-        List<Tree> rootTreeList = null;
+        List<UIDataTree> rootTreeList = null;
         if(!CollectionUtils.isEmpty(rootCbos)){
             rootTreeList = cbo2Trees(rootCbos,valueField,StringUtils.isBlank(rootExpress)?textField:rootExpress,parentFieldName,treeQuery.isShowCheckBox(),null);
             TreeQueryObject treeQueryObject = new TreeQueryObject();
@@ -609,19 +627,19 @@
      * @param queryFieldList 鏌ヨ鐨勫瓧娈�
      * @param treeQueryObject 鏍戝舰鏌ヨ瀵硅薄锛岄渶瑕乿alueField鍜宼extField锛岃繕鏈塸arentFieldName,鍜宑heckBox
      */
-    private void queryTreeForBO(List<Tree> rootTreeList, String queryTemplate,List<String> queryFieldList,TreeQueryObject treeQueryObject) {
-        for (Tree rootTree : rootTreeList) {
+    private void queryTreeForBO(List<UIDataTree> rootTreeList, String queryTemplate,List<String> queryFieldList,TreeQueryObject treeQueryObject) {
+        for (UIDataTree rootTree : rootTreeList) {
             List<BusinessObject> thisChildren = null;
-            Map<String,String> sourceDataMap = rootTree.getAttributes();
+            Map<String,Object> sourceDataMap = rootTree.getAttributes();
             sourceDataMap.put("f_oid",rootTree.getOid());
             Map<String,String> conditionMap = new HashMap<>();
             conditionMap.put(treeQueryObject.getParentFieldName(),rootTree.getOid());
             if (StringUtils.isNotBlank(queryTemplate)) {
                 thisChildren = boService.queryCBOByScheme(queryTemplate, conditionMap, sourceDataMap, null, queryFieldList);
             } else {
-                thisChildren = boService.queryCBO(sourceDataMap.getOrDefault("btmname",sourceDataMap.getOrDefault("btmName",treeQueryObject.getParentBtmName())), conditionMap, null, queryFieldList);
+                thisChildren = boService.queryCBO((String) sourceDataMap.getOrDefault("btmname",sourceDataMap.getOrDefault("btmName",treeQueryObject.getParentBtmName())), conditionMap, null, queryFieldList);
             }
-            List<Tree> childrenTree = cbo2Trees(thisChildren, treeQueryObject.getValueField(), treeQueryObject.getTextField(), treeQueryObject.getParentFieldName(), treeQueryObject.isShowCheckBox(), null);
+            List<UIDataTree> childrenTree = cbo2Trees(thisChildren, treeQueryObject.getValueField(), treeQueryObject.getTextField(), treeQueryObject.getParentFieldName(), treeQueryObject.isShowCheckBox(), null);
             rootTree.setChildren(childrenTree);
             if(treeQueryObject.isQueryAllLevel() && !CollectionUtils.isEmpty(childrenTree) ) {
                 queryTreeForBO(childrenTree,queryTemplate,queryFieldList,treeQueryObject);
@@ -638,8 +656,8 @@
      * @param textField 鏄剧ず琛ㄨ揪寮�
      * @param showCheckBox 鏄惁鏄剧ず澶嶉�夋
      */
-    private void queryTreeForLO(List<Tree> rootTreeList, UILinkTypeDataQuery linkTypeDataQuery,String parentFieldName,String valueField,String textField,boolean showCheckBox) {
-        for (Tree rootTree : rootTreeList) {
+    private void queryTreeForLO(List<UIDataTree> rootTreeList, UILinkTypeDataQuery linkTypeDataQuery,String parentFieldName,String valueField,String textField,boolean showCheckBox) {
+        for (UIDataTree rootTree : rootTreeList) {
             Map<String,String> conditionMap = new HashMap<>();
             conditionMap.put(linkTypeDataQuery.isDirection()?"t_oid":"f_oid",rootTree.getOid());
             linkTypeDataQuery.setConditionMap(conditionMap);
@@ -658,18 +676,21 @@
      * @param parentOid 涓婄骇鐨勪富閿�
      * @return 鏍�
      */
-    private List<Tree> cbo2Trees(Collection<BusinessObject> cbos,String valueField,String textField,String parentFieldName,boolean showCheckBox,String parentOid){
+    private List<UIDataTree> cbo2Trees(Collection<BusinessObject> cbos,String valueField,String textField,String parentFieldName,boolean showCheckBox,String parentOid){
         final int[] i = {0};
-        List<Tree> rootList = new ArrayList<>();
-        List<Tree> children = new ArrayList<>();
+        List<UIDataTree> rootList = new ArrayList<>();
+        List<UIDataTree> children = new ArrayList<>();
         cbos.stream().forEach(cbo->{
-            Tree tree = new Tree();
+            UIDataTree tree = new UIDataTree();
             tree.setOid(getValueByExpress(cbo,valueField));
             tree.setText(getValueByExpress(cbo,textField));
             if(StringUtils.isNotBlank(parentFieldName)){
                 tree.setParentId(ObjectTool.getBOAttributeValue(cbo,parentFieldName));
             }
-            tree.setAttributes(boService.cbo2Map(cbo));
+            Map<String,Object> cbo2Map = boService.cbo2Map(cbo);
+            Map<String, Object> returnMap = new HashMap<>();
+            returnMap.put((String) cbo2Map.get("btmname"),cbo2Map);
+            tree.setAttributes(returnMap);
             tree.setIndex(i[0] + "");
             i[0]++;
             tree.setChecked(showCheckBox);
@@ -683,7 +704,7 @@
         if(rootList.size() == 0 && children.size() == 0){
             return rootList;
         }
-        return Tree.getChildList(rootList,children);
+        return UIDataTree.getChildList(rootList,children);
     }
 
     /**
@@ -696,42 +717,25 @@
      * @param parentOid 涓婄骇鐨勫��
      * @return 鏍戝舰鏁版嵁
      */
-    public List<Tree> cloAndCbo2Trees(Collection<com.vci.corba.query.data.BOAndLO> boAndLOS,String valueField,String textField,String parentFieldName,boolean showCheckBox,String parentOid){
+    public List<UIDataTree> cloAndCbo2Trees(Collection<BOAndLO> boAndLOS, String valueField, String textField, String parentFieldName, boolean showCheckBox, String parentOid){
         final int[] i = {0};
-        List<Tree> rootList = new ArrayList<>();
-        List<Tree> children = new ArrayList<>();
+        List<UIDataTree> rootList = new ArrayList<>();
+        List<UIDataTree> children = new ArrayList<>();
         boAndLOS.stream().forEach(boAndLO->{
-            Tree tree = new Tree();
+            UIDataTree tree = new UIDataTree();
             BusinessObject cbo = new BusinessObject();
             cbo = boAndLO.bo;
             LinkObject clo = new LinkObject();
             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);
-                }
-            });
+            Map<String,Object> cloMap = loService.clo2Map(clo);
+            Map<String,Object> cbo2Map = boService.cbo2Map(cbo);
 
-            if(!CollectionUtils.isEmpty(cbo2Map)){
+            /*if(!CollectionUtils.isEmpty(cbo2Map)){
                 cbo2Map.forEach((key,value)->{
                     //TODO: 杩欏効涓哄暐瑕佹嫾鎺ヤ笂parentFieldName锛屽鑷村悗闈reemarker琛ㄨ揪寮忔棤娉曟纭浛鎹�
-                    cloMap.put(/*parentFieldName + "." +*/ key,value);
+                    cloMap.put(/*parentFieldName + "." + key,value);
                 });
-            }
+            }*/
             tree.setOid(getValueByExpressForBOAndLO(cloMap,cbo2Map,valueField));
             tree.setText(getValueByExpressForBOAndLO(cloMap,cbo2Map,textField));
             if(StringUtils.isBlank(parentFieldName)){
@@ -743,7 +747,10 @@
                     tree.setParentId(ObjectTool.getLOAttributeValue(clo,parentFieldName));
                 }
             }
-
+            //TODO锛氳繑鍥炵殑鏁版嵁鏀规垚鎸夐摼鎺ョ被鍨嬪拰涓氬姟绫诲瀷涓簁ey锛氬�间负瀵瑰簲鐨勫睘鎬ч泦鍚堝舰寮忚繑鍥�
+            Map<String, Object> returnMap = new HashMap<>();
+            returnMap.put((String) cloMap.get("linktypename"),cloMap);
+            returnMap.put((String) cbo2Map.get("btmname"),cbo2Map);
             tree.setAttributes(returnMap);
             tree.setIndex(i[0] + "");
             i[0]++;
@@ -756,7 +763,7 @@
             }
         });
 
-        return Tree.getChildList(rootList,children);
+        return UIDataTree.getChildList(rootList,children);
     }
 
     /**
@@ -788,17 +795,30 @@
      * @param fieldExpress 琛ㄨ揪寮�
      * @return 鏇挎崲鍚庣殑鍊�
      */
-    private String getValueByExpressForBOAndLO(Map<String,String> valueMap,Map<String,String> boValueMap,String fieldExpress){
+    private String getValueByExpressForBOAndLO(Map<String,Object> valueMap,Map<String,Object> boValueMap,String fieldExpress){
         if(fieldExpress.contains("${")){
             //浣跨敤freemarker澶勭悊
-            return VciBaseUtil.replaceByFreeMarker(fieldExpress,valueMap);
+            /*
+            TODO:琛ㄨ揪寮忓瓨鍦═_OID.name杩欑褰㈠紡鏃秄reemarker鏇挎崲瑙勫垯鏄粠T_OID杩欎釜瀵硅薄涓嫑name灞炴�э紝
+                浣嗘槸valueMap鏄竴涓猄tring,String鐨凪ap鎵�浠ラ渶瑕佸皢T_OID.鎴朏_OID.鍘绘帀锛屽洜涓轰笉绠℃槸鏌ヨ鐨�
+                form绔繕鏄痶o绔兘鏄钩鍙版煡濂芥斁鍦ㄤ笟鍔″睘鎬oValueMap闆嗗悎涓殑锛屾墍浠ョ洿鎺ユ浛灏卞彲浠�
+            */
+            if(fieldExpress.contains(".")){
+                //鍘婚櫎t_oid銆乀_OID浠ュ強f_oid銆丗_OID
+                fieldExpress = fieldExpress
+                        .replace("t_oid.","")
+                        .replace("T_OID.","")
+                        .replace("f_oid.","")
+                        .replace("F_OID.","");
+            }
+            return VciBaseUtil.replaceByFreeMarker(fieldExpress,boValueMap);
         }else {
             List<String> fieldList = VciBaseUtil.str2List(fieldExpress);
-            Map<String,String> valueLowMap = new HashMap<>();
+            Map<String,Object> valueLowMap = new HashMap<>();
             valueMap.forEach((key,value)->{
                 valueLowMap.put(key.toLowerCase(),value);
             });
-            Map<String,String> boLowValueMap = new HashMap<>();
+            Map<String,Object> boLowValueMap = new HashMap<>();
             if(!CollectionUtils.isEmpty(boValueMap)){
                 boValueMap.forEach((key,value)->{
                     boLowValueMap.put(key.toLowerCase(),value);
@@ -806,7 +826,7 @@
             }
             StringBuilder sb = new StringBuilder();
             fieldList.stream().forEach(field->{
-                sb.append(valueLowMap.getOrDefault(field,boLowValueMap.getOrDefault(field,""))).append(" ");
+                sb.append(boLowValueMap.getOrDefault(field,valueLowMap.getOrDefault(field,""))).append(" ");
             });
             return sb.toString().trim();
         }

--
Gitblit v1.9.3