From b48383cfbab275b7b5c870549d11903908128a07 Mon Sep 17 00:00:00 2001
From: LSH
Date: 星期五, 11 八月 2023 13:24:54 +0800
Subject: [PATCH] #核价功能完善

---
 src/main/java/com/zy/crm/manager/controller/PriQuoteController.java |   34 +++++++++++++++++++++++++++-------
 1 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/src/main/java/com/zy/crm/manager/controller/PriQuoteController.java b/src/main/java/com/zy/crm/manager/controller/PriQuoteController.java
index 1de6b71..05c9a65 100644
--- a/src/main/java/com/zy/crm/manager/controller/PriQuoteController.java
+++ b/src/main/java/com/zy/crm/manager/controller/PriQuoteController.java
@@ -13,9 +13,11 @@
 import com.core.domain.KeyValueVo;
 import com.zy.crm.common.web.BaseController;
 import com.zy.crm.manager.entity.Item;
+import com.zy.crm.manager.entity.Plan;
 import com.zy.crm.manager.entity.PriQuote;
 import com.zy.crm.manager.entity.PriQuoteBudget;
 import com.zy.crm.manager.service.ItemService;
+import com.zy.crm.manager.service.PlanService;
 import com.zy.crm.manager.service.PriQuoteBudgetService;
 import com.zy.crm.manager.service.PriQuoteService;
 import org.apache.poi.xssf.usermodel.XSSFSheet;
@@ -37,7 +39,7 @@
     private PriQuoteService priQuoteService;
 
     @Autowired
-    private ItemService itemService;
+    private PlanService planService;
 
     @Autowired
     private PriQuoteBudgetService priQuoteBudgetService;
@@ -67,15 +69,33 @@
     }
 
     private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){
+        Long deptId = getDeptId();
+        boolean signUserId = false;
+        boolean signDeptId = false;
+        for (Map.Entry<String, Object> entry : map.entrySet()){
+            if (entry.getKey().equals("dept_id")){
+                signDeptId = true;
+            }
+        }
         for (Map.Entry<String, Object> entry : map.entrySet()){
             String val = String.valueOf(entry.getValue());
             if (val.contains(RANGE_TIME_LINK)){
                 String[] dates = val.split(RANGE_TIME_LINK);
                 wrapper.ge(entry.getKey(), DateUtils.convert(dates[0]));
                 wrapper.le(entry.getKey(), DateUtils.convert(dates[1]));
+            } else if (entry.getKey().equals("dept_id")){
+                if (!val.equals("19")){
+                    wrapper.eq(entry.getKey(), val);
+                }
+            } else if (entry.getKey().equals("user_id") && !signDeptId){
+                signUserId = true;
+                wrapper.eq(entry.getKey(), val);
             } else {
                 wrapper.like(entry.getKey(), val);
             }
+        }
+        if (!signUserId && !signDeptId){
+            wrapper.eq("user_id", getUserId());
         }
     }
 
@@ -102,12 +122,12 @@
         priQuote.setUpdateTime(new Date());
 
         //涓氬姟鍛�
-        Item item = itemService.selectById(priQuote.getItemId());
-        priQuote.setMemberId(item.getMember());
+        Plan plan = planService.selectById(priQuote.getItemId());
+        priQuote.setMemberId(plan.getUserId());
 
         //璁剧疆椤圭洰娴佺▼
-        item.setStep(5);
-        itemService.updateById(item);
+        plan.setStep(5);
+        planService.updateById(plan);
 
         priQuoteService.insert(priQuote);
         return R.ok();
@@ -137,8 +157,8 @@
         priQuote.setUpdateTime(new Date());
 
         //涓氬姟鍛�
-        Item item = itemService.selectById(priQuote.getItemId());
-        priQuote.setMemberId(item.getMember());
+        Plan plan = planService.selectById(priQuote.getItemId());
+        priQuote.setMemberId(plan.getUserId());
 
         priQuoteService.insert(priQuote);
         return R.ok();

--
Gitblit v1.9.1