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