|
|
@@ -213,6 +213,7 @@ public class PerformanceAppraisalPlanManage { |
|
|
|
// 获取分组信息 |
|
|
|
List<PerformanceAppraisalProjectGroupVO> groups = groupList.stream().map(g -> { |
|
|
|
PerformanceAppraisalProjectGroupVO groupVo = new PerformanceAppraisalProjectGroupVO(); |
|
|
|
groupVo.setId(g.getId()); |
|
|
|
groupVo.setAppraisalId(id); |
|
|
|
groupVo.setName(g.getName()); |
|
|
|
String reAppraisalUsersStr = g.getReAppraisalUsers(); |
|
|
@@ -589,7 +590,9 @@ public class PerformanceAppraisalPlanManage { |
|
|
|
UserInfoDetails user = LoginUserUtil.loginUserDetail(); |
|
|
|
|
|
|
|
PerformanceAppraisalProjectGroup group = BeanUtil.copyProperties(dto, PerformanceAppraisalProjectGroup.class); |
|
|
|
|
|
|
|
// 获取当前评价计划内的分组信息 |
|
|
|
List<PerformanceAppraisalProjectGroup> groupList = groupService.list(Wrappers.lambdaQuery(PerformanceAppraisalProjectGroup.class) |
|
|
|
.eq(PerformanceAppraisalProjectGroup::getAppraisalId, dto.getAppraisalId())); |
|
|
|
if(Objects.isNull(dto.getId())){ |
|
|
|
group.setId(null); |
|
|
|
group.setCreateOn(LocalDateTime.now()); |
|
|
@@ -600,14 +603,30 @@ public class PerformanceAppraisalPlanManage { |
|
|
|
group.setId(old.getId()); |
|
|
|
} |
|
|
|
if(CollUtil.isNotEmpty(dto.getProjectCodes())){ |
|
|
|
// 判断选择的项目是否已经在当前评价计划的其他分组内 |
|
|
|
// 获取当前评价计划的其他分组的项目信息 |
|
|
|
List<String> projectCodeList = groupList.stream() |
|
|
|
.map(PerformanceAppraisalProjectGroup::getProjectCodes) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
checkProjectCodes(dto.getProjectCodes(),projectCodeList); |
|
|
|
group.setProjectCodes(String.join(StrPool.COMMA, dto.getProjectCodes())); |
|
|
|
} |
|
|
|
if(CollUtil.isNotEmpty(dto.getReAppraisalUsers())){ |
|
|
|
// 判断选择的复评人员是否已经在当前评价计划的其他分组内 |
|
|
|
checkReAppraisalUsers(dto.getReAppraisalUsers(),dto.getAppraisalId()); |
|
|
|
// 获取当前评价计划的其他分组的复评人员信息 |
|
|
|
List<String> reUserList = groupList.stream() |
|
|
|
.map(PerformanceAppraisalProjectGroup::getReAppraisalUsers) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
checkReAppraisalAndVerifyUsers(dto.getReAppraisalUsers(),reUserList,CommonConst.REAPPRAISAL_TYPE); |
|
|
|
group.setReAppraisalUsers(String.join(StrPool.COMMA, dto.getReAppraisalUsers())); |
|
|
|
} |
|
|
|
if(CollUtil.isNotEmpty(dto.getVerificationUsers())){ |
|
|
|
// 判断选择的核查人员是否已经在当前评价计划的其他分组内 |
|
|
|
// 获取当前评价计划的其他分组的核查人员信息 |
|
|
|
List<String> verifyList = groupList.stream() |
|
|
|
.map(PerformanceAppraisalProjectGroup::getVerificationUsers) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
checkReAppraisalAndVerifyUsers(dto.getVerificationUsers(),verifyList,CommonConst.VERIFY_TYPE); |
|
|
|
group.setVerificationUsers(String.join(StrPool.COMMA, dto.getVerificationUsers())); |
|
|
|
} |
|
|
|
group.setUpdateOn(LocalDateTime.now()); |
|
|
@@ -616,18 +635,30 @@ public class PerformanceAppraisalPlanManage { |
|
|
|
return "操作成功"; |
|
|
|
} |
|
|
|
|
|
|
|
private void checkReAppraisalUsers(List<String> reAppraisalUsers, Long appraisalId) { |
|
|
|
// 获取当前评价计划的其他分组的复评人员信息 |
|
|
|
List<PerformanceAppraisalProjectGroup> groupList = groupService.list(Wrappers.lambdaQuery(PerformanceAppraisalProjectGroup.class) |
|
|
|
.eq(PerformanceAppraisalProjectGroup::getAppraisalId, appraisalId)); |
|
|
|
List<String> reUserList = groupList.stream() |
|
|
|
.map(PerformanceAppraisalProjectGroup::getReAppraisalUsers) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
// 如果提交的复评人员在该评价计划其他分组中 |
|
|
|
if (!CollectionUtil.intersection(reAppraisalUsers,reUserList).isEmpty()){ |
|
|
|
ArrayList<String> reUsers = Lists.newArrayList(reAppraisalUsers); |
|
|
|
reUsers.retainAll(reUserList); |
|
|
|
// 获取重复添加的复评人员名字 |
|
|
|
private void checkProjectCodes(List<String> projectCodes, List<String> projectCodeList) { |
|
|
|
// 判断选择的项目是否已经在当前评价计划的其他分组内 |
|
|
|
// 如果提交的项目在该评价计划其他分组中 |
|
|
|
if (!CollectionUtil.intersection(projectCodes,projectCodeList).isEmpty()){ |
|
|
|
ArrayList<String> proCodes = Lists.newArrayList(projectCodes); |
|
|
|
proCodes.retainAll(projectCodeList); |
|
|
|
// 获取重复添加的项目Code |
|
|
|
String names = proCodes.stream().map(i -> { |
|
|
|
Project project = projectService.getProjectByCode(i); |
|
|
|
if (Objects.nonNull(project)){ |
|
|
|
return project.getProjectName(); |
|
|
|
} |
|
|
|
return StrPool.EMPTY; |
|
|
|
}).collect(Collectors.joining(StrPool.COMMA)); |
|
|
|
throw new BizException("项目:" + names + CommonConst.REPEAT); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void checkReAppraisalAndVerifyUsers(List<String> checkUsers, List<String> compareUsers, Integer type) { |
|
|
|
// 如果提交的复评/核查人员在该评价计划其他分组中 |
|
|
|
if (!CollectionUtil.intersection(checkUsers,compareUsers).isEmpty()){ |
|
|
|
ArrayList<String> reUsers = Lists.newArrayList(checkUsers); |
|
|
|
reUsers.retainAll(compareUsers); |
|
|
|
// 获取重复添加的复评/核查人员名字 |
|
|
|
String names = reUsers.stream().map(i -> { |
|
|
|
UserFullInfoDTO info = userInfoHelper.getUserFullInfoByEmployeeCode(i); |
|
|
|
if (Objects.nonNull(info)){ |
|
|
@@ -635,7 +666,11 @@ public class PerformanceAppraisalPlanManage { |
|
|
|
} |
|
|
|
return StrPool.EMPTY; |
|
|
|
}).collect(Collectors.joining(StrPool.COMMA)); |
|
|
|
throw new BizException("复评人员:" + names + CommonConst.REAPPRAISAL_REPEAT); |
|
|
|
if (CommonConst.REAPPRAISAL_TYPE.equals(type)) { |
|
|
|
throw new BizException("复评人员:" + names + CommonConst.REPEAT); |
|
|
|
}else if (CommonConst.VERIFY_TYPE.equals(type)){ |
|
|
|
throw new BizException("核查人员:" + names + CommonConst.REPEAT); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|