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 | 70 ++++++++++++++++++++++++++++------- 1 files changed, 56 insertions(+), 14 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 12701d1..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 @@ -26,6 +26,7 @@ import com.vci.starter.web.wrapper.VciQueryWrapperForDO; 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; @@ -892,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); @@ -910,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("*"); @@ -925,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,"鏌ヨ妯℃澘鐨勫悕绉�"); @@ -934,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(); @@ -965,7 +969,7 @@ } } } - }); + });*/ } }catch(PLException e){ logger.error(e.code,e); @@ -975,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); + } + } + }); } /** @@ -989,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); @@ -1093,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); @@ -1441,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); @@ -2067,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); } @@ -2083,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); } @@ -2100,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); @@ -2171,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)); } @@ -2186,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