Selaa lähdekoodia

评价计划-单位自评修改

tags/24080901
CMM 1 vuosi sitten
vanhempi
commit
e1d8a1248c
2 muutettua tiedostoa jossa 53 lisäystä ja 11 poistoa
  1. +37
    -11
      pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/OrgSelfAppraisalManage.java
  2. +16
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalProjectVO.java

+ 37
- 11
pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/OrgSelfAppraisalManage.java Näytä tiedosto

@@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ningdatech.basic.exception.BizException;
import com.ningdatech.basic.function.VUtils;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisal;
@@ -15,9 +16,14 @@ import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalVO;
import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalApplicationService;
import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalProjectService;
import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalService;
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.service.IProjectApplicationService;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import com.ningdatech.pmapi.sys.model.entity.Role;
import com.ningdatech.pmapi.sys.service.IRoleService;
import com.ningdatech.pmapi.user.entity.enumeration.RoleEnum;
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails;
import com.ningdatech.pmapi.user.util.LoginUserUtil;
import lombok.AllArgsConstructor;
@@ -49,6 +55,7 @@ public class OrgSelfAppraisalManage {
private final IProjectService projectService;

private final IProjectApplicationService applicationService;
private final IRoleService roleService;

/**
* 绩效列表
@@ -60,23 +67,37 @@ public class OrgSelfAppraisalManage {

//当前登录用户 单位code
String empPosUnitCode = user.getEmpPosUnitCode();
// 获取当前登录用户的角色列表,只有单位管理员才能查看该列表
List<Role> userRoleList = user.getUserRoleList();
List<Long> roleIdList = userRoleList.stream().map(Role::getId).collect(Collectors.toList());
Role role = roleService.getOne(Wrappers.lambdaQuery(Role.class)
.eq(Role::getName, RoleEnum.COMPANY_MANAGER.getDesc()));
if (Objects.isNull(role)){
throw new BizException("系统没有单位管理员角色!");
}

// 登录用户不是单位管理员,不能查看本单位的自评计划列表
if (!roleIdList.contains(role.getId())){
return PageVo.empty();
}

// 获取登录用户所在单位的所有已终验项目信息
List<Project> projectLists = projectService.list(Wrappers.lambdaQuery(Project.class)
.eq(Project::getStatus, ProjectStatusEnum.ACCEPTED.getCode())
.eq(Project::getBuildOrgCode, empPosUnitCode));

if(CollUtil.isEmpty(projectLists)){
return PageVo.empty();
}

List<Long> projectIds = projectLists.stream().map(Project::getId).collect(Collectors.toList());

// 获取添加过该单位项目的所有评价计划信息
List<PerformanceAppraisalProject> paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class)
.in(PerformanceAppraisalProject::getProjectId, projectIds));
if(CollUtil.isEmpty(paps)){
return PageVo.empty();
}

Set<Long> paIds = paps.stream().map(PerformanceAppraisalProject::getAppraisalId).collect(Collectors.toSet());
// 获取评价计划列表
Page<PerformanceAppraisal> page = req.page();
LambdaQueryWrapper<PerformanceAppraisal> wrapper = Wrappers.lambdaQuery(PerformanceAppraisal.class)
.in(PerformanceAppraisal::getId,paIds)
@@ -86,10 +107,9 @@ public class OrgSelfAppraisalManage {
return PageVo.empty();
}

List<PerformanceAppraisalVO> res = page.getRecords().stream().map(p -> {
PerformanceAppraisalVO vo = BeanUtil.copyProperties(p,PerformanceAppraisalVO.class);
return vo;
}).collect(Collectors.toList());
List<PerformanceAppraisalVO> res = page.getRecords().stream()
.map(p -> BeanUtil.copyProperties(p, PerformanceAppraisalVO.class))
.collect(Collectors.toList());
return PageVo.of(res,page.getTotal());
}

@@ -97,8 +117,9 @@ public class OrgSelfAppraisalManage {
UserInfoDetails user = LoginUserUtil.loginUserDetail();

PerformanceAppraisal plan = performanceAppraisalService.getById(planId);
VUtils.isTrue(Objects.isNull(plan)).throwMessage("该计划不存在!");
VUtils.isTrue(Objects.isNull(plan)).throwMessage("该评价计划不存在!");

// 获取评价计划内已添加的待评价项目信息
List<PerformanceAppraisalProject> paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class)
.eq(PerformanceAppraisalProject::getAppraisalId, plan.getId()));
Map<Long, PerformanceAppraisalProject> papsMap = paps.stream().collect(Collectors.toMap(PerformanceAppraisalProject::getProjectId, p -> p));
@@ -106,11 +127,12 @@ public class OrgSelfAppraisalManage {
if(CollUtil.isEmpty(paps)){
return PageVo.empty();
}
Set<String> projectIds = paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toSet());

// 获取本单位在当前评价计划内的项目
Set<String> projectCodes = paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toSet());
Page<Project> page = req.page();
LambdaQueryWrapper<Project> wrapper = Wrappers.lambdaQuery(Project.class)
.in(Project::getProjectCode, projectIds)
.in(Project::getProjectCode, projectCodes)
.eq(Project::getNewest, Boolean.TRUE)
.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode())
.like(StringUtils.isNotBlank(req.getProjectName()),Project::getProjectName,req.getProjectName());
@@ -124,6 +146,10 @@ public class OrgSelfAppraisalManage {
.map(p -> {
PerformanceAppraisalProjectVO vo = BeanUtil.copyProperties(p, PerformanceAppraisalProjectVO.class);
PerformanceAppraisalProject appraisalProject = papsMap.get(p.getId());
vo.setProjectTypeName(ProjectTypeEnum.getDesc(p.getProjectType()));
vo.setIsReAppraisal(appraisalProject.getIsReAppraisal());
vo.setSelfAppraisalStart(appraisalProject.getSelfAppraisalStart());
vo.setSelfAppraisalEnd(appraisalProject.getSelfAppraisalEnd());
vo.setCanSelfAppraisal(checkCanSelfAppraisal(appraisalProject));
return vo;
})


+ 16
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalProjectVO.java Näytä tiedosto

@@ -1,5 +1,6 @@
package com.ningdatech.pmapi.performance.model.vo;

import com.alibaba.fastjson.annotation.JSONField;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -51,4 +52,19 @@ public class PerformanceAppraisalProjectVO implements Serializable {

@ApiModelProperty("是否可自评")
private Boolean canSelfAppraisal = Boolean.FALSE;

@ApiModelProperty("自评开始时间")
private LocalDateTime selfAppraisalStart;

@ApiModelProperty("自评结束时间")
private LocalDateTime selfAppraisalEnd;

@ApiModelProperty("自评总分")
private BigDecimal selfAppraisalScore;

@ApiModelProperty("打分时间")
@JSONField(format = "yyyy-MM-dd HH:mm")
private LocalDateTime scoreTime;


}

Loading…
Peruuta
Tallenna