tao.mo

task-schedule | 修改 | 推送IMP001报文开发

mt
2024年11月21日16:13:02
Showing 26 changed files with 303 additions and 329 deletions
...@@ -17,5 +17,5 @@ public interface AttachmentExtMapper { ...@@ -17,5 +17,5 @@ public interface AttachmentExtMapper {
17 @Select("SELECT * FROM T_BIZ_ATTACHMENT WHERE UPLOAD_RECORD_ID = " + 17 @Select("SELECT * FROM T_BIZ_ATTACHMENT WHERE UPLOAD_RECORD_ID = " +
18 "(SELECT MAX(ID) FROM T_BIZ_UPLOAD_RECORD WHERE CREATE_USER_ID = #{query.userId} " + 18 "(SELECT MAX(ID) FROM T_BIZ_UPLOAD_RECORD WHERE CREATE_USER_ID = #{query.userId} " +
19 "AND CONSIGNMENT_ID = #{query.consignmentId}) AND STATUS = 1") 19 "AND CONSIGNMENT_ID = #{query.consignmentId}) AND STATUS = 1")
20 - Attachment queryInfo(@Param("query") UserConsignmentInfoQuery query); 20 + List<Attachment> queryInfo(@Param("query") UserConsignmentInfoQuery query);
21 } 21 }
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -10,7 +10,7 @@ import java.util.List; ...@@ -10,7 +10,7 @@ import java.util.List;
10 public interface IAttachmentRepository { 10 public interface IAttachmentRepository {
11 List<AttachmentHistoryDto> findHistory(AttachmentHistoryQuery attachmentHistoryQuery); 11 List<AttachmentHistoryDto> findHistory(AttachmentHistoryQuery attachmentHistoryQuery);
12 12
13 - Attachment queryInfo(UserConsignmentInfoQuery userConsignmentInfoQuery); 13 + List<Attachment> queryInfo(UserConsignmentInfoQuery userConsignmentInfoQuery);
14 14
15 Attachment saveOrUpdate(Attachment entity); 15 Attachment saveOrUpdate(Attachment entity);
16 16
......
...@@ -26,7 +26,7 @@ public class AttachmentRepositoryImpl extends BaseDao implements IAttachmentRepo ...@@ -26,7 +26,7 @@ public class AttachmentRepositoryImpl extends BaseDao implements IAttachmentRepo
26 * @return com.fedex.connect.common.model.biz.Attachment 26 * @return com.fedex.connect.common.model.biz.Attachment
27 */ 27 */
28 @Override 28 @Override
29 - public Attachment queryInfo(UserConsignmentInfoQuery userConsignmentInfoQuery){ 29 + public List<Attachment> queryInfo(UserConsignmentInfoQuery userConsignmentInfoQuery){
30 return attachmentExtMapper.queryInfo(userConsignmentInfoQuery); 30 return attachmentExtMapper.queryInfo(userConsignmentInfoQuery);
31 } 31 }
32 32
......
...@@ -7,6 +7,8 @@ import com.fedex.connect.customer.service.base.BaseService; ...@@ -7,6 +7,8 @@ import com.fedex.connect.customer.service.base.BaseService;
7 import com.fedex.connect.customer.service.biz.IAttachmentQueryService; 7 import com.fedex.connect.customer.service.biz.IAttachmentQueryService;
8 import org.springframework.stereotype.Service; 8 import org.springframework.stereotype.Service;
9 9
10 +import java.util.List;
11 +
10 /** 12 /**
11 * @Author Szl 13 * @Author Szl
12 * @Description 类说明 附件查询相关service 14 * @Description 类说明 附件查询相关service
...@@ -23,7 +25,7 @@ public class AttachmentQueryServiceImpl extends BaseService implements IAttachme ...@@ -23,7 +25,7 @@ public class AttachmentQueryServiceImpl extends BaseService implements IAttachme
23 * @return com.fedex.connect.common.dependencies.date.vo.ResponseVo 25 * @return com.fedex.connect.common.dependencies.date.vo.ResponseVo
24 */ 26 */
25 public ResponseVo queryInfo(UserConsignmentInfoQuery userConsignmentInfoQuery){ 27 public ResponseVo queryInfo(UserConsignmentInfoQuery userConsignmentInfoQuery){
26 - Attachment attachment = attachmentRepository.queryInfo(userConsignmentInfoQuery); 28 + List<Attachment> attachmentList = attachmentRepository.queryInfo(userConsignmentInfoQuery);
27 - return responseUtils.success(attachment); 29 + return responseUtils.success(attachmentList);
28 } 30 }
29 } 31 }
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -21,8 +21,12 @@ public interface ParamConfigConstants { ...@@ -21,8 +21,12 @@ public interface ParamConfigConstants {
21 * @Date 2024/11/20 21 * @Date 2024/11/20
22 */ 22 */
23 interface TASK_PARAM_KEYS{ 23 interface TASK_PARAM_KEYS{
24 - //推送TW001间隔配置key 24 + //推送IMP001任务间隔
25 String PUSH_IMP001_INTERVAL = "push_imp001_interval"; 25 String PUSH_IMP001_INTERVAL = "push_imp001_interval";
26 + //推送IMP001定时任务处理数量
27 + String PUSH_IMP001_NUMBER = "push_imp001_number";
28 + //推送IMP001重试处理数量
29 + String PUSH_IMP001_RETRY_NUMBER = "push_imp001_retry_number";
26 //推送进口文件定时任务处理数量 30 //推送进口文件定时任务处理数量
27 String PUSH_CON_NUMBER = "push_con_number"; 31 String PUSH_CON_NUMBER = "push_con_number";
28 //通知发件人定时任务处理数量 32 //通知发件人定时任务处理数量
......
1 +package com.fedex.connect.task.constants;
2 +
3 +/**
4 + * @Author mt
5 + * @Description 类说明 常量接口
6 + * @Date 2024/4/18
7 + */
8 +public interface Constant {
9 + //TW001表头信息
10 + interface IMP001_HEAD_KEYS{
11 + /**
12 + * 消息代码:IMP001报文标志
13 + */
14 + String MESSAGE_CODE = "IMP001";
15 + /**
16 + * 发送程序ID:TWEXP
17 + */
18 + String SENDER_ID = "TWEXP";
19 + /**
20 + * 接受程序ID:IMP
21 + */
22 + String RECEIVER_ID = "IMP";
23 + }
24 +
25 + //文件后缀字符串keys
26 + interface FILE_SUFFIX_KEYS{
27 + /**
28 + * json字符串
29 + */
30 + String JSON = ".json";
31 + /**
32 + * temp临时文件
33 + */
34 + String TEMP = ".temp";
35 + /**
36 + * zip文件后缀
37 + */
38 + String ZIP = ".zip";
39 + }
40 +}
...\ No newline at end of file ...\ No newline at end of file
1 package com.fedex.connect.task.data.dto.imp001; 1 package com.fedex.connect.task.data.dto.imp001;
2 2
3 -import com.fedex.connect.common.dependencies.arithmetic.AESUtil;
4 import lombok.Data; 3 import lombok.Data;
5 -import org.apache.commons.lang3.StringUtils;
6 4
7 import java.io.Serializable; 5 import java.io.Serializable;
8 6
...@@ -25,65 +23,5 @@ public class Imp001Consignment implements Serializable { ...@@ -25,65 +23,5 @@ public class Imp001Consignment implements Serializable {
25 * @Description 联络人 23 * @Description 联络人
26 * @Date 2024/5/23 24 * @Date 2024/5/23
27 */ 25 */
28 - private String liaisons; 26 + private Integer attachedFilesCount;
29 - /**
30 - * @Author mt
31 - * @Description 货物输出统一编号
32 - * 8-12位,数字加英文大写
33 - * @Date 2024/5/23
34 - */
35 - private String consigneeNo;
36 - /**
37 - * @Author mt
38 - * @Description 联络人email
39 - * 标准邮件格式:xxx@xx.com
40 - * @Date 2024/5/23
41 - */
42 - private String email;
43 - /**
44 - * @Author mt
45 - * @Description 联络电话
46 - * 包含:数字、空格-()()#::,,;;+.
47 - * @Date 2024/5/23
48 - */
49 - private String tel;
50 - /**
51 - * @Author mt
52 - * @Description 分机
53 - * 包含:数字、空格-()()#::,,;;+.
54 - * @Date 2024/5/23
55 - */
56 - private String extensionTel;
57 - /**
58 - * @Author mt
59 - * @Description 行动电话
60 - * 包含:数字、空格-()()#::,,;;+.
61 - * @Date 2024/5/23
62 - */
63 - private String phone;
64 - /**
65 - * @Author mt
66 - * @Description 特殊交代事项
67 - * @Date 2024/5/23
68 - */
69 - private String customsClearanceInstruction;
70 -
71 - /**
72 - * @Author mt
73 - * @Description 对部分字段进行解密
74 - * @Date 2024/6/13
75 - * @param
76 - * @return void
77 - */
78 - public void decode() {
79 - if (StringUtils.isNotBlank(this.getLiaisons())){
80 - this.setLiaisons(AESUtil.decode_default(this.getLiaisons()));
81 - }
82 - if (StringUtils.isNotBlank(this.getTel())){
83 - this.setTel(AESUtil.decode_default(this.getTel()));
84 - }
85 - if (StringUtils.isNotBlank(this.getPhone())){
86 - this.setPhone(AESUtil.decode_default(this.getPhone()));
87 - }
88 - }
89 } 27 }
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -20,19 +20,18 @@ public class Imp001Files implements Serializable { ...@@ -20,19 +20,18 @@ public class Imp001Files implements Serializable {
20 private String name; 20 private String name;
21 /** 21 /**
22 * @Author mt 22 * @Author mt
23 - * @Description 文件来源 23 + * @Description 文件名后缀
24 - * "文件类型 24 + * 小写
25 - * (1:系统生成的的“聯絡方式與特殊交待事項”。2:系统生成的“出口報關檢核表”。3:用户上传的文件)"
26 * @Date 2024/5/23 25 * @Date 2024/5/23
27 */ 26 */
28 - private Integer source; 27 + private String suffix;
29 /** 28 /**
30 * @Author mt 29 * @Author mt
31 - * @Description 文件名后缀 30 + * @Description 分运单,发票,箱单和其它这四种类型 AWB,INV,PKL,OTH
32 - * 31 + *
33 * @Date 2024/5/23 32 * @Date 2024/5/23
34 */ 33 */
35 - private String suffix; 34 + private String contentType;
36 /** 35 /**
37 * @Author mt 36 * @Author mt
38 * @Description 文件大小 37 * @Description 文件大小
......
...@@ -7,7 +7,7 @@ import java.io.Serializable; ...@@ -7,7 +7,7 @@ import java.io.Serializable;
7 7
8 /** 8 /**
9 * @Author mt 9 * @Author mt
10 - * @Description tw001消息主体 10 + * @Description imp001消息主体
11 * @Date 2024/5/23 11 * @Date 2024/5/23
12 */ 12 */
13 @Data 13 @Data
......
1 package com.fedex.connect.task.repository.base; 1 package com.fedex.connect.task.repository.base;
2 2
3 +import com.fedex.connect.common.dao.biz.ConsignmentMapper;
3 import com.fedex.connect.common.dao.biz.EmailMapper; 4 import com.fedex.connect.common.dao.biz.EmailMapper;
4 import com.fedex.connect.common.dao.biz.PushObMapper; 5 import com.fedex.connect.common.dao.biz.PushObMapper;
5 import com.fedex.connect.common.dao.log.EmailHistoryMapper; 6 import com.fedex.connect.common.dao.log.EmailHistoryMapper;
...@@ -34,4 +35,6 @@ public class AbstractDaoRepository { ...@@ -34,4 +35,6 @@ public class AbstractDaoRepository {
34 protected PushObMapperExt pushObMapperExt; 35 protected PushObMapperExt pushObMapperExt;
35 @Autowired 36 @Autowired
36 protected ParamConfigMapper paramConfigMapper; 37 protected ParamConfigMapper paramConfigMapper;
38 + @Autowired
39 + protected ConsignmentMapper consignmentMapper;
37 } 40 }
...\ No newline at end of file ...\ No newline at end of file
......
1 package com.fedex.connect.task.repository.dao; 1 package com.fedex.connect.task.repository.dao;
2 2
3 +import com.fedex.connect.common.model.biz.Attachment;
3 import com.fedex.connect.task.data.dto.PushZipEmailDto; 4 import com.fedex.connect.task.data.dto.PushZipEmailDto;
4 import org.apache.ibatis.annotations.*; 5 import org.apache.ibatis.annotations.*;
5 6
...@@ -14,4 +15,8 @@ public interface AttachmentExtMapper { ...@@ -14,4 +15,8 @@ public interface AttachmentExtMapper {
14 "WHERE a.BIZ_ID = #{bizId}") 15 "WHERE a.BIZ_ID = #{bizId}")
15 List<PushZipEmailDto> findAttachmentDetailsByBizId(@Param("bizId") Long bizId); 16 List<PushZipEmailDto> findAttachmentDetailsByBizId(@Param("bizId") Long bizId);
16 17
18 + @Select("SELECT * FROM T_BIZ_ATTACHMENT WHERE UPLOAD_RECORD_ID = " +
19 + "(SELECT MAX(ID) FROM T_BIZ_UPLOAD_RECORD WHERE " +
20 + " CONSIGNMENT_ID = #{consignmentId}) AND STATUS = 1")
21 + List<Attachment> queryAttachmentInfo(@Param("consignmentId") Long consignmentId);
17 } 22 }
......
...@@ -11,17 +11,17 @@ import java.util.List; ...@@ -11,17 +11,17 @@ import java.util.List;
11 public interface PushObMapperExt { 11 public interface PushObMapperExt {
12 12
13 @Select( "<script>" + 13 @Select( "<script>" +
14 - "SELECT * FROM T_PUSH_OB_LOG WHERE STATUS_CODE = #{statusCode,jdbcType=VARCHAR} AND ROWNUM &lt;= 500" + 14 + "SELECT * FROM T_BIZ_PUSH_OB WHERE STATUS_CODE = #{statusCode,jdbcType=VARCHAR} AND ROWNUM &lt;= #{rownum,jdbcType=NUMERIC}" +
15 "</script>") 15 "</script>")
16 - List<PushOb> findPushObByStatus(@Param("statusCode") String statusCode); 16 + List<PushOb> findPushObByStatus(@Param("statusCode") String statusCode,@Param("rownum") Long rownum);
17 17
18 @Select( "<script>" + 18 @Select( "<script>" +
19 - "SELECT * FROM T_PUSH_OB_LOG WHERE PUSH_NUM &lt; #{pushNum,jdbcType=NUMERIC} AND STATUS_CODE = #{statusCode,jdbcType=VARCHAR} AND ROWNUM &lt;= 500" + 19 + "SELECT * FROM T_BIZ_PUSH_OB WHERE PUSH_NUM &lt; #{pushNum,jdbcType=NUMERIC} AND STATUS_CODE = #{statusCode,jdbcType=VARCHAR} AND ROWNUM &lt;= #{rownum,jdbcType=NUMERIC}" +
20 "</script>") 20 "</script>")
21 - List<PushOb> findPushObByStatusAndNum(@Param("pushNum") Long pushNum, @Param("statusCode") String statusCode); 21 + List<PushOb> findPushObByStatusAndNum(@Param("pushNum") Long pushNum, @Param("statusCode") String statusCode,@Param("rownum") Long rownum);
22 22
23 @Select( "<script>" + 23 @Select( "<script>" +
24 - "SELECT count(*) FROM T_PUSH_OB_LOG WHERE PUSH_NUM &gt;= #{pushNum,jdbcType=NUMERIC} AND PUSH_STATUS = #{statusCode,jdbcType=VARCHAR} " + 24 + "SELECT count(*) FROM T_BIZ_PUSH_OB WHERE PUSH_NUM &gt;= #{pushNum,jdbcType=NUMERIC} AND PUSH_STATUS = #{statusCode,jdbcType=VARCHAR} " +
25 "AND TRUNC(CREATE_TIME) = TRUNC(TO_DATE(#{date,jdbcType=VARCHAR}, 'YYYY-MM-DD'))" + 25 "AND TRUNC(CREATE_TIME) = TRUNC(TO_DATE(#{date,jdbcType=VARCHAR}, 'YYYY-MM-DD'))" +
26 "</script>") 26 "</script>")
27 Integer findErrPushForEmail(@Param("pushNum") Long pushNum, @Param("statusCode") String statusCode, @Param("date") String date); 27 Integer findErrPushForEmail(@Param("pushNum") Long pushNum, @Param("statusCode") String statusCode, @Param("date") String date);
......
1 package com.fedex.connect.task.repository.repo.biz; 1 package com.fedex.connect.task.repository.repo.biz;
2 2
3 +import com.fedex.connect.common.model.biz.Attachment;
3 import com.fedex.connect.task.data.dto.PushZipEmailDto; 4 import com.fedex.connect.task.data.dto.PushZipEmailDto;
4 import org.apache.ibatis.annotations.Param; 5 import org.apache.ibatis.annotations.Param;
5 6
...@@ -8,4 +9,6 @@ import java.util.List; ...@@ -8,4 +9,6 @@ import java.util.List;
8 public interface IAttachmentRepository { 9 public interface IAttachmentRepository {
9 10
10 List<PushZipEmailDto> findAttachmentDetailsByBizId(@Param("bizId") Long bizId); 11 List<PushZipEmailDto> findAttachmentDetailsByBizId(@Param("bizId") Long bizId);
12 +
13 + List<Attachment> queryAttachmentInfo(Long consignmentId);
11 } 14 }
......
1 +package com.fedex.connect.task.repository.repo.biz;
2 +
3 +import com.fedex.connect.common.model.biz.Consignment;
4 +
5 +public interface IConsignmentRepository {
6 + Consignment findById(Long id);
7 +}
...@@ -28,9 +28,10 @@ public interface IPushObRepository { ...@@ -28,9 +28,10 @@ public interface IPushObRepository {
28 * @Description 根据推送次数,推送状态查找需要推送记录 28 * @Description 根据推送次数,推送状态查找需要推送记录
29 * @Date 2024/11/20 29 * @Date 2024/11/20
30 * @param statusCode 30 * @param statusCode
31 + * @param rownum
31 * @return java.util.List<com.fedex.connect.common.model.biz.PushOb> 32 * @return java.util.List<com.fedex.connect.common.model.biz.PushOb>
32 */ 33 */
33 - List<PushOb> findPushOb(String statusCode); 34 + List<PushOb> findPushOb(String statusCode,Long rownum);
34 35
35 /** 36 /**
36 * @Author mt 37 * @Author mt
...@@ -38,9 +39,10 @@ public interface IPushObRepository { ...@@ -38,9 +39,10 @@ public interface IPushObRepository {
38 * @Date 2024/11/20 39 * @Date 2024/11/20
39 * @param pushNum 40 * @param pushNum
40 * @param statusCode 41 * @param statusCode
42 + * @param rownum
41 * @return java.util.List<com.fedex.connect.common.model.biz.PushOb> 43 * @return java.util.List<com.fedex.connect.common.model.biz.PushOb>
42 */ 44 */
43 - List<PushOb> findErrPushOb(Long pushNum,String statusCode); 45 + List<PushOb> findErrPushOb(Long pushNum,String statusCode,Long rownum);
44 46
45 Integer findErrPushForEmail(Long pushNum,String statusCode,String date); 47 Integer findErrPushForEmail(Long pushNum,String statusCode,String date);
46 } 48 }
......
1 package com.fedex.connect.task.repository.repo.biz.impl; 1 package com.fedex.connect.task.repository.repo.biz.impl;
2 2
3 +import com.fedex.connect.common.model.biz.Attachment;
3 import com.fedex.connect.task.data.dto.PushZipEmailDto; 4 import com.fedex.connect.task.data.dto.PushZipEmailDto;
4 import com.fedex.connect.task.repository.base.AbstractDaoRepository; 5 import com.fedex.connect.task.repository.base.AbstractDaoRepository;
5 import com.fedex.connect.task.repository.repo.biz.IAttachmentRepository; 6 import com.fedex.connect.task.repository.repo.biz.IAttachmentRepository;
7 +import org.apache.ibatis.annotations.Param;
6 import org.springframework.stereotype.Repository; 8 import org.springframework.stereotype.Repository;
7 9
8 import java.util.List; 10 import java.util.List;
...@@ -14,4 +16,9 @@ public class AttachmentRepositoryImpl extends AbstractDaoRepository implements I ...@@ -14,4 +16,9 @@ public class AttachmentRepositoryImpl extends AbstractDaoRepository implements I
14 public List<PushZipEmailDto> findAttachmentDetailsByBizId(Long bizId) { 16 public List<PushZipEmailDto> findAttachmentDetailsByBizId(Long bizId) {
15 return attachmentExtMapper.findAttachmentDetailsByBizId(bizId); 17 return attachmentExtMapper.findAttachmentDetailsByBizId(bizId);
16 } 18 }
19 +
20 + @Override
21 + public List<Attachment> queryAttachmentInfo(Long consignmentId){
22 + return attachmentExtMapper.queryAttachmentInfo(consignmentId);
23 + }
17 } 24 }
......
1 +package com.fedex.connect.task.repository.repo.biz.impl;
2 +
3 +import com.fedex.connect.common.model.biz.Consignment;
4 +import com.fedex.connect.task.repository.base.AbstractDaoRepository;
5 +import com.fedex.connect.task.repository.repo.biz.IConsignmentRepository;
6 +import org.springframework.stereotype.Repository;
7 +
8 +@Repository
9 +public class ConsignmentRepositoryImpl extends AbstractDaoRepository implements IConsignmentRepository {
10 + /**
11 + * @Author mt
12 + * @Description 根据运单ID查找运单信息
13 + * @Date 2024/11/18
14 + * @param id
15 + * @return com.fedex.connect.common.model.biz.Consignment
16 + */
17 + public Consignment findById(Long id){
18 + return consignmentMapper.selectByPrimaryKey(id);
19 + }
20 +}
...@@ -41,8 +41,8 @@ public class PushObRepositoryImpl extends AbstractDaoRepository implements IPush ...@@ -41,8 +41,8 @@ public class PushObRepositoryImpl extends AbstractDaoRepository implements IPush
41 * @return java.util.List<com.fedex.connect.common.model.biz.PushOb> 41 * @return java.util.List<com.fedex.connect.common.model.biz.PushOb>
42 */ 42 */
43 @Override 43 @Override
44 - public List<PushOb> findPushOb(String statusCode) { 44 + public List<PushOb> findPushOb(String statusCode,Long rownum) {
45 - return pushObMapperExt.findPushObByStatus(statusCode); 45 + return pushObMapperExt.findPushObByStatus(statusCode,rownum);
46 } 46 }
47 47
48 /** 48 /**
...@@ -54,8 +54,8 @@ public class PushObRepositoryImpl extends AbstractDaoRepository implements IPush ...@@ -54,8 +54,8 @@ public class PushObRepositoryImpl extends AbstractDaoRepository implements IPush
54 * @return java.util.List<com.fedex.connect.common.model.biz.PushOb> 54 * @return java.util.List<com.fedex.connect.common.model.biz.PushOb>
55 */ 55 */
56 @Override 56 @Override
57 - public List<PushOb> findErrPushOb(Long pushNum, String statusCode) { 57 + public List<PushOb> findErrPushOb(Long pushNum, String statusCode,Long rownum) {
58 - return pushObMapperExt.findPushObByStatusAndNum(pushNum,statusCode); 58 + return pushObMapperExt.findPushObByStatusAndNum(pushNum,statusCode,rownum);
59 } 59 }
60 60
61 @Override 61 @Override
......
...@@ -2,6 +2,9 @@ package com.fedex.connect.task.repository.repo.sys; ...@@ -2,6 +2,9 @@ package com.fedex.connect.task.repository.repo.sys;
2 2
3 import com.fedex.connect.common.model.sys.ParamConfig; 3 import com.fedex.connect.common.model.sys.ParamConfig;
4 4
5 +import java.util.Map;
6 +
5 public interface IParamConfigRepository { 7 public interface IParamConfigRepository {
6 ParamConfig findValueByCode(String code); 8 ParamConfig findValueByCode(String code);
9 + Map<String,ParamConfig> findValueByCodes(String...strings);
7 } 10 }
......
...@@ -8,6 +8,12 @@ import com.fedex.connect.task.repository.repo.sys.IParamConfigRepository; ...@@ -8,6 +8,12 @@ import com.fedex.connect.task.repository.repo.sys.IParamConfigRepository;
8 import org.springframework.stereotype.Repository; 8 import org.springframework.stereotype.Repository;
9 import org.springframework.util.CollectionUtils; 9 import org.springframework.util.CollectionUtils;
10 10
11 +import java.util.Arrays;
12 +import java.util.List;
13 +import java.util.Map;
14 +import java.util.Objects;
15 +import java.util.stream.Collectors;
16 +
11 @Repository 17 @Repository
12 public class ParamConfigRepositoryImpl extends AbstractDaoRepository implements IParamConfigRepository { 18 public class ParamConfigRepositoryImpl extends AbstractDaoRepository implements IParamConfigRepository {
13 19
...@@ -19,4 +25,19 @@ public class ParamConfigRepositoryImpl extends AbstractDaoRepository implements ...@@ -19,4 +25,19 @@ public class ParamConfigRepositoryImpl extends AbstractDaoRepository implements
19 criteria.andStatusEqualTo(StatusEnum.YES.getCode()); 25 criteria.andStatusEqualTo(StatusEnum.YES.getCode());
20 return CollectionUtils.firstElement(paramConfigMapper.selectByExample(example)); 26 return CollectionUtils.firstElement(paramConfigMapper.selectByExample(example));
21 } 27 }
28 +
29 + @Override
30 + public Map<String,ParamConfig> findValueByCodes(String...strings) {
31 + if(Objects.isNull(strings) || strings.length == 0){
32 + return null;
33 + }
34 + List<String> codes = Arrays.asList(strings);
35 + ParamConfigExample example = new ParamConfigExample();
36 + ParamConfigExample.Criteria criteria = example.createCriteria();
37 + criteria.andCodeIn(codes);
38 + criteria.andStatusEqualTo(StatusEnum.YES.getCode());
39 + List<ParamConfig> paramConfigList = paramConfigMapper.selectByExample(example);
40 + Map<String,ParamConfig> paramConfigMap = paramConfigList.stream().filter(Objects::nonNull).collect(Collectors.toMap(ParamConfig::getCode, paramConfig -> paramConfig));
41 + return paramConfigMap;
42 + }
22 } 43 }
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -6,6 +6,7 @@ import com.fedex.connect.task.repository.repo.biz.IEmailRepository; ...@@ -6,6 +6,7 @@ import com.fedex.connect.task.repository.repo.biz.IEmailRepository;
6 import com.fedex.connect.task.repository.repo.biz.IPushObRepository; 6 import com.fedex.connect.task.repository.repo.biz.IPushObRepository;
7 import com.fedex.connect.task.repository.repo.sys.IKafkaStorageHistoryRepository; 7 import com.fedex.connect.task.repository.repo.sys.IKafkaStorageHistoryRepository;
8 import com.fedex.connect.task.repository.repo.sys.IKafkaTemporaryStorageRepository; 8 import com.fedex.connect.task.repository.repo.sys.IKafkaTemporaryStorageRepository;
9 +import com.fedex.connect.task.repository.repo.sys.IParamConfigRepository;
9 import com.fedex.connect.task.repository.repo.sys.IRedisSlabExtRepository; 10 import com.fedex.connect.task.repository.repo.sys.IRedisSlabExtRepository;
10 import org.springframework.beans.factory.annotation.Autowired; 11 import org.springframework.beans.factory.annotation.Autowired;
11 12
...@@ -29,4 +30,6 @@ public class BaseService { ...@@ -29,4 +30,6 @@ public class BaseService {
29 protected IAttachmentRepository attachmentExtRepository; 30 protected IAttachmentRepository attachmentExtRepository;
30 @Autowired 31 @Autowired
31 protected IPushObRepository pushObRepository; 32 protected IPushObRepository pushObRepository;
33 + @Autowired
34 + protected IParamConfigRepository paramConfigRepository;
32 } 35 }
...\ No newline at end of file ...\ No newline at end of file
......
1 package com.fedex.connect.task.service.biz; 1 package com.fedex.connect.task.service.biz;
2 2
3 -import com.fedex.connect.common.model.biz.Consignment;
4 -
5 public interface IPushObService { 3 public interface IPushObService {
6 /** 4 /**
7 * @Author mt 5 * @Author mt
8 - * @Description 保存pushLog表记录
9 - * @Date 2024/8/2
10 - * @param consignment
11 - * @return void
12 - */
13 - void savePushLog(Consignment consignment);
14 - /**
15 - * @Author mt
16 * @Description 推送Imp001报文数据zip包文件 6 * @Description 推送Imp001报文数据zip包文件
17 * @Date 2024/8/2 7 * @Date 2024/8/2
18 * @param 8 * @param
......
1 package com.fedex.connect.task.service.biz.impl; 1 package com.fedex.connect.task.service.biz.impl;
2 2
3 +import com.fedex.connect.common.dependencies.contants.ParamConfigConstants;
3 import com.fedex.connect.common.dependencies.enums.biz.PushObStatusEnum; 4 import com.fedex.connect.common.dependencies.enums.biz.PushObStatusEnum;
4 -import com.fedex.connect.common.model.biz.Consignment; 5 +import com.fedex.connect.common.dependencies.util.Utils;
5 import com.fedex.connect.common.model.biz.PushOb; 6 import com.fedex.connect.common.model.biz.PushOb;
7 +import com.fedex.connect.common.model.sys.ParamConfig;
8 +import com.fedex.connect.task.data.bo.Imp001GenerateBo;
6 import com.fedex.connect.task.service.base.BaseService; 9 import com.fedex.connect.task.service.base.BaseService;
7 import com.fedex.connect.task.service.biz.IPushObService; 10 import com.fedex.connect.task.service.biz.IPushObService;
11 +import com.fedex.connect.task.utils.biz.imp001.Imp001GenerateUtil;
12 +import com.fedex.connect.task.utils.biz.imp001.Imp001PushUtil;
13 +import com.fedex.connect.task.utils.biz.imp001.Imp001RecordLogUtil;
8 import lombok.extern.slf4j.Slf4j; 14 import lombok.extern.slf4j.Slf4j;
15 +import org.springframework.beans.factory.annotation.Autowired;
9 import org.springframework.stereotype.Service; 16 import org.springframework.stereotype.Service;
10 17
11 import java.util.List; 18 import java.util.List;
19 +import java.util.Map;
20 +import java.util.Objects;
12 21
13 /** 22 /**
14 * @Author mt 23 * @Author mt
...@@ -18,18 +27,25 @@ import java.util.List; ...@@ -18,18 +27,25 @@ import java.util.List;
18 @Slf4j 27 @Slf4j
19 @Service 28 @Service
20 public class PushObServiceImpl extends BaseService implements IPushObService { 29 public class PushObServiceImpl extends BaseService implements IPushObService {
21 - 30 + @Autowired
22 - public void savePushLog(Consignment consignment){ 31 + Imp001GenerateUtil imp001GenerateUtil;
23 - 32 + @Autowired
24 - } 33 + Imp001PushUtil imp001PushUtil;
34 + @Autowired
35 + Imp001RecordLogUtil imp001RecordLogUtil;
25 36
26 /** 37 /**
27 * 推送OB报文数据zip包文件 38 * 推送OB报文数据zip包文件
28 */ 39 */
29 @Override 40 @Override
30 public void sendOb() { 41 public void sendOb() {
42 + //获取每次处理数据量量参数
43 + ParamConfig paramConfig = paramConfigRepository.findValueByCode(ParamConfigConstants.TASK_PARAM_KEYS.PUSH_IMP001_NUMBER);
44 + Long rownum = Long.parseLong(paramConfig.getValue());
31 //获取需要处理的记录 45 //获取需要处理的记录
32 - List<PushOb> pushObLogList = pushObRepository.findPushOb(PushObStatusEnum.TO_BE_SENT.getCode()); 46 + List<PushOb> pushObList = pushObRepository.findPushOb(PushObStatusEnum.TO_BE_SENT.getCode(),rownum);
47 + //推送imp001数据
48 + this.pushOb(pushObList);
33 } 49 }
34 50
35 /** 51 /**
...@@ -37,7 +53,24 @@ public class PushObServiceImpl extends BaseService implements IPushObService { ...@@ -37,7 +53,24 @@ public class PushObServiceImpl extends BaseService implements IPushObService {
37 */ 53 */
38 @Override 54 @Override
39 public void sendObRetry() { 55 public void sendObRetry() {
40 - 56 + //获取每次处理数据量量参数
57 + Map<String,ParamConfig> paramConfig = paramConfigRepository.findValueByCodes(ParamConfigConstants.TASK_PARAM_KEYS.PUSH_IMP001_NUMBER,
58 + ParamConfigConstants.TASK_PARAM_KEYS.PUSH_IMP001_RETRY_NUMBER);
59 + //推送IMP001重试处理数量
60 + ParamConfig retryNumConfig = paramConfig.get(ParamConfigConstants.TASK_PARAM_KEYS.PUSH_IMP001_RETRY_NUMBER);
61 + Long retryNum = Long.parseLong(retryNumConfig.getCode());
62 + //推送IMP001定时任务处理数量
63 + ParamConfig rownumConfig = paramConfig.get(ParamConfigConstants.TASK_PARAM_KEYS.PUSH_IMP001_NUMBER);
64 + Long rownum = Long.parseLong(rownumConfig.getCode());
65 + //获取需要重新处理的记录:处理4次以下,并且推送失败的
66 + List<PushOb> errPushObLog = pushObRepository.findErrPushOb(retryNum, PushObStatusEnum.PUSH_FAILED.getCode(),rownum);
67 + if (errPushObLog!=null && !errPushObLog.isEmpty()){
68 + log.info("sendObRetryTask : sendObRetry size: "+errPushObLog.size());
69 + //重新推送tw001数据
70 + this.pushOb(errPushObLog);
71 + }else{
72 + log.info("sendObRetryTask : No data found for sendObRetry!");
73 + }
41 } 74 }
42 75
43 /** 76 /**
...@@ -48,6 +81,33 @@ public class PushObServiceImpl extends BaseService implements IPushObService { ...@@ -48,6 +81,33 @@ public class PushObServiceImpl extends BaseService implements IPushObService {
48 * @return void 81 * @return void
49 */ 82 */
50 private void pushOb(List<PushOb> pushObList){ 83 private void pushOb(List<PushOb> pushObList){
51 - 84 + Utils.listOf(pushObList).stream().filter(Objects::nonNull).forEach(ob ->{
85 + boolean flag = false;
86 + String errorMsg = "";
87 + Imp001GenerateBo imp001GenerateBo = null;
88 + try {
89 + //生成tw001 json对象dto
90 + imp001GenerateBo = imp001GenerateUtil.generateImp001Json(ob);
91 + //根据tw001 json对象生成并且推送zip包
92 + imp001PushUtil.pushImp001(imp001GenerateBo);
93 + flag = true;
94 + }catch(Exception ex){
95 + log.error("pushOb error : ",ex);
96 + errorMsg = ex.getMessage();
97 + flag = false;
98 + }finally{
99 + /**
100 + * 如果生成失败,推送失败,则不会记录推送日志明细,更新推送日志表。
101 + * 记录日志,并且备份
102 + */
103 + if(flag){
104 + //推送成功
105 + imp001RecordLogUtil.pushSuccessRecordLog(imp001GenerateBo, ob);
106 + }else{
107 + //推送失败
108 + imp001RecordLogUtil.pushFailRecordLog(imp001GenerateBo, ob, errorMsg);
109 + }
110 + }
111 + });
52 } 112 }
53 } 113 }
...\ No newline at end of file ...\ No newline at end of file
......
1 //package com.fedex.connect.task.utils.biz.imp001; 1 //package com.fedex.connect.task.utils.biz.imp001;
2 // 2 //
3 +//import com.fedex.connect.common.dependencies.cache.CacheSystem;
4 +//import com.fedex.connect.common.dependencies.util.NIOFileUtils;
5 +//import com.fedex.connect.common.model.bi.DictionaryEntries;
6 +//import com.fedex.connect.common.model.biz.Attachment;
7 +//import com.fedex.connect.common.model.biz.Consignment;
8 +//import com.fedex.connect.common.model.biz.PushOb;
9 +//import com.fedex.connect.task.config.PropertiesConfig;
10 +//import com.fedex.connect.task.data.bo.Imp001FileInfoBo;
11 +//import com.fedex.connect.task.data.bo.Imp001GenerateBo;
12 +//import com.fedex.connect.task.data.dto.imp001.*;
13 +//import com.fedex.connect.task.repository.repo.biz.IAttachmentRepository;
14 +//import com.fedex.connect.task.repository.repo.biz.IConsignmentRepository;
3 //import com.fedex.export.common.util.DateUtil; 15 //import com.fedex.export.common.util.DateUtil;
4 //import com.fedex.export.common.util.NioFileUtils; 16 //import com.fedex.export.common.util.NioFileUtils;
5 //import com.fedex.export.common.util.StringExtUtil; 17 //import com.fedex.export.common.util.StringExtUtil;
...@@ -26,66 +38,55 @@ ...@@ -26,66 +38,55 @@
26 // 38 //
27 ///** 39 ///**
28 // * @Author mt 40 // * @Author mt
29 -// * @Description tw001报文生成json,util 41 +// * @Description imp001报文生成json,util
30 // * @Date 2024/5/24 42 // * @Date 2024/5/24
31 // */ 43 // */
32 //@Slf4j 44 //@Slf4j
33 //@Component 45 //@Component
34 -//public class Tw001GenerateUtil { 46 +//public class Imp001GenerateUtil {
35 // @Autowired 47 // @Autowired
36 -// private ISysDictionaryService sysDictionaryService; 48 +// CacheSystem cacheSystem;
37 // @Autowired 49 // @Autowired
38 -// private IDeclareInfoService declareInfoService; 50 +// private IAttachmentRepository attachmentRepository;
39 // @Autowired 51 // @Autowired
40 -// private IDeclareCheckInfoService declareCheckInfoService; 52 +// private NIOFileUtils nioFileUtils;
41 -// @Autowired
42 -// private IDeclareCustomsFileService declareCustomsFileService;
43 -// @Autowired
44 -// private IUploadFileService uploadFileService;
45 -// @Autowired
46 -// private NioFileUtils nioFileUtils;
47 // @Autowired 53 // @Autowired
48 // private PropertiesConfig propertiesConfig; 54 // private PropertiesConfig propertiesConfig;
49 // 55 //
50 // /** 56 // /**
51 // * @Author mt 57 // * @Author mt
52 -// * @Description 生成tw001报文json对象 58 +// * @Description 生成imp001报文json对象
53 -// * @Date 2024/5/27 59 +// * @Date 2024/11/21
54 -// * @param pushObLog 60 +// * @param pushOb
55 -// * @return com.fedex.export.data.dto.tw001.Imp001RootJsonDto 61 +// * @return Imp001GenerateBo
56 // */ 62 // */
57 -// public Imp001GenerateBo generateTw001Json(PushObLog pushObLog) throws IOException{ 63 +// public Imp001GenerateBo generateImp001Json(PushOb pushOb) throws IOException{
58 // Imp001RootJsonDto tw001RootJsonDto = new Imp001RootJsonDto(); 64 // Imp001RootJsonDto tw001RootJsonDto = new Imp001RootJsonDto();
59 -// //根据运单id 65 +// List<Attachment> attachmentList = attachmentRepository.queryAttachmentInfo(pushOb.getConsignmentId());
60 -// DeclareInfo declareInfo = declareInfoService.findByDeclareId(pushObLog.getDeclareId()); 66 +// //生成IMP001报文数据
61 -// DeclareCheckInfo declareCheckInfo = declareCheckInfoService.findByDeclareId(pushObLog.getDeclareId()); 67 +// Imp001Data imp001Data = new Imp001Data();
62 -// DeclareCustomsFile declareCustomsFile = declareCustomsFileService.findByDeclareId(pushObLog.getDeclareId());
63 -// List<UploadFile> uploadFiles = uploadFileService.findFilesByCusFileId(declareCustomsFile);
64 -// //获取文件类型字典集合
65 -// Map<String,SysDictionary> pushFileTypeMap = sysDictionaryService.findDicByCodeGroup(Constant.SEND_TW001_KEYS.PUSH_FILE_TYPE_KEYS.CODE_GROUP);
66 -// //生成TW001报文数据
67 -// Imp001Data tw001Data = new Imp001Data();
68 // Imp001Consignments[] consignments = new Imp001Consignments[1]; 68 // Imp001Consignments[] consignments = new Imp001Consignments[1];
69 -// Imp001Consignments tw001Consignments = new Imp001Consignments(); 69 +// Imp001Consignments imp001Consignments = new Imp001Consignments();
70 // //生成运单数据 70 // //生成运单数据
71 -// Imp001Consignment consignment = this.generateConsignment(declareInfo); 71 +// Imp001Consignment imp001Consignment = new Imp001Consignment();
72 -// //生成检核表数据 72 +// //运单号
73 -// Tw001CheckInfo checkInfo = this.generateCheckInfo(declareCheckInfo,declareInfo.getDeliveryNo()); 73 +// imp001Consignment.setDeliveryNo(pushOb.getConsignmentCode());
74 +// //附件个数
75 +// imp001Consignment.setAttachedFilesCount(attachmentList.size());
74 // //生成文件列表数据 76 // //生成文件列表数据
75 -// Imp001Files[] files = this.generateFiles(uploadFiles,declareInfo.getDeliveryNo(),declareInfo.getDeclareId()); 77 +// Imp001Files[] files = this.generateFiles(attachmentList);
76 // /***************设置对象赋值***************/ 78 // /***************设置对象赋值***************/
77 -// tw001Consignments.setConsignment(consignment); 79 +// imp001Consignments.setConsignment(imp001Consignment);
78 -// tw001Consignments.setCheckInfo(checkInfo); 80 +// imp001Consignments.setFiles(files);
79 -// tw001Consignments.setFiles(files); 81 +// consignments[0] = imp001Consignments;
80 -// consignments[0] = tw001Consignments; 82 +// imp001Data.setConsignments(consignments);
81 -// tw001Data.setConsignments(consignments);
82 // //初始化TW001表头信息 83 // //初始化TW001表头信息
83 -// this.initTw001Head(tw001RootJsonDto); 84 +// this.initImp001Head(tw001RootJsonDto);
84 -// tw001RootJsonDto.setData(tw001Data); 85 +// tw001RootJsonDto.setData(imp001Data);
85 // //返回对象 86 // //返回对象
86 // Imp001GenerateBo tw001GenerateBo = new Imp001GenerateBo(); 87 // Imp001GenerateBo tw001GenerateBo = new Imp001GenerateBo();
87 // tw001GenerateBo.setDeclareInfo(declareInfo); 88 // tw001GenerateBo.setDeclareInfo(declareInfo);
88 -// tw001GenerateBo.setTw001RootJsonDto(tw001RootJsonDto); 89 +// tw001GenerateBo.setImp001RootJsonDto(tw001RootJsonDto);
89 // //获取生成tw001临时文件夹目录 90 // //获取生成tw001临时文件夹目录
90 // String workFilePath = this.generateWorkPath(declareInfo.getDeliveryNo(),declareInfo.getDeclareId()); 91 // String workFilePath = this.generateWorkPath(declareInfo.getDeliveryNo(),declareInfo.getDeclareId());
91 // tw001GenerateBo.setWorkFilePath(workFilePath); 92 // tw001GenerateBo.setWorkFilePath(workFilePath);
...@@ -115,23 +116,23 @@ ...@@ -115,23 +116,23 @@
115 // /** 116 // /**
116 // * @Author mt 117 // * @Author mt
117 // * @Description 初始化TW001表头信息 118 // * @Description 初始化TW001表头信息
118 -// * @Date 2024/5/31 119 +// * @Date 2024/11/21
119 -// * @param tw001RootJsonDto 120 +// * @param imp001RootJsonDto
120 // * @return void 121 // * @return void
121 // */ 122 // */
122 -// private void initTw001Head(Imp001RootJsonDto tw001RootJsonDto){ 123 +// private void initImp001Head(Imp001RootJsonDto imp001RootJsonDto){
123 // String UUIDStr=String.valueOf(UUID.randomUUID()); 124 // String UUIDStr=String.valueOf(UUID.randomUUID());
124 // //消息代码/类型 125 // //消息代码/类型
125 -// tw001RootJsonDto.setMessageId(UUIDStr); 126 +// imp001RootJsonDto.setMessageId(UUIDStr);
126 // //消息代码/类型 127 // //消息代码/类型
127 -// tw001RootJsonDto.setMessageCode(Constant.SEND_TW001_KEYS.TW001_HEAD_KEYS.MESSAGE_CODE); 128 +// imp001RootJsonDto.setMessageCode(Constant.SEND_TW001_KEYS.TW001_HEAD_KEYS.MESSAGE_CODE);
128 // //发送程序ID 129 // //发送程序ID
129 -// tw001RootJsonDto.setSenderId(Constant.SEND_TW001_KEYS.TW001_HEAD_KEYS.SENDER_ID); 130 +// imp001RootJsonDto.setSenderId(Constant.SEND_TW001_KEYS.TW001_HEAD_KEYS.SENDER_ID);
130 // //接受程序ID 131 // //接受程序ID
131 -// tw001RootJsonDto.setReceiverId(Constant.SEND_TW001_KEYS.TW001_HEAD_KEYS.RECEIVER_ID); 132 +// imp001RootJsonDto.setReceiverId(Constant.SEND_TW001_KEYS.TW001_HEAD_KEYS.RECEIVER_ID);
132 // String sendTime = String.valueOf(System.currentTimeMillis()); 133 // String sendTime = String.valueOf(System.currentTimeMillis());
133 // //发送时间,时间戳 134 // //发送时间,时间戳
134 -// tw001RootJsonDto.setSendTime(sendTime); 135 +// imp001RootJsonDto.setSendTime(sendTime);
135 // } 136 // }
136 // 137 //
137 // /** 138 // /**
...@@ -161,7 +162,7 @@ ...@@ -161,7 +162,7 @@
161 // * @param fileName 162 // * @param fileName
162 // * @return com.fedex.export.data.bo.Imp001FileInfoBo 163 // * @return com.fedex.export.data.bo.Imp001FileInfoBo
163 // */ 164 // */
164 -// private Imp001FileInfoBo initFileInfo(Map<String,SysDictionary> pushFileTypeMap,String fileTypeCode,String fileName){ 165 +// private Imp001FileInfoBo initFileInfo(Map<String,SysDictionary> pushFileTypeMap, String fileTypeCode, String fileName){
165 // Imp001FileInfoBo fileInfoBo = new Imp001FileInfoBo(); 166 // Imp001FileInfoBo fileInfoBo = new Imp001FileInfoBo();
166 // //类型编码不为空则初始化文件id,文件类型 167 // //类型编码不为空则初始化文件id,文件类型
167 // if(StringUtils.isNotEmpty(fileTypeCode)) { 168 // if(StringUtils.isNotEmpty(fileTypeCode)) {
...@@ -178,111 +179,24 @@ ...@@ -178,111 +179,24 @@
178 // 179 //
179 // /** 180 // /**
180 // * @Author mt 181 // * @Author mt
181 -// * @Description 生成运单对象vo
182 -// * @Date 2024/5/27
183 -// * @param declareInfo
184 -// * @return com.fedex.export.data.dto.tw001.Imp001Consignment
185 -// */
186 -// private Imp001Consignment generateConsignment(DeclareInfo declareInfo){
187 -// if(declareInfo == null){
188 -// return null;
189 -// }
190 -// Imp001Consignment tw001Consignment = new Imp001Consignment();
191 -// //提单号码
192 -// tw001Consignment.setDeliveryNo(declareInfo.getDeliveryNo());
193 -// //联络人
194 -// tw001Consignment.setLiaisons(declareInfo.getLiaisons());
195 -// //货物输出统一编号
196 -// tw001Consignment.setConsigneeNo(declareInfo.getConsigneeNo());
197 -// //联络人email
198 -// tw001Consignment.setEmail(declareInfo.getEmail());
199 -// //联络电话
200 -// tw001Consignment.setTel(declareInfo.getTel());
201 -// //分机号
202 -// tw001Consignment.setExtensionTel(declareInfo.getExtensionTel());
203 -// //行动电话
204 -// tw001Consignment.setPhone(declareInfo.getPhone());
205 -// //特殊交代事项
206 -// tw001Consignment.setCustomsClearanceInstruction(declareInfo.getCustomsClearanceInstruction());
207 -// //对字段进行解密
208 -// tw001Consignment.decode();
209 -// return tw001Consignment;
210 -// }
211 -//
212 -// /**
213 -// * @Author mt
214 -// * @Description 生成检核表对象vo
215 -// * @Date 2024/5/27
216 -// * @param declareCheckInfo
217 -// * @param deliveryNo
218 -// * @return com.fedex.export.data.dto.tw001.Tw001CheckInfo
219 -// */
220 -// private Tw001CheckInfo generateCheckInfo(DeclareCheckInfo declareCheckInfo,String deliveryNo) throws IOException{
221 -// if(declareCheckInfo == null){
222 -// return null;
223 -// }
224 -// Tw001CheckInfo tw001CheckInfo = new Tw001CheckInfo();
225 -// //报单类别(数据字典的KEY值,多个KEY分号拼接)
226 -// tw001CheckInfo.setCustomsDeclarationType(declareCheckInfo.getCustomsDeclarationType());
227 -// //是否为电子冲退税报单
228 -// tw001CheckInfo.setTaxRefundFormFlag(declareCheckInfo.getTaxRefundFormFlag() == null ? null : declareCheckInfo.getTaxRefundFormFlag().intValue());
229 -// //监管编号-5个字元,包含中文英文大写
230 -// tw001CheckInfo.setSupervisoryNo(declareCheckInfo.getSupervisoryNo());
231 -// //原进口报单号码
232 -// tw001CheckInfo.setOriginalImportEntryNo(declareCheckInfo.getOriginalImportEntryNo());
233 -// //用料清表文号
234 -// tw001CheckInfo.setListOfMaterialsNo(declareCheckInfo.getListOfMaterialsNo());
235 -// //出口统计方式(数据字典KEY值,多个KEY分号拼接)
236 -// tw001CheckInfo.setExportStatisticsMethod(declareCheckInfo.getExportStatisticsMethod());
237 -// //出口统计方式其他附加信息
238 -// tw001CheckInfo.setMethodAdditional(declareCheckInfo.getMethodAdditional());
239 -// //指定报关日
240 -// tw001CheckInfo.setDayOfEntry(declareCheckInfo.getDayOfEntry());
241 -// //中文品名
242 -// tw001CheckInfo.setChineseName(declareCheckInfo.getChineseName());
243 -// //税则
244 -// tw001CheckInfo.setTaxRules(declareCheckInfo.getTaxRules());
245 -// //报关金额
246 -// tw001CheckInfo.setCustomsDeclarationAmount(declareCheckInfo.getCustomsDeclarationAmount());
247 -// //报关金额币别
248 -// tw001CheckInfo.setCurrencyCd(declareCheckInfo.getCurrencyCd());
249 -// //是否有商标
250 -// tw001CheckInfo.setBrandFlag(declareCheckInfo.getBrandFlag() == null ? null : declareCheckInfo.getBrandFlag().intValue());
251 -// //文字商标
252 -// tw001CheckInfo.setBrandTxt(declareCheckInfo.getBrandTxt());
253 -// //图案商标名称
254 -// String brandImage = this.brandImage(declareCheckInfo,deliveryNo);
255 -// //图案商标
256 -// tw001CheckInfo.setBrandImage(brandImage);
257 -// //产证
258 -// tw001CheckInfo.setPropertyCertificate(declareCheckInfo.getPropertyCertificate());
259 -// //ECFA产证
260 -// tw001CheckInfo.setEcfaPropertyCertificate(declareCheckInfo.getEcfaPropertyCertificate());
261 -// //ECFA产证编号
262 -// tw001CheckInfo.setEcfaPropertyCertificateNo(declareCheckInfo.getEcfaPropertyCertificateNo());
263 -// //申请
264 -// tw001CheckInfo.setApplyFor(declareCheckInfo.getApplyFor());
265 -// return tw001CheckInfo;
266 -// }
267 -//
268 -// /**
269 -// * @Author mt
270 // * @Description 生成文件对象集合vo,并且将文件复制到指定目录 182 // * @Description 生成文件对象集合vo,并且将文件复制到指定目录
271 -// * @Date 2024/5/27 183 +// * @Date 2024/11/21
272 -// * @param uploadFiles 184 +// * @param attachmentList
273 -// * @return com.fedex.export.data.dto.tw001.Imp001Files[] 185 +// * @return com.fedex.connect.task.data.dto.imp001.Imp001Files[]
274 // */ 186 // */
275 -// private Imp001Files[] generateFiles(List<UploadFile> uploadFiles,String deliveryNo,Long declareId) throws IOException{ 187 +// private Imp001Files[] generateFiles(List<Attachment> attachmentList) throws IOException{
276 -// if(uploadFiles == null || uploadFiles.size() == 0){ 188 +// if(attachmentList == null || attachmentList.size() == 0){
277 // return null; 189 // return null;
278 // } 190 // }
279 -// Imp001Files[] tw001Files = new Imp001Files[uploadFiles.size()]; 191 +// Imp001Files[] tw001Files = new Imp001Files[attachmentList.size()];
280 -// for(int i = 0 ; i < uploadFiles.size() ; i ++){ 192 +// for(int i = 0 ; i < attachmentList.size() ; i ++){
281 -// UploadFile uploadFile = uploadFiles.get(i); 193 +// Attachment attachment = attachmentList.get(i);
282 // Imp001Files file = new Imp001Files(); 194 // Imp001Files file = new Imp001Files();
283 -// //获取文件类型 195 +// //获取附件业务类型
284 -// Integer source = this.sourceType(uploadFile.getName(),uploadFile.getSource()); 196 +// DictionaryEntries attBizType = cacheSystem.getDicAttachmentBizType(attachment.getBizTypeCode());
285 -// if(source == null){ 197 +// //运单、发票、箱单、其他
198 +// String bizTypeCode = attBizType.getExt1();
199 +// if(StringUtils.isEmpty(bizTypeCode)){
286 // continue; 200 // continue;
287 // } 201 // }
288 // //重置文件名称,并且复制源文件到指定目录 202 // //重置文件名称,并且复制源文件到指定目录
...@@ -341,61 +255,6 @@ ...@@ -341,61 +255,6 @@
341 // 255 //
342 // /** 256 // /**
343 // * @Author mt 257 // * @Author mt
344 -// * @Description 获取文件类型
345 -// * @Date 2024/5/27
346 -// * @param name 文件名称
347 -// * @param sourceType 1:用户上传。2:系统生成。3:图案商标
348 -// * @return java.lang.Integer
349 -// * (1:系统生成的的“聯絡方式與特殊交待事項”。2:系统生成的“出口報關檢核表”。3:用户上传的文件)
350 -// */
351 -// private Integer sourceType(String name,Long sourceType){
352 -// //1:用户上传。2:系统生成。3:图案商标
353 -// if(sourceType.equals(Constant.SEND_TW001_KEYS.UPLOAD_SOURCE_2)){
354 -// if(name.equals(Constant.SEND_TW001_KEYS.APPLICATION_FORM)){
355 -// //出口報關申請表
356 -// return Constant.SEND_TW001_KEYS.TW001_FILE_SOURCE_1;
357 -// }else if(name.equals(Constant.SEND_TW001_KEYS.REVIEW_FORM)){
358 -// //出口報關檢核表
359 -// return Constant.SEND_TW001_KEYS.TW001_FILE_SOURCE_2;
360 -// }
361 -// }else if(sourceType.equals(Constant.SEND_TW001_KEYS.UPLOAD_SOURCE_1)){
362 -// return Constant.SEND_TW001_KEYS.TW001_FILE_SOURCE_3;
363 -// }
364 -// //如果类型为图案商标则返回null
365 -// return null;
366 -// }
367 -//
368 -// /**
369 -// * @Author mt
370 -// * @Description COMPRESS_12位运单号_10位运单ID_yyyyMMddHHmmssSSS.jpeg 图案商标名称,并且复制源文件到指定目录
371 -// * 【可上传类型:圖片格式僅支持bmp,jpg,jpeg,png格式,大小不超過2M】
372 -// * @Date 2024/5/27
373 -// * @param checkInfo
374 -// * @param deliveryNo
375 -// * @return java.lang.String
376 -// */
377 -// private String brandImage(DeclareCheckInfo checkInfo,String deliveryNo) throws IOException{
378 -// String resBrandImage = null;
379 -// //图案商标名称不为空,并且存在后缀
380 -// if(!Utils.isEmpty(checkInfo.getBrandImage()) && checkInfo.getBrandImage().lastIndexOf(Constant.COMMON_KEYS.SPOT) > 0){
381 -// String suffix = checkInfo.getBrandImage().substring(checkInfo.getBrandImage().lastIndexOf(Constant.COMMON_KEYS.SPOT));
382 -// resBrandImage = Constant.SEND_TW001_KEYS.COMPRESS
383 -// + Constant.COMMON_KEYS.UNDER_LINE + deliveryNo
384 -// + Constant.COMMON_KEYS.UNDER_LINE + StringExtUtil.idLeftPadStr(checkInfo.getDeclareId())
385 -// + Constant.COMMON_KEYS.UNDER_LINE +
386 -// DateUtil.yyyyMMddHH24mmssSSS(new Date()) + suffix;
387 -// //获取源文件目录
388 -// String sourceFilePath = checkInfo.getBrandImage();
389 -// //获取复制目标目录
390 -// String targetFilePath = this.generateWorkPath(deliveryNo,checkInfo.getDeclareId()) + resBrandImage;
391 -// //复制文件到指定目录
392 -// nioFileUtils.copyFile(sourceFilePath,targetFilePath);
393 -// }
394 -// return resBrandImage;
395 -// }
396 -//
397 -// /**
398 -// * @Author mt
399 // * @Description 生成文件夹目录 /var/share/icleartw/TWIMPORT/work/yyyy-MM-dd/运单号_运单ID/ 258 // * @Description 生成文件夹目录 /var/share/icleartw/TWIMPORT/work/yyyy-MM-dd/运单号_运单ID/
400 // * @Date 2024/5/29 259 // * @Date 2024/5/29
401 // * @param deliveryNo 260 // * @param deliveryNo
......
1 //package com.fedex.connect.task.utils.biz.imp001; 1 //package com.fedex.connect.task.utils.biz.imp001;
2 // 2 //
3 +//import com.fedex.connect.task.config.PropertiesConfig;
4 +//import com.fedex.connect.task.data.bo.Imp001GenerateBo;
3 //import com.fedex.export.common.util.*; 5 //import com.fedex.export.common.util.*;
4 //import com.fedex.export.config.PropertiesConfig; 6 //import com.fedex.export.config.PropertiesConfig;
5 //import com.fedex.export.constants.Constant; 7 //import com.fedex.export.constants.Constant;
...@@ -7,6 +9,7 @@ ...@@ -7,6 +9,7 @@
7 //import com.fedex.export.data.bo.Imp001GenerateBo; 9 //import com.fedex.export.data.bo.Imp001GenerateBo;
8 //import com.fedex.export.repository.entity.DeclareInfo; 10 //import com.fedex.export.repository.entity.DeclareInfo;
9 //import com.fedex.export.repository.entity.SysDictionary; 11 //import com.fedex.export.repository.entity.SysDictionary;
12 +//import lombok.extern.slf4j.Slf4j;
10 //import org.slf4j.Logger; 13 //import org.slf4j.Logger;
11 //import org.slf4j.LoggerFactory; 14 //import org.slf4j.LoggerFactory;
12 //import org.springframework.beans.factory.annotation.Autowired; 15 //import org.springframework.beans.factory.annotation.Autowired;
...@@ -24,9 +27,9 @@ ...@@ -24,9 +27,9 @@
24 // * @Description tw001报文推送,util 27 // * @Description tw001报文推送,util
25 // * @Date 2024/5/29 28 // * @Date 2024/5/29
26 // */ 29 // */
30 +//@Slf4j
27 //@Component 31 //@Component
28 -//public class Tw001PushUtil { 32 +//public class Imp001PushUtil {
29 -// private static Logger log = LoggerFactory.getLogger(Tw001PushUtil.class);
30 // @Autowired 33 // @Autowired
31 // PropertiesConfig propertiesConfig; 34 // PropertiesConfig propertiesConfig;
32 // @Autowired 35 // @Autowired
...@@ -36,17 +39,17 @@ ...@@ -36,17 +39,17 @@
36 // 39 //
37 // /** 40 // /**
38 // * @Author mt 41 // * @Author mt
39 -// * @Description 推送tw001 42 +// * @Description 推送imp001
40 -// * @Date 2024/5/29 43 +// * @Date 2024/11/21
41 -// * @param tw001GenerateBo 44 +// * @param imp001GenerateBo
42 -// * @return com.fedex.export.data.dto.tw001.Imp001RootJsonDto 45 +// * @return void
43 // */ 46 // */
44 -// public void pushTw001(Imp001GenerateBo tw001GenerateBo) throws Exception{ 47 +// public void pushImp001(Imp001GenerateBo imp001GenerateBo) throws Exception{
45 // long start = System.currentTimeMillis(); 48 // long start = System.currentTimeMillis();
46 // //生成zip临时文件到指定临时目录 49 // //生成zip临时文件到指定临时目录
47 -// String zipFileName = this.toZips(tw001GenerateBo); 50 +// String zipFileName = this.toZips(imp001GenerateBo);
48 // //zip原始临时目录,zip为临时文件 51 // //zip原始临时目录,zip为临时文件
49 -// String zipSourceTempFilePath = tw001GenerateBo.getWorkFilePath() + zipFileName + Constant.FILE_SUFFIX_KEYS.TEMP; 52 +// String zipSourceTempFilePath = imp001GenerateBo.getWorkFilePath() + zipFileName + Constant.FILE_SUFFIX_KEYS.TEMP;
50 // //推送zip文件最终目录 53 // //推送zip文件最终目录
51 // String zipTargetFilePath = propertiesConfig.getTw001PathFinal() + zipFileName; 54 // String zipTargetFilePath = propertiesConfig.getTw001PathFinal() + zipFileName;
52 // //记录zip文件名称 55 // //记录zip文件名称
......
1 //package com.fedex.connect.task.utils.biz.imp001; 1 //package com.fedex.connect.task.utils.biz.imp001;
2 // 2 //
3 +//import com.fedex.connect.common.model.biz.PushOb;
4 +//import com.fedex.connect.task.config.PropertiesConfig;
5 +//import com.fedex.connect.task.data.bo.Imp001GenerateBo;
3 //import com.fedex.export.common.enums.PushLogEnum; 6 //import com.fedex.export.common.enums.PushLogEnum;
4 //import com.fedex.export.common.util.DateUtil; 7 //import com.fedex.export.common.util.DateUtil;
5 //import com.fedex.export.common.util.NioFileUtils; 8 //import com.fedex.export.common.util.NioFileUtils;
...@@ -12,6 +15,7 @@ ...@@ -12,6 +15,7 @@
12 //import com.fedex.export.repository.entity.log.PushObLog; 15 //import com.fedex.export.repository.entity.log.PushObLog;
13 //import com.fedex.export.repository.repo.business.IPushObLogRepository; 16 //import com.fedex.export.repository.repo.business.IPushObLogRepository;
14 //import com.fedex.export.service.business.IPushObDetailService; 17 //import com.fedex.export.service.business.IPushObDetailService;
18 +//import lombok.extern.slf4j.Slf4j;
15 //import org.slf4j.Logger; 19 //import org.slf4j.Logger;
16 //import org.slf4j.LoggerFactory; 20 //import org.slf4j.LoggerFactory;
17 //import org.springframework.beans.factory.annotation.Autowired; 21 //import org.springframework.beans.factory.annotation.Autowired;
...@@ -27,9 +31,9 @@ ...@@ -27,9 +31,9 @@
27 // * @Description 类说明 推送tw001完成,记录日志,并且备份数据 31 // * @Description 类说明 推送tw001完成,记录日志,并且备份数据
28 // * @Date 2024/5/30 32 // * @Date 2024/5/30
29 // */ 33 // */
34 +//@Slf4j
30 //@Component 35 //@Component
31 -//public class Tw001RecordLogUtil { 36 +//public class Imp001RecordLogUtil {
32 -// private static Logger log = LoggerFactory.getLogger(Tw001RecordLogUtil.class);
33 // @Autowired 37 // @Autowired
34 // PropertiesConfig propertiesConfig; 38 // PropertiesConfig propertiesConfig;
35 // @Autowired 39 // @Autowired
...@@ -41,18 +45,19 @@ ...@@ -41,18 +45,19 @@
41 // 45 //
42 // /** 46 // /**
43 // * @Author mt 47 // * @Author mt
44 -// * @Description 功能说明 推送成功记录日志 48 +// * @Description 推送成功记录日志
45 -// * @Date 2024/5/30 49 +// * @Date 2024/11/21
46 -// * @param tw001GenerateBo 50 +// * @param imp001GenerateBo
51 +// * @param obLog
47 // * @return void 52 // * @return void
48 // */ 53 // */
49 -// public void pushSuccessRecordLog(Imp001GenerateBo tw001GenerateBo, PushObLog obLog){ 54 +// public void pushSuccessRecordLog(Imp001GenerateBo imp001GenerateBo, PushOb obLog){
50 // try { 55 // try {
51 -// if(Objects.nonNull(tw001GenerateBo)){ 56 +// if(Objects.nonNull(imp001GenerateBo)){
52 // //备份文件,并且记录日志 57 // //备份文件,并且记录日志
53 -// String targetPath = this.recordLog(tw001GenerateBo,obLog , propertiesConfig.getTw001PathBak(),PushLogEnum.PUSHED_SUCCESS,null); 58 +// String targetPath = this.recordLog(imp001GenerateBo,obLog , propertiesConfig.getTw001PathBak(),PushLogEnum.PUSHED_SUCCESS,null);
54 -// obLog.setFileName(tw001GenerateBo.getZipFileName()); 59 +// obLog.setFileName(imp001GenerateBo.getZipFileName());
55 -// obLog.setFilePath(tw001GenerateBo.getZipFileTargetPath()); 60 +// obLog.setFilePath(imp001GenerateBo.getZipFileTargetPath());
56 // obLog.setFileBackPath(targetPath); 61 // obLog.setFileBackPath(targetPath);
57 // } 62 // }
58 // obLog.setPushNum(obLog.getPushNum() + 1); 63 // obLog.setPushNum(obLog.getPushNum() + 1);
...@@ -75,7 +80,7 @@ ...@@ -75,7 +80,7 @@
75 // * @param errorMsg 80 // * @param errorMsg
76 // * @return void 81 // * @return void
77 // */ 82 // */
78 -// public void pushFailRecordLog(Imp001GenerateBo tw001GenerateBo, PushObLog obLog, String errorMsg){ 83 +// public void pushFailRecordLog(Imp001GenerateBo tw001GenerateBo, PushOb obLog, String errorMsg){
79 // try { 84 // try {
80 // if(Objects.nonNull(tw001GenerateBo)){ 85 // if(Objects.nonNull(tw001GenerateBo)){
81 // //备份文件,并且记录失败日志 86 // //备份文件,并且记录失败日志
...@@ -105,7 +110,7 @@ ...@@ -105,7 +110,7 @@
105 // * @return 返回目标备份路径 110 // * @return 返回目标备份路径
106 // */ 111 // */
107 // private String recordLog(Imp001GenerateBo tw001GenerateBo, 112 // private String recordLog(Imp001GenerateBo tw001GenerateBo,
108 -// PushObLog obLog, 113 +// PushOb obLog,
109 // String tarPath, 114 // String tarPath,
110 // PushLogEnum pushLogEnum, 115 // PushLogEnum pushLogEnum,
111 // String remark){ 116 // String remark){
......