...
|
...
|
@@ -18,9 +18,7 @@ import java.io.IOException; |
|
|
import java.math.BigDecimal;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
import java.util.*;
|
|
|
|
|
|
@Service
|
|
|
public class MT2201ServiceImp extends CustomXmlMaker implements MT2201Service {
|
...
|
...
|
@@ -62,30 +60,48 @@ public class MT2201ServiceImp extends CustomXmlMaker implements MT2201Service { |
|
|
private String orgCode;
|
|
|
|
|
|
@Override
|
|
|
public Map<String, Object> creatMt2201(Map<String, Object> map) throws IOException, ParseException {
|
|
|
public List<Map<String, Object>> creatMt2201(List<NMMS_CUSTOM_MT2201> nmmsCustomMt2201List) throws IOException, ParseException {
|
|
|
List<Map<String, Object>> mapList = new ArrayList<>();
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
for (NMMS_CUSTOM_MT2201 nmmsCustomMt2201: nmmsCustomMt2201List){
|
|
|
map.put("templatePath", "/manifest/MT2201.ftlx");
|
|
|
map.put("sendPath", "./send/add/");
|
|
|
return mt2201(map);
|
|
|
map.put("mt2201", nmmsCustomMt2201);
|
|
|
Map<String, Object> map1 = mt2201(map);
|
|
|
mapList.add(map1);
|
|
|
}
|
|
|
return mapList;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public Map<String, Object> editMt2201(Map<String, Object> map) throws IOException, ParseException {
|
|
|
public List<Map<String, Object>> editMt2201(List<NMMS_CUSTOM_MT2201> nmmsCustomMt2201List,
|
|
|
String reason,
|
|
|
String contactName,
|
|
|
String contactTel) throws IOException, ParseException {
|
|
|
List<Map<String, Object>> mapList = new ArrayList<>();
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
map.put("reason", reason);
|
|
|
map.put("contactName", contactName);
|
|
|
map.put("contactTel", contactTel);
|
|
|
for (NMMS_CUSTOM_MT2201 nmmsCustomMt2201: nmmsCustomMt2201List){
|
|
|
map.put("templatePath", "/edit/MT2201.ftlx");
|
|
|
map.put("sendPath", "./send/edit/");
|
|
|
return mt2201(map);
|
|
|
map.put("mt2201", nmmsCustomMt2201);
|
|
|
Map<String, Object> map1 = mt2201(map);
|
|
|
mapList.add(map1);
|
|
|
}
|
|
|
return mapList;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public Map<String, Object> removeMt2201(Map<String, Object> map) throws IOException, ParseException {
|
|
|
|
|
|
String customCode = map.get("customCode").toString();
|
|
|
|
|
|
// 生成报文头部信息
|
|
|
CustomsXmlFactory customsXmlFactory = new CustomsXmlFactory();
|
|
|
CustomsXmlHeader message = customsXmlFactory.getCustomsXmlHeader("MESSAGE");
|
|
|
Map<String, Object> mt2201 = message.makeHeader(customCode, orgsn, map.get("awba").toString(), orgCode, "", "MT2201");
|
|
|
map.put("map", mt2201);
|
|
|
|
|
|
// 舱单传输人名称
|
|
|
map.put("orgCode", orgCode);
|
|
|
// 处理主单号-
|
...
|
...
|
@@ -142,19 +158,16 @@ public class MT2201ServiceImp extends CustomXmlMaker implements MT2201Service { |
|
|
// 处理主单号-
|
|
|
String awba = ReturnUtil.awbaReplace(custom_mt2201.getAwba());
|
|
|
map.put("awba", awba);
|
|
|
|
|
|
// 生成报文头部信息
|
|
|
CustomsXmlFactory customsXmlFactory = new CustomsXmlFactory();
|
|
|
CustomsXmlHeader message = customsXmlFactory.getCustomsXmlHeader("MESSAGE");
|
|
|
Map<String, Object> mt2201 = message.makeHeader(customCode, orgsn, custom_mt2201.getAwba(), orgCode, "", "MT2201");
|
|
|
map.put("map", mt2201);
|
|
|
|
|
|
String s = DateUtil.addDateMinut(new Date(), 6);
|
|
|
// 货物装卸时间
|
|
|
map.put("loadingDate",s);
|
|
|
// 舱单传输人名称
|
|
|
map.put("orgCode", orgCode);
|
|
|
|
|
|
Map<String, Object> maps = new HashMap<>();
|
|
|
// 生成报文
|
|
|
if (makeXmlToFile(map.get("templatePath").toString(), mt2201.get("messageID")+".xml", map, map.get("sendPath").toString())>0){
|
...
|
...
|
@@ -182,7 +195,6 @@ public class MT2201ServiceImp extends CustomXmlMaker implements MT2201Service { |
|
|
nmmsCustomResponse.setCusrestext("新增报发送成功");
|
|
|
maps.put("status", "1");
|
|
|
maps.put("customResponse", nmmsCustomResponse);
|
|
|
|
|
|
return maps;
|
|
|
}else {
|
|
|
map.put("functionCode", "5");
|
...
|
...
|
|