|
|
@@ -145,23 +145,28 @@ public class AppAppraisalManage { |
|
|
|
List<PerformanceAppraisalApplication> 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<Long> ids = paas.stream().map(PerformanceAppraisalApplication::getApplicationId).collect(Collectors.toList()); |
|
|
|
// 从绩效评价打分信息表中获取上述绩效评价计划应用的打分信息 |
|
|
|
List<PerformanceAppraisalAppScoreInfo> appraisalScoreInfos = performanceAppraisalAppScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppScoreInfo.class) |
|
|
|
.eq(PerformanceAppraisalAppScoreInfo::getAppraisalId, planId)); |
|
|
|
// 筛选出当前登录用户未进行打分的应用信息 |
|
|
|
List<Long> appIds = appraisalScoreInfos.stream() |
|
|
|
.filter(a -> !employeeCode.equals(a.getAppraisalEmployeeCode())) |
|
|
|
.map(PerformanceAppraisalAppScoreInfo::getApplicationId) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
List<Long> appIds; |
|
|
|
if (CollUtil.isNotEmpty(appraisalScoreInfos)) { |
|
|
|
// 筛选出当前登录用户已进行打分的应用信息 |
|
|
|
List<Long> 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<ProjectApplication> page = req.page(); |
|
|
|
LambdaQueryWrapper<ProjectApplication> 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<PerformanceAppraisalApplication> 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<PerformanceAppraisalAppScoreInfo> appraisalScoreInfos = performanceAppraisalAppScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppScoreInfo.class) |
|
|
|
.eq(PerformanceAppraisalAppScoreInfo::getAppraisalId, planId)); |
|
|
|
// 筛选出当前登录用户已进行打分的应用信息 |
|
|
|
List<Long> appIds = appraisalScoreInfos.stream() |
|
|
|
.filter(a -> employeeCode.equals(a.getAppraisalEmployeeCode())) |
|
|
|
.map(PerformanceAppraisalAppScoreInfo::getApplicationId) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
List<Long> appIds = Lists.newArrayList(); |
|
|
|
if (CollUtil.isNotEmpty(appraisalScoreInfos)) { |
|
|
|
// 筛选出当前登录用户已进行打分的应用信息 |
|
|
|
List<Long> 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<PerformanceAppraisalAppIndicator> 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<Long, PerformanceAppraisalAppScoreInfo> commonScoreInfoMap = performanceAppraisalAppScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppScoreInfo.class) |
|
|
|
.eq(PerformanceAppraisalAppScoreInfo::getApplicationId, appId) |
|
|
@@ -286,7 +305,9 @@ public class AppAppraisalManage { |
|
|
|
|
|
|
|
// 辅助指标 |
|
|
|
List<PerformanceAppraisalAppIndicator> 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<Long, PerformanceAppraisalAppScoreInfo> 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<PerformanceAppraisalAppIndicator> indexList = performanceAppraisalAppIndicatorService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppIndicator.class) |
|
|
|
.in(PerformanceAppraisalAppIndicator::getId, indexIds)); |
|
|
|
if (CollUtil.isEmpty(indexList)){ |
|
|
|
throw new BizException("评价指标不存在!"); |
|
|
|
Map<Long, PerformanceAppraisalAppIndicator> indexMap = MapUtil.newHashMap(); |
|
|
|
if (CollUtil.isNotEmpty(indexIds)) { |
|
|
|
List<PerformanceAppraisalAppIndicator> 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<Long, PerformanceAppraisalAppIndicator> indexMap = indexList.stream().collect(Collectors.toMap(PerformanceAppraisalAppIndicator::getId, d -> d)); |
|
|
|
|
|
|
|
// 查出应用业务指标分数信息 |
|
|
|
List<ProjectCoreBusinessIndicators> businessIndexList = projectCoreBusinessIndicatorsService.list(Wrappers.lambdaQuery(ProjectCoreBusinessIndicators.class) |
|
|
|
.in(ProjectCoreBusinessIndicators::getId, businessIndexIds)); |
|
|
|
if (CollUtil.isEmpty(indexList)){ |
|
|
|
throw new BizException("评价指标不存在!"); |
|
|
|
Map<Long, ProjectCoreBusinessIndicators> businessIndexMap = MapUtil.newHashMap(); |
|
|
|
if (CollUtil.isNotEmpty(businessIndexIds)) { |
|
|
|
List<ProjectCoreBusinessIndicators> 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<Long, ProjectCoreBusinessIndicators> businessIndexMap = businessIndexList.stream().collect(Collectors.toMap(ProjectCoreBusinessIndicators::getId, d -> d)); |
|
|
|
|
|
|
|
Map<Long, PerformanceAppraisalAppIndicator> finalIndexMap = indexMap; |
|
|
|
Map<Long, ProjectCoreBusinessIndicators> finalBusinessIndexMap = businessIndexMap; |
|
|
|
List<PerformanceAppraisalAppScoreInfo> 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){ |
|
|
|