@@ -56,7 +56,8 @@ public class GeneratorCodeKingbaseConfig { | |||||
} | } | ||||
public static void main(String[] args) { | public static void main(String[] args) { | ||||
generate("Liuxinxin", "expert", PATH_LXX, "expert_gov_business_strip"); | |||||
//generate("Liuxinxin", "expert", PATH_LXX, "expert_gov_business_strip"); | |||||
generate("CMM", "test", PATH_CMM, "nd_project_delay_apply"); | |||||
} | } | ||||
} | } |
@@ -49,7 +49,6 @@ public class DelayedApplyController { | |||||
@PostMapping("/apply") | @PostMapping("/apply") | ||||
public String delayedApply(@Validated @RequestBody DelayedApplyDTO dto) { | public String delayedApply(@Validated @RequestBody DelayedApplyDTO dto) { | ||||
String instanceId = delayedApplyManage.startDelayedApplyProcess(dto); | String instanceId = delayedApplyManage.startDelayedApplyProcess(dto); | ||||
return "启动流程实例 【" + instanceId + "】 成功"; | |||||
//return delayedApplyManage.delayedApply(dto); | |||||
return "启动延期申请流程实例 【" + instanceId + "】 成功"; | |||||
} | } | ||||
} | } |
@@ -36,6 +36,7 @@ import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; | import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; | ||||
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; | import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; | ||||
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; | import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; | ||||
import com.ningdatech.pmapi.projectlib.service.INdProjectDelayApplyService; | |||||
import com.ningdatech.pmapi.projectlib.service.IProjectInstService; | import com.ningdatech.pmapi.projectlib.service.IProjectInstService; | ||||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | import com.ningdatech.pmapi.projectlib.service.IProjectService; | ||||
import com.ningdatech.pmapi.staging.enums.MsgTypeEnum; | import com.ningdatech.pmapi.staging.enums.MsgTypeEnum; | ||||
@@ -229,7 +230,7 @@ public class DelayedApplyManage { | |||||
.throwMessage("提交失败 该项目不是 已立项|待终验"); | .throwMessage("提交失败 该项目不是 已立项|待终验"); | ||||
VUtils.isTrue(Objects.isNull(project.getPlanAcceptanceTime()) | VUtils.isTrue(Objects.isNull(project.getPlanAcceptanceTime()) | ||||
|| project.getPlanAcceptanceTime().compareTo(LocalDateTime.now()) <= 0) | |||||
|| project.getPlanAcceptanceTime().compareTo(LocalDateTime.now()) > 0) | |||||
.throwMessage("当前项目还未过期验收"); | .throwMessage("当前项目还未过期验收"); | ||||
String regionCode = user.getRegionCode(); | String regionCode = user.getRegionCode(); | ||||
@@ -253,12 +254,11 @@ public class DelayedApplyManage { | |||||
// 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 | // 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 | ||||
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(employeeCode, project); | Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(employeeCode, project); | ||||
String instanceId = processInstanceService.newStartProcess(model.getProcessDefId(), model.getFormId(), params, orgModelMap); | String instanceId = processInstanceService.newStartProcess(model.getProcessDefId(), model.getFormId(), params, orgModelMap); | ||||
log.info("终验方案项目申报成功 【{}】", instanceId); | |||||
log.info("延期申请申报成功 【{}】", instanceId); | |||||
// 保存项目相关 | |||||
// 保存项目延期实例相关 | |||||
projectLibManage.saveProjectByApplyDelay(dto, project, instanceId); | projectLibManage.saveProjectByApplyDelay(dto, project, instanceId); | ||||
//发送给第一个审批人消息 | //发送给第一个审批人消息 | ||||
noticeManage.sendFirtUser(project,model.getFormName(),instanceId, | noticeManage.sendFirtUser(project,model.getFormName(),instanceId, | ||||
WorkNoticeContant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); | WorkNoticeContant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); | ||||
@@ -44,4 +44,16 @@ public enum InstTypeEnum { | |||||
} | } | ||||
return StringUtils.EMPTY; | return StringUtils.EMPTY; | ||||
} | } | ||||
public static InstTypeEnum getByCode(Integer code) { | |||||
if (Objects.isNull(code)) { | |||||
return null; | |||||
} | |||||
for (InstTypeEnum t : InstTypeEnum.values()) { | |||||
if (code.equals(t.getCode())) { | |||||
return t; | |||||
} | |||||
} | |||||
return null; | |||||
} | |||||
} | } |
@@ -34,16 +34,14 @@ import com.ningdatech.pmapi.projectlib.handle.ProcessExecuteChainHandle; | |||||
import com.ningdatech.pmapi.projectlib.helper.ProjectHelper; | import com.ningdatech.pmapi.projectlib.helper.ProjectHelper; | ||||
import com.ningdatech.pmapi.projectlib.model.dto.ProjectApplicationDTO; | import com.ningdatech.pmapi.projectlib.model.dto.ProjectApplicationDTO; | ||||
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; | import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; | ||||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectRenewalFundDeclaration; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.*; | |||||
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; | import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; | ||||
import com.ningdatech.pmapi.projectlib.model.vo.AnnualAmountVO; | import com.ningdatech.pmapi.projectlib.model.vo.AnnualAmountVO; | ||||
import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO; | import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO; | ||||
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; | import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; | ||||
import com.ningdatech.pmapi.projectlib.service.*; | import com.ningdatech.pmapi.projectlib.service.*; | ||||
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; | import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; | ||||
import com.ningdatech.pmapi.user.util.LoginUserUtil; | |||||
import com.wflow.exception.BusinessException; | import com.wflow.exception.BusinessException; | ||||
import com.wflow.workflow.bean.vo.ProcessDetailVO; | import com.wflow.workflow.bean.vo.ProcessDetailVO; | ||||
import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||
@@ -79,8 +77,8 @@ public class ProjectLibManage { | |||||
private final IProjectApplicationService projectApplicationService; | private final IProjectApplicationService projectApplicationService; | ||||
private final GenerateProjectCodeUtil generateProjectCodeUtil; | private final GenerateProjectCodeUtil generateProjectCodeUtil; | ||||
private final IProjectInstService projectInstService; | private final IProjectInstService projectInstService; | ||||
private final StateMachineUtils stateMachineUtils; | private final StateMachineUtils stateMachineUtils; | ||||
private final INdProjectDelayApplyService projectDelayApplyService; | |||||
public PageVo<ProjectLibListItemVO> projectLibList(ProjectListReq req) { | public PageVo<ProjectLibListItemVO> projectLibList(ProjectListReq req) { | ||||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | ||||
@@ -617,20 +615,26 @@ public class ProjectLibManage { | |||||
} | } | ||||
public void saveProjectByApplyDelay(DelayedApplyDTO dto, Project project, String instanceId) { | public void saveProjectByApplyDelay(DelayedApplyDTO dto, Project project, String instanceId) { | ||||
// 获取项目的立项批复时间和建设周期 | |||||
LocalDateTime approvalDate = project.getApprovalDate(); | |||||
String buildCycle = project.getBuildCycle(); | |||||
// 重新计算建设周期、验收时间 | |||||
String constructCycle = buildCycle + dto.getDelayedMonth(); | |||||
project.setBuildCycle(constructCycle); | |||||
Long delayedMonth = Long.valueOf(dto.getDelayedMonth()); | |||||
String acceptTime = NdDateUtils.format(approvalDate.plusMonths(delayedMonth), DatePattern.NORM_DATETIME_MINUTE_PATTERN); | |||||
project.setBuildCycle(acceptTime); | |||||
// 更新项目流程实例ID | |||||
project.setInstCode(instanceId); | project.setInstCode(instanceId); | ||||
project.setApplyDelayFile(dto.getSupportingMaterials()); | |||||
project.setApplyDelayReason(dto.getDelayedReason()); | |||||
project.setCreateOn(LocalDateTime.now()); | |||||
project.setUpdateOn(LocalDateTime.now()); | |||||
projectService.updateById(project); | projectService.updateById(project); | ||||
// 保存延期申请信息 | |||||
ProjectDelayApply projectDelayApply = new ProjectDelayApply(); | |||||
projectDelayApply.setDelayTime(dto.getDelayedMonth()); | |||||
projectDelayApply.setDelayApplyFile(dto.getSupportingMaterials()); | |||||
projectDelayApply.setDelayApplyReason(dto.getDelayedReason()); | |||||
projectDelayApply.setProjectId(project.getId()); | |||||
projectDelayApply.setInstanceId(instanceId); | |||||
projectDelayApply.setCreateBy(LoginUserUtil.getUserId()); | |||||
projectDelayApply.setCreateOn(LocalDateTime.now()); | |||||
projectDelayApply.setUpdateBy(LoginUserUtil.getUserId()); | |||||
projectDelayApply.setUpdateOn(LocalDateTime.now()); | |||||
projectDelayApplyService.save(projectDelayApply); | |||||
//保存项目和实例的关系 | //保存项目和实例的关系 | ||||
ProjectInst projectInst = new ProjectInst(); | ProjectInst projectInst = new ProjectInst(); | ||||
projectInst.setProjectId(project.getId()); | projectInst.setProjectId(project.getId()); | ||||
@@ -0,0 +1,16 @@ | |||||
package com.ningdatech.pmapi.projectlib.mapper; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectDelayApply; | |||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||||
/** | |||||
* <p> | |||||
* 项目延期申请记录表 Mapper 接口 | |||||
* </p> | |||||
* | |||||
* @author CMM | |||||
* @since 2023-06-15 | |||||
*/ | |||||
public interface NdProjectDelayApplyMapper extends BaseMapper<ProjectDelayApply> { | |||||
} |
@@ -0,0 +1,5 @@ | |||||
<?xml version="1.0" encoding="UTF-8"?> | |||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||||
<mapper namespace="com.ningdatech.pmapi.projectlib.mapper.NdProjectDelayApplyMapper"> | |||||
</mapper> |
@@ -0,0 +1,57 @@ | |||||
package com.ningdatech.pmapi.projectlib.model.entity; | |||||
import com.baomidou.mybatisplus.annotation.IdType; | |||||
import com.baomidou.mybatisplus.annotation.TableId; | |||||
import com.baomidou.mybatisplus.annotation.TableName; | |||||
import java.io.Serializable; | |||||
import java.time.LocalDateTime; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
/** | |||||
* <p> | |||||
* 项目延期申请记录表 | |||||
* </p> | |||||
* | |||||
* @author CMM | |||||
* @since 2023-06-15 | |||||
*/ | |||||
@Data | |||||
@TableName("nd_project_delay_apply") | |||||
@ApiModel(value = "NdProjectDelayApply对象", description = "项目延期申请记录表") | |||||
public class ProjectDelayApply implements Serializable { | |||||
private static final long serialVersionUID = 1L; | |||||
@ApiModelProperty("主键") | |||||
@TableId(type = IdType.AUTO) | |||||
private Long id; | |||||
@ApiModelProperty("项目ID") | |||||
private Long projectId; | |||||
@ApiModelProperty("延期时间(几个月)") | |||||
private Integer delayTime; | |||||
@ApiModelProperty("延期申请佐证材料") | |||||
private String delayApplyFile; | |||||
@ApiModelProperty("延期申请理由") | |||||
private String delayApplyReason; | |||||
@ApiModelProperty("创建人") | |||||
private Long createBy; | |||||
@ApiModelProperty("创建时间") | |||||
private LocalDateTime createOn; | |||||
@ApiModelProperty("更新人") | |||||
private Long updateBy; | |||||
@ApiModelProperty("更新时间") | |||||
private LocalDateTime updateOn; | |||||
@ApiModelProperty("延期申请实例ID") | |||||
private String instanceId; | |||||
} |
@@ -0,0 +1,16 @@ | |||||
package com.ningdatech.pmapi.projectlib.service; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectDelayApply; | |||||
import com.baomidou.mybatisplus.extension.service.IService; | |||||
/** | |||||
* <p> | |||||
* 项目延期申请记录表 服务类 | |||||
* </p> | |||||
* | |||||
* @author CMM | |||||
* @since 2023-06-15 | |||||
*/ | |||||
public interface INdProjectDelayApplyService extends IService<ProjectDelayApply> { | |||||
} |
@@ -0,0 +1,20 @@ | |||||
package com.ningdatech.pmapi.projectlib.service.impl; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectDelayApply; | |||||
import com.ningdatech.pmapi.projectlib.mapper.NdProjectDelayApplyMapper; | |||||
import com.ningdatech.pmapi.projectlib.service.INdProjectDelayApplyService; | |||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||||
import org.springframework.stereotype.Service; | |||||
/** | |||||
* <p> | |||||
* 项目延期申请记录表 服务实现类 | |||||
* </p> | |||||
* | |||||
* @author CMM | |||||
* @since 2023-06-15 | |||||
*/ | |||||
@Service | |||||
public class NdProjectDelayApplyServiceImpl extends ServiceImpl<NdProjectDelayApplyMapper, ProjectDelayApply> implements INdProjectDelayApplyService { | |||||
} |
@@ -1,8 +1,12 @@ | |||||
package com.ningdatech.pmapi.todocenter.handle; | package com.ningdatech.pmapi.todocenter.handle; | ||||
import cn.hutool.core.collection.CollUtil; | import cn.hutool.core.collection.CollUtil; | ||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||||
import com.ningdatech.basic.exception.BizException; | import com.ningdatech.basic.exception.BizException; | ||||
import com.ningdatech.pmapi.common.helper.UserInfoHelper; | import com.ningdatech.pmapi.common.helper.UserInfoHelper; | ||||
import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; | |||||
import com.ningdatech.pmapi.projectlib.service.IProjectInstService; | |||||
import com.ningdatech.pmapi.todocenter.constant.TodoCenterContant; | import com.ningdatech.pmapi.todocenter.constant.TodoCenterContant; | ||||
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; | import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; | ||||
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; | import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; | ||||
@@ -44,6 +48,7 @@ public class WithDrawHandle { | |||||
private final HistoryService historyService; | private final HistoryService historyService; | ||||
private final RepositoryService repositoryService; | private final RepositoryService repositoryService; | ||||
private final IProjectInstService projectInstService; | |||||
/** | /** | ||||
* 判断 当前流程 可否被当前登录人 所撤回 | * 判断 当前流程 可否被当前登录人 所撤回 | ||||
@@ -306,6 +311,16 @@ public class WithDrawHandle { | |||||
*/ | */ | ||||
public boolean canRootWithDraw(HistoricProcessInstance instance,String employeeCode) { | public boolean canRootWithDraw(HistoricProcessInstance instance,String employeeCode) { | ||||
String startUserId = instance.getStartUserId(); | String startUserId = instance.getStartUserId(); | ||||
// 如果是申请延期或者申请借阅审批流程,流程发起人不能撤回,直接返回false | |||||
String instanceId = instance.getId(); | |||||
ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) | |||||
.eq(ProjectInst::getInstCode, instanceId)); | |||||
Integer instType = projectInst.getInstType(); | |||||
if (InstTypeEnum.APPLY_DELAY.getCode().equals(instType) || | |||||
InstTypeEnum.APPLY_BORROW.getCode().equals(instType)){ | |||||
return Boolean.FALSE; | |||||
} | |||||
//如果流程发起人 不是 当前登录人 直接返回false | //如果流程发起人 不是 当前登录人 直接返回false | ||||
if(StringUtils.isBlank(employeeCode) || StringUtils.isBlank(startUserId) | if(StringUtils.isBlank(employeeCode) || StringUtils.isBlank(startUserId) | ||||
|| !employeeCode.equals(startUserId)){ | || !employeeCode.equals(startUserId)){ | ||||
@@ -3,16 +3,21 @@ package com.ningdatech.pmapi.todocenter.manage; | |||||
import static com.ningdatech.pmapi.todocenter.constant.WorkNoticeContant.*; | import static com.ningdatech.pmapi.todocenter.constant.WorkNoticeContant.*; | ||||
import java.time.LocalDateTime; | import java.time.LocalDateTime; | ||||
import java.time.format.DateTimeFormatter; | |||||
import java.util.*; | import java.util.*; | ||||
import java.util.stream.Collectors; | import java.util.stream.Collectors; | ||||
import cn.hutool.core.date.DatePattern; | |||||
import com.google.common.collect.Lists; | import com.google.common.collect.Lists; | ||||
import com.ningdatech.basic.util.NdDateUtils; | |||||
import com.ningdatech.file.service.FileService; | import com.ningdatech.file.service.FileService; | ||||
import com.ningdatech.pmapi.common.constant.ProjectDeclareConst; | import com.ningdatech.pmapi.common.constant.ProjectDeclareConst; | ||||
import com.ningdatech.pmapi.projectdeclared.converter.ApplicationConverter; | import com.ningdatech.pmapi.projectdeclared.converter.ApplicationConverter; | ||||
import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectDelayApply; | |||||
import com.ningdatech.pmapi.projectlib.service.INdProjectDelayApplyService; | |||||
import com.ningdatech.pmapi.provincial.service.IJoinReviewProvincialBureauService; | import com.ningdatech.pmapi.provincial.service.IJoinReviewProvincialBureauService; | ||||
import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
import org.checkerframework.checker.nullness.qual.Nullable; | |||||
import org.flowable.engine.HistoryService; | import org.flowable.engine.HistoryService; | ||||
import org.flowable.engine.RuntimeService; | import org.flowable.engine.RuntimeService; | ||||
import org.flowable.engine.TaskService; | import org.flowable.engine.TaskService; | ||||
@@ -77,10 +82,9 @@ public class HandlerManage { | |||||
private final IProjectInstService projectInstService; | private final IProjectInstService projectInstService; | ||||
private final NoticeManage noticeManage; | private final NoticeManage noticeManage; | ||||
private final DeclaredProjectManage declaredProjectManage; | private final DeclaredProjectManage declaredProjectManage; | ||||
private final FileService fileService; | private final FileService fileService; | ||||
private final IJoinReviewProvincialBureauService joinReviewProvincialBureauService; | private final IJoinReviewProvincialBureauService joinReviewProvincialBureauService; | ||||
private final INdProjectDelayApplyService projectDelayApplyService; | |||||
/** | /** | ||||
* 审核通过后 所处理的逻辑 | * 审核通过后 所处理的逻辑 | ||||
@@ -93,6 +97,16 @@ public class HandlerManage { | |||||
HistoricProcessInstance newInstance = historyService.createHistoricProcessInstanceQuery() | HistoricProcessInstance newInstance = historyService.createHistoricProcessInstanceQuery() | ||||
.processInstanceId(instance.getId()) | .processInstanceId(instance.getId()) | ||||
.singleResult(); | .singleResult(); | ||||
// 获取当前流程实例类型 | |||||
String instanceId = newInstance.getId(); | |||||
ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) | |||||
.eq(ProjectInst::getInstCode, instanceId)); | |||||
Integer instType = projectInst.getInstType(); | |||||
InstTypeEnum instTypeEnum = InstTypeEnum.getByCode(instType); | |||||
if (Objects.isNull(instTypeEnum)){ | |||||
throw new BizException("当前审批流类型不存在,流程类型code:" + instType); | |||||
} | |||||
// 获取流程通过后当前流程详情 | // 获取流程通过后当前流程详情 | ||||
ProcessProgressVo newInstanceDetail = processInstanceService.getProgressInstanceDetail(null, instance.getId()); | ProcessProgressVo newInstanceDetail = processInstanceService.getProgressInstanceDetail(null, instance.getId()); | ||||
// 获取流程通过后当前审核人信息,向其发送工作通知 | // 获取流程通过后当前审核人信息,向其发送工作通知 | ||||
@@ -124,41 +138,58 @@ public class HandlerManage { | |||||
// 若当前登录用户是最后一个审批人,需更新流程状态为审核完成,项目状态到下个状态 | // 若当前登录用户是最后一个审批人,需更新流程状态为审核完成,项目状态到下个状态 | ||||
// 并向流程发起人发送浙政钉工作通知:【项目名称】已通过【流程名称】,请及时开始下一步操作。 | // 并向流程发起人发送浙政钉工作通知:【项目名称】已通过【流程名称】,请及时开始下一步操作。 | ||||
if (HisProInsEndActId.END.equals(newInstance.getEndActivityId())) { | if (HisProInsEndActId.END.equals(newInstance.getEndActivityId())) { | ||||
switch (Objects.requireNonNull(ProjectStatusEnum.getValue(declaredProject.getStatus()))) { | |||||
// 当前项目状态是预审中 | |||||
case PRE_APPLYING: | |||||
//先修改项目状态 | |||||
updatePassProjectStatus(userId, declaredProject); | |||||
//然后入库暂存库 | |||||
projectStagingService.addByProject(declaredProject,"暂存入库 待提交部门联审"); | |||||
break; | |||||
// 当前项目状态是单位内部审核中 | |||||
case UNDER_INTERNAL_AUDIT: | |||||
// 如果是申请延期和申请借阅审批流程,不走状态机 | |||||
if (InstTypeEnum.APPLY_DELAY.getCode().equals(instType) || InstTypeEnum.APPLY_BORROW.getCode().equals(instType)){ | |||||
switch (instTypeEnum) { | |||||
case APPLY_DELAY: | |||||
// 保存延期申请记录,更新项目建设周期和计划验收时间 | |||||
updateProjectDelayApplyInfo(declaredProject,instanceId); | |||||
break; | |||||
case APPLY_BORROW: | |||||
//TODO 申请借阅审批逻辑 | |||||
break; | |||||
default: | |||||
throw new BizException("传入实例类型错误: " + instTypeEnum); | |||||
} | |||||
}else { | |||||
switch (Objects.requireNonNull(ProjectStatusEnum.getValue(declaredProject.getStatus()))) { | |||||
// 当前项目状态是预审中 | |||||
case PRE_APPLYING: | |||||
//先修改项目状态 | |||||
updatePassProjectStatus(userId, declaredProject); | |||||
//然后入库暂存库 | |||||
projectStagingService.addByProject(declaredProject, "暂存入库 待提交部门联审"); | |||||
break; | |||||
// 当前项目状态是单位内部审核中 | |||||
case UNDER_INTERNAL_AUDIT: | |||||
// 当前项目状态是部门联审中 | // 当前项目状态是部门联审中 | ||||
case DEPARTMENT_JOINT_REVIEW: | |||||
//如果是 区县 并且 500万及以上要推送省局重大项目 | |||||
if(!StateMachineUtils.isCityProject(declaredProject) && | |||||
StateMachineUtils.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)); | |||||
}catch (Exception e){ | |||||
log.info("区县推送省级联审失败[{}],{}", declaredProject.getProjectName() ,e.getMessage()); | |||||
log.error("区县推送省级联审失败:" + e); | |||||
case DEPARTMENT_JOINT_REVIEW: | |||||
//如果是 区县 并且 500万及以上要推送省局重大项目 | |||||
if (!StateMachineUtils.isCityProject(declaredProject) && | |||||
StateMachineUtils.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)); | |||||
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: | |||||
updatePassProjectStatus(userId, declaredProject); | |||||
break; | |||||
default: | |||||
throw new IllegalStateException("Unexpected value: " + declaredProject.getStatus()); | |||||
// 当前项目状态是方案评审中 | |||||
case SCHEME_UNDER_REVIEW: | |||||
// 当前项目状态是终验审核中 | |||||
case FINAL_ACCEPTANCE_IS_UNDER_REVIEW: | |||||
updatePassProjectStatus(userId, declaredProject); | |||||
break; | |||||
default: | |||||
throw new BizException("传入项目状态错误: " + declaredProject.getStatus()); | |||||
} | |||||
} | } | ||||
//发送消息 | //发送消息 | ||||
noticeManage.sendNotice(instance.getStartUserId(),userId,declaredProject,instance.getProcessDefinitionName(), | noticeManage.sendNotice(instance.getStartUserId(),userId,declaredProject,instance.getProcessDefinitionName(), | ||||
@@ -178,6 +209,28 @@ public class HandlerManage { | |||||
} | } | ||||
} | } | ||||
private void updateProjectDelayApplyInfo(Project declaredProject, String instanceId) { | |||||
// 获取延期申请填写的相关信息 | |||||
ProjectDelayApply delayApply = projectDelayApplyService.getOne(Wrappers.lambdaQuery(ProjectDelayApply.class) | |||||
.eq(ProjectDelayApply::getProjectId, declaredProject.getId()) | |||||
.eq(ProjectDelayApply::getInstanceId, instanceId)); | |||||
// 获取项目的立项批复时间和建设周期 | |||||
LocalDateTime approvalDate = declaredProject.getApprovalDate(); | |||||
String buildCycle = declaredProject.getBuildCycle(); | |||||
// 重新计算建设周期、验收时间 | |||||
String constructCycle = String.valueOf(Integer.parseInt(buildCycle) + delayApply.getDelayTime()); | |||||
declaredProject.setBuildCycle(constructCycle); | |||||
Long constructMonth = Long.valueOf(constructCycle); | |||||
declaredProject.setBuildCycle(String.valueOf(constructMonth)); | |||||
String acceptTime = NdDateUtils.format(approvalDate.plusMonths(constructMonth), DatePattern.NORM_DATETIME_MINUTE_PATTERN); | |||||
LocalDateTime time = LocalDateTime.parse(acceptTime, DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_MINUTE_PATTERN)); | |||||
declaredProject.setPlanAcceptanceTime(time); | |||||
declaredProject.setInstCode(instanceId); | |||||
declaredProject.setApplyDelayFile(delayApply.getDelayApplyFile()); | |||||
declaredProject.setApplyDelayReason(delayApply.getDelayApplyReason()); | |||||
projectService.updateById(declaredProject); | |||||
} | |||||
/** | /** | ||||
* 驳回后 所处理的逻辑 | * 驳回后 所处理的逻辑 | ||||
@@ -186,8 +239,16 @@ public class HandlerManage { | |||||
*/ | */ | ||||
public void afterRejectTodo(Project declaredProject, HistoricProcessInstance instance) { | public void afterRejectTodo(Project declaredProject, HistoricProcessInstance instance) { | ||||
Long userId = LoginUserUtil.getUserId(); | Long userId = LoginUserUtil.getUserId(); | ||||
// 更新项目状态和流程状态 | |||||
updateRejectProjectStatus(userId, declaredProject); | |||||
// 获取当前流程实例类型 | |||||
String instanceId = declaredProject.getInstCode(); | |||||
ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) | |||||
.eq(ProjectInst::getInstCode, instanceId)); | |||||
Integer instType = projectInst.getInstType(); | |||||
// 审批流程不是申请延期和申请借阅,需调用状态机 | |||||
if (!InstTypeEnum.APPLY_DELAY.getCode().equals(instType) && !InstTypeEnum.APPLY_BORROW.getCode().equals(instType)) { | |||||
// 更新项目状态和流程状态 | |||||
updateRejectProjectStatus(userId, declaredProject); | |||||
} | |||||
//发送消息 | //发送消息 | ||||
noticeManage.sendNotice(instance.getStartUserId(),userId,declaredProject,instance.getProcessDefinitionName(), | noticeManage.sendNotice(instance.getStartUserId(),userId,declaredProject,instance.getProcessDefinitionName(), | ||||
REJECT_MSG_TEMPLATE,MsgTypeEnum.PROJECT_REVIEW_REJECT); | REJECT_MSG_TEMPLATE,MsgTypeEnum.PROJECT_REVIEW_REJECT); | ||||