|
|
@@ -44,6 +44,7 @@ import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Objects; |
|
|
|
import java.util.stream.Collectors; |
|
|
@@ -100,9 +101,15 @@ public class IndicatorConfigManage { |
|
|
|
} |
|
|
|
ProjectIndexTemplateVO vo = BeanUtil.copyProperties(template, |
|
|
|
ProjectIndexTemplateVO.class); |
|
|
|
String projectTagIds = template.getProjectTagIds(); |
|
|
|
if (StringUtils.isNotBlank(projectTagIds)){ |
|
|
|
List<Long> proTagIdList = Arrays.stream(projectTagIds.split(StrPool.COMMA)).map(Long::valueOf).collect(Collectors.toList()); |
|
|
|
vo.setProjectTagIds(proTagIdList); |
|
|
|
} |
|
|
|
// 获取模版绩效指标详情 |
|
|
|
List<PerformanceIndicatorProjectTemplateDetail> templateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) |
|
|
|
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, id)); |
|
|
|
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, id) |
|
|
|
.eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional,Boolean.FALSE)); |
|
|
|
// 获取模版附加绩效指标详情 |
|
|
|
List<PerformanceIndicatorProjectTemplateDetail> additionalTemplateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) |
|
|
|
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, id) |
|
|
@@ -151,10 +158,13 @@ public class IndicatorConfigManage { |
|
|
|
if(CollUtil.isNotEmpty(dto.getTemplateDetails())){ |
|
|
|
//先删除 |
|
|
|
indicatorProjectTemplateDetailService.remove(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) |
|
|
|
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId,dto.getId())); |
|
|
|
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId,dto.getId()) |
|
|
|
.eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional,Boolean.FALSE)); |
|
|
|
analysisTemplateDetails(dto.getTemplateDetails(),template.getId()); |
|
|
|
//校检 所有3级指标(不包括附加指标) 总分是不是100 |
|
|
|
List<PerformanceIndicatorProjectTemplateDetail> indexList = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) |
|
|
|
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, template.getId()) |
|
|
|
.eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional,Boolean.FALSE) |
|
|
|
.eq(PerformanceIndicatorProjectTemplateDetail::getType,PerformanceTemplateTypeEnum.THIRD_INDEX.getCode())); |
|
|
|
if(CollUtil.isNotEmpty(indexList)){ |
|
|
|
BigDecimal sum = indexList.stream() |
|
|
@@ -164,7 +174,6 @@ public class IndicatorConfigManage { |
|
|
|
boolean score = (BigDecimal.valueOf(100)).equals(sum); |
|
|
|
VUtils.isTrue(Boolean.FALSE.equals(score)).throwMessage("总分不是100 操作失败!"); |
|
|
|
} |
|
|
|
analysisTemplateDetails(dto.getTemplateDetails(),template.getId()); |
|
|
|
} |
|
|
|
// 保存 模版附加指标详情 |
|
|
|
if (CollUtil.isNotEmpty(dto.getAdditionalIndexDetails())){ |
|
|
@@ -220,6 +229,7 @@ public class IndicatorConfigManage { |
|
|
|
templateDetail.setTemplateId(templateId); |
|
|
|
// 一级指标的父ID为null |
|
|
|
templateDetail.setParentId(parentId); |
|
|
|
templateDetail.setIsAdditional(Boolean.FALSE); |
|
|
|
|
|
|
|
indicatorProjectTemplateDetailService.save(templateDetail); |
|
|
|
|
|
|
@@ -334,7 +344,8 @@ public class IndicatorConfigManage { |
|
|
|
.eq(PerformanceIndicatorProjectTemplate::getProjectType, projectTemplate.getProjectType()) |
|
|
|
.eq(PerformanceIndicatorProjectTemplate::getProjectYear, projectTemplate.getProjectYear()) |
|
|
|
.eq(PerformanceIndicatorProjectTemplate::getAmountRange, projectTemplate.getAmountRange()) |
|
|
|
.eq(PerformanceIndicatorProjectTemplate::getProjectTagIds, projectTemplate.getProjectTagIds())); |
|
|
|
.eq(PerformanceIndicatorProjectTemplate::getProjectTagIds, projectTemplate.getProjectTagIds()) |
|
|
|
.eq(PerformanceIndicatorProjectTemplate::getStatus,CommonEnum.YES.getCode())); |
|
|
|
if (Objects.nonNull(template)){ |
|
|
|
throw new BizException("相同配置的模板已存在,当前模板无法启用!"); |
|
|
|
} |
|
|
|