@@ -0,0 +1,73 @@ | |||
package com.ningdatech.pmapi.todocenter.handle; | |||
import cn.hutool.core.collection.CollUtil; | |||
import com.ningdatech.pmapi.todocenter.model.vo.ProcessProgressDetailVo; | |||
import lombok.AllArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.flowable.engine.RuntimeService; | |||
import org.flowable.engine.runtime.ActivityInstance; | |||
import org.springframework.stereotype.Component; | |||
import java.util.List; | |||
/** | |||
* @Classname PassHandle | |||
* @Description | |||
* @Date 2023/5/5 14:46 | |||
* @Author PoffyZhang | |||
*/ | |||
@Component | |||
@Slf4j | |||
@AllArgsConstructor | |||
public class PassHandle { | |||
private final RuntimeService runtimeService; | |||
/** | |||
* 判断节点类型 | |||
* @param instanceId | |||
* @param employeeCode | |||
* @return | |||
*/ | |||
public void checkCanPassOrSeal(String instanceId,String taskId,String employeeCode, ProcessProgressDetailVo res) { | |||
List<ActivityInstance> activities = runtimeService.createActivityInstanceQuery() | |||
.taskAssignee(employeeCode) | |||
.processInstanceId(instanceId) | |||
.unfinished() | |||
.orderByActivityInstanceStartTime() | |||
.asc() | |||
.list(); | |||
if(CollUtil.isEmpty(activities)){ | |||
res.setCanPass(Boolean.FALSE); | |||
res.setCanReject(Boolean.FALSE); | |||
res.setCanSeal(Boolean.FALSE); | |||
return; | |||
} | |||
for(ActivityInstance activity : activities){ | |||
if(StringUtils.isNotBlank(taskId)){ | |||
if(taskId.equals(activity.getTaskId())){ | |||
if(StringUtils.isNotBlank(activity.getActivityId())){ | |||
res.setCanReject(Boolean.TRUE); | |||
if(activity.getActivityId().startsWith("node")){ | |||
res.setCanPass(Boolean.TRUE); | |||
}else if(activity.getActivityId().startsWith("seal")){ | |||
res.setCanSeal(Boolean.TRUE); | |||
} | |||
} | |||
} | |||
} | |||
if(StringUtils.isNotBlank(activity.getActivityId())){ | |||
res.setCanReject(Boolean.TRUE); | |||
if(activity.getActivityId().startsWith("node")){ | |||
res.setCanPass(Boolean.TRUE); | |||
}else if(activity.getActivityId().startsWith("seal")){ | |||
res.setCanSeal(Boolean.TRUE); | |||
} | |||
} | |||
} | |||
} | |||
} |
@@ -13,6 +13,7 @@ import javax.servlet.http.HttpServletResponse; | |||
import cn.hutool.core.util.ObjectUtil; | |||
import com.ningdatech.pmapi.projectdeclared.manage.DeclaredProjectManage; | |||
import com.ningdatech.pmapi.todocenter.constant.TodoCenterContant; | |||
import com.ningdatech.pmapi.todocenter.handle.PassHandle; | |||
import com.ningdatech.pmapi.todocenter.handle.WithDrawHandle; | |||
import com.ningdatech.pmapi.todocenter.model.vo.TodoNumVO; | |||
import com.wflow.workflow.enums.ProcessHandlerEnum; | |||
@@ -141,6 +142,8 @@ public class TodoCenterManage { | |||
private final WithDrawHandle withDrawHandle; | |||
private final PassHandle passHandle; | |||
/** | |||
* 待办中心待我处理项目列表查询 | |||
* | |||
@@ -462,6 +465,7 @@ public class TodoCenterManage { | |||
* @return 流程进度及表单详情 | |||
*/ | |||
public ProcessProgressDetailVo getProcessDetail(ProcessDetailReq request) { | |||
String employeeCode = LoginUserUtil.loginUserDetail().getEmployeeCode(); | |||
String instanceId = request.getInstanceId(); | |||
String nodeId = request.getNodeId(); | |||
Long projectId = request.getProjectId(); | |||
@@ -480,6 +484,7 @@ public class TodoCenterManage { | |||
res.setStatus(progressInstanceDetail.getStatus()); | |||
res.setProjectId(projectId); | |||
res.setCanWithdraw(withDrawHandle.checkCanWithdraw(instanceId,progressInstanceDetail)); | |||
passHandle.checkCanPassOrSeal(request.getInstanceId(),request.getTaskId(),employeeCode,res); | |||
return res; | |||
} | |||
@@ -27,4 +27,7 @@ public class ProcessDetailReq { | |||
@ApiModelProperty("项目ID") | |||
private Long projectId; | |||
@ApiModelProperty("任务ID") | |||
private String taskId; | |||
} |
@@ -1,6 +1,7 @@ | |||
package com.ningdatech.pmapi.todocenter.model.vo; | |||
import com.wflow.workflow.bean.process.enums.NodeTypeEnum; | |||
import com.wflow.workflow.bean.vo.ProcessProgressVo; | |||
import lombok.AllArgsConstructor; | |||
@@ -33,5 +34,23 @@ public class ProcessProgressDetailVo { | |||
*/ | |||
private Long projectId; | |||
/** | |||
* 能否撤回 | |||
*/ | |||
private Boolean canWithdraw = Boolean.FALSE; | |||
/** | |||
* 能否通过 | |||
*/ | |||
private Boolean canPass = Boolean.FALSE; | |||
/** | |||
* 能否盖章 | |||
*/ | |||
private Boolean canSeal = Boolean.FALSE; | |||
/** | |||
* 能否驳回 | |||
*/ | |||
private Boolean canReject = Boolean.FALSE; | |||
} |