@@ -77,23 +77,13 @@ public class ProjectDeclareChoiceAction implements Action<ProjectStatusEnum, Pro | |||
private void preDeclareChoice(StateContext<ProjectStatusEnum, ProjectStatusChangeEvent> stateContext) { | |||
Project project = getProject(stateContext); | |||
log.info("预审申报事件之前,项目的状态为:{}", project.getStatus()); | |||
if (StateMachineUtil.isCityProject() && StateMachineUtil.judgeDeclareAmount(project, | |||
ProjectDeclareConst.Number.DECLARE_AMOUNT_JUDGEMENT)) { | |||
project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode()); | |||
} else { | |||
project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); | |||
} | |||
project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); | |||
} | |||
private void preWithDrawChoice(StateContext<ProjectStatusEnum, ProjectStatusChangeEvent> stateContext) { | |||
Project project = getProject(stateContext); | |||
log.info("预审中撤回事件之前,项目的状态为:{}", project.getStatus()); | |||
if (StateMachineUtil.isCityProject() && StateMachineUtil.judgeDeclareAmount(project, | |||
ProjectDeclareConst.Number.DECLARE_AMOUNT_JUDGEMENT)) { | |||
project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); | |||
} else { | |||
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); | |||
} | |||
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); | |||
} | |||
private Project getProject(StateContext<ProjectStatusEnum, ProjectStatusChangeEvent> stateContext) { | |||
@@ -2,9 +2,9 @@ package com.hz.pm.api.common.statemachine.builder; | |||
import com.hz.pm.api.common.statemachine.action.ProjectDeclareChoiceAction; | |||
import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; | |||
import com.hz.pm.api.common.statemachine.factory.ProjectDeclareGuardFactory; | |||
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; | |||
import com.hz.pm.api.common.statemachine.factory.ProjectDeclareGuardFactory.PendingPreQualificationChoiceGuard; | |||
import com.hz.pm.api.projectlib.model.entity.Project; | |||
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; | |||
import lombok.RequiredArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.BeanFactory; | |||
@@ -98,7 +98,7 @@ public class ProjectDeclareStateMachineBuilderImpl implements ProjectDeclareStat | |||
// 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 | |||
.withChoice() | |||
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS, new ProjectDeclareGuardFactory.PendingPreQualificationChoiceGuard(), new ProjectDeclareChoiceAction()) | |||
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS, new PendingPreQualificationChoiceGuard(), new ProjectDeclareChoiceAction()) | |||
.last(ProjectStatusEnum.PRE_APPLYING, new ProjectDeclareChoiceAction()).and() | |||
// 省级部门联审通过,从省级部门联审中到省级部门联审成功 | |||
@@ -140,7 +140,7 @@ public class ProjectDeclareStateMachineBuilderImpl implements ProjectDeclareStat | |||
// 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 | |||
.withChoice() | |||
.source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) | |||
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS, new ProjectDeclareGuardFactory.PendingPreQualificationChoiceGuard() | |||
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS, new PendingPreQualificationChoiceGuard() | |||
, new ProjectDeclareChoiceAction()) | |||
.last(ProjectStatusEnum.PENDING_PREQUALIFICATION, new ProjectDeclareChoiceAction()).and() | |||
// 预审不通过重新提交,从预审不通过到待预审选择 | |||
@@ -151,7 +151,7 @@ public class ProjectDeclareStateMachineBuilderImpl implements ProjectDeclareStat | |||
// 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 | |||
.withChoice() | |||
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS, new ProjectDeclareGuardFactory.PendingPreQualificationChoiceGuard(), new ProjectDeclareChoiceAction()) | |||
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS, new PendingPreQualificationChoiceGuard(), new ProjectDeclareChoiceAction()) | |||
.last(ProjectStatusEnum.PRE_APPLYING, new ProjectDeclareChoiceAction()).and() | |||
// 部门联审通过,从部门联审中到年度计划中 | |||
.withExternal() | |||
@@ -1,21 +1,10 @@ | |||
package com.hz.pm.api.common.statemachine.factory; | |||
import cn.hutool.core.collection.CollUtil; | |||
import com.hz.pm.api.common.model.constant.ProjectDeclareConst; | |||
import com.hz.pm.api.common.model.constant.StateMachineConst; | |||
import com.hz.pm.api.common.enumeration.CommonEnum; | |||
import com.hz.pm.api.common.statemachine.util.StateMachineUtil; | |||
import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; | |||
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; | |||
import com.hz.pm.api.projectlib.model.entity.Project; | |||
import com.hz.pm.api.projectlib.model.entity.ProjectApplication; | |||
import org.springframework.statemachine.StateContext; | |||
import org.springframework.statemachine.guard.Guard; | |||
import java.util.List; | |||
import static com.hz.pm.api.common.model.constant.StateMachineConst.APPLICATION_DECLARE; | |||
/** | |||
* 项目申报状态机guard集合类 | |||
* | |||
@@ -24,34 +13,13 @@ import static com.hz.pm.api.common.model.constant.StateMachineConst.APPLICATION_ | |||
*/ | |||
public class ProjectDeclareGuardFactory { | |||
private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; | |||
public static class PendingPreQualificationChoiceGuard implements Guard<ProjectStatusEnum, ProjectStatusChangeEvent> { | |||
@Override | |||
public boolean evaluate(StateContext<ProjectStatusEnum, ProjectStatusChangeEvent> context) { | |||
Project project = context.getMessage().getHeaders().get(PROJECT_DECLARE, Project.class); | |||
// 判断申报项目是否是市级项目,且申报金额是否大于等于1000万元 | |||
return StateMachineUtil.isCityProject() && StateMachineUtil.judgeDeclareAmount(project, | |||
ProjectDeclareConst.Number.DECLARE_AMOUNT_JUDGEMENT); | |||
return true; | |||
} | |||
} | |||
public static class ApprovedAfterChoiceGuard implements Guard<ProjectStatusEnum, ProjectStatusChangeEvent> { | |||
@Override | |||
public boolean evaluate(StateContext<ProjectStatusEnum, ProjectStatusChangeEvent> context) { | |||
List<ProjectApplication> projectApplications = context.getMessage().getHeaders().get(APPLICATION_DECLARE, List.class); | |||
final Boolean[] res = {Boolean.FALSE}; | |||
// 判断 是否有初次创建的应用 | |||
if (CollUtil.isEmpty(projectApplications)){ | |||
return res[0]; | |||
} | |||
projectApplications.forEach(app -> { | |||
Integer isFirst = app.getIsFirst(); | |||
if(isFirst.equals(CommonEnum.YES.getCode())){ | |||
res[0] = Boolean.TRUE; | |||
} | |||
}); | |||
return res[0]; | |||
} | |||
} | |||
} |
@@ -113,16 +113,6 @@ public class StateMachineUtil { | |||
return flag > 0 || flag == 0; | |||
} | |||
/** | |||
* 判断申报项目是否为市级项目 | |||
* | |||
* @return boolean | |||
* @since 2023/02/07 17:05 | |||
*/ | |||
public static boolean isCityProject() { | |||
return Boolean.FALSE; | |||
} | |||
public ProjectStatusChangeEvent getProjectStatusPassEvent(Integer status) { | |||
ProjectStatusChangeEvent event = ProjectStatusChangeEvent.getPassValueByCode(status); | |||
if (Objects.isNull(event)) { | |||
@@ -2,28 +2,21 @@ package com.hz.pm.api.filemanage.manage; | |||
import cn.hutool.core.bean.BeanUtil; | |||
import cn.hutool.core.collection.CollUtil; | |||
import cn.hutool.core.util.NumberUtil; | |||
import com.alibaba.fastjson.JSON; | |||
import com.alibaba.fastjson.JSONArray; | |||
import com.alibaba.fastjson.JSONObject; | |||
import com.baomidou.mybatisplus.core.conditions.Wrapper; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.google.common.collect.Lists; | |||
import com.hz.pm.api.common.util.StrUtils; | |||
import com.hz.pm.api.user.helper.MhUnitCache; | |||
import com.hz.pm.api.user.model.dto.MhUnitDTO; | |||
import com.ningdatech.basic.exception.BizException; | |||
import com.ningdatech.basic.function.VUtils; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.basic.util.CollUtils; | |||
import com.ningdatech.file.entity.File; | |||
import com.ningdatech.file.service.FileService; | |||
import com.ningdatech.file.utils.StrPool; | |||
import com.hz.pm.api.common.model.constant.BizConst; | |||
import com.hz.pm.api.common.model.constant.CommonConst; | |||
import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; | |||
import com.hz.pm.api.common.helper.UserInfoHelper; | |||
import com.hz.pm.api.common.model.constant.BizConst; | |||
import com.hz.pm.api.common.model.constant.CommonConst; | |||
import com.hz.pm.api.common.util.ExcelDownUtil; | |||
import com.hz.pm.api.common.util.StrUtils; | |||
import com.hz.pm.api.expert.manage.ExpertReviewManage; | |||
import com.hz.pm.api.expert.model.vo.ExpertReviewDetailVO; | |||
import com.hz.pm.api.expert.model.vo.ProjectReviewDetailVO; | |||
@@ -33,8 +26,6 @@ import com.hz.pm.api.filemanage.model.vo.ProjectApplyBorrowVO; | |||
import com.hz.pm.api.filemanage.model.vo.ProjectFileListVO; | |||
import com.hz.pm.api.filemanage.model.vo.ProjectFileVO; | |||
import com.hz.pm.api.filemanage.service.INdProjectApplyBorrowService; | |||
import com.hz.pm.api.organization.model.entity.DingOrganization; | |||
import com.hz.pm.api.organization.service.IDingOrganizationService; | |||
import com.hz.pm.api.projectdeclared.manage.ConstructionManage; | |||
import com.hz.pm.api.projectdeclared.manage.DefaultDeclaredProjectManage; | |||
import com.hz.pm.api.projectdeclared.manage.FinalAcceptanceManage; | |||
@@ -47,12 +38,12 @@ import com.hz.pm.api.projectdeclared.model.vo.PreInsVO; | |||
import com.hz.pm.api.projectdeclared.model.vo.PurchaseVO; | |||
import com.hz.pm.api.projectdeclared.service.IContractService; | |||
import com.hz.pm.api.projectdeclared.service.IPurchaseService; | |||
import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; | |||
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; | |||
import com.hz.pm.api.projectlib.manage.ProjectLibManage; | |||
import com.hz.pm.api.projectlib.model.entity.Project; | |||
import com.hz.pm.api.projectlib.model.entity.ProjectApplication; | |||
import com.hz.pm.api.projectlib.model.entity.ProjectInst; | |||
import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; | |||
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; | |||
import com.hz.pm.api.projectlib.model.vo.ProjectDetailVO; | |||
import com.hz.pm.api.projectlib.service.IProjectApplicationService; | |||
import com.hz.pm.api.projectlib.service.IProjectInstService; | |||
@@ -60,8 +51,18 @@ import com.hz.pm.api.projectlib.service.IProjectService; | |||
import com.hz.pm.api.staging.enums.MsgTypeEnum; | |||
import com.hz.pm.api.sys.manage.NoticeManage; | |||
import com.hz.pm.api.todocenter.constant.WorkNoticeConstant; | |||
import com.hz.pm.api.user.helper.MhUnitCache; | |||
import com.hz.pm.api.user.model.dto.MhUnitDTO; | |||
import com.hz.pm.api.user.security.model.UserFullInfoDTO; | |||
import com.hz.pm.api.user.security.model.UserInfoDetails; | |||
import com.hz.pm.api.user.util.LoginUserUtil; | |||
import com.ningdatech.basic.exception.BizException; | |||
import com.ningdatech.basic.function.VUtils; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.basic.util.CollUtils; | |||
import com.ningdatech.file.entity.File; | |||
import com.ningdatech.file.service.FileService; | |||
import com.ningdatech.file.utils.StrPool; | |||
import com.wflow.bean.entity.WflowModels; | |||
import com.wflow.contants.HisProInsEndActId; | |||
import com.wflow.exception.BusinessException; | |||
@@ -122,8 +123,7 @@ public class ProjectFileManage { | |||
private final MhUnitCache mhUnitCache; | |||
public PageVo<ProjectFileListVO> list(ProjectFileListParam req) { | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||
LambdaQueryWrapper<Project> query = Wrappers.lambdaQuery(Project.class) | |||
.like(StrUtils.isNotBlank(req.getProjectName()), Project::getProjectName, req.getProjectName()) | |||
.like(StrUtils.isNotBlank(req.getBuildOrgName()), Project::getBuildOrgName, req.getBuildOrgName()) | |||
@@ -140,7 +140,7 @@ public class ProjectFileManage { | |||
ProjectFileListVO vo = new ProjectFileListVO(); | |||
vo.setId(p.getId()); | |||
// 用户只可查阅自己及下属单位的项目档案和已经申请借阅通过的项目档案 | |||
if (StrUtils.isBlank(p.getBuildOrgCode()) | |||
if (NumberUtil.isNumber(p.getBuildOrgCode()) | |||
|| subOrgSet.contains(Long.parseLong(p.getBuildOrgCode())) | |||
|| checkCanRead(subOrgSet, p)) { | |||
vo.setCanRead(Boolean.TRUE); | |||
@@ -149,12 +149,13 @@ public class ProjectFileManage { | |||
vo.setPojectCode(p.getProjectCode()); | |||
vo.setProjectName(p.getProjectName()); | |||
// 判断当前项目,当前登录用户是否已经开启了申请借阅并且没有审批完成 | |||
ProjectApplyBorrow projectApplyBorrow = projectApplyBorrowService.getOne(Wrappers | |||
.lambdaQuery(ProjectApplyBorrow.class) | |||
.eq(ProjectApplyBorrow::getApplyBorrowUserId, user.getUserId()) | |||
Wrapper<ProjectApplyBorrow> pabQuery = Wrappers.lambdaQuery(ProjectApplyBorrow.class) | |||
.select(ProjectApplyBorrow::getInstanceId) | |||
.eq(ProjectApplyBorrow::getApplyBorrowUserId, user.getUserIdStr()) | |||
.eq(ProjectApplyBorrow::getProjectId, p.getId()) | |||
.orderByDesc(ProjectApplyBorrow::getCreateOn) | |||
.last("limit 1")); | |||
.last(BizConst.LIMIT_1); | |||
ProjectApplyBorrow projectApplyBorrow = projectApplyBorrowService.getOne(pabQuery); | |||
if (Objects.nonNull(projectApplyBorrow)) { | |||
String instCode = projectApplyBorrow.getInstanceId(); | |||
// 获取流程实例 | |||
@@ -173,14 +174,14 @@ public class ProjectFileManage { | |||
// 从申请借阅信息表中查询当前项目是否有当前登录用户发起的申请借阅审批流程 | |||
ProjectApplyBorrow applyBorrow = projectApplyBorrowService.getOne(Wrappers | |||
.lambdaQuery(ProjectApplyBorrow.class) | |||
.eq(ProjectApplyBorrow::getApplyBorrowUserId, user.getUserId()) | |||
.eq(ProjectApplyBorrow::getApplyBorrowUserId, user.getUserIdStr()) | |||
.eq(ProjectApplyBorrow::getProjectId, p.getId()) | |||
.eq(ProjectApplyBorrow::getInstanceId, instCode)); | |||
// 延期申请流程还未审核结束 | |||
if (Objects.nonNull(applyBorrow) && InstTypeEnum.APPLY_BORROW.getCode().equals(instType) | |||
if (Objects.nonNull(applyBorrow) && InstTypeEnum.APPLY_BORROW.eq(instType) | |||
&& Objects.isNull(newInstance.getEndActivityId())) { | |||
vo.setCanApplyBorrow(Boolean.FALSE); | |||
} else if (InstTypeEnum.APPLY_BORROW.getCode().equals(instType) && | |||
} else if (InstTypeEnum.APPLY_BORROW.eq(instType) && | |||
HisProInsEndActId.REJECT.equals(newInstance.getEndActivityId())) { | |||
// 如果是延期申请审核被驳回,设置项目可以申请延期申报 | |||
vo.setCanApplyBorrow(Boolean.TRUE); | |||
@@ -195,10 +196,12 @@ public class ProjectFileManage { | |||
private boolean checkCanRead(List<Long> subOrgSet, Project project) { | |||
// 从申请借阅信息表中查出本单位及下属单位审批通过的项目 | |||
List<String> subOrgSetStr = CollUtils.convert(subOrgSet, String::valueOf); | |||
HashSet<Long> borrowProjectIdSet = new HashSet<>(); | |||
List<Long> applyBorrowProjectIdList = projectApplyBorrowService | |||
.list(Wrappers.lambdaQuery(ProjectApplyBorrow.class) | |||
.in(ProjectApplyBorrow::getApplyBorrowOrgCode, subOrgSet) | |||
.select(ProjectApplyBorrow::getProjectId) | |||
.in(ProjectApplyBorrow::getApplyBorrowOrgCode, subOrgSetStr) | |||
.eq(ProjectApplyBorrow::getIsSuccess, Boolean.TRUE)) | |||
.stream().map(ProjectApplyBorrow::getProjectId) | |||
.filter(borrowProjectIdSet::add) | |||
@@ -242,10 +245,6 @@ public class ProjectFileManage { | |||
return projectFileVo; | |||
} | |||
public String wantRead(Long projectId) { | |||
return "申请成功"; | |||
} | |||
public String startApplyBorrowProcess(Long projectId) { | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
Project project = projectService.getNewProject(projectId); | |||
@@ -33,6 +33,7 @@ import com.hz.pm.api.projectlib.model.req.ProjectListReq; | |||
import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; | |||
import com.hz.pm.api.projectlib.service.IProjectService; | |||
import com.hz.pm.api.user.security.model.UserFullInfoDTO; | |||
import com.hz.pm.api.user.security.model.UserInfoDetails; | |||
import com.hz.pm.api.user.util.LoginUserUtil; | |||
import com.ningdatech.basic.exception.BizException; | |||
import com.ningdatech.basic.function.VUtils; | |||
@@ -363,7 +364,7 @@ public class ConstructionManage { | |||
* @return | |||
*/ | |||
public PageVo<ProjectLibListItemVO> preProjectlist(ProjectListReq req) { | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||
VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); | |||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | |||
//建设中状态 | |||
@@ -256,16 +256,12 @@ public class DelayedApplyManage { | |||
|| project.getPlanAcceptanceTime().isAfter(LocalDateTime.now())) | |||
.throwMessage("当前项目还未过期验收"); | |||
String regionCode = project.getAreaCode(); | |||
WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) | |||
.eq(WflowModels::getRegionCode, regionCode) | |||
.eq(WflowModels::getProcessType, ProjectProcessStageEnum.APPLY_DELAY.getCode()) | |||
.last(BizConst.LIMIT_1)); | |||
if (Objects.isNull(model)) { | |||
log.error("此 【{}】区域找不到延期申请流程配置", regionCode); | |||
throw new BusinessException(String.format("此 【%s】区域找不到延期申请流程配置", regionCode)); | |||
throw new BusinessException("找不到延期申请流程配置"); | |||
} | |||
ProcessStartParamsVo params = new ProcessStartParamsVo(); | |||
@@ -207,7 +207,6 @@ public class FinalAcceptanceManage { | |||
String regionCode = projectInfo.getAreaCode(); | |||
WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) | |||
.eq(WflowModels::getRegionCode, regionCode) | |||
.eq(WflowModels::getProcessType, ProjectProcessStageEnum.ACCEPTANCE_DECLARATION_APPROVAL_PROCESS.getCode()) | |||
.last(BizConst.LIMIT_1)); | |||
@@ -258,16 +257,12 @@ public class FinalAcceptanceManage { | |||
VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("重新提交失败 此项目不存在!"); | |||
VUtils.isTrue(StringUtils.isBlank(projectDto.getFinalAcceptanceMaterials())).throwMessage("提交失败 请提交终验材料!"); | |||
String regionCode = projectInfo.getAreaCode(); | |||
WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) | |||
.eq(WflowModels::getRegionCode, regionCode) | |||
.eq(WflowModels::getProcessType, ProjectProcessStageEnum.ACCEPTANCE_DECLARATION_APPROVAL_PROCESS.getCode()) | |||
.last(BizConst.LIMIT_1)); | |||
if (Objects.isNull(model)) { | |||
log.error("此 【{}】区域找不到 验收申报流程配置", regionCode); | |||
throw new BusinessException(String.format("此 【%s】区域找不到 验收申报流程配置", regionCode)); | |||
throw new BusinessException("找不到验收申报流程配置"); | |||
} | |||
//首先要判断 项目当前状态 是不是 方案待申报 | |||
@@ -73,8 +73,7 @@ public class ReviewChecklistManage { | |||
query.eq(Project::getNewest, Boolean.TRUE); | |||
//建设方案提交后的状态 | |||
query.ge(Project::getStatus, ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()) | |||
.ne(Project::getStatus, ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()) | |||
.eq(Project::getAreaCode, RegionConst.RC_HZ); | |||
.ne(Project::getStatus, ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); | |||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||
buildReviewCheckPermission(query, user); | |||
@@ -38,7 +38,8 @@ public class GenerateProjectCodeUtil { | |||
public String generateProjectCode(ProjectDTO project) { | |||
// 获取所属行政区划代码(9位) | |||
String areaCode = project.getAreaCode() + ProjectCodeContant.REGION_LAST_3; | |||
// String areaCode = project.getAreaCode() + ProjectCodeContant.REGION_LAST_3; | |||
String areaCode = RegionConst.RC_HZ + ProjectCodeContant.REGION_LAST_3; | |||
// 获取建设年度 (10-13) | |||
String year = Objects.nonNull(project.getProjectYear()) ? String.valueOf(project.getProjectYear()) | |||
: String.valueOf(LocalDateTime.now().getYear()); | |||
@@ -55,7 +56,8 @@ public class GenerateProjectCodeUtil { | |||
public String generateProjectCode(ProjectCollection project) { | |||
// 获取所属行政区划代码(9位) | |||
String areaCode = project.getAreaCode() + ProjectCodeContant.REGION_LAST_3; | |||
// String areaCode = project.getAreaCode() + ProjectCodeContant.REGION_LAST_3; | |||
String areaCode = RegionConst.RC_HZ + ProjectCodeContant.REGION_LAST_3; | |||
// 获取建设年度 (10-13) | |||
String year = Objects.nonNull(project.getProjectYear()) ? String.valueOf(project.getProjectYear()) | |||
: String.valueOf(LocalDateTime.now().getYear()); | |||
@@ -78,7 +80,8 @@ public class GenerateProjectCodeUtil { | |||
VUtils.isTrue(Objects.isNull(baseinfo)).throwMessage("没有项目基本信息 无法生成项目编号!"); | |||
VUtils.isTrue(Objects.isNull(apply)).throwMessage("没有项目申报信息 无法生成项目编号!"); | |||
String areaCode = (StringUtils.isNotBlank(baseinfo.getBaseAreaCode()) ? baseinfo.getBaseAreaCode() : RegionConst.RC_HZ + BizConst.NINE_AREA_CODE_LAST); | |||
// String areaCode = (StringUtils.isNotBlank(baseinfo.getBaseAreaCode()) ? baseinfo.getBaseAreaCode() : RegionConst.RC_HZ + BizConst.NINE_AREA_CODE_LAST); | |||
String areaCode = RegionConst.RC_HZ + BizConst.NINE_AREA_CODE_LAST; | |||
// 获取建设年度 (10-13) | |||
String year = Objects.nonNull(apply.getBaseProjSetYear()) ? apply.getBaseProjSetYear() | |||
: String.valueOf(LocalDateTime.now().getYear()); | |||
@@ -101,7 +104,8 @@ public class GenerateProjectCodeUtil { | |||
VUtils.isTrue(Objects.isNull(baseinfo)).throwMessage("没有项目基本信息 无法生成项目编号!"); | |||
VUtils.isTrue(Objects.isNull(apply)).throwMessage("没有项目申报信息 无法生成项目编号!"); | |||
String areaCode = (StringUtils.isNotBlank(baseinfo.getBaseAreaCode()) ? baseinfo.getBaseAreaCode() : RegionConst.RC_HZ + BizConst.NINE_AREA_CODE_LAST); | |||
// String areaCode = (StringUtils.isNotBlank(baseinfo.getBaseAreaCode()) ? baseinfo.getBaseAreaCode() : RegionConst.RC_HZ + BizConst.NINE_AREA_CODE_LAST); | |||
String areaCode = RegionConst.RC_HZ + BizConst.NINE_AREA_CODE_LAST; | |||
// 获取建设年度 (10-13) | |||
String year = Objects.nonNull(apply.getBaseProjSetYear()) ? apply.getBaseProjSetYear() | |||
: String.valueOf(LocalDateTime.now().getYear()); | |||
@@ -46,8 +46,6 @@ public class ProcessExecuteChainHandle { | |||
* @since 2023/02/26 | |||
*/ | |||
public List<ProcessDetailVO> handle(Long projectId, List<ProcessDetailVO> processSchedule) { | |||
Project project = projectService.getById(projectId); | |||
List<AbstractProcessBusinessHandle> handles = Lists.newArrayList(); | |||
for (AbstractProcessBusinessHandle processBusinessHandle : processBusinessHandles) { | |||
if (processBusinessHandle instanceof AnnualPlanHandle) { | |||
@@ -66,10 +64,7 @@ public class ProcessExecuteChainHandle { | |||
} | |||
} else if (processBusinessHandle instanceof ProvinceUnitedReviewHandle) { | |||
//省级联审 | |||
if (StateMachineUtil.isCityProject() && StateMachineUtil.judgeDeclareAmount(project, | |||
ProjectDeclareConst.Number.DECLARE_AMOUNT_JUDGEMENT)) { | |||
handles.add(processBusinessHandle); | |||
} | |||
// TODO | |||
} else { | |||
handles.add(processBusinessHandle); | |||
} | |||
@@ -4,10 +4,10 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.hz.pm.api.common.model.constant.BizConst; | |||
import com.hz.pm.api.common.model.constant.CommonConst; | |||
import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; | |||
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; | |||
import com.hz.pm.api.projectlib.manage.AnnualPlanLibManage; | |||
import com.hz.pm.api.projectlib.model.entity.Project; | |||
import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; | |||
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; | |||
import com.hz.pm.api.projectlib.service.INdProjectStatusChangeService; | |||
import com.hz.pm.api.projectlib.service.IProjectService; | |||
import com.wflow.workflow.bean.vo.ProcessDetailVO; | |||
@@ -15,12 +15,9 @@ import com.wflow.workflow.enums.StepStatusEnum; | |||
import org.springframework.core.annotation.Order; | |||
import org.springframework.stereotype.Component; | |||
import java.util.Arrays; | |||
import java.util.List; | |||
import java.util.Objects; | |||
import static com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum.*; | |||
/** | |||
* 立项批复处理 | |||
* | |||
@@ -32,35 +29,10 @@ import static com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum.*; | |||
public class ProjectApprovalHandle extends AbstractProcessBusinessHandle { | |||
private final INdProjectStatusChangeService projectStatusChangeService; | |||
private final IProjectService projectService; | |||
private final AnnualPlanLibManage annualPlanLibManage; | |||
private Integer order = 8; | |||
/** | |||
* 项目状态为:待立项批复之前的状态 | |||
*/ | |||
private static final List<ProjectStatusEnum> PROJECT_APPROVAL_LIST_STATUS = Arrays.asList( | |||
NOT_APPROVED, | |||
UNDER_INTERNAL_AUDIT, | |||
UNDER_INTERNAL_AUDIT_NOT_PASS, | |||
PENDING_PREQUALIFICATION, | |||
JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS, | |||
JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS, | |||
THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED, | |||
PRE_APPLYING, | |||
PREQUALIFICATION_FAILED, | |||
DEPARTMENT_JOINT_REVIEW, | |||
DEPARTMENT_JOINT_REVIEW_FAILED, | |||
IN_THE_ANNUAL_PLAN, | |||
BE_SUSPENDED, | |||
SCHEME_UNDER_REVIEW, | |||
SCHEME_REVIEW_FAILED, | |||
TO_BE_DECLARED, | |||
PLAN_TO_BE_DECLARED | |||
); | |||
public ProjectApprovalHandle(AnnualPlanLibManage annualPlanLibManage, INdProjectStatusChangeService projectStatusChangeService, IProjectService projectService){ | |||
this.annualPlanLibManage = annualPlanLibManage; | |||
public ProjectApprovalHandle(AnnualPlanLibManage annualPlanLibManage, INdProjectStatusChangeService projectStatusChangeService, IProjectService projectService) { | |||
this.projectStatusChangeService = projectStatusChangeService; | |||
this.projectService = projectService; | |||
} | |||
@@ -73,12 +45,12 @@ public class ProjectApprovalHandle extends AbstractProcessBusinessHandle { | |||
//查出历史版本的 所有项目ID | |||
List<Long> allVersionProjectIds = projectService.getAllVersionProjectId(project); | |||
Integer status = project.getStatus(); | |||
if(Objects.isNull(status)){ | |||
if (Objects.isNull(status)) { | |||
return; | |||
} | |||
// 项目状态为待立项批复之前的状态 | |||
if (status < ProjectStatusEnum.TO_BE_APPROVED.getCode()){ | |||
if (status < ProjectStatusEnum.TO_BE_APPROVED.getCode()) { | |||
processDetailVO.setStepStatus(StepStatusEnum.NOT_START); | |||
processDetailVO.setProcessName(CommonConst.PROJECT_APPROVAL); | |||
processSchedule.add(processDetailVO); | |||
@@ -86,7 +58,7 @@ public class ProjectApprovalHandle extends AbstractProcessBusinessHandle { | |||
} | |||
// 当前项目状态为待立项批复 | |||
if (ProjectStatusEnum.TO_BE_APPROVED.getCode().equals(status)){ | |||
if (ProjectStatusEnum.TO_BE_APPROVED.getCode().equals(status)) { | |||
// 根据建设方案评审通过的时间获取 | |||
ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) | |||
.in(ProjectStatusChange::getProjectId, allVersionProjectIds) | |||
@@ -240,23 +240,23 @@ public class AnnualPlanLibManage { | |||
/** | |||
* build 项目的角色权限到req | |||
* | |||
* @param query | |||
* @param query \ | |||
*/ | |||
public UserFullInfoDTO buildProjectLibPermission(LambdaQueryWrapper<Project> query) { | |||
public void buildProjectLibPermission(LambdaQueryWrapper<Project> query) { | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
Optional<DataScopeDTO> currentUserDataScope = DataScopeUtil.getCurrentUserDataScope(user); | |||
if (!currentUserDataScope.isPresent()) { | |||
log.warn("没有取到权限信息 当前查询 没有权限条件"); | |||
return user; | |||
return; | |||
} | |||
switch (currentUserDataScope.get().getRole()) { | |||
case NORMAL_MEMBER: | |||
// 普通用户 只能看到自己单位去申报的 | |||
query.eq(Project::getBuildOrgCode, user.getMhUnitId()); | |||
query.eq(Project::getBuildOrgCode, user.getMhUnitIdStr()); | |||
break; | |||
case COMPANY_MANAGER: | |||
// 单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 | |||
query.eq(Project::getBuildOrgCode, user.getMhUnitId()); | |||
query.eq(Project::getBuildOrgCode, user.getMhUnitIdStr()); | |||
break; | |||
case SUPER_ADMIN: | |||
// 超级管理员 看到丽水全市的 并且也要判断他 同时是不是单位管理员 | |||
@@ -266,7 +266,6 @@ public class AnnualPlanLibManage { | |||
query.eq(Project::getId, "NULL"); | |||
break; | |||
} | |||
return user; | |||
} | |||
@Transactional(rollbackFor = Exception.class) | |||
@@ -207,24 +207,7 @@ public class ProcessEndListener { | |||
case UNDER_INTERNAL_AUDIT: | |||
// 当前项目状态是部门联审中 | |||
case DEPARTMENT_JOINT_REVIEW: | |||
//如果是 区县 并且 500万及以上要推送省局重大项目 | |||
if (!StateMachineUtil.isCityProject() && | |||
StateMachineUtil.judgeDeclareAmount(declaredProject, | |||
ProjectDeclareConst.Number.DECLARE_COUNTY_AMOUNT_JUDGEMENT)) { | |||
try { | |||
List<ProjectApplication> applications = projectApplicationService | |||
.list(Wrappers.lambdaQuery(ProjectApplication.class) | |||
.eq(ProjectApplication::getProjectId, declaredProject.getId())); | |||
joinReviewProvincialBureauService.pushImportProject( | |||
ApplicationConverter.convertProject(declaredProject, applications, fileService, active)); | |||
handlerManage.updatePassProjectStatus(userId, declaredProject); | |||
break; | |||
} catch (Exception e) { | |||
log.info("区县推送省级联审失败[{}],{}", declaredProject.getProjectName(), e.getMessage()); | |||
log.error("区县推送省级联审失败:" + e); | |||
} | |||
} | |||
// 当前项目状态是方案评审中 | |||
// 当前项目状态是方案评审中 | |||
case SCHEME_UNDER_REVIEW: | |||
// 当前项目状态是终验审核中 | |||
case FINAL_ACCEPTANCE_IS_UNDER_REVIEW: | |||
@@ -156,7 +156,7 @@ public class HandlerManage { | |||
// 并向流程发起人发送浙政钉工作通知:【项目名称】已通过【流程名称】,请及时开始下一步操作。 | |||
if (HisProInsEndActId.END.equals(newInstance.getEndActivityId())) { | |||
// 如果是申请延期和申请借阅审批流程,不走状态机 | |||
if (InstTypeEnum.APPLY_DELAY.getCode().equals(instType) || InstTypeEnum.APPLY_BORROW.getCode().equals(instType)) { | |||
if (InstTypeEnum.APPLY_DELAY.eq(instType) || InstTypeEnum.APPLY_BORROW.eq(instType)) { | |||
switch (instTypeEnum) { | |||
case APPLY_DELAY: | |||
// 保存延期申请记录,更新项目建设周期和计划验收时间 | |||
@@ -180,29 +180,6 @@ public class HandlerManage { | |||
break; | |||
// 当前项目状态是部门联审中 | |||
case DEPARTMENT_JOINT_REVIEW: | |||
log.info("部门联审成功后 要判断是否是 区县重大项目"); | |||
boolean isImport = !StateMachineUtil.isCityProject() && | |||
StateMachineUtil.judgeDeclareAmount(declaredProject, | |||
ProjectDeclareConst.Number.DECLARE_COUNTY_AMOUNT_JUDGEMENT); | |||
log.info("isImport :{}", isImport); | |||
//如果是 区县 并且 500万及以上要推送省局重大项目 | |||
if (isImport) { | |||
try { | |||
List<ProjectApplication> applications = projectApplicationService | |||
.list(Wrappers.lambdaQuery(ProjectApplication.class) | |||
.eq(ProjectApplication::getProjectCode, declaredProject.getProjectCode())); | |||
joinReviewProvincialBureauService.pushImportProject( | |||
ApplicationConverter.convertProject(declaredProject, applications, fileService, active)); | |||
updatePassProjectStatus(userId, declaredProject); | |||
break; | |||
} catch (Exception e) { | |||
log.info("区县推送省级联审失败[{}],{}", declaredProject.getProjectName(), e.getMessage()); | |||
log.error("区县推送省级联审失败:" + e); | |||
} | |||
} | |||
break; | |||
// 当前项目状态是单位内部审核中 | |||
case UNDER_INTERNAL_AUDIT: | |||
// 当前项目状态是方案评审中 | |||
case FINAL_ACCEPTANCE_IS_UNDER_REVIEW: | |||
@@ -329,7 +329,7 @@ public class TodoCenterManage { | |||
*/ | |||
public String handler(ReqProcessHandlerDTO param) { | |||
// 获取登录用户ID | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||
// 获取登录用户浙政钉code | |||
String userIdStr = user.getUserIdStr(); | |||
// 获取入参 | |||