正在显示
12 个修改的文件
包含
116 行增加
和
30 行删除
@@ -2,11 +2,10 @@ package com.sunyo.wlpt.message.builder.controller; | @@ -2,11 +2,10 @@ package com.sunyo.wlpt.message.builder.controller; | ||
2 | 2 | ||
3 | import com.sunyo.wlpt.message.builder.service.MT4201Service; | 3 | import com.sunyo.wlpt.message.builder.service.MT4201Service; |
4 | import org.springframework.beans.factory.annotation.Autowired; | 4 | import org.springframework.beans.factory.annotation.Autowired; |
5 | -import org.springframework.web.bind.annotation.RequestBody; | ||
6 | -import org.springframework.web.bind.annotation.RequestMapping; | ||
7 | -import org.springframework.web.bind.annotation.RestController; | 5 | +import org.springframework.web.bind.annotation.*; |
8 | 6 | ||
9 | import java.io.IOException; | 7 | import java.io.IOException; |
8 | +import java.text.ParseException; | ||
10 | import java.util.Map; | 9 | import java.util.Map; |
11 | 10 | ||
12 | 11 | ||
@@ -18,11 +17,23 @@ public class MT4201Controller { | @@ -18,11 +17,23 @@ public class MT4201Controller { | ||
18 | MT4201Service mt4201Service; | 17 | MT4201Service mt4201Service; |
19 | 18 | ||
20 | 19 | ||
21 | - @RequestMapping("/create4201") | 20 | + @PostMapping("/createMt4201") |
21 | + @ResponseBody | ||
22 | public int pffmcreate(@RequestBody Map<String, Object> map) throws IOException { | 22 | public int pffmcreate(@RequestBody Map<String, Object> map) throws IOException { |
23 | 23 | ||
24 | return mt4201Service.pffmcreate(map); | 24 | return mt4201Service.pffmcreate(map); |
25 | 25 | ||
26 | } | 26 | } |
27 | 27 | ||
28 | + | ||
29 | + @PutMapping("/removeMt4201") | ||
30 | + @ResponseBody | ||
31 | + public int remove4201(@RequestBody Map<String, Object> map) throws IOException, ParseException { | ||
32 | + | ||
33 | + return mt4201Service.remove4201(map); | ||
34 | + | ||
35 | + } | ||
36 | + | ||
37 | + | ||
38 | + | ||
28 | } | 39 | } |
@@ -23,7 +23,7 @@ public class MT520XController { | @@ -23,7 +23,7 @@ public class MT520XController { | ||
23 | * @return | 23 | * @return |
24 | */ | 24 | */ |
25 | @RequestMapping("/520xcreate") | 25 | @RequestMapping("/520xcreate") |
26 | - public Boolean create(@RequestBody Map<String, Object> map){ | 26 | + public int create(@RequestBody Map<String, Object> map){ |
27 | 27 | ||
28 | try { | 28 | try { |
29 | 29 | ||
@@ -31,7 +31,7 @@ public class MT520XController { | @@ -31,7 +31,7 @@ public class MT520XController { | ||
31 | 31 | ||
32 | }catch (Exception e){ | 32 | }catch (Exception e){ |
33 | e.printStackTrace(); | 33 | e.printStackTrace(); |
34 | - return false; | 34 | + return 0; |
35 | } | 35 | } |
36 | 36 | ||
37 | } | 37 | } |
1 | package com.sunyo.wlpt.message.builder.service; | 1 | package com.sunyo.wlpt.message.builder.service; |
2 | 2 | ||
3 | import java.io.IOException; | 3 | import java.io.IOException; |
4 | +import java.text.ParseException; | ||
4 | import java.util.Map; | 5 | import java.util.Map; |
5 | 6 | ||
6 | public interface MT4201Service { | 7 | public interface MT4201Service { |
7 | 8 | ||
8 | int pffmcreate(Map<String, Object> map) throws IOException; | 9 | int pffmcreate(Map<String, Object> map) throws IOException; |
9 | 10 | ||
11 | + int remove4201(Map<String, Object> map) throws IOException, ParseException; | ||
12 | + | ||
10 | } | 13 | } |
@@ -49,7 +49,7 @@ public class MT2201ServiceImp extends CustomXmlMaker implements MT2201Service { | @@ -49,7 +49,7 @@ public class MT2201ServiceImp extends CustomXmlMaker implements MT2201Service { | ||
49 | } | 49 | } |
50 | 50 | ||
51 | @Value("${custom.custom-code}") | 51 | @Value("${custom.custom-code}") |
52 | - private String customCode; | 52 | + private String orgsn; |
53 | 53 | ||
54 | @Value("${custom.org-code}") | 54 | @Value("${custom.org-code}") |
55 | private String orgCode; | 55 | private String orgCode; |
@@ -73,9 +73,9 @@ public class MT2201ServiceImp extends CustomXmlMaker implements MT2201Service { | @@ -73,9 +73,9 @@ public class MT2201ServiceImp extends CustomXmlMaker implements MT2201Service { | ||
73 | 73 | ||
74 | String customCode = map.get("customCode").toString(); | 74 | String customCode = map.get("customCode").toString(); |
75 | // 生成报文头部 | 75 | // 生成报文头部 |
76 | - String msgId = makeMsgID("MT2201", customCode, map.get("awba").toString()); | 76 | + String msgId = makeMsgID("MT2201", orgsn, map.get("awba").toString()); |
77 | String msessageType = "MT2201"; | 77 | String msessageType = "MT2201"; |
78 | - String senderId = makeSenderID(customCode, customCode, ""); | 78 | + String senderId = makeSenderID(customCode, orgsn, ""); |
79 | String receiverID = customCode; | 79 | String receiverID = customCode; |
80 | map.put("msgId", msgId); | 80 | map.put("msgId", msgId); |
81 | map.put("msessageType", msessageType); | 81 | map.put("msessageType", msessageType); |
@@ -108,9 +108,9 @@ public class MT2201ServiceImp extends CustomXmlMaker implements MT2201Service { | @@ -108,9 +108,9 @@ public class MT2201ServiceImp extends CustomXmlMaker implements MT2201Service { | ||
108 | map.put("mt", custom_mt2201); | 108 | map.put("mt", custom_mt2201); |
109 | map.put("awbAwbinfo", awbAwbinfo); | 109 | map.put("awbAwbinfo", awbAwbinfo); |
110 | // 生成报文头部 | 110 | // 生成报文头部 |
111 | - String msgId = makeMsgID("MT2201", customCode, custom_mt2201.getAwba()); | 111 | + String msgId = makeMsgID("MT2201", orgsn, custom_mt2201.getAwba()); |
112 | String msessageType = "MT2201"; | 112 | String msessageType = "MT2201"; |
113 | - String senderId = makeSenderID(customCode, customCode, ""); | 113 | + String senderId = makeSenderID(customCode, orgsn, ""); |
114 | String receiverID = customCode; | 114 | String receiverID = customCode; |
115 | map.put("msgId", msgId); | 115 | map.put("msgId", msgId); |
116 | map.put("msessageType", msessageType); | 116 | map.put("msessageType", msessageType); |
@@ -5,14 +5,21 @@ import com.sunyo.wlpt.base.model.NMMS_CUSTOM_MT4201; | @@ -5,14 +5,21 @@ import com.sunyo.wlpt.base.model.NMMS_CUSTOM_MT4201; | ||
5 | import com.sunyo.wlpt.message.builder.service.MT4201Service; | 5 | import com.sunyo.wlpt.message.builder.service.MT4201Service; |
6 | import com.sunyo.wlpt.message.builder.util.CustomXmlMaker; | 6 | import com.sunyo.wlpt.message.builder.util.CustomXmlMaker; |
7 | import com.tianbo.util.Date.DateUtil; | 7 | import com.tianbo.util.Date.DateUtil; |
8 | +import org.springframework.beans.factory.annotation.Value; | ||
8 | import org.springframework.stereotype.Service; | 9 | import org.springframework.stereotype.Service; |
9 | 10 | ||
11 | +import javax.xml.crypto.Data; | ||
10 | import java.io.IOException; | 12 | import java.io.IOException; |
13 | +import java.text.ParseException; | ||
11 | import java.util.Map; | 14 | import java.util.Map; |
12 | 15 | ||
13 | @Service | 16 | @Service |
14 | public class MT4201ServiceImp extends CustomXmlMaker implements MT4201Service { | 17 | public class MT4201ServiceImp extends CustomXmlMaker implements MT4201Service { |
15 | 18 | ||
19 | + | ||
20 | + @Value("${custom.custom-code}") | ||
21 | + private String orgsn; | ||
22 | + | ||
16 | @Override | 23 | @Override |
17 | public int pffmcreate(Map<String, Object> map) throws IOException { | 24 | public int pffmcreate(Map<String, Object> map) throws IOException { |
18 | 25 | ||
@@ -20,19 +27,17 @@ public class MT4201ServiceImp extends CustomXmlMaker implements MT4201Service { | @@ -20,19 +27,17 @@ public class MT4201ServiceImp extends CustomXmlMaker implements MT4201Service { | ||
20 | ObjectMapper objectMapper = new ObjectMapper(); | 27 | ObjectMapper objectMapper = new ObjectMapper(); |
21 | 28 | ||
22 | NMMS_CUSTOM_MT4201 customMt4201 = objectMapper.convertValue(map.get("mt4201"), NMMS_CUSTOM_MT4201.class); | 29 | NMMS_CUSTOM_MT4201 customMt4201 = objectMapper.convertValue(map.get("mt4201"), NMMS_CUSTOM_MT4201.class); |
23 | - | ||
24 | // 关区代码 | 30 | // 关区代码 |
25 | String customCode = customMt4201.getCustomcode(); | 31 | String customCode = customMt4201.getCustomcode(); |
26 | - | ||
27 | // 报文头时间 精确到毫秒 | 32 | // 报文头时间 精确到毫秒 |
28 | map.put("sendTime", DateUtil.getCurrentTime17()); | 33 | map.put("sendTime", DateUtil.getCurrentTime17()); |
29 | // 封装实体 | 34 | // 封装实体 |
30 | map.put("mt", customMt4201); | 35 | map.put("mt", customMt4201); |
31 | 36 | ||
32 | // 生成报文头部 | 37 | // 生成报文头部 |
33 | - String msgId = makeMsgID("MT4201", "460470678920X", customMt4201.getAwba()); | 38 | + String msgId = makeMsgID("MT4201", orgsn, customMt4201.getAwba()); |
34 | String msessageType = "MT4201"; | 39 | String msessageType = "MT4201"; |
35 | - String senderId = makeSenderID(customCode, "460470678920X", "DXPENT0000460002"); | 40 | + String senderId = makeSenderID(customCode, orgsn); |
36 | String receiverID = customCode; | 41 | String receiverID = customCode; |
37 | map.put("msgId", msgId); | 42 | map.put("msgId", msgId); |
38 | map.put("msessageType", msessageType); | 43 | map.put("msessageType", msessageType); |
@@ -44,4 +49,30 @@ public class MT4201ServiceImp extends CustomXmlMaker implements MT4201Service { | @@ -44,4 +49,30 @@ public class MT4201ServiceImp extends CustomXmlMaker implements MT4201Service { | ||
44 | return 0; | 49 | return 0; |
45 | } | 50 | } |
46 | } | 51 | } |
52 | + | ||
53 | + | ||
54 | + @Override | ||
55 | + public int remove4201(Map<String, Object> map) throws IOException, ParseException { | ||
56 | + // 关区代码 | ||
57 | + String customCode = map.get("customCode").toString(); | ||
58 | + // 报文头时间 精确到毫秒 | ||
59 | + map.put("sendTime", DateUtil.getCurrentTime17()); | ||
60 | + | ||
61 | + String flightDate = DateUtil.get_yyyyMMdd(map.get("flightDate").toString()); | ||
62 | + map.put("flightDate",flightDate); | ||
63 | + // 生成报文头部 | ||
64 | + String msgId = makeMsgID("MT4201", orgsn, map.get("awba").toString()); | ||
65 | + String msessageType = "MT4201"; | ||
66 | + String senderId = makeSenderID(customCode, orgsn); | ||
67 | + String receiverID = customCode; | ||
68 | + map.put("msgId", msgId); | ||
69 | + map.put("msessageType", msessageType); | ||
70 | + map.put("senderId", senderId); | ||
71 | + map.put("receiverID", receiverID); | ||
72 | + if (makeXmlToFile("/remove/MT4201.ftlx", msgId+".xml", map, "./send/remove/")>0){ | ||
73 | + return 1; | ||
74 | + }else { | ||
75 | + return 0; | ||
76 | + } | ||
77 | + } | ||
47 | } | 78 | } |
@@ -5,6 +5,7 @@ import com.sunyo.wlpt.base.model.NMMS_CUSTOM_MT520X; | @@ -5,6 +5,7 @@ import com.sunyo.wlpt.base.model.NMMS_CUSTOM_MT520X; | ||
5 | import com.sunyo.wlpt.message.builder.service.MT520XService; | 5 | import com.sunyo.wlpt.message.builder.service.MT520XService; |
6 | import com.sunyo.wlpt.message.builder.util.CustomXmlMaker; | 6 | import com.sunyo.wlpt.message.builder.util.CustomXmlMaker; |
7 | import com.tianbo.util.Date.DateUtil; | 7 | import com.tianbo.util.Date.DateUtil; |
8 | +import org.springframework.beans.factory.annotation.Value; | ||
8 | import org.springframework.stereotype.Service; | 9 | import org.springframework.stereotype.Service; |
9 | 10 | ||
10 | import java.io.IOException; | 11 | import java.io.IOException; |
@@ -14,9 +15,11 @@ import java.util.Map; | @@ -14,9 +15,11 @@ import java.util.Map; | ||
14 | @Service | 15 | @Service |
15 | public class MT520XServiceImp extends CustomXmlMaker implements MT520XService{ | 16 | public class MT520XServiceImp extends CustomXmlMaker implements MT520XService{ |
16 | 17 | ||
18 | + @Value("${custom.custom-code}") | ||
19 | + private String orgsn; | ||
17 | 20 | ||
18 | @Override | 21 | @Override |
19 | - public Boolean create(Map<String, Object> map) { | 22 | + public int create(Map<String, Object> map) { |
20 | 23 | ||
21 | try { | 24 | try { |
22 | 25 | ||
@@ -32,6 +35,7 @@ public class MT520XServiceImp extends CustomXmlMaker implements MT520XService{ | @@ -32,6 +35,7 @@ public class MT520XServiceImp extends CustomXmlMaker implements MT520XService{ | ||
32 | hashMap.put("sendTime", DateUtil.getCurrentTime17()); | 35 | hashMap.put("sendTime", DateUtil.getCurrentTime17()); |
33 | // 封装实体 | 36 | // 封装实体 |
34 | hashMap.put("mt", customMt520X); | 37 | hashMap.put("mt", customMt520X); |
38 | + | ||
35 | if ("5201".equals(customMt520X.getExt1())){ | 39 | if ("5201".equals(customMt520X.getExt1())){ |
36 | 40 | ||
37 | // 生成报文头部 | 41 | // 生成报文头部 |
@@ -51,25 +55,25 @@ public class MT520XServiceImp extends CustomXmlMaker implements MT520XService{ | @@ -51,25 +55,25 @@ public class MT520XServiceImp extends CustomXmlMaker implements MT520XService{ | ||
51 | }else { | 55 | }else { |
52 | 56 | ||
53 | // 生成报文头部 | 57 | // 生成报文头部 |
54 | - String msgId = makeMsgID("MT5202", "460470678920X", customMt520X.getAwba()); | 58 | + String msgId = makeMsgID("MT5202", orgsn, customMt520X.getAwba()); |
55 | String msessageType = "MT5202"; | 59 | String msessageType = "MT5202"; |
56 | - String senderId = makeSenderID(customCode, "460470678920X", "DXPENT0000460002"); | 60 | + String senderId = makeSenderID(customCode, orgsn, "DXPENT0000460002"); |
57 | String receiverID = customCode; | 61 | String receiverID = customCode; |
58 | hashMap.put("msgId", msgId); | 62 | hashMap.put("msgId", msgId); |
59 | hashMap.put("msessageType", msessageType); | 63 | hashMap.put("msessageType", msessageType); |
60 | hashMap.put("senderId", senderId); | 64 | hashMap.put("senderId", senderId); |
61 | hashMap.put("receiverID", receiverID); | 65 | hashMap.put("receiverID", receiverID); |
62 | -// if (makeXmlToFile("/manifest/MT5202.ftlx", msgId+".xml", hashMap)>0){ | ||
63 | -// return true; | ||
64 | -// }else { | ||
65 | -// return false; | ||
66 | -// } | 66 | + if (makeXmlToFile("/manifest/MT5202.ftlx", msgId+".xml", hashMap, "./send/add/")>0){ |
67 | + return 1; | ||
68 | + }else { | ||
69 | + return 0; | ||
70 | + } | ||
67 | } | 71 | } |
68 | }catch (Exception e){ | 72 | }catch (Exception e){ |
69 | 73 | ||
70 | e.printStackTrace(); | 74 | e.printStackTrace(); |
71 | - return false; | 75 | + return 0; |
72 | } | 76 | } |
73 | - return null; | 77 | + return 0; |
74 | } | 78 | } |
75 | } | 79 | } |
@@ -24,6 +24,12 @@ public class CustomXmlMaker { | @@ -24,6 +24,12 @@ public class CustomXmlMaker { | ||
24 | @Value("${tcs.mq-number}") | 24 | @Value("${tcs.mq-number}") |
25 | private String TCSMQNumber; | 25 | private String TCSMQNumber; |
26 | 26 | ||
27 | + @Value("${custom.custom-code}") | ||
28 | + private String customCode; | ||
29 | + | ||
30 | + @Value("${custom.org-code}") | ||
31 | + private String orgCode; | ||
32 | + | ||
27 | public CustomXmlMaker() { | 33 | public CustomXmlMaker() { |
28 | if (freemakerTemplate==null){ | 34 | if (freemakerTemplate==null){ |
29 | this.freemakerTemplate = new Configuration(); | 35 | this.freemakerTemplate = new Configuration(); |
@@ -103,4 +109,5 @@ public class CustomXmlMaker { | @@ -103,4 +109,5 @@ public class CustomXmlMaker { | ||
103 | public String makeSenderID(String customCode,String ORGSN){ | 109 | public String makeSenderID(String customCode,String ORGSN){ |
104 | return makeSenderID(customCode,ORGSN,TCSMQNumber); | 110 | return makeSenderID(customCode,ORGSN,TCSMQNumber); |
105 | } | 111 | } |
112 | + | ||
106 | } | 113 | } |
@@ -86,8 +86,8 @@ | @@ -86,8 +86,8 @@ | ||
86 | </Consignment> | 86 | </Consignment> |
87 | <AdditionalInformation> | 87 | <AdditionalInformation> |
88 | <Reason>${reason}</Reason> | 88 | <Reason>${reason}</Reason> |
89 | - <ContactName>${contacName}</ContactName> | ||
90 | - <ContactTel>${contacTel}</ContactTel> | 89 | + <ContactName>${contactName}</ContactName> |
90 | + <ContactTel>${contactTel}</ContactTel> | ||
91 | </AdditionalInformation> | 91 | </AdditionalInformation> |
92 | </Declaration> | 92 | </Declaration> |
93 | </Manifest> | 93 | </Manifest> |
@@ -23,8 +23,8 @@ | @@ -23,8 +23,8 @@ | ||
23 | <ID>${mt.awba}</ID> | 23 | <ID>${mt.awba}</ID> |
24 | </TransportContractDocument> | 24 | </TransportContractDocument> |
25 | <LoadingLocation> | 25 | <LoadingLocation> |
26 | - <ID>${mt.destinationstation}/${mt.customcode}</ID> | ||
27 | - <LoadingDate>${mt.loadingtime?string('yyyyMMddHHmmssSSS')}</LoadingDate> | 26 | + <ID>${mt.originstation}/${mt.customcode}</ID> |
27 | + <LoadingDate>${mt.loadingtime?string('yyyyMMddHHmmss')}</LoadingDate> | ||
28 | </LoadingLocation> | 28 | </LoadingLocation> |
29 | <ConsignmentPackaging> | 29 | <ConsignmentPackaging> |
30 | <QuantityQuantity>${mt.lodingpiece}</QuantityQuantity> | 30 | <QuantityQuantity>${mt.lodingpiece}</QuantityQuantity> |
@@ -26,7 +26,11 @@ | @@ -26,7 +26,11 @@ | ||
26 | <Reason>${reason}</Reason> | 26 | <Reason>${reason}</Reason> |
27 | <ContactName>${contactName}</ContactName> | 27 | <ContactName>${contactName}</ContactName> |
28 | <ContactTel>${contactTel}</ContactTel> | 28 | <ContactTel>${contactTel}</ContactTel> |
29 | + <#if content ??> | ||
29 | <Content>${content}</Content> | 30 | <Content>${content}</Content> |
31 | + <#else> | ||
32 | + <Content></Content> | ||
33 | + </#if> | ||
30 | </AdditionalInformation> | 34 | </AdditionalInformation> |
31 | </Declaration> | 35 | </Declaration> |
32 | </Manifest> | 36 | </Manifest> |
1 | +<Manifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:Declaration:datamodel:standard:CN:MT4201:1"> | ||
2 | + <Head> | ||
3 | + <MessageID>${msgId}</MessageID> | ||
4 | + <FunctionCode>3</FunctionCode> | ||
5 | + <MessageType>${msessageType}</MessageType> | ||
6 | + <SenderID>${senderId}</SenderID> | ||
7 | + <ReceiverID>${receiverID}</ReceiverID> | ||
8 | + <SendTime>${sendTime}</SendTime> | ||
9 | + <Version>1.0</Version> | ||
10 | + </Head> | ||
11 | + <Declaration> | ||
12 | + <BorderTransportMeans> | ||
13 | + <JourneyID>${carrier}${flightNo}/${flightDate}</JourneyID> | ||
14 | + </BorderTransportMeans> | ||
15 | + <Consignment> | ||
16 | + <TransportContractDocument> | ||
17 | + <ID>${awba}</ID> | ||
18 | + </TransportContractDocument> | ||
19 | + </Consignment> | ||
20 | + <AdditionalInformation> | ||
21 | + <Reason>${reason}</Reason> | ||
22 | + <ContactName>${contactName}</ContactName> | ||
23 | + <ContactTel>${contactTel}</ContactTel> | ||
24 | + </AdditionalInformation> | ||
25 | + </Declaration> | ||
26 | +</Manifest> |
-
请 注册 或 登录 后发表评论