ソースを参照

标签管理 项目标签关联

master
PoffyZhang 1年前
コミット
ab10af9d23
3個のファイルの変更53行の追加0行の削除
  1. +44
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java
  2. +4
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java
  3. +5
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectLibListItemVO.java

+ 44
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java ファイルの表示

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


+ 4
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java ファイルの表示

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ningdatech.basic.util.NdDateUtils;
import com.ningdatech.pmapi.common.util.BizUtils;
import com.ningdatech.pmapi.portrait.model.vo.TagVO;
import com.ningdatech.pmapi.projectdeclared.model.entity.Contract;
import com.ningdatech.pmapi.projectdeclared.model.vo.ContractVO;
import com.ningdatech.pmapi.projectdeclared.model.vo.PreInsAcceptancePersonVO;
@@ -396,6 +397,9 @@ public class ProjectDetailVO {
@ApiModelProperty("审批详情")
private ProcessProgressDetailVo process;

@ApiModelProperty("标签")
private List<TagVO> tags;

public String getVersionStr() {
if (Objects.nonNull(this.newest) && this.newest) {
this.versionStr = "当前版本";


+ 5
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectLibListItemVO.java ファイルの表示

@@ -3,6 +3,7 @@ package com.ningdatech.pmapi.projectlib.model.vo;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ningdatech.pmapi.common.enumeration.CommonEnum;
import com.ningdatech.pmapi.portrait.model.vo.TagVO;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum;
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails;
@@ -16,6 +17,7 @@ import lombok.experimental.Tolerate;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;
import java.util.Optional;

@@ -142,6 +144,9 @@ public class ProjectLibListItemVO {
@ApiModelProperty("初步方案项目ID")
private Long prePlanProjectId;

@ApiModelProperty("标签")
private List<TagVO> tags;

//预审申报时候 需不需要上传上级条线意见文件
private Boolean needUploadSuperLineFile;
public Boolean getNeedUploadSuperLineFile() {


読み込み中…
キャンセル
保存