From afd5c86b170c2fc63896a2475097cf1654a3c889 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期三, 27 十一月 2024 23:02:07 +0800
Subject: [PATCH] 业务类型树查询接口新增UIDataTree用来专门返回key:list形式的参数,修改多处Map<String,String>为Map<String,Object>。

---
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebBoServiceImpl.java |   79 +++++++++++++++++++++++++++++----------
 1 files changed, 59 insertions(+), 20 deletions(-)

diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebBoServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebBoServiceImpl.java
index f53eb5b..be39cfa 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebBoServiceImpl.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebBoServiceImpl.java
@@ -1,7 +1,6 @@
 package com.vci.web.service.impl;
 
 import com.vci.client.common.oq.OQTool;
-import com.vci.client.common.providers.ClientServiceProvider;
 import com.vci.common.qt.object.*;
 import com.vci.common.utility.ObjectUtility;
 import com.vci.corba.common.PLException;
@@ -15,6 +14,7 @@
 import com.vci.corba.query.data.KV;
 import com.vci.frameworkcore.compatibility.SmUserQueryServiceI;
 import com.vci.omd.utils.ObjectTool;
+import com.vci.pagemodel.*;
 import com.vci.starter.web.annotation.Column;
 import com.vci.starter.web.constant.QueryOptionConstant;
 import com.vci.starter.web.enumpck.BooleanEnum;
@@ -24,9 +24,9 @@
 import com.vci.starter.web.util.BeanUtil;
 import com.vci.starter.web.util.VciBaseUtil;
 import com.vci.starter.web.wrapper.VciQueryWrapperForDO;
-import com.vci.web.pageModel.*;
 import com.vci.web.properties.WebProperties;
 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;
@@ -154,9 +154,7 @@
 		if(btmName!=null){
 			btmName = btmName.trim().toLowerCase();
 		}
-		//todo 鐢变簬鐧诲綍闂鍚庣画闇�瑕佷慨鏀�
-//		String userid = WebUtil.getCurrentUserId();
-		String userid = "1";
+		String userid = WebUtil.getCurrentUserId();
 		if(!hasCreatedCbos.containsKey(btmName)){
 			if(StringUtils.isEmpty(userid)){
 				throw new VciBaseException(msgCodePrefix +"noHasUserid");
@@ -199,7 +197,7 @@
 		bo.versionRule = String.valueOf(btmTypeVO.getVersionRule());
 		if(StringUtils.isNotBlank(btmTypeVO.getRevisionRuleId())){
 			OsRevisionRuleVO revisionRuleVO = revisionRuleService.getRevisionRuleById(btmTypeVO.getRevisionRuleId());
-			bo.revisionValue = revisionRuleVO.getStartCode();
+			bo.revisionValue = revisionRuleVO.getInitialValue();
 		}
 
 		bo.revisionSeq = (short) 1;
@@ -895,7 +893,7 @@
 	 */
 	@Override
 	public List<BusinessObject> queryCBOByScheme(String queryScheme,
-			Map<String, String> conditionMap, Map<String, String> replaceMap)
+			Map<String, String> conditionMap, Map<String, Object> replaceMap)
 			throws VciBaseException {
 		PageHelper ph = new PageHelper(-1);
 		return queryCBOByScheme(queryScheme,conditionMap,replaceMap,ph);
@@ -913,7 +911,7 @@
 	 */
 	@Override
 	public List<BusinessObject> queryCBOByScheme(String queryScheme,
-			Map<String, String> conditionMap, Map<String, String> replaceMap,
+			Map<String, String> conditionMap, Map<String, Object> replaceMap,
 			PageHelper ph) throws VciBaseException {
 		List<String> clauseList = new ArrayList<String>();
 		clauseList.add("*");
@@ -928,7 +926,7 @@
 	 * @throws VciBaseException 鏌ヨ鍑洪敊鐨勬椂鍊欎細鎶涘嚭寮傚父
 	 */
 	@Override
-	public QueryTemplate getQtByName(String name, Map<String, String> replaceMap) throws VciBaseException{
+	public QueryTemplate getQtByName(String name, Map<String, Object> replaceMap) throws VciBaseException{
 		QueryTemplate qt = null;
 		try{
 			VciBaseUtil.alertNotNull(name,"鏌ヨ妯℃澘鐨勫悕绉�");
@@ -937,15 +935,18 @@
 			//鍥犱负涔嬪墠骞冲彴鐨凾ool.replaceQTValues 娌℃湁澶勭悊 ${xxx}銆傦紝 涓轰簡蹇界暐澶у皬鍐欙紝鎴戜滑杩欓噷鍗曠嫭澶勭悊 weidy@2021-3-10
 			//鎴戜滑杞崲涓哄皬鍐�
 			Condition condition = qt.getCondition();
-			Map<String,String> replaceLowMap = new HashMap<>();
+			Map<String,Object> replaceLowMap = new HashMap<>();
 			if(condition !=null && condition.getCIMap()!=null){
 				// Map<String, String> systemVarValueMap = VciSystemVarConstants.getSystemVarValueMap();
+				//杞皬鍐�
 				if(!CollectionUtils.isEmpty(replaceMap)){
 					replaceMap.forEach((key,value)->{
 						replaceLowMap.put(key.toLowerCase(),value);
 					});
 				}
-				Map<String, ConditionItem> ciMap = condition.getCIMap();
+				//鏀逛负閫掑綊锛屽鐞嗘ā鏉垮妯℃澘鐨勯棶棰�
+				this.recurReplaceCiMap(qt,replaceLowMap);
+				/*Map<String, ConditionItem> ciMap = condition.getCIMap();
 				ciMap.forEach((ciId,ci)->{
 					if(ci.isLeaf()) {
 						LeafInfo lInfo = ci.getLeafInfo();
@@ -968,7 +969,7 @@
 							}
 						}
 					}
-				});
+				});*/
 			}
 		}catch(PLException e){
 			logger.error(e.code,e);
@@ -978,6 +979,44 @@
 			throw new VciBaseException(this.msgCodePrefix + "qtError", new Object[]{name});
 		}
 		return qt;
+	}
+
+	/**
+	 * 閫掑綊澶勭悊ciMap涓�兼浛鎹㈤棶棰�,澶勭悊妯℃澘濂楁ā鏉跨殑闂
+	 * @param qt
+	 * @param replaceLowMap
+	 */
+	private void recurReplaceCiMap(QueryTemplate qt, Map<String,Object> replaceLowMap){
+		//璺冲嚭閫掑綊
+		if(Func.isEmpty(qt)){
+			return;
+		}
+		Map<String, ConditionItem> ciMap = qt.getCondition().getCIMap();
+		ciMap.forEach((ciId,ci)->{
+			if(ci.isLeaf()) {
+				LeafInfo lInfo = ci.getLeafInfo();
+				String value = lInfo.getValue().getOrdinaryValue();
+				if(StringUtils.isNotBlank(value)){
+					if(value.contains("#")){
+						//绯荤粺鍙橀噺.鏀寔涓�涓�
+						//lInfo.getValue().setOrdinaryValue(systemVarValueMap.getOrDefault(value.toUpperCase(),""));
+					}else if(value.contains("${")){
+						//鏈�${xxxx}鐨勬柟寮�
+						if(!CollectionUtils.isEmpty(replaceLowMap)) {
+							try {
+								lInfo.getValue().setOrdinaryValue(VciBaseUtil.replaceByFreeMarker(value, replaceLowMap));
+							}catch (Throwable e){
+								logger.error("鍙兘閰嶇疆鏈夐棶棰橈紝鍦ㄨ浆鎹reemarker琛ㄨ揪寮忕殑鏃跺�欙紝娌℃湁鎵惧埌瀵瑰簲鐨勫�硷紝鐩墠琛ㄨ揪寮忎负{}",new String[]{value},e);
+							}
+						}
+					}else if(replaceLowMap.containsKey(value.toLowerCase())){
+						lInfo.getValue().setOrdinaryValue((String) replaceLowMap.get(value.toLowerCase()));
+					}
+				}else {
+					recurReplaceCiMap(lInfo.getValue().getQueryTemplate(),replaceLowMap);
+				}
+			}
+		});
 	}
 
 	/**
@@ -992,7 +1031,7 @@
 	 */
 	@Override
 	public List<BusinessObject> queryCBOByScheme(String queryScheme,
-			Map<String, String> conditionMap, Map<String, String> replaceMap,
+			Map<String, String> conditionMap, Map<String, Object> replaceMap,
 			PageHelper ph, List<String> clauseList) throws VciBaseException {
 		QueryTemplate qt = getQtByName(queryScheme,replaceMap);
 		return baseQueryCBO(qt,conditionMap,ph,clauseList);
@@ -1096,7 +1135,7 @@
 	 */
 	@Override
 	public int queryCountByScheme(String queryScheme,
-			Map<String, String> conditionMap, Map<String, String> replaceMap)
+			Map<String, String> conditionMap, Map<String, Object> replaceMap)
 			throws VciBaseException {
 		QueryTemplate qt = getQtByName(queryScheme,replaceMap);
 		return baseQueryCount(qt,conditionMap);
@@ -1444,7 +1483,7 @@
 	@Override
 	public <T> List<T> queryObjectByScheme(String queryScheme, Class<T> c,
 			Map<String, String> conditionMap, PageHelper ph,
-			Map<String, String> replaceMap) throws VciBaseException {
+			Map<String, Object> replaceMap) throws VciBaseException {
 		WebUtil.alertNotNull(queryScheme,"鏌ヨ鏂规");
 		//鐩存帴浠庡璞¢噷鍘绘煡璇笟鍔$被鍨嬬殑鍚嶇О
 		swapConditionMap(c,conditionMap);
@@ -2070,7 +2109,7 @@
      */
 	@Override
 	public DataGrid queryGridByScheme(String queryScheme,
-			Map<String, String> conditionMap, Map<String, String> replaceMap)
+			Map<String, String> conditionMap, Map<String, Object> replaceMap)
 			throws VciBaseException {
 		return queryGridByScheme(queryScheme,conditionMap,replaceMap,new PageHelper(-1,true),null);
 	}
@@ -2086,7 +2125,7 @@
      */
 	@Override
 	public DataGrid queryGridByScheme(String queryScheme,
-			Map<String, String> conditionMap, Map<String, String> replaceMap,
+			Map<String, String> conditionMap, Map<String, Object> replaceMap,
 			PageHelper ph) throws VciBaseException {
 		return queryGridByScheme(queryScheme,conditionMap,replaceMap,ph,null);
 	}
@@ -2103,7 +2142,7 @@
      */
 	@Override
 	public DataGrid queryGridByScheme(String queryScheme,
-			Map<String, String> conditionMap, Map<String, String> replaceMap,
+			Map<String, String> conditionMap, Map<String, Object> replaceMap,
 			PageHelper ph, List<String> clauseList) throws VciBaseException {
 		if(ph == null){
 			ph = new PageHelper(-1,true);
@@ -2174,7 +2213,7 @@
      */
 	@Override
 	public DataGrid queryGridClassByScheme(String queryScheme, Class c,
-			Map<String, String> conditionMap,Map<String,String> replaceMap) throws VciBaseException {
+			Map<String, String> conditionMap,Map<String,Object> replaceMap) throws VciBaseException {
 		return queryGridClassByScheme(queryScheme,c,conditionMap,replaceMap,new PageHelper(-1,true));
 	}
 	
@@ -2189,7 +2228,7 @@
      */
 	@Override
 	public DataGrid queryGridClassByScheme(String queryScheme, Class c,
-			Map<String, String> conditionMap, Map<String,String> replaceMap,PageHelper ph)
+			Map<String, String> conditionMap, Map<String,Object> replaceMap,PageHelper ph)
 			throws VciBaseException {
 		if(ph == null){
 			ph = new PageHelper(-1,true);

--
Gitblit v1.9.3