作者 朱兆平

优化多线程全部业务ok

  1 +package com.tianbo.analysis.bean;
  2 +
  3 +import com.tianbo.analysis.dao.*;
  4 +import com.tianbo.analysis.service.SendLogService;
  5 +import org.springframework.beans.factory.annotation.Autowired;
  6 +import org.springframework.stereotype.Component;
  7 +
  8 +@Component
  9 +public class WlptBaseModel {
  10 +
  11 +
  12 + @Autowired
  13 + public ALLOCATEARRIVALMapper allocatearrivalMapper;
  14 +
  15 + @Autowired
  16 + public SendLogService sendLogService;
  17 +
  18 + @Autowired
  19 + public ARRIVEDMASTERMapper arrivedmasterMapper;
  20 +
  21 + @Autowired
  22 + public ARRIVEDSECONDARYMapper arrivedsecondaryMapper;
  23 +
  24 + @Autowired
  25 + public DEPARTURESLOADINGMapper departuresloadingMapper;
  26 +
  27 + @Autowired
  28 + public INPORTALLOCATEMapper inportallocateMapper;
  29 +
  30 + @Autowired
  31 + public INTERNATIONALTRANSITMapper internationaltransitMapper;
  32 +
  33 + @Autowired
  34 + public ORIGINMANIFESTMASTERMapper originmanifestmasterMapper;
  35 +
  36 + @Autowired
  37 + public OriginmanifestsecondaryMapper originmanifestsecondaryMapper;
  38 +
  39 + @Autowired
  40 + public PREPAREMASTERMapper preparemasterMapper;
  41 +
  42 + @Autowired
  43 + public PREPARESECONDARYMapper preparesecondaryMapper;
  44 +
  45 + @Autowired
  46 + public TALLYMASTERMapper tallymasterMapper;
  47 +
  48 + @Autowired
  49 + public TALLYSECONDARYMapper tallysecondaryMapper;
  50 +
  51 + public WlptBaseModel() {
  52 + //处理多线程时 springboot 无法注入bean的问题
  53 + if (allocatearrivalMapper==null){
  54 + allocatearrivalMapper = SpringBeanUtitl.getBean(ALLOCATEARRIVALMapper.class);
  55 + }
  56 + if (sendLogService==null){
  57 + sendLogService = SpringBeanUtitl.getBean(SendLogService.class);
  58 + }
  59 + if (arrivedmasterMapper==null){
  60 + arrivedmasterMapper = SpringBeanUtitl.getBean(ARRIVEDMASTERMapper.class);
  61 + }
  62 + if (arrivedsecondaryMapper==null){
  63 + arrivedsecondaryMapper= SpringBeanUtitl.getBean(ARRIVEDSECONDARYMapper.class);
  64 + }
  65 + if(departuresloadingMapper==null){
  66 + departuresloadingMapper = SpringBeanUtitl.getBean(DEPARTURESLOADINGMapper.class);
  67 + }
  68 + if(inportallocateMapper==null){
  69 + inportallocateMapper = SpringBeanUtitl.getBean(INPORTALLOCATEMapper.class);
  70 + }
  71 + if(internationaltransitMapper==null){
  72 + internationaltransitMapper = SpringBeanUtitl.getBean(INTERNATIONALTRANSITMapper.class);
  73 + }
  74 + if(originmanifestmasterMapper==null){
  75 + originmanifestmasterMapper = SpringBeanUtitl.getBean(ORIGINMANIFESTMASTERMapper.class);
  76 + }
  77 + if(originmanifestsecondaryMapper==null){
  78 + originmanifestsecondaryMapper = SpringBeanUtitl.getBean(OriginmanifestsecondaryMapper.class);
  79 + }
  80 + if(preparemasterMapper==null){
  81 + preparemasterMapper = SpringBeanUtitl.getBean(PREPAREMASTERMapper.class);
  82 + }
  83 + if(preparesecondaryMapper==null){
  84 + preparesecondaryMapper = SpringBeanUtitl.getBean(PREPARESECONDARYMapper.class);
  85 + }
  86 + if(tallymasterMapper==null){
  87 + tallymasterMapper = SpringBeanUtitl.getBean(TALLYMASTERMapper.class);
  88 + }
  89 + if(tallysecondaryMapper==null){
  90 + tallysecondaryMapper = SpringBeanUtitl.getBean(TALLYSECONDARYMapper.class);
  91 + }
  92 + }
  93 +
  94 + public static void init(){
  95 +
  96 + }
  97 +
  98 + public int masterAnalysisReception(){
  99 + return 0;
  100 + }
  101 +
  102 + public int secondAnalysisReception(){
  103 + return 0;
  104 + }
  105 +}
1 package com.tianbo.analysis.handle; 1 package com.tianbo.analysis.handle;
2 2
3 -import com.tianbo.analysis.model.ALLOCATEARRIVAL;  
4 -import com.tianbo.analysis.model.CustomReception;  
5 -import com.tianbo.analysis.service.*;  
6 -import com.tianbo.analysis.service.imp.*; 3 +import com.tianbo.analysis.model.*;
7 import com.tianbo.analysis.tools.AWBTools; 4 import com.tianbo.analysis.tools.AWBTools;
8 import com.tianbo.util.Date.DateUtil; 5 import com.tianbo.util.Date.DateUtil;
9 import com.tianbo.util.XML.XMLXPath; 6 import com.tianbo.util.XML.XMLXPath;
@@ -16,9 +13,7 @@ import org.dom4j.Document; @@ -16,9 +13,7 @@ import org.dom4j.Document;
16 import org.dom4j.DocumentException; 13 import org.dom4j.DocumentException;
17 import org.dom4j.Element; 14 import org.dom4j.Element;
18 import org.dom4j.io.SAXReader; 15 import org.dom4j.io.SAXReader;
19 -import org.springframework.beans.factory.annotation.Autowired;  
20 import org.springframework.beans.factory.annotation.Value; 16 import org.springframework.beans.factory.annotation.Value;
21 -import org.springframework.context.annotation.Scope;  
22 import org.springframework.stereotype.Component; 17 import org.springframework.stereotype.Component;
23 import org.xml.sax.SAXParseException; 18 import org.xml.sax.SAXParseException;
24 19
@@ -129,10 +124,10 @@ public class CustomXmlHandleThread implements Runnable{ @@ -129,10 +124,10 @@ public class CustomXmlHandleThread implements Runnable{
129 * @throws SAXParseException 124 * @throws SAXParseException
130 * @throws FileNotFoundException 125 * @throws FileNotFoundException
131 */ 126 */
132 - public int handelXmlDocument() throws DocumentException,UnsupportedEncodingException,SAXParseException,FileNotFoundException { 127 + private int handelXmlDocument() throws DocumentException,UnsupportedEncodingException,SAXParseException,FileNotFoundException {
133 128
134 int i = 0; 129 int i = 0;
135 - 130 + String secondSplit = "_";
136 SAXReader saxReader = new SAXReader(); 131 SAXReader saxReader = new SAXReader();
137 Document document = saxReader.read(xmlfile); 132 Document document = saxReader.read(xmlfile);
138 Element contentRoot = document.getRootElement(); 133 Element contentRoot = document.getRootElement();
@@ -183,32 +178,73 @@ public class CustomXmlHandleThread implements Runnable{ @@ -183,32 +178,73 @@ public class CustomXmlHandleThread implements Runnable{
183 functionCode); 178 functionCode);
184 switch (msgType){ 179 switch (msgType){
185 case "MT9999": 180 case "MT9999":
186 - i = customXmlHandle.coustomAnalysisService.insertRecept(customReception); 181 + ORIGINMANIFESTMASTER originmanifestmaster = new ORIGINMANIFESTMASTER(customReception);
  182 + PREPAREMASTER preparemaster= new PREPAREMASTER(customReception);
  183 + ARRIVEDMASTER arrivedmaster9999 = new ARRIVEDMASTER(customReception);
  184 + if(originmanifestmaster.masterAnalysisReception()>0){
  185 + i=1;
  186 + }else if(preparemaster.masterAnalysisReception()>0){
  187 + i=1;
  188 + }else {
  189 + i=arrivedmaster9999.masterAnalysisReception();
  190 + }
187 break; 191 break;
188 case "MT3201": 192 case "MT3201":
189 - i= customXmlHandle.arrivedmasterService.insertRecept(customReception); 193 + if (customReception.getWayBillSecond()!=null && secondSplit.contains(customReception.getWayBillSecond())){
  194 + ARRIVEDSECONDARY arrivedsecondary = new ARRIVEDSECONDARY(customReception);
  195 + i=arrivedsecondary.secondAnalysisReception();
  196 + }else {
  197 + ARRIVEDMASTER arrivedmaster = new ARRIVEDMASTER(customReception);
  198 + i=arrivedmaster.masterAnalysisReception();
  199 + }
190 break; 200 break;
191 case "MT5202": 201 case "MT5202":
192 - i = customXmlHandle.tallymasterService.insertRecept(customReception); 202 + if (customReception.getWayBillSecond()!=null && secondSplit.contains(customReception.getWayBillSecond())){
  203 + TALLYSECONDARY tallysecondary = new TALLYSECONDARY(customReception);
  204 + i=tallysecondary.secondAnalysisReception();
  205 + }else {
  206 + TALLYMASTER tallymaster= new TALLYMASTER(customReception);
  207 + i = tallymaster.masterAnalysisReception();
  208 + }
193 break; 209 break;
194 case "MT5201": 210 case "MT5201":
195 - i = customXmlHandle.tallymasterService.insertRecept(customReception); 211 + if (customReception.getWayBillSecond()!=null && secondSplit.contains(customReception.getWayBillSecond())){
  212 + TALLYSECONDARY tallysecondary = new TALLYSECONDARY(customReception);
  213 + i=tallysecondary.secondAnalysisReception();
  214 + }else {
  215 + TALLYMASTER tallymaster= new TALLYMASTER(customReception);
  216 + i = tallymaster.masterAnalysisReception();
  217 + }
196 break; 218 break;
197 case "MT4201": 219 case "MT4201":
198 - i = customXmlHandle.departuresloadingService.insertRecept(customReception); 220 + DEPARTURESLOADING departuresloading = new DEPARTURESLOADING(customReception);
  221 + i=departuresloading.masterAnalysisReception();
199 break; 222 break;
200 case "MT1201": 223 case "MT1201":
201 - i = customXmlHandle.coustomAnalysisService.insertRecept(customReception); 224 + if (customReception.getWayBillSecond()!=null && secondSplit.contains(customReception.getWayBillSecond())){
  225 + Originmanifestsecondary originmanifestsecondary = new Originmanifestsecondary(customReception);
  226 + originmanifestsecondary.secondAnalysisReception();
  227 + }else {
  228 + ORIGINMANIFESTMASTER originmanifestmaster1201 = new ORIGINMANIFESTMASTER(customReception);
  229 + i = originmanifestmaster1201.masterAnalysisReception();
  230 + }
202 break; 231 break;
203 case "MT2201": 232 case "MT2201":
204 - i = customXmlHandle.preparemasterService.insertRecept(customReception); 233 + if (customReception.getWayBillSecond()!=null && secondSplit.contains(customReception.getWayBillSecond())){
  234 + PREPARESECONDARY preparesecondary = new PREPARESECONDARY(customReception);
  235 + i = preparesecondary.secondAnalysisReception();
  236 + }else {
  237 + PREPAREMASTER preparemaster1201= new PREPAREMASTER(customReception);
  238 + i = preparemaster1201.masterAnalysisReception();
  239 + }
205 break; 240 break;
206 case "MT6202": 241 case "MT6202":
207 - i = customXmlHandle.inportallocateService.insertRecept(customReception); 242 + INPORTALLOCATE inportallocate = new INPORTALLOCATE(customReception);
  243 + i = inportallocate.masterAnalysisReception();
208 break; 244 break;
209 case "MT3202": 245 case "MT3202":
210 ALLOCATEARRIVAL allocatearrival = new ALLOCATEARRIVAL(customReception); 246 ALLOCATEARRIVAL allocatearrival = new ALLOCATEARRIVAL(customReception);
211 - i= allocatearrival.analysisReception(); 247 + i= allocatearrival.masterAnalysisReception();
212 break; 248 break;
213 case "MT8205": 249 case "MT8205":
214 transXmlHandel(document,customReception); 250 transXmlHandel(document,customReception);
@@ -223,7 +259,7 @@ public class CustomXmlHandleThread implements Runnable{ @@ -223,7 +259,7 @@ public class CustomXmlHandleThread implements Runnable{
223 } 259 }
224 260
225 /** 261 /**
226 - * 国际转运回执处理 262 + * 国际转运回执处理,特殊业务
227 * @param document 263 * @param document
228 * @param customReception 264 * @param customReception
229 * @return 265 * @return
@@ -254,13 +290,15 @@ public class CustomXmlHandleThread implements Runnable{ @@ -254,13 +290,15 @@ public class CustomXmlHandleThread implements Runnable{
254 customReception.getReceiverID(), 290 customReception.getReceiverID(),
255 customReception.getVersion(), 291 customReception.getVersion(),
256 customReception.getFunctionCode()); 292 customReception.getFunctionCode());
257 - int i=customXmlHandle.internationaltransitService.insertRecept(transCustomReception); 293 + INTERNATIONALTRANSIT internationaltransit = new INTERNATIONALTRANSIT(transCustomReception);
  294 +
  295 + int i=internationaltransit.masterAnalysisReception();
258 296
259 return i; 297 return i;
260 298
261 } 299 }
262 300
263 - public void errBak(File file){ 301 + private void errBak(File file){
264 try { 302 try {
265 String today = DateUtil.getTodayBy_yyyyMMdd(); 303 String today = DateUtil.getTodayBy_yyyyMMdd();
266 String errDirByDay = customXmlHandle.errBakDir + "/" + today; 304 String errDirByDay = customXmlHandle.errBakDir + "/" + today;
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; 3 +import com.tianbo.analysis.bean.WlptBaseModel;
7 import com.tianbo.analysis.tools.AWBTools; 4 import com.tianbo.analysis.tools.AWBTools;
8 import com.tianbo.util.Date.DateUtil; 5 import com.tianbo.util.Date.DateUtil;
9 import lombok.Data; 6 import lombok.Data;
@@ -13,13 +10,11 @@ import org.apache.commons.lang.StringUtils; @@ -13,13 +10,11 @@ import org.apache.commons.lang.StringUtils;
13 import java.util.Date; 10 import java.util.Date;
14 import java.util.List; 11 import java.util.List;
15 12
16 -@Slf4j  
17 @Data 13 @Data
18 -public class ALLOCATEARRIVAL { 14 +@Slf4j
  15 +public class ALLOCATEARRIVAL extends WlptBaseModel{
19 16
20 - private ALLOCATEARRIVALMapper allocatearrivalMapper;  
21 17
22 - private SendLogService sendLogService;  
23 18
24 private String id; 19 private String id;
25 20
@@ -47,14 +42,13 @@ public class ALLOCATEARRIVAL { @@ -47,14 +42,13 @@ public class ALLOCATEARRIVAL {
47 42
48 private String receiptinformation; 43 private String receiptinformation;
49 44
50 - private CustomReception customReception; 45 +
51 46
52 public ALLOCATEARRIVAL(){ 47 public ALLOCATEARRIVAL(){
53 48
54 } 49 }
55 50
56 public ALLOCATEARRIVAL(CustomReception customReception){ 51 public ALLOCATEARRIVAL(CustomReception customReception){
57 - this.customReception = customReception;  
58 this.waybillno = customReception.getWayBillMaster(); 52 this.waybillno = customReception.getWayBillMaster();
59 this.receiptinformation = customReception.getResponseText(); 53 this.receiptinformation = customReception.getResponseText();
60 this.status = AWBTools.transCusRspCode(customReception.getResponseCode()); 54 this.status = AWBTools.transCusRspCode(customReception.getResponseCode());
@@ -65,13 +59,6 @@ public class ALLOCATEARRIVAL { @@ -65,13 +59,6 @@ public class ALLOCATEARRIVAL {
65 this.setFlightdate(DateUtil.formatByyyyyMMdd(customReception.getFlightDate())); 59 this.setFlightdate(DateUtil.formatByyyyyMMdd(customReception.getFlightDate()));
66 } 60 }
67 61
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 } 62 }
76 63
77 public String getId() { 64 public String getId() {
@@ -178,7 +165,8 @@ public class ALLOCATEARRIVAL { @@ -178,7 +165,8 @@ public class ALLOCATEARRIVAL {
178 this.receiptinformation = receiptinformation == null ? null : receiptinformation.trim(); 165 this.receiptinformation = receiptinformation == null ? null : receiptinformation.trim();
179 } 166 }
180 167
181 - public int analysisReception(){ 168 + @Override
  169 + public int masterAnalysisReception(){
182 170
183 int i= allocatearrivalMapper.updateRECEIPTION(this); 171 int i= allocatearrivalMapper.updateRECEIPTION(this);
184 //获取主单autoid 172 //获取主单autoid
@@ -188,10 +176,11 @@ public class ALLOCATEARRIVAL { @@ -188,10 +176,11 @@ public class ALLOCATEARRIVAL {
188 String autoId = departuresloading1.getId(); 176 String autoId = departuresloading1.getId();
189 177
190 //插入sendlog记录表 178 //插入sendlog记录表
191 - log.info("即将插入日志运单号为:"+waybillno+"->id="+id); 179 + log.info("即将插入回执日志运单号为:"+waybillno+"->id="+id);
192 int ii =sendLogService.insertSendlog("MT3202",receiptinformation,autoId); 180 int ii =sendLogService.insertSendlog("MT3202",receiptinformation,autoId);
193 181
194 if (i>0 && ii>0){ 182 if (i>0 && ii>0){
  183 + log.info("运单号 {} 分拨运抵回执更新成功",waybillno);
195 return 1; 184 return 1;
196 } 185 }
197 } 186 }
1 package com.tianbo.analysis.model; 1 package com.tianbo.analysis.model;
2 2
  3 +import com.tianbo.analysis.bean.WlptBaseModel;
  4 +import com.tianbo.analysis.tools.AWBTools;
  5 +import com.tianbo.util.Date.DateUtil;
3 import lombok.Data; 6 import lombok.Data;
  7 +import lombok.extern.slf4j.Slf4j;
  8 +import org.apache.commons.lang.StringUtils;
4 9
5 import java.util.Date; 10 import java.util.Date;
  11 +import java.util.List;
6 12
7 @Data 13 @Data
8 -public class ARRIVEDMASTER { 14 +@Slf4j
  15 +public class ARRIVEDMASTER extends WlptBaseModel {
  16 +
9 private String autoid; 17 private String autoid;
10 18
11 private String waybillnomaster; 19 private String waybillnomaster;
@@ -57,4 +65,46 @@ public class ARRIVEDMASTER { @@ -57,4 +65,46 @@ public class ARRIVEDMASTER {
57 private String receiptinformation; 65 private String receiptinformation;
58 66
59 private Date createdate; 67 private Date createdate;
  68 +
  69 + public ARRIVEDMASTER() {
  70 +
  71 + }
  72 +
  73 + public ARRIVEDMASTER(CustomReception customReception) {
  74 + init();
  75 + this.waybillnomaster = customReception.getWayBillMaster();
  76 +
  77 + String[] flightInfo = AWBTools.splitFlight(customReception.getFlightNo());
  78 + this.setFlightno(flightInfo[1]);
  79 + this.setCarrier(flightInfo[0]);
  80 + if (!StringUtils.isEmpty(customReception.getFlightDate())) {
  81 + this.setFlightDate(DateUtil.formatByyyyyMMdd(customReception.getFlightDate()));
  82 + }
  83 +
  84 + this.status = AWBTools.transCusRspCode(customReception.getResponseCode());
  85 + this.receiptinformation = customReception.getResponseText();
  86 + }
  87 +
  88 + @Override
  89 + public int masterAnalysisReception() {
  90 + //更新主单回执
  91 + int i = arrivedmasterMapper.updateRECEIPTION(this);
  92 + //获取分单autoid
  93 + List<ARRIVEDMASTER> arrivedmasterList = arrivedmasterMapper.selectAutoIdByAwb(this);
  94 + if(!arrivedmasterList.isEmpty()){
  95 + ARRIVEDMASTER originMaster = arrivedmasterList.get(0);
  96 + String autoId = originMaster.getAutoid();
  97 +
  98 + //插入sendlog记录表
  99 + log.info("即将插入回执日志运单号为:"+waybillnomaster+"->autoid="+autoId);
  100 + int ii =sendLogService.insertSendlog("MT3201",receiptinformation,autoId);
  101 +
  102 +
  103 + if (i>0 && ii>0){
  104 + log.info("运单号 {} 运抵回执更新成功",waybillnomaster);
  105 + return 1;
  106 + }
  107 + }
  108 + return 0;
  109 + }
60 } 110 }
1 package com.tianbo.analysis.model; 1 package com.tianbo.analysis.model;
2 2
  3 +import com.tianbo.analysis.bean.WlptBaseModel;
  4 +import com.tianbo.analysis.tools.AWBTools;
  5 +import com.tianbo.util.Date.DateUtil;
  6 +import lombok.Data;
  7 +import lombok.extern.slf4j.Slf4j;
  8 +import org.apache.commons.lang.StringUtils;
  9 +
3 import java.util.Date; 10 import java.util.Date;
  11 +import java.util.List;
4 12
5 -public class ARRIVEDSECONDARY { 13 +@Data
  14 +@Slf4j
  15 +public class ARRIVEDSECONDARY extends WlptBaseModel {
6 private String autoid; 16 private String autoid;
7 17
8 private String waybillnomaster; 18 private String waybillnomaster;
@@ -282,4 +292,50 @@ public class ARRIVEDSECONDARY { @@ -282,4 +292,50 @@ public class ARRIVEDSECONDARY {
282 public void setStatus(String status) { 292 public void setStatus(String status) {
283 this.status = status == null ? null : status.trim(); 293 this.status = status == null ? null : status.trim();
284 } 294 }
  295 +
  296 + public ARRIVEDSECONDARY() {
  297 + }
  298 +
  299 + public ARRIVEDSECONDARY(CustomReception customReception) {
  300 + this.waybillnomaster = customReception.getWayBillMaster();
  301 + //取分单号
  302 + String[] awbhArr = customReception.getWayBillSecond().split("_");
  303 + this.waybillnosecondary = awbhArr[1];
  304 + String[] flightInfo = AWBTools.splitFlight(customReception.getFlightNo());
  305 + this.setFlightno(flightInfo[1]);
  306 + this.setCarrier(flightInfo[0]);
  307 + if (!StringUtils.isEmpty(customReception.getFlightDate())) {
  308 + this.setFlightdate(DateUtil.formatByyyyyMMdd(customReception.getFlightDate()));
  309 + }
  310 + this.receiption = customReception.getResponseText();
  311 + this.status = AWBTools.transCusRspCode(customReception.getResponseCode());
  312 + }
  313 +
  314 + @Override
  315 + public int secondAnalysisReception() {
  316 + //更新分单回执
  317 + int i = arrivedsecondaryMapper.updateRECEIPTION(this);
  318 + //获取分单autoid
  319 + List<ARRIVEDSECONDARY> arrivedsecondaryList = arrivedsecondaryMapper.selectAutoIdByawbAawbH(this);
  320 + if(!arrivedsecondaryList.isEmpty()){
  321 + ARRIVEDSECONDARY arrivedSecond = arrivedsecondaryList.get(0);
  322 + String autoId = arrivedSecond.getAutoid();
  323 + //插入sendlog记录表
  324 + log.info("即将插入回执日志运单号为:{}{},->autoid={}",waybillnomaster,waybillnosecondary,autoId);
  325 + int ii = sendLogService.insertSendlog("MT3201",receiption,autoId);
  326 +
  327 + //todo:同时更新发送日志表的回执信息
  328 +
  329 +
  330 + if (i>0 && ii>0 ){
  331 + log.info("运单号 {} 运抵分单回执更新成功",waybillnosecondary);
  332 + return 1;
  333 + }
  334 + }else {
  335 + //todo:如果都没适配到的话,要从发送日志表里面通过回执中的messageid 找到发送信息,适配回执
  336 + }
  337 + return 0;
  338 +
  339 +
  340 + }
285 } 341 }
1 package com.tianbo.analysis.model; 1 package com.tianbo.analysis.model;
2 2
3 -import java.util.Date; 3 +import com.tianbo.analysis.bean.WlptBaseModel;
  4 +import com.tianbo.analysis.tools.AWBTools;
  5 +import com.tianbo.util.Date.DateUtil;
  6 +import lombok.Data;
  7 +import lombok.extern.slf4j.Slf4j;
  8 +import org.apache.commons.lang.StringUtils;
4 9
5 -public class DEPARTURESLOADING { 10 +import java.util.Date;
  11 +import java.util.List;
  12 +@Data
  13 +@Slf4j
  14 +public class DEPARTURESLOADING extends WlptBaseModel {
6 private String id; 15 private String id;
7 16
8 private Date createdate; 17 private Date createdate;
@@ -172,4 +181,37 @@ public class DEPARTURESLOADING { @@ -172,4 +181,37 @@ public class DEPARTURESLOADING {
172 public void setStatus(String status) { 181 public void setStatus(String status) {
173 this.status = status == null ? null : status.trim(); 182 this.status = status == null ? null : status.trim();
174 } 183 }
  184 +
  185 + public DEPARTURESLOADING() {
  186 +
  187 + }
  188 + public DEPARTURESLOADING(CustomReception customReception) {
  189 + init();
  190 + this.waybillno = customReception.getWayBillMaster();
  191 + this.flightno = customReception.getFlightNo();
  192 + if (!StringUtils.isEmpty(customReception.getFlightDate())) {
  193 + this.setFlightdate(DateUtil.formatByyyyyMMdd(customReception.getFlightDate()));
  194 + }
  195 + this.receiption = customReception.getResponseText();
  196 + this.status = AWBTools.transCusRspCode(customReception.getResponseCode());
  197 + }
  198 +
  199 + @Override
  200 + public int masterAnalysisReception() {
  201 + int i = departuresloadingMapper.updateRECEIPTION(this);
  202 + List<DEPARTURESLOADING> list = departuresloadingMapper.selectAutoIdByAwb(this);
  203 + if(!list.isEmpty()){
  204 + DEPARTURESLOADING departuresloading1 = list.get(0);
  205 + String autoId = departuresloading1.getId();
  206 + //插入sendlog记录表
  207 + log.info("即将插入回执日志运单号为:"+waybillno+"->autoid="+autoId);
  208 + int ii =sendLogService.insertSendlog("MT4201",receiption,autoId);
  209 +
  210 + if (i>0 && ii>0){
  211 + log.info("运单号 {} 装载回执更新成功",waybillno);
  212 + return 1;
  213 + }
  214 + }
  215 + return 0;
  216 + }
175 } 217 }
1 package com.tianbo.analysis.model; 1 package com.tianbo.analysis.model;
2 2
  3 +import com.tianbo.analysis.bean.WlptBaseModel;
  4 +import com.tianbo.analysis.tools.AWBTools;
  5 +import com.tianbo.util.Date.DateUtil;
  6 +import lombok.Data;
  7 +import lombok.extern.slf4j.Slf4j;
  8 +import org.apache.commons.lang.StringUtils;
  9 +
3 import java.util.Date; 10 import java.util.Date;
  11 +import java.util.List;
4 12
5 -public class INPORTALLOCATE { 13 +@Data
  14 +@Slf4j
  15 +public class INPORTALLOCATE extends WlptBaseModel {
6 private String id; 16 private String id;
7 17
8 private Date createdate; 18 private Date createdate;
@@ -152,4 +162,39 @@ public class INPORTALLOCATE { @@ -152,4 +162,39 @@ public class INPORTALLOCATE {
152 public void setReceiptinformation(String receiptinformation) { 162 public void setReceiptinformation(String receiptinformation) {
153 this.receiptinformation = receiptinformation == null ? null : receiptinformation.trim(); 163 this.receiptinformation = receiptinformation == null ? null : receiptinformation.trim();
154 } 164 }
  165 +
  166 + public INPORTALLOCATE() {
  167 + }
  168 + public INPORTALLOCATE(CustomReception customReception) {
  169 + this.waybillno = customReception.getWayBillMaster();
  170 + String[] flightInfo = AWBTools.splitFlight(customReception.getFlightNo());
  171 + this.setFlightno(flightInfo[1]);
  172 + this.setCarrier(flightInfo[0]);
  173 + if (!StringUtils.isEmpty(customReception.getFlightDate())) {
  174 + this.setFlightdate(DateUtil.formatByyyyyMMdd(customReception.getFlightDate()));
  175 + }
  176 + this.status = AWBTools.transCusRspCode(customReception.getResponseCode());
  177 + this.receiptinformation = customReception.getResponseText();
  178 + }
  179 +
  180 + @Override
  181 + public int masterAnalysisReception() {
  182 + int i = inportallocateMapper.updateRECEIPTION(this);
  183 +
  184 + List<INPORTALLOCATE> arrivedmasterList = inportallocateMapper.selectAutoIdByAwb(this);
  185 + if(!arrivedmasterList.isEmpty()){
  186 + INPORTALLOCATE departuresloading1 = arrivedmasterList.get(0);
  187 + String autoId = departuresloading1.getId();
  188 +
  189 + //插入sendlog记录表
  190 + log.info("即将插入回执日志运单号为:"+waybillno+"->autoid="+autoId);
  191 + int ii =sendLogService.insertSendlog("MT6202",receiptinformation,autoId);
  192 +
  193 + if (i>0 && ii>0 ){
  194 + log.info("运单号 {} 分拨申请回执更新成功",waybillno);
  195 + return 1;
  196 + }
  197 + }
  198 + return 0;
  199 + }
155 } 200 }
1 package com.tianbo.analysis.model; 1 package com.tianbo.analysis.model;
2 2
  3 +import com.tianbo.analysis.bean.WlptBaseModel;
  4 +import com.tianbo.analysis.tools.AWBTools;
  5 +import com.tianbo.util.Date.DateUtil;
  6 +import lombok.Data;
  7 +import lombok.extern.slf4j.Slf4j;
  8 +
3 import java.util.Date; 9 import java.util.Date;
  10 +import java.util.List;
4 11
5 -public class INTERNATIONALTRANSIT { 12 +@Data
  13 +@Slf4j
  14 +public class INTERNATIONALTRANSIT extends WlptBaseModel {
6 private String autoid; 15 private String autoid;
7 16
8 private Date createdate; 17 private Date createdate;
@@ -202,4 +211,39 @@ public class INTERNATIONALTRANSIT { @@ -202,4 +211,39 @@ public class INTERNATIONALTRANSIT {
202 public void setDestinationstationBill(String destinationstationBill) { 211 public void setDestinationstationBill(String destinationstationBill) {
203 this.destinationstationBill = destinationstationBill == null ? null : destinationstationBill.trim(); 212 this.destinationstationBill = destinationstationBill == null ? null : destinationstationBill.trim();
204 } 213 }
  214 +
  215 + public INTERNATIONALTRANSIT(){
  216 +
  217 + }
  218 + public INTERNATIONALTRANSIT(CustomReception customReception) {
  219 + String[] flightInfo = AWBTools.splitFlight(customReception.getImportFlightNo());
  220 + this.originalCarrier = flightInfo[0];
  221 + this.originalFlightno = flightInfo[1];
  222 + this.originalFlightdate = DateUtil.formatByyyyyMMdd(customReception.getImportFlightDate());
  223 + this.originalBillno = AWBTools.awbFormat(customReception.getImportWaybillMaster());
  224 + //TODO:碰见分单回执再解析
  225 + this.originalSubNumber = originalSubNumber;
  226 +
  227 + this.status = AWBTools.transCusRspCode(customReception.getResponseCode());
  228 + this.receiption = customReception.getResponseText();
  229 + }
  230 +
  231 + @Override
  232 + public int masterAnalysisReception() {
  233 + int i = internationaltransitMapper.updateRECEIPTION(this);
  234 + List<INTERNATIONALTRANSIT> internationaltransits = internationaltransitMapper.selectAutoIdByAwb(this);
  235 + if(!internationaltransits.isEmpty()){
  236 + INTERNATIONALTRANSIT internationaltransit = internationaltransits.get(0);
  237 + String autoId = internationaltransit.getAutoid();
  238 +
  239 + //插入sendlog记录表
  240 + log.info("即将插入国际转运日志运单号为:"+originalBillno+"->autoid="+autoId);
  241 + int ii =sendLogService.insertSendlog("MT8205",receiption,autoId);
  242 + if (i>0 && ii>0){
  243 + log.info("运单号 {} 国际转运回执更新成功",originalBillno);
  244 + return 1;
  245 + }
  246 + }
  247 + return 0;
  248 + }
205 } 249 }
1 package com.tianbo.analysis.model; 1 package com.tianbo.analysis.model;
2 2
  3 +import com.tianbo.analysis.bean.WlptBaseModel;
  4 +import com.tianbo.analysis.tools.AWBTools;
  5 +import com.tianbo.util.Date.DateUtil;
  6 +import lombok.Data;
  7 +import lombok.extern.slf4j.Slf4j;
  8 +import org.apache.commons.lang.StringUtils;
  9 +
3 import java.util.Date; 10 import java.util.Date;
  11 +import java.util.List;
4 12
5 -public class ORIGINMANIFESTMASTER { 13 +@Data
  14 +@Slf4j
  15 +public class ORIGINMANIFESTMASTER extends WlptBaseModel {
6 private String autoid; 16 private String autoid;
7 17
8 private String waybillnomaster; 18 private String waybillnomaster;
@@ -442,4 +452,39 @@ public class ORIGINMANIFESTMASTER { @@ -442,4 +452,39 @@ public class ORIGINMANIFESTMASTER {
442 public void setConsigneePhone(String consigneePhone) { 452 public void setConsigneePhone(String consigneePhone) {
443 this.consigneePhone = consigneePhone == null ? null : consigneePhone.trim(); 453 this.consigneePhone = consigneePhone == null ? null : consigneePhone.trim();
444 } 454 }
  455 +
  456 + public ORIGINMANIFESTMASTER() {
  457 +
  458 + }
  459 + public ORIGINMANIFESTMASTER(CustomReception customReception) {
  460 + this.waybillnomaster = customReception.getWayBillMaster();
  461 + this.flightno = customReception.getFlightNo();
  462 + this.receiptinformation = customReception.getResponseText();
  463 + if (!StringUtils.isEmpty(customReception.getFlightDate())) {
  464 + this.flightDate = DateUtil.formatByyyyyMMdd(customReception.getFlightDate());
  465 + }
  466 + this.status = AWBTools.transCusRspCode(customReception.getResponseCode());
  467 + }
  468 +
  469 + @Override
  470 + public int masterAnalysisReception() {
  471 + //更新主单回执
  472 + int i = originmanifestmasterMapper.updateRECEIPTION(this);
  473 + //获取分单autoid
  474 + List<ORIGINMANIFESTMASTER> originmanifestmasterList = originmanifestmasterMapper.selectAutoIdByAwb(this);
  475 + if(!originmanifestmasterList.isEmpty()){
  476 + ORIGINMANIFESTMASTER originMaster = originmanifestmasterList.get(0);
  477 + String autoId = originMaster.getAutoid();
  478 +
  479 + //插入sendlog记录表
  480 + log.info("即将插入日志运单号为:"+waybillnomaster+"->autoid="+autoId);
  481 + int ii =sendLogService.insertSendlog("MT1201",receiptinformation,autoId);;
  482 +
  483 + if (i>0 && ii>0){
  484 + log.info("运单号 {} 原始回执更新成功",waybillnomaster);
  485 + return 1;
  486 + }
  487 + }
  488 + return 0;
  489 + }
445 } 490 }
1 package com.tianbo.analysis.model; 1 package com.tianbo.analysis.model;
2 2
  3 +import com.tianbo.analysis.bean.WlptBaseModel;
  4 +import com.tianbo.analysis.tools.AWBTools;
  5 +import lombok.Data;
  6 +import lombok.extern.slf4j.Slf4j;
  7 +
3 import java.util.Date; 8 import java.util.Date;
  9 +import java.util.List;
4 10
5 -public class Originmanifestsecondary { 11 +@Data
  12 +@Slf4j
  13 +public class Originmanifestsecondary extends WlptBaseModel {
6 private String autoid; 14 private String autoid;
7 15
8 private String waybillnomaster; 16 private String waybillnomaster;
@@ -322,4 +330,35 @@ public class Originmanifestsecondary { @@ -322,4 +330,35 @@ public class Originmanifestsecondary {
322 public void setConsigneePhone(String consigneePhone) { 330 public void setConsigneePhone(String consigneePhone) {
323 this.consigneePhone = consigneePhone == null ? null : consigneePhone.trim(); 331 this.consigneePhone = consigneePhone == null ? null : consigneePhone.trim();
324 } 332 }
  333 +
  334 + public Originmanifestsecondary(){
  335 +
  336 + }
  337 + public Originmanifestsecondary(CustomReception customReception) {
  338 + this.waybillnomaster = customReception.getWayBillMaster();
  339 + this.waybillnosecondary = customReception.getWayBillSecond().split("_")[1];
  340 + this.status = AWBTools.transCusRspCode(customReception.getResponseCode());
  341 + this.receiption = customReception.getResponseText();
  342 + }
  343 +
  344 + @Override
  345 + public int secondAnalysisReception() {
  346 + //更新分单回执
  347 + int i = originmanifestsecondaryMapper.updateRECEIPTION(this);
  348 + //获取分单autoid
  349 + List<Originmanifestsecondary> originmanifestsecondaryList = originmanifestsecondaryMapper.selectAutoIdByawbAawbH(this);
  350 + if(!originmanifestsecondaryList.isEmpty()){
  351 + Originmanifestsecondary originSecond = originmanifestsecondaryList.get(0);
  352 + String autoId = originSecond.getAutoid();
  353 + //插入sendlog记录表
  354 + log.info("即将插入日志运单号为:"+waybillnosecondary+"->autoid="+autoId);
  355 + int ii = sendLogService.insertSendlog("MT1201",receiption,autoId);
  356 +
  357 + if (i>0 && ii>0){
  358 + log.info("运单号 {}_{} 原始回执更新成功",waybillnomaster,waybillnosecondary);
  359 + return 1;
  360 + }
  361 + }
  362 + return 0;
  363 + }
325 } 364 }
1 package com.tianbo.analysis.model; 1 package com.tianbo.analysis.model;
2 2
  3 +import com.tianbo.analysis.bean.WlptBaseModel;
  4 +import com.tianbo.analysis.tools.AWBTools;
  5 +import com.tianbo.util.Date.DateUtil;
  6 +import lombok.Data;
  7 +import lombok.extern.slf4j.Slf4j;
  8 +import org.apache.commons.lang.StringUtils;
  9 +
3 import java.util.Date; 10 import java.util.Date;
  11 +import java.util.List;
4 12
5 -public class PREPAREMASTER { 13 +@Data
  14 +@Slf4j
  15 +public class PREPAREMASTER extends WlptBaseModel {
6 private String autoid; 16 private String autoid;
7 17
8 private String flightno; 18 private String flightno;
@@ -382,4 +392,41 @@ public class PREPAREMASTER { @@ -382,4 +392,41 @@ public class PREPAREMASTER {
382 public void setUnloadingstation(String unloadingstation) { 392 public void setUnloadingstation(String unloadingstation) {
383 this.unloadingstation = unloadingstation == null ? null : unloadingstation.trim(); 393 this.unloadingstation = unloadingstation == null ? null : unloadingstation.trim();
384 } 394 }
  395 +
  396 + public PREPAREMASTER() {
  397 +
  398 + }
  399 + public PREPAREMASTER(CustomReception customReception) {
  400 + String[] flightInfo = AWBTools.splitFlight(customReception.getFlightNo());
  401 + this.setFlightno(flightInfo[1]);
  402 + this.setCarrier(flightInfo[0]);
  403 + if (!StringUtils.isEmpty(customReception.getFlightDate())) {
  404 + this.flightdate=DateUtil.formatByyyyyMMdd(customReception.getFlightDate());
  405 + }
  406 + this.waybillnomaster = customReception.getWayBillMaster();
  407 + this.status = AWBTools.transCusRspCode(customReception.getResponseCode());
  408 + this.receiptinformation = customReception.getResponseText();
  409 + }
  410 +
  411 + @Override
  412 + public int masterAnalysisReception() {
  413 +//更新主单回执
  414 + int i = preparemasterMapper.updateRECEIPTION(this);
  415 + //获取分单autoid
  416 + List<PREPAREMASTER> preparemasterList = preparemasterMapper.selectAutoIdByAwb(this);
  417 + if(!preparemasterList.isEmpty()){
  418 + PREPAREMASTER originMaster = preparemasterList.get(0);
  419 + String autoId = originMaster.getAutoid();
  420 +
  421 + //插入sendlog记录表
  422 + log.info("即将插入日志运单号为:"+waybillnomaster+"->autoid="+autoId);
  423 + int ii =sendLogService.insertSendlog("MT2201",receiptinformation,autoId);
  424 +
  425 + if (i>0 && ii>0){
  426 + log.info("运单号 {} 预配回执更新成功",waybillnomaster);
  427 + return 1;
  428 + }
  429 + }
  430 + return 0;
  431 + }
385 } 432 }
1 package com.tianbo.analysis.model; 1 package com.tianbo.analysis.model;
2 2
  3 +import com.tianbo.analysis.bean.WlptBaseModel;
  4 +import com.tianbo.analysis.tools.AWBTools;
  5 +import com.tianbo.util.Date.DateUtil;
  6 +import lombok.Data;
  7 +import lombok.extern.slf4j.Slf4j;
  8 +import org.apache.commons.lang.StringUtils;
  9 +
3 import java.math.BigDecimal; 10 import java.math.BigDecimal;
4 import java.util.Date; 11 import java.util.Date;
  12 +import java.util.List;
5 13
6 -public class PREPARESECONDARY { 14 +@Data
  15 +@Slf4j
  16 +public class PREPARESECONDARY extends WlptBaseModel {
7 private String id; 17 private String id;
8 18
9 private String waybillnomaster; 19 private String waybillnomaster;
@@ -793,4 +803,40 @@ public class PREPARESECONDARY { @@ -793,4 +803,40 @@ public class PREPARESECONDARY {
793 public void setUnlodingcode(String unlodingcode) { 803 public void setUnlodingcode(String unlodingcode) {
794 this.unlodingcode = unlodingcode == null ? null : unlodingcode.trim(); 804 this.unlodingcode = unlodingcode == null ? null : unlodingcode.trim();
795 } 805 }
  806 + public PREPARESECONDARY(){
  807 +
  808 + }
  809 +
  810 + public PREPARESECONDARY(CustomReception customReception) {
  811 + String[] flightInfo = AWBTools.splitFlight(customReception.getFlightNo());
  812 + this.setFlightno(flightInfo[1]);
  813 + this.setCarrier(flightInfo[0]);
  814 + this.waybillnomaster = customReception.getWayBillMaster();
  815 + this.waybillnosecondary = customReception.getWayBillSecond().split("_")[1];
  816 + if (!StringUtils.isEmpty(customReception.getFlightDate())) {
  817 + this.flightdate= DateUtil.formatByyyyyMMdd(customReception.getFlightDate());
  818 + }
  819 + this.status = AWBTools.transCusRspCode(customReception.getResponseCode());
  820 + this.receiptinformation = customReception.getResponseText();
  821 + }
  822 +
  823 + @Override
  824 + public int secondAnalysisReception() {
  825 + //更新分单回执
  826 + int i = preparesecondaryMapper.updateRECEIPTION(this);
  827 + //获取分单autoid
  828 + List<PREPARESECONDARY> arrivedsecondaryList = preparesecondaryMapper.selectAutoIdByawbAawbH(this);
  829 + if(!arrivedsecondaryList.isEmpty()){
  830 + PREPARESECONDARY preparesecondary1 = arrivedsecondaryList.get(0);
  831 + String autoId = preparesecondary1.getAutoid();
  832 + //插入sendlog记录表
  833 + log.info("即将插入日志运单号为:"+waybillnosecondary+"->autoid="+autoId);
  834 + int ii = sendLogService.insertSendlog("MT2201",receiptinformation,autoId);
  835 + if (i>0 && ii>0){
  836 + log.info("运单号 {}_{} 原始回执更新成功",waybillnomaster,waybillnosecondary);
  837 + return 1;
  838 + }
  839 + }
  840 + return 0;
  841 + }
796 } 842 }
1 package com.tianbo.analysis.model; 1 package com.tianbo.analysis.model;
2 2
  3 +import com.tianbo.analysis.bean.WlptBaseModel;
  4 +import com.tianbo.analysis.tools.AWBTools;
  5 +import com.tianbo.util.Date.DateUtil;
  6 +import lombok.Data;
  7 +import lombok.extern.slf4j.Slf4j;
  8 +import org.apache.commons.lang.StringUtils;
  9 +
3 import java.util.Date; 10 import java.util.Date;
  11 +import java.util.List;
4 12
5 -public class TALLYMASTER { 13 +@Data
  14 +@Slf4j
  15 +public class TALLYMASTER extends WlptBaseModel {
6 private String autoid; 16 private String autoid;
7 17
8 private String waybillnomaster; 18 private String waybillnomaster;
@@ -63,6 +73,8 @@ public class TALLYMASTER { @@ -63,6 +73,8 @@ public class TALLYMASTER {
63 73
64 private String transportsplitdescription; 74 private String transportsplitdescription;
65 75
  76 + private CustomReception customReceptionT;
  77 +
66 public String getAutoid() { 78 public String getAutoid() {
67 return autoid; 79 return autoid;
68 } 80 }
@@ -302,4 +314,38 @@ public class TALLYMASTER { @@ -302,4 +314,38 @@ public class TALLYMASTER {
302 public void setTransportsplitdescription(String transportsplitdescription) { 314 public void setTransportsplitdescription(String transportsplitdescription) {
303 this.transportsplitdescription = transportsplitdescription == null ? null : transportsplitdescription.trim(); 315 this.transportsplitdescription = transportsplitdescription == null ? null : transportsplitdescription.trim();
304 } 316 }
  317 + public TALLYMASTER(){
  318 +
  319 + }
  320 + public TALLYMASTER(CustomReception customReception) {
  321 + this.customReceptionT=customReception;
  322 + this.waybillnomaster = customReception.getWayBillMaster();
  323 + this.flightno = customReception.getFlightNo();
  324 + if (!StringUtils.isEmpty(customReception.getFlightDate())) {
  325 + this.flightdate= DateUtil.formatByyyyyMMdd(customReception.getFlightDate());
  326 + }
  327 + this.status = AWBTools.transCusRspCode(customReception.getResponseCode());
  328 + this.receiptinformation = customReception.getResponseText();
  329 + this.talltype = customReception.getMessageType();
  330 + }
  331 +
  332 + @Override
  333 + public int masterAnalysisReception() {
  334 + //更新主单回执
  335 + int i = tallymasterMapper.updateRECEIPTION(this);
  336 + //获取主单autoid
  337 + List<TALLYMASTER> arrivedmasterList = tallymasterMapper.selectAutoIdByAwb(this);
  338 + if(!arrivedmasterList.isEmpty()){
  339 + TALLYMASTER originMaster = arrivedmasterList.get(0);
  340 + String autoId = originMaster.getAutoid();
  341 +
  342 + int ii =sendLogService.insertSendlog(customReceptionT.getMessageType(),receiptinformation,autoId);
  343 +
  344 + if (i>0 && ii>0 ){
  345 + log.info("运单号 {} 理货回执更新成功",waybillnomaster);
  346 + return 1;
  347 + }
  348 + }
  349 + return 0;
  350 + }
305 } 351 }
1 package com.tianbo.analysis.model; 1 package com.tianbo.analysis.model;
2 2
  3 +import com.tianbo.analysis.bean.WlptBaseModel;
  4 +import com.tianbo.analysis.tools.AWBTools;
  5 +import lombok.Data;
  6 +import lombok.extern.slf4j.Slf4j;
  7 +
3 import java.util.Date; 8 import java.util.Date;
  9 +import java.util.List;
4 10
5 -public class TALLYSECONDARY { 11 +@Data
  12 +@Slf4j
  13 +public class TALLYSECONDARY extends WlptBaseModel {
6 private String autoid; 14 private String autoid;
7 15
8 private String waybillnomaster; 16 private String waybillnomaster;
@@ -41,6 +49,7 @@ public class TALLYSECONDARY { @@ -41,6 +49,7 @@ public class TALLYSECONDARY {
41 49
42 private String receiptinformation; 50 private String receiptinformation;
43 51
  52 + private CustomReception customReceptionT;
44 public String getAutoid() { 53 public String getAutoid() {
45 return autoid; 54 return autoid;
46 } 55 }
@@ -192,4 +201,38 @@ public class TALLYSECONDARY { @@ -192,4 +201,38 @@ public class TALLYSECONDARY {
192 public void setReceiptinformation(String receiptinformation) { 201 public void setReceiptinformation(String receiptinformation) {
193 this.receiptinformation = receiptinformation == null ? null : receiptinformation.trim(); 202 this.receiptinformation = receiptinformation == null ? null : receiptinformation.trim();
194 } 203 }
  204 +
  205 + public TALLYSECONDARY(){
  206 +
  207 + }
  208 + public TALLYSECONDARY(CustomReception customReception) {
  209 + this.customReceptionT = customReception;
  210 + this.waybillnomaster = customReception.getWayBillMaster();
  211 + this.waybillnosecondary = customReception.getWayBillSecond().split("_")[1];
  212 + this.status = AWBTools.transCusRspCode(customReception.getResponseCode());
  213 + this.receiptinformation = customReception.getResponseText();
  214 + }
  215 +
  216 + @Override
  217 + public int secondAnalysisReception() {
  218 + //更新分单回执
  219 + int i = tallysecondaryMapper.updateRECEIPTION(this);
  220 + //获取分单autoid
  221 + List<TALLYSECONDARY> tallysecondaryList = tallysecondaryMapper.selectAutoIdByawbAawbH(this);
  222 +
  223 + if(!tallysecondaryList.isEmpty()){
  224 + TALLYSECONDARY arrivedSecond = tallysecondaryList.get(0);
  225 + String autoId = arrivedSecond.getAutoid();
  226 + //插入sendlog记录表
  227 + log.info("即将插入理货分单回执,运单号为:{}_{},autoid:{}",waybillnomaster,waybillnosecondary,autoId);
  228 + int ii = sendLogService.insertSendlog(customReceptionT.getMessageType(),receiptinformation,autoId);
  229 +
  230 + if (i>0 && ii>0){
  231 + log.info("运单号 {} 理货回执更新成功",waybillnosecondary);
  232 + return 1;
  233 + }
  234 +
  235 + }
  236 + return 0;
  237 + }
195 } 238 }
@@ -21,6 +21,7 @@ public class SendLogServiceImp implements SendLogService{ @@ -21,6 +21,7 @@ public class SendLogServiceImp implements SendLogService{
21 @Override 21 @Override
22 public int insertSendlog(String type,String reception,String autoId){ 22 public int insertSendlog(String type,String reception,String autoId){
23 SENDLOG sendlog = new SENDLOG(); 23 SENDLOG sendlog = new SENDLOG();
  24 + sendlog.setOpauthor("System");
24 sendlog.setAutoid(Helper.getUUID()); 25 sendlog.setAutoid(Helper.getUUID());
25 sendlog.setCreatedate(new Date()); 26 sendlog.setCreatedate(new Date());
26 sendlog.setMessageautoid(autoId); 27 sendlog.setMessageautoid(autoId);
@@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@
13 <result column="FD_ID" property="fdId" jdbcType="VARCHAR" /> 13 <result column="FD_ID" property="fdId" jdbcType="VARCHAR" />
14 <result column="FD_NAME" property="fdName" jdbcType="VARCHAR" /> 14 <result column="FD_NAME" property="fdName" jdbcType="VARCHAR" />
15 <result column="FLIGHTNO" property="flightno" jdbcType="VARCHAR" /> 15 <result column="FLIGHTNO" property="flightno" jdbcType="VARCHAR" />
16 - <result column="FLIGHTDATE" property="flightdate" jdbcType="TIMESTAMP" /> 16 + <result column="FLIGHTDATE" property="flightdate" jdbcType="DATE" />
17 <result column="ARRIVEDTOTALPIECE" property="arrivedtotalpiece" jdbcType="VARCHAR" /> 17 <result column="ARRIVEDTOTALPIECE" property="arrivedtotalpiece" jdbcType="VARCHAR" />
18 <result column="TOTALPIECEQUANTITY" property="totalpiecequantity" jdbcType="VARCHAR" /> 18 <result column="TOTALPIECEQUANTITY" property="totalpiecequantity" jdbcType="VARCHAR" />
19 <result column="ARRIVEDTOTALWEIGHT" property="arrivedtotalweight" jdbcType="VARCHAR" /> 19 <result column="ARRIVEDTOTALWEIGHT" property="arrivedtotalweight" jdbcType="VARCHAR" />
@@ -233,9 +233,19 @@ @@ -233,9 +233,19 @@
233 233
234 <update id="updateRECEIPTION" parameterType="com.tianbo.analysis.model.ARRIVEDSECONDARY" > 234 <update id="updateRECEIPTION" parameterType="com.tianbo.analysis.model.ARRIVEDSECONDARY" >
235 UPDATE ARRIVEDSECONDARY 235 UPDATE ARRIVEDSECONDARY
236 - SET RECEIPTION= #{receiption,jdbcType=VARCHAR},STATUS = #{status,jdbcType=VARCHAR}  
237 - WHERE WAYBILLNOMASTER = #{waybillnomaster,jdbcType=VARCHAR}  
238 - AND WAYBILLNOSECONDARY = #{waybillnosecondary,jdbcType=VARCHAR} 236 + SET
  237 + RECEIPTION= #{receiption,jdbcType=VARCHAR},
  238 + STATUS = #{status,jdbcType=VARCHAR}
  239 + WHERE
  240 + WAYBILLNOMASTER = #{waybillnomaster,jdbcType=VARCHAR}
  241 + AND
  242 + WAYBILLNOSECONDARY = #{waybillnosecondary,jdbcType=VARCHAR}
  243 + AND
  244 + FLIGHTNO = #{flightno,jdbcType=VARCHAR}
  245 + AND
  246 + CARRIER = #{carrier,jdbcType=VARCHAR}
  247 + AND
  248 + FLIGHTDATE= #{flightdate,jdbcType=DATE}
239 </update> 249 </update>
240 250
241 <select id="selectAutoIdByawbAawbH" parameterType="com.tianbo.analysis.model.ARRIVEDSECONDARY" resultType="com.tianbo.analysis.model.ARRIVEDSECONDARY"> 251 <select id="selectAutoIdByawbAawbH" parameterType="com.tianbo.analysis.model.ARRIVEDSECONDARY" resultType="com.tianbo.analysis.model.ARRIVEDSECONDARY">