...
|
...
|
@@ -4,11 +4,14 @@ import com.fasterxml.jackson.databind.ObjectMapper; |
|
|
import com.sunyo.wlpt.base.model.AWB_AWBINFO;
|
|
|
import com.sunyo.wlpt.base.model.NMMS_CUSTOM_MT1201;
|
|
|
import com.sunyo.wlpt.base.model.NMMS_CUSTOM_RESPONSE;
|
|
|
import com.sunyo.wlpt.message.builder.factory.CustomsXmlFactory;
|
|
|
import com.sunyo.wlpt.message.builder.factory.CustomsXmlHeader;
|
|
|
import com.sunyo.wlpt.message.builder.service.MT1201Service;
|
|
|
import com.sunyo.wlpt.message.builder.util.CustomXmlMaker;
|
|
|
import com.sunyo.wlpt.message.builder.util.ReturnUtil;
|
|
|
import com.tianbo.util.Date.DateUtil;
|
|
|
import com.tianbo.util.nmms.AwbaUtils;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
...
|
...
|
@@ -28,6 +31,9 @@ public class MT1201ServiceImp extends CustomXmlMaker implements MT1201Service{ |
|
|
@Value("${custom.org-code}")
|
|
|
private String orgCode;
|
|
|
|
|
|
@Value("${custom.mq-number}")
|
|
|
private String mq_number;
|
|
|
|
|
|
@Override
|
|
|
public Map<String, Object> ffmcreate(Map<String, Object> map) throws IOException, ParseException {
|
|
|
|
...
|
...
|
@@ -46,31 +52,27 @@ public class MT1201ServiceImp extends CustomXmlMaker implements MT1201Service{ |
|
|
|
|
|
@Override
|
|
|
public Map<String, Object> removeMt1201(Map<String, Object> map) throws IOException, ParseException {
|
|
|
// 处理主单号 -
|
|
|
String awba = ReturnUtil.awbaReplace(map.get("awba").toString());
|
|
|
|
|
|
String customCode = map.get("customCode").toString();
|
|
|
// 生成报文头部
|
|
|
String msgId = makeMsgID("MT1201", orgsn, map.get("awba").toString());
|
|
|
String senderId = makeSenderID(customCode, orgsn, "");
|
|
|
String receiverID = customCode;
|
|
|
map.put("msgId", msgId);
|
|
|
map.put("senderId", senderId);
|
|
|
map.put("receiverID", receiverID);
|
|
|
// 报文头时间 精确到毫秒
|
|
|
map.put("sendTime", DateUtil.getCurrentTime17());
|
|
|
// 舱单传输人名称
|
|
|
map.put("orgCode", orgCode);
|
|
|
|
|
|
// 处理主单号 -
|
|
|
String awba = ReturnUtil.awbaReplace(map.get("awba").toString());
|
|
|
map.put("awbas", awba);
|
|
|
|
|
|
String flightDate = ReturnUtil.awbaReplace(map.get("flightDate").toString());
|
|
|
map.put("flightDates",flightDate);
|
|
|
|
|
|
|
|
|
// 生成报文头部信息
|
|
|
CustomsXmlFactory customsXmlFactory = new CustomsXmlFactory();
|
|
|
CustomsXmlHeader message = customsXmlFactory.getCustomsXmlHeader("MESSAGE");
|
|
|
Map<String, Object> mt1201 = message.makeHeader(customCode, orgsn, awba, mq_number, "MT1201");
|
|
|
map.put("map", mt1201);
|
|
|
|
|
|
// 生成报文
|
|
|
Map<String, Object> hashMap = new HashMap<>();
|
|
|
// 生成报文
|
|
|
if (makeXmlToFile("/remove/MT1201.ftlx", msgId+".xml", map, "./send/remove/")>0){
|
|
|
if (makeXmlToFile("/remove/MT1201.ftlx", mt1201.get("messageID")+".xml", map, "./send/remove/")>0){
|
|
|
map.put("functionCode", "3");
|
|
|
map.put("busType","MT1201");
|
|
|
NMMS_CUSTOM_RESPONSE nmmsCustomResponse = ReturnUtil.nmmsCustomResponse(map);
|
...
|
...
|
@@ -93,12 +95,18 @@ public class MT1201ServiceImp extends CustomXmlMaker implements MT1201Service{ |
|
|
ObjectMapper objectMapper = new ObjectMapper();
|
|
|
// 预配
|
|
|
NMMS_CUSTOM_MT1201 customMt1201 = objectMapper.convertValue(map.get("mt1201"), NMMS_CUSTOM_MT1201.class);
|
|
|
String splitcode = customMt1201.getSplitcode();
|
|
|
if(StringUtils.isEmpty(splitcode)){
|
|
|
if ("T".equals(splitcode) || "S".equals(splitcode)){
|
|
|
customMt1201.setSplitcode("0");
|
|
|
}else {
|
|
|
customMt1201.setSplitcode("1");
|
|
|
}
|
|
|
}
|
|
|
// 运单
|
|
|
AWB_AWBINFO awbAwbinfo = customMt1201.getAwbinfo();
|
|
|
// 关区代码
|
|
|
String customCode = customMt1201.getCustomcode();
|
|
|
// 报文头时间 精确到毫秒
|
|
|
map.put("sendTime", DateUtil.getCurrentTime17());
|
|
|
// 航班起飞时间 sendTime(海关接受时间) + 1小时
|
|
|
String s = DateUtil.addDateMinut(new Date(), 1);
|
|
|
// 航班到达时间 航班起飞时间 + 2小时/+当前是间加3个小时
|
...
|
...
|
@@ -114,18 +122,18 @@ public class MT1201ServiceImp extends CustomXmlMaker implements MT1201Service{ |
|
|
// 处理主单号-
|
|
|
String awba = ReturnUtil.awbaReplace(customMt1201.getAwba());
|
|
|
map.put("awba", awba);
|
|
|
// 生成报文头部
|
|
|
String msgId = makeMsgID("MT1201", orgsn, customMt1201.getAwba());
|
|
|
String senderId = makeSenderID(customCode, orgsn, "");
|
|
|
String receiverID = customCode;
|
|
|
map.put("msgId", msgId);
|
|
|
map.put("senderId", senderId);
|
|
|
map.put("receiverID", receiverID);
|
|
|
|
|
|
// 生成报文头部信息
|
|
|
CustomsXmlFactory customsXmlFactory = new CustomsXmlFactory();
|
|
|
CustomsXmlHeader message = customsXmlFactory.getCustomsXmlHeader("MESSAGE");
|
|
|
Map<String, Object> mt1201 = message.makeHeader(customCode, orgsn, awba, mq_number, "MT1201");
|
|
|
map.put("map", mt1201);
|
|
|
|
|
|
// 舱单传输人名称
|
|
|
map.put("orgCode", orgCode);
|
|
|
Map<String, Object> maps = new HashMap<>();
|
|
|
// 生成报文
|
|
|
if (makeXmlToFile(map.get("templatePath").toString(), msgId+".xml", map, map.get("sendPath").toString())>0){
|
|
|
if (makeXmlToFile(map.get("templatePath").toString(), mt1201.get("messageID")+".xml", map, map.get("sendPath").toString())>0){
|
|
|
if (!map.containsKey("reason")){
|
|
|
map.put("functionCode", "9");
|
|
|
map.put("busType","MT1201");
|
...
|
...
|
|