| | |
| | | private TTaskCleanService taskCleanService; |
| | | @Autowired |
| | | private TTemplateCountService templateCountService; |
| | | @Autowired |
| | | private TEarlyWarningService earlyWarningService; |
| | | |
| | | |
| | | // 每一个小时执行一次 |
| | | // @Scheduled(cron = "0 0 0 * * ?") |
| | | @Scheduled(fixedRate = 1500000000) |
| | | // @Scheduled(fixedRate = 1500000000) |
| | | public void dayOfCreateInspection() { |
| | | try { |
| | | |
| | |
| | | taskCleanService.updateBatchById(taskCleanList); |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | @Scheduled(cron = "0 0 20 * * ?") |
| | | public void dayOfEarlyWarning() { |
| | | try { |
| | | // 查询前一天为执行的所有任务,改成已超时状态 |
| | | List<TTask> taskCleanList = taskCleanService.list(Wrappers.lambdaQuery(TTask.class) |
| | | .like(TTask::getImplementTime, LocalDate.now().minusDays(1)) |
| | | .eq(TTask::getStatus, 1)); |
| | | if (!CollectionUtils.isEmpty(taskCleanList)) { |
| | | List<TEarlyWarning> earlyWarningList = new ArrayList<>(); |
| | | taskCleanList.forEach(task -> { |
| | | task.setStatus(2); |
| | | TEarlyWarning earlyWarning = new TEarlyWarning(); |
| | | earlyWarning.setWarningType(1); |
| | | earlyWarning.setTaskId(task.getId()); |
| | | earlyWarningList.add(earlyWarning); |
| | | }); |
| | | earlyWarningService.saveBatch(earlyWarningList); |
| | | taskCleanService.updateBatchById(taskCleanList); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | tasks.add(task); |
| | | } |
| | | |
| | | // 添加应生成任务数量 |
| | | TTemplateCount templateCount = new TTemplateCount(); |
| | | templateCount.setTemplateId(detail.getTemplateId()); |
| | | templateCount.setTaskCount(tLocationList.size()* cycle); |
| | | templateCount.setUserId(sysUser.getUserId()); |
| | | templateCountService.save(templateCount); |
| | | |
| | | // 添加应生成任务数量 |
| | | TTemplateCount templateCount = new TTemplateCount(); |
| | | templateCount.setTemplateId(detail.getTemplateId()); |
| | | // 查询所有的保洁员下面的点位 |
| | | List<String> cleanIds = cleaners.stream().map(TCleaner::getId).collect(Collectors.toList()); |
| | | List<TLocation> tLocations = locationService.list(Wrappers.lambdaQuery(TLocation.class) |
| | | .in(TLocation::getLocationCleaner, cleanIds)); |
| | | templateCount.setTaskCount(tLocations.size()); |
| | | templateCount.setUserId(sysUser.getUserId()); |
| | | templateCountService.save(templateCount); |
| | | taskCleanService.saveBatch(tasks); |
| | | taskCount = taskCount + tasks.size(); |
| | | } |