Ver código fonte

增加查看项目所有评审记录

tags/24080901
WendyYang 1 ano atrás
pai
commit
0f250512f4
6 arquivos alterados com 131 adições e 6 exclusões
  1. +10
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertReviewController.java
  2. +60
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertReviewManage.java
  3. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ReviewTemplateSettingsManage.java
  4. +40
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/ProjectReviewDetailVO.java
  5. +9
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/IMeetingInnerProjectService.java
  6. +10
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/impl/MeetingInnerProjectServiceImpl.java

+ 10
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertReviewController.java Ver arquivo

@@ -5,6 +5,7 @@ import com.ningdatech.log.annotation.WebLog;
import com.ningdatech.pmapi.expert.manage.ExpertReviewManage;
import com.ningdatech.pmapi.expert.model.req.ExpertReviewDetailReq;
import com.ningdatech.pmapi.expert.model.vo.ExpertReviewDetailVO;
import com.ningdatech.pmapi.expert.model.vo.ProjectReviewDetailVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
@@ -72,4 +73,13 @@ public class ExpertReviewController {
return expertReviewManage.listReviews(projectId, meetingId, false);
}

@GetMapping("/detail/{projectId}")
@ApiImplicitParams({
@ApiImplicitParam(name = "projectId", value = "项目ID"),
})
@ApiOperation("查看项目的所有评审意见")
public ProjectReviewDetailVO projectExpertReviewDetail(@PathVariable Long projectId) {
return expertReviewManage.projectExpertReviewDetail(projectId);
}

}

+ 60
- 4
pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertReviewManage.java Ver arquivo

@@ -10,19 +10,25 @@ import com.ningdatech.file.entity.vo.result.AttachFileVo;
import com.ningdatech.file.service.FileService;
import com.ningdatech.pmapi.expert.model.dto.ReviewTemplateOptionDTO;
import com.ningdatech.pmapi.expert.model.entity.ExpertReview;
import com.ningdatech.pmapi.expert.model.entity.ReviewTemplateSettings;
import com.ningdatech.pmapi.expert.model.req.ExpertReviewDetailReq;
import com.ningdatech.pmapi.expert.model.vo.ExpertReviewDetailVO;
import com.ningdatech.pmapi.expert.model.vo.ProjectReviewDetailVO;
import com.ningdatech.pmapi.expert.model.vo.ReviewTemplateVO;
import com.ningdatech.pmapi.expert.service.IExpertReviewService;
import com.ningdatech.pmapi.expert.service.IReviewTemplateSettingsService;
import com.ningdatech.pmapi.meeting.entity.domain.Meeting;
import com.ningdatech.pmapi.meeting.service.IMeetingExpertService;
import com.ningdatech.pmapi.meeting.service.IMeetingInnerProjectService;
import com.ningdatech.pmapi.meeting.service.IMeetingService;
import com.ningdatech.pmapi.user.util.LoginUserUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;

import static com.ningdatech.pmapi.expert.model.vo.ProjectReviewDetailVO.ReviewDetailByTypeVO;
import static com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatusEnum.AGREED;

/**
@@ -41,6 +47,9 @@ public class ExpertReviewManage {
private final DistributedLock distributedLock;
private final IMeetingExpertService meetingExpertService;
private final FileService fileService;
private final IMeetingInnerProjectService meetingInnerProjectService;
private final IMeetingService meetingService;
private final IReviewTemplateSettingsService templateSettingsService;

private static final String EXPERT_REVIEW_KEY = "expert_review:";

@@ -142,4 +151,51 @@ public class ExpertReviewManage {
});
}

public ProjectReviewDetailVO projectExpertReviewDetail(Long projectId) {
ProjectReviewDetailVO detail = new ProjectReviewDetailVO();
List<Long> meetingIds = meetingInnerProjectService.listMeetingIdByProjectId(projectId);
if (meetingIds.isEmpty()) {
return detail;
}
List<Meeting> meetings = meetingService.listByIds(meetingIds);
Collection<Long> tmpMeetingIds = meetings.stream()
.collect(Collectors.groupingBy(Meeting::getType,
Collectors.collectingAndThen(Collectors.toList(), w -> {
w.sort(Comparator.comparing(Meeting::getCreateOn));
return w.get(w.size() - 1).getId();
}))).values();
LambdaQueryWrapper<ExpertReview> erQuery = Wrappers.lambdaQuery(ExpertReview.class)
.in(ExpertReview::getMeetingId, tmpMeetingIds)
.eq(ExpertReview::getProjectId, projectId)
.orderByDesc(ExpertReview::getCreateOn);
List<ExpertReview> expertReviews = expertReviewService.list(erQuery);
if (expertReviews.isEmpty()) {
return detail;
}
List<Long> templateIds = CollUtils.fieldList(expertReviews, ExpertReview::getTemplateId);
List<ReviewTemplateSettings> templates = templateSettingsService.listByIds(templateIds);
Map<Long, ReviewTemplateVO> templateMap = CollUtils.listToMap(templates,
ReviewTemplateSettings::getId,
ReviewTemplateSettingsManage::buildTemplateDetail);
detail.setTemplates(templateMap.values());
Map<Integer, ReviewDetailByTypeVO> map = new HashMap<>(8);
expertReviews.forEach(review -> {
ReviewTemplateVO template = templateMap.get(review.getTemplateId());
ReviewDetailByTypeVO reviewDetailByType = map.computeIfAbsent(template.getTemplateType(), k -> {
ReviewDetailByTypeVO tmpReviewDetail = new ReviewDetailByTypeVO();
tmpReviewDetail.setReviewType(k);
tmpReviewDetail.setTeamMemberReviews(new ArrayList<>());
return tmpReviewDetail;
});
ExpertReviewDetailVO tmpReview = buildExpertReviewDetail(review);
if (review.getIsFinal()) {
reviewDetailByType.setFinalReview(tmpReview);
} else {
reviewDetailByType.getTeamMemberReviews().add(tmpReview);
}
});
detail.setReviews(map.values());
return detail;
}

}

+ 2
- 2
pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ReviewTemplateSettingsManage.java Ver arquivo

@@ -67,10 +67,10 @@ public class ReviewTemplateSettingsManage {

public List<ReviewTemplateVO> listReviewTemplateSettings(List<Long> templateIds) {
List<ReviewTemplateSettings> settings = reviewTemplateSettingsService.listByIds(templateIds);
return CollUtils.convert(settings, this::buildTemplateDetail);
return CollUtils.convert(settings, ReviewTemplateSettingsManage::buildTemplateDetail);
}

private ReviewTemplateVO buildTemplateDetail(ReviewTemplateSettings settings) {
protected static ReviewTemplateVO buildTemplateDetail(ReviewTemplateSettings settings) {
if (settings == null) {
throw BizException.wrap("模版不存在");
}


+ 40
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/ProjectReviewDetailVO.java Ver arquivo

@@ -0,0 +1,40 @@
package com.ningdatech.pmapi.expert.model.vo;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Collection;
import java.util.List;

/**
* <p>
* ProjectExpertReviewDetailVO
* </p>
*
* @author WendyYang
* @since 2023/4/19
**/
@Data
public class ProjectReviewDetailVO {

@ApiModelProperty("评审模版详情")
private Collection<ReviewTemplateVO> templates;

private Collection<ReviewDetailByTypeVO> reviews;

@Data
public static class ReviewDetailByTypeVO {

@ApiModelProperty("评审类型")
private Integer reviewType;

@ApiModelProperty("最终评审意见")
private ExpertReviewDetailVO finalReview;

@ApiModelProperty("组员评审意见")
private List<ExpertReviewDetailVO> teamMemberReviews;

}


}

+ 9
- 0
pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/IMeetingInnerProjectService.java Ver arquivo

@@ -24,4 +24,13 @@ public interface IMeetingInnerProjectService extends IService<MeetingInnerProjec
**/
List<MeetingInnerProject> listByMeetingId(Long meetingId);

/**
* 查询项目关联的所有会议
*
* @param projectId 会议ID
* @return 项目关联的会议ID
* @author WendyYang
**/
List<Long> listMeetingIdByProjectId(Long projectId);

}

+ 10
- 0
pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/impl/MeetingInnerProjectServiceImpl.java Ver arquivo

@@ -1,7 +1,9 @@
package com.ningdatech.pmapi.meeting.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ningdatech.basic.util.CollUtils;
import com.ningdatech.pmapi.meeting.entity.domain.MeetingInnerProject;
import com.ningdatech.pmapi.meeting.mapper.MeetingInnerProjectMapper;
import com.ningdatech.pmapi.meeting.service.IMeetingInnerProjectService;
@@ -26,4 +28,12 @@ public class MeetingInnerProjectServiceImpl extends ServiceImpl<MeetingInnerProj
.eq(MeetingInnerProject::getMeetingId, meetingId));
}

@Override
public List<Long> listMeetingIdByProjectId(Long projectId) {
LambdaQueryWrapper<MeetingInnerProject> query = Wrappers
.lambdaQuery(MeetingInnerProject.class)
.eq(MeetingInnerProject::getProjectId, projectId);
return CollUtils.fieldList(list(query), MeetingInnerProject::getMeetingId);
}

}

Carregando…
Cancelar
Salvar