正在显示
13 个修改的文件
包含
159 行增加
和
168 行删除
@@ -137,6 +137,7 @@ custom: | @@ -137,6 +137,7 @@ custom: | ||
137 | receptBakDir: ./success | 137 | receptBakDir: ./success |
138 | #解析错误报文的备份目录 | 138 | #解析错误报文的备份目录 |
139 | errBakDir: ./error | 139 | errBakDir: ./error |
140 | + transmitDir: ./transmit | ||
140 | devops: | 141 | devops: |
141 | dir: | 142 | dir: |
142 | singlewindow-tcs-recept: D:\TCSSingleWindow\recive | 143 | singlewindow-tcs-recept: D:\TCSSingleWindow\recive |
@@ -40,6 +40,10 @@ public class CustomXmlHandleThread implements Runnable{ | @@ -40,6 +40,10 @@ public class CustomXmlHandleThread implements Runnable{ | ||
40 | @Value("${custom.errBakDir}") | 40 | @Value("${custom.errBakDir}") |
41 | private String errBakDir; | 41 | private String errBakDir; |
42 | 42 | ||
43 | + //回执转发目录 | ||
44 | + @Value("${custom.transmit}") | ||
45 | + private String transmitDir; | ||
46 | + | ||
43 | private File xmlfile; | 47 | private File xmlfile; |
44 | private static CustomXmlHandleThread customXmlHandle; | 48 | private static CustomXmlHandleThread customXmlHandle; |
45 | //海关新舱单回执报头 | 49 | //海关新舱单回执报头 |
@@ -101,6 +105,8 @@ public class CustomXmlHandleThread implements Runnable{ | @@ -101,6 +105,8 @@ public class CustomXmlHandleThread implements Runnable{ | ||
101 | customXmlHandle.bakupDir = this.bakupDir; | 105 | customXmlHandle.bakupDir = this.bakupDir; |
102 | 106 | ||
103 | customXmlHandle.errBakDir = this.errBakDir; | 107 | customXmlHandle.errBakDir = this.errBakDir; |
108 | + | ||
109 | + customXmlHandle.transmitDir = this.transmitDir; | ||
104 | // 初使化时将已静态化的testService实例化 | 110 | // 初使化时将已静态化的testService实例化 |
105 | } | 111 | } |
106 | 112 | ||
@@ -108,12 +114,15 @@ public class CustomXmlHandleThread implements Runnable{ | @@ -108,12 +114,15 @@ public class CustomXmlHandleThread implements Runnable{ | ||
108 | public void run() { | 114 | public void run() { |
109 | 115 | ||
110 | try{ | 116 | try{ |
117 | + FileUtils.copyFileToDirectory(xmlfile,new File(customXmlHandle.transmitDir)); | ||
111 | int i =handelXmlDocument(); | 118 | int i =handelXmlDocument(); |
112 | String today = DateUtil.getTodayBy_yyyyMMdd(); | 119 | String today = DateUtil.getTodayBy_yyyyMMdd(); |
113 | String backdireByDay = customXmlHandle.bakupDir + "/" + today; | 120 | String backdireByDay = customXmlHandle.bakupDir + "/" + today; |
114 | //操作成功,则转移剪切解析文件到备份目录,否则转移到error目录备份 | 121 | //操作成功,则转移剪切解析文件到备份目录,否则转移到error目录备份 |
115 | if(i>0){ | 122 | if(i>0){ |
116 | File bakupDirectory = new File(backdireByDay); | 123 | File bakupDirectory = new File(backdireByDay); |
124 | + //复制一份到转发目录 | ||
125 | + //解析成功备份一份到备份目录 | ||
117 | FileUtils.moveFileToDirectory(xmlfile,bakupDirectory,true); | 126 | FileUtils.moveFileToDirectory(xmlfile,bakupDirectory,true); |
118 | }else { | 127 | }else { |
119 | errBak(xmlfile); | 128 | errBak(xmlfile); |
@@ -57,7 +57,7 @@ public class NmmsBaseService { | @@ -57,7 +57,7 @@ public class NmmsBaseService { | ||
57 | return shareServiceImp.share(customReception.getMessageType(), customReception); | 57 | return shareServiceImp.share(customReception.getMessageType(), customReception); |
58 | } | 58 | } |
59 | } | 59 | } |
60 | - //未进入主分单解析 返回0 失败 | 60 | + |
61 | return 0; | 61 | return 0; |
62 | 62 | ||
63 | } | 63 | } |
@@ -4,6 +4,8 @@ import com.tianbo.analysis.dao.ALLOCATEARRIVALMapper; | @@ -4,6 +4,8 @@ import com.tianbo.analysis.dao.ALLOCATEARRIVALMapper; | ||
4 | import com.tianbo.analysis.model.ALLOCATEARRIVAL; | 4 | import com.tianbo.analysis.model.ALLOCATEARRIVAL; |
5 | import com.tianbo.analysis.model.CustomReception; | 5 | import com.tianbo.analysis.model.CustomReception; |
6 | import com.tianbo.analysis.service.ALLOCATEARRIVALService; | 6 | import com.tianbo.analysis.service.ALLOCATEARRIVALService; |
7 | +import com.tianbo.analysis.service.NmmsBaseService; | ||
8 | +import com.tianbo.analysis.tools.AWBTools; | ||
7 | import com.tianbo.util.Date.DateUtil; | 9 | import com.tianbo.util.Date.DateUtil; |
8 | import lombok.extern.slf4j.Slf4j; | 10 | import lombok.extern.slf4j.Slf4j; |
9 | import org.apache.commons.lang.StringUtils; | 11 | import org.apache.commons.lang.StringUtils; |
@@ -19,7 +21,7 @@ import java.util.List; | @@ -19,7 +21,7 @@ import java.util.List; | ||
19 | */ | 21 | */ |
20 | @Service | 22 | @Service |
21 | @Slf4j | 23 | @Slf4j |
22 | -public class ALLOCATEARRIVALServiceImp implements ALLOCATEARRIVALService { | 24 | +public class ALLOCATEARRIVALServiceImp extends NmmsBaseService implements ALLOCATEARRIVALService { |
23 | 25 | ||
24 | @Autowired | 26 | @Autowired |
25 | ALLOCATEARRIVALMapper allocatearrivalMapper; | 27 | ALLOCATEARRIVALMapper allocatearrivalMapper; |
@@ -39,19 +41,14 @@ public class ALLOCATEARRIVALServiceImp implements ALLOCATEARRIVALService { | @@ -39,19 +41,14 @@ public class ALLOCATEARRIVALServiceImp implements ALLOCATEARRIVALService { | ||
39 | String flightDateStr = customReception.getFlightDate(); | 41 | String flightDateStr = customReception.getFlightDate(); |
40 | if (!StringUtils.isEmpty(flightDateStr)) { | 42 | if (!StringUtils.isEmpty(flightDateStr)) { |
41 | Date flightDate = DateUtil.formatByyyyyMMdd(flightDateStr); | 43 | Date flightDate = DateUtil.formatByyyyyMMdd(flightDateStr); |
42 | - //设置主单回执、航班号、航班日期 | ||
43 | - ALLOCATEARRIVAL allocatearrival = new ALLOCATEARRIVAL(); | ||
44 | - allocatearrival.setReceiptinformation(reception); | ||
45 | - allocatearrival.setFlightno(customReception.getFlightNo().substring(2)); | ||
46 | - allocatearrival.setFlightdate(flightDate); | 44 | + |
47 | 45 | ||
48 | if (awbA!=null && awbA.length()>0){ | 46 | if (awbA!=null && awbA.length()>0){ |
49 | StringBuffer stringBuffer = new StringBuffer(awbA); | 47 | StringBuffer stringBuffer = new StringBuffer(awbA); |
50 | stringBuffer.insert(3,"-"); | 48 | stringBuffer.insert(3,"-"); |
51 | awbA = stringBuffer.toString(); | 49 | awbA = stringBuffer.toString(); |
52 | 50 | ||
53 | - //设置主分单的 主单号 | ||
54 | - allocatearrival.setWaybillno(awbA); | 51 | + |
55 | } | 52 | } |
56 | 53 | ||
57 | 54 | ||
@@ -59,6 +56,31 @@ public class ALLOCATEARRIVALServiceImp implements ALLOCATEARRIVALService { | @@ -59,6 +56,31 @@ public class ALLOCATEARRIVALServiceImp implements ALLOCATEARRIVALService { | ||
59 | if (flightDate != null && customReception.getFlightNo() != null){ | 56 | if (flightDate != null && customReception.getFlightNo() != null){ |
60 | //处理主单格式,将海关回执的主单号58019316861,变为580-19316861 | 57 | //处理主单格式,将海关回执的主单号58019316861,变为580-19316861 |
61 | if (awbA!=null && awbA.length()>0){ | 58 | if (awbA!=null && awbA.length()>0){ |
59 | + | ||
60 | + } | ||
61 | + }else { | ||
62 | + | ||
63 | + return shareServiceImp.share("MT3202", customReception); | ||
64 | + } | ||
65 | + | ||
66 | + } | ||
67 | + | ||
68 | + //未进入主分单解析 返回0 失败 | ||
69 | + return 0; | ||
70 | + } | ||
71 | + | ||
72 | + @Override | ||
73 | + public int master() { | ||
74 | + //设置主单回执、航班号、航班日期 | ||
75 | + ALLOCATEARRIVAL allocatearrival = new ALLOCATEARRIVAL(); | ||
76 | + allocatearrival.setReceiptinformation(reception); | ||
77 | + String[] flightInfo = AWBTools.splitFlight(customReception.getFlightNo()); | ||
78 | + allocatearrival.setFlightno(flightInfo[1]); | ||
79 | + allocatearrival.setCarrier(flightInfo[0]); | ||
80 | + allocatearrival.setFlightdate(flightDate); | ||
81 | + //设置主分单的 主单号 | ||
82 | + allocatearrival.setWaybillno(awbA); | ||
83 | + allocatearrival.setStatus(nmsStatusCode); | ||
62 | //更新主单回执 | 84 | //更新主单回执 |
63 | int i = allocatearrivalMapper.updateRECEIPTION(allocatearrival); | 85 | int i = allocatearrivalMapper.updateRECEIPTION(allocatearrival); |
64 | //获取分单autoid | 86 | //获取分单autoid |
@@ -78,14 +100,4 @@ public class ALLOCATEARRIVALServiceImp implements ALLOCATEARRIVALService { | @@ -78,14 +100,4 @@ public class ALLOCATEARRIVALServiceImp implements ALLOCATEARRIVALService { | ||
78 | } | 100 | } |
79 | return 0; | 101 | return 0; |
80 | } | 102 | } |
81 | - }else { | ||
82 | - | ||
83 | - return shareServiceImp.share("MT3202", customReception); | ||
84 | - } | ||
85 | - | ||
86 | - } | ||
87 | - | ||
88 | - //未进入主分单解析 返回0 失败 | ||
89 | - return 0; | ||
90 | - } | ||
91 | } | 103 | } |
@@ -9,6 +9,7 @@ import com.tianbo.analysis.model.ORIGINMANIFESTMASTER; | @@ -9,6 +9,7 @@ import com.tianbo.analysis.model.ORIGINMANIFESTMASTER; | ||
9 | import com.tianbo.analysis.model.Originmanifestsecondary; | 9 | import com.tianbo.analysis.model.Originmanifestsecondary; |
10 | import com.tianbo.analysis.model.SENDLOG; | 10 | import com.tianbo.analysis.model.SENDLOG; |
11 | import com.tianbo.analysis.service.CoustomAnalysisService; | 11 | import com.tianbo.analysis.service.CoustomAnalysisService; |
12 | +import com.tianbo.analysis.service.NmmsBaseService; | ||
12 | import com.tianbo.util.Date.DateUtil; | 13 | import com.tianbo.util.Date.DateUtil; |
13 | import com.tianbo.util.Helper; | 14 | import com.tianbo.util.Helper; |
14 | import lombok.extern.slf4j.Slf4j; | 15 | import lombok.extern.slf4j.Slf4j; |
@@ -20,9 +21,13 @@ import java.math.BigDecimal; | @@ -20,9 +21,13 @@ import java.math.BigDecimal; | ||
20 | import java.util.Date; | 21 | import java.util.Date; |
21 | import java.util.List; | 22 | import java.util.List; |
22 | 23 | ||
24 | +/** | ||
25 | + * @author mrz | ||
26 | + * 原始回执解析 | ||
27 | + */ | ||
23 | @Service | 28 | @Service |
24 | @Slf4j | 29 | @Slf4j |
25 | -public class CoustomAnalysisServiceImp implements CoustomAnalysisService { | 30 | +public class CoustomAnalysisServiceImp extends NmmsBaseService implements CoustomAnalysisService { |
26 | 31 | ||
27 | @Autowired | 32 | @Autowired |
28 | SENDLOGMapper sendlogMapper; | 33 | SENDLOGMapper sendlogMapper; |
@@ -38,50 +43,25 @@ public class CoustomAnalysisServiceImp implements CoustomAnalysisService { | @@ -38,50 +43,25 @@ public class CoustomAnalysisServiceImp implements CoustomAnalysisService { | ||
38 | } | 43 | } |
39 | } | 44 | } |
40 | 45 | ||
41 | - @Override | ||
42 | - public int insertRecept(CustomReception customReception){ | ||
43 | - | ||
44 | - ShareServiceImp shareServiceImp = new ShareServiceImp(); | ||
45 | 46 | ||
46 | 47 | ||
47 | - String awbA = customReception.getWayBillMaster(); | ||
48 | - String awbH = customReception.getWayBillSecond(); | ||
49 | - // 回执内容 | ||
50 | - String reception = customReception.getResponseText(); | ||
51 | - String flightDateStr = customReception.getFlightDate(); | ||
52 | - | ||
53 | -// Date flightDate = new Date(); | ||
54 | - if (!StringUtils.isEmpty(flightDateStr)){ | ||
55 | - Date flightDate = DateUtil.formatByyyyyMMdd(flightDateStr); | 48 | + @Override |
49 | + public int insertRecept(CustomReception customReception){ | ||
50 | + return super.insertRecept(customReception); | ||
51 | + } | ||
56 | 52 | ||
53 | + @Override | ||
54 | + public int second() { | ||
57 | // 设置分单回执 | 55 | // 设置分单回执 |
58 | Originmanifestsecondary originmanifestsecondary = new Originmanifestsecondary(); | 56 | Originmanifestsecondary originmanifestsecondary = new Originmanifestsecondary(); |
59 | originmanifestsecondary.setReceiption(reception); | 57 | originmanifestsecondary.setReceiption(reception); |
60 | - | ||
61 | - // 设置主单回执、航班号、航班日期 | ||
62 | - ORIGINMANIFESTMASTER originmanifestmaster = new ORIGINMANIFESTMASTER(); | ||
63 | - originmanifestmaster.setReceiptinformation(reception); | ||
64 | - originmanifestmaster.setFlightno(customReception.getFlightNo()); | ||
65 | - originmanifestmaster.setFlightDate(flightDate); | ||
66 | - | ||
67 | - // 判断航班号 航班日期 是否为空 | ||
68 | - if (flightDate != null && customReception.getFlightNo() != null){ | ||
69 | - if (awbA!=null && awbA.length()>0){ | ||
70 | - StringBuffer stringBuffer = new StringBuffer(awbA); | ||
71 | - stringBuffer.insert(3,"-"); | ||
72 | - awbA = stringBuffer.toString(); | ||
73 | - | ||
74 | //设置主分单的 主单号 | 58 | //设置主分单的 主单号 |
75 | originmanifestsecondary.setWaybillnomaster(awbA); | 59 | originmanifestsecondary.setWaybillnomaster(awbA); |
76 | - originmanifestmaster.setWaybillnomaster(awbA); | ||
77 | - } | ||
78 | - | ||
79 | - //有分单号 更新分单 | ||
80 | - if(awbA!=null && awbA.length()>0 && awbH!=null && awbH.length()> 0){ | ||
81 | //取分单号 | 60 | //取分单号 |
82 | String[] awbhArr = awbH.split("_"); | 61 | String[] awbhArr = awbH.split("_"); |
83 | String awbh = awbhArr[1]; | 62 | String awbh = awbhArr[1]; |
84 | originmanifestsecondary.setWaybillnosecondary(awbh); | 63 | originmanifestsecondary.setWaybillnosecondary(awbh); |
64 | + originmanifestsecondary.setStatus(nmsStatusCode); | ||
85 | //更新分单回执 | 65 | //更新分单回执 |
86 | int i = originmanifestsecondaryMapper.updateRECEIPTION(originmanifestsecondary); | 66 | int i = originmanifestsecondaryMapper.updateRECEIPTION(originmanifestsecondary); |
87 | //获取分单autoid | 67 | //获取分单autoid |
@@ -94,15 +74,26 @@ public class CoustomAnalysisServiceImp implements CoustomAnalysisService { | @@ -94,15 +74,26 @@ public class CoustomAnalysisServiceImp implements CoustomAnalysisService { | ||
94 | int ii = insertSendlog("MT1201",reception,autoId); | 74 | int ii = insertSendlog("MT1201",reception,autoId); |
95 | 75 | ||
96 | int iii = shareServiceImp.updateMessages(customReception); | 76 | int iii = shareServiceImp.updateMessages(customReception); |
97 | - if (i>0 && ii>0 && iii > 0){ | 77 | + if (i>0 && ii>0){ |
78 | + log.info("运单号 {} 原始回执更新成功",awbA); | ||
79 | + return 1; | ||
80 | + } | ||
81 | + if (iii > 0){ | ||
98 | return 1; | 82 | return 1; |
99 | } | 83 | } |
100 | } | 84 | } |
101 | return 0; | 85 | return 0; |
102 | } | 86 | } |
103 | 87 | ||
104 | - //处理主单格式,将海关回执的主单号58019316861,变为580-19316861 | ||
105 | - if (awbA!=null && awbA.length()>0){ | 88 | + @Override |
89 | + public int master() { | ||
90 | + // 设置主单回执、航班号、航班日期 | ||
91 | + ORIGINMANIFESTMASTER originmanifestmaster = new ORIGINMANIFESTMASTER(); | ||
92 | + originmanifestmaster.setReceiptinformation(reception); | ||
93 | + originmanifestmaster.setFlightno(customReception.getFlightNo()); | ||
94 | + originmanifestmaster.setFlightDate(flightDate); | ||
95 | + originmanifestmaster.setWaybillnomaster(awbA); | ||
96 | + originmanifestmaster.setStatus(nmsStatusCode); | ||
106 | //更新主单回执 | 97 | //更新主单回执 |
107 | int i = originmanifestmasterMapper.updateRECEIPTION(originmanifestmaster); | 98 | int i = originmanifestmasterMapper.updateRECEIPTION(originmanifestmaster); |
108 | //获取分单autoid | 99 | //获取分单autoid |
@@ -116,22 +107,17 @@ public class CoustomAnalysisServiceImp implements CoustomAnalysisService { | @@ -116,22 +107,17 @@ public class CoustomAnalysisServiceImp implements CoustomAnalysisService { | ||
116 | int ii =insertSendlog("MT1201",reception,autoId); | 107 | int ii =insertSendlog("MT1201",reception,autoId); |
117 | 108 | ||
118 | int iii = shareServiceImp.updateMessages(customReception); | 109 | int iii = shareServiceImp.updateMessages(customReception); |
119 | - if (i>0 && ii>0 && iii > 0){ | 110 | + if (i>0 && ii>0){ |
111 | + log.info("运单号 {} 原始回执更新成功",awbA); | ||
120 | return 1; | 112 | return 1; |
121 | } | 113 | } |
122 | - } | ||
123 | - return 0; | ||
124 | - } | ||
125 | - }else { | ||
126 | - return shareServiceImp.share("MT1201", customReception); | 114 | + if (iii > 0){ |
115 | + return 1; | ||
127 | } | 116 | } |
128 | } | 117 | } |
129 | - | ||
130 | - //未进入主分单解析 返回0 失败 | ||
131 | return 0; | 118 | return 0; |
132 | } | 119 | } |
133 | 120 | ||
134 | - | ||
135 | public int insertSendlog(String type,String reception,String autoId){ | 121 | public int insertSendlog(String type,String reception,String autoId){ |
136 | SENDLOG sendlog = new SENDLOG(); | 122 | SENDLOG sendlog = new SENDLOG(); |
137 | sendlog.setAutoid(Helper.getUUID()); | 123 | sendlog.setAutoid(Helper.getUUID()); |
@@ -5,6 +5,8 @@ import com.tianbo.analysis.dao.INPORTALLOCATEMapper; | @@ -5,6 +5,8 @@ import com.tianbo.analysis.dao.INPORTALLOCATEMapper; | ||
5 | import com.tianbo.analysis.model.CustomReception; | 5 | import com.tianbo.analysis.model.CustomReception; |
6 | import com.tianbo.analysis.model.INPORTALLOCATE; | 6 | import com.tianbo.analysis.model.INPORTALLOCATE; |
7 | import com.tianbo.analysis.service.INPORTALLOCATEService; | 7 | import com.tianbo.analysis.service.INPORTALLOCATEService; |
8 | +import com.tianbo.analysis.service.NmmsBaseService; | ||
9 | +import com.tianbo.analysis.tools.AWBTools; | ||
8 | import com.tianbo.util.Date.DateUtil; | 10 | import com.tianbo.util.Date.DateUtil; |
9 | import lombok.extern.slf4j.Slf4j; | 11 | import lombok.extern.slf4j.Slf4j; |
10 | import org.apache.commons.lang.StringUtils; | 12 | import org.apache.commons.lang.StringUtils; |
@@ -21,7 +23,7 @@ import java.util.List; | @@ -21,7 +23,7 @@ import java.util.List; | ||
21 | 23 | ||
22 | @Service | 24 | @Service |
23 | @Slf4j | 25 | @Slf4j |
24 | -public class INPORTALLOCATEServiceImp implements INPORTALLOCATEService{ | 26 | +public class INPORTALLOCATEServiceImp extends NmmsBaseService implements INPORTALLOCATEService{ |
25 | 27 | ||
26 | @Autowired | 28 | @Autowired |
27 | INPORTALLOCATEMapper inportallocateMapper; | 29 | INPORTALLOCATEMapper inportallocateMapper; |
@@ -29,38 +31,20 @@ public class INPORTALLOCATEServiceImp implements INPORTALLOCATEService{ | @@ -29,38 +31,20 @@ public class INPORTALLOCATEServiceImp implements INPORTALLOCATEService{ | ||
29 | 31 | ||
30 | @Override | 32 | @Override |
31 | public int insertRecept(CustomReception customReception) { | 33 | public int insertRecept(CustomReception customReception) { |
32 | - ShareServiceImp shareServiceImp = new ShareServiceImp(); | ||
33 | - | ||
34 | - // 发送日志 插入 | ||
35 | - CoustomAnalysisServiceImp coustomAnalysisServiceImp = new CoustomAnalysisServiceImp(); | 34 | + return super.insertRecept(customReception); |
35 | + } | ||
36 | 36 | ||
37 | - // 主单号 | ||
38 | - String awbA = customReception.getWayBillMaster(); | ||
39 | - //回执内容 | ||
40 | - String reception = customReception.getResponseText(); | ||
41 | - String flightDateStr = customReception.getFlightDate(); | ||
42 | - if (!StringUtils.isEmpty(flightDateStr)) { | ||
43 | - Date flightDate = DateUtil.formatByyyyyMMdd(flightDateStr); | ||
44 | - //设置主单回执、航班号、航班日期 | 37 | + @Override |
38 | + public int master() { | ||
45 | INPORTALLOCATE inportallocate = new INPORTALLOCATE(); | 39 | INPORTALLOCATE inportallocate = new INPORTALLOCATE(); |
46 | inportallocate.setReceiptinformation(reception); | 40 | inportallocate.setReceiptinformation(reception); |
47 | - inportallocate.setFlightno(customReception.getFlightNo().substring(2)); | 41 | + String[] flightInfo = AWBTools.splitFlight(customReception.getFlightNo()); |
42 | + inportallocate.setFlightno(flightInfo[1]); | ||
43 | + inportallocate.setCarrier(flightInfo[0]); | ||
48 | inportallocate.setFlightdate(flightDate); | 44 | inportallocate.setFlightdate(flightDate); |
49 | - | ||
50 | - if (awbA!=null && awbA.length()>0){ | ||
51 | - StringBuffer stringBuffer = new StringBuffer(awbA); | ||
52 | - stringBuffer.insert(3,"-"); | ||
53 | - awbA = stringBuffer.toString(); | ||
54 | - | ||
55 | //设置主分单的 主单号 | 45 | //设置主分单的 主单号 |
56 | inportallocate.setWaybillno(awbA); | 46 | inportallocate.setWaybillno(awbA); |
57 | - } | ||
58 | - | ||
59 | - | ||
60 | - // 判断航班号 航班日期 是否为空 | ||
61 | - if (flightDate != null && customReception.getFlightNo() != null){ | ||
62 | - //处理主单格式,将海关回执的主单号58019316861,变为580-19316861 | ||
63 | - if (awbA!=null && awbA.length()>0){ | 47 | + inportallocate.setStatus(nmsStatusCode); |
64 | //更新主单回执 | 48 | //更新主单回执 |
65 | int i = inportallocateMapper.updateRECEIPTION(inportallocate); | 49 | int i = inportallocateMapper.updateRECEIPTION(inportallocate); |
66 | //获取分单autoid | 50 | //获取分单autoid |
@@ -74,20 +58,14 @@ public class INPORTALLOCATEServiceImp implements INPORTALLOCATEService{ | @@ -74,20 +58,14 @@ public class INPORTALLOCATEServiceImp implements INPORTALLOCATEService{ | ||
74 | int ii =coustomAnalysisServiceImp.insertSendlog("MT6202",reception,autoId); | 58 | int ii =coustomAnalysisServiceImp.insertSendlog("MT6202",reception,autoId); |
75 | 59 | ||
76 | int iii = shareServiceImp.updateMessages(customReception); | 60 | int iii = shareServiceImp.updateMessages(customReception); |
77 | - if (i>0 && ii>0 && iii > 0){ | 61 | + if (i>0 && ii>0 ){ |
62 | + log.info("运单号 {} 分拨申请回执更新成功",awbA); | ||
78 | return 1; | 63 | return 1; |
79 | } | 64 | } |
65 | + if (iii > 0){ | ||
66 | + return 1; | ||
80 | } | 67 | } |
81 | - return 0; | ||
82 | - } | ||
83 | - }else { | ||
84 | - | ||
85 | - return shareServiceImp.share("MT6202", customReception); | ||
86 | - } | ||
87 | - | ||
88 | } | 68 | } |
89 | - | ||
90 | - //未进入主分单解析 返回0 失败 | ||
91 | return 0; | 69 | return 0; |
92 | } | 70 | } |
93 | } | 71 | } |
@@ -5,10 +5,10 @@ import com.tianbo.analysis.dao.PREPARESECONDARYMapper; | @@ -5,10 +5,10 @@ import com.tianbo.analysis.dao.PREPARESECONDARYMapper; | ||
5 | import com.tianbo.analysis.model.CustomReception; | 5 | import com.tianbo.analysis.model.CustomReception; |
6 | import com.tianbo.analysis.model.PREPAREMASTER; | 6 | import com.tianbo.analysis.model.PREPAREMASTER; |
7 | import com.tianbo.analysis.model.PREPARESECONDARY; | 7 | import com.tianbo.analysis.model.PREPARESECONDARY; |
8 | +import com.tianbo.analysis.service.NmmsBaseService; | ||
8 | import com.tianbo.analysis.service.PREPAREMASTERService; | 9 | import com.tianbo.analysis.service.PREPAREMASTERService; |
9 | -import com.tianbo.util.Date.DateUtil; | 10 | +import com.tianbo.analysis.tools.AWBTools; |
10 | import lombok.extern.slf4j.Slf4j; | 11 | import lombok.extern.slf4j.Slf4j; |
11 | -import org.apache.commons.lang.StringUtils; | ||
12 | import org.springframework.beans.factory.annotation.Autowired; | 12 | import org.springframework.beans.factory.annotation.Autowired; |
13 | import org.springframework.stereotype.Service; | 13 | import org.springframework.stereotype.Service; |
14 | 14 | ||
@@ -21,7 +21,7 @@ import java.util.List; | @@ -21,7 +21,7 @@ import java.util.List; | ||
21 | */ | 21 | */ |
22 | @Service | 22 | @Service |
23 | @Slf4j | 23 | @Slf4j |
24 | -public class PREPAREMASTERServiceImp implements PREPAREMASTERService { | 24 | +public class PREPAREMASTERServiceImp extends NmmsBaseService implements PREPAREMASTERService { |
25 | 25 | ||
26 | @Autowired | 26 | @Autowired |
27 | PREPAREMASTERMapper preparemasterMapper; | 27 | PREPAREMASTERMapper preparemasterMapper; |
@@ -33,49 +33,25 @@ public class PREPAREMASTERServiceImp implements PREPAREMASTERService { | @@ -33,49 +33,25 @@ public class PREPAREMASTERServiceImp implements PREPAREMASTERService { | ||
33 | // 货物接收运抵主分单 | 33 | // 货物接收运抵主分单 |
34 | public int insertRecept(CustomReception customReception) { | 34 | public int insertRecept(CustomReception customReception) { |
35 | 35 | ||
36 | + return super.insertRecept(customReception); | ||
37 | + } | ||
36 | 38 | ||
37 | - ShareServiceImp shareServiceImp = new ShareServiceImp(); | ||
38 | - // 发送日志 插入 | ||
39 | - CoustomAnalysisServiceImp coustomAnalysisServiceImp = new CoustomAnalysisServiceImp(); | ||
40 | - | ||
41 | - // 主单号 | ||
42 | - String awbA = customReception.getWayBillMaster(); | ||
43 | - String awbH = customReception.getWayBillSecond(); | ||
44 | - //回执内容 | ||
45 | - String reception = customReception.getResponseText(); | ||
46 | - String flightDateStr = customReception.getFlightDate(); | ||
47 | - if (!StringUtils.isEmpty(flightDateStr)) { | ||
48 | - Date flightDate = DateUtil.formatByyyyyMMdd(flightDateStr); | ||
49 | - | 39 | + /** |
40 | + * 入库分单回执信息 | ||
41 | + * @return 成功返回1,失败返回0。 | ||
42 | + */ | ||
43 | + @Override | ||
44 | + public int second() { | ||
50 | // 设置 接收运抵分单 回执 | 45 | // 设置 接收运抵分单 回执 |
51 | PREPARESECONDARY preparesecondary = new PREPARESECONDARY(); | 46 | PREPARESECONDARY preparesecondary = new PREPARESECONDARY(); |
52 | preparesecondary.setReceiptinformation(reception); | 47 | preparesecondary.setReceiptinformation(reception); |
53 | - | ||
54 | - //设置主单回执、航班号、航班日期 | ||
55 | - PREPAREMASTER preparemaster = new PREPAREMASTER(); | ||
56 | - preparemaster.setReceiptinformation(reception); | ||
57 | - preparemaster.setFlightno(customReception.getFlightNo()); | ||
58 | - preparemaster.setFlightdate(flightDate); | ||
59 | - | ||
60 | - if (awbA!=null && awbA.length()>0){ | ||
61 | - StringBuffer stringBuffer = new StringBuffer(awbA); | ||
62 | - stringBuffer.insert(3,"-"); | ||
63 | - awbA = stringBuffer.toString(); | ||
64 | - | ||
65 | //设置主分单的 主单号 | 48 | //设置主分单的 主单号 |
66 | preparesecondary.setWaybillnomaster(awbA); | 49 | preparesecondary.setWaybillnomaster(awbA); |
67 | - preparemaster.setWaybillnomaster(awbA); | ||
68 | - } | ||
69 | - | ||
70 | - | ||
71 | - // 判断航班号 航班日期 是否为空 | ||
72 | - if (flightDate != null && customReception.getFlightNo() != null){ | ||
73 | - //有分单号 更新分单 | ||
74 | - if(awbA!=null && awbA.length()>0 && awbH!=null && awbH.length()> 0){ | ||
75 | - //取分单号 | 50 | +//取分单号 |
76 | String[] awbhArr = awbH.split("_"); | 51 | String[] awbhArr = awbH.split("_"); |
77 | String awbh = awbhArr[1]; | 52 | String awbh = awbhArr[1]; |
78 | preparesecondary.setWaybillnosecondary(awbh); | 53 | preparesecondary.setWaybillnosecondary(awbh); |
54 | + preparesecondary.setStatus(nmsStatusCode); | ||
79 | //更新分单回执 | 55 | //更新分单回执 |
80 | int i = preparesecondaryMapper.updateRECEIPTION(preparesecondary); | 56 | int i = preparesecondaryMapper.updateRECEIPTION(preparesecondary); |
81 | //获取分单autoid | 57 | //获取分单autoid |
@@ -85,18 +61,36 @@ public class PREPAREMASTERServiceImp implements PREPAREMASTERService { | @@ -85,18 +61,36 @@ public class PREPAREMASTERServiceImp implements PREPAREMASTERService { | ||
85 | String autoId = preparesecondary1.getAutoid(); | 61 | String autoId = preparesecondary1.getAutoid(); |
86 | //插入sendlog记录表 | 62 | //插入sendlog记录表 |
87 | log.info("即将插入日志运单号为:"+awbH+"->autoid="+autoId); | 63 | log.info("即将插入日志运单号为:"+awbH+"->autoid="+autoId); |
88 | - int ii = coustomAnalysisServiceImp.insertSendlog("MT3201",reception,autoId); | 64 | + int ii = coustomAnalysisServiceImp.insertSendlog(customReception.getMessageType(),reception,autoId); |
89 | 65 | ||
90 | int iii = shareServiceImp.updateMessages(customReception); | 66 | int iii = shareServiceImp.updateMessages(customReception); |
91 | - if (i>0 && ii>0 && iii > 0){ | 67 | + if (i>0 && ii>0){ |
68 | + log.info("运单号 {} 原始回执更新成功",awbH); | ||
69 | + return 1; | ||
70 | + } | ||
71 | + if (iii > 0){ | ||
92 | return 1; | 72 | return 1; |
93 | } | 73 | } |
94 | } | 74 | } |
95 | return 0; | 75 | return 0; |
76 | + | ||
96 | } | 77 | } |
97 | 78 | ||
98 | - //处理主单格式,将海关回执的主单号58019316861,变为580-19316861 | ||
99 | - if (awbA!=null && awbA.length()>0){ | 79 | + /** |
80 | + * 入库分单回执信息 | ||
81 | + * @return 成功返回1,失败返回0。 | ||
82 | + */ | ||
83 | + @Override | ||
84 | + public int master() { | ||
85 | + //设置主单回执、航班号、航班日期 | ||
86 | + PREPAREMASTER preparemaster = new PREPAREMASTER(); | ||
87 | + preparemaster.setReceiptinformation(reception); | ||
88 | + String[] flightInfo = AWBTools.splitFlight(customReception.getFlightNo()); | ||
89 | + preparemaster.setFlightno(flightInfo[1]); | ||
90 | + preparemaster.setCarrier(flightInfo[0]); | ||
91 | + preparemaster.setFlightdate(flightDate); | ||
92 | + preparemaster.setWaybillnomaster(awbA); | ||
93 | + preparemaster.setStatus(nmsStatusCode); | ||
100 | //更新主单回执 | 94 | //更新主单回执 |
101 | int i = preparemasterMapper.updateRECEIPTION(preparemaster); | 95 | int i = preparemasterMapper.updateRECEIPTION(preparemaster); |
102 | //获取分单autoid | 96 | //获取分单autoid |
@@ -107,24 +101,17 @@ public class PREPAREMASTERServiceImp implements PREPAREMASTERService { | @@ -107,24 +101,17 @@ public class PREPAREMASTERServiceImp implements PREPAREMASTERService { | ||
107 | 101 | ||
108 | //插入sendlog记录表 | 102 | //插入sendlog记录表 |
109 | log.info("即将插入日志运单号为:"+awbA+"->autoid="+autoId); | 103 | log.info("即将插入日志运单号为:"+awbA+"->autoid="+autoId); |
110 | - int ii =coustomAnalysisServiceImp.insertSendlog("MT3201",reception,autoId); | 104 | + int ii =coustomAnalysisServiceImp.insertSendlog(customReception.getMessageType(),reception,autoId); |
111 | 105 | ||
112 | int iii = shareServiceImp.updateMessages(customReception); | 106 | int iii = shareServiceImp.updateMessages(customReception); |
113 | - if (i>0 && ii>0 && iii > 0){ | 107 | + if (i>0 && ii>0){ |
108 | + log.info("运单号 {} 原始回执更新成功",awbA); | ||
114 | return 1; | 109 | return 1; |
115 | } | 110 | } |
111 | + if (iii > 0){ | ||
112 | + return 1; | ||
116 | } | 113 | } |
117 | - return 0; | ||
118 | - } | ||
119 | - }else { | ||
120 | - | ||
121 | - | ||
122 | - return shareServiceImp.share("MT2201", customReception); | ||
123 | - } | ||
124 | - | ||
125 | } | 114 | } |
126 | - | ||
127 | - //未进入主分单解析 返回0 失败 | ||
128 | return 0; | 115 | return 0; |
129 | } | 116 | } |
130 | } | 117 | } |
@@ -15,9 +15,11 @@ public class AWBTools { | @@ -15,9 +15,11 @@ public class AWBTools { | ||
15 | } | 15 | } |
16 | 16 | ||
17 | public static String[] splitFlight(String flightNo){ | 17 | public static String[] splitFlight(String flightNo){ |
18 | - String[] flight = {"1","2"}; | 18 | + String[] flight = {"UNKONW","UNKONW"}; |
19 | + if (!StringUtils.isEmpty(flightNo) && flightNo.length()>2){ | ||
19 | flight[0] = flightNo.substring(0,2); | 20 | flight[0] = flightNo.substring(0,2); |
20 | flight[1] = flightNo.substring(2); | 21 | flight[1] = flightNo.substring(2); |
22 | + } | ||
21 | return flight; | 23 | return flight; |
22 | } | 24 | } |
23 | 25 |
@@ -7,7 +7,7 @@ | @@ -7,7 +7,7 @@ | ||
7 | <result column="WAYBILLNO" property="waybillno" jdbcType="VARCHAR" /> | 7 | <result column="WAYBILLNO" property="waybillno" jdbcType="VARCHAR" /> |
8 | <result column="CARRIER" property="carrier" jdbcType="VARCHAR" /> | 8 | <result column="CARRIER" property="carrier" jdbcType="VARCHAR" /> |
9 | <result column="FLIGHTNO" property="flightno" jdbcType="VARCHAR" /> | 9 | <result column="FLIGHTNO" property="flightno" jdbcType="VARCHAR" /> |
10 | - <result column="FLIGHTDATE" property="flightdate" jdbcType="TIMESTAMP" /> | 10 | + <result column="FLIGHTDATE" property="flightdate" jdbcType="DATE" /> |
11 | <result column="CUSTOMOS" property="customos" jdbcType="VARCHAR" /> | 11 | <result column="CUSTOMOS" property="customos" jdbcType="VARCHAR" /> |
12 | <result column="ARRIVALPIECES" property="arrivalpieces" jdbcType="VARCHAR" /> | 12 | <result column="ARRIVALPIECES" property="arrivalpieces" jdbcType="VARCHAR" /> |
13 | <result column="ARRIVALWEIGHT" property="arrivalweight" jdbcType="VARCHAR" /> | 13 | <result column="ARRIVALWEIGHT" property="arrivalweight" jdbcType="VARCHAR" /> |
@@ -117,10 +117,14 @@ | @@ -117,10 +117,14 @@ | ||
117 | 117 | ||
118 | <update id="updateRECEIPTION" parameterType="com.tianbo.analysis.model.ALLOCATEARRIVAL" > | 118 | <update id="updateRECEIPTION" parameterType="com.tianbo.analysis.model.ALLOCATEARRIVAL" > |
119 | UPDATE ALLOCATEARRIVAL | 119 | UPDATE ALLOCATEARRIVAL |
120 | - SET RECEIPTINFORMATION= #{receiptinformation,jdbcType=VARCHAR} | ||
121 | - WHERE FLIGHTNO = #{flightno,jdbcType=VARCHAR} | 120 | + SET RECEIPTINFORMATION= #{receiptinformation,jdbcType=VARCHAR}, |
121 | + STATUS = #{status,jdbcType=VARCHAR} | ||
122 | + WHERE | ||
123 | + CARRIER = #{carrier,jdbcType=VARCHAR} | ||
124 | + AND | ||
125 | + FLIGHTNO = #{flightno,jdbcType=VARCHAR} | ||
122 | AND | 126 | AND |
123 | - FLIGHTDATE= #{flightDate,jdbcType=TIMESTAMP} | 127 | + FLIGHTDATE= #{flightDate,jdbcType=DATE} |
124 | AND | 128 | AND |
125 | WAYBILLNO = #{waybillno,jdbcType=VARCHAR} | 129 | WAYBILLNO = #{waybillno,jdbcType=VARCHAR} |
126 | </update> | 130 | </update> |
@@ -131,7 +135,7 @@ | @@ -131,7 +135,7 @@ | ||
131 | WHERE | 135 | WHERE |
132 | FLIGHTNO= #{flightno,jdbcType=VARCHAR} | 136 | FLIGHTNO= #{flightno,jdbcType=VARCHAR} |
133 | AND | 137 | AND |
134 | - FLIGHTDATE= #{flightDate,jdbcType=TIMESTAMP} | 138 | + FLIGHTDATE= #{flightDate,jdbcType=DATE} |
135 | AND | 139 | AND |
136 | WAYBILLNO = #{waybillno,jdbcType=VARCHAR} | 140 | WAYBILLNO = #{waybillno,jdbcType=VARCHAR} |
137 | </select> | 141 | </select> |
@@ -132,9 +132,13 @@ | @@ -132,9 +132,13 @@ | ||
132 | 132 | ||
133 | 133 | ||
134 | <update id="updateRECEIPTION" parameterType="com.tianbo.analysis.model.INPORTALLOCATE" > | 134 | <update id="updateRECEIPTION" parameterType="com.tianbo.analysis.model.INPORTALLOCATE" > |
135 | - UPDATE ALLOCATEARRIVAL | ||
136 | - SET RECEIPTINFORMATION= #{receiptinformation,jdbcType=VARCHAR} | ||
137 | - WHERE FLIGHTNO = #{flightno,jdbcType=VARCHAR} | 135 | + UPDATE INPORTALLOCATE |
136 | + SET RECEIPTINFORMATION= #{receiptinformation,jdbcType=VARCHAR}, | ||
137 | + STATUS = #{status,jdbcType=VARCHAR} | ||
138 | + WHERE | ||
139 | + CARRIER = #{carrier,jdbcType=VARCHAR} | ||
140 | + AND | ||
141 | + FLIGHTNO = #{flightno,jdbcType=VARCHAR} | ||
138 | AND | 142 | AND |
139 | FLIGHTDATE= #{flightDate,jdbcType=TIMESTAMP} | 143 | FLIGHTDATE= #{flightDate,jdbcType=TIMESTAMP} |
140 | AND | 144 | AND |
@@ -143,7 +147,7 @@ | @@ -143,7 +147,7 @@ | ||
143 | 147 | ||
144 | <select id="selectAutoIdByAwb" parameterType="com.tianbo.analysis.model.INPORTALLOCATE" resultType="com.tianbo.analysis.model.INPORTALLOCATE"> | 148 | <select id="selectAutoIdByAwb" parameterType="com.tianbo.analysis.model.INPORTALLOCATE" resultType="com.tianbo.analysis.model.INPORTALLOCATE"> |
145 | SELECT ID | 149 | SELECT ID |
146 | - FROM ALLOCATEARRIVAL | 150 | + FROM INPORTALLOCATE |
147 | WHERE | 151 | WHERE |
148 | FLIGHTNO= #{flightno,jdbcType=VARCHAR} | 152 | FLIGHTNO= #{flightno,jdbcType=VARCHAR} |
149 | AND | 153 | AND |
@@ -355,7 +355,9 @@ | @@ -355,7 +355,9 @@ | ||
355 | 355 | ||
356 | <update id="updateRECEIPTION" parameterType="com.tianbo.analysis.model.ORIGINMANIFESTMASTER" > | 356 | <update id="updateRECEIPTION" parameterType="com.tianbo.analysis.model.ORIGINMANIFESTMASTER" > |
357 | UPDATE ORIGINMANIFESTMASTER | 357 | UPDATE ORIGINMANIFESTMASTER |
358 | - SET RECEIPTINFORMATION= #{receiptinformation,jdbcType=VARCHAR} | 358 | + SET |
359 | + RECEIPTINFORMATION= #{receiptinformation,jdbcType=VARCHAR}, | ||
360 | + STATUS=#{status,jdbcType=VARCHAR } | ||
359 | WHERE FLIGHTNO = #{flightno,jdbcType=VARCHAR} | 361 | WHERE FLIGHTNO = #{flightno,jdbcType=VARCHAR} |
360 | AND | 362 | AND |
361 | FLIGHT_DATE= #{flightDate,jdbcType=TIMESTAMP} | 363 | FLIGHT_DATE= #{flightDate,jdbcType=TIMESTAMP} |
@@ -308,12 +308,15 @@ | @@ -308,12 +308,15 @@ | ||
308 | </insert> | 308 | </insert> |
309 | <update id="updateRECEIPTION" parameterType="com.tianbo.analysis.model.PREPAREMASTER" > | 309 | <update id="updateRECEIPTION" parameterType="com.tianbo.analysis.model.PREPAREMASTER" > |
310 | UPDATE PREPAREMASTER | 310 | UPDATE PREPAREMASTER |
311 | - SET RECEIPTINFORMATION= #{receiptinformation,jdbcType=VARCHAR} | 311 | + SET RECEIPTINFORMATION= #{receiptinformation,jdbcType=VARCHAR}, |
312 | + STATUS = #{status,jdbcType=VARCHAR } | ||
312 | WHERE FLIGHTNO = #{flightno,jdbcType=VARCHAR} | 313 | WHERE FLIGHTNO = #{flightno,jdbcType=VARCHAR} |
313 | AND | 314 | AND |
314 | FLIGHTDATE= #{flightDate,jdbcType=TIMESTAMP} | 315 | FLIGHTDATE= #{flightDate,jdbcType=TIMESTAMP} |
315 | AND | 316 | AND |
316 | WAYBILLNOMASTER = #{waybillnomaster,jdbcType=VARCHAR} | 317 | WAYBILLNOMASTER = #{waybillnomaster,jdbcType=VARCHAR} |
318 | + AND | ||
319 | + CARRIER = #{carrier,jdbcType=VARCHAR} | ||
317 | </update> | 320 | </update> |
318 | 321 | ||
319 | <select id="selectAutoIdByAwb" parameterType="com.tianbo.analysis.model.PREPAREMASTER" resultType="com.tianbo.analysis.model.PREPAREMASTER"> | 322 | <select id="selectAutoIdByAwb" parameterType="com.tianbo.analysis.model.PREPAREMASTER" resultType="com.tianbo.analysis.model.PREPAREMASTER"> |
@@ -263,8 +263,11 @@ | @@ -263,8 +263,11 @@ | ||
263 | 263 | ||
264 | <update id="updateRECEIPTION" parameterType="com.tianbo.analysis.model.Originmanifestsecondary" > | 264 | <update id="updateRECEIPTION" parameterType="com.tianbo.analysis.model.Originmanifestsecondary" > |
265 | UPDATE ORIGINMANIFESTSECONDARY | 265 | UPDATE ORIGINMANIFESTSECONDARY |
266 | - SET RECEIPTION= #{receiption,jdbcType=VARCHAR} | ||
267 | - WHERE WAYBILLNOMASTER = #{waybillnomaster,jdbcType=VARCHAR} | 266 | + SET |
267 | + RECEIPTION= #{receiption,jdbcType=VARCHAR}, | ||
268 | + STATUS=#{status,jdbcType=VARCHAR } | ||
269 | + WHERE | ||
270 | + WAYBILLNOMASTER = #{waybillnomaster,jdbcType=VARCHAR} | ||
268 | AND WAYBILLNOSECONDARY = #{waybillnosecondary,jdbcType=VARCHAR} | 271 | AND WAYBILLNOSECONDARY = #{waybillnosecondary,jdbcType=VARCHAR} |
269 | </update> | 272 | </update> |
270 | 273 |
-
请 注册 或 登录 后发表评论