作者 申海龙

service 逻辑 改动 添加 if判断

... ... @@ -107,9 +107,12 @@ public class CustomXmlHandle{
if(journeyid != null){
String[] flightList = journeyid.split("/");
if(flightList.length > 0){
flightNo = flightList[0];
flightDate = flightList[1];
}
flightNo = flightList[0];
flightDate = flightList[1];
}
String awbA = XMLXPath.getSingleValueByPath(document,waybillMaster);
... ...
... ... @@ -8,6 +8,7 @@ import com.tianbo.analysis.model.CustomReception;
import com.tianbo.analysis.service.ARRIVEDMASTERService;
import com.tianbo.util.Date.DateUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
... ... @@ -45,85 +46,84 @@ public class ARRIVEDMASTERServiceImp implements ARRIVEDMASTERService {
//回执内容
String reception = customReception.getResponseText();
String flightDateStr = customReception.getFlightDate();
Date flightDate = new Date();
if (flightDateStr != null){
flightDate = DateUtil.formatByyyyyMMdd(flightDateStr);
}
// 设置 接收运抵分单 回执
ARRIVEDSECONDARY arrivedsecondary = new ARRIVEDSECONDARY();
arrivedsecondary.setReceiption(reception);
//设置主单回执、航班号、航班日期
ARRIVEDMASTER arrivedmaster = new ARRIVEDMASTER();
arrivedmaster.setReceiptinformation(reception);
arrivedmaster.setFlightno(customReception.getFlightNo());
arrivedmaster.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();
//设置主分单的 主单号
arrivedsecondary.setWaybillnomaster(awbA);
arrivedmaster.setWaybillnomaster(awbA);
}
if (!StringUtils.isEmpty(flightDateStr)) {
Date flightDate = DateUtil.formatByyyyyMMdd(flightDateStr);
// 设置 接收运抵分单 回执
ARRIVEDSECONDARY arrivedsecondary = new ARRIVEDSECONDARY();
arrivedsecondary.setReceiption(reception);
//设置主单回执、航班号、航班日期
ARRIVEDMASTER arrivedmaster = new ARRIVEDMASTER();
arrivedmaster.setReceiptinformation(reception);
arrivedmaster.setFlightno(customReception.getFlightNo());
arrivedmaster.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();
//设置主分单的 主单号
arrivedsecondary.setWaybillnomaster(awbA);
arrivedmaster.setWaybillnomaster(awbA);
}
//有分单号 更新分单
if(awbA!=null && awbA.length()>0 && awbH!=null && awbH.length()> 0){
//取分单号
String[] awbhArr = awbH.split("_");
String awbh = awbhArr[1];
arrivedsecondary.setWaybillnosecondary(awbh);
//更新分单回执
int i = arrivedsecondaryMapper.updateRECEIPTION(arrivedsecondary);
//获取分单autoid
List<ARRIVEDSECONDARY> arrivedsecondaryList = arrivedsecondaryMapper.selectAutoIdByawbAawbH(arrivedsecondary);
if(!arrivedsecondaryList.isEmpty()){
ARRIVEDSECONDARY arrivedSecond = arrivedsecondaryList.get(0);
String autoId = arrivedSecond.getAutoid();
//插入sendlog记录表
log.info("即将插入日志运单号为:"+awbH+"->autoid="+autoId);
int ii = coustomAnalysisServiceImp.insertSendlog("MT3201",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];
arrivedsecondary.setWaybillnosecondary(awbh);
//更新分单回执
int i = arrivedsecondaryMapper.updateRECEIPTION(arrivedsecondary);
//获取分单autoid
List<ARRIVEDSECONDARY> arrivedsecondaryList = arrivedsecondaryMapper.selectAutoIdByawbAawbH(arrivedsecondary);
if(!arrivedsecondaryList.isEmpty()){
ARRIVEDSECONDARY arrivedSecond = arrivedsecondaryList.get(0);
String autoId = arrivedSecond.getAutoid();
//插入sendlog记录表
log.info("即将插入日志运单号为:"+awbH+"->autoid="+autoId);
int ii = coustomAnalysisServiceImp.insertSendlog("MT3201",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 = arrivedmasterMapper.updateRECEIPTION(arrivedmaster);
//获取分单autoid
List<ARRIVEDMASTER> arrivedmasterList = arrivedmasterMapper.selectAutoIdByAwb(arrivedmaster);
if(!arrivedmasterList.isEmpty()){
ARRIVEDMASTER originMaster = arrivedmasterList.get(0);
String autoId = originMaster.getAutoid();
//插入sendlog记录表
log.info("即将插入日志运单号为:"+awbA+"->autoid="+autoId);
int ii =coustomAnalysisServiceImp.insertSendlog("MT3201",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 = arrivedmasterMapper.updateRECEIPTION(arrivedmaster);
//获取分单autoid
List<ARRIVEDMASTER> arrivedmasterList = arrivedmasterMapper.selectAutoIdByAwb(arrivedmaster);
if(!arrivedmasterList.isEmpty()){
ARRIVEDMASTER originMaster = arrivedmasterList.get(0);
String autoId = originMaster.getAutoid();
//插入sendlog记录表
log.info("即将插入日志运单号为:"+awbA+"->autoid="+autoId);
int ii =coustomAnalysisServiceImp.insertSendlog("MT3201",reception,autoId);
int iii = shareServiceImp.updateMessages(customReception);
if (i>0 && ii>0 && iii > 0){
return 1;
}
}
return 0;
}
return 0;
}
}else {
}else {
return shareServiceImp.share("MT3201", customReception);
return shareServiceImp.share("MT3201", customReception);
}
}
//未进入主分单解析 返回0 失败
return 0;
}
... ...
... ... @@ -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 失败
... ...
... ... @@ -6,6 +6,7 @@ import com.tianbo.analysis.model.DEPARTURESLOADING;
import com.tianbo.analysis.service.DEPARTURESLOADINGService;
import com.tianbo.util.Date.DateUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
... ... @@ -37,54 +38,54 @@ public class DEPARTURESLOADINGServiceImp implements DEPARTURESLOADINGService{
//回执内容
String reception = customReception.getResponseText();
String flightDateStr = customReception.getFlightDate();
Date flightDate = new Date();
if (flightDateStr != null){
flightDate = DateUtil.formatByyyyyMMdd(flightDateStr);
}
//设置主单回执、航班号、航班日期
DEPARTURESLOADING departuresloading = new DEPARTURESLOADING();
departuresloading.setReceiption(reception);
departuresloading.setFlightno(customReception.getFlightNo());
departuresloading.setFlightdate(flightDate);
if (!StringUtils.isEmpty(flightDateStr)) {
Date flightDate = DateUtil.formatByyyyyMMdd(flightDateStr);
//设置主单回执、航班号、航班日期
DEPARTURESLOADING departuresloading = new DEPARTURESLOADING();
departuresloading.setReceiption(reception);
departuresloading.setFlightno(customReception.getFlightNo());
departuresloading.setFlightdate(flightDate);
if (awbA!=null && awbA.length()>0){
StringBuffer stringBuffer = new StringBuffer(awbA);
stringBuffer.insert(3,"-");
awbA = stringBuffer.toString();
if (awbA!=null && awbA.length()>0){
StringBuffer stringBuffer = new StringBuffer(awbA);
stringBuffer.insert(3,"-");
awbA = stringBuffer.toString();
//设置主分单的 主单号
departuresloading.setWaybillno(awbA);
}
//设置主分单的 主单号
departuresloading.setWaybillno(awbA);
}
// 判断航班号 航班日期 是否为空
if (flightDate != null && customReception.getFlightNo() != null){
//处理主单格式,将海关回执的主单号58019316861,变为580-19316861
if (awbA!=null && awbA.length()>0){
//更新主单回执
int i = departuresloadingMapper.updateRECEIPTION(departuresloading);
//获取分单autoid
List<DEPARTURESLOADING> arrivedmasterList = departuresloadingMapper.selectAutoIdByAwb(departuresloading);
if(!arrivedmasterList.isEmpty()){
DEPARTURESLOADING departuresloading1 = arrivedmasterList.get(0);
String autoId = departuresloading1.getId();
//插入sendlog记录表
log.info("即将插入日志运单号为:"+awbA+"->autoid="+autoId);
int ii =coustomAnalysisServiceImp.insertSendlog("MT4201",reception,autoId);
int iii = shareServiceImp.updateMessages(customReception);
if (i>0 && ii>0 && iii > 0){
return 1;
// 判断航班号 航班日期 是否为空
if (flightDate != null && customReception.getFlightNo() != null){
//处理主单格式,将海关回执的主单号58019316861,变为580-19316861
if (awbA!=null && awbA.length()>0){
//更新主单回执
int i = departuresloadingMapper.updateRECEIPTION(departuresloading);
//获取分单autoid
List<DEPARTURESLOADING> arrivedmasterList = departuresloadingMapper.selectAutoIdByAwb(departuresloading);
if(!arrivedmasterList.isEmpty()){
DEPARTURESLOADING departuresloading1 = arrivedmasterList.get(0);
String autoId = departuresloading1.getId();
//插入sendlog记录表
log.info("即将插入日志运单号为:"+awbA+"->autoid="+autoId);
int ii =coustomAnalysisServiceImp.insertSendlog("MT4201",reception,autoId);
int iii = shareServiceImp.updateMessages(customReception);
if (i>0 && ii>0 && iii > 0){
return 1;
}
}
return 0;
}
return 0;
}else {
return shareServiceImp.share("MT4201", customReception);
}
}else {
return shareServiceImp.share("MT4201", customReception);
}
//未进入主分单解析 返回0 失败
return 0;
}
... ...
... ... @@ -8,6 +8,7 @@ import com.tianbo.analysis.model.PREPARESECONDARY;
import com.tianbo.analysis.service.PREPAREMASTERService;
import com.tianbo.util.Date.DateUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
... ... @@ -43,84 +44,84 @@ public class PREPAREMASTERServiceImp implements PREPAREMASTERService {
//回执内容
String reception = customReception.getResponseText();
String flightDateStr = customReception.getFlightDate();
Date flightDate = new Date();
if (flightDateStr != null){
flightDate = DateUtil.formatByyyyyMMdd(flightDateStr);
}
if (!StringUtils.isEmpty(flightDateStr)) {
Date flightDate = DateUtil.formatByyyyyMMdd(flightDateStr);
// 设置 接收运抵分单 回执
PREPARESECONDARY preparesecondary = new PREPARESECONDARY();
preparesecondary.setReceiptinformation(reception);
// 设置 接收运抵分单 回执
PREPARESECONDARY preparesecondary = new PREPARESECONDARY();
preparesecondary.setReceiptinformation(reception);
//设置主单回执、航班号、航班日期
PREPAREMASTER preparemaster = new PREPAREMASTER();
preparemaster.setReceiptinformation(reception);
preparemaster.setFlightno(customReception.getFlightNo());
preparemaster.setFlightdate(flightDate);
//设置主单回执、航班号、航班日期
PREPAREMASTER preparemaster = new PREPAREMASTER();
preparemaster.setReceiptinformation(reception);
preparemaster.setFlightno(customReception.getFlightNo());
preparemaster.setFlightdate(flightDate);
if (awbA!=null && awbA.length()>0){
StringBuffer stringBuffer = new StringBuffer(awbA);
stringBuffer.insert(3,"-");
awbA = stringBuffer.toString();
if (awbA!=null && awbA.length()>0){
StringBuffer stringBuffer = new StringBuffer(awbA);
stringBuffer.insert(3,"-");
awbA = stringBuffer.toString();
//设置主分单的 主单号
preparesecondary.setWaybillnomaster(awbA);
preparemaster.setWaybillnomaster(awbA);
}
//设置主分单的 主单号
preparesecondary.setWaybillnomaster(awbA);
preparemaster.setWaybillnomaster(awbA);
}
// 判断航班号 航班日期 是否为空
if (flightDate != null && customReception.getFlightNo() != null){
//有分单号 更新分单
if(awbA!=null && awbA.length()>0 && awbH!=null && awbH.length()> 0){
//取分单号
String[] awbhArr = awbH.split("_");
String awbh = awbhArr[1];
preparesecondary.setWaybillnosecondary(awbh);
//更新分单回执
int i = preparesecondaryMapper.updateRECEIPTION(preparesecondary);
//获取分单autoid
List<PREPARESECONDARY> arrivedsecondaryList = preparesecondaryMapper.selectAutoIdByawbAawbH(preparesecondary);
if(!arrivedsecondaryList.isEmpty()){
PREPARESECONDARY preparesecondary1 = arrivedsecondaryList.get(0);
String autoId = preparesecondary1.getAutoid();
//插入sendlog记录表
log.info("即将插入日志运单号为:"+awbH+"->autoid="+autoId);
int ii = coustomAnalysisServiceImp.insertSendlog("MT3201",reception,autoId);
int iii = shareServiceImp.updateMessages(customReception);
if (i>0 && ii>0 && iii > 0){
return 1;
// 判断航班号 航班日期 是否为空
if (flightDate != null && customReception.getFlightNo() != null){
//有分单号 更新分单
if(awbA!=null && awbA.length()>0 && awbH!=null && awbH.length()> 0){
//取分单号
String[] awbhArr = awbH.split("_");
String awbh = awbhArr[1];
preparesecondary.setWaybillnosecondary(awbh);
//更新分单回执
int i = preparesecondaryMapper.updateRECEIPTION(preparesecondary);
//获取分单autoid
List<PREPARESECONDARY> arrivedsecondaryList = preparesecondaryMapper.selectAutoIdByawbAawbH(preparesecondary);
if(!arrivedsecondaryList.isEmpty()){
PREPARESECONDARY preparesecondary1 = arrivedsecondaryList.get(0);
String autoId = preparesecondary1.getAutoid();
//插入sendlog记录表
log.info("即将插入日志运单号为:"+awbH+"->autoid="+autoId);
int ii = coustomAnalysisServiceImp.insertSendlog("MT3201",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 = preparemasterMapper.updateRECEIPTION(preparemaster);
//获取分单autoid
List<PREPAREMASTER> arrivedmasterList = preparemasterMapper.selectAutoIdByAwb(preparemaster);
if(!arrivedmasterList.isEmpty()){
PREPAREMASTER originMaster = arrivedmasterList.get(0);
String autoId = originMaster.getAutoid();
//插入sendlog记录表
log.info("即将插入日志运单号为:"+awbA+"->autoid="+autoId);
int ii =coustomAnalysisServiceImp.insertSendlog("MT3201",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 = preparemasterMapper.updateRECEIPTION(preparemaster);
//获取分单autoid
List<PREPAREMASTER> arrivedmasterList = preparemasterMapper.selectAutoIdByAwb(preparemaster);
if(!arrivedmasterList.isEmpty()){
PREPAREMASTER originMaster = arrivedmasterList.get(0);
String autoId = originMaster.getAutoid();
//插入sendlog记录表
log.info("即将插入日志运单号为:"+awbA+"->autoid="+autoId);
int ii =coustomAnalysisServiceImp.insertSendlog("MT3201",reception,autoId);
int iii = shareServiceImp.updateMessages(customReception);
if (i>0 && ii>0 && iii > 0){
return 1;
}
}
return 0;
}
return 0;
}
}else {
}else {
return shareServiceImp.share("MT2201", customReception);
return shareServiceImp.share("MT2201", customReception);
}
}
//未进入主分单解析 返回0 失败
... ...
... ... @@ -8,6 +8,7 @@ import com.tianbo.analysis.model.TALLYSECONDARY;
import com.tianbo.analysis.service.TALLYMASTERService;
import com.tianbo.util.Date.DateUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
... ... @@ -45,81 +46,80 @@ public class TALLYMASTERServiceImp implements TALLYMASTERService{
//回执内容
String reception = customReception.getResponseText();
String flightDateStr = customReception.getFlightDate();
Date flightDate = new Date();
if (flightDateStr != null){
flightDate = DateUtil.formatByyyyyMMdd(flightDateStr);
}
// 设置 进出港理货 回执
TALLYSECONDARY tallysecondary = new TALLYSECONDARY();
tallysecondary.setReceiptinformation(reception);
//设置进出港理货回执、航班号、航班日期
TALLYMASTER tallymaster = new TALLYMASTER();
tallymaster.setReceiptinformation(reception);
tallymaster.setFlightno(customReception.getFlightNo());
tallymaster.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();
//设置主分单的 主单号
tallysecondary.setWaybillnomaster(awbA);
tallymaster.setWaybillnomaster(awbA);
}
if (!StringUtils.isEmpty(flightDateStr)) {
Date flightDate = DateUtil.formatByyyyyMMdd(flightDateStr);
// 设置 进出港理货 回执
TALLYSECONDARY tallysecondary = new TALLYSECONDARY();
tallysecondary.setReceiptinformation(reception);
//设置进出港理货回执、航班号、航班日期
TALLYMASTER tallymaster = new TALLYMASTER();
tallymaster.setReceiptinformation(reception);
tallymaster.setFlightno(customReception.getFlightNo());
tallymaster.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();
//设置主分单的 主单号
tallysecondary.setWaybillnomaster(awbA);
tallymaster.setWaybillnomaster(awbA);
}
//有分单号 更新分单
if(awbA!=null && awbA.length()>0 && awbH!=null && awbH.length()> 0){
//取分单号
String[] awbhArr = awbH.split("_");
String awbh = awbhArr[1];
tallysecondary.setWaybillnosecondary(awbh);
//更新分单回执
int i = tallysecondaryMapper.updateRECEIPTION(tallysecondary);
//获取分单autoid
List<TALLYSECONDARY> tallysecondaryList = tallysecondaryMapper.selectAutoIdByawbAawbH(tallysecondary);
if(!tallysecondaryList.isEmpty()){
TALLYSECONDARY arrivedSecond = tallysecondaryList.get(0);
String autoId = arrivedSecond.getAutoid();
//插入sendlog记录表
log.info("即将插入日志运单号为:"+awbH+"->autoid="+autoId);
int ii = coustomAnalysisServiceImp.insertSendlog(mt,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];
tallysecondary.setWaybillnosecondary(awbh);
//更新分单回执
int i = tallysecondaryMapper.updateRECEIPTION(tallysecondary);
//获取分单autoid
List<TALLYSECONDARY> tallysecondaryList = tallysecondaryMapper.selectAutoIdByawbAawbH(tallysecondary);
if(!tallysecondaryList.isEmpty()){
TALLYSECONDARY arrivedSecond = tallysecondaryList.get(0);
String autoId = arrivedSecond.getAutoid();
//插入sendlog记录表
log.info("即将插入日志运单号为:"+awbH+"->autoid="+autoId);
int ii = coustomAnalysisServiceImp.insertSendlog(mt,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 = tallymasterMapper.updateRECEIPTION(tallymaster);
//获取分单autoid
List<TALLYMASTER> arrivedmasterList = tallymasterMapper.selectAutoIdByAwb(tallymaster);
if(!arrivedmasterList.isEmpty()){
TALLYMASTER originMaster = arrivedmasterList.get(0);
String autoId = originMaster.getAutoid();
//插入sendlog记录表
log.info("即将插入日志运单号为:"+awbA+"->autoid="+autoId);
int ii =coustomAnalysisServiceImp.insertSendlog(mt,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 = tallymasterMapper.updateRECEIPTION(tallymaster);
//获取分单autoid
List<TALLYMASTER> arrivedmasterList = tallymasterMapper.selectAutoIdByAwb(tallymaster);
if(!arrivedmasterList.isEmpty()){
TALLYMASTER originMaster = arrivedmasterList.get(0);
String autoId = originMaster.getAutoid();
//插入sendlog记录表
log.info("即将插入日志运单号为:"+awbA+"->autoid="+autoId);
int ii =coustomAnalysisServiceImp.insertSendlog(mt,reception,autoId);
int iii = shareServiceImp.updateMessages(customReception);
if (i>0 && ii>0 && iii > 0){
return 1;
}
}
return 0;
}
return 0;
}
}else {
}else {
return shareServiceImp.share("MT5202", customReception);
return shareServiceImp.share("MT5202", customReception);
}
}
//未进入主分单解析 返回0 失败
... ...
... ... @@ -251,14 +251,17 @@
UPDATE TALLYMASTER
SET RECEIPTINFORMATION= #{receiptinformation,jdbcType=VARCHAR}
WHERE WAYBILLNOMASTER = #{waybillnomaster,jdbcType=VARCHAR}
AND WAYBILLNOSECONDARY = #{waybillnosecondary,jdbcType=VARCHAR}
AND FLIGHTNO = #{flghtno, jdbcType=VARCHAR}
AND FLIGHTDATE = #{flightdate, jdbcType=TIMESTAMP}
</update>
<select id="selectAutoIdByawbAawbH" parameterType="com.tianbo.analysis.model.TALLYMASTER" resultType="com.tianbo.analysis.model.TALLYMASTER">
<select id="selectAutoIdByAwb" parameterType="com.tianbo.analysis.model.TALLYMASTER" resultType="com.tianbo.analysis.model.TALLYMASTER">
SELECT AUTOID
FROM TALLYMASTER
WHERE
WAYBILLNOMASTER = #{waybillnomaster,jdbcType=VARCHAR} AND WAYBILLNOSECONDARY = #{waybillnosecondary,jdbcType=VARCHAR}
WAYBILLNOMASTER = #{waybillnomaster,jdbcType=VARCHAR}
AND FLIGHTNO = #{flghtno, jdbcType=VARCHAR}
AND FLIGHTDATE = #{flightdate, jdbcType=TIMESTAMP}
</select>
</mapper>
\ No newline at end of file
... ...