diff --git a/src/main/java/neatlogic/framework/process/constvalue/ProcessTaskOperationType.java b/src/main/java/neatlogic/framework/process/constvalue/ProcessTaskOperationType.java index 85dfbade788033fd70cf106bd7d707e31da458e5..5c03df82faa5d0cc9f8e39fb217b585624c389e4 100644 --- a/src/main/java/neatlogic/framework/process/constvalue/ProcessTaskOperationType.java +++ b/src/main/java/neatlogic/framework/process/constvalue/ProcessTaskOperationType.java @@ -2,6 +2,8 @@ package neatlogic.framework.process.constvalue; import neatlogic.framework.common.constvalue.GroupSearch; import neatlogic.framework.common.constvalue.UserType; +import neatlogic.framework.process.operationauth.core.IOperationType; +import neatlogic.framework.process.operationauth.core.OperationAuthHandlerType; import java.util.Arrays; import java.util.List; @@ -117,6 +119,11 @@ public enum ProcessTaskOperationType implements IOperationType { return text; } + @Override + public OperationAuthHandlerType getOperationAuthHandlerType() { + return OperationAuthHandlerType.TASK; + } + public List getDefaultValue() { return defaultValue; } diff --git a/src/main/java/neatlogic/framework/process/constvalue/ProcessTaskStepOperationType.java b/src/main/java/neatlogic/framework/process/constvalue/ProcessTaskStepOperationType.java index 923a825290f3ad1b11740fe81f02b742b0adf43e..837b1f57dbd5a33921465824758eafa106e20ff0 100644 --- a/src/main/java/neatlogic/framework/process/constvalue/ProcessTaskStepOperationType.java +++ b/src/main/java/neatlogic/framework/process/constvalue/ProcessTaskStepOperationType.java @@ -2,6 +2,7 @@ package neatlogic.framework.process.constvalue; import neatlogic.framework.common.constvalue.GroupSearch; import neatlogic.framework.common.constvalue.UserType; +import neatlogic.framework.process.operationauth.core.IOperationType; import neatlogic.framework.process.operationauth.core.OperationAuthHandlerType; import java.util.Arrays; diff --git a/src/main/java/neatlogic/framework/process/crossover/IProcessStepHandlerCrossoverUtil.java b/src/main/java/neatlogic/framework/process/crossover/IProcessStepHandlerCrossoverUtil.java index 7f237ac141c40ec4e6f30b30d2e95458f4019aec..0d0a0244bb4e47ef3fc08328bb6155c71d2ab561 100644 --- a/src/main/java/neatlogic/framework/process/crossover/IProcessStepHandlerCrossoverUtil.java +++ b/src/main/java/neatlogic/framework/process/crossover/IProcessStepHandlerCrossoverUtil.java @@ -20,7 +20,7 @@ package neatlogic.framework.process.crossover; import neatlogic.framework.crossover.ICrossoverService; import neatlogic.framework.notify.core.INotifyTriggerType; import neatlogic.framework.process.audithandler.core.IProcessTaskAuditType; -import neatlogic.framework.process.constvalue.ProcessTaskOperationType; +import neatlogic.framework.process.operationauth.core.IOperationType; import neatlogic.framework.process.dto.ProcessTaskStepVo; import neatlogic.framework.process.dto.ProcessTaskVo; import neatlogic.framework.process.stepremind.core.IProcessTaskStepRemindType; @@ -69,7 +69,7 @@ public interface IProcessStepHandlerCrossoverUtil extends ICrossoverService { * @Params:[currentProcessTaskStepVo, action] * @Returns:void **/ - void timeAudit(ProcessTaskStepVo currentProcessTaskStepVo, ProcessTaskOperationType action); + void timeAudit(ProcessTaskStepVo currentProcessTaskStepVo, IOperationType action); /** * @Description: 记录操作活动 @@ -114,14 +114,14 @@ public interface IProcessStepHandlerCrossoverUtil extends ICrossoverService { * @Params:[currentProcessTaskStepVo, action] * @Returns:void **/ - void saveContentAndFile(ProcessTaskStepVo currentProcessTaskStepVo, ProcessTaskOperationType action); + void saveContentAndFile(ProcessTaskStepVo currentProcessTaskStepVo, IOperationType action); /** * 保存工单级别的操作描述内容 * @param currentProcessTaskVo * @param action */ - void saveProcessTaskOperationContent(ProcessTaskVo currentProcessTaskVo, ProcessTaskOperationType action); + void saveProcessTaskOperationContent(ProcessTaskVo currentProcessTaskVo, IOperationType action); /** * 流转操作时检查回复信息是否必填 diff --git a/src/main/java/neatlogic/framework/process/exception/operationauth/ProcessTaskAutomaticHandlerNotEnableOperateException.java b/src/main/java/neatlogic/framework/process/exception/operationauth/ProcessTaskAutomaticHandlerNotEnableOperateException.java index 28d0ced1ebec08cc9650d8250ed5048cc928c8fb..398f5df67c79f32416d37c33afa6669b22913d75 100644 --- a/src/main/java/neatlogic/framework/process/exception/operationauth/ProcessTaskAutomaticHandlerNotEnableOperateException.java +++ b/src/main/java/neatlogic/framework/process/exception/operationauth/ProcessTaskAutomaticHandlerNotEnableOperateException.java @@ -15,7 +15,7 @@ along with this program. If not, see .*/ package neatlogic.framework.process.exception.operationauth; -import neatlogic.framework.process.constvalue.ProcessTaskOperationType; +import neatlogic.framework.process.operationauth.core.IOperationType; /** * @author linbq @@ -24,7 +24,7 @@ import neatlogic.framework.process.constvalue.ProcessTaskOperationType; public class ProcessTaskAutomaticHandlerNotEnableOperateException extends ProcessTaskPermissionDeniedException { private static final long serialVersionUID = 9216337410118158664L; - public ProcessTaskAutomaticHandlerNotEnableOperateException(ProcessTaskOperationType operationType) { + public ProcessTaskAutomaticHandlerNotEnableOperateException(IOperationType operationType) { super("外部调用节点不支持“{0}”操作", operationType.getText()); } } diff --git a/src/main/java/neatlogic/framework/process/exception/operationauth/ProcessTaskOperationUnauthorizedException.java b/src/main/java/neatlogic/framework/process/exception/operationauth/ProcessTaskOperationUnauthorizedException.java index ba9fe9fdb12ff2d7063cbfad332aff72eeea05d4..b21eacb078309e7b481d032698daefee719675d7 100644 --- a/src/main/java/neatlogic/framework/process/exception/operationauth/ProcessTaskOperationUnauthorizedException.java +++ b/src/main/java/neatlogic/framework/process/exception/operationauth/ProcessTaskOperationUnauthorizedException.java @@ -15,7 +15,7 @@ along with this program. If not, see .*/ package neatlogic.framework.process.exception.operationauth; -import neatlogic.framework.process.constvalue.ProcessTaskOperationType; +import neatlogic.framework.process.operationauth.core.IOperationType; /** * @author linbq @@ -24,7 +24,7 @@ import neatlogic.framework.process.constvalue.ProcessTaskOperationType; public class ProcessTaskOperationUnauthorizedException extends ProcessTaskPermissionDeniedException { private static final long serialVersionUID = 9216337410118158639L; - public ProcessTaskOperationUnauthorizedException(ProcessTaskOperationType operationType) { + public ProcessTaskOperationUnauthorizedException(IOperationType operationType) { super("您的“{0}”操作未获得授权", operationType.getText()); } } diff --git a/src/main/java/neatlogic/framework/process/exception/operationauth/ProcessTaskTimerHandlerNotEnableOperateException.java b/src/main/java/neatlogic/framework/process/exception/operationauth/ProcessTaskTimerHandlerNotEnableOperateException.java index 82518604aa1cdb33fbfbefd5b1221e3a0e38eafe..088488402b05e0ce77ef6d0a8780199e4c0793b5 100644 --- a/src/main/java/neatlogic/framework/process/exception/operationauth/ProcessTaskTimerHandlerNotEnableOperateException.java +++ b/src/main/java/neatlogic/framework/process/exception/operationauth/ProcessTaskTimerHandlerNotEnableOperateException.java @@ -15,7 +15,7 @@ along with this program. If not, see .*/ package neatlogic.framework.process.exception.operationauth; -import neatlogic.framework.process.constvalue.ProcessTaskOperationType; +import neatlogic.framework.process.operationauth.core.IOperationType; /** * @author linbq @@ -24,7 +24,7 @@ import neatlogic.framework.process.constvalue.ProcessTaskOperationType; public class ProcessTaskTimerHandlerNotEnableOperateException extends ProcessTaskPermissionDeniedException { private static final long serialVersionUID = 9216337410118158663L; - public ProcessTaskTimerHandlerNotEnableOperateException(ProcessTaskOperationType operationType) { + public ProcessTaskTimerHandlerNotEnableOperateException(IOperationType operationType) { super("定时节点不支持“{0}”操作", operationType.getText()); } } diff --git a/src/main/java/neatlogic/framework/process/operationauth/core/IOperationAuthHandler.java b/src/main/java/neatlogic/framework/process/operationauth/core/IOperationAuthHandler.java index 1f9afcf32138ca80f35a8910528f9c63e92fbb92..19383b213a6c95b91dcfa7d87eed0caa2d925a7c 100644 --- a/src/main/java/neatlogic/framework/process/operationauth/core/IOperationAuthHandler.java +++ b/src/main/java/neatlogic/framework/process/operationauth/core/IOperationAuthHandler.java @@ -1,14 +1,13 @@ package neatlogic.framework.process.operationauth.core; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import neatlogic.framework.process.constvalue.ProcessTaskOperationType; +import com.alibaba.fastjson.JSONObject; import neatlogic.framework.process.dto.ProcessTaskStepVo; import neatlogic.framework.process.dto.ProcessTaskVo; import neatlogic.framework.process.exception.operationauth.ProcessTaskPermissionDeniedException; -import com.alibaba.fastjson.JSONObject; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; public interface IOperationAuthHandler { /** @@ -17,14 +16,14 @@ public interface IOperationAuthHandler { * @Description: 保存权限类型和该权限的判断逻辑 * @return Map> */ - Map>, JSONObject>> + Map>, JSONObject>> getOperationBiPredicateMap(); String getHandler(); default Boolean getOperateMap(ProcessTaskVo processTaskVo, String userUuid, - ProcessTaskOperationType operationType, - Map> operationTypePermissionDeniedExceptionMap, + IOperationType operationType, + Map> operationTypePermissionDeniedExceptionMap, JSONObject extraParam ) { return getOperateMap(processTaskVo, null, userUuid, operationType, operationTypePermissionDeniedExceptionMap, extraParam); @@ -41,11 +40,11 @@ public interface IOperationAuthHandler { default Boolean getOperateMap(ProcessTaskVo processTaskVo, ProcessTaskStepVo processTaskStepVo, String userUuid, - ProcessTaskOperationType operationType, - Map> operationTypePermissionDeniedExceptionMap, + IOperationType operationType, + Map> operationTypePermissionDeniedExceptionMap, JSONObject extraParam ) { - TernaryPredicate>, JSONObject> predicate = + TernaryPredicate>, JSONObject> predicate = getOperationBiPredicateMap().get(operationType); if (predicate != null) { return predicate.test(processTaskVo, processTaskStepVo, userUuid, operationTypePermissionDeniedExceptionMap, extraParam); @@ -59,7 +58,7 @@ public interface IOperationAuthHandler { * @Description: 返回当前handler能判断的权限列表 * @return List */ - default List getAllOperationTypeList() { + default List getAllOperationTypeList() { return new ArrayList<>(getOperationBiPredicateMap().keySet()); } } diff --git a/src/main/java/neatlogic/framework/process/operationauth/core/IOperationAuthHandlerType.java b/src/main/java/neatlogic/framework/process/operationauth/core/IOperationAuthHandlerType.java index a4e1c9589bc7956804753d71aea74a8c84ad6e54..dd1d53ef9cf2ab2fb165f491f831a6a2b820cf65 100755 --- a/src/main/java/neatlogic/framework/process/operationauth/core/IOperationAuthHandlerType.java +++ b/src/main/java/neatlogic/framework/process/operationauth/core/IOperationAuthHandlerType.java @@ -2,12 +2,10 @@ package neatlogic.framework.process.operationauth.core; import java.util.List; -import neatlogic.framework.process.constvalue.ProcessTaskOperationType; - public interface IOperationAuthHandlerType { public String getValue(); public String getText(); - default List getOperationTypeList() { + default List getOperationTypeList() { return OperationAuthHandlerFactory.getHandler(this.getValue()).getAllOperationTypeList(); } } diff --git a/src/main/java/neatlogic/framework/process/constvalue/IOperationType.java b/src/main/java/neatlogic/framework/process/operationauth/core/IOperationType.java old mode 100755 new mode 100644 similarity index 34% rename from src/main/java/neatlogic/framework/process/constvalue/IOperationType.java rename to src/main/java/neatlogic/framework/process/operationauth/core/IOperationType.java index 29cd2b68025ed27820af49a999f9b05be9384f5b..71a8b174dbb3c527f638807efb29c8f13e603257 --- a/src/main/java/neatlogic/framework/process/constvalue/IOperationType.java +++ b/src/main/java/neatlogic/framework/process/operationauth/core/IOperationType.java @@ -1,21 +1,21 @@ -/*Copyright (C) $today.year 深圳极向量科技有限公司 All Rights Reserved. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see .*/ - -package neatlogic.framework.process.constvalue; - -import neatlogic.framework.process.operationauth.core.OperationAuthHandlerType; +/* + * Copyright (C) 2024 深圳极向量科技有限公司 All Rights Reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package neatlogic.framework.process.operationauth.core; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/neatlogic/framework/process/operationauth/core/OperationAuthHandlerBase.java b/src/main/java/neatlogic/framework/process/operationauth/core/OperationAuthHandlerBase.java index 28d3b8612a241b5f527323b2669045f2410f5501..b59b7d1b51a826f202298a8812219a2dba79660a 100644 --- a/src/main/java/neatlogic/framework/process/operationauth/core/OperationAuthHandlerBase.java +++ b/src/main/java/neatlogic/framework/process/operationauth/core/OperationAuthHandlerBase.java @@ -224,7 +224,7 @@ public abstract class OperationAuthHandlerBase implements IOperationAuthHandler * @return boolean */ protected boolean checkOperationAuthIsConfigured(ProcessTaskVo processTaskVo, ProcessTaskStepVo processTaskStepVo, - ProcessTaskOperationType operationType, String userUuid) { + IOperationType operationType, String userUuid) { JSONArray authorityList = null; ISelectContentByHashCrossoverMapper selectContentByHashCrossoverMapper = CrossoverServiceFactory.getApi(ISelectContentByHashCrossoverMapper.class); String stepConfig = selectContentByHashCrossoverMapper.getProcessTaskStepConfigByHash(processTaskStepVo.getConfigHash()); @@ -262,8 +262,7 @@ public abstract class OperationAuthHandlerBase implements IOperationAuthHandler * @param userUuid 用户 * @return boolean */ - protected boolean checkOperationAuthIsConfigured(ProcessTaskVo processTaskVo, - ProcessTaskOperationType operationType, String userUuid) { + protected boolean checkOperationAuthIsConfigured(ProcessTaskVo processTaskVo, IOperationType operationType, String userUuid) { JSONArray authorityList = (JSONArray)JSONPath.read(processTaskVo.getConfig(), "process.processConfig.authorityList"); if (CollectionUtils.isNotEmpty(authorityList)) { @@ -272,8 +271,7 @@ public abstract class OperationAuthHandlerBase implements IOperationAuthHandler return false; } - private boolean checkOperationAuthIsConfigured(ProcessTaskVo processTaskVo, ProcessTaskStepVo processTaskStepVo, - ProcessTaskOperationType operationType, JSONArray authorityList, String userUuid) { + private boolean checkOperationAuthIsConfigured(ProcessTaskVo processTaskVo, ProcessTaskStepVo processTaskStepVo, IOperationType operationType, JSONArray authorityList, String userUuid) { for (int i = 0; i < authorityList.size(); i++) { JSONObject authorityObj = authorityList.getJSONObject(i); String action = authorityObj.getString("action"); @@ -409,7 +407,7 @@ public abstract class OperationAuthHandlerBase implements IOperationAuthHandler if (handler != null) { if (ProcessStepMode.MT == handler.getMode()) {// 手动处理节点 if (checkOperationAuthIsConfigured(processTaskVo, processTaskStepVo, - ProcessTaskOperationType.STEP_RETREAT, userUuid)) { + ProcessTaskStepOperationType.STEP_RETREAT, userUuid)) { return true; } } else {// 自动处理节点,继续找前置节点 diff --git a/src/main/java/neatlogic/framework/process/operationauth/core/ProcessAuthManager.java b/src/main/java/neatlogic/framework/process/operationauth/core/ProcessAuthManager.java index 9eed14735be780122455426d30eb23b088431248..f6f1ecab4e67ffde157ee4412a50c248bec4e88a 100644 --- a/src/main/java/neatlogic/framework/process/operationauth/core/ProcessAuthManager.java +++ b/src/main/java/neatlogic/framework/process/operationauth/core/ProcessAuthManager.java @@ -35,15 +35,15 @@ public class ProcessAuthManager { /** 工单id与步骤idList的键值对 **/ private Map> processTaskStepIdSetMap; /** 需要校验的权限列表 **/ - private Set operationTypeSet; + private Set operationTypeSet; /** 需要校验的某个工单或步骤的某个权限 **/ - private Map checkOperationTypeMap; + private Map checkOperationTypeMap; /** 缓存作用,保存授权给当前用户处理服务工单的用户列表 **/ private Map> channelUuidFromUserUuidListMap = new HashMap<>(); /** 缓存作用,保存当前用户授权列表 **/ private Map> processTaskAgentListMap = new HashMap<>(); /** 保存某个工单或步骤的某个权限检验时,导致失败的原因 **/ - private Map> operationTypePermissionDeniedExceptionMap = new HashMap<>(); + private Map> operationTypePermissionDeniedExceptionMap = new HashMap<>(); /** 保存额外参数 **/ private Map extraParamMap = new HashMap<>(); /** 需要校验的用户,如果不传,默认为当前用户 **/ @@ -51,7 +51,7 @@ public class ProcessAuthManager { public static class Builder { private Set processTaskIdSet = new HashSet<>(); private Set processTaskStepIdSet = new HashSet<>(); - private Set operationTypeSet = new HashSet<>(); + private Set operationTypeSet = new HashSet<>(); private String userUuid; public Builder() {} @@ -81,7 +81,7 @@ public class ProcessAuthManager { return this; } - public Builder addOperationType(ProcessTaskOperationType operationType) { + public Builder addOperationType(IOperationType operationType) { operationTypeSet.add(operationType); return this; } @@ -104,11 +104,11 @@ public class ProcessAuthManager { */ public static class TaskOperationChecker { private Long processTaskId; - private ProcessTaskOperationType operationType; + private IOperationType operationType; private JSONObject extraParam; private String userUuid; - public TaskOperationChecker(Long processTaskId, ProcessTaskOperationType operationType) { + public TaskOperationChecker(Long processTaskId, IOperationType operationType) { this.processTaskId = processTaskId; this.operationType = operationType; } @@ -138,11 +138,11 @@ public class ProcessAuthManager { */ public static class StepOperationChecker { private Long processTaskStepId; - private ProcessTaskOperationType operationType; + private IOperationType operationType; private JSONObject extraParam; private String userUuid; - public StepOperationChecker(Long processTaskStepId, ProcessTaskOperationType operationType) { + public StepOperationChecker(Long processTaskStepId, IOperationType operationType) { this.processTaskStepId = processTaskStepId; this.operationType = operationType; } @@ -196,11 +196,11 @@ public class ProcessAuthManager { * * @Time:2020年12月21日 * @Description: 返回多个工单及其步骤权限列表,返回值map中的key可能是工单id或步骤id,value就是其拥有的权限列表 - * @return Map> + * @return Map> */ - public Map> getOperateMap() { + public Map> getOperateMap() { // long startTime = System.currentTimeMillis(); - Map> resultMap = new HashMap<>(); + Map> resultMap = new HashMap<>(); if (CollectionUtils.isEmpty(processTaskIdSet) && CollectionUtils.isEmpty(processTaskStepIdSet)) { return resultMap; } @@ -290,18 +290,18 @@ public class ProcessAuthManager { * * @Time:2020年12月21日 * @Description: 返回一个工单及其步骤权限列表,返回值map中的key可能是工单id或步骤id,value就是其拥有的权限列表 - * @return Map> + * @return Map> */ - private Map> getOperateMap(ProcessTaskVo processTaskVo, String userUuid) { - Set taskOperationTypeSet = new HashSet<>(); - Set stepOperationTypeSet = new HashSet<>(); - List taskOperationTypeList = OperationAuthHandlerType.TASK.getOperationTypeList(); - List stepOperationTypeList = OperationAuthHandlerType.STEP.getOperationTypeList(); + private Map> getOperateMap(ProcessTaskVo processTaskVo, String userUuid) { + Set taskOperationTypeSet = new HashSet<>(); + Set stepOperationTypeSet = new HashSet<>(); + List taskOperationTypeList = OperationAuthHandlerType.TASK.getOperationTypeList(); + List stepOperationTypeList = OperationAuthHandlerType.STEP.getOperationTypeList(); if (CollectionUtils.isEmpty(operationTypeSet)) { taskOperationTypeSet.addAll(taskOperationTypeList); stepOperationTypeSet.addAll(stepOperationTypeList); } else { - for (ProcessTaskOperationType operationType : operationTypeSet) { + for (IOperationType operationType : operationTypeSet) { if (taskOperationTypeList.contains(operationType)) { taskOperationTypeSet.add(operationType); } else if (stepOperationTypeList.contains(operationType)) { @@ -309,13 +309,13 @@ public class ProcessAuthManager { } } } - Map> resultMap = new HashMap<>(); + Map> resultMap = new HashMap<>(); // String userUuid = UserContext.get().getUserUuid(true); JSONObject extraParam = extraParamMap.computeIfAbsent(processTaskVo.getId(), key -> new JSONObject()); if (CollectionUtils.isNotEmpty(taskOperationTypeSet)) { IOperationAuthHandler handler = OperationAuthHandlerFactory.getHandler(OperationAuthHandlerType.TASK.getValue()); - Set resultSet = new HashSet<>(); - for (ProcessTaskOperationType operationType : taskOperationTypeSet) { + Set resultSet = new HashSet<>(); + for (IOperationType operationType : taskOperationTypeSet) { boolean result = handler.getOperateMap(processTaskVo, userUuid, operationType, operationTypePermissionDeniedExceptionMap, extraParam); if (result) { resultSet.add(operationType); @@ -352,8 +352,8 @@ public class ProcessAuthManager { for (ProcessTaskStepVo processTaskStepVo : processTaskVo.getStepList()) { if (processTaskStepIdList.contains(processTaskStepVo.getId())) { extraParam = extraParamMap.computeIfAbsent(processTaskStepVo.getId(), key -> new JSONObject()); - Set resultSet = new HashSet<>(); - for (ProcessTaskOperationType operationType : stepOperationTypeSet) { + Set resultSet = new HashSet<>(); + for (IOperationType operationType : stepOperationTypeSet) { Boolean result = null; IOperationAuthHandler handler = OperationAuthHandlerFactory.getHandler(processTaskStepVo.getHandler()); if (handler != null) { @@ -458,8 +458,8 @@ public class ProcessAuthManager { */ public boolean check() { if (MapUtils.isNotEmpty(checkOperationTypeMap)) { - Map> resultMap = getOperateMap(); - for (Map.Entry entry : checkOperationTypeMap.entrySet()) { + Map> resultMap = getOperateMap(); + for (Map.Entry entry : checkOperationTypeMap.entrySet()) { return resultMap.computeIfAbsent(entry.getKey(), k -> new HashSet<>()).contains(entry.getValue()); } } @@ -473,8 +473,8 @@ public class ProcessAuthManager { */ public boolean checkAndNoPermissionThrowException() { if (!check()) { - for (Map.Entry entry : checkOperationTypeMap.entrySet()) { - Map map = operationTypePermissionDeniedExceptionMap.get(entry.getKey()); + for (Map.Entry entry : checkOperationTypeMap.entrySet()) { + Map map = operationTypePermissionDeniedExceptionMap.get(entry.getKey()); if (MapUtils.isNotEmpty(map)) { ProcessTaskPermissionDeniedException exception = map.get(entry.getValue()); if (exception != null) { @@ -493,8 +493,8 @@ public class ProcessAuthManager { * @param operationType 操作权限类型 * @return */ - public ProcessTaskPermissionDeniedException getProcessTaskPermissionDeniedException(Long id, ProcessTaskOperationType operationType) { - Map map = operationTypePermissionDeniedExceptionMap.get(id); + public ProcessTaskPermissionDeniedException getProcessTaskPermissionDeniedException(Long id, IOperationType operationType) { + Map map = operationTypePermissionDeniedExceptionMap.get(id); if (MapUtils.isNotEmpty(map)) { return map.get(operationType); } diff --git a/src/main/java/neatlogic/framework/process/stephandler/core/IProcessStepInternalHandler.java b/src/main/java/neatlogic/framework/process/stephandler/core/IProcessStepInternalHandler.java index a3c365170532bb34dc1f3dc8bd5d7f9eee0a013e..2fa7a8addf272a6a4f4bccc23662dfb93dcf1cb0 100644 --- a/src/main/java/neatlogic/framework/process/stephandler/core/IProcessStepInternalHandler.java +++ b/src/main/java/neatlogic/framework/process/stephandler/core/IProcessStepInternalHandler.java @@ -2,8 +2,8 @@ package neatlogic.framework.process.stephandler.core; import com.alibaba.fastjson.JSONObject; import neatlogic.framework.notify.core.INotifyPolicyHandler; +import neatlogic.framework.process.operationauth.core.IOperationType; import neatlogic.framework.process.constvalue.ProcessFlowDirection; -import neatlogic.framework.process.constvalue.ProcessTaskOperationType; import neatlogic.framework.process.dto.ProcessStepVo; import neatlogic.framework.process.dto.ProcessTaskStepDataVo; import neatlogic.framework.process.dto.ProcessTaskStepInOperationVo; @@ -90,7 +90,7 @@ public interface IProcessStepInternalHandler { /** * 返回步骤动作,校验时用 */ - default ProcessTaskOperationType[] getStepActions() { + default IOperationType[] getStepActions() { //TODO 加default只是为了不报错,重构完所有代码后删掉这个default函数 return null; } @@ -98,7 +98,7 @@ public interface IProcessStepInternalHandler { /** * 返回步骤按钮列表 */ - default ProcessTaskOperationType[] getStepButtons() { + default IOperationType[] getStepButtons() { //TODO 加default只是为了不报错,重构完所有代码后删掉这个default函数 return null; } diff --git a/src/main/java/neatlogic/framework/process/stephandler/core/IProcessTaskOperatePostProcessor.java b/src/main/java/neatlogic/framework/process/stephandler/core/IProcessTaskOperatePostProcessor.java index 1d957c26a2d2e6a77b1b5541332ca13a643b059b..b7e46407f6060d51877a5a95b25a497a72976b1b 100644 --- a/src/main/java/neatlogic/framework/process/stephandler/core/IProcessTaskOperatePostProcessor.java +++ b/src/main/java/neatlogic/framework/process/stephandler/core/IProcessTaskOperatePostProcessor.java @@ -17,7 +17,7 @@ package neatlogic.framework.process.stephandler.core; -import neatlogic.framework.process.constvalue.IOperationType; +import neatlogic.framework.process.operationauth.core.IOperationType; import neatlogic.framework.process.dto.ProcessTaskStepVo; /** diff --git a/src/main/java/neatlogic/framework/process/stephandler/core/ProcessStepHandlerBase.java b/src/main/java/neatlogic/framework/process/stephandler/core/ProcessStepHandlerBase.java index 561ee376cbb7c5785934375617fa91c8277fae6e..aec98e720669f0389e43a4fb5298355c9bf31d52 100644 --- a/src/main/java/neatlogic/framework/process/stephandler/core/ProcessStepHandlerBase.java +++ b/src/main/java/neatlogic/framework/process/stephandler/core/ProcessStepHandlerBase.java @@ -52,6 +52,7 @@ import neatlogic.framework.process.exception.processtaskserialnumberpolicy.Proce import neatlogic.framework.process.fulltextindex.ProcessFullTextIndexType; import neatlogic.framework.process.notify.constvalue.ProcessTaskNotifyTriggerType; import neatlogic.framework.process.notify.constvalue.ProcessTaskStepNotifyTriggerType; +import neatlogic.framework.process.operationauth.core.IOperationType; import neatlogic.framework.process.operationauth.core.ProcessAuthManager; import neatlogic.framework.process.processtaskserialnumberpolicy.core.IProcessTaskSerialNumberPolicyHandler; import neatlogic.framework.process.processtaskserialnumberpolicy.core.ProcessTaskSerialNumberPolicyHandlerFactory; @@ -268,11 +269,11 @@ public abstract class ProcessStepHandlerBase implements IProcessStepHandler { processStepUtilHandler.updateProcessTaskStepUserAndWorker(currentProcessTaskStepVo.getProcessTaskId(), currentProcessTaskStepVo.getId()); } currentProcessTaskStepVo.getParamObj().put("operateTime", new Date()); - ProcessTaskOperatePostProcessorFactory.invokePostProcessorsAfterProcessTaskStepOperate(currentProcessTaskStepVo, ProcessTaskOperationType.STEP_ACTIVE); + ProcessTaskOperatePostProcessorFactory.invokePostProcessorsAfterProcessTaskStepOperate(currentProcessTaskStepVo, ProcessTaskStepOperationType.STEP_ACTIVE); /* 写入时间审计 **/ - processStepHandlerCrossoverUtil.timeAudit(currentProcessTaskStepVo, ProcessTaskOperationType.STEP_ACTIVE); + processStepHandlerCrossoverUtil.timeAudit(currentProcessTaskStepVo, ProcessTaskStepOperationType.STEP_ACTIVE); if (currentProcessTaskStepVo.getStatus().equals(ProcessTaskStepStatus.RUNNING.getValue())) { - processStepHandlerCrossoverUtil.timeAudit(currentProcessTaskStepVo, ProcessTaskOperationType.STEP_START); + processStepHandlerCrossoverUtil.timeAudit(currentProcessTaskStepVo, ProcessTaskStepOperationType.STEP_START); processStepHandlerCrossoverUtil.notify(currentProcessTaskStepVo, ProcessTaskStepNotifyTriggerType.START); processStepHandlerCrossoverUtil.action(currentProcessTaskStepVo, ProcessTaskStepNotifyTriggerType.START); } @@ -295,7 +296,7 @@ public abstract class ProcessStepHandlerBase implements IProcessStepHandler { updateProcessTaskStepStatus(currentProcessTaskStepVo); /* 自动处理 **/ IProcessStepHandler handler = ProcessStepHandlerFactory.getHandler(this.getHandler()); - doNext(ProcessTaskOperationType.STEP_HANDLE, new ProcessStepThread(currentProcessTaskStepVo) { + doNext(ProcessTaskStepOperationType.STEP_HANDLE, new ProcessStepThread(currentProcessTaskStepVo) { @Override public void myExecute() { handler.handle(currentProcessTaskStepVo); @@ -689,9 +690,9 @@ public abstract class ProcessStepHandlerBase implements IProcessStepHandler { /* 如果步骤被标记为全部完成,则触发完成 **/ if (currentProcessTaskStepVo.getIsAllDone()) { /* 记录时间审计 **/ - processStepHandlerCrossoverUtil.timeAudit(currentProcessTaskStepVo, ProcessTaskOperationType.STEP_COMPLETE); + processStepHandlerCrossoverUtil.timeAudit(currentProcessTaskStepVo, ProcessTaskStepOperationType.STEP_COMPLETE); IProcessStepHandler handler = ProcessStepHandlerFactory.getHandler(this.getHandler()); - doNext(ProcessTaskOperationType.STEP_COMPLETE, new ProcessStepThread(currentProcessTaskStepVo) { + doNext(ProcessTaskStepOperationType.STEP_COMPLETE, new ProcessStepThread(currentProcessTaskStepVo) { @Override public void myExecute() { handler.complete(currentProcessTaskStepVo); @@ -720,9 +721,9 @@ public abstract class ProcessStepHandlerBase implements IProcessStepHandler { myHandle(currentProcessTaskStepVo); if (currentProcessTaskStepVo.getIsAllDone()) { /* 记录时间审计 **/ - processStepHandlerCrossoverUtil.timeAudit(currentProcessTaskStepVo, ProcessTaskOperationType.STEP_COMPLETE); + processStepHandlerCrossoverUtil.timeAudit(currentProcessTaskStepVo, ProcessTaskStepOperationType.STEP_COMPLETE); - doNext(ProcessTaskOperationType.STEP_COMPLETE, new ProcessStepThread(currentProcessTaskStepVo) { + doNext(ProcessTaskStepOperationType.STEP_COMPLETE, new ProcessStepThread(currentProcessTaskStepVo) { @Override public void myExecute() { handler.complete(currentProcessTaskStepVo); @@ -776,7 +777,7 @@ public abstract class ProcessStepHandlerBase implements IProcessStepHandler { processTaskCrossoverMapper.getProcessTaskLockById(currentProcessTaskStepVo.getProcessTaskId()); /* 检查处理人是否合法 **/ new ProcessAuthManager - .StepOperationChecker(currentProcessTaskStepVo.getId(), ProcessTaskOperationType.STEP_START) + .StepOperationChecker(currentProcessTaskStepVo.getId(), ProcessTaskStepOperationType.STEP_START) .build() .checkAndNoPermissionThrowException(); try { @@ -807,9 +808,9 @@ public abstract class ProcessStepHandlerBase implements IProcessStepHandler { processStepUtilHandler.updateProcessTaskStepUserAndWorker(currentProcessTaskStepVo.getProcessTaskId(), currentProcessTaskStepVo.getId()); currentProcessTaskStepVo.getParamObj().put("operateTime", new Date()); - ProcessTaskOperatePostProcessorFactory.invokePostProcessorsAfterProcessTaskStepOperate(currentProcessTaskStepVo, ProcessTaskOperationType.STEP_START); + ProcessTaskOperatePostProcessorFactory.invokePostProcessorsAfterProcessTaskStepOperate(currentProcessTaskStepVo, ProcessTaskStepOperationType.STEP_START); /* 写入时间审计 **/ - processStepHandlerCrossoverUtil.timeAudit(currentProcessTaskStepVo, ProcessTaskOperationType.STEP_START); + processStepHandlerCrossoverUtil.timeAudit(currentProcessTaskStepVo, ProcessTaskStepOperationType.STEP_START); /* 计算SLA **/ processStepHandlerCrossoverUtil.calculateSla(currentProcessTaskStepVo); @@ -857,13 +858,13 @@ public abstract class ProcessStepHandlerBase implements IProcessStepHandler { /* 锁定当前流程 **/ processTaskCrossoverMapper.getProcessTaskLockById(currentProcessTaskStepVo.getProcessTaskId()); ProcessTaskStepNotifyTriggerType notifyTriggerType = ProcessTaskStepNotifyTriggerType.SUCCEED; - ProcessTaskOperationType operationType = ProcessTaskOperationType.STEP_COMPLETE; + IOperationType operationType = ProcessTaskStepOperationType.STEP_COMPLETE; boolean canComplete = false; JSONObject paramObj = currentProcessTaskStepVo.getParamObj(); String action = paramObj.getString("action"); if (this.getMode().equals(ProcessStepMode.MT)) { - if (ProcessTaskOperationType.STEP_BACK.getValue().equals(action)) { - operationType = ProcessTaskOperationType.STEP_BACK; + if (ProcessTaskStepOperationType.STEP_BACK.getValue().equals(action)) { + operationType = ProcessTaskStepOperationType.STEP_BACK; notifyTriggerType = ProcessTaskStepNotifyTriggerType.BACK; } canComplete = new ProcessAuthManager @@ -909,7 +910,7 @@ public abstract class ProcessStepHandlerBase implements IProcessStepHandler { if (this.getMode().equals(ProcessStepMode.MT)) { myBeforeComplete(currentProcessTaskStepVo); - if (operationType == ProcessTaskOperationType.STEP_COMPLETE) { + if (operationType == ProcessTaskStepOperationType.STEP_COMPLETE) { String priorityUuid = paramObj.getString("priorityUuid"); if (StringUtils.isNotBlank(priorityUuid)) { processTaskCrossoverMapper.updateProcessTaskPriorityUuidById(currentProcessTaskStepVo.getProcessTaskId(), priorityUuid); @@ -978,7 +979,7 @@ public abstract class ProcessStepHandlerBase implements IProcessStepHandler { nextStep.setFromProcessTaskStepId(currentProcessTaskStepVo.getId()); nextStep.setStartProcessTaskStepId(currentProcessTaskStepVo.getStartProcessTaskStepId()); nextStep.setParallelActivateStepIdList(nextStepIdList); - ProcessTaskStepThread thread = new ProcessTaskStepThread(ProcessTaskOperationType.STEP_ACTIVE, nextStep, nextStepHandler.getMode()) { + ProcessTaskStepThread thread = new ProcessTaskStepThread(ProcessTaskStepOperationType.STEP_ACTIVE, nextStep, nextStepHandler.getMode()) { @Override protected void myExecute(ProcessTaskStepVo processTaskStepVo) { IProcessStepHandler processStepHandler = ProcessStepHandlerFactory.getHandler(processTaskStepVo.getHandler()); @@ -1025,7 +1026,7 @@ public abstract class ProcessStepHandlerBase implements IProcessStepHandler { awaitAdvanceStep.setFromProcessTaskStepId(currentProcessTaskStepVo.getId()); awaitAdvanceStep.setStartProcessTaskStepId(currentProcessTaskStepVo.getStartProcessTaskStepId()); awaitAdvanceStep.setParallelActivateStepIdList(new ArrayList<>()); - ProcessTaskStepThread thread = new ProcessTaskStepThread(ProcessTaskOperationType.STEP_ACTIVE, awaitAdvanceStep, awaitAdvanceStepHandler.getMode()) { + ProcessTaskStepThread thread = new ProcessTaskStepThread(ProcessTaskStepOperationType.STEP_ACTIVE, awaitAdvanceStep, awaitAdvanceStepHandler.getMode()) { @Override protected void myExecute(ProcessTaskStepVo processTaskStepVo) { IProcessStepHandler processStepHandler = ProcessStepHandlerFactory.getHandler(processTaskStepVo.getHandler()); @@ -1049,7 +1050,7 @@ public abstract class ProcessStepHandlerBase implements IProcessStepHandler { /* 回退提醒 **/ processTaskCrossoverMapper.deleteProcessTaskStepRemind(new ProcessTaskStepRemindVo(currentProcessTaskStepVo.getId())); if (this.getMode().equals(ProcessStepMode.MT)) { - if (ProcessTaskOperationType.STEP_BACK.getValue().equals(action)) { + if (ProcessTaskStepOperationType.STEP_BACK.getValue().equals(action)) { // processTaskMapper.deleteProcessTaskStepRemind(new ProcessTaskStepRemindVo(currentProcessTaskStepVo.getId())); processStepHandlerCrossoverUtil.saveStepRemind(currentProcessTaskStepVo, paramObj.getLong("nextStepId"), paramObj.getString("content"), ProcessTaskStepRemindType.BACK); } @@ -1186,7 +1187,7 @@ public abstract class ProcessStepHandlerBase implements IProcessStepHandler { IProcessTaskCrossoverMapper processTaskCrossoverMapper = CrossoverServiceFactory.getApi(IProcessTaskCrossoverMapper.class); processTaskCrossoverMapper.getProcessTaskLockById(currentProcessTaskStepVo.getProcessTaskId()); new ProcessAuthManager - .StepOperationChecker(currentProcessTaskStepVo.getId(), ProcessTaskOperationType.STEP_REAPPROVAL) + .StepOperationChecker(currentProcessTaskStepVo.getId(), ProcessTaskStepOperationType.STEP_REAPPROVAL) .build() .checkAndNoPermissionThrowException(); Long needActiveStepId = null; @@ -1256,7 +1257,7 @@ public abstract class ProcessStepHandlerBase implements IProcessStepHandler { } /* 保存描述内容 **/ processStepHandlerCrossoverUtil.checkContentIsRequired(currentProcessTaskStepVo); - processStepHandlerCrossoverUtil.saveContentAndFile(currentProcessTaskStepVo, ProcessTaskOperationType.STEP_REAPPROVAL); + processStepHandlerCrossoverUtil.saveContentAndFile(currentProcessTaskStepVo, ProcessTaskStepOperationType.STEP_REAPPROVAL); myReapproval(currentProcessTaskStepVo); /* 更新步骤状态 **/ @@ -1284,7 +1285,7 @@ public abstract class ProcessStepHandlerBase implements IProcessStepHandler { processTaskCrossoverMapper.updateProcessTaskStepRelIsHit(processTaskStepRelVo); } } - doNext(ProcessTaskOperationType.STEP_ACTIVE, new ProcessStepThread(nextStep) { + doNext(ProcessTaskStepOperationType.STEP_ACTIVE, new ProcessStepThread(nextStep) { @Override public void myExecute() { nextStepHandler.active(nextStep); @@ -1332,9 +1333,9 @@ public abstract class ProcessStepHandlerBase implements IProcessStepHandler { myReapprovalAudit(currentProcessTaskStepVo); if (this.getMode().equals(ProcessStepMode.MT)) { currentProcessTaskStepVo.getParamObj().put("operateTime", new Date()); - ProcessTaskOperatePostProcessorFactory.invokePostProcessorsAfterProcessTaskStepOperate(currentProcessTaskStepVo, ProcessTaskOperationType.STEP_REAPPROVAL); + ProcessTaskOperatePostProcessorFactory.invokePostProcessorsAfterProcessTaskStepOperate(currentProcessTaskStepVo, ProcessTaskStepOperationType.STEP_REAPPROVAL); /* 写入时间审计 **/ - processStepHandlerCrossoverUtil.timeAudit(currentProcessTaskStepVo, ProcessTaskOperationType.STEP_REAPPROVAL); + processStepHandlerCrossoverUtil.timeAudit(currentProcessTaskStepVo, ProcessTaskStepOperationType.STEP_REAPPROVAL); /* 计算SLA **/ processStepHandlerCrossoverUtil.calculateSla(new ProcessTaskVo(currentProcessTaskStepVo.getProcessTaskId())); } @@ -1354,7 +1355,7 @@ public abstract class ProcessStepHandlerBase implements IProcessStepHandler { // 锁定当前流程 processTaskCrossoverMapper.getProcessTaskLockById(currentProcessTaskStepVo.getProcessTaskId()); new ProcessAuthManager - .StepOperationChecker(currentProcessTaskStepVo.getId(), ProcessTaskOperationType.STEP_RETREAT) + .StepOperationChecker(currentProcessTaskStepVo.getId(), ProcessTaskStepOperationType.STEP_RETREAT) .build() .checkAndNoPermissionThrowException(); try { @@ -1379,11 +1380,11 @@ public abstract class ProcessStepHandlerBase implements IProcessStepHandler { updateProcessTaskStepStatus(currentProcessTaskStepVo); currentProcessTaskStepVo.getParamObj().put("operateTime", new Date()); - ProcessTaskOperatePostProcessorFactory.invokePostProcessorsAfterProcessTaskStepOperate(currentProcessTaskStepVo, ProcessTaskOperationType.STEP_RETREAT); + ProcessTaskOperatePostProcessorFactory.invokePostProcessorsAfterProcessTaskStepOperate(currentProcessTaskStepVo, ProcessTaskStepOperationType.STEP_RETREAT); /* 写入时间审计 **/ - processStepHandlerCrossoverUtil.timeAudit(currentProcessTaskStepVo, ProcessTaskOperationType.STEP_RETREAT); + processStepHandlerCrossoverUtil.timeAudit(currentProcessTaskStepVo, ProcessTaskStepOperationType.STEP_RETREAT); if (currentProcessTaskStepVo.getStatus().equals(ProcessTaskStepStatus.RUNNING.getValue())) { - processStepHandlerCrossoverUtil.timeAudit(currentProcessTaskStepVo, ProcessTaskOperationType.STEP_START); + processStepHandlerCrossoverUtil.timeAudit(currentProcessTaskStepVo, ProcessTaskStepOperationType.STEP_START); } /* 计算SLA并触发超时警告 **/ @@ -1575,12 +1576,12 @@ public abstract class ProcessStepHandlerBase implements IProcessStepHandler { } /* 检查处理人是否合法 **/ new ProcessAuthManager - .StepOperationChecker(currentProcessTaskStepVo.getId(), ProcessTaskOperationType.STEP_RECOVER) + .StepOperationChecker(currentProcessTaskStepVo.getId(), ProcessTaskStepOperationType.STEP_RECOVER) .build() .checkAndNoPermissionThrowException(); stepMajorUserRegulate(currentProcessTaskStepVo); - processStepHandlerCrossoverUtil.saveContentAndFile(currentProcessTaskStepVo, ProcessTaskOperationType.STEP_RECOVER); + processStepHandlerCrossoverUtil.saveContentAndFile(currentProcessTaskStepVo, ProcessTaskStepOperationType.STEP_RECOVER); myRecover(currentProcessTaskStepVo); /* 更新工单步骤状态为 “进行中” **/ @@ -1601,7 +1602,7 @@ public abstract class ProcessStepHandlerBase implements IProcessStepHandler { processStepUtilHandler.updateProcessTaskStepUserAndWorker(currentProcessTaskStepVo.getProcessTaskId(), currentProcessTaskStepVo.getId()); currentProcessTaskStepVo.getParamObj().put("operateTime", new Date()); - ProcessTaskOperatePostProcessorFactory.invokePostProcessorsAfterProcessTaskStepOperate(currentProcessTaskStepVo, ProcessTaskOperationType.STEP_RECOVER); + ProcessTaskOperatePostProcessorFactory.invokePostProcessorsAfterProcessTaskStepOperate(currentProcessTaskStepVo, ProcessTaskStepOperationType.STEP_RECOVER); /* 触发通知 **/ processStepHandlerCrossoverUtil.notify(currentProcessTaskStepVo, ProcessTaskStepNotifyTriggerType.RECOVER); @@ -1631,7 +1632,7 @@ public abstract class ProcessStepHandlerBase implements IProcessStepHandler { processTaskCrossoverMapper.getProcessTaskLockById(currentProcessTaskStepVo.getProcessTaskId()); /* 检查处理人是否合法 **/ new ProcessAuthManager - .StepOperationChecker(currentProcessTaskStepVo.getId(), ProcessTaskOperationType.STEP_PAUSE) + .StepOperationChecker(currentProcessTaskStepVo.getId(), ProcessTaskStepOperationType.STEP_PAUSE) .build() .checkAndNoPermissionThrowException(); try { @@ -1640,7 +1641,7 @@ public abstract class ProcessStepHandlerBase implements IProcessStepHandler { throw new ProcessStepUtilHandlerNotFoundException(this.getHandler()); } stepMajorUserRegulate(currentProcessTaskStepVo); - processStepHandlerCrossoverUtil.saveContentAndFile(currentProcessTaskStepVo, ProcessTaskOperationType.STEP_PAUSE); + processStepHandlerCrossoverUtil.saveContentAndFile(currentProcessTaskStepVo, ProcessTaskStepOperationType.STEP_PAUSE); myPause(currentProcessTaskStepVo); /* 更新工单步骤状态为 “已挂起” **/ @@ -1652,7 +1653,7 @@ public abstract class ProcessStepHandlerBase implements IProcessStepHandler { if (CollectionUtils.isNotEmpty(processTaskStepUserList)) { String userUuid = processTaskStepUserList.get(0).getUserUuid(); majorUserHasStepPauseAuth = new ProcessAuthManager - .StepOperationChecker(currentProcessTaskStepVo.getId(), ProcessTaskOperationType.STEP_RECOVER) + .StepOperationChecker(currentProcessTaskStepVo.getId(), ProcessTaskStepOperationType.STEP_RECOVER) .withUserUuid(userUuid) .build() .check(); @@ -1667,9 +1668,9 @@ public abstract class ProcessStepHandlerBase implements IProcessStepHandler { processStepUtilHandler.updateProcessTaskStepUserAndWorker(currentProcessTaskStepVo.getProcessTaskId(), currentProcessTaskStepVo.getId()); currentProcessTaskStepVo.getParamObj().put("operateTime", new Date()); - ProcessTaskOperatePostProcessorFactory.invokePostProcessorsAfterProcessTaskStepOperate(currentProcessTaskStepVo, ProcessTaskOperationType.STEP_PAUSE); + ProcessTaskOperatePostProcessorFactory.invokePostProcessorsAfterProcessTaskStepOperate(currentProcessTaskStepVo, ProcessTaskStepOperationType.STEP_PAUSE); /* 写入时间审计 **/ - processStepHandlerCrossoverUtil.timeAudit(currentProcessTaskStepVo, ProcessTaskOperationType.STEP_PAUSE); + processStepHandlerCrossoverUtil.timeAudit(currentProcessTaskStepVo, ProcessTaskStepOperationType.STEP_PAUSE); /* 计算SLA **/ processStepHandlerCrossoverUtil.calculateSla(currentProcessTaskStepVo); @@ -1702,7 +1703,7 @@ public abstract class ProcessStepHandlerBase implements IProcessStepHandler { /* 校验权限 **/ new ProcessAuthManager - .StepOperationChecker(currentProcessTaskStepVo.getId(), ProcessTaskOperationType.STEP_ACCEPT) + .StepOperationChecker(currentProcessTaskStepVo.getId(), ProcessTaskStepOperationType.STEP_ACCEPT) .build() .checkAndNoPermissionThrowException(); try { @@ -1730,7 +1731,7 @@ public abstract class ProcessStepHandlerBase implements IProcessStepHandler { processTaskCrossoverMapper.insertProcessTaskStepUser(processTaskStepUserVo); currentProcessTaskStepVo.getParamObj().put("operateTime", new Date()); - ProcessTaskOperatePostProcessorFactory.invokePostProcessorsAfterProcessTaskStepOperate(currentProcessTaskStepVo, ProcessTaskOperationType.STEP_ACCEPT); + ProcessTaskOperatePostProcessorFactory.invokePostProcessorsAfterProcessTaskStepOperate(currentProcessTaskStepVo, ProcessTaskStepOperationType.STEP_ACCEPT); /* 处理历史记录 **/ // processStepHandlerUtilService.audit(currentProcessTaskStepVo, ProcessTaskStepAction.ACCEPT); @@ -1760,7 +1761,7 @@ public abstract class ProcessStepHandlerBase implements IProcessStepHandler { /* 校验权限 **/ new ProcessAuthManager - .StepOperationChecker(currentProcessTaskStepVo.getId(), ProcessTaskOperationType.STEP_TRANSFER) + .StepOperationChecker(currentProcessTaskStepVo.getId(), ProcessTaskStepOperationType.STEP_TRANSFER) .build() .checkAndNoPermissionThrowException(); @@ -1818,7 +1819,7 @@ public abstract class ProcessStepHandlerBase implements IProcessStepHandler { contentTargetList.add(contentTargetObj); } currentProcessTaskStepVo.getParamObj().put("contentTargetList", contentTargetList); - processStepHandlerCrossoverUtil.saveContentAndFile(currentProcessTaskStepVo, ProcessTaskOperationType.STEP_TRANSFER); + processStepHandlerCrossoverUtil.saveContentAndFile(currentProcessTaskStepVo, ProcessTaskStepOperationType.STEP_TRANSFER); /* 根据子类需要把最终处理人放进来,引擎将自动写入数据库,也可能为空,例如一些特殊的流程节点 **/ processTaskStepVo.setStatus(ProcessTaskStepStatus.PENDING.getValue()); @@ -1862,7 +1863,7 @@ public abstract class ProcessStepHandlerBase implements IProcessStepHandler { myAfterTransfer(processTaskStepVo); currentProcessTaskStepVo.getParamObj().put("operateTime", new Date()); - ProcessTaskOperatePostProcessorFactory.invokePostProcessorsAfterProcessTaskStepOperate(currentProcessTaskStepVo, ProcessTaskOperationType.STEP_TRANSFER); + ProcessTaskOperatePostProcessorFactory.invokePostProcessorsAfterProcessTaskStepOperate(currentProcessTaskStepVo, ProcessTaskStepOperationType.STEP_TRANSFER); /* 触发通知 **/ processStepHandlerCrossoverUtil.notify(currentProcessTaskStepVo, ProcessTaskStepNotifyTriggerType.TRANSFER); @@ -1927,7 +1928,7 @@ public abstract class ProcessStepHandlerBase implements IProcessStepHandler { IProcessStepHandler handler = ProcessStepHandlerFactory.getHandler(fromProcessTaskStepVo.getHandler()); if (handler != null) { fromProcessTaskStepVo.setFromProcessTaskStepId(currentProcessTaskStepVo.getId()); - doNext(ProcessTaskOperationType.STEP_BACK, new ProcessStepThread(fromProcessTaskStepVo) { + doNext(ProcessTaskStepOperationType.STEP_BACK, new ProcessStepThread(fromProcessTaskStepVo) { @Override public void myExecute() { handler.back(fromProcessTaskStepVo); @@ -1939,7 +1940,7 @@ public abstract class ProcessStepHandlerBase implements IProcessStepHandler { IProcessStepHandler handler = ProcessStepHandlerFactory.getHandler(fromProcessTaskStepVo.getHandler()); if (handler != null) { fromProcessTaskStepVo.setFromProcessTaskStepId(currentProcessTaskStepVo.getId()); - doNext(ProcessTaskOperationType.STEP_ACTIVE, new ProcessStepThread(fromProcessTaskStepVo) { + doNext(ProcessTaskStepOperationType.STEP_ACTIVE, new ProcessStepThread(fromProcessTaskStepVo) { @Override public void myExecute() { handler.active(fromProcessTaskStepVo); @@ -1951,7 +1952,7 @@ public abstract class ProcessStepHandlerBase implements IProcessStepHandler { } } /* 处理时间审计 **/ - processStepHandlerCrossoverUtil.timeAudit(currentProcessTaskStepVo, ProcessTaskOperationType.STEP_BACK); + processStepHandlerCrossoverUtil.timeAudit(currentProcessTaskStepVo, ProcessTaskStepOperationType.STEP_BACK); /* 触发通知 **/ processStepHandlerCrossoverUtil.notify(currentProcessTaskStepVo, ProcessTaskStepNotifyTriggerType.BACK); @@ -2335,7 +2336,7 @@ public abstract class ProcessStepHandlerBase implements IProcessStepHandler { processTaskCrossoverMapper.updateProcessTaskStepRelIsHit(processTaskStepRelVo); nextStep.setFromProcessTaskStepId(currentProcessTaskStepVo.getId()); nextStep.setStartProcessTaskStepId(currentProcessTaskStepVo.getStartProcessTaskStepId()); - ProcessTaskStepThread thread = new ProcessTaskStepThread(ProcessTaskOperationType.STEP_ACTIVE, nextStep, nextStepHandler.getMode()) { + ProcessTaskStepThread thread = new ProcessTaskStepThread(ProcessTaskStepOperationType.STEP_ACTIVE, nextStep, nextStepHandler.getMode()) { @Override protected void myExecute(ProcessTaskStepVo processTaskStepVo) { IProcessStepHandler processStepHandler = ProcessStepHandlerFactory.getHandler(processTaskStepVo.getHandler()); @@ -2355,9 +2356,9 @@ public abstract class ProcessStepHandlerBase implements IProcessStepHandler { } doNext(processTaskStepThreadList); /* 写入时间审计 **/ - processStepHandlerCrossoverUtil.timeAudit(currentProcessTaskStepVo, ProcessTaskOperationType.STEP_ACTIVE); - processStepHandlerCrossoverUtil.timeAudit(currentProcessTaskStepVo, ProcessTaskOperationType.STEP_START); - processStepHandlerCrossoverUtil.timeAudit(currentProcessTaskStepVo, ProcessTaskOperationType.STEP_COMPLETE); + processStepHandlerCrossoverUtil.timeAudit(currentProcessTaskStepVo, ProcessTaskStepOperationType.STEP_ACTIVE); + processStepHandlerCrossoverUtil.timeAudit(currentProcessTaskStepVo, ProcessTaskStepOperationType.STEP_START); + processStepHandlerCrossoverUtil.timeAudit(currentProcessTaskStepVo, ProcessTaskStepOperationType.STEP_COMPLETE); /* 计算SLA并触发超时警告 **/ processStepHandlerCrossoverUtil.calculateSla(currentProcessTaskStepVo); @@ -2426,7 +2427,7 @@ public abstract class ProcessStepHandlerBase implements IProcessStepHandler { String type = ProcessFlowDirection.FORWARD.getValue(); JSONObject paramObj = currentProcessTaskStepVo.getParamObj(); String action = paramObj.getString("action"); - if (ProcessTaskOperationType.STEP_BACK.getValue().equals(action)) { + if (ProcessTaskStepOperationType.STEP_BACK.getValue().equals(action)) { type = ProcessFlowDirection.BACKWARD.getValue(); } IProcessTaskCrossoverMapper processTaskCrossoverMapper = CrossoverServiceFactory.getApi(IProcessTaskCrossoverMapper.class); @@ -2701,7 +2702,7 @@ public abstract class ProcessStepHandlerBase implements IProcessStepHandler { if (handler != null) { toStepVo.setStartProcessTaskStepId(currentProcessTaskStepVo.getStartProcessTaskStepId()); toStepVo.setFromProcessTaskStepId(currentProcessTaskStepVo.getId()); - ProcessTaskStepThread thread = new ProcessTaskStepThread(ProcessTaskOperationType.STEP_HANG, toStepVo, handler.getMode()) { + ProcessTaskStepThread thread = new ProcessTaskStepThread(ProcessTaskStepOperationType.STEP_HANG, toStepVo, handler.getMode()) { @Override protected void myExecute(ProcessTaskStepVo processTaskStepVo) { IProcessStepHandler processStepHandler = ProcessStepHandlerFactory.getHandler(processTaskStepVo.getHandler()); @@ -2908,7 +2909,7 @@ public abstract class ProcessStepHandlerBase implements IProcessStepHandler { } } - protected static synchronized void doNext(ProcessTaskOperationType operationType, ProcessStepThread thread) { + protected static synchronized void doNext(IOperationType operationType, ProcessStepThread thread) { String operationTypeValue = ""; if (operationType != null) { operationTypeValue = operationType.getValue(); @@ -2989,11 +2990,11 @@ public abstract class ProcessStepHandlerBase implements IProcessStepHandler { processTaskScoreCrossoverMapper.deleteProcessTaskAutoScoreByProcessTaskId(currentProcessTaskStepVo.getProcessTaskId()); currentProcessTaskStepVo.getParamObj().put("operateTime", new Date()); - ProcessTaskOperatePostProcessorFactory.invokePostProcessorsAfterProcessTaskStepOperate(currentProcessTaskStepVo, ProcessTaskOperationType.STEP_REDO); + ProcessTaskOperatePostProcessorFactory.invokePostProcessorsAfterProcessTaskStepOperate(currentProcessTaskStepVo, ProcessTaskStepOperationType.STEP_REDO); /* 写入时间审计 **/ processStepHandlerCrossoverUtil.timeAudit(currentProcessTaskStepVo, ProcessTaskOperationType.PROCESSTASK_REDO); if (currentProcessTaskStepVo.getStatus().equals(ProcessTaskStepStatus.RUNNING.getValue())) { - processStepHandlerCrossoverUtil.timeAudit(currentProcessTaskStepVo, ProcessTaskOperationType.STEP_START); + processStepHandlerCrossoverUtil.timeAudit(currentProcessTaskStepVo, ProcessTaskStepOperationType.STEP_START); } /* 计算SLA并触发超时警告 **/ diff --git a/src/main/java/neatlogic/framework/process/stephandler/core/ProcessTaskOperatePostProcessorFactory.java b/src/main/java/neatlogic/framework/process/stephandler/core/ProcessTaskOperatePostProcessorFactory.java index 151fabcaaa4f9c50d35cc7f40ae4b4262442311a..e23b78d749be0509a951849d553158ff797c6141 100644 --- a/src/main/java/neatlogic/framework/process/stephandler/core/ProcessTaskOperatePostProcessorFactory.java +++ b/src/main/java/neatlogic/framework/process/stephandler/core/ProcessTaskOperatePostProcessorFactory.java @@ -20,7 +20,7 @@ package neatlogic.framework.process.stephandler.core; import neatlogic.framework.applicationlistener.core.ModuleInitializedListenerBase; import neatlogic.framework.bootstrap.NeatLogicWebApplicationContext; import neatlogic.framework.common.RootComponent; -import neatlogic.framework.process.constvalue.IOperationType; +import neatlogic.framework.process.operationauth.core.IOperationType; import neatlogic.framework.process.dto.ProcessTaskStepVo; import java.util.ArrayList; diff --git a/src/main/java/neatlogic/framework/process/stephandler/core/ProcessTaskStepThread.java b/src/main/java/neatlogic/framework/process/stephandler/core/ProcessTaskStepThread.java index df2606956a177c1dd9fda8b6971876b4a1955f2a..dd9e7b0c7dd13839baae882fd329769d076f3557 100644 --- a/src/main/java/neatlogic/framework/process/stephandler/core/ProcessTaskStepThread.java +++ b/src/main/java/neatlogic/framework/process/stephandler/core/ProcessTaskStepThread.java @@ -19,8 +19,8 @@ package neatlogic.framework.process.stephandler.core; import neatlogic.framework.asynchronization.thread.NeatLogicThread; import neatlogic.framework.crossover.CrossoverServiceFactory; +import neatlogic.framework.process.operationauth.core.IOperationType; import neatlogic.framework.process.constvalue.ProcessStepMode; -import neatlogic.framework.process.constvalue.ProcessTaskOperationType; import neatlogic.framework.process.crossover.IProcessTaskCrossoverMapper; import neatlogic.framework.process.dto.ProcessTaskStepVo; @@ -34,11 +34,11 @@ public abstract class ProcessTaskStepThread extends NeatLogicThread { private final ProcessStepMode mode; - private final ProcessTaskOperationType operationType; + private final IOperationType operationType; private Long inOperationId; - public ProcessTaskStepThread(ProcessTaskOperationType operationType, ProcessTaskStepVo processTaskStepVo, ProcessStepMode mode) { + public ProcessTaskStepThread(IOperationType operationType, ProcessTaskStepVo processTaskStepVo, ProcessStepMode mode) { super("PROCESSTASK-STEP-" + (operationType != null ? operationType.getValue() : "空") + (processTaskStepVo != null ? "-" + processTaskStepVo.getName() + "_" +processTaskStepVo.getId() : "")); this.processTaskStepVo = processTaskStepVo; this.processTaskId = processTaskStepVo.getProcessTaskId(); @@ -80,7 +80,7 @@ public abstract class ProcessTaskStepThread extends NeatLogicThread { return mode; } - public ProcessTaskOperationType getOperationType() { + public IOperationType getOperationType() { return operationType; } } diff --git a/src/main/java/neatlogic/framework/process/stephandler/core/ProcessTaskStepThreadComparator.java b/src/main/java/neatlogic/framework/process/stephandler/core/ProcessTaskStepThreadComparator.java index 60356cf5275e3dcfcbdfbc5771b376a8700098eb..afc49a82ae18f076893f269791dfb781f7af5308 100644 --- a/src/main/java/neatlogic/framework/process/stephandler/core/ProcessTaskStepThreadComparator.java +++ b/src/main/java/neatlogic/framework/process/stephandler/core/ProcessTaskStepThreadComparator.java @@ -19,7 +19,7 @@ package neatlogic.framework.process.stephandler.core; import neatlogic.framework.process.constvalue.ProcessFlowDirection; import neatlogic.framework.process.constvalue.ProcessStepMode; -import neatlogic.framework.process.constvalue.ProcessTaskOperationType; +import neatlogic.framework.process.constvalue.ProcessTaskStepOperationType; import neatlogic.framework.process.dto.ProcessTaskStepRelVo; import java.util.*; @@ -44,10 +44,10 @@ public class ProcessTaskStepThreadComparator implements Comparator