作者 xudada

转关运抵申报批量发送

@@ -151,6 +151,12 @@ customs: @@ -151,6 +151,12 @@ customs:
151 transarrive: 151 transarrive:
152 #生成报文文件夹路径,尾部要带斜杠/ 152 #生成报文文件夹路径,尾部要带斜杠/
153 xml-save: transarriveSend/ 153 xml-save: transarriveSend/
  154 + # 客户端统一编号
  155 + clientSeqno: "000000000000002050"
  156 + # 邮箱客户端id
  157 + hostId: 111
  158 + # 当前操作员ic卡证书号
  159 + certNo: 111
154 160
155 sso: 161 sso:
156 witheIP: 10.5.14.108,10.5.14.109,10.5.14.110 162 witheIP: 10.5.14.108,10.5.14.109,10.5.14.110
@@ -70,6 +70,17 @@ public class CustomsProperties { @@ -70,6 +70,17 @@ public class CustomsProperties {
70 70
71 public static class Transarrive { 71 public static class Transarrive {
72 private String xmlSave; 72 private String xmlSave;
  73 + private String clientSeqno;
  74 + private String hostId;
  75 + private String certNo;
  76 +
  77 + public String getCertNo() {
  78 + return certNo;
  79 + }
  80 +
  81 + public void setCertNo(String certNo) {
  82 + this.certNo = certNo;
  83 + }
73 84
74 public String getXmlSave() { 85 public String getXmlSave() {
75 return xmlSave; 86 return xmlSave;
@@ -78,5 +89,21 @@ public class CustomsProperties { @@ -78,5 +89,21 @@ public class CustomsProperties {
78 public void setXmlSave(String xmlSave) { 89 public void setXmlSave(String xmlSave) {
79 this.xmlSave = xmlSave; 90 this.xmlSave = xmlSave;
80 } 91 }
  92 +
  93 + public String getClientSeqno() {
  94 + return clientSeqno;
  95 + }
  96 +
  97 + public void setClientSeqno(String clientSeqno) {
  98 + this.clientSeqno = clientSeqno;
  99 + }
  100 +
  101 + public String getHostId() {
  102 + return hostId;
  103 + }
  104 +
  105 + public void setHostId(String hostId) {
  106 + this.hostId = hostId;
  107 + }
81 } 108 }
82 } 109 }
@@ -13,6 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired; @@ -13,6 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
13 import org.springframework.web.bind.annotation.*; 13 import org.springframework.web.bind.annotation.*;
14 14
15 import java.util.Date; 15 import java.util.Date;
  16 +import java.util.List;
16 import java.util.UUID; 17 import java.util.UUID;
17 18
18 @Api(description = "转关运抵申报") 19 @Api(description = "转关运抵申报")
@@ -80,7 +81,7 @@ public class TransArriveExportController { @@ -80,7 +81,7 @@ public class TransArriveExportController {
80 81
81 @ApiOperation(value = "批量转关运抵申报") 82 @ApiOperation(value = "批量转关运抵申报")
82 @PostMapping("batchSend") 83 @PostMapping("batchSend")
83 - public ResultJson batchSend(@RequestBody TRANSTOARRIVEEXPORT trans){  
84 - return transArriveExportService.batchSend(trans); 84 + public ResultJson batchSend(@RequestBody List<String> autoIDlist){
  85 + return transArriveExportService.batchSend(autoIDlist);
85 } 86 }
86 } 87 }
1 package com.tianbo.analysis.dao; 1 package com.tianbo.analysis.dao;
2 2
  3 +import com.tianbo.analysis.model.MANIFEST_AIR_CHANGE;
3 import com.tianbo.analysis.model.TRANSTOARRIVEEXPORT; 4 import com.tianbo.analysis.model.TRANSTOARRIVEEXPORT;
4 5
5 import java.util.List; 6 import java.util.List;
@@ -18,4 +19,6 @@ public interface TRANSTOARRIVEEXPORTMapper { @@ -18,4 +19,6 @@ public interface TRANSTOARRIVEEXPORTMapper {
18 int updateByPrimaryKey(TRANSTOARRIVEEXPORT record); 19 int updateByPrimaryKey(TRANSTOARRIVEEXPORT record);
19 20
20 List<TRANSTOARRIVEEXPORT> selectTrans(TRANSTOARRIVEEXPORT record); 21 List<TRANSTOARRIVEEXPORT> selectTrans(TRANSTOARRIVEEXPORT record);
  22 +
  23 + List<TRANSTOARRIVEEXPORT> selectListByAutoIDS(List<String> idList);
21 } 24 }
1 package com.tianbo.analysis.service; 1 package com.tianbo.analysis.service;
2 2
3 import com.github.pagehelper.PageInfo; 3 import com.github.pagehelper.PageInfo;
  4 +import com.tianbo.analysis.model.MANIFEST_AIR_CHANGE;
4 import com.tianbo.analysis.model.ResultJson; 5 import com.tianbo.analysis.model.ResultJson;
5 import com.tianbo.analysis.model.TRANSTOARRIVEEXPORT; 6 import com.tianbo.analysis.model.TRANSTOARRIVEEXPORT;
6 7
@@ -12,5 +13,7 @@ public interface TransArriveExportService { @@ -12,5 +13,7 @@ public interface TransArriveExportService {
12 int delTransArriveExport(String autoid); 13 int delTransArriveExport(String autoid);
13 PageInfo<TRANSTOARRIVEEXPORT> selectTrans(TRANSTOARRIVEEXPORT transtoarriveexport, int pageNum, int pageSize); 14 PageInfo<TRANSTOARRIVEEXPORT> selectTrans(TRANSTOARRIVEEXPORT transtoarriveexport, int pageNum, int pageSize);
14 ResultJson send(TRANSTOARRIVEEXPORT var); 15 ResultJson send(TRANSTOARRIVEEXPORT var);
15 - ResultJson batchSend(TRANSTOARRIVEEXPORT var); 16 + ResultJson batchSend(List<String> autoIDlist);
  17 +
  18 + List<TRANSTOARRIVEEXPORT> selectListByAutoIDS(List<String> autoIDlist);
16 } 19 }
@@ -4,6 +4,7 @@ import com.github.pagehelper.PageHelper; @@ -4,6 +4,7 @@ import com.github.pagehelper.PageHelper;
4 import com.github.pagehelper.PageInfo; 4 import com.github.pagehelper.PageInfo;
5 import com.tianbo.analysis.config.CustomsProperties; 5 import com.tianbo.analysis.config.CustomsProperties;
6 import com.tianbo.analysis.dao.TRANSTOARRIVEEXPORTMapper; 6 import com.tianbo.analysis.dao.TRANSTOARRIVEEXPORTMapper;
  7 +import com.tianbo.analysis.model.MANIFEST_AIR_CHANGE;
7 import com.tianbo.analysis.model.ResultJson; 8 import com.tianbo.analysis.model.ResultJson;
8 import com.tianbo.analysis.model.TRANSTOARRIVEEXPORT; 9 import com.tianbo.analysis.model.TRANSTOARRIVEEXPORT;
9 import com.tianbo.analysis.service.TransArriveExportService; 10 import com.tianbo.analysis.service.TransArriveExportService;
@@ -75,7 +76,9 @@ public class TransArriveExportImpl implements TransArriveExportService { @@ -75,7 +76,9 @@ public class TransArriveExportImpl implements TransArriveExportService {
75 record.setApplycode(customsProperties.getApplyCode()); 76 record.setApplycode(customsProperties.getApplyCode());
76 record.setApplyname(customsProperties.getApplyName()); 77 record.setApplyname(customsProperties.getApplyName());
77 record.setCopcode(customsProperties.getCopCode()); 78 record.setCopcode(customsProperties.getCopCode());
78 - record.setCustomscode("4604"); 79 + record.setClientseqno(customsProperties.getTransarrive().getClientSeqno());
  80 + record.setHostid(customsProperties.getTransarrive().getHostId());
  81 + record.setCertno(customsProperties.getTransarrive().getCertNo());
79 //操作员IC卡号 82 //操作员IC卡号
80 record.setInputopid(customsProperties.getInputOpId()); 83 record.setInputopid(customsProperties.getInputOpId());
81 // 操作员姓名 84 // 操作员姓名
@@ -104,6 +107,7 @@ public class TransArriveExportImpl implements TransArriveExportService { @@ -104,6 +107,7 @@ public class TransArriveExportImpl implements TransArriveExportService {
104 * 中文的地方在模板中要用utext,否则中文会被 escape 转义 107 * 中文的地方在模板中要用utext,否则中文会被 escape 转义
105 */ 108 */
106 String xmlStr = templateEngine.process("transToArrive/EXPORT_DECLARE_TPL.xml",context); 109 String xmlStr = templateEngine.process("transToArrive/EXPORT_DECLARE_TPL.xml",context);
  110 + log.info("[XML-INFO]\n{}",xmlStr);
107 111
108 boolean valied = XmlTools.validateXMLSchemaThrowError("xsd/ETAImportMessage.xsd", xmlStr); 112 boolean valied = XmlTools.validateXMLSchemaThrowError("xsd/ETAImportMessage.xsd", xmlStr);
109 if (valied) { 113 if (valied) {
@@ -146,7 +150,21 @@ public class TransArriveExportImpl implements TransArriveExportService { @@ -146,7 +150,21 @@ public class TransArriveExportImpl implements TransArriveExportService {
146 } 150 }
147 151
148 @Override 152 @Override
149 - public ResultJson batchSend(TRANSTOARRIVEEXPORT var) {  
150 - return null; 153 + public ResultJson batchSend(List<String> autoIDlist) {
  154 + ResultJson resultJson = new ResultJson();
  155 + List<TRANSTOARRIVEEXPORT> list = selectListByAutoIDS(autoIDlist);
  156 + for (TRANSTOARRIVEEXPORT manifestAirChange : list) {
  157 + ResultJson result = send(manifestAirChange);
  158 + /*if (!result){
  159 + message = message + manifestAirChange.getWaybillnomaster() +"发送失败\n";
  160 + }*/
  161 + }
  162 + return resultJson;
  163 + }
  164 +
  165 + @Override
  166 + public List<TRANSTOARRIVEEXPORT> selectListByAutoIDS(List<String> autoIDlist) {
  167 + List<TRANSTOARRIVEEXPORT> list = mapper.selectListByAutoIDS(autoIDlist);
  168 + return list;
151 } 169 }
152 } 170 }
@@ -45,6 +45,41 @@ @@ -45,6 +45,41 @@
45 ClientSeqNo, HostId, CertNo, USERNAME, CREATTIME, DSTATUS, CUSTOM_RESPONSE_TEXT, 45 ClientSeqNo, HostId, CertNo, USERNAME, CREATTIME, DSTATUS, CUSTOM_RESPONSE_TEXT,
46 CUSTOM_RESPONSE_STATUS, UPDATETIME 46 CUSTOM_RESPONSE_STATUS, UPDATETIME
47 </sql> 47 </sql>
  48 + <sql id="Custom_Receipt">
  49 + <include refid="Base_Column_List" />
  50 + ,RECEIPTION
  51 + </sql>
  52 + <select id="selectListByAutoIDS" resultMap="BaseResultMap" parameterType="java.util.List" >
  53 + SELECT
  54 + <include refid="Custom_Receipt" />
  55 + FROM
  56 + (
  57 + SELECT
  58 + <include refid="Custom_Receipt" />
  59 + FROM
  60 + (
  61 + SELECT
  62 + <include refid="Base_Column_List" />
  63 + FROM
  64 + TRANS_TO_ARRIVE_EXPORT
  65 + where AUTOID in
  66 + <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
  67 + #{item}
  68 + </foreach>
  69 + ) t1
  70 + LEFT JOIN (
  71 + SELECT
  72 + RECEIPTION,
  73 + MESSAGEAUTOID,
  74 + MESSAGETYPE,
  75 + ROW_NUMBER () OVER ( PARTITION BY MESSAGEAUTOID ORDER BY CREATEDATE DESC ) rn
  76 + FROM
  77 + SENDLOG
  78 + ) t2 ON t1.AUTOID = t2.MESSAGEAUTOID
  79 + AND t2.rn = 1
  80 + ) t3
  81 + order by CREATTIME desc
  82 + </select>
48 <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" > 83 <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
49 select 84 select
50 <include refid="Base_Column_List" /> 85 <include refid="Base_Column_List" />