Просмотр исходного кода

绩效评价-项目评分表删除多余字段

master
CMM 1 год назад
Родитель
Сommit
7eb79a418b
5 измененных файлов: 107 добавлений и 50 удалений
  1. +4
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/OrgSelfAppraisalController.java
  2. +72
    -44
      pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/OrgSelfAppraisalManage.java
  3. +11
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/AppraisalScoreExportDTO.java
  4. +0
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalScoreInfo.java
  5. +20
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/req/PerformanceAppraisalExportReq.java

+ 4
- 3
pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/OrgSelfAppraisalController.java Просмотреть файл

@@ -5,6 +5,7 @@ import com.ningdatech.log.annotation.WebLog;
import com.ningdatech.pmapi.common.util.ExcelDownUtil;
import com.ningdatech.pmapi.performance.manage.OrgSelfAppraisalManage;
import com.ningdatech.pmapi.performance.model.dto.ProjectAppraisalDTO;
import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalExportReq;
import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq;
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalProjectVO;
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalVO;
@@ -62,10 +63,10 @@ public class OrgSelfAppraisalController {
return selfAppraisalManage.submitSelfAppraisal(param);
}

@GetMapping("/score/export/{projectCode}")
@GetMapping("/score/export")
@ApiOperation("自评打分导出")
@WebLog(value = "自评打分导出",modular = "绩效评价-单位自评")
private void exportScore(@PathVariable String projectCode, HttpServletResponse response){
ExcelDownUtil.downXls(response, projectCode, selfAppraisalManage::exportScore);
public void exportScore(@Valid @ModelAttribute PerformanceAppraisalExportReq param, HttpServletResponse response){
ExcelDownUtil.downXls(response, param, selfAppraisalManage::exportScore);
}
}

+ 72
- 44
pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/OrgSelfAppraisalManage.java Просмотреть файл

@@ -2,6 +2,7 @@ package com.ningdatech.pmapi.performance.manage;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import com.alibaba.excel.EasyExcel;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -11,6 +12,8 @@ import com.ningdatech.basic.function.VUtils;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.basic.util.StrPool;
import com.ningdatech.pmapi.common.enumeration.CommonEnum;
import com.ningdatech.pmapi.common.util.ExcelDownUtil;
import com.ningdatech.pmapi.common.util.ExcelExportStyle;
import com.ningdatech.pmapi.performance.constant.BizConst;
import com.ningdatech.pmapi.performance.enumration.AppraisalTypeEnum;
import com.ningdatech.pmapi.performance.enumration.PerformanceTemplateTypeEnum;
@@ -19,6 +22,7 @@ import com.ningdatech.pmapi.performance.model.dto.AppraisalScoreExportDTO;
import com.ningdatech.pmapi.performance.model.dto.ProjectAppraisalDTO;
import com.ningdatech.pmapi.performance.model.dto.ProjectAppraisalInfoDTO;
import com.ningdatech.pmapi.performance.model.entity.*;
import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalExportReq;
import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq;
import com.ningdatech.pmapi.performance.model.vo.*;
import com.ningdatech.pmapi.performance.service.*;
@@ -41,6 +45,7 @@ import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.*;
@@ -273,12 +278,14 @@ public class OrgSelfAppraisalManage {
.eq(PerformanceIndicatorProjectTemplate::getProjectYear, projectYear)
.eq(PerformanceIndicatorProjectTemplate::getAmountRange, amountRange)
.eq(PerformanceIndicatorProjectTemplate::getProjectTagIds,projectTagIds)
.eq(PerformanceIndicatorProjectTemplate::getStatus,CommonEnum.YES.getCode())
.orderByDesc(PerformanceIndicatorProjectTemplate::getUpdateOn);
PerformanceIndicatorProjectTemplate projectTemplate = indicatorProjectTemplateService.getOne(wrapper);
if (Objects.isNull(projectTemplate)){
throw new BizException("该项目匹配不到指标模板,请返回上一页或者刷新重试。");
List<PerformanceIndicatorProjectTemplate> templates = indicatorProjectTemplateService.list(wrapper);
VUtils.isTrue(CollUtil.isEmpty(templates)).throwMessage("该项目匹配不到指标模板,请返回上一页或者刷新重试。");
if (templates.size() > 1){
throw new BizException("当前项目匹配到多个模板,请返回模板库检查模板配置!");
}
PerformanceIndicatorProjectTemplate projectTemplate = templates.get(0);
// 装配项目指标详情及分数信息
// 获取模版绩效指标详情
List<PerformanceIndicatorProjectTemplateDetail> templateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class)
@@ -373,11 +380,11 @@ public class OrgSelfAppraisalManage {
return "提交失败";
}

public void exportScore(HttpServletResponse response, String projectCode) {
public void exportScore(HttpServletResponse response, PerformanceAppraisalExportReq param) {
UserInfoDetails user = LoginUserUtil.loginUserDetail();
String regionCode = user.getRegionCode();
ProjectAppraisalIndexDetailVO vo = new ProjectAppraisalIndexDetailVO();
String projectCode = param.getProjectCode();
Long appraisalId = param.getAppraisalId();

// 根据项目编码获取最新版本的项目信息
Project project = projectService.getProjectByCode(projectCode);
@@ -411,66 +418,87 @@ public class OrgSelfAppraisalManage {
.eq(PerformanceIndicatorProjectTemplate::getProjectYear, projectYear)
.eq(PerformanceIndicatorProjectTemplate::getAmountRange, amountRange)
.eq(PerformanceIndicatorProjectTemplate::getProjectTagIds,projectTagIds)
.eq(PerformanceIndicatorProjectTemplate::getStatus,CommonEnum.YES.getCode())
.orderByDesc(PerformanceIndicatorProjectTemplate::getUpdateOn);
PerformanceIndicatorProjectTemplate projectTemplate = indicatorProjectTemplateService.getOne(wrapper);
if (Objects.isNull(projectTemplate)){
throw new BizException("该项目匹配不到指标模板,请返回上一页或者刷新重试。");
List<PerformanceIndicatorProjectTemplate> templates = indicatorProjectTemplateService.list(wrapper);
VUtils.isTrue(CollUtil.isEmpty(templates)).throwMessage("该项目匹配不到指标模板,请返回上一页或者刷新重试。");
if (templates.size() > 1){
throw new BizException("当前项目匹配到多个模板,请返回模板库检查模板配置!");
}
PerformanceIndicatorProjectTemplate projectTemplate = templates.get(0);
// 装配项目指标详情及分数信息
// 获取模版绩效指标详情
List<PerformanceIndicatorProjectTemplateDetail> templateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class)
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, projectTemplate.getId())
.eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional,Boolean.FALSE));
// 获取模版附加绩效指标详情
List<PerformanceIndicatorProjectTemplateDetail> additionalTemplateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class)
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, projectTemplate.getId())
.eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional,Boolean.TRUE));
List<ProjectTemplateDetailVO> templateDetailVos = templateDetailBuildHelper.buildTemplateDetail(templateDetails,projectCode,vo);
List<ProjectTemplateDetailVO> additionalTemplateDetailVos = templateDetailBuildHelper.buildTemplateDetail(additionalTemplateDetails,projectCode,vo);
Map<Long, ProjectTemplateDetailVO> templateDetailVoMap = templateDetailVos.stream().collect(Collectors.toMap(ProjectTemplateDetailVO::getId, t -> t));
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, projectTemplate.getId()));
Map<Long, PerformanceIndicatorProjectTemplateDetail> templateDetailMap = templateDetails.stream().collect(Collectors.toMap(PerformanceIndicatorProjectTemplateDetail::getId, t -> t));

List<AppraisalScoreExportDTO> exportDataList = Lists.newArrayList();
List<AppraisalScoreExportDTO> exportAdditionalDataList = Lists.newArrayList();
// 构建指标和打分详情
Map<Long, PerformanceAppraisalScoreInfo> scoreInfoMap = performanceAppraisalScoreInfoService.list().stream()
List<PerformanceAppraisalScoreInfo> scoreInfoList = performanceAppraisalScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalScoreInfo.class)
.eq(PerformanceAppraisalScoreInfo::getAppraisalId, appraisalId)
.eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.SELF_APPRAISAL.getCode())
.eq(PerformanceAppraisalScoreInfo::getAppraisalProjectCode, projectCode)
.orderBy(Boolean.TRUE, Boolean.TRUE, PerformanceAppraisalScoreInfo::getTemplateDetailId));
Map<Long, PerformanceAppraisalScoreInfo> scoreInfoMap = scoreInfoList.stream()
.collect(Collectors.toMap(PerformanceAppraisalScoreInfo::getTemplateDetailId, p -> p));
// 筛选出所有三级指标
List<ProjectTemplateDetailVO> thirdVos = templateDetailVos.stream()
.filter(t -> PerformanceTemplateTypeEnum.THIRD_INDEX.getCode().equals(t.getType()))
.collect(Collectors.toList());
for (ProjectTemplateDetailVO templateDetailVo : thirdVos) {
// 筛选出所有打分的三级指标模板详情ID
for (PerformanceAppraisalScoreInfo scoreInfo : scoreInfoList) {
AppraisalScoreExportDTO thirdDto = new AppraisalScoreExportDTO();
thirdDto.setThirdIndexName(templateDetailVo.getName());
thirdDto.setIndexDetail(templateDetailVo.getIndexDetail());
thirdDto.setGradeDetail(templateDetailVo.getGradeDetail());
thirdDto.setSupportMaterial(templateDetailVo.getSupportMaterial());
thirdDto.setIndexScore(templateDetailVo.getIndexScore());
thirdDto.setIsAdditional(CommonEnum.YES.getDesc());
PerformanceAppraisalScoreInfo appraisalScoreInfo = scoreInfoMap.get(templateDetailVo.getId());
Long detailId = scoreInfo.getTemplateDetailId();
PerformanceIndicatorProjectTemplateDetail thirdTemplateDetail = templateDetailMap.get(detailId);
thirdDto.setThirdIndexName(thirdTemplateDetail.getName());
thirdDto.setIndexDetail(thirdTemplateDetail.getIndexDetail());
thirdDto.setGradeDetail(thirdTemplateDetail.getGradeDetail());
thirdDto.setSupportMaterial(thirdTemplateDetail.getSupportMaterial());
thirdDto.setIndexScore(thirdTemplateDetail.getIndexScore());
if (Boolean.TRUE.equals(thirdTemplateDetail.getIsAdditional())) {
thirdDto.setIsAdditional(CommonEnum.YES.getDesc());
} else if (Boolean.FALSE.equals(thirdTemplateDetail.getIsAdditional())) {
thirdDto.setIsAdditional(CommonEnum.NO.getDesc());
}
PerformanceAppraisalScoreInfo appraisalScoreInfo = scoreInfoMap.get(thirdTemplateDetail.getId());
if (Objects.nonNull(appraisalScoreInfo)) {
thirdDto.setAppraisalBasis(appraisalScoreInfo.getAppraisalBasis());
thirdDto.setAppraisalScore(appraisalScoreInfo.getAppraisalScore());
}
exportDataList.add(thirdDto);
// 二级指标名称
Long secondId = templateDetailVo.getParentId();
Long secondId = thirdTemplateDetail.getParentId();
if (Objects.nonNull(secondId)) {
ProjectTemplateDetailVO secondTemplateDetailVo = templateDetailVoMap.get(secondId);
if (Objects.nonNull(secondTemplateDetailVo)) {
thirdDto.setSecondIndexName(secondTemplateDetailVo.getName());
PerformanceIndicatorProjectTemplateDetail secondTemplateDetail = templateDetailMap.get(secondId);
if (Objects.nonNull(secondTemplateDetail)) {
thirdDto.setSecondIndexName(secondTemplateDetail.getName());
// 一级指标名称
Long firstId = secondTemplateDetailVo.getParentId();
Long firstId = secondTemplateDetail.getParentId();
if (Objects.nonNull(firstId)){
ProjectTemplateDetailVO firstTemplateDetailVo = templateDetailVoMap.get(secondId);
if (Objects.nonNull(firstTemplateDetailVo)) {
thirdDto.setFirstIndexName(firstTemplateDetailVo.getName());
PerformanceIndicatorProjectTemplateDetail firstTemplateDetail = templateDetailMap.get(firstId);
if (Objects.nonNull(firstTemplateDetail)) {
thirdDto.setFirstIndexName(firstTemplateDetail.getName());
}
}
}
}
if (Boolean.FALSE.equals(thirdTemplateDetail.getIsAdditional())) {
exportDataList.add(thirdDto);
}else {
exportAdditionalDataList.add(thirdDto);
}
}
exportDataList.addAll(exportAdditionalDataList);

String fileName = "绩效评价_单位自评_评分明细表";
ExcelDownUtil.setFileName(fileName, response);
//数据导出处理函数
try {
EasyExcel.write(response.getOutputStream(), AppraisalScoreExportDTO.class)
.autoCloseStream(false)
.registerWriteHandler(ExcelExportStyle.formalStyle())
.sheet(fileName)
.doWrite(exportDataList);
} catch (IOException e) {
throw new RuntimeException(e);
}



}
}

+ 11
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/AppraisalScoreExportDTO.java Просмотреть файл

@@ -3,6 +3,7 @@ package com.ningdatech.pmapi.performance.model.dto;
import java.io.Serializable;
import java.math.BigDecimal;

import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@@ -18,32 +19,42 @@ public class AppraisalScoreExportDTO implements Serializable {
private static final long serialVersionUID = 1L;

@ApiModelProperty("一级指标名称")
@ExcelProperty(value = "一级指标",index = 0)
private String firstIndexName;

@ApiModelProperty("二级指标名称")
@ExcelProperty(value = "二级指标",index = 1)
private String secondIndexName;

@ApiModelProperty("三级指标名称")
@ExcelProperty(value = "三级指标",index = 2)
private String thirdIndexName;

@ApiModelProperty("指标分值 3级指标才有")
@ExcelProperty(value = "指标分值",index = 3)
private BigDecimal indexScore;

@ApiModelProperty("指标细则 3级指标才有")
@ExcelProperty(value = "指标细则",index = 4)
private String indexDetail;

@ApiModelProperty("评分细则")
@ExcelProperty(value = "评分细则",index = 5)
private String gradeDetail;

@ApiModelProperty("佐证材料描述")
@ExcelProperty(value = "佐证材料",index = 6)
private String supportMaterial;

@ApiModelProperty("自评依据")
@ExcelProperty(value = "自评依据",index = 7)
private String appraisalBasis;

@ApiModelProperty("自评得分")
@ExcelProperty(value = "自评得分",index = 8)
private BigDecimal appraisalScore;

@ApiModelProperty("是否为附加指标")
@ExcelProperty(value = "是否附加指标",index = 9)
private String isAdditional;
}

+ 0
- 3
pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalScoreInfo.java Просмотреть файл

@@ -70,7 +70,4 @@ public class PerformanceAppraisalScoreInfo implements Serializable {

@ApiModelProperty("评价项目Code")
private String appraisalProjectCode;

@ApiModelProperty("评价应用ID")
private Long appraisalAppId;
}

+ 20
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/model/req/PerformanceAppraisalExportReq.java Просмотреть файл

@@ -0,0 +1,20 @@
package com.ningdatech.pmapi.performance.model.req;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
* PerformanceAppraisalExportReq
* @return
* @author CMM
* @since 2023/08/16 17:07
*/
@Data
public class PerformanceAppraisalExportReq {

@ApiModelProperty("计划名称")
private String projectCode;

@ApiModelProperty("评价计划Id")
private Long appraisalId;
}

Загрузка…
Отмена
Сохранить