作者 申海龙

service 逻辑 改动 添加 if判断

@@ -107,9 +107,12 @@ public class CustomXmlHandle{ @@ -107,9 +107,12 @@ public class CustomXmlHandle{
107 if(journeyid != null){ 107 if(journeyid != null){
108 108
109 String[] flightList = journeyid.split("/"); 109 String[] flightList = journeyid.split("/");
  110 + if(flightList.length > 0){
  111 + flightNo = flightList[0];
  112 + flightDate = flightList[1];
  113 + }
  114 +
110 115
111 - flightNo = flightList[0];  
112 - flightDate = flightList[1];  
113 } 116 }
114 117
115 String awbA = XMLXPath.getSingleValueByPath(document,waybillMaster); 118 String awbA = XMLXPath.getSingleValueByPath(document,waybillMaster);
@@ -8,6 +8,7 @@ import com.tianbo.analysis.model.CustomReception; @@ -8,6 +8,7 @@ import com.tianbo.analysis.model.CustomReception;
8 import com.tianbo.analysis.service.ARRIVEDMASTERService; 8 import com.tianbo.analysis.service.ARRIVEDMASTERService;
9 import com.tianbo.util.Date.DateUtil; 9 import com.tianbo.util.Date.DateUtil;
10 import lombok.extern.slf4j.Slf4j; 10 import lombok.extern.slf4j.Slf4j;
  11 +import org.apache.commons.lang.StringUtils;
11 import org.springframework.beans.factory.annotation.Autowired; 12 import org.springframework.beans.factory.annotation.Autowired;
12 import org.springframework.stereotype.Service; 13 import org.springframework.stereotype.Service;
13 14
@@ -45,85 +46,84 @@ public class ARRIVEDMASTERServiceImp implements ARRIVEDMASTERService { @@ -45,85 +46,84 @@ public class ARRIVEDMASTERServiceImp implements ARRIVEDMASTERService {
45 //回执内容 46 //回执内容
46 String reception = customReception.getResponseText(); 47 String reception = customReception.getResponseText();
47 String flightDateStr = customReception.getFlightDate(); 48 String flightDateStr = customReception.getFlightDate();
48 - Date flightDate = new Date();  
49 - if (flightDateStr != null){  
50 - flightDate = DateUtil.formatByyyyyMMdd(flightDateStr);  
51 - }  
52 49
53 - // 设置 接收运抵分单 回执  
54 - ARRIVEDSECONDARY arrivedsecondary = new ARRIVEDSECONDARY();  
55 - arrivedsecondary.setReceiption(reception);  
56 -  
57 - //设置主单回执、航班号、航班日期  
58 - ARRIVEDMASTER arrivedmaster = new ARRIVEDMASTER();  
59 - arrivedmaster.setReceiptinformation(reception);  
60 - arrivedmaster.setFlightno(customReception.getFlightNo());  
61 - arrivedmaster.setFlightdate(flightDate);  
62 -  
63 - // 判断航班号 航班日期 是否为空  
64 - if (flightDate != null && customReception.getFlightNo() != null){  
65 - if (awbA!=null && awbA.length()>0){  
66 - StringBuffer stringBuffer = new StringBuffer(awbA);  
67 - stringBuffer.insert(3,"-");  
68 - awbA = stringBuffer.toString();  
69 -  
70 - //设置主分单的 主单号  
71 - arrivedsecondary.setWaybillnomaster(awbA);  
72 - arrivedmaster.setWaybillnomaster(awbA);  
73 - } 50 + if (!StringUtils.isEmpty(flightDateStr)) {
  51 + Date flightDate = DateUtil.formatByyyyyMMdd(flightDateStr);
  52 +
  53 + // 设置 接收运抵分单 回执
  54 + ARRIVEDSECONDARY arrivedsecondary = new ARRIVEDSECONDARY();
  55 + arrivedsecondary.setReceiption(reception);
  56 +
  57 + //设置主单回执、航班号、航班日期
  58 + ARRIVEDMASTER arrivedmaster = new ARRIVEDMASTER();
  59 + arrivedmaster.setReceiptinformation(reception);
  60 + arrivedmaster.setFlightno(customReception.getFlightNo());
  61 + arrivedmaster.setFlightdate(flightDate);
  62 +
  63 + // 判断航班号 航班日期 是否为空
  64 + if (flightDate != null && customReception.getFlightNo() != null){
  65 + if (awbA!=null && awbA.length()>0){
  66 + StringBuffer stringBuffer = new StringBuffer(awbA);
  67 + stringBuffer.insert(3,"-");
  68 + awbA = stringBuffer.toString();
  69 +
  70 + //设置主分单的 主单号
  71 + arrivedsecondary.setWaybillnomaster(awbA);
  72 + arrivedmaster.setWaybillnomaster(awbA);
  73 + }
74 74
75 - //有分单号 更新分单  
76 - if(awbA!=null && awbA.length()>0 && awbH!=null && awbH.length()> 0){  
77 - //取分单号  
78 - String[] awbhArr = awbH.split("_");  
79 - String awbh = awbhArr[1];  
80 - arrivedsecondary.setWaybillnosecondary(awbh);  
81 - //更新分单回执  
82 - int i = arrivedsecondaryMapper.updateRECEIPTION(arrivedsecondary);  
83 - //获取分单autoid  
84 - List<ARRIVEDSECONDARY> arrivedsecondaryList = arrivedsecondaryMapper.selectAutoIdByawbAawbH(arrivedsecondary);  
85 - if(!arrivedsecondaryList.isEmpty()){  
86 - ARRIVEDSECONDARY arrivedSecond = arrivedsecondaryList.get(0);  
87 - String autoId = arrivedSecond.getAutoid();  
88 - //插入sendlog记录表  
89 - log.info("即将插入日志运单号为:"+awbH+"->autoid="+autoId);  
90 - int ii = coustomAnalysisServiceImp.insertSendlog("MT3201",reception,autoId);  
91 -  
92 - int iii = shareServiceImp.updateMessages(customReception);  
93 - if (i>0 && ii>0 && iii > 0){  
94 - return 1; 75 + //有分单号 更新分单
  76 + if(awbA!=null && awbA.length()>0 && awbH!=null && awbH.length()> 0){
  77 + //取分单号
  78 + String[] awbhArr = awbH.split("_");
  79 + String awbh = awbhArr[1];
  80 + arrivedsecondary.setWaybillnosecondary(awbh);
  81 + //更新分单回执
  82 + int i = arrivedsecondaryMapper.updateRECEIPTION(arrivedsecondary);
  83 + //获取分单autoid
  84 + List<ARRIVEDSECONDARY> arrivedsecondaryList = arrivedsecondaryMapper.selectAutoIdByawbAawbH(arrivedsecondary);
  85 + if(!arrivedsecondaryList.isEmpty()){
  86 + ARRIVEDSECONDARY arrivedSecond = arrivedsecondaryList.get(0);
  87 + String autoId = arrivedSecond.getAutoid();
  88 + //插入sendlog记录表
  89 + log.info("即将插入日志运单号为:"+awbH+"->autoid="+autoId);
  90 + int ii = coustomAnalysisServiceImp.insertSendlog("MT3201",reception,autoId);
  91 +
  92 + int iii = shareServiceImp.updateMessages(customReception);
  93 + if (i>0 && ii>0 && iii > 0){
  94 + return 1;
  95 + }
95 } 96 }
  97 + return 0;
96 } 98 }
97 - return 0;  
98 - }  
99 99
100 - //处理主单格式,将海关回执的主单号58019316861,变为580-19316861  
101 - if (awbA!=null && awbA.length()>0){  
102 - //更新主单回执  
103 - int i = arrivedmasterMapper.updateRECEIPTION(arrivedmaster);  
104 - //获取分单autoid  
105 - List<ARRIVEDMASTER> arrivedmasterList = arrivedmasterMapper.selectAutoIdByAwb(arrivedmaster);  
106 - if(!arrivedmasterList.isEmpty()){  
107 - ARRIVEDMASTER originMaster = arrivedmasterList.get(0);  
108 - String autoId = originMaster.getAutoid();  
109 -  
110 - //插入sendlog记录表  
111 - log.info("即将插入日志运单号为:"+awbA+"->autoid="+autoId);  
112 - int ii =coustomAnalysisServiceImp.insertSendlog("MT3201",reception,autoId);  
113 -  
114 - int iii = shareServiceImp.updateMessages(customReception);  
115 - if (i>0 && ii>0 && iii > 0){  
116 - return 1; 100 + //处理主单格式,将海关回执的主单号58019316861,变为580-19316861
  101 + if (awbA!=null && awbA.length()>0){
  102 + //更新主单回执
  103 + int i = arrivedmasterMapper.updateRECEIPTION(arrivedmaster);
  104 + //获取分单autoid
  105 + List<ARRIVEDMASTER> arrivedmasterList = arrivedmasterMapper.selectAutoIdByAwb(arrivedmaster);
  106 + if(!arrivedmasterList.isEmpty()){
  107 + ARRIVEDMASTER originMaster = arrivedmasterList.get(0);
  108 + String autoId = originMaster.getAutoid();
  109 +
  110 + //插入sendlog记录表
  111 + log.info("即将插入日志运单号为:"+awbA+"->autoid="+autoId);
  112 + int ii =coustomAnalysisServiceImp.insertSendlog("MT3201",reception,autoId);
  113 +
  114 + int iii = shareServiceImp.updateMessages(customReception);
  115 + if (i>0 && ii>0 && iii > 0){
  116 + return 1;
  117 + }
117 } 118 }
  119 + return 0;
118 } 120 }
119 - return 0;  
120 - }  
121 - }else { 121 + }else {
122 122
123 - return shareServiceImp.share("MT3201", customReception); 123 + return shareServiceImp.share("MT3201", customReception);
  124 + }
124 } 125 }
125 126
126 -  
127 //未进入主分单解析 返回0 失败 127 //未进入主分单解析 返回0 失败
128 return 0; 128 return 0;
129 } 129 }
@@ -11,6 +11,7 @@ import com.tianbo.analysis.service.CoustomAnalysisService; @@ -11,6 +11,7 @@ import com.tianbo.analysis.service.CoustomAnalysisService;
11 import com.tianbo.util.Date.DateUtil; 11 import com.tianbo.util.Date.DateUtil;
12 import com.tianbo.util.Helper; 12 import com.tianbo.util.Helper;
13 import lombok.extern.slf4j.Slf4j; 13 import lombok.extern.slf4j.Slf4j;
  14 +import org.apache.commons.lang.StringUtils;
14 import org.springframework.beans.factory.annotation.Autowired; 15 import org.springframework.beans.factory.annotation.Autowired;
15 import org.springframework.stereotype.Service; 16 import org.springframework.stereotype.Service;
16 17
@@ -42,84 +43,81 @@ public class CoustomAnalysisServiceImp implements CoustomAnalysisService { @@ -42,84 +43,81 @@ public class CoustomAnalysisServiceImp implements CoustomAnalysisService {
42 String reception = customReception.getResponseText(); 43 String reception = customReception.getResponseText();
43 String flightDateStr = customReception.getFlightDate(); 44 String flightDateStr = customReception.getFlightDate();
44 45
45 - Date flightDate = new Date();  
46 - if (flightDateStr != null){  
47 - flightDate = DateUtil.formatByyyyyMMdd(flightDateStr);  
48 - }  
49 -  
50 -  
51 - // 设置分单回执  
52 - Originmanifestsecondary originmanifestsecondary = new Originmanifestsecondary();  
53 - originmanifestsecondary.setReceiption(reception);  
54 -  
55 - // 设置主单回执、航班号、航班日期  
56 - ORIGINMANIFESTMASTER originmanifestmaster = new ORIGINMANIFESTMASTER();  
57 - originmanifestmaster.setReceiptinformation(reception);  
58 - originmanifestmaster.setFlightno(customReception.getFlightNo());  
59 - originmanifestmaster.setFlightDate(flightDate);  
60 -  
61 - // 判断航班号 航班日期 是否为空  
62 - if (flightDate != null && customReception.getFlightNo() != null){  
63 - if (awbA!=null && awbA.length()>0){  
64 - StringBuffer stringBuffer = new StringBuffer(awbA);  
65 - stringBuffer.insert(3,"-");  
66 - awbA = stringBuffer.toString();  
67 -  
68 - //设置主分单的 主单号  
69 - originmanifestsecondary.setWaybillnomaster(awbA);  
70 - originmanifestmaster.setWaybillnomaster(awbA);  
71 - } 46 +// Date flightDate = new Date();
  47 + if (!StringUtils.isEmpty(flightDateStr)){
  48 + Date flightDate = DateUtil.formatByyyyyMMdd(flightDateStr);
  49 +
  50 + // 设置分单回执
  51 + Originmanifestsecondary originmanifestsecondary = new Originmanifestsecondary();
  52 + originmanifestsecondary.setReceiption(reception);
  53 +
  54 + // 设置主单回执、航班号、航班日期
  55 + ORIGINMANIFESTMASTER originmanifestmaster = new ORIGINMANIFESTMASTER();
  56 + originmanifestmaster.setReceiptinformation(reception);
  57 + originmanifestmaster.setFlightno(customReception.getFlightNo());
  58 + originmanifestmaster.setFlightDate(flightDate);
  59 +
  60 + // 判断航班号 航班日期 是否为空
  61 + if (flightDate != null && customReception.getFlightNo() != null){
  62 + if (awbA!=null && awbA.length()>0){
  63 + StringBuffer stringBuffer = new StringBuffer(awbA);
  64 + stringBuffer.insert(3,"-");
  65 + awbA = stringBuffer.toString();
  66 +
  67 + //设置主分单的 主单号
  68 + originmanifestsecondary.setWaybillnomaster(awbA);
  69 + originmanifestmaster.setWaybillnomaster(awbA);
  70 + }
72 71
73 - //有分单号 更新分单  
74 - if(awbA!=null && awbA.length()>0 && awbH!=null && awbH.length()> 0){  
75 - //取分单号  
76 - String[] awbhArr = awbH.split("_");  
77 - String awbh = awbhArr[1];  
78 - originmanifestsecondary.setWaybillnosecondary(awbh);  
79 - //更新分单回执  
80 - int i = originmanifestsecondaryMapper.updateRECEIPTION(originmanifestsecondary);  
81 - //获取分单autoid  
82 - List<Originmanifestsecondary> originmanifestsecondaryList = originmanifestsecondaryMapper.selectAutoIdByawbAawbH(originmanifestsecondary);  
83 - if(!originmanifestsecondaryList.isEmpty()){  
84 - Originmanifestsecondary originSecond = originmanifestsecondaryList.get(0);  
85 - String autoId = originSecond.getAutoid();  
86 - //插入sendlog记录表  
87 - log.info("即将插入日志运单号为:"+awbH+"->autoid="+autoId);  
88 - int ii = insertSendlog("MT1201",reception,autoId);  
89 -  
90 - int iii = shareServiceImp.updateMessages(customReception);  
91 - if (i>0 && ii>0 && iii > 0){  
92 - return 1; 72 + //有分单号 更新分单
  73 + if(awbA!=null && awbA.length()>0 && awbH!=null && awbH.length()> 0){
  74 + //取分单号
  75 + String[] awbhArr = awbH.split("_");
  76 + String awbh = awbhArr[1];
  77 + originmanifestsecondary.setWaybillnosecondary(awbh);
  78 + //更新分单回执
  79 + int i = originmanifestsecondaryMapper.updateRECEIPTION(originmanifestsecondary);
  80 + //获取分单autoid
  81 + List<Originmanifestsecondary> originmanifestsecondaryList = originmanifestsecondaryMapper.selectAutoIdByawbAawbH(originmanifestsecondary);
  82 + if(!originmanifestsecondaryList.isEmpty()){
  83 + Originmanifestsecondary originSecond = originmanifestsecondaryList.get(0);
  84 + String autoId = originSecond.getAutoid();
  85 + //插入sendlog记录表
  86 + log.info("即将插入日志运单号为:"+awbH+"->autoid="+autoId);
  87 + int ii = insertSendlog("MT1201",reception,autoId);
  88 +
  89 + int iii = shareServiceImp.updateMessages(customReception);
  90 + if (i>0 && ii>0 && iii > 0){
  91 + return 1;
  92 + }
93 } 93 }
  94 + return 0;
94 } 95 }
95 - return 0;  
96 - }  
97 96
98 - //处理主单格式,将海关回执的主单号58019316861,变为580-19316861  
99 - if (awbA!=null && awbA.length()>0){  
100 - //更新主单回执  
101 - int i = originmanifestmasterMapper.updateRECEIPTION(originmanifestmaster);  
102 - //获取分单autoid  
103 - List<ORIGINMANIFESTMASTER> originmanifestmasterList = originmanifestmasterMapper.selectAutoIdByAwb(originmanifestmaster);  
104 - if(!originmanifestmasterList.isEmpty()){  
105 - ORIGINMANIFESTMASTER originMaster = originmanifestmasterList.get(0);  
106 - String autoId = originMaster.getAutoid();  
107 -  
108 - //插入sendlog记录表  
109 - log.info("即将插入日志运单号为:"+awbA+"->autoid="+autoId);  
110 - int ii =insertSendlog("MT1201",reception,autoId);  
111 -  
112 - int iii = shareServiceImp.updateMessages(customReception);  
113 - if (i>0 && ii>0 && iii > 0){  
114 - return 1; 97 + //处理主单格式,将海关回执的主单号58019316861,变为580-19316861
  98 + if (awbA!=null && awbA.length()>0){
  99 + //更新主单回执
  100 + int i = originmanifestmasterMapper.updateRECEIPTION(originmanifestmaster);
  101 + //获取分单autoid
  102 + List<ORIGINMANIFESTMASTER> originmanifestmasterList = originmanifestmasterMapper.selectAutoIdByAwb(originmanifestmaster);
  103 + if(!originmanifestmasterList.isEmpty()){
  104 + ORIGINMANIFESTMASTER originMaster = originmanifestmasterList.get(0);
  105 + String autoId = originMaster.getAutoid();
  106 +
  107 + //插入sendlog记录表
  108 + log.info("即将插入日志运单号为:"+awbA+"->autoid="+autoId);
  109 + int ii =insertSendlog("MT1201",reception,autoId);
  110 +
  111 + int iii = shareServiceImp.updateMessages(customReception);
  112 + if (i>0 && ii>0 && iii > 0){
  113 + return 1;
  114 + }
115 } 115 }
  116 + return 0;
116 } 117 }
117 - return 0; 118 + }else {
  119 + return shareServiceImp.share("MT1201", customReception);
118 } 120 }
119 - }else {  
120 -  
121 -  
122 - return shareServiceImp.share("MT1201", customReception);  
123 } 121 }
124 122
125 //未进入主分单解析 返回0 失败 123 //未进入主分单解析 返回0 失败
@@ -6,6 +6,7 @@ import com.tianbo.analysis.model.DEPARTURESLOADING; @@ -6,6 +6,7 @@ import com.tianbo.analysis.model.DEPARTURESLOADING;
6 import com.tianbo.analysis.service.DEPARTURESLOADINGService; 6 import com.tianbo.analysis.service.DEPARTURESLOADINGService;
7 import com.tianbo.util.Date.DateUtil; 7 import com.tianbo.util.Date.DateUtil;
8 import lombok.extern.slf4j.Slf4j; 8 import lombok.extern.slf4j.Slf4j;
  9 +import org.apache.commons.lang.StringUtils;
9 import org.springframework.beans.factory.annotation.Autowired; 10 import org.springframework.beans.factory.annotation.Autowired;
10 import org.springframework.stereotype.Service; 11 import org.springframework.stereotype.Service;
11 12
@@ -37,54 +38,54 @@ public class DEPARTURESLOADINGServiceImp implements DEPARTURESLOADINGService{ @@ -37,54 +38,54 @@ public class DEPARTURESLOADINGServiceImp implements DEPARTURESLOADINGService{
37 //回执内容 38 //回执内容
38 String reception = customReception.getResponseText(); 39 String reception = customReception.getResponseText();
39 String flightDateStr = customReception.getFlightDate(); 40 String flightDateStr = customReception.getFlightDate();
40 - Date flightDate = new Date();  
41 - if (flightDateStr != null){  
42 - flightDate = DateUtil.formatByyyyyMMdd(flightDateStr);  
43 - }  
44 -  
45 - //设置主单回执、航班号、航班日期  
46 - DEPARTURESLOADING departuresloading = new DEPARTURESLOADING();  
47 - departuresloading.setReceiption(reception);  
48 - departuresloading.setFlightno(customReception.getFlightNo());  
49 - departuresloading.setFlightdate(flightDate); 41 + if (!StringUtils.isEmpty(flightDateStr)) {
  42 + Date flightDate = DateUtil.formatByyyyyMMdd(flightDateStr);
  43 + //设置主单回执、航班号、航班日期
  44 + DEPARTURESLOADING departuresloading = new DEPARTURESLOADING();
  45 + departuresloading.setReceiption(reception);
  46 + departuresloading.setFlightno(customReception.getFlightNo());
  47 + departuresloading.setFlightdate(flightDate);
50 48
51 - if (awbA!=null && awbA.length()>0){  
52 - StringBuffer stringBuffer = new StringBuffer(awbA);  
53 - stringBuffer.insert(3,"-");  
54 - awbA = stringBuffer.toString(); 49 + if (awbA!=null && awbA.length()>0){
  50 + StringBuffer stringBuffer = new StringBuffer(awbA);
  51 + stringBuffer.insert(3,"-");
  52 + awbA = stringBuffer.toString();
55 53
56 - //设置主分单的 主单号  
57 - departuresloading.setWaybillno(awbA);  
58 - } 54 + //设置主分单的 主单号
  55 + departuresloading.setWaybillno(awbA);
  56 + }
59 57
60 58
61 - // 判断航班号 航班日期 是否为空  
62 - if (flightDate != null && customReception.getFlightNo() != null){  
63 - //处理主单格式,将海关回执的主单号58019316861,变为580-19316861  
64 - if (awbA!=null && awbA.length()>0){  
65 - //更新主单回执  
66 - int i = departuresloadingMapper.updateRECEIPTION(departuresloading);  
67 - //获取分单autoid  
68 - List<DEPARTURESLOADING> arrivedmasterList = departuresloadingMapper.selectAutoIdByAwb(departuresloading);  
69 - if(!arrivedmasterList.isEmpty()){  
70 - DEPARTURESLOADING departuresloading1 = arrivedmasterList.get(0);  
71 - String autoId = departuresloading1.getId();  
72 -  
73 - //插入sendlog记录表  
74 - log.info("即将插入日志运单号为:"+awbA+"->autoid="+autoId);  
75 - int ii =coustomAnalysisServiceImp.insertSendlog("MT4201",reception,autoId);  
76 -  
77 - int iii = shareServiceImp.updateMessages(customReception);  
78 - if (i>0 && ii>0 && iii > 0){  
79 - return 1; 59 + // 判断航班号 航班日期 是否为空
  60 + if (flightDate != null && customReception.getFlightNo() != null){
  61 + //处理主单格式,将海关回执的主单号58019316861,变为580-19316861
  62 + if (awbA!=null && awbA.length()>0){
  63 + //更新主单回执
  64 + int i = departuresloadingMapper.updateRECEIPTION(departuresloading);
  65 + //获取分单autoid
  66 + List<DEPARTURESLOADING> arrivedmasterList = departuresloadingMapper.selectAutoIdByAwb(departuresloading);
  67 + if(!arrivedmasterList.isEmpty()){
  68 + DEPARTURESLOADING departuresloading1 = arrivedmasterList.get(0);
  69 + String autoId = departuresloading1.getId();
  70 +
  71 + //插入sendlog记录表
  72 + log.info("即将插入日志运单号为:"+awbA+"->autoid="+autoId);
  73 + int ii =coustomAnalysisServiceImp.insertSendlog("MT4201",reception,autoId);
  74 +
  75 + int iii = shareServiceImp.updateMessages(customReception);
  76 + if (i>0 && ii>0 && iii > 0){
  77 + return 1;
  78 + }
80 } 79 }
  80 + return 0;
81 } 81 }
82 - return 0; 82 + }else {
  83 +
  84 + return shareServiceImp.share("MT4201", customReception);
83 } 85 }
84 - }else {  
85 86
86 - return shareServiceImp.share("MT4201", customReception);  
87 } 87 }
  88 +
88 //未进入主分单解析 返回0 失败 89 //未进入主分单解析 返回0 失败
89 return 0; 90 return 0;
90 } 91 }
@@ -8,6 +8,7 @@ import com.tianbo.analysis.model.PREPARESECONDARY; @@ -8,6 +8,7 @@ import com.tianbo.analysis.model.PREPARESECONDARY;
8 import com.tianbo.analysis.service.PREPAREMASTERService; 8 import com.tianbo.analysis.service.PREPAREMASTERService;
9 import com.tianbo.util.Date.DateUtil; 9 import com.tianbo.util.Date.DateUtil;
10 import lombok.extern.slf4j.Slf4j; 10 import lombok.extern.slf4j.Slf4j;
  11 +import org.apache.commons.lang.StringUtils;
11 import org.springframework.beans.factory.annotation.Autowired; 12 import org.springframework.beans.factory.annotation.Autowired;
12 import org.springframework.stereotype.Service; 13 import org.springframework.stereotype.Service;
13 14
@@ -43,84 +44,84 @@ public class PREPAREMASTERServiceImp implements PREPAREMASTERService { @@ -43,84 +44,84 @@ public class PREPAREMASTERServiceImp implements PREPAREMASTERService {
43 //回执内容 44 //回执内容
44 String reception = customReception.getResponseText(); 45 String reception = customReception.getResponseText();
45 String flightDateStr = customReception.getFlightDate(); 46 String flightDateStr = customReception.getFlightDate();
46 - Date flightDate = new Date();  
47 - if (flightDateStr != null){  
48 - flightDate = DateUtil.formatByyyyyMMdd(flightDateStr);  
49 - } 47 + if (!StringUtils.isEmpty(flightDateStr)) {
  48 + Date flightDate = DateUtil.formatByyyyyMMdd(flightDateStr);
50 49
51 - // 设置 接收运抵分单 回执  
52 - PREPARESECONDARY preparesecondary = new PREPARESECONDARY();  
53 - preparesecondary.setReceiptinformation(reception); 50 + // 设置 接收运抵分单 回执
  51 + PREPARESECONDARY preparesecondary = new PREPARESECONDARY();
  52 + preparesecondary.setReceiptinformation(reception);
54 53
55 - //设置主单回执、航班号、航班日期  
56 - PREPAREMASTER preparemaster = new PREPAREMASTER();  
57 - preparemaster.setReceiptinformation(reception);  
58 - preparemaster.setFlightno(customReception.getFlightNo());  
59 - preparemaster.setFlightdate(flightDate); 54 + //设置主单回执、航班号、航班日期
  55 + PREPAREMASTER preparemaster = new PREPAREMASTER();
  56 + preparemaster.setReceiptinformation(reception);
  57 + preparemaster.setFlightno(customReception.getFlightNo());
  58 + preparemaster.setFlightdate(flightDate);
60 59
61 - if (awbA!=null && awbA.length()>0){  
62 - StringBuffer stringBuffer = new StringBuffer(awbA);  
63 - stringBuffer.insert(3,"-");  
64 - awbA = stringBuffer.toString(); 60 + if (awbA!=null && awbA.length()>0){
  61 + StringBuffer stringBuffer = new StringBuffer(awbA);
  62 + stringBuffer.insert(3,"-");
  63 + awbA = stringBuffer.toString();
65 64
66 - //设置主分单的 主单号  
67 - preparesecondary.setWaybillnomaster(awbA);  
68 - preparemaster.setWaybillnomaster(awbA);  
69 - } 65 + //设置主分单的 主单号
  66 + preparesecondary.setWaybillnomaster(awbA);
  67 + preparemaster.setWaybillnomaster(awbA);
  68 + }
70 69
71 70
72 - // 判断航班号 航班日期 是否为空  
73 - if (flightDate != null && customReception.getFlightNo() != null){  
74 - //有分单号 更新分单  
75 - if(awbA!=null && awbA.length()>0 && awbH!=null && awbH.length()> 0){  
76 - //取分单号  
77 - String[] awbhArr = awbH.split("_");  
78 - String awbh = awbhArr[1];  
79 - preparesecondary.setWaybillnosecondary(awbh);  
80 - //更新分单回执  
81 - int i = preparesecondaryMapper.updateRECEIPTION(preparesecondary);  
82 - //获取分单autoid  
83 - List<PREPARESECONDARY> arrivedsecondaryList = preparesecondaryMapper.selectAutoIdByawbAawbH(preparesecondary);  
84 - if(!arrivedsecondaryList.isEmpty()){  
85 - PREPARESECONDARY preparesecondary1 = arrivedsecondaryList.get(0);  
86 - String autoId = preparesecondary1.getAutoid();  
87 - //插入sendlog记录表  
88 - log.info("即将插入日志运单号为:"+awbH+"->autoid="+autoId);  
89 - int ii = coustomAnalysisServiceImp.insertSendlog("MT3201",reception,autoId);  
90 -  
91 - int iii = shareServiceImp.updateMessages(customReception);  
92 - if (i>0 && ii>0 && iii > 0){  
93 - return 1; 71 + // 判断航班号 航班日期 是否为空
  72 + if (flightDate != null && customReception.getFlightNo() != null){
  73 + //有分单号 更新分单
  74 + if(awbA!=null && awbA.length()>0 && awbH!=null && awbH.length()> 0){
  75 + //取分单号
  76 + String[] awbhArr = awbH.split("_");
  77 + String awbh = awbhArr[1];
  78 + preparesecondary.setWaybillnosecondary(awbh);
  79 + //更新分单回执
  80 + int i = preparesecondaryMapper.updateRECEIPTION(preparesecondary);
  81 + //获取分单autoid
  82 + List<PREPARESECONDARY> arrivedsecondaryList = preparesecondaryMapper.selectAutoIdByawbAawbH(preparesecondary);
  83 + if(!arrivedsecondaryList.isEmpty()){
  84 + PREPARESECONDARY preparesecondary1 = arrivedsecondaryList.get(0);
  85 + String autoId = preparesecondary1.getAutoid();
  86 + //插入sendlog记录表
  87 + log.info("即将插入日志运单号为:"+awbH+"->autoid="+autoId);
  88 + int ii = coustomAnalysisServiceImp.insertSendlog("MT3201",reception,autoId);
  89 +
  90 + int iii = shareServiceImp.updateMessages(customReception);
  91 + if (i>0 && ii>0 && iii > 0){
  92 + return 1;
  93 + }
94 } 94 }
  95 + return 0;
95 } 96 }
96 - return 0;  
97 - }  
98 97
99 - //处理主单格式,将海关回执的主单号58019316861,变为580-19316861  
100 - if (awbA!=null && awbA.length()>0){  
101 - //更新主单回执  
102 - int i = preparemasterMapper.updateRECEIPTION(preparemaster);  
103 - //获取分单autoid  
104 - List<PREPAREMASTER> arrivedmasterList = preparemasterMapper.selectAutoIdByAwb(preparemaster);  
105 - if(!arrivedmasterList.isEmpty()){  
106 - PREPAREMASTER originMaster = arrivedmasterList.get(0);  
107 - String autoId = originMaster.getAutoid();  
108 -  
109 - //插入sendlog记录表  
110 - log.info("即将插入日志运单号为:"+awbA+"->autoid="+autoId);  
111 - int ii =coustomAnalysisServiceImp.insertSendlog("MT3201",reception,autoId);  
112 -  
113 - int iii = shareServiceImp.updateMessages(customReception);  
114 - if (i>0 && ii>0 && iii > 0){  
115 - return 1; 98 + //处理主单格式,将海关回执的主单号58019316861,变为580-19316861
  99 + if (awbA!=null && awbA.length()>0){
  100 + //更新主单回执
  101 + int i = preparemasterMapper.updateRECEIPTION(preparemaster);
  102 + //获取分单autoid
  103 + List<PREPAREMASTER> arrivedmasterList = preparemasterMapper.selectAutoIdByAwb(preparemaster);
  104 + if(!arrivedmasterList.isEmpty()){
  105 + PREPAREMASTER originMaster = arrivedmasterList.get(0);
  106 + String autoId = originMaster.getAutoid();
  107 +
  108 + //插入sendlog记录表
  109 + log.info("即将插入日志运单号为:"+awbA+"->autoid="+autoId);
  110 + int ii =coustomAnalysisServiceImp.insertSendlog("MT3201",reception,autoId);
  111 +
  112 + int iii = shareServiceImp.updateMessages(customReception);
  113 + if (i>0 && ii>0 && iii > 0){
  114 + return 1;
  115 + }
116 } 116 }
  117 + return 0;
117 } 118 }
118 - return 0;  
119 - }  
120 - }else { 119 + }else {
121 120
122 121
123 - return shareServiceImp.share("MT2201", customReception); 122 + return shareServiceImp.share("MT2201", customReception);
  123 + }
  124 +
124 } 125 }
125 126
126 //未进入主分单解析 返回0 失败 127 //未进入主分单解析 返回0 失败
@@ -8,6 +8,7 @@ import com.tianbo.analysis.model.TALLYSECONDARY; @@ -8,6 +8,7 @@ import com.tianbo.analysis.model.TALLYSECONDARY;
8 import com.tianbo.analysis.service.TALLYMASTERService; 8 import com.tianbo.analysis.service.TALLYMASTERService;
9 import com.tianbo.util.Date.DateUtil; 9 import com.tianbo.util.Date.DateUtil;
10 import lombok.extern.slf4j.Slf4j; 10 import lombok.extern.slf4j.Slf4j;
  11 +import org.apache.commons.lang.StringUtils;
11 import org.springframework.beans.factory.annotation.Autowired; 12 import org.springframework.beans.factory.annotation.Autowired;
12 import org.springframework.stereotype.Service; 13 import org.springframework.stereotype.Service;
13 14
@@ -45,81 +46,80 @@ public class TALLYMASTERServiceImp implements TALLYMASTERService{ @@ -45,81 +46,80 @@ public class TALLYMASTERServiceImp implements TALLYMASTERService{
45 //回执内容 46 //回执内容
46 String reception = customReception.getResponseText(); 47 String reception = customReception.getResponseText();
47 String flightDateStr = customReception.getFlightDate(); 48 String flightDateStr = customReception.getFlightDate();
48 - Date flightDate = new Date();  
49 - if (flightDateStr != null){  
50 - flightDate = DateUtil.formatByyyyyMMdd(flightDateStr);  
51 - }  
52 49
53 - // 设置 进出港理货 回执  
54 - TALLYSECONDARY tallysecondary = new TALLYSECONDARY();  
55 - tallysecondary.setReceiptinformation(reception);  
56 -  
57 - //设置进出港理货回执、航班号、航班日期  
58 - TALLYMASTER tallymaster = new TALLYMASTER();  
59 - tallymaster.setReceiptinformation(reception);  
60 - tallymaster.setFlightno(customReception.getFlightNo());  
61 - tallymaster.setFlightdate(flightDate);  
62 - // 判断航班号 航班日期 是否为空  
63 - if (flightDate != null && customReception.getFlightNo() != null){  
64 - if (awbA!=null && awbA.length()>0){  
65 - StringBuffer stringBuffer = new StringBuffer(awbA);  
66 - stringBuffer.insert(3,"-");  
67 - awbA = stringBuffer.toString();  
68 -  
69 - //设置主分单的 主单号  
70 - tallysecondary.setWaybillnomaster(awbA);  
71 - tallymaster.setWaybillnomaster(awbA);  
72 - } 50 + if (!StringUtils.isEmpty(flightDateStr)) {
  51 + Date flightDate = DateUtil.formatByyyyyMMdd(flightDateStr);
  52 + // 设置 进出港理货 回执
  53 + TALLYSECONDARY tallysecondary = new TALLYSECONDARY();
  54 + tallysecondary.setReceiptinformation(reception);
  55 +
  56 + //设置进出港理货回执、航班号、航班日期
  57 + TALLYMASTER tallymaster = new TALLYMASTER();
  58 + tallymaster.setReceiptinformation(reception);
  59 + tallymaster.setFlightno(customReception.getFlightNo());
  60 + tallymaster.setFlightdate(flightDate);
  61 + // 判断航班号 航班日期 是否为空
  62 + if (flightDate != null && customReception.getFlightNo() != null){
  63 + if (awbA!=null && awbA.length()>0){
  64 + StringBuffer stringBuffer = new StringBuffer(awbA);
  65 + stringBuffer.insert(3,"-");
  66 + awbA = stringBuffer.toString();
  67 +
  68 + //设置主分单的 主单号
  69 + tallysecondary.setWaybillnomaster(awbA);
  70 + tallymaster.setWaybillnomaster(awbA);
  71 + }
73 72
74 - //有分单号 更新分单  
75 - if(awbA!=null && awbA.length()>0 && awbH!=null && awbH.length()> 0){  
76 - //取分单号  
77 - String[] awbhArr = awbH.split("_");  
78 - String awbh = awbhArr[1];  
79 - tallysecondary.setWaybillnosecondary(awbh);  
80 - //更新分单回执  
81 - int i = tallysecondaryMapper.updateRECEIPTION(tallysecondary);  
82 - //获取分单autoid  
83 - List<TALLYSECONDARY> tallysecondaryList = tallysecondaryMapper.selectAutoIdByawbAawbH(tallysecondary);  
84 - if(!tallysecondaryList.isEmpty()){  
85 - TALLYSECONDARY arrivedSecond = tallysecondaryList.get(0);  
86 - String autoId = arrivedSecond.getAutoid();  
87 - //插入sendlog记录表  
88 - log.info("即将插入日志运单号为:"+awbH+"->autoid="+autoId);  
89 - int ii = coustomAnalysisServiceImp.insertSendlog(mt,reception,autoId);  
90 -  
91 - int iii = shareServiceImp.updateMessages(customReception);  
92 - if (i>0 && ii>0 && iii > 0){  
93 - return 1; 73 + //有分单号 更新分单
  74 + if(awbA!=null && awbA.length()>0 && awbH!=null && awbH.length()> 0){
  75 + //取分单号
  76 + String[] awbhArr = awbH.split("_");
  77 + String awbh = awbhArr[1];
  78 + tallysecondary.setWaybillnosecondary(awbh);
  79 + //更新分单回执
  80 + int i = tallysecondaryMapper.updateRECEIPTION(tallysecondary);
  81 + //获取分单autoid
  82 + List<TALLYSECONDARY> tallysecondaryList = tallysecondaryMapper.selectAutoIdByawbAawbH(tallysecondary);
  83 + if(!tallysecondaryList.isEmpty()){
  84 + TALLYSECONDARY arrivedSecond = tallysecondaryList.get(0);
  85 + String autoId = arrivedSecond.getAutoid();
  86 + //插入sendlog记录表
  87 + log.info("即将插入日志运单号为:"+awbH+"->autoid="+autoId);
  88 + int ii = coustomAnalysisServiceImp.insertSendlog(mt,reception,autoId);
  89 +
  90 + int iii = shareServiceImp.updateMessages(customReception);
  91 + if (i>0 && ii>0 && iii > 0){
  92 + return 1;
  93 + }
94 } 94 }
  95 + return 0;
95 } 96 }
96 - return 0;  
97 - }  
98 97
99 - //处理主单格式,将海关回执的主单号58019316861,变为580-19316861  
100 - if (awbA!=null && awbA.length()>0){  
101 - //更新主单回执  
102 - int i = tallymasterMapper.updateRECEIPTION(tallymaster);  
103 - //获取分单autoid  
104 - List<TALLYMASTER> arrivedmasterList = tallymasterMapper.selectAutoIdByAwb(tallymaster);  
105 - if(!arrivedmasterList.isEmpty()){  
106 - TALLYMASTER originMaster = arrivedmasterList.get(0);  
107 - String autoId = originMaster.getAutoid();  
108 -  
109 - //插入sendlog记录表  
110 - log.info("即将插入日志运单号为:"+awbA+"->autoid="+autoId);  
111 - int ii =coustomAnalysisServiceImp.insertSendlog(mt,reception,autoId);  
112 -  
113 - int iii = shareServiceImp.updateMessages(customReception);  
114 - if (i>0 && ii>0 && iii > 0){  
115 - return 1; 98 + //处理主单格式,将海关回执的主单号58019316861,变为580-19316861
  99 + if (awbA!=null && awbA.length()>0){
  100 + //更新主单回执
  101 + int i = tallymasterMapper.updateRECEIPTION(tallymaster);
  102 + //获取分单autoid
  103 + List<TALLYMASTER> arrivedmasterList = tallymasterMapper.selectAutoIdByAwb(tallymaster);
  104 + if(!arrivedmasterList.isEmpty()){
  105 + TALLYMASTER originMaster = arrivedmasterList.get(0);
  106 + String autoId = originMaster.getAutoid();
  107 +
  108 + //插入sendlog记录表
  109 + log.info("即将插入日志运单号为:"+awbA+"->autoid="+autoId);
  110 + int ii =coustomAnalysisServiceImp.insertSendlog(mt,reception,autoId);
  111 +
  112 + int iii = shareServiceImp.updateMessages(customReception);
  113 + if (i>0 && ii>0 && iii > 0){
  114 + return 1;
  115 + }
116 } 116 }
  117 + return 0;
117 } 118 }
118 - return 0;  
119 - }  
120 - }else { 119 + }else {
121 120
122 - return shareServiceImp.share("MT5202", customReception); 121 + return shareServiceImp.share("MT5202", customReception);
  122 + }
123 } 123 }
124 124
125 //未进入主分单解析 返回0 失败 125 //未进入主分单解析 返回0 失败
@@ -251,14 +251,17 @@ @@ -251,14 +251,17 @@
251 UPDATE TALLYMASTER 251 UPDATE TALLYMASTER
252 SET RECEIPTINFORMATION= #{receiptinformation,jdbcType=VARCHAR} 252 SET RECEIPTINFORMATION= #{receiptinformation,jdbcType=VARCHAR}
253 WHERE WAYBILLNOMASTER = #{waybillnomaster,jdbcType=VARCHAR} 253 WHERE WAYBILLNOMASTER = #{waybillnomaster,jdbcType=VARCHAR}
254 - AND WAYBILLNOSECONDARY = #{waybillnosecondary,jdbcType=VARCHAR} 254 + AND FLIGHTNO = #{flghtno, jdbcType=VARCHAR}
  255 + AND FLIGHTDATE = #{flightdate, jdbcType=TIMESTAMP}
255 </update> 256 </update>
256 257
257 - <select id="selectAutoIdByawbAawbH" parameterType="com.tianbo.analysis.model.TALLYMASTER" resultType="com.tianbo.analysis.model.TALLYMASTER"> 258 + <select id="selectAutoIdByAwb" parameterType="com.tianbo.analysis.model.TALLYMASTER" resultType="com.tianbo.analysis.model.TALLYMASTER">
258 SELECT AUTOID 259 SELECT AUTOID
259 FROM TALLYMASTER 260 FROM TALLYMASTER
260 WHERE 261 WHERE
261 - WAYBILLNOMASTER = #{waybillnomaster,jdbcType=VARCHAR} AND WAYBILLNOSECONDARY = #{waybillnosecondary,jdbcType=VARCHAR} 262 + WAYBILLNOMASTER = #{waybillnomaster,jdbcType=VARCHAR}
  263 + AND FLIGHTNO = #{flghtno, jdbcType=VARCHAR}
  264 + AND FLIGHTDATE = #{flightdate, jdbcType=TIMESTAMP}
262 </select> 265 </select>
263 266
264 </mapper> 267 </mapper>