diff --git a/detection/src/main/java/com/njcn/gather/plan/service/impl/AdPlanServiceImpl.java b/detection/src/main/java/com/njcn/gather/plan/service/impl/AdPlanServiceImpl.java index 62f83058..11b02c17 100644 --- a/detection/src/main/java/com/njcn/gather/plan/service/impl/AdPlanServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/plan/service/impl/AdPlanServiceImpl.java @@ -168,6 +168,7 @@ public class AdPlanServiceImpl extends ServiceImpl impleme child.put("id", adPlan.getId()); child.put("pid", adPlan.getFatherPlanId()); child.put("name", adPlan.getName()); + child.put("timeCheck",adPlan.getTimeCheck()); children.add(child); }); } diff --git a/system/src/main/java/com/njcn/gather/system/dictionary/service/impl/DictTreeServiceImpl.java b/system/src/main/java/com/njcn/gather/system/dictionary/service/impl/DictTreeServiceImpl.java index 2758739d..dddd9568 100644 --- a/system/src/main/java/com/njcn/gather/system/dictionary/service/impl/DictTreeServiceImpl.java +++ b/system/src/main/java/com/njcn/gather/system/dictionary/service/impl/DictTreeServiceImpl.java @@ -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.QueryWrapper; 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.gather.system.dictionary.mapper.DictTreeMapper; import com.njcn.gather.system.dictionary.pojo.param.DictTreeParam; @@ -51,6 +52,7 @@ public class DictTreeServiceImpl extends ServiceImpl i @Override @Transactional(rollbackFor = {Exception.class}) public boolean addDictTree(DictTreeParam dictTreeParam) { + checkRepeat(dictTreeParam,false); boolean result; DictTree dictTree = new DictTree(); BeanUtils.copyProperties(dictTreeParam, dictTree); @@ -73,6 +75,7 @@ public class DictTreeServiceImpl extends ServiceImpl i @Override @Transactional(rollbackFor = {Exception.class}) public boolean updateDictTree(DictTreeParam.UpdateParam param) { + checkRepeat(param,true); boolean result; DictTree dictTree = new DictTree(); BeanUtils.copyProperties(param, dictTree); @@ -165,6 +168,20 @@ public class DictTreeServiceImpl extends ServiceImpl i // lambdaQueryWrapper.eq(DictTree::getState, DictConst.ENABLE).eq(DictTree::getType, type); // return this.list(lambdaQueryWrapper); // } + private void checkRepeat(DictTreeParam dictTreeParam,boolean isExcludeSelf){ + LambdaQueryWrapper 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 filterTreeByName(List tree, String keyword) { if (CollectionUtils.isEmpty(tree) || !StrUtil.isNotBlank(keyword)) { diff --git a/system/src/main/java/com/njcn/gather/system/pojo/enums/SystemResponseEnum.java b/system/src/main/java/com/njcn/gather/system/pojo/enums/SystemResponseEnum.java index f4a296e8..ae3c049c 100644 --- a/system/src/main/java/com/njcn/gather/system/pojo/enums/SystemResponseEnum.java +++ b/system/src/main/java/com/njcn/gather/system/pojo/enums/SystemResponseEnum.java @@ -64,8 +64,8 @@ public enum SystemResponseEnum { LOG_EXCEPTION_TIME("A0302", "导入旧日志文件异常:缺少时间范围"), DELETE_DATA("A0303", "导入旧日志文件异常:删除数据失败"), 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;