作者 朱兆平

优化多线程全部业务ok

package com.tianbo.analysis.bean;
import com.tianbo.analysis.dao.*;
import com.tianbo.analysis.service.SendLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class WlptBaseModel {
@Autowired
public ALLOCATEARRIVALMapper allocatearrivalMapper;
@Autowired
public SendLogService sendLogService;
@Autowired
public ARRIVEDMASTERMapper arrivedmasterMapper;
@Autowired
public ARRIVEDSECONDARYMapper arrivedsecondaryMapper;
@Autowired
public DEPARTURESLOADINGMapper departuresloadingMapper;
@Autowired
public INPORTALLOCATEMapper inportallocateMapper;
@Autowired
public INTERNATIONALTRANSITMapper internationaltransitMapper;
@Autowired
public ORIGINMANIFESTMASTERMapper originmanifestmasterMapper;
@Autowired
public OriginmanifestsecondaryMapper originmanifestsecondaryMapper;
@Autowired
public PREPAREMASTERMapper preparemasterMapper;
@Autowired
public PREPARESECONDARYMapper preparesecondaryMapper;
@Autowired
public TALLYMASTERMapper tallymasterMapper;
@Autowired
public TALLYSECONDARYMapper tallysecondaryMapper;
public WlptBaseModel() {
//处理多线程时 springboot 无法注入bean的问题
if (allocatearrivalMapper==null){
allocatearrivalMapper = SpringBeanUtitl.getBean(ALLOCATEARRIVALMapper.class);
}
if (sendLogService==null){
sendLogService = SpringBeanUtitl.getBean(SendLogService.class);
}
if (arrivedmasterMapper==null){
arrivedmasterMapper = SpringBeanUtitl.getBean(ARRIVEDMASTERMapper.class);
}
if (arrivedsecondaryMapper==null){
arrivedsecondaryMapper= SpringBeanUtitl.getBean(ARRIVEDSECONDARYMapper.class);
}
if(departuresloadingMapper==null){
departuresloadingMapper = SpringBeanUtitl.getBean(DEPARTURESLOADINGMapper.class);
}
if(inportallocateMapper==null){
inportallocateMapper = SpringBeanUtitl.getBean(INPORTALLOCATEMapper.class);
}
if(internationaltransitMapper==null){
internationaltransitMapper = SpringBeanUtitl.getBean(INTERNATIONALTRANSITMapper.class);
}
if(originmanifestmasterMapper==null){
originmanifestmasterMapper = SpringBeanUtitl.getBean(ORIGINMANIFESTMASTERMapper.class);
}
if(originmanifestsecondaryMapper==null){
originmanifestsecondaryMapper = SpringBeanUtitl.getBean(OriginmanifestsecondaryMapper.class);
}
if(preparemasterMapper==null){
preparemasterMapper = SpringBeanUtitl.getBean(PREPAREMASTERMapper.class);
}
if(preparesecondaryMapper==null){
preparesecondaryMapper = SpringBeanUtitl.getBean(PREPARESECONDARYMapper.class);
}
if(tallymasterMapper==null){
tallymasterMapper = SpringBeanUtitl.getBean(TALLYMASTERMapper.class);
}
if(tallysecondaryMapper==null){
tallysecondaryMapper = SpringBeanUtitl.getBean(TALLYSECONDARYMapper.class);
}
}
public static void init(){
}
public int masterAnalysisReception(){
return 0;
}
public int secondAnalysisReception(){
return 0;
}
}
... ...
package com.tianbo.analysis.handle;
import com.tianbo.analysis.model.ALLOCATEARRIVAL;
import com.tianbo.analysis.model.CustomReception;
import com.tianbo.analysis.service.*;
import com.tianbo.analysis.service.imp.*;
import com.tianbo.analysis.model.*;
import com.tianbo.analysis.tools.AWBTools;
import com.tianbo.util.Date.DateUtil;
import com.tianbo.util.XML.XMLXPath;
... ... @@ -16,9 +13,7 @@ import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import org.xml.sax.SAXParseException;
... ... @@ -129,10 +124,10 @@ public class CustomXmlHandleThread implements Runnable{
* @throws SAXParseException
* @throws FileNotFoundException
*/
public int handelXmlDocument() throws DocumentException,UnsupportedEncodingException,SAXParseException,FileNotFoundException {
private int handelXmlDocument() throws DocumentException,UnsupportedEncodingException,SAXParseException,FileNotFoundException {
int i = 0;
String secondSplit = "_";
SAXReader saxReader = new SAXReader();
Document document = saxReader.read(xmlfile);
Element contentRoot = document.getRootElement();
... ... @@ -183,32 +178,73 @@ public class CustomXmlHandleThread implements Runnable{
functionCode);
switch (msgType){
case "MT9999":
i = customXmlHandle.coustomAnalysisService.insertRecept(customReception);
ORIGINMANIFESTMASTER originmanifestmaster = new ORIGINMANIFESTMASTER(customReception);
PREPAREMASTER preparemaster= new PREPAREMASTER(customReception);
ARRIVEDMASTER arrivedmaster9999 = new ARRIVEDMASTER(customReception);
if(originmanifestmaster.masterAnalysisReception()>0){
i=1;
}else if(preparemaster.masterAnalysisReception()>0){
i=1;
}else {
i=arrivedmaster9999.masterAnalysisReception();
}
break;
case "MT3201":
i= customXmlHandle.arrivedmasterService.insertRecept(customReception);
if (customReception.getWayBillSecond()!=null && secondSplit.contains(customReception.getWayBillSecond())){
ARRIVEDSECONDARY arrivedsecondary = new ARRIVEDSECONDARY(customReception);
i=arrivedsecondary.secondAnalysisReception();
}else {
ARRIVEDMASTER arrivedmaster = new ARRIVEDMASTER(customReception);
i=arrivedmaster.masterAnalysisReception();
}
break;
case "MT5202":
i = customXmlHandle.tallymasterService.insertRecept(customReception);
if (customReception.getWayBillSecond()!=null && secondSplit.contains(customReception.getWayBillSecond())){
TALLYSECONDARY tallysecondary = new TALLYSECONDARY(customReception);
i=tallysecondary.secondAnalysisReception();
}else {
TALLYMASTER tallymaster= new TALLYMASTER(customReception);
i = tallymaster.masterAnalysisReception();
}
break;
case "MT5201":
i = customXmlHandle.tallymasterService.insertRecept(customReception);
if (customReception.getWayBillSecond()!=null && secondSplit.contains(customReception.getWayBillSecond())){
TALLYSECONDARY tallysecondary = new TALLYSECONDARY(customReception);
i=tallysecondary.secondAnalysisReception();
}else {
TALLYMASTER tallymaster= new TALLYMASTER(customReception);
i = tallymaster.masterAnalysisReception();
}
break;
case "MT4201":
i = customXmlHandle.departuresloadingService.insertRecept(customReception);
DEPARTURESLOADING departuresloading = new DEPARTURESLOADING(customReception);
i=departuresloading.masterAnalysisReception();
break;
case "MT1201":
i = customXmlHandle.coustomAnalysisService.insertRecept(customReception);
if (customReception.getWayBillSecond()!=null && secondSplit.contains(customReception.getWayBillSecond())){
Originmanifestsecondary originmanifestsecondary = new Originmanifestsecondary(customReception);
originmanifestsecondary.secondAnalysisReception();
}else {
ORIGINMANIFESTMASTER originmanifestmaster1201 = new ORIGINMANIFESTMASTER(customReception);
i = originmanifestmaster1201.masterAnalysisReception();
}
break;
case "MT2201":
i = customXmlHandle.preparemasterService.insertRecept(customReception);
if (customReception.getWayBillSecond()!=null && secondSplit.contains(customReception.getWayBillSecond())){
PREPARESECONDARY preparesecondary = new PREPARESECONDARY(customReception);
i = preparesecondary.secondAnalysisReception();
}else {
PREPAREMASTER preparemaster1201= new PREPAREMASTER(customReception);
i = preparemaster1201.masterAnalysisReception();
}
break;
case "MT6202":
i = customXmlHandle.inportallocateService.insertRecept(customReception);
INPORTALLOCATE inportallocate = new INPORTALLOCATE(customReception);
i = inportallocate.masterAnalysisReception();
break;
case "MT3202":
ALLOCATEARRIVAL allocatearrival = new ALLOCATEARRIVAL(customReception);
i= allocatearrival.analysisReception();
i= allocatearrival.masterAnalysisReception();
break;
case "MT8205":
transXmlHandel(document,customReception);
... ... @@ -223,7 +259,7 @@ public class CustomXmlHandleThread implements Runnable{
}
/**
* 国际转运回执处理
* 国际转运回执处理,特殊业务
* @param document
* @param customReception
* @return
... ... @@ -254,13 +290,15 @@ public class CustomXmlHandleThread implements Runnable{
customReception.getReceiverID(),
customReception.getVersion(),
customReception.getFunctionCode());
int i=customXmlHandle.internationaltransitService.insertRecept(transCustomReception);
INTERNATIONALTRANSIT internationaltransit = new INTERNATIONALTRANSIT(transCustomReception);
int i=internationaltransit.masterAnalysisReception();
return i;
}
public void errBak(File file){
private void errBak(File file){
try {
String today = DateUtil.getTodayBy_yyyyMMdd();
String errDirByDay = customXmlHandle.errBakDir + "/" + today;
... ...
package com.tianbo.analysis.model;
import com.tianbo.analysis.bean.SpringBeanUtitl;
import com.tianbo.analysis.dao.ALLOCATEARRIVALMapper;
import com.tianbo.analysis.dao.SENDLOGMapper;
import com.tianbo.analysis.service.SendLogService;
import com.tianbo.analysis.bean.WlptBaseModel;
import com.tianbo.analysis.tools.AWBTools;
import com.tianbo.util.Date.DateUtil;
import lombok.Data;
... ... @@ -13,13 +10,11 @@ import org.apache.commons.lang.StringUtils;
import java.util.Date;
import java.util.List;
@Slf4j
@Data
public class ALLOCATEARRIVAL {
@Slf4j
public class ALLOCATEARRIVAL extends WlptBaseModel{
private ALLOCATEARRIVALMapper allocatearrivalMapper;
private SendLogService sendLogService;
private String id;
... ... @@ -47,14 +42,13 @@ public class ALLOCATEARRIVAL {
private String receiptinformation;
private CustomReception customReception;
public ALLOCATEARRIVAL(){
}
public ALLOCATEARRIVAL(CustomReception customReception){
this.customReception = customReception;
this.waybillno = customReception.getWayBillMaster();
this.receiptinformation = customReception.getResponseText();
this.status = AWBTools.transCusRspCode(customReception.getResponseCode());
... ... @@ -65,13 +59,6 @@ public class ALLOCATEARRIVAL {
this.setFlightdate(DateUtil.formatByyyyyMMdd(customReception.getFlightDate()));
}
//处理多线程时 springboot 无法注入bean的问题
if (this.allocatearrivalMapper==null){
this.allocatearrivalMapper = SpringBeanUtitl.getBean(ALLOCATEARRIVALMapper.class);
}
if (this.sendLogService==null){
this.sendLogService = SpringBeanUtitl.getBean(SendLogService.class);
}
}
public String getId() {
... ... @@ -178,7 +165,8 @@ public class ALLOCATEARRIVAL {
this.receiptinformation = receiptinformation == null ? null : receiptinformation.trim();
}
public int analysisReception(){
@Override
public int masterAnalysisReception(){
int i= allocatearrivalMapper.updateRECEIPTION(this);
//获取主单autoid
... ... @@ -188,10 +176,11 @@ public class ALLOCATEARRIVAL {
String autoId = departuresloading1.getId();
//插入sendlog记录表
log.info("即将插入日志运单号为:"+waybillno+"->id="+id);
log.info("即将插入回执日志运单号为:"+waybillno+"->id="+id);
int ii =sendLogService.insertSendlog("MT3202",receiptinformation,autoId);
if (i>0 && ii>0){
log.info("运单号 {} 分拨运抵回执更新成功",waybillno);
return 1;
}
}
... ...
package com.tianbo.analysis.model;
import com.tianbo.analysis.bean.WlptBaseModel;
import com.tianbo.analysis.tools.AWBTools;
import com.tianbo.util.Date.DateUtil;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import java.util.Date;
import java.util.List;
@Data
public class ARRIVEDMASTER {
@Slf4j
public class ARRIVEDMASTER extends WlptBaseModel {
private String autoid;
private String waybillnomaster;
... ... @@ -57,4 +65,46 @@ public class ARRIVEDMASTER {
private String receiptinformation;
private Date createdate;
public ARRIVEDMASTER() {
}
public ARRIVEDMASTER(CustomReception customReception) {
init();
this.waybillnomaster = customReception.getWayBillMaster();
String[] flightInfo = AWBTools.splitFlight(customReception.getFlightNo());
this.setFlightno(flightInfo[1]);
this.setCarrier(flightInfo[0]);
if (!StringUtils.isEmpty(customReception.getFlightDate())) {
this.setFlightDate(DateUtil.formatByyyyyMMdd(customReception.getFlightDate()));
}
this.status = AWBTools.transCusRspCode(customReception.getResponseCode());
this.receiptinformation = customReception.getResponseText();
}
@Override
public int masterAnalysisReception() {
//更新主单回执
int i = arrivedmasterMapper.updateRECEIPTION(this);
//获取分单autoid
List<ARRIVEDMASTER> arrivedmasterList = arrivedmasterMapper.selectAutoIdByAwb(this);
if(!arrivedmasterList.isEmpty()){
ARRIVEDMASTER originMaster = arrivedmasterList.get(0);
String autoId = originMaster.getAutoid();
//插入sendlog记录表
log.info("即将插入回执日志运单号为:"+waybillnomaster+"->autoid="+autoId);
int ii =sendLogService.insertSendlog("MT3201",receiptinformation,autoId);
if (i>0 && ii>0){
log.info("运单号 {} 运抵回执更新成功",waybillnomaster);
return 1;
}
}
return 0;
}
}
\ No newline at end of file
... ...
package com.tianbo.analysis.model;
import com.tianbo.analysis.bean.WlptBaseModel;
import com.tianbo.analysis.tools.AWBTools;
import com.tianbo.util.Date.DateUtil;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import java.util.Date;
import java.util.List;
public class ARRIVEDSECONDARY {
@Data
@Slf4j
public class ARRIVEDSECONDARY extends WlptBaseModel {
private String autoid;
private String waybillnomaster;
... ... @@ -282,4 +292,50 @@ public class ARRIVEDSECONDARY {
public void setStatus(String status) {
this.status = status == null ? null : status.trim();
}
public ARRIVEDSECONDARY() {
}
public ARRIVEDSECONDARY(CustomReception customReception) {
this.waybillnomaster = customReception.getWayBillMaster();
//取分单号
String[] awbhArr = customReception.getWayBillSecond().split("_");
this.waybillnosecondary = awbhArr[1];
String[] flightInfo = AWBTools.splitFlight(customReception.getFlightNo());
this.setFlightno(flightInfo[1]);
this.setCarrier(flightInfo[0]);
if (!StringUtils.isEmpty(customReception.getFlightDate())) {
this.setFlightdate(DateUtil.formatByyyyyMMdd(customReception.getFlightDate()));
}
this.receiption = customReception.getResponseText();
this.status = AWBTools.transCusRspCode(customReception.getResponseCode());
}
@Override
public int secondAnalysisReception() {
//更新分单回执
int i = arrivedsecondaryMapper.updateRECEIPTION(this);
//获取分单autoid
List<ARRIVEDSECONDARY> arrivedsecondaryList = arrivedsecondaryMapper.selectAutoIdByawbAawbH(this);
if(!arrivedsecondaryList.isEmpty()){
ARRIVEDSECONDARY arrivedSecond = arrivedsecondaryList.get(0);
String autoId = arrivedSecond.getAutoid();
//插入sendlog记录表
log.info("即将插入回执日志运单号为:{}{},->autoid={}",waybillnomaster,waybillnosecondary,autoId);
int ii = sendLogService.insertSendlog("MT3201",receiption,autoId);
//todo:同时更新发送日志表的回执信息
if (i>0 && ii>0 ){
log.info("运单号 {} 运抵分单回执更新成功",waybillnosecondary);
return 1;
}
}else {
//todo:如果都没适配到的话,要从发送日志表里面通过回执中的messageid 找到发送信息,适配回执
}
return 0;
}
}
\ No newline at end of file
... ...
package com.tianbo.analysis.model;
import java.util.Date;
import com.tianbo.analysis.bean.WlptBaseModel;
import com.tianbo.analysis.tools.AWBTools;
import com.tianbo.util.Date.DateUtil;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
public class DEPARTURESLOADING {
import java.util.Date;
import java.util.List;
@Data
@Slf4j
public class DEPARTURESLOADING extends WlptBaseModel {
private String id;
private Date createdate;
... ... @@ -172,4 +181,37 @@ public class DEPARTURESLOADING {
public void setStatus(String status) {
this.status = status == null ? null : status.trim();
}
public DEPARTURESLOADING() {
}
public DEPARTURESLOADING(CustomReception customReception) {
init();
this.waybillno = customReception.getWayBillMaster();
this.flightno = customReception.getFlightNo();
if (!StringUtils.isEmpty(customReception.getFlightDate())) {
this.setFlightdate(DateUtil.formatByyyyyMMdd(customReception.getFlightDate()));
}
this.receiption = customReception.getResponseText();
this.status = AWBTools.transCusRspCode(customReception.getResponseCode());
}
@Override
public int masterAnalysisReception() {
int i = departuresloadingMapper.updateRECEIPTION(this);
List<DEPARTURESLOADING> list = departuresloadingMapper.selectAutoIdByAwb(this);
if(!list.isEmpty()){
DEPARTURESLOADING departuresloading1 = list.get(0);
String autoId = departuresloading1.getId();
//插入sendlog记录表
log.info("即将插入回执日志运单号为:"+waybillno+"->autoid="+autoId);
int ii =sendLogService.insertSendlog("MT4201",receiption,autoId);
if (i>0 && ii>0){
log.info("运单号 {} 装载回执更新成功",waybillno);
return 1;
}
}
return 0;
}
}
\ No newline at end of file
... ...
package com.tianbo.analysis.model;
import com.tianbo.analysis.bean.WlptBaseModel;
import com.tianbo.analysis.tools.AWBTools;
import com.tianbo.util.Date.DateUtil;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import java.util.Date;
import java.util.List;
public class INPORTALLOCATE {
@Data
@Slf4j
public class INPORTALLOCATE extends WlptBaseModel {
private String id;
private Date createdate;
... ... @@ -152,4 +162,39 @@ public class INPORTALLOCATE {
public void setReceiptinformation(String receiptinformation) {
this.receiptinformation = receiptinformation == null ? null : receiptinformation.trim();
}
public INPORTALLOCATE() {
}
public INPORTALLOCATE(CustomReception customReception) {
this.waybillno = customReception.getWayBillMaster();
String[] flightInfo = AWBTools.splitFlight(customReception.getFlightNo());
this.setFlightno(flightInfo[1]);
this.setCarrier(flightInfo[0]);
if (!StringUtils.isEmpty(customReception.getFlightDate())) {
this.setFlightdate(DateUtil.formatByyyyyMMdd(customReception.getFlightDate()));
}
this.status = AWBTools.transCusRspCode(customReception.getResponseCode());
this.receiptinformation = customReception.getResponseText();
}
@Override
public int masterAnalysisReception() {
int i = inportallocateMapper.updateRECEIPTION(this);
List<INPORTALLOCATE> arrivedmasterList = inportallocateMapper.selectAutoIdByAwb(this);
if(!arrivedmasterList.isEmpty()){
INPORTALLOCATE departuresloading1 = arrivedmasterList.get(0);
String autoId = departuresloading1.getId();
//插入sendlog记录表
log.info("即将插入回执日志运单号为:"+waybillno+"->autoid="+autoId);
int ii =sendLogService.insertSendlog("MT6202",receiptinformation,autoId);
if (i>0 && ii>0 ){
log.info("运单号 {} 分拨申请回执更新成功",waybillno);
return 1;
}
}
return 0;
}
}
\ No newline at end of file
... ...
package com.tianbo.analysis.model;
import com.tianbo.analysis.bean.WlptBaseModel;
import com.tianbo.analysis.tools.AWBTools;
import com.tianbo.util.Date.DateUtil;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import java.util.Date;
import java.util.List;
public class INTERNATIONALTRANSIT {
@Data
@Slf4j
public class INTERNATIONALTRANSIT extends WlptBaseModel {
private String autoid;
private Date createdate;
... ... @@ -202,4 +211,39 @@ public class INTERNATIONALTRANSIT {
public void setDestinationstationBill(String destinationstationBill) {
this.destinationstationBill = destinationstationBill == null ? null : destinationstationBill.trim();
}
public INTERNATIONALTRANSIT(){
}
public INTERNATIONALTRANSIT(CustomReception customReception) {
String[] flightInfo = AWBTools.splitFlight(customReception.getImportFlightNo());
this.originalCarrier = flightInfo[0];
this.originalFlightno = flightInfo[1];
this.originalFlightdate = DateUtil.formatByyyyyMMdd(customReception.getImportFlightDate());
this.originalBillno = AWBTools.awbFormat(customReception.getImportWaybillMaster());
//TODO:碰见分单回执再解析
this.originalSubNumber = originalSubNumber;
this.status = AWBTools.transCusRspCode(customReception.getResponseCode());
this.receiption = customReception.getResponseText();
}
@Override
public int masterAnalysisReception() {
int i = internationaltransitMapper.updateRECEIPTION(this);
List<INTERNATIONALTRANSIT> internationaltransits = internationaltransitMapper.selectAutoIdByAwb(this);
if(!internationaltransits.isEmpty()){
INTERNATIONALTRANSIT internationaltransit = internationaltransits.get(0);
String autoId = internationaltransit.getAutoid();
//插入sendlog记录表
log.info("即将插入国际转运日志运单号为:"+originalBillno+"->autoid="+autoId);
int ii =sendLogService.insertSendlog("MT8205",receiption,autoId);
if (i>0 && ii>0){
log.info("运单号 {} 国际转运回执更新成功",originalBillno);
return 1;
}
}
return 0;
}
}
\ No newline at end of file
... ...
package com.tianbo.analysis.model;
import com.tianbo.analysis.bean.WlptBaseModel;
import com.tianbo.analysis.tools.AWBTools;
import com.tianbo.util.Date.DateUtil;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import java.util.Date;
import java.util.List;
public class ORIGINMANIFESTMASTER {
@Data
@Slf4j
public class ORIGINMANIFESTMASTER extends WlptBaseModel {
private String autoid;
private String waybillnomaster;
... ... @@ -442,4 +452,39 @@ public class ORIGINMANIFESTMASTER {
public void setConsigneePhone(String consigneePhone) {
this.consigneePhone = consigneePhone == null ? null : consigneePhone.trim();
}
public ORIGINMANIFESTMASTER() {
}
public ORIGINMANIFESTMASTER(CustomReception customReception) {
this.waybillnomaster = customReception.getWayBillMaster();
this.flightno = customReception.getFlightNo();
this.receiptinformation = customReception.getResponseText();
if (!StringUtils.isEmpty(customReception.getFlightDate())) {
this.flightDate = DateUtil.formatByyyyyMMdd(customReception.getFlightDate());
}
this.status = AWBTools.transCusRspCode(customReception.getResponseCode());
}
@Override
public int masterAnalysisReception() {
//更新主单回执
int i = originmanifestmasterMapper.updateRECEIPTION(this);
//获取分单autoid
List<ORIGINMANIFESTMASTER> originmanifestmasterList = originmanifestmasterMapper.selectAutoIdByAwb(this);
if(!originmanifestmasterList.isEmpty()){
ORIGINMANIFESTMASTER originMaster = originmanifestmasterList.get(0);
String autoId = originMaster.getAutoid();
//插入sendlog记录表
log.info("即将插入日志运单号为:"+waybillnomaster+"->autoid="+autoId);
int ii =sendLogService.insertSendlog("MT1201",receiptinformation,autoId);;
if (i>0 && ii>0){
log.info("运单号 {} 原始回执更新成功",waybillnomaster);
return 1;
}
}
return 0;
}
}
\ No newline at end of file
... ...
package com.tianbo.analysis.model;
import com.tianbo.analysis.bean.WlptBaseModel;
import com.tianbo.analysis.tools.AWBTools;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import java.util.Date;
import java.util.List;
public class Originmanifestsecondary {
@Data
@Slf4j
public class Originmanifestsecondary extends WlptBaseModel {
private String autoid;
private String waybillnomaster;
... ... @@ -322,4 +330,35 @@ public class Originmanifestsecondary {
public void setConsigneePhone(String consigneePhone) {
this.consigneePhone = consigneePhone == null ? null : consigneePhone.trim();
}
public Originmanifestsecondary(){
}
public Originmanifestsecondary(CustomReception customReception) {
this.waybillnomaster = customReception.getWayBillMaster();
this.waybillnosecondary = customReception.getWayBillSecond().split("_")[1];
this.status = AWBTools.transCusRspCode(customReception.getResponseCode());
this.receiption = customReception.getResponseText();
}
@Override
public int secondAnalysisReception() {
//更新分单回执
int i = originmanifestsecondaryMapper.updateRECEIPTION(this);
//获取分单autoid
List<Originmanifestsecondary> originmanifestsecondaryList = originmanifestsecondaryMapper.selectAutoIdByawbAawbH(this);
if(!originmanifestsecondaryList.isEmpty()){
Originmanifestsecondary originSecond = originmanifestsecondaryList.get(0);
String autoId = originSecond.getAutoid();
//插入sendlog记录表
log.info("即将插入日志运单号为:"+waybillnosecondary+"->autoid="+autoId);
int ii = sendLogService.insertSendlog("MT1201",receiption,autoId);
if (i>0 && ii>0){
log.info("运单号 {}_{} 原始回执更新成功",waybillnomaster,waybillnosecondary);
return 1;
}
}
return 0;
}
}
\ No newline at end of file
... ...
package com.tianbo.analysis.model;
import com.tianbo.analysis.bean.WlptBaseModel;
import com.tianbo.analysis.tools.AWBTools;
import com.tianbo.util.Date.DateUtil;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import java.util.Date;
import java.util.List;
public class PREPAREMASTER {
@Data
@Slf4j
public class PREPAREMASTER extends WlptBaseModel {
private String autoid;
private String flightno;
... ... @@ -382,4 +392,41 @@ public class PREPAREMASTER {
public void setUnloadingstation(String unloadingstation) {
this.unloadingstation = unloadingstation == null ? null : unloadingstation.trim();
}
public PREPAREMASTER() {
}
public PREPAREMASTER(CustomReception customReception) {
String[] flightInfo = AWBTools.splitFlight(customReception.getFlightNo());
this.setFlightno(flightInfo[1]);
this.setCarrier(flightInfo[0]);
if (!StringUtils.isEmpty(customReception.getFlightDate())) {
this.flightdate=DateUtil.formatByyyyyMMdd(customReception.getFlightDate());
}
this.waybillnomaster = customReception.getWayBillMaster();
this.status = AWBTools.transCusRspCode(customReception.getResponseCode());
this.receiptinformation = customReception.getResponseText();
}
@Override
public int masterAnalysisReception() {
//更新主单回执
int i = preparemasterMapper.updateRECEIPTION(this);
//获取分单autoid
List<PREPAREMASTER> preparemasterList = preparemasterMapper.selectAutoIdByAwb(this);
if(!preparemasterList.isEmpty()){
PREPAREMASTER originMaster = preparemasterList.get(0);
String autoId = originMaster.getAutoid();
//插入sendlog记录表
log.info("即将插入日志运单号为:"+waybillnomaster+"->autoid="+autoId);
int ii =sendLogService.insertSendlog("MT2201",receiptinformation,autoId);
if (i>0 && ii>0){
log.info("运单号 {} 预配回执更新成功",waybillnomaster);
return 1;
}
}
return 0;
}
}
\ No newline at end of file
... ...
package com.tianbo.analysis.model;
import com.tianbo.analysis.bean.WlptBaseModel;
import com.tianbo.analysis.tools.AWBTools;
import com.tianbo.util.Date.DateUtil;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
public class PREPARESECONDARY {
@Data
@Slf4j
public class PREPARESECONDARY extends WlptBaseModel {
private String id;
private String waybillnomaster;
... ... @@ -793,4 +803,40 @@ public class PREPARESECONDARY {
public void setUnlodingcode(String unlodingcode) {
this.unlodingcode = unlodingcode == null ? null : unlodingcode.trim();
}
public PREPARESECONDARY(){
}
public PREPARESECONDARY(CustomReception customReception) {
String[] flightInfo = AWBTools.splitFlight(customReception.getFlightNo());
this.setFlightno(flightInfo[1]);
this.setCarrier(flightInfo[0]);
this.waybillnomaster = customReception.getWayBillMaster();
this.waybillnosecondary = customReception.getWayBillSecond().split("_")[1];
if (!StringUtils.isEmpty(customReception.getFlightDate())) {
this.flightdate= DateUtil.formatByyyyyMMdd(customReception.getFlightDate());
}
this.status = AWBTools.transCusRspCode(customReception.getResponseCode());
this.receiptinformation = customReception.getResponseText();
}
@Override
public int secondAnalysisReception() {
//更新分单回执
int i = preparesecondaryMapper.updateRECEIPTION(this);
//获取分单autoid
List<PREPARESECONDARY> arrivedsecondaryList = preparesecondaryMapper.selectAutoIdByawbAawbH(this);
if(!arrivedsecondaryList.isEmpty()){
PREPARESECONDARY preparesecondary1 = arrivedsecondaryList.get(0);
String autoId = preparesecondary1.getAutoid();
//插入sendlog记录表
log.info("即将插入日志运单号为:"+waybillnosecondary+"->autoid="+autoId);
int ii = sendLogService.insertSendlog("MT2201",receiptinformation,autoId);
if (i>0 && ii>0){
log.info("运单号 {}_{} 原始回执更新成功",waybillnomaster,waybillnosecondary);
return 1;
}
}
return 0;
}
}
\ No newline at end of file
... ...
package com.tianbo.analysis.model;
import com.tianbo.analysis.bean.WlptBaseModel;
import com.tianbo.analysis.tools.AWBTools;
import com.tianbo.util.Date.DateUtil;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import java.util.Date;
import java.util.List;
public class TALLYMASTER {
@Data
@Slf4j
public class TALLYMASTER extends WlptBaseModel {
private String autoid;
private String waybillnomaster;
... ... @@ -63,6 +73,8 @@ public class TALLYMASTER {
private String transportsplitdescription;
private CustomReception customReceptionT;
public String getAutoid() {
return autoid;
}
... ... @@ -302,4 +314,38 @@ public class TALLYMASTER {
public void setTransportsplitdescription(String transportsplitdescription) {
this.transportsplitdescription = transportsplitdescription == null ? null : transportsplitdescription.trim();
}
public TALLYMASTER(){
}
public TALLYMASTER(CustomReception customReception) {
this.customReceptionT=customReception;
this.waybillnomaster = customReception.getWayBillMaster();
this.flightno = customReception.getFlightNo();
if (!StringUtils.isEmpty(customReception.getFlightDate())) {
this.flightdate= DateUtil.formatByyyyyMMdd(customReception.getFlightDate());
}
this.status = AWBTools.transCusRspCode(customReception.getResponseCode());
this.receiptinformation = customReception.getResponseText();
this.talltype = customReception.getMessageType();
}
@Override
public int masterAnalysisReception() {
//更新主单回执
int i = tallymasterMapper.updateRECEIPTION(this);
//获取主单autoid
List<TALLYMASTER> arrivedmasterList = tallymasterMapper.selectAutoIdByAwb(this);
if(!arrivedmasterList.isEmpty()){
TALLYMASTER originMaster = arrivedmasterList.get(0);
String autoId = originMaster.getAutoid();
int ii =sendLogService.insertSendlog(customReceptionT.getMessageType(),receiptinformation,autoId);
if (i>0 && ii>0 ){
log.info("运单号 {} 理货回执更新成功",waybillnomaster);
return 1;
}
}
return 0;
}
}
\ No newline at end of file
... ...
package com.tianbo.analysis.model;
import com.tianbo.analysis.bean.WlptBaseModel;
import com.tianbo.analysis.tools.AWBTools;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import java.util.Date;
import java.util.List;
public class TALLYSECONDARY {
@Data
@Slf4j
public class TALLYSECONDARY extends WlptBaseModel {
private String autoid;
private String waybillnomaster;
... ... @@ -41,6 +49,7 @@ public class TALLYSECONDARY {
private String receiptinformation;
private CustomReception customReceptionT;
public String getAutoid() {
return autoid;
}
... ... @@ -192,4 +201,38 @@ public class TALLYSECONDARY {
public void setReceiptinformation(String receiptinformation) {
this.receiptinformation = receiptinformation == null ? null : receiptinformation.trim();
}
public TALLYSECONDARY(){
}
public TALLYSECONDARY(CustomReception customReception) {
this.customReceptionT = customReception;
this.waybillnomaster = customReception.getWayBillMaster();
this.waybillnosecondary = customReception.getWayBillSecond().split("_")[1];
this.status = AWBTools.transCusRspCode(customReception.getResponseCode());
this.receiptinformation = customReception.getResponseText();
}
@Override
public int secondAnalysisReception() {
//更新分单回执
int i = tallysecondaryMapper.updateRECEIPTION(this);
//获取分单autoid
List<TALLYSECONDARY> tallysecondaryList = tallysecondaryMapper.selectAutoIdByawbAawbH(this);
if(!tallysecondaryList.isEmpty()){
TALLYSECONDARY arrivedSecond = tallysecondaryList.get(0);
String autoId = arrivedSecond.getAutoid();
//插入sendlog记录表
log.info("即将插入理货分单回执,运单号为:{}_{},autoid:{}",waybillnomaster,waybillnosecondary,autoId);
int ii = sendLogService.insertSendlog(customReceptionT.getMessageType(),receiptinformation,autoId);
if (i>0 && ii>0){
log.info("运单号 {} 理货回执更新成功",waybillnosecondary);
return 1;
}
}
return 0;
}
}
\ No newline at end of file
... ...
... ... @@ -21,6 +21,7 @@ public class SendLogServiceImp implements SendLogService{
@Override
public int insertSendlog(String type,String reception,String autoId){
SENDLOG sendlog = new SENDLOG();
sendlog.setOpauthor("System");
sendlog.setAutoid(Helper.getUUID());
sendlog.setCreatedate(new Date());
sendlog.setMessageautoid(autoId);
... ...
... ... @@ -13,7 +13,7 @@
<result column="FD_ID" property="fdId" jdbcType="VARCHAR" />
<result column="FD_NAME" property="fdName" jdbcType="VARCHAR" />
<result column="FLIGHTNO" property="flightno" jdbcType="VARCHAR" />
<result column="FLIGHTDATE" property="flightdate" jdbcType="TIMESTAMP" />
<result column="FLIGHTDATE" property="flightdate" jdbcType="DATE" />
<result column="ARRIVEDTOTALPIECE" property="arrivedtotalpiece" jdbcType="VARCHAR" />
<result column="TOTALPIECEQUANTITY" property="totalpiecequantity" jdbcType="VARCHAR" />
<result column="ARRIVEDTOTALWEIGHT" property="arrivedtotalweight" jdbcType="VARCHAR" />
... ... @@ -233,9 +233,19 @@
<update id="updateRECEIPTION" parameterType="com.tianbo.analysis.model.ARRIVEDSECONDARY" >
UPDATE ARRIVEDSECONDARY
SET RECEIPTION= #{receiption,jdbcType=VARCHAR},STATUS = #{status,jdbcType=VARCHAR}
WHERE WAYBILLNOMASTER = #{waybillnomaster,jdbcType=VARCHAR}
AND WAYBILLNOSECONDARY = #{waybillnosecondary,jdbcType=VARCHAR}
SET
RECEIPTION= #{receiption,jdbcType=VARCHAR},
STATUS = #{status,jdbcType=VARCHAR}
WHERE
WAYBILLNOMASTER = #{waybillnomaster,jdbcType=VARCHAR}
AND
WAYBILLNOSECONDARY = #{waybillnosecondary,jdbcType=VARCHAR}
AND
FLIGHTNO = #{flightno,jdbcType=VARCHAR}
AND
CARRIER = #{carrier,jdbcType=VARCHAR}
AND
FLIGHTDATE= #{flightdate,jdbcType=DATE}
</update>
<select id="selectAutoIdByawbAawbH" parameterType="com.tianbo.analysis.model.ARRIVEDSECONDARY" resultType="com.tianbo.analysis.model.ARRIVEDSECONDARY">
... ...