中扬CRM客户关系管理系统
#
luxiaotao1123
2022-11-28 5528e869fc25354fe62fbb228cfdd40e0df94dbc
src/main/java/com/zy/crm/manager/controller/PlanController.java
@@ -8,6 +8,7 @@
import com.core.annotations.ManagerAuth;
import com.core.common.BaseRes;
import com.core.common.Cools;
import com.core.common.DateUtils;
import com.core.common.R;
import com.core.domain.KeyValueVo;
import com.core.exception.CoolException;
@@ -184,8 +185,33 @@
                if (manager.getId().equals(getUserId())) {
                    // 查找规划组长
                    plan.setSettleMsg(JSON.toJSONString(SettleDto.init(plan, manager)));
                    PlanType planType = planTypeService.selectById(plan.getPlanType());
                    User planLeader = planTypeService.findPlanLeader(planType);
                    if (Cools.isEmpty(planLeader)) {
                        throw new CoolException("未查找到规划组长,请联系管理员");
                    }
                    // 修改 settle 步骤数据
                    List<SettleDto> list = JSON.parseArray(plan.getSettleMsg(), SettleDto.class);
                    for (SettleDto dto : list) {
                        switch (dto.getStep()) {
                            case 1:
                                dto.setCurr(Boolean.FALSE);
                                break;
                            case 2:
                                dto.setCurr(Boolean.TRUE);
                                dto.setMsg("本组组长" + manager.getNickname() + "审批通过");
                                dto.setTime(DateUtils.convert(new Date()));
                                break;
                            case 3:
                                dto.setUserId(planLeader.getId());
                                dto.setUsername(planLeader.getNickname());
                                break;
                            default:
                                break;
                        }
                    }
                    plan.setSettleMsg(JSON.toJSONString(list));
                    // 修改规划单状态
                    plan.setSettle(2);  // 规划组长待审
@@ -197,6 +223,12 @@
                    }
                    // 添加规划组长跟进人
                    PlanFoll planFoll = new PlanFoll();
                    planFoll.setPlanId(plan.getId());
                    planFoll.setUserId(planLeader.getId());
                    if (!planFollService.insert(planFoll)) {
                        throw new CoolException("审核失败,请联系管理员");
                    }
                } else {
                    return R.error("抱歉,您没有审核的权限");