From 3c462257e9774a385c0a4e25f286a0c27852a2fc Mon Sep 17 00:00:00 2001 From: CMM <2198256324@qq.com> Date: Wed, 16 Aug 2023 09:18:21 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=A9=E6=95=88=E8=AF=84=E4=BB=B7-=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=BA=94=E7=94=A8=E6=8C=87=E6=A0=87=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/AppAppraisalController.java | 4 +- .../controller/OrgSelfAppraisalController.java | 1 - .../performance/manage/AppAppraisalManage.java | 87 ++++++++++++++-------- .../manage/PerformanceAppraisalPlanManage.java | 6 ++ .../dto/PerformanceIndicatorAppIndexSaveDTO.java | 6 ++ .../model/vo/AppAppraisalIndexDetailVO.java | 8 +- .../pmapi/performance/model/vo/AppIndexVO.java | 6 ++ 7 files changed, 79 insertions(+), 39 deletions(-) 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 index d1351a1..393e318 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/AppAppraisalController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/AppAppraisalController.java @@ -37,11 +37,11 @@ public class AppAppraisalController { @GetMapping("/unEvaluate-list/{planId}/{reAppraisalGroupId}") @ApiOperation("当前绩效评价应用待评价列表") - public PageVo pendingList(@PathVariable Long planId, @PathVariable Long reAppraisalGroupId, PerformanceAppraisalListReq req) { + public PageVo unEvaluateList(@PathVariable Long planId, @PathVariable Long reAppraisalGroupId, PerformanceAppraisalListReq req) { return appAppraisalManage.unEvaluateList(planId,reAppraisalGroupId,req); } - @GetMapping("/evaluated-list/{planId}") + @GetMapping("/evaluated-list/{planId}/{reAppraisalGroupId}") @ApiOperation("当前绩效评价应用已评价列表") public PageVo evaluatedList(@PathVariable Long planId, @PathVariable Long reAppraisalGroupId, PerformanceAppraisalListReq req) { return appAppraisalManage.evaluatedList(planId,reAppraisalGroupId,req); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/OrgSelfAppraisalController.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/OrgSelfAppraisalController.java index 9b10fc7..79cb512 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/OrgSelfAppraisalController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/OrgSelfAppraisalController.java @@ -57,5 +57,4 @@ public class OrgSelfAppraisalController { public String submitSelfAppraisal(@Valid @RequestBody ProjectAppraisalDTO param){ return selfAppraisalManage.submitSelfAppraisal(param); } - } 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 index c0dea44..1cd6822 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/AppAppraisalManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/AppAppraisalManage.java @@ -145,23 +145,28 @@ public class AppAppraisalManage { List paas = performanceAppraisalApplicationService.list(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) .eq(PerformanceAppraisalApplication::getAppraisalId, group.getAppraisalId()) .eq(PerformanceAppraisalApplication::getIsCompleteAppraisal, Boolean.FALSE)); + // 没有当前用户待评价的应用信息 if (CollUtil.isEmpty(paas)){ return PageVo.empty(); } + List ids = paas.stream().map(PerformanceAppraisalApplication::getApplicationId).collect(Collectors.toList()); // 从绩效评价打分信息表中获取上述绩效评价计划应用的打分信息 List appraisalScoreInfos = performanceAppraisalAppScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppScoreInfo.class) .eq(PerformanceAppraisalAppScoreInfo::getAppraisalId, planId)); - // 筛选出当前登录用户未进行打分的应用信息 - List appIds = appraisalScoreInfos.stream() - .filter(a -> !employeeCode.equals(a.getAppraisalEmployeeCode())) - .map(PerformanceAppraisalAppScoreInfo::getApplicationId) - .collect(Collectors.toList()); - + List appIds; + if (CollUtil.isNotEmpty(appraisalScoreInfos)) { + // 筛选出当前登录用户已进行打分的应用信息 + List scoredAppIds = appraisalScoreInfos.stream() + .filter(a -> employeeCode.equals(a.getAppraisalEmployeeCode())) + .map(PerformanceAppraisalAppScoreInfo::getApplicationId) + .collect(Collectors.toList()); + ids.removeAll(scoredAppIds); + } + appIds = ids; // 没有当前用户待评价的应用信息 if(CollUtil.isEmpty(appIds)){ return PageVo.empty(); } - Page page = req.page(); LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(ProjectApplication.class) .in(ProjectApplication::getId, appIds) @@ -195,23 +200,27 @@ public class AppAppraisalManage { PerformanceAppraisalProjectGroup group = groupService.getById(reAppraisalGroupId); VUtils.isTrue(Objects.isNull(group)).throwMessage("分组不存在!"); - // 获取分组所在评价计划添加的未完成评价的应用信息 + // 获取分组所在评价计划添加的已完成评价的应用信息 List paas = performanceAppraisalApplicationService.list(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) .eq(PerformanceAppraisalApplication::getAppraisalId, group.getAppraisalId()) - .eq(PerformanceAppraisalApplication::getIsCompleteAppraisal, Boolean.FALSE)); + .eq(PerformanceAppraisalApplication::getIsCompleteAppraisal, Boolean.TRUE)); if (CollUtil.isEmpty(paas)){ return PageVo.empty(); } // 从绩效评价打分信息表中获取上述绩效评价计划应用的打分信息 List appraisalScoreInfos = performanceAppraisalAppScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppScoreInfo.class) .eq(PerformanceAppraisalAppScoreInfo::getAppraisalId, planId)); - // 筛选出当前登录用户已进行打分的应用信息 - List appIds = appraisalScoreInfos.stream() - .filter(a -> employeeCode.equals(a.getAppraisalEmployeeCode())) - .map(PerformanceAppraisalAppScoreInfo::getApplicationId) - .collect(Collectors.toList()); + List appIds = Lists.newArrayList(); + if (CollUtil.isNotEmpty(appraisalScoreInfos)) { + // 筛选出当前登录用户已进行打分的应用信息 + List scoredAppIds = appraisalScoreInfos.stream() + .filter(a -> employeeCode.equals(a.getAppraisalEmployeeCode())) + .map(PerformanceAppraisalAppScoreInfo::getApplicationId) + .collect(Collectors.toList()); + appIds = scoredAppIds; + } - // 没有当前用户待评价的应用信息 + // 没有当前用户已评价的应用信息 if(CollUtil.isEmpty(appIds)){ return PageVo.empty(); } @@ -261,11 +270,21 @@ public class AppAppraisalManage { public AppAppraisalIndexDetailVO detail(Long appId) { + + ProjectApplication projectApplication = projectApplicationService.getById(appId); + AppAppraisalIndexDetailVO resVo = new AppAppraisalIndexDetailVO(); + if (Objects.nonNull(projectApplication)){ + resVo.setBuildOrgName(projectApplication.getBuildOrgName()); + // todo 应用状态 需通过appCode通过IRS接口获取,这里暂时写死 已验收 + resVo.setApplicationStatus("已验收"); + } // 获取指标配置的应用指标信息 // 通用指标 List commonIndexList = performanceAppraisalAppIndicatorService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppIndicator.class) - .eq(PerformanceAppraisalAppIndicator::getIndexType, AppIndexTypeEnum.COMMON.getCode())); + .eq(PerformanceAppraisalAppIndicator::getIndexType, AppIndexTypeEnum.COMMON.getCode()) + .eq(PerformanceAppraisalAppIndicator::getIsDisplay,Boolean.TRUE) + .orderBy(Boolean.TRUE,Boolean.TRUE,PerformanceAppraisalAppIndicator::getSort)); // 获取当前应用通用指标的的打分信息 Map commonScoreInfoMap = performanceAppraisalAppScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppScoreInfo.class) .eq(PerformanceAppraisalAppScoreInfo::getApplicationId, appId) @@ -286,7 +305,9 @@ public class AppAppraisalManage { // 辅助指标 List auxIndexList = performanceAppraisalAppIndicatorService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppIndicator.class) - .eq(PerformanceAppraisalAppIndicator::getIndexType, AppIndexTypeEnum.AUX.getCode())); + .eq(PerformanceAppraisalAppIndicator::getIndexType, AppIndexTypeEnum.AUX.getCode()) + .eq(PerformanceAppraisalAppIndicator::getIsDisplay,Boolean.TRUE) + .orderBy(Boolean.TRUE,Boolean.TRUE,PerformanceAppraisalAppIndicator::getSort)); // 获取当前应用辅助指标的的打分信息 Map auxScoreInfoMap = performanceAppraisalAppScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppScoreInfo.class) .eq(PerformanceAppraisalAppScoreInfo::getApplicationId, appId) @@ -350,32 +371,40 @@ public class AppAppraisalManage { .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 = MapUtil.newHashMap(); + if (CollUtil.isNotEmpty(indexIds)) { + List indexList = performanceAppraisalAppIndicatorService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppIndicator.class) + .in(PerformanceAppraisalAppIndicator::getId, indexIds)); + if (CollUtil.isEmpty(indexList)) { + throw new BizException("通用/辅助评价指标不存在!"); + } + indexMap = indexList.stream().collect(Collectors.toMap(PerformanceAppraisalAppIndicator::getId, d -> d)); } - 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 = MapUtil.newHashMap(); + if (CollUtil.isNotEmpty(businessIndexIds)) { + List businessIndexList = projectCoreBusinessIndicatorsService.list(Wrappers.lambdaQuery(ProjectCoreBusinessIndicators.class) + .in(ProjectCoreBusinessIndicators::getId, businessIndexIds)); + if (CollUtil.isEmpty(businessIndexList)) { + throw new BizException("核心业务评价指标不存在!"); + } + businessIndexMap = businessIndexList.stream().collect(Collectors.toMap(ProjectCoreBusinessIndicators::getId, d -> d)); } - Map businessIndexMap = businessIndexList.stream().collect(Collectors.toMap(ProjectCoreBusinessIndicators::getId, d -> d)); + Map finalIndexMap = indexMap; + Map finalBusinessIndexMap = businessIndexMap; 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()); + PerformanceAppraisalAppIndicator appIndicator = finalIndexMap.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()); + ProjectCoreBusinessIndicators coreBusinessIndicators = finalBusinessIndexMap.get(a.getIndexId()); BigDecimal score = a.getScore(); BigDecimal indexScore = coreBusinessIndicators.getScore(); if (score.compareTo(indexScore) > 0 || score.compareTo(BigDecimal.ZERO) < 0){ 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 47d2ea0..51facf2 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 @@ -415,6 +415,9 @@ public class PerformanceAppraisalPlanManage { .eq(PerformanceAppraisalProject::getAppraisalId,editDTO.getId())); // 删除项目的打分信息 List projectIds = editDTO.getProjects().stream().map(AppraisalProjectDTO::getId).collect(Collectors.toList()); + if (CollUtil.isEmpty(projectIds)){ + throw new BizException("请选择至少一个评价项目!"); + } List projectCodes = projectService.listByIds(projectIds).stream().map(Project::getProjectCode).collect(Collectors.toList()); // 删除项目的打分信息 performanceAppraisalScoreInfoService.remove(Wrappers.lambdaQuery(PerformanceAppraisalScoreInfo.class) @@ -457,6 +460,9 @@ public class PerformanceAppraisalPlanManage { .eq(PerformanceAppraisalApplication::getAppraisalId,editDTO.getId())); // 删除计划内应用的打分信息 List applicationIdList = editDTO.getApplicationIds(); + if (CollUtil.isEmpty(applicationIdList)){ + throw new BizException("请选择至少一个应用!"); + } // 删除应用的打分信息 performanceAppraisalAppScoreInfoService.remove(Wrappers.lambdaQuery(PerformanceAppraisalAppScoreInfo.class) .eq(PerformanceAppraisalAppScoreInfo::getAppraisalId,editDTO.getId()) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceIndicatorAppIndexSaveDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceIndicatorAppIndexSaveDTO.java index 4665378..0973517 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceIndicatorAppIndexSaveDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceIndicatorAppIndexSaveDTO.java @@ -46,4 +46,10 @@ public class PerformanceIndicatorAppIndexSaveDTO implements Serializable { @ApiModelProperty("指标分值") private BigDecimal indexScore; + + @ApiModelProperty("单位") + private String unit; + + @ApiModelProperty("指标定义") + private String indexDef; } 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 index 1c2d8f0..2ec63cb 100644 --- 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 @@ -27,7 +27,7 @@ public class AppAppraisalIndexDetailVO implements Serializable { private String buildOrgName; @ApiModelProperty("应用状态") - private Integer projectStatus; + private String applicationStatus; @ApiModelProperty("通用指标详情") private List commonIndexDetails; @@ -38,10 +38,4 @@ public class AppAppraisalIndexDetailVO implements Serializable { @ApiModelProperty("业务指标详情") private List businessIndexDetails; - @ApiModelProperty("评价分数信息") - private List appraisalScoreInfo; - - @ApiModelProperty("评价得分信息") - private Map appraisalTotalScoreInfo; - } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/AppIndexVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/AppIndexVO.java index ad8ab6d..27ef74c 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/AppIndexVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/AppIndexVO.java @@ -47,6 +47,12 @@ public class AppIndexVO implements Serializable { @ApiModelProperty("是否展示") private Boolean isDisplay; + @ApiModelProperty("单位") + private String unit; + + @ApiModelProperty("指标定义") + private String indexDef; + @ApiModelProperty("创建时间") private LocalDateTime createOn;