This commit is contained in:
dzc committed 2026-07-07 20:01:55 +08:00
1 parent df41665efc
commit bce1885ccf
1 file changed
+8 -7
@@ -50,8 +50,8 @@ public class ThirdPushConfServiceImpl extends ServiceImpl<ThirdPushConfMapper, T
if (entity == null) {
return false;
}
if (existTitle(entity)) {
throw new RuntimeException("推送标题不能重复");
if (existInformSchedule(entity)) {
throw new RuntimeException("同一业务下通知类型和通知时间不能重复");
}
validateCron(entity);
boolean saved = save(entity);
@@ -73,8 +73,8 @@ public class ThirdPushConfServiceImpl extends ServiceImpl<ThirdPushConfMapper, T
if (entity == null || entity.getId() == null) {
return false;
}
if (existTitle(entity)) {
throw new RuntimeException("推送标题不能重复");
if (existInformSchedule(entity)) {
throw new RuntimeException("同一业务下通知类型和通知时间不能重复");
}
ThirdPushConfEntity oldEntity = getById(entity.getId());
if (oldEntity == null) {
@@ -116,13 +116,14 @@ public class ThirdPushConfServiceImpl extends ServiceImpl<ThirdPushConfMapper, T
}
/**
* 标题不能重复(同 bizType + bizId 下)
* 同一 bizType + bizId 下,通知类型和通知时间不能重复
*/
private boolean existTitle(ThirdPushConfEntity dto) {
private boolean existInformSchedule(ThirdPushConfEntity dto) {
Long count = baseMapper.selectCount(new LambdaQueryWrapper<ThirdPushConfEntity>()
.eq(ObjectUtil.isNotEmpty(dto.getTitle()), ThirdPushConfEntity::getTitle, dto.getTitle())
.eq(ObjectUtil.isNotEmpty(dto.getBizType()), ThirdPushConfEntity::getBizType, dto.getBizType())
.eq(ObjectUtil.isNotEmpty(dto.getBizId()), ThirdPushConfEntity::getBizId, dto.getBizId())
.eq(ObjectUtil.isNotEmpty(dto.getInformType()), ThirdPushConfEntity::getInformType, dto.getInformType())
.eq(ObjectUtil.isNotEmpty(dto.getInformTime()), ThirdPushConfEntity::getInformTime, dto.getInformTime())
.ne(ObjectUtil.isNotEmpty(dto.getId()), ThirdPushConfEntity::getId, dto.getId())
);
if (ObjectUtil.isNotEmpty(dto.getId())) {