From caac62f1f080ee8db3aba698f7f67ce105ad9ffe Mon Sep 17 00:00:00 2001
From: LSH
Date: 星期一, 09 十月 2023 13:30:58 +0800
Subject: [PATCH] #核价相关

---
 src/main/java/com/zy/crm/manager/controller/PlanController.java |   66 +++++++++++++++++++++++++++------
 1 files changed, 54 insertions(+), 12 deletions(-)

diff --git a/src/main/java/com/zy/crm/manager/controller/PlanController.java b/src/main/java/com/zy/crm/manager/controller/PlanController.java
index 0ba45fb..b980ec9 100644
--- a/src/main/java/com/zy/crm/manager/controller/PlanController.java
+++ b/src/main/java/com/zy/crm/manager/controller/PlanController.java
@@ -12,11 +12,9 @@
 import com.core.common.R;
 import com.core.domain.KeyValueVo;
 import com.core.exception.CoolException;
-import com.zy.crm.common.entity.RouteCollectCountType;
 import com.zy.crm.common.model.SettleDto;
 import com.zy.crm.common.service.OssService;
 import com.zy.crm.common.utils.FileSaveExampleUtil;
-import com.zy.crm.common.utils.SetOfUtils;
 import com.zy.crm.common.web.BaseController;
 import com.zy.crm.manager.controller.result.FollowerTableVo;
 import com.zy.crm.manager.entity.*;
@@ -33,20 +31,11 @@
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
-import org.springframework.core.io.Resource;
-import org.springframework.core.io.FileSystemResource;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
 
 import javax.servlet.http.HttpServletResponse;
-import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.*;
-
-import static java.util.stream.Collectors.toList;
 
 @RestController
 public class PlanController extends BaseController {
@@ -61,6 +50,10 @@
     private OssService ossService;
     @Autowired
     private PriOnline2Service priOnline2Service;
+    @Autowired
+    private OrderService orderService;
+    @Autowired
+    private SmsCodeService smsCodeService;
 
     @GetMapping(value = "/plan/{id}/auth")
     @ManagerAuth
@@ -124,6 +117,16 @@
         if (planService.selectByUuid(hostId, plan.getUuid()) != null) {
             throw new CoolException("瑙勫垝鍗曞凡瀛樺湪");
         }
+
+        Order order = orderService.selectById(plan.getOrderId());
+        if (Cools.isEmpty(order)) {
+            throw new CoolException("璺熻釜椤圭洰涓嶅瓨鍦�");
+        }
+
+        if (!order.getDirector().equals(getUserId())){
+            throw new CoolException("鍙厑璁歌窡韪」鐩礋璐d汉娣诲姞鎵�閫夐」鐩鍒掔敵璇峰崟");
+        }
+
         Date now = new Date();
         plan.setHostId(hostId);
         plan.setUuid(planService.getUuid(hostId));  // 瑙勫垝鍗曚唬鍙�
@@ -135,7 +138,7 @@
         plan.setCreateTime(now);
         plan.setUpdateBy(getUserId());
         plan.setUpdateTime(now);
-        plan.setStatus(1);
+        plan.setStatus(0);
 
         plan.setForm(JSON.toJSONString(param));     // 鑷畾涔夎〃鍗曞唴瀹�
         plan.setSettle(1);  // 1.寮�濮�
@@ -431,6 +434,11 @@
                 plan.setUpdateBy(getUserId());
                 plan.setUpdateTime(new Date());
 
+                boolean sendSmsCode = smsCodeService.sendSmsCodeText(planner.getMobile());
+                if (!sendSmsCode) {
+                    System.out.println("鐭俊鍙戦�佸け璐ワ紒");
+                }
+
                 if (!planService.updateById(plan)) {
                     throw new CoolException("瀹℃牳澶辫触锛岃鑱旂郴绠$悊鍛�");
                 }
@@ -508,6 +516,7 @@
                 plan.setSettleMsg(JSON.toJSONString(list1));
                 // 淇敼瑙勫垝鍗曠姸鎬�
                 plan.setSettle(4);  // 瀹℃壒閫氳繃
+                plan.setStatus(1);  // 瀹℃壒閫氳繃
                 plan.setUpdateBy(getUserId());
                 plan.setUpdateTime(new Date());
 
@@ -587,6 +596,39 @@
         return R.ok(result);
     }
 
+    @RequestMapping(value = "/planQueryNameToRob/auth")
+    @ManagerAuth
+    public R planQueryNameToRob(String condition) {
+        EntityWrapper<Plan> wrapper = new EntityWrapper<>();
+        wrapper.like("name", condition);
+        wrapper.eq("status",1);
+
+        int type =1;
+        if (getUser().getNickname().equals("鏉庝笘璞�3绾�")){
+            type=2;
+        }
+
+        List<Long> typeList = new ArrayList<>();
+        List<PlanType> planTypes = planTypeService.selectList(new EntityWrapper<PlanType>().eq("type", type));
+        for (PlanType planType : planTypes){
+            typeList.add(planType.getId());
+        }
+        wrapper.in("plan_type",typeList);
+
+//        Page<Plan> page = planService.selectPage(new Page<>(0, 10), wrapper);
+        List<Plan> plans = planService.selectList(wrapper);
+        List<Map<String, Object>> result = new ArrayList<>();
+//        for (Plan plan : page.getRecords()){
+        for (Plan plan : plans){
+            Map<String, Object> map = new HashMap<>();
+            map.put("id", plan.getId());
+//            map.put("value", plan.getName()+"---"+plan.getId());
+            map.put("value", plan.getName());
+            result.add(map);
+        }
+        return R.ok(result);
+    }
+
     @RequestMapping(value = "/plan/check/column/auth")
     @ManagerAuth
     public R query(@RequestBody JSONObject param) {

--
Gitblit v1.9.1