Browse Source

评价计划分组-分组项目、复评、核查人员重复校验

master
CMM 1 year ago
parent
commit
0415b2f4f4
2 changed files with 53 additions and 16 deletions
  1. +3
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConst.java
  2. +50
    -15
      pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalPlanManage.java

+ 3
- 1
pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConst.java View File

@@ -60,7 +60,9 @@ public interface CommonConst {
String COPY = "副本";
String PROJECT_REPEAT = " 项目已在其他评价计划中,请勿重复添加!";
String APP_REPEAT = " 应用已在其他评价计划中,请勿重复添加!";
String REAPPRAISAL_REPEAT = " 已在其他当前评价计划其他分组中,请勿重复添加!";
Integer REAPPRAISAL_TYPE = 1;
Integer VERIFY_TYPE = 2;
String REPEAT = " 已在其他当前评价计划其他分组中,请勿重复添加!";





+ 50
- 15
pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalPlanManage.java View File

@@ -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);
}
}
}



Loading…
Cancel
Save