|  |  |  | 
|---|
|  |  |  | plan.setUpdateTime(new Date()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | plan.setForm(JSON.toJSONString(param));     // 自定义表单内容 | 
|---|
|  |  |  | User manager = userService.getDeptManager(getHostId(), getUser().getDeptId()); | 
|---|
|  |  |  | plan.setSettleMsg(JSON.toJSONString(SettleDto.init(plan, manager))); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (!planService.updateById(plan)) { | 
|---|
|  |  |  | throw new CoolException("保持失败,请重试"); | 
|---|
|  |  |  | 
|---|
|  |  |  | @PostMapping(value = "/plan/approval/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R approval(@RequestParam Long planId){ | 
|---|
|  |  |  | Plan plan = planService.selectById(planId); | 
|---|
|  |  |  | assert plan != null; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | switch (plan.getSettle()) { | 
|---|
|  |  |  | case 1: | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case 2: | 
|---|
|  |  |  | // 本组组长审核 | 
|---|
|  |  |  | User user = userService.selectById(plan.getUserId()); | 
|---|
|  |  |  | User manager = userService.getDeptManager(getHostId(), user.getDeptId()); | 
|---|
|  |  |  | if (manager.getId().equals(getUserId())) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 查找规划组长 | 
|---|
|  |  |  | plan.setSettleMsg(JSON.toJSONString(SettleDto.init(plan, manager))); | 
|---|
|  |  |  | // 修改 settle 步骤数据 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 修改规划单状态 | 
|---|
|  |  |  | plan.setSettle(3);  // 规划组长待审 | 
|---|
|  |  |  | plan.setUpdateBy(getUserId()); | 
|---|
|  |  |  | plan.setUpdateTime(new Date()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (!planService.updateById(plan)) { | 
|---|
|  |  |  | throw new CoolException("审核失败,请联系管理员"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 添加规划组长跟进人 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | return R.error("抱歉,您没有审核的权限"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case 3: | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case 4: | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | default: | 
|---|
|  |  |  | return R.error(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|