代码更新

This commit is contained in:
ludj
2023-02-05 17:51:04 +08:00
parent c47b61abdc
commit 7f51a4e3e9
3 changed files with 608 additions and 652 deletions

View File

@@ -202,8 +202,10 @@ public class DeviceOpcProtocolRunable implements Runnable {
}
}
} catch (Exception var30) {
if (group != null) {
try {
group.getServer().dispose();
group.clear();
group.remove();
} catch (Exception var6) {

View File

@@ -138,7 +138,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
@Override
public Map<String, Object> queryAllByCache(Map whereJson, Pageable page) {
synchronized (TaskServiceImpl.class){
this.reload();
@@ -151,6 +151,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
String task_type = (String) whereJson.get("task_type");
List<TaskDto> taskList = new ArrayList();
synchronized (TaskServiceImpl.class){
Iterator<TaskDto> it = tasks.iterator();
while (it.hasNext()) {
TaskDto task = it.next();
@@ -193,6 +194,8 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
DateUtil.parse(task2.getCreate_time())))
.collect(Collectors.toList());
}
Integer currentPageNumber = page.getPageNumber() + 1;
Integer pageMaxSize = page.getPageSize();
List<TaskDto> taskDtoList =
@@ -204,7 +207,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
jo.put("content", taskDtoList);
jo.put("totalElements", taskList.size());
return jo;
}
}
@Override
@@ -653,7 +656,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
@Override
@Transactional(rollbackFor = Exception.class)
public void update(TaskDto dto) {
synchronized (TaskServiceImpl.class) {
TaskDto entity = this.findById(dto.getTask_id());
if (entity == null) {
throw new BadRequestException("被删除或无权限,操作失败!");
@@ -669,6 +672,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
wo.update(json);
synchronized (TaskServiceImpl.class) {
Iterator<TaskDto> iterator = tasks.iterator();
while (iterator.hasNext()) {
TaskDto task = iterator.next();
@@ -679,6 +683,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
if (StrUtil.equals(dto.getTask_status(), "0") || StrUtil.equals(dto.getTask_status(), "1")) {
tasks.add(dto);
}
}
// 判断是否为WMS下发的任务如果是反馈任务状态给WMS
String hasWms = paramService.findByCode(AcsConfig.HASWMS).getValue();
if (!StrUtil.startWith(dto.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) {
@@ -767,7 +772,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
}
}
}
}
}
@Override
@@ -916,7 +921,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
JSONObject json = (JSONObject) JSONObject.toJSON(entity);
wo.update(json);
try {
synchronized (TaskServiceImpl.class){
Iterator<TaskDto> it = tasks.iterator();
// 清理缓存
while (it.hasNext()) {
@@ -924,10 +929,8 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
if (taskDto.getTask_id().equals(id)) {
tasks.remove(taskDto);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}}
// 判断是否为WMS下发的任务如果是反馈任务状态给WMS
String hasWms = paramService.findByCode(AcsConfig.HASWMS).getValue();
if (!StrUtil.startWith(entity.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) {
@@ -1089,7 +1092,6 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
if (acsTask == null) {
throw new BadRequestException("被删除或无权限,操作失败!");
}
ParamService paramService = SpringContextHolder.getBean(ParamService.class);
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
InstructionService instructionservice = SpringContextHolder.getBean("instructionServiceImpl");
InstructionDto inst = instructionservice.findByTaskid(ids, "instruction_status < 2 ");