作者 朱兆平

优化多线程mt3202已OK

正在显示 25 个修改的文件 包含 560 行增加195 行删除
@@ -132,12 +132,12 @@ jwt: @@ -132,12 +132,12 @@ jwt:
132 #自定义配置 132 #自定义配置
133 custom: 133 custom:
134 #进港放行回执读取目录 134 #进港放行回执读取目录
135 - receptDirectory: /Users/mrz/Downloads/rdp_temp/logs/回执报文样例 135 + receptDirectory: /Users/mrz/Downloads/rdp_temp/logs/回执报文样例/
136 #回执解析成功后的备份目录 136 #回执解析成功后的备份目录
137 - receptBakDir: ./success 137 + receptBakDir: /Users/mrz/Downloads/rdp_temp/logs/success
138 #解析错误报文的备份目录 138 #解析错误报文的备份目录
139 - errBakDir: ./error  
140 - transmitDir: ./transmit 139 + errBakDir: /Users/mrz/Downloads/rdp_temp/logs/error
  140 + transmitDir: /Users/mrz/Downloads/rdp_temp/logs/transmit
141 devops: 141 devops:
142 dir: 142 dir:
143 singlewindow-tcs-recept: D:\TCSSingleWindow\recive 143 singlewindow-tcs-recept: D:\TCSSingleWindow\recive
@@ -24,9 +24,9 @@ @@ -24,9 +24,9 @@
24 <!--输出到控制台--> 24 <!--输出到控制台-->
25 <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> 25 <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
26 <!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息--> 26 <!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息-->
27 - <filter class="ch.qos.logback.classic.filter.ThresholdFilter">  
28 - <level>DEBUG</level>  
29 - </filter> 27 + <!--<filter class="ch.qos.logback.classic.filter.ThresholdFilter">-->
  28 + <!--<level>trace</level>-->
  29 + <!--</filter>-->
30 <encoder> 30 <encoder>
31 <Pattern>${CONSOLE_LOG_PATTERN}</Pattern> 31 <Pattern>${CONSOLE_LOG_PATTERN}</Pattern>
32 <!-- 设置字符集 windows系统这里设置成GBK--> 32 <!-- 设置字符集 windows系统这里设置成GBK-->
@@ -144,6 +144,33 @@ @@ -144,6 +144,33 @@
144 </filter> 144 </filter>
145 </appender> 145 </appender>
146 146
  147 + <!-- 时间滚动输出 level为 trace 日志 -->
  148 + <appender name="TRACE_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
  149 + <!-- 正在记录的日志文件的路径及文件名 -->
  150 + <file>${log.path}/log_trace.log</file>
  151 + <!--日志文件输出格式-->
  152 + <encoder>
  153 + <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
  154 + <charset>UTF-8</charset> <!-- 此处设置字符集 -->
  155 + </encoder>
  156 + <!-- 日志记录器的滚动策略,按日期,按大小记录 -->
  157 + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
  158 + <fileNamePattern>${log.path}/trace/log-trace-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
  159 + <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
  160 + <maxFileSize>100MB</maxFileSize>
  161 + </timeBasedFileNamingAndTriggeringPolicy>
  162 + <!--日志文件保留天数-->
  163 + <maxHistory>15</maxHistory>
  164 + </rollingPolicy>
  165 + <!-- 此日志文件只记录trace级别的 -->
  166 + <filter class="ch.qos.logback.classic.filter.LevelFilter">
  167 + <level>TRACE</level>
  168 + <onMatch>ACCEPT</onMatch>
  169 + <onMismatch>DENY</onMismatch>
  170 + </filter>
  171 + </appender>
  172 +
  173 +
147 <!-- 174 <!--
148 <logger>用来设置某一个包或者具体的某一个类的日志打印级别、 175 <logger>用来设置某一个包或者具体的某一个类的日志打印级别、
149 以及指定<appender>。<logger>仅有一个name属性, 176 以及指定<appender>。<logger>仅有一个name属性,
@@ -169,17 +196,26 @@ @@ -169,17 +196,26 @@
169 不能设置为INHERITED或者同义词NULL。默认是DEBUG 196 不能设置为INHERITED或者同义词NULL。默认是DEBUG
170 可以包含零个或多个元素,标识这个appender将会添加到这个logger。 197 可以包含零个或多个元素,标识这个appender将会添加到这个logger。
171 --> 198 -->
  199 + <!--<logger name="com.tianbo.analysis" level="trace">-->
  200 + <!--&lt;!&ndash;<appender-ref ref="CONSOLE" />&ndash;&gt;-->
  201 + <!--<appender-ref ref="TRACE_FILE" />-->
  202 + <!--<appender-ref ref="DEBUG_FILE" />-->
  203 + <!--<appender-ref ref="INFO_FILE" />-->
  204 + <!--<appender-ref ref="WARN_FILE" />-->
  205 + <!--<appender-ref ref="ERROR_FILE" />-->
  206 + <!--</logger>-->
172 207
173 <!--开发环境:打印控制台--> 208 <!--开发环境:打印控制台-->
174 <springProfile name="dev"> 209 <springProfile name="dev">
175 - <logger name="org.springframework.boot" level="trace"/> 210 + <!--<logger name="org.springframework.boot" level="trace"/>-->
176 <logger name="org.apache.tomcat" level="info" /> 211 <logger name="org.apache.tomcat" level="info" />
177 <logger name="com.tianbo.analysis.dao" level="DEBUG" /> 212 <logger name="com.tianbo.analysis.dao" level="DEBUG" />
178 - <root level="INFO"> 213 + <root level="trace">
179 <appender-ref ref="CONSOLE" /> 214 <appender-ref ref="CONSOLE" />
180 - <!--<appender-ref ref="DEBUG_FILE" />-->  
181 - <!--<appender-ref ref="INFO_FILE" />-->  
182 - <!--<appender-ref ref="WARN_FILE" />--> 215 + <appender-ref ref="TRACE_FILE" />
  216 + <appender-ref ref="DEBUG_FILE" />
  217 + <appender-ref ref="INFO_FILE" />
  218 + <appender-ref ref="WARN_FILE" />
183 <appender-ref ref="ERROR_FILE" /> 219 <appender-ref ref="ERROR_FILE" />
184 </root> 220 </root>
185 </springProfile> 221 </springProfile>
@@ -194,6 +230,7 @@ @@ -194,6 +230,7 @@
194 <appender-ref ref="INFO_FILE" /> 230 <appender-ref ref="INFO_FILE" />
195 <appender-ref ref="ERROR_FILE" /> 231 <appender-ref ref="ERROR_FILE" />
196 <appender-ref ref="WARN_FILE" /> 232 <appender-ref ref="WARN_FILE" />
  233 + <appender-ref ref="TRACE_FILE" />
197 </root> 234 </root>
198 </springProfile> 235 </springProfile>
199 236
@@ -4,6 +4,7 @@ @@ -4,6 +4,7 @@
4 */ 4 */
5 package com.tianbo.analysis; 5 package com.tianbo.analysis;
6 6
  7 +import com.tianbo.analysis.task.TaskAnalysis;
7 import org.mybatis.spring.annotation.MapperScan; 8 import org.mybatis.spring.annotation.MapperScan;
8 import org.springframework.boot.SpringApplication; 9 import org.springframework.boot.SpringApplication;
9 import org.springframework.boot.autoconfigure.SpringBootApplication; 10 import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -12,6 +13,7 @@ import org.springframework.cloud.client.discovery.EnableDiscoveryClient; @@ -12,6 +13,7 @@ import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
12 import org.springframework.cloud.client.loadbalancer.LoadBalanced; 13 import org.springframework.cloud.client.loadbalancer.LoadBalanced;
13 import org.springframework.context.annotation.Bean; 14 import org.springframework.context.annotation.Bean;
14 import org.springframework.context.annotation.ComponentScan; 15 import org.springframework.context.annotation.ComponentScan;
  16 +import org.springframework.scheduling.annotation.EnableAsync;
15 import org.springframework.scheduling.annotation.EnableScheduling; 17 import org.springframework.scheduling.annotation.EnableScheduling;
16 import org.springframework.transaction.annotation.EnableTransactionManagement; 18 import org.springframework.transaction.annotation.EnableTransactionManagement;
17 import org.springframework.web.client.RestTemplate; 19 import org.springframework.web.client.RestTemplate;
1 package com.tianbo.analysis.handle; 1 package com.tianbo.analysis.handle;
2 2
  3 +import com.tianbo.analysis.model.ALLOCATEARRIVAL;
3 import com.tianbo.analysis.model.CustomReception; 4 import com.tianbo.analysis.model.CustomReception;
4 import com.tianbo.analysis.service.*; 5 import com.tianbo.analysis.service.*;
  6 +import com.tianbo.analysis.service.imp.*;
  7 +import com.tianbo.analysis.tools.AWBTools;
5 import com.tianbo.util.Date.DateUtil; 8 import com.tianbo.util.Date.DateUtil;
6 import com.tianbo.util.XML.XMLXPath; 9 import com.tianbo.util.XML.XMLXPath;
7 import lombok.Data; 10 import lombok.Data;
8 import lombok.extern.slf4j.Slf4j; 11 import lombok.extern.slf4j.Slf4j;
9 import org.apache.commons.io.FileExistsException; 12 import org.apache.commons.io.FileExistsException;
10 import org.apache.commons.io.FileUtils; 13 import org.apache.commons.io.FileUtils;
  14 +import org.apache.commons.lang.StringUtils;
11 import org.dom4j.Document; 15 import org.dom4j.Document;
12 import org.dom4j.DocumentException; 16 import org.dom4j.DocumentException;
13 import org.dom4j.Element; 17 import org.dom4j.Element;
14 import org.dom4j.io.SAXReader; 18 import org.dom4j.io.SAXReader;
15 import org.springframework.beans.factory.annotation.Autowired; 19 import org.springframework.beans.factory.annotation.Autowired;
16 import org.springframework.beans.factory.annotation.Value; 20 import org.springframework.beans.factory.annotation.Value;
  21 +import org.springframework.context.annotation.Scope;
17 import org.springframework.stereotype.Component; 22 import org.springframework.stereotype.Component;
18 import org.xml.sax.SAXParseException; 23 import org.xml.sax.SAXParseException;
19 24
@@ -21,6 +26,7 @@ import javax.annotation.PostConstruct; @@ -21,6 +26,7 @@ import javax.annotation.PostConstruct;
21 import java.io.File; 26 import java.io.File;
22 import java.io.FileNotFoundException; 27 import java.io.FileNotFoundException;
23 import java.io.UnsupportedEncodingException; 28 import java.io.UnsupportedEncodingException;
  29 +import java.util.concurrent.CountDownLatch;
24 30
25 /** 31 /**
26 * @author mrz 32 * @author mrz
@@ -32,6 +38,7 @@ import java.io.UnsupportedEncodingException; @@ -32,6 +38,7 @@ import java.io.UnsupportedEncodingException;
32 @Slf4j 38 @Slf4j
33 public class CustomXmlHandleThread implements Runnable{ 39 public class CustomXmlHandleThread implements Runnable{
34 40
  41 + private CountDownLatch latch;
35 //备份目录 42 //备份目录
36 @Value("${custom.receptBakDir}") 43 @Value("${custom.receptBakDir}")
37 private String bakupDir; 44 private String bakupDir;
@@ -40,10 +47,6 @@ public class CustomXmlHandleThread implements Runnable{ @@ -40,10 +47,6 @@ public class CustomXmlHandleThread implements Runnable{
40 @Value("${custom.errBakDir}") 47 @Value("${custom.errBakDir}")
41 private String errBakDir; 48 private String errBakDir;
42 49
43 - //回执转发目录  
44 - @Value("${custom.transmit}")  
45 - private String transmitDir;  
46 -  
47 private File xmlfile; 50 private File xmlfile;
48 private static CustomXmlHandleThread customXmlHandle; 51 private static CustomXmlHandleThread customXmlHandle;
49 //海关新舱单回执报头 52 //海关新舱单回执报头
@@ -55,66 +58,43 @@ public class CustomXmlHandleThread implements Runnable{ @@ -55,66 +58,43 @@ public class CustomXmlHandleThread implements Runnable{
55 public final static String SendTime = "//Manifest/Head/SendTime"; 58 public final static String SendTime = "//Manifest/Head/SendTime";
56 public final static String Version = "//Manifest/Head/Version"; 59 public final static String Version = "//Manifest/Head/Version";
57 60
58 - //海关新舱单回执报体 61 +
  62 + /**
  63 + * 海关普通业务新舱单回执报体
  64 + */
59 public final static String JourneyID = "//Manifest/Response/BorderTransportMeans/JourneyID"; 65 public final static String JourneyID = "//Manifest/Response/BorderTransportMeans/JourneyID";
60 public final static String WaybillMaster = "//Manifest/Response/Consignment/TransportContractDocument/ID"; 66 public final static String WaybillMaster = "//Manifest/Response/Consignment/TransportContractDocument/ID";
61 public final static String WaybillSecond = "//Manifest/Response/Consignment/AssociatedTransportDocument/ID"; 67 public final static String WaybillSecond = "//Manifest/Response/Consignment/AssociatedTransportDocument/ID";
62 public final static String ResponseCode = "//Manifest/Response/Consignment/ResponseType/Code"; 68 public final static String ResponseCode = "//Manifest/Response/Consignment/ResponseType/Code";
63 public final static String ResponseText = "//Manifest/Response/Consignment/ResponseType/Text"; 69 public final static String ResponseText = "//Manifest/Response/Consignment/ResponseType/Text";
64 70
65 - @Autowired  
66 - private CoustomAnalysisService coustomAnalysisService;  
67 -  
68 - @Autowired  
69 - private ARRIVEDMASTERService arrivedmasterService;  
70 -  
71 - @Autowired  
72 - private TALLYMASTERService tallymasterService;  
73 -  
74 - @Autowired  
75 - private DEPARTURESLOADINGService departuresloadingService;  
76 -  
77 - @Autowired  
78 - private PREPAREMASTERService preparemasterService;  
79 -  
80 - @Autowired  
81 - private ALLOCATEARRIVALService allocatearrivalService;  
82 -  
83 - @Autowired  
84 - private INPORTALLOCATEService inportallocateService; 71 + /**
  72 + * 海关国际转运业务回执报体
  73 + */
  74 + public final static String ImportJourneyID = "//Manifest/Response/ImportInformation/BorderTransportMeans/JourneyID";
  75 + public final static String ImportWaybillMaster = "//Manifest/Response/ImportInformation/Consignment/TransportContractDocument/ID";
  76 + public final static String ExportJourneyID = "//Manifest/Response/ExportInformation/BorderTransportMeans/JourneyID";
  77 + public final static String ExportWaybillMaster = "//Manifest/Response/ExportInformation/Consignment/TransportContractDocument/ID";
  78 + public final static String TransResponseCode = "//Manifest/Response/ResponseType/Code";
  79 + public final static String TransResponseText = "//Manifest/Response/ResponseType/Text";
85 80
86 81
87 //通过@PostConstruct实现初始化bean之前进行的操作,解决service调用空指针问题 82 //通过@PostConstruct实现初始化bean之前进行的操作,解决service调用空指针问题
88 @PostConstruct 83 @PostConstruct
89 public void init() { 84 public void init() {
90 customXmlHandle = this; 85 customXmlHandle = this;
91 - customXmlHandle.coustomAnalysisService = this.coustomAnalysisService;  
92 -  
93 - customXmlHandle.arrivedmasterService = this.arrivedmasterService;  
94 -  
95 - customXmlHandle.tallymasterService = this.tallymasterService;  
96 -  
97 - customXmlHandle.departuresloadingService = this.departuresloadingService;  
98 -  
99 - customXmlHandle.preparemasterService = this.preparemasterService;  
100 -  
101 - customXmlHandle.allocatearrivalService = this.allocatearrivalService;  
102 -  
103 - customXmlHandle.inportallocateService = this.inportallocateService;  
104 86
105 customXmlHandle.bakupDir = this.bakupDir; 87 customXmlHandle.bakupDir = this.bakupDir;
106 88
107 customXmlHandle.errBakDir = this.errBakDir; 89 customXmlHandle.errBakDir = this.errBakDir;
108 90
109 - customXmlHandle.transmitDir = this.transmitDir;  
110 // 初使化时将已静态化的testService实例化 91 // 初使化时将已静态化的testService实例化
111 } 92 }
112 93
113 @Override 94 @Override
114 public void run() { 95 public void run() {
115 - 96 + log.info("线程:{}开始",xmlfile.getName());
116 try{ 97 try{
117 - FileUtils.copyFileToDirectory(xmlfile,new File(customXmlHandle.transmitDir));  
118 int i =handelXmlDocument(); 98 int i =handelXmlDocument();
119 String today = DateUtil.getTodayBy_yyyyMMdd(); 99 String today = DateUtil.getTodayBy_yyyyMMdd();
120 String backdireByDay = customXmlHandle.bakupDir + "/" + today; 100 String backdireByDay = customXmlHandle.bakupDir + "/" + today;
@@ -128,12 +108,17 @@ public class CustomXmlHandleThread implements Runnable{ @@ -128,12 +108,17 @@ public class CustomXmlHandleThread implements Runnable{
128 errBak(xmlfile); 108 errBak(xmlfile);
129 } 109 }
130 }catch (FileExistsException e){ 110 }catch (FileExistsException e){
131 - log.error("错误的解析文件剪切失败,目标目录已存在同名文件",e);  
132 - e.printStackTrace(); 111 + log.error("错误的解析文件剪切失败,目标目录已存在同名文件");
133 }catch (Exception e){ 112 }catch (Exception e){
  113 + log.error("错误的解析文件剪切失败,目标目录已存在同名文件",e);
  114 + errBak(xmlfile);
134 e.printStackTrace(); 115 e.printStackTrace();
135 } 116 }
136 117
  118 + log.info("线程:{}结束",xmlfile.getName());
  119 + latch.countDown();
  120 + log.info("剩余线程数量{}",latch.getCount());
  121 +
137 } 122 }
138 /** 123 /**
139 * 124 *
@@ -156,12 +141,11 @@ public class CustomXmlHandleThread implements Runnable{ @@ -156,12 +141,11 @@ public class CustomXmlHandleThread implements Runnable{
156 String flightDate = ""; 141 String flightDate = "";
157 142
158 //开始解析 143 //开始解析
159 -// fzeFoh.setGrossweightmeasureuc(XMLXPath.getSingleValueByPath(document,GrossWeightMeasureUc));  
160 String msgType = XMLXPath.getSingleValueByPath(document,MessageType); 144 String msgType = XMLXPath.getSingleValueByPath(document,MessageType);
161 String journeyid = XMLXPath.getSingleValueByPath(document,JourneyID); 145 String journeyid = XMLXPath.getSingleValueByPath(document,JourneyID);
162 // XMLXPath.getSingleValueByPath(document, ) 146 // XMLXPath.getSingleValueByPath(document, )
163 147
164 - if(journeyid != null&& !journeyid.isEmpty()){ 148 + if(!StringUtils.isEmpty(journeyid)){
165 149
166 String[] flightList = journeyid.split("/"); 150 String[] flightList = journeyid.split("/");
167 if(flightList.length > 0){ 151 if(flightList.length > 0){
@@ -223,15 +207,57 @@ public class CustomXmlHandleThread implements Runnable{ @@ -223,15 +207,57 @@ public class CustomXmlHandleThread implements Runnable{
223 i = customXmlHandle.inportallocateService.insertRecept(customReception); 207 i = customXmlHandle.inportallocateService.insertRecept(customReception);
224 break; 208 break;
225 case "MT3202": 209 case "MT3202":
226 - i = customXmlHandle.allocatearrivalService.insertRecept(customReception); 210 + ALLOCATEARRIVAL allocatearrival = new ALLOCATEARRIVAL(customReception);
  211 + i= allocatearrival.analysisReception();
227 break; 212 break;
228 case "MT8205": 213 case "MT8205":
229 - 214 + transXmlHandel(document,customReception);
  215 + break;
  216 + default:
230 break; 217 break;
231 218
232 } 219 }
233 220
234 return i; 221 return i;
  222 +
  223 + }
  224 +
  225 + /**
  226 + * 国际转运回执处理
  227 + * @param document
  228 + * @param customReception
  229 + * @return
  230 + */
  231 + private int transXmlHandel(Document document,CustomReception customReception){
  232 +
  233 + String importJourneyID = XMLXPath.getSingleValueByPath(document,ImportJourneyID);
  234 + String importFlightNo = "UNKONW";
  235 + String importFlightDate = "00000000";
  236 + if(!StringUtils.isEmpty(importJourneyID)){
  237 + importFlightNo = AWBTools.splitFlightAndDate(importJourneyID)[0];
  238 + importFlightDate = AWBTools.splitFlightAndDate(importJourneyID)[1];
  239 + }
  240 +
  241 +
  242 + String importWaybillMaster= XMLXPath.getSingleValueByPath(document,ImportWaybillMaster);
  243 + String transResponseCode=XMLXPath.getSingleValueByPath(document,TransResponseCode);
  244 + String transResponseText=XMLXPath.getSingleValueByPath(document,TransResponseText);
  245 + CustomReception transCustomReception = new CustomReception( customReception.getMessageType(),
  246 + importFlightNo,
  247 + importFlightDate,
  248 + importWaybillMaster,
  249 + transResponseCode,
  250 + transResponseText,
  251 + customReception.getMessageID(),
  252 + customReception.getSendTime(),
  253 + customReception.getSenderID(),
  254 + customReception.getReceiverID(),
  255 + customReception.getVersion(),
  256 + customReception.getFunctionCode());
  257 + int i=customXmlHandle.internationaltransitService.insertRecept(transCustomReception);
  258 +
  259 + return i;
  260 +
235 } 261 }
236 262
237 public void errBak(File file){ 263 public void errBak(File file){
@@ -240,10 +266,9 @@ public class CustomXmlHandleThread implements Runnable{ @@ -240,10 +266,9 @@ public class CustomXmlHandleThread implements Runnable{
240 String errDirByDay = customXmlHandle.errBakDir + "/" + today; 266 String errDirByDay = customXmlHandle.errBakDir + "/" + today;
241 File berrDirectory = new File(errDirByDay); 267 File berrDirectory = new File(errDirByDay);
242 FileUtils.moveFileToDirectory(file,berrDirectory,true); 268 FileUtils.moveFileToDirectory(file,berrDirectory,true);
243 - log.error("解析或其他错误备份文件:"+File.pathSeparator); 269 + log.info("数据库未找到与回执适配的信息备份文件:{}:"+file.getName());
244 }catch (FileExistsException e){ 270 }catch (FileExistsException e){
245 - log.error("错误的解析文件剪切失败,目标目录已存在同名文件",e);  
246 - e.printStackTrace(); 271 + log.error("备份解析错误文件失败,目标文件夹存在同名文件{}",file.getName());
247 }catch (Exception e){ 272 }catch (Exception e){
248 e.printStackTrace(); 273 e.printStackTrace();
249 } 274 }
1 package com.tianbo.analysis.model; 1 package com.tianbo.analysis.model;
2 2
  3 +import com.tianbo.analysis.bean.SpringBeanUtitl;
  4 +import com.tianbo.analysis.dao.ALLOCATEARRIVALMapper;
  5 +import com.tianbo.analysis.dao.SENDLOGMapper;
  6 +import com.tianbo.analysis.service.SendLogService;
  7 +import com.tianbo.analysis.tools.AWBTools;
  8 +import com.tianbo.util.Date.DateUtil;
  9 +import lombok.Data;
  10 +import lombok.extern.slf4j.Slf4j;
  11 +import org.apache.commons.lang.StringUtils;
  12 +
3 import java.util.Date; 13 import java.util.Date;
  14 +import java.util.List;
4 15
  16 +@Slf4j
  17 +@Data
5 public class ALLOCATEARRIVAL { 18 public class ALLOCATEARRIVAL {
  19 +
  20 + private ALLOCATEARRIVALMapper allocatearrivalMapper;
  21 +
  22 + private SendLogService sendLogService;
  23 +
6 private String id; 24 private String id;
7 25
8 private Date createdate; 26 private Date createdate;
@@ -29,6 +47,33 @@ public class ALLOCATEARRIVAL { @@ -29,6 +47,33 @@ public class ALLOCATEARRIVAL {
29 47
30 private String receiptinformation; 48 private String receiptinformation;
31 49
  50 + private CustomReception customReception;
  51 +
  52 + public ALLOCATEARRIVAL(){
  53 +
  54 + }
  55 +
  56 + public ALLOCATEARRIVAL(CustomReception customReception){
  57 + this.customReception = customReception;
  58 + this.waybillno = customReception.getWayBillMaster();
  59 + this.receiptinformation = customReception.getResponseText();
  60 + this.status = AWBTools.transCusRspCode(customReception.getResponseCode());
  61 + String[] flightInfo = AWBTools.splitFlight(customReception.getFlightNo());
  62 + this.setFlightno(flightInfo[1]);
  63 + this.setCarrier(flightInfo[0]);
  64 + if (!StringUtils.isEmpty(customReception.getFlightDate())) {
  65 + this.setFlightdate(DateUtil.formatByyyyyMMdd(customReception.getFlightDate()));
  66 + }
  67 +
  68 + //处理多线程时 springboot 无法注入bean的问题
  69 + if (this.allocatearrivalMapper==null){
  70 + this.allocatearrivalMapper = SpringBeanUtitl.getBean(ALLOCATEARRIVALMapper.class);
  71 + }
  72 + if (this.sendLogService==null){
  73 + this.sendLogService = SpringBeanUtitl.getBean(SendLogService.class);
  74 + }
  75 + }
  76 +
32 public String getId() { 77 public String getId() {
33 return id; 78 return id;
34 } 79 }
@@ -132,4 +177,24 @@ public class ALLOCATEARRIVAL { @@ -132,4 +177,24 @@ public class ALLOCATEARRIVAL {
132 public void setReceiptinformation(String receiptinformation) { 177 public void setReceiptinformation(String receiptinformation) {
133 this.receiptinformation = receiptinformation == null ? null : receiptinformation.trim(); 178 this.receiptinformation = receiptinformation == null ? null : receiptinformation.trim();
134 } 179 }
  180 +
  181 + public int analysisReception(){
  182 +
  183 + int i= allocatearrivalMapper.updateRECEIPTION(this);
  184 + //获取主单autoid
  185 + List<ALLOCATEARRIVAL> arrivedmasterList = allocatearrivalMapper.selectAutoIdByAwb(this);
  186 + if(!arrivedmasterList.isEmpty()){
  187 + ALLOCATEARRIVAL departuresloading1 = arrivedmasterList.get(0);
  188 + String autoId = departuresloading1.getId();
  189 +
  190 + //插入sendlog记录表
  191 + log.info("即将插入日志运单号为:"+waybillno+"->id="+id);
  192 + int ii =sendLogService.insertSendlog("MT3202",receiptinformation,autoId);
  193 +
  194 + if (i>0 && ii>0){
  195 + return 1;
  196 + }
  197 + }
  198 + return 0;
  199 + }
135 } 200 }
@@ -4,6 +4,7 @@ import lombok.Data; @@ -4,6 +4,7 @@ import lombok.Data;
4 4
5 @Data 5 @Data
6 public class CustomReception { 6 public class CustomReception {
  7 + //回执报头
7 private String messageID; 8 private String messageID;
8 private String functionCode; 9 private String functionCode;
9 private String messageType; 10 private String messageType;
@@ -11,6 +12,8 @@ public class CustomReception { @@ -11,6 +12,8 @@ public class CustomReception {
11 private String receiverID; 12 private String receiverID;
12 private String sendTime; 13 private String sendTime;
13 private String version; 14 private String version;
  15 +
  16 + //一般业务回执
14 private String flightNo; 17 private String flightNo;
15 private String flightDate; 18 private String flightDate;
16 private String wayBillMaster; 19 private String wayBillMaster;
@@ -18,6 +21,14 @@ public class CustomReception { @@ -18,6 +21,14 @@ public class CustomReception {
18 private String responseCode; 21 private String responseCode;
19 private String responseText; 22 private String responseText;
20 23
  24 + //国际转运回执
  25 + private String importFlightDate;
  26 + private String importFlightNo;
  27 + private String importWaybillMaster;
  28 + private String exportFlightDate;
  29 + private String exportFlightNo;
  30 + private String exportWaybillMaster;
  31 +
21 public CustomReception(String messageType, 32 public CustomReception(String messageType,
22 String flightNo, 33 String flightNo,
23 String flightDate, 34 String flightDate,
@@ -45,4 +56,30 @@ public class CustomReception { @@ -45,4 +56,30 @@ public class CustomReception {
45 this.version = version; 56 this.version = version;
46 this.functionCode = functionCode; 57 this.functionCode = functionCode;
47 } 58 }
  59 +
  60 + public CustomReception(String messageType,
  61 + String importFlightNo,
  62 + String importFlightDate,
  63 + String importWaybillMaster,
  64 + String transResponseCode,
  65 + String transResponseText,
  66 + String messageID,
  67 + String sendTime,
  68 + String senderID,
  69 + String receiverID,
  70 + String version,
  71 + String functionCode){
  72 + this.messageType = messageType;
  73 + this.importFlightNo = importFlightNo;
  74 + this.importFlightDate = importFlightDate;
  75 + this.importWaybillMaster = importWaybillMaster;
  76 + this.responseCode = transResponseCode;
  77 + this.responseText = transResponseText;
  78 + this.messageID = messageID;
  79 + this.sendTime = sendTime;
  80 + this.senderID =senderID;
  81 + this.receiverID = receiverID;
  82 + this.version = version;
  83 + this.functionCode = functionCode;
  84 + }
48 } 85 }
1 -package com.tianbo.analysis.service; 1 +package com.tianbo.analysis.model;
2 2
3 import com.tianbo.analysis.model.CustomReception; 3 import com.tianbo.analysis.model.CustomReception;
4 import com.tianbo.analysis.service.imp.CoustomAnalysisServiceImp; 4 import com.tianbo.analysis.service.imp.CoustomAnalysisServiceImp;
@@ -7,11 +7,13 @@ import com.tianbo.analysis.tools.AWBTools; @@ -7,11 +7,13 @@ import com.tianbo.analysis.tools.AWBTools;
7 import com.tianbo.util.Date.DateUtil; 7 import com.tianbo.util.Date.DateUtil;
8 import lombok.extern.slf4j.Slf4j; 8 import lombok.extern.slf4j.Slf4j;
9 import org.apache.commons.lang.StringUtils; 9 import org.apache.commons.lang.StringUtils;
  10 +import org.springframework.scheduling.annotation.Async;
10 11
11 import java.util.Date; 12 import java.util.Date;
12 13
13 @Slf4j 14 @Slf4j
14 -public class NmmsBaseService { 15 +@Async
  16 +public class NmmsBase {
15 17
16 public ShareServiceImp shareServiceImp; 18 public ShareServiceImp shareServiceImp;
17 public CoustomAnalysisServiceImp coustomAnalysisServiceImp; 19 public CoustomAnalysisServiceImp coustomAnalysisServiceImp;
@@ -25,6 +27,7 @@ public class NmmsBaseService { @@ -25,6 +27,7 @@ public class NmmsBaseService {
25 public Date flightDate; 27 public Date flightDate;
26 28
27 public int insertRecept(CustomReception customReception){ 29 public int insertRecept(CustomReception customReception){
  30 + log.warn("公共对象监控打印{}",this);
28 this.shareServiceImp = new ShareServiceImp(); 31 this.shareServiceImp = new ShareServiceImp();
29 // 发送日志 插入 32 // 发送日志 插入
30 this.coustomAnalysisServiceImp = new CoustomAnalysisServiceImp(); 33 this.coustomAnalysisServiceImp = new CoustomAnalysisServiceImp();
  1 +package com.tianbo.analysis.service;
  2 +
  3 +public interface SendLogService {
  4 +
  5 + int insertSendlog(String type,String reception,String autoId);
  6 +}
@@ -2,17 +2,14 @@ package com.tianbo.analysis.service.imp; @@ -2,17 +2,14 @@ package com.tianbo.analysis.service.imp;
2 2
3 import com.tianbo.analysis.dao.ALLOCATEARRIVALMapper; 3 import com.tianbo.analysis.dao.ALLOCATEARRIVALMapper;
4 import com.tianbo.analysis.model.ALLOCATEARRIVAL; 4 import com.tianbo.analysis.model.ALLOCATEARRIVAL;
5 -import com.tianbo.analysis.model.CustomReception;  
6 import com.tianbo.analysis.service.ALLOCATEARRIVALService; 5 import com.tianbo.analysis.service.ALLOCATEARRIVALService;
7 -import com.tianbo.analysis.service.NmmsBaseService; 6 +import com.tianbo.analysis.model.NmmsBase;
8 import com.tianbo.analysis.tools.AWBTools; 7 import com.tianbo.analysis.tools.AWBTools;
9 -import com.tianbo.util.Date.DateUtil;  
10 import lombok.extern.slf4j.Slf4j; 8 import lombok.extern.slf4j.Slf4j;
11 -import org.apache.commons.lang.StringUtils;  
12 import org.springframework.beans.factory.annotation.Autowired; 9 import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.scheduling.annotation.Async;
13 import org.springframework.stereotype.Service; 11 import org.springframework.stereotype.Service;
14 12
15 -import java.util.Date;  
16 import java.util.List; 13 import java.util.List;
17 14
18 /** 15 /**
@@ -21,7 +18,8 @@ import java.util.List; @@ -21,7 +18,8 @@ import java.util.List;
21 */ 18 */
22 @Service 19 @Service
23 @Slf4j 20 @Slf4j
24 -public class ALLOCATEARRIVALServiceImp extends NmmsBaseService implements ALLOCATEARRIVALService { 21 +@Async
  22 +public class ALLOCATEARRIVALServiceImp extends NmmsBase implements ALLOCATEARRIVALService {
25 23
26 @Autowired 24 @Autowired
27 ALLOCATEARRIVALMapper allocatearrivalMapper; 25 ALLOCATEARRIVALMapper allocatearrivalMapper;
@@ -4,15 +4,13 @@ import com.tianbo.analysis.dao.ARRIVEDMASTERMapper; @@ -4,15 +4,13 @@ import com.tianbo.analysis.dao.ARRIVEDMASTERMapper;
4 import com.tianbo.analysis.dao.ARRIVEDSECONDARYMapper; 4 import com.tianbo.analysis.dao.ARRIVEDSECONDARYMapper;
5 import com.tianbo.analysis.model.*; 5 import com.tianbo.analysis.model.*;
6 import com.tianbo.analysis.service.ARRIVEDMASTERService; 6 import com.tianbo.analysis.service.ARRIVEDMASTERService;
7 -import com.tianbo.analysis.service.NmmsBaseService; 7 +import com.tianbo.analysis.model.NmmsBase;
8 import com.tianbo.analysis.tools.AWBTools; 8 import com.tianbo.analysis.tools.AWBTools;
9 -import com.tianbo.util.Date.DateUtil;  
10 import lombok.extern.slf4j.Slf4j; 9 import lombok.extern.slf4j.Slf4j;
11 -import org.apache.commons.lang.StringUtils;  
12 import org.springframework.beans.factory.annotation.Autowired; 10 import org.springframework.beans.factory.annotation.Autowired;
  11 +import org.springframework.scheduling.annotation.Async;
13 import org.springframework.stereotype.Service; 12 import org.springframework.stereotype.Service;
14 13
15 -import java.util.Date;  
16 import java.util.List; 14 import java.util.List;
17 15
18 /** 16 /**
@@ -21,7 +19,8 @@ import java.util.List; @@ -21,7 +19,8 @@ import java.util.List;
21 */ 19 */
22 @Service 20 @Service
23 @Slf4j 21 @Slf4j
24 -public class ARRIVEDMASTERServiceImp extends NmmsBaseService implements ARRIVEDMASTERService{ 22 +@Async
  23 +public class ARRIVEDMASTERServiceImp extends NmmsBase implements ARRIVEDMASTERService{
25 24
26 25
27 @Autowired 26 @Autowired
@@ -4,17 +4,15 @@ import com.tianbo.analysis.bean.SpringBeanUtitl; @@ -4,17 +4,15 @@ import com.tianbo.analysis.bean.SpringBeanUtitl;
4 import com.tianbo.analysis.dao.ORIGINMANIFESTMASTERMapper; 4 import com.tianbo.analysis.dao.ORIGINMANIFESTMASTERMapper;
5 import com.tianbo.analysis.dao.OriginmanifestsecondaryMapper; 5 import com.tianbo.analysis.dao.OriginmanifestsecondaryMapper;
6 import com.tianbo.analysis.dao.SENDLOGMapper; 6 import com.tianbo.analysis.dao.SENDLOGMapper;
7 -import com.tianbo.analysis.model.CustomReception;  
8 import com.tianbo.analysis.model.ORIGINMANIFESTMASTER; 7 import com.tianbo.analysis.model.ORIGINMANIFESTMASTER;
9 import com.tianbo.analysis.model.Originmanifestsecondary; 8 import com.tianbo.analysis.model.Originmanifestsecondary;
10 import com.tianbo.analysis.model.SENDLOG; 9 import com.tianbo.analysis.model.SENDLOG;
11 import com.tianbo.analysis.service.CoustomAnalysisService; 10 import com.tianbo.analysis.service.CoustomAnalysisService;
12 -import com.tianbo.analysis.service.NmmsBaseService;  
13 -import com.tianbo.util.Date.DateUtil; 11 +import com.tianbo.analysis.model.NmmsBase;
14 import com.tianbo.util.Helper; 12 import com.tianbo.util.Helper;
15 import lombok.extern.slf4j.Slf4j; 13 import lombok.extern.slf4j.Slf4j;
16 -import org.apache.commons.lang.StringUtils;  
17 import org.springframework.beans.factory.annotation.Autowired; 14 import org.springframework.beans.factory.annotation.Autowired;
  15 +import org.springframework.scheduling.annotation.Async;
18 import org.springframework.stereotype.Service; 16 import org.springframework.stereotype.Service;
19 17
20 import java.math.BigDecimal; 18 import java.math.BigDecimal;
@@ -27,7 +25,8 @@ import java.util.List; @@ -27,7 +25,8 @@ import java.util.List;
27 */ 25 */
28 @Service 26 @Service
29 @Slf4j 27 @Slf4j
30 -public class CoustomAnalysisServiceImp extends NmmsBaseService implements CoustomAnalysisService { 28 +@Async
  29 +public class CoustomAnalysisServiceImp extends NmmsBase implements CoustomAnalysisService {
31 30
32 @Autowired 31 @Autowired
33 SENDLOGMapper sendlogMapper; 32 SENDLOGMapper sendlogMapper;
@@ -41,6 +40,12 @@ public class CoustomAnalysisServiceImp extends NmmsBaseService implements Cousto @@ -41,6 +40,12 @@ public class CoustomAnalysisServiceImp extends NmmsBaseService implements Cousto
41 if (this.sendlogMapper==null){ 40 if (this.sendlogMapper==null){
42 this.sendlogMapper = SpringBeanUtitl.getBean(SENDLOGMapper.class); 41 this.sendlogMapper = SpringBeanUtitl.getBean(SENDLOGMapper.class);
43 } 42 }
  43 + if (this.originmanifestmasterMapper==null){
  44 + this.originmanifestmasterMapper = SpringBeanUtitl.getBean(ORIGINMANIFESTMASTERMapper.class);
  45 + }
  46 + if (this.originmanifestsecondaryMapper==null){
  47 + this.originmanifestsecondaryMapper = SpringBeanUtitl.getBean(OriginmanifestsecondaryMapper.class);
  48 + }
44 } 49 }
45 50
46 @Override 51 @Override
1 package com.tianbo.analysis.service.imp; 1 package com.tianbo.analysis.service.imp;
2 2
3 import com.tianbo.analysis.dao.DEPARTURESLOADINGMapper; 3 import com.tianbo.analysis.dao.DEPARTURESLOADINGMapper;
4 -import com.tianbo.analysis.model.CustomReception;  
5 import com.tianbo.analysis.model.DEPARTURESLOADING; 4 import com.tianbo.analysis.model.DEPARTURESLOADING;
6 import com.tianbo.analysis.service.DEPARTURESLOADINGService; 5 import com.tianbo.analysis.service.DEPARTURESLOADINGService;
7 -import com.tianbo.analysis.service.NmmsBaseService;  
8 -import com.tianbo.util.Date.DateUtil; 6 +import com.tianbo.analysis.model.NmmsBase;
9 import lombok.extern.slf4j.Slf4j; 7 import lombok.extern.slf4j.Slf4j;
10 -import org.apache.commons.lang.StringUtils;  
11 import org.springframework.beans.factory.annotation.Autowired; 8 import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.scheduling.annotation.Async;
12 import org.springframework.stereotype.Service; 10 import org.springframework.stereotype.Service;
13 11
14 -import java.util.Date;  
15 import java.util.List; 12 import java.util.List;
16 13
17 /** 14 /**
@@ -20,7 +17,8 @@ import java.util.List; @@ -20,7 +17,8 @@ import java.util.List;
20 */ 17 */
21 @Service 18 @Service
22 @Slf4j 19 @Slf4j
23 -public class DEPARTURESLOADINGServiceImp extends NmmsBaseService implements DEPARTURESLOADINGService{ 20 +@Async
  21 +public class DEPARTURESLOADINGServiceImp extends NmmsBase implements DEPARTURESLOADINGService{
24 22
25 @Autowired 23 @Autowired
26 DEPARTURESLOADINGMapper departuresloadingMapper; 24 DEPARTURESLOADINGMapper departuresloadingMapper;
1 package com.tianbo.analysis.service.imp; 1 package com.tianbo.analysis.service.imp;
2 2
3 -import com.fasterxml.jackson.databind.annotation.JsonAppend;  
4 import com.tianbo.analysis.dao.INPORTALLOCATEMapper; 3 import com.tianbo.analysis.dao.INPORTALLOCATEMapper;
5 -import com.tianbo.analysis.model.CustomReception;  
6 import com.tianbo.analysis.model.INPORTALLOCATE; 4 import com.tianbo.analysis.model.INPORTALLOCATE;
7 import com.tianbo.analysis.service.INPORTALLOCATEService; 5 import com.tianbo.analysis.service.INPORTALLOCATEService;
8 -import com.tianbo.analysis.service.NmmsBaseService; 6 +import com.tianbo.analysis.model.NmmsBase;
9 import com.tianbo.analysis.tools.AWBTools; 7 import com.tianbo.analysis.tools.AWBTools;
10 -import com.tianbo.util.Date.DateUtil;  
11 import lombok.extern.slf4j.Slf4j; 8 import lombok.extern.slf4j.Slf4j;
12 -import org.apache.commons.lang.StringUtils;  
13 import org.springframework.beans.factory.annotation.Autowired; 9 import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.scheduling.annotation.Async;
14 import org.springframework.stereotype.Service; 11 import org.springframework.stereotype.Service;
15 12
16 -import java.util.Date;  
17 import java.util.List; 13 import java.util.List;
18 14
19 /** 15 /**
@@ -23,7 +19,8 @@ import java.util.List; @@ -23,7 +19,8 @@ import java.util.List;
23 19
24 @Service 20 @Service
25 @Slf4j 21 @Slf4j
26 -public class INPORTALLOCATEServiceImp extends NmmsBaseService implements INPORTALLOCATEService{ 22 +@Async
  23 +public class INPORTALLOCATEServiceImp extends NmmsBase implements INPORTALLOCATEService{
27 24
28 @Autowired 25 @Autowired
29 INPORTALLOCATEMapper inportallocateMapper; 26 INPORTALLOCATEMapper inportallocateMapper;
@@ -4,13 +4,14 @@ import com.tianbo.analysis.dao.INTERNATIONALTRANSITMapper; @@ -4,13 +4,14 @@ import com.tianbo.analysis.dao.INTERNATIONALTRANSITMapper;
4 import com.tianbo.analysis.model.CustomReception; 4 import com.tianbo.analysis.model.CustomReception;
5 import com.tianbo.analysis.model.INTERNATIONALTRANSIT; 5 import com.tianbo.analysis.model.INTERNATIONALTRANSIT;
6 import com.tianbo.analysis.service.INTERNATIONALTRANSITService; 6 import com.tianbo.analysis.service.INTERNATIONALTRANSITService;
  7 +import com.tianbo.analysis.model.NmmsBase;
  8 +import com.tianbo.analysis.tools.AWBTools;
7 import com.tianbo.util.Date.DateUtil; 9 import com.tianbo.util.Date.DateUtil;
8 import lombok.extern.slf4j.Slf4j; 10 import lombok.extern.slf4j.Slf4j;
9 -import org.apache.commons.lang.StringUtils;  
10 import org.springframework.beans.factory.annotation.Autowired; 11 import org.springframework.beans.factory.annotation.Autowired;
  12 +import org.springframework.scheduling.annotation.Async;
11 import org.springframework.stereotype.Service; 13 import org.springframework.stereotype.Service;
12 14
13 -import java.util.Date;  
14 import java.util.List; 15 import java.util.List;
15 16
16 /** 17 /**
@@ -19,72 +20,55 @@ import java.util.List; @@ -19,72 +20,55 @@ import java.util.List;
19 */ 20 */
20 @Service 21 @Service
21 @Slf4j 22 @Slf4j
22 -public class INTERNATIONALTRANSITServiceImp implements INTERNATIONALTRANSITService{ 23 +@Async
  24 +public class INTERNATIONALTRANSITServiceImp extends NmmsBase implements INTERNATIONALTRANSITService{
23 25
24 @Autowired 26 @Autowired
25 INTERNATIONALTRANSITMapper internationaltransitMapper; 27 INTERNATIONALTRANSITMapper internationaltransitMapper;
26 28
27 @Override 29 @Override
28 - public int insertRecept(CustomReception customReception) {  
29 - ShareServiceImp shareServiceImp = new ShareServiceImp();  
30 -  
31 - // 发送日志 插入  
32 - CoustomAnalysisServiceImp coustomAnalysisServiceImp = new CoustomAnalysisServiceImp();  
33 -  
34 - // 主单号  
35 - String awbA = customReception.getWayBillMaster();  
36 - //回执内容  
37 - String reception = customReception.getResponseText();  
38 - String flightDateStr = customReception.getFlightDate();  
39 - if (!StringUtils.isEmpty(flightDateStr)) {  
40 - Date flightDate = DateUtil.formatByyyyyMMdd(flightDateStr);  
41 - //设置主单回执、航班号、航班日期  
42 - INTERNATIONALTRANSIT inportallocate = new INTERNATIONALTRANSIT();  
43 - inportallocate.setReceiption(reception);  
44 - inportallocate.setOriginalFlightno(customReception.getFlightNo().substring(2));  
45 - inportallocate.setOriginalFlightdate(flightDate);  
46 -  
47 - if (awbA!=null && awbA.length()>0){  
48 - StringBuffer stringBuffer = new StringBuffer(awbA);  
49 - stringBuffer.insert(3,"-");  
50 - awbA = stringBuffer.toString(); 30 + public int insertRecept(CustomReception customReception){
  31 + super.insertRecept(customReception);
  32 + log.info("开始解析:运单号 {} 回执类型:{} ",customReception.getImportWaybillMaster(),customReception.getMessageType());
  33 + return master();
  34 + }
51 35
52 - //设置主分单的 主单号  
53 - inportallocate.setOriginalBillno(awbA); 36 + @Override
  37 + public int master() {
  38 + //设置主单回执、航班号、航班日期
  39 + INTERNATIONALTRANSIT inportallocate = new INTERNATIONALTRANSIT();
  40 + inportallocate.setReceiption(customReception.getResponseText());
  41 + String[] flightInfo = AWBTools.splitFlight(customReception.getImportFlightNo());
  42 + inportallocate.setOriginalFlightno(flightInfo[1]);
  43 + inportallocate.setOriginalCarrier(flightInfo[0]);
  44 +
  45 + inportallocate.setOriginalFlightdate(DateUtil.formatByyyyyMMdd(customReception.getImportFlightDate()));
  46 +
  47 + //设置主分单的 主单号
  48 + inportallocate.setOriginalBillno(AWBTools.awbFormat(customReception.getImportWaybillMaster()));
  49 + inportallocate.setStatus(AWBTools.transCusRspCode(customReception.getResponseCode()));
  50 +
  51 + //更新主单回执
  52 + int i = internationaltransitMapper.updateRECEIPTION(inportallocate);
  53 + //获取分单autoid
  54 + List<INTERNATIONALTRANSIT> internationaltransits = internationaltransitMapper.selectAutoIdByAwb(inportallocate);
  55 + if(!internationaltransits.isEmpty()){
  56 + INTERNATIONALTRANSIT internationaltransit = internationaltransits.get(0);
  57 + String autoId = internationaltransit.getAutoid();
  58 +
  59 + //插入sendlog记录表
  60 + log.info("即将插入日志运单号为:"+awbA+"->autoid="+autoId);
  61 + int ii =coustomAnalysisServiceImp.insertSendlog("MT8205",reception,autoId);
  62 +
  63 + int iii = shareServiceImp.updateMessages(customReception);
  64 + if (i>0 && ii>0){
  65 + log.info("运单号 {} 国际转运回执更新成功",customReception.getImportWaybillMaster());
  66 + return 1;
54 } 67 }
55 -  
56 -  
57 - // 判断航班号 航班日期 是否为空  
58 - if (flightDate != null && customReception.getFlightNo() != null){  
59 - //处理主单格式,将海关回执的主单号58019316861,变为580-19316861  
60 - if (awbA!=null && awbA.length()>0){  
61 - //更新主单回执  
62 - int i = internationaltransitMapper.updateRECEIPTION(inportallocate);  
63 - //获取分单autoid  
64 - List<INTERNATIONALTRANSIT> arrivedmasterList = internationaltransitMapper.selectAutoIdByAwb(inportallocate);  
65 - if(!arrivedmasterList.isEmpty()){  
66 - INTERNATIONALTRANSIT departuresloading1 = arrivedmasterList.get(0);  
67 - String autoId = departuresloading1.getAutoid();  
68 -  
69 - //插入sendlog记录表  
70 - log.info("即将插入日志运单号为:"+awbA+"->autoid="+autoId);  
71 - int ii =coustomAnalysisServiceImp.insertSendlog("MT8205",reception,autoId);  
72 -  
73 - int iii = shareServiceImp.updateMessages(customReception);  
74 - if (i>0 && ii>0 && iii > 0){  
75 - return 1;  
76 - }  
77 - }  
78 - return 0;  
79 - }  
80 - }else {  
81 -  
82 - return shareServiceImp.share("MT8205", customReception); 68 + if (iii > 0){
  69 + return 1;
83 } 70 }
84 -  
85 } 71 }
86 -  
87 - //未进入主分单解析 返回0 失败  
88 return 0; 72 return 0;
89 } 73 }
90 } 74 }
@@ -2,17 +2,16 @@ package com.tianbo.analysis.service.imp; @@ -2,17 +2,16 @@ package com.tianbo.analysis.service.imp;
2 2
3 import com.tianbo.analysis.dao.PREPAREMASTERMapper; 3 import com.tianbo.analysis.dao.PREPAREMASTERMapper;
4 import com.tianbo.analysis.dao.PREPARESECONDARYMapper; 4 import com.tianbo.analysis.dao.PREPARESECONDARYMapper;
5 -import com.tianbo.analysis.model.CustomReception;  
6 import com.tianbo.analysis.model.PREPAREMASTER; 5 import com.tianbo.analysis.model.PREPAREMASTER;
7 import com.tianbo.analysis.model.PREPARESECONDARY; 6 import com.tianbo.analysis.model.PREPARESECONDARY;
8 -import com.tianbo.analysis.service.NmmsBaseService; 7 +import com.tianbo.analysis.model.NmmsBase;
9 import com.tianbo.analysis.service.PREPAREMASTERService; 8 import com.tianbo.analysis.service.PREPAREMASTERService;
10 import com.tianbo.analysis.tools.AWBTools; 9 import com.tianbo.analysis.tools.AWBTools;
11 import lombok.extern.slf4j.Slf4j; 10 import lombok.extern.slf4j.Slf4j;
12 import org.springframework.beans.factory.annotation.Autowired; 11 import org.springframework.beans.factory.annotation.Autowired;
  12 +import org.springframework.scheduling.annotation.Async;
13 import org.springframework.stereotype.Service; 13 import org.springframework.stereotype.Service;
14 14
15 -import java.util.Date;  
16 import java.util.List; 15 import java.util.List;
17 16
18 /** 17 /**
@@ -21,7 +20,8 @@ import java.util.List; @@ -21,7 +20,8 @@ import java.util.List;
21 */ 20 */
22 @Service 21 @Service
23 @Slf4j 22 @Slf4j
24 -public class PREPAREMASTERServiceImp extends NmmsBaseService implements PREPAREMASTERService { 23 +@Async
  24 +public class PREPAREMASTERServiceImp extends NmmsBase implements PREPAREMASTERService {
25 25
26 @Autowired 26 @Autowired
27 PREPAREMASTERMapper preparemasterMapper; 27 PREPAREMASTERMapper preparemasterMapper;
@@ -38,6 +38,10 @@ public class PREPAREMASTERServiceImp extends NmmsBaseService implements PREPAREM @@ -38,6 +38,10 @@ public class PREPAREMASTERServiceImp extends NmmsBaseService implements PREPAREM
38 // 设置 接收运抵分单 回执 38 // 设置 接收运抵分单 回执
39 PREPARESECONDARY preparesecondary = new PREPARESECONDARY(); 39 PREPARESECONDARY preparesecondary = new PREPARESECONDARY();
40 preparesecondary.setReceiptinformation(reception); 40 preparesecondary.setReceiptinformation(reception);
  41 + String[] flightInfo = AWBTools.splitFlight(customReception.getFlightNo());
  42 + preparesecondary.setFlightno(flightInfo[1]);
  43 + preparesecondary.setCarrier(flightInfo[0]);
  44 + preparesecondary.setFlightdate(flightDate);
41 //设置主分单的 主单号 45 //设置主分单的 主单号
42 preparesecondary.setWaybillnomaster(awbA); 46 preparesecondary.setWaybillnomaster(awbA);
43 //取分单号 47 //取分单号
  1 +package com.tianbo.analysis.service.imp;
  2 +
  3 +import com.tianbo.analysis.dao.SENDLOGMapper;
  4 +import com.tianbo.analysis.model.SENDLOG;
  5 +import com.tianbo.analysis.service.SendLogService;
  6 +import com.tianbo.util.Helper;
  7 +import lombok.extern.slf4j.Slf4j;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.stereotype.Service;
  10 +
  11 +import java.math.BigDecimal;
  12 +import java.util.Date;
  13 +
  14 +@Service
  15 +@Slf4j
  16 +public class SendLogServiceImp implements SendLogService{
  17 +
  18 + @Autowired
  19 + private SENDLOGMapper sendlogMapper;
  20 +
  21 + @Override
  22 + public int insertSendlog(String type,String reception,String autoId){
  23 + SENDLOG sendlog = new SENDLOG();
  24 + sendlog.setAutoid(Helper.getUUID());
  25 + sendlog.setCreatedate(new Date());
  26 + sendlog.setMessageautoid(autoId);
  27 + sendlog.setMessagetype(type);
  28 + sendlog.setReceiption(reception);
  29 + sendlog.setSendpeice(new Long(0));
  30 + sendlog.setSendweight(new BigDecimal(0));
  31 +
  32 +
  33 + int i = sendlogMapper.insertSelective(sendlog);
  34 + if (i>0){
  35 + log.info("插入回执日志成功,插入数据量为:"+i);
  36 + }
  37 +
  38 + return i;
  39 + }
  40 +}
@@ -2,18 +2,15 @@ package com.tianbo.analysis.service.imp; @@ -2,18 +2,15 @@ package com.tianbo.analysis.service.imp;
2 2
3 import com.tianbo.analysis.dao.TALLYMASTERMapper; 3 import com.tianbo.analysis.dao.TALLYMASTERMapper;
4 import com.tianbo.analysis.dao.TALLYSECONDARYMapper; 4 import com.tianbo.analysis.dao.TALLYSECONDARYMapper;
5 -import com.tianbo.analysis.model.CustomReception;  
6 import com.tianbo.analysis.model.TALLYMASTER; 5 import com.tianbo.analysis.model.TALLYMASTER;
7 import com.tianbo.analysis.model.TALLYSECONDARY; 6 import com.tianbo.analysis.model.TALLYSECONDARY;
8 -import com.tianbo.analysis.service.NmmsBaseService; 7 +import com.tianbo.analysis.model.NmmsBase;
9 import com.tianbo.analysis.service.TALLYMASTERService; 8 import com.tianbo.analysis.service.TALLYMASTERService;
10 -import com.tianbo.util.Date.DateUtil;  
11 import lombok.extern.slf4j.Slf4j; 9 import lombok.extern.slf4j.Slf4j;
12 -import org.apache.commons.lang.StringUtils;  
13 import org.springframework.beans.factory.annotation.Autowired; 10 import org.springframework.beans.factory.annotation.Autowired;
  11 +import org.springframework.scheduling.annotation.Async;
14 import org.springframework.stereotype.Service; 12 import org.springframework.stereotype.Service;
15 13
16 -import java.util.Date;  
17 import java.util.List; 14 import java.util.List;
18 15
19 /** 16 /**
@@ -24,7 +21,8 @@ import java.util.List; @@ -24,7 +21,8 @@ import java.util.List;
24 21
25 @Service 22 @Service
26 @Slf4j 23 @Slf4j
27 -public class TALLYMASTERServiceImp extends NmmsBaseService implements TALLYMASTERService{ 24 +@Async
  25 +public class TALLYMASTERServiceImp extends NmmsBase implements TALLYMASTERService{
28 26
29 @Autowired 27 @Autowired
30 TALLYMASTERMapper tallymasterMapper; 28 TALLYMASTERMapper tallymasterMapper;
@@ -80,6 +78,7 @@ public class TALLYMASTERServiceImp extends NmmsBaseService implements TALLYMASTE @@ -80,6 +78,7 @@ public class TALLYMASTERServiceImp extends NmmsBaseService implements TALLYMASTE
80 tallysecondary.setStatus(nmsStatusCode); 78 tallysecondary.setStatus(nmsStatusCode);
81 //设置主分单的 主单号 79 //设置主分单的 主单号
82 tallysecondary.setWaybillnomaster(awbA); 80 tallysecondary.setWaybillnomaster(awbA);
  81 + log.info("开始解析主单的{}分单{}",awbA,awbH);
83 //取分单号 82 //取分单号
84 String[] awbhArr = awbH.split("_"); 83 String[] awbhArr = awbH.split("_");
85 String awbh = awbhArr[1]; 84 String awbh = awbhArr[1];
@@ -4,13 +4,17 @@ import com.tianbo.util.Date.DateUtil; @@ -4,13 +4,17 @@ import com.tianbo.util.Date.DateUtil;
4 import com.tianbo.util.IO.FileTool; 4 import com.tianbo.util.IO.FileTool;
5 import com.tianbo.analysis.handle.CustomXmlHandleThread; 5 import com.tianbo.analysis.handle.CustomXmlHandleThread;
6 import lombok.extern.slf4j.Slf4j; 6 import lombok.extern.slf4j.Slf4j;
  7 +import org.apache.commons.io.FileUtils;
7 import org.springframework.beans.factory.annotation.Value; 8 import org.springframework.beans.factory.annotation.Value;
8 import org.springframework.scheduling.annotation.Scheduled; 9 import org.springframework.scheduling.annotation.Scheduled;
9 import org.springframework.stereotype.Component; 10 import org.springframework.stereotype.Component;
10 11
11 import java.io.File; 12 import java.io.File;
12 -import java.util.Iterator; 13 +import java.io.IOException;
  14 +import java.text.SimpleDateFormat;
  15 +import java.util.Date;
13 import java.util.List; 16 import java.util.List;
  17 +import java.util.concurrent.*;
14 18
15 /** 19 /**
16 * 回执解析定时任务 20 * 回执解析定时任务
@@ -23,31 +27,91 @@ public class TaskAnalysis { @@ -23,31 +27,91 @@ public class TaskAnalysis {
23 @Value("${custom.receptDirectory}") 27 @Value("${custom.receptDirectory}")
24 private String receptDir; 28 private String receptDir;
25 29
26 - @Scheduled(fixedDelay = 500000) 30 + //回执转发目录
  31 + @Value("${custom.transmitDir}")
  32 + private String transmitDir;
  33 +
  34 + @Scheduled(fixedRate = 5000)
27 public void startTask(){ 35 public void startTask(){
  36 + final SimpleDateFormat sdf = new SimpleDateFormat(
  37 + "yyyy-MM-dd HH:mm:ss");
  38 +
  39 + final String startTime = sdf.format(new Date());
  40 +
  41 + //设置转发文件夹
  42 + String today = DateUtil.getTodayBy_yyyyMMdd();
  43 + String transToCfps = transmitDir + "/" + today;
28 //回执目录 44 //回执目录
29 String readDir = receptDir; 45 String readDir = receptDir;
30 - try{ 46 +
  47 + //初始化线程池
  48 + ThreadPoolExecutor threadPool = XMLThreadPoolFactory.instance();
  49 +
  50 + try {
31 File fileDirectory = new File(readDir); 51 File fileDirectory = new File(readDir);
32 - List<File> files = FileTool.readDirectoryFiles(fileDirectory);  
33 - Iterator<File> it = files.iterator();  
34 - while(it.hasNext()){  
35 - File file = it.next();  
36 - try {  
37 - CustomXmlHandleThread customXmlHandleThread = new CustomXmlHandleThread();  
38 - customXmlHandleThread.setXmlfile(file);  
39 - Thread thread = new Thread(customXmlHandleThread);  
40 - thread.start();  
41 -  
42 - }catch (Exception e){  
43 - e.printStackTrace();  
44 - log.error("解析回执出错",e);  
45 - } 52 + List<File> files = FileTool.readDirectoryFiles(fileDirectory);
  53 + //文件数量大于50个,每次只解析前50个
  54 + if (files!=null && !files.isEmpty() && files.size()>50){
  55 + CountDownLatch latch = new CountDownLatch(50);
  56 + log.trace("解析任务开始{},文件数量:{}",startTime,50);
  57 + for (int i=0;i<50;i++){
  58 + threadJbob(files.get(i),latch,transToCfps,threadPool);
46 } 59 }
  60 + latch.await();
  61 + }
  62 + //文件数量小于50个,全部一次解析完
  63 + if (files!=null && !files.isEmpty() && files.size()<50){
  64 + CountDownLatch latch = new CountDownLatch(files.size());
  65 + log.info("解析任务开始{},文件数量:{}",startTime,files.size());
  66 + for (int i=0;i<files.size();i++){
  67 + threadJbob(files.get(i),latch,transToCfps,threadPool);
  68 + }
  69 + latch.await();
  70 + }
  71 +
  72 +// Iterator<File> it = files.iterator();
  73 +// while (it.hasNext()) {
  74 +// if (threadPool.getActiveCount() < 100) {
  75 +// File file = it.next();
  76 +// try {
  77 +// FileUtils.copyFileToDirectory(file, new File(transToCfps));
  78 +// } catch (IOException e) {
  79 +// e.printStackTrace();
  80 +// log.error("复制报文{}到回执转发目录失败", file.getName());
  81 +// }
  82 +//
  83 +// try {
  84 +// CustomXmlHandleThread customXmlHandleThread = new CustomXmlHandleThread();
  85 +// customXmlHandleThread.setXmlfile(file);
  86 +// threadPool.execute(customXmlHandleThread);
  87 +// } catch (Exception e) {
  88 +// e.printStackTrace();
  89 +// log.error("解析回执出错", e);
  90 +// }
  91 +// }
  92 +// }
47 }catch (Exception e){ 93 }catch (Exception e){
48 e.printStackTrace(); 94 e.printStackTrace();
49 log.error("获取目录文件出错",e); 95 log.error("获取目录文件出错",e);
50 } 96 }
51 97
  98 + log.info("解析任务结束{}",sdf.format(new Date()));
  99 +
  100 + }
  101 +
  102 + private void threadJbob(File file,CountDownLatch latch,String transToCfps,ThreadPoolExecutor threadPool){
  103 + try{
  104 + FileUtils.copyFileToDirectory(file, new File(transToCfps));
  105 + CustomXmlHandleThread customXmlHandleThread = new CustomXmlHandleThread();
  106 + customXmlHandleThread.setXmlfile(file);
  107 + customXmlHandleThread.setLatch(latch);
  108 + threadPool.execute(customXmlHandleThread);
  109 + }catch (IOException e){
  110 + log.error("备份文件{}出错,错误代码:{}",file,e);
  111 + }catch (Exception e){
  112 + log.error("线程解析出错{}",e);
  113 + }
  114 +
52 } 115 }
  116 +
53 } 117 }
  1 +package com.tianbo.analysis.task;
  2 +
  3 +import java.util.ArrayList;
  4 +import java.util.Date;
  5 +import java.util.Iterator;
  6 +import java.util.List;
  7 +import java.util.concurrent.ThreadFactory;
  8 +
  9 +public class XMLThreadFactory implements ThreadFactory {
  10 +
  11 + private int counter;
  12 + private String name;
  13 + private List<String> stats;
  14 +
  15 + public XMLThreadFactory(String name)
  16 + {
  17 + counter = 1;
  18 + this.name = name;
  19 + stats = new ArrayList<String>();
  20 + }
  21 +
  22 + @Override
  23 + public Thread newThread(Runnable runnable)
  24 + {
  25 + Thread t = new Thread(runnable, name + "-Thread_" + counter);
  26 + counter++;
  27 + stats.add(String.format("Created thread %d with name %s on %s \n", t.getId(), t.getName(), new Date()));
  28 + return t;
  29 + }
  30 +
  31 + public String getStats()
  32 + {
  33 + StringBuffer buffer = new StringBuffer();
  34 + Iterator<String> it = stats.iterator();
  35 + while (it.hasNext())
  36 + {
  37 + buffer.append(it.next());
  38 + }
  39 + return buffer.toString();
  40 + }
  41 +
  42 +}
  1 +package com.tianbo.analysis.task;
  2 +
  3 +import java.util.concurrent.LinkedBlockingQueue;
  4 +import java.util.concurrent.ThreadPoolExecutor;
  5 +import java.util.concurrent.TimeUnit;
  6 +
  7 +public class XMLThreadPoolFactory {
  8 +
  9 + private static ThreadPoolExecutor threadPool;
  10 +
  11 + public static ThreadPoolExecutor instance(){
  12 + if (threadPool==null){
  13 + XMLThreadFactory xmlThreadFactory = new XMLThreadFactory("xml");
  14 + threadPool = new ThreadPoolExecutor(5, 100,
  15 + 0L, TimeUnit.MILLISECONDS,
  16 + new LinkedBlockingQueue<Runnable>(1024),
  17 + xmlThreadFactory,
  18 + new ThreadPoolExecutor.AbortPolicy());
  19 + }
  20 + return threadPool;
  21 + }
  22 +}
@@ -14,6 +14,11 @@ public class AWBTools { @@ -14,6 +14,11 @@ public class AWBTools {
14 return ""; 14 return "";
15 } 15 }
16 16
  17 + /**
  18 + * 将航班号拆分成承运人及航班
  19 + * @param flightNo
  20 + * @return 返回数组 [0]为承运人 [1]为航班号
  21 + */
17 public static String[] splitFlight(String flightNo){ 22 public static String[] splitFlight(String flightNo){
18 String[] flight = {"UNKONW","UNKONW"}; 23 String[] flight = {"UNKONW","UNKONW"};
19 if (!StringUtils.isEmpty(flightNo) && flightNo.length()>2){ 24 if (!StringUtils.isEmpty(flightNo) && flightNo.length()>2){
@@ -24,6 +29,23 @@ public class AWBTools { @@ -24,6 +29,23 @@ public class AWBTools {
24 } 29 }
25 30
26 /** 31 /**
  32 + * 拆分航班号与航班日期 CV7302/20190826
  33 + * @param flightNoAndDate
  34 + * @return [0] CV7302 [1]20190826
  35 + */
  36 + public static String[] splitFlightAndDate(String flightNoAndDate){
  37 + String[] flight = {"UNKONW","UNKONW"};
  38 + if(!StringUtils.isEmpty(flightNoAndDate)){
  39 + String[] flightList = flightNoAndDate.split("/");
  40 + if(flightList.length > 0){
  41 + flight[0] = flightList[0];
  42 + flight[1] = flightList[1];
  43 + }
  44 + }
  45 + return flight;
  46 + }
  47 +
  48 + /**
27 * 将海关回执中的response code 转换成新舱单1.0数据库中的相关状态,相关状态码参考readme.md 49 * 将海关回执中的response code 转换成新舱单1.0数据库中的相关状态,相关状态码参考readme.md
28 * @param rspCode 50 * @param rspCode
29 * @return 51 * @return
@@ -124,7 +124,7 @@ @@ -124,7 +124,7 @@
124 AND 124 AND
125 FLIGHTNO = #{flightno,jdbcType=VARCHAR} 125 FLIGHTNO = #{flightno,jdbcType=VARCHAR}
126 AND 126 AND
127 - FLIGHTDATE= #{flightDate,jdbcType=DATE} 127 + FLIGHTDATE= #{flightdate,jdbcType=DATE}
128 AND 128 AND
129 WAYBILLNO = #{waybillno,jdbcType=VARCHAR} 129 WAYBILLNO = #{waybillno,jdbcType=VARCHAR}
130 </update> 130 </update>
@@ -135,7 +135,7 @@ @@ -135,7 +135,7 @@
135 WHERE 135 WHERE
136 FLIGHTNO= #{flightno,jdbcType=VARCHAR} 136 FLIGHTNO= #{flightno,jdbcType=VARCHAR}
137 AND 137 AND
138 - FLIGHTDATE= #{flightDate,jdbcType=DATE} 138 + FLIGHTDATE= #{flightdate,jdbcType=DATE}
139 AND 139 AND
140 WAYBILLNO = #{waybillno,jdbcType=VARCHAR} 140 WAYBILLNO = #{waybillno,jdbcType=VARCHAR}
141 </select> 141 </select>
@@ -172,21 +172,27 @@ @@ -172,21 +172,27 @@
172 172
173 <update id="updateRECEIPTION" parameterType="com.tianbo.analysis.model.INTERNATIONALTRANSIT" > 173 <update id="updateRECEIPTION" parameterType="com.tianbo.analysis.model.INTERNATIONALTRANSIT" >
174 UPDATE INTERNATIONALTRANSIT 174 UPDATE INTERNATIONALTRANSIT
175 - SET RECEIPTINFORMATION= #{receiptinformation,jdbcType=VARCHAR}  
176 - WHERE ORIGINAL_FLIGHTNO = #{originalFlightno,jdbcType=VARCHAR} 175 + SET RECEIPTION= #{receiption,jdbcType=VARCHAR},
  176 + STATUS = #{status,jdbcType=VARCHAR }
  177 + WHERE
  178 + ORIGINAL_FLIGHTNO = #{originalFlightno,jdbcType=VARCHAR}
  179 + AND
  180 + ORIGINAL_CARRIER = #{originalCarrier,jdbcType=VARCHAR}
177 AND 181 AND
178 - FLIGHTDATE= #{flightDate,jdbcType=TIMESTAMP} 182 + ORIGINAL_FLIGHTDATE= #{originalFlightdate,jdbcType=DATE}
179 AND 183 AND
180 - WAYBILLNO = #{waybillno,jdbcType=VARCHAR} 184 + ORIGINAL_BILLNO = #{originalBillno,jdbcType=VARCHAR}
181 </update> 185 </update>
182 186
183 <select id="selectAutoIdByAwb" parameterType="com.tianbo.analysis.model.INTERNATIONALTRANSIT" resultType="com.tianbo.analysis.model.INTERNATIONALTRANSIT"> 187 <select id="selectAutoIdByAwb" parameterType="com.tianbo.analysis.model.INTERNATIONALTRANSIT" resultType="com.tianbo.analysis.model.INTERNATIONALTRANSIT">
184 - SELECT ID 188 + SELECT AUTOID
185 FROM INTERNATIONALTRANSIT 189 FROM INTERNATIONALTRANSIT
186 WHERE 190 WHERE
187 ORIGINAL_FLIGHTNO= #{originalFlightno,jdbcType=VARCHAR} 191 ORIGINAL_FLIGHTNO= #{originalFlightno,jdbcType=VARCHAR}
188 AND 192 AND
189 - ORIGINAL_FLIGHTDATE= #{originalFlightdate,jdbcType=TIMESTAMP} 193 + ORIGINAL_CARRIER = #{originalCarrier,jdbcType=VARCHAR}
  194 + AND
  195 + ORIGINAL_FLIGHTDATE= #{originalFlightdate,jdbcType=DATE}
190 AND 196 AND
191 ORIGINAL_BILLNO = #{originalBillno,jdbcType=VARCHAR} 197 ORIGINAL_BILLNO = #{originalBillno,jdbcType=VARCHAR}
192 </select> 198 </select>
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
4 <resultMap id="BaseResultMap" type="com.tianbo.analysis.model.PREPAREMASTER" > 4 <resultMap id="BaseResultMap" type="com.tianbo.analysis.model.PREPAREMASTER" >
5 <result column="AUTOID" property="autoid" jdbcType="VARCHAR" /> 5 <result column="AUTOID" property="autoid" jdbcType="VARCHAR" />
6 <result column="FLIGHTNO" property="flightno" jdbcType="VARCHAR" /> 6 <result column="FLIGHTNO" property="flightno" jdbcType="VARCHAR" />
7 - <result column="FLIGHTDATE" property="flightdate" jdbcType="TIMESTAMP" /> 7 + <result column="FLIGHTDATE" property="flightdate" jdbcType="DATE" />
8 <result column="ORIGINATINGSTATION" property="originatingstation" jdbcType="VARCHAR" /> 8 <result column="ORIGINATINGSTATION" property="originatingstation" jdbcType="VARCHAR" />
9 <result column="DESTINATIONSTATION" property="destinationstation" jdbcType="VARCHAR" /> 9 <result column="DESTINATIONSTATION" property="destinationstation" jdbcType="VARCHAR" />
10 <result column="WAYBILLNOMASTER" property="waybillnomaster" jdbcType="VARCHAR" /> 10 <result column="WAYBILLNOMASTER" property="waybillnomaster" jdbcType="VARCHAR" />
@@ -310,9 +310,10 @@ @@ -310,9 +310,10 @@
310 UPDATE PREPAREMASTER 310 UPDATE PREPAREMASTER
311 SET RECEIPTINFORMATION= #{receiptinformation,jdbcType=VARCHAR}, 311 SET RECEIPTINFORMATION= #{receiptinformation,jdbcType=VARCHAR},
312 STATUS = #{status,jdbcType=VARCHAR } 312 STATUS = #{status,jdbcType=VARCHAR }
313 - WHERE FLIGHTNO = #{flightno,jdbcType=VARCHAR} 313 + WHERE
  314 + FLIGHTNO = #{flightno,jdbcType=VARCHAR}
314 AND 315 AND
315 - FLIGHTDATE= #{flightDate,jdbcType=TIMESTAMP} 316 + FLIGHTDATE= #{flightdate,jdbcType=DATE }
316 AND 317 AND
317 WAYBILLNOMASTER = #{waybillnomaster,jdbcType=VARCHAR} 318 WAYBILLNOMASTER = #{waybillnomaster,jdbcType=VARCHAR}
318 AND 319 AND
@@ -325,7 +326,7 @@ @@ -325,7 +326,7 @@
325 WHERE 326 WHERE
326 FLIGHTNO= #{flightno,jdbcType=VARCHAR} 327 FLIGHTNO= #{flightno,jdbcType=VARCHAR}
327 AND 328 AND
328 - FLIGHTDATE= #{flightDate,jdbcType=TIMESTAMP} 329 + FLIGHTDATE= #{flightdate,jdbcType=TIMESTAMP}
329 AND 330 AND
330 WAYBILLNOMASTER = #{waybillnomaster,jdbcType=VARCHAR} 331 WAYBILLNOMASTER = #{waybillnomaster,jdbcType=VARCHAR}
331 </select> 332 </select>
@@ -20,7 +20,7 @@ @@ -20,7 +20,7 @@
20 <result column="CREATOR" jdbcType="DECIMAL" property="creator" /> 20 <result column="CREATOR" jdbcType="DECIMAL" property="creator" />
21 <result column="CREATE_DATE" jdbcType="TIMESTAMP" property="createDate" /> 21 <result column="CREATE_DATE" jdbcType="TIMESTAMP" property="createDate" />
22 <result column="FLIGHTNO" jdbcType="VARCHAR" property="flightno" /> 22 <result column="FLIGHTNO" jdbcType="VARCHAR" property="flightno" />
23 - <result column="FLIGHTDATE" jdbcType="TIMESTAMP" property="flightdate" /> 23 + <result column="FLIGHTDATE" jdbcType="DATE" property="flightdate" />
24 <result column="ORIGINATINGSTATION" jdbcType="VARCHAR" property="originatingstation" /> 24 <result column="ORIGINATINGSTATION" jdbcType="VARCHAR" property="originatingstation" />
25 <result column="DESTINATIONSTATION" jdbcType="VARCHAR" property="destinationstation" /> 25 <result column="DESTINATIONSTATION" jdbcType="VARCHAR" property="destinationstation" />
26 <result column="AGENTCOMPANYCODE" jdbcType="VARCHAR" property="agentcompanycode" /> 26 <result column="AGENTCOMPANYCODE" jdbcType="VARCHAR" property="agentcompanycode" />
@@ -968,9 +968,18 @@ @@ -968,9 +968,18 @@
968 968
969 <update id="updateRECEIPTION" parameterType="com.tianbo.analysis.model.PREPARESECONDARY" > 969 <update id="updateRECEIPTION" parameterType="com.tianbo.analysis.model.PREPARESECONDARY" >
970 UPDATE PREPARESECONDARY 970 UPDATE PREPARESECONDARY
971 - SET RECEIPTION= #{receiption,jdbcType=VARCHAR}  
972 - WHERE WAYBILLNOMASTER = #{waybillnomaster,jdbcType=VARCHAR}  
973 - AND WAYBILLNOSECONDARY = #{waybillnosecondary,jdbcType=VARCHAR} 971 + SET RECEIPTINFORMATION= #{receiptinformation,jdbcType=VARCHAR},
  972 + STATUS = #{status,jdbcType=VARCHAR }
  973 + WHERE
  974 + WAYBILLNOMASTER = #{waybillnomaster,jdbcType=VARCHAR}
  975 + AND
  976 + WAYBILLNOSECONDARY = #{waybillnosecondary,jdbcType=VARCHAR}
  977 + AND
  978 + FLIGHTNO = #{flightno,jdbcType=VARCHAR}
  979 + AND
  980 + FLIGHTDATE= #{flightdate,jdbcType=DATE }
  981 + AND
  982 + CARRIER = #{carrier,jdbcType=VARCHAR}
974 </update> 983 </update>
975 984
976 <select id="selectAutoIdByawbAawbH" parameterType="com.tianbo.analysis.model.PREPARESECONDARY" resultType="com.tianbo.analysis.model.PREPARESECONDARY"> 985 <select id="selectAutoIdByawbAawbH" parameterType="com.tianbo.analysis.model.PREPARESECONDARY" resultType="com.tianbo.analysis.model.PREPARESECONDARY">