Browse Source

评审项目列表增加评审结果

master
WendyYang 1 year ago
parent
commit
25a5dc81b0
7 changed files with 153 additions and 12 deletions
  1. +34
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ReviewResultEnum.java
  2. +0
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertReviewManage.java
  3. +21
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertReviewService.java
  4. +21
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertReviewServiceImpl.java
  5. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingController.java
  6. +53
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/MeetingReviewProjectVO.java
  7. +22
    -9
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java

+ 34
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ReviewResultEnum.java View File

@@ -0,0 +1,34 @@
package com.ningdatech.pmapi.expert.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
* <p>
* ReviewResultEnum
* </p>
*
* @author WendyYang
* @since 14:17 2023/3/20
*/
@Getter
@AllArgsConstructor
public enum ReviewResultEnum {

PASSED(1, "通过"),
TO_BE_REVIEWED(2, "需复核"),
REFUSED(3, "不通过");

private final int code;
private final String value;

public static ReviewResultEnum getByCode(int code) {
return Arrays.stream(values())
.filter(w -> w.getCode() == code)
.findFirst()
.orElseThrow(() -> new IllegalArgumentException("无效的审核结果编码"));
}

}

+ 0
- 1
pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertReviewManage.java View File

@@ -62,7 +62,6 @@ public class ExpertReviewManage {
try {
List<ExpertReview> reviews = expertReviewService.listByProjectIdAndExpertId(projectId, userId);
if (req.getIsFinal()) {
// TODO 判断所有专家是否都已评价
if (reviews.isEmpty()) {
throw BizException.wrap("请先填写个人评审意见");
}


+ 21
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertReviewService.java View File

@@ -4,6 +4,7 @@ import com.ningdatech.pmapi.expert.model.entity.ExpertReview;
import com.baomidou.mybatisplus.extension.service.IService;

import java.util.List;
import java.util.Map;

/**
* <p>
@@ -25,4 +26,24 @@ public interface IExpertReviewService extends IService<ExpertReview> {
**/
List<ExpertReview> listByProjectIdAndExpertId(Long projectId, Long expertId);

/**
* 获取最终评审结果
*
* @param meetingId 会议ID
* @param projectId 项目ID
* @return {@link ExpertReview}
* @author WendyYang
**/
ExpertReview getFinalReview(Long meetingId, Long projectId);

/**
* 获取最终评审结果
*
* @param meetingId 会议ID
* @param projectId 项目ID
* @return {@link ExpertReview}
* @author WendyYang
**/
Map<Long, ExpertReview> listFinalReview(Long meetingId);

}

+ 21
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertReviewServiceImpl.java View File

@@ -3,12 +3,15 @@ package com.ningdatech.pmapi.expert.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.common.constant.BizConst;
import com.ningdatech.pmapi.expert.mapper.ExpertReviewMapper;
import com.ningdatech.pmapi.expert.model.entity.ExpertReview;
import com.ningdatech.pmapi.expert.service.IExpertReviewService;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
* <p>
@@ -30,4 +33,22 @@ public class ExpertReviewServiceImpl extends ServiceImpl<ExpertReviewMapper, Exp
return list(query);
}

@Override
public ExpertReview getFinalReview(Long meetingId, Long projectId) {
LambdaQueryWrapper<ExpertReview> query = Wrappers.lambdaQuery(ExpertReview.class);
query.eq(ExpertReview::getProjectId, projectId);
query.eq(ExpertReview::getMeetingId, meetingId);
query.eq(ExpertReview::getIsFinal, Boolean.TRUE);
query.last(BizConst.LIMIT_1);
return getOne(query);
}

@Override
public Map<Long, ExpertReview> listFinalReview(Long meetingId) {
LambdaQueryWrapper<ExpertReview> query = Wrappers.lambdaQuery(ExpertReview.class);
query.eq(ExpertReview::getMeetingId, meetingId);
query.eq(ExpertReview::getIsFinal, Boolean.TRUE);
return CollUtils.listToMap(list(query), ExpertReview::getProjectId);
}

}

+ 2
- 2
pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingController.java View File

@@ -177,13 +177,13 @@ public class MeetingController {

@GetMapping("/option/project")
@ApiOperation("项目列表(创建会议添加项目)")
public PageVo<ProjectLibListItemVO> projectList(MeetingOptionProjectReq req) {
public PageVo<MeetingReviewProjectVO> projectList(MeetingOptionProjectReq req) {
return meetingManage.optionProject(req);
}

@GetMapping("/{meetingId}/projects")
@ApiOperation("会议关联项目列表")
public List<ProjectLibListItemVO> projectsByMeetingId(@PathVariable Long meetingId) {
public List<MeetingReviewProjectVO> projectsByMeetingId(@PathVariable Long meetingId) {
return meetingManage.projectsByMeetingId(meetingId);
}



+ 53
- 0
pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/MeetingReviewProjectVO.java View File

@@ -0,0 +1,53 @@
package com.ningdatech.pmapi.meeting.entity.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.experimental.Tolerate;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
* <p>
* MeetingReviewProjectVO
* </p>
*
* @author WendyYang
* @since 13:57 2023/3/20
*/
@Data
@Builder
public class MeetingReviewProjectVO {

@Tolerate
public MeetingReviewProjectVO() {
}

@ApiModelProperty("项目ID")
private Long id;

@ApiModelProperty("项目名称")
private String projectName;

@ApiModelProperty("申报金额")
private BigDecimal declaredAmount;

@ApiModelProperty("项目类型")
private Integer projectType;

@ApiModelProperty("申报年度")
private Integer projectYear;

@ApiModelProperty("申报单位")
private String buildOrg;

@ApiModelProperty("评审结果")
private String reviewResult;

@ApiModelProperty("创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private LocalDateTime createOn;

}

+ 22
- 9
pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java View File

@@ -18,8 +18,11 @@ import com.ningdatech.basic.util.StrPool;
import com.ningdatech.basic.util.ValidUtil;
import com.ningdatech.cache.lock.DistributedLock;
import com.ningdatech.pmapi.common.helper.RegionCacheHelper;
import com.ningdatech.pmapi.expert.constant.ReviewResultEnum;
import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo;
import com.ningdatech.pmapi.expert.helper.PermissionCheckHelper;
import com.ningdatech.pmapi.expert.model.entity.ExpertReview;
import com.ningdatech.pmapi.expert.service.IExpertReviewService;
import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService;
import com.ningdatech.pmapi.meeting.builder.ExpertInviteBuilder;
import com.ningdatech.pmapi.meeting.entity.domain.*;
@@ -41,7 +44,6 @@ import com.ningdatech.pmapi.organization.service.IDingOrganizationService;
import com.ningdatech.pmapi.organization.service.IGovBusinessStripService;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import com.ningdatech.pmapi.sys.model.dto.RegionDTO;
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails;
@@ -89,7 +91,7 @@ public class MeetingManage {
private final IMeetingOuterProjectService meetingOuterProjectService;
private final IGovBusinessStripService businessStripService;
private final IDingOrganizationService dingOrganizationService;
private final IExpertReviewService expertReviewService;
private final ExpertInviteHelper expertInviteHelper;
private static final String INVITED_RULE_CREATE = "INVITED_RULE_CREATE:";

@@ -728,7 +730,7 @@ public class MeetingManage {
return PageVo.of(page.getRecords(), page.getTotal());
}

public PageVo<ProjectLibListItemVO> optionProject(MeetingOptionProjectReq req) {
public PageVo<MeetingReviewProjectVO> optionProject(MeetingOptionProjectReq req) {
String meetingType = req.getMeetingType();
LambdaQueryWrapper<Project> query = Wrappers.lambdaQuery(Project.class);
switch (MeetingReviewTypeEnum.getByCode(meetingType)) {
@@ -748,28 +750,38 @@ public class MeetingManage {
return PageVo.empty();
}
Page<Project> page = projectService.page(req.page(), query);
PageVo<ProjectLibListItemVO> result = PageVo.of(null, page.getTotal());
PageVo<MeetingReviewProjectVO> result = PageVo.of(null, page.getTotal());
if (result.getTotal() > 0) {
result.setRecords(CollUtils.convert(page.getRecords(), this::buildProjectList));
}
return result;
}

public List<ProjectLibListItemVO> projectsByMeetingId(Long meetingId) {
public List<MeetingReviewProjectVO> projectsByMeetingId(Long meetingId) {
Meeting meeting = meetingService.getById(meetingId);
if (meeting.getIsInnerProject()) {
List<MeetingInnerProject> projects = meetingInnerProjectService.listByMeetingId(meetingId);
List<Long> projectIdList = CollUtils.fieldList(projects, MeetingInnerProject::getProjectId);
List<Project> projectList = projectService.listByIds(projectIdList);
return CollUtils.convert(projectList, this::buildProjectList);
Map<Long, ExpertReview> reviewMap = expertReviewService.listFinalReview(meetingId);
return CollUtils.convert(projectList, w -> {
MeetingReviewProjectVO vo = buildProjectList(w);
ExpertReview review = reviewMap.get(w.getId());
if (review != null) {
vo.setReviewResult(ReviewResultEnum.getByCode(review.getReviewResult()).getValue());
} else {
vo.setReviewResult("--");
}
return vo;
});
} else {
List<MeetingOuterProject> projects = meetingOuterProjectService.listByMeetingId(meetingId);
return BeanUtil.copyToList(projects, ProjectLibListItemVO.class);
return BeanUtil.copyToList(projects, MeetingReviewProjectVO.class);
}
}

private ProjectLibListItemVO buildProjectList(Project project) {
return ProjectLibListItemVO
private MeetingReviewProjectVO buildProjectList(Project project) {
return MeetingReviewProjectVO
.builder()
.id(project.getId())
.projectName(project.getProjectName())
@@ -777,6 +789,7 @@ public class MeetingManage {
.projectType(project.getProjectType())
.projectYear(project.getProjectYear())
.buildOrg(project.getBuildOrgName())
.createOn(project.getCreateOn())
.build();
}



Loading…
Cancel
Save