作者 朱兆平

装载回执完成,MAPPER优化

@@ -5,10 +5,12 @@ import com.tianbo.analysis.service.imp.CoustomAnalysisServiceImp; @@ -5,10 +5,12 @@ import com.tianbo.analysis.service.imp.CoustomAnalysisServiceImp;
5 import com.tianbo.analysis.service.imp.ShareServiceImp; 5 import com.tianbo.analysis.service.imp.ShareServiceImp;
6 import com.tianbo.analysis.tools.AWBTools; 6 import com.tianbo.analysis.tools.AWBTools;
7 import com.tianbo.util.Date.DateUtil; 7 import com.tianbo.util.Date.DateUtil;
  8 +import lombok.extern.slf4j.Slf4j;
8 import org.apache.commons.lang.StringUtils; 9 import org.apache.commons.lang.StringUtils;
9 10
10 import java.util.Date; 11 import java.util.Date;
11 12
  13 +@Slf4j
12 public class NmmsBaseService { 14 public class NmmsBaseService {
13 15
14 public ShareServiceImp shareServiceImp; 16 public ShareServiceImp shareServiceImp;
@@ -36,7 +38,7 @@ public class NmmsBaseService { @@ -36,7 +38,7 @@ public class NmmsBaseService {
36 38
37 this.reception = customReception.getResponseText(); 39 this.reception = customReception.getResponseText();
38 this.flightDateStr = customReception.getFlightDate(); 40 this.flightDateStr = customReception.getFlightDate();
39 - 41 + log.info("开始解析:运单号 {} 回执类型:{} ",awbA,customReception.getMessageType());
40 if (!StringUtils.isEmpty(flightDateStr)) { 42 if (!StringUtils.isEmpty(flightDateStr)) {
41 this.flightDate = DateUtil.formatByyyyyMMdd(flightDateStr); 43 this.flightDate = DateUtil.formatByyyyyMMdd(flightDateStr);
42 44
@@ -55,6 +55,7 @@ public class ARRIVEDMASTERServiceImp extends NmmsBaseService implements ARRIVEDM @@ -55,6 +55,7 @@ public class ARRIVEDMASTERServiceImp extends NmmsBaseService implements ARRIVEDM
55 arrivedmaster.setFlightno(flightInfo[1]); 55 arrivedmaster.setFlightno(flightInfo[1]);
56 arrivedmaster.setCarrier(flightInfo[0]); 56 arrivedmaster.setCarrier(flightInfo[0]);
57 arrivedmaster.setFlightDate(flightDate); 57 arrivedmaster.setFlightDate(flightDate);
  58 + arrivedmaster.setStatus(nmsStatusCode);
58 //更新主单回执 59 //更新主单回执
59 int i = arrivedmasterMapper.updateRECEIPTION(arrivedmaster); 60 int i = arrivedmasterMapper.updateRECEIPTION(arrivedmaster);
60 //获取分单autoid 61 //获取分单autoid
@@ -70,7 +71,7 @@ public class ARRIVEDMASTERServiceImp extends NmmsBaseService implements ARRIVEDM @@ -70,7 +71,7 @@ public class ARRIVEDMASTERServiceImp extends NmmsBaseService implements ARRIVEDM
70 int iii = shareServiceImp.updateMessages(customReception); 71 int iii = shareServiceImp.updateMessages(customReception);
71 72
72 if (i>0 && ii>0){ 73 if (i>0 && ii>0){
73 - log.info("运单号 {} 理货回执更新成功",awbA); 74 + log.info("运单号 {} 运抵回执更新成功",awbA);
74 return 1; 75 return 1;
75 } 76 }
76 if ( iii > 0){ 77 if ( iii > 0){
@@ -96,6 +97,7 @@ public class ARRIVEDMASTERServiceImp extends NmmsBaseService implements ARRIVEDM @@ -96,6 +97,7 @@ public class ARRIVEDMASTERServiceImp extends NmmsBaseService implements ARRIVEDM
96 String[] awbhArr = awbH.split("_"); 97 String[] awbhArr = awbH.split("_");
97 String awbh = awbhArr[1]; 98 String awbh = awbhArr[1];
98 arrivedsecondary.setWaybillnosecondary(awbh); 99 arrivedsecondary.setWaybillnosecondary(awbh);
  100 + arrivedsecondary.setStatus(nmsStatusCode);
99 //更新分单回执 101 //更新分单回执
100 int i = arrivedsecondaryMapper.updateRECEIPTION(arrivedsecondary); 102 int i = arrivedsecondaryMapper.updateRECEIPTION(arrivedsecondary);
101 //获取分单autoid 103 //获取分单autoid
@@ -109,7 +111,7 @@ public class ARRIVEDMASTERServiceImp extends NmmsBaseService implements ARRIVEDM @@ -109,7 +111,7 @@ public class ARRIVEDMASTERServiceImp extends NmmsBaseService implements ARRIVEDM
109 111
110 int iii = shareServiceImp.updateMessages(customReception); 112 int iii = shareServiceImp.updateMessages(customReception);
111 if (i>0 && ii>0 ){ 113 if (i>0 && ii>0 ){
112 - log.info("运单号 {} 理货回执更新成功",awbA); 114 + log.info("运单号 {} 运抵回执更新成功",awbA);
113 return 1; 115 return 1;
114 } 116 }
115 if ( iii > 0){ 117 if ( iii > 0){
@@ -4,6 +4,7 @@ import com.tianbo.analysis.dao.DEPARTURESLOADINGMapper; @@ -4,6 +4,7 @@ import com.tianbo.analysis.dao.DEPARTURESLOADINGMapper;
4 import com.tianbo.analysis.model.CustomReception; 4 import com.tianbo.analysis.model.CustomReception;
5 import com.tianbo.analysis.model.DEPARTURESLOADING; 5 import com.tianbo.analysis.model.DEPARTURESLOADING;
6 import com.tianbo.analysis.service.DEPARTURESLOADINGService; 6 import com.tianbo.analysis.service.DEPARTURESLOADINGService;
  7 +import com.tianbo.analysis.service.NmmsBaseService;
7 import com.tianbo.util.Date.DateUtil; 8 import com.tianbo.util.Date.DateUtil;
8 import lombok.extern.slf4j.Slf4j; 9 import lombok.extern.slf4j.Slf4j;
9 import org.apache.commons.lang.StringUtils; 10 import org.apache.commons.lang.StringUtils;
@@ -19,47 +20,31 @@ import java.util.List; @@ -19,47 +20,31 @@ import java.util.List;
19 */ 20 */
20 @Service 21 @Service
21 @Slf4j 22 @Slf4j
22 -public class DEPARTURESLOADINGServiceImp implements DEPARTURESLOADINGService{ 23 +public class DEPARTURESLOADINGServiceImp extends NmmsBaseService implements DEPARTURESLOADINGService{
23 24
24 @Autowired 25 @Autowired
25 DEPARTURESLOADINGMapper departuresloadingMapper; 26 DEPARTURESLOADINGMapper departuresloadingMapper;
26 27
27 @Override 28 @Override
28 public int insertRecept(CustomReception customReception) { 29 public int insertRecept(CustomReception customReception) {
  30 + return super.insertRecept(customReception);
29 31
30 - ShareServiceImp shareServiceImp = new ShareServiceImp();  
31 -  
32 - // 发送日志 插入  
33 - CoustomAnalysisServiceImp coustomAnalysisServiceImp = new CoustomAnalysisServiceImp(); 32 + }
34 33
35 - // 主单号  
36 - String awbA = customReception.getWayBillMaster();  
37 - String awbH = customReception.getWayBillSecond();  
38 - //回执内容  
39 - String reception = customReception.getResponseText();  
40 - String flightDateStr = customReception.getFlightDate();  
41 - if (!StringUtils.isEmpty(flightDateStr)) {  
42 - Date flightDate = DateUtil.formatByyyyyMMdd(flightDateStr); 34 + /**
  35 + * 入库分单回执信息
  36 + * @return 成功返回1,失败返回0。
  37 + */
  38 + @Override
  39 + public int master() {
43 //设置主单回执、航班号、航班日期 40 //设置主单回执、航班号、航班日期
44 DEPARTURESLOADING departuresloading = new DEPARTURESLOADING(); 41 DEPARTURESLOADING departuresloading = new DEPARTURESLOADING();
45 departuresloading.setReceiption(reception); 42 departuresloading.setReceiption(reception);
46 departuresloading.setFlightno(customReception.getFlightNo()); 43 departuresloading.setFlightno(customReception.getFlightNo());
47 departuresloading.setFlightdate(flightDate); 44 departuresloading.setFlightdate(flightDate);
48 -  
49 - if (awbA!=null && awbA.length()>0){  
50 - StringBuffer stringBuffer = new StringBuffer(awbA);  
51 - stringBuffer.insert(3,"-");  
52 - awbA = stringBuffer.toString();  
53 - 45 + departuresloading.setStatus(nmsStatusCode);
54 //设置主分单的 主单号 46 //设置主分单的 主单号
55 departuresloading.setWaybillno(awbA); 47 departuresloading.setWaybillno(awbA);
56 - }  
57 -  
58 -  
59 - // 判断航班号 航班日期 是否为空  
60 - if (flightDate != null && customReception.getFlightNo() != null){  
61 - //处理主单格式,将海关回执的主单号58019316861,变为580-19316861  
62 - if (awbA!=null && awbA.length()>0){  
63 //更新主单回执 48 //更新主单回执
64 int i = departuresloadingMapper.updateRECEIPTION(departuresloading); 49 int i = departuresloadingMapper.updateRECEIPTION(departuresloading);
65 //获取分单autoid 50 //获取分单autoid
@@ -73,20 +58,14 @@ public class DEPARTURESLOADINGServiceImp implements DEPARTURESLOADINGService{ @@ -73,20 +58,14 @@ public class DEPARTURESLOADINGServiceImp implements DEPARTURESLOADINGService{
73 int ii =coustomAnalysisServiceImp.insertSendlog("MT4201",reception,autoId); 58 int ii =coustomAnalysisServiceImp.insertSendlog("MT4201",reception,autoId);
74 59
75 int iii = shareServiceImp.updateMessages(customReception); 60 int iii = shareServiceImp.updateMessages(customReception);
76 - if (i>0 && ii>0 && iii > 0){ 61 + if (i>0 && ii>0){
  62 + log.info("运单号 {} 装载回执更新成功",awbA);
77 return 1; 63 return 1;
78 } 64 }
  65 + if (iii > 0){
  66 + return 1;
79 } 67 }
80 - return 0;  
81 - }  
82 - }else {  
83 -  
84 - return shareServiceImp.share("MT4201", customReception);  
85 - }  
86 -  
87 } 68 }
88 -  
89 - //未进入主分单解析 返回0 失败  
90 return 0; 69 return 0;
91 } 70 }
92 } 71 }
@@ -11,7 +11,7 @@ public class AWBTools { @@ -11,7 +11,7 @@ public class AWBTools {
11 awbNo = stringBuffer.toString(); 11 awbNo = stringBuffer.toString();
12 return awbNo; 12 return awbNo;
13 } 13 }
14 - return null; 14 + return "";
15 } 15 }
16 16
17 public static String[] splitFlight(String flightNo){ 17 public static String[] splitFlight(String flightNo){
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 <result column="CREATEDATE" property="createdate" jdbcType="TIMESTAMP" /> 6 <result column="CREATEDATE" property="createdate" jdbcType="TIMESTAMP" />
7 <result column="WAYBILLNO" property="waybillno" jdbcType="VARCHAR" /> 7 <result column="WAYBILLNO" property="waybillno" jdbcType="VARCHAR" />
8 <result column="FLIGHTNO" property="flightno" jdbcType="VARCHAR" /> 8 <result column="FLIGHTNO" property="flightno" jdbcType="VARCHAR" />
9 - <result column="FLIGHTDATE" property="flightdate" jdbcType="TIMESTAMP" /> 9 + <result column="FLIGHTDATE" property="flightdate" jdbcType="DATE" />
10 <result column="ORIGINATINGSTATION" property="originatingstation" jdbcType="VARCHAR" /> 10 <result column="ORIGINATINGSTATION" property="originatingstation" jdbcType="VARCHAR" />
11 <result column="DESTINATIONSTATION" property="destinationstation" jdbcType="VARCHAR" /> 11 <result column="DESTINATIONSTATION" property="destinationstation" jdbcType="VARCHAR" />
12 <result column="STOWAGEPIECES" property="stowagepieces" jdbcType="VARCHAR" /> 12 <result column="STOWAGEPIECES" property="stowagepieces" jdbcType="VARCHAR" />
@@ -147,21 +147,21 @@ @@ -147,21 +147,21 @@
147 147
148 <update id="updateRECEIPTION" parameterType="com.tianbo.analysis.model.DEPARTURESLOADING" > 148 <update id="updateRECEIPTION" parameterType="com.tianbo.analysis.model.DEPARTURESLOADING" >
149 UPDATE DEPARTURESLOADING 149 UPDATE DEPARTURESLOADING
150 - SET RECEIPTINO= #{receiptino,jdbcType=VARCHAR} 150 + SET RECEIPTION= #{receiption,jdbcType=VARCHAR},STATUS = #{status,jdbcType=VARCHAR}
151 WHERE FLIGHTNO = #{flightno,jdbcType=VARCHAR} 151 WHERE FLIGHTNO = #{flightno,jdbcType=VARCHAR}
152 AND 152 AND
153 - FLIGHTDATE= #{flightDate,jdbcType=TIMESTAMP} 153 + FLIGHTDATE= #{flightdate,jdbcType=DATE}
154 AND 154 AND
155 WAYBILLNO = #{waybillno,jdbcType=VARCHAR} 155 WAYBILLNO = #{waybillno,jdbcType=VARCHAR}
156 </update> 156 </update>
157 157
158 <select id="selectAutoIdByAwb" parameterType="com.tianbo.analysis.model.DEPARTURESLOADING" resultType="com.tianbo.analysis.model.DEPARTURESLOADING"> 158 <select id="selectAutoIdByAwb" parameterType="com.tianbo.analysis.model.DEPARTURESLOADING" resultType="com.tianbo.analysis.model.DEPARTURESLOADING">
159 - SELECT AUTOID 159 + SELECT ID
160 FROM DEPARTURESLOADING 160 FROM DEPARTURESLOADING
161 WHERE 161 WHERE
162 FLIGHTNO= #{flightno,jdbcType=VARCHAR} 162 FLIGHTNO= #{flightno,jdbcType=VARCHAR}
163 AND 163 AND
164 - FLIGHTDATE= #{flightDate,jdbcType=TIMESTAMP} 164 + FLIGHTDATE= #{flightdate,jdbcType=DATE}
165 AND 165 AND
166 WAYBILLNO = #{waybillno,jdbcType=VARCHAR} 166 WAYBILLNO = #{waybillno,jdbcType=VARCHAR}
167 </select> 167 </select>
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 <result column="TCD_TYPECODE" property="tcdTypecode" jdbcType="VARCHAR" /> 8 <result column="TCD_TYPECODE" property="tcdTypecode" jdbcType="VARCHAR" />
9 <result column="TALLTYPE" property="talltype" jdbcType="VARCHAR" /> 9 <result column="TALLTYPE" property="talltype" jdbcType="VARCHAR" />
10 <result column="FLIGHTNO" property="flightno" jdbcType="VARCHAR" /> 10 <result column="FLIGHTNO" property="flightno" jdbcType="VARCHAR" />
11 - <result column="FLIGHTDATE" property="flightdate" jdbcType="TIMESTAMP" /> 11 + <result column="FLIGHTDATE" property="flightdate" jdbcType="DATE" />
12 <result column="SEGMENT" property="segment" jdbcType="VARCHAR" /> 12 <result column="SEGMENT" property="segment" jdbcType="VARCHAR" />
13 <result column="ORIGINATINGSTATION" property="originatingstation" jdbcType="VARCHAR" /> 13 <result column="ORIGINATINGSTATION" property="originatingstation" jdbcType="VARCHAR" />
14 <result column="O_NAME" property="oName" jdbcType="VARCHAR" /> 14 <result column="O_NAME" property="oName" jdbcType="VARCHAR" />