From dbb9403bf4b9e8a679641e1bef2f27f98ac680ac Mon Sep 17 00:00:00 2001 From: yanps Date: Tue, 26 Dec 2023 10:08:22 +0800 Subject: [PATCH] =?UTF-8?q?add:=20=E6=83=A0=E6=B0=8F=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E7=94=9F=E6=88=90=E5=A2=9E=E5=8A=A0=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../task/service/impl/TaskServiceImpl.java | 29 ++++++++++++++++--- .../main/resources/config/application-dev.yml | 5 ++++ .../resources/config/application-prod.yml | 5 ++++ .../src/main/resources/log/HSTask.xml | 29 +++++++++++++++++++ .../src/main/resources/logback-spring.xml | 1 + 5 files changed, 65 insertions(+), 4 deletions(-) create mode 100644 hd/nladmin-system/src/main/resources/log/HSTask.xml diff --git a/hd/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java b/hd/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java index 240e2bc..949e14c 100644 --- a/hd/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java +++ b/hd/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java @@ -50,6 +50,8 @@ import org.nl.utils.SpringContextHolder; import org.nl.wql.WQL; import org.nl.wql.core.bean.WQLObject; import org.nl.wql.util.WqlUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; @@ -69,7 +71,6 @@ import java.util.regex.Pattern; **/ @Service @RequiredArgsConstructor -@Slf4j public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { List tasks = new ArrayList(); @@ -101,6 +102,8 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { this.reload(); } + private static final Logger log = LoggerFactory.getLogger(TaskServiceImpl.class); + public synchronized void reload() { this.tasks = this.queryAll("task_status <2 and is_delete =0"); } @@ -676,9 +679,15 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { list.sort(new Comparator() { @Override public int compare(RouteLineDto o1, RouteLineDto o2) { - String s1 = o1.getNext_device_code().substring(o1.getNext_device_code().length() - 2); - String s2 = o2.getNext_device_code().substring(o2.getNext_device_code().length() - 2); - return Integer.compare(Integer.parseInt(s1), Integer.parseInt(s2)); + Pattern pattern = Pattern.compile("\\d"); + Matcher matcher1 = pattern.matcher(o1.getNext_device_code()); + Matcher matcher2 = pattern.matcher(o2.getNext_device_code()); + if (matcher1.find() && matcher2.find()) { + String s1 = o1.getNext_device_code().substring(o1.getNext_device_code().length() - 2); + String s2 = o2.getNext_device_code().substring(o2.getNext_device_code().length() - 2); + return Integer.compare(Integer.parseInt(s1), Integer.parseInt(s2)); + } + return 0; } }); String next_code = arrjo.getString("next_code"); @@ -703,6 +712,11 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { && ObjectUtil.isEmpty(this.findByStartCode(device_code))) { break; } else { + if (standardOrdinarySiteDeviceDriver.getHasGoods() != 0) { + log.info("普通站点,{}终点设备有货.导致获取不到终点创建任务失败",next_device_code); + } else if (standardOrdinarySiteDeviceDriver.getIslock()) { + log.info("普通站点,{}终点设备有锁定.导致获取不到终点创建任务失败",next_device_code); + } next_device_code = ""; isFirst = false; } @@ -717,6 +731,13 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { break; } else { next_device_code = ""; + if (standardInspectSiteDeviceDriver.getMode()== 0) { + log.info("检测站点驱动,{}终点设备脱机.导致获取不到终点创建任务失败",next_device_code); + } else if (standardInspectSiteDeviceDriver.getHasGoods()!= 0) { + log.info("检测站点驱动,{}终点设备有货.导致获取不到终点创建任务失败",next_device_code); + } else if (standardInspectSiteDeviceDriver.getIslock()) { + log.info("检测站点驱动,{}终点设备有锁定.导致获取不到终点创建任务失败",next_device_code); + } } } else { next_device_code = ""; diff --git a/hd/nladmin-system/src/main/resources/config/application-dev.yml b/hd/nladmin-system/src/main/resources/config/application-dev.yml index f9d3a4d..d1915f6 100644 --- a/hd/nladmin-system/src/main/resources/config/application-dev.yml +++ b/hd/nladmin-system/src/main/resources/config/application-dev.yml @@ -132,3 +132,8 @@ file: # 文件大小 /M maxSize: 100 avatarMaxSize: 5 + +logging: + file: + path: D:\hs_log + config: classpath:logback-spring.xml diff --git a/hd/nladmin-system/src/main/resources/config/application-prod.yml b/hd/nladmin-system/src/main/resources/config/application-prod.yml index 86ac6a2..8f7df76 100644 --- a/hd/nladmin-system/src/main/resources/config/application-prod.yml +++ b/hd/nladmin-system/src/main/resources/config/application-prod.yml @@ -135,3 +135,8 @@ file: # 文件大小 /M maxSize: 100 avatarMaxSize: 5 +#日志配置 +logging: + file: + path: D:\hs_log + config: classpath:logback-spring.xml \ No newline at end of file diff --git a/hd/nladmin-system/src/main/resources/log/HSTask.xml b/hd/nladmin-system/src/main/resources/log/HSTask.xml new file mode 100644 index 0000000..9791e9d --- /dev/null +++ b/hd/nladmin-system/src/main/resources/log/HSTask.xml @@ -0,0 +1,29 @@ + + + + + + + + + ${LOG_HOME}/惠氏任务生成/%d{yyyy-MM-dd}.%i.log + + 15 + + 200MB + + 2GB + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + + + + + + + + + + diff --git a/hd/nladmin-system/src/main/resources/logback-spring.xml b/hd/nladmin-system/src/main/resources/logback-spring.xml index 9bd5afe..1478b94 100644 --- a/hd/nladmin-system/src/main/resources/logback-spring.xml +++ b/hd/nladmin-system/src/main/resources/logback-spring.xml @@ -26,6 +26,7 @@ https://juejin.cn/post/6844903775631572999 +