Преглед изворни кода

代码优化开发20211121

MSY пре 3 година
родитељ
комит
3be98b57e8

+ 3 - 1
src/main/java/com/jkcredit/invoice/credit/custInterface/NoCarInterServiceImpl.java

@@ -304,7 +304,7 @@ public class NoCarInterServiceImpl implements NoCarInterService {
             customerCarRec.setCarNum(noCarWayBill.getPlateNum());
             customerCarRec.setCarColor(noCarWayBill.getPlateColor());
             customerCarRec.setCustomerName(appKey);
-            customerCarRec.setInterType(0);
+            customerCarRec.setInterType(0);//接口
             customerCarRec.setCompanyNum(customerRec.getCompanyNum());
             customerCarRec.setBusinessType("2");
             customerCarRec.setServiceOperation(1);//默认运营车辆
@@ -391,6 +391,7 @@ public class NoCarInterServiceImpl implements NoCarInterService {
             noCarWayBill.setPredictEndTime(DateUtil.getDistanceHoursFormat(endTime));
             noCarWayBill.setStartTime(noCarWayBill1.getStartTime());
             noCarWayBill.setHisFlag(noCarWayBill1.getHisFlag());
+            noCarWayBill.setInterType(0);//接口
 
             RespR rs = noCarService.noCarWaybillEnd(noCarWayBill);
             long costtimeend = System.currentTimeMillis();
@@ -590,6 +591,7 @@ public class NoCarInterServiceImpl implements NoCarInterService {
             noCarWayBill.setPredictEndTime(DateUtil.getDistanceHoursFormat(endTime));
             noCarWayBill.setStartTime(noCarWayBill1.getStartTime());
             noCarWayBill.setHisFlag(noCarWayBill1.getHisFlag());
+            noCarWayBill.setInterType(0);//接口
 
             RespR rs = noCarService.noCarHisWaybillEnd(noCarWayBill);
             long costtimeend = System.currentTimeMillis();

+ 4 - 4
src/main/java/com/jkcredit/invoice/service/lowerService/impl/NoCarServiceImpl.java

@@ -223,7 +223,7 @@ public class NoCarServiceImpl implements NoCarService{
         if(DateUtil.getDistanceHours(noCarWayBill.getStartTime(),new Date())<-72){
             return new RespR(false,"失败,运单开始时间超72小时");
         }
-        if(DateUtil.getDistanceHours(noCarWayBill.getStartTime(),DateUtil.StringToDate(noCarWayBill.getPredictEndTime()))<-96){
+        if((DateUtil.getDistanceHours(noCarWayBill.getStartTime(),DateUtil.StringToDate(noCarWayBill.getPredictEndTime()))<-96) && (noCarWayBill.getInterType() != 0)){
             log.info("运单结束失败:NoCarServiceImpl.noCarWaybillStart{},msg{}",noCarWayBill,"运单已经超时,请拆分");
             return new RespR(false,"失败,承运时长超96小时");
         }
@@ -312,7 +312,7 @@ public class NoCarServiceImpl implements NoCarService{
         noCarWayBill1.setDestAddr(noCarWayBill.getDestAddr());
         noCarWayBill1.setPredictEndTime(noCarWayBill.getPredictEndTime());
         noCarWayBill1.setBatchNumEnd(noCarWayBill.getBatchNumEnd());
-        if(DateUtil.getDistanceHours(noCarWayBill1.getStartTime(),DateUtil.StringToDate(noCarWayBill1.getPredictEndTime()))<-96){
+        if((DateUtil.getDistanceHours(noCarWayBill1.getStartTime(),DateUtil.StringToDate(noCarWayBill1.getPredictEndTime()))<-96) && (noCarWayBill.getInterType() != 0)){
             //noCarWayBill1.setBillwayStatus(4);
             noCarWayBill1.setFailReason("失败,承运时长超96小时");
             noCarWaybillMapper.updateByBillNum(noCarWayBill1);
@@ -359,7 +359,7 @@ public class NoCarServiceImpl implements NoCarService{
             log.info("历史运单开始上传失败:NoCarServiceImpl.noCarHisWaybillStart{},msg{}",noCarWayBill,"必须是二十天前的运单");
             return new RespR(false,"失败,运单未满20天时效");
         }
-        if(DateUtil.getDistanceHours(noCarWayBill.getStartTime(),DateUtil.StringToDate(noCarWayBill.getPredictEndTime()))<-96){
+        if((DateUtil.getDistanceHours(noCarWayBill.getStartTime(),DateUtil.StringToDate(noCarWayBill.getPredictEndTime()))<-96) && (noCarWayBill.getInterType() != 0)){
             log.info("运单结束失败:NoCarServiceImpl.noCarWaybillStart{},msg{}",noCarWayBill,"运单已经超时,请拆分");
             noCarWaybillMapper.updateByBillNum(noCarWayBill1);
             return new RespR(false,"失败,承运时长超96小时");
@@ -420,7 +420,7 @@ public class NoCarServiceImpl implements NoCarService{
         }
         noCarWayBill1.setDestAddr(noCarWayBill.getDestAddr());
         noCarWayBill1.setPredictEndTime(noCarWayBill.getPredictEndTime());
-        if(DateUtil.getDistanceHours(noCarWayBill.getStartTime(),DateUtil.StringToDate(noCarWayBill.getPredictEndTime()))<-96){
+        if((DateUtil.getDistanceHours(noCarWayBill.getStartTime(),DateUtil.StringToDate(noCarWayBill.getPredictEndTime()))<-96) && (noCarWayBill.getInterType() != 0)){
             log.info("历史运单结束上传失败:NoCarServiceImpl.noCarHisWaybillEnd{},msg{}",noCarWayBill,"运单已经超时,请拆分");
             return new RespR(false,"失败,承运时长超96小时");
         }

+ 19 - 25
src/main/resources/logback-spring.xml

@@ -1,10 +1,10 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <configuration debug="false" scan="false">
     <springProperty scop="context" name="spring.application.name" source="spring.application.name" defaultValue=""/>
-    <property name="log.path" value="/home/app/logs"/>
+    <property name="log.path" value="/home/app"/>
     <!-- 彩色日志格式 -->
     <property name="CONSOLE_LOG_PATTERN"
-              value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}" />
+              value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n" />
     <!-- 彩色日志依赖的渲染类 -->
     <conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" />
     <conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" />
@@ -12,47 +12,41 @@
                     converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" />
     <!-- Console log output -->
     <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
-        <encoder>
+        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
             <pattern>${CONSOLE_LOG_PATTERN}</pattern>
         </encoder>
     </appender>
 
-    <appender name="syslog"
+
+    <appender name="FILE"
               class="ch.qos.logback.core.rolling.RollingFileAppender">
-         <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
-            <level>TRACE</level>
-        </filter>
+
         <!-- rollingPolicy:当发生滚动时,决定 RollingFileAppender 的行为,涉及文件移动和重命名。 -->
         <!-- TimeBasedRollingPolicy: 最常用的滚动策略,它根据时间来制定滚动策略,既负责滚动也负责出发滚动 -->
         <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
             <!-- 活动文件的名字会根据fileNamePattern的值,每隔一段时间改变一次 -->
             <!-- 文件名:log/sys.2017-12-05.0.log -->
-            <fileNamePattern>${log.path}/log/sys.%d.%i.log</fileNamePattern>
+            <fileNamePattern>${log.path}/log/system.log.%d{yyyy-MM-dd}.log</fileNamePattern>
             <!-- 每产生一个日志文件,该日志文件的保存期限为30天 -->
-            <maxHistory>30</maxHistory>
-            <timeBasedFileNamingAndTriggeringPolicy  class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
-                <!-- maxFileSize:这是活动文件的大小,默认值是10MB,本篇设置为1KB,只是为了演示 -->
-                <maxFileSize>10M</maxFileSize>
-            </timeBasedFileNamingAndTriggeringPolicy>
+            <maxHistory>60</maxHistory>
         </rollingPolicy>
-        <encoder>
-            <!-- pattern节点,用来设置日志的输入格式 -->
-            <pattern>
-                %d %p (%file:%line\)- %m%n
-            </pattern>
-            <!-- 记录日志的编码 -->
-            <charset>UTF-8</charset> <!-- 此处设置字符集 -->
-        </encoder>
-    </appender>
+            <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+                <pattern>${CONSOLE_LOG_PATTERN}</pattern>
+            </encoder>
+            <triggeringPolicy  class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+                <!-- maxFileSize:这是活动文件的大小,默认值是10MB,本篇设置为1KB,只是为了演示 -->
+                <maxFileSize>50M</maxFileSize>
+            </triggeringPolicy>
 
+    </appender>
     <!-- Level: FATAL 0  ERROR 3  WARN 4  INFO 6  DEBUG 7 -->
     <root level="INFO">
         <appender-ref ref="console" />
-        <appender-ref ref="syslog" />
+        <appender-ref ref="FILE"/>
     </root>
 
 
-    <logger name="com.jkcredit.invoice" level="INFO">
-        <appender-ref ref="syslog"/>
+  <logger name="com.jkcredit.invoice" level="INFO">
+        <appender-ref ref="FILE"/>
     </logger>
 </configuration>