Bladeren bron

Merge branch 'ls2_performance_appraisal_0801' of http://git.ningdatech.com/liushuai/project-management into dev

tags/24080901
CMM 1 jaar geleden
bovenliggende
commit
0fbe0b50d2
4 gewijzigde bestanden met toevoegingen van 89 en 3 verwijderingen
  1. +7
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceAppraisalPlanController.java
  2. +77
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalPlanManage.java
  3. +2
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/helper/ProjectHelper.java
  4. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectListReq.java

+ 7
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceAppraisalPlanController.java Bestand weergeven

@@ -12,6 +12,7 @@ import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalApplication
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 com.ningdatech.pmapi.projectlib.model.vo.ProjectApplicationVO;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -60,6 +61,12 @@ public class PerformanceAppraisalPlanController {
return performanceAppraisalPlanManage.finalProjectList(req);
}

@GetMapping("/final-application-list")
@ApiOperation("评价计划-终验应用列表")
public PageVo<ProjectApplicationVO> finalApplicationList(PerformanceAppraisalListReq req) {
return performanceAppraisalPlanManage.finalApplicationList(req);
}

@PostMapping("/addProject")
@ApiOperation("评价计划-添加待评价项目")
@WebLog("评价计划-添加待评价项目")


+ 77
- 3
pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalPlanManage.java Bestand weergeven

@@ -9,7 +9,10 @@ import com.ningdatech.pmapi.performance.service.*;
import com.ningdatech.pmapi.projectlib.helper.ProjectHelper;
import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage;
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectApplicationVO;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO;
import com.wflow.workflow.bean.vo.ProcessTaskVo;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

@@ -85,6 +88,7 @@ public class PerformanceAppraisalPlanManage {
private final IPerformanceAppraisalScoreInfoService performanceAppraisalScoreInfoService;
private final IPerformanceAppraisalAppScoreInfoService performanceAppraisalAppScoreInfoService;
private final ProjectLibManage projectLibManage;
private final IProjectApplicationService projectApplicationService;

/**
* 绩效列表
@@ -1055,8 +1059,8 @@ public class PerformanceAppraisalPlanManage {
param.setBuildOrgName(buildOrgName);
param.setProjectType(projectType);
param.setProjectYear(projectYear);
param.setRegionCode(user.getRegionCode());
param.setStatus(ProjectStatusEnum.ACCEPTED.getCode());
PageVo<ProjectLibListItemVO> resList = projectLibManage.projectLibListWithPermission(param, user);
// 获取已添加到评价计划中的项目
List<String> projectCodes = performanceAppraisalProjectService.list().stream()
.map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toList());
@@ -1070,7 +1074,77 @@ public class PerformanceAppraisalPlanManage {
}
}
// 过滤掉已经添加到评价计划中的项目(如果是编辑评价计划,保留当前计划已添加的项目)
List<ProjectLibListItemVO> result = resList.getRecords().stream().filter(r -> !projectCodes.contains(r.getProjectCode())).collect(Collectors.toList());
return PageVo.of(result,result.size());
param.setProjectCodes(projectCodes);
return projectLibManage.projectLibListWithPermission(param, user);
}

public PageVo<ProjectApplicationVO> finalApplicationList(PerformanceAppraisalListReq req) {
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId());
String regionCode = user.getRegionCode();
Long appraisalId = req.getAppraisalId();

Page<ProjectApplication> page = req.page();
LambdaQueryWrapper<ProjectApplication> wrapper = Wrappers.lambdaQuery(ProjectApplication.class)
.like(StringUtils.isNotBlank(req.getBuildOrgName()), ProjectApplication::getBuildOrgName, req.getBuildOrgName());

if (StringUtils.isNotBlank(req.getApplicationName())) {
wrapper.and(q1 -> q1.like(ProjectApplication::getApplicationName, req.getApplicationName())
.or(q2 -> q2.like(ProjectApplication::getRelatedExistsApplication, req.getApplicationName())));
}
// 获取本区域已验收的项目关联的应用
List<Project> projectList = projectService.list(Wrappers.lambdaQuery(Project.class)
.eq(Project::getAreaCode, regionCode)
.eq(Project::getNewest,Boolean.TRUE)
.eq(Project::getStatus, ProjectStatusEnum.ACCEPTED.getCode()));
List<String> projectCodeList = projectList.stream().map(Project::getProjectCode).collect(Collectors.toList());
List<Integer> projectVersionList = projectList.stream().map(Project::getVersion).collect(Collectors.toList());
wrapper.in(ProjectApplication::getProjectCode,projectCodeList);
wrapper.in(ProjectApplication::getProjectVersion,projectVersionList);
wrapper.orderByDesc(ProjectApplication::getUpdateOn);
List<ProjectApplication> appList = projectApplicationService.list(wrapper);

List<ProjectApplication> applicationList = Lists.newArrayList();
// 按项目编号+应用名称+IRS关联应用名称分组,获取最新版本的应用
Map<String, List<ProjectApplication>> appMap = appList.stream().collect(Collectors.groupingBy(p -> p.getProjectCode() + p.getRelatedExistsApplication() + p.getApplicationName()));
for (Map.Entry<String, List<ProjectApplication>> entry : appMap.entrySet()) {
List<ProjectApplication> applications = entry.getValue();
Optional<ProjectApplication> max = applications.stream().max(Comparator.comparingInt(ProjectApplication::getProjectVersion));
if (max.isPresent()){
ProjectApplication application = max.get();
applicationList.add(application);
}
}
if (CollUtil.isEmpty(applicationList)){
return PageVo.empty();
}
// 获取已添加到评价计划中的应用
List<Long> applicationIdList = performanceAppraisalApplicationService.list().stream()
.map(PerformanceAppraisalApplication::getApplicationId).collect(Collectors.toList());
// 如果是编辑评价计划,保留当前计划已添加的应用
if (Objects.nonNull(appraisalId)) {
List<PerformanceAppraisalApplication> projectApplications = performanceAppraisalApplicationService.list(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class)
.eq(PerformanceAppraisalApplication::getAppraisalId, appraisalId));
if (CollUtil.isNotEmpty(projectApplications)){
List<Long> appIdList = projectApplications.stream().map(PerformanceAppraisalApplication::getApplicationId).collect(Collectors.toList());
applicationIdList.removeAll(appIdList);
}
}
List<ProjectApplication> resList = applicationList.stream().filter(a -> !applicationIdList.contains(a.getId())).collect(Collectors.toList());
if (CollUtil.isEmpty(resList)){
return PageVo.empty();
}

Integer pageNumber = req.getPageNumber();
Integer pageSize = req.getPageSize();
List<ProjectApplication> resultList = resList.stream()
.skip((long) (pageNumber - 1) * pageSize)
.limit(pageSize)
.collect(Collectors.toList());

List<ProjectApplicationVO> res = resultList.stream()
.map(app -> BeanUtil.copyProperties(app, ProjectApplicationVO.class))
.collect(Collectors.toList());

return PageVo.of(res, resList.size());
}
}

+ 2
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/helper/ProjectHelper.java Bestand weergeven

@@ -60,6 +60,8 @@ public class ProjectHelper {
.in(CollUtil.isNotEmpty(req.getStatusList()),Project::getStatus,req.getStatusList())
//实例code
.in(CollUtil.isNotEmpty(req.getInstCodes()),Project::getInstCode,req.getInstCodes())
//已添加评价计划的项目code
.notIn(CollUtil.isNotEmpty(req.getProjectCodes()),Project::getProjectCode,req.getProjectCodes())
.orderByDesc(Project::getCreateOn);
return query;
}


+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectListReq.java Bestand weergeven

@@ -96,6 +96,9 @@ public class ProjectListReq extends PagePo {
@ApiModelProperty("实例code 多个")
private List<String> instCodes;

@ApiModelProperty("项目code 多个")
private List<String> projectCodes;

@ApiModelProperty("导出选项")
private List<ExportOptionEnum> exportOptionList;
}

Laden…
Annuleren
Opslaan