...
|
...
|
@@ -3,13 +3,17 @@ package com.sunyo.wlpt.message.builder.service.imp; |
|
|
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.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 org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
import java.text.ParseException;
|
|
|
import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
|
...
|
...
|
@@ -23,7 +27,7 @@ public class MT1201ServiceImp extends CustomXmlMaker implements MT1201Service{ |
|
|
private String orgCode;
|
|
|
|
|
|
@Override
|
|
|
public int ffmcreate(Map<String, Object> map) throws IOException {
|
|
|
public Map<String, Object> ffmcreate(Map<String, Object> map) throws IOException, ParseException {
|
|
|
|
|
|
map.put("templatePath", "/manifest/MT1201.ftlx");
|
|
|
map.put("sendPath", "./send/add/");
|
...
|
...
|
@@ -31,7 +35,7 @@ public class MT1201ServiceImp extends CustomXmlMaker implements MT1201Service{ |
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public int editMt1201(Map<String, Object> map) throws IOException {
|
|
|
public Map<String, Object> editMt1201(Map<String, Object> map) throws IOException, ParseException {
|
|
|
|
|
|
map.put("templatePath", "/edit/MT1201.ftlx");
|
|
|
map.put("sendPath", "./send/edit/");
|
...
|
...
|
@@ -39,7 +43,7 @@ public class MT1201ServiceImp extends CustomXmlMaker implements MT1201Service{ |
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public int removeMt1201(Map<String, Object> map) throws IOException {
|
|
|
public Map<String, Object> removeMt1201(Map<String, Object> map) throws IOException, ParseException {
|
|
|
|
|
|
String customCode = map.get("customCode").toString();
|
|
|
// 生成报文头部
|
...
|
...
|
@@ -54,15 +58,27 @@ public class MT1201ServiceImp extends CustomXmlMaker implements MT1201Service{ |
|
|
// 舱单传输人名称
|
|
|
map.put("orgCode", orgCode);
|
|
|
// 生成报文
|
|
|
Map<String, Object> hashMap = new HashMap<>();
|
|
|
// 生成报文
|
|
|
if (makeXmlToFile("/remove/MT1201.ftlx", msgId+".xml", map, "./send/remove/")>0){
|
|
|
return 1;
|
|
|
map.put("functionCode", "3");
|
|
|
map.put("busType","MT1201");
|
|
|
NMMS_CUSTOM_RESPONSE nmmsCustomResponse = ReturnUtil.nmmsCustomResponse(map);
|
|
|
// 操作类型
|
|
|
nmmsCustomResponse.setOpertype("删除");
|
|
|
nmmsCustomResponse.setCusrescode("24");
|
|
|
nmmsCustomResponse.setCusrestext("删除报发送成功");
|
|
|
hashMap.put("status", "1");
|
|
|
hashMap.put("customResponse", nmmsCustomResponse);
|
|
|
return hashMap;
|
|
|
}else {
|
|
|
return 0;
|
|
|
hashMap.put("staus", "0");
|
|
|
return hashMap;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
public int mt1201(Map<String, Object> map) throws IOException {
|
|
|
public Map<String, Object> mt1201(Map<String, Object> map) throws IOException, ParseException {
|
|
|
ObjectMapper objectMapper = new ObjectMapper();
|
|
|
// 预配
|
|
|
NMMS_CUSTOM_MT1201 customMt1201 = objectMapper.convertValue(map.get("mt1201"), NMMS_CUSTOM_MT1201.class);
|
...
|
...
|
@@ -72,6 +88,13 @@ public class MT1201ServiceImp extends CustomXmlMaker implements MT1201Service{ |
|
|
String customCode = customMt1201.getCustomcode();
|
|
|
// 报文头时间 精确到毫秒
|
|
|
map.put("sendTime", DateUtil.getCurrentTime17());
|
|
|
// 航班起飞时间 sendTime(海关接受时间) + 1小时
|
|
|
String s = DateUtil.addDateMinut(new Date(), 1);
|
|
|
// 航班到达时间 航班起飞时间 + 2小时
|
|
|
String ss = DateUtil.addDateMinut(new Date(), 3);
|
|
|
map.put("arrivalDateTime", s);
|
|
|
map.put("departureDateTime", ss);
|
|
|
|
|
|
// 封装实体
|
|
|
map.put("mt", customMt1201);
|
|
|
map.put("awbAwbinfo", awbAwbinfo);
|
...
|
...
|
@@ -84,11 +107,73 @@ public class MT1201ServiceImp extends CustomXmlMaker implements MT1201Service{ |
|
|
map.put("receiverID", receiverID);
|
|
|
// 舱单传输人名称
|
|
|
map.put("orgCode", orgCode);
|
|
|
Map<String, Object> maps = new HashMap<>();
|
|
|
// 生成报文
|
|
|
if (makeXmlToFile(map.get("templatePath").toString(), msgId+".xml", map, map.get("sendPath").toString())>0){
|
|
|
return 1;
|
|
|
if (!map.containsKey("reason")){
|
|
|
map.put("functionCode", "9");
|
|
|
map.put("busType","MT1201");
|
|
|
NMMS_CUSTOM_RESPONSE nmmsCustomResponse = ReturnUtil.nmmsCustomResponse(map);
|
|
|
// 航班日期
|
|
|
nmmsCustomResponse.setFlightdate(customMt1201.getFlightdate());
|
|
|
// 航班号
|
|
|
nmmsCustomResponse.setFlightno(customMt1201.getFlightno());
|
|
|
// 航班承运人
|
|
|
nmmsCustomResponse.setCarrier(customMt1201.getCarrier());
|
|
|
// 主单号
|
|
|
nmmsCustomResponse.setAwbano(customMt1201.getAwba());
|
|
|
if (!"".equals(customMt1201.getAwbh())){
|
|
|
// 分单号
|
|
|
nmmsCustomResponse.setAwbhno(customMt1201.getAwbh());
|
|
|
}else {
|
|
|
nmmsCustomResponse.setAwbhno(null);
|
|
|
}
|
|
|
// 件数
|
|
|
nmmsCustomResponse.setBuspiece(Integer.valueOf(customMt1201.getPiece().toString()));
|
|
|
// 重量
|
|
|
nmmsCustomResponse.setBusweight(Long.valueOf(customMt1201.getWeight().toString()));
|
|
|
// 操作类型
|
|
|
nmmsCustomResponse.setOpertype("新增");
|
|
|
nmmsCustomResponse.setCusrescode("23");
|
|
|
nmmsCustomResponse.setCusrestext("新增报发送成功");
|
|
|
maps.put("status", "1");
|
|
|
maps.put("customResponse", nmmsCustomResponse);
|
|
|
|
|
|
return maps;
|
|
|
}else {
|
|
|
map.put("functionCode", "5");
|
|
|
map.put("busType","MT1201");
|
|
|
NMMS_CUSTOM_RESPONSE nmmsCustomResponse = ReturnUtil.nmmsCustomResponse(map);
|
|
|
// 航班日期
|
|
|
nmmsCustomResponse.setFlightdate(customMt1201.getFlightdate());
|
|
|
// 航班号
|
|
|
nmmsCustomResponse.setFlightno(customMt1201.getFlightno());
|
|
|
// 航班承运人
|
|
|
nmmsCustomResponse.setCarrier(customMt1201.getCarrier());
|
|
|
// 主单号
|
|
|
nmmsCustomResponse.setAwbano(customMt1201.getAwba());
|
|
|
if (!"".equals(customMt1201.getAwbh())){
|
|
|
// 分单号
|
|
|
nmmsCustomResponse.setAwbhno(customMt1201.getAwbh());
|
|
|
}else {
|
|
|
nmmsCustomResponse.setAwbhno(null);
|
|
|
}
|
|
|
// 件数
|
|
|
nmmsCustomResponse.setBuspiece(Integer.valueOf(customMt1201.getPiece().toString()));
|
|
|
// 重量
|
|
|
nmmsCustomResponse.setBusweight(Long.valueOf(customMt1201.getWeight().toString()));
|
|
|
// 操作类型
|
|
|
nmmsCustomResponse.setOpertype("修改");
|
|
|
nmmsCustomResponse.setCusrescode("25");
|
|
|
nmmsCustomResponse.setCusrestext("修改报发送成功");
|
|
|
maps.put("status", "1");
|
|
|
maps.put("customResponse", nmmsCustomResponse);
|
|
|
|
|
|
return maps;
|
|
|
}
|
|
|
}else {
|
|
|
return 0;
|
|
|
maps.put("status", "0");
|
|
|
return maps;
|
|
|
}
|
|
|
}
|
|
|
} |
...
|
...
|
|