tao.mo

biz-customer | 修改 | save跟savelAll方法调整名称为saveOrUpdate

mt
2024年11月20日10:08:18
Showing 28 changed files with 323 additions and 103 deletions
package com.fedex.connect.customer.repository.base;
import com.fedex.connect.common.dao.biz.AttachmentMapper;
import com.fedex.connect.common.dao.biz.ConsignmentMapper;
import com.fedex.connect.common.dao.biz.UploadRecordMapper;
import com.fedex.connect.common.dao.biz.UserConsignmentMappingMapper;
import com.fedex.connect.common.dao.biz.*;
import com.fedex.connect.customer.repository.dao.AttachmentExtMapper;
import com.fedex.connect.customer.repository.dao.ConsignmentExtMapper;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -18,7 +15,9 @@ public class BaseDao {
@Autowired
protected UserConsignmentMappingMapper userConsignmentMappingMapper;
@Autowired
protected PushObMapper pushObMapper;
@Autowired
protected ConsignmentExtMapper consignmentExtMapper;
@Autowired
protected AttachmentExtMapper attachmentExtMapper;
}
}
\ No newline at end of file
......
......@@ -12,7 +12,7 @@ public interface IAttachmentRepository {
Attachment queryInfo(UserConsignmentInfoQuery userConsignmentInfoQuery);
Attachment save(Attachment entity);
Attachment saveOrUpdate(Attachment entity);
void saveAll(List<Attachment> list);
void saveOrUpdateAll(List<Attachment> list);
}
\ No newline at end of file
......
......@@ -20,7 +20,7 @@ public interface IConsignmentRepository {
Consignment findConsignmentInfo(UserConsignmentInfoQuery consignmentInfoQuery);
Consignment save(Consignment entity);
Consignment saveOrUpdate(Consignment entity);
void saveAll(List<Consignment> list);
void saveOrUpdateAll(List<Consignment> list);
}
......
package com.fedex.connect.customer.repository.repo;
import com.fedex.connect.common.model.biz.PushOb;
import java.util.List;
public interface IPushObRepository {
/**
* @Author mt
* @Description 推送进口文件主表保存或更新
* @Date 2024/11/19
* @param entity
* @return com.fedex.connect.common.model.biz.PushOb
*/
PushOb saveOrUpdate(PushOb entity);
/**
* @Author mt
* @Description 推送进口文件主表批量保存或更新
* @Date 2024/11/19
* @param list
* @return void
*/
void saveOrUpdateAll(List<PushOb> list);
}
\ No newline at end of file
......@@ -12,7 +12,7 @@ public interface IUploadRecordRepository {
* @param entity
* @return com.fedex.connect.common.model.biz.UploadRecord
*/
UploadRecord save(UploadRecord entity);
UploadRecord saveOrUpdate(UploadRecord entity);
/**
* @Author mt
* @Description 上传记录批量保存或更新
......@@ -20,5 +20,5 @@ public interface IUploadRecordRepository {
* @param list
* @return void
*/
void saveAll(List<UploadRecord> list);
void saveOrUpdateAll(List<UploadRecord> list);
}
......
......@@ -21,7 +21,7 @@ public interface IUserConsignmentMappingRepository {
* @param entity
* @return com.fedex.connect.common.model.biz.UserConsignmentMapping
*/
UserConsignmentMapping save(UserConsignmentMapping entity);
UserConsignmentMapping saveOrUpdate(UserConsignmentMapping entity);
/**
* @Author mt
* @Description 用户与运单映射信息批量保存或更新
......@@ -29,5 +29,5 @@ public interface IUserConsignmentMappingRepository {
* @param list
* @return void
*/
void saveAll(List<UserConsignmentMapping> list);
void saveOrUpdateAll(List<UserConsignmentMapping> list);
}
......
......@@ -31,7 +31,7 @@ public class AttachmentRepositoryImpl extends BaseDao implements IAttachmentRepo
}
@Override
public Attachment save(Attachment entity) {
public Attachment saveOrUpdate(Attachment entity) {
if(entity != null) {
if (entity.getId() == null || entity.getId().longValue() <= 0) {
attachmentMapper.insertSelective(entity);
......@@ -43,7 +43,7 @@ public class AttachmentRepositoryImpl extends BaseDao implements IAttachmentRepo
}
@Override
public void saveAll(List<Attachment> list) {
public void saveOrUpdateAll(List<Attachment> list) {
list.stream().forEach(p->{
if(p.getId() == null || p.getId().longValue() <=0){
attachmentMapper.insertSelective(p);
......
......@@ -64,7 +64,7 @@ public class ConsignmentRepositoryImpl extends BaseDao implements IConsignmentRe
}
@Override
public Consignment save(Consignment entity) {
public Consignment saveOrUpdate(Consignment entity) {
if(entity != null) {
if (entity.getId() == null || entity.getId().longValue() <= 0) {
consignmentMapper.insertSelective(entity);
......@@ -76,7 +76,7 @@ public class ConsignmentRepositoryImpl extends BaseDao implements IConsignmentRe
}
@Override
public void saveAll(List<Consignment> list) {
public void saveOrUpdateAll(List<Consignment> list) {
list.stream().forEach(p->{
if(p.getId() == null || p.getId().longValue() <=0){
consignmentMapper.insertSelective(p);
......
package com.fedex.connect.customer.repository.repo.impl;
import com.fedex.connect.common.model.biz.PushOb;
import com.fedex.connect.customer.repository.base.BaseDao;
import com.fedex.connect.customer.repository.repo.IPushObRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public class PushObRepositoryImpl extends BaseDao implements IPushObRepository {
@Override
public PushOb saveOrUpdate(PushOb entity) {
if(entity != null) {
if (entity.getId() == null || entity.getId().longValue() <= 0) {
pushObMapper.insertSelective(entity);
} else if (entity.getId() != null && entity.getId().longValue() > 0){
pushObMapper.updateByPrimaryKeySelective(entity);
}
}
return entity;
}
@Override
public void saveOrUpdateAll(List<PushOb> list) {
list.stream().forEach(p->{
if(p.getId() == null || p.getId().longValue() <=0){
pushObMapper.insertSelective(p);
}else if(p.getId() != null && p.getId().longValue() >0){
pushObMapper.updateByPrimaryKeySelective(p);
}
});
}
}
\ No newline at end of file
......@@ -10,7 +10,7 @@ import java.util.List;
@Repository
public class UploadRecordRepositoryImpl extends BaseDao implements IUploadRecordRepository {
@Override
public UploadRecord save(UploadRecord entity) {
public UploadRecord saveOrUpdate(UploadRecord entity) {
if(entity != null) {
if (entity.getId() == null || entity.getId().longValue() <= 0) {
uploadRecordMapper.insertSelective(entity);
......@@ -22,7 +22,7 @@ public class UploadRecordRepositoryImpl extends BaseDao implements IUploadRecord
}
@Override
public void saveAll(List<UploadRecord> list) {
public void saveOrUpdateAll(List<UploadRecord> list) {
list.stream().forEach(p->{
if(p.getId() == null || p.getId().longValue() <=0){
uploadRecordMapper.insertSelective(p);
......
......@@ -42,7 +42,7 @@ public class UserConsignmentMappingRepositoryImpl extends BaseDao implements IUs
}
@Override
public void saveAll(List<UserConsignmentMapping> list) {
public void saveOrUpdateAll(List<UserConsignmentMapping> list) {
list.stream().forEach(p->{
if(p.getId() == null || p.getId().longValue() <=0){
userConsignmentMappingMapper.insertSelective(p);
......
package com.fedex.connect.customer.service.base;
import com.fedex.connect.common.dependencies.util.ResponseUtils;
import com.fedex.connect.customer.repository.repo.IAttachmentRepository;
import com.fedex.connect.customer.repository.repo.IConsignmentRepository;
import com.fedex.connect.customer.repository.repo.IUploadRecordRepository;
import com.fedex.connect.customer.repository.repo.IUserConsignmentMappingRepository;
import com.fedex.connect.customer.repository.repo.*;
import org.springframework.beans.factory.annotation.Autowired;
public class BaseService {
......@@ -18,4 +15,6 @@ public class BaseService {
protected IUploadRecordRepository uploadRecordRepository;
@Autowired
protected IUserConsignmentMappingRepository userConsignmentMappingRepository;
@Autowired
protected IPushObRepository pushObRepository;
}
\ No newline at end of file
......
......@@ -4,10 +4,7 @@ import com.fedex.connect.common.dependencies.date.vo.ResponseVo;
import com.fedex.connect.common.dependencies.enums.base.StatusEnum;
import com.fedex.connect.common.dependencies.util.AssignmentFieldUtils;
import com.fedex.connect.common.dependencies.util.ResponseUtils;
import com.fedex.connect.common.model.biz.Attachment;
import com.fedex.connect.common.model.biz.Consignment;
import com.fedex.connect.common.model.biz.UploadRecord;
import com.fedex.connect.common.model.biz.UserConsignmentMapping;
import com.fedex.connect.common.model.biz.*;
import com.fedex.connect.common.model.sys.User;
import com.fedex.connect.customer.data.bo.AddBo;
import com.fedex.connect.customer.data.bo.ConsignmentBo;
......@@ -16,7 +13,9 @@ import com.fedex.connect.customer.service.base.BaseService;
import com.fedex.connect.customer.service.biz.IAttachmentService;
import com.fedex.connect.customer.service.biz.IConsignmentService;
import com.fedex.connect.customer.util.service.biz.ConsignmentUtil;
import com.fedex.connect.customer.util.service.biz.PushObUtil;
import com.fedex.connect.customer.util.service.biz.UploadRecordUtil;
import com.fedex.connect.customer.util.service.biz.UserConsignmentMappingUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -42,6 +41,10 @@ public class ConsignmentServiceImpl extends BaseService implements IConsignmentS
@Autowired
private UploadRecordUtil uploadRecordUtil;
@Autowired
private UserConsignmentMappingUtil userConsignmentMappingUtil;
@Autowired
private PushObUtil pushObUtil;
@Autowired
private IAttachmentService attachmentService;
/**
......@@ -122,13 +125,7 @@ public class ConsignmentServiceImpl extends BaseService implements IConsignmentS
/**
* 保存运单相关信息
*/
this.saveSubmitInfo(consignment,attachmentList,uploadRecord,user);
/**
* 初始化插入预清关文件推送任务日志,szl添加
*/
/**
* 初始化插入预清关文件邮件推送日志,mt添加
*/
this.submitInfo(consignment,attachmentList,uploadRecord,user);
}catch(Exception ex){
/**
* 提交异常,需要删除对应已上传附件
......@@ -150,7 +147,7 @@ public class ConsignmentServiceImpl extends BaseService implements IConsignmentS
* @return void
*/
@Transactional(rollbackFor = Exception.class)
public void saveSubmitInfo(Consignment consignment,
public void submitInfo(Consignment consignment,
List<Attachment> attachmentList,
UploadRecord uploadRecord,
User user) throws Exception{
......@@ -180,13 +177,27 @@ public class ConsignmentServiceImpl extends BaseService implements IConsignmentS
*/
UserConsignmentMapping userConsignmentMapping = userConsignmentMappingRepository.findByUserIdConsignmentId(user.getId(),consignment.getId());
if(Objects.isNull(userConsignmentMapping)){
userConsignmentMapping = new UserConsignmentMapping();
userConsignmentMapping.setUserId(user.getId());
userConsignmentMapping.setConsignmentId(consignment.getId());
userConsignmentMapping.setStatus(StatusEnum.YES.getCode());
AssignmentFieldUtils.assignmentTableBaseField(userConsignmentMapping);
/**
* 初始化插入预清关文件推送任务日志
*/
userConsignmentMapping = userConsignmentMappingUtil.initUserConsignmentMapping(user.getId(),consignment.getId());
/**
* 初始化插入预清关文件推送任务日志
*/
userConsignmentMappingRepository.save(userConsignmentMapping);
}
}
/**
* Todo 初始化插入预清关文件推送任务日志,szl添加
*/
/**
* 初始化插入预清关文件邮件推送日志,mt添加
*/
PushOb pushOb = pushObUtil.initPushOb(consignment,user);
/**
* 推送进口文件主表
*/
pushObRepository.save(pushOb);
}
}
\ No newline at end of file
......
......@@ -53,7 +53,7 @@ public class AttachmentUtil {
DictionaryEntries attachmentBizTypeEntries = cacheSystem.getDicAttachmentBizType(bizType);
attachment.setBizTypeCode(attachmentBizTypeEntries.getCode());
attachment.setBizTypeName(attachmentBizTypeEntries.getDescription());
DictionaryEntries attachmentFileTypeEntries = cacheSystem.getDicAttachmentBizType(AttachmentFileTypeEnum.FILE.getCode());
DictionaryEntries attachmentFileTypeEntries = cacheSystem.getDicAttachmentFileType(AttachmentFileTypeEnum.FILE.getCode());
attachment.setFileTypeCode(attachmentFileTypeEntries.getCode());
attachment.setFileTypeName(attachmentFileTypeEntries.getDescription());
attachment.setStatus(StatusEnum.YES.getCode());
......
......@@ -4,6 +4,7 @@ import com.fedex.connect.common.dependencies.cache.CacheSystem;
import com.fedex.connect.common.dependencies.contants.DigitConstants;
import com.fedex.connect.common.dependencies.date.vo.ResponseVo;
import com.fedex.connect.common.dependencies.enums.biz.ConsignmentStatusEnum;
import com.fedex.connect.common.dependencies.util.AssignmentFieldUtils;
import com.fedex.connect.common.dependencies.util.ResponseUtils;
import com.fedex.connect.common.model.bi.DictionaryEntries;
import com.fedex.connect.common.model.biz.Consignment;
......@@ -36,6 +37,59 @@ public class ConsignmentUtil {
IConsignmentRepository consignmentRepository;
/**
* @Author mt
* @Description 初始化运单表信息
* @Date 2024/11/15
* @param consignmentBo
* @param user
* @return void
*/
public Consignment initConsignment(ConsignmentBo consignmentBo, User user){
Consignment consignment = consignmentRepository.findById(consignmentBo.getConsignmentId());
DictionaryEntries consignmentStatusDic = cacheSystem.getDicConsignmentStatus(ConsignmentStatusEnum.CONSIGNMENT_STATUS_01.getCode());
try {
Date nowDate = new Date();
//如果没有运单id,则是通过add添加进来的运单
if (Objects.isNull(consignment)) {
consignment = new Consignment();
//用户录入数据拷贝
BeanUtils.copyProperties(consignmentBo, consignment);
//用户录入shipperaccount
consignment.setUserInputShipperAccount(consignmentBo.getShipperAccount());
//始发国名称
consignment.setUserInputOriginCountry(consignmentBo.getOriginCountry());
//始发国编码
consignment.setUserInputOriginCountryCode(consignmentBo.getOriginCountryCode());
/******提交信息记录******/
consignment.setFirstSubmitTime(nowDate);
consignment.setFirstSubmitter(user.getUserName());
consignment.setFirstSubmitterId(user.getId());
consignment.setCreateTime(nowDate);
consignment.setCreateUserName(user.getUserName());
consignment.setCreateUserId(user.getId());
} else {
consignment.setModifyTime(nowDate);
consignment.setModifyUserName(user.getUserName());
consignment.setModifyUserId(user.getId());
}
//记录当前提交人信息
consignment.setSubmitTime(nowDate);
consignment.setSubmitter(user.getUserName());
consignment.setSubmitterId(user.getId());
//记录当前提交运单状态
consignment.setStatusCode(consignmentStatusDic.getCode());
consignment.setStatusName(consignmentStatusDic.getDescription());
/**
* 初始化基础字段
*/
AssignmentFieldUtils.assignmentTableBaseField(consignment);
}catch(Exception ex){
responseUtils.fail(ResponseCode.MESSAGE_CODE_30014,ex);
}
return consignment;
}
/**
* @Author Szl
* @Description 功能说明 不存在501的运单add时判断该运单是否为自己的运单
* @Date 2024/11/12
......@@ -125,53 +179,4 @@ public class ConsignmentUtil {
private boolean isShipperAccountMatch(String account1, String account2) {
return StringUtils.hasText(account1) && StringUtils.hasText(account2) && account1.equals(account2);
}
/**
* @Author mt
* @Description 初始化运单表信息
* @Date 2024/11/15
* @param consignmentBo
* @param user
* @return void
*/
public Consignment initConsignment(ConsignmentBo consignmentBo, User user){
Consignment consignment = consignmentRepository.findById(consignmentBo.getConsignmentId());
DictionaryEntries consignmentStatusDic = cacheSystem.getDicConsignmentStatus(ConsignmentStatusEnum.CONSIGNMENT_STATUS_01.getCode());
try {
Date nowDate = new Date();
//如果没有运单id,则是通过add添加进来的运单
if (Objects.isNull(consignment)) {
consignment = new Consignment();
//用户录入数据拷贝
BeanUtils.copyProperties(consignmentBo, consignment);
//用户录入shipperaccount
consignment.setUserInputShipperAccount(consignmentBo.getShipperAccount());
//始发国名称
consignment.setUserInputOriginCountry(consignmentBo.getOriginCountry());
//始发国编码
consignment.setUserInputOriginCountryCode(consignmentBo.getOriginCountryCode());
/******提交信息记录******/
consignment.setFirstSubmitTime(nowDate);
consignment.setFirstSubmitter(user.getUserName());
consignment.setFirstSubmitterId(user.getId());
consignment.setCreateTime(nowDate);
consignment.setCreateUserName(user.getUserName());
consignment.setCreateUserId(user.getId());
} else {
consignment.setModifyTime(nowDate);
consignment.setModifyUserName(user.getUserName());
consignment.setModifyUserId(user.getId());
}
//记录当前提交人信息
consignment.setSubmitTime(nowDate);
consignment.setSubmitter(user.getUserName());
consignment.setSubmitterId(user.getId());
//记录当前提交运单状态
consignment.setStatusCode(consignmentStatusDic.getCode());
consignment.setStatusName(consignmentStatusDic.getDescription());
}catch(Exception ex){
responseUtils.fail(ResponseCode.MESSAGE_CODE_30014,ex);
}
return consignment;
}
}
......
package com.fedex.connect.customer.util.service.biz;
import com.fedex.connect.common.dependencies.cache.CacheSystem;
import com.fedex.connect.common.dependencies.contants.DigitConstants;
import com.fedex.connect.common.dependencies.enums.biz.PushObStatusEnum;
import com.fedex.connect.common.dependencies.util.AssignmentFieldUtils;
import com.fedex.connect.common.model.bi.DictionaryEntries;
import com.fedex.connect.common.model.biz.Consignment;
import com.fedex.connect.common.model.biz.PushOb;
import com.fedex.connect.common.model.sys.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* @Author mt
* @Description 推送Imp001操作util
* @Date 2024/11/19
*/
@Slf4j
@Component
public class PushObUtil {
@Autowired
CacheSystem cacheSystem;
/**
* @Author mt
* @Description 初始化插入预清关文件推送任务日志
* @Date 2024/11/19
* @param
* @return com.fedex.connect.common.model.biz.PushOb
*/
public PushOb initPushOb(Consignment consignment, User user) throws Exception{
DictionaryEntries pushObStatus = cacheSystem.getDicPushObStatus(PushObStatusEnum.TO_BE_SENT.getCode());
PushOb pushOb = new PushOb();
pushOb.setConsignmentId(consignment.getId());
pushOb.setConsignmentCode(consignment.getConsignmentCode());
pushOb.setPushNum(DigitConstants.DIGIT_ZERO_LONG);
pushOb.setStatusCode(pushObStatus.getCode());
pushOb.setStatusName(pushObStatus.getDescription());
pushOb.setCreateUserId(user.getId());
pushOb.setCreateUserName(user.getUserName());
pushOb.setModifyUserId(user.getId());
pushOb.setModifyUserName(user.getUserName());
/**
* 初始化基础字段
*/
AssignmentFieldUtils.assignmentTableBaseField(pushOb);
return pushOb;
}
}
\ No newline at end of file
package com.fedex.connect.customer.util.service.biz;
import com.fedex.connect.common.dependencies.enums.base.StatusEnum;
import com.fedex.connect.common.dependencies.util.AssignmentFieldUtils;
import com.fedex.connect.common.model.biz.UserConsignmentMapping;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* @Author mt
* @Description 用户运单映射表util
* @Date 2024/11/19
*/
@Slf4j
@Component
public class UserConsignmentMappingUtil {
/**
* @Author mt
* @Description 初始化用户运单映射表信息
* @Date 2024/11/19
* @param
* @return com.fedex.connect.common.model.biz.PushOb
*/
public UserConsignmentMapping initUserConsignmentMapping(Long userId,Long consignmentId) throws Exception{
UserConsignmentMapping userConsignmentMapping = new UserConsignmentMapping();
userConsignmentMapping.setUserId(userId);
userConsignmentMapping.setConsignmentId(consignmentId);
userConsignmentMapping.setStatus(StatusEnum.YES.getCode());
AssignmentFieldUtils.assignmentTableBaseField(userConsignmentMapping);
return userConsignmentMapping;
}
}
\ No newline at end of file
......@@ -175,4 +175,15 @@ public class CacheSystem implements CommandLineRunner {
public DictionaryEntries getDicAttachmentFileType(String code){
return this.getDicEntries(DictionaryConstants.ATTACHMENT_FILE_TYPE,code);
}
/**
* @Author mt
* @Description 功能说明 根据code获取Imp001推送状态指定字典项
* @Date 2024/11/7
* @param code
* @return com.fedex.connect.common.model.bi.DictionaryEntries
*/
public DictionaryEntries getDicPushObStatus(String code){
return this.getDicEntries(DictionaryConstants.PUSH_OB_STATUS,code);
}
}
\ No newline at end of file
......
......@@ -22,4 +22,6 @@ public interface DictionaryConstants {
String ATTACHMENT_BIZ_TYPE = "ATTACHMENT_BIZ_TYPE";
//附件文件类型
String ATTACHMENT_FILE_TYPE = "ATTACHMENT_FILE_TYPE";
//Imp001推送状态
String PUSH_OB_STATUS = "PUSH_OB_STATUS";
}
......
package com.fedex.connect.common.dependencies.enums.biz;
/**
* @Author mt
* @Description 邮件推送状态
* @Date 2024/11/19
*/
public enum EmailStatusEnum {
PENDING(0L,"pending","待发送"),
SUCCESS(1L,"success","发送成功"),
FAILED(2L,"failed","发送失败"),
;
private Long code;
private String enMsg;
private String msg;
......
package com.fedex.connect.common.dependencies.enums.biz;
/**
* @Author mt
* @Description 邮件推送类型
* @Date 2024/11/19
*/
public enum EmailTypeEnum {
PUSH_CON_FILE(0L,"pushConFile","推送预清关文件"),
;
private Long code;
private String enMsg;
private String msg;
......
package com.fedex.connect.common.dependencies.enums.biz;
/**
* @Author mt
* @Description IMP001推送状态
* @Date 2024/11/19
*/
public enum PushObStatusEnum {
TO_BE_SENT("pushObStatus_01","To be sent","待推送"),
PUSH_SUCCESSFUL("pushObStatus_02","Push successful","推送成功"),
PUSH_FAILED("pushObStatus_03","Push failed","推送失败"),
;
private String code;
private String enMsg;
private String msg;
PushObStatusEnum(String code, String enMsg, String msg) {
this.code = code;
this.enMsg = enMsg;
this.msg = msg;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getEnMsg() {
return enMsg;
}
public void setEnMsg(String enMsg) {
this.enMsg = enMsg;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
}
\ No newline at end of file
......@@ -9,5 +9,5 @@ public interface IEmailRepository {
void deleteById(Long id);
void save(Email entity);
void saveOrUpdate(Email entity);
}
......
......@@ -18,7 +18,8 @@ public class EmailRepositoryImpl extends AbstractDaoRepository implements IEmail
emailExtMapper.deleteById(id);
}
public void save(Email entity){
@Override
public void saveOrUpdate(Email entity){
if(entity != null) {
if (entity.getId() == null || entity.getId() <= 0) {
emailMapper.insertSelective(entity);
......
......@@ -3,5 +3,5 @@ package com.fedex.connect.task.repository.repo.log;
import com.fedex.connect.common.model.log.EmailHistory;
public interface IEmailHistoryRepository {
void save(EmailHistory entity);
void saveOrUpdate(EmailHistory entity);
}
......
......@@ -9,7 +9,7 @@ import org.springframework.stereotype.Repository;
public class EmailHistoryRepositoryImpl extends AbstractDaoRepository implements IEmailHistoryRepository {
@Override
public void save(EmailHistory entity) {
public void saveOrUpdate(EmailHistory entity) {
if(entity != null) {
if (entity.getId() == null || entity.getId() <= 0) {
emailHistoryMapper.insertSelective(entity);
......
......@@ -10,6 +10,6 @@ import java.util.List;
* 2022年11月3日15:30:53
*/
public interface IKafkaStorageHistoryRepository {
KafkaStorageHistory save(KafkaStorageHistory entity);
void saveAll(List<KafkaStorageHistory> list);
KafkaStorageHistory saveOrUpdate(KafkaStorageHistory entity);
void saveOrUpdateAll(List<KafkaStorageHistory> list);
}
......
......@@ -15,7 +15,7 @@ import java.util.List;
@Repository
public class KafkaStorageHistoryRepositoryImpl extends AbstractDaoRepository implements IKafkaStorageHistoryRepository {
@Override
public KafkaStorageHistory save(KafkaStorageHistory entity){
public KafkaStorageHistory saveOrUpdate(KafkaStorageHistory entity){
if(entity != null) {
if (entity.getId() == null || entity.getId().longValue() <= 0) {
kafkaStorageHistoryMapper.insertSelective(entity);
......@@ -27,7 +27,7 @@ public class KafkaStorageHistoryRepositoryImpl extends AbstractDaoRepository imp
}
@Override
public void saveAll(List<KafkaStorageHistory> list){
public void saveOrUpdateAll(List<KafkaStorageHistory> list){
list.stream().forEach(p->{
if(p.getId() == null || p.getId().longValue() <=0){
kafkaStorageHistoryMapper.insertSelective(p);
......