Browse Source

add: 惠氏任务生成增加日志

master
yanps 1 year ago
parent
commit
dbb9403bf4
  1. 29
      hd/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java
  2. 5
      hd/nladmin-system/src/main/resources/config/application-dev.yml
  3. 5
      hd/nladmin-system/src/main/resources/config/application-prod.yml
  4. 29
      hd/nladmin-system/src/main/resources/log/HSTask.xml
  5. 1
      hd/nladmin-system/src/main/resources/logback-spring.xml

29
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<TaskDto> 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<RouteLineDto>() {
@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 = "";

5
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

5
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

29
hd/nladmin-system/src/main/resources/log/HSTask.xml

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<included>
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
<property name="LOG_HOME" value="${logPath}"/>
<!-- 按照每天生成日志文件 -->
<appender name="FILE2" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/惠氏任务生成/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数-->
<maxHistory>15</maxHistory>
<!--单个日志最大容量 至少10MB才能看得出来-->
<maxFileSize>200MB</maxFileSize>
<!--所有日志最多占多大容量-->
<totalSizeCap>2GB</totalSizeCap>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
</encoder>
</appender>
<!-- 打印sql -->
<logger name="org.nl.acs.task.service.impl.TaskServiceImpl" level="info" additivity="false">
<appender-ref ref="FILE2"/>
</logger>
</included>

1
hd/nladmin-system/src/main/resources/logback-spring.xml

@ -26,6 +26,7 @@ https://juejin.cn/post/6844903775631572999
<include resource="log/QueryXZAgvTaskStatus.xml"/>
<include resource="log/NDCSocketConnectionAutoRun.xml"/>
<include resource="log/ScannerBarcode.xml"/>
<include resource="log/HSTask.xml"/>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">

Loading…
Cancel
Save