Browse Source

rev:更新提交

master
gengby 2 months ago
parent
commit
3543c2d71e
  1. 2
      acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java
  2. 20
      acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java
  3. 14
      acs/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCreateInst.java

2
acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java

@ -710,6 +710,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
JSONObject json = (JSONObject) JSONObject.toJSON(entity); JSONObject json = (JSONObject) JSONObject.toJSON(entity);
wo.update(json); wo.update(json);
removeByCodeFromCache(entity.getInstruction_code());
JSONObject taskjson = taskwo.query("task_id ='" + insttaskid + "'").uniqueResult(0); JSONObject taskjson = taskwo.query("task_id ='" + insttaskid + "'").uniqueResult(0);
TaskDto obj = taskjson.toJavaObject(TaskDto.class); TaskDto obj = taskjson.toJavaObject(TaskDto.class);
// =0 则不用再次请求 // =0 则不用再次请求
@ -721,7 +722,6 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
} }
} }
removeByCodeFromCache(entity.getInstruction_code());
// this.reload(); // this.reload();
} }

20
acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java

@ -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());
} }

14
acs/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCreateInst.java

@ -43,6 +43,11 @@ public class AutoCreateInst {
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class); RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class);
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
List<TaskDto> list = taskserver.queryAllFromCacheByStatus("0"); List<TaskDto> list = taskserver.queryAllFromCacheByStatus("0");
// System.out.println("进来了....我点击了");
// for (TaskDto taskDto : list2) {
// System.out.println("我点击了 任务号:" + taskDto.getTask_code());
// }
// System.out.println("进来了....我点击了");
Map<String, List<TaskDto>> collect = list.stream().sorted(Comparator.comparing(TaskDto::getCreate_time).thenComparing(TaskDto::getTask_code)) Map<String, List<TaskDto>> collect = list.stream().sorted(Comparator.comparing(TaskDto::getCreate_time).thenComparing(TaskDto::getTask_code))
.collect(Collectors.groupingBy(TaskDto::getPriority)); .collect(Collectors.groupingBy(TaskDto::getPriority));
TreeMap<String, List<TaskDto>> treeMap = new TreeMap<>(new Comparator<String>() { TreeMap<String, List<TaskDto>> treeMap = new TreeMap<>(new Comparator<String>() {
@ -102,9 +107,16 @@ public class AutoCreateInst {
} }
} }
Boolean flag2 = false; Boolean flag2 = false;
// if ("3-7".equals(nextDevice.getDevice_code())) {
// Thread.sleep(60000);
// }
List<TaskDto> list2 = taskserver.queryAllFromCacheByStatus("1"); List<TaskDto> list2 = taskserver.queryAllFromCacheByStatus("1");
if (CollUtil.isNotEmpty(list2)) { if (CollUtil.isNotEmpty(list2)) {
System.out.println("size:" + list2.size());
for (TaskDto taskDto : list2) { for (TaskDto taskDto : list2) {
System.out.println(taskDto.getNext_device_code());
if (taskDto.getTask_type().equals(acsTask.getTask_type())) { if (taskDto.getTask_type().equals(acsTask.getTask_type())) {
if (startDevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { if (startDevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) startDevice.getDeviceDriver(); standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) startDevice.getDeviceDriver();
@ -268,6 +280,8 @@ public class AutoCreateInst {
acsTask.setTask_status("1"); acsTask.setTask_status("1");
acsTask.setRemark(""); acsTask.setRemark("");
taskserver.update(acsTask); taskserver.update(acsTask);
list2.add(acsTask);
// System.out.println("我点击了....往list2中添加任务号为:" + acsTask.getTask_code());
} }
} }
} }
Loading…
Cancel
Save