Browse Source

任务状态被改变

tags/v1.1.0
qiujinyang 2 years ago
parent
commit
44e8666fb7
3 changed files with 6 additions and 4 deletions
  1. +1
    -1
      tuoheng-admin/src/main/java/com/tuoheng/admin/controller/ParamController.java
  2. +4
    -2
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/ThInspectionServiceImpl.java
  3. +1
    -1
      tuoheng-admin/src/main/java/com/tuoheng/admin/task/ScheduledTask.java

+ 1
- 1
tuoheng-admin/src/main/java/com/tuoheng/admin/controller/ParamController.java View File

status = status == 1 ? 2 : 1; status = status == 1 ? 2 : 1;
redisUtils.set("status",status); redisUtils.set("status",status);
} }
boolean status = (Integer) redisUtils.get("status")==1?true:false;
boolean status = (Integer) redisUtils.get("status") == 1;
return JsonResult.success(status); return JsonResult.success(status);
} }



+ 4
- 2
tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/ThInspectionServiceImpl.java View File

} else if (ObjectUtil.isEmpty(jsonResult.getData()) && jsonResult.getCode() != 0) { } else if (ObjectUtil.isEmpty(jsonResult.getData()) && jsonResult.getCode() != 0) {
return JsonResult.error(jsonResult.getMsg()); return JsonResult.error(jsonResult.getMsg());
} else { } else {
ThMission thMissionUpdate=new ThMission(UpdateOrCreateEnum.UPDATE.getCode());
thMissionUpdate.setId(thMission.getId());
//修改执行时间为当前 //修改执行时间为当前
thMission.setExecutionStartTime(new Date());
missionMapper.updateById(thMission);
thMissionUpdate.setExecutionStartTime(new Date());
missionMapper.updateById(thMissionUpdate);
//返回执行结果 //返回执行结果
return JsonResult.success(jsonResult.getMsg()); return JsonResult.success(jsonResult.getMsg());
} }

+ 1
- 1
tuoheng-admin/src/main/java/com/tuoheng/admin/task/ScheduledTask.java View File

.ge(ThMission::getExecutionStatus, 1) .ge(ThMission::getExecutionStatus, 1)
.eq(ThMission::getStatus, TaskStatusEnum.WAIT.getCode())); .eq(ThMission::getStatus, TaskStatusEnum.WAIT.getCode()));


log.info("秒钟一次");
log.info("秒钟一次");


for (ThMission thMission : thMissions) { for (ThMission thMission : thMissions) {
JsonResult jsonResult = inspectionService.executeTask(String.valueOf(thMission.getId())); JsonResult jsonResult = inspectionService.executeTask(String.valueOf(thMission.getId()));

Loading…
Cancel
Save