biz-customer | 修改 | save跟savelAll方法调整名称为saveOrUpdate
mt 2024年11月20日10:08:18
Showing
28 changed files
with
323 additions
and
103 deletions
| 1 | package com.fedex.connect.customer.repository.base; | 1 | package com.fedex.connect.customer.repository.base; |
| 2 | 2 | ||
| 3 | -import com.fedex.connect.common.dao.biz.AttachmentMapper; | 3 | +import com.fedex.connect.common.dao.biz.*; |
| 4 | -import com.fedex.connect.common.dao.biz.ConsignmentMapper; | ||
| 5 | -import com.fedex.connect.common.dao.biz.UploadRecordMapper; | ||
| 6 | -import com.fedex.connect.common.dao.biz.UserConsignmentMappingMapper; | ||
| 7 | import com.fedex.connect.customer.repository.dao.AttachmentExtMapper; | 4 | import com.fedex.connect.customer.repository.dao.AttachmentExtMapper; |
| 8 | import com.fedex.connect.customer.repository.dao.ConsignmentExtMapper; | 5 | import com.fedex.connect.customer.repository.dao.ConsignmentExtMapper; |
| 9 | import org.springframework.beans.factory.annotation.Autowired; | 6 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | @@ -18,7 +15,9 @@ public class BaseDao { | ... | @@ -18,7 +15,9 @@ public class BaseDao { |
| 18 | @Autowired | 15 | @Autowired |
| 19 | protected UserConsignmentMappingMapper userConsignmentMappingMapper; | 16 | protected UserConsignmentMappingMapper userConsignmentMappingMapper; |
| 20 | @Autowired | 17 | @Autowired |
| 18 | + protected PushObMapper pushObMapper; | ||
| 19 | + @Autowired | ||
| 21 | protected ConsignmentExtMapper consignmentExtMapper; | 20 | protected ConsignmentExtMapper consignmentExtMapper; |
| 22 | @Autowired | 21 | @Autowired |
| 23 | protected AttachmentExtMapper attachmentExtMapper; | 22 | protected AttachmentExtMapper attachmentExtMapper; |
| 24 | -} | 23 | +} |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -12,7 +12,7 @@ public interface IAttachmentRepository { | ... | @@ -12,7 +12,7 @@ public interface IAttachmentRepository { |
| 12 | 12 | ||
| 13 | Attachment queryInfo(UserConsignmentInfoQuery userConsignmentInfoQuery); | 13 | Attachment queryInfo(UserConsignmentInfoQuery userConsignmentInfoQuery); |
| 14 | 14 | ||
| 15 | - Attachment save(Attachment entity); | 15 | + Attachment saveOrUpdate(Attachment entity); |
| 16 | 16 | ||
| 17 | - void saveAll(List<Attachment> list); | 17 | + void saveOrUpdateAll(List<Attachment> list); |
| 18 | } | 18 | } |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -20,7 +20,7 @@ public interface IConsignmentRepository { | ... | @@ -20,7 +20,7 @@ public interface IConsignmentRepository { |
| 20 | 20 | ||
| 21 | Consignment findConsignmentInfo(UserConsignmentInfoQuery consignmentInfoQuery); | 21 | Consignment findConsignmentInfo(UserConsignmentInfoQuery consignmentInfoQuery); |
| 22 | 22 | ||
| 23 | - Consignment save(Consignment entity); | 23 | + Consignment saveOrUpdate(Consignment entity); |
| 24 | 24 | ||
| 25 | - void saveAll(List<Consignment> list); | 25 | + void saveOrUpdateAll(List<Consignment> list); |
| 26 | } | 26 | } | ... | ... |
server/biz-customer/src/main/java/com/fedex/connect/customer/repository/repo/IPushObRepository.java
0 → 100644
| 1 | +package com.fedex.connect.customer.repository.repo; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.common.model.biz.PushOb; | ||
| 4 | +import java.util.List; | ||
| 5 | + | ||
| 6 | +public interface IPushObRepository { | ||
| 7 | + /** | ||
| 8 | + * @Author mt | ||
| 9 | + * @Description 推送进口文件主表保存或更新 | ||
| 10 | + * @Date 2024/11/19 | ||
| 11 | + * @param entity | ||
| 12 | + * @return com.fedex.connect.common.model.biz.PushOb | ||
| 13 | + */ | ||
| 14 | + PushOb saveOrUpdate(PushOb entity); | ||
| 15 | + /** | ||
| 16 | + * @Author mt | ||
| 17 | + * @Description 推送进口文件主表批量保存或更新 | ||
| 18 | + * @Date 2024/11/19 | ||
| 19 | + * @param list | ||
| 20 | + * @return void | ||
| 21 | + */ | ||
| 22 | + void saveOrUpdateAll(List<PushOb> list); | ||
| 23 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -12,7 +12,7 @@ public interface IUploadRecordRepository { | ... | @@ -12,7 +12,7 @@ public interface IUploadRecordRepository { |
| 12 | * @param entity | 12 | * @param entity |
| 13 | * @return com.fedex.connect.common.model.biz.UploadRecord | 13 | * @return com.fedex.connect.common.model.biz.UploadRecord |
| 14 | */ | 14 | */ |
| 15 | - UploadRecord save(UploadRecord entity); | 15 | + UploadRecord saveOrUpdate(UploadRecord entity); |
| 16 | /** | 16 | /** |
| 17 | * @Author mt | 17 | * @Author mt |
| 18 | * @Description 上传记录批量保存或更新 | 18 | * @Description 上传记录批量保存或更新 |
| ... | @@ -20,5 +20,5 @@ public interface IUploadRecordRepository { | ... | @@ -20,5 +20,5 @@ public interface IUploadRecordRepository { |
| 20 | * @param list | 20 | * @param list |
| 21 | * @return void | 21 | * @return void |
| 22 | */ | 22 | */ |
| 23 | - void saveAll(List<UploadRecord> list); | 23 | + void saveOrUpdateAll(List<UploadRecord> list); |
| 24 | } | 24 | } | ... | ... |
| ... | @@ -21,7 +21,7 @@ public interface IUserConsignmentMappingRepository { | ... | @@ -21,7 +21,7 @@ public interface IUserConsignmentMappingRepository { |
| 21 | * @param entity | 21 | * @param entity |
| 22 | * @return com.fedex.connect.common.model.biz.UserConsignmentMapping | 22 | * @return com.fedex.connect.common.model.biz.UserConsignmentMapping |
| 23 | */ | 23 | */ |
| 24 | - UserConsignmentMapping save(UserConsignmentMapping entity); | 24 | + UserConsignmentMapping saveOrUpdate(UserConsignmentMapping entity); |
| 25 | /** | 25 | /** |
| 26 | * @Author mt | 26 | * @Author mt |
| 27 | * @Description 用户与运单映射信息批量保存或更新 | 27 | * @Description 用户与运单映射信息批量保存或更新 |
| ... | @@ -29,5 +29,5 @@ public interface IUserConsignmentMappingRepository { | ... | @@ -29,5 +29,5 @@ public interface IUserConsignmentMappingRepository { |
| 29 | * @param list | 29 | * @param list |
| 30 | * @return void | 30 | * @return void |
| 31 | */ | 31 | */ |
| 32 | - void saveAll(List<UserConsignmentMapping> list); | 32 | + void saveOrUpdateAll(List<UserConsignmentMapping> list); |
| 33 | } | 33 | } | ... | ... |
| ... | @@ -31,7 +31,7 @@ public class AttachmentRepositoryImpl extends BaseDao implements IAttachmentRepo | ... | @@ -31,7 +31,7 @@ public class AttachmentRepositoryImpl extends BaseDao implements IAttachmentRepo |
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | @Override | 33 | @Override |
| 34 | - public Attachment save(Attachment entity) { | 34 | + public Attachment saveOrUpdate(Attachment entity) { |
| 35 | if(entity != null) { | 35 | if(entity != null) { |
| 36 | if (entity.getId() == null || entity.getId().longValue() <= 0) { | 36 | if (entity.getId() == null || entity.getId().longValue() <= 0) { |
| 37 | attachmentMapper.insertSelective(entity); | 37 | attachmentMapper.insertSelective(entity); |
| ... | @@ -43,7 +43,7 @@ public class AttachmentRepositoryImpl extends BaseDao implements IAttachmentRepo | ... | @@ -43,7 +43,7 @@ public class AttachmentRepositoryImpl extends BaseDao implements IAttachmentRepo |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | @Override | 45 | @Override |
| 46 | - public void saveAll(List<Attachment> list) { | 46 | + public void saveOrUpdateAll(List<Attachment> list) { |
| 47 | list.stream().forEach(p->{ | 47 | list.stream().forEach(p->{ |
| 48 | if(p.getId() == null || p.getId().longValue() <=0){ | 48 | if(p.getId() == null || p.getId().longValue() <=0){ |
| 49 | attachmentMapper.insertSelective(p); | 49 | attachmentMapper.insertSelective(p); | ... | ... |
| ... | @@ -64,7 +64,7 @@ public class ConsignmentRepositoryImpl extends BaseDao implements IConsignmentRe | ... | @@ -64,7 +64,7 @@ public class ConsignmentRepositoryImpl extends BaseDao implements IConsignmentRe |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | @Override | 66 | @Override |
| 67 | - public Consignment save(Consignment entity) { | 67 | + public Consignment saveOrUpdate(Consignment entity) { |
| 68 | if(entity != null) { | 68 | if(entity != null) { |
| 69 | if (entity.getId() == null || entity.getId().longValue() <= 0) { | 69 | if (entity.getId() == null || entity.getId().longValue() <= 0) { |
| 70 | consignmentMapper.insertSelective(entity); | 70 | consignmentMapper.insertSelective(entity); |
| ... | @@ -76,7 +76,7 @@ public class ConsignmentRepositoryImpl extends BaseDao implements IConsignmentRe | ... | @@ -76,7 +76,7 @@ public class ConsignmentRepositoryImpl extends BaseDao implements IConsignmentRe |
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | @Override | 78 | @Override |
| 79 | - public void saveAll(List<Consignment> list) { | 79 | + public void saveOrUpdateAll(List<Consignment> list) { |
| 80 | list.stream().forEach(p->{ | 80 | list.stream().forEach(p->{ |
| 81 | if(p.getId() == null || p.getId().longValue() <=0){ | 81 | if(p.getId() == null || p.getId().longValue() <=0){ |
| 82 | consignmentMapper.insertSelective(p); | 82 | consignmentMapper.insertSelective(p); | ... | ... |
| 1 | +package com.fedex.connect.customer.repository.repo.impl; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.common.model.biz.PushOb; | ||
| 4 | +import com.fedex.connect.customer.repository.base.BaseDao; | ||
| 5 | +import com.fedex.connect.customer.repository.repo.IPushObRepository; | ||
| 6 | +import org.springframework.stereotype.Repository; | ||
| 7 | +import java.util.List; | ||
| 8 | + | ||
| 9 | +@Repository | ||
| 10 | +public class PushObRepositoryImpl extends BaseDao implements IPushObRepository { | ||
| 11 | + @Override | ||
| 12 | + public PushOb saveOrUpdate(PushOb entity) { | ||
| 13 | + if(entity != null) { | ||
| 14 | + if (entity.getId() == null || entity.getId().longValue() <= 0) { | ||
| 15 | + pushObMapper.insertSelective(entity); | ||
| 16 | + } else if (entity.getId() != null && entity.getId().longValue() > 0){ | ||
| 17 | + pushObMapper.updateByPrimaryKeySelective(entity); | ||
| 18 | + } | ||
| 19 | + } | ||
| 20 | + return entity; | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + @Override | ||
| 24 | + public void saveOrUpdateAll(List<PushOb> list) { | ||
| 25 | + list.stream().forEach(p->{ | ||
| 26 | + if(p.getId() == null || p.getId().longValue() <=0){ | ||
| 27 | + pushObMapper.insertSelective(p); | ||
| 28 | + }else if(p.getId() != null && p.getId().longValue() >0){ | ||
| 29 | + pushObMapper.updateByPrimaryKeySelective(p); | ||
| 30 | + } | ||
| 31 | + }); | ||
| 32 | + } | ||
| 33 | +} | ||
| ... | \ 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 | @Repository | 10 | @Repository |
| 11 | public class UploadRecordRepositoryImpl extends BaseDao implements IUploadRecordRepository { | 11 | public class UploadRecordRepositoryImpl extends BaseDao implements IUploadRecordRepository { |
| 12 | @Override | 12 | @Override |
| 13 | - public UploadRecord save(UploadRecord entity) { | 13 | + public UploadRecord saveOrUpdate(UploadRecord entity) { |
| 14 | if(entity != null) { | 14 | if(entity != null) { |
| 15 | if (entity.getId() == null || entity.getId().longValue() <= 0) { | 15 | if (entity.getId() == null || entity.getId().longValue() <= 0) { |
| 16 | uploadRecordMapper.insertSelective(entity); | 16 | uploadRecordMapper.insertSelective(entity); |
| ... | @@ -22,7 +22,7 @@ public class UploadRecordRepositoryImpl extends BaseDao implements IUploadRecord | ... | @@ -22,7 +22,7 @@ public class UploadRecordRepositoryImpl extends BaseDao implements IUploadRecord |
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | @Override | 24 | @Override |
| 25 | - public void saveAll(List<UploadRecord> list) { | 25 | + public void saveOrUpdateAll(List<UploadRecord> list) { |
| 26 | list.stream().forEach(p->{ | 26 | list.stream().forEach(p->{ |
| 27 | if(p.getId() == null || p.getId().longValue() <=0){ | 27 | if(p.getId() == null || p.getId().longValue() <=0){ |
| 28 | uploadRecordMapper.insertSelective(p); | 28 | uploadRecordMapper.insertSelective(p); | ... | ... |
| ... | @@ -42,7 +42,7 @@ public class UserConsignmentMappingRepositoryImpl extends BaseDao implements IUs | ... | @@ -42,7 +42,7 @@ public class UserConsignmentMappingRepositoryImpl extends BaseDao implements IUs |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | @Override | 44 | @Override |
| 45 | - public void saveAll(List<UserConsignmentMapping> list) { | 45 | + public void saveOrUpdateAll(List<UserConsignmentMapping> list) { |
| 46 | list.stream().forEach(p->{ | 46 | list.stream().forEach(p->{ |
| 47 | if(p.getId() == null || p.getId().longValue() <=0){ | 47 | if(p.getId() == null || p.getId().longValue() <=0){ |
| 48 | userConsignmentMappingMapper.insertSelective(p); | 48 | userConsignmentMappingMapper.insertSelective(p); | ... | ... |
| 1 | package com.fedex.connect.customer.service.base; | 1 | package com.fedex.connect.customer.service.base; |
| 2 | 2 | ||
| 3 | import com.fedex.connect.common.dependencies.util.ResponseUtils; | 3 | import com.fedex.connect.common.dependencies.util.ResponseUtils; |
| 4 | -import com.fedex.connect.customer.repository.repo.IAttachmentRepository; | 4 | +import com.fedex.connect.customer.repository.repo.*; |
| 5 | -import com.fedex.connect.customer.repository.repo.IConsignmentRepository; | ||
| 6 | -import com.fedex.connect.customer.repository.repo.IUploadRecordRepository; | ||
| 7 | -import com.fedex.connect.customer.repository.repo.IUserConsignmentMappingRepository; | ||
| 8 | import org.springframework.beans.factory.annotation.Autowired; | 5 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | 6 | ||
| 10 | public class BaseService { | 7 | public class BaseService { |
| ... | @@ -18,4 +15,6 @@ public class BaseService { | ... | @@ -18,4 +15,6 @@ public class BaseService { |
| 18 | protected IUploadRecordRepository uploadRecordRepository; | 15 | protected IUploadRecordRepository uploadRecordRepository; |
| 19 | @Autowired | 16 | @Autowired |
| 20 | protected IUserConsignmentMappingRepository userConsignmentMappingRepository; | 17 | protected IUserConsignmentMappingRepository userConsignmentMappingRepository; |
| 18 | + @Autowired | ||
| 19 | + protected IPushObRepository pushObRepository; | ||
| 21 | } | 20 | } |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -4,10 +4,7 @@ import com.fedex.connect.common.dependencies.date.vo.ResponseVo; | ... | @@ -4,10 +4,7 @@ import com.fedex.connect.common.dependencies.date.vo.ResponseVo; |
| 4 | import com.fedex.connect.common.dependencies.enums.base.StatusEnum; | 4 | import com.fedex.connect.common.dependencies.enums.base.StatusEnum; |
| 5 | import com.fedex.connect.common.dependencies.util.AssignmentFieldUtils; | 5 | import com.fedex.connect.common.dependencies.util.AssignmentFieldUtils; |
| 6 | import com.fedex.connect.common.dependencies.util.ResponseUtils; | 6 | import com.fedex.connect.common.dependencies.util.ResponseUtils; |
| 7 | -import com.fedex.connect.common.model.biz.Attachment; | 7 | +import com.fedex.connect.common.model.biz.*; |
| 8 | -import com.fedex.connect.common.model.biz.Consignment; | ||
| 9 | -import com.fedex.connect.common.model.biz.UploadRecord; | ||
| 10 | -import com.fedex.connect.common.model.biz.UserConsignmentMapping; | ||
| 11 | import com.fedex.connect.common.model.sys.User; | 8 | import com.fedex.connect.common.model.sys.User; |
| 12 | import com.fedex.connect.customer.data.bo.AddBo; | 9 | import com.fedex.connect.customer.data.bo.AddBo; |
| 13 | import com.fedex.connect.customer.data.bo.ConsignmentBo; | 10 | import com.fedex.connect.customer.data.bo.ConsignmentBo; |
| ... | @@ -16,7 +13,9 @@ import com.fedex.connect.customer.service.base.BaseService; | ... | @@ -16,7 +13,9 @@ import com.fedex.connect.customer.service.base.BaseService; |
| 16 | import com.fedex.connect.customer.service.biz.IAttachmentService; | 13 | import com.fedex.connect.customer.service.biz.IAttachmentService; |
| 17 | import com.fedex.connect.customer.service.biz.IConsignmentService; | 14 | import com.fedex.connect.customer.service.biz.IConsignmentService; |
| 18 | import com.fedex.connect.customer.util.service.biz.ConsignmentUtil; | 15 | import com.fedex.connect.customer.util.service.biz.ConsignmentUtil; |
| 16 | +import com.fedex.connect.customer.util.service.biz.PushObUtil; | ||
| 19 | import com.fedex.connect.customer.util.service.biz.UploadRecordUtil; | 17 | import com.fedex.connect.customer.util.service.biz.UploadRecordUtil; |
| 18 | +import com.fedex.connect.customer.util.service.biz.UserConsignmentMappingUtil; | ||
| 20 | import org.apache.commons.lang3.StringUtils; | 19 | import org.apache.commons.lang3.StringUtils; |
| 21 | import org.springframework.beans.factory.annotation.Autowired; | 20 | import org.springframework.beans.factory.annotation.Autowired; |
| 22 | import org.springframework.stereotype.Service; | 21 | import org.springframework.stereotype.Service; |
| ... | @@ -42,6 +41,10 @@ public class ConsignmentServiceImpl extends BaseService implements IConsignmentS | ... | @@ -42,6 +41,10 @@ public class ConsignmentServiceImpl extends BaseService implements IConsignmentS |
| 42 | @Autowired | 41 | @Autowired |
| 43 | private UploadRecordUtil uploadRecordUtil; | 42 | private UploadRecordUtil uploadRecordUtil; |
| 44 | @Autowired | 43 | @Autowired |
| 44 | + private UserConsignmentMappingUtil userConsignmentMappingUtil; | ||
| 45 | + @Autowired | ||
| 46 | + private PushObUtil pushObUtil; | ||
| 47 | + @Autowired | ||
| 45 | private IAttachmentService attachmentService; | 48 | private IAttachmentService attachmentService; |
| 46 | 49 | ||
| 47 | /** | 50 | /** |
| ... | @@ -122,13 +125,7 @@ public class ConsignmentServiceImpl extends BaseService implements IConsignmentS | ... | @@ -122,13 +125,7 @@ public class ConsignmentServiceImpl extends BaseService implements IConsignmentS |
| 122 | /** | 125 | /** |
| 123 | * 保存运单相关信息 | 126 | * 保存运单相关信息 |
| 124 | */ | 127 | */ |
| 125 | - this.saveSubmitInfo(consignment,attachmentList,uploadRecord,user); | 128 | + this.submitInfo(consignment,attachmentList,uploadRecord,user); |
| 126 | - /** | ||
| 127 | - * 初始化插入预清关文件推送任务日志,szl添加 | ||
| 128 | - */ | ||
| 129 | - /** | ||
| 130 | - * 初始化插入预清关文件邮件推送日志,mt添加 | ||
| 131 | - */ | ||
| 132 | }catch(Exception ex){ | 129 | }catch(Exception ex){ |
| 133 | /** | 130 | /** |
| 134 | * 提交异常,需要删除对应已上传附件 | 131 | * 提交异常,需要删除对应已上传附件 |
| ... | @@ -150,7 +147,7 @@ public class ConsignmentServiceImpl extends BaseService implements IConsignmentS | ... | @@ -150,7 +147,7 @@ public class ConsignmentServiceImpl extends BaseService implements IConsignmentS |
| 150 | * @return void | 147 | * @return void |
| 151 | */ | 148 | */ |
| 152 | @Transactional(rollbackFor = Exception.class) | 149 | @Transactional(rollbackFor = Exception.class) |
| 153 | - public void saveSubmitInfo(Consignment consignment, | 150 | + public void submitInfo(Consignment consignment, |
| 154 | List<Attachment> attachmentList, | 151 | List<Attachment> attachmentList, |
| 155 | UploadRecord uploadRecord, | 152 | UploadRecord uploadRecord, |
| 156 | User user) throws Exception{ | 153 | User user) throws Exception{ |
| ... | @@ -180,13 +177,27 @@ public class ConsignmentServiceImpl extends BaseService implements IConsignmentS | ... | @@ -180,13 +177,27 @@ public class ConsignmentServiceImpl extends BaseService implements IConsignmentS |
| 180 | */ | 177 | */ |
| 181 | UserConsignmentMapping userConsignmentMapping = userConsignmentMappingRepository.findByUserIdConsignmentId(user.getId(),consignment.getId()); | 178 | UserConsignmentMapping userConsignmentMapping = userConsignmentMappingRepository.findByUserIdConsignmentId(user.getId(),consignment.getId()); |
| 182 | if(Objects.isNull(userConsignmentMapping)){ | 179 | if(Objects.isNull(userConsignmentMapping)){ |
| 183 | - userConsignmentMapping = new UserConsignmentMapping(); | 180 | + /** |
| 184 | - userConsignmentMapping.setUserId(user.getId()); | 181 | + * 初始化插入预清关文件推送任务日志 |
| 185 | - userConsignmentMapping.setConsignmentId(consignment.getId()); | 182 | + */ |
| 186 | - userConsignmentMapping.setStatus(StatusEnum.YES.getCode()); | 183 | + userConsignmentMapping = userConsignmentMappingUtil.initUserConsignmentMapping(user.getId(),consignment.getId()); |
| 187 | - AssignmentFieldUtils.assignmentTableBaseField(userConsignmentMapping); | 184 | + /** |
| 185 | + * 初始化插入预清关文件推送任务日志 | ||
| 186 | + */ | ||
| 188 | userConsignmentMappingRepository.save(userConsignmentMapping); | 187 | userConsignmentMappingRepository.save(userConsignmentMapping); |
| 189 | } | 188 | } |
| 190 | } | 189 | } |
| 190 | + /** | ||
| 191 | + * Todo 初始化插入预清关文件推送任务日志,szl添加 | ||
| 192 | + */ | ||
| 193 | + | ||
| 194 | + /** | ||
| 195 | + * 初始化插入预清关文件邮件推送日志,mt添加 | ||
| 196 | + */ | ||
| 197 | + PushOb pushOb = pushObUtil.initPushOb(consignment,user); | ||
| 198 | + /** | ||
| 199 | + * 推送进口文件主表 | ||
| 200 | + */ | ||
| 201 | + pushObRepository.save(pushOb); | ||
| 191 | } | 202 | } |
| 192 | } | 203 | } |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -53,7 +53,7 @@ public class AttachmentUtil { | ... | @@ -53,7 +53,7 @@ public class AttachmentUtil { |
| 53 | DictionaryEntries attachmentBizTypeEntries = cacheSystem.getDicAttachmentBizType(bizType); | 53 | DictionaryEntries attachmentBizTypeEntries = cacheSystem.getDicAttachmentBizType(bizType); |
| 54 | attachment.setBizTypeCode(attachmentBizTypeEntries.getCode()); | 54 | attachment.setBizTypeCode(attachmentBizTypeEntries.getCode()); |
| 55 | attachment.setBizTypeName(attachmentBizTypeEntries.getDescription()); | 55 | attachment.setBizTypeName(attachmentBizTypeEntries.getDescription()); |
| 56 | - DictionaryEntries attachmentFileTypeEntries = cacheSystem.getDicAttachmentBizType(AttachmentFileTypeEnum.FILE.getCode()); | 56 | + DictionaryEntries attachmentFileTypeEntries = cacheSystem.getDicAttachmentFileType(AttachmentFileTypeEnum.FILE.getCode()); |
| 57 | attachment.setFileTypeCode(attachmentFileTypeEntries.getCode()); | 57 | attachment.setFileTypeCode(attachmentFileTypeEntries.getCode()); |
| 58 | attachment.setFileTypeName(attachmentFileTypeEntries.getDescription()); | 58 | attachment.setFileTypeName(attachmentFileTypeEntries.getDescription()); |
| 59 | attachment.setStatus(StatusEnum.YES.getCode()); | 59 | attachment.setStatus(StatusEnum.YES.getCode()); | ... | ... |
| ... | @@ -4,6 +4,7 @@ import com.fedex.connect.common.dependencies.cache.CacheSystem; | ... | @@ -4,6 +4,7 @@ import com.fedex.connect.common.dependencies.cache.CacheSystem; |
| 4 | import com.fedex.connect.common.dependencies.contants.DigitConstants; | 4 | import com.fedex.connect.common.dependencies.contants.DigitConstants; |
| 5 | import com.fedex.connect.common.dependencies.date.vo.ResponseVo; | 5 | import com.fedex.connect.common.dependencies.date.vo.ResponseVo; |
| 6 | import com.fedex.connect.common.dependencies.enums.biz.ConsignmentStatusEnum; | 6 | import com.fedex.connect.common.dependencies.enums.biz.ConsignmentStatusEnum; |
| 7 | +import com.fedex.connect.common.dependencies.util.AssignmentFieldUtils; | ||
| 7 | import com.fedex.connect.common.dependencies.util.ResponseUtils; | 8 | import com.fedex.connect.common.dependencies.util.ResponseUtils; |
| 8 | import com.fedex.connect.common.model.bi.DictionaryEntries; | 9 | import com.fedex.connect.common.model.bi.DictionaryEntries; |
| 9 | import com.fedex.connect.common.model.biz.Consignment; | 10 | import com.fedex.connect.common.model.biz.Consignment; |
| ... | @@ -36,6 +37,59 @@ public class ConsignmentUtil { | ... | @@ -36,6 +37,59 @@ public class ConsignmentUtil { |
| 36 | IConsignmentRepository consignmentRepository; | 37 | IConsignmentRepository consignmentRepository; |
| 37 | 38 | ||
| 38 | /** | 39 | /** |
| 40 | + * @Author mt | ||
| 41 | + * @Description 初始化运单表信息 | ||
| 42 | + * @Date 2024/11/15 | ||
| 43 | + * @param consignmentBo | ||
| 44 | + * @param user | ||
| 45 | + * @return void | ||
| 46 | + */ | ||
| 47 | + public Consignment initConsignment(ConsignmentBo consignmentBo, User user){ | ||
| 48 | + Consignment consignment = consignmentRepository.findById(consignmentBo.getConsignmentId()); | ||
| 49 | + DictionaryEntries consignmentStatusDic = cacheSystem.getDicConsignmentStatus(ConsignmentStatusEnum.CONSIGNMENT_STATUS_01.getCode()); | ||
| 50 | + try { | ||
| 51 | + Date nowDate = new Date(); | ||
| 52 | + //如果没有运单id,则是通过add添加进来的运单 | ||
| 53 | + if (Objects.isNull(consignment)) { | ||
| 54 | + consignment = new Consignment(); | ||
| 55 | + //用户录入数据拷贝 | ||
| 56 | + BeanUtils.copyProperties(consignmentBo, consignment); | ||
| 57 | + //用户录入shipperaccount | ||
| 58 | + consignment.setUserInputShipperAccount(consignmentBo.getShipperAccount()); | ||
| 59 | + //始发国名称 | ||
| 60 | + consignment.setUserInputOriginCountry(consignmentBo.getOriginCountry()); | ||
| 61 | + //始发国编码 | ||
| 62 | + consignment.setUserInputOriginCountryCode(consignmentBo.getOriginCountryCode()); | ||
| 63 | + /******提交信息记录******/ | ||
| 64 | + consignment.setFirstSubmitTime(nowDate); | ||
| 65 | + consignment.setFirstSubmitter(user.getUserName()); | ||
| 66 | + consignment.setFirstSubmitterId(user.getId()); | ||
| 67 | + consignment.setCreateTime(nowDate); | ||
| 68 | + consignment.setCreateUserName(user.getUserName()); | ||
| 69 | + consignment.setCreateUserId(user.getId()); | ||
| 70 | + } else { | ||
| 71 | + consignment.setModifyTime(nowDate); | ||
| 72 | + consignment.setModifyUserName(user.getUserName()); | ||
| 73 | + consignment.setModifyUserId(user.getId()); | ||
| 74 | + } | ||
| 75 | + //记录当前提交人信息 | ||
| 76 | + consignment.setSubmitTime(nowDate); | ||
| 77 | + consignment.setSubmitter(user.getUserName()); | ||
| 78 | + consignment.setSubmitterId(user.getId()); | ||
| 79 | + //记录当前提交运单状态 | ||
| 80 | + consignment.setStatusCode(consignmentStatusDic.getCode()); | ||
| 81 | + consignment.setStatusName(consignmentStatusDic.getDescription()); | ||
| 82 | + /** | ||
| 83 | + * 初始化基础字段 | ||
| 84 | + */ | ||
| 85 | + AssignmentFieldUtils.assignmentTableBaseField(consignment); | ||
| 86 | + }catch(Exception ex){ | ||
| 87 | + responseUtils.fail(ResponseCode.MESSAGE_CODE_30014,ex); | ||
| 88 | + } | ||
| 89 | + return consignment; | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + /** | ||
| 39 | * @Author Szl | 93 | * @Author Szl |
| 40 | * @Description 功能说明 不存在501的运单add时判断该运单是否为自己的运单 | 94 | * @Description 功能说明 不存在501的运单add时判断该运单是否为自己的运单 |
| 41 | * @Date 2024/11/12 | 95 | * @Date 2024/11/12 |
| ... | @@ -125,53 +179,4 @@ public class ConsignmentUtil { | ... | @@ -125,53 +179,4 @@ public class ConsignmentUtil { |
| 125 | private boolean isShipperAccountMatch(String account1, String account2) { | 179 | private boolean isShipperAccountMatch(String account1, String account2) { |
| 126 | return StringUtils.hasText(account1) && StringUtils.hasText(account2) && account1.equals(account2); | 180 | return StringUtils.hasText(account1) && StringUtils.hasText(account2) && account1.equals(account2); |
| 127 | } | 181 | } |
| 128 | - | ||
| 129 | - /** | ||
| 130 | - * @Author mt | ||
| 131 | - * @Description 初始化运单表信息 | ||
| 132 | - * @Date 2024/11/15 | ||
| 133 | - * @param consignmentBo | ||
| 134 | - * @param user | ||
| 135 | - * @return void | ||
| 136 | - */ | ||
| 137 | - public Consignment initConsignment(ConsignmentBo consignmentBo, User user){ | ||
| 138 | - Consignment consignment = consignmentRepository.findById(consignmentBo.getConsignmentId()); | ||
| 139 | - DictionaryEntries consignmentStatusDic = cacheSystem.getDicConsignmentStatus(ConsignmentStatusEnum.CONSIGNMENT_STATUS_01.getCode()); | ||
| 140 | - try { | ||
| 141 | - Date nowDate = new Date(); | ||
| 142 | - //如果没有运单id,则是通过add添加进来的运单 | ||
| 143 | - if (Objects.isNull(consignment)) { | ||
| 144 | - consignment = new Consignment(); | ||
| 145 | - //用户录入数据拷贝 | ||
| 146 | - BeanUtils.copyProperties(consignmentBo, consignment); | ||
| 147 | - //用户录入shipperaccount | ||
| 148 | - consignment.setUserInputShipperAccount(consignmentBo.getShipperAccount()); | ||
| 149 | - //始发国名称 | ||
| 150 | - consignment.setUserInputOriginCountry(consignmentBo.getOriginCountry()); | ||
| 151 | - //始发国编码 | ||
| 152 | - consignment.setUserInputOriginCountryCode(consignmentBo.getOriginCountryCode()); | ||
| 153 | - /******提交信息记录******/ | ||
| 154 | - consignment.setFirstSubmitTime(nowDate); | ||
| 155 | - consignment.setFirstSubmitter(user.getUserName()); | ||
| 156 | - consignment.setFirstSubmitterId(user.getId()); | ||
| 157 | - consignment.setCreateTime(nowDate); | ||
| 158 | - consignment.setCreateUserName(user.getUserName()); | ||
| 159 | - consignment.setCreateUserId(user.getId()); | ||
| 160 | - } else { | ||
| 161 | - consignment.setModifyTime(nowDate); | ||
| 162 | - consignment.setModifyUserName(user.getUserName()); | ||
| 163 | - consignment.setModifyUserId(user.getId()); | ||
| 164 | - } | ||
| 165 | - //记录当前提交人信息 | ||
| 166 | - consignment.setSubmitTime(nowDate); | ||
| 167 | - consignment.setSubmitter(user.getUserName()); | ||
| 168 | - consignment.setSubmitterId(user.getId()); | ||
| 169 | - //记录当前提交运单状态 | ||
| 170 | - consignment.setStatusCode(consignmentStatusDic.getCode()); | ||
| 171 | - consignment.setStatusName(consignmentStatusDic.getDescription()); | ||
| 172 | - }catch(Exception ex){ | ||
| 173 | - responseUtils.fail(ResponseCode.MESSAGE_CODE_30014,ex); | ||
| 174 | - } | ||
| 175 | - return consignment; | ||
| 176 | - } | ||
| 177 | } | 182 | } | ... | ... |
server/biz-customer/src/main/java/com/fedex/connect/customer/util/service/biz/PushObUtil.java
0 → 100644
| 1 | +package com.fedex.connect.customer.util.service.biz; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.common.dependencies.cache.CacheSystem; | ||
| 4 | +import com.fedex.connect.common.dependencies.contants.DigitConstants; | ||
| 5 | +import com.fedex.connect.common.dependencies.enums.biz.PushObStatusEnum; | ||
| 6 | +import com.fedex.connect.common.dependencies.util.AssignmentFieldUtils; | ||
| 7 | +import com.fedex.connect.common.model.bi.DictionaryEntries; | ||
| 8 | +import com.fedex.connect.common.model.biz.Consignment; | ||
| 9 | +import com.fedex.connect.common.model.biz.PushOb; | ||
| 10 | +import com.fedex.connect.common.model.sys.User; | ||
| 11 | +import lombok.extern.slf4j.Slf4j; | ||
| 12 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 13 | +import org.springframework.stereotype.Component; | ||
| 14 | + | ||
| 15 | +/** | ||
| 16 | + * @Author mt | ||
| 17 | + * @Description 推送Imp001操作util | ||
| 18 | + * @Date 2024/11/19 | ||
| 19 | + */ | ||
| 20 | +@Slf4j | ||
| 21 | +@Component | ||
| 22 | +public class PushObUtil { | ||
| 23 | + @Autowired | ||
| 24 | + CacheSystem cacheSystem; | ||
| 25 | + /** | ||
| 26 | + * @Author mt | ||
| 27 | + * @Description 初始化插入预清关文件推送任务日志 | ||
| 28 | + * @Date 2024/11/19 | ||
| 29 | + * @param | ||
| 30 | + * @return com.fedex.connect.common.model.biz.PushOb | ||
| 31 | + */ | ||
| 32 | + public PushOb initPushOb(Consignment consignment, User user) throws Exception{ | ||
| 33 | + DictionaryEntries pushObStatus = cacheSystem.getDicPushObStatus(PushObStatusEnum.TO_BE_SENT.getCode()); | ||
| 34 | + PushOb pushOb = new PushOb(); | ||
| 35 | + pushOb.setConsignmentId(consignment.getId()); | ||
| 36 | + pushOb.setConsignmentCode(consignment.getConsignmentCode()); | ||
| 37 | + pushOb.setPushNum(DigitConstants.DIGIT_ZERO_LONG); | ||
| 38 | + pushOb.setStatusCode(pushObStatus.getCode()); | ||
| 39 | + pushOb.setStatusName(pushObStatus.getDescription()); | ||
| 40 | + pushOb.setCreateUserId(user.getId()); | ||
| 41 | + pushOb.setCreateUserName(user.getUserName()); | ||
| 42 | + pushOb.setModifyUserId(user.getId()); | ||
| 43 | + pushOb.setModifyUserName(user.getUserName()); | ||
| 44 | + /** | ||
| 45 | + * 初始化基础字段 | ||
| 46 | + */ | ||
| 47 | + AssignmentFieldUtils.assignmentTableBaseField(pushOb); | ||
| 48 | + return pushOb; | ||
| 49 | + } | ||
| 50 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +package com.fedex.connect.customer.util.service.biz; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.common.dependencies.enums.base.StatusEnum; | ||
| 4 | +import com.fedex.connect.common.dependencies.util.AssignmentFieldUtils; | ||
| 5 | +import com.fedex.connect.common.model.biz.UserConsignmentMapping; | ||
| 6 | +import lombok.extern.slf4j.Slf4j; | ||
| 7 | +import org.springframework.stereotype.Component; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * @Author mt | ||
| 11 | + * @Description 用户运单映射表util | ||
| 12 | + * @Date 2024/11/19 | ||
| 13 | + */ | ||
| 14 | +@Slf4j | ||
| 15 | +@Component | ||
| 16 | +public class UserConsignmentMappingUtil { | ||
| 17 | + | ||
| 18 | + /** | ||
| 19 | + * @Author mt | ||
| 20 | + * @Description 初始化用户运单映射表信息 | ||
| 21 | + * @Date 2024/11/19 | ||
| 22 | + * @param | ||
| 23 | + * @return com.fedex.connect.common.model.biz.PushOb | ||
| 24 | + */ | ||
| 25 | + public UserConsignmentMapping initUserConsignmentMapping(Long userId,Long consignmentId) throws Exception{ | ||
| 26 | + UserConsignmentMapping userConsignmentMapping = new UserConsignmentMapping(); | ||
| 27 | + userConsignmentMapping.setUserId(userId); | ||
| 28 | + userConsignmentMapping.setConsignmentId(consignmentId); | ||
| 29 | + userConsignmentMapping.setStatus(StatusEnum.YES.getCode()); | ||
| 30 | + AssignmentFieldUtils.assignmentTableBaseField(userConsignmentMapping); | ||
| 31 | + return userConsignmentMapping; | ||
| 32 | + } | ||
| 33 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -175,4 +175,15 @@ public class CacheSystem implements CommandLineRunner { | ... | @@ -175,4 +175,15 @@ public class CacheSystem implements CommandLineRunner { |
| 175 | public DictionaryEntries getDicAttachmentFileType(String code){ | 175 | public DictionaryEntries getDicAttachmentFileType(String code){ |
| 176 | return this.getDicEntries(DictionaryConstants.ATTACHMENT_FILE_TYPE,code); | 176 | return this.getDicEntries(DictionaryConstants.ATTACHMENT_FILE_TYPE,code); |
| 177 | } | 177 | } |
| 178 | + | ||
| 179 | + /** | ||
| 180 | + * @Author mt | ||
| 181 | + * @Description 功能说明 根据code获取Imp001推送状态指定字典项 | ||
| 182 | + * @Date 2024/11/7 | ||
| 183 | + * @param code | ||
| 184 | + * @return com.fedex.connect.common.model.bi.DictionaryEntries | ||
| 185 | + */ | ||
| 186 | + public DictionaryEntries getDicPushObStatus(String code){ | ||
| 187 | + return this.getDicEntries(DictionaryConstants.PUSH_OB_STATUS,code); | ||
| 188 | + } | ||
| 178 | } | 189 | } |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -22,4 +22,6 @@ public interface DictionaryConstants { | ... | @@ -22,4 +22,6 @@ public interface DictionaryConstants { |
| 22 | String ATTACHMENT_BIZ_TYPE = "ATTACHMENT_BIZ_TYPE"; | 22 | String ATTACHMENT_BIZ_TYPE = "ATTACHMENT_BIZ_TYPE"; |
| 23 | //附件文件类型 | 23 | //附件文件类型 |
| 24 | String ATTACHMENT_FILE_TYPE = "ATTACHMENT_FILE_TYPE"; | 24 | String ATTACHMENT_FILE_TYPE = "ATTACHMENT_FILE_TYPE"; |
| 25 | + //Imp001推送状态 | ||
| 26 | + String PUSH_OB_STATUS = "PUSH_OB_STATUS"; | ||
| 25 | } | 27 | } | ... | ... |
| 1 | package com.fedex.connect.common.dependencies.enums.biz; | 1 | package com.fedex.connect.common.dependencies.enums.biz; |
| 2 | 2 | ||
| 3 | +/** | ||
| 4 | + * @Author mt | ||
| 5 | + * @Description 邮件推送状态 | ||
| 6 | + * @Date 2024/11/19 | ||
| 7 | + */ | ||
| 3 | public enum EmailStatusEnum { | 8 | public enum EmailStatusEnum { |
| 4 | PENDING(0L,"pending","待发送"), | 9 | PENDING(0L,"pending","待发送"), |
| 5 | SUCCESS(1L,"success","发送成功"), | 10 | SUCCESS(1L,"success","发送成功"), |
| 6 | FAILED(2L,"failed","发送失败"), | 11 | FAILED(2L,"failed","发送失败"), |
| 7 | - | ||
| 8 | ; | 12 | ; |
| 9 | 13 | ||
| 10 | - | ||
| 11 | private Long code; | 14 | private Long code; |
| 12 | private String enMsg; | 15 | private String enMsg; |
| 13 | private String msg; | 16 | private String msg; | ... | ... |
| 1 | package com.fedex.connect.common.dependencies.enums.biz; | 1 | package com.fedex.connect.common.dependencies.enums.biz; |
| 2 | 2 | ||
| 3 | +/** | ||
| 4 | + * @Author mt | ||
| 5 | + * @Description 邮件推送类型 | ||
| 6 | + * @Date 2024/11/19 | ||
| 7 | + */ | ||
| 3 | public enum EmailTypeEnum { | 8 | public enum EmailTypeEnum { |
| 4 | PUSH_CON_FILE(0L,"pushConFile","推送预清关文件"), | 9 | PUSH_CON_FILE(0L,"pushConFile","推送预清关文件"), |
| 5 | - | ||
| 6 | ; | 10 | ; |
| 7 | 11 | ||
| 8 | - | ||
| 9 | private Long code; | 12 | private Long code; |
| 10 | private String enMsg; | 13 | private String enMsg; |
| 11 | private String msg; | 14 | private String msg; | ... | ... |
| 1 | +package com.fedex.connect.common.dependencies.enums.biz; | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * @Author mt | ||
| 5 | + * @Description IMP001推送状态 | ||
| 6 | + * @Date 2024/11/19 | ||
| 7 | + */ | ||
| 8 | +public enum PushObStatusEnum { | ||
| 9 | + TO_BE_SENT("pushObStatus_01","To be sent","待推送"), | ||
| 10 | + PUSH_SUCCESSFUL("pushObStatus_02","Push successful","推送成功"), | ||
| 11 | + PUSH_FAILED("pushObStatus_03","Push failed","推送失败"), | ||
| 12 | + ; | ||
| 13 | + | ||
| 14 | + private String code; | ||
| 15 | + private String enMsg; | ||
| 16 | + private String msg; | ||
| 17 | + | ||
| 18 | + PushObStatusEnum(String code, String enMsg, String msg) { | ||
| 19 | + this.code = code; | ||
| 20 | + this.enMsg = enMsg; | ||
| 21 | + this.msg = msg; | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + public String getCode() { | ||
| 25 | + return code; | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + public void setCode(String code) { | ||
| 29 | + this.code = code; | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + public String getEnMsg() { | ||
| 33 | + return enMsg; | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + public void setEnMsg(String enMsg) { | ||
| 37 | + this.enMsg = enMsg; | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + public String getMsg() { | ||
| 41 | + return msg; | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + public void setMsg(String msg) { | ||
| 45 | + this.msg = msg; | ||
| 46 | + } | ||
| 47 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -18,7 +18,8 @@ public class EmailRepositoryImpl extends AbstractDaoRepository implements IEmail | ... | @@ -18,7 +18,8 @@ public class EmailRepositoryImpl extends AbstractDaoRepository implements IEmail |
| 18 | emailExtMapper.deleteById(id); | 18 | emailExtMapper.deleteById(id); |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | - public void save(Email entity){ | 21 | + @Override |
| 22 | + public void saveOrUpdate(Email entity){ | ||
| 22 | if(entity != null) { | 23 | if(entity != null) { |
| 23 | if (entity.getId() == null || entity.getId() <= 0) { | 24 | if (entity.getId() == null || entity.getId() <= 0) { |
| 24 | emailMapper.insertSelective(entity); | 25 | emailMapper.insertSelective(entity); | ... | ... |
| ... | @@ -3,5 +3,5 @@ package com.fedex.connect.task.repository.repo.log; | ... | @@ -3,5 +3,5 @@ package com.fedex.connect.task.repository.repo.log; |
| 3 | import com.fedex.connect.common.model.log.EmailHistory; | 3 | import com.fedex.connect.common.model.log.EmailHistory; |
| 4 | 4 | ||
| 5 | public interface IEmailHistoryRepository { | 5 | public interface IEmailHistoryRepository { |
| 6 | - void save(EmailHistory entity); | 6 | + void saveOrUpdate(EmailHistory entity); |
| 7 | } | 7 | } | ... | ... |
| ... | @@ -9,7 +9,7 @@ import org.springframework.stereotype.Repository; | ... | @@ -9,7 +9,7 @@ import org.springframework.stereotype.Repository; |
| 9 | public class EmailHistoryRepositoryImpl extends AbstractDaoRepository implements IEmailHistoryRepository { | 9 | public class EmailHistoryRepositoryImpl extends AbstractDaoRepository implements IEmailHistoryRepository { |
| 10 | 10 | ||
| 11 | @Override | 11 | @Override |
| 12 | - public void save(EmailHistory entity) { | 12 | + public void saveOrUpdate(EmailHistory entity) { |
| 13 | if(entity != null) { | 13 | if(entity != null) { |
| 14 | if (entity.getId() == null || entity.getId() <= 0) { | 14 | if (entity.getId() == null || entity.getId() <= 0) { |
| 15 | emailHistoryMapper.insertSelective(entity); | 15 | emailHistoryMapper.insertSelective(entity); | ... | ... |
| ... | @@ -10,6 +10,6 @@ import java.util.List; | ... | @@ -10,6 +10,6 @@ import java.util.List; |
| 10 | * 2022年11月3日15:30:53 | 10 | * 2022年11月3日15:30:53 |
| 11 | */ | 11 | */ |
| 12 | public interface IKafkaStorageHistoryRepository { | 12 | public interface IKafkaStorageHistoryRepository { |
| 13 | - KafkaStorageHistory save(KafkaStorageHistory entity); | 13 | + KafkaStorageHistory saveOrUpdate(KafkaStorageHistory entity); |
| 14 | - void saveAll(List<KafkaStorageHistory> list); | 14 | + void saveOrUpdateAll(List<KafkaStorageHistory> list); |
| 15 | } | 15 | } | ... | ... |
| ... | @@ -15,7 +15,7 @@ import java.util.List; | ... | @@ -15,7 +15,7 @@ import java.util.List; |
| 15 | @Repository | 15 | @Repository |
| 16 | public class KafkaStorageHistoryRepositoryImpl extends AbstractDaoRepository implements IKafkaStorageHistoryRepository { | 16 | public class KafkaStorageHistoryRepositoryImpl extends AbstractDaoRepository implements IKafkaStorageHistoryRepository { |
| 17 | @Override | 17 | @Override |
| 18 | - public KafkaStorageHistory save(KafkaStorageHistory entity){ | 18 | + public KafkaStorageHistory saveOrUpdate(KafkaStorageHistory entity){ |
| 19 | if(entity != null) { | 19 | if(entity != null) { |
| 20 | if (entity.getId() == null || entity.getId().longValue() <= 0) { | 20 | if (entity.getId() == null || entity.getId().longValue() <= 0) { |
| 21 | kafkaStorageHistoryMapper.insertSelective(entity); | 21 | kafkaStorageHistoryMapper.insertSelective(entity); |
| ... | @@ -27,7 +27,7 @@ public class KafkaStorageHistoryRepositoryImpl extends AbstractDaoRepository imp | ... | @@ -27,7 +27,7 @@ public class KafkaStorageHistoryRepositoryImpl extends AbstractDaoRepository imp |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | @Override | 29 | @Override |
| 30 | - public void saveAll(List<KafkaStorageHistory> list){ | 30 | + public void saveOrUpdateAll(List<KafkaStorageHistory> list){ |
| 31 | list.stream().forEach(p->{ | 31 | list.stream().forEach(p->{ |
| 32 | if(p.getId() == null || p.getId().longValue() <=0){ | 32 | if(p.getId() == null || p.getId().longValue() <=0){ |
| 33 | kafkaStorageHistoryMapper.insertSelective(p); | 33 | kafkaStorageHistoryMapper.insertSelective(p); | ... | ... |
-
Please register or login to post a comment