tao.mo

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

mt
2024年11月21日16:13:02
Showing 26 changed files with 242 additions and 127 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.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){
......