@@ -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); | |||
} | |||
} |
@@ -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("无效的审核结果编码")); | |||
} | |||
} |
@@ -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("请先填写个人评审意见"); | |||
} | |||
@@ -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,32 @@ 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 | |||
* @return {@link ExpertReview} | |||
* @author WendyYang | |||
**/ | |||
Map<Long, ExpertReview> listFinalReviewMap(Long meetingId); | |||
/** | |||
* 获取最终评审结果 | |||
* | |||
* @param meetingId 会议ID | |||
* @return {@link ExpertReview} | |||
* @author WendyYang | |||
**/ | |||
List<ExpertReview> listFinalReview(Long meetingId); | |||
} |
@@ -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,27 @@ 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> listFinalReviewMap(Long meetingId) { | |||
return CollUtils.listToMap(listFinalReview(meetingId), ExpertReview::getProjectId); | |||
} | |||
@Override | |||
public List<ExpertReview> listFinalReview(Long meetingId) { | |||
LambdaQueryWrapper<ExpertReview> query = Wrappers.lambdaQuery(ExpertReview.class); | |||
query.eq(ExpertReview::getMeetingId, meetingId); | |||
query.eq(ExpertReview::getIsFinal, Boolean.TRUE); | |||
return list(query); | |||
} | |||
} |
@@ -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); | |||
} | |||
@@ -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; | |||
} |
@@ -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.listFinalReviewMap(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(); | |||
} | |||