作者 shenhailong

国际转运报文 生成完善

@@ -130,6 +130,7 @@ jwt: @@ -130,6 +130,7 @@ jwt:
130 max-alive: 300 130 max-alive: 300
131 custom: 131 custom:
132 send-path: ./send/ 132 send-path: ./send/
  133 +# send-path: /send/
133 #海关备案编码 134 #海关备案编码
134 custom-code: 460470678920X 135 custom-code: 460470678920X
135 #舱单传输人名称 136 #舱单传输人名称
@@ -4,8 +4,6 @@ import com.sunyo.wlpt.message.builder.service.MT8205Service; @@ -4,8 +4,6 @@ import com.sunyo.wlpt.message.builder.service.MT8205Service;
4 import org.springframework.beans.factory.annotation.Autowired; 4 import org.springframework.beans.factory.annotation.Autowired;
5 import org.springframework.web.bind.annotation.*; 5 import org.springframework.web.bind.annotation.*;
6 6
7 -import java.io.IOException;  
8 -import java.text.ParseException;  
9 import java.util.HashMap; 7 import java.util.HashMap;
10 import java.util.Map; 8 import java.util.Map;
11 9
1 package com.sunyo.wlpt.message.builder.service.imp; 1 package com.sunyo.wlpt.message.builder.service.imp;
2 2
3 import com.fasterxml.jackson.databind.ObjectMapper; 3 import com.fasterxml.jackson.databind.ObjectMapper;
4 -import com.sunyo.wlpt.base.model.NMMS_CUSTOM_MT1201;  
5 -import com.sunyo.wlpt.base.model.NMMS_CUSTOM_MT2201;  
6 -import com.sunyo.wlpt.base.model.NMMS_CUSTOM_MT8205;  
7 -import com.sunyo.wlpt.base.model.NMMS_CUSTOM_RESPONSE; 4 +import com.sunyo.wlpt.base.model.*;
8 import com.sunyo.wlpt.message.builder.service.MT8205Service; 5 import com.sunyo.wlpt.message.builder.service.MT8205Service;
9 import com.sunyo.wlpt.message.builder.util.CustomXmlMaker; 6 import com.sunyo.wlpt.message.builder.util.CustomXmlMaker;
10 import com.sunyo.wlpt.message.builder.util.ReturnUtil; 7 import com.sunyo.wlpt.message.builder.util.ReturnUtil;
@@ -33,31 +30,20 @@ public class MT8205ServiceImp extends CustomXmlMaker implements MT8205Service { @@ -33,31 +30,20 @@ public class MT8205ServiceImp extends CustomXmlMaker implements MT8205Service {
33 public Map<String, Object> create8205(Map<String, Object> map) throws IOException, ParseException { 30 public Map<String, Object> create8205(Map<String, Object> map) throws IOException, ParseException {
34 ObjectMapper objectMapper = new ObjectMapper(); 31 ObjectMapper objectMapper = new ObjectMapper();
35 // 转运记录 32 // 转运记录
36 - NMMS_CUSTOM_MT8205 customMt8205 = objectMapper.convertValue(map.get("mt8205"), NMMS_CUSTOM_MT8205.class);  
37 - // 进港原始  
38 - NMMS_CUSTOM_MT1201 customMt1201 = objectMapper.convertValue(map.get("mt1201"), NMMS_CUSTOM_MT1201.class);  
39 - // 出港预配  
40 - NMMS_CUSTOM_MT2201 customMt2201 = objectMapper.convertValue(map.get("mt2201"), NMMS_CUSTOM_MT2201.class); 33 + CUSTOM_MT8205 customMt8205 = objectMapper.convertValue(map.get("mt8205"), CUSTOM_MT8205.class);
41 // 关区代码 34 // 关区代码
42 String customCode = customMt8205.getCustomcode(); 35 String customCode = customMt8205.getCustomcode();
43 // 报文头时间 精确到毫秒 36 // 报文头时间 精确到毫秒
44 map.put("sendTime", DateUtil.getCurrentTime17()); 37 map.put("sendTime", DateUtil.getCurrentTime17());
45 // 封装实体 38 // 封装实体
46 map.put("mt8205", customMt8205); 39 map.put("mt8205", customMt8205);
47 - map.put("mt1201", customMt1201);  
48 - map.put("mt2201", customMt2201);  
49 map.put("orgCode", orgCode); 40 map.put("orgCode", orgCode);
50 -  
51 // 处理主单号 - 41 // 处理主单号 -
52 - String mt1201 = ReturnUtil.awbaReplace(customMt1201.getAwba());  
53 - map.put("mt1201", mt1201);  
54 - 42 + customMt8205.setOriginawbano(ReturnUtil.awbaReplace(customMt8205.getOriginawbano()));
55 // 处理主单号 - 43 // 处理主单号 -
56 - String mt2201 = ReturnUtil.awbaReplace(customMt2201.getAwba());  
57 - map.put("mt2201", mt2201);  
58 - 44 + customMt8205.setTransawbano(ReturnUtil.awbaReplace(customMt8205.getTransawbano()));
59 // 生成报文头部 45 // 生成报文头部
60 - String msgId = makeMsgID("MT8205", orgsn, customMt1201.getAwba()); 46 + String msgId = makeMsgID("MT8205", orgsn, customMt8205.getOriginawbano());
61 String msessageType = "MT8205"; 47 String msessageType = "MT8205";
62 String senderId = makeSenderID(customCode, orgsn, ""); 48 String senderId = makeSenderID(customCode, orgsn, "");
63 String receiverID = customCode; 49 String receiverID = customCode;
@@ -74,22 +60,23 @@ public class MT8205ServiceImp extends CustomXmlMaker implements MT8205Service { @@ -74,22 +60,23 @@ public class MT8205ServiceImp extends CustomXmlMaker implements MT8205Service {
74 NMMS_CUSTOM_RESPONSE nmmsCustomResponse = ReturnUtil.nmmsCustomResponse(map); 60 NMMS_CUSTOM_RESPONSE nmmsCustomResponse = ReturnUtil.nmmsCustomResponse(map);
75 System.out.println(); 61 System.out.println();
76 // 航班日期 62 // 航班日期
77 - nmmsCustomResponse.setFlightdate(customMt1201.getFlightdate()); 63 + nmmsCustomResponse.setFlightdate(customMt8205.getOriginflightdate());
78 // 航班号 64 // 航班号
79 - nmmsCustomResponse.setFlightno(customMt1201.getFlightno()); 65 + nmmsCustomResponse.setFlightno(customMt8205.getOriginflightno());
80 // 航班承运人 66 // 航班承运人
81 - nmmsCustomResponse.setCarrier(customMt1201.getCarrier()); 67 + nmmsCustomResponse.setCarrier(customMt8205.getOrigincarrier());
82 // 主单号 68 // 主单号
83 - nmmsCustomResponse.setAwbano(customMt1201.getAwba()); 69 + nmmsCustomResponse.setAwbano(customMt8205.getOriginawbano());
84 // 分单号 70 // 分单号
85 - nmmsCustomResponse.setAwbhno(AwbaUtils.awbh(customMt1201.getAwbh())); 71 + nmmsCustomResponse.setAwbhno(AwbaUtils.awbh(customMt8205.getOriginawbhno()));
86 // 件数 72 // 件数
87 - nmmsCustomResponse.setBuspiece(Integer.valueOf(customMt1201.getPiece().toString())); 73 + nmmsCustomResponse.setBuspiece(Integer.valueOf(customMt8205.getTranspiece().toString()));
88 // 重量 74 // 重量
89 - nmmsCustomResponse.setBusweight(new BigDecimal(customMt1201.getWeight().toString())); 75 + nmmsCustomResponse.setBusweight(new BigDecimal(customMt8205.getTransweight().toString()));
90 // 操作类型 76 // 操作类型
91 nmmsCustomResponse.setOpertype("新增"); 77 nmmsCustomResponse.setOpertype("新增");
92 nmmsCustomResponse.setCusrescode("23"); 78 nmmsCustomResponse.setCusrescode("23");
  79 + nmmsCustomResponse.setOperusername(map.get("username").toString());
93 nmmsCustomResponse.setCusrestext("新增报发送成功"); 80 nmmsCustomResponse.setCusrestext("新增报发送成功");
94 map8205.put("status", "1"); 81 map8205.put("status", "1");
95 map8205.put("customResponse", nmmsCustomResponse); 82 map8205.put("customResponse", nmmsCustomResponse);
@@ -16,23 +16,23 @@ @@ -16,23 +16,23 @@
16 <Name>${orgCode}</Name> 16 <Name>${orgCode}</Name>
17 </RepresentativePerson> 17 </RepresentativePerson>
18 <BorderTransportMeans> 18 <BorderTransportMeans>
19 - <JourneyID>${mt1201.carrier}${mt1201.flightno}/${mt1201.flightdate?string('yyyyMMdd')}</JourneyID> 19 + <JourneyID>${mt8205.origincarrier}${mt8205.originflightno}/${mt8205.originflightdate?string('yyyyMMdd')}</JourneyID>
20 </BorderTransportMeans> 20 </BorderTransportMeans>
21 <Consignment> 21 <Consignment>
22 <TransportContractDocument> 22 <TransportContractDocument>
23 - <ID>${mt1201awba}</ID> 23 + <ID>${mt8205.originawbano}</ID>
24 </TransportContractDocument> 24 </TransportContractDocument>
25 <LoadingLocation> 25 <LoadingLocation>
26 <ID>${mt8205.awboriginstation}</ID> 26 <ID>${mt8205.awboriginstation}</ID>
27 </LoadingLocation> 27 </LoadingLocation>
28 <ConsignmentPackaging> 28 <ConsignmentPackaging>
29 - <QuantityQuantity>${mt1201.piece}</QuantityQuantity> 29 + <QuantityQuantity>${mt8205.transpiece}</QuantityQuantity>
30 <TypeCode>PK</TypeCode> 30 <TypeCode>PK</TypeCode>
31 </ConsignmentPackaging> 31 </ConsignmentPackaging>
32 - <TotalGrossMassMeasure>${mt1201.weight?c}</TotalGrossMassMeasure> 32 + <TotalGrossMassMeasure>${mt8205.transweight?c}</TotalGrossMassMeasure>
33 <ConsignmentItem> 33 <ConsignmentItem>
34 <Commodity> 34 <Commodity>
35 - <CargoDescription>${mt1201.goodsname}</CargoDescription> 35 + <CargoDescription>${mt8205.goodsname}</CargoDescription>
36 </Commodity> 36 </Commodity>
37 </ConsignmentItem> 37 </ConsignmentItem>
38 </Consignment> 38 </Consignment>
@@ -42,20 +42,20 @@ @@ -42,20 +42,20 @@
42 <Name>${orgCode}</Name> 42 <Name>${orgCode}</Name>
43 </RepresentativePerson> 43 </RepresentativePerson>
44 <BorderTransportMeans> 44 <BorderTransportMeans>
45 - <JourneyID>${mt2201.carrier}${mt2201.flightno}/${mt2201.flightdate?string('yyyyMMdd')}</JourneyID> 45 + <JourneyID>${mt8205.transcarrier}${mt8205.transflightno}/${mt8205.transflightdate?string('yyyyMMdd')}</JourneyID>
46 </BorderTransportMeans> 46 </BorderTransportMeans>
47 <Consignment> 47 <Consignment>
48 <TransportContractDocument> 48 <TransportContractDocument>
49 - <ID>${mt2201awba}</ID> 49 + <ID>${mt8205.transawbano}</ID>
50 </TransportContractDocument> 50 </TransportContractDocument>
51 <UnloadingLocation> 51 <UnloadingLocation>
52 <ID>${mt8205.awbdesstation}</ID> 52 <ID>${mt8205.awbdesstation}</ID>
53 </UnloadingLocation> 53 </UnloadingLocation>
54 <ConsignmentPackaging> 54 <ConsignmentPackaging>
55 - <QuantityQuantity>${mt2201.piece}</QuantityQuantity> 55 + <QuantityQuantity>${mt8205.transpiece}</QuantityQuantity>
56 <TypeCode>PK</TypeCode> 56 <TypeCode>PK</TypeCode>
57 </ConsignmentPackaging> 57 </ConsignmentPackaging>
58 - <TotalGrossMassMeasure>${mt2201.weight?c}</TotalGrossMassMeasure> 58 + <TotalGrossMassMeasure>${mt8205.transweight?c}</TotalGrossMassMeasure>
59 </Consignment> 59 </Consignment>
60 </ExportInformation> 60 </ExportInformation>
61 </Relation> 61 </Relation>