| | |
| | | private WeeklyFollService weeklyFollService; |
| | | @Autowired |
| | | private SmsCodeService smsCodeService; |
| | | @Autowired |
| | | private CstmrService cstmrService; |
| | | |
| | | String PZH = " ————————————————— "; |
| | | Integer PBN = 3; |
| | |
| | | throw new CoolException("参数为空:WeeklyDailyPlanList"); |
| | | } else if (Cools.isEmpty(param.getWeeklyId())){ |
| | | throw new CoolException("参数为空:WeeklyId"); |
| | | } else if (Cools.isEmpty(param.getWeeklyType())){ |
| | | throw new CoolException("参数为空:WeeklyDailyPlanList"); |
| | | } else if (Cools.isEmpty(param.getType())){ |
| | | throw new CoolException("参数为空:Type"); |
| | | } else if (Cools.isEmpty(param.getWeeklyType())){ |
| | |
| | | throw new CoolException("参数为空:WeeklyDailyRealityList"); |
| | | } else if (Cools.isEmpty(param.getWeeklyId())){ |
| | | throw new CoolException("参数为空:WeeklyId"); |
| | | } else if (Cools.isEmpty(param.getWeeklyType())){ |
| | | throw new CoolException("参数为空:WeeklyDailyPlanList"); |
| | | } else if (Cools.isEmpty(param.getType())){ |
| | | throw new CoolException("参数为空:Type"); |
| | | } else if (Cools.isEmpty(param.getWeeklyType())){ |
| | |
| | | } |
| | | return R.ok("回退成功"); |
| | | } |
| | | |
| | | @RequestMapping(value = "/weekly/from/add/phone/auth") |
| | | @ManagerAuth(memo = "周计划/日计划/日实际") |
| | | @Transactional |
| | | public R formAddModifyPhone(@RequestBody WeeklyDomainParam param){ |
| | | try{ |
| | | if (Cools.isEmpty(param)){ |
| | | throw new CoolException("参数为空:WeeklyDomainParam"); |
| | | } else if (Cools.isEmpty(param.getWeeklyDailyRealityList()) || param.getWeeklyDailyRealityList().size()==0){ |
| | | throw new CoolException("参数为空:WeeklyDailyRealityList"); |
| | | } else if (Cools.isEmpty(param.getWeeklyId())){ |
| | | throw new CoolException("参数为空:WeeklyId"); |
| | | // } else if (Cools.isEmpty(param.getType())){ |
| | | // throw new CoolException("参数为空:Type"); |
| | | } else if (Cools.isEmpty(param.getWeeklyType())){ |
| | | throw new CoolException("参数为空:Weekly"); |
| | | } |
| | | Date now = new Date(); |
| | | Weekly weekly = weeklyService.selectById(param.getWeeklyId()); |
| | | weekly.setUpdateBy(getUserId()); |
| | | weekly.setUpdateTime(now); |
| | | |
| | | |
| | | List<Date> dateList = new ArrayList<>();//获取周一与周日日期 |
| | | dateList = TimeCalculatorUtils.WeeklyMondayAndSundayNow(weekly.getStartTime()); |
| | | |
| | | List<Date> dates = TimeCalculatorUtils.WeeklyListDays(dateList);//获取周一到周日日期 |
| | | |
| | | try{ |
| | | weeklyService.updateById(weekly); |
| | | } catch (Exception e) { |
| | | log.error("更新周计划主表失败,异常信息:"+e); |
| | | throw new CoolException("更新周计划主表失败"); |
| | | } |
| | | |
| | | List<CstmrUtilsParam> cstmrUtilsParamList = new ArrayList<>(); |
| | | for (WeeklyDailyReality weeklyDailyReality: param.getWeeklyDailyRealityList()){ |
| | | Cstmr cstmr = null; |
| | | if (!Cools.isEmpty(weeklyDailyReality.getCstmrName())){ |
| | | cstmr = cstmrService.selectByName(getHostId(), weeklyDailyReality.getCstmrName()); |
| | | if(Cools.isEmpty(cstmr)){ |
| | | throw new CoolException("未查询到甲方单位!"); |
| | | }else { |
| | | weeklyDailyReality.setCstmrId(cstmr.getId()); |
| | | } |
| | | } |
| | | weeklyDailyReality.setHostId(getHostId()); |
| | | weeklyDailyReality.setDeptId(getDeptId()); // 所属部门 |
| | | weeklyDailyReality.setUserId(getUserId()); // 所属人员 |
| | | |
| | | weeklyDailyReality.setDirector(getUserId()); // 所属人员 |
| | | |
| | | weeklyDailyReality.setCreateBy(getUserId()); |
| | | weeklyDailyReality.setCreateTime(now); |
| | | weeklyDailyReality.setUpdateBy(getUserId()); |
| | | weeklyDailyReality.setUpdateTime(now); |
| | | |
| | | weeklyDailyReality.setStatus(weekly.getStatus()); |
| | | |
| | | weeklyDailyReality.setDailyTime(dates.get(weeklyDailyReality.getWeeklyDay()-1)); |
| | | weeklyDailyReality.setWeeklyId(weekly.getId()); |
| | | |
| | | try{ |
| | | weeklyDailyRealityService.insert(weeklyDailyReality); |
| | | } catch (Exception e){ |
| | | log.error("新增日计划失败"+e); |
| | | throw new CoolException("新增日计划失败"); |
| | | } |
| | | |
| | | } |
| | | |
| | | } catch (Exception e){ |
| | | log.error("更新周计划异常,异常信息:"+e); |
| | | throw new CoolException("更新周计划失败==>"+e); |
| | | } |
| | | |
| | | return R.ok("更新成功"); |
| | | } |
| | | } |