|
@ -100,8 +100,11 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public synchronized void reload() { |
|
|
public synchronized void reload() { |
|
|
List list = this.queryAll("task_status <2 and is_delete =0 order by create_time"); |
|
|
// System.out.println("我点击了同步按钮");
|
|
|
|
|
|
List<TaskDto> list = this.queryAll("task_status < 2 and is_delete =0 order by create_time"); |
|
|
|
|
|
// for (TaskDto taskDto : list) {
|
|
|
|
|
|
// System.out.println("我点击了同步按钮,更新数据库,查询出未完成的任务为:" + taskDto.getTask_code() + "任务状态为:" + taskDto.getTask_status());
|
|
|
|
|
|
// }
|
|
|
tasks = new CopyOnWriteArrayList<>(list); |
|
|
tasks = new CopyOnWriteArrayList<>(list); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -114,7 +117,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public List<TaskDto> queryAllFromCacheByStatus(String task_status){ |
|
|
public List<TaskDto> queryAllFromCacheByStatus(String task_status) { |
|
|
return Optional.ofNullable(this.tasks) |
|
|
return Optional.ofNullable(this.tasks) |
|
|
.orElse(new CopyOnWriteArrayList<>()) |
|
|
.orElse(new CopyOnWriteArrayList<>()) |
|
|
.stream() |
|
|
.stream() |
|
@ -676,7 +679,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
// @Transactional(rollbackFor = Exception.class)
|
|
|
public void update(TaskDto dto) { |
|
|
public void update(TaskDto dto) { |
|
|
|
|
|
|
|
|
TaskDto entity = this.findById(dto.getTask_id()); |
|
|
TaskDto entity = this.findById(dto.getTask_id()); |
|
@ -693,8 +696,9 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { |
|
|
JSONObject json = (JSONObject) JSONObject.toJSON(dto); |
|
|
JSONObject json = (JSONObject) JSONObject.toJSON(dto); |
|
|
|
|
|
|
|
|
wo.update(json); |
|
|
wo.update(json); |
|
|
|
|
|
// System.out.println("我点击了....修改数据库的状态为执行中...任务号" + dto.getTask_code());
|
|
|
|
|
|
|
|
|
Iterator<TaskDto> iterator = tasks.iterator(); |
|
|
// Iterator<TaskDto> iterator = tasks.iterator();
|
|
|
// while (iterator.hasNext()) {
|
|
|
// while (iterator.hasNext()) {
|
|
|
// TaskDto task = iterator.next();
|
|
|
// TaskDto task = iterator.next();
|
|
|
// if (task.getTask_code().equals(dto.getTask_code())) {
|
|
|
// if (task.getTask_code().equals(dto.getTask_code())) {
|
|
@ -704,6 +708,8 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
removeByCodeFromCache(entity.getTask_code()); |
|
|
removeByCodeFromCache(entity.getTask_code()); |
|
|
|
|
|
// System.out.println("我点击了....修改内存中的状态为执行中...任务号" + dto.getTask_code());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (StrUtil.equals(dto.getTask_status(), "0") || StrUtil.equals(dto.getTask_status(), "1")) { |
|
|
if (StrUtil.equals(dto.getTask_status(), "0") || StrUtil.equals(dto.getTask_status(), "1")) { |
|
|
tasks.add(dto); |
|
|
tasks.add(dto); |
|
@ -759,9 +765,9 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { |
|
|
} else { |
|
|
} else { |
|
|
int status = 0; |
|
|
int status = 0; |
|
|
JSONObject jo = new JSONObject(); |
|
|
JSONObject jo = new JSONObject(); |
|
|
if (body == null){ |
|
|
if (body == null) { |
|
|
status = 400; |
|
|
status = 400; |
|
|
}else { |
|
|
} else { |
|
|
status = body.getStatus(); |
|
|
status = body.getStatus(); |
|
|
jo = JSONObject.parseObject(body.body()); |
|
|
jo = JSONObject.parseObject(body.body()); |
|
|
} |
|
|
} |
|
|