Просмотр исходного кода

绩效评价计划-分组待评价项目列表

tags/24080901
CMM 1 год назад
Родитель
Сommit
360aca6672
5 измененных файлов: 102 добавлений и 44 удалений
  1. +1
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConst.java
  2. +12
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceAppraisalPlanController.java
  3. +84
    -38
      pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalPlanManage.java
  4. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalProjectGroup.java
  5. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/req/PerformanceAppraisalListReq.java

+ 1
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConst.java Просмотреть файл

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





+ 12
- 4
pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceAppraisalPlanController.java Просмотреть файл

@@ -3,12 +3,14 @@ package com.ningdatech.pmapi.performance.controller;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.log.annotation.WebLog;
import com.ningdatech.pmapi.performance.manage.PerformanceAppraisalPlanManage;
import com.ningdatech.pmapi.performance.model.dto.AddAppraisalObjectDTO;
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.req.PerformanceAppraisalListReq;
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalApplicationVO;
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalProjectGroupVO;
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalProjectVO;
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -54,15 +56,15 @@ public class PerformanceAppraisalPlanController {
@PostMapping("/addProject")
@ApiOperation("评价计划-添加待评价项目")
@WebLog("评价计划-添加待评价项目")
public String addProject(@Valid @RequestBody PerformanceAppraisalCreateDTO createDTO) {
return performanceAppraisalPlanManage.addProject(createDTO);
public String addProject(@Valid @RequestBody AddAppraisalObjectDTO addDTO) {
return performanceAppraisalPlanManage.addProject(addDTO);
}

@PostMapping("/addApplication")
@ApiOperation("评价计划-添加待评价应用")
@WebLog("评价计划-添加待评价应用")
public String addApplication(@Valid @RequestBody PerformanceAppraisalCreateDTO createDTO) {
return performanceAppraisalPlanManage.addApplication(createDTO);
public String addApplication(@Valid @RequestBody AddAppraisalObjectDTO addDTO) {
return performanceAppraisalPlanManage.addApplication(addDTO);
}

@PostMapping("/edit")
@@ -85,6 +87,12 @@ public class PerformanceAppraisalPlanController {
return performanceAppraisalPlanManage.applicationList(req);
}

@GetMapping("/project-list")
@ApiOperation("项目分组-评价计划内待评价项目列表")
public PageVo<PerformanceAppraisalProjectVO> projectList(PerformanceAppraisalListReq req) {
return performanceAppraisalPlanManage.projectList(req);
}

@GetMapping("/group/list/{appraisalId}")
@ApiOperation("绩效评价分组列表")
public List<PerformanceAppraisalProjectGroupVO> groupList(@PathVariable Long appraisalId,


+ 84
- 38
pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalPlanManage.java Просмотреть файл

@@ -4,7 +4,6 @@ import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;

import org.checkerframework.checker.nullness.qual.Nullable;
import org.springframework.stereotype.Component;
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.performance.convert.PerformanceAppraisalConveter;
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.PerformanceAppraisalApplication;
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.projectlib.enumeration.InstTypeEnum;
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.ProjectApplication;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst;
@@ -219,24 +216,12 @@ public class PerformanceAppraisalPlanManage {
groupVo.setAppraisalId(id);
groupVo.setName(g.getName());
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);
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.setCreateOn(g.getCreateOn());
return groupVo;
@@ -499,7 +484,8 @@ public class PerformanceAppraisalPlanManage {
List<PerformanceAppraisalProjectGroup> groups = groupService.list(
Wrappers.lambdaQuery(PerformanceAppraisalProjectGroup.class)
.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)){
return Collections.emptyList();
}
@@ -511,7 +497,7 @@ public class PerformanceAppraisalPlanManage {
groups.stream().forEach(g -> {
allEmployeeCodes.addAll(CodeUtil.convertStrToList(g.getReAppraisalUsers()));
allEmployeeCodes.addAll(CodeUtil.convertStrToList(g.getVerificationUsers()));
projectCodes.addAll(CodeUtil.convertStrToList(g.getProjectIds()));
projectCodes.addAll(CodeUtil.convertStrToList(g.getProjectCodes()));
});

if(CollUtil.isNotEmpty(allEmployeeCodes)){
@@ -541,7 +527,7 @@ public class PerformanceAppraisalPlanManage {
vo.setUpdateBy(g.getUpdateBy());
vo.setUpdateOn(g.getUpdateOn());
vo.setId(g.getId());
vo.setProjects(checkProject(g.getProjectIds(), finalProjectMap));
vo.setProjects(checkProject(g.getProjectCodes(), finalProjectMap));
vo.setReAppraisalUsers(checkUser(g.getReAppraisalUsers(), finalUserMap));
vo.setVerificationUsers(checkUser(g.getVerificationUsers(), finalUserMap));
return vo;
@@ -562,8 +548,8 @@ public class PerformanceAppraisalPlanManage {

Map<String, Project> projectMap = Maps.newHashMap();
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));
if(CollUtil.isNotEmpty(projects)){
projectMap = projects.stream().collect(Collectors.toMap(Project::getProjectCode,p -> p));
@@ -588,7 +574,7 @@ public class PerformanceAppraisalPlanManage {
vo.setUpdateBy(group.getUpdateBy());
vo.setUpdateOn(group.getUpdateOn());
vo.setId(group.getId());
vo.setProjects(checkProject(group.getProjectIds(), projectMap));
vo.setProjects(checkProject(group.getProjectCodes(), projectMap));
vo.setReAppraisalUsers(checkUser(group.getReAppraisalUsers(), userMap));
vo.setVerificationUsers(checkUser(group.getVerificationUsers(), userMap));
return vo;
@@ -614,13 +600,15 @@ public class PerformanceAppraisalPlanManage {
group.setId(old.getId());
}
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())){
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())){
group.setVerificationUsers(dto.getVerificationUsers().stream().collect(Collectors.joining(StrPool.COMMA)));
group.setVerificationUsers(String.join(StrPool.COMMA, dto.getVerificationUsers()));
}
group.setUpdateOn(LocalDateTime.now());
group.setUpdateBy(user.getUsername());
@@ -628,6 +616,29 @@ 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);
// 获取重复添加的复评人员名字
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
@@ -672,9 +683,7 @@ public class PerformanceAppraisalPlanManage {
if(StringUtils.isBlank(users)){
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) {
@@ -712,12 +721,11 @@ public class PerformanceAppraisalPlanManage {
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("请选择至少一个评价项目!");
}
List<Long> projectIdList = projects.stream().map(AppraisalProjectDTO::getId).collect(Collectors.toList());
// 获取已经创建的评价计划中添加的评价项目ID
List<Long> projectIds = performanceAppraisalProjectService.list().stream()
.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();
if (CollUtil.isEmpty(applicationIdList)){
throw new BizException("请选择至少一个评应用!");
@@ -771,4 +779,42 @@ public class PerformanceAppraisalPlanManage {
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());
}
}

+ 2
- 2
pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalProjectGroup.java Просмотреть файл

@@ -38,8 +38,8 @@ public class PerformanceAppraisalProjectGroup implements Serializable {
@ApiModelProperty("计划id")
private Long appraisalId;

@ApiModelProperty("分组内的所有项目id")
private String projectIds;
@ApiModelProperty("分组内的所有项目code")
private String projectCodes;

@ApiModelProperty("复评人员")
private String reAppraisalUsers;


+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/model/req/PerformanceAppraisalListReq.java Просмотреть файл

@@ -45,4 +45,7 @@ public class PerformanceAppraisalListReq extends PagePo {

@ApiModelProperty("申报单位")
private String buildOrgName;

@ApiModelProperty("评价计划ID")
private Long appraisalId;
}

Загрузка…
Отмена
Сохранить