|
|
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;
|
...
|
...
|
|