@@ -26,6 +26,10 @@ | |||
<groupId>org.projectlombok</groupId> | |||
<artifactId>lombok</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.assertj</groupId> | |||
<artifactId>assertj-core</artifactId> | |||
</dependency> | |||
<!-- mybatis plus--> | |||
<dependency> | |||
<groupId>com.baomidou</groupId> | |||
@@ -35,7 +35,8 @@ public enum ProjectProcessStageEnum { | |||
SELF_TEST(10, "系统自测审批流程"), | |||
ADAPTION(11, "适配改造审批流程"), | |||
TEST_VALID(12, "测试验证审批流程"), | |||
COMPLIANCE_REVIEW(13, "合规性审查"); | |||
COMPLIANCE_REVIEW(13, "合规性审查流程"), | |||
PROJECT_REVIEW(14, "项目评审流程"); | |||
private final Integer code; | |||
private final String desc; | |||
@@ -52,8 +53,12 @@ public enum ProjectProcessStageEnum { | |||
return StringUtils.EMPTY; | |||
} | |||
public static Optional<ProjectProcessStageEnum> get(Integer code) { | |||
private static Optional<ProjectProcessStageEnum> get(Integer code) { | |||
return Arrays.stream(values()).filter(w -> w.getCode().equals(code)).findFirst(); | |||
} | |||
public static ProjectProcessStageEnum getNoNull(Integer code) { | |||
return get(code).orElseThrow(() -> new IllegalArgumentException("流程实例类型")); | |||
} | |||
} |
@@ -1,11 +1,14 @@ | |||
package com.hz.pm.api.projectlib.model.enumeration; | |||
import com.ningdatech.basic.exception.BizException; | |||
import lombok.AllArgsConstructor; | |||
import lombok.Getter; | |||
import lombok.NoArgsConstructor; | |||
import org.apache.commons.lang3.StringUtils; | |||
import java.util.Arrays; | |||
import java.util.Objects; | |||
import java.util.Optional; | |||
/** | |||
* 实例类型枚举 | |||
@@ -34,33 +37,28 @@ public enum InstTypeEnum { | |||
SELF_TEST(10, "系统自测审批流程"), | |||
ADAPTION(11, "适配改造审批流程"), | |||
TEST_VALID(12, "测试验证审批流程"), | |||
COMPLIANCE_REVIEW(13, "合规性审查"); | |||
COMPLIANCE_REVIEW(13, "合规性审查流程"), | |||
PROJECT_REVIEW(14, "项目评审流程"); | |||
private Integer code; | |||
private String desc; | |||
public static String getDescByCode(Integer code) { | |||
if (Objects.isNull(code)) { | |||
return StringUtils.EMPTY; | |||
} | |||
for (InstTypeEnum t : InstTypeEnum.values()) { | |||
if (code.equals(t.getCode())) { | |||
return t.desc; | |||
} | |||
} | |||
return StringUtils.EMPTY; | |||
public static String getDesc(Integer code) { | |||
Optional<InstTypeEnum> instType = get(code); | |||
return instType.flatMap(w -> Optional.of(w.getDesc())).orElse(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; | |||
private static Optional<InstTypeEnum> get(Integer code) { | |||
return Arrays.stream(values()) | |||
.filter(w -> w.eq(code)) | |||
.findFirst(); | |||
} | |||
public static InstTypeEnum getNoNull(Integer code) { | |||
return Arrays.stream(values()) | |||
.filter(w -> w.eq(code)) | |||
.findFirst() | |||
.orElseThrow(() -> BizException.wrap("未找到对应的实例类型")); | |||
} | |||
public boolean eq(Integer code) { | |||
@@ -122,11 +122,7 @@ public class ProcessEndListener { | |||
String instanceId = newInstance.getId(); | |||
ProjectInst projectInst = projectInstService.getByInstCode(instanceId); | |||
Integer instType = projectInst.getInstType(); | |||
InstTypeEnum instTypeEnum = InstTypeEnum.getByCode(instType); | |||
if (Objects.isNull(instTypeEnum)) { | |||
throw BizException.wrap("当前审批流类型不存在,流程类型code:" + instType); | |||
} | |||
InstTypeEnum instTypeEnum = InstTypeEnum.getNoNull(instType); | |||
// 获取流程通过后当前流程详情 | |||
ProcessProgressVo newInstDetail = processInstanceService.getProgressInstanceDetail(null, instance.getId()); | |||
// 获取流程通过后当前审核人信息,向其发送工作通知 | |||
@@ -1,6 +1,7 @@ | |||
package com.hz.pm.api.scheduler.listener; | |||
import cn.hutool.core.text.CharSequenceUtil; | |||
import cn.hutool.core.util.StrUtil; | |||
import cn.hutool.extra.spring.SpringUtil; | |||
import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; | |||
import com.hz.pm.api.common.helper.UserInfoHelper; | |||
@@ -33,7 +34,6 @@ import org.springframework.stereotype.Component; | |||
import java.time.Instant; | |||
import java.util.List; | |||
import java.util.Optional; | |||
import java.util.Set; | |||
/** | |||
@@ -69,10 +69,10 @@ public class TaskCreatedListener implements FlowableEventListener { | |||
String procDefId = entityEvent.getProcessDefinitionId(); | |||
String procInstId = entityEvent.getProcessInstanceId(); | |||
WflowModelHistorys models = processModelHistorysService.getByProcessDefId(procDefId); | |||
Optional<ProjectProcessStageEnum> procType = ProjectProcessStageEnum.get(models.getProcessType()); | |||
ProjectProcessStageEnum procType = ProjectProcessStageEnum.getNoNull(models.getProcessType()); | |||
TaskEntity taskEntity = (TaskEntity) entityEvent.getEntity(); | |||
UserFullInfoDTO assignee = userInfoHelper.getUserFullInfo(taskEntity.getAssignee()); | |||
if (assignee == null || CharSequenceUtil.isBlank(assignee.getMhUserId())) { | |||
if (assignee == null || StrUtil.isBlank(assignee.getMhUserId())) { | |||
return; | |||
} | |||
ProjectInst projectInst = projectInstService.getByInstCode(procInstId); | |||
@@ -80,18 +80,14 @@ public class TaskCreatedListener implements FlowableEventListener { | |||
return; | |||
} | |||
Project project = projectService.getById(projectInst.getProjectId()); | |||
if (!procType.isPresent()) { | |||
return; | |||
} | |||
ProjectProcessStageEnum processStage = procType.get(); | |||
switch (processStage) { | |||
switch (procType) { | |||
case XC_APPROVAL_PROCESS: | |||
case PROJECT_RECORD_APPROVAL_PROCESS: | |||
case ACCEPTANCE_DECLARATION_APPROVAL_PROCESS: | |||
// 发送信产平台待办 | |||
MHTodoTypeEnum todoType = getMhTodoTypeEnum(procType.get()); | |||
MHTodoTypeEnum todoType = getMhTodoTypeEnum(procType); | |||
String content = String.format("【%s】的【%s】需要您审核,请及时处理。", | |||
project.getProjectName(), procType.get().getDesc()); | |||
project.getProjectName(), procType.getDesc()); | |||
MhTodoExtraParamDTO paramObj = MhTodoExtraParamDTO.builder() | |||
.projectId(project.getId()) | |||
.taskId(taskEntity.getId()) | |||
@@ -101,8 +97,8 @@ public class TaskCreatedListener implements FlowableEventListener { | |||
.userName(assignee.getRealName()) | |||
.path("/toDoCenter/handleDuringExamine") | |||
.build(); | |||
if (processStage.equals(ProjectProcessStageEnum.ACCEPTANCE_DECLARATION_APPROVAL_PROCESS) | |||
|| processStage.equals(ProjectProcessStageEnum.XC_APPROVAL_PROCESS)) { | |||
if (procType.equals(ProjectProcessStageEnum.ACCEPTANCE_DECLARATION_APPROVAL_PROCESS) | |||
|| procType.equals(ProjectProcessStageEnum.XC_APPROVAL_PROCESS)) { | |||
PurchaseInst purchaseInst = purchaseInstService.getByProjectIdAndInstCode(paramObj.getProjectId(), procInstId); | |||
if (purchaseInst == null) { | |||
return; | |||
@@ -127,19 +123,16 @@ public class TaskCreatedListener implements FlowableEventListener { | |||
FlowableEngineEntityEvent entityEvent = (FlowableEngineEntityEvent) event; | |||
String procDefId = entityEvent.getProcessDefinitionId(); | |||
WflowModelHistorys models = processModelHistorysService.getByProcessDefId(procDefId); | |||
Optional<ProjectProcessStageEnum> procType = ProjectProcessStageEnum.get(models.getProcessType()); | |||
if (!procType.isPresent()) { | |||
return; | |||
} | |||
ProjectProcessStageEnum procType = ProjectProcessStageEnum.getNoNull(models.getProcessType()); | |||
TaskEntity taskEntity = (TaskEntity) entityEvent.getEntity(); | |||
WflowHelper wflowHelper = SpringUtil.getBean(WflowHelper.class); | |||
String taskDefKey = taskEntity.getTaskDefinitionKey(); | |||
boolean orUserTask = wflowHelper.isOrUserTask(procDefId, taskDefKey); | |||
switch (procType.get()) { | |||
switch (procType) { | |||
case XC_APPROVAL_PROCESS: | |||
case PROJECT_RECORD_APPROVAL_PROCESS: | |||
case ACCEPTANCE_DECLARATION_APPROVAL_PROCESS: | |||
MHTodoTypeEnum todoType = getMhTodoTypeEnum(procType.get()); | |||
MHTodoTypeEnum todoType = getMhTodoTypeEnum(procType); | |||
if (orUserTask) { | |||
List<HistoricTaskInstance> tasks = wflowHelper.listFinishedTasks(taskDefKey); | |||
Set<String> taskIds = CollUtils.fieldSet(tasks, HistoricTaskInstance::getId); | |||
@@ -68,13 +68,13 @@ public class EarlyWarningManage { | |||
case PROCESS_WARNING: | |||
if (Objects.isNull(noticeType)) { | |||
content = convertContent(noticeContent, project.getProjectName(), | |||
InstTypeEnum.getByCode(biz), overTimeout); | |||
InstTypeEnum.getNoNull(biz), overTimeout); | |||
} else if (noticeType.equals(WarningNoticeTypeEnum.ADVENT.getCode())) { | |||
content = convertAdventContent(noticeContent, project.getProjectName(), | |||
InstTypeEnum.getByCode(biz), adventTimeout, overTimeout); | |||
InstTypeEnum.getNoNull(biz), adventTimeout, overTimeout); | |||
} else { | |||
content = convertContent(noticeContent, project.getProjectName(), | |||
InstTypeEnum.getByCode(biz), overTimeout); | |||
InstTypeEnum.getNoNull(biz), overTimeout); | |||
} | |||
records.setRuleType(WarningRuleTypeEnum.PROCESS_WARNING.getCode()); | |||
break; | |||
@@ -181,13 +181,13 @@ public class EarlyWarningManage { | |||
records = new WflowEarlyWarningRecords(); | |||
if (Objects.isNull(noticeType)) { | |||
content = convertContent(noticeContent, project.getProjectName(), | |||
InstTypeEnum.getByCode(biz), overTimeout); | |||
InstTypeEnum.getNoNull(biz), overTimeout); | |||
} else if (noticeType.equals(WarningNoticeTypeEnum.ADVENT.getCode())) { | |||
content = convertAdventContent(noticeContent, project.getProjectName(), | |||
InstTypeEnum.getByCode(biz), adventTimeout, overTimeout); | |||
InstTypeEnum.getNoNull(biz), adventTimeout, overTimeout); | |||
} else { | |||
content = convertContent(noticeContent, project.getProjectName(), | |||
InstTypeEnum.getByCode(biz), overTimeout); | |||
InstTypeEnum.getNoNull(biz), overTimeout); | |||
} | |||
records.setRuleType(WarningRuleTypeEnum.PROCESS_WARNING.getCode()); | |||
break; | |||
@@ -86,8 +86,8 @@ public class ProcessStatisticsManage { | |||
} | |||
HashSet<String> instCodes = new HashSet<>(); | |||
Map<InstTypeEnum, List<String>> mapByInstType = projectInsts.stream() | |||
.filter(w -> InstTypeEnum.getByCode(w.getInstType()) != null) | |||
.collect(Collectors.groupingBy(w -> InstTypeEnum.getByCode(w.getInstType()), | |||
.filter(w -> InstTypeEnum.getNoNull(w.getInstType()) != null) | |||
.collect(Collectors.groupingBy(w -> InstTypeEnum.getNoNull(w.getInstType()), | |||
Collectors.mapping(w -> { | |||
instCodes.add(w.getInstCode()); | |||
return w.getInstCode(); | |||
@@ -11,6 +11,7 @@ import lombok.NoArgsConstructor; | |||
import lombok.ToString; | |||
import lombok.experimental.Accessors; | |||
import org.apache.commons.lang3.StringUtils; | |||
import java.io.Serializable; | |||
import java.time.LocalDateTime; | |||
import java.util.Objects; | |||
@@ -19,6 +20,7 @@ import java.util.Objects; | |||
* 实体类 | |||
* 角色分配 | |||
* 预警触发通知记录 | |||
* | |||
* @author PoffyZhang | |||
*/ | |||
@Data | |||
@@ -123,21 +125,18 @@ public class WflowEarlyWarningRecordsVO implements Serializable { | |||
@ApiModelProperty(value = "临期时要记录下 超期的时间") | |||
private Integer overTime; | |||
public String getInstTypeName(){ | |||
if(Objects.nonNull(this.instType) && Objects.nonNull(this.ruleType)){ | |||
if(this.ruleType.equals(WarningRuleTypeEnum.PROCESS_WARNING.getCode())){ | |||
InstTypeEnum instEnum = InstTypeEnum.getByCode(this.instType); | |||
if(Objects.nonNull(instEnum)){ | |||
return instEnum.getDesc(); | |||
} | |||
}else if(this.ruleType.equals(WarningRuleTypeEnum.DECLARED_WARNING.getCode())){ | |||
public String getInstTypeName() { | |||
if (Objects.nonNull(this.instType) && Objects.nonNull(this.ruleType)) { | |||
if (this.ruleType.equals(WarningRuleTypeEnum.PROCESS_WARNING.getCode())) { | |||
return InstTypeEnum.getDesc(this.instType); | |||
} else if (this.ruleType.equals(WarningRuleTypeEnum.DECLARED_WARNING.getCode())) { | |||
WarningFlowTypeEnum warningFlowTypeEnum = WarningFlowTypeEnum.getByCode(this.instType); | |||
if(Objects.nonNull(warningFlowTypeEnum)){ | |||
if (Objects.nonNull(warningFlowTypeEnum)) { | |||
return warningFlowTypeEnum.getDesc(); | |||
} | |||
}else if(this.ruleType.equals(WarningRuleTypeEnum.OPERATION_WARNING.getCode())){ | |||
} else if (this.ruleType.equals(WarningRuleTypeEnum.OPERATION_WARNING.getCode())) { | |||
WarningOperationTypeEnum operationTypeEnum = WarningOperationTypeEnum.getByCode(this.instType); | |||
if(Objects.nonNull(operationTypeEnum)){ | |||
if (Objects.nonNull(operationTypeEnum)) { | |||
return operationTypeEnum.getDesc(); | |||
} | |||
} | |||
@@ -145,10 +144,10 @@ public class WflowEarlyWarningRecordsVO implements Serializable { | |||
return StringUtils.EMPTY; | |||
} | |||
public String getRuleTypeName(){ | |||
if(Objects.nonNull(this.ruleType)){ | |||
public String getRuleTypeName() { | |||
if (Objects.nonNull(this.ruleType)) { | |||
WarningRuleTypeEnum warningEnum = WarningRuleTypeEnum.checkByCode(this.instType); | |||
if(Objects.nonNull(warningEnum)){ | |||
if (Objects.nonNull(warningEnum)) { | |||
return warningEnum.getDesc(); | |||
} | |||
} | |||
@@ -39,7 +39,6 @@ import com.hz.pm.api.projectlib.service.IProjectApplicationService; | |||
import com.hz.pm.api.projectlib.service.IProjectInstService; | |||
import com.hz.pm.api.projectlib.service.IProjectService; | |||
import com.hz.pm.api.staging.enums.MsgTypeEnum; | |||
import com.hz.pm.api.staging.service.IProjectStagingService; | |||
import com.hz.pm.api.sys.manage.NoticeManage; | |||
import com.hz.pm.api.todocenter.constant.TodoCenterConst; | |||
import com.hz.pm.api.user.util.LoginUserUtil; | |||
@@ -90,7 +89,6 @@ public class HandlerManage { | |||
private final ProjectStateMachineUtil projectStateMachineUtil; | |||
private final ProcessInstanceService processInstanceService; | |||
private final IProjectApplicationService projectApplicationService; | |||
private final IProjectStagingService projectStagingService; | |||
private final IProjectInstService projectInstService; | |||
private final NoticeManage noticeManage; | |||
private final DeclaredProjectManage declaredProjectManage; | |||
@@ -126,11 +124,7 @@ public class HandlerManage { | |||
String instanceId = newInstance.getId(); | |||
ProjectInst projectInst = projectInstService.getByInstCode(instanceId); | |||
Integer instType = projectInst.getInstType(); | |||
InstTypeEnum instTypeEnum = InstTypeEnum.getByCode(instType); | |||
if (Objects.isNull(instTypeEnum)) { | |||
throw new BizException("当前审批流类型不存在,流程类型code:" + instType); | |||
} | |||
InstTypeEnum instTypeEnum = InstTypeEnum.getNoNull(instType); | |||
// 获取流程通过后当前流程详情 | |||
ProcessProgressVo newInstDetail = processInstanceService.getProgressInstanceDetail(null, instance.getId()); | |||
// 获取流程通过后当前审核人信息,向其发送工作通知 | |||
@@ -190,16 +184,17 @@ public class HandlerManage { | |||
} else { | |||
ProjectStatus projectStatus = ProjectStatus.getNoNull(project.getStatus()); | |||
switch (projectStatus) { | |||
// 立项备案审批 | |||
// 立项备案审批 | |||
case DECLARED_APPROVED_RECORD_AUDITING: | |||
case ON_COMPLIANCE_REVIEW: | |||
case ON_PROJECT_REVIEW: | |||
updatePassProjectStatus(userId, project); | |||
break; | |||
case ON_PURCHASING: | |||
case TO_BE_FIRST_INSPECTED: | |||
case ON_PILOT_RUNNING: | |||
case ON_FINALLY_INSPECTED: | |||
ProjectProcessStageEnum processStage = ProjectProcessStageEnum.get(instTypeEnum.getCode()) | |||
.orElseThrow(() -> BizException.wrap("不支持的流程类型")); | |||
ProjectProcessStageEnum processStage = ProjectProcessStageEnum.getNoNull(instTypeEnum.getCode()); | |||
purchasePassedCallback(project, instanceId, processStage); | |||
break; | |||
default: | |||
@@ -382,8 +377,7 @@ public class HandlerManage { | |||
ProjectInst projectInst = projectInstService.getByInstCode(instanceId); | |||
Integer instType = projectInst.getInstType(); | |||
// 审批流程不是申请延期和申请借阅,需调用状态机 | |||
InstTypeEnum instTypeEnum = InstTypeEnum.getByCode(instType); | |||
Assert.notNull(instTypeEnum, "不支持的流程类型"); | |||
InstTypeEnum instTypeEnum = InstTypeEnum.getNoNull(instType); | |||
switch (instTypeEnum) { | |||
case APPLY_BORROW: | |||
case APPLY_DELAY: | |||
@@ -589,28 +583,4 @@ public class HandlerManage { | |||
} | |||
} | |||
/** | |||
* 判断是否包含 此任务 | |||
* | |||
* @param progressNodes \ | |||
* @param taskId \ | |||
* @return \ | |||
*/ | |||
public static boolean checkIsContainsTask(List<ProgressNode> progressNodes, String taskId) { | |||
if (CollUtil.isEmpty(progressNodes)) { | |||
return Boolean.FALSE; | |||
} | |||
for (ProgressNode node : progressNodes) { | |||
if (node.getTaskId().equals(taskId)) { | |||
return Boolean.TRUE; | |||
} | |||
if (CollUtil.isNotEmpty(node.getChildren()) && | |||
(checkIsContainsTask(node.getChildren(), taskId))) { | |||
return Boolean.TRUE; | |||
} | |||
} | |||
return Boolean.FALSE; | |||
} | |||
} |
@@ -57,6 +57,7 @@ import com.hz.pm.api.todocenter.model.vo.TodoNumVO; | |||
import com.hz.pm.api.todocenter.service.ITodoService; | |||
import com.hz.pm.api.todocenter.service.StatisticsService; | |||
import com.hz.pm.api.todocenter.utils.BuildUserUtils; | |||
import com.hz.pm.api.todocenter.utils.ProcessUtil; | |||
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; | |||
@@ -617,8 +618,7 @@ public class TodoCenterManage { | |||
if (userFullInfo != null && user.getMhUnitId().equals(userFullInfo.getMhUnitId())) { | |||
//说明是此单位的人 | |||
//那么要去看 taskId 是不是 在这个单位内的任务 | |||
boolean isContainsTask = HandlerManage.checkIsContainsTask(children, taskId); | |||
if (isContainsTask) { | |||
if (ProcessUtil.containsTask(children, taskId)) { | |||
res[0] = Boolean.TRUE; | |||
} | |||
} | |||
@@ -14,6 +14,7 @@ import com.hz.pm.api.todocenter.model.req.ProcessDetailReq; | |||
import com.hz.pm.api.todocenter.model.vo.ProcessProgressDetailVO; | |||
import com.hz.pm.api.todocenter.service.ITodoService; | |||
import com.hz.pm.api.todocenter.utils.BuildUserUtils; | |||
import com.hz.pm.api.todocenter.utils.ProcessUtil; | |||
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; | |||
@@ -30,10 +31,12 @@ import java.util.List; | |||
import java.util.Objects; | |||
/** | |||
* @Classname TodoService | |||
* @Description | |||
* @Date 2023/7/25 15:41 | |||
* @Author PoffyZhang | |||
* <p> | |||
* TodoServiceImpl | |||
* </p> | |||
* | |||
* @author WendyYang | |||
* @since 14:53 2024/4/16 | |||
*/ | |||
@Service | |||
@AllArgsConstructor | |||
@@ -41,17 +44,11 @@ import java.util.Objects; | |||
public class TodoServiceImpl implements ITodoService { | |||
private final ProcessInstanceService processInstanceService; | |||
private final BuildUserUtils buildUserUtils; | |||
private final UserInfoHelper userInfoHelper; | |||
private final WithDrawHandle withDrawHandle; | |||
private final PassHandle passHandle; | |||
private final IProjectService projectService; | |||
private final IProjectInstService projectInstService; | |||
/** | |||
@@ -104,32 +101,27 @@ public class TodoServiceImpl implements ITodoService { | |||
return Boolean.FALSE; | |||
} | |||
final Boolean[] res = {Boolean.FALSE}; | |||
progressInfo.forEach(p -> { | |||
boolean state = Boolean.FALSE; | |||
for (ProgressNode p : progressInfo) { | |||
//如果是 子流程 | |||
if (Objects.nonNull(p.getNodeType()) && NodeTypeEnum.SUB.name().equals(p.getNodeType().name())) { | |||
//如果不是上级条线单位 根本不用理 | |||
if (Boolean.FALSE.equals(p.getIsHighLine())) { | |||
return; | |||
} | |||
if (Objects.nonNull(p.getNodeType()) | |||
&& NodeTypeEnum.SUB.name().equals(p.getNodeType().name()) | |||
&& (Boolean.TRUE.equals(p.getIsHighLine()))) { | |||
List<ProgressNode> children = p.getChildren(); | |||
ProgressNode progressNode = children.get(0); | |||
String userId = progressNode.getUserId(); | |||
if (StringUtils.isBlank(userId)) { | |||
return; | |||
} | |||
UserFullInfoDTO currUser = userInfoHelper.getUserFullInfo(userId); | |||
if (Objects.nonNull(currUser) && user.getMhUnitId().equals(currUser.getMhUnitId())) { | |||
//说明是此单位的人 | |||
//那么要去看 taskId 是不是 在这个单位内的任务 | |||
boolean isContainsTask = HandlerManage.checkIsContainsTask(children, taskId); | |||
if (isContainsTask) { | |||
res[0] = Boolean.TRUE; | |||
if (StringUtils.isNotBlank(userId)) { | |||
UserFullInfoDTO currUser = userInfoHelper.getUserFullInfo(userId); | |||
if (Objects.nonNull(currUser) | |||
&& user.getMhUnitId().equals(currUser.getMhUnitId()) | |||
&& (ProcessUtil.containsTask(children, taskId))) { | |||
state = Boolean.TRUE; | |||
break; | |||
} | |||
} | |||
} | |||
}); | |||
return res[0]; | |||
} | |||
return state; | |||
} | |||
/** | |||
@@ -0,0 +1,46 @@ | |||
package com.hz.pm.api.todocenter.utils; | |||
import cn.hutool.core.collection.CollUtil; | |||
import com.wflow.workflow.bean.process.ProgressNode; | |||
import java.util.List; | |||
/** | |||
* <p> | |||
* ProcessUtil | |||
* </p> | |||
* | |||
* @author WendyYang | |||
* @since 14:45 2024/4/16 | |||
*/ | |||
public class ProcessUtil { | |||
private ProcessUtil() { | |||
} | |||
/** | |||
* 判断是否包含 此任务 | |||
* | |||
* @param nodes \ | |||
* @param taskId \ | |||
* @return \ | |||
*/ | |||
public static boolean containsTask(List<ProgressNode> nodes, String taskId) { | |||
if (CollUtil.isEmpty(nodes)) { | |||
return Boolean.FALSE; | |||
} | |||
for (ProgressNode node : nodes) { | |||
if (node.getTaskId().equals(taskId)) { | |||
return Boolean.TRUE; | |||
} | |||
if (CollUtil.isNotEmpty(node.getChildren()) && | |||
(containsTask(node.getChildren(), taskId))) { | |||
return Boolean.TRUE; | |||
} | |||
} | |||
return Boolean.FALSE; | |||
} | |||
} |