| | |
| | | @PostMapping(value = "/plan/approval/auth") |
| | | @ManagerAuth |
| | | public R approval(@RequestParam Long planId, |
| | | @RequestParam(required = false) Long planner){ |
| | | @RequestParam(required = false) Long plannerId){ |
| | | Plan plan = planService.selectById(planId); |
| | | assert plan != null; |
| | | |
| | |
| | | } |
| | | break; |
| | | case 2: |
| | | // 查找规划组长 |
| | | PlanType planType = planTypeService.selectById(plan.getPlanType()); |
| | | User planLeader = planTypeService.findPlanLeader(planType); |
| | | if (Cools.isEmpty(planLeader)) { |
| | | throw new CoolException("未查找到规划组长,请联系管理员"); |
| | | } |
| | | if (Cools.isEmpty(planLeader)) { |
| | | throw new CoolException("未查找到规划组长,请联系管理员"); |
| | | } |
| | | if (!getUserId().equals(planLeader.getId())) { |
| | | return R.error("抱歉,您没有审核的权限"); |
| | | } |
| | | if (Cools.isEmpty(plannerId)) { |
| | | return R.error("指定规划员不能为空"); |
| | | } |
| | | User planner = userService.selectById(plannerId); |
| | | // 修改 settle 步骤数据 |
| | | List<SettleDto> list = JSON.parseArray(plan.getSettleMsg(), SettleDto.class); |
| | | for (SettleDto dto : list) { |
| | | switch (dto.getStep()) { |
| | | case 2: |
| | | dto.setCurr(Boolean.FALSE); |
| | | break; |
| | | case 3: |
| | | dto.setCurr(Boolean.TRUE); |
| | | dto.setUserId(planLeader.getId()); |
| | | dto.setUsername(planLeader.getNickname()); |
| | | dto.setMsg("售前组长" + planLeader.getNickname() + "审批通过"); |
| | | dto.setTime(DateUtils.convert(new Date())); |
| | | break; |
| | | case 4: |
| | | dto.setUserId(planner.getId()); |
| | | dto.setUsername(planner.getNickname()); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | plan.setSettleMsg(JSON.toJSONString(list)); |
| | | // 修改规划单状态 |
| | | plan.setSettle(3); // 规划员待审 |
| | | plan.setPlanner(planner.getId()); |
| | | plan.setUpdateBy(getUserId()); |
| | | plan.setUpdateTime(new Date()); |
| | | |
| | | if (!planService.updateById(plan)) { |
| | | throw new CoolException("审核失败,请联系管理员"); |
| | | } |
| | | |
| | | // 添加规划组长跟进人 |
| | | PlanFoll planFoll = new PlanFoll(); |
| | | planFoll.setPlanId(planner.getId()); |
| | | planFoll.setUserId(planLeader.getId()); |
| | | if (!planFollService.insert(planFoll)) { |
| | | throw new CoolException("审核失败,请联系管理员"); |
| | | } |
| | | |
| | | break; |
| | | case 3: |
| | | break; |
| | |
| | | default: |
| | | return R.error(); |
| | | } |
| | | return R.ok(); |
| | | return R.ok("审批成功"); |
| | | } |
| | | |
| | | @PostMapping(value = "/plan/planner/list/auth") |