...
|
...
|
@@ -11,6 +11,7 @@ import com.tianbo.analysis.service.CoustomAnalysisService; |
|
|
import com.tianbo.util.Date.DateUtil;
|
|
|
import com.tianbo.util.Helper;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
...
|
...
|
@@ -42,84 +43,81 @@ public class CoustomAnalysisServiceImp implements CoustomAnalysisService { |
|
|
String reception = customReception.getResponseText();
|
|
|
String flightDateStr = customReception.getFlightDate();
|
|
|
|
|
|
Date flightDate = new Date();
|
|
|
if (flightDateStr != null){
|
|
|
flightDate = DateUtil.formatByyyyyMMdd(flightDateStr);
|
|
|
}
|
|
|
|
|
|
|
|
|
// 设置分单回执
|
|
|
Originmanifestsecondary originmanifestsecondary = new Originmanifestsecondary();
|
|
|
originmanifestsecondary.setReceiption(reception);
|
|
|
|
|
|
// 设置主单回执、航班号、航班日期
|
|
|
ORIGINMANIFESTMASTER originmanifestmaster = new ORIGINMANIFESTMASTER();
|
|
|
originmanifestmaster.setReceiptinformation(reception);
|
|
|
originmanifestmaster.setFlightno(customReception.getFlightNo());
|
|
|
originmanifestmaster.setFlightDate(flightDate);
|
|
|
|
|
|
// 判断航班号 航班日期 是否为空
|
|
|
if (flightDate != null && customReception.getFlightNo() != null){
|
|
|
if (awbA!=null && awbA.length()>0){
|
|
|
StringBuffer stringBuffer = new StringBuffer(awbA);
|
|
|
stringBuffer.insert(3,"-");
|
|
|
awbA = stringBuffer.toString();
|
|
|
|
|
|
//设置主分单的 主单号
|
|
|
originmanifestsecondary.setWaybillnomaster(awbA);
|
|
|
originmanifestmaster.setWaybillnomaster(awbA);
|
|
|
}
|
|
|
// Date flightDate = new Date();
|
|
|
if (!StringUtils.isEmpty(flightDateStr)){
|
|
|
Date flightDate = DateUtil.formatByyyyyMMdd(flightDateStr);
|
|
|
|
|
|
// 设置分单回执
|
|
|
Originmanifestsecondary originmanifestsecondary = new Originmanifestsecondary();
|
|
|
originmanifestsecondary.setReceiption(reception);
|
|
|
|
|
|
// 设置主单回执、航班号、航班日期
|
|
|
ORIGINMANIFESTMASTER originmanifestmaster = new ORIGINMANIFESTMASTER();
|
|
|
originmanifestmaster.setReceiptinformation(reception);
|
|
|
originmanifestmaster.setFlightno(customReception.getFlightNo());
|
|
|
originmanifestmaster.setFlightDate(flightDate);
|
|
|
|
|
|
// 判断航班号 航班日期 是否为空
|
|
|
if (flightDate != null && customReception.getFlightNo() != null){
|
|
|
if (awbA!=null && awbA.length()>0){
|
|
|
StringBuffer stringBuffer = new StringBuffer(awbA);
|
|
|
stringBuffer.insert(3,"-");
|
|
|
awbA = stringBuffer.toString();
|
|
|
|
|
|
//设置主分单的 主单号
|
|
|
originmanifestsecondary.setWaybillnomaster(awbA);
|
|
|
originmanifestmaster.setWaybillnomaster(awbA);
|
|
|
}
|
|
|
|
|
|
//有分单号 更新分单
|
|
|
if(awbA!=null && awbA.length()>0 && awbH!=null && awbH.length()> 0){
|
|
|
//取分单号
|
|
|
String[] awbhArr = awbH.split("_");
|
|
|
String awbh = awbhArr[1];
|
|
|
originmanifestsecondary.setWaybillnosecondary(awbh);
|
|
|
//更新分单回执
|
|
|
int i = originmanifestsecondaryMapper.updateRECEIPTION(originmanifestsecondary);
|
|
|
//获取分单autoid
|
|
|
List<Originmanifestsecondary> originmanifestsecondaryList = originmanifestsecondaryMapper.selectAutoIdByawbAawbH(originmanifestsecondary);
|
|
|
if(!originmanifestsecondaryList.isEmpty()){
|
|
|
Originmanifestsecondary originSecond = originmanifestsecondaryList.get(0);
|
|
|
String autoId = originSecond.getAutoid();
|
|
|
//插入sendlog记录表
|
|
|
log.info("即将插入日志运单号为:"+awbH+"->autoid="+autoId);
|
|
|
int ii = insertSendlog("MT1201",reception,autoId);
|
|
|
|
|
|
int iii = shareServiceImp.updateMessages(customReception);
|
|
|
if (i>0 && ii>0 && iii > 0){
|
|
|
return 1;
|
|
|
//有分单号 更新分单
|
|
|
if(awbA!=null && awbA.length()>0 && awbH!=null && awbH.length()> 0){
|
|
|
//取分单号
|
|
|
String[] awbhArr = awbH.split("_");
|
|
|
String awbh = awbhArr[1];
|
|
|
originmanifestsecondary.setWaybillnosecondary(awbh);
|
|
|
//更新分单回执
|
|
|
int i = originmanifestsecondaryMapper.updateRECEIPTION(originmanifestsecondary);
|
|
|
//获取分单autoid
|
|
|
List<Originmanifestsecondary> originmanifestsecondaryList = originmanifestsecondaryMapper.selectAutoIdByawbAawbH(originmanifestsecondary);
|
|
|
if(!originmanifestsecondaryList.isEmpty()){
|
|
|
Originmanifestsecondary originSecond = originmanifestsecondaryList.get(0);
|
|
|
String autoId = originSecond.getAutoid();
|
|
|
//插入sendlog记录表
|
|
|
log.info("即将插入日志运单号为:"+awbH+"->autoid="+autoId);
|
|
|
int ii = insertSendlog("MT1201",reception,autoId);
|
|
|
|
|
|
int iii = shareServiceImp.updateMessages(customReception);
|
|
|
if (i>0 && ii>0 && iii > 0){
|
|
|
return 1;
|
|
|
}
|
|
|
}
|
|
|
return 0;
|
|
|
}
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
//处理主单格式,将海关回执的主单号58019316861,变为580-19316861
|
|
|
if (awbA!=null && awbA.length()>0){
|
|
|
//更新主单回执
|
|
|
int i = originmanifestmasterMapper.updateRECEIPTION(originmanifestmaster);
|
|
|
//获取分单autoid
|
|
|
List<ORIGINMANIFESTMASTER> originmanifestmasterList = originmanifestmasterMapper.selectAutoIdByAwb(originmanifestmaster);
|
|
|
if(!originmanifestmasterList.isEmpty()){
|
|
|
ORIGINMANIFESTMASTER originMaster = originmanifestmasterList.get(0);
|
|
|
String autoId = originMaster.getAutoid();
|
|
|
|
|
|
//插入sendlog记录表
|
|
|
log.info("即将插入日志运单号为:"+awbA+"->autoid="+autoId);
|
|
|
int ii =insertSendlog("MT1201",reception,autoId);
|
|
|
|
|
|
int iii = shareServiceImp.updateMessages(customReception);
|
|
|
if (i>0 && ii>0 && iii > 0){
|
|
|
return 1;
|
|
|
//处理主单格式,将海关回执的主单号58019316861,变为580-19316861
|
|
|
if (awbA!=null && awbA.length()>0){
|
|
|
//更新主单回执
|
|
|
int i = originmanifestmasterMapper.updateRECEIPTION(originmanifestmaster);
|
|
|
//获取分单autoid
|
|
|
List<ORIGINMANIFESTMASTER> originmanifestmasterList = originmanifestmasterMapper.selectAutoIdByAwb(originmanifestmaster);
|
|
|
if(!originmanifestmasterList.isEmpty()){
|
|
|
ORIGINMANIFESTMASTER originMaster = originmanifestmasterList.get(0);
|
|
|
String autoId = originMaster.getAutoid();
|
|
|
|
|
|
//插入sendlog记录表
|
|
|
log.info("即将插入日志运单号为:"+awbA+"->autoid="+autoId);
|
|
|
int ii =insertSendlog("MT1201",reception,autoId);
|
|
|
|
|
|
int iii = shareServiceImp.updateMessages(customReception);
|
|
|
if (i>0 && ii>0 && iii > 0){
|
|
|
return 1;
|
|
|
}
|
|
|
}
|
|
|
return 0;
|
|
|
}
|
|
|
return 0;
|
|
|
}else {
|
|
|
return shareServiceImp.share("MT1201", customReception);
|
|
|
}
|
|
|
}else {
|
|
|
|
|
|
|
|
|
return shareServiceImp.share("MT1201", customReception);
|
|
|
}
|
|
|
|
|
|
//未进入主分单解析 返回0 失败
|
...
|
...
|
|