diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertReviewManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertReviewManage.java index ac53807..8071049 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertReviewManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertReviewManage.java @@ -6,18 +6,22 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.util.CollUtils; import com.ningdatech.cache.lock.DistributedLock; +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.req.ExpertReviewDetailReq; import com.ningdatech.pmapi.expert.model.vo.ExpertReviewDetailVO; import com.ningdatech.pmapi.expert.service.IExpertReviewService; -import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatusEnum; import com.ningdatech.pmapi.meeting.service.IMeetingExpertService; 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 static com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatusEnum.AGREED; @@ -36,6 +40,7 @@ public class ExpertReviewManage { private final IExpertReviewService expertReviewService; private final DistributedLock distributedLock; private final IMeetingExpertService meetingExpertService; + private final FileService fileService; private static final String EXPERT_REVIEW_KEY = "expert_review:"; @@ -120,7 +125,20 @@ public class ExpertReviewManage { query.eq(ExpertReview::getIsFinal, Boolean.FALSE); query.orderByDesc(ExpertReview::getCreateOn); List reviews = expertReviewService.list(query); - return CollUtils.convert(reviews, this::buildExpertReviewDetail); + if (reviews.isEmpty()) { + return Collections.emptyList(); + } + List attachFileIds = CollUtils.fieldList(reviews, ExpertReview::getAttachFileId); + Map fileMap = new HashMap<>(attachFileIds.size()); + if (attachFileIds.size() > 0) { + List files = fileService.getByIds(attachFileIds); + files.forEach(w -> fileMap.put(w.getFileId(), w)); + } + return CollUtils.convert(reviews, w -> { + ExpertReviewDetailVO reviewDetail = buildExpertReviewDetail(w); + reviewDetail.setAttachFile(fileMap.get(w.getAttachFileId())); + return reviewDetail; + }); } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/ExpertReviewDetailVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/ExpertReviewDetailVO.java index 7af0cd6..be22bc6 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/ExpertReviewDetailVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/ExpertReviewDetailVO.java @@ -1,5 +1,6 @@ package com.ningdatech.pmapi.expert.model.vo; +import com.ningdatech.file.entity.vo.result.AttachFileVo; import com.ningdatech.pmapi.expert.model.dto.ReviewTemplateOptionDTO; import io.swagger.annotations.ApiModelProperty; import lombok.Builder; @@ -40,6 +41,9 @@ public class ExpertReviewDetailVO { @ApiModelProperty("附件ID") private Long attachFileId; + @ApiModelProperty("附件详情") + private AttachFileVo attachFile; + @ApiModelProperty("评审结果:1 通过、2 需复核、3 不通过") private Integer reviewResult; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/MeetingReviewProjectDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/MeetingReviewProjectDTO.java index 2964d50..d2fa0af 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/MeetingReviewProjectDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/MeetingReviewProjectDTO.java @@ -31,4 +31,7 @@ public class MeetingReviewProjectDTO { @ApiModelProperty("申报单位") private String buildOrg; + @ApiModelProperty("评审结果") + private String reviewResult; + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java index 464634e..a3435b6 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java @@ -415,6 +415,7 @@ public class MeetingManage { if (meeting.getIsInnerProject()) { List innerProjects = meetingInnerProjectService.listByMeetingId(meetingId); List projects = projectService.listByIds(CollUtils.fieldList(innerProjects, MeetingInnerProject::getProjectId)); + Map reviewMap = expertReviewService.listFinalReviewMap(meetingId); List convert = CollUtils.convert(projects, w -> { MeetingReviewProjectDTO mrp = new MeetingReviewProjectDTO(); mrp.setBuildOrg(w.getBuildOrgName()); @@ -422,6 +423,10 @@ public class MeetingManage { mrp.setProjectType(w.getProjectType().toString()); mrp.setProjectYear(w.getProjectYear()); mrp.setDeclareAmount(w.getDeclareAmount()); + ExpertReview review = reviewMap.get(w.getId()); + if (review != null) { + mrp.setReviewResult(ReviewResultEnum.getByCode(review.getReviewResult()).getValue()); + } return mrp; }); detail.setProjects(convert);