...
|
...
|
@@ -6,6 +6,7 @@ import com.sunyo.wlpt.base.model.NMMS_CUSTOM_MT1201; |
|
|
import com.sunyo.wlpt.message.builder.service.MT1201Service;
|
|
|
import com.sunyo.wlpt.message.builder.util.CustomXmlMaker;
|
|
|
import com.tianbo.util.Date.DateUtil;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.io.IOException;
|
...
|
...
|
@@ -15,41 +16,79 @@ import java.util.Map; |
|
|
@Service
|
|
|
public class MT1201ServiceImp extends CustomXmlMaker implements MT1201Service{
|
|
|
|
|
|
@Value("${custom.custom-code}")
|
|
|
private String orgsn;
|
|
|
|
|
|
@Value("${custom.org-code}")
|
|
|
private String orgCode;
|
|
|
|
|
|
@Override
|
|
|
public int ffmcreate(Map<String, Object> map) throws IOException {
|
|
|
|
|
|
ObjectMapper objectMapper = new ObjectMapper();
|
|
|
map.put("templatePath", "/manifest/MT1201.ftlx");
|
|
|
map.put("sendPath", "./send/add/");
|
|
|
return mt1201(map);
|
|
|
}
|
|
|
|
|
|
NMMS_CUSTOM_MT1201 customMt1201 = objectMapper.convertValue(map.get("mt1201"), NMMS_CUSTOM_MT1201.class);
|
|
|
@Override
|
|
|
public int editMt1201(Map<String, Object> map) throws IOException {
|
|
|
|
|
|
Map<String, Object> hashMap = new HashMap();
|
|
|
map.put("templatePath", "/edit/MT1201.ftlx");
|
|
|
map.put("sendPath", "./send/edit/");
|
|
|
return mt1201(map);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public int removeMt1201(Map<String, Object> map) throws IOException {
|
|
|
|
|
|
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);
|
|
|
// 生成报文
|
|
|
if (makeXmlToFile("/remove/MT1201.ftlx", msgId+".xml", map, "./send/remove/")>0){
|
|
|
return 1;
|
|
|
}else {
|
|
|
return 0;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
AWB_AWBINFO awbAwbinfo = customMt1201.getAwbinfo();
|
|
|
|
|
|
public int mt1201(Map<String, Object> map) throws IOException {
|
|
|
ObjectMapper objectMapper = new ObjectMapper();
|
|
|
// 预配
|
|
|
NMMS_CUSTOM_MT1201 customMt1201 = objectMapper.convertValue(map.get("mt1201"), NMMS_CUSTOM_MT1201.class);
|
|
|
// 运单
|
|
|
AWB_AWBINFO awbAwbinfo = customMt1201.getAwbinfo();
|
|
|
// 关区代码
|
|
|
String customCode = customMt1201.getCustomcode();
|
|
|
// 报文头时间 精确到毫秒
|
|
|
hashMap.put("sendTime", DateUtil.getCurrentTime17());
|
|
|
map.put("sendTime", DateUtil.getCurrentTime17());
|
|
|
// 封装实体
|
|
|
hashMap.put("mt", customMt1201);
|
|
|
|
|
|
hashMap.put("awbAwbinfo", customMt1201);
|
|
|
|
|
|
map.put("mt", customMt1201);
|
|
|
map.put("awbAwbinfo", awbAwbinfo);
|
|
|
// 生成报文头部
|
|
|
String msgId = makeMsgID("MT1201", "460470678920X", customMt1201.getAwba());
|
|
|
String msessageType = "MT1201";
|
|
|
String senderId = makeSenderID(customCode, "460470678920X", "DXPENT0000460002");
|
|
|
String msgId = makeMsgID("MT2201", orgsn, customMt1201.getAwba());
|
|
|
String senderId = makeSenderID(customCode, orgsn, "");
|
|
|
String receiverID = customCode;
|
|
|
hashMap.put("msgId", msgId);
|
|
|
hashMap.put("msessageType", msessageType);
|
|
|
hashMap.put("senderId", senderId);
|
|
|
hashMap.put("receiverID", receiverID);
|
|
|
// if (makeXmlToFile("/manifest/MT5201.ftlx", msgId+".xml", hashMap)>0){
|
|
|
// return 200;
|
|
|
// }else {
|
|
|
// return 201;
|
|
|
// }
|
|
|
map.put("msgId", msgId);
|
|
|
map.put("senderId", senderId);
|
|
|
map.put("receiverID", receiverID);
|
|
|
// 舱单传输人名称
|
|
|
map.put("orgCode", orgCode);
|
|
|
// 生成报文
|
|
|
if (makeXmlToFile(map.get("templatePath").toString(), msgId+".xml", map, map.get("sendPath").toString())>0){
|
|
|
return 1;
|
|
|
}else {
|
|
|
return 0;
|
|
|
}
|
|
|
}
|
|
|
} |
...
|
...
|
|