作者 shenhailong

生成报文 拆分 controller 2201 生成报

... ... @@ -9,85 +9,12 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
@RestController
@RequestMapping("/mtcreate")
@RequestMapping("/mt8205")
public class CreateftlxController {
@Autowired
MT520XService mt520XService;
@Autowired
MT1201Service mt1201Service;
@Autowired
MT3201Service mt3201Service;
@Autowired
MT4201Service mt4201Service;
@Autowired
MT8205Service mt8205Service;
/**
* 进出港理货
* @param map
* @return
*/
@RequestMapping("/520xcreate")
public Boolean create(@RequestBody Map<String, Object> map){
try {
return mt520XService.create(map);
}catch (Exception e){
e.printStackTrace();
return false;
}
}
/**
* 原始 FFm
* @param map
* @return
*/
@RequestMapping("/1201create")
public Boolean ffmcreate(@RequestBody Map<String, Object> map){
try {
return true;
}catch (Exception e){
e.printStackTrace();
return false;
}
}
@RequestMapping("/3201create")
public Boolean fohcreate(@RequestBody Map<String, Object> map){
try {
return mt3201Service.fohcreate(map);
}catch (Exception e){
e.printStackTrace();
return false;
}
}
@RequestMapping("/4201create")
public Boolean pffmcreate(@RequestBody Map<String, Object> map){
try {
return mt4201Service.pffmcreate(map);
}catch (Exception e){
e.printStackTrace();
return false;
}
}
@RequestMapping("/8205create")
public Boolean create8205(@RequestBody Map<String, Object> map){
... ...
package com.sunyo.wlpt.message.builder.controller;
import com.sunyo.wlpt.message.builder.service.MT1201Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
@RestController
@RequestMapping("/mt1201")
public class MT1201Controller {
@Autowired
MT1201Service mt1201Service;
/**
* 原始 FFm
* @param map
* @return
*/
@RequestMapping("/1201create")
public Boolean ffmcreate(@RequestBody Map<String, Object> map){
try {
return true;
}catch (Exception e){
e.printStackTrace();
return false;
}
}
}
... ...
package com.sunyo.wlpt.message.builder.controller;
import com.sunyo.wlpt.message.builder.service.MT2201Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
@RestController
@RequestMapping(value = "/mt2201")
public class MT2201Controller {
@Autowired
private MT2201Service mt2201Service;
@RequestMapping("/creatMt2201")
public int creatMt2201(@RequestBody Map<String, Object> map){
int i = mt2201Service.creatMt2201(map);
return 0;
}
}
... ...
package com.sunyo.wlpt.message.builder.controller;
import com.sunyo.wlpt.message.builder.service.MT3201Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
@RestController
@RequestMapping("/mt3201")
public class MT3201Controller {
@Autowired
MT3201Service mt3201Service;
@RequestMapping("/3201create")
public Boolean fohcreate(@RequestBody Map<String, Object> map){
try {
return mt3201Service.fohcreate(map);
}catch (Exception e){
e.printStackTrace();
return false;
}
}
}
... ...
package com.sunyo.wlpt.message.builder.controller;
import com.sunyo.wlpt.message.builder.service.MT4201Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
@RestController
@RequestMapping("/mt4201")
public class MT4201Controller {
@Autowired
MT4201Service mt4201Service;
@RequestMapping("/4201create")
public Boolean pffmcreate(@RequestBody Map<String, Object> map){
try {
return mt4201Service.pffmcreate(map);
}catch (Exception e){
e.printStackTrace();
return false;
}
}
}
... ...
package com.sunyo.wlpt.message.builder.controller;
import com.sunyo.wlpt.message.builder.service.MT520XService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
@RestController
@RequestMapping("/mt520x")
public class MT520XController {
@Autowired
MT520XService mt520XService;
/**
* 进出港理货
* @param map
* @return
*/
@RequestMapping("/520xcreate")
public Boolean create(@RequestBody Map<String, Object> map){
try {
return mt520XService.create(map);
}catch (Exception e){
e.printStackTrace();
return false;
}
}
}
... ...
package com.sunyo.wlpt.message.builder.service;
import com.sunyo.wlpt.base.model.NMMS_CUSTOM_MT2201;
import java.util.Map;
public interface MT2201Service {
int deleteByPrimaryKey(String uuid);
int insert(NMMS_CUSTOM_MT2201 record);
int insertSelective(NMMS_CUSTOM_MT2201 record);
NMMS_CUSTOM_MT2201 selectByPrimaryKey(String uuid);
int updateByPrimaryKeySelective(NMMS_CUSTOM_MT2201 record);
int updateByPrimaryKey(NMMS_CUSTOM_MT2201 record);
int creatMt2201(Map<String, Object> map);
}
... ...
package com.sunyo.wlpt.message.builder.service.imp;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.sunyo.wlpt.base.model.NMMS_CUSTOM_MT2201;
import com.sunyo.wlpt.base.model.NMMS_CUSTOM_MT4201;
import com.sunyo.wlpt.message.builder.service.MT2201Service;
import com.sunyo.wlpt.message.builder.util.CustomXmlMaker;
import com.tianbo.util.Date.DateUtil;
import org.springframework.stereotype.Service;
import java.util.Map;
@Service
public class MT2201ServiceImp extends CustomXmlMaker implements MT2201Service {
@Override
public int deleteByPrimaryKey(String uuid) {
return 0;
}
@Override
public int insert(NMMS_CUSTOM_MT2201 record) {
return 0;
}
@Override
public int insertSelective(NMMS_CUSTOM_MT2201 record) {
return 0;
}
@Override
public NMMS_CUSTOM_MT2201 selectByPrimaryKey(String uuid) {
return null;
}
@Override
public int updateByPrimaryKeySelective(NMMS_CUSTOM_MT2201 record) {
return 0;
}
@Override
public int updateByPrimaryKey(NMMS_CUSTOM_MT2201 record) {
return 0;
}
@Override
public int creatMt2201(Map<String, Object> map) {
ObjectMapper objectMapper = new ObjectMapper();
NMMS_CUSTOM_MT2201 custom_mt2201 = objectMapper.convertValue(map.get("mt2201"), NMMS_CUSTOM_MT2201.class);
// 关区代码
String customCode = custom_mt2201.getCustomcode();
// 报文头时间 精确到毫秒
map.put("sendTime", DateUtil.getCurrentTime17());
// 封装实体
map.put("mt", custom_mt2201);
// 生成报文头部
String msgId = makeMsgID("MT2201", "460470678920X", custom_mt2201.getAwba());
String msessageType = "MT4201";
String senderId = makeSenderID(customCode, "460470678920X", "DXPENT0000460002");
String receiverID = customCode;
map.put("msgId", msgId);
map.put("msessageType", msessageType);
map.put("senderId", senderId);
map.put("receiverID", receiverID);
// if (makeXmlToFile("/manifest/MT4201.ftlx", msgId+".xml", map)>0){
// return true;
// }else {
// return false;
// }
return 0;
}
}
... ...
<Manifest xmlns="urn:Declaration:datamodel:standard:CN:MT2201:1" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Head>
<MessageID>${msgId}</MessageID>
<FunctionCode>9</FunctionCode>
<MessageType>${msessageType}</MessageType>
<SenderID>${senderId}</SenderID>
<ReceiverID>${receiverID}</ReceiverID>
<SendTime>${sendTime}</SendTime>
<Version>1.0</Version>
</Head>
<Declaration>
<RepresentativePerson>
<Name>舱单书传输人名称</Name>
</RepresentativePerson>
<ExitCustomsOffice>
<ID>${mt.originstation}</ID>
</ExitCustomsOffice>
<Carrier>
<ID>${mt.carrier}</ID>
</Carrier>
<BorderTransportMeans>
<JourneyID>${mt.carrier}${mt.flightno}/${mt.flightdate?string('yyyyMMdd')}</JourneyID>
<TypeCode>4</TypeCode>
</BorderTransportMeans>
<Consignment>
<TransportContractDocument>
<ID>${mt.awba}</ID>
<ConditionCode>10</ConditionCode>
</TransportContractDocument>
<AssociatedTransportDocument>
<ID>${mt.awba}_${mt.awbh}</ID>
</AssociatedTransportDocument>
<LoadingLocation>
<ID>${mt.originstation}/${mt.customcode}</ID>
<LoadingDate>201911070600086</LoadingDate>
</LoadingLocation>
<UnloadingLocation>
<ID>${mt.destinationstation}</ID>
</UnloadingLocation>
<GoodsConsignedPlace>
<!-- “货物托运的地点或者国家代码” 必填 这里取航班起始站代码-->
<ID>货物托运地点或国家代码${mt.destinationstation}</ID>
</GoodsConsignedPlace>
<!-- “货物海关状态代码” 必填-->
<CustomsStatusCode>货物海关状态代码</CustomsStatusCode>
<TransportSplitIndicator>0</TransportSplitIndicator>
<FreightPayment>
<MethodCode>PP</MethodCode>
</FreightPayment>
<ConsignmentPackaging>
<QuantityQuantity>1</QuantityQuantity>
</ConsignmentPackaging>
<TotalGrossMassMeasure>2.5</TotalGrossMassMeasure>
<Consignee>
<Name>CGN</Name>
<Address>
<Line>UPS FREIGHT CENTER 5 AIRPORT COLOGN</Line>
<CountryCode>DE</CountryCode>
</Address>
<Communication>
<ID>22414912705</ID>
<TypeID>TE</TypeID>
</Communication>
</Consignee>
<Consignor>
<Name>UPS PARCEL DELIVERY (GUANGDONG) CO LTD ZHENGZHOU BRANCH</Name>
<Address>
<Line>NO59TH 1F,ZHENGWEI ROAD ECONOMIC DEVELOP AREA ZHENGZHOU CHINA. 45116</Line>
<CountryCode>CN</CountryCode>
</Address>
<Communication>
<ID>86-371-68512160</ID>
<TypeID>TE</TypeID>
</Communication>
</Consignor>
<ConsignmentItem>
<SequenceNumeric>1</SequenceNumeric>
<ConsignmentItemPackaging>
<QuantityQuantity>1</QuantityQuantity>
</ConsignmentItemPackaging>
<Commodity>
<CargoDescription>2</CargoDescription>
</Commodity>
<GoodsMeasure>
<GrossMassMeasure>2.5</GrossMassMeasure>
</GoodsMeasure>
</ConsignmentItem>
</Consignment>
</Declaration>
</Manifest>
\ No newline at end of file
... ...