|
|
@@ -63,7 +63,6 @@ public class AppAppraisalManage { |
|
|
|
*/ |
|
|
|
public PageVo<PerformanceAppraisalVO> list(PerformanceAppraisalListReq req) { |
|
|
|
UserInfoDetails user = LoginUserUtil.loginUserDetail(); |
|
|
|
String employeeCode = user.getEmployeeCode(); |
|
|
|
// 获取当前登录用户的角色列表,只有绩效复评人员才能查看该列表 |
|
|
|
List<Role> userRoleList = user.getUserRoleList(); |
|
|
|
List<Long> roleIdList = userRoleList.stream().map(Role::getId).collect(Collectors.toList()); |
|
|
@@ -85,46 +84,13 @@ public class AppAppraisalManage { |
|
|
|
return PageVo.empty(); |
|
|
|
} |
|
|
|
Set<Long> paIds = paas.stream().map(PerformanceAppraisalApplication::getAppraisalId).collect(Collectors.toSet()); |
|
|
|
|
|
|
|
// 获取评价计划关联的分组信息 |
|
|
|
List<PerformanceAppraisalProjectGroup> groups = groupService.list(Wrappers.lambdaQuery(PerformanceAppraisalProjectGroup.class) |
|
|
|
.in(PerformanceAppraisalProjectGroup::getAppraisalId, paIds)); |
|
|
|
// 获取当前登录复评员所在的分组信息 |
|
|
|
List<PerformanceAppraisalProjectGroup> groupList = groups.stream().filter(g -> { |
|
|
|
String reAppraisalUsers = g.getReAppraisalUsers(); |
|
|
|
List<String> 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(); |
|
|
|
} |
|
|
|
// 因为一个复评用户只能出现在一个计划的一个分组中 所以可以将分组信息按评价计划分组 |
|
|
|
Map<Long, PerformanceAppraisalProjectGroup> groupMap = groupList.stream().collect(Collectors.toMap(PerformanceAppraisalProjectGroup::getAppraisalId, g -> g)); |
|
|
|
// 获取分组所在的评价计划ID |
|
|
|
List<Long> appraisalIds = groupList.stream().map(PerformanceAppraisalProjectGroup::getAppraisalId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
// 获取复评计划列表 |
|
|
|
Page<PerformanceAppraisal> page = req.page(); |
|
|
|
LambdaQueryWrapper<PerformanceAppraisal> wrapper = Wrappers.lambdaQuery(PerformanceAppraisal.class) |
|
|
|
.in(PerformanceAppraisal::getId,appraisalIds) |
|
|
|
.in(PerformanceAppraisal::getId,paIds) |
|
|
|
.orderByDesc(PerformanceAppraisal::getUpdateOn); |
|
|
|
performanceAppraisalService.page(page,wrapper); |
|
|
|
List<PerformanceAppraisalVO> res = page.getRecords().stream() |
|
|
|
.map(p -> { |
|
|
|
PerformanceAppraisalVO vo = BeanUtil.copyProperties(p, PerformanceAppraisalVO.class); |
|
|
|
PerformanceAppraisalProjectGroup group = groupMap.get(p.getId()); |
|
|
|
vo.setReAppraisalGroupId(group.getId()); |
|
|
|
return vo; |
|
|
|
}) |
|
|
|
.map(p -> BeanUtil.copyProperties(p, PerformanceAppraisalVO.class)) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
return PageVo.of(res,page.getTotal()); |
|
|
|
} |
|
|
@@ -137,18 +103,6 @@ public class AppAppraisalManage { |
|
|
|
PerformanceAppraisal plan = performanceAppraisalService.getById(planId); |
|
|
|
VUtils.isTrue(Objects.isNull(plan)).throwMessage("该评价计划不存在!"); |
|
|
|
|
|
|
|
// 判断当前评价计划分组是否存在 |
|
|
|
List<PerformanceAppraisalProjectGroup> projectGroups = groupService.list(Wrappers.lambdaQuery(PerformanceAppraisalProjectGroup.class) |
|
|
|
.eq(PerformanceAppraisalProjectGroup::getAppraisalId, planId)); |
|
|
|
if (CollUtil.isEmpty(projectGroups)){ |
|
|
|
throw new BizException("当前应用所在评价计划的分组信息不存在"); |
|
|
|
} |
|
|
|
// 判断分组内是否添加复评人员 |
|
|
|
List<String> reUsers = projectGroups.stream().map(PerformanceAppraisalProjectGroup::getReAppraisalUsers).collect(Collectors.toList()); |
|
|
|
if (CollUtil.isEmpty(reUsers)){ |
|
|
|
throw new BizException("当前评价计划分组内未添加复评人员!"); |
|
|
|
} |
|
|
|
|
|
|
|
// 获取分组所在评价计划添加的未完成评价的应用信息 |
|
|
|
List<PerformanceAppraisalApplication> paas = performanceAppraisalApplicationService.list(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) |
|
|
|
.eq(PerformanceAppraisalApplication::getAppraisalId, planId) |
|
|
@@ -206,18 +160,7 @@ public class AppAppraisalManage { |
|
|
|
PerformanceAppraisal plan = performanceAppraisalService.getById(planId); |
|
|
|
VUtils.isTrue(Objects.isNull(plan)).throwMessage("该评价计划不存在!"); |
|
|
|
|
|
|
|
// 判断当前评价计划分组是否存在 |
|
|
|
List<PerformanceAppraisalProjectGroup> projectGroups = groupService.list(Wrappers.lambdaQuery(PerformanceAppraisalProjectGroup.class) |
|
|
|
.eq(PerformanceAppraisalProjectGroup::getAppraisalId, planId)); |
|
|
|
if (CollUtil.isEmpty(projectGroups)){ |
|
|
|
throw new BizException("当前应用所在评价计划的分组信息不存在"); |
|
|
|
} |
|
|
|
// 判断分组内是否添加复评人员 |
|
|
|
List<String> reUsers = projectGroups.stream().map(PerformanceAppraisalProjectGroup::getReAppraisalUsers).collect(Collectors.toList()); |
|
|
|
if (CollUtil.isEmpty(reUsers)){ |
|
|
|
throw new BizException("当前评价计划分组内未添加复评人员!"); |
|
|
|
} |
|
|
|
// 获取分组所在评价计划添加的已完成评价的应用信息 |
|
|
|
// 获取评价计划添加的已完成评价的应用信息 |
|
|
|
List<PerformanceAppraisalApplication> paas = performanceAppraisalApplicationService.list(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) |
|
|
|
.eq(PerformanceAppraisalApplication::getAppraisalId, planId) |
|
|
|
.eq(PerformanceAppraisalApplication::getIsCompleteAppraisal, Boolean.TRUE)); |
|
|
|