中扬CRM客户关系管理系统
LSH
2023-10-09 caac62f1f080ee8db3aba698f7f67ce105ad9ffe
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));  // 规划单代号
@@ -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) {