@@ -230,7 +230,7 @@ public class DelayedApplyManage { | |||
.throwMessage("提交失败 该项目不是 已立项|待终验"); | |||
VUtils.isTrue(Objects.isNull(project.getPlanAcceptanceTime()) | |||
|| project.getPlanAcceptanceTime().compareTo(LocalDateTime.now()) <= 0) | |||
|| project.getPlanAcceptanceTime().compareTo(LocalDateTime.now()) > 0) | |||
.throwMessage("当前项目还未过期验收"); | |||
String regionCode = user.getRegionCode(); | |||
@@ -616,6 +616,13 @@ public class ProjectLibManage { | |||
public void saveProjectByApplyDelay(DelayedApplyDTO dto, Project project, String instanceId) { | |||
// 更新项目流程实例ID | |||
project.setInstCode(instanceId); | |||
project.setCreateOn(LocalDateTime.now()); | |||
project.setUpdateOn(LocalDateTime.now()); | |||
projectService.updateById(project); | |||
// 保存延期申请信息 | |||
ProjectDelayApply projectDelayApply = new ProjectDelayApply(); | |||
projectDelayApply.setDelayTime(dto.getDelayedMonth()); | |||
projectDelayApply.setDelayApplyFile(dto.getSupportingMaterials()); | |||
@@ -1,8 +1,12 @@ | |||
package com.ningdatech.pmapi.todocenter.handle; | |||
import cn.hutool.core.collection.CollUtil; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.ningdatech.basic.exception.BizException; | |||
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.user.security.auth.model.UserFullInfoDTO; | |||
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; | |||
@@ -44,6 +48,7 @@ public class WithDrawHandle { | |||
private final HistoryService historyService; | |||
private final RepositoryService repositoryService; | |||
private final IProjectInstService projectInstService; | |||
/** | |||
* 判断 当前流程 可否被当前登录人 所撤回 | |||
@@ -306,6 +311,16 @@ public class WithDrawHandle { | |||
*/ | |||
public boolean canRootWithDraw(HistoricProcessInstance instance,String employeeCode) { | |||
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 | |||
if(StringUtils.isBlank(employeeCode) || StringUtils.isBlank(startUserId) | |||
|| !employeeCode.equals(startUserId)){ | |||
@@ -3,6 +3,7 @@ package com.ningdatech.pmapi.todocenter.manage; | |||
import static com.ningdatech.pmapi.todocenter.constant.WorkNoticeContant.*; | |||
import java.time.LocalDateTime; | |||
import java.time.format.DateTimeFormatter; | |||
import java.util.*; | |||
import java.util.stream.Collectors; | |||
@@ -145,7 +146,7 @@ public class HandlerManage { | |||
updateProjectDelayApplyInfo(declaredProject,instanceId); | |||
break; | |||
case APPLY_BORROW: | |||
// 申请借阅审批逻辑 | |||
//TODO 申请借阅审批逻辑 | |||
break; | |||
default: | |||
throw new BizException("传入实例类型错误: " + instTypeEnum); | |||
@@ -217,11 +218,13 @@ public class HandlerManage { | |||
LocalDateTime approvalDate = declaredProject.getApprovalDate(); | |||
String buildCycle = declaredProject.getBuildCycle(); | |||
// 重新计算建设周期、验收时间 | |||
String constructCycle = buildCycle + delayApply.getDelayTime(); | |||
String constructCycle = String.valueOf(Integer.parseInt(buildCycle) + delayApply.getDelayTime()); | |||
declaredProject.setBuildCycle(constructCycle); | |||
Long delayedMonth = Long.valueOf(delayApply.getDelayTime()); | |||
String acceptTime = NdDateUtils.format(approvalDate.plusMonths(delayedMonth), DatePattern.NORM_DATETIME_MINUTE_PATTERN); | |||
declaredProject.setBuildCycle(acceptTime); | |||
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()); | |||
@@ -236,8 +239,16 @@ public class HandlerManage { | |||
*/ | |||
public void afterRejectTodo(Project declaredProject, HistoricProcessInstance instance) { | |||
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(), | |||
REJECT_MSG_TEMPLATE,MsgTypeEnum.PROJECT_REVIEW_REJECT); | |||