|
@@ -4,7 +4,6 @@ import java.time.LocalDateTime; |
|
|
import java.util.*; |
|
|
import java.util.*; |
|
|
import java.util.stream.Collectors; |
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
import org.checkerframework.checker.nullness.qual.Nullable; |
|
|
|
|
|
import org.springframework.stereotype.Component; |
|
|
import org.springframework.stereotype.Component; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
@@ -27,10 +26,7 @@ import com.ningdatech.pmapi.common.util.BizUtils; |
|
|
import com.ningdatech.pmapi.common.util.CodeUtil; |
|
|
import com.ningdatech.pmapi.common.util.CodeUtil; |
|
|
import com.ningdatech.pmapi.performance.convert.PerformanceAppraisalConveter; |
|
|
import com.ningdatech.pmapi.performance.convert.PerformanceAppraisalConveter; |
|
|
import com.ningdatech.pmapi.performance.enumration.EvalObjectEnum; |
|
|
import com.ningdatech.pmapi.performance.enumration.EvalObjectEnum; |
|
|
import com.ningdatech.pmapi.performance.model.dto.AppraisalProjectDTO; |
|
|
|
|
|
import com.ningdatech.pmapi.performance.model.dto.PerformanceAppraisalCreateDTO; |
|
|
|
|
|
import com.ningdatech.pmapi.performance.model.dto.PerformanceAppraisalEditDTO; |
|
|
|
|
|
import com.ningdatech.pmapi.performance.model.dto.PerformanceAppraisalProjectGroupSaveDTO; |
|
|
|
|
|
|
|
|
import com.ningdatech.pmapi.performance.model.dto.*; |
|
|
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisal; |
|
|
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisal; |
|
|
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalApplication; |
|
|
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalApplication; |
|
|
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalProject; |
|
|
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalProject; |
|
@@ -46,6 +42,7 @@ import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalProjectServ |
|
|
import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalService; |
|
|
import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalService; |
|
|
import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; |
|
|
import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; |
|
|
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; |
|
|
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; |
|
|
|
|
|
import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum; |
|
|
import com.ningdatech.pmapi.projectlib.model.entity.Project; |
|
|
import com.ningdatech.pmapi.projectlib.model.entity.Project; |
|
|
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; |
|
|
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; |
|
|
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; |
|
|
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; |
|
@@ -219,24 +216,12 @@ public class PerformanceAppraisalPlanManage { |
|
|
groupVo.setAppraisalId(id); |
|
|
groupVo.setAppraisalId(id); |
|
|
groupVo.setName(g.getName()); |
|
|
groupVo.setName(g.getName()); |
|
|
String reAppraisalUsersStr = g.getReAppraisalUsers(); |
|
|
String reAppraisalUsersStr = g.getReAppraisalUsers(); |
|
|
List<UserFullInfoDTO> reAppraisalUsers = Arrays.stream(reAppraisalUsersStr.split(StrPool.COMMA)).map(r -> { |
|
|
|
|
|
UserFullInfoDTO userFullInfoDTO = new UserFullInfoDTO(); |
|
|
|
|
|
List<String> reUsers = Arrays.asList(r.split(StrPool.PIPE)); |
|
|
|
|
|
if (CollUtil.isNotEmpty(reUsers)) { |
|
|
|
|
|
userFullInfoDTO.setUsername(reUsers.get(0)); |
|
|
|
|
|
} |
|
|
|
|
|
return userFullInfoDTO; |
|
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
List<UserFullInfoDTO> reAppraisalUsers = Arrays.stream(reAppraisalUsersStr.split(StrPool.COMMA)) |
|
|
|
|
|
.map(userInfoHelper::getUserFullInfoByEmployeeCode).collect(Collectors.toList()); |
|
|
groupVo.setReAppraisalUsers(reAppraisalUsers); |
|
|
groupVo.setReAppraisalUsers(reAppraisalUsers); |
|
|
String verificationUsersStr = g.getVerificationUsers(); |
|
|
String verificationUsersStr = g.getVerificationUsers(); |
|
|
List<UserFullInfoDTO> verificationUsers = Arrays.stream(verificationUsersStr.split(StrPool.COMMA)).map(r -> { |
|
|
|
|
|
UserFullInfoDTO userFullInfoDTO = new UserFullInfoDTO(); |
|
|
|
|
|
List<String> reUsers = Arrays.asList(r.split(StrPool.PIPE)); |
|
|
|
|
|
if (CollUtil.isNotEmpty(reUsers)) { |
|
|
|
|
|
userFullInfoDTO.setUsername(reUsers.get(0)); |
|
|
|
|
|
} |
|
|
|
|
|
return userFullInfoDTO; |
|
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
List<UserFullInfoDTO> verificationUsers = Arrays.stream(verificationUsersStr.split(StrPool.COMMA)) |
|
|
|
|
|
.map(userInfoHelper::getUserFullInfoByEmployeeCode).collect(Collectors.toList()); |
|
|
groupVo.setVerificationUsers(verificationUsers); |
|
|
groupVo.setVerificationUsers(verificationUsers); |
|
|
groupVo.setCreateOn(g.getCreateOn()); |
|
|
groupVo.setCreateOn(g.getCreateOn()); |
|
|
return groupVo; |
|
|
return groupVo; |
|
@@ -499,7 +484,8 @@ public class PerformanceAppraisalPlanManage { |
|
|
List<PerformanceAppraisalProjectGroup> groups = groupService.list( |
|
|
List<PerformanceAppraisalProjectGroup> groups = groupService.list( |
|
|
Wrappers.lambdaQuery(PerformanceAppraisalProjectGroup.class) |
|
|
Wrappers.lambdaQuery(PerformanceAppraisalProjectGroup.class) |
|
|
.eq(PerformanceAppraisalProjectGroup::getAppraisalId, appraisalId) |
|
|
.eq(PerformanceAppraisalProjectGroup::getAppraisalId, appraisalId) |
|
|
.like(StringUtils.isNotBlank(name),PerformanceAppraisalProjectGroup::getName,name)); |
|
|
|
|
|
|
|
|
.like(StringUtils.isNotBlank(name),PerformanceAppraisalProjectGroup::getName,name) |
|
|
|
|
|
.orderByDesc(PerformanceAppraisalProjectGroup::getCreateOn)); |
|
|
if(CollUtil.isEmpty(groups)){ |
|
|
if(CollUtil.isEmpty(groups)){ |
|
|
return Collections.emptyList(); |
|
|
return Collections.emptyList(); |
|
|
} |
|
|
} |
|
@@ -511,7 +497,7 @@ public class PerformanceAppraisalPlanManage { |
|
|
groups.stream().forEach(g -> { |
|
|
groups.stream().forEach(g -> { |
|
|
allEmployeeCodes.addAll(CodeUtil.convertStrToList(g.getReAppraisalUsers())); |
|
|
allEmployeeCodes.addAll(CodeUtil.convertStrToList(g.getReAppraisalUsers())); |
|
|
allEmployeeCodes.addAll(CodeUtil.convertStrToList(g.getVerificationUsers())); |
|
|
allEmployeeCodes.addAll(CodeUtil.convertStrToList(g.getVerificationUsers())); |
|
|
projectCodes.addAll(CodeUtil.convertStrToList(g.getProjectIds())); |
|
|
|
|
|
|
|
|
projectCodes.addAll(CodeUtil.convertStrToList(g.getProjectCodes())); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
if(CollUtil.isNotEmpty(allEmployeeCodes)){ |
|
|
if(CollUtil.isNotEmpty(allEmployeeCodes)){ |
|
@@ -541,7 +527,7 @@ public class PerformanceAppraisalPlanManage { |
|
|
vo.setUpdateBy(g.getUpdateBy()); |
|
|
vo.setUpdateBy(g.getUpdateBy()); |
|
|
vo.setUpdateOn(g.getUpdateOn()); |
|
|
vo.setUpdateOn(g.getUpdateOn()); |
|
|
vo.setId(g.getId()); |
|
|
vo.setId(g.getId()); |
|
|
vo.setProjects(checkProject(g.getProjectIds(), finalProjectMap)); |
|
|
|
|
|
|
|
|
vo.setProjects(checkProject(g.getProjectCodes(), finalProjectMap)); |
|
|
vo.setReAppraisalUsers(checkUser(g.getReAppraisalUsers(), finalUserMap)); |
|
|
vo.setReAppraisalUsers(checkUser(g.getReAppraisalUsers(), finalUserMap)); |
|
|
vo.setVerificationUsers(checkUser(g.getVerificationUsers(), finalUserMap)); |
|
|
vo.setVerificationUsers(checkUser(g.getVerificationUsers(), finalUserMap)); |
|
|
return vo; |
|
|
return vo; |
|
@@ -562,8 +548,8 @@ public class PerformanceAppraisalPlanManage { |
|
|
|
|
|
|
|
|
Map<String, Project> projectMap = Maps.newHashMap(); |
|
|
Map<String, Project> projectMap = Maps.newHashMap(); |
|
|
List<Project> projects = projectService.list(Wrappers.lambdaQuery(Project.class) |
|
|
List<Project> projects = projectService.list(Wrappers.lambdaQuery(Project.class) |
|
|
.in(StringUtils.isNotBlank(group.getProjectIds()),Project::getProjectCode, |
|
|
|
|
|
Arrays.stream(group.getProjectIds().split(StrPool.COMMA)).collect(Collectors.toList())) |
|
|
|
|
|
|
|
|
.in(StringUtils.isNotBlank(group.getProjectCodes()),Project::getProjectCode, |
|
|
|
|
|
Arrays.stream(group.getProjectCodes().split(StrPool.COMMA)).collect(Collectors.toList())) |
|
|
.eq(Project::getNewest,Boolean.TRUE)); |
|
|
.eq(Project::getNewest,Boolean.TRUE)); |
|
|
if(CollUtil.isNotEmpty(projects)){ |
|
|
if(CollUtil.isNotEmpty(projects)){ |
|
|
projectMap = projects.stream().collect(Collectors.toMap(Project::getProjectCode,p -> p)); |
|
|
projectMap = projects.stream().collect(Collectors.toMap(Project::getProjectCode,p -> p)); |
|
@@ -588,7 +574,7 @@ public class PerformanceAppraisalPlanManage { |
|
|
vo.setUpdateBy(group.getUpdateBy()); |
|
|
vo.setUpdateBy(group.getUpdateBy()); |
|
|
vo.setUpdateOn(group.getUpdateOn()); |
|
|
vo.setUpdateOn(group.getUpdateOn()); |
|
|
vo.setId(group.getId()); |
|
|
vo.setId(group.getId()); |
|
|
vo.setProjects(checkProject(group.getProjectIds(), projectMap)); |
|
|
|
|
|
|
|
|
vo.setProjects(checkProject(group.getProjectCodes(), projectMap)); |
|
|
vo.setReAppraisalUsers(checkUser(group.getReAppraisalUsers(), userMap)); |
|
|
vo.setReAppraisalUsers(checkUser(group.getReAppraisalUsers(), userMap)); |
|
|
vo.setVerificationUsers(checkUser(group.getVerificationUsers(), userMap)); |
|
|
vo.setVerificationUsers(checkUser(group.getVerificationUsers(), userMap)); |
|
|
return vo; |
|
|
return vo; |
|
@@ -614,13 +600,15 @@ public class PerformanceAppraisalPlanManage { |
|
|
group.setId(old.getId()); |
|
|
group.setId(old.getId()); |
|
|
} |
|
|
} |
|
|
if(CollUtil.isNotEmpty(dto.getProjectCodes())){ |
|
|
if(CollUtil.isNotEmpty(dto.getProjectCodes())){ |
|
|
group.setProjectIds(dto.getProjectCodes().stream().collect(Collectors.joining(StrPool.COMMA))); |
|
|
|
|
|
|
|
|
group.setProjectCodes(String.join(StrPool.COMMA, dto.getProjectCodes())); |
|
|
} |
|
|
} |
|
|
if(CollUtil.isNotEmpty(dto.getReAppraisalUsers())){ |
|
|
if(CollUtil.isNotEmpty(dto.getReAppraisalUsers())){ |
|
|
group.setReAppraisalUsers(dto.getReAppraisalUsers().stream().collect(Collectors.joining(StrPool.COMMA))); |
|
|
|
|
|
|
|
|
// 判断选择的复评人员是否已经在当前评价计划的其他分组内 |
|
|
|
|
|
checkReAppraisalUsers(dto.getReAppraisalUsers(),dto.getAppraisalId()); |
|
|
|
|
|
group.setReAppraisalUsers(String.join(StrPool.COMMA, dto.getReAppraisalUsers())); |
|
|
} |
|
|
} |
|
|
if(CollUtil.isNotEmpty(dto.getVerificationUsers())){ |
|
|
if(CollUtil.isNotEmpty(dto.getVerificationUsers())){ |
|
|
group.setVerificationUsers(dto.getVerificationUsers().stream().collect(Collectors.joining(StrPool.COMMA))); |
|
|
|
|
|
|
|
|
group.setVerificationUsers(String.join(StrPool.COMMA, dto.getVerificationUsers())); |
|
|
} |
|
|
} |
|
|
group.setUpdateOn(LocalDateTime.now()); |
|
|
group.setUpdateOn(LocalDateTime.now()); |
|
|
group.setUpdateBy(user.getUsername()); |
|
|
group.setUpdateBy(user.getUsername()); |
|
@@ -628,6 +616,29 @@ public class PerformanceAppraisalPlanManage { |
|
|
return "操作成功"; |
|
|
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); |
|
|
|
|
|
// 获取重复添加的复评人员名字 |
|
|
|
|
|
String names = reUsers.stream().map(i -> { |
|
|
|
|
|
UserFullInfoDTO info = userInfoHelper.getUserFullInfoByEmployeeCode(i); |
|
|
|
|
|
if (Objects.nonNull(info)){ |
|
|
|
|
|
return info.getUsername(); |
|
|
|
|
|
} |
|
|
|
|
|
return StrPool.EMPTY; |
|
|
|
|
|
}).collect(Collectors.joining(StrPool.COMMA)); |
|
|
|
|
|
throw new BizException("复评人员:" + names + CommonConst.REAPPRAISAL_REPEAT); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 删除分组 |
|
|
* 删除分组 |
|
|
* @param id |
|
|
* @param id |
|
@@ -672,9 +683,7 @@ public class PerformanceAppraisalPlanManage { |
|
|
if(StringUtils.isBlank(users)){ |
|
|
if(StringUtils.isBlank(users)){ |
|
|
return Collections.emptyList(); |
|
|
return Collections.emptyList(); |
|
|
} |
|
|
} |
|
|
return Arrays.stream(users.split(StrPool.COMMA)).map( |
|
|
|
|
|
employeeCode -> userMap.get(employeeCode) |
|
|
|
|
|
).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
return Arrays.stream(users.split(StrPool.COMMA)).map(userMap::get).collect(Collectors.toList()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public PageVo<PerformanceAppraisalApplicationVO> applicationList(PerformanceAppraisalListReq req) { |
|
|
public PageVo<PerformanceAppraisalApplicationVO> applicationList(PerformanceAppraisalListReq req) { |
|
@@ -712,12 +721,11 @@ public class PerformanceAppraisalPlanManage { |
|
|
return PageVo.of(res,page.getTotal()); |
|
|
return PageVo.of(res,page.getTotal()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public String addProject(PerformanceAppraisalCreateDTO addDTO) { |
|
|
|
|
|
List<AppraisalProjectDTO> projects = addDTO.getProjects(); |
|
|
|
|
|
if (CollUtil.isEmpty(projects)){ |
|
|
|
|
|
|
|
|
public String addProject(AddAppraisalObjectDTO addDTO) { |
|
|
|
|
|
List<Long> projectIdList = addDTO.getProjectIds(); |
|
|
|
|
|
if (CollUtil.isEmpty(projectIdList)){ |
|
|
throw new BizException("请选择至少一个评价项目!"); |
|
|
throw new BizException("请选择至少一个评价项目!"); |
|
|
} |
|
|
} |
|
|
List<Long> projectIdList = projects.stream().map(AppraisalProjectDTO::getId).collect(Collectors.toList()); |
|
|
|
|
|
// 获取已经创建的评价计划中添加的评价项目ID |
|
|
// 获取已经创建的评价计划中添加的评价项目ID |
|
|
List<Long> projectIds = performanceAppraisalProjectService.list().stream() |
|
|
List<Long> projectIds = performanceAppraisalProjectService.list().stream() |
|
|
.map(PerformanceAppraisalProject::getProjectId).collect(Collectors.toList()); |
|
|
.map(PerformanceAppraisalProject::getProjectId).collect(Collectors.toList()); |
|
@@ -740,7 +748,7 @@ public class PerformanceAppraisalPlanManage { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String addApplication(PerformanceAppraisalCreateDTO addDTO) { |
|
|
|
|
|
|
|
|
public String addApplication(AddAppraisalObjectDTO addDTO) { |
|
|
List<Long> applicationIdList = addDTO.getApplicationIds(); |
|
|
List<Long> applicationIdList = addDTO.getApplicationIds(); |
|
|
if (CollUtil.isEmpty(applicationIdList)){ |
|
|
if (CollUtil.isEmpty(applicationIdList)){ |
|
|
throw new BizException("请选择至少一个评应用!"); |
|
|
throw new BizException("请选择至少一个评应用!"); |
|
@@ -771,4 +779,42 @@ public class PerformanceAppraisalPlanManage { |
|
|
return !CollectionUtil.intersection(idList, ids).isEmpty(); |
|
|
return !CollectionUtil.intersection(idList, ids).isEmpty(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public PageVo<PerformanceAppraisalProjectVO> projectList(PerformanceAppraisalListReq req) { |
|
|
|
|
|
Long appraisalId = req.getAppraisalId(); |
|
|
|
|
|
VUtils.isTrue(Objects.isNull(appraisalId)).throwMessage("未传入评价计划ID"); |
|
|
|
|
|
String projectName = req.getProjectName(); |
|
|
|
|
|
String buildOrgName = req.getBuildOrgName(); |
|
|
|
|
|
// 获取评价计划内的选择的项目信息 |
|
|
|
|
|
List<PerformanceAppraisalProject> appraisalProjectList = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) |
|
|
|
|
|
.eq(PerformanceAppraisalProject::getAppraisalId, appraisalId)); |
|
|
|
|
|
List<String> projectCodes = appraisalProjectList.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toList()); |
|
|
|
|
|
LambdaQueryWrapper<Project> wrapper = Wrappers.lambdaQuery(Project.class) |
|
|
|
|
|
.in(Project::getProjectCode, projectCodes) |
|
|
|
|
|
.eq(Project::getNewest, Boolean.TRUE); |
|
|
|
|
|
|
|
|
|
|
|
// 如果对项目名称进行模糊查询 |
|
|
|
|
|
if (StringUtils.isNotBlank(projectName) && StringUtils.isBlank(buildOrgName)){ |
|
|
|
|
|
wrapper.like(Project::getProjectName,projectName); |
|
|
|
|
|
} |
|
|
|
|
|
// 如果对申报单位进行模糊查询 |
|
|
|
|
|
else if (StringUtils.isNotBlank(buildOrgName) && StringUtils.isBlank(projectName)) { |
|
|
|
|
|
wrapper.like(Project::getBuildOrgName,buildOrgName); |
|
|
|
|
|
} |
|
|
|
|
|
// 同时对项目名称和申报单位进行模糊查询 |
|
|
|
|
|
else if (StringUtils.isNotBlank(projectName) && StringUtils.isNotBlank(buildOrgName)) { |
|
|
|
|
|
wrapper.like(Project::getProjectName, projectName) |
|
|
|
|
|
.like(Project::getBuildOrgName, buildOrgName); |
|
|
|
|
|
} |
|
|
|
|
|
List<Project> projects = projectService.list(wrapper); |
|
|
|
|
|
if (CollUtil.isEmpty(projects)){ |
|
|
|
|
|
return PageVo.empty(); |
|
|
|
|
|
} |
|
|
|
|
|
List<PerformanceAppraisalProjectVO> voList = projects.stream().map(p -> { |
|
|
|
|
|
PerformanceAppraisalProjectVO appraisalProjectVo = new PerformanceAppraisalProjectVO(); |
|
|
|
|
|
BeanUtil.copyProperties(p, appraisalProjectVo); |
|
|
|
|
|
appraisalProjectVo.setProjectTypeName(ProjectTypeEnum.getDesc(p.getProjectType())); |
|
|
|
|
|
return appraisalProjectVo; |
|
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
return PageVo.of(voList,voList.size()); |
|
|
|
|
|
} |
|
|
} |
|
|
} |