|
|
package com.sunyo.wlpt.message.builder.service.imp;
|
|
|
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.sunyo.wlpt.base.model.NMMS_CUSTOM_MT1201;
|
|
|
import com.sunyo.wlpt.base.model.NMMS_CUSTOM_MT2201;
|
|
|
import com.sunyo.wlpt.base.model.NMMS_CUSTOM_MT8205;
|
|
|
import com.sunyo.wlpt.message.builder.service.MT8205Service;
|
|
|
import com.sunyo.wlpt.message.builder.util.CustomXmlMaker;
|
|
|
import com.tianbo.util.Date.DateUtil;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
import java.util.Map;
|
|
|
|
|
|
@Service
|
|
|
public class MT8205ServiceImp extends CustomXmlMaker implements MT8205Service {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
public Boolean create8205(Map<String, Object> map) throws IOException {
|
|
|
ObjectMapper objectMapper = new ObjectMapper();
|
|
|
// 转运记录
|
|
|
NMMS_CUSTOM_MT8205 customMt8205 = objectMapper.convertValue(map.get("mt8205"), NMMS_CUSTOM_MT8205.class);
|
|
|
// 进港原始
|
|
|
NMMS_CUSTOM_MT1201 customMt1201 = objectMapper.convertValue(map.get("mt1201"), NMMS_CUSTOM_MT1201.class);
|
|
|
// 出港预配
|
|
|
NMMS_CUSTOM_MT2201 customMt2201 = objectMapper.convertValue(map.get("mt2201"), NMMS_CUSTOM_MT2201.class);
|
|
|
|
|
|
// 关区代码
|
|
|
String customCode = customMt8205.getCustomcode();
|
|
|
// 报文头时间 精确到毫秒
|
|
|
map.put("sendTime", DateUtil.getCurrentTime17());
|
|
|
// 封装实体
|
|
|
map.put("mt8205", customMt8205);
|
|
|
map.put("mt1201", customMt1201);
|
|
|
map.put("mt2201", customMt2201);
|
|
|
|
|
|
// 生成报文头部
|
|
|
String msgId = makeMsgID("MT8205", "460470678920X", "");
|
|
|
String msessageType = "MT8205";
|
|
|
String senderId = makeSenderID(customCode, "460470678920X", "DXPENT0000460002");
|
|
|
String receiverID = customCode;
|
|
|
map.put("msgId", msgId);
|
|
|
map.put("msessageType", msessageType);
|
|
|
map.put("senderId", senderId);
|
|
|
map.put("receiverID", receiverID);
|
|
|
|
|
|
if (makeXmlToFile("/manifest/MT8205.ftlx", msgId+".xml", map)>0){
|
|
|
return true;
|
|
|
}else {
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
} |
...
|
...
|
|