|
|
@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.google.common.collect.Lists; |
|
|
|
import com.google.common.collect.Maps; |
|
|
|
import com.ningdatech.basic.function.VUtils; |
|
|
|
import com.ningdatech.basic.model.PageVo; |
|
|
|
import com.ningdatech.basic.util.CollUtils; |
|
|
@@ -34,6 +35,11 @@ import com.ningdatech.pmapi.organization.service.IDingOrganizationService; |
|
|
|
import com.ningdatech.pmapi.performance.model.dto.ProjectCoreBusinessDTO; |
|
|
|
import com.ningdatech.pmapi.performance.model.entity.ProjectCoreBusinessIndicators; |
|
|
|
import com.ningdatech.pmapi.performance.service.IProjectCoreBusinessIndicatorsService; |
|
|
|
import com.ningdatech.pmapi.portrait.model.entity.ProjectTag; |
|
|
|
import com.ningdatech.pmapi.portrait.model.entity.Tag; |
|
|
|
import com.ningdatech.pmapi.portrait.model.vo.TagVO; |
|
|
|
import com.ningdatech.pmapi.portrait.service.IProjectTagService; |
|
|
|
import com.ningdatech.pmapi.portrait.service.ITagService; |
|
|
|
import com.ningdatech.pmapi.projectdeclared.model.dto.DelayedApplyDTO; |
|
|
|
import com.ningdatech.pmapi.projectdeclared.model.entity.Contract; |
|
|
|
import com.ningdatech.pmapi.projectdeclared.model.entity.PaymentPlan; |
|
|
@@ -114,6 +120,9 @@ public class ProjectLibManage { |
|
|
|
private final ITodoService todoService; |
|
|
|
private final IProjectCoreBusinessIndicatorsService projectCoreBusinessIndicatorsService; |
|
|
|
|
|
|
|
private final IProjectTagService projectTagService; |
|
|
|
private final ITagService tagService; |
|
|
|
|
|
|
|
public PageVo<ProjectLibListItemVO> projectLibList(ProjectListReq req) { |
|
|
|
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); |
|
|
|
query.eq(Project::getNewest, Boolean.TRUE); |
|
|
@@ -153,6 +162,24 @@ public class ProjectLibManage { |
|
|
|
return PageVo.empty(); |
|
|
|
} |
|
|
|
UserFullInfoDTO finalUser = user; |
|
|
|
|
|
|
|
Set<String> projectCodes = page.getRecords().stream() |
|
|
|
.map(Project::getProjectCode).collect(Collectors.toSet()); |
|
|
|
List<ProjectTag> pts = projectTagService.list(Wrappers.lambdaQuery(ProjectTag.class) |
|
|
|
.in(ProjectTag::getProjectCode, projectCodes)); |
|
|
|
Map<String,List<ProjectTag>> tagMap = Maps.newHashMap(); |
|
|
|
Map<Long,String> tagNameMap = Maps.newHashMap(); |
|
|
|
if(CollUtil.isNotEmpty(pts)){ |
|
|
|
tagMap = pts.stream().collect(Collectors.groupingBy(ProjectTag::getProjectCode)); |
|
|
|
Set<Long> tagIds = pts.stream().map(ProjectTag::getTagId).collect(Collectors.toSet()); |
|
|
|
List<Tag> tags = tagService.list(Wrappers.lambdaQuery(Tag.class) |
|
|
|
.in(Tag::getId, tagIds)); |
|
|
|
if(CollUtil.isNotEmpty(tags)){ |
|
|
|
tagNameMap = tags.stream().collect(Collectors.toMap(Tag::getId,Tag::getName)); |
|
|
|
} |
|
|
|
} |
|
|
|
Map<String, List<ProjectTag>> finalTagMap = tagMap; |
|
|
|
Map<Long,String> finalTagNameMap = tagNameMap; |
|
|
|
List<ProjectLibListItemVO> records = CollUtils.convert(page.getRecords(), w -> { |
|
|
|
ProjectLibListItemVO item = new ProjectLibListItemVO(); |
|
|
|
item.setId(w.getId()); |
|
|
@@ -175,11 +202,28 @@ public class ProjectLibManage { |
|
|
|
item.setCanPreDeclared(Boolean.TRUE); |
|
|
|
} |
|
|
|
item.setPrePlanProjectId(w.getPrePlanProjectId()); |
|
|
|
setTag(item,finalTagMap,finalTagNameMap); |
|
|
|
return item; |
|
|
|
}); |
|
|
|
return PageVo.of(records, total); |
|
|
|
} |
|
|
|
|
|
|
|
private void setTag(ProjectLibListItemVO item, Map<String, List<ProjectTag>> finalTagMap, Map<Long, String> finalTagNameMap) { |
|
|
|
if(finalTagMap.containsKey(item.getProjectCode())){ |
|
|
|
List<TagVO> tags = Lists.newArrayList(); |
|
|
|
List<ProjectTag> projectTags = finalTagMap.get(item.getProjectCode()); |
|
|
|
for(ProjectTag pt :projectTags){ |
|
|
|
if(finalTagNameMap.containsKey(pt.getTagId())){ |
|
|
|
TagVO vo = new TagVO(); |
|
|
|
vo.setId(pt.getTagId()); |
|
|
|
vo.setName(finalTagNameMap.get(pt.getTagId())); |
|
|
|
tags.add(vo); |
|
|
|
} |
|
|
|
} |
|
|
|
item.setTags(tags); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public List<Project> projectList(ProjectListReq req) { |
|
|
|
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); |
|
|
|
return projectService.list(query); |
|
|
|