@@ -27,4 +27,6 @@ public class ExistsSqlConst { | |||||
public static final String USER_EXISTS_ROLE = "select 1 from nd_user_role nur where nur.user_id = nd_user_info.id "; | public static final String USER_EXISTS_ROLE = "select 1 from nd_user_role nur where nur.user_id = nd_user_info.id "; | ||||
public static final String MEETING_INNER_PROJECT_EXISTS_MEETING = "select 1 from meeting m where meeting_inner_project.meeting_id = m.id "; | |||||
} | } |
@@ -50,9 +50,33 @@ public class ProjectStateChangeAction { | |||||
project.setStatus(ProjectStatus.ON_COMPLIANCE_REVIEW.getCode()); | project.setStatus(ProjectStatus.ON_COMPLIANCE_REVIEW.getCode()); | ||||
} | } | ||||
@OnTransition(source = "ON_COMPLIANCE_REVIEW", target = "WITHOUT_PROJECT_REVIEW") | |||||
@OnTransition(source = "ON_COMPLIANCE_REVIEW", target = "WITHOUT_EXPERT_REVIEW") | |||||
public void COMPLIANCE_REVIEW_PASS(Message<ProjectStateChangeEvent> message) { | public void COMPLIANCE_REVIEW_PASS(Message<ProjectStateChangeEvent> message) { | ||||
Project project = getProject(message); | Project project = getProject(message); | ||||
project.setStatus(ProjectStatus.WITHOUT_EXPERT_REVIEW.getCode()); | |||||
} | |||||
@OnTransition(source = "WITHOUT_EXPERT_REVIEW", target = "ON_EXPERT_REVIEW") | |||||
public void EXPERT_REVIEW_SUBMIT(Message<ProjectStateChangeEvent> message) { | |||||
Project project = getProject(message); | |||||
project.setStatus(ProjectStatus.ON_EXPERT_REVIEW.getCode()); | |||||
} | |||||
@OnTransition(source = "EXPERT_REVIEW_FAILED", target = "ON_EXPERT_REVIEW") | |||||
public void EXPERT_REVIEW_RESUBMIT(Message<ProjectStateChangeEvent> message) { | |||||
Project project = getProject(message); | |||||
project.setStatus(ProjectStatus.ON_EXPERT_REVIEW.getCode()); | |||||
} | |||||
@OnTransition(source = "ON_EXPERT_REVIEW", target = "EXPERT_REVIEW_FAILED") | |||||
public void EXPERT_REVIEW_FAILED(Message<ProjectStateChangeEvent> message) { | |||||
Project project = getProject(message); | |||||
project.setStatus(ProjectStatus.EXPERT_REVIEW_FAILED.getCode()); | |||||
} | |||||
@OnTransition(source = "ON_EXPERT_REVIEW", target = "WITHOUT_PROJECT_REVIEW") | |||||
public void EXPERT_REVIEW_PASS(Message<ProjectStateChangeEvent> message) { | |||||
Project project = getProject(message); | |||||
project.setStatus(ProjectStatus.WITHOUT_PROJECT_REVIEW.getCode()); | project.setStatus(ProjectStatus.WITHOUT_PROJECT_REVIEW.getCode()); | ||||
} | } | ||||
@@ -95,8 +95,28 @@ public class ProjectStateMachineBuilderImpl implements BaseStateMachineBuilder<P | |||||
// 合规性审查通过 | // 合规性审查通过 | ||||
.withExternal() | .withExternal() | ||||
.source(ProjectStatus.ON_COMPLIANCE_REVIEW) | .source(ProjectStatus.ON_COMPLIANCE_REVIEW) | ||||
.target(ProjectStatus.WITHOUT_PROJECT_REVIEW) | |||||
.target(ProjectStatus.WITHOUT_EXPERT_REVIEW) | |||||
.event(ProjectStateChangeEvent.COMPLIANCE_REVIEW_PASS).and() | .event(ProjectStateChangeEvent.COMPLIANCE_REVIEW_PASS).and() | ||||
// 提交专家评审 | |||||
.withExternal() | |||||
.source(ProjectStatus.WITHOUT_EXPERT_REVIEW) | |||||
.target(ProjectStatus.ON_EXPERT_REVIEW) | |||||
.event(ProjectStateChangeEvent.EXPERT_REVIEW_SUBMIT).and() | |||||
// 重新提交项目评审 | |||||
.withExternal() | |||||
.source(ProjectStatus.EXPERT_REVIEW_FAILED) | |||||
.target(ProjectStatus.ON_EXPERT_REVIEW) | |||||
.event(ProjectStateChangeEvent.EXPERT_REVIEW_RESUBMIT).and() | |||||
// 项目评审不通过 | |||||
.withExternal() | |||||
.source(ProjectStatus.ON_EXPERT_REVIEW) | |||||
.target(ProjectStatus.EXPERT_REVIEW_FAILED) | |||||
.event(ProjectStateChangeEvent.EXPERT_REVIEW_FAILED).and() | |||||
// 项目评审通过 | |||||
.withExternal() | |||||
.source(ProjectStatus.ON_EXPERT_REVIEW) | |||||
.target(ProjectStatus.WITHOUT_EXPERT_REVIEW) | |||||
.event(ProjectStateChangeEvent.EXPERT_REVIEW_PASS).and() | |||||
// 提交项目评审 | // 提交项目评审 | ||||
.withExternal() | .withExternal() | ||||
.source(ProjectStatus.WITHOUT_PROJECT_REVIEW) | .source(ProjectStatus.WITHOUT_PROJECT_REVIEW) | ||||
@@ -39,6 +39,26 @@ public enum ProjectStateChangeEvent implements AbstractStateChangeEvent { | |||||
COMPLIANCE_REVIEW_PASS(ProjectStatus.ON_COMPLIANCE_REVIEW.getCode(), null, null), | COMPLIANCE_REVIEW_PASS(ProjectStatus.ON_COMPLIANCE_REVIEW.getCode(), null, null), | ||||
/** | /** | ||||
* @see ProjectStateChangeAction#EXPERT_REVIEW_SUBMIT(Message) | |||||
*/ | |||||
EXPERT_REVIEW_SUBMIT(ProjectStatus.WITHOUT_EXPERT_REVIEW.getCode(), null, null), | |||||
/** | |||||
* @see ProjectStateChangeAction#EXPERT_REVIEW_RESUBMIT(Message) | |||||
*/ | |||||
EXPERT_REVIEW_RESUBMIT(ProjectStatus.EXPERT_REVIEW_FAILED.getCode(), null, null), | |||||
/** | |||||
* @see ProjectStateChangeAction#EXPERT_REVIEW_FAILED(Message) | |||||
*/ | |||||
EXPERT_REVIEW_FAILED(null, ProjectStatus.ON_EXPERT_REVIEW.getCode(), null), | |||||
/** | |||||
* @see ProjectStateChangeAction#EXPERT_REVIEW_PASS(Message) | |||||
*/ | |||||
EXPERT_REVIEW_PASS(ProjectStatus.ON_PROJECT_REVIEW.getCode(), null, null), | |||||
/** | |||||
* @see ProjectStateChangeAction#PROJECT_REVIEW_SUBMIT(Message) | * @see ProjectStateChangeAction#PROJECT_REVIEW_SUBMIT(Message) | ||||
*/ | */ | ||||
PROJECT_REVIEW_SUBMIT(ProjectStatus.WITHOUT_PROJECT_REVIEW.getCode(), null, null), | PROJECT_REVIEW_SUBMIT(ProjectStatus.WITHOUT_PROJECT_REVIEW.getCode(), null, null), | ||||
@@ -16,6 +16,7 @@ import com.hz.pm.api.common.exception.ReturnException; | |||||
import com.hz.pm.api.common.helper.RegionCacheHelper; | import com.hz.pm.api.common.helper.RegionCacheHelper; | ||||
import com.hz.pm.api.common.model.constant.BizConst; | import com.hz.pm.api.common.model.constant.BizConst; | ||||
import com.hz.pm.api.common.model.constant.MhUnitConst; | import com.hz.pm.api.common.model.constant.MhUnitConst; | ||||
import com.hz.pm.api.common.statemachine.util.ProjectStateMachineUtil; | |||||
import com.hz.pm.api.common.util.BizUtils; | import com.hz.pm.api.common.util.BizUtils; | ||||
import com.hz.pm.api.common.util.EnvironmentUtil; | import com.hz.pm.api.common.util.EnvironmentUtil; | ||||
import com.hz.pm.api.expert.entity.ExpertUserFullInfo; | import com.hz.pm.api.expert.entity.ExpertUserFullInfo; | ||||
@@ -109,6 +110,7 @@ public class MeetingManage { | |||||
private final IUserInfoService userInfoService; | private final IUserInfoService userInfoService; | ||||
private final EnvironmentUtil environmentUtil; | private final EnvironmentUtil environmentUtil; | ||||
private final MhUnitCache mhUnitCache; | private final MhUnitCache mhUnitCache; | ||||
private final ProjectStateMachineUtil projectStateMachineUtil; | |||||
private static final String INVITED_RULE_CREATE = "INVITED_RULE_CREATE:"; | private static final String INVITED_RULE_CREATE = "INVITED_RULE_CREATE:"; | ||||
@@ -149,12 +151,22 @@ public class MeetingManage { | |||||
meeting.setInviteType(inviteRule.getInviteType()); | meeting.setInviteType(inviteRule.getInviteType()); | ||||
meetingService.save(meeting); | meetingService.save(meeting); | ||||
if (Boolean.TRUE.equals(meetingBasic.getIsInnerProject())) { | if (Boolean.TRUE.equals(meetingBasic.getIsInnerProject())) { | ||||
List<MeetingInnerProject> projects = meetingBasic.getInnerProjects().stream().map(w -> { | |||||
List<Long> projectIds = new ArrayList<>(); | |||||
List<MeetingInnerProject> meetingInnerProjects = meetingBasic.getInnerProjects().stream().map(w -> { | |||||
MeetingInnerProject project = BeanUtil.copyProperties(w, MeetingInnerProject.class); | MeetingInnerProject project = BeanUtil.copyProperties(w, MeetingInnerProject.class); | ||||
project.setMeetingId(meeting.getId()); | project.setMeetingId(meeting.getId()); | ||||
projectIds.add(w.getProjectId()); | |||||
return project; | return project; | ||||
}).collect(Collectors.toList()); | }).collect(Collectors.toList()); | ||||
meetingInnerProjectService.saveBatch(projects); | |||||
List<Project> projects = projectService.listByIds(projectIds); | |||||
boolean allMatch = projects.stream().allMatch(w -> ProjectStatus.EXPERT_REVIEW_FAILED.eq(w.getStatus()) | |||||
|| ProjectStatus.WITHOUT_EXPERT_REVIEW.eq(w.getStatus())); | |||||
if (!allMatch) { | |||||
throw ReturnException.wrap("当前关联项目包含暂不可评审项目"); | |||||
} | |||||
projects.forEach(projectStateMachineUtil::pass); | |||||
projectService.updateBatchById(projects); | |||||
meetingInnerProjectService.saveBatch(meetingInnerProjects); | |||||
} | } | ||||
// 抽取专家 | // 抽取专家 | ||||
inviteRule.setMeetingId(meeting.getId()); | inviteRule.setMeetingId(meeting.getId()); | ||||
@@ -728,6 +740,14 @@ public class MeetingManage { | |||||
if (!experts.isEmpty()) { | if (!experts.isEmpty()) { | ||||
meetingNotifyHelper.sendCancelMeetingMsg(experts, meeting); | meetingNotifyHelper.sendCancelMeetingMsg(experts, meeting); | ||||
} | } | ||||
if (Boolean.TRUE.equals(meeting.getIsInnerProject())) { | |||||
// 取消项目时候重置项目状态 | |||||
List<MeetingInnerProject> meetingInnerProjects = meetingInnerProjectService.listByMeetingId(meetingId); | |||||
List<Long> projectIds = CollUtils.fieldList(meetingInnerProjects, MeetingInnerProject::getProjectId); | |||||
List<Project> projects = projectService.listByIds(projectIds); | |||||
projects.forEach(w -> w.setStatus(ProjectStatus.WITHOUT_EXPERT_REVIEW.getCode())); | |||||
projectService.updateBatchById(projects); | |||||
} | |||||
// 将取消的会议推送给MH | // 将取消的会议推送给MH | ||||
mhApiClient.cancelMeetingToMh(meetingId); | mhApiClient.cancelMeetingToMh(meetingId); | ||||
} finally { | } finally { | ||||
@@ -983,6 +1003,7 @@ public class MeetingManage { | |||||
break; | break; | ||||
case PROJECT_REVIEW: | case PROJECT_REVIEW: | ||||
case EXPERT_REVIEW: | case EXPERT_REVIEW: | ||||
query.isNotNull(Project::getConstructionPlanSealFile); | |||||
buildOptionProjectQuery(query, meetingType, ProjectStatus.WITHOUT_PROJECT_REVIEW); | buildOptionProjectQuery(query, meetingType, ProjectStatus.WITHOUT_PROJECT_REVIEW); | ||||
break; | break; | ||||
default: | default: | ||||
@@ -1027,7 +1048,9 @@ public class MeetingManage { | |||||
} | } | ||||
private void buildOptionProjectQuery(LambdaQueryWrapper<Project> query, String meetingType, ProjectStatus status) { | private void buildOptionProjectQuery(LambdaQueryWrapper<Project> query, String meetingType, ProjectStatus status) { | ||||
query.eq(Project::getStatus, status.getCode()); | |||||
if (status != null) { | |||||
query.eq(Project::getStatus, status.getCode()); | |||||
} | |||||
String sql = String.format("select 1 from meeting m inner join meeting_inner_project mip on" + | String sql = String.format("select 1 from meeting m inner join meeting_inner_project mip on" + | ||||
" m.is_inner_project = 1 and m.id = mip.meeting_id and nd_project.id = mip.project_id" + | " m.is_inner_project = 1 and m.id = mip.meeting_id and nd_project.id = mip.project_id" + | ||||
" and m.type = %s and m.status != 3", meetingType); | " and m.type = %s and m.status != 3", meetingType); | ||||
@@ -1078,22 +1101,32 @@ public class MeetingManage { | |||||
public void uploadProjectReviewResult(ProjectReviewResultUploadReq req) { | public void uploadProjectReviewResult(ProjectReviewResultUploadReq req) { | ||||
String key = "meeting_project_result_upload:" + req.getMeetingProjectId(); | String key = "meeting_project_result_upload:" + req.getMeetingProjectId(); | ||||
if (!distributedLock.lock(key, RETRY_TIMES)) { | if (!distributedLock.lock(key, RETRY_TIMES)) { | ||||
throw BizException.wrap("正在上传会议结果,请勿重复操作"); | |||||
throw ReturnException.wrap("正在上传会议结果,请勿重复操作"); | |||||
} | } | ||||
try { | try { | ||||
Meeting meeting = meetingService.getById(req.getMeetingId()); | Meeting meeting = meetingService.getById(req.getMeetingId()); | ||||
if (meeting == null || MeetingStatusEnum.CANCEL.eq(meeting.getStatus())) { | if (meeting == null || MeetingStatusEnum.CANCEL.eq(meeting.getStatus())) { | ||||
throw BizException.wrap("会议不存在或已取消"); | |||||
throw ReturnException.wrap("会议不存在或已取消"); | |||||
} | } | ||||
LocalDateTime now = LocalDateTime.now(); | LocalDateTime now = LocalDateTime.now(); | ||||
if (meeting.getEndTime().isAfter(now)) { | if (meeting.getEndTime().isAfter(now)) { | ||||
throw BizException.wrap("会议未结束"); | |||||
throw ReturnException.wrap("会议未结束"); | |||||
} | } | ||||
if (!Boolean.TRUE.equals(meeting.getIsInnerProject())) { | if (!Boolean.TRUE.equals(meeting.getIsInnerProject())) { | ||||
throw BizException.wrap("此会议未关联项目"); | |||||
throw ReturnException.wrap("此会议未关联项目"); | |||||
} | } | ||||
MeetingInnerProject mip = BeanUtil.copyProperties(req, MeetingInnerProject.class); | MeetingInnerProject mip = BeanUtil.copyProperties(req, MeetingInnerProject.class); | ||||
if (mip.getReviewResult() != null) { | |||||
throw ReturnException.wrap("会议结果已上传"); | |||||
} | |||||
mip.setId(req.getMeetingProjectId()); | mip.setId(req.getMeetingProjectId()); | ||||
Project project = projectService.getById(mip.getProjectId()); | |||||
if (req.getReviewResult() == 1) { | |||||
projectStateMachineUtil.pass(project); | |||||
} else { | |||||
projectStateMachineUtil.reject(project); | |||||
} | |||||
projectService.updateById(project); | |||||
meetingInnerProjectService.updateById(mip); | meetingInnerProjectService.updateById(mip); | ||||
} finally { | } finally { | ||||
distributedLock.releaseLock(key); | distributedLock.releaseLock(key); | ||||
@@ -64,4 +64,16 @@ public class ProjectReviewController { | |||||
return projectReviewManage.reviewProjectProgressStatistics(req); | return projectReviewManage.reviewProjectProgressStatistics(req); | ||||
} | } | ||||
@ApiOperation("专家评审列表") | |||||
@GetMapping("/pageExpertReviewProject") | |||||
public PageVo<ProjectLibListItemVO> pageExpertReviewProject(ProjectListReq req) { | |||||
return projectReviewManage.pageExpertReviewProject(req); | |||||
} | |||||
@GetMapping("/expertReviewProgressStatistics") | |||||
@ApiOperation("专家评审项目进度统计") | |||||
public ReviewProgressStatisticsVO expertProgressStatistics(ProjectListReq req) { | |||||
return projectReviewManage.expertReviewProjectProgressStatistics(req); | |||||
} | |||||
} | } |
@@ -11,9 +11,12 @@ import com.hz.pm.api.common.model.constant.BizConst; | |||||
import com.hz.pm.api.common.model.constant.ExistsSqlConst; | import com.hz.pm.api.common.model.constant.ExistsSqlConst; | ||||
import com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent; | import com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent; | ||||
import com.hz.pm.api.common.statemachine.util.ProjectStateMachineUtil; | import com.hz.pm.api.common.statemachine.util.ProjectStateMachineUtil; | ||||
import com.hz.pm.api.common.util.BizUtils; | |||||
import com.hz.pm.api.datascope.model.DataScopeDTO; | import com.hz.pm.api.datascope.model.DataScopeDTO; | ||||
import com.hz.pm.api.datascope.utils.DataScopeUtil; | import com.hz.pm.api.datascope.utils.DataScopeUtil; | ||||
import com.hz.pm.api.meeting.entity.domain.MeetingInnerProject; | |||||
import com.hz.pm.api.meeting.entity.dto.ProjectReviewResultDTO; | import com.hz.pm.api.meeting.entity.dto.ProjectReviewResultDTO; | ||||
import com.hz.pm.api.meeting.service.IMeetingInnerProjectService; | |||||
import com.hz.pm.api.projectdeclared.model.entity.ProjectReview; | import com.hz.pm.api.projectdeclared.model.entity.ProjectReview; | ||||
import com.hz.pm.api.projectdeclared.model.req.ProjectReviewApplyReq; | import com.hz.pm.api.projectdeclared.model.req.ProjectReviewApplyReq; | ||||
import com.hz.pm.api.projectdeclared.model.vo.ReviewProgressStatisticsVO; | import com.hz.pm.api.projectdeclared.model.vo.ReviewProgressStatisticsVO; | ||||
@@ -69,6 +72,7 @@ public class ProjectReviewManage { | |||||
private final ProjectStateMachineUtil projectStateMachineUtil; | private final ProjectStateMachineUtil projectStateMachineUtil; | ||||
private final MhUnitCache mhUnitCache; | private final MhUnitCache mhUnitCache; | ||||
private final UserInfoHelper userInfoHelper; | private final UserInfoHelper userInfoHelper; | ||||
private final IMeetingInnerProjectService meetingInnerProjectService; | |||||
@Transactional(rollbackFor = Exception.class) | @Transactional(rollbackFor = Exception.class) | ||||
public synchronized void projectReviewApply(ProjectReviewApplyReq req) { | public synchronized void projectReviewApply(ProjectReviewApplyReq req) { | ||||
@@ -135,14 +139,14 @@ public class ProjectReviewManage { | |||||
req.setStatus(null); | req.setStatus(null); | ||||
ProjectManageUtil.projectQuery(query, req); | ProjectManageUtil.projectQuery(query, req); | ||||
query.exists(ExistsSqlConst.PROJECT_EXISTS_STATUS_CHANGE + | query.exists(ExistsSqlConst.PROJECT_EXISTS_STATUS_CHANGE + | ||||
" and npsc.event = {0}", ProjectStateChangeEvent.COMPLIANCE_REVIEW_PASS) | |||||
" and npsc.event = {0}", ProjectStateChangeEvent.EXPERT_REVIEW_PASS) | |||||
.ne(Project::getStage, ProjectStatus.STOPPED.getCode()) | .ne(Project::getStage, ProjectStatus.STOPPED.getCode()) | ||||
.eq(Project::getNewest, Boolean.TRUE) | .eq(Project::getNewest, Boolean.TRUE) | ||||
.select(Project::getStatus, Project::getId); | .select(Project::getStatus, Project::getId); | ||||
List<Project> projects = projectService.list(query); | List<Project> projects = projectService.list(query); | ||||
Map<ProjectStatus, Long> countMap = CollUtils.groupCount(projects, w -> { | Map<ProjectStatus, Long> countMap = CollUtils.groupCount(projects, w -> { | ||||
if (!ProjectStatus.PROJECT_REVIEW_FAILED.eq(w.getStatus()) | if (!ProjectStatus.PROJECT_REVIEW_FAILED.eq(w.getStatus()) | ||||
&& !ProjectStatus.COMPLIANCE_REVIEW_PASSED.eq(w.getStatus()) | |||||
&& !ProjectStatus.EXPERT_REVIEW_PASSED.eq(w.getStatus()) | |||||
&& !ProjectStatus.WITHOUT_PROJECT_REVIEW.eq(w.getStatus()) | && !ProjectStatus.WITHOUT_PROJECT_REVIEW.eq(w.getStatus()) | ||||
&& !ProjectStatus.ON_PROJECT_REVIEW.eq(w.getStatus()) | && !ProjectStatus.ON_PROJECT_REVIEW.eq(w.getStatus()) | ||||
&& !ProjectStatus.ON_CHANGE_APPLY.eq(w.getStatus())) { | && !ProjectStatus.ON_CHANGE_APPLY.eq(w.getStatus())) { | ||||
@@ -182,7 +186,7 @@ public class ProjectReviewManage { | |||||
} | } | ||||
} else { | } else { | ||||
query.exists(ExistsSqlConst.PROJECT_EXISTS_STATUS_CHANGE + | query.exists(ExistsSqlConst.PROJECT_EXISTS_STATUS_CHANGE + | ||||
" and npsc.event = {0}", ProjectStateChangeEvent.COMPLIANCE_REVIEW_PASS); | |||||
" and npsc.event = {0}", ProjectStateChangeEvent.EXPERT_REVIEW_PASS); | |||||
} | } | ||||
ProjectManageUtil.projectQuery(query, req); | ProjectManageUtil.projectQuery(query, req); | ||||
query.eq(Project::getNewest, Boolean.TRUE) | query.eq(Project::getNewest, Boolean.TRUE) | ||||
@@ -194,7 +198,7 @@ public class ProjectReviewManage { | |||||
List<ProjectLibListItemVO> records = CollUtils.convert(page.getRecords(), w -> { | List<ProjectLibListItemVO> records = CollUtils.convert(page.getRecords(), w -> { | ||||
ProjectLibListItemVO item = BeanUtil.copyProperties(w, ProjectLibListItemVO.class); | ProjectLibListItemVO item = BeanUtil.copyProperties(w, ProjectLibListItemVO.class); | ||||
if (!ProjectStatus.PROJECT_REVIEW_FAILED.eq(w.getStatus()) | if (!ProjectStatus.PROJECT_REVIEW_FAILED.eq(w.getStatus()) | ||||
&& !ProjectStatus.COMPLIANCE_REVIEW_PASSED.eq(w.getStatus()) | |||||
&& !ProjectStatus.EXPERT_REVIEW_PASSED.eq(w.getStatus()) | |||||
&& !ProjectStatus.WITHOUT_PROJECT_REVIEW.eq(w.getStatus()) | && !ProjectStatus.WITHOUT_PROJECT_REVIEW.eq(w.getStatus()) | ||||
&& !ProjectStatus.ON_PROJECT_REVIEW.eq(w.getStatus()) | && !ProjectStatus.ON_PROJECT_REVIEW.eq(w.getStatus()) | ||||
&& !ProjectStatus.ON_CHANGE_APPLY.eq(w.getStatus())) { | && !ProjectStatus.ON_CHANGE_APPLY.eq(w.getStatus())) { | ||||
@@ -205,6 +209,100 @@ public class ProjectReviewManage { | |||||
return PageVo.of(records, page.getTotal()); | return PageVo.of(records, page.getTotal()); | ||||
} | } | ||||
public ReviewProgressStatisticsVO expertReviewProjectProgressStatistics(ProjectListReq req) { | |||||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||||
LambdaQueryWrapper<Project> query = ProjectManageUtil.initQuery(); | |||||
if (!projectQueryPermission(query, user, req.getDeclaredUnitId())) { | |||||
return null; | |||||
} | |||||
req.setStatus(null); | |||||
ProjectManageUtil.projectQuery(query, req); | |||||
query.exists(ExistsSqlConst.PROJECT_EXISTS_STATUS_CHANGE + | |||||
" and npsc.event = {0}", ProjectStateChangeEvent.COMPLIANCE_REVIEW_PASS) | |||||
.ne(Project::getStage, ProjectStatus.STOPPED.getCode()) | |||||
.eq(Project::getNewest, Boolean.TRUE) | |||||
.select(Project::getStatus, Project::getId); | |||||
List<Project> projects = projectService.list(query); | |||||
Map<ProjectStatus, Long> countMap = CollUtils.groupCount(projects, w -> { | |||||
if (!ProjectStatus.EXPERT_REVIEW_FAILED.eq(w.getStatus()) | |||||
&& !ProjectStatus.COMPLIANCE_REVIEW_PASSED.eq(w.getStatus()) | |||||
&& !ProjectStatus.WITHOUT_EXPERT_REVIEW.eq(w.getStatus()) | |||||
&& !ProjectStatus.ON_EXPERT_REVIEW.eq(w.getStatus()) | |||||
&& !ProjectStatus.ON_CHANGE_APPLY.eq(w.getStatus())) { | |||||
return ProjectStatus.EXPERT_REVIEW_PASSED; | |||||
} | |||||
return ProjectStatus.getNoNull(w.getStatus()); | |||||
}); | |||||
return ReviewProgressStatisticsVO.builder() | |||||
.totalCount(projects.size()) | |||||
.todoCount(countMap.getOrDefault(ProjectStatus.WITHOUT_EXPERT_REVIEW, 0L)) | |||||
.auditCount(countMap.getOrDefault(ProjectStatus.ON_EXPERT_REVIEW, 0L)) | |||||
.passedCount(countMap.getOrDefault(ProjectStatus.EXPERT_REVIEW_PASSED, 0L)) | |||||
.failedCount(countMap.getOrDefault(ProjectStatus.EXPERT_REVIEW_FAILED, 0L)) | |||||
.build(); | |||||
} | |||||
/** | |||||
* 项目列表 | |||||
* | |||||
* @param req \ | |||||
* @return \ | |||||
*/ | |||||
public PageVo<ProjectLibListItemVO> pageExpertReviewProject(ProjectListReq req) { | |||||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||||
LambdaQueryWrapper<Project> query = ProjectManageUtil.initQuery(); | |||||
if (!projectQueryPermission(query, user, req.getDeclaredUnitId())) { | |||||
return PageVo.empty(); | |||||
} | |||||
Integer status = req.getStatus(); | |||||
if (status != null) { | |||||
req.setStatus(null); | |||||
if (ProjectStatus.EXPERT_REVIEW_PASSED.eq(status)) { | |||||
query.exists(ExistsSqlConst.PROJECT_EXISTS_STATUS_CHANGE + | |||||
" and npsc.event = {0}", ProjectStateChangeEvent.EXPERT_REVIEW_PASS); | |||||
} else { | |||||
query.eq(Project::getStatus, status); | |||||
} | |||||
} else { | |||||
query.exists(ExistsSqlConst.PROJECT_EXISTS_STATUS_CHANGE + | |||||
" and npsc.event = {0}", ProjectStateChangeEvent.COMPLIANCE_REVIEW_PASS); | |||||
} | |||||
ProjectManageUtil.projectQuery(query, req); | |||||
query.eq(Project::getNewest, Boolean.TRUE) | |||||
.ne(Project::getStage, ProjectStatus.STOPPED.getCode()); | |||||
Page<Project> page = projectService.page(req.page(), query); | |||||
if (page.getTotal() == 0) { | |||||
return PageVo.empty(); | |||||
} | |||||
List<Long> projectIds = new ArrayList<>(); | |||||
List<ProjectLibListItemVO> records = CollUtils.convert(page.getRecords(), w -> { | |||||
projectIds.add(w.getId()); | |||||
ProjectLibListItemVO item = BeanUtil.copyProperties(w, ProjectLibListItemVO.class); | |||||
if (!ProjectStatus.EXPERT_REVIEW_PASSED.eq(w.getStatus()) | |||||
&& !ProjectStatus.COMPLIANCE_REVIEW_PASSED.eq(w.getStatus()) | |||||
&& !ProjectStatus.WITHOUT_EXPERT_REVIEW.eq(w.getStatus()) | |||||
&& !ProjectStatus.ON_EXPERT_REVIEW.eq(w.getStatus()) | |||||
&& !ProjectStatus.ON_CHANGE_APPLY.eq(w.getStatus())) { | |||||
item.setStatus(ProjectStatus.EXPERT_REVIEW_PASSED.getCode()); | |||||
} | |||||
return item; | |||||
}); | |||||
Wrapper<MeetingInnerProject> wrapper = Wrappers.lambdaQuery(MeetingInnerProject.class) | |||||
.in(MeetingInnerProject::getProjectId, projectIds) | |||||
.notExists(ExistsSqlConst.MEETING_INNER_PROJECT_EXISTS_MEETING + " and status == 3"); | |||||
List<MeetingInnerProject> meetingInnerProjects = meetingInnerProjectService.list(wrapper); | |||||
Map<Long, MeetingInnerProject> lastMeetingInnerProjects = BizUtils.groupFirstMap(meetingInnerProjects, | |||||
MeetingInnerProject::getProjectId, Comparator.comparing(MeetingInnerProject::getId)); | |||||
for (ProjectLibListItemVO item : records) { | |||||
MeetingInnerProject meetingInnerProject = lastMeetingInnerProjects.get(item.getId()); | |||||
if (meetingInnerProject != null) { | |||||
item.setMeetingId(meetingInnerProject.getMeetingId()); | |||||
item.setMeetingProjectId(meetingInnerProject.getId()); | |||||
} | |||||
} | |||||
return PageVo.of(records, page.getTotal()); | |||||
} | |||||
private boolean projectQueryPermission(LambdaQueryWrapper<Project> query, | private boolean projectQueryPermission(LambdaQueryWrapper<Project> query, | ||||
UserFullInfoDTO user, | UserFullInfoDTO user, | ||||
Long declaredUnitId) { | Long declaredUnitId) { | ||||
@@ -34,12 +34,20 @@ public enum ProjectStatus implements IStatus<Integer, String> { | |||||
COMPLIANCE_REVIEW_PASSED(10032, "合规性审查通过", 10000), | COMPLIANCE_REVIEW_PASSED(10032, "合规性审查通过", 10000), | ||||
/** | /** | ||||
* 项目评审 | |||||
* 专家评审 | |||||
*/ | */ | ||||
WITHOUT_PROJECT_REVIEW(10040, "待项目评审", 10000), | |||||
ON_PROJECT_REVIEW(10041, "项目评审中", 10000), | |||||
PROJECT_REVIEW_FAILED(10042, "项目评审不通过", 10000), | |||||
PROJECT_REVIEW_PASSED(10043, "项目评审通过", 10000), | |||||
WITHOUT_EXPERT_REVIEW(10050, "待专家评审", 10000), | |||||
ON_EXPERT_REVIEW(10051, "专家评审中", 10000), | |||||
EXPERT_REVIEW_FAILED(10052, "专家评审不通过", 10000), | |||||
EXPERT_REVIEW_PASSED(10053, "专家评审通过", 10000), | |||||
/** | |||||
* 项目复核 | |||||
*/ | |||||
WITHOUT_PROJECT_REVIEW(10040, "待项目复核", 10000), | |||||
ON_PROJECT_REVIEW(10041, "项目复核中", 10000), | |||||
PROJECT_REVIEW_FAILED(10042, "项目复核不通过", 10000), | |||||
PROJECT_REVIEW_PASSED(10043, "项目复核通过", 10000), | |||||
ON_ANNUAL_PLAN(10010, "年度计划中", 10000), | ON_ANNUAL_PLAN(10010, "年度计划中", 10000), | ||||
@@ -179,4 +179,10 @@ public class ProjectLibListItemVO { | |||||
@ApiModelProperty("项目终止状态") | @ApiModelProperty("项目终止状态") | ||||
private Integer stoppedStatus; | private Integer stoppedStatus; | ||||
@ApiModelProperty("会议项目关联ID") | |||||
private Long meetingProjectId; | |||||
@ApiModelProperty("会议ID") | |||||
private Long meetingId; | |||||
} | } |