From 68431bd54c7508ea8beff777f5ced93bc6ac942f Mon Sep 17 00:00:00 2001 From: CMM <2198256324@qq.com> Date: Mon, 14 Aug 2023 15:07:06 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=A9=E6=95=88=E8=AF=84=E4=BB=B7-=E6=95=B4?= =?UTF-8?q?=E6=94=B9=E6=A0=B8=E6=9F=A5=E3=80=81=E5=BA=94=E7=94=A8=E8=AF=84?= =?UTF-8?q?=E4=BB=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/GeneratorCodeKingbaseConfig.java | 2 +- .../controller/AppAppraisalController.java | 62 +++ .../controller/RectifyAuditController.java | 56 +++ .../performance/controller/RectifyController.java | 66 +++ .../performance/enumration/AppIndexTypeEnum.java | 42 ++ .../performance/enumration/AppraisalTypeEnum.java | 4 +- .../performance/enumration/RectifyAuditEnum.java | 41 ++ .../performance/enumration/RectifyStatusEnum.java | 44 ++ .../helper/TemplateDetailBuildHelper.java | 1 + .../helper/impl/TemplateDetailBuildHelperImpl.java | 17 +- .../performance/manage/AppAppraisalManage.java | 523 +++++++++++++++++++++ .../manage/PerformanceAppraisalPlanManage.java | 20 +- .../performance/manage/ReAppraisalManage.java | 18 +- .../performance/manage/RectifyAuditManage.java | 375 +++++++++++++++ .../pmapi/performance/manage/RectifyManage.java | 296 ++++++++++++ .../pmapi/performance/manage/VerifyManage.java | 35 +- .../PerformanceAppraisalAppScoreInfoMapper.java | 16 + .../PerformanceAppraisalAppScoreInfoMapper.xml | 5 + .../performance/model/dto/AppAppraisalInfoDTO.java | 32 ++ .../performance/model/dto/ProjectAppraisalDTO.java | 22 + .../entity/PerformanceAppraisalAppIndicator.java | 9 + .../entity/PerformanceAppraisalAppScoreInfo.java | 64 +++ .../entity/PerformanceAppraisalApplication.java | 16 + .../model/entity/PerformanceAppraisalProject.java | 35 ++ .../entity/PerformanceAppraisalScoreInfo.java | 5 +- .../model/vo/AppAppraisalIndexDetailVO.java | 47 ++ .../model/vo/AppBusinessIndexDetailVO.java | 62 +++ .../performance/model/vo/AppIndexDetailVO.java | 69 +++ .../model/vo/PerformanceAppraisalAppVO.java | 99 ++++ .../vo/PerformanceAppraisalApplicationVO.java | 6 + .../model/vo/PerformanceAppraisalProjectVO.java | 36 +- .../model/vo/PerformanceAppraisalVO.java | 11 + .../model/vo/ProjectAppraisalIndexDetailVO.java | 3 + .../model/vo/ProjectTemplateDetailVO.java | 3 + .../performance/model/vo/RectifyDetailVO.java | 58 +++ .../IPerformanceAppraisalAppScoreInfoService.java | 16 + ...erformanceAppraisalAppScoreInfoServiceImpl.java | 20 + 37 files changed, 2202 insertions(+), 34 deletions(-) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/AppAppraisalController.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/RectifyAuditController.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/RectifyController.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/AppIndexTypeEnum.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/RectifyAuditEnum.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/RectifyStatusEnum.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/AppAppraisalManage.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/RectifyAuditManage.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/RectifyManage.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalAppScoreInfoMapper.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalAppScoreInfoMapper.xml create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/AppAppraisalInfoDTO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalAppScoreInfo.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/AppAppraisalIndexDetailVO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/AppBusinessIndexDetailVO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/AppIndexDetailVO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalAppVO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/RectifyDetailVO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalAppScoreInfoService.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalAppScoreInfoServiceImpl.java diff --git a/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java b/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java index 414a8b0..6a34985 100644 --- a/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java +++ b/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java @@ -57,7 +57,7 @@ public class GeneratorCodeKingbaseConfig { public static void main(String[] args) { //generate("Liuxinxin", "expert", PATH_LXX, "expert_gov_business_strip"); - generate("CMM", "test", PATH_CMM, "nd_performance_appraisal_score_info"); + generate("CMM", "test", PATH_CMM, "nd_performance_appraisal_app_score_info"); } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/AppAppraisalController.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/AppAppraisalController.java new file mode 100644 index 0000000..18d50e2 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/AppAppraisalController.java @@ -0,0 +1,62 @@ +package com.ningdatech.pmapi.performance.controller; + +import javax.validation.Valid; + +import com.ningdatech.pmapi.performance.manage.AppAppraisalManage; +import com.ningdatech.pmapi.performance.model.vo.*; +import org.springframework.web.bind.annotation.*; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.pmapi.performance.manage.ReAppraisalManage; +import com.ningdatech.pmapi.performance.model.dto.ProjectAppraisalDTO; +import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; + +/** + * ReAppraisalController + * @return + * @author CMM + * @since 2023/08/10 8:54 + */ +@RestController +@RequiredArgsConstructor +@Api(tags = "绩效评价-应用评价") +@RequestMapping("/api/v1/app-appraisal") +public class AppAppraisalController { + + private final AppAppraisalManage appAppraisalManage; + + @GetMapping("/list") + @ApiOperation("当前复评用户的应用绩效评价计划列表") + public PageVo list(PerformanceAppraisalListReq req) { + return appAppraisalManage.list(req); + } + + @GetMapping("/unEvaluate-list/{planId}") + @ApiOperation("当前绩效评价应用待评价列表") + public PageVo pendingList(@PathVariable Long planId, PerformanceAppraisalListReq req) { + return appAppraisalManage.unEvaluateList(planId,req); + } + + @GetMapping("/evaluated-list/{planId}") + @ApiOperation("当前绩效评价应用已评价列表") + public PageVo evaluatedList(@PathVariable Long planId,PerformanceAppraisalListReq req) { + return appAppraisalManage.evaluatedList(planId,req); + } + + @GetMapping("/detail/{appId}") + @ApiOperation("获取详情") + public AppAppraisalIndexDetailVO detail(@PathVariable Long appId){ + return appAppraisalManage.detail(appId); + } + + @PostMapping("/save") + @ApiOperation("保存分数") + public String saveAppraisal(@Valid @RequestBody ProjectAppraisalDTO param){ + return appAppraisalManage.saveAppraisal(param); + } + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/RectifyAuditController.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/RectifyAuditController.java new file mode 100644 index 0000000..8c4e6db --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/RectifyAuditController.java @@ -0,0 +1,56 @@ +package com.ningdatech.pmapi.performance.controller; + +import javax.validation.Valid; + +import com.ningdatech.pmapi.performance.manage.RectifyAuditManage; +import org.springframework.web.bind.annotation.*; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.pmapi.performance.model.dto.ProjectAppraisalDTO; +import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq; +import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalProjectVO; +import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalVO; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; + +/** + * RectifyController + * @return + * @author CMM + * @since 2023/08/12 15:45 + */ +@RestController +@RequiredArgsConstructor +@Api(tags = "绩效评价-项目整改核查") +@RequestMapping("/api/v1/rectify-audit") +public class RectifyAuditController { + + private final RectifyAuditManage rectifyAuditManage; + + @GetMapping("/list") + @ApiOperation("当前用户的绩效评价整改审核计划列表") + public PageVo list(PerformanceAppraisalListReq req) { + return rectifyAuditManage.list(req); + } + + @GetMapping("/unAudit-list/{planId}") + @ApiOperation("当前绩效评价待整改审核列表") + public PageVo unAuditList(@PathVariable Long planId, PerformanceAppraisalListReq req) { + return rectifyAuditManage.unAuditList(planId,req); + } + + @GetMapping("/audited-list/{planId}") + @ApiOperation("当前绩效评价已整改审核列表") + public PageVo auditedList(@PathVariable Long planId,PerformanceAppraisalListReq req) { + return rectifyAuditManage.auditedList(planId,req); + } + + @PostMapping("/submit") + @ApiOperation("提交整改审核结果") + public String submit(@Valid @RequestBody ProjectAppraisalDTO param){ + return rectifyAuditManage.submit(param); + } + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/RectifyController.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/RectifyController.java new file mode 100644 index 0000000..ebcb6f4 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/RectifyController.java @@ -0,0 +1,66 @@ +package com.ningdatech.pmapi.performance.controller; + +import javax.validation.Valid; + +import org.springframework.web.bind.annotation.*; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.pmapi.performance.manage.RectifyManage; +import com.ningdatech.pmapi.performance.model.dto.ProjectAppraisalDTO; +import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq; +import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalProjectVO; +import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalVO; +import com.ningdatech.pmapi.performance.model.vo.RectifyDetailVO; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; + +/** + * RectifyController + * + * @return + * @author CMM + * @since 2023/08/12 15:45 + */ +@RestController +@RequiredArgsConstructor +@Api(tags = "绩效评价-项目整改") +@RequestMapping("/api/v1/rectify") +public class RectifyController { + + private final RectifyManage rectifyManage; + + @GetMapping("/list") + @ApiOperation("当前用户的绩效评价整改计划列表") + public PageVo list(PerformanceAppraisalListReq req) { + return rectifyManage.list(req); + } + + @GetMapping("/unRectify-list/{planId}") + @ApiOperation("当前绩效评价待整改列表") + public PageVo unRectifyList(@PathVariable Long planId, + PerformanceAppraisalListReq req) { + return rectifyManage.unRectifyList(planId, req); + } + + @GetMapping("/rectified-list/{planId}") + @ApiOperation("当前绩效评价已整改列表") + public PageVo rectifiedList(@PathVariable Long planId, + PerformanceAppraisalListReq req) { + return rectifyManage.rectifiedList(planId, req); + } + + @GetMapping("/get-rectify-detail/{planId}/{projectCode}") + @ApiOperation("查看整改详情") + public RectifyDetailVO getRectifyDetail(@PathVariable Long planId, @PathVariable String projectCode) { + return rectifyManage.getRectifyDetail(planId, projectCode); + } + + @PostMapping("/fill-out-result") + @ApiOperation("填写整改情况") + public String fillOutResult(@Valid @RequestBody ProjectAppraisalDTO param) { + return rectifyManage.fillOutResult(param); + } + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/AppIndexTypeEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/AppIndexTypeEnum.java new file mode 100644 index 0000000..b61ace2 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/AppIndexTypeEnum.java @@ -0,0 +1,42 @@ +package com.ningdatech.pmapi.performance.enumration; + +import java.util.Objects; + +import org.apache.commons.lang3.StringUtils; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +/** + * AppIndexTypeEnum + * @return + * @author CMM + * @since 2023/07/26 16:44 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +public enum AppIndexTypeEnum { + /** + * 应用指标类型 + */ + COMMON(1, "通用指标"), + AUX(2, "辅助指标"), + BUSINESS(3,"业务指标"); + + private Integer code; + private String desc; + + public static String getDesc(Integer code) { + if (Objects.isNull(code)) { + return StringUtils.EMPTY; + } + for (AppIndexTypeEnum t : AppIndexTypeEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/AppraisalTypeEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/AppraisalTypeEnum.java index 0dd22b3..232c040 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/AppraisalTypeEnum.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/AppraisalTypeEnum.java @@ -23,7 +23,9 @@ public enum AppraisalTypeEnum { */ SELF_APPRAISAL(1, "单位自评"), RE_APPRAISAL(2, "人工复评"), - EXPERT_VERIFY(3, "专家核查"); + EXPERT_VERIFY(3, "专家核查"), + EXPERT_RECTIFY_AUDIT(4, "专家整改审核"), + APPLICATION_APPRAISAL(5, "应用评价"); private Integer code; private String desc; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/RectifyAuditEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/RectifyAuditEnum.java new file mode 100644 index 0000000..4528116 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/RectifyAuditEnum.java @@ -0,0 +1,41 @@ +package com.ningdatech.pmapi.performance.enumration; + +import java.util.Objects; + +import org.apache.commons.lang3.StringUtils; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +/** + * RectifyAuditEnum + * @return + * @author CMM + * @since 2023/07/26 16:44 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +public enum RectifyAuditEnum { + /** + * 评价类型 + */ + APPROVED(1, "通过"), + NOT_APPROVED(2, "不通过"); + + private Integer code; + private String desc; + + public static String getDesc(Integer code) { + if (Objects.isNull(code)) { + return StringUtils.EMPTY; + } + for (RectifyAuditEnum t : RectifyAuditEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/RectifyStatusEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/RectifyStatusEnum.java new file mode 100644 index 0000000..c40d67c --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/RectifyStatusEnum.java @@ -0,0 +1,44 @@ +package com.ningdatech.pmapi.performance.enumration; + +import java.util.Objects; + +import org.apache.commons.lang3.StringUtils; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +/** + * RectifyStatusEnum + * @return + * @author CMM + * @since 2023/07/26 16:44 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +public enum RectifyStatusEnum { + /** + * 整改状态 + */ + TO_BE_SUBMITTED(1, "整改情况待提交"), + NOT_APPROVED(2, "整改核查不通过"), + TO_BE_REVIEWED(3, "整改待审核"), + APPROVED(4,"整改审核通过"); + + + private Integer code; + private String desc; + + public static String getDesc(Integer code) { + if (Objects.isNull(code)) { + return StringUtils.EMPTY; + } + for (RectifyStatusEnum t : RectifyStatusEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/helper/TemplateDetailBuildHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/helper/TemplateDetailBuildHelper.java index 2c866a1..270dfdb 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/helper/TemplateDetailBuildHelper.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/helper/TemplateDetailBuildHelper.java @@ -16,6 +16,7 @@ public interface TemplateDetailBuildHelper { /** * 构建评价模板详情信息 * @param templateDetails + * @param vo * @return */ List buildTemplateDetail(List templateDetails, ProjectAppraisalIndexDetailVO vo); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/helper/impl/TemplateDetailBuildHelperImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/helper/impl/TemplateDetailBuildHelperImpl.java index 5cfef4d..1301435 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/helper/impl/TemplateDetailBuildHelperImpl.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/helper/impl/TemplateDetailBuildHelperImpl.java @@ -53,7 +53,7 @@ public class TemplateDetailBuildHelperImpl implements TemplateDetailBuildHelper if (Objects.nonNull(templateDetailThird.getParentId()) && templateDetailThird.getParentId().equals(templateDetailSecond.getId())) { ProjectTemplateDetailVO detailThirdVo = BeanUtil.copyProperties(templateDetailThird, ProjectTemplateDetailVO.class); - // 如果有单位自评、复评、核查分数信息,各自装配信息 + // 如果有单位自评、复评、核查、整改审核分数信息,各自装配信息 // 获取自评分数信息 List selfAppraisalScoreInfo = performanceAppraisalScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalScoreInfo.class) .eq(PerformanceAppraisalScoreInfo::getTemplateDetailId, templateDetailThird.getId()) @@ -87,7 +87,7 @@ public class TemplateDetailBuildHelperImpl implements TemplateDetailBuildHelper BigDecimal sum = scoreMap.values().stream() .filter(Objects::nonNull) .reduce(BigDecimal.ZERO, BigDecimal::add); - vo.setVerifyTotalScore(sum); + vo.setReAppraisalTotalScore(sum); } } // 按照核查人员分组 获取核查分数信息 @@ -113,6 +113,19 @@ public class TemplateDetailBuildHelperImpl implements TemplateDetailBuildHelper vo.setVerifyTotalScore(sum); } } + // 获取整改审核分数信息 + List rectifyAuditScoreInfo = performanceAppraisalScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalScoreInfo.class) + .eq(PerformanceAppraisalScoreInfo::getTemplateDetailId, templateDetailThird.getId()) + .eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.EXPERT_RECTIFY_AUDIT.getCode())); + if (CollUtil.isNotEmpty(rectifyAuditScoreInfo)) { + detailThirdVo.setRectifyAuditScoreInfo(rectifyAuditScoreInfo); + BigDecimal score = rectifyAuditScoreInfo.stream().map(PerformanceAppraisalScoreInfo::getAppraisalScore) + .filter(Objects::nonNull) + .reduce(BigDecimal.ZERO, BigDecimal::add); + if (Objects.nonNull(vo)) { + vo.setRectifyAuditTotalScore(score); + } + } secondList.add(detailThirdVo); } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/AppAppraisalManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/AppAppraisalManage.java new file mode 100644 index 0000000..cd0885f --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/AppAppraisalManage.java @@ -0,0 +1,523 @@ +package com.ningdatech.pmapi.performance.manage; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; + +import cn.hutool.core.map.MapUtil; +import com.ningdatech.pmapi.performance.enumration.AppIndexTypeEnum; +import com.ningdatech.pmapi.performance.model.dto.AppAppraisalInfoDTO; +import com.ningdatech.pmapi.performance.model.vo.*; +import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; +import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; +import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService; +import org.apache.commons.lang3.StringUtils; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.google.common.collect.Lists; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.function.VUtils; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.StrPool; +import com.ningdatech.pmapi.performance.constant.BizConst; +import com.ningdatech.pmapi.performance.enumration.AppraisalTypeEnum; +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.PerformanceAppraisalListReq; +import com.ningdatech.pmapi.performance.service.*; +import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum; +import com.ningdatech.pmapi.projectlib.model.entity.Project; +import com.ningdatech.pmapi.projectlib.service.IProjectService; +import com.ningdatech.pmapi.sys.model.entity.Role; +import com.ningdatech.pmapi.sys.service.IRoleService; +import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; +import com.ningdatech.pmapi.user.util.LoginUserUtil; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * AppAppraisalManage + * @return + * @author CMM + * @since 2023/08/10 8:55 + */ +@Component +@Slf4j +@AllArgsConstructor +public class AppAppraisalManage { + + private final IPerformanceAppraisalService performanceAppraisalService; + private final IPerformanceAppraisalProjectService performanceAppraisalProjectService; + private final IProjectService projectService; + private final IRoleService roleService; + private final IPerformanceAppraisalAppScoreInfoService performanceAppraisalAppScoreInfoService; + private final IPerformanceAppraisalProjectGroupService groupService; + private final IProjectApplicationService projectApplicationService; + private final IPerformanceAppraisalApplicationService performanceAppraisalApplicationService; + private final IPerformanceAppraisalAppIndicatorService performanceAppraisalAppIndicatorService; + private final IProjectCoreBusinessIndicatorsService projectCoreBusinessIndicatorsService; + /** + * 复评-评价计划列表 + * @param req + * @return + */ + public PageVo list(PerformanceAppraisalListReq req) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + String employeeCode = user.getEmployeeCode(); + String regionCode = user.getRegionCode(); + // 获取当前登录用户的角色列表,只有绩效复评人员才能查看该列表 + List userRoleList = user.getUserRoleList(); + List roleIdList = userRoleList.stream().map(Role::getId).collect(Collectors.toList()); + Role role = roleService.getOne(Wrappers.lambdaQuery(Role.class) + .eq(Role::getName, BizConst.REAPPRAISAL_ROLE)); + if (Objects.isNull(role)){ + throw new BizException("登录用户没有复评员角色!"); + } + + // 登录用户不是复评员,不能查看复评计划列表 + if (!roleIdList.contains(role.getId())){ + return PageVo.empty(); + } + + // 获取登录用户所在区域的所有已终验项目信息 + List projectLists = projectService.list(Wrappers.lambdaQuery(Project.class) + .eq(Project::getStatus, ProjectStatusEnum.ACCEPTED.getCode()) + .eq(Project::getAreaCode, regionCode)); + List projectCodes = projectLists.stream().map(Project::getProjectCode).collect(Collectors.toList()); + // 获取项目关联的应用信息 + List applications = projectApplicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) + .in(ProjectApplication::getProjectCode, projectCodes)); + // 已验收的项目关联的应用信息不存在 + if(CollUtil.isEmpty(applications)){ + return PageVo.empty(); + } + List appIds = applications.stream().map(ProjectApplication::getId).collect(Collectors.toList()); + List paas = performanceAppraisalApplicationService.list(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) + .in(PerformanceAppraisalApplication::getApplicationId, appIds)); + // 没有包含应用的评价计划 + if (CollUtil.isEmpty(paas)){ + return PageVo.empty(); + } + Set paIds = paas.stream().map(PerformanceAppraisalApplication::getAppraisalId).collect(Collectors.toSet()); + + // 获取评价计划关联的分组信息 + List groups = groupService.list(Wrappers.lambdaQuery(PerformanceAppraisalProjectGroup.class) + .in(PerformanceAppraisalProjectGroup::getAppraisalId, paIds)); + // 获取当前登录复评员所在的分组信息 + List groupList = groups.stream().filter(g -> { + String reAppraisalUsers = g.getReAppraisalUsers(); + List empCodeList = Lists.newArrayList(); + if (reAppraisalUsers.contains(StrPool.COMMA)) { + empCodeList.addAll(Arrays.asList(reAppraisalUsers.split(StrPool.COMMA))); + }else { + empCodeList.add(reAppraisalUsers); + } + if (empCodeList.contains(employeeCode)) { + return true; + } + return false; + }).collect(Collectors.toList()); + // 当前登录复评员用户,没有参加评价计划 + if (CollUtil.isEmpty(groupList)){ + return PageVo.empty(); + } + // 获取分组所在的评价计划ID + List appraisalIds = groupList.stream().map(PerformanceAppraisalProjectGroup::getAppraisalId).collect(Collectors.toList()); + // 获取复评计划列表 + Page page = req.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(PerformanceAppraisal.class) + .in(PerformanceAppraisal::getId,appraisalIds) + .orderByDesc(PerformanceAppraisal::getUpdateOn); + performanceAppraisalService.page(page,wrapper); + List res = page.getRecords().stream() + .map(p -> BeanUtil.copyProperties(p, PerformanceAppraisalVO.class)) + .collect(Collectors.toList()); + return PageVo.of(res,page.getTotal()); + } + + + public PageVo unEvaluateList(Long planId, PerformanceAppraisalListReq req) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + String employeeCode = user.getEmployeeCode(); + + PerformanceAppraisal plan = performanceAppraisalService.getById(planId); + VUtils.isTrue(Objects.isNull(plan)).throwMessage("该评价计划不存在!"); + + // 获取评价计划内已添加的未完成评价应用信息,且应用为当前登录复评用户所在分组评价项目关联的应用 + List groupList = groupService.list(Wrappers.lambdaQuery(PerformanceAppraisalProjectGroup.class) + .eq(PerformanceAppraisalProjectGroup::getAppraisalId, planId)); + // 筛选出当前登录复评用户所在的分组信息 + List groups = groupList.stream().filter(g -> { + String reAppraisalUsers = g.getReAppraisalUsers(); + if (reAppraisalUsers.contains(employeeCode)) { + return true; + } + return false; + }).collect(Collectors.toList()); + // 获取评价计划分组信息内的项目信息 + List proCodes = groups.stream() + .map(PerformanceAppraisalProjectGroup::getProjectCodes) + .collect(Collectors.toList()); + List projectCodes = Lists.newArrayList(); + for (String proCode : proCodes) { + if (proCode.contains(StrPool.COMMA)){ + projectCodes.addAll(Arrays.asList(proCode.split(StrPool.COMMA))); + }else { + projectCodes.add(proCode); + } + } + + List paas = performanceAppraisalApplicationService.list(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) + .eq(PerformanceAppraisalApplication::getAppraisalId, plan.getId()) + .in(PerformanceAppraisalApplication::getAppraisalProjectCode,projectCodes) + .eq(PerformanceAppraisalApplication::getIsCompleteAppraisal,Boolean.FALSE)); + if (CollUtil.isEmpty(paas)){ + return PageVo.empty(); + } + Set appraisalIds = paas.stream() + .map(PerformanceAppraisalApplication::getAppraisalId) + .collect(Collectors.toSet()); + // 从绩效评价打分信息表中获取上述绩效评价计划应用的打分信息 + List appraisalScoreInfos = performanceAppraisalAppScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppScoreInfo.class) + .in(PerformanceAppraisalAppScoreInfo::getAppraisalId, appraisalIds)); + // 筛选出当前登录用户未进行打分的应用信息 + List appIds = appraisalScoreInfos.stream() + .filter(a -> !employeeCode.equals(a.getAppraisalEmployeeCode())) + .map(PerformanceAppraisalAppScoreInfo::getApplicationId) + .collect(Collectors.toList()); + + // 没有当前用户待评价的应用信息 + if(CollUtil.isEmpty(appIds)){ + return PageVo.empty(); + } + + Page page = req.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(ProjectApplication.class) + .in(ProjectApplication::getId, appIds) + .like(StringUtils.isNotBlank(req.getApplicationName()),ProjectApplication::getApplicationName,req.getApplicationName()); + projectApplicationService.page(page,wrapper); + + if(0L == page.getTotal()){ + return PageVo.empty(); + } + + List res = page.getRecords().stream() + .map(p -> { + PerformanceAppraisalAppVO vo = BeanUtil.copyProperties(p, PerformanceAppraisalAppVO.class); + vo.setCanAppraisal(checkCanAppraisal(employeeCode,p.getId(),planId)); + vo.setAppraisalId(planId); + return vo; + }) + .collect(Collectors.toList()); + + return PageVo.of(res,page.getTotal()); + } + + public PageVo evaluatedList(Long planId, PerformanceAppraisalListReq req) { + + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + String employeeCode = user.getEmployeeCode(); + + PerformanceAppraisal plan = performanceAppraisalService.getById(planId); + VUtils.isTrue(Objects.isNull(plan)).throwMessage("该评价计划不存在!"); + + + // 获取评价计划内已添加的未完成评价应用信息,且应用为当前登录复评用户所在分组评价项目关联的应用 + List groupList = groupService.list(Wrappers.lambdaQuery(PerformanceAppraisalProjectGroup.class) + .eq(PerformanceAppraisalProjectGroup::getAppraisalId, planId)); + // 筛选出当前登录复评用户所在的分组信息 + List groups = groupList.stream().filter(g -> { + String reAppraisalUsers = g.getReAppraisalUsers(); + if (reAppraisalUsers.contains(employeeCode)) { + return true; + } + return false; + }).collect(Collectors.toList()); + // 获取评价计划分组信息内的项目信息 + List proCodes = groups.stream() + .map(PerformanceAppraisalProjectGroup::getProjectCodes) + .collect(Collectors.toList()); + List projectCodes = Lists.newArrayList(); + for (String proCode : proCodes) { + if (proCode.contains(StrPool.COMMA)){ + projectCodes.addAll(Arrays.asList(proCode.split(StrPool.COMMA))); + }else { + projectCodes.add(proCode); + } + } + + List paas = performanceAppraisalApplicationService.list(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) + .eq(PerformanceAppraisalApplication::getAppraisalId, plan.getId()) + .in(PerformanceAppraisalApplication::getAppraisalProjectCode,projectCodes) + .eq(PerformanceAppraisalApplication::getIsCompleteAppraisal,Boolean.FALSE)); + if (CollUtil.isEmpty(paas)){ + return PageVo.empty(); + } + Set appraisalIds = paas.stream() + .map(PerformanceAppraisalApplication::getAppraisalId) + .collect(Collectors.toSet()); + // 从绩效评价打分信息表中获取上述绩效评价计划应用的打分信息 + List appraisalScoreInfos = performanceAppraisalAppScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppScoreInfo.class) + .in(PerformanceAppraisalAppScoreInfo::getAppraisalId, appraisalIds)); + // 筛选出当前登录用户未进行打分的应用信息 + List appIds = appraisalScoreInfos.stream() + .filter(a -> employeeCode.equals(a.getAppraisalEmployeeCode())) + .map(PerformanceAppraisalAppScoreInfo::getApplicationId) + .collect(Collectors.toList()); + + // 没有当前用户待评价的应用信息 + if(CollUtil.isEmpty(appIds)){ + return PageVo.empty(); + } + + Page page = req.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(ProjectApplication.class) + .in(ProjectApplication::getId, appIds) + .like(StringUtils.isNotBlank(req.getApplicationName()),ProjectApplication::getApplicationName,req.getApplicationName()); + projectApplicationService.page(page,wrapper); + + if(0L == page.getTotal()){ + return PageVo.empty(); + } + + List res = page.getRecords().stream() + .map(p -> { + PerformanceAppraisalAppVO vo = BeanUtil.copyProperties(p, PerformanceAppraisalAppVO.class); + vo.setCanAppraisal(checkCanAppraisal(employeeCode,p.getId(),planId)); + vo.setAppraisalId(planId); + return vo; + }) + .collect(Collectors.toList()); + + return PageVo.of(res,page.getTotal()); + } + + /** + * 是否可以评价 + * + * @param employeeCode + * @param appId + * @param appraisalId + * @return + */ + private Boolean checkCanAppraisal(String employeeCode, Long appId, Long appraisalId) { + // 从绩效评价应用打分信息表中查询打分人员为当前登录复评用户的打分信息 + // 如果没有相关的打分信息,说明是当前登录复评用户是首次评价 + List scoreInfos = performanceAppraisalAppScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppScoreInfo.class) + .eq(PerformanceAppraisalAppScoreInfo::getApplicationId,appId) + .eq(PerformanceAppraisalAppScoreInfo::getAppraisalId,appraisalId) + .eq(PerformanceAppraisalAppScoreInfo::getAppraisalEmployeeCode, employeeCode)); + if (CollUtil.isEmpty(scoreInfos)){ + return true; + } + return Boolean.FALSE; + } + + + public AppAppraisalIndexDetailVO detail(Long appId) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + String regionCode = user.getRegionCode(); + + AppAppraisalIndexDetailVO resVo = new AppAppraisalIndexDetailVO(); + + // 获取指标配置的应用指标信息 + // 登录复评用户所在区域通用指标 + // todo 是否需要过滤展示形式为打分的通用指标 + List commonIndexList = performanceAppraisalAppIndicatorService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppIndicator.class) + .eq(PerformanceAppraisalAppIndicator::getRegionCode, regionCode) + .eq(PerformanceAppraisalAppIndicator::getIndexType, AppIndexTypeEnum.COMMON.getCode())); + if (CollUtil.isNotEmpty(commonIndexList)) { + List commonIndexDetails = commonIndexList.stream().map(i -> { + AppIndexDetailVO vo = new AppIndexDetailVO(); + BeanUtils.copyProperties(i, vo); + // 如果进行了打分,按复评人员分组 + List appAppraisalScoreInfo = performanceAppraisalAppScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppScoreInfo.class) + .eq(PerformanceAppraisalAppScoreInfo::getApplicationId, appId)); + if (CollUtil.isNotEmpty(appAppraisalScoreInfo)){ + Map> scoreInfoMap = appAppraisalScoreInfo.stream() + .collect(Collectors.groupingBy(PerformanceAppraisalAppScoreInfo::getAppraisalEmployeeName)); + HashMap scoreMap = MapUtil.newHashMap(); + for (String name : scoreInfoMap.keySet()) { + List scoreInfos = scoreInfoMap.get(name); + BigDecimal totalScore = scoreInfos.stream().map(PerformanceAppraisalAppScoreInfo::getAppraisalScore) + .filter(Objects::nonNull) + .reduce(BigDecimal.ZERO, BigDecimal::add); + scoreMap.put(name, totalScore); + } + resVo.setAppraisalScoreInfo(scoreInfoMap); + resVo.setAppraisalTotalScoreInfo(scoreMap); + } + return vo; + }).collect(Collectors.toList()); + resVo.setCommonIndexDetails(commonIndexDetails); + } + + // 登录复评用户所在区域辅助指标 + // todo 是否需要过滤展示形式为打分的辅助指标 + List auxIndexList = performanceAppraisalAppIndicatorService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppIndicator.class) + .eq(PerformanceAppraisalAppIndicator::getRegionCode, regionCode) + .eq(PerformanceAppraisalAppIndicator::getIndexType, AppIndexTypeEnum.AUX.getCode())); + if (CollUtil.isNotEmpty(auxIndexList)) { + List auxIndexDetails = auxIndexList.stream().map(i -> { + AppIndexDetailVO vo = new AppIndexDetailVO(); + BeanUtils.copyProperties(i, vo); + return vo; + }).collect(Collectors.toList()); + resVo.setAuxIndexDetails(auxIndexDetails); + } + // 获取应用的核心业务指标 + List coreBusinessIndicators = projectCoreBusinessIndicatorsService.list(Wrappers.lambdaQuery(ProjectCoreBusinessIndicators.class) + .eq(ProjectCoreBusinessIndicators::getApplicationId, appId)); + if (CollUtil.isNotEmpty(coreBusinessIndicators)) { + List businessIndexDetails = coreBusinessIndicators.stream().map(c -> { + AppBusinessIndexDetailVO appBusinessIndexDetailVo = new AppBusinessIndexDetailVO(); + BeanUtils.copyProperties(coreBusinessIndicators, appBusinessIndexDetailVo); + return appBusinessIndexDetailVo; + }).collect(Collectors.toList()); + resVo.setBusinessIndexDetails(businessIndexDetails); + } + return resVo; + } + + public String saveAppraisal(ProjectAppraisalDTO param) { + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + String employeeCode = userDetail.getEmployeeCode(); + String username = userDetail.getUsername(); + + Long applicationId = param.getApplicationId(); + Long appraisalId = param.getAppraisalId(); + List appAppraisalInfoList = param.getAppAppraisalInfoList(); + + // 获取评价应用 + PerformanceAppraisalApplication appraisalApplication = performanceAppraisalApplicationService.getOne(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) + .eq(PerformanceAppraisalApplication::getAppraisalId, appraisalId) + .eq(PerformanceAppraisalApplication::getApplicationId, applicationId)); + + List indexIds = appAppraisalInfoList.stream().filter(a -> AppIndexTypeEnum.COMMON.getCode().equals(a.getIndexType()) || + AppIndexTypeEnum.AUX.getCode().equals(a.getIndexType())) + .map(AppAppraisalInfoDTO::getIndexId) + .collect(Collectors.toList()); + List businessIndexIds = appAppraisalInfoList.stream() + .filter(a -> AppIndexTypeEnum.BUSINESS.getCode().equals(a.getIndexType())) + .map(AppAppraisalInfoDTO::getIndexId) + .collect(Collectors.toList()); + // 查出通用、辅助应用指标分数信息 + List indexList = performanceAppraisalAppIndicatorService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppIndicator.class) + .in(PerformanceAppraisalAppIndicator::getId, indexIds)); + if (CollUtil.isEmpty(indexList)){ + throw new BizException("评价指标不存在!"); + } + Map indexMap = indexList.stream().collect(Collectors.toMap(PerformanceAppraisalAppIndicator::getId, d -> d)); + + // 查出应用业务指标分数信息 + List businessIndexList = projectCoreBusinessIndicatorsService.list(Wrappers.lambdaQuery(ProjectCoreBusinessIndicators.class) + .in(ProjectCoreBusinessIndicators::getId, businessIndexIds)); + if (CollUtil.isEmpty(indexList)){ + throw new BizException("评价指标不存在!"); + } + Map businessIndexMap = businessIndexList.stream().collect(Collectors.toMap(ProjectCoreBusinessIndicators::getId, d -> d)); + + List scoreInfos = appAppraisalInfoList.stream().map(a -> { + if (AppIndexTypeEnum.COMMON.getCode().equals(a.getIndexType()) || + AppIndexTypeEnum.AUX.getCode().equals(a.getIndexType())){ + PerformanceAppraisalAppIndicator appIndicator = indexMap.get(a.getIndexId()); + BigDecimal score = a.getScore(); + BigDecimal indexScore = appIndicator.getIndexScore(); + if (score.compareTo(indexScore) > 0 || score.compareTo(BigDecimal.ZERO) < 0){ + throw new BizException("评价得分必须大于等于0且小于等于指标分值!"); + } + } else if (AppIndexTypeEnum.BUSINESS.getCode().equals(a.getIndexType())) { + ProjectCoreBusinessIndicators coreBusinessIndicators = businessIndexMap.get(a.getIndexId()); + BigDecimal score = a.getScore(); + BigDecimal indexScore = coreBusinessIndicators.getScore(); + if (score.compareTo(indexScore) > 0 || score.compareTo(BigDecimal.ZERO) < 0){ + throw new BizException("评价得分必须大于等于0且小于等于指标分值!"); + } + } + // 保存评价分数信息 + PerformanceAppraisalAppScoreInfo scoreInfo = new PerformanceAppraisalAppScoreInfo(); + scoreInfo.setAppraisalScore(a.getScore()); + scoreInfo.setAppraisalId(appraisalId); + scoreInfo.setAppraisalEmployeeCode(employeeCode); + scoreInfo.setAppraisalEmployeeName(username); + scoreInfo.setApplicationId(applicationId); + scoreInfo.setIndexId(a.getIndexId()); + scoreInfo.setIndexType(a.getIndexType()); + scoreInfo.setCreateOn(LocalDateTime.now()); + scoreInfo.setCreateBy(username); + scoreInfo.setUpdateOn(LocalDateTime.now()); + scoreInfo.setUpdateBy(username); + return scoreInfo; + }).collect(Collectors.toList()); + if (performanceAppraisalAppScoreInfoService.saveBatch(scoreInfos)){ + // 计算评价总分并保存 + BigDecimal appraisalTotalScore = appAppraisalInfoList.stream() + .map(AppAppraisalInfoDTO::getScore) + .filter(Objects::nonNull) + .reduce(BigDecimal.ZERO, BigDecimal::add); + BigDecimal lastAppraisalTotalScore; + // 判断项目所在分组内其他复评人员是否已经打分 + if (Objects.nonNull(appraisalApplication.getAppraisalTotalScore())){ + // 已经进行了复评,计算两个分值的平均分 + BigDecimal add = appraisalTotalScore.add(appraisalApplication.getAppraisalTotalScore()); + lastAppraisalTotalScore = add.divide(BigDecimal.valueOf(2)); + }else { + // 还没有进行过复评 + lastAppraisalTotalScore = appraisalTotalScore; + } + appraisalApplication.setAppraisalTotalScore(lastAppraisalTotalScore); + // 取最新地打分时间 + appraisalApplication.setAppraisalScoreTime(LocalDateTime.now()); + // 判断当前复评人是否为该评价应用关联的评价项目所在分组的复评人员中的最后一个复评人 + // 获取评价应用关联的评价项目所在的评价计划关联的分组信息 + String appraisalProjectCode = appraisalApplication.getAppraisalProjectCode(); + List groups = groupService.list(Wrappers.lambdaQuery(PerformanceAppraisalProjectGroup.class) + .eq(PerformanceAppraisalProjectGroup::getAppraisalId,appraisalId)); + + // 获取当前登录复评员所在包含该评价应用的分组信息 + List groupList = groups.stream().filter(g -> { + String reAppraisalUsers = g.getReAppraisalUsers(); + String projectCodes = g.getProjectCodes(); + if (reAppraisalUsers.contains(employeeCode) && + projectCodes.contains(appraisalProjectCode)) { + return true; + } + return false; + }).collect(Collectors.toList()); + PerformanceAppraisalProjectGroup projectGroup = groupList.get(0); + judgeCompleteAppraisal(projectGroup, appraisalApplication); + appraisalApplication.setUpdateOn(LocalDateTime.now()); + appraisalApplication.setUpdateBy(username); + performanceAppraisalApplicationService.updateById(appraisalApplication); + return "提交成功"; + } + return "提交失败"; + } + + + private void judgeCompleteAppraisal(PerformanceAppraisalProjectGroup group, PerformanceAppraisalApplication appraisalApplication) { + // 获取该评价应用的复评打分信息 + List scoreInfos = performanceAppraisalAppScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppScoreInfo.class) + .eq(PerformanceAppraisalAppScoreInfo::getAppraisalId, group.getAppraisalId()) + .eq(PerformanceAppraisalAppScoreInfo::getApplicationId, appraisalApplication.getApplicationId())); + String reAppraisalUsers = group.getReAppraisalUsers(); + List users = scoreInfos.stream().map(PerformanceAppraisalAppScoreInfo::getAppraisalEmployeeCode).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(users)){ + String join = String.join(StrPool.COMMA, users); + if (join.equals(reAppraisalUsers)) { + appraisalApplication.setIsCompleteAppraisal(Boolean.TRUE); + } + } + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalPlanManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalPlanManage.java index e988521..553c70c 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalPlanManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalPlanManage.java @@ -387,10 +387,17 @@ public class PerformanceAppraisalPlanManage { } List applicationIds = createDTO.getApplicationIds(); + Map applicationMap = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class).in(ProjectApplication::getId, applicationIds)).stream() + .collect(Collectors.toMap(ProjectApplication::getId, a -> a)); for(Long applicationId : applicationIds){ PerformanceAppraisalApplication paa = new PerformanceAppraisalApplication(); paa.setAppraisalId(id); paa.setApplicationId(applicationId); + ProjectApplication projectApplication = applicationMap.get(applicationId); + if (Objects.nonNull(projectApplication)){ + paa.setAppraisalProjectId(projectApplication.getProjectId()); + paa.setAppraisalProjectCode(projectApplication.getProjectCode()); + } paa.setCreateBy(user.getUsername()); paa.setCreateOn(LocalDateTime.now()); paa.setUpdateBy(user.getUsername()); @@ -439,18 +446,21 @@ public class PerformanceAppraisalPlanManage { if(Objects.isNull(editDTO.getApplicationIds())){ return; } - //删除先 performanceAppraisalApplicationService.remove(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) .eq(PerformanceAppraisalApplication::getAppraisalId,editDTO.getId())); List applicationIds = editDTO.getApplicationIds(); - + Map applicationMap = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class).in(ProjectApplication::getId, applicationIds)).stream() + .collect(Collectors.toMap(ProjectApplication::getId, a -> a)); for(Long applicationId : applicationIds){ - ProjectApplication projectApplication = applicationService.getById(applicationId); - VUtils.isTrue(Objects.isNull(projectApplication)).throwMessage("应用不存在 " + applicationId); PerformanceAppraisalApplication paa = new PerformanceAppraisalApplication(); paa.setAppraisalId(editDTO.getId()); paa.setApplicationId(applicationId); + ProjectApplication projectApplication = applicationMap.get(applicationId); + if (Objects.nonNull(projectApplication)){ + paa.setAppraisalProjectId(projectApplication.getProjectId()); + paa.setAppraisalProjectCode(projectApplication.getProjectCode()); + } paa.setCreateBy(user.getUsername()); paa.setCreateOn(LocalDateTime.now()); paa.setUpdateBy(user.getUsername()); @@ -800,6 +810,8 @@ public class PerformanceAppraisalPlanManage { List res = page.getRecords().stream().map(r -> { PerformanceAppraisalApplicationVO vo = new PerformanceAppraisalApplicationVO(); vo.setAppId(r.getId()); + vo.setAppraisalProjectId(r.getProjectId()); + vo.setAppraisalProjectCode(r.getProjectCode()); vo.setApplicationName(Objects.nonNull(r.getApplicationName()) ? r.getApplicationName() : r.getRelatedExistsApplication()); vo.setBuildOrgName(r.getBuildOrgName()); vo.setApplicationType(r.getApplicationType()); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/ReAppraisalManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/ReAppraisalManage.java index 9d8bbbd..b57277e 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/ReAppraisalManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/ReAppraisalManage.java @@ -65,8 +65,6 @@ public class ReAppraisalManage { public PageVo list(PerformanceAppraisalListReq req) { UserInfoDetails user = LoginUserUtil.loginUserDetail(); String employeeCode = user.getEmployeeCode(); - //当前登录用户 单位code - String empPosUnitCode = user.getEmpPosUnitCode(); // 获取当前登录用户的角色列表,只有绩效复评人员才能查看该列表 List userRoleList = user.getUserRoleList(); List roleIdList = userRoleList.stream().map(Role::getId).collect(Collectors.toList()); @@ -97,7 +95,12 @@ public class ReAppraisalManage { // 获取当前登录复评员所在的分组信息 List groupList = groups.stream().filter(g -> { String reAppraisalUsers = g.getReAppraisalUsers(); - List empCodeList = Arrays.stream(reAppraisalUsers.split(StrPool.COMMA)).collect(Collectors.toList()); + List empCodeList = Lists.newArrayList(); + if (reAppraisalUsers.contains(StrPool.COMMA)) { + empCodeList.addAll(Arrays.asList(reAppraisalUsers.split(StrPool.COMMA))); + }else { + empCodeList.add(reAppraisalUsers); + } if (empCodeList.contains(employeeCode)) { return true; } @@ -290,7 +293,9 @@ public class ReAppraisalManage { } private void judgeCompleteReAppraisal(PerformanceAppraisalProjectGroup group, PerformanceAppraisalProject appraisalProject) { + // 获取该评价计划的复评打分信息 Map> scoreInfoMap = performanceAppraisalScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalScoreInfo.class) + .eq(PerformanceAppraisalScoreInfo::getAppraisalId,group.getAppraisalId()) .eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.RE_APPRAISAL.getCode())) .stream().collect(Collectors.groupingBy(PerformanceAppraisalScoreInfo::getAppraisalEmployeeCode)); @@ -307,11 +312,8 @@ public class ReAppraisalManage { // 获取分组内复评人员对分组内项目的复评分数信息 List scoreInfoList = scoreInfoMap.get(reUser); if (CollUtil.isNotEmpty(scoreInfoList)){ - List projectIdList = scoreInfoList.stream() - .map(PerformanceAppraisalScoreInfo::getAppraisalProjectId) - .collect(Collectors.toList()); - List proCodes = projectService.listByIds(projectIdList).stream() - .map(Project::getProjectCode) + List proCodes = scoreInfoList.stream() + .map(PerformanceAppraisalScoreInfo::getAppraisalProjectCode) .collect(Collectors.toList()); // 当前登录用户所在分组的复评人员 对分组内所有项目进行了复评 if (CollUtil.isNotEmpty(proCodes)){ diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/RectifyAuditManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/RectifyAuditManage.java new file mode 100644 index 0000000..95a5923 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/RectifyAuditManage.java @@ -0,0 +1,375 @@ +package com.ningdatech.pmapi.performance.manage; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; + +import cn.hutool.core.text.StrPool; +import com.google.common.collect.Lists; +import com.ningdatech.pmapi.common.enumeration.CommonEnum; +import com.ningdatech.pmapi.performance.enumration.AppraisalTypeEnum; +import com.ningdatech.pmapi.performance.enumration.RectifyAuditEnum; +import com.ningdatech.pmapi.performance.model.dto.ProjectAppraisalInfoDTO; +import com.ningdatech.pmapi.performance.model.entity.*; +import com.ningdatech.pmapi.performance.service.*; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.function.VUtils; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.pmapi.common.helper.UserInfoHelper; +import com.ningdatech.pmapi.performance.enumration.RectifyStatusEnum; +import com.ningdatech.pmapi.performance.model.dto.ProjectAppraisalDTO; +import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq; +import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalProjectVO; +import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalVO; +import com.ningdatech.pmapi.performance.model.vo.RectifyDetailVO; +import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum; +import com.ningdatech.pmapi.projectlib.model.entity.Project; +import com.ningdatech.pmapi.projectlib.service.IProjectService; +import com.ningdatech.pmapi.sys.model.entity.Role; +import com.ningdatech.pmapi.sys.service.IRoleService; +import com.ningdatech.pmapi.user.entity.enumeration.RoleEnum; +import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; +import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; +import com.ningdatech.pmapi.user.util.LoginUserUtil; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * RectifyAuditManage + * + * @return + * @author CMM + * @since 2023/08/12 17:36 + */ +@Component +@Slf4j +@AllArgsConstructor +public class RectifyAuditManage { + + private final IPerformanceAppraisalService performanceAppraisalService; + private final IPerformanceAppraisalProjectService performanceAppraisalProjectService; + private final IProjectService projectService; + private final IRoleService roleService; + private final UserInfoHelper userInfoHelper; + private final IPerformanceAppraisalProjectGroupService groupService; + private final IPerformanceIndicatorProjectTemplateDetailService indicatorProjectTemplateDetailService; + private final IPerformanceAppraisalScoreInfoService performanceAppraisalScoreInfoService; + /** + * 绩效列表 + * + * @param req + * @return + */ + public PageVo list(PerformanceAppraisalListReq req) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + + // 当前登录用户 单位code + String employeeCode = user.getEmployeeCode(); + // 获取当前登录用户的角色列表,只有专家才能查看该列表 + List userRoleList = user.getUserRoleList(); + List roleIdList = userRoleList.stream().map(Role::getId).collect(Collectors.toList()); + Role role = + roleService.getOne(Wrappers.lambdaQuery(Role.class).eq(Role::getName, RoleEnum.COMPANY_MANAGER.getDesc())); + if (Objects.isNull(role)) { + throw new BizException("登录用户没有专家角色!"); + } + + // 登录用户不是专家,不能查看本单位的整改审核计划列表 + if (!roleIdList.contains(role.getId())) { + return PageVo.empty(); + } + + // 从绩效评价 分组表中获取当前登录专家所在的分组信息 且登录用户为核查组长 + List groups = Lists.newArrayList(); + List projectGroups = groupService.list(); + for (PerformanceAppraisalProjectGroup projectGroup : projectGroups) { + String verifyLeader = projectGroup.getVerifyLeader(); + if (verifyLeader.equals(employeeCode)) { + groups.add(projectGroup); + } + } + // 当前登录专家没有绩效分组信息 + if (CollUtil.isEmpty(groups)) { + return PageVo.empty(); + } + + // 获取分组所在的评价计划ID + List appraisalIds = + groups.stream().map(PerformanceAppraisalProjectGroup::getAppraisalId).collect(Collectors.toList()); + Page page = req.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(PerformanceAppraisal.class) + .in(PerformanceAppraisal::getId, appraisalIds).orderByDesc(PerformanceAppraisal::getUpdateOn); + performanceAppraisalService.page(page, wrapper); + if (0L == page.getTotal()) { + return PageVo.empty(); + } + + // 获取评价计划内的所有需整改核查项目信息(整改状态为整改待审核、整改审核不通过、整改审核通过) + List paps = performanceAppraisalProjectService.list(Wrappers + .lambdaQuery(PerformanceAppraisalProject.class) + .in(PerformanceAppraisalProject::getAppraisalId, appraisalIds) + .and(wp -> wp.eq(PerformanceAppraisalProject::getRectifyStatus, RectifyStatusEnum.TO_BE_REVIEWED.getCode()) + .or().eq(PerformanceAppraisalProject::getRectifyStatus, RectifyStatusEnum.NOT_APPROVED.getCode()).or() + .eq(PerformanceAppraisalProject::getRectifyStatus, RectifyStatusEnum.APPROVED.getCode())) + .eq(PerformanceAppraisalProject::getIsRectify, Boolean.TRUE)); + // 评价计划内符合条件的项目数为空 + if (CollUtil.isEmpty(paps)) { + return PageVo.empty(); + } + // 按评价计划分组 + Map> papsMap = + paps.stream().collect(Collectors.groupingBy(PerformanceAppraisalProject::getAppraisalId)); + + List res = page.getRecords().stream().map(p -> { + PerformanceAppraisalVO vo = BeanUtil.copyProperties(p, PerformanceAppraisalVO.class); + // 统计评价计划待核查项目数量(整改状态为:整改待审核) + List projects = papsMap.get(p.getId()); + List unRectifyAuditProjects = + projects.stream().filter(d -> RectifyStatusEnum.TO_BE_REVIEWED.getCode().equals(d.getRectifyStatus())) + .collect(Collectors.toList()); + vo.setUnRectifyAuditNumber(unRectifyAuditProjects.size()); + // 统计评价计划已核查项目数量(整改状态为:整改核查不通过、整改审核通过) + List rectifiedAuditProjects = + paps.stream() + .filter(d -> RectifyStatusEnum.NOT_APPROVED.getCode().equals(d.getRectifyStatus()) + || RectifyStatusEnum.APPROVED.getCode().equals(d.getRectifyStatus())) + .collect(Collectors.toList()); + vo.setRectifiedAuditNumber(rectifiedAuditProjects.size()); + return vo; + }).collect(Collectors.toList()); + return PageVo.of(res, page.getTotal()); + } + + public PageVo unAuditList(Long planId, PerformanceAppraisalListReq req) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + String employeeCode = user.getEmployeeCode(); + + PerformanceAppraisal plan = performanceAppraisalService.getById(planId); + VUtils.isTrue(Objects.isNull(plan)).throwMessage("该评价计划不存在!"); + + // 因为一个核查用户只能出现在一个评价计划中的一个分组中,所以根据评价计划ID和核查组长信息可以确定分组内项目信息 + PerformanceAppraisalProjectGroup projectGroup = + groupService.getOne(Wrappers.lambdaQuery(PerformanceAppraisalProjectGroup.class) + .eq(PerformanceAppraisalProjectGroup::getAppraisalId, planId) + .eq(PerformanceAppraisalProjectGroup::getVerifyLeader, employeeCode)); + // 当前登录专家没有为核查组长的绩效分组信息 + if (Objects.isNull(projectGroup)) { + return PageVo.empty(); + } + + String groupProjectCodes = projectGroup.getProjectCodes(); + List codes = Lists.newArrayList(); + if (groupProjectCodes.contains(StrPool.COMMA)) { + codes.addAll(Arrays.asList(groupProjectCodes.split(StrPool.COMMA))); + } else { + codes.add(groupProjectCodes); + } + // 获取评价计划内已添加的核查组长为当前登录专家用户的待整改审核项目信息 + List paps = + performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) + .eq(PerformanceAppraisalProject::getAppraisalId, plan.getId()) + .in(PerformanceAppraisalProject::getProjectCode, codes) + .eq(PerformanceAppraisalProject::getIsRectify, Boolean.TRUE) + .eq(PerformanceAppraisalProject::getRectifyStatus, RectifyStatusEnum.TO_BE_REVIEWED.getCode())); + if (CollUtil.isEmpty(paps)) { + return PageVo.empty(); + } + Map papsMap = + paps.stream().collect(Collectors.toMap(PerformanceAppraisalProject::getProjectId, p -> p)); + + // 获取本单位在当前评价计划内的项目 + Set projectCodes = + paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toSet()); + Page page = req.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Project.class) + .in(Project::getProjectCode, projectCodes).eq(Project::getNewest, Boolean.TRUE) + .like(StringUtils.isNotBlank(req.getBuildOrgName()), Project::getBuildOrgName, req.getBuildOrgName()) + .like(StringUtils.isNotBlank(req.getProjectName()), Project::getProjectName, req.getProjectName()); + projectService.page(page, wrapper); + + if (0L == page.getTotal()) { + return PageVo.empty(); + } + + List res = page.getRecords().stream().map(p -> { + PerformanceAppraisalProjectVO vo = BeanUtil.copyProperties(p, PerformanceAppraisalProjectVO.class); + PerformanceAppraisalProject appraisalProject = papsMap.get(p.getId()); + BeanUtil.copyProperties(appraisalProject, vo); + vo.setProjectId(appraisalProject.getProjectId()); + vo.setProjectCode(appraisalProject.getProjectCode()); + vo.setProjectTypeName(ProjectTypeEnum.getDesc(p.getProjectType())); + vo.setAppraisalId(planId); + vo.setRectifyStatus(appraisalProject.getRectifyStatus()); + vo.setRectifyStatusName(RectifyStatusEnum.getDesc(appraisalProject.getRectifyStatus())); + vo.setGroupId(projectGroup.getId()); + return vo; + }).collect(Collectors.toList()); + + return PageVo.of(res, page.getTotal()); + } + + public PageVo auditedList(Long planId, PerformanceAppraisalListReq req) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + String employeeCode = user.getEmployeeCode(); + + PerformanceAppraisal plan = performanceAppraisalService.getById(planId); + VUtils.isTrue(Objects.isNull(plan)).throwMessage("该评价计划不存在!"); + + // 因为一个核查用户只能出现在一个评价计划中的一个分组中,所以根据评价计划ID和核查组长信息可以确定分组内项目信息 + PerformanceAppraisalProjectGroup projectGroup = + groupService.getOne(Wrappers.lambdaQuery(PerformanceAppraisalProjectGroup.class) + .eq(PerformanceAppraisalProjectGroup::getAppraisalId, planId) + .eq(PerformanceAppraisalProjectGroup::getVerifyLeader, employeeCode)); + // 当前登录专家没有为核查组长的绩效分组信息 + if (Objects.isNull(projectGroup)) { + return PageVo.empty(); + } + + String groupProjectCodes = projectGroup.getProjectCodes(); + List codes = Lists.newArrayList(); + if (groupProjectCodes.contains(StrPool.COMMA)) { + codes.addAll(Arrays.asList(groupProjectCodes.split(StrPool.COMMA))); + } else { + codes.add(groupProjectCodes); + } + // 获取评价计划内已添加的核查组长为当前登录专家用户的已整改审核项目信息 + List< + PerformanceAppraisalProject> paps = + performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) + .eq(PerformanceAppraisalProject::getAppraisalId, plan.getId()) + .in(PerformanceAppraisalProject::getProjectCode, codes) + .eq(PerformanceAppraisalProject::getIsRectify, Boolean.TRUE) + .and(wp -> wp + .eq(PerformanceAppraisalProject::getRectifyStatus, RectifyStatusEnum.NOT_APPROVED.getCode()) + .or().eq(PerformanceAppraisalProject::getRectifyStatus, RectifyStatusEnum.APPROVED.getCode()))); + if (CollUtil.isEmpty(paps)) { + return PageVo.empty(); + } + Map papsMap = + paps.stream().collect(Collectors.toMap(PerformanceAppraisalProject::getProjectId, p -> p)); + + // 获取评价计划内的项目 + Set projectCodes = + paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toSet()); + Page page = req.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Project.class) + .in(Project::getProjectCode, projectCodes).eq(Project::getNewest, Boolean.TRUE) + .like(StringUtils.isNotBlank(req.getBuildOrgName()), Project::getBuildOrgName, req.getBuildOrgName()) + .like(StringUtils.isNotBlank(req.getProjectName()), Project::getProjectName, req.getProjectName()); + projectService.page(page, wrapper); + + if (0L == page.getTotal()) { + return PageVo.empty(); + } + + List res = page.getRecords().stream().map(p -> { + PerformanceAppraisalProjectVO vo = BeanUtil.copyProperties(p, PerformanceAppraisalProjectVO.class); + PerformanceAppraisalProject appraisalProject = papsMap.get(p.getId()); + BeanUtil.copyProperties(appraisalProject, vo); + vo.setProjectId(appraisalProject.getProjectId()); + vo.setProjectCode(appraisalProject.getProjectCode()); + vo.setProjectTypeName(ProjectTypeEnum.getDesc(p.getProjectType())); + vo.setAppraisalId(planId); + vo.setRectifyStatus(appraisalProject.getRectifyStatus()); + vo.setRectifyStatusName(RectifyStatusEnum.getDesc(appraisalProject.getRectifyStatus())); + vo.setGroupId(projectGroup.getId()); + return vo; + }).collect(Collectors.toList()); + + return PageVo.of(res, page.getTotal()); + } + + @Transactional(rollbackFor = Exception.class) + public String submit(ProjectAppraisalDTO param) { + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + String employeeCode = userDetail.getEmployeeCode(); + String username = userDetail.getUsername(); + Long appraisalId = param.getAppraisalId(); + Long appraisalProjectId = param.getAppraisalProjectId(); + String appraisalProjectCode = param.getAppraisalProjectCode(); + Integer rectifyAuditResult = param.getRectifyAuditResult(); + String rectifyAuditOpinion = param.getRectifyAuditOpinion(); + String rectifyAuditAppendix = param.getRectifyAuditAppendix(); + List appraisalInfoList = param.getAppraisalInfoList(); + Long groupId = param.getGroupId(); + PerformanceAppraisalProjectGroup group = groupService.getById(groupId); + + // 获取评价项目 + PerformanceAppraisalProject appraisalProject = performanceAppraisalProjectService.getOne(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) + .eq(PerformanceAppraisalProject::getAppraisalId, appraisalId) + .eq(PerformanceAppraisalProject::getProjectCode,appraisalProjectCode) + .eq(PerformanceAppraisalProject::getProjectId, appraisalProjectId)); + + List ids = appraisalInfoList.stream() + .map(ProjectAppraisalInfoDTO::getProjectTemplateDetailId) + .collect(Collectors.toList()); + // 查出项目模版详情信息 + List detailList = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) + .in(PerformanceIndicatorProjectTemplateDetail::getId, ids)); + if (CollUtil.isEmpty(detailList)){ + throw new BizException("评价指标不存在!"); + } + Map detailMap = detailList.stream().collect(Collectors.toMap(PerformanceIndicatorProjectTemplateDetail::getId, d -> d)); + List scoreInfos = appraisalInfoList.stream().map(a -> { + PerformanceIndicatorProjectTemplateDetail templateDetail = detailMap.get(a.getProjectTemplateDetailId()); + BigDecimal score = a.getScore(); + BigDecimal indexScore = templateDetail.getIndexScore(); + if (score.compareTo(indexScore) > 0 || score.compareTo(BigDecimal.ZERO) < 0){ + throw new BizException("核查审核得分必须大于等于0且小于等于指标分值!"); + } + // 保存核查分数信息 + PerformanceAppraisalScoreInfo scoreInfo = new PerformanceAppraisalScoreInfo(); + scoreInfo.setAppraisalBasis(a.getAppraisalBasis()); + scoreInfo.setAppraisalScore(a.getScore()); + scoreInfo.setAppraisalBasisAppendix(a.getAppraisalBasisAppendix()); + scoreInfo.setAppraisalType(AppraisalTypeEnum.EXPERT_RECTIFY_AUDIT.getCode()); + scoreInfo.setTemplateDetailId(templateDetail.getId()); + scoreInfo.setTemplateId(templateDetail.getTemplateId()); + scoreInfo.setAppraisalEmployeeCode(employeeCode); + scoreInfo.setAppraisalEmployeeName(username); + scoreInfo.setAppraisalId(appraisalId); + scoreInfo.setAppraisalProjectId(appraisalProjectId); + scoreInfo.setAppraisalProjectCode(appraisalProjectCode); + scoreInfo.setCreateOn(LocalDateTime.now()); + scoreInfo.setCreateBy(username); + return scoreInfo; + }).collect(Collectors.toList()); + + if (performanceAppraisalScoreInfoService.saveBatch(scoreInfos)){ + // 计算核查总分并保存 + BigDecimal rectifyTotalScore = appraisalInfoList.stream() + .map(ProjectAppraisalInfoDTO::getScore) + .filter(Objects::nonNull) + .reduce(BigDecimal.ZERO, BigDecimal::add); + + // 保存整改审核相关信息 + appraisalProject.setRectifyTotalScore(rectifyTotalScore); + appraisalProject.setRectifyScoreTime(LocalDateTime.now()); + appraisalProject.setUpdateOn(LocalDateTime.now()); + appraisalProject.setUpdateBy(username); + appraisalProject.setRectifyAuditResult(rectifyAuditResult); + appraisalProject.setRectifyAuditOpinion(rectifyAuditOpinion); + appraisalProject.setRectifyAuditAppendix(rectifyAuditAppendix); + if (RectifyAuditEnum.APPROVED.getCode().equals(rectifyAuditResult)) { + appraisalProject.setRectifyStatus(RectifyStatusEnum.APPROVED.getCode()); + } else if (RectifyAuditEnum.NOT_APPROVED.getCode().equals(rectifyAuditResult)) { + appraisalProject.setRectifyStatus(RectifyStatusEnum.NOT_APPROVED.getCode()); + } + performanceAppraisalProjectService.updateById(appraisalProject); + return "提交成功"; + } + return "提交失败"; + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/RectifyManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/RectifyManage.java new file mode 100644 index 0000000..fac7148 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/RectifyManage.java @@ -0,0 +1,296 @@ +package com.ningdatech.pmapi.performance.manage; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Collectors; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.function.VUtils; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.pmapi.common.helper.UserInfoHelper; +import com.ningdatech.pmapi.performance.enumration.RectifyStatusEnum; +import com.ningdatech.pmapi.performance.model.dto.ProjectAppraisalDTO; +import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisal; +import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalProject; +import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq; +import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalProjectVO; +import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalVO; +import com.ningdatech.pmapi.performance.model.vo.RectifyDetailVO; +import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalProjectService; +import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalService; +import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; +import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum; +import com.ningdatech.pmapi.projectlib.model.entity.Project; +import com.ningdatech.pmapi.projectlib.service.IProjectService; +import com.ningdatech.pmapi.sys.model.entity.Role; +import com.ningdatech.pmapi.sys.service.IRoleService; +import com.ningdatech.pmapi.user.entity.enumeration.RoleEnum; +import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; +import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; +import com.ningdatech.pmapi.user.util.LoginUserUtil; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * RectifyManage + * + * @return + * @author CMM + * @since 2023/08/12 17:36 + */ +@Component +@Slf4j +@AllArgsConstructor +public class RectifyManage { + + private final IPerformanceAppraisalService performanceAppraisalService; + private final IPerformanceAppraisalProjectService performanceAppraisalProjectService; + private final IProjectService projectService; + private final IRoleService roleService; + private final UserInfoHelper userInfoHelper; + + /** + * 绩效列表 + * + * @param req + * @return + */ + public PageVo list(PerformanceAppraisalListReq req) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + + // 当前登录用户 单位code + String empPosUnitCode = user.getEmpPosUnitCode(); + // 获取当前登录用户的角色列表,只有单位管理员才能查看该列表 + List userRoleList = user.getUserRoleList(); + List roleIdList = userRoleList.stream().map(Role::getId).collect(Collectors.toList()); + Role role = + roleService.getOne(Wrappers.lambdaQuery(Role.class).eq(Role::getName, RoleEnum.COMPANY_MANAGER.getDesc())); + if (Objects.isNull(role)) { + throw new BizException("登录用户没有单位管理员角色!"); + } + + // 登录用户不是单位管理员,不能查看本单位的整改计划列表 + if (!roleIdList.contains(role.getId())) { + return PageVo.empty(); + } + + // 获取登录用户所在单位的所有已终验项目信息 + List projectLists = projectService.list(Wrappers.lambdaQuery(Project.class) + .eq(Project::getStatus, ProjectStatusEnum.ACCEPTED.getCode()).eq(Project::getBuildOrgCode, empPosUnitCode)); + + if (CollUtil.isEmpty(projectLists)) { + return PageVo.empty(); + } + List projectIds = projectLists.stream().map(Project::getId).collect(Collectors.toList()); + // 获取添加过该单位项目的所有评价计划信息,且评价计划内包含有需要整改项目 + List paps = performanceAppraisalProjectService.list(Wrappers + .lambdaQuery(PerformanceAppraisalProject.class).in(PerformanceAppraisalProject::getProjectId, projectIds) + .eq(PerformanceAppraisalProject::getIsRectify, Boolean.TRUE)); + // 按评价计划分组 + Map> papsMap = + paps.stream().collect(Collectors.groupingBy(PerformanceAppraisalProject::getAppraisalId)); + if (CollUtil.isEmpty(paps)) { + return PageVo.empty(); + } + Set paIds = paps.stream().map(PerformanceAppraisalProject::getAppraisalId).collect(Collectors.toSet()); + // 获取评价计划列表 + Page page = req.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(PerformanceAppraisal.class) + .in(PerformanceAppraisal::getId, paIds).orderByDesc(PerformanceAppraisal::getUpdateOn); + performanceAppraisalService.page(page, wrapper); + if (0L == page.getTotal()) { + return PageVo.empty(); + } + + List res = page.getRecords().stream().map(p -> { + PerformanceAppraisalVO vo = BeanUtil.copyProperties(p, PerformanceAppraisalVO.class); + // 统计评价计划待整改项目数量(整改状态为:整改情况待提交、整改核查不通过) + List projects = papsMap.get(p.getId()); + List unRectifyProjects = projects.stream() + .filter(d -> RectifyStatusEnum.TO_BE_SUBMITTED.getCode().equals(d.getRectifyStatus()) + || RectifyStatusEnum.NOT_APPROVED.getCode().equals(d.getRectifyStatus())) + .collect(Collectors.toList()); + vo.setUnRectifyNumber(unRectifyProjects.size()); + // 统计评价计划已整改项目数量(整改状态为:整改待审核、整改审核通过) + List rectifiedProjects = + paps.stream() + .filter(d -> RectifyStatusEnum.TO_BE_REVIEWED.getCode().equals(d.getRectifyStatus()) + || RectifyStatusEnum.APPROVED.getCode().equals(d.getRectifyStatus())) + .collect(Collectors.toList()); + vo.setRectifiedNumber(rectifiedProjects.size()); + return vo; + }).collect(Collectors.toList()); + return PageVo.of(res, page.getTotal()); + } + + public PageVo unRectifyList(Long planId, PerformanceAppraisalListReq req) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + + PerformanceAppraisal plan = performanceAppraisalService.getById(planId); + VUtils.isTrue(Objects.isNull(plan)).throwMessage("该评价计划不存在!"); + + // 获取评价计划内已添加的待整改项目信息 + List paps = + performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) + .eq(PerformanceAppraisalProject::getAppraisalId, plan.getId()) + .eq(PerformanceAppraisalProject::getIsRectify, Boolean.TRUE) + .and(wp -> wp + .eq(PerformanceAppraisalProject::getRectifyStatus, RectifyStatusEnum.TO_BE_SUBMITTED.getCode()).or() + .eq(PerformanceAppraisalProject::getRectifyStatus, RectifyStatusEnum.NOT_APPROVED.getCode()))); + Map papsMap = + paps.stream().collect(Collectors.toMap(PerformanceAppraisalProject::getProjectId, p -> p)); + + if (CollUtil.isEmpty(paps)) { + return PageVo.empty(); + } + + // 获取本单位在当前评价计划内的项目 + Set projectCodes = + paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toSet()); + Page page = req.page(); + LambdaQueryWrapper wrapper = + Wrappers.lambdaQuery(Project.class).in(Project::getProjectCode, projectCodes) + .eq(Project::getNewest, Boolean.TRUE).eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()) + .like(StringUtils.isNotBlank(req.getProjectName()), Project::getProjectName, req.getProjectName()); + projectService.page(page, wrapper); + + if (0L == page.getTotal()) { + return PageVo.empty(); + } + + List res = page.getRecords().stream().map(p -> { + PerformanceAppraisalProjectVO vo = BeanUtil.copyProperties(p, PerformanceAppraisalProjectVO.class); + PerformanceAppraisalProject appraisalProject = papsMap.get(p.getId()); + BeanUtil.copyProperties(appraisalProject, vo); + vo.setProjectId(appraisalProject.getProjectId()); + vo.setProjectCode(appraisalProject.getProjectCode()); + vo.setProjectTypeName(ProjectTypeEnum.getDesc(p.getProjectType())); + vo.setAppraisalId(planId); + vo.setRectifyStatus(appraisalProject.getRectifyStatus()); + vo.setRectifyStatusName(RectifyStatusEnum.getDesc(appraisalProject.getRectifyStatus())); + return vo; + }).collect(Collectors.toList()); + + return PageVo.of(res, page.getTotal()); + } + + public PageVo rectifiedList(Long planId, PerformanceAppraisalListReq req) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + + PerformanceAppraisal plan = performanceAppraisalService.getById(planId); + VUtils.isTrue(Objects.isNull(plan)).throwMessage("该评价计划不存在!"); + + // 获取评价计划内已添加的已整改项目信息 + List paps = + performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) + .eq(PerformanceAppraisalProject::getAppraisalId, plan.getId()) + .eq(PerformanceAppraisalProject::getIsRectify, Boolean.TRUE) + .and(wp -> wp + .eq(PerformanceAppraisalProject::getRectifyStatus, RectifyStatusEnum.TO_BE_REVIEWED.getCode()).or() + .eq(PerformanceAppraisalProject::getRectifyStatus, RectifyStatusEnum.APPROVED.getCode()))); + Map papsMap = + paps.stream().collect(Collectors.toMap(PerformanceAppraisalProject::getProjectId, p -> p)); + + if (CollUtil.isEmpty(paps)) { + return PageVo.empty(); + } + + // 获取本单位在当前评价计划内的项目 + Set projectCodes = + paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toSet()); + Page page = req.page(); + LambdaQueryWrapper wrapper = + Wrappers.lambdaQuery(Project.class).in(Project::getProjectCode, projectCodes) + .eq(Project::getNewest, Boolean.TRUE).eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()) + .like(StringUtils.isNotBlank(req.getProjectName()), Project::getProjectName, req.getProjectName()); + projectService.page(page, wrapper); + + if (0L == page.getTotal()) { + return PageVo.empty(); + } + List res = page.getRecords().stream().map(p -> { + PerformanceAppraisalProjectVO vo = BeanUtil.copyProperties(p, PerformanceAppraisalProjectVO.class); + PerformanceAppraisalProject appraisalProject = papsMap.get(p.getId()); + BeanUtil.copyProperties(appraisalProject, vo); + vo.setProjectId(appraisalProject.getProjectId()); + vo.setProjectCode(appraisalProject.getProjectCode()); + vo.setProjectTypeName(ProjectTypeEnum.getDesc(p.getProjectType())); + vo.setAppraisalId(planId); + vo.setRectifyStatus(appraisalProject.getRectifyStatus()); + vo.setRectifyStatusName(RectifyStatusEnum.getDesc(appraisalProject.getRectifyStatus())); + return vo; + }).collect(Collectors.toList()); + + return PageVo.of(res, page.getTotal()); + } + + public RectifyDetailVO getRectifyDetail(Long planId, String projectCode) { + RectifyDetailVO vo = new RectifyDetailVO(); + // 根据评价计划ID和项目编号获取评价项目信息 + PerformanceAppraisalProject appraisalProject = performanceAppraisalProjectService.getOne(Wrappers + .lambdaQuery(PerformanceAppraisalProject.class).eq(PerformanceAppraisalProject::getAppraisalId, planId) + .eq(PerformanceAppraisalProject::getProjectCode, projectCode)); + VUtils.isTrue(Objects.isNull(appraisalProject)).throwMessage("该项目已被移除评价计划,请返回上一页或者刷新重试!!"); + BeanUtils.copyProperties(appraisalProject, vo); + String rectifySubmitEmployeeCode = appraisalProject.getRectifySubmitEmployeeCode(); + if (StringUtils.isNotBlank(rectifySubmitEmployeeCode)) { + UserFullInfoDTO userFullInfoDto = userInfoHelper.getUserFullInfoByEmployeeCode(rectifySubmitEmployeeCode); + vo.setRectifySubmitEmployee(userFullInfoDto); + } + String rectifyResSubEmpCode = appraisalProject.getRectifyResSubEmpCode(); + if (StringUtils.isNotBlank(rectifyResSubEmpCode)) { + UserFullInfoDTO userFullInfoDto = userInfoHelper.getUserFullInfoByEmployeeCode(rectifyResSubEmpCode); + vo.setRectifyResSubEmployee(userFullInfoDto); + } + vo.setRectifyStatusName(RectifyStatusEnum.getDesc(appraisalProject.getRectifyStatus())); + return vo; + } + + @Transactional(rollbackFor = Exception.class) + public String fillOutResult(ProjectAppraisalDTO param) { + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + String employeeCode = userDetail.getEmployeeCode(); + String username = userDetail.getUsername(); + + Long appraisalId = param.getAppraisalId(); + Long appraisalProjectId = param.getAppraisalProjectId(); + String appraisalProjectCode = param.getAppraisalProjectCode(); + String rectifyResult = param.getRectifyResult(); + String rectifyResultAppendix = param.getRectifyResultAppendix(); + + // 判断该项目是否还存在于计划或分组中 + PerformanceAppraisalProject appraisalProject = performanceAppraisalProjectService.getOne(Wrappers + .lambdaQuery(PerformanceAppraisalProject.class).eq(PerformanceAppraisalProject::getAppraisalId, appraisalId) + .eq(PerformanceAppraisalProject::getProjectId, appraisalProjectId) + .eq(PerformanceAppraisalProject::getProjectCode, appraisalProjectCode)); + if (Objects.isNull(appraisalProject)) { + throw new BizException("该项目已被移除评价计划,请返回上一页或者刷新重试!"); + } + appraisalProject.setRectifyResult(rectifyResult); + appraisalProject.setRectifyResultAppendix(rectifyResultAppendix); + appraisalProject.setRectifyResSubEmpCode(employeeCode); + appraisalProject.setRectifyResSubTime(LocalDateTime.now()); + // 更新整改状态为整改待审核 + appraisalProject.setRectifyStatus(RectifyStatusEnum.TO_BE_REVIEWED.getCode()); + appraisalProject.setUpdateOn(LocalDateTime.now()); + appraisalProject.setUpdateBy(username); + if (performanceAppraisalProjectService.updateById(appraisalProject)) { + return "提交审核成功!"; + } + return "提交审核失败"; + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/VerifyManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/VerifyManage.java index 66e7d01..044ce7d 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/VerifyManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/VerifyManage.java @@ -2,11 +2,12 @@ package com.ningdatech.pmapi.performance.manage; import java.math.BigDecimal; import java.time.LocalDateTime; -import java.util.*; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Objects; import java.util.stream.Collectors; -import com.google.common.collect.Lists; -import com.ningdatech.pmapi.user.entity.enumeration.RoleEnum; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; @@ -14,12 +15,13 @@ import org.springframework.transaction.annotation.Transactional; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.google.common.collect.Lists; import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.function.VUtils; import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.util.StrPool; import com.ningdatech.pmapi.performance.enumration.AppraisalTypeEnum; -import com.ningdatech.pmapi.performance.helper.TemplateDetailBuildHelper; +import com.ningdatech.pmapi.performance.enumration.RectifyStatusEnum; import com.ningdatech.pmapi.performance.model.dto.ProjectAppraisalDTO; import com.ningdatech.pmapi.performance.model.dto.ProjectAppraisalInfoDTO; import com.ningdatech.pmapi.performance.model.entity.*; @@ -27,12 +29,12 @@ import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq; import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalProjectVO; import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalVO; import com.ningdatech.pmapi.performance.service.*; -import com.ningdatech.pmapi.portrait.service.IProjectTagService; import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum; import com.ningdatech.pmapi.projectlib.model.entity.Project; import com.ningdatech.pmapi.projectlib.service.IProjectService; import com.ningdatech.pmapi.sys.model.entity.Role; import com.ningdatech.pmapi.sys.service.IRoleService; +import com.ningdatech.pmapi.user.entity.enumeration.RoleEnum; import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; import com.ningdatech.pmapi.user.util.LoginUserUtil; @@ -56,10 +58,7 @@ public class VerifyManage { private final IPerformanceAppraisalProjectService performanceAppraisalProjectService; private final IProjectService projectService; private final IRoleService roleService; - private final IPerformanceIndicatorProjectTemplateService indicatorProjectTemplateService; - private final TemplateDetailBuildHelper templateDetailBuildHelper; private final IPerformanceIndicatorProjectTemplateDetailService indicatorProjectTemplateDetailService; - private final IProjectTagService projectTagService; private final IPerformanceAppraisalScoreInfoService performanceAppraisalScoreInfoService; private final IPerformanceAppraisalProjectGroupService groupService; /** @@ -117,8 +116,8 @@ public class VerifyManage { PerformanceAppraisalVO vo = BeanUtil.copyProperties(p, PerformanceAppraisalVO.class); PerformanceAppraisalProjectGroup group = groupMap.get(p.getId()); if (Objects.nonNull(group)) { - vo.setReAppraisalGroupId(group.getId()); - vo.setReAppraisalGroupName(group.getName()); + vo.setVerifyGroupId(group.getId()); + vo.setVerifyGroupName(group.getName()); } return vo; }).collect(Collectors.toList()); @@ -196,6 +195,7 @@ public class VerifyManage { if (employeeCode.equals(verifyLeader)){ vo.setCanRectify(Boolean.TRUE); } + vo.setGroupId(groupId); return vo; }) .collect(Collectors.toList()); @@ -271,17 +271,21 @@ public class VerifyManage { // 还没有进行过复评 lastVerifyTotalScore = verifyTotalScore; } - appraisalProject.setReAppraisalTotalScore(lastVerifyTotalScore); + appraisalProject.setVerifyTotalScore(lastVerifyTotalScore); // 取最新地核查打分时间 appraisalProject.setVerifyScoreTime(LocalDateTime.now()); // 判断当前核查人是否为该评价项目所在分组的核查人员中的最后一个核查人 judgeCompleteVerify(group, appraisalProject); appraisalProject.setUpdateOn(LocalDateTime.now()); appraisalProject.setUpdateBy(username); + // 保存整改相关信息 if (Objects.nonNull(param.getIsRectify()) || StringUtils.isNotBlank(param.getRectifyOpinion())) { appraisalProject.setIsRectify(param.getIsRectify()); appraisalProject.setRectifyOpinion(param.getRectifyOpinion()); + appraisalProject.setRectifySubmitEmployeeCode(employeeCode); + appraisalProject.setRectifySubmitTime(LocalDateTime.now()); + appraisalProject.setRectifyStatus(RectifyStatusEnum.TO_BE_SUBMITTED.getCode()); } performanceAppraisalProjectService.updateById(appraisalProject); return "提交成功"; @@ -290,7 +294,9 @@ public class VerifyManage { } private void judgeCompleteVerify(PerformanceAppraisalProjectGroup group, PerformanceAppraisalProject appraisalProject) { + // 获取该评价计划的核查打分信息 Map> scoreInfoMap = performanceAppraisalScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalScoreInfo.class) + .eq(PerformanceAppraisalScoreInfo::getAppraisalId,group.getAppraisalId()) .eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.EXPERT_VERIFY.getCode())) .stream().collect(Collectors.groupingBy(PerformanceAppraisalScoreInfo::getAppraisalEmployeeCode)); @@ -307,11 +313,8 @@ public class VerifyManage { // 获取分组内核查人员对分组内项目的核查分数信息 List scoreInfoList = scoreInfoMap.get(verifyUser); if (CollUtil.isNotEmpty(scoreInfoList)){ - List projectIdList = scoreInfoList.stream() - .map(PerformanceAppraisalScoreInfo::getAppraisalProjectId) - .collect(Collectors.toList()); - List proCodes = projectService.listByIds(projectIdList).stream() - .map(Project::getProjectCode) + List proCodes = scoreInfoList.stream() + .map(PerformanceAppraisalScoreInfo::getAppraisalProjectCode) .collect(Collectors.toList()); // 当前登录用户所在分组的核查人员 对分组内所有项目进行了核查 if (CollUtil.isNotEmpty(proCodes)){ diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalAppScoreInfoMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalAppScoreInfoMapper.java new file mode 100644 index 0000000..458f9fc --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalAppScoreInfoMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.pmapi.performance.mapper; + +import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalAppScoreInfo; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author CMM + * @since 2023-08-14 + */ +public interface PerformanceAppraisalAppScoreInfoMapper extends BaseMapper { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalAppScoreInfoMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalAppScoreInfoMapper.xml new file mode 100644 index 0000000..483998c --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalAppScoreInfoMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/AppAppraisalInfoDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/AppAppraisalInfoDTO.java new file mode 100644 index 0000000..da63ddc --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/AppAppraisalInfoDTO.java @@ -0,0 +1,32 @@ +package com.ningdatech.pmapi.performance.model.dto; + +import java.io.Serializable; +import java.math.BigDecimal; + +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 应用评价信息 + * @return + * @author CMM + * @since 2023/08/08 18:46 + */ +@Data +public class AppAppraisalInfoDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("应用指标ID") + private Long indexId; + + @ApiModelProperty("评价得分") + @NotNull(message = "得分不能为空!") + private BigDecimal score; + + @ApiModelProperty("指标类型") + private Integer indexType; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectAppraisalDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectAppraisalDTO.java index 0d0be8d..3df7ff0 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectAppraisalDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectAppraisalDTO.java @@ -19,6 +19,9 @@ public class ProjectAppraisalDTO implements Serializable { private static final long serialVersionUID = 1L; + @ApiModelProperty("评价应用ID") + private Long applicationId; + @ApiModelProperty("评价项目ID") private Long appraisalProjectId; @@ -31,6 +34,9 @@ public class ProjectAppraisalDTO implements Serializable { @ApiModelProperty("项目模板指标详情评价信息集合") private List appraisalInfoList; + @ApiModelProperty("应用指标评价信息集合") + private List appAppraisalInfoList; + @ApiModelProperty("项目是否需要整改") private Boolean isRectify; @@ -39,4 +45,20 @@ public class ProjectAppraisalDTO implements Serializable { @ApiModelProperty("评价项目所在分组ID") private Long groupId; + + @ApiModelProperty("整改结果说明") + private String rectifyResult; + + @ApiModelProperty("整改结果附件") + private String rectifyResultAppendix; + + @ApiModelProperty("整改审核结果 1 通过、2 不通过") + private Integer rectifyAuditResult; + + @ApiModelProperty("整改审核意见") + private String rectifyAuditOpinion; + + @ApiModelProperty("整改审核附件") + private String rectifyAuditAppendix; + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalAppIndicator.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalAppIndicator.java index 466807b..64e851b 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalAppIndicator.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalAppIndicator.java @@ -50,6 +50,15 @@ public class PerformanceAppraisalAppIndicator implements Serializable { @ApiModelProperty("是否展示") private Boolean isDisplay; + @ApiModelProperty("单位") + private String unit; + + @ApiModelProperty("指标定义") + private String indexDef; + + @ApiModelProperty("所属区域") + private String regionCode; + @ApiModelProperty("创建时间") private LocalDateTime createOn; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalAppScoreInfo.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalAppScoreInfo.java new file mode 100644 index 0000000..40796f0 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalAppScoreInfo.java @@ -0,0 +1,64 @@ +package com.ningdatech.pmapi.performance.model.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author CMM + * @since 2023-08-14 + */ +@Data +@TableName("nd_performance_appraisal_app_score_info") +@ApiModel(value = "NdPerformanceAppraisalAppScoreInfo对象", description = "") +public class PerformanceAppraisalAppScoreInfo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("创建人") + private String createBy; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; + + @ApiModelProperty("更新人") + private String updateBy; + + @ApiModelProperty("评价指标ID") + private Long indexId; + + @ApiModelProperty("指标类型 1 通用指标、2 辅助指标、3 业务指标") + private Integer indexType; + + @ApiModelProperty("评价得分") + private BigDecimal appraisalScore; + + @ApiModelProperty("评价员工code") + private String appraisalEmployeeCode; + + @ApiModelProperty("评价员工姓名") + private String appraisalEmployeeName; + + @ApiModelProperty("评价应用ID") + private Long applicationId; + + @ApiModelProperty("评价计划ID") + private Long appraisalId; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalApplication.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalApplication.java index 1084386..f6c0b3e 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalApplication.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalApplication.java @@ -8,6 +8,7 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.io.Serializable; +import java.math.BigDecimal; import java.time.LocalDateTime; /** @@ -37,4 +38,19 @@ public class PerformanceAppraisalApplication implements Serializable { @ApiModelProperty("应用ID") private Long applicationId; + + @ApiModelProperty("应用关联的项目ID") + private Long appraisalProjectId; + + @ApiModelProperty("应用关联的项目code") + private String appraisalProjectCode; + + @ApiModelProperty("评价总分") + private BigDecimal appraisalTotalScore; + + @ApiModelProperty("打分时间") + private LocalDateTime appraisalScoreTime; + + @ApiModelProperty("是否完成评价") + private Boolean isCompleteAppraisal; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalProject.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalProject.java index eb11971..4ff21ef 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalProject.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalProject.java @@ -70,12 +70,24 @@ public class PerformanceAppraisalProject implements Serializable { @ApiModelProperty("核查打分时间") private LocalDateTime verifyScoreTime; + @ApiModelProperty("整改审核总分") + private BigDecimal rectifyTotalScore; + + @ApiModelProperty("整改审核打分时间") + private LocalDateTime rectifyScoreTime; + @ApiModelProperty("项目是否需要整改") private Boolean isRectify; @ApiModelProperty("整改意见") private String rectifyOpinion; + @ApiModelProperty("整改提交人员工code") + private String rectifySubmitEmployeeCode; + + @ApiModelProperty("整改提交时间") + private LocalDateTime rectifySubmitTime; + @ApiModelProperty("是否完成自评") private Boolean isCompleteSelfAppraisal; @@ -85,4 +97,27 @@ public class PerformanceAppraisalProject implements Serializable { @ApiModelProperty("是否完成核查") private Boolean isCompleteVerify; + @ApiModelProperty("整改状态 1 整改情况待提交、2 整改核查不通过、3 整改待审核、4 整改审核通过") + private Integer rectifyStatus; + + @ApiModelProperty("整改结果说明") + private String rectifyResult; + + @ApiModelProperty("整改结果附件") + private String rectifyResultAppendix; + + @ApiModelProperty("整改结果提交人员工code") + private String rectifyResSubEmpCode; + + @ApiModelProperty("整改结果提交时间") + private LocalDateTime rectifyResSubTime; + + @ApiModelProperty("整改审核结果 1 通过、2 不通过") + private Integer rectifyAuditResult; + + @ApiModelProperty("整改审核意见") + private String rectifyAuditOpinion; + + @ApiModelProperty("整改审核附件") + private String rectifyAuditAppendix; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalScoreInfo.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalScoreInfo.java index 12e9fb3..586be45 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalScoreInfo.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalScoreInfo.java @@ -59,7 +59,7 @@ public class PerformanceAppraisalScoreInfo implements Serializable { @ApiModelProperty("评价人员姓名") private String appraisalEmployeeName; - @ApiModelProperty("评价类型 1 单位自评、2 复评人员复评、3 专家核查") + @ApiModelProperty("评价类型 1 单位自评、2 复评人员复评、3 专家核查、4 专家整改审核、5 应用评价") private Integer appraisalType; @ApiModelProperty("评价计划ID") @@ -70,4 +70,7 @@ public class PerformanceAppraisalScoreInfo implements Serializable { @ApiModelProperty("评价项目Code") private String appraisalProjectCode; + + @ApiModelProperty("评价应用ID") + private Long appraisalAppId; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/AppAppraisalIndexDetailVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/AppAppraisalIndexDetailVO.java new file mode 100644 index 0000000..6342371 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/AppAppraisalIndexDetailVO.java @@ -0,0 +1,47 @@ +package com.ningdatech.pmapi.performance.model.vo; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; +import java.util.Map; + +import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalAppScoreInfo; +import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalScoreInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 应用评价指标 + * @return + * @author CMM + * @since 2023/08/08 8:55 + */ +@Data +@ApiModel(value = "应用评价指标模版详情", description = "应用评价指标模版详情") +public class AppAppraisalIndexDetailVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("申报/建设单位") + private String buildOrgName; + + @ApiModelProperty("应用状态") + private Integer projectStatus; + + @ApiModelProperty("通用指标详情") + private List commonIndexDetails; + + @ApiModelProperty("辅助指标详情") + private List auxIndexDetails; + + @ApiModelProperty("业务指标详情") + private List businessIndexDetails; + + @ApiModelProperty("评价分数信息") + private Map> appraisalScoreInfo; + + @ApiModelProperty("评价得分信息") + private Map appraisalTotalScoreInfo; + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/AppBusinessIndexDetailVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/AppBusinessIndexDetailVO.java new file mode 100644 index 0000000..80e73e0 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/AppBusinessIndexDetailVO.java @@ -0,0 +1,62 @@ +package com.ningdatech.pmapi.performance.model.vo; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + + +/** + * AppIndexDetailVO + * @return + * @author CMM + * @since 2023/08/14 8:55 + */ +@Data +public class AppBusinessIndexDetailVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键ID") + private Long id; + + @ApiModelProperty("核心业务") + private String coreBusiness; + + @ApiModelProperty("业务指标分值") + private BigDecimal score; + + @ApiModelProperty("业务指标名称") + private String businessIndicatorName; + + @ApiModelProperty("业务指标描述") + private String businessIndicatorDescription; + + @ApiModelProperty("指标设计依据") + private String indexDesignBasis; + + @ApiModelProperty("指标计算方法") + private String indexCalculationMethod; + + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("项目编号") + private String projectCode; + + @ApiModelProperty("关联的应用ID") + private Long applicationId; + + @ApiModelProperty("评价得分") + private BigDecimal appraisalScore; + + private LocalDateTime createOn; + private LocalDateTime updateOn; + private String createBy; + private String updateBy; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/AppIndexDetailVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/AppIndexDetailVO.java new file mode 100644 index 0000000..5677204 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/AppIndexDetailVO.java @@ -0,0 +1,69 @@ +package com.ningdatech.pmapi.performance.model.vo; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + + +/** + * AppIndexDetailVO + * @return + * @author CMM + * @since 2023/08/14 8:55 + */ +@Data +public class AppIndexDetailVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键ID") + private Long id; + + @ApiModelProperty("指标名称") + private String indexName; + + @ApiModelProperty("指标所属模块") + private String indexOwningModule; + + @ApiModelProperty("指标展示顺序") + private Integer sort; + + @ApiModelProperty("展示形式(1 图标、2 文字、3 评分)") + private Integer displayForm; + + @ApiModelProperty("指标类型(1 通用指标、2 辅助指标)") + private Integer indexType; + + @ApiModelProperty("指标分值") + private BigDecimal indexScore; + + @ApiModelProperty("是否展示") + private Boolean isDisplay; + + @ApiModelProperty("单位") + private String unit; + + @ApiModelProperty("指标定义") + private String indexDef; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("创建人") + private String createBy; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; + + @ApiModelProperty("创建人") + private String updateBy; + + @ApiModelProperty("评价得分") + private BigDecimal appraisalScore; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalAppVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalAppVO.java new file mode 100644 index 0000000..7f7387d --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalAppVO.java @@ -0,0 +1,99 @@ +package com.ningdatech.pmapi.performance.model.vo; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +import com.alibaba.fastjson.annotation.JSONField; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * PerformanceAppraisalAppVO + * @return + * @author CMM + + */ +@Data +@ApiModel(value = "绩效评价应用对象", description = "绩效评价应用对象") +public class PerformanceAppraisalAppVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("应用ID") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("应用名称") + private String applicationName; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; + + @ApiModelProperty("删除时间") + private LocalDateTime deleteOn; + + @ApiModelProperty("应用类型") + private String applicationType; + + @ApiModelProperty("是否数改系统 0:否 1:是") + private Integer isDigitalModification; + + @ApiModelProperty("数改系统 1: '党政机关整体智治',2: '数字政府',3: '数字经济',4: '数字社会',7: '数字文化',5: '数字法治',6: '一体化智能化公共数据平台', 8: '基层智治' 多个用英文,分隔") + private String digitalModification; + + @ApiModelProperty("业务领域") + private String bizDomain; + + @ApiModelProperty("发布端") + private String publishSide; + + @ApiModelProperty("应用简介") + private String applicationSummary; + + @ApiModelProperty("等保级别 1:一级 2:二级 3:三级 4:四级 5:五级") + private Integer secrecyGrade; + + @ApiModelProperty("密码测评级别 1:一级 2:二级 3:三级 4:四级 5:五级") + private Integer passwordGrade; + + @ApiModelProperty("申报单位名称") + private String buildOrgName; + + @ApiModelProperty("申报单位编码") + private String buildOrgCode; + + private Long createBy; + + private Long updateBy; + + @ApiModelProperty("项目编码") + private String projectCode; + + @ApiModelProperty("项目版本") + private Integer projectVersion; + + @ApiModelProperty("是否为建设方案申报") + private Boolean isConstruct; + + @ApiModelProperty("应用核心业务") + private Boolean coreBusinessList; + + @ApiModelProperty("是否可以评价") + private Boolean canAppraisal; + + @ApiModelProperty("评价计划ID") + private Long appraisalId; + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalApplicationVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalApplicationVO.java index c4bba5f..28e5faf 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalApplicationVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalApplicationVO.java @@ -21,6 +21,12 @@ public class PerformanceAppraisalApplicationVO implements Serializable { @ApiModelProperty("应用ID") private Long appId; + @ApiModelProperty("应用关联的项目ID") + private Long appraisalProjectId; + + @ApiModelProperty("应用关联的项目code") + private String appraisalProjectCode; + @ApiModelProperty("应用名称") private String applicationName; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalProjectVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalProjectVO.java index 9db9130..4f4a85e 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalProjectVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalProjectVO.java @@ -1,6 +1,7 @@ package com.ningdatech.pmapi.performance.model.vo; import com.alibaba.fastjson.annotation.JSONField; +import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -57,7 +58,7 @@ public class PerformanceAppraisalProjectVO implements Serializable { @ApiModelProperty("是否可核查") private Boolean canVerify = Boolean.FALSE; - @ApiModelProperty("是否可整改") + @ApiModelProperty("是否可填写整改意见") private Boolean canRectify = Boolean.FALSE; @ApiModelProperty("自评开始时间") @@ -93,10 +94,43 @@ public class PerformanceAppraisalProjectVO implements Serializable { @ApiModelProperty("整改意见") private String rectifyOpinion; + @ApiModelProperty("整改提交人") + private UserFullInfoDTO rectifySubmitEmployee; + + @ApiModelProperty("整改提交时间") + private LocalDateTime rectifySubmitTime; + @ApiModelProperty("评价计划ID") private Long appraisalId; @ApiModelProperty("所在分组ID") private Long groupId; + @ApiModelProperty("整改状态 1 整改情况待提交、2 整改核查不通过、3 整改待审核、4 整改审核通过") + private Integer rectifyStatus; + + @ApiModelProperty("整改状态名称") + private String rectifyStatusName; + + @ApiModelProperty("整改结果说明") + private String rectifyResult; + + @ApiModelProperty("整改结果附件") + private String rectifyResultAppendix; + + @ApiModelProperty("整改结果提交人员工code") + private String rectifyResSubEmpCode; + + @ApiModelProperty("整改结果提交时间") + private LocalDateTime rectifyResSubTime; + + @ApiModelProperty("整改审核结果 1 通过、2 不通过") + private Integer rectifyAuditResult; + + @ApiModelProperty("整改审核意见") + private String rectifyAuditOpinion; + + @ApiModelProperty("整改审核附件") + private String rectifyAuditAppendix; + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalVO.java index 25db559..25de516 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalVO.java @@ -64,4 +64,15 @@ public class PerformanceAppraisalVO implements Serializable { @ApiModelProperty("核查分组名称") private String verifyGroupName; + @ApiModelProperty("待整改项目数") + private Integer unRectifyNumber; + + @ApiModelProperty("已整改项目数") + private Integer rectifiedNumber; + + @ApiModelProperty("待核查项目数") + private Integer unRectifyAuditNumber; + + @ApiModelProperty("已核查项目数") + private Integer rectifiedAuditNumber; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectAppraisalIndexDetailVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectAppraisalIndexDetailVO.java index 0b26c1e..93200b5 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectAppraisalIndexDetailVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectAppraisalIndexDetailVO.java @@ -49,4 +49,7 @@ public class ProjectAppraisalIndexDetailVO implements Serializable { @ApiModelProperty("核查总得分") private BigDecimal verifyTotalScore; + + @ApiModelProperty("整改审核总得分") + private BigDecimal rectifyAuditTotalScore; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectTemplateDetailVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectTemplateDetailVO.java index 2166577..95a4d9f 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectTemplateDetailVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectTemplateDetailVO.java @@ -73,4 +73,7 @@ public class ProjectTemplateDetailVO implements Serializable { @ApiModelProperty("核查得分信息") private Map verifyTotalScoreInfo; + @ApiModelProperty("自评分数信息") + private List rectifyAuditScoreInfo; + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/RectifyDetailVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/RectifyDetailVO.java new file mode 100644 index 0000000..59ce554 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/RectifyDetailVO.java @@ -0,0 +1,58 @@ +package com.ningdatech.pmapi.performance.model.vo; + +import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * 整改详情 + * + * @author CMM + * @since 2023/08/13 15:36 + */ +@Data +@ApiModel(value = "整改详情", description = "整改详情") +public class RectifyDetailVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("整改意见") + private String rectifyOpinion; + + @ApiModelProperty("整改提交人") + private UserFullInfoDTO rectifySubmitEmployee; + + @ApiModelProperty("整改提交时间") + private LocalDateTime rectifySubmitTime; + + @ApiModelProperty("整改结果说明") + private String rectifyResult; + + @ApiModelProperty("整改结果附件") + private String rectifyResultAppendix; + + @ApiModelProperty("整改结果提交人") + private UserFullInfoDTO rectifyResSubEmployee; + + @ApiModelProperty("整改结果提交时间") + private LocalDateTime rectifyResSubTime; + + @ApiModelProperty("整改审核结果 1 通过、2 不通过") + private Integer rectifyAuditResult; + + @ApiModelProperty("整改审核意见") + private String rectifyAuditOpinion; + + @ApiModelProperty("整改审核附件") + private String rectifyAuditAppendix; + + @ApiModelProperty("整改状态 1 整改情况待提交、2 整改核查不通过、3 整改待审核、4 整改审核通过") + private Integer rectifyStatus; + + @ApiModelProperty("整改状态名称") + private String rectifyStatusName; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalAppScoreInfoService.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalAppScoreInfoService.java new file mode 100644 index 0000000..86c48c3 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalAppScoreInfoService.java @@ -0,0 +1,16 @@ +package com.ningdatech.pmapi.performance.service; + +import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalAppScoreInfo; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author CMM + * @since 2023-08-14 + */ +public interface IPerformanceAppraisalAppScoreInfoService extends IService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalAppScoreInfoServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalAppScoreInfoServiceImpl.java new file mode 100644 index 0000000..e25cc6d --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalAppScoreInfoServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.pmapi.performance.service.impl; + +import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalAppScoreInfo; +import com.ningdatech.pmapi.performance.mapper.PerformanceAppraisalAppScoreInfoMapper; +import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalAppScoreInfoService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author CMM + * @since 2023-08-14 + */ +@Service +public class PerformanceAppraisalAppScoreInfoServiceImpl extends ServiceImpl implements IPerformanceAppraisalAppScoreInfoService { + +}