中扬CRM客户关系管理系统
LSH
2023-10-07 46871cc790a14fd3aee71fd564938411fa39e3d6
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("只允许跟踪项目负责人添加所选项目规划申请单");
        }
        Date now = new Date();
        plan.setHostId(hostId);
        plan.setUuid(planService.getUuid(hostId));  // 规划单代号
@@ -151,7 +154,7 @@
        // 自动添加跟进人
        PlanFoll planFoll = new PlanFoll();
        planFoll.setPlanId(plan.getId());
        planFoll.setUserId(manager.getId());
        planFoll.setUserId(planLeader.getId());
        if (!planFollService.insert(planFoll)) {
            throw new CoolException("保持失败,请重试");
        }
@@ -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("审核失败,请联系管理员");
                }
@@ -527,7 +535,7 @@
        Plan plan = planService.selectById(planId);
        assert plan != null;
        if (plan.getSettle() != 2) {
        if (plan.getSettle() != 1) {
            return R.error();
        }
        // 查找规划组长