wangting
2024-12-02 cdba4febf23c6f55346a474579361923aacf0bc9
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebBoServiceImpl.java
@@ -30,6 +30,7 @@
import com.vci.web.util.PlatformClientUtil;
import com.vci.web.util.WebUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.math3.distribution.TDistribution;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.slf4j.Logger;
@@ -893,7 +894,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);
@@ -911,7 +912,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("*");
@@ -926,7 +927,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,"查询模板的名称");
@@ -935,9 +936,10 @@
         //因为之前平台的Tool.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);
@@ -985,7 +987,7 @@
    * @param qt
    * @param replaceLowMap
    */
   private void recurReplaceCiMap(QueryTemplate qt, Map<String,String> replaceLowMap){
   private void recurReplaceCiMap(QueryTemplate qt, Map<String,Object> replaceLowMap){
      //跳出递归
      if(Func.isEmpty(qt)){
         return;
@@ -1009,7 +1011,7 @@
                     }
                  }
               }else if(replaceLowMap.containsKey(value.toLowerCase())){
                  lInfo.getValue().setOrdinaryValue(replaceLowMap.get(value.toLowerCase()));
                  lInfo.getValue().setOrdinaryValue((String) replaceLowMap.get(value.toLowerCase()));
               }
            }else {
               recurReplaceCiMap(lInfo.getValue().getQueryTemplate(),replaceLowMap);
@@ -1030,7 +1032,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);
@@ -1134,7 +1136,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);
@@ -1482,7 +1484,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);
@@ -2108,7 +2110,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);
   }
@@ -2124,7 +2126,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);
   }
@@ -2141,7 +2143,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);
@@ -2212,7 +2214,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));
   }
   
@@ -2227,7 +2229,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);
@@ -2272,9 +2274,13 @@
   public Map cbo2Map(BusinessObject cbo) throws VciBaseException {
      Map<String,String> map = new HashMap<String, String>();
      WebUtil.copyValueToMapFromCbos(cbo, map);
      return map;
      //TODO:20241128 过滤掉空key和空value
      Map<String, Object> filteredCbo2Map = map.entrySet()
            .stream()
            .filter(entry -> entry.getKey() != null && !entry.getKey().isEmpty() && entry.getValue() != null && !entry.getValue().toString().isEmpty())
            .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
      return filteredCbo2Map;
   }
    /**
     * map转为BusinessObject