|
@@ -159,6 +159,7 @@ public class IndicatorServiceImpl extends ServiceImpl<IndicatorMapper, Indicator
|
|
if (null == dto2.getChildCode() || "".equals(dto2.getChildCode().trim()) || null == dto2.getChildName() || "".equals(dto2.getChildName().trim())) {
|
|
if (null == dto2.getChildCode() || "".equals(dto2.getChildCode().trim()) || null == dto2.getChildName() || "".equals(dto2.getChildName().trim())) {
|
|
throw new CustomException("子指标名或编码为空");
|
|
throw new CustomException("子指标名或编码为空");
|
|
}
|
|
}
|
|
|
|
+ List<IndicatorDictionary> indicatorDictionaryList = new ArrayList<>();
|
|
for (IndicatorDictionary i : dto2.getList()) {
|
|
for (IndicatorDictionary i : dto2.getList()) {
|
|
|
|
|
|
IndicatorDictionary indicatorDictionary = new IndicatorDictionary();
|
|
IndicatorDictionary indicatorDictionary = new IndicatorDictionary();
|
|
@@ -167,40 +168,58 @@ public class IndicatorServiceImpl extends ServiceImpl<IndicatorMapper, Indicator
|
|
String formula = decode.replaceAll(" ", "+");
|
|
String formula = decode.replaceAll(" ", "+");
|
|
|
|
|
|
QueryWrapper<IndicatorDictionary> qw = new QueryWrapper<>();
|
|
QueryWrapper<IndicatorDictionary> qw = new QueryWrapper<>();
|
|
- qw.lambda().eq(IndicatorDictionary::getIndicatorId, dto.getId());
|
|
|
|
- qw.lambda().eq(IndicatorDictionary::getChildCode, dto2.getChildCode());
|
|
|
|
- qw.lambda().eq(IndicatorDictionary::getOptionCode, i.getOptionCode());
|
|
|
|
- qw.lambda().eq(IndicatorDictionary::getDelFlag, "1");
|
|
|
|
- List<IndicatorDictionary> list2 = indicatorDictionaryMapper.selectList(qw);
|
|
|
|
-
|
|
|
|
- if (null != list2 && list2.size() > 0) {
|
|
|
|
- if (null == i.getId()) {
|
|
|
|
|
|
+ if (null == i.getId() || "".equals(i.getId().trim())) {
|
|
|
|
+ qw.lambda().eq(IndicatorDictionary::getIndicatorId, dto.getId());
|
|
|
|
+ qw.lambda().eq(IndicatorDictionary::getChildCode, dto2.getChildCode());
|
|
|
|
+ qw.lambda().eq(IndicatorDictionary::getOptionCode, i.getOptionCode());
|
|
|
|
+ qw.lambda().eq(IndicatorDictionary::getFormula, i.getFormula());
|
|
|
|
+ qw.lambda().eq(IndicatorDictionary::getDelFlag, "1");
|
|
|
|
+ List<IndicatorDictionary> list = indicatorDictionaryMapper.selectList(qw);
|
|
|
|
+ if (list.size() > 0) {
|
|
throw new CustomException("当前属性code已存在");
|
|
throw new CustomException("当前属性code已存在");
|
|
} else {
|
|
} else {
|
|
- for (IndicatorDictionary idic : list2){
|
|
|
|
- idic.setDelFlag("0");
|
|
|
|
- indicatorDictionaryService.updateById(idic);
|
|
|
|
|
|
+ indicatorDictionary.setIndicatorId(dto.getId());
|
|
|
|
+ indicatorDictionary.setChildName(dto2.getChildName());
|
|
|
|
+ indicatorDictionary.setChildCode(dto2.getChildCode());
|
|
|
|
+ indicatorDictionary.setOptionName(null == CacheContext.ddNameMap.get(i.getOptionCode()) ? "未知属性" : CacheContext.ddNameMap.get(i.getOptionCode()));
|
|
|
|
+ indicatorDictionary.setOptionCode(i.getOptionCode());
|
|
|
|
+ indicatorDictionary.setOptionOrder(i.getOptionOrder());
|
|
|
|
+ indicatorDictionary.setCreateTime(new Date());
|
|
|
|
+ indicatorDictionary.setFormula(formula);
|
|
|
|
+ indicatorDictionary.setIsShow(i.getIsShow());
|
|
|
|
+ indicatorDictionary.setIsQuantified(i.getIsQuantified());
|
|
|
|
+ indicatorDictionary.setDelFlag("1");
|
|
|
|
+ indicatorDictionaryList.add(indicatorDictionary);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ qw.lambda().eq(IndicatorDictionary::getId, i.getId());
|
|
|
|
+ qw.lambda().eq(IndicatorDictionary::getDelFlag, "1");
|
|
|
|
+ List<IndicatorDictionary> list = indicatorDictionaryMapper.selectList(qw);
|
|
|
|
+ if (list.size() > 0) {
|
|
|
|
+ for (IndicatorDictionary idic : list) {
|
|
|
|
+ if (i.getIndicatorId().equals(idic.getIndicatorId()) && (!dto2.getChildCode().equals(idic.getChildCode()) || !i.getOptionCode().equals(idic.getOptionCode()) || !i.getFormula().equals(idic.getFormula()))) {
|
|
|
|
+ idic.setDelFlag("0");
|
|
|
|
+ indicatorDictionaryService.updateById(idic);
|
|
|
|
+ indicatorDictionary.setIndicatorId(dto.getId());
|
|
|
|
+ indicatorDictionary.setChildName(dto2.getChildName());
|
|
|
|
+ indicatorDictionary.setChildCode(dto2.getChildCode());
|
|
|
|
+ indicatorDictionary.setOptionName(null == CacheContext.ddNameMap.get(i.getOptionCode()) ? "未知属性" : CacheContext.ddNameMap.get(i.getOptionCode()));
|
|
|
|
+ indicatorDictionary.setOptionCode(i.getOptionCode());
|
|
|
|
+ indicatorDictionary.setOptionOrder(i.getOptionOrder());
|
|
|
|
+ indicatorDictionary.setCreateTime(new Date());
|
|
|
|
+ indicatorDictionary.setFormula(formula);
|
|
|
|
+ indicatorDictionary.setIsShow(i.getIsShow());
|
|
|
|
+ indicatorDictionary.setIsQuantified(i.getIsQuantified());
|
|
|
|
+ indicatorDictionary.setDelFlag("1");
|
|
|
|
+ indicatorDictionaryList.add(indicatorDictionary);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
- indicatorDictionary.setIndicatorId(dto.getId());
|
|
|
|
- indicatorDictionary.setChildName(dto2.getChildName());
|
|
|
|
- indicatorDictionary.setChildCode(dto2.getChildCode());
|
|
|
|
- indicatorDictionary.setOptionName(null == CacheContext.ddNameMap.get(i.getOptionCode()) ? "未知属性" : CacheContext.ddNameMap.get(i.getOptionCode()));
|
|
|
|
- indicatorDictionary.setOptionCode(i.getOptionCode());
|
|
|
|
- indicatorDictionary.setOptionOrder(i.getOptionOrder());
|
|
|
|
- indicatorDictionary.setDes(i.getDes());
|
|
|
|
- indicatorDictionary.setCreateTime(new Date());
|
|
|
|
- indicatorDictionary.setFormula(formula);
|
|
|
|
- indicatorDictionary.setIsShow(i.getIsShow());
|
|
|
|
- indicatorDictionary.setIsQuantified(i.getIsQuantified());
|
|
|
|
- indicatorDictionary.setDelFlag("1");
|
|
|
|
-
|
|
|
|
- b = indicatorDictionaryService.save(indicatorDictionary);
|
|
|
|
- if (!b) {
|
|
|
|
- throw new CustomException("指标明细存失败");
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
+ b = indicatorDictionaryService.saveBatch(indicatorDictionaryList);
|
|
|
|
+ if (!b) {
|
|
|
|
+ throw new CustomException("指标明细存失败");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return b;
|
|
return b;
|