From 8b434a01ef9e2e48d1300be7792caa91f653b08e Mon Sep 17 00:00:00 2001
From: LSH
Date: 星期一, 11 九月 2023 20:04:05 +0800
Subject: [PATCH] #销售核价可查看甲方单位与规划单信息

---
 src/main/java/com/zy/crm/manager/controller/PriSalesController.java |   42 +++++++++++++++++++++++-------------------
 1 files changed, 23 insertions(+), 19 deletions(-)

diff --git a/src/main/java/com/zy/crm/manager/controller/PriSalesController.java b/src/main/java/com/zy/crm/manager/controller/PriSalesController.java
index 0b5eccc..32880ae 100644
--- a/src/main/java/com/zy/crm/manager/controller/PriSalesController.java
+++ b/src/main/java/com/zy/crm/manager/controller/PriSalesController.java
@@ -12,14 +12,8 @@
 import com.core.common.R;
 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.PriOnline;
-import com.zy.crm.manager.entity.PriSales;
-import com.zy.crm.manager.service.ItemService;
-import com.zy.crm.manager.service.PlanService;
-import com.zy.crm.manager.service.PriOnlineService;
-import com.zy.crm.manager.service.PriSalesService;
+import com.zy.crm.manager.entity.*;
+import com.zy.crm.manager.service.*;
 import org.apache.poi.xssf.usermodel.XSSFSheet;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -39,10 +33,13 @@
     private PriSalesService priSalesService;
 
     @Autowired
-    private PriOnlineService priOnlineService;
+    private PriOnline2Service priOnline2Service;
 
     @Autowired
     private PlanService planService;
+
+    @Autowired
+    private PriQuoteBudgetService priQuoteBudgetService;
 
     @RequestMapping(value = "/priSales/{id}/auth")
     @ManagerAuth
@@ -99,17 +96,18 @@
     }
 
     @RequestMapping(value = "/priSales/add/auth")
-    @ManagerAuth
+    @ManagerAuth(memo = "娣诲姞浜у搧璐圭敤鏄庣粏")
     public R add(@RequestBody Map<String,Object> map) {
-        PriOnline priOnline = priOnlineService.selectById(Long.parseLong(map.get("priOnlineId").toString()));
+        PriOnline2 priOnline2 = priOnline2Service.selectById(Long.parseLong(map.get("priOnlineId").toString()));
 
         PriSales priSales = new PriSales();
         priSales.setCreateTime(new Date());
         priSales.setTitle(map.get("title").toString());
-        priSales.setTemplateName(priOnline.getTemplateName());
+        priSales.setTemplateName(priOnline2.getTemplateName());
         priSales.setSheetData(map.get("sheetData").toString());
-        priSales.setItemId(priOnline.getItemId());
-        priSales.setOrderNum(priOnline.getOrderNum());
+        priSales.setPriOnline2Id(Long.parseLong(map.get("priOnlineId").toString()));
+        priSales.setItemId(priOnline2.getItemId());
+        priSales.setOrderNum(priOnline2.getOrderNum());
         SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
         priSales.setInOrderNum(format.format(new Date()));
 
@@ -134,7 +132,7 @@
     }
 
     @RequestMapping(value = "/priSales/addOther/auth")
-    @ManagerAuth
+    @ManagerAuth(memo = "鍙﹀瓨浜у搧璐圭敤鏄庣粏")
     public R addOther(@RequestBody Map<String,Object> map) {
         PriSales online = priSalesService.selectById(Long.parseLong(map.get("id").toString()));
 
@@ -165,7 +163,7 @@
     }
 
     @RequestMapping(value = "/priSales/update/auth")
-    @ManagerAuth
+    @ManagerAuth(memo = "鏇存柊浜у搧璐圭敤鏄庣粏")
     public R update(@RequestBody Map<String,Object> map){
         PriSales priSales = priSalesService.selectById(Long.parseLong(map.get("id").toString()));
         priSales.setTitle(map.get("title").toString());
@@ -179,7 +177,7 @@
     }
 
     @RequestMapping(value = "/priSales/updateForm/auth")
-    @ManagerAuth
+    @ManagerAuth(memo = "鏇存柊浜у搧璐圭敤鏄庣粏妯℃澘鍚嶅拰鏍囬")
     public R updateForm(Long id,String templateName,String title){
         PriSales priSales = priSalesService.selectById(id);
         priSales.setTemplateName(templateName);
@@ -193,10 +191,16 @@
     }
 
     @RequestMapping(value = "/priSales/delete/auth")
-    @ManagerAuth
+    @ManagerAuth(memo = "鍒犻櫎浜у搧璐圭敤鏄庣粏")
     public R delete(Long[] ids){
         if (Cools.isEmpty(ids)){
             return R.error();
+        }
+        for (Long id : ids){
+            int  priQuoteBudget= priQuoteBudgetService.selectCount(new EntityWrapper<PriQuoteBudget>().eq("pri_sales_id", id));
+            if (priQuoteBudget!=0){
+                return R.error("瀛樺湪鍏宠仈鐨勬姤浠烽绠楀崟锛岀姝㈠垹闄わ紒锛侊紒");
+            }
         }
         priSalesService.deleteBatchIds(Arrays.asList(ids));
         return R.ok();
@@ -224,7 +228,7 @@
         for (PriSales priSales : page.getRecords()){
             Map<String, Object> map = new HashMap<>();
             map.put("id", priSales.getId());
-            map.put("value", priSales.getInOrderNum() + "/" + priSales.getPlanId$() + "/" + priSales.getMemberId$());
+            map.put("value", priSales.getInOrderNum() + "/" + priSales.getPlanId$() + "/" + priSales.getMemberId$()+"/" + priSales.getTemplateName());
             result.add(map);
         }
         return R.ok(result);

--
Gitblit v1.9.1