@@ -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); | |||
} | |||
} |
@@ -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; | |||
} | |||
} |
@@ -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("模版不存在"); | |||
} | |||
@@ -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; | |||
} | |||
} |
@@ -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); | |||
} |
@@ -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); | |||
} | |||
} |
@@ -332,6 +332,7 @@ public class DeclaredProjectManage { | |||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | |||
//当非预审申报的时候 是自己单位 当是预审申报的时候 要主管单位 | |||
preQuery(query,user); | |||
query.eq(Project::getNewest,Boolean.TRUE); | |||
Page<Project> page = projectService.page(req.page(), query); | |||
long total; | |||
if ((total = page.getTotal()) == 0) { | |||
@@ -376,6 +377,7 @@ public class DeclaredProjectManage { | |||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(param); | |||
//当非预审申报的时候 是自己单位 当是预审申报的时候 要主管单位 | |||
preQuery(query,user); | |||
query.eq(Project::getNewest,Boolean.TRUE); | |||
List<Project> records = projectService.list(query); | |||
AtomicInteger serialNumber = new AtomicInteger(0); | |||
@@ -250,6 +250,7 @@ public class PrequalificationDeclaredProjectManage { | |||
ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode())); | |||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | |||
buildPermission(query,user); | |||
query.eq(Project::getNewest,Boolean.TRUE); | |||
Page<Project> page = projectService.page(req.page(), query); | |||
long total; | |||
if ((total = page.getTotal()) == 0) { | |||
@@ -311,6 +312,7 @@ public class PrequalificationDeclaredProjectManage { | |||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | |||
//角色权限 | |||
buildPermission(query,user); | |||
query.eq(Project::getNewest,Boolean.TRUE); | |||
List<Project> records = projectService.list(query); | |||
List<PretrialDeclaredExportDTO> collect = records.stream().map(r -> { | |||
@@ -121,6 +121,7 @@ public class AnnualPlanLibManage { | |||
item.setDeclaredAmount(w.getDeclareAmount()); | |||
item.setBuildOrg(w.getBuildOrgName()); | |||
item.setCreateOn(w.getCreateOn()); | |||
item.setApprovalAmount(w.getApprovalAmount()); | |||
item.setIsStartDeclaredProject(!IN_THE_ANNUAL_PLAN.eq(w.getStatus())); | |||
result.getRecords().add(item); | |||
}); | |||
@@ -79,6 +79,7 @@ public class ProjectLibManage { | |||
public PageVo<ProjectLibListItemVO> projectLibList(ProjectListReq req) { | |||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | |||
query.eq(Project::getNewest,Boolean.TRUE); | |||
Page<Project> page = projectService.page(req.page(), query); | |||
long total; | |||
if ((total = page.getTotal()) == 0) { | |||
@@ -192,8 +193,10 @@ public class ProjectLibManage { | |||
projectService.save(project); | |||
}else{ | |||
//否则是重新提交的 新生成一个新版本的项目 | |||
projectDto.setSponsor(employeeCode); | |||
project = newProjectWithVersion(projectDto); | |||
project.setInstCode(instanceId); | |||
project.setSponsor(employeeCode); | |||
projectService.updateById(project); | |||
} | |||
//保存项目应用 | |||
@@ -295,12 +298,12 @@ public class ProjectLibManage { | |||
if(Objects.nonNull(statusCode)){ | |||
project.setStatus(statusCode); | |||
} | |||
projectService.save(project); | |||
projectService.update(Wrappers.lambdaUpdate(Project.class) | |||
.set(Project::getNewest,Boolean.FALSE) | |||
.ne(Project::getId,project.getId()) | |||
.eq(Project::getProjectCode,project.getProjectCode())); | |||
if(projectService.save(project)){ | |||
projectService.update(Wrappers.lambdaUpdate(Project.class) | |||
.set(Project::getNewest,Boolean.FALSE) | |||
.ne(Project::getId,project.getId()) | |||
.eq(Project::getProjectCode,project.getProjectCode())); | |||
} | |||
return project; | |||
} | |||
@@ -29,6 +29,9 @@ public class AnnualPlanListItemVO { | |||
@ApiModelProperty("申报金额") | |||
private BigDecimal declaredAmount; | |||
@ApiModelProperty("立项批复金额") | |||
private BigDecimal approvalAmount; | |||
@ApiModelProperty("预算年度") | |||
private Integer projectYear; | |||
@@ -75,6 +75,11 @@ public class CheckProvincialReviewResultTask { | |||
log.info("此项目 【{}】 还未审核",projectRes.getProjectId()); | |||
} else if(ProjectProvincialAuditStatusEnum.AUDITING.getCode().equals(projectRes.getProjectStatus())){ | |||
log.info("此项目 【{}】 还在审核中",projectRes.getProjectId()); | |||
project.setUpdateOn(LocalDateTime.now()); | |||
//保存审核结果 | |||
project.setSjlsResult(CollUtil.isNotEmpty(projectRes.getProcessComment()) | |||
? JSON.toJSONString(projectRes.getProcessComment()) : StringUtils.EMPTY); | |||
projectService.updateById(project); | |||
}else if(ProjectProvincialAuditStatusEnum.SUCCESS.getCode().equals(projectRes.getProjectStatus())){ | |||
log.info("此项目 【{}】 审核通过",projectRes.getProjectId()); | |||
stateMachineUtils.pass(project); | |||