作者 朱兆平

优化多线程全部业务ok

@@ -132,7 +132,7 @@ jwt: @@ -132,7 +132,7 @@ 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/回执报文样例/20191018
136 #回执解析成功后的备份目录 136 #回执解析成功后的备份目录
137 receptBakDir: /Users/mrz/Downloads/rdp_temp/logs/success 137 receptBakDir: /Users/mrz/Downloads/rdp_temp/logs/success
138 #解析错误报文的备份目录 138 #解析错误报文的备份目录
@@ -247,7 +247,7 @@ public class CustomXmlHandleThread implements Runnable{ @@ -247,7 +247,7 @@ public class CustomXmlHandleThread implements Runnable{
247 i= allocatearrival.masterAnalysisReception(); 247 i= allocatearrival.masterAnalysisReception();
248 break; 248 break;
249 case "MT8205": 249 case "MT8205":
250 - transXmlHandel(document,customReception); 250 + i = transXmlHandel(document,customReception);
251 break; 251 break;
252 default: 252 default:
253 break; 253 break;
@@ -14,8 +14,6 @@ import java.util.List; @@ -14,8 +14,6 @@ import java.util.List;
14 @Slf4j 14 @Slf4j
15 public class ALLOCATEARRIVAL extends WlptBaseModel{ 15 public class ALLOCATEARRIVAL extends WlptBaseModel{
16 16
17 -  
18 -  
19 private String id; 17 private String id;
20 18
21 private Date createdate; 19 private Date createdate;
@@ -176,7 +174,7 @@ public class ALLOCATEARRIVAL extends WlptBaseModel{ @@ -176,7 +174,7 @@ public class ALLOCATEARRIVAL extends WlptBaseModel{
176 String autoId = departuresloading1.getId(); 174 String autoId = departuresloading1.getId();
177 175
178 //插入sendlog记录表 176 //插入sendlog记录表
179 - log.info("即将插入回执日志运单号为:"+waybillno+"->id="+id); 177 + log.info("即将插入回执日志运单号为:"+waybillno+"->id="+autoId);
180 int ii =sendLogService.insertSendlog("MT3202",receiptinformation,autoId); 178 int ii =sendLogService.insertSendlog("MT3202",receiptinformation,autoId);
181 179
182 if (i>0 && ii>0){ 180 if (i>0 && ii>0){
@@ -71,8 +71,7 @@ public class ARRIVEDMASTER extends WlptBaseModel { @@ -71,8 +71,7 @@ public class ARRIVEDMASTER extends WlptBaseModel {
71 } 71 }
72 72
73 public ARRIVEDMASTER(CustomReception customReception) { 73 public ARRIVEDMASTER(CustomReception customReception) {
74 - init();  
75 - this.waybillnomaster = customReception.getWayBillMaster(); 74 + this.waybillnomaster = AWBTools.awbFormat(customReception.getWayBillMaster());
76 75
77 String[] flightInfo = AWBTools.splitFlight(customReception.getFlightNo()); 76 String[] flightInfo = AWBTools.splitFlight(customReception.getFlightNo());
78 this.setFlightno(flightInfo[1]); 77 this.setFlightno(flightInfo[1]);
@@ -297,7 +297,7 @@ public class ARRIVEDSECONDARY extends WlptBaseModel { @@ -297,7 +297,7 @@ public class ARRIVEDSECONDARY extends WlptBaseModel {
297 } 297 }
298 298
299 public ARRIVEDSECONDARY(CustomReception customReception) { 299 public ARRIVEDSECONDARY(CustomReception customReception) {
300 - this.waybillnomaster = customReception.getWayBillMaster(); 300 + this.waybillnomaster = AWBTools.awbFormat(customReception.getWayBillMaster());
301 //取分单号 301 //取分单号
302 String[] awbhArr = customReception.getWayBillSecond().split("_"); 302 String[] awbhArr = customReception.getWayBillSecond().split("_");
303 this.waybillnosecondary = awbhArr[1]; 303 this.waybillnosecondary = awbhArr[1];
@@ -187,7 +187,7 @@ public class DEPARTURESLOADING extends WlptBaseModel { @@ -187,7 +187,7 @@ public class DEPARTURESLOADING extends WlptBaseModel {
187 } 187 }
188 public DEPARTURESLOADING(CustomReception customReception) { 188 public DEPARTURESLOADING(CustomReception customReception) {
189 init(); 189 init();
190 - this.waybillno = customReception.getWayBillMaster(); 190 + this.waybillno = AWBTools.awbFormat(customReception.getWayBillMaster());
191 this.flightno = customReception.getFlightNo(); 191 this.flightno = customReception.getFlightNo();
192 if (!StringUtils.isEmpty(customReception.getFlightDate())) { 192 if (!StringUtils.isEmpty(customReception.getFlightDate())) {
193 this.setFlightdate(DateUtil.formatByyyyyMMdd(customReception.getFlightDate())); 193 this.setFlightdate(DateUtil.formatByyyyyMMdd(customReception.getFlightDate()));
@@ -222,7 +222,7 @@ public class INTERNATIONALTRANSIT extends WlptBaseModel { @@ -222,7 +222,7 @@ public class INTERNATIONALTRANSIT extends WlptBaseModel {
222 this.originalFlightdate = DateUtil.formatByyyyyMMdd(customReception.getImportFlightDate()); 222 this.originalFlightdate = DateUtil.formatByyyyyMMdd(customReception.getImportFlightDate());
223 this.originalBillno = AWBTools.awbFormat(customReception.getImportWaybillMaster()); 223 this.originalBillno = AWBTools.awbFormat(customReception.getImportWaybillMaster());
224 //TODO:碰见分单回执再解析 224 //TODO:碰见分单回执再解析
225 - this.originalSubNumber = originalSubNumber; 225 + this.originalSubNumber = customReception.getWayBillSecond();
226 226
227 this.status = AWBTools.transCusRspCode(customReception.getResponseCode()); 227 this.status = AWBTools.transCusRspCode(customReception.getResponseCode());
228 this.receiption = customReception.getResponseText(); 228 this.receiption = customReception.getResponseText();
@@ -457,7 +457,7 @@ public class ORIGINMANIFESTMASTER extends WlptBaseModel { @@ -457,7 +457,7 @@ public class ORIGINMANIFESTMASTER extends WlptBaseModel {
457 457
458 } 458 }
459 public ORIGINMANIFESTMASTER(CustomReception customReception) { 459 public ORIGINMANIFESTMASTER(CustomReception customReception) {
460 - this.waybillnomaster = customReception.getWayBillMaster(); 460 + this.waybillnomaster = AWBTools.awbFormat(customReception.getWayBillMaster());
461 this.flightno = customReception.getFlightNo(); 461 this.flightno = customReception.getFlightNo();
462 this.receiptinformation = customReception.getResponseText(); 462 this.receiptinformation = customReception.getResponseText();
463 if (!StringUtils.isEmpty(customReception.getFlightDate())) { 463 if (!StringUtils.isEmpty(customReception.getFlightDate())) {
@@ -335,7 +335,7 @@ public class Originmanifestsecondary extends WlptBaseModel { @@ -335,7 +335,7 @@ public class Originmanifestsecondary extends WlptBaseModel {
335 335
336 } 336 }
337 public Originmanifestsecondary(CustomReception customReception) { 337 public Originmanifestsecondary(CustomReception customReception) {
338 - this.waybillnomaster = customReception.getWayBillMaster(); 338 + this.waybillnomaster = AWBTools.awbFormat(customReception.getWayBillMaster());
339 this.waybillnosecondary = customReception.getWayBillSecond().split("_")[1]; 339 this.waybillnosecondary = customReception.getWayBillSecond().split("_")[1];
340 this.status = AWBTools.transCusRspCode(customReception.getResponseCode()); 340 this.status = AWBTools.transCusRspCode(customReception.getResponseCode());
341 this.receiption = customReception.getResponseText(); 341 this.receiption = customReception.getResponseText();
@@ -403,7 +403,7 @@ public class PREPAREMASTER extends WlptBaseModel { @@ -403,7 +403,7 @@ public class PREPAREMASTER extends WlptBaseModel {
403 if (!StringUtils.isEmpty(customReception.getFlightDate())) { 403 if (!StringUtils.isEmpty(customReception.getFlightDate())) {
404 this.flightdate=DateUtil.formatByyyyyMMdd(customReception.getFlightDate()); 404 this.flightdate=DateUtil.formatByyyyyMMdd(customReception.getFlightDate());
405 } 405 }
406 - this.waybillnomaster = customReception.getWayBillMaster(); 406 + this.waybillnomaster = AWBTools.awbFormat(customReception.getWayBillMaster());
407 this.status = AWBTools.transCusRspCode(customReception.getResponseCode()); 407 this.status = AWBTools.transCusRspCode(customReception.getResponseCode());
408 this.receiptinformation = customReception.getResponseText(); 408 this.receiptinformation = customReception.getResponseText();
409 } 409 }
@@ -811,7 +811,7 @@ public class PREPARESECONDARY extends WlptBaseModel { @@ -811,7 +811,7 @@ public class PREPARESECONDARY extends WlptBaseModel {
811 String[] flightInfo = AWBTools.splitFlight(customReception.getFlightNo()); 811 String[] flightInfo = AWBTools.splitFlight(customReception.getFlightNo());
812 this.setFlightno(flightInfo[1]); 812 this.setFlightno(flightInfo[1]);
813 this.setCarrier(flightInfo[0]); 813 this.setCarrier(flightInfo[0]);
814 - this.waybillnomaster = customReception.getWayBillMaster(); 814 + this.waybillnomaster = AWBTools.awbFormat(customReception.getWayBillMaster());
815 this.waybillnosecondary = customReception.getWayBillSecond().split("_")[1]; 815 this.waybillnosecondary = customReception.getWayBillSecond().split("_")[1];
816 if (!StringUtils.isEmpty(customReception.getFlightDate())) { 816 if (!StringUtils.isEmpty(customReception.getFlightDate())) {
817 this.flightdate= DateUtil.formatByyyyyMMdd(customReception.getFlightDate()); 817 this.flightdate= DateUtil.formatByyyyyMMdd(customReception.getFlightDate());
@@ -319,7 +319,7 @@ public class TALLYMASTER extends WlptBaseModel { @@ -319,7 +319,7 @@ public class TALLYMASTER extends WlptBaseModel {
319 } 319 }
320 public TALLYMASTER(CustomReception customReception) { 320 public TALLYMASTER(CustomReception customReception) {
321 this.customReceptionT=customReception; 321 this.customReceptionT=customReception;
322 - this.waybillnomaster = customReception.getWayBillMaster(); 322 + this.waybillnomaster = AWBTools.awbFormat(customReception.getWayBillMaster());
323 this.flightno = customReception.getFlightNo(); 323 this.flightno = customReception.getFlightNo();
324 if (!StringUtils.isEmpty(customReception.getFlightDate())) { 324 if (!StringUtils.isEmpty(customReception.getFlightDate())) {
325 this.flightdate= DateUtil.formatByyyyyMMdd(customReception.getFlightDate()); 325 this.flightdate= DateUtil.formatByyyyyMMdd(customReception.getFlightDate());
@@ -207,7 +207,7 @@ public class TALLYSECONDARY extends WlptBaseModel { @@ -207,7 +207,7 @@ public class TALLYSECONDARY extends WlptBaseModel {
207 } 207 }
208 public TALLYSECONDARY(CustomReception customReception) { 208 public TALLYSECONDARY(CustomReception customReception) {
209 this.customReceptionT = customReception; 209 this.customReceptionT = customReception;
210 - this.waybillnomaster = customReception.getWayBillMaster(); 210 + this.waybillnomaster = AWBTools.awbFormat(customReception.getWayBillMaster());
211 this.waybillnosecondary = customReception.getWayBillSecond().split("_")[1]; 211 this.waybillnosecondary = customReception.getWayBillSecond().split("_")[1];
212 this.status = AWBTools.transCusRspCode(customReception.getResponseCode()); 212 this.status = AWBTools.transCusRspCode(customReception.getResponseCode());
213 this.receiptinformation = customReception.getResponseText(); 213 this.receiptinformation = customReception.getResponseText();
@@ -51,16 +51,16 @@ public class TaskAnalysis { @@ -51,16 +51,16 @@ public class TaskAnalysis {
51 File fileDirectory = new File(readDir); 51 File fileDirectory = new File(readDir);
52 List<File> files = FileTool.readDirectoryFiles(fileDirectory); 52 List<File> files = FileTool.readDirectoryFiles(fileDirectory);
53 //文件数量大于50个,每次只解析前50个 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++){ 54 + if (files!=null && !files.isEmpty() && files.size()>10){
  55 + CountDownLatch latch = new CountDownLatch(10);
  56 + log.trace("解析任务开始{},文件数量:{}",startTime,10);
  57 + for (int i=0;i<10;i++){
58 threadJbob(files.get(i),latch,transToCfps,threadPool); 58 threadJbob(files.get(i),latch,transToCfps,threadPool);
59 } 59 }
60 latch.await(); 60 latch.await();
61 } 61 }
62 //文件数量小于50个,全部一次解析完 62 //文件数量小于50个,全部一次解析完
63 - if (files!=null && !files.isEmpty() && files.size()<50){ 63 + if (files!=null && !files.isEmpty() && files.size()<10){
64 CountDownLatch latch = new CountDownLatch(files.size()); 64 CountDownLatch latch = new CountDownLatch(files.size());
65 log.info("解析任务开始{},文件数量:{}",startTime,files.size()); 65 log.info("解析任务开始{},文件数量:{}",startTime,files.size());
66 for (int i=0;i<files.size();i++){ 66 for (int i=0;i<files.size();i++){
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 <result column="WAYBILLNO" property="waybillno" jdbcType="VARCHAR" /> 7 <result column="WAYBILLNO" property="waybillno" jdbcType="VARCHAR" />
8 <result column="CARRIER" property="carrier" jdbcType="VARCHAR" /> 8 <result column="CARRIER" property="carrier" jdbcType="VARCHAR" />
9 <result column="FLIGHTNO" property="flightno" jdbcType="VARCHAR" /> 9 <result column="FLIGHTNO" property="flightno" jdbcType="VARCHAR" />
10 - <result column="FLIGHTDATE" property="flightdate" jdbcType="TIMESTAMP" /> 10 + <result column="FLIGHTDATE" property="flightdate" jdbcType="DATE" />
11 <result column="CUSTOMOS" property="customos" jdbcType="VARCHAR" /> 11 <result column="CUSTOMOS" property="customos" jdbcType="VARCHAR" />
12 <result column="TALLYPIECES" property="tallypieces" jdbcType="VARCHAR" /> 12 <result column="TALLYPIECES" property="tallypieces" jdbcType="VARCHAR" />
13 <result column="TALLYWEIGHT" property="tallyweight" jdbcType="VARCHAR" /> 13 <result column="TALLYWEIGHT" property="tallyweight" jdbcType="VARCHAR" />
@@ -140,7 +140,7 @@ @@ -140,7 +140,7 @@
140 AND 140 AND
141 FLIGHTNO = #{flightno,jdbcType=VARCHAR} 141 FLIGHTNO = #{flightno,jdbcType=VARCHAR}
142 AND 142 AND
143 - FLIGHTDATE= #{flightDate,jdbcType=TIMESTAMP} 143 + FLIGHTDATE= #{flightdate,jdbcType=DATE }
144 AND 144 AND
145 WAYBILLNO = #{waybillno,jdbcType=VARCHAR} 145 WAYBILLNO = #{waybillno,jdbcType=VARCHAR}
146 </update> 146 </update>
@@ -151,7 +151,7 @@ @@ -151,7 +151,7 @@
151 WHERE 151 WHERE
152 FLIGHTNO= #{flightno,jdbcType=VARCHAR} 152 FLIGHTNO= #{flightno,jdbcType=VARCHAR}
153 AND 153 AND
154 - FLIGHTDATE= #{flightDate,jdbcType=TIMESTAMP} 154 + FLIGHTDATE= #{flightdate,jdbcType=DATE}
155 AND 155 AND
156 WAYBILLNO = #{waybillno,jdbcType=VARCHAR} 156 WAYBILLNO = #{waybillno,jdbcType=VARCHAR}
157 </select> 157 </select>