This commit is contained in:
caozehui
2024-12-20 13:46:07 +08:00
parent a81439b1d2
commit 603d5cdd5f
3 changed files with 20 additions and 2 deletions

View File

@@ -168,6 +168,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
child.put("id", adPlan.getId()); child.put("id", adPlan.getId());
child.put("pid", adPlan.getFatherPlanId()); child.put("pid", adPlan.getFatherPlanId());
child.put("name", adPlan.getName()); child.put("name", adPlan.getName());
child.put("timeCheck",adPlan.getTimeCheck());
children.add(child); children.add(child);
}); });
} }

View File

@@ -5,6 +5,7 @@ import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.common.pojo.exception.BusinessException; import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.gather.system.dictionary.mapper.DictTreeMapper; import com.njcn.gather.system.dictionary.mapper.DictTreeMapper;
import com.njcn.gather.system.dictionary.pojo.param.DictTreeParam; import com.njcn.gather.system.dictionary.pojo.param.DictTreeParam;
@@ -51,6 +52,7 @@ public class DictTreeServiceImpl extends ServiceImpl<DictTreeMapper, DictTree> i
@Override @Override
@Transactional(rollbackFor = {Exception.class}) @Transactional(rollbackFor = {Exception.class})
public boolean addDictTree(DictTreeParam dictTreeParam) { public boolean addDictTree(DictTreeParam dictTreeParam) {
checkRepeat(dictTreeParam,false);
boolean result; boolean result;
DictTree dictTree = new DictTree(); DictTree dictTree = new DictTree();
BeanUtils.copyProperties(dictTreeParam, dictTree); BeanUtils.copyProperties(dictTreeParam, dictTree);
@@ -73,6 +75,7 @@ public class DictTreeServiceImpl extends ServiceImpl<DictTreeMapper, DictTree> i
@Override @Override
@Transactional(rollbackFor = {Exception.class}) @Transactional(rollbackFor = {Exception.class})
public boolean updateDictTree(DictTreeParam.UpdateParam param) { public boolean updateDictTree(DictTreeParam.UpdateParam param) {
checkRepeat(param,true);
boolean result; boolean result;
DictTree dictTree = new DictTree(); DictTree dictTree = new DictTree();
BeanUtils.copyProperties(param, dictTree); BeanUtils.copyProperties(param, dictTree);
@@ -165,6 +168,20 @@ public class DictTreeServiceImpl extends ServiceImpl<DictTreeMapper, DictTree> i
// lambdaQueryWrapper.eq(DictTree::getState, DictConst.ENABLE).eq(DictTree::getType, type); // lambdaQueryWrapper.eq(DictTree::getState, DictConst.ENABLE).eq(DictTree::getType, type);
// return this.list(lambdaQueryWrapper); // return this.list(lambdaQueryWrapper);
// } // }
private void checkRepeat(DictTreeParam dictTreeParam,boolean isExcludeSelf){
LambdaQueryWrapper<DictTree> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(DictTree::getCode, dictTreeParam.getCode())
.eq(DictTree::getState, DataStateEnum.ENABLE.getCode());
if(isExcludeSelf){
if(dictTreeParam instanceof DictTreeParam.UpdateParam){
wrapper.ne(DictTree::getId, ((DictTreeParam.UpdateParam) dictTreeParam).getId());
}
}
int count = this.count(wrapper);
if (count > 0) {
throw new BusinessException(SystemResponseEnum.CODE_REPEAT);
}
}
private List<DictTree> filterTreeByName(List<DictTree> tree, String keyword) { private List<DictTree> filterTreeByName(List<DictTree> tree, String keyword) {
if (CollectionUtils.isEmpty(tree) || !StrUtil.isNotBlank(keyword)) { if (CollectionUtils.isEmpty(tree) || !StrUtil.isNotBlank(keyword)) {

View File

@@ -64,8 +64,8 @@ public enum SystemResponseEnum {
LOG_EXCEPTION_TIME("A0302", "导入旧日志文件异常:缺少时间范围"), LOG_EXCEPTION_TIME("A0302", "导入旧日志文件异常:缺少时间范围"),
DELETE_DATA("A0303", "导入旧日志文件异常:删除数据失败"), DELETE_DATA("A0303", "导入旧日志文件异常:删除数据失败"),
MULTIPLE_CLICKS_LOG_FILE_WRITER("A0304", "当前文件备份数据未结束,请勿多次点击"), MULTIPLE_CLICKS_LOG_FILE_WRITER("A0304", "当前文件备份数据未结束,请勿多次点击"),
MULTIPLE_CLICKS_RECOVER_LOG_FILE("A0303", "当前文件恢复数据未结束,请勿多次点击") MULTIPLE_CLICKS_RECOVER_LOG_FILE("A0303", "当前文件恢复数据未结束,请勿多次点击"),
; CODE_REPEAT("A0305","编码重复" );
private final String code; private final String code;