Sfoglia il codice sorgente

交付范围信息点查询bug修复

linhuili 2 anni fa
parent
commit
e95e56e43f

+ 27 - 3
dmp-business/dmp-rwd/src/main/java/com/persagy/dmp/rwd/delivery/controller/ObjectInfoCollectController.java

@@ -1,7 +1,6 @@
 package com.persagy.dmp.rwd.delivery.controller;
 
 import cn.hutool.core.collection.CollUtil;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fasterxml.jackson.databind.node.ObjectNode;
@@ -48,8 +47,9 @@ public class ObjectInfoCollectController {
         if(criteria == null) {
             throw new BusinessException(ResponseCode.A0400.getCode(), ResponseCode.A0400.getDesc());
         }
-        // deliveryType 字段预留,暂不根据此字段查询
-        criteria.getCriteria().remove("deliveryType");
+        // deliveryType 字段处理
+        handleQueryCritera(criteria);
+
         QueryWrapper<ObjectInfoCollect> wrapper = new QueryWrapper<>();
         // 转换查询条件
         QueryCriteriaHelper.toWrapper(wrapper, criteria, ObjectInfoCollect.class);
@@ -183,4 +183,28 @@ public class ObjectInfoCollectController {
         }
     }
 
+    /**
+     * 处理deliveryType查询条件 0-项目交付范围 1-现场交付范围 2- 项目、现场
+     * @param criteria
+     */
+    private void handleQueryCritera(QueryCriteria criteria){
+        ObjectNode queryCriteria = criteria.getCriteria();
+        if(CollUtil.isEmpty(queryCriteria)){
+            return;
+        }
+        String jsonNode = queryCriteria.get("deliveryType").toString();
+        if(jsonNode!=null){
+            String deliveryType = jsonNode.toString();
+            criteria.getCriteria().remove("deliveryType");
+            if("0".equals(deliveryType)){
+                //查询项目交付范围下的信息点
+                criteria.getCriteria().withArray("deliveryType").add(0).add(2);
+            }
+            if("1".equals(deliveryType)){
+                //查询现场交付范围信息点
+                criteria.getCriteria().withArray("deliveryType").add(1).add(2);
+            }
+        }
+    }
+
 }