From 25a5dc81b084b9a71312cccca2774dc966cd7ddb Mon Sep 17 00:00:00 2001 From: WendyYang Date: Mon, 20 Mar 2023 14:24:12 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=AF=84=E5=AE=A1=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=A2=9E=E5=8A=A0=E8=AF=84=E5=AE=A1=E7=BB=93?= =?UTF-8?q?=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/expert/constant/ReviewResultEnum.java | 34 ++++++++++++++ .../pmapi/expert/manage/ExpertReviewManage.java | 1 - .../pmapi/expert/service/IExpertReviewService.java | 21 +++++++++ .../service/impl/ExpertReviewServiceImpl.java | 21 +++++++++ .../meeting/controller/MeetingController.java | 4 +- .../meeting/entity/vo/MeetingReviewProjectVO.java | 53 ++++++++++++++++++++++ .../pmapi/meeting/manage/MeetingManage.java | 31 +++++++++---- 7 files changed, 153 insertions(+), 12 deletions(-) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ReviewResultEnum.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/MeetingReviewProjectVO.java diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ReviewResultEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ReviewResultEnum.java new file mode 100644 index 0000000..b62f072 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ReviewResultEnum.java @@ -0,0 +1,34 @@ +package com.ningdatech.pmapi.expert.constant; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.Arrays; + +/** + *

+ * ReviewResultEnum + *

+ * + * @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("无效的审核结果编码")); + } + +} 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 b070dec..8acd3ac 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 @@ -62,7 +62,6 @@ public class ExpertReviewManage { try { List reviews = expertReviewService.listByProjectIdAndExpertId(projectId, userId); if (req.getIsFinal()) { - // TODO 判断所有专家是否都已评价 if (reviews.isEmpty()) { throw BizException.wrap("请先填写个人评审意见"); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertReviewService.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertReviewService.java index 8a9a650..fe05a21 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertReviewService.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertReviewService.java @@ -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; /** *

@@ -25,4 +26,24 @@ public interface IExpertReviewService extends IService { **/ List 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 listFinalReview(Long meetingId); + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertReviewServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertReviewServiceImpl.java index 0dbb95c..c0accdd 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertReviewServiceImpl.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertReviewServiceImpl.java @@ -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; /** *

@@ -30,4 +33,22 @@ public class ExpertReviewServiceImpl extends ServiceImpl 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 listFinalReview(Long meetingId) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(ExpertReview.class); + query.eq(ExpertReview::getMeetingId, meetingId); + query.eq(ExpertReview::getIsFinal, Boolean.TRUE); + return CollUtils.listToMap(list(query), ExpertReview::getProjectId); + } + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingController.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingController.java index 1fc83a0..a70a51f 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingController.java @@ -177,13 +177,13 @@ public class MeetingController { @GetMapping("/option/project") @ApiOperation("项目列表(创建会议添加项目)") - public PageVo projectList(MeetingOptionProjectReq req) { + public PageVo projectList(MeetingOptionProjectReq req) { return meetingManage.optionProject(req); } @GetMapping("/{meetingId}/projects") @ApiOperation("会议关联项目列表") - public List projectsByMeetingId(@PathVariable Long meetingId) { + public List projectsByMeetingId(@PathVariable Long meetingId) { return meetingManage.projectsByMeetingId(meetingId); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/MeetingReviewProjectVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/MeetingReviewProjectVO.java new file mode 100644 index 0000000..1519e06 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/MeetingReviewProjectVO.java @@ -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; + +/** + *

+ * MeetingReviewProjectVO + *

+ * + * @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; + +} 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 d0c820d..3ab6456 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 @@ -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 optionProject(MeetingOptionProjectReq req) { + public PageVo optionProject(MeetingOptionProjectReq req) { String meetingType = req.getMeetingType(); LambdaQueryWrapper query = Wrappers.lambdaQuery(Project.class); switch (MeetingReviewTypeEnum.getByCode(meetingType)) { @@ -748,28 +750,38 @@ public class MeetingManage { return PageVo.empty(); } Page page = projectService.page(req.page(), query); - PageVo result = PageVo.of(null, page.getTotal()); + PageVo result = PageVo.of(null, page.getTotal()); if (result.getTotal() > 0) { result.setRecords(CollUtils.convert(page.getRecords(), this::buildProjectList)); } return result; } - public List projectsByMeetingId(Long meetingId) { + public List projectsByMeetingId(Long meetingId) { Meeting meeting = meetingService.getById(meetingId); if (meeting.getIsInnerProject()) { List projects = meetingInnerProjectService.listByMeetingId(meetingId); List projectIdList = CollUtils.fieldList(projects, MeetingInnerProject::getProjectId); List projectList = projectService.listByIds(projectIdList); - return CollUtils.convert(projectList, this::buildProjectList); + Map 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 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(); } From 820d6311a296fbccdb384f64c142d0f125d51c5f Mon Sep 17 00:00:00 2001 From: WendyYang Date: Mon, 20 Mar 2023 15:34:04 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=B8=93=E5=AE=B6?= =?UTF-8?q?=E8=AF=84=E5=AE=A1=E6=9F=A5=E8=AF=A2=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/expert/service/IExpertReviewService.java | 12 ++++++++++-- .../pmapi/expert/service/impl/ExpertReviewServiceImpl.java | 9 +++++++-- .../com/ningdatech/pmapi/meeting/manage/MeetingManage.java | 2 +- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertReviewService.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertReviewService.java index fe05a21..91074c2 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertReviewService.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertReviewService.java @@ -40,10 +40,18 @@ public interface IExpertReviewService extends IService { * 获取最终评审结果 * * @param meetingId 会议ID - * @param projectId 项目ID * @return {@link ExpertReview} * @author WendyYang **/ - Map listFinalReview(Long meetingId); + Map listFinalReviewMap(Long meetingId); + + /** + * 获取最终评审结果 + * + * @param meetingId 会议ID + * @return {@link ExpertReview} + * @author WendyYang + **/ + List listFinalReview(Long meetingId); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertReviewServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertReviewServiceImpl.java index c0accdd..e07a0e3 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertReviewServiceImpl.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertReviewServiceImpl.java @@ -44,11 +44,16 @@ public class ExpertReviewServiceImpl extends ServiceImpl listFinalReview(Long meetingId) { + public Map listFinalReviewMap(Long meetingId) { + return CollUtils.listToMap(listFinalReview(meetingId), ExpertReview::getProjectId); + } + + @Override + public List listFinalReview(Long meetingId) { LambdaQueryWrapper query = Wrappers.lambdaQuery(ExpertReview.class); query.eq(ExpertReview::getMeetingId, meetingId); query.eq(ExpertReview::getIsFinal, Boolean.TRUE); - return CollUtils.listToMap(list(query), ExpertReview::getProjectId); + return list(query); } } 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 3ab6456..f0f0cd8 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 @@ -763,7 +763,7 @@ public class MeetingManage { List projects = meetingInnerProjectService.listByMeetingId(meetingId); List projectIdList = CollUtils.fieldList(projects, MeetingInnerProject::getProjectId); List projectList = projectService.listByIds(projectIdList); - Map reviewMap = expertReviewService.listFinalReview(meetingId); + Map reviewMap = expertReviewService.listFinalReviewMap(meetingId); return CollUtils.convert(projectList, w -> { MeetingReviewProjectVO vo = buildProjectList(w); ExpertReview review = reviewMap.get(w.getId()); From 0f6b63ae99fe0f6d4b70df9c08ab89e84efaf0be Mon Sep 17 00:00:00 2001 From: WendyYang Date: Mon, 20 Mar 2023 16:57:47 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=B8=93=E5=AE=B6?= =?UTF-8?q?=E8=AF=84=E5=AE=A1=E6=9F=A5=E8=AF=A2=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pmapi/src/main/java/com/ningdatech/pmapi/App.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/App.java b/pmapi/src/main/java/com/ningdatech/pmapi/App.java index 8bb5ca7..93837f8 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/App.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/App.java @@ -1,8 +1,11 @@ package com.ningdatech.pmapi; +import com.ningdatech.basic.util.SpringUtils; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableScheduling; @@ -22,7 +25,9 @@ public class App { protected static final String MAPPER_PACKAGES = "com.ningdatech.pmapi.**.mapper"; public static void main(String[] args) { - SpringApplication.run(App.class, args); + ApplicationContext context = SpringApplication.run(App.class, args); + // 设置applicationContext + SpringUtils.setApplicationContext(context); } }