作者 xudada

转关运抵申报批量发送

... ... @@ -151,6 +151,12 @@ customs:
transarrive:
#生成报文文件夹路径,尾部要带斜杠/
xml-save: transarriveSend/
# 客户端统一编号
clientSeqno: "000000000000002050"
# 邮箱客户端id
hostId: 111
# 当前操作员ic卡证书号
certNo: 111
sso:
witheIP: 10.5.14.108,10.5.14.109,10.5.14.110
... ...
... ... @@ -70,6 +70,17 @@ public class CustomsProperties {
public static class Transarrive {
private String xmlSave;
private String clientSeqno;
private String hostId;
private String certNo;
public String getCertNo() {
return certNo;
}
public void setCertNo(String certNo) {
this.certNo = certNo;
}
public String getXmlSave() {
return xmlSave;
... ... @@ -78,5 +89,21 @@ public class CustomsProperties {
public void setXmlSave(String xmlSave) {
this.xmlSave = xmlSave;
}
public String getClientSeqno() {
return clientSeqno;
}
public void setClientSeqno(String clientSeqno) {
this.clientSeqno = clientSeqno;
}
public String getHostId() {
return hostId;
}
public void setHostId(String hostId) {
this.hostId = hostId;
}
}
}
... ...
... ... @@ -13,6 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
import java.util.UUID;
@Api(description = "转关运抵申报")
... ... @@ -80,7 +81,7 @@ public class TransArriveExportController {
@ApiOperation(value = "批量转关运抵申报")
@PostMapping("batchSend")
public ResultJson batchSend(@RequestBody TRANSTOARRIVEEXPORT trans){
return transArriveExportService.batchSend(trans);
public ResultJson batchSend(@RequestBody List<String> autoIDlist){
return transArriveExportService.batchSend(autoIDlist);
}
}
... ...
package com.tianbo.analysis.dao;
import com.tianbo.analysis.model.MANIFEST_AIR_CHANGE;
import com.tianbo.analysis.model.TRANSTOARRIVEEXPORT;
import java.util.List;
... ... @@ -18,4 +19,6 @@ public interface TRANSTOARRIVEEXPORTMapper {
int updateByPrimaryKey(TRANSTOARRIVEEXPORT record);
List<TRANSTOARRIVEEXPORT> selectTrans(TRANSTOARRIVEEXPORT record);
List<TRANSTOARRIVEEXPORT> selectListByAutoIDS(List<String> idList);
}
... ...
package com.tianbo.analysis.service;
import com.github.pagehelper.PageInfo;
import com.tianbo.analysis.model.MANIFEST_AIR_CHANGE;
import com.tianbo.analysis.model.ResultJson;
import com.tianbo.analysis.model.TRANSTOARRIVEEXPORT;
... ... @@ -12,5 +13,7 @@ public interface TransArriveExportService {
int delTransArriveExport(String autoid);
PageInfo<TRANSTOARRIVEEXPORT> selectTrans(TRANSTOARRIVEEXPORT transtoarriveexport, int pageNum, int pageSize);
ResultJson send(TRANSTOARRIVEEXPORT var);
ResultJson batchSend(TRANSTOARRIVEEXPORT var);
ResultJson batchSend(List<String> autoIDlist);
List<TRANSTOARRIVEEXPORT> selectListByAutoIDS(List<String> autoIDlist);
}
... ...
... ... @@ -4,6 +4,7 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.tianbo.analysis.config.CustomsProperties;
import com.tianbo.analysis.dao.TRANSTOARRIVEEXPORTMapper;
import com.tianbo.analysis.model.MANIFEST_AIR_CHANGE;
import com.tianbo.analysis.model.ResultJson;
import com.tianbo.analysis.model.TRANSTOARRIVEEXPORT;
import com.tianbo.analysis.service.TransArriveExportService;
... ... @@ -75,7 +76,9 @@ public class TransArriveExportImpl implements TransArriveExportService {
record.setApplycode(customsProperties.getApplyCode());
record.setApplyname(customsProperties.getApplyName());
record.setCopcode(customsProperties.getCopCode());
record.setCustomscode("4604");
record.setClientseqno(customsProperties.getTransarrive().getClientSeqno());
record.setHostid(customsProperties.getTransarrive().getHostId());
record.setCertno(customsProperties.getTransarrive().getCertNo());
//操作员IC卡号
record.setInputopid(customsProperties.getInputOpId());
// 操作员姓名
... ... @@ -104,6 +107,7 @@ public class TransArriveExportImpl implements TransArriveExportService {
* 中文的地方在模板中要用utext,否则中文会被 escape 转义
*/
String xmlStr = templateEngine.process("transToArrive/EXPORT_DECLARE_TPL.xml",context);
log.info("[XML-INFO]\n{}",xmlStr);
boolean valied = XmlTools.validateXMLSchemaThrowError("xsd/ETAImportMessage.xsd", xmlStr);
if (valied) {
... ... @@ -146,7 +150,21 @@ public class TransArriveExportImpl implements TransArriveExportService {
}
@Override
public ResultJson batchSend(TRANSTOARRIVEEXPORT var) {
return null;
public ResultJson batchSend(List<String> autoIDlist) {
ResultJson resultJson = new ResultJson();
List<TRANSTOARRIVEEXPORT> list = selectListByAutoIDS(autoIDlist);
for (TRANSTOARRIVEEXPORT manifestAirChange : list) {
ResultJson result = send(manifestAirChange);
/*if (!result){
message = message + manifestAirChange.getWaybillnomaster() +"发送失败\n";
}*/
}
return resultJson;
}
@Override
public List<TRANSTOARRIVEEXPORT> selectListByAutoIDS(List<String> autoIDlist) {
List<TRANSTOARRIVEEXPORT> list = mapper.selectListByAutoIDS(autoIDlist);
return list;
}
}
... ...
... ... @@ -45,6 +45,41 @@
ClientSeqNo, HostId, CertNo, USERNAME, CREATTIME, DSTATUS, CUSTOM_RESPONSE_TEXT,
CUSTOM_RESPONSE_STATUS, UPDATETIME
</sql>
<sql id="Custom_Receipt">
<include refid="Base_Column_List" />
,RECEIPTION
</sql>
<select id="selectListByAutoIDS" resultMap="BaseResultMap" parameterType="java.util.List" >
SELECT
<include refid="Custom_Receipt" />
FROM
(
SELECT
<include refid="Custom_Receipt" />
FROM
(
SELECT
<include refid="Base_Column_List" />
FROM
TRANS_TO_ARRIVE_EXPORT
where AUTOID in
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
) t1
LEFT JOIN (
SELECT
RECEIPTION,
MESSAGEAUTOID,
MESSAGETYPE,
ROW_NUMBER () OVER ( PARTITION BY MESSAGEAUTOID ORDER BY CREATEDATE DESC ) rn
FROM
SENDLOG
) t2 ON t1.AUTOID = t2.MESSAGEAUTOID
AND t2.rn = 1
) t3
order by CREATTIME desc
</select>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
... ...