作者 shenhailong

添加 批量单号发送删除 逻辑修改

添加出港预配  批量生成删除 批量生成发送 批量生成修改
@@ -34,6 +34,26 @@ public class MT1201Controller { @@ -34,6 +34,26 @@ public class MT1201Controller {
34 } 34 }
35 } 35 }
36 36
  37 + /**
  38 + * 原始 FFm
  39 + * @param map
  40 + * @return
  41 + */
  42 + @RequestMapping("/batchCreateMt1201")
  43 + @ResponseBody
  44 + public Map<String, Object> batchCreateMt1201(@RequestBody Map<String, Object> map){
  45 +
  46 + try {
  47 +
  48 + return mt1201Service.ffmcreate(map);
  49 + }catch (Exception e){
  50 + e.printStackTrace();
  51 + Map<String, Object> maps = new HashMap<>();
  52 + maps.put("status", "0");
  53 + return maps;
  54 + }
  55 + }
  56 +
37 57
38 /** 58 /**
39 * 原始 FFm 59 * 原始 FFm
@@ -70,6 +90,20 @@ public class MT1201Controller { @@ -70,6 +90,20 @@ public class MT1201Controller {
70 } 90 }
71 } 91 }
72 92
  93 + @PutMapping("/batchRemoveMt1201")
  94 + @ResponseBody
  95 + public Map<String, Object> batchRemoveMt1201(@RequestBody Map<String, Object> map){
  96 + try {
  97 +
  98 + return mt1201Service.removeMt1201(map);
  99 + }catch (Exception e){
  100 + e.printStackTrace();
  101 + Map<String, Object> maps = new HashMap<>();
  102 + maps.put("status", "0");
  103 + return maps;
  104 + }
  105 + }
  106 +
73 107
74 108
75 } 109 }
@@ -2,12 +2,14 @@ package com.sunyo.wlpt.message.builder.controller; @@ -2,12 +2,14 @@ package com.sunyo.wlpt.message.builder.controller;
2 2
3 import com.sunyo.wlpt.base.model.NMMS_CUSTOM_MT2201; 3 import com.sunyo.wlpt.base.model.NMMS_CUSTOM_MT2201;
4 import com.sunyo.wlpt.message.builder.service.MT2201Service; 4 import com.sunyo.wlpt.message.builder.service.MT2201Service;
  5 +import com.sunyo.wlpt.message.builder.util.ReturnUtil;
5 import io.swagger.annotations.ApiOperation; 6 import io.swagger.annotations.ApiOperation;
6 import org.springframework.beans.factory.annotation.Autowired; 7 import org.springframework.beans.factory.annotation.Autowired;
7 import org.springframework.web.bind.annotation.*; 8 import org.springframework.web.bind.annotation.*;
8 9
9 import java.io.IOException; 10 import java.io.IOException;
10 import java.text.ParseException; 11 import java.text.ParseException;
  12 +import java.text.SimpleDateFormat;
11 import java.util.ArrayList; 13 import java.util.ArrayList;
12 import java.util.HashMap; 14 import java.util.HashMap;
13 import java.util.List; 15 import java.util.List;
@@ -48,7 +50,6 @@ public class MT2201Controller { @@ -48,7 +50,6 @@ public class MT2201Controller {
48 @RequestParam("contactTel")String contactTel) { 50 @RequestParam("contactTel")String contactTel) {
49 51
50 try { 52 try {
51 -  
52 return mt2201Service.editMt2201(nmmsCustomMt2201List, reason, contactName, contactTel); 53 return mt2201Service.editMt2201(nmmsCustomMt2201List, reason, contactName, contactTel);
53 }catch (Exception e){ 54 }catch (Exception e){
54 e.printStackTrace(); 55 e.printStackTrace();
@@ -60,15 +61,21 @@ public class MT2201Controller { @@ -60,15 +61,21 @@ public class MT2201Controller {
60 @PutMapping("/removeMt2201") 61 @PutMapping("/removeMt2201")
61 @ApiOperation(value = "删除报文") 62 @ApiOperation(value = "删除报文")
62 @ResponseBody 63 @ResponseBody
63 - public Map<String, Object> removeMt2201(@RequestBody Map<String, Object> map) { 64 + public List<Map<String, Object>> removeMt2201(@RequestBody List<NMMS_CUSTOM_MT2201> nmmsCustomMt2201List,
  65 + @RequestParam("reason")String reason,
  66 + @RequestParam("contactName")String contactName,
  67 + @RequestParam("contactTel")String contactTel,
  68 + @RequestParam("content")String content) {
64 69
65 try { 70 try {
66 - return mt2201Service.removeMt2201(map); 71 + Map<String, Object> map = removeLogic(nmmsCustomMt2201List, reason, contactName, contactTel, content);
  72 + Map<String, Object> mapNmms = mt2201Service.removeMt2201(map);
  73 + List<Map<String, Object>> mapList = new ArrayList<>();
  74 + mapList.add(mapNmms);
  75 + return mapList;
67 }catch (Exception e){ 76 }catch (Exception e){
68 e.printStackTrace(); 77 e.printStackTrace();
69 - Map<String, Object> maps = new HashMap<>();  
70 - maps.put("status", "0");  
71 - return maps; 78 + return null;
72 } 79 }
73 80
74 } 81 }
@@ -85,4 +92,36 @@ public class MT2201Controller { @@ -85,4 +92,36 @@ public class MT2201Controller {
85 92
86 } 93 }
87 94
  95 + /**
  96 + * 删除报文逻辑处理
  97 + */
  98 + public Map<String, Object> removeLogic(List<NMMS_CUSTOM_MT2201> nmmsCustomMt2201List,
  99 + String reason,
  100 + String contactName,
  101 + String contactTel,
  102 + String content){
  103 + Map<String, Object> map = new HashMap<>();
  104 + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
  105 +
  106 + for (NMMS_CUSTOM_MT2201 nmmsCustomMt2201 : nmmsCustomMt2201List){
  107 + map.put("flightDates",sdf.format(nmmsCustomMt2201.getFlightdate()));
  108 + map.put("carrier", nmmsCustomMt2201.getCarrier());
  109 + map.put("flightNo", nmmsCustomMt2201.getFlightno());
  110 + map.put("customCode", nmmsCustomMt2201.getCustomcode());
  111 + map.put("awba", nmmsCustomMt2201.getAwba());
  112 + break;
  113 + }
  114 + for (NMMS_CUSTOM_MT2201 nmmsCustomMt2201 : nmmsCustomMt2201List){
  115 + // 处理主单号-
  116 + String awba = ReturnUtil.awbaReplace(nmmsCustomMt2201.getAwba());
  117 + nmmsCustomMt2201.setAwba(awba);
  118 + }
  119 + map.put("reason",reason);
  120 + map.put("contactName",contactName);
  121 + map.put("contactTel",contactTel);
  122 + map.put("content",content);
  123 + map.put("nmmsCustomMt2201List", nmmsCustomMt2201List);
  124 + return map;
  125 + }
  126 +
88 } 127 }
@@ -104,17 +104,16 @@ public class MT2201ServiceImp extends CustomXmlMaker implements MT2201Service { @@ -104,17 +104,16 @@ public class MT2201ServiceImp extends CustomXmlMaker implements MT2201Service {
104 map.put("map", mt2201); 104 map.put("map", mt2201);
105 // 舱单传输人名称 105 // 舱单传输人名称
106 map.put("orgCode", orgCode); 106 map.put("orgCode", orgCode);
107 - // 处理主单号-  
108 - String awba = ReturnUtil.awbaReplace(map.get("awba").toString());  
109 - map.put("awbas", awba);  
110 - String flightDate = ReturnUtil.awbaReplace(map.get("flightDate").toString());  
111 - map.put("flightDates",flightDate); 107 +// // 处理主单号-
  108 +// String awba = ReturnUtil.awbaReplace(map.get("awba").toString());
  109 +// map.put("awbas", awba);
  110 +// String flightDate = ReturnUtil.awbaReplace(map.get("flightDate").toString());
  111 +// map.put("flightDates",flightDate);
112 Map<String, Object> hashMap = new HashMap<>(); 112 Map<String, Object> hashMap = new HashMap<>();
113 // 生成报文 113 // 生成报文
114 if (makeXmlToFile("/remove/MT2201.ftlx", mt2201.get("messageID").toString()+".xml", map, "./send/remove/")>0){ 114 if (makeXmlToFile("/remove/MT2201.ftlx", mt2201.get("messageID").toString()+".xml", map, "./send/remove/")>0){
115 map.put("functionCode", "3"); 115 map.put("functionCode", "3");
116 map.put("busType","MT2201"); 116 map.put("busType","MT2201");
117 - System.out.println();  
118 NMMS_CUSTOM_RESPONSE nmmsCustomResponse = ReturnUtil.nmmsCustomResponse(map); 117 NMMS_CUSTOM_RESPONSE nmmsCustomResponse = ReturnUtil.nmmsCustomResponse(map);
119 // 操作类型 118 // 操作类型
120 nmmsCustomResponse.setOpertype("删除"); 119 nmmsCustomResponse.setOpertype("删除");
@@ -16,21 +16,25 @@ @@ -16,21 +16,25 @@
16 <BorderTransportMeans> 16 <BorderTransportMeans>
17 <JourneyID>${carrier}${flightNo}/${flightDates}</JourneyID> 17 <JourneyID>${carrier}${flightNo}/${flightDates}</JourneyID>
18 </BorderTransportMeans> 18 </BorderTransportMeans>
19 - <Consignment>  
20 - <TransportContractDocument>  
21 - <ID>${awbas}</ID>  
22 - <ChangeReasonCode>9999</ChangeReasonCode>  
23 - </TransportContractDocument>  
24 - <#if awbh?default("")?length gt 1>  
25 - <AssociatedTransportDocument>  
26 - <ID>${awbas}_${awbh}</ID>  
27 - </AssociatedTransportDocument>  
28 - </#if>  
29 - </Consignment> 19 + <#list nmmsCustomMt2201List as nmms>
  20 + <Consignment>
  21 + <TransportContractDocument>
  22 + <ID>${nmms.awba}</ID>
  23 + <ChangeReasonCode>9999</ChangeReasonCode>
  24 + </TransportContractDocument>
  25 + <#if nmms.awbh?default("")?length gt 1>
  26 + <AssociatedTransportDocument>
  27 + <ID>${nmms.awba}_${nmms.awbh}</ID>
  28 + </AssociatedTransportDocument>
  29 + </#if>
  30 + </Consignment>
  31 + </#list>
  32 +
30 <AdditionalInformation> 33 <AdditionalInformation>
31 <Reason>${reason}</Reason> 34 <Reason>${reason}</Reason>
32 <ContactName>${contactName}</ContactName> 35 <ContactName>${contactName}</ContactName>
33 <ContactTel>${contactTel}</ContactTel> 36 <ContactTel>${contactTel}</ContactTel>
  37 + <Content>${content}</Content>
34 </AdditionalInformation> 38 </AdditionalInformation>
35 </Declaration> 39 </Declaration>
36 -</Manifest>  
  40 +</Manifest>