...
|
...
|
@@ -2,13 +2,16 @@ package com.sunyo.wlpt.message.builder.service.imp; |
|
|
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.sunyo.wlpt.base.model.NMMS_CUSTOM_MT520X;
|
|
|
import com.sunyo.wlpt.base.model.NMMS_CUSTOM_RESPONSE;
|
|
|
import com.sunyo.wlpt.message.builder.service.MT520XService;
|
|
|
import com.sunyo.wlpt.message.builder.util.CustomXmlMaker;
|
|
|
import com.sunyo.wlpt.message.builder.util.ReturnUtil;
|
|
|
import com.tianbo.util.Date.DateUtil;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
import java.text.ParseException;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
|
...
|
...
|
@@ -22,7 +25,7 @@ public class MT520XServiceImp extends CustomXmlMaker implements MT520XService{ |
|
|
private String orgCode;
|
|
|
|
|
|
@Override
|
|
|
public int create(Map<String, Object> map) {
|
|
|
public Map<String, Object> create(Map<String, Object> map) {
|
|
|
|
|
|
try {
|
|
|
|
...
|
...
|
@@ -51,11 +54,11 @@ public class MT520XServiceImp extends CustomXmlMaker implements MT520XService{ |
|
|
hashMap.put("msessageType", msessageType);
|
|
|
hashMap.put("senderId", senderId);
|
|
|
hashMap.put("receiverID", receiverID);
|
|
|
if (makeXmlToFile("/manifest/MT5201.ftlx", msgId+".xml", hashMap, "./send/add/")>0){
|
|
|
return 1;
|
|
|
}else {
|
|
|
return 0;
|
|
|
}
|
|
|
// if (makeXmlToFile("/manifest/MT5201.ftlx", msgId+".xml", hashMap, "./send/add/")>0){
|
|
|
// return 1;
|
|
|
// }else {
|
|
|
// return 0;
|
|
|
// }
|
|
|
}else {
|
|
|
|
|
|
// 生成报文头部
|
...
|
...
|
@@ -67,22 +70,46 @@ public class MT520XServiceImp extends CustomXmlMaker implements MT520XService{ |
|
|
hashMap.put("msessageType", msessageType);
|
|
|
hashMap.put("senderId", senderId);
|
|
|
hashMap.put("receiverID", receiverID);
|
|
|
Map<String, Object> maps = new HashMap<>();
|
|
|
if (makeXmlToFile("/manifest/MT5202.ftlx", msgId+".xml", hashMap, "./send/add/")>0){
|
|
|
return 1;
|
|
|
|
|
|
hashMap.put("functionCode", "2");
|
|
|
hashMap.put("busType","MT5202");
|
|
|
NMMS_CUSTOM_RESPONSE nmmsCustomResponse = ReturnUtil.nmmsCustomResponse(hashMap);
|
|
|
// 航班日期
|
|
|
nmmsCustomResponse.setFlightdate(customMt520X.getFlightdate());
|
|
|
// 航班号
|
|
|
nmmsCustomResponse.setFlightno(customMt520X.getFlightno());
|
|
|
// 航班承运人
|
|
|
nmmsCustomResponse.setCarrier(customMt520X.getCarrier());
|
|
|
// 主单号
|
|
|
nmmsCustomResponse.setAwbano(customMt520X.getAwba());
|
|
|
// 分单号
|
|
|
nmmsCustomResponse.setAwbhno(customMt520X.getAwbh());
|
|
|
// 件数
|
|
|
nmmsCustomResponse.setBuspiece(customMt520X.getPiece());
|
|
|
// 重量
|
|
|
nmmsCustomResponse.setBusweight(customMt520X.getWeight());
|
|
|
maps.put("status", "1");
|
|
|
maps.put("customResponse", nmmsCustomResponse);
|
|
|
|
|
|
return maps;
|
|
|
}else {
|
|
|
return 0;
|
|
|
maps.put("staus", "0");
|
|
|
return maps;
|
|
|
}
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
|
|
|
e.printStackTrace();
|
|
|
return 0;
|
|
|
return null;
|
|
|
}
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public int remove520x(Map<String, Object> map) throws IOException {
|
|
|
public Map<String, Object> remove520x(Map<String, Object> map) throws IOException, ParseException {
|
|
|
|
|
|
String customCode = map.get("customCode").toString();
|
|
|
map.put("customCode", customCode);
|
...
|
...
|
@@ -96,11 +123,13 @@ public class MT520XServiceImp extends CustomXmlMaker implements MT520XService{ |
|
|
map.put("msgId", msgId);
|
|
|
map.put("senderId", senderId);
|
|
|
map.put("receiverID", receiverID);
|
|
|
if (makeXmlToFile("/remove/MT5201.ftlx", msgId+".xml", map, "./send/remove/")>0){
|
|
|
return 1;
|
|
|
}else {
|
|
|
return 0;
|
|
|
}
|
|
|
// if (makeXmlToFile("/remove/MT5201.ftlx", msgId+".xml", map, "./send/remove/")>0){
|
|
|
//
|
|
|
//
|
|
|
// return 1;
|
|
|
// }else {
|
|
|
// return 0;
|
|
|
// }
|
|
|
}else {
|
|
|
// 生成报文头部
|
|
|
String msgId = makeMsgID("MT5202", orgsn, map.get("awba").toString());
|
...
|
...
|
@@ -109,12 +138,21 @@ public class MT520XServiceImp extends CustomXmlMaker implements MT520XService{ |
|
|
map.put("msgId", msgId);
|
|
|
map.put("senderId", senderId);
|
|
|
map.put("receiverID", receiverID);
|
|
|
Map<String, Object> maps = new HashMap<>();
|
|
|
if (makeXmlToFile("/remove/MT5202.ftlx", msgId+".xml", map, "./send/remove/")>0){
|
|
|
return 1;
|
|
|
|
|
|
map.put("functionCode", "3");
|
|
|
map.put("busType","MT5202");
|
|
|
NMMS_CUSTOM_RESPONSE nmmsCustomResponse = ReturnUtil.nmmsCustomResponse(map);
|
|
|
maps.put("status", "1");
|
|
|
maps.put("customResponse", nmmsCustomResponse);
|
|
|
|
|
|
return maps;
|
|
|
}else {
|
|
|
return 0;
|
|
|
maps.put("staus", "0");
|
|
|
return maps;
|
|
|
}
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|