| | |
| | | import com.ruoyi.system.mapper.TCleanerMapper; |
| | | import com.ruoyi.system.model.*; |
| | | import com.ruoyi.system.service.*; |
| | | import com.ruoyi.system.utils.TemplateMessageSendUtil; |
| | | import com.ruoyi.web.controller.tool.EmailUtils; |
| | | import com.ruoyi.web.controller.tool.MsgUtils; |
| | | import javafx.concurrent.Task; |
| | |
| | | private TLeaveService leaveService; |
| | | @Resource |
| | | private TNoticeService noticeService; |
| | | |
| | | |
| | | // 每一个小时执行一次 |
| | | // @Scheduled(cron = "0 0 0 * * ?") |
| | | // @Scheduled(fixedRate = 1500000000) |
| | | // 每天晚上22点执行 |
| | | @Scheduled(cron = "0 0 22 * * ?") |
| | | public void dayOfCreateInspection() { |
| | | try { |
| | | |
| | | // 查询任务模板 |
| | | List<TTemplate> list = templateService.list(); |
| | | if (CollectionUtils.isEmpty(list)) { |
| | |
| | | private TNoticeSetService noticeSetService; |
| | | @Resource |
| | | private MsgUtils msgUtils; |
| | | @Resource |
| | | private TemplateMessageSendUtil templateMessageSendUtil; |
| | | @Resource |
| | | private TDictDataService dictDataService; |
| | | @Scheduled(cron = "0 0 20 * * ?") |
| | |
| | | List<TNotice> noticeList = new ArrayList<>(); |
| | | List<TNotice> addNotice = new ArrayList<>(); |
| | | taskCleanList.forEach(task -> { |
| | | task.setStatus(2); |
| | | TEarlyWarning earlyWarning = new TEarlyWarning(); |
| | | earlyWarning.setWarningType(1); |
| | | earlyWarning.setTaskId(task.getId()); |
| | |
| | | msgUtils.sendMsg2(sysUser.getPhonenumber(),count+""); |
| | | break; |
| | | case 2: |
| | | if (StringUtils.hasLength(email.getDataContent())&&StringUtils.hasLength(code.getDataContent())){ |
| | | if (StringUtils.hasLength(email.getDataContent())&&StringUtils.hasLength(code.getDataContent()) |
| | | &&StringUtils.hasLength(sysUser.getEmail())){ |
| | | EmailUtils.sendEmail(sysUser.getEmail(),email.getDataContent(),code.getDataContent(),"今日剩余"+count+"个任务未完成,请尽快处理"); |
| | | } |
| | | break; |
| | | case 3: |
| | | if (StringUtils.hasLength(sysUser.getOpenId())){ |
| | | Date date = new Date(); |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | String format = simpleDateFormat.format(date); |
| | | templateMessageSendUtil.wxTemplateDayWorkRequest(sysUser.getOpenId(), |
| | | count+"",format); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | noticeService.saveBatch(addNotice); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | @Scheduled(cron = "0 0 8 * * ?") |
| | | public void dayMinusOfEarlyWarning() { |
| | | 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)) { |
| | | taskCleanList.forEach(task -> { |
| | | task.setStatus(2); |
| | | }); |
| | | taskCleanService.updateBatchById(taskCleanList); |
| | | } |
| | | } catch (Exception e) { |