Kaynağa Gözat

Merge remote-tracking branch 'origin/dev' into dev

tags/24080901
PoffyZhang 1 yıl önce
ebeveyn
işleme
ba04e39ac3
2 değiştirilmiş dosya ile 69 ekleme ve 14 silme
  1. +67
    -13
      pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/IndicatorConfigManage.java
  2. +2
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/OrgSelfAppraisalManage.java

+ 67
- 13
pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/IndicatorConfigManage.java Dosyayı Görüntüle

@@ -46,6 +46,7 @@ import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;

@@ -375,20 +376,73 @@ public class IndicatorConfigManage {
// 新增指标详情
List<PerformanceIndicatorProjectTemplateDetail> projectTemplateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class)
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, templateId));
// 逐个新增并保存各指标
for (PerformanceIndicatorProjectTemplateDetail projectTemplateDetail : projectTemplateDetails) {
PerformanceIndicatorProjectTemplateDetail newProjectTemplateDetail = new PerformanceIndicatorProjectTemplateDetail();
BeanUtils.copyProperties(projectTemplateDetail, newProjectTemplateDetail);
newProjectTemplateDetail.setTemplateId(newTemplate.getId());
newProjectTemplateDetail.setCreateOn(LocalDateTime.now());
newProjectTemplateDetail.setCreateBy(user.getUsername());
newProjectTemplateDetail.setUpdateOn(LocalDateTime.now());
newProjectTemplateDetail.setUpdateBy(user.getUsername());
// 新的指标ID要置空
newProjectTemplateDetail.setId(null);
indicatorProjectTemplateDetailService.save(newProjectTemplateDetail);
Map<Long, PerformanceIndicatorProjectTemplateDetail> detailMap = projectTemplateDetails.stream().collect(Collectors.toMap(PerformanceIndicatorProjectTemplateDetail::getId, p -> p));
// 按层级逐个新增并保存各指标
// 从三级指标开始
List<PerformanceIndicatorProjectTemplateDetail> thirdList = projectTemplateDetails.stream()
.filter(p -> PerformanceTemplateTypeEnum.THIRD_INDEX.getCode().equals(p.getType()))
.collect(Collectors.toList());
if (CollUtil.isEmpty(thirdList)){
throw new BizException("当前模板未配置三级指!");
}
List<PerformanceIndicatorProjectTemplateDetail> templateDetails = Lists.newArrayList();
for (PerformanceIndicatorProjectTemplateDetail templateDetail : thirdList) {
PerformanceIndicatorProjectTemplateDetail newThirdTemplateDetail = new PerformanceIndicatorProjectTemplateDetail();
BeanUtils.copyProperties(templateDetail, newThirdTemplateDetail);
newThirdTemplateDetail.setTemplateId(newTemplate.getId());
newThirdTemplateDetail.setCreateOn(LocalDateTime.now());
newThirdTemplateDetail.setCreateBy(user.getUsername());
newThirdTemplateDetail.setUpdateOn(LocalDateTime.now());
newThirdTemplateDetail.setUpdateBy(user.getUsername());
// 新的指标ID、parentId要置空
newThirdTemplateDetail.setId(null);
newThirdTemplateDetail.setParentId(null);
indicatorProjectTemplateDetailService.save(newThirdTemplateDetail);
// 再保存关联的二级指标
Long thirdParentId = templateDetail.getParentId();
PerformanceIndicatorProjectTemplateDetail secondTemplateDetail = detailMap.get(thirdParentId);
if (Objects.isNull(secondTemplateDetail)){
throw new BizException("三级指标:" + templateDetail.getName() + "对应的二级指标不存在");
}
PerformanceIndicatorProjectTemplateDetail newSecondTemplateDetail = new PerformanceIndicatorProjectTemplateDetail();
BeanUtils.copyProperties(secondTemplateDetail, newSecondTemplateDetail);
newSecondTemplateDetail.setTemplateId(newTemplate.getId());
newSecondTemplateDetail.setCreateOn(LocalDateTime.now());
newSecondTemplateDetail.setCreateBy(user.getUsername());
newSecondTemplateDetail.setUpdateOn(LocalDateTime.now());
newSecondTemplateDetail.setUpdateBy(user.getUsername());
// 新的指标Id、parentId要置空
newSecondTemplateDetail.setId(null);
newSecondTemplateDetail.setParentId(null);
indicatorProjectTemplateDetailService.save(newSecondTemplateDetail);
// 关联三级指标
newThirdTemplateDetail.setParentId(newSecondTemplateDetail.getId());
templateDetails.add(newThirdTemplateDetail);
// 再保存关联的一级指标
Long secondParentId = secondTemplateDetail.getParentId();
PerformanceIndicatorProjectTemplateDetail firstTemplateDetail = detailMap.get(secondParentId);
if (Objects.isNull(firstTemplateDetail)){
throw new BizException("二级指标:" + secondTemplateDetail.getName() + "对应的一级指标不存在");
}
PerformanceIndicatorProjectTemplateDetail newFirstTemplateDetail = new PerformanceIndicatorProjectTemplateDetail();
BeanUtils.copyProperties(firstTemplateDetail, newFirstTemplateDetail);
newFirstTemplateDetail.setTemplateId(newTemplate.getId());
newFirstTemplateDetail.setCreateOn(LocalDateTime.now());
newFirstTemplateDetail.setCreateBy(user.getUsername());
newFirstTemplateDetail.setUpdateOn(LocalDateTime.now());
newFirstTemplateDetail.setUpdateBy(user.getUsername());
// 新的指标ID、parentId要置空
newFirstTemplateDetail.setId(null);
newFirstTemplateDetail.setParentId(null);
indicatorProjectTemplateDetailService.save(newFirstTemplateDetail);
// 关联二级指标
newSecondTemplateDetail.setParentId(newFirstTemplateDetail.getId());
templateDetails.add(newSecondTemplateDetail);
}
// 批量更新
if (indicatorProjectTemplateDetailService.updateBatchById(templateDetails)) {
return "模版复制成功";
}
return "模版复制成功";
}
return "模版复制失败";
}


+ 2
- 1
pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/OrgSelfAppraisalManage.java Dosyayı Görüntüle

@@ -277,7 +277,8 @@ public class OrgSelfAppraisalManage {
// 装配项目指标详情及分数信息
// 获取模版绩效指标详情
List<PerformanceIndicatorProjectTemplateDetail> templateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class)
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, projectTemplate.getId()));
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, projectTemplate.getId())
.eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional,Boolean.FALSE));
// 获取模版附加绩效指标详情
List<PerformanceIndicatorProjectTemplateDetail> additionalTemplateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class)
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, projectTemplate.getId())


Yükleniyor…
İptal
Kaydet