...
|
...
|
@@ -8,6 +8,7 @@ import com.sunyo.wlpt.base.model.NMMS_CUSTOM_MT4201; |
|
|
import com.sunyo.wlpt.message.builder.service.MT2201Service;
|
|
|
import com.sunyo.wlpt.message.builder.util.CustomXmlMaker;
|
|
|
import com.tianbo.util.Date.DateUtil;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.cglib.beans.BeanMap;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
...
|
...
|
@@ -47,9 +48,53 @@ public class MT2201ServiceImp extends CustomXmlMaker implements MT2201Service { |
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
@Value("${custom.custom-code}")
|
|
|
private String customCode;
|
|
|
|
|
|
@Value("${custom.org-code}")
|
|
|
private String orgCode;
|
|
|
|
|
|
@Override
|
|
|
public int creatMt2201(Map<String, Object> map) throws IOException{
|
|
|
map.put("templatePath", "/manifest/MT2201.ftlx");
|
|
|
map.put("sendPath", "./send/add/");
|
|
|
return mt2201(map);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public int editMt2201(Map<String, Object> map) throws IOException {
|
|
|
map.put("templatePath", "/edit/MT2201.ftlx");
|
|
|
map.put("sendPath", "./send/edit/");
|
|
|
return mt2201(map);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public int removeMt2201(Map<String, Object> map) throws IOException {
|
|
|
|
|
|
String customCode = map.get("customCode").toString();
|
|
|
// 生成报文头部
|
|
|
String msgId = makeMsgID("MT2201", customCode, map.get("awba").toString());
|
|
|
String msessageType = "MT2201";
|
|
|
String senderId = makeSenderID(customCode, customCode, "");
|
|
|
String receiverID = customCode;
|
|
|
map.put("msgId", msgId);
|
|
|
map.put("msessageType", msessageType);
|
|
|
map.put("senderId", senderId);
|
|
|
map.put("receiverID", receiverID);
|
|
|
// 报文头时间 精确到毫秒
|
|
|
map.put("sendTime", DateUtil.getCurrentTime17());
|
|
|
// 舱单传输人名称
|
|
|
map.put("orgCode", orgCode);
|
|
|
// 生成报文
|
|
|
if (makeXmlToFile("/remove/MT2201.ftlx", msgId+".xml", map, "./send/remove/")>0){
|
|
|
return 1;
|
|
|
}else {
|
|
|
return 0;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
public int mt2201(Map<String, Object> map) throws IOException {
|
|
|
ObjectMapper objectMapper = new ObjectMapper();
|
|
|
// 预配
|
|
|
NMMS_CUSTOM_MT2201 custom_mt2201 = objectMapper.convertValue(map.get("mt2201"), NMMS_CUSTOM_MT2201.class);
|
...
|
...
|
@@ -63,19 +108,21 @@ public class MT2201ServiceImp extends CustomXmlMaker implements MT2201Service { |
|
|
map.put("mt", custom_mt2201);
|
|
|
map.put("awbAwbinfo", awbAwbinfo);
|
|
|
// 生成报文头部
|
|
|
String msgId = makeMsgID("MT2201", "460470678920X", custom_mt2201.getAwba());
|
|
|
String msgId = makeMsgID("MT2201", customCode, custom_mt2201.getAwba());
|
|
|
String msessageType = "MT2201";
|
|
|
String senderId = makeSenderID(customCode, "460470678920X", "DXPENT0000460002");
|
|
|
String senderId = makeSenderID(customCode, customCode, "");
|
|
|
String receiverID = customCode;
|
|
|
map.put("msgId", msgId);
|
|
|
map.put("msessageType", msessageType);
|
|
|
map.put("senderId", senderId);
|
|
|
map.put("receiverID", receiverID);
|
|
|
// 舱单传输人名称
|
|
|
map.put("orgCode", orgCode);
|
|
|
// 生成报文
|
|
|
if (makeXmlToFile("/manifest/MT2201.ftlx", msgId+".xml", map)>0){
|
|
|
return 200;
|
|
|
if (makeXmlToFile(map.get("templatePath").toString(), msgId+".xml", map, map.get("sendPath").toString())>0){
|
|
|
return 1;
|
|
|
}else {
|
|
|
return 201;
|
|
|
return 0;
|
|
|
}
|
|
|
}
|
|
|
} |
...
|
...
|
|