作者 shenhailong

修改1201报文 货运承运地点

添加 海关通道编号

优化 报文生成头部信息 重复代码问题
@@ -136,5 +136,5 @@ custom: @@ -136,5 +136,5 @@ custom:
136 #舱单传输人名称 136 #舱单传输人名称
137 org-code: 9141010070678920XJ 137 org-code: 9141010070678920XJ
138 tcs: 138 tcs:
139 - #企业备案编码 139 + #海关通道编号
140 mq-number: DXPENT0000460002 140 mq-number: DXPENT0000460002
@@ -17,12 +17,11 @@ public class CustomsXmlAnalysisHeader implements CustomsXmlHeader { @@ -17,12 +17,11 @@ public class CustomsXmlAnalysisHeader implements CustomsXmlHeader {
17 * @param customCode 关区代码 17 * @param customCode 关区代码
18 * @param orgsn 海关备案编码 18 * @param orgsn 海关备案编码
19 * @param waylbillNo 主单号 19 * @param waylbillNo 主单号
20 - * @param orgCode 舱单传输人名称  
21 * @param tcssn 企业备案编码 20 * @param tcssn 企业备案编码
22 * @return 21 * @return
23 */ 22 */
24 @Override 23 @Override
25 - public Map<String, Object> makeHeader(String customCode, String orgsn, String waylbillNo, String orgCode, String tcssn, String mtType) { 24 + public Map<String, Object> makeHeader(String customCode, String orgsn, String waylbillNo, String tcssn, String mtType) {
26 Map<String, Object> map = new HashMap<>(); 25 Map<String, Object> map = new HashMap<>();
27 CustomXmlMaker customXmlMaker = new CustomXmlMaker(); 26 CustomXmlMaker customXmlMaker = new CustomXmlMaker();
28 // 报文头部信息 messageId 27 // 报文头部信息 messageId
@@ -4,6 +4,6 @@ import java.util.Map; @@ -4,6 +4,6 @@ import java.util.Map;
4 4
5 public interface CustomsXmlHeader { 5 public interface CustomsXmlHeader {
6 6
7 - Map<String, Object> makeHeader(String customCode, String orgsn, String waylbillNo, String orgCode, String tcssn, String mtType); 7 + Map<String, Object> makeHeader(String customCode, String orgsn, String waylbillNo, String tcssn, String mtType);
8 8
9 } 9 }
@@ -4,11 +4,14 @@ import com.fasterxml.jackson.databind.ObjectMapper; @@ -4,11 +4,14 @@ import com.fasterxml.jackson.databind.ObjectMapper;
4 import com.sunyo.wlpt.base.model.AWB_AWBINFO; 4 import com.sunyo.wlpt.base.model.AWB_AWBINFO;
5 import com.sunyo.wlpt.base.model.NMMS_CUSTOM_MT1201; 5 import com.sunyo.wlpt.base.model.NMMS_CUSTOM_MT1201;
6 import com.sunyo.wlpt.base.model.NMMS_CUSTOM_RESPONSE; 6 import com.sunyo.wlpt.base.model.NMMS_CUSTOM_RESPONSE;
  7 +import com.sunyo.wlpt.message.builder.factory.CustomsXmlFactory;
  8 +import com.sunyo.wlpt.message.builder.factory.CustomsXmlHeader;
7 import com.sunyo.wlpt.message.builder.service.MT1201Service; 9 import com.sunyo.wlpt.message.builder.service.MT1201Service;
8 import com.sunyo.wlpt.message.builder.util.CustomXmlMaker; 10 import com.sunyo.wlpt.message.builder.util.CustomXmlMaker;
9 import com.sunyo.wlpt.message.builder.util.ReturnUtil; 11 import com.sunyo.wlpt.message.builder.util.ReturnUtil;
10 import com.tianbo.util.Date.DateUtil; 12 import com.tianbo.util.Date.DateUtil;
11 import com.tianbo.util.nmms.AwbaUtils; 13 import com.tianbo.util.nmms.AwbaUtils;
  14 +import org.apache.commons.lang.StringUtils;
12 import org.springframework.beans.factory.annotation.Value; 15 import org.springframework.beans.factory.annotation.Value;
13 import org.springframework.stereotype.Service; 16 import org.springframework.stereotype.Service;
14 17
@@ -28,6 +31,9 @@ public class MT1201ServiceImp extends CustomXmlMaker implements MT1201Service{ @@ -28,6 +31,9 @@ public class MT1201ServiceImp extends CustomXmlMaker implements MT1201Service{
28 @Value("${custom.org-code}") 31 @Value("${custom.org-code}")
29 private String orgCode; 32 private String orgCode;
30 33
  34 + @Value("${custom.mq-number}")
  35 + private String mq_number;
  36 +
31 @Override 37 @Override
32 public Map<String, Object> ffmcreate(Map<String, Object> map) throws IOException, ParseException { 38 public Map<String, Object> ffmcreate(Map<String, Object> map) throws IOException, ParseException {
33 39
@@ -46,31 +52,27 @@ public class MT1201ServiceImp extends CustomXmlMaker implements MT1201Service{ @@ -46,31 +52,27 @@ public class MT1201ServiceImp extends CustomXmlMaker implements MT1201Service{
46 52
47 @Override 53 @Override
48 public Map<String, Object> removeMt1201(Map<String, Object> map) throws IOException, ParseException { 54 public Map<String, Object> removeMt1201(Map<String, Object> map) throws IOException, ParseException {
  55 + // 处理主单号 -
  56 + String awba = ReturnUtil.awbaReplace(map.get("awba").toString());
49 57
50 String customCode = map.get("customCode").toString(); 58 String customCode = map.get("customCode").toString();
51 - // 生成报文头部  
52 - String msgId = makeMsgID("MT1201", orgsn, map.get("awba").toString());  
53 - String senderId = makeSenderID(customCode, orgsn, "");  
54 - String receiverID = customCode;  
55 - map.put("msgId", msgId);  
56 - map.put("senderId", senderId);  
57 - map.put("receiverID", receiverID);  
58 - // 报文头时间 精确到毫秒  
59 - map.put("sendTime", DateUtil.getCurrentTime17());  
60 - // 舱单传输人名称  
61 - map.put("orgCode", orgCode);  
62 59
63 - // 处理主单号 -  
64 - String awba = ReturnUtil.awbaReplace(map.get("awba").toString());  
65 map.put("awbas", awba); 60 map.put("awbas", awba);
66 61
67 String flightDate = ReturnUtil.awbaReplace(map.get("flightDate").toString()); 62 String flightDate = ReturnUtil.awbaReplace(map.get("flightDate").toString());
68 map.put("flightDates",flightDate); 63 map.put("flightDates",flightDate);
69 64
  65 +
  66 + // 生成报文头部信息
  67 + CustomsXmlFactory customsXmlFactory = new CustomsXmlFactory();
  68 + CustomsXmlHeader message = customsXmlFactory.getCustomsXmlHeader("MESSAGE");
  69 + Map<String, Object> mt1201 = message.makeHeader(customCode, orgsn, awba, mq_number, "MT1201");
  70 + map.put("map", mt1201);
  71 +
70 // 生成报文 72 // 生成报文
71 Map<String, Object> hashMap = new HashMap<>(); 73 Map<String, Object> hashMap = new HashMap<>();
72 // 生成报文 74 // 生成报文
73 - if (makeXmlToFile("/remove/MT1201.ftlx", msgId+".xml", map, "./send/remove/")>0){ 75 + if (makeXmlToFile("/remove/MT1201.ftlx", mt1201.get("messageID")+".xml", map, "./send/remove/")>0){
74 map.put("functionCode", "3"); 76 map.put("functionCode", "3");
75 map.put("busType","MT1201"); 77 map.put("busType","MT1201");
76 NMMS_CUSTOM_RESPONSE nmmsCustomResponse = ReturnUtil.nmmsCustomResponse(map); 78 NMMS_CUSTOM_RESPONSE nmmsCustomResponse = ReturnUtil.nmmsCustomResponse(map);
@@ -93,12 +95,18 @@ public class MT1201ServiceImp extends CustomXmlMaker implements MT1201Service{ @@ -93,12 +95,18 @@ public class MT1201ServiceImp extends CustomXmlMaker implements MT1201Service{
93 ObjectMapper objectMapper = new ObjectMapper(); 95 ObjectMapper objectMapper = new ObjectMapper();
94 // 预配 96 // 预配
95 NMMS_CUSTOM_MT1201 customMt1201 = objectMapper.convertValue(map.get("mt1201"), NMMS_CUSTOM_MT1201.class); 97 NMMS_CUSTOM_MT1201 customMt1201 = objectMapper.convertValue(map.get("mt1201"), NMMS_CUSTOM_MT1201.class);
  98 + String splitcode = customMt1201.getSplitcode();
  99 + if(StringUtils.isEmpty(splitcode)){
  100 + if ("T".equals(splitcode) || "S".equals(splitcode)){
  101 + customMt1201.setSplitcode("0");
  102 + }else {
  103 + customMt1201.setSplitcode("1");
  104 + }
  105 + }
96 // 运单 106 // 运单
97 AWB_AWBINFO awbAwbinfo = customMt1201.getAwbinfo(); 107 AWB_AWBINFO awbAwbinfo = customMt1201.getAwbinfo();
98 // 关区代码 108 // 关区代码
99 String customCode = customMt1201.getCustomcode(); 109 String customCode = customMt1201.getCustomcode();
100 - // 报文头时间 精确到毫秒  
101 - map.put("sendTime", DateUtil.getCurrentTime17());  
102 // 航班起飞时间 sendTime(海关接受时间) + 1小时 110 // 航班起飞时间 sendTime(海关接受时间) + 1小时
103 String s = DateUtil.addDateMinut(new Date(), 1); 111 String s = DateUtil.addDateMinut(new Date(), 1);
104 // 航班到达时间 航班起飞时间 + 2小时/+当前是间加3个小时 112 // 航班到达时间 航班起飞时间 + 2小时/+当前是间加3个小时
@@ -114,18 +122,18 @@ public class MT1201ServiceImp extends CustomXmlMaker implements MT1201Service{ @@ -114,18 +122,18 @@ public class MT1201ServiceImp extends CustomXmlMaker implements MT1201Service{
114 // 处理主单号- 122 // 处理主单号-
115 String awba = ReturnUtil.awbaReplace(customMt1201.getAwba()); 123 String awba = ReturnUtil.awbaReplace(customMt1201.getAwba());
116 map.put("awba", awba); 124 map.put("awba", awba);
117 - // 生成报文头部  
118 - String msgId = makeMsgID("MT1201", orgsn, customMt1201.getAwba());  
119 - String senderId = makeSenderID(customCode, orgsn, "");  
120 - String receiverID = customCode;  
121 - map.put("msgId", msgId);  
122 - map.put("senderId", senderId);  
123 - map.put("receiverID", receiverID); 125 +
  126 + // 生成报文头部信息
  127 + CustomsXmlFactory customsXmlFactory = new CustomsXmlFactory();
  128 + CustomsXmlHeader message = customsXmlFactory.getCustomsXmlHeader("MESSAGE");
  129 + Map<String, Object> mt1201 = message.makeHeader(customCode, orgsn, awba, mq_number, "MT1201");
  130 + map.put("map", mt1201);
  131 +
124 // 舱单传输人名称 132 // 舱单传输人名称
125 map.put("orgCode", orgCode); 133 map.put("orgCode", orgCode);
126 Map<String, Object> maps = new HashMap<>(); 134 Map<String, Object> maps = new HashMap<>();
127 // 生成报文 135 // 生成报文
128 - if (makeXmlToFile(map.get("templatePath").toString(), msgId+".xml", map, map.get("sendPath").toString())>0){ 136 + if (makeXmlToFile(map.get("templatePath").toString(), mt1201.get("messageID")+".xml", map, map.get("sendPath").toString())>0){
129 if (!map.containsKey("reason")){ 137 if (!map.containsKey("reason")){
130 map.put("functionCode", "9"); 138 map.put("functionCode", "9");
131 map.put("busType","MT1201"); 139 map.put("busType","MT1201");
@@ -59,6 +59,9 @@ public class MT2201ServiceImp extends CustomXmlMaker implements MT2201Service { @@ -59,6 +59,9 @@ public class MT2201ServiceImp extends CustomXmlMaker implements MT2201Service {
59 @Value("${custom.org-code}") 59 @Value("${custom.org-code}")
60 private String orgCode; 60 private String orgCode;
61 61
  62 + @Value("${custom.mq-number}")
  63 + private String mq_number;
  64 +
62 @Override 65 @Override
63 public List<Map<String, Object>> creatMt2201(List<NMMS_CUSTOM_MT2201> nmmsCustomMt2201List) throws IOException, ParseException { 66 public List<Map<String, Object>> creatMt2201(List<NMMS_CUSTOM_MT2201> nmmsCustomMt2201List) throws IOException, ParseException {
64 List<Map<String, Object>> mapList = new ArrayList<>(); 67 List<Map<String, Object>> mapList = new ArrayList<>();
@@ -95,23 +98,19 @@ public class MT2201ServiceImp extends CustomXmlMaker implements MT2201Service { @@ -95,23 +98,19 @@ public class MT2201ServiceImp extends CustomXmlMaker implements MT2201Service {
95 98
96 @Override 99 @Override
97 public Map<String, Object> removeMt2201(Map<String, Object> map) throws IOException, ParseException { 100 public Map<String, Object> removeMt2201(Map<String, Object> map) throws IOException, ParseException {
98 - 101 + String awba = ReturnUtil.awbaReplace(map.get("awba").toString());
99 String customCode = map.get("customCode").toString(); 102 String customCode = map.get("customCode").toString();
  103 +
100 // 生成报文头部信息 104 // 生成报文头部信息
101 CustomsXmlFactory customsXmlFactory = new CustomsXmlFactory(); 105 CustomsXmlFactory customsXmlFactory = new CustomsXmlFactory();
102 CustomsXmlHeader message = customsXmlFactory.getCustomsXmlHeader("MESSAGE"); 106 CustomsXmlHeader message = customsXmlFactory.getCustomsXmlHeader("MESSAGE");
103 - Map<String, Object> mt2201 = message.makeHeader(customCode, orgsn, map.get("awba").toString(), orgCode, "", "MT2201"); 107 + Map<String, Object> mt2201 = message.makeHeader(customCode, orgsn, awba, mq_number, "MT2201");
104 map.put("map", mt2201); 108 map.put("map", mt2201);
105 // 舱单传输人名称 109 // 舱单传输人名称
106 map.put("orgCode", orgCode); 110 map.put("orgCode", orgCode);
107 -// // 处理主单号-  
108 -// String awba = ReturnUtil.awbaReplace(map.get("awba").toString());  
109 -// map.put("awbas", awba);  
110 -// String flightDate = ReturnUtil.awbaReplace(map.get("flightDate").toString());  
111 -// map.put("flightDates",flightDate);  
112 Map<String, Object> hashMap = new HashMap<>(); 111 Map<String, Object> hashMap = new HashMap<>();
113 // 生成报文 112 // 生成报文
114 - if (makeXmlToFile("/remove/MT2201.ftlx", mt2201.get("messageID").toString()+".xml", map, "./send/remove/")>0){ 113 + if (makeXmlToFile("/remove/MT2201.ftlx", mt2201.get("messageID")+".xml", map, "./send/remove/")>0){
115 map.put("functionCode", "3"); 114 map.put("functionCode", "3");
116 map.put("busType","MT2201"); 115 map.put("busType","MT2201");
117 NMMS_CUSTOM_RESPONSE nmmsCustomResponse = ReturnUtil.nmmsCustomResponse(map); 116 NMMS_CUSTOM_RESPONSE nmmsCustomResponse = ReturnUtil.nmmsCustomResponse(map);
@@ -160,7 +159,7 @@ public class MT2201ServiceImp extends CustomXmlMaker implements MT2201Service { @@ -160,7 +159,7 @@ public class MT2201ServiceImp extends CustomXmlMaker implements MT2201Service {
160 // 生成报文头部信息 159 // 生成报文头部信息
161 CustomsXmlFactory customsXmlFactory = new CustomsXmlFactory(); 160 CustomsXmlFactory customsXmlFactory = new CustomsXmlFactory();
162 CustomsXmlHeader message = customsXmlFactory.getCustomsXmlHeader("MESSAGE"); 161 CustomsXmlHeader message = customsXmlFactory.getCustomsXmlHeader("MESSAGE");
163 - Map<String, Object> mt2201 = message.makeHeader(customCode, orgsn, custom_mt2201.getAwba(), orgCode, "", "MT2201"); 162 + Map<String, Object> mt2201 = message.makeHeader(customCode, orgsn, awba, mq_number, "MT2201");
164 map.put("map", mt2201); 163 map.put("map", mt2201);
165 String s = DateUtil.addDateMinut(new Date(), 6); 164 String s = DateUtil.addDateMinut(new Date(), 6);
166 // 货物装卸时间 165 // 货物装卸时间
@@ -28,7 +28,7 @@ public class MT3201ServiceImp extends CustomXmlMaker implements MT3201Service { @@ -28,7 +28,7 @@ public class MT3201ServiceImp extends CustomXmlMaker implements MT3201Service {
28 private String orgCode; 28 private String orgCode;
29 29
30 @Value("${tcs.mq-number}") 30 @Value("${tcs.mq-number}")
31 - private String tcss; 31 + private String mq_number;
32 32
33 @Override 33 @Override
34 public Map<String, Object> fohcreate(Map<String, Object> map) throws IOException, ParseException { 34 public Map<String, Object> fohcreate(Map<String, Object> map) throws IOException, ParseException {
@@ -45,7 +45,7 @@ public class MT3201ServiceImp extends CustomXmlMaker implements MT3201Service { @@ -45,7 +45,7 @@ public class MT3201ServiceImp extends CustomXmlMaker implements MT3201Service {
45 // 生成报文头部信息 45 // 生成报文头部信息
46 CustomsXmlFactory customsXmlFactory = new CustomsXmlFactory(); 46 CustomsXmlFactory customsXmlFactory = new CustomsXmlFactory();
47 CustomsXmlHeader message = customsXmlFactory.getCustomsXmlHeader("MESSAGE"); 47 CustomsXmlHeader message = customsXmlFactory.getCustomsXmlHeader("MESSAGE");
48 - Map<String, Object> mt3201 = message.makeHeader(customCode, orgsn, customMt3201.getAwba(), orgCode, tcss, "MT3201"); 48 + Map<String, Object> mt3201 = message.makeHeader(customCode, orgsn, awba, mq_number, "MT3201");
49 map.put("map", mt3201); 49 map.put("map", mt3201);
50 50
51 Map<String, Object> map3201= new HashMap<>(); 51 Map<String, Object> map3201= new HashMap<>();
@@ -98,7 +98,7 @@ public class MT3201ServiceImp extends CustomXmlMaker implements MT3201Service { @@ -98,7 +98,7 @@ public class MT3201ServiceImp extends CustomXmlMaker implements MT3201Service {
98 // 生成报文头部信息 98 // 生成报文头部信息
99 CustomsXmlFactory customsXmlFactory = new CustomsXmlFactory(); 99 CustomsXmlFactory customsXmlFactory = new CustomsXmlFactory();
100 CustomsXmlHeader message = customsXmlFactory.getCustomsXmlHeader("MESSAGE"); 100 CustomsXmlHeader message = customsXmlFactory.getCustomsXmlHeader("MESSAGE");
101 - Map<String, Object> mt3201 = message.makeHeader(customCode, orgsn, map.get("awba").toString(), orgCode, tcss, "MT3201"); 101 + Map<String, Object> mt3201 = message.makeHeader(customCode, orgsn, awba, mq_number, "MT3201");
102 map.put("map", mt3201); 102 map.put("map", mt3201);
103 103
104 if (makeXmlToFile("/remove/MT3201.ftlx", mt3201.get("messageID")+".xml", map,"./send/remove/")>0){ 104 if (makeXmlToFile("/remove/MT3201.ftlx", mt3201.get("messageID")+".xml", map,"./send/remove/")>0){
@@ -3,6 +3,8 @@ package com.sunyo.wlpt.message.builder.service.imp; @@ -3,6 +3,8 @@ package com.sunyo.wlpt.message.builder.service.imp;
3 import com.fasterxml.jackson.databind.ObjectMapper; 3 import com.fasterxml.jackson.databind.ObjectMapper;
4 import com.sunyo.wlpt.base.model.NMMS_CUSTOM_RESPONSE; 4 import com.sunyo.wlpt.base.model.NMMS_CUSTOM_RESPONSE;
5 import com.sunyo.wlpt.base.model.NMMS_CUSTOM_TRANS; 5 import com.sunyo.wlpt.base.model.NMMS_CUSTOM_TRANS;
  6 +import com.sunyo.wlpt.message.builder.factory.CustomsXmlFactory;
  7 +import com.sunyo.wlpt.message.builder.factory.CustomsXmlHeader;
6 import com.sunyo.wlpt.message.builder.service.MT3202Service; 8 import com.sunyo.wlpt.message.builder.service.MT3202Service;
7 import com.sunyo.wlpt.message.builder.util.CustomXmlMaker; 9 import com.sunyo.wlpt.message.builder.util.CustomXmlMaker;
8 import com.sunyo.wlpt.message.builder.util.ReturnUtil; 10 import com.sunyo.wlpt.message.builder.util.ReturnUtil;
@@ -22,6 +24,9 @@ public class MT3202ServiceImp extends CustomXmlMaker implements MT3202Service { @@ -22,6 +24,9 @@ public class MT3202ServiceImp extends CustomXmlMaker implements MT3202Service {
22 @Value("${custom.custom-code}") 24 @Value("${custom.custom-code}")
23 private String orgsn; 25 private String orgsn;
24 26
  27 + @Value("${tcs.mq-number}")
  28 + private String mq_number;
  29 +
25 @Override 30 @Override
26 public Map<String, Object> createMt3202(Map<String, Object> map) throws ParseException, IOException { 31 public Map<String, Object> createMt3202(Map<String, Object> map) throws ParseException, IOException {
27 32
@@ -30,8 +35,6 @@ public class MT3202ServiceImp extends CustomXmlMaker implements MT3202Service { @@ -30,8 +35,6 @@ public class MT3202ServiceImp extends CustomXmlMaker implements MT3202Service {
30 NMMS_CUSTOM_TRANS nmmsCustomTrans = objectMapper.convertValue(map.get("mt3202"), NMMS_CUSTOM_TRANS.class); 35 NMMS_CUSTOM_TRANS nmmsCustomTrans = objectMapper.convertValue(map.get("mt3202"), NMMS_CUSTOM_TRANS.class);
31 // 关区代码 36 // 关区代码
32 String customCode = nmmsCustomTrans.getCustomcode(); 37 String customCode = nmmsCustomTrans.getCustomcode();
33 - // 报文头时间 精确到毫秒  
34 - map.put("sendTime", DateUtil.getCurrentTime17());  
35 // 封装实体 38 // 封装实体
36 map.put("mt", nmmsCustomTrans); 39 map.put("mt", nmmsCustomTrans);
37 40
@@ -39,19 +42,15 @@ public class MT3202ServiceImp extends CustomXmlMaker implements MT3202Service { @@ -39,19 +42,15 @@ public class MT3202ServiceImp extends CustomXmlMaker implements MT3202Service {
39 String awba = ReturnUtil.awbaReplace(nmmsCustomTrans.getAwba()); 42 String awba = ReturnUtil.awbaReplace(nmmsCustomTrans.getAwba());
40 map.put("awba", awba); 43 map.put("awba", awba);
41 44
42 - // 生成报文头部  
43 - String msgId = makeMsgID("MT3202", orgsn, nmmsCustomTrans.getAwba());  
44 - String msessageType = "MT3202";  
45 - String senderId = makeSenderID(customCode, orgsn, "");  
46 - String receiverID = customCode;  
47 - map.put("msgId", msgId);  
48 - map.put("msessageType", msessageType);  
49 - map.put("senderId", senderId);  
50 - map.put("receiverID", receiverID); 45 + // 生成报文头部信息
  46 + CustomsXmlFactory customsXmlFactory = new CustomsXmlFactory();
  47 + CustomsXmlHeader message = customsXmlFactory.getCustomsXmlHeader("MESSAGE");
  48 + Map<String, Object> mt3202 = message.makeHeader(customCode, orgsn, awba, mq_number, "MT3202");
  49 + map.put("map", mt3202);
51 50
52 Map<String, Object> map3202 = new HashMap<>(); 51 Map<String, Object> map3202 = new HashMap<>();
53 52
54 - if (makeXmlToFile("/manifest/MT3202.ftlx", msgId+".xml", map, "./send/add/")>0){ 53 + if (makeXmlToFile("/manifest/MT3202.ftlx", mt3202.get("messageID")+".xml", map, "./send/add/")>0){
55 map.put("functionCode", "2"); 54 map.put("functionCode", "2");
56 map.put("busType","MT3202"); 55 map.put("busType","MT3202");
57 NMMS_CUSTOM_RESPONSE nmmsCustomResponse = ReturnUtil.nmmsCustomResponse(map); 56 NMMS_CUSTOM_RESPONSE nmmsCustomResponse = ReturnUtil.nmmsCustomResponse(map);
@@ -83,27 +82,25 @@ public class MT3202ServiceImp extends CustomXmlMaker implements MT3202Service { @@ -83,27 +82,25 @@ public class MT3202ServiceImp extends CustomXmlMaker implements MT3202Service {
83 82
84 @Override 83 @Override
85 public Map<String, Object> removeMt3202(Map<String, Object> map) throws IOException, ParseException { 84 public Map<String, Object> removeMt3202(Map<String, Object> map) throws IOException, ParseException {
  85 + // 处理主单号 -
  86 + String awba = ReturnUtil.awbaReplace(map.get("awba").toString());
86 // 关区代码 87 // 关区代码
87 String customCode = map.get("customCode").toString(); 88 String customCode = map.get("customCode").toString();
88 // 报文头时间 精确到毫秒 89 // 报文头时间 精确到毫秒
89 map.put("sendTime", DateUtil.getCurrentTime17()); 90 map.put("sendTime", DateUtil.getCurrentTime17());
90 - // 生成报文头部  
91 - String msgId = makeMsgID("MT3202", orgsn, map.get("awba").toString());  
92 - String senderId = makeSenderID(customCode, orgsn, "");  
93 - String receiverID = customCode;  
94 - map.put("msgId", msgId);  
95 - map.put("senderId", senderId);  
96 - map.put("receiverID", receiverID);  
97 91
98 - // 处理主单号 -  
99 - String awba = ReturnUtil.awbaReplace(map.get("awba").toString());  
100 - map.put("awbas", awba); 92 + // 生成报文头部信息
  93 + CustomsXmlFactory customsXmlFactory = new CustomsXmlFactory();
  94 + CustomsXmlHeader message = customsXmlFactory.getCustomsXmlHeader("MESSAGE");
  95 + Map<String, Object> mt3202 = message.makeHeader(customCode, orgsn, awba, mq_number, "MT3202");
  96 + map.put("map", mt3202);
101 97
  98 + map.put("awbas", awba);
102 String flightDate = ReturnUtil.awbaReplace(map.get("flightDate").toString()); 99 String flightDate = ReturnUtil.awbaReplace(map.get("flightDate").toString());
103 map.put("flightDates",flightDate); 100 map.put("flightDates",flightDate);
104 101
105 Map<String, Object> map3201 = new HashMap<>(); 102 Map<String, Object> map3201 = new HashMap<>();
106 - if (makeXmlToFile("/remove/MT3202.ftlx", msgId+".xml", map,"./send/remove/")>0){ 103 + if (makeXmlToFile("/remove/MT3202.ftlx", mt3202.get("messageID")+".xml", map,"./send/remove/")>0){
107 map.put("functionCode", "3"); 104 map.put("functionCode", "3");
108 map.put("busType","MT3202"); 105 map.put("busType","MT3202");
109 NMMS_CUSTOM_RESPONSE nmmsCustomResponse = ReturnUtil.nmmsCustomResponse(map); 106 NMMS_CUSTOM_RESPONSE nmmsCustomResponse = ReturnUtil.nmmsCustomResponse(map);
@@ -27,6 +27,9 @@ public class MT4201ServiceImp extends CustomXmlMaker implements MT4201Service { @@ -27,6 +27,9 @@ public class MT4201ServiceImp extends CustomXmlMaker implements MT4201Service {
27 @Value("${custom.custom-code}") 27 @Value("${custom.custom-code}")
28 private String orgsn; 28 private String orgsn;
29 29
  30 + @Value("${tcs.mq-number}")
  31 + private String mq_number;
  32 +
30 @Override 33 @Override
31 public Map<String, Object> pffmcreate(Map<String, Object> map) throws IOException, ParseException { 34 public Map<String, Object> pffmcreate(Map<String, Object> map) throws IOException, ParseException {
32 35
@@ -45,12 +48,12 @@ public class MT4201ServiceImp extends CustomXmlMaker implements MT4201Service { @@ -45,12 +48,12 @@ public class MT4201ServiceImp extends CustomXmlMaker implements MT4201Service {
45 // 生成报文头部信息 48 // 生成报文头部信息
46 CustomsXmlFactory customsXmlFactory = new CustomsXmlFactory(); 49 CustomsXmlFactory customsXmlFactory = new CustomsXmlFactory();
47 CustomsXmlHeader message = customsXmlFactory.getCustomsXmlHeader("MESSAGE"); 50 CustomsXmlHeader message = customsXmlFactory.getCustomsXmlHeader("MESSAGE");
48 - Map<String, Object> mt4201 = message.makeHeader(customCode, orgsn, customMt4201.getAwba(), "", "", "MT4201"); 51 + Map<String, Object> mt4201 = message.makeHeader(customCode, orgsn, customMt4201.getAwba(), mq_number, "MT4201");
49 map.put("map", mt4201); 52 map.put("map", mt4201);
50 53
51 54
52 Map<String, Object> map4201 = new HashMap<>(); 55 Map<String, Object> map4201 = new HashMap<>();
53 - if (makeXmlToFile("/manifest/MT4201.ftlx", mt4201.get("messageID").toString()+".xml", map, "./send/add/")>0){ 56 + if (makeXmlToFile("/manifest/MT4201.ftlx", mt4201.get("messageID")+".xml", map, "./send/add/")>0){
54 map.put("functionCode", "2"); 57 map.put("functionCode", "2");
55 map.put("busType","MT4201"); 58 map.put("busType","MT4201");
56 NMMS_CUSTOM_RESPONSE nmmsCustomResponse = ReturnUtil.nmmsCustomResponse(map); 59 NMMS_CUSTOM_RESPONSE nmmsCustomResponse = ReturnUtil.nmmsCustomResponse(map);
@@ -92,7 +95,7 @@ public class MT4201ServiceImp extends CustomXmlMaker implements MT4201Service { @@ -92,7 +95,7 @@ public class MT4201ServiceImp extends CustomXmlMaker implements MT4201Service {
92 // 生成报文头部信息 95 // 生成报文头部信息
93 CustomsXmlFactory customsXmlFactory = new CustomsXmlFactory(); 96 CustomsXmlFactory customsXmlFactory = new CustomsXmlFactory();
94 CustomsXmlHeader message = customsXmlFactory.getCustomsXmlHeader("MESSAGE"); 97 CustomsXmlHeader message = customsXmlFactory.getCustomsXmlHeader("MESSAGE");
95 - Map<String, Object> mt4201 = message.makeHeader(customCode, orgsn, map.get("awba").toString(), "", "", "MT4201"); 98 + Map<String, Object> mt4201 = message.makeHeader(customCode, orgsn, map.get("awba").toString(), mq_number, "MT4201");
96 map.put("map", mt4201); 99 map.put("map", mt4201);
97 100
98 // 处理主单号 - 101 // 处理主单号 -
@@ -102,7 +105,7 @@ public class MT4201ServiceImp extends CustomXmlMaker implements MT4201Service { @@ -102,7 +105,7 @@ public class MT4201ServiceImp extends CustomXmlMaker implements MT4201Service {
102 String flightDate = ReturnUtil.awbaReplace(map.get("flightDate").toString()); 105 String flightDate = ReturnUtil.awbaReplace(map.get("flightDate").toString());
103 map.put("flightDates",flightDate); 106 map.put("flightDates",flightDate);
104 Map<String, Object> map4201 = new HashMap<>(); 107 Map<String, Object> map4201 = new HashMap<>();
105 - if (makeXmlToFile("/remove/MT4201.ftlx", mt4201.get("messageID").toString()+".xml", map, "./send/remove/")>0){ 108 + if (makeXmlToFile("/remove/MT4201.ftlx", mt4201.get("messageID")+".xml", map, "./send/remove/")>0){
106 map.put("functionCode", "3"); 109 map.put("functionCode", "3");
107 map.put("busType","MT4201"); 110 map.put("busType","MT4201");
108 NMMS_CUSTOM_RESPONSE nmmsCustomResponse = ReturnUtil.nmmsCustomResponse(map); 111 NMMS_CUSTOM_RESPONSE nmmsCustomResponse = ReturnUtil.nmmsCustomResponse(map);
@@ -28,6 +28,9 @@ public class MT520XServiceImp extends CustomXmlMaker implements MT520XService{ @@ -28,6 +28,9 @@ public class MT520XServiceImp extends CustomXmlMaker implements MT520XService{
28 @Value("${custom.org-code}") 28 @Value("${custom.org-code}")
29 private String orgCode; 29 private String orgCode;
30 30
  31 + @Value("${custom.mq-number}")
  32 + private String mq_number;
  33 +
31 @Override 34 @Override
32 public Map<String, Object> create(Map<String, Object> map) throws IOException, ParseException { 35 public Map<String, Object> create(Map<String, Object> map) throws IOException, ParseException {
33 36
@@ -46,18 +49,14 @@ public class MT520XServiceImp extends CustomXmlMaker implements MT520XService{ @@ -46,18 +49,14 @@ public class MT520XServiceImp extends CustomXmlMaker implements MT520XService{
46 hashMap.put("mt", customMt520X); 49 hashMap.put("mt", customMt520X);
47 hashMap.put("orgCode", orgCode); 50 hashMap.put("orgCode", orgCode);
48 if ("MT5201".equals(customMt520X.getRcfdep())){ 51 if ("MT5201".equals(customMt520X.getRcfdep())){
49 - // 生成报文头部  
50 - String msgId = makeMsgID("MT5201", orgsn, customMt520X.getAwba());  
51 - String msessageType = "MT5201";  
52 - String senderId = makeSenderID(customCode, orgsn, "");  
53 - String receiverID = customCode;  
54 - hashMap.put("msgId", msgId);  
55 - hashMap.put("msessageType", msessageType);  
56 - hashMap.put("senderId", senderId);  
57 - hashMap.put("receiverID", receiverID); 52 + // 生成报文头部信息
  53 + CustomsXmlFactory customsXmlFactory = new CustomsXmlFactory();
  54 + CustomsXmlHeader message = customsXmlFactory.getCustomsXmlHeader("MESSAGE");
  55 + Map<String, Object> mt5201 = message.makeHeader(customCode, orgsn, awba, mq_number, "MT5201");
  56 + map.put("map", mt5201);
58 57
59 Map<String, Object> maps = new HashMap<>(); 58 Map<String, Object> maps = new HashMap<>();
60 - if (makeXmlToFile("/manifest/MT5201.ftlx", msgId+".xml", hashMap, "./send/add/")>0){ 59 + if (makeXmlToFile("/manifest/MT5201.ftlx", mt5201.get("messageID").toString()+".xml", hashMap, "./send/add/")>0){
61 60
62 hashMap.put("functionCode", "2"); 61 hashMap.put("functionCode", "2");
63 hashMap.put("busType","MT5201"); 62 hashMap.put("busType","MT5201");
@@ -91,7 +90,7 @@ public class MT520XServiceImp extends CustomXmlMaker implements MT520XService{ @@ -91,7 +90,7 @@ public class MT520XServiceImp extends CustomXmlMaker implements MT520XService{
91 // 生成报文头部信息 90 // 生成报文头部信息
92 CustomsXmlFactory customsXmlFactory = new CustomsXmlFactory(); 91 CustomsXmlFactory customsXmlFactory = new CustomsXmlFactory();
93 CustomsXmlHeader message = customsXmlFactory.getCustomsXmlHeader("MESSAGE"); 92 CustomsXmlHeader message = customsXmlFactory.getCustomsXmlHeader("MESSAGE");
94 - Map<String, Object> mt520x = message.makeHeader(customCode, orgsn, customMt520X.getAwba(), orgCode, "", "MT5202"); 93 + Map<String, Object> mt520x = message.makeHeader(customCode, orgsn, awba, mq_number, "MT5202");
95 hashMap .put("map", mt520x); 94 hashMap .put("map", mt520x);
96 95
97 Map<String, Object> maps = new HashMap<>(); 96 Map<String, Object> maps = new HashMap<>();
@@ -133,8 +132,6 @@ public class MT520XServiceImp extends CustomXmlMaker implements MT520XService{ @@ -133,8 +132,6 @@ public class MT520XServiceImp extends CustomXmlMaker implements MT520XService{
133 132
134 String customCode = map.get("customCode").toString(); 133 String customCode = map.get("customCode").toString();
135 map.put("customCode", customCode); 134 map.put("customCode", customCode);
136 - // 报文头时间 精确到毫秒  
137 - map.put("sendTime", DateUtil.getCurrentTime17());  
138 135
139 // 处理主单号- 136 // 处理主单号-
140 String awba = ReturnUtil.awbaReplace(map.get("awba").toString()); 137 String awba = ReturnUtil.awbaReplace(map.get("awba").toString());
@@ -144,15 +141,13 @@ public class MT520XServiceImp extends CustomXmlMaker implements MT520XService{ @@ -144,15 +141,13 @@ public class MT520XServiceImp extends CustomXmlMaker implements MT520XService{
144 map.put("flightDates",flightDate); 141 map.put("flightDates",flightDate);
145 142
146 if ("MT5201".equals(map.get("rcfdep").toString())){ 143 if ("MT5201".equals(map.get("rcfdep").toString())){
147 - // 生成报文头部  
148 - String msgId = makeMsgID("MT5201", orgsn, map.get("awba").toString());  
149 - String senderId = makeSenderID(customCode, orgsn, "");  
150 - String receiverID = customCode;  
151 - map.put("msgId", msgId);  
152 - map.put("senderId", senderId);  
153 - map.put("receiverID", receiverID); 144 + // 生成报文头部信息
  145 + CustomsXmlFactory customsXmlFactory = new CustomsXmlFactory();
  146 + CustomsXmlHeader message = customsXmlFactory.getCustomsXmlHeader("MESSAGE");
  147 + Map<String, Object> mt5201 = message.makeHeader(customCode, orgsn, awba, mq_number, "MT5201");
  148 + map.put("map", mt5201);
154 Map<String, Object> maps = new HashMap<>(); 149 Map<String, Object> maps = new HashMap<>();
155 - if (makeXmlToFile("/remove/MT5201.ftlx", msgId+".xml", map, "./send/remove/")>0){ 150 + if (makeXmlToFile("/remove/MT5201.ftlx", mt5201.get("messageID")+".xml", map, "./send/remove/")>0){
156 151
157 map.put("functionCode", "3"); 152 map.put("functionCode", "3");
158 map.put("busType","MT5201"); 153 map.put("busType","MT5201");
@@ -173,7 +168,7 @@ public class MT520XServiceImp extends CustomXmlMaker implements MT520XService{ @@ -173,7 +168,7 @@ public class MT520XServiceImp extends CustomXmlMaker implements MT520XService{
173 // 生成报文头部信息 168 // 生成报文头部信息
174 CustomsXmlFactory customsXmlFactory = new CustomsXmlFactory(); 169 CustomsXmlFactory customsXmlFactory = new CustomsXmlFactory();
175 CustomsXmlHeader message = customsXmlFactory.getCustomsXmlHeader("MESSAGE"); 170 CustomsXmlHeader message = customsXmlFactory.getCustomsXmlHeader("MESSAGE");
176 - Map<String, Object> mt520x = message.makeHeader(customCode, orgsn, map.get("awba").toString(), orgCode, "", "MT5202"); 171 + Map<String, Object> mt520x = message.makeHeader(customCode, orgsn, awba, mq_number, "MT5202");
177 map.put("map", mt520x); 172 map.put("map", mt520x);
178 173
179 Map<String, Object> maps = new HashMap<>(); 174 Map<String, Object> maps = new HashMap<>();
@@ -3,6 +3,8 @@ package com.sunyo.wlpt.message.builder.service.imp; @@ -3,6 +3,8 @@ package com.sunyo.wlpt.message.builder.service.imp;
3 import com.fasterxml.jackson.databind.ObjectMapper; 3 import com.fasterxml.jackson.databind.ObjectMapper;
4 import com.sunyo.wlpt.base.model.NMMS_CUSTOM_RESPONSE; 4 import com.sunyo.wlpt.base.model.NMMS_CUSTOM_RESPONSE;
5 import com.sunyo.wlpt.base.model.NMMS_CUSTOM_TRANS; 5 import com.sunyo.wlpt.base.model.NMMS_CUSTOM_TRANS;
  6 +import com.sunyo.wlpt.message.builder.factory.CustomsXmlFactory;
  7 +import com.sunyo.wlpt.message.builder.factory.CustomsXmlHeader;
6 import com.sunyo.wlpt.message.builder.service.MT6202Service; 8 import com.sunyo.wlpt.message.builder.service.MT6202Service;
7 import com.sunyo.wlpt.message.builder.util.CustomXmlMaker; 9 import com.sunyo.wlpt.message.builder.util.CustomXmlMaker;
8 import com.sunyo.wlpt.message.builder.util.ReturnUtil; 10 import com.sunyo.wlpt.message.builder.util.ReturnUtil;
@@ -22,6 +24,9 @@ public class MT6202ServiceImp extends CustomXmlMaker implements MT6202Service{ @@ -22,6 +24,9 @@ public class MT6202ServiceImp extends CustomXmlMaker implements MT6202Service{
22 @Value("${custom.custom-code}") 24 @Value("${custom.custom-code}")
23 private String orgsn; 25 private String orgsn;
24 26
  27 + @Value("${custom.mq-number}")
  28 + private String mq_number;
  29 +
25 @Override 30 @Override
26 public Map<String, Object> creatMt6202(Map<String, Object> map) throws IOException, ParseException { 31 public Map<String, Object> creatMt6202(Map<String, Object> map) throws IOException, ParseException {
27 ObjectMapper objectMapper = new ObjectMapper(); 32 ObjectMapper objectMapper = new ObjectMapper();
@@ -29,8 +34,6 @@ public class MT6202ServiceImp extends CustomXmlMaker implements MT6202Service{ @@ -29,8 +34,6 @@ public class MT6202ServiceImp extends CustomXmlMaker implements MT6202Service{
29 NMMS_CUSTOM_TRANS nmmsCustomTrans = objectMapper.convertValue(map.get("mt6202"), NMMS_CUSTOM_TRANS.class); 34 NMMS_CUSTOM_TRANS nmmsCustomTrans = objectMapper.convertValue(map.get("mt6202"), NMMS_CUSTOM_TRANS.class);
30 // 关区代码 35 // 关区代码
31 String customCode = nmmsCustomTrans.getCustomcode(); 36 String customCode = nmmsCustomTrans.getCustomcode();
32 - // 报文头时间 精确到毫秒  
33 - map.put("sendTime", DateUtil.getCurrentTime17());  
34 // 封装实体 37 // 封装实体
35 map.put("mt", nmmsCustomTrans); 38 map.put("mt", nmmsCustomTrans);
36 39
@@ -38,19 +41,15 @@ public class MT6202ServiceImp extends CustomXmlMaker implements MT6202Service{ @@ -38,19 +41,15 @@ public class MT6202ServiceImp extends CustomXmlMaker implements MT6202Service{
38 String awba = ReturnUtil.awbaReplace(nmmsCustomTrans.getAwba()); 41 String awba = ReturnUtil.awbaReplace(nmmsCustomTrans.getAwba());
39 map.put("awba", awba); 42 map.put("awba", awba);
40 43
41 - // 生成报文头部  
42 - String msgId = makeMsgID("MT6202", orgsn, nmmsCustomTrans.getAwba());  
43 - String msessageType = "MT6202";  
44 - String senderId = makeSenderID(customCode, orgsn, "");  
45 - String receiverID = customCode;  
46 - map.put("msgId", msgId);  
47 - map.put("msessageType", msessageType);  
48 - map.put("senderId", senderId);  
49 - map.put("receiverID", receiverID); 44 + // 生成报文头部信息
  45 + CustomsXmlFactory customsXmlFactory = new CustomsXmlFactory();
  46 + CustomsXmlHeader message = customsXmlFactory.getCustomsXmlHeader("MESSAGE");
  47 + Map<String, Object> mt6202 = message.makeHeader(customCode, orgsn, awba, mq_number, "MT6202");
  48 + map.put("map", mt6202);
50 49
51 Map<String, Object> map6202 = new HashMap<>(); 50 Map<String, Object> map6202 = new HashMap<>();
52 51
53 - if (makeXmlToFile("/manifest/MT6202.ftlx", msgId+".xml", map, "./send/add/")>0){ 52 + if (makeXmlToFile("/manifest/MT6202.ftlx", mt6202.get("messageID")+".xml", map, "./send/add/")>0){
54 map.put("functionCode", "2"); 53 map.put("functionCode", "2");
55 map.put("busType","MT6202"); 54 map.put("busType","MT6202");
56 NMMS_CUSTOM_RESPONSE nmmsCustomResponse = ReturnUtil.nmmsCustomResponse(map); 55 NMMS_CUSTOM_RESPONSE nmmsCustomResponse = ReturnUtil.nmmsCustomResponse(map);
@@ -82,27 +81,25 @@ public class MT6202ServiceImp extends CustomXmlMaker implements MT6202Service{ @@ -82,27 +81,25 @@ public class MT6202ServiceImp extends CustomXmlMaker implements MT6202Service{
82 81
83 @Override 82 @Override
84 public Map<String, Object> removeMt6202(Map<String, Object> map) throws IOException, ParseException { 83 public Map<String, Object> removeMt6202(Map<String, Object> map) throws IOException, ParseException {
85 - // 关区代码  
86 - String customCode = map.get("customCode").toString();  
87 - // 报文头时间 精确到毫秒  
88 - map.put("sendTime", DateUtil.getCurrentTime17());  
89 - // 生成报文头部  
90 - String msgId = makeMsgID("MT6202", orgsn, map.get("awba").toString());  
91 - String senderId = makeSenderID(customCode, orgsn, "");  
92 - String receiverID = customCode;  
93 - map.put("msgId", msgId);  
94 - map.put("senderId", senderId);  
95 - map.put("receiverID", receiverID);  
96 84
97 // 处理主单号 - 85 // 处理主单号 -
98 String awba = ReturnUtil.awbaReplace(map.get("awba").toString()); 86 String awba = ReturnUtil.awbaReplace(map.get("awba").toString());
  87 + // 关区代码
  88 + String customCode = map.get("customCode").toString();
  89 +
  90 + // 生成报文头部信息
  91 + CustomsXmlFactory customsXmlFactory = new CustomsXmlFactory();
  92 + CustomsXmlHeader message = customsXmlFactory.getCustomsXmlHeader("MESSAGE");
  93 + Map<String, Object> mt6202 = message.makeHeader(customCode, orgsn, awba, mq_number, "MT6202");
  94 + map.put("map", mt6202);
  95 +
99 map.put("awbas", awba); 96 map.put("awbas", awba);
100 97
101 String flightDate = ReturnUtil.awbaReplace(map.get("flightDate").toString()); 98 String flightDate = ReturnUtil.awbaReplace(map.get("flightDate").toString());
102 map.put("flightDates",flightDate); 99 map.put("flightDates",flightDate);
103 100
104 Map<String, Object> map3201 = new HashMap<>(); 101 Map<String, Object> map3201 = new HashMap<>();
105 - if (makeXmlToFile("/remove/MT6202.ftlx", msgId+".xml", map,"./send/remove/")>0){ 102 + if (makeXmlToFile("/remove/MT6202.ftlx", mt6202.get("messageID")+".xml", map,"./send/remove/")>0){
106 map.put("functionCode", "3"); 103 map.put("functionCode", "3");
107 map.put("busType","MT6202"); 104 map.put("busType","MT6202");
108 NMMS_CUSTOM_RESPONSE nmmsCustomResponse = ReturnUtil.nmmsCustomResponse(map); 105 NMMS_CUSTOM_RESPONSE nmmsCustomResponse = ReturnUtil.nmmsCustomResponse(map);
@@ -2,6 +2,8 @@ package com.sunyo.wlpt.message.builder.service.imp; @@ -2,6 +2,8 @@ package com.sunyo.wlpt.message.builder.service.imp;
2 2
3 import com.fasterxml.jackson.databind.ObjectMapper; 3 import com.fasterxml.jackson.databind.ObjectMapper;
4 import com.sunyo.wlpt.base.model.*; 4 import com.sunyo.wlpt.base.model.*;
  5 +import com.sunyo.wlpt.message.builder.factory.CustomsXmlFactory;
  6 +import com.sunyo.wlpt.message.builder.factory.CustomsXmlHeader;
5 import com.sunyo.wlpt.message.builder.service.MT8205Service; 7 import com.sunyo.wlpt.message.builder.service.MT8205Service;
6 import com.sunyo.wlpt.message.builder.util.CustomXmlMaker; 8 import com.sunyo.wlpt.message.builder.util.CustomXmlMaker;
7 import com.sunyo.wlpt.message.builder.util.ReturnUtil; 9 import com.sunyo.wlpt.message.builder.util.ReturnUtil;
@@ -26,6 +28,9 @@ public class MT8205ServiceImp extends CustomXmlMaker implements MT8205Service { @@ -26,6 +28,9 @@ public class MT8205ServiceImp extends CustomXmlMaker implements MT8205Service {
26 @Value("${custom.org-code}") 28 @Value("${custom.org-code}")
27 private String orgCode; 29 private String orgCode;
28 30
  31 + @Value("${custom.mq-number}")
  32 + private String mq_number;
  33 +
29 @Override 34 @Override
30 public Map<String, Object> create8205(Map<String, Object> map) throws IOException, ParseException { 35 public Map<String, Object> create8205(Map<String, Object> map) throws IOException, ParseException {
31 ObjectMapper objectMapper = new ObjectMapper(); 36 ObjectMapper objectMapper = new ObjectMapper();
@@ -41,39 +46,35 @@ public class MT8205ServiceImp extends CustomXmlMaker implements MT8205Service { @@ -41,39 +46,35 @@ public class MT8205ServiceImp extends CustomXmlMaker implements MT8205Service {
41 map.put("mt8205", customMt8205); 46 map.put("mt8205", customMt8205);
42 map.put("orgCode", orgCode); 47 map.put("orgCode", orgCode);
43 // 回执主单号带- 48 // 回执主单号带-
44 - String originawbano = customMt8205.getOriginawbano(); 49 + String transawbano = customMt8205.getTransawbano();
45 // 处理主单号 - 50 // 处理主单号 -
46 - customMt8205.setOriginawbano(ReturnUtil.awbaReplace(originawbano)); 51 + customMt8205.setOriginawbano(ReturnUtil.awbaReplace(customMt8205.getOriginawbano()));
47 52
48 // 处理主单号 - 53 // 处理主单号 -
49 - customMt8205.setTransawbano(ReturnUtil.awbaReplace(customMt8205.getTransawbano()));  
50 - // 生成报文头部  
51 - String msgId = makeMsgID("MT8205", orgsn, customMt8205.getOriginawbano());  
52 - String msessageType = "MT8205";  
53 - String senderId = makeSenderID(customCode, orgsn, "");  
54 - String receiverID = customCode;  
55 - map.put("msgId", msgId);  
56 - map.put("msessageType", msessageType);  
57 - map.put("senderId", senderId);  
58 - map.put("receiverID", receiverID); 54 + customMt8205.setTransawbano(ReturnUtil.awbaReplace(transawbano));
  55 + // 生成报文头部信息
  56 + CustomsXmlFactory customsXmlFactory = new CustomsXmlFactory();
  57 + CustomsXmlHeader message = customsXmlFactory.getCustomsXmlHeader("MESSAGE");
  58 + Map<String, Object> mt8205 = message.makeHeader(customCode, orgsn, customMt8205.getOriginawbano(), mq_number, "MT8205");
  59 + map.put("map", mt8205);
59 60
60 Map<String, Object> map8205 = new HashMap<>(); 61 Map<String, Object> map8205 = new HashMap<>();
61 62
62 - if (makeXmlToFile("/manifest/MT8205.ftlx", msgId+".xml", map, "./send/add/")>0){ 63 + if (makeXmlToFile("/manifest/MT8205.ftlx", mt8205.get("messageID")+".xml", map, "./send/add/")>0){
63 map.put("functionCode", "2"); 64 map.put("functionCode", "2");
64 map.put("busType","MT8205"); 65 map.put("busType","MT8205");
65 NMMS_CUSTOM_RESPONSE nmmsCustomResponse = ReturnUtil.nmmsCustomResponse(map); 66 NMMS_CUSTOM_RESPONSE nmmsCustomResponse = ReturnUtil.nmmsCustomResponse(map);
66 System.out.println(); 67 System.out.println();
67 // 航班日期 68 // 航班日期
68 - nmmsCustomResponse.setFlightdate(customMt8205.getOriginflightdate()); 69 + nmmsCustomResponse.setFlightdate(customMt8205.getTransflightdate());
69 // 航班号 70 // 航班号
70 - nmmsCustomResponse.setFlightno(customMt8205.getOriginflightno()); 71 + nmmsCustomResponse.setFlightno(customMt8205.getTransflightno());
71 // 航班承运人 72 // 航班承运人
72 - nmmsCustomResponse.setCarrier(customMt8205.getOrigincarrier()); 73 + nmmsCustomResponse.setCarrier(customMt8205.getTranscarrier());
73 // 主单号 74 // 主单号
74 - nmmsCustomResponse.setAwbano(originawbano); 75 + nmmsCustomResponse.setAwbano(transawbano);
75 // 分单号 76 // 分单号
76 - nmmsCustomResponse.setAwbhno(AwbaUtils.awbh(customMt8205.getOriginawbhno())); 77 + nmmsCustomResponse.setAwbhno(AwbaUtils.awbh(customMt8205.getTransawbhno()));
77 // 件数 78 // 件数
78 nmmsCustomResponse.setBuspiece(Integer.valueOf(customMt8205.getTranspiece().toString())); 79 nmmsCustomResponse.setBuspiece(Integer.valueOf(customMt8205.getTranspiece().toString()));
79 // 重量 80 // 重量
1 <Manifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:Declaration:datamodel:standard:CN:MT1201:1"> 1 <Manifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:Declaration:datamodel:standard:CN:MT1201:1">
2 <Head> 2 <Head>
3 - <MessageID>${msgId}</MessageID> 3 + <MessageID>${map.messageID}</MessageID>
4 <FunctionCode>5</FunctionCode> 4 <FunctionCode>5</FunctionCode>
5 <MessageType>MT1201</MessageType> 5 <MessageType>MT1201</MessageType>
6 - <SenderID>${senderId}</SenderID>  
7 - <ReceiverID>${receiverID}</ReceiverID>  
8 - <SendTime>${sendTime}</SendTime> 6 + <SenderID>${map.senderID}</SenderID>
  7 + <ReceiverID>${map.receiverID}</ReceiverID>
  8 + <SendTime>${map.sendTime}</SendTime>
9 <Version>1.0</Version> 9 <Version>1.0</Version>
10 </Head> 10 </Head>
11 <Declaration> 11 <Declaration>
@@ -46,7 +46,7 @@ @@ -46,7 +46,7 @@
46 <ArrivalDate>${arrival}</ArrivalDate> 46 <ArrivalDate>${arrival}</ArrivalDate>
47 </UnloadingLocation> 47 </UnloadingLocation>
48 <GoodsConsignedPlace> 48 <GoodsConsignedPlace>
49 - <ID>${mt.destinationstation}</ID> 49 + <ID>${mt.originstation}</ID>
50 </GoodsConsignedPlace> 50 </GoodsConsignedPlace>
51 <TransportSplitIndicator>${mt.splitcode}</TransportSplitIndicator> 51 <TransportSplitIndicator>${mt.splitcode}</TransportSplitIndicator>
52 <FreightPayment> 52 <FreightPayment>
@@ -97,4 +97,4 @@ @@ -97,4 +97,4 @@
97 <ContactTel>${contactTel}</ContactTel> 97 <ContactTel>${contactTel}</ContactTel>
98 </AdditionalInformation> 98 </AdditionalInformation>
99 </Declaration> 99 </Declaration>
100 -</Manifest>  
  100 +</Manifest>
1 <Manifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:Declaration:datamodel:standard:CN:MT1201:1"> 1 <Manifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:Declaration:datamodel:standard:CN:MT1201:1">
2 <Head> 2 <Head>
3 - <MessageID>${msgId}</MessageID> 3 + <MessageID>${map.messageID}</MessageID>
4 <FunctionCode>9</FunctionCode> 4 <FunctionCode>9</FunctionCode>
5 <MessageType>MT1201</MessageType> 5 <MessageType>MT1201</MessageType>
6 - <SenderID>${senderId}</SenderID>  
7 - <ReceiverID>${receiverID}</ReceiverID>  
8 - <SendTime>${sendTime}</SendTime> 6 + <SenderID>${map.senderID}</SenderID>
  7 + <ReceiverID>${map.receiverID}</ReceiverID>
  8 + <SendTime>${map.sendTime}</SendTime>
9 <Version>1.0</Version> 9 <Version>1.0</Version>
10 </Head> 10 </Head>
11 <Declaration> 11 <Declaration>
@@ -45,7 +45,7 @@ @@ -45,7 +45,7 @@
45 <ArrivalDate>${arrival}</ArrivalDate> 45 <ArrivalDate>${arrival}</ArrivalDate>
46 </UnloadingLocation> 46 </UnloadingLocation>
47 <GoodsConsignedPlace> 47 <GoodsConsignedPlace>
48 - <ID>${mt.destinationstation}</ID> 48 + <ID>${mt.originstation}</ID>
49 </GoodsConsignedPlace> 49 </GoodsConsignedPlace>
50 <CustomsStatusCode>${awbAwbinfo.awbtype}</CustomsStatusCode> 50 <CustomsStatusCode>${awbAwbinfo.awbtype}</CustomsStatusCode>
51 <TransportSplitIndicator>${mt.splitcode}</TransportSplitIndicator> 51 <TransportSplitIndicator>${mt.splitcode}</TransportSplitIndicator>
@@ -92,4 +92,4 @@ @@ -92,4 +92,4 @@
92 </ConsignmentItem> 92 </ConsignmentItem>
93 </Consignment> 93 </Consignment>
94 </Declaration> 94 </Declaration>
95 -</Manifest>  
  95 +</Manifest>
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <Manifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:Declaration:datamodel:standard:CN:MT3202:1"> 2 <Manifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:Declaration:datamodel:standard:CN:MT3202:1">
3 <Head> 3 <Head>
4 - <MessageID>${msgId}</MessageID>  
5 - <FunctionCode>2</FunctionCode> 4 + <MessageID>${map.messageID}</MessageID>
  5 + <FunctionCode>9</FunctionCode>
6 <MessageType>MT3202</MessageType> 6 <MessageType>MT3202</MessageType>
7 - <SenderID>${senderId}</SenderID>  
8 - <ReceiverID>${receiverID}</ReceiverID>  
9 - <SendTime>${sendTime}</SendTime> 7 + <SenderID>${map.senderID}</SenderID>
  8 + <ReceiverID>${map.receiverID}</ReceiverID>
  9 + <SendTime>${map.sendTime}</SendTime>
10 <Version>1.0</Version> 10 <Version>1.0</Version>
11 </Head> 11 </Head>
12 <Declaration> 12 <Declaration>
@@ -35,4 +35,4 @@ @@ -35,4 +35,4 @@
35 </ConsignmentItem> 35 </ConsignmentItem>
36 </Consignment> 36 </Consignment>
37 </Declaration> 37 </Declaration>
38 -</Manifest>  
  38 +</Manifest>
1 <Manifest xmlns="urn:Declaration:datamodel:standard:CN:MT5201:1" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 1 <Manifest xmlns="urn:Declaration:datamodel:standard:CN:MT5201:1" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
2 <Head> 2 <Head>
3 - <MessageID>${msgId}</MessageID> 3 + <MessageID>${map.messageID}</MessageID>
4 <FunctionCode>2</FunctionCode> 4 <FunctionCode>2</FunctionCode>
5 <MessageType>MT5201</MessageType> 5 <MessageType>MT5201</MessageType>
6 - <SenderID>${senderId}</SenderID>  
7 - <ReceiverID>${receiverID}</ReceiverID>  
8 - <SendTime>${sendTime}</SendTime> 6 + <SenderID>${map.senderID}</SenderID>
  7 + <ReceiverID>${map.receiverID}</ReceiverID>
  8 + <SendTime>${map.sendTime}</SendTime>
9 <Version>1.0</Version> 9 <Version>1.0</Version>
10 </Head> 10 </Head>
11 <Declaration> 11 <Declaration>
@@ -41,4 +41,4 @@ @@ -41,4 +41,4 @@
41 <TotalGrossMassMeasure>${mt.weight?c}</TotalGrossMassMeasure> 41 <TotalGrossMassMeasure>${mt.weight?c}</TotalGrossMassMeasure>
42 </Consignment> 42 </Consignment>
43 </Declaration> 43 </Declaration>
44 -</Manifest>  
  44 +</Manifest>
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <Manifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:Declaration:datamodel:standard:CN:MT6202:1"> 2 <Manifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:Declaration:datamodel:standard:CN:MT6202:1">
3 <Head> 3 <Head>
4 - <MessageID>${msgId}</MessageID> 4 + <MessageID>${map.messageID}</MessageID>
5 <FunctionCode>2</FunctionCode> 5 <FunctionCode>2</FunctionCode>
6 - <MessageType>MT8205</MessageType>  
7 - <SenderID>${senderId}</SenderID>  
8 - <ReceiverID>${receiverID}</ReceiverID>  
9 - <SendTime>${sendTime}</SendTime> 6 + <MessageType>MT6202</MessageType>
  7 + <SenderID>${map.senderID}</SenderID>
  8 + <ReceiverID>${map.receiverID}</ReceiverID>
  9 + <SendTime>${map.sendTime}</SendTime>
10 <Version>1.0</Version> 10 <Version>1.0</Version>
11 </Head> 11 </Head>
12 <Declaration> 12 <Declaration>
@@ -35,4 +35,4 @@ @@ -35,4 +35,4 @@
35 </BorderTransportMeans> 35 </BorderTransportMeans>
36 </Consignment> 36 </Consignment>
37 </Declaration> 37 </Declaration>
38 -</Manifest>  
  38 +</Manifest>
1 <Manifest xmlns="urn:Declaration:datamodel:standard:CN:MT8205:1" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 1 <Manifest xmlns="urn:Declaration:datamodel:standard:CN:MT8205:1" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
2 <Head> 2 <Head>
3 - <MessageID>${msgId}</MessageID> 3 + <MessageID>${map.messageID}</MessageID>
4 <FunctionCode>2</FunctionCode> 4 <FunctionCode>2</FunctionCode>
5 <MessageType>MT8205</MessageType> 5 <MessageType>MT8205</MessageType>
6 - <SenderID>${senderId}</SenderID>  
7 - <ReceiverID>${receiverID}</ReceiverID>  
8 - <SendTime>${sendTime}</SendTime> 6 + <SenderID>${map.senderID}</SenderID>
  7 + <ReceiverID>${map.receiverID}</ReceiverID>
  8 + <SendTime>${map.sendTime}</SendTime>
9 <Version>1.0</Version> 9 <Version>1.0</Version>
10 </Head> 10 </Head>
11 <Declaration> 11 <Declaration>
1 <Manifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:Declaration:datamodel:standard:CN:MT1201:1"> 1 <Manifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:Declaration:datamodel:standard:CN:MT1201:1">
2 <Head> 2 <Head>
3 - <MessageID>${msgId}</MessageID> 3 + <MessageID>${map.messageID}</MessageID>
4 <FunctionCode>3</FunctionCode> 4 <FunctionCode>3</FunctionCode>
5 <MessageType>MT1201</MessageType> 5 <MessageType>MT1201</MessageType>
6 - <SenderID>${senderId}</SenderID>  
7 - <ReceiverID>${receiverID}</ReceiverID>  
8 - <SendTime>${sendTime}</SendTime> 6 + <SenderID>${map.senderID}</SenderID>
  7 + <ReceiverID>${map.receiverID}</ReceiverID>
  8 + <SendTime>${map.sendTime}</SendTime>
9 <Version>1.0</Version> 9 <Version>1.0</Version>
10 </Head> 10 </Head>
11 <Declaration> 11 <Declaration>
@@ -32,4 +32,4 @@ @@ -32,4 +32,4 @@
32 <ContactTel>${contactTel}</ContactTel> 32 <ContactTel>${contactTel}</ContactTel>
33 </AdditionalInformation> 33 </AdditionalInformation>
34 </Declaration> 34 </Declaration>
35 -</Manifest>  
  35 +</Manifest>
1 <Manifest xmlns="urn:Declaration:datamodel:standard:CN:MT5202:1" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 1 <Manifest xmlns="urn:Declaration:datamodel:standard:CN:MT5202:1" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
2 <Head> 2 <Head>
3 - <MessageID>${msgId}</MessageID> 3 + <MessageID>${map.messageID}</MessageID>
4 <FunctionCode>3</FunctionCode> 4 <FunctionCode>3</FunctionCode>
5 <MessageType>MT3202</MessageType> 5 <MessageType>MT3202</MessageType>
6 - <SenderID>${senderId}</SenderID>  
7 - <ReceiverID>${receiverID}</ReceiverID>  
8 - <SendTime>${sendTime}</SendTime> 6 + <SenderID>${map.senderID}</SenderID>
  7 + <ReceiverID>${map.receiverID}</ReceiverID>
  8 + <SendTime>${map.sendTime}</SendTime>
9 <Version>1.0</Version> 9 <Version>1.0</Version>
10 </Head> 10 </Head>
11 <Declaration> 11 <Declaration>
@@ -23,4 +23,4 @@ @@ -23,4 +23,4 @@
23 <ContactTel>${contactTel}</ContactTel> 23 <ContactTel>${contactTel}</ContactTel>
24 </AdditionalInformation> 24 </AdditionalInformation>
25 </Declaration> 25 </Declaration>
26 -</Manifest>  
  26 +</Manifest>
1 <Manifest xmlns="urn:Declaration:datamodel:standard:CN:MT5202:1" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 1 <Manifest xmlns="urn:Declaration:datamodel:standard:CN:MT5202:1" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
2 <Head> 2 <Head>
3 - <MessageID>${msgId}</MessageID> 3 + <MessageID>${map.messageID}</MessageID>
4 <FunctionCode>3</FunctionCode> 4 <FunctionCode>3</FunctionCode>
5 - <MessageType>MT5021</MessageType>  
6 - <SenderID>${senderId}</SenderID>  
7 - <ReceiverID>${receiverID}</ReceiverID>  
8 - <SendTime>${sendTime}</SendTime> 5 + <MessageType>MT5201</MessageType>
  6 + <SenderID>${map.senderID}</SenderID>
  7 + <ReceiverID>${map.receiverID}</ReceiverID>
  8 + <SendTime>${map.sendTime}</SendTime>
9 <Version>1.0</Version> 9 <Version>1.0</Version>
10 </Head> 10 </Head>
11 <Declaration> 11 <Declaration>
@@ -29,4 +29,4 @@ @@ -29,4 +29,4 @@
29 <ContactTel>${contactTel}</ContactTel> 29 <ContactTel>${contactTel}</ContactTel>
30 </AdditionalInformation> 30 </AdditionalInformation>
31 </Declaration> 31 </Declaration>
32 -</Manifest>  
  32 +</Manifest>
1 <Manifest xmlns="urn:Declaration:datamodel:standard:CN:MT5202:1" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 1 <Manifest xmlns="urn:Declaration:datamodel:standard:CN:MT5202:1" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
2 <Head> 2 <Head>
3 - <MessageID>${msgId}</MessageID> 3 + <MessageID>${map.messageID}</MessageID>
4 <FunctionCode>3</FunctionCode> 4 <FunctionCode>3</FunctionCode>
5 <MessageType>MT6202</MessageType> 5 <MessageType>MT6202</MessageType>
6 - <SenderID>${senderId}</SenderID>  
7 - <ReceiverID>${receiverID}</ReceiverID>  
8 - <SendTime>${sendTime}</SendTime> 6 + <SenderID>${map.senderID}</SenderID>
  7 + <ReceiverID>${map.receiverID}</ReceiverID>
  8 + <SendTime>${map.sendTime}</SendTime>
9 <Version>1.0</Version> 9 <Version>1.0</Version>
10 </Head> 10 </Head>
11 <Declaration> 11 <Declaration>
@@ -23,4 +23,4 @@ @@ -23,4 +23,4 @@
23 <ContactTel>${contactTel}</ContactTel> 23 <ContactTel>${contactTel}</ContactTel>
24 </AdditionalInformation> 24 </AdditionalInformation>
25 </Declaration> 25 </Declaration>
26 -</Manifest>  
  26 +</Manifest>