wangchangsheng il y a 2 ans
Parent
commit
718a7545c5

+ 9 - 9
ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/DataDictionaryServiceImpl.java

@@ -52,16 +52,16 @@ public class DataDictionaryServiceImpl extends ServiceImpl<DataDictionaryMapper,
 	public boolean saveOrUpdate(DataDictionary entity) {
 
 		//业务判断
-		QueryWrapper<DataDictionary> qw = new QueryWrapper<>();
-		qw.lambda().eq(DataDictionary::getDataKey, entity.getDataKey());
-		qw.lambda().eq(DataDictionary::getSuperKey, entity.getSuperKey());
-		List<DataDictionary> list = baseMapper.selectList(qw);
-		if (null != list && list.size() > 0) {
-			throw new RuntimeException("当前字典key已存在");
-		}
-		if (null != entity &&  (null == entity.getId() || "".equals(entity.getId().trim()))){
+		if (null != entity && (null == entity.getId() || "".equals(entity.getId().trim()))) {
+			QueryWrapper<DataDictionary> qw = new QueryWrapper<>();
+			qw.lambda().eq(DataDictionary::getDataKey, entity.getDataKey());
+			qw.lambda().eq(DataDictionary::getSuperKey, entity.getSuperKey());
+			List<DataDictionary> list = baseMapper.selectList(qw);
+			if (null != list && list.size() > 0) {
+				throw new RuntimeException("当前字典key已存在");
+			}
 			entity.setUpdateTime(new Date());
-		}else {
+		} else {
 			entity.setCreateTime(new Date());
 		}
 		return super.saveOrUpdate(entity);

+ 13 - 11
ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/EvaluateRuleServiceImpl.java

@@ -29,8 +29,8 @@ public class EvaluateRuleServiceImpl extends ServiceImpl<EvaluateRuleMapper, Eva
 	public IPage<EvaluateRule> list(Integer pageNum, Integer pageSize, String id, String des, String indicatorId, String evaluateMethod) {
 
 		QueryWrapper<EvaluateRule> qw = new QueryWrapper<>();
-		if (null == pageNum || null == pageSize ){
-			throw  new RuntimeException("分页参数为空");
+		if (null == pageNum || null == pageSize) {
+			throw new RuntimeException("分页参数为空");
 		}
 		//构造分页构造器
 		Page<EvaluateRule> page = new Page<>(pageNum, pageSize);
@@ -54,24 +54,26 @@ public class EvaluateRuleServiceImpl extends ServiceImpl<EvaluateRuleMapper, Eva
 
 		qw.lambda().orderByAsc(EvaluateRule::getId);
 
-		IPage<EvaluateRule>  list = baseMapper.selectPage(page,qw);
+		IPage<EvaluateRule> list = baseMapper.selectPage(page, qw);
 
 		return list;
 	}
 
 	@Override
 	public boolean saveOrUpdate(EvaluateRule entity) {
-		QueryWrapper<EvaluateRule> qw = new QueryWrapper<>();
-		qw.lambda().eq(EvaluateRule::getIndicatorId, entity.getIndicatorId());
-		List<EvaluateRule> list = baseMapper.selectList(qw);
-		if (null !=list && list.size()>0){
-			throw  new RuntimeException("当前指标评分规则已存在");
-		}
-		if (null != entity &&  (null == entity.getId() || "".equals(entity.getId().trim()))){
+
+		if (null != entity && (null == entity.getId() || "".equals(entity.getId().trim()))) {
+			QueryWrapper<EvaluateRule> qw = new QueryWrapper<>();
+			qw.lambda().eq(EvaluateRule::getIndicatorId, entity.getIndicatorId());
+			List<EvaluateRule> list = baseMapper.selectList(qw);
+			if (null != list && list.size() > 0) {
+				throw new RuntimeException("当前指标评分规则已存在");
+			}
 			entity.setUpdateTime(new Date());
-		}else {
+		} else {
 			entity.setCreateTime(new Date());
 		}
 		return super.saveOrUpdate(entity);
+
 	}
 }

+ 10 - 10
ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/IndicatorDictionaryServiceImpl.java

@@ -52,19 +52,19 @@ public class IndicatorDictionaryServiceImpl extends ServiceImpl<IndicatorDiction
 	@Override
 	public boolean saveOrUpdate(IndicatorDictionary entity) {
 
-		QueryWrapper<IndicatorDictionary> qw = new QueryWrapper<>();
-		qw.lambda().eq(IndicatorDictionary::getIndicatorId, entity.getIndicatorId());
-		qw.lambda().eq(IndicatorDictionary::getOptionCode, entity.getOptionCode());
-		List<IndicatorDictionary> list = baseMapper.selectList(qw);
-		if (null != list && list.size() > 0) {
-			throw new RuntimeException("当前属性code已存在");
-		}
-		if (null != entity &&  (null == entity.getId() || "".equals(entity.getId().trim()))){
+		if (null != entity && (null == entity.getId() || "".equals(entity.getId().trim()))) {
+			QueryWrapper<IndicatorDictionary> qw = new QueryWrapper<>();
+			qw.lambda().eq(IndicatorDictionary::getIndicatorId, entity.getIndicatorId());
+			qw.lambda().eq(IndicatorDictionary::getOptionCode, entity.getOptionCode());
+			List<IndicatorDictionary> list = baseMapper.selectList(qw);
+			if (null != list && list.size() > 0) {
+				throw new RuntimeException("当前属性code已存在");
+			}
 			entity.setUpdateTime(new Date());
-		}else {
+		} else {
 			entity.setCreateTime(new Date());
 		}
-		entity.setOptionName(null == CacheContext.ddNameMap.get(entity.getOptionCode())?"未知属性":CacheContext.ddNameMap.get(entity.getOptionCode()));
+		entity.setOptionName(null == CacheContext.ddNameMap.get(entity.getOptionCode()) ? "未知属性" : CacheContext.ddNameMap.get(entity.getOptionCode()));
 		return super.saveOrUpdate(entity);
 	}
 

+ 11 - 10
ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/IndicatorServiceImpl.java

@@ -76,20 +76,21 @@ public class IndicatorServiceImpl extends ServiceImpl<IndicatorMapper, Indicator
 	@Override
 	public boolean saveOrUpdate(Indicator entity) {
 
-		QueryWrapper<Indicator> qw = new QueryWrapper<>();
-		qw.lambda().eq(Indicator::getIndicatorCode, entity.getIndicatorCode());
-		qw.lambda().eq(Indicator::getBinSection, entity.getBinSection());
-		qw.lambda().eq(Indicator::getBinStage, entity.getBinStage());
-		List<Indicator> list = baseMapper.selectList(qw);
-		if (null != list && list.size() > 0) {
-			throw new RuntimeException("当前指标code已存在");
-		}
-		if (null != entity &&  (null == entity.getId() || "".equals(entity.getId().trim()))){
+		if (null != entity && (null == entity.getId() || "".equals(entity.getId().trim()))) {
+			QueryWrapper<Indicator> qw = new QueryWrapper<>();
+			qw.lambda().eq(Indicator::getIndicatorCode, entity.getIndicatorCode());
+			qw.lambda().eq(Indicator::getBinSection, entity.getBinSection());
+			qw.lambda().eq(Indicator::getBinStage, entity.getBinStage());
+			List<Indicator> list = baseMapper.selectList(qw);
+			if (null != list && list.size() > 0) {
+				throw new RuntimeException("当前指标code已存在");
+			}
 			entity.setUpdateTime(new Date());
-		}else {
+		} else {
 			entity.setCreateTime(new Date());
 		}
 		return super.saveOrUpdate(entity);
+
 	}