|
@@ -55,6 +55,10 @@ public class TaskController {
|
|
private HttpServletRequest request;
|
|
private HttpServletRequest request;
|
|
@Resource
|
|
@Resource
|
|
private TaskService taskService;
|
|
private TaskService taskService;
|
|
|
|
+ @Resource
|
|
|
|
+ private InformationService informationService;
|
|
|
|
+ @Resource
|
|
|
|
+ private TaskInformationService taskInformationService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -134,5 +138,55 @@ public class TaskController {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 消息提醒
|
|
|
|
+ */
|
|
|
|
+ @Scheduled(cron = "0 8 * * * ?")
|
|
|
|
+ public void InfoMationAlerts(){
|
|
|
|
+ log.info("定时执行了===========>");
|
|
|
|
+ QueryWrapper<Task> taskQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ //应该不用考虑任务的状态
|
|
|
|
+ taskQueryWrapper.eq("is_delete",0).eq("is_repeat",1);
|
|
|
|
+ List<Task> list = taskService.list(taskQueryWrapper);
|
|
|
|
+ if (!list.isEmpty()){
|
|
|
|
+ for (Task task : list) {
|
|
|
|
+ List<String> executorIdList=new ArrayList<>();
|
|
|
|
+ String executorId = task.getExecutorId();
|
|
|
|
+ if (!StringUtils.isEmpty(executorId)){
|
|
|
|
+ String[] split = executorId.split(",");
|
|
|
|
+ executorIdList = Arrays.asList(split);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+// 重复类型 :每天:0、每周:1、每月:2、自定义周期:3、自定义日期:4
|
|
|
|
+ if (task.getRepeatType()!=null&&task.getRepeatType()==0){
|
|
|
|
+ //获取任务重复结束 重复永不结束 1:勾选
|
|
|
|
+ if (task.getRepeatEndNever()!=null&&task.getRepeatEndNever()==1){
|
|
|
|
+ if (!executorIdList.isEmpty()){
|
|
|
|
+ ArrayList<Information> informationArrayList = new ArrayList<>();
|
|
|
|
+ for (String userId : executorIdList) {
|
|
|
|
+ Information information = new Information();
|
|
|
|
+ information.setUserId(userId).setMsg("任务提醒")
|
|
|
|
+ .setTime(LocalDateTime.now()).setChecked(0);
|
|
|
|
+ informationArrayList.add(information);
|
|
|
|
+ }
|
|
|
|
+ informationService.saveBatch(informationArrayList);
|
|
|
|
+ }
|
|
|
|
+ }else if (task.getRepeatEndCount()!=null&&task.getRepeatEndCount()>0){
|
|
|
|
+ LambdaQueryWrapper<TaskInformation> lqw = new LambdaQueryWrapper<>();
|
|
|
|
+ lqw.eq(TaskInformation::getTaskId,task.getId()).eq(TaskInformation::getCompanyId,task.getCompanyId());
|
|
|
|
+ TaskInformation taskInformation = taskInformationService.getOne(lqw);
|
|
|
|
+
|
|
|
|
+ if (taskInformation==null){
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|