Browse Source

申请延期审批流程修改

tags/24082201
CMM 1 year ago
parent
commit
65cf966def
4 changed files with 41 additions and 8 deletions
  1. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DelayedApplyManage.java
  2. +7
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java
  3. +15
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/handle/WithDrawHandle.java
  4. +18
    -7
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java

+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DelayedApplyManage.java View File

@@ -230,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();


+ 7
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java View File

@@ -616,6 +616,13 @@ public class ProjectLibManage {


public void saveProjectByApplyDelay(DelayedApplyDTO dto, Project project, String instanceId) { 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 projectDelayApply = new ProjectDelayApply();
projectDelayApply.setDelayTime(dto.getDelayedMonth()); projectDelayApply.setDelayTime(dto.getDelayedMonth());
projectDelayApply.setDelayApplyFile(dto.getSupportingMaterials()); projectDelayApply.setDelayApplyFile(dto.getSupportingMaterials());


+ 15
- 0
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/handle/WithDrawHandle.java View File

@@ -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)){


+ 18
- 7
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java View File

@@ -3,6 +3,7 @@ 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;


@@ -145,7 +146,7 @@ public class HandlerManage {
updateProjectDelayApplyInfo(declaredProject,instanceId); updateProjectDelayApplyInfo(declaredProject,instanceId);
break; break;
case APPLY_BORROW: case APPLY_BORROW:
// 申请借阅审批逻辑
//TODO 申请借阅审批逻辑
break; break;
default: default:
throw new BizException("传入实例类型错误: " + instTypeEnum); throw new BizException("传入实例类型错误: " + instTypeEnum);
@@ -217,11 +218,13 @@ public class HandlerManage {
LocalDateTime approvalDate = declaredProject.getApprovalDate(); LocalDateTime approvalDate = declaredProject.getApprovalDate();
String buildCycle = declaredProject.getBuildCycle(); String buildCycle = declaredProject.getBuildCycle();
// 重新计算建设周期、验收时间 // 重新计算建设周期、验收时间
String constructCycle = buildCycle + delayApply.getDelayTime();
String constructCycle = String.valueOf(Integer.parseInt(buildCycle) + delayApply.getDelayTime());
declaredProject.setBuildCycle(constructCycle); 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.setInstCode(instanceId);
declaredProject.setApplyDelayFile(delayApply.getDelayApplyFile()); declaredProject.setApplyDelayFile(delayApply.getDelayApplyFile());
declaredProject.setApplyDelayReason(delayApply.getDelayApplyReason()); declaredProject.setApplyDelayReason(delayApply.getDelayApplyReason());
@@ -236,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);


Loading…
Cancel
Save