作者 shenhailong

分单为"" 改为 null 增加 回执 编号 23 24 25 业务操作

  1 +package com.sunyo.wlpt.message.builder.controller;
  2 +
  3 +import com.sunyo.wlpt.message.builder.service.MT6202Service;
  4 +import org.springframework.beans.factory.annotation.Autowired;
  5 +import org.springframework.web.bind.annotation.*;
  6 +
  7 +import java.io.IOException;
  8 +import java.text.ParseException;
  9 +import java.util.Map;
  10 +
  11 +@RequestMapping(value = "/mt6202")
  12 +@RestController
  13 +public class MT6202Controller {
  14 +
  15 + @Autowired
  16 + private MT6202Service mt6202Service;
  17 +
  18 + @PostMapping(value = "/creatMt6202")
  19 + @ResponseBody
  20 + public Map<String, Object> creatMt8205(@RequestBody Map<String, Object> map) throws IOException, ParseException {
  21 +
  22 + return mt6202Service.creatMt6202(map);
  23 + }
  24 +
  25 + @PutMapping(value = "/removeMt6202")
  26 + @ResponseBody
  27 + public Map<String, Object> removeMt6202(@RequestBody Map<String, Object> map) throws IOException, ParseException {
  28 +
  29 + return mt6202Service.removeMt6202(map);
  30 + }
  31 +
  32 +}
  1 +package com.sunyo.wlpt.message.builder.controller;
  2 +
  3 +import com.sunyo.wlpt.message.builder.service.MT8205Service;
  4 +import org.springframework.beans.factory.annotation.Autowired;
  5 +import org.springframework.web.bind.annotation.*;
  6 +
  7 +import java.io.IOException;
  8 +import java.text.ParseException;
  9 +import java.util.Map;
  10 +
  11 +@RequestMapping(value = "/mt8205")
  12 +@RestController
  13 +public class MT8205Controller {
  14 +
  15 + @Autowired
  16 + private MT8205Service mt8205Service;
  17 +
  18 + @PostMapping(value = "/creatMt8205")
  19 + @ResponseBody
  20 + public Map<String, Object> creatMt8205(@RequestBody Map<String, Object> map) throws IOException, ParseException {
  21 +
  22 + return mt8205Service.create8205(map);
  23 + }
  24 +
  25 +}
@@ -17,6 +17,7 @@ import org.springframework.stereotype.Service; @@ -17,6 +17,7 @@ import org.springframework.stereotype.Service;
17 import java.io.IOException; 17 import java.io.IOException;
18 import java.math.BigDecimal; 18 import java.math.BigDecimal;
19 import java.text.ParseException; 19 import java.text.ParseException;
  20 +import java.util.Date;
20 import java.util.HashMap; 21 import java.util.HashMap;
21 import java.util.Map; 22 import java.util.Map;
22 23
@@ -98,6 +99,8 @@ public class MT2201ServiceImp extends CustomXmlMaker implements MT2201Service { @@ -98,6 +99,8 @@ public class MT2201ServiceImp extends CustomXmlMaker implements MT2201Service {
98 NMMS_CUSTOM_RESPONSE nmmsCustomResponse = ReturnUtil.nmmsCustomResponse(map); 99 NMMS_CUSTOM_RESPONSE nmmsCustomResponse = ReturnUtil.nmmsCustomResponse(map);
99 // 操作类型 100 // 操作类型
100 nmmsCustomResponse.setOpertype("删除"); 101 nmmsCustomResponse.setOpertype("删除");
  102 + nmmsCustomResponse.setCusrescode("24");
  103 + nmmsCustomResponse.setCusrestext("删除报发送成功");
101 hashMap.put("status", "1"); 104 hashMap.put("status", "1");
102 hashMap.put("customResponse", nmmsCustomResponse); 105 hashMap.put("customResponse", nmmsCustomResponse);
103 return hashMap; 106 return hashMap;
@@ -128,12 +131,16 @@ public class MT2201ServiceImp extends CustomXmlMaker implements MT2201Service { @@ -128,12 +131,16 @@ public class MT2201ServiceImp extends CustomXmlMaker implements MT2201Service {
128 map.put("msgId", msgId); 131 map.put("msgId", msgId);
129 map.put("senderId", senderId); 132 map.put("senderId", senderId);
130 map.put("receiverID", receiverID); 133 map.put("receiverID", receiverID);
  134 + String s = DateUtil.addDateMinut(new Date(), 6);
  135 + // 货物装卸时间
  136 + map.put("loadingDate",s);
131 // 舱单传输人名称 137 // 舱单传输人名称
132 map.put("orgCode", orgCode); 138 map.put("orgCode", orgCode);
133 139
134 Map<String, Object> maps = new HashMap<>(); 140 Map<String, Object> maps = new HashMap<>();
135 // 生成报文 141 // 生成报文
136 if (makeXmlToFile(map.get("templatePath").toString(), msgId+".xml", map, map.get("sendPath").toString())>0){ 142 if (makeXmlToFile(map.get("templatePath").toString(), msgId+".xml", map, map.get("sendPath").toString())>0){
  143 + if (!map.containsKey("reason")){
137 map.put("functionCode", "9"); 144 map.put("functionCode", "9");
138 map.put("busType","MT2201"); 145 map.put("busType","MT2201");
139 NMMS_CUSTOM_RESPONSE nmmsCustomResponse = ReturnUtil.nmmsCustomResponse(map); 146 NMMS_CUSTOM_RESPONSE nmmsCustomResponse = ReturnUtil.nmmsCustomResponse(map);
@@ -145,19 +152,56 @@ public class MT2201ServiceImp extends CustomXmlMaker implements MT2201Service { @@ -145,19 +152,56 @@ public class MT2201ServiceImp extends CustomXmlMaker implements MT2201Service {
145 nmmsCustomResponse.setCarrier(custom_mt2201.getCarrier()); 152 nmmsCustomResponse.setCarrier(custom_mt2201.getCarrier());
146 // 主单号 153 // 主单号
147 nmmsCustomResponse.setAwbano(custom_mt2201.getAwba()); 154 nmmsCustomResponse.setAwbano(custom_mt2201.getAwba());
  155 + if (!"".equals(custom_mt2201.getAwbh())){
148 // 分单号 156 // 分单号
149 nmmsCustomResponse.setAwbhno(custom_mt2201.getAwbh()); 157 nmmsCustomResponse.setAwbhno(custom_mt2201.getAwbh());
  158 + }else {
  159 + nmmsCustomResponse.setAwbhno(null);
  160 + }
150 // 件数 161 // 件数
151 nmmsCustomResponse.setBuspiece(Integer.valueOf(custom_mt2201.getPiece().toString())); 162 nmmsCustomResponse.setBuspiece(Integer.valueOf(custom_mt2201.getPiece().toString()));
152 // 重量 163 // 重量
153 nmmsCustomResponse.setBusweight(Long.valueOf(custom_mt2201.getWeight().toString())); 164 nmmsCustomResponse.setBusweight(Long.valueOf(custom_mt2201.getWeight().toString()));
154 // 操作类型 165 // 操作类型
155 nmmsCustomResponse.setOpertype("新增"); 166 nmmsCustomResponse.setOpertype("新增");
  167 + nmmsCustomResponse.setCusrescode("23");
  168 + nmmsCustomResponse.setCusrestext("新增报发送成功");
156 maps.put("status", "1"); 169 maps.put("status", "1");
157 maps.put("customResponse", nmmsCustomResponse); 170 maps.put("customResponse", nmmsCustomResponse);
158 171
159 return maps; 172 return maps;
160 }else { 173 }else {
  174 + map.put("functionCode", "5");
  175 + map.put("busType","MT2201");
  176 + NMMS_CUSTOM_RESPONSE nmmsCustomResponse = ReturnUtil.nmmsCustomResponse(map);
  177 + // 航班日期
  178 + nmmsCustomResponse.setFlightdate(custom_mt2201.getFlightdate());
  179 + // 航班号
  180 + nmmsCustomResponse.setFlightno(custom_mt2201.getFlightno());
  181 + // 航班承运人
  182 + nmmsCustomResponse.setCarrier(custom_mt2201.getCarrier());
  183 + // 主单号
  184 + nmmsCustomResponse.setAwbano(custom_mt2201.getAwba());
  185 + if (!"".equals(custom_mt2201.getAwbh())){
  186 + // 分单号
  187 + nmmsCustomResponse.setAwbhno(custom_mt2201.getAwbh());
  188 + }else {
  189 + nmmsCustomResponse.setAwbhno(null);
  190 + }
  191 + // 件数
  192 + nmmsCustomResponse.setBuspiece(Integer.valueOf(custom_mt2201.getPiece().toString()));
  193 + // 重量
  194 + nmmsCustomResponse.setBusweight(Long.valueOf(custom_mt2201.getWeight().toString()));
  195 + // 操作类型
  196 + nmmsCustomResponse.setOpertype("修改");
  197 + nmmsCustomResponse.setCusrescode("25");
  198 + nmmsCustomResponse.setCusrestext("修改报发送成功");
  199 + maps.put("status", "1");
  200 + maps.put("customResponse", nmmsCustomResponse);
  201 +
  202 + return maps;
  203 + }
  204 + }else {
161 maps.put("status", "0"); 205 maps.put("status", "0");
162 return maps; 206 return maps;
163 } 207 }
@@ -58,14 +58,21 @@ public class MT3201ServiceImp extends CustomXmlMaker implements MT3201Service { @@ -58,14 +58,21 @@ public class MT3201ServiceImp extends CustomXmlMaker implements MT3201Service {
58 nmmsCustomResponse.setCarrier(customMt3201.getCarrier()); 58 nmmsCustomResponse.setCarrier(customMt3201.getCarrier());
59 // 主单号 59 // 主单号
60 nmmsCustomResponse.setAwbano(customMt3201.getAwba()); 60 nmmsCustomResponse.setAwbano(customMt3201.getAwba());
  61 + if (!"".equals(customMt3201.getAwbh())){
61 // 分单号 62 // 分单号
62 nmmsCustomResponse.setAwbhno(customMt3201.getAwbh()); 63 nmmsCustomResponse.setAwbhno(customMt3201.getAwbh());
  64 + }else {
  65 + nmmsCustomResponse.setAwbhno(null);
  66 + }
  67 +
63 // 件数 68 // 件数
64 nmmsCustomResponse.setBuspiece(Integer.valueOf(customMt3201.getPiece().toString())); 69 nmmsCustomResponse.setBuspiece(Integer.valueOf(customMt3201.getPiece().toString()));
65 // 重量 70 // 重量
66 nmmsCustomResponse.setBusweight(Long.valueOf(customMt3201.getWeight().toString())); 71 nmmsCustomResponse.setBusweight(Long.valueOf(customMt3201.getWeight().toString()));
67 // 操作类型 72 // 操作类型
68 nmmsCustomResponse.setOpertype("新增"); 73 nmmsCustomResponse.setOpertype("新增");
  74 + nmmsCustomResponse.setCusrescode("23");
  75 + nmmsCustomResponse.setCusrestext("新增报发送成功");
69 map3201.put("status", "1"); 76 map3201.put("status", "1");
70 map3201.put("customResponse", nmmsCustomResponse); 77 map3201.put("customResponse", nmmsCustomResponse);
71 78
@@ -96,6 +103,8 @@ public class MT3201ServiceImp extends CustomXmlMaker implements MT3201Service { @@ -96,6 +103,8 @@ public class MT3201ServiceImp extends CustomXmlMaker implements MT3201Service {
96 NMMS_CUSTOM_RESPONSE nmmsCustomResponse = ReturnUtil.nmmsCustomResponse(map); 103 NMMS_CUSTOM_RESPONSE nmmsCustomResponse = ReturnUtil.nmmsCustomResponse(map);
97 // 操作类型 104 // 操作类型
98 nmmsCustomResponse.setOpertype("删除"); 105 nmmsCustomResponse.setOpertype("删除");
  106 + nmmsCustomResponse.setCusrescode("24");
  107 + nmmsCustomResponse.setCusrestext("删除报发送成功");
99 map3201.put("status", "1"); 108 map3201.put("status", "1");
100 map3201.put("customResponse", nmmsCustomResponse); 109 map3201.put("customResponse", nmmsCustomResponse);
101 return map3201; 110 return map3201;
@@ -59,14 +59,22 @@ public class MT4201ServiceImp extends CustomXmlMaker implements MT4201Service { @@ -59,14 +59,22 @@ public class MT4201ServiceImp extends CustomXmlMaker implements MT4201Service {
59 nmmsCustomResponse.setCarrier(customMt4201.getCarrier()); 59 nmmsCustomResponse.setCarrier(customMt4201.getCarrier());
60 // 主单号 60 // 主单号
61 nmmsCustomResponse.setAwbano(customMt4201.getAwba()); 61 nmmsCustomResponse.setAwbano(customMt4201.getAwba());
  62 + if (!"".equals(customMt4201.getAwbh())){
62 // 分单号 63 // 分单号
63 nmmsCustomResponse.setAwbhno(customMt4201.getAwbh()); 64 nmmsCustomResponse.setAwbhno(customMt4201.getAwbh());
  65 + }else {
  66 + // 分单号
  67 + nmmsCustomResponse.setAwbhno(null);
  68 + }
  69 +
64 // 件数 70 // 件数
65 nmmsCustomResponse.setBuspiece(Integer.valueOf(customMt4201.getLodingpiece().toString())); 71 nmmsCustomResponse.setBuspiece(Integer.valueOf(customMt4201.getLodingpiece().toString()));
66 // 重量 72 // 重量
67 nmmsCustomResponse.setBusweight(Long.valueOf(customMt4201.getLodingweight().toString())); 73 nmmsCustomResponse.setBusweight(Long.valueOf(customMt4201.getLodingweight().toString()));
68 // 操作类型 74 // 操作类型
69 nmmsCustomResponse.setOpertype("新增"); 75 nmmsCustomResponse.setOpertype("新增");
  76 + nmmsCustomResponse.setCusrescode("23");
  77 + nmmsCustomResponse.setCusrestext("新增报发送成功");
70 map4201.put("status", "1"); 78 map4201.put("status", "1");
71 map4201.put("customResponse", nmmsCustomResponse); 79 map4201.put("customResponse", nmmsCustomResponse);
72 80
@@ -98,6 +106,8 @@ public class MT4201ServiceImp extends CustomXmlMaker implements MT4201Service { @@ -98,6 +106,8 @@ public class MT4201ServiceImp extends CustomXmlMaker implements MT4201Service {
98 NMMS_CUSTOM_RESPONSE nmmsCustomResponse = ReturnUtil.nmmsCustomResponse(map); 106 NMMS_CUSTOM_RESPONSE nmmsCustomResponse = ReturnUtil.nmmsCustomResponse(map);
99 // 操作类型 107 // 操作类型
100 nmmsCustomResponse.setOpertype("删除"); 108 nmmsCustomResponse.setOpertype("删除");
  109 + nmmsCustomResponse.setCusrescode("24");
  110 + nmmsCustomResponse.setCusrestext("删除报发送成功");
101 map4201.put("status", "1"); 111 map4201.put("status", "1");
102 map4201.put("customResponse", nmmsCustomResponse); 112 map4201.put("customResponse", nmmsCustomResponse);
103 return map4201; 113 return map4201;
@@ -42,9 +42,7 @@ public class MT520XServiceImp extends CustomXmlMaker implements MT520XService{ @@ -42,9 +42,7 @@ public class MT520XServiceImp extends CustomXmlMaker implements MT520XService{
42 // 封装实体 42 // 封装实体
43 hashMap.put("mt", customMt520X); 43 hashMap.put("mt", customMt520X);
44 hashMap.put("orgCode", orgCode); 44 hashMap.put("orgCode", orgCode);
45 -  
46 if ("5201".equals(customMt520X.getRcfdep())){ 45 if ("5201".equals(customMt520X.getRcfdep())){
47 -  
48 // 生成报文头部 46 // 生成报文头部
49 String msgId = makeMsgID("MT5201", orgsn, customMt520X.getAwba()); 47 String msgId = makeMsgID("MT5201", orgsn, customMt520X.getAwba());
50 String msessageType = "MT5201"; 48 String msessageType = "MT5201";
@@ -54,11 +52,41 @@ public class MT520XServiceImp extends CustomXmlMaker implements MT520XService{ @@ -54,11 +52,41 @@ public class MT520XServiceImp extends CustomXmlMaker implements MT520XService{
54 hashMap.put("msessageType", msessageType); 52 hashMap.put("msessageType", msessageType);
55 hashMap.put("senderId", senderId); 53 hashMap.put("senderId", senderId);
56 hashMap.put("receiverID", receiverID); 54 hashMap.put("receiverID", receiverID);
57 -// if (makeXmlToFile("/manifest/MT5201.ftlx", msgId+".xml", hashMap, "./send/add/")>0){  
58 -// return 1;  
59 -// }else {  
60 -// return 0;  
61 -// } 55 + Map<String, Object> maps = new HashMap<>();
  56 + if (makeXmlToFile("/manifest/MT5201.ftlx", msgId+".xml", hashMap, "./send/add/")>0){
  57 +
  58 + hashMap.put("functionCode", "2");
  59 + hashMap.put("busType","MT5201");
  60 + NMMS_CUSTOM_RESPONSE nmmsCustomResponse = ReturnUtil.nmmsCustomResponse(hashMap);
  61 + // 航班日期
  62 + nmmsCustomResponse.setFlightdate(customMt520X.getFlightdate());
  63 + // 航班号
  64 + nmmsCustomResponse.setFlightno(customMt520X.getFlightno());
  65 + // 航班承运人
  66 + nmmsCustomResponse.setCarrier(customMt520X.getCarrier());
  67 + // 主单号
  68 + nmmsCustomResponse.setAwbano(customMt520X.getAwba());
  69 + if (!"".equals(customMt520X.getAwbh())){
  70 + // 分单号
  71 + nmmsCustomResponse.setAwbhno(customMt520X.getAwbh());
  72 + }else {
  73 + nmmsCustomResponse.setAwbhno(null);
  74 + }
  75 + // 件数
  76 + nmmsCustomResponse.setBuspiece(customMt520X.getPiece());
  77 + // 重量
  78 + nmmsCustomResponse.setBusweight(customMt520X.getWeight());
  79 + // 操作类型
  80 + nmmsCustomResponse.setOpertype("新增");
  81 + nmmsCustomResponse.setCusrescode("23");
  82 + nmmsCustomResponse.setCusrestext("新增报发送成功");
  83 + maps.put("status", "1");
  84 + maps.put("customResponse", nmmsCustomResponse);
  85 + return maps;
  86 + }else {
  87 + maps.put("staus", "0");
  88 + return maps;
  89 + }
62 }else { 90 }else {
63 91
64 // 生成报文头部 92 // 生成报文头部
@@ -84,14 +112,20 @@ public class MT520XServiceImp extends CustomXmlMaker implements MT520XService{ @@ -84,14 +112,20 @@ public class MT520XServiceImp extends CustomXmlMaker implements MT520XService{
84 nmmsCustomResponse.setCarrier(customMt520X.getCarrier()); 112 nmmsCustomResponse.setCarrier(customMt520X.getCarrier());
85 // 主单号 113 // 主单号
86 nmmsCustomResponse.setAwbano(customMt520X.getAwba()); 114 nmmsCustomResponse.setAwbano(customMt520X.getAwba());
  115 + if (!"".equals(customMt520X.getAwbh())){
87 // 分单号 116 // 分单号
88 nmmsCustomResponse.setAwbhno(customMt520X.getAwbh()); 117 nmmsCustomResponse.setAwbhno(customMt520X.getAwbh());
  118 + }else {
  119 + nmmsCustomResponse.setAwbhno(null);
  120 + }
89 // 件数 121 // 件数
90 nmmsCustomResponse.setBuspiece(customMt520X.getPiece()); 122 nmmsCustomResponse.setBuspiece(customMt520X.getPiece());
91 // 重量 123 // 重量
92 nmmsCustomResponse.setBusweight(customMt520X.getWeight()); 124 nmmsCustomResponse.setBusweight(customMt520X.getWeight());
93 // 操作类型 125 // 操作类型
94 nmmsCustomResponse.setOpertype("新增"); 126 nmmsCustomResponse.setOpertype("新增");
  127 + nmmsCustomResponse.setCusrescode("23");
  128 + nmmsCustomResponse.setCusrestext("新增报发送成功");
95 maps.put("status", "1"); 129 maps.put("status", "1");
96 maps.put("customResponse", nmmsCustomResponse); 130 maps.put("customResponse", nmmsCustomResponse);
97 131
@@ -106,7 +140,6 @@ public class MT520XServiceImp extends CustomXmlMaker implements MT520XService{ @@ -106,7 +140,6 @@ public class MT520XServiceImp extends CustomXmlMaker implements MT520XService{
106 e.printStackTrace(); 140 e.printStackTrace();
107 return null; 141 return null;
108 } 142 }
109 - return null;  
110 143
111 } 144 }
112 145
@@ -125,13 +158,23 @@ public class MT520XServiceImp extends CustomXmlMaker implements MT520XService{ @@ -125,13 +158,23 @@ public class MT520XServiceImp extends CustomXmlMaker implements MT520XService{
125 map.put("msgId", msgId); 158 map.put("msgId", msgId);
126 map.put("senderId", senderId); 159 map.put("senderId", senderId);
127 map.put("receiverID", receiverID); 160 map.put("receiverID", receiverID);
128 -// if (makeXmlToFile("/remove/MT5201.ftlx", msgId+".xml", map, "./send/remove/")>0){  
129 -//  
130 -//  
131 -// return 1;  
132 -// }else {  
133 -// return 0;  
134 -// } 161 + Map<String, Object> maps = new HashMap<>();
  162 + if (makeXmlToFile("/remove/MT5201.ftlx", msgId+".xml", map, "./send/remove/")>0){
  163 +
  164 + map.put("functionCode", "3");
  165 + map.put("busType","MT5201");
  166 + NMMS_CUSTOM_RESPONSE nmmsCustomResponse = ReturnUtil.nmmsCustomResponse(map);
  167 + nmmsCustomResponse.setCusrescode("24");
  168 + nmmsCustomResponse.setCusrestext("删除报发送成功");
  169 + // 操作类型
  170 + nmmsCustomResponse.setOpertype("删除");
  171 + maps.put("status", "1");
  172 + maps.put("customResponse", nmmsCustomResponse);
  173 + return maps;
  174 + }else {
  175 + maps.put("staus", "0");
  176 + return maps;
  177 + }
135 }else { 178 }else {
136 // 生成报文头部 179 // 生成报文头部
137 String msgId = makeMsgID("MT5202", orgsn, map.get("awba").toString()); 180 String msgId = makeMsgID("MT5202", orgsn, map.get("awba").toString());
@@ -146,17 +189,17 @@ public class MT520XServiceImp extends CustomXmlMaker implements MT520XService{ @@ -146,17 +189,17 @@ public class MT520XServiceImp extends CustomXmlMaker implements MT520XService{
146 map.put("functionCode", "3"); 189 map.put("functionCode", "3");
147 map.put("busType","MT5202"); 190 map.put("busType","MT5202");
148 NMMS_CUSTOM_RESPONSE nmmsCustomResponse = ReturnUtil.nmmsCustomResponse(map); 191 NMMS_CUSTOM_RESPONSE nmmsCustomResponse = ReturnUtil.nmmsCustomResponse(map);
  192 + nmmsCustomResponse.setCusrescode("24");
  193 + nmmsCustomResponse.setCusrestext("删除报发送成功");
149 // 操作类型 194 // 操作类型
150 nmmsCustomResponse.setOpertype("删除"); 195 nmmsCustomResponse.setOpertype("删除");
151 maps.put("status", "1"); 196 maps.put("status", "1");
152 maps.put("customResponse", nmmsCustomResponse); 197 maps.put("customResponse", nmmsCustomResponse);
153 -  
154 return maps; 198 return maps;
155 }else { 199 }else {
156 maps.put("staus", "0"); 200 maps.put("staus", "0");
157 return maps; 201 return maps;
158 } 202 }
159 } 203 }
160 - return null;  
161 } 204 }
162 } 205 }
  1 +package com.sunyo.wlpt.message.builder.service.imp;
  2 +
  3 +import com.fasterxml.jackson.databind.ObjectMapper;
  4 +import com.sunyo.wlpt.base.model.NMMS_CUSTOM_RESPONSE;
  5 +import com.sunyo.wlpt.base.model.NMMS_CUSTOM_TRANS;
  6 +import com.sunyo.wlpt.message.builder.service.MT6202Service;
  7 +import com.sunyo.wlpt.message.builder.util.CustomXmlMaker;
  8 +import com.sunyo.wlpt.message.builder.util.ReturnUtil;
  9 +import com.tianbo.util.Date.DateUtil;
  10 +import org.springframework.beans.factory.annotation.Value;
  11 +import org.springframework.stereotype.Service;
  12 +
  13 +import java.io.IOException;
  14 +import java.text.ParseException;
  15 +import java.util.HashMap;
  16 +import java.util.Map;
  17 +
  18 +@Service
  19 +public class MT6202ServiceImp extends CustomXmlMaker implements MT6202Service{
  20 +
  21 + @Value("${custom.custom-code}")
  22 + private String orgsn;
  23 +
  24 + @Override
  25 + public Map<String, Object> creatMt6202(Map<String, Object> map) throws IOException, ParseException {
  26 + ObjectMapper objectMapper = new ObjectMapper();
  27 + // 转运记录
  28 + NMMS_CUSTOM_TRANS nmmsCustomTrans = objectMapper.convertValue(map.get("mt6202"), NMMS_CUSTOM_TRANS.class);
  29 + // 关区代码
  30 + String customCode = nmmsCustomTrans.getCustomcode();
  31 + // 报文头时间 精确到毫秒
  32 + map.put("sendTime", DateUtil.getCurrentTime17());
  33 + // 封装实体
  34 + map.put("mt", nmmsCustomTrans);
  35 + // 生成报文头部
  36 + String msgId = makeMsgID("MT6202", orgsn, nmmsCustomTrans.getAwba());
  37 + String msessageType = "MT6202";
  38 + String senderId = makeSenderID(customCode, orgsn, "");
  39 + String receiverID = customCode;
  40 + map.put("msgId", msgId);
  41 + map.put("msessageType", msessageType);
  42 + map.put("senderId", senderId);
  43 + map.put("receiverID", receiverID);
  44 +
  45 + Map<String, Object> map6202 = new HashMap<>();
  46 +
  47 + if (makeXmlToFile("/manifest/MT6202.ftlx", msgId+".xml", map, "./send/add/")>0){
  48 + map.put("functionCode", "2");
  49 + map.put("busType","MT6202");
  50 + NMMS_CUSTOM_RESPONSE nmmsCustomResponse = ReturnUtil.nmmsCustomResponse(map);
  51 + // 航班日期
  52 + nmmsCustomResponse.setFlightdate(nmmsCustomTrans.getFlightdate());
  53 + // 航班号
  54 + nmmsCustomResponse.setFlightno(nmmsCustomTrans.getFlightno());
  55 + // 航班承运人
  56 + nmmsCustomResponse.setCarrier(nmmsCustomTrans.getCarrier());
  57 + // 主单号
  58 + nmmsCustomResponse.setAwbano(nmmsCustomTrans.getAwba());
  59 + // 件数
  60 + nmmsCustomResponse.setBuspiece(Integer.valueOf(nmmsCustomTrans.getTurnpiece().toString()));
  61 + // 重量
  62 + nmmsCustomResponse.setBusweight(Long.valueOf(nmmsCustomTrans.getTurnweight().toString()));
  63 + // 操作类型
  64 + nmmsCustomResponse.setOpertype("新增");
  65 + nmmsCustomResponse.setCusrescode("23");
  66 + nmmsCustomResponse.setCusrestext("新增报发送成功");
  67 + map6202.put("status", "1");
  68 + map6202.put("customResponse", nmmsCustomResponse);
  69 +
  70 + return map6202;
  71 + }else {
  72 + map6202.put("status", "0");
  73 + return map6202;
  74 + }
  75 + }
  76 +
  77 + @Override
  78 + public Map<String, Object> removeMt6202(Map<String, Object> map) throws IOException, ParseException {
  79 + // 关区代码
  80 + String customCode = map.get("customCode").toString();
  81 + // 报文头时间 精确到毫秒
  82 + map.put("sendTime", DateUtil.getCurrentTime17());
  83 + // 生成报文头部
  84 + String msgId = makeMsgID("MT6202", orgsn, map.get("awba").toString());
  85 + String senderId = makeSenderID(customCode, orgsn, "");
  86 + String receiverID = customCode;
  87 + map.put("msgId", msgId);
  88 + map.put("senderId", senderId);
  89 + map.put("receiverID", receiverID);
  90 + Map<String, Object> map3201 = new HashMap<>();
  91 + if (makeXmlToFile("/remove/MT6202.ftlx", msgId+".xml", map,"./send/remove/")>0){
  92 + map.put("functionCode", "3");
  93 + map.put("busType","MT6202");
  94 + NMMS_CUSTOM_RESPONSE nmmsCustomResponse = ReturnUtil.nmmsCustomResponse(map);
  95 + // 操作类型
  96 + nmmsCustomResponse.setOpertype("删除");
  97 + nmmsCustomResponse.setCusrescode("24");
  98 + nmmsCustomResponse.setCusrestext("删除报发送成功");
  99 + map3201.put("status", "1");
  100 + map3201.put("customResponse", nmmsCustomResponse);
  101 + return map3201;
  102 + }else {
  103 + map3201.put("staus", "0");
  104 + return map3201;
  105 + }
  106 + }
  107 +}
@@ -4,22 +4,31 @@ import com.fasterxml.jackson.databind.ObjectMapper; @@ -4,22 +4,31 @@ import com.fasterxml.jackson.databind.ObjectMapper;
4 import com.sunyo.wlpt.base.model.NMMS_CUSTOM_MT1201; 4 import com.sunyo.wlpt.base.model.NMMS_CUSTOM_MT1201;
5 import com.sunyo.wlpt.base.model.NMMS_CUSTOM_MT2201; 5 import com.sunyo.wlpt.base.model.NMMS_CUSTOM_MT2201;
6 import com.sunyo.wlpt.base.model.NMMS_CUSTOM_MT8205; 6 import com.sunyo.wlpt.base.model.NMMS_CUSTOM_MT8205;
  7 +import com.sunyo.wlpt.base.model.NMMS_CUSTOM_RESPONSE;
7 import com.sunyo.wlpt.message.builder.service.MT8205Service; 8 import com.sunyo.wlpt.message.builder.service.MT8205Service;
8 import com.sunyo.wlpt.message.builder.util.CustomXmlMaker; 9 import com.sunyo.wlpt.message.builder.util.CustomXmlMaker;
  10 +import com.sunyo.wlpt.message.builder.util.ReturnUtil;
9 import com.tianbo.util.Date.DateUtil; 11 import com.tianbo.util.Date.DateUtil;
10 import org.springframework.beans.factory.annotation.Autowired; 12 import org.springframework.beans.factory.annotation.Autowired;
  13 +import org.springframework.beans.factory.annotation.Value;
11 import org.springframework.stereotype.Service; 14 import org.springframework.stereotype.Service;
12 15
13 import java.io.IOException; 16 import java.io.IOException;
  17 +import java.text.ParseException;
  18 +import java.util.HashMap;
14 import java.util.Map; 19 import java.util.Map;
15 20
16 @Service 21 @Service
17 public class MT8205ServiceImp extends CustomXmlMaker implements MT8205Service { 22 public class MT8205ServiceImp extends CustomXmlMaker implements MT8205Service {
18 23
  24 + @Value("${custom.custom-code}")
  25 + private String orgsn;
19 26
  27 + @Value("${custom.org-code}")
  28 + private String orgCode;
20 29
21 @Override 30 @Override
22 - public Boolean create8205(Map<String, Object> map) throws IOException { 31 + public Map<String, Object> create8205(Map<String, Object> map) throws IOException, ParseException {
23 ObjectMapper objectMapper = new ObjectMapper(); 32 ObjectMapper objectMapper = new ObjectMapper();
24 // 转运记录 33 // 转运记录
25 NMMS_CUSTOM_MT8205 customMt8205 = objectMapper.convertValue(map.get("mt8205"), NMMS_CUSTOM_MT8205.class); 34 NMMS_CUSTOM_MT8205 customMt8205 = objectMapper.convertValue(map.get("mt8205"), NMMS_CUSTOM_MT8205.class);
@@ -27,7 +36,6 @@ public class MT8205ServiceImp extends CustomXmlMaker implements MT8205Service { @@ -27,7 +36,6 @@ public class MT8205ServiceImp extends CustomXmlMaker implements MT8205Service {
27 NMMS_CUSTOM_MT1201 customMt1201 = objectMapper.convertValue(map.get("mt1201"), NMMS_CUSTOM_MT1201.class); 36 NMMS_CUSTOM_MT1201 customMt1201 = objectMapper.convertValue(map.get("mt1201"), NMMS_CUSTOM_MT1201.class);
28 // 出港预配 37 // 出港预配
29 NMMS_CUSTOM_MT2201 customMt2201 = objectMapper.convertValue(map.get("mt2201"), NMMS_CUSTOM_MT2201.class); 38 NMMS_CUSTOM_MT2201 customMt2201 = objectMapper.convertValue(map.get("mt2201"), NMMS_CUSTOM_MT2201.class);
30 -  
31 // 关区代码 39 // 关区代码
32 String customCode = customMt8205.getCustomcode(); 40 String customCode = customMt8205.getCustomcode();
33 // 报文头时间 精确到毫秒 41 // 报文头时间 精确到毫秒
@@ -36,22 +44,49 @@ public class MT8205ServiceImp extends CustomXmlMaker implements MT8205Service { @@ -36,22 +44,49 @@ public class MT8205ServiceImp extends CustomXmlMaker implements MT8205Service {
36 map.put("mt8205", customMt8205); 44 map.put("mt8205", customMt8205);
37 map.put("mt1201", customMt1201); 45 map.put("mt1201", customMt1201);
38 map.put("mt2201", customMt2201); 46 map.put("mt2201", customMt2201);
39 - 47 + map.put("orgCode", orgCode);
40 // 生成报文头部 48 // 生成报文头部
41 - String msgId = makeMsgID("MT8205", "460470678920X", ""); 49 + String msgId = makeMsgID("MT8205", orgsn, customMt1201.getAwba());
42 String msessageType = "MT8205"; 50 String msessageType = "MT8205";
43 - String senderId = makeSenderID(customCode, "460470678920X", "DXPENT0000460002"); 51 + String senderId = makeSenderID(customCode, orgsn, "");
44 String receiverID = customCode; 52 String receiverID = customCode;
45 map.put("msgId", msgId); 53 map.put("msgId", msgId);
46 map.put("msessageType", msessageType); 54 map.put("msessageType", msessageType);
47 map.put("senderId", senderId); 55 map.put("senderId", senderId);
48 map.put("receiverID", receiverID); 56 map.put("receiverID", receiverID);
49 57
50 -// if (makeXmlToFile("/manifest/MT8205.ftlx", msgId+".xml", map)>0){  
51 -// return true;  
52 -// }else {  
53 -// return false;  
54 -// }  
55 - return null; 58 + Map<String, Object> map8205 = new HashMap<>();
  59 +
  60 + if (makeXmlToFile("/manifest/MT8205.ftlx", msgId+".xml", map, "./send/add/")>0){
  61 + map.put("functionCode", "2");
  62 + map.put("busType","MT8205");
  63 + NMMS_CUSTOM_RESPONSE nmmsCustomResponse = ReturnUtil.nmmsCustomResponse(map);
  64 + System.out.println();
  65 + // 航班日期
  66 + nmmsCustomResponse.setFlightdate(customMt1201.getFlightdate());
  67 + // 航班号
  68 + nmmsCustomResponse.setFlightno(customMt1201.getFlightno());
  69 + // 航班承运人
  70 + nmmsCustomResponse.setCarrier(customMt1201.getCarrier());
  71 + // 主单号
  72 + nmmsCustomResponse.setAwbano(customMt1201.getAwba());
  73 + // 分单号
  74 + nmmsCustomResponse.setAwbhno(customMt1201.getAwbh());
  75 + // 件数
  76 + nmmsCustomResponse.setBuspiece(Integer.valueOf(customMt1201.getPiece().toString()));
  77 + // 重量
  78 + nmmsCustomResponse.setBusweight(Long.valueOf(customMt1201.getWeight().toString()));
  79 + // 操作类型
  80 + nmmsCustomResponse.setOpertype("新增");
  81 + nmmsCustomResponse.setCusrescode("23");
  82 + nmmsCustomResponse.setCusrestext("新增报发送成功");
  83 + map8205.put("status", "1");
  84 + map8205.put("customResponse", nmmsCustomResponse);
  85 +
  86 + return map8205;
  87 + }else {
  88 + map8205.put("status", "0");
  89 + return map8205;
  90 + }
56 } 91 }
57 } 92 }
@@ -55,7 +55,13 @@ public class ReturnUtil { @@ -55,7 +55,13 @@ public class ReturnUtil {
55 nmmsCustomResponse.setAwbano(map.get("awba").toString()); 55 nmmsCustomResponse.setAwbano(map.get("awba").toString());
56 } 56 }
57 if (map.containsKey("awbh")){ 57 if (map.containsKey("awbh")){
  58 + if (!"".equals(map.get("awbh").toString())){
  59 + // 分单号
58 nmmsCustomResponse.setAwbhno(map.get("awbh").toString()); 60 nmmsCustomResponse.setAwbhno(map.get("awbh").toString());
  61 + }else {
  62 + // 分单号
  63 + nmmsCustomResponse.setAwbhno(null);
  64 + }
59 } 65 }
60 if (map.containsKey("flightNo")){ 66 if (map.containsKey("flightNo")){
61 nmmsCustomResponse.setFlightno(map.get("flightNo").toString()); 67 nmmsCustomResponse.setFlightno(map.get("flightNo").toString());
@@ -36,7 +36,7 @@ @@ -36,7 +36,7 @@
36 </#if> 36 </#if>
37 <LoadingLocation> 37 <LoadingLocation>
38 <ID>${mt.originstation}/${mt.customcode}</ID> 38 <ID>${mt.originstation}/${mt.customcode}</ID>
39 - <LoadingDate>202001210605086</LoadingDate> 39 + <LoadingDate>${loadingDate}</LoadingDate>
40 </LoadingLocation> 40 </LoadingLocation>
41 <UnloadingLocation> 41 <UnloadingLocation>
42 <ID>${mt.destinationstation}</ID> 42 <ID>${mt.destinationstation}</ID>
@@ -34,7 +34,7 @@ @@ -34,7 +34,7 @@
34 </#if> 34 </#if>
35 <LoadingLocation> 35 <LoadingLocation>
36 <ID>${mt.originstation}/${mt.customcode}</ID> 36 <ID>${mt.originstation}/${mt.customcode}</ID>
37 - <LoadingDate>202001210605086</LoadingDate> 37 + <LoadingDate>${loadingDate}</LoadingDate>
38 </LoadingLocation> 38 </LoadingLocation>
39 <UnloadingLocation> 39 <UnloadingLocation>
40 <ID>${mt.destinationstation}</ID> 40 <ID>${mt.destinationstation}</ID>
@@ -35,7 +35,7 @@ @@ -35,7 +35,7 @@
35 <QuantityQuantity>${mt.lodingpiece}</QuantityQuantity> 35 <QuantityQuantity>${mt.lodingpiece}</QuantityQuantity>
36 </ConsignmentPackaging> 36 </ConsignmentPackaging>
37 <TotalGrossMassMeasure>${mt.lodingweight}</TotalGrossMassMeasure> 37 <TotalGrossMassMeasure>${mt.lodingweight}</TotalGrossMassMeasure>
38 - <TransportSplitIndicator>???<#--0整皮 1分批--></TransportSplitIndicator> 38 + <TransportSplitIndicator>0</TransportSplitIndicator>
39 <ConsignmentItem> 39 <ConsignmentItem>
40 <Commodity> 40 <Commodity>
41 <CargoDescription>${mt.goodsname}</CargoDescription> 41 <CargoDescription>${mt.goodsname}</CargoDescription>
1 -<Manifest xmlns="urn:Declaration:datamodel:standard:CN:MT6202:1" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 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 <Head> 3 <Head>
3 <MessageID>${msgId}</MessageID> 4 <MessageID>${msgId}</MessageID>
4 <FunctionCode>2</FunctionCode> 5 <FunctionCode>2</FunctionCode>
5 - <MessageType>${msessageType}</MessageType> 6 + <MessageType>MT8205</MessageType>
6 <SenderID>${senderId}</SenderID> 7 <SenderID>${senderId}</SenderID>
7 <ReceiverID>${receiverID}</ReceiverID> 8 <ReceiverID>${receiverID}</ReceiverID>
8 <SendTime>${sendTime}</SendTime> 9 <SendTime>${sendTime}</SendTime>
@@ -12,9 +13,9 @@ @@ -12,9 +13,9 @@
12 <BorderTransportMeans> 13 <BorderTransportMeans>
13 <JourneyID>${mt.carrier}${mt.flightno}/${mt.flightdate?string('yyyyMMdd')}</JourneyID> 14 <JourneyID>${mt.carrier}${mt.flightno}/${mt.flightdate?string('yyyyMMdd')}</JourneyID>
14 <TypeCode>4</TypeCode> 15 <TypeCode>4</TypeCode>
15 - <CargoFacilityLocation>${mt.turnunloading}/${mt.customcode}</CargoFacilityLocation> 16 + <CargoFacilityLocation>${mt.turnunloading}</CargoFacilityLocation>
16 <UnloadingLocation> 17 <UnloadingLocation>
17 - <ID>${destinationstation}/4620</ID> 18 + <ID>CGO/${mt.customcode}</ID>
18 </UnloadingLocation> 19 </UnloadingLocation>
19 </BorderTransportMeans> 20 </BorderTransportMeans>
20 <Consignment> 21 <Consignment>
@@ -26,10 +27,10 @@ @@ -26,10 +27,10 @@
26 </ConsignmentPackaging> 27 </ConsignmentPackaging>
27 <TotalGrossMassMeasure>${mt.turnweight}</TotalGrossMassMeasure> 28 <TotalGrossMassMeasure>${mt.turnweight}</TotalGrossMassMeasure>
28 <BorderTransportMeans> 29 <BorderTransportMeans>
29 - <JourneyID>${mt.carrier}${mt.flightno}</JourneyID> 30 + <JourneyID>${mt.pno}</JourneyID>
30 <TypeCode>3</TypeCode> 31 <TypeCode>3</TypeCode>
31 <Carrier> 32 <Carrier>
32 - <Name>${mt.carrier}</Name> 33 + <Name>${mt.ext1}</Name>
33 </Carrier> 34 </Carrier>
34 </BorderTransportMeans> 35 </BorderTransportMeans>
35 </Consignment> 36 </Consignment>
@@ -2,18 +2,18 @@ @@ -2,18 +2,18 @@
2 <Head> 2 <Head>
3 <MessageID>${msgId}</MessageID> 3 <MessageID>${msgId}</MessageID>
4 <FunctionCode>2</FunctionCode> 4 <FunctionCode>2</FunctionCode>
5 - <MessageType>${msessageType}</MessageType> 5 + <MessageType>MT8205</MessageType>
6 <SenderID>${senderId}</SenderID> 6 <SenderID>${senderId}</SenderID>
7 <ReceiverID>${receiverID}</ReceiverID> 7 <ReceiverID>${receiverID}</ReceiverID>
8 <SendTime>${sendTime}</SendTime> 8 <SendTime>${sendTime}</SendTime>
9 <Version>1.0</Version> 9 <Version>1.0</Version>
10 </Head> 10 </Head>
11 <Declaration> 11 <Declaration>
12 - <DeclarationOfficeID>${mt1201.customcode}</DeclarationOfficeID> 12 + <DeclarationOfficeID>${mt8205.customcode}</DeclarationOfficeID>
13 <Relation> 13 <Relation>
14 <ImportInformation> 14 <ImportInformation>
15 <RepresentativePerson> 15 <RepresentativePerson>
16 - <Name>460470678920X</Name> 16 + <Name>${orgCode}</Name>
17 </RepresentativePerson> 17 </RepresentativePerson>
18 <BorderTransportMeans> 18 <BorderTransportMeans>
19 <JourneyID>${mt1201.carrier}${mt1201.flightno}/${mt1201.flightdate?string('yyyyMMdd')}</JourneyID> 19 <JourneyID>${mt1201.carrier}${mt1201.flightno}/${mt1201.flightdate?string('yyyyMMdd')}</JourneyID>
@@ -23,7 +23,7 @@ @@ -23,7 +23,7 @@
23 <ID>${mt1201.awba}</ID> 23 <ID>${mt1201.awba}</ID>
24 </TransportContractDocument> 24 </TransportContractDocument>
25 <LoadingLocation> 25 <LoadingLocation>
26 - <ID>${mt1201.originstation}</ID> 26 + <ID>${mt8205.awboriginstation}</ID>
27 </LoadingLocation> 27 </LoadingLocation>
28 <ConsignmentPackaging> 28 <ConsignmentPackaging>
29 <QuantityQuantity>${mt1201.piece}</QuantityQuantity> 29 <QuantityQuantity>${mt1201.piece}</QuantityQuantity>
@@ -39,7 +39,7 @@ @@ -39,7 +39,7 @@
39 </ImportInformation> 39 </ImportInformation>
40 <ExportInformation> 40 <ExportInformation>
41 <RepresentativePerson> 41 <RepresentativePerson>
42 - <Name>460470678920X</Name> 42 + <Name>${orgCode}</Name>
43 </RepresentativePerson> 43 </RepresentativePerson>
44 <BorderTransportMeans> 44 <BorderTransportMeans>
45 <JourneyID>${mt2201.carrier}${mt2201.flightno}/${mt2201.flightdate?string('yyyyMMdd')}</JourneyID> 45 <JourneyID>${mt2201.carrier}${mt2201.flightno}/${mt2201.flightdate?string('yyyyMMdd')}</JourneyID>
@@ -49,13 +49,13 @@ @@ -49,13 +49,13 @@
49 <ID>${mt2201.awba}</ID> 49 <ID>${mt2201.awba}</ID>
50 </TransportContractDocument> 50 </TransportContractDocument>
51 <UnloadingLocation> 51 <UnloadingLocation>
52 - <ID>${mt2201.destinationstation}</ID> 52 + <ID>${mt8205.awbdesstation}</ID>
53 </UnloadingLocation> 53 </UnloadingLocation>
54 <ConsignmentPackaging> 54 <ConsignmentPackaging>
55 - <QuantityQuantity>${mt8205.transpiece}</QuantityQuantity>  
56 - <TypeCode>${mt8205.goodspackage}</TypeCode> 55 + <QuantityQuantity>${mt2201.piece}</QuantityQuantity>
  56 + <TypeCode>PK</TypeCode>
57 </ConsignmentPackaging> 57 </ConsignmentPackaging>
58 - <TotalGrossMassMeasure>${mt8205.transweight}</TotalGrossMassMeasure> 58 + <TotalGrossMassMeasure>${mt2201.weight}</TotalGrossMassMeasure>
59 </Consignment> 59 </Consignment>
60 </ExportInformation> 60 </ExportInformation>
61 </Relation> 61 </Relation>
  1 +<Manifest xmlns="urn:Declaration:datamodel:standard:CN:MT5202:1" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  2 + <Head>
  3 + <MessageID>${msgId}</MessageID>
  4 + <FunctionCode>3</FunctionCode>
  5 + <MessageType>MT6202</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>${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>