【同步】BOOT 和 CLOUD 的功能
This commit is contained in:
@@ -63,7 +63,7 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode TASK_WITHDRAW_FAIL_PROCESS_NOT_RUNNING = new ErrorCode(1_009_005_017, "撤回失败,流程实例未运行!");
|
||||
ErrorCode TASK_WITHDRAW_FAIL_TASK_NOT_EXISTS = new ErrorCode(1_009_005_018, "撤回失败,未查询到用户已办任务!");
|
||||
ErrorCode TASK_WITHDRAW_FAIL_NOT_ALLOW = new ErrorCode(1_009_005_019, "撤回失败,此流程不允许撤回操作!");
|
||||
ErrorCode TASK_WITHDRAW_FAIL_NEXT_TASK_NOT_ALLOW = new ErrorCode(1_009_005_019, "撤回失败,下一节点不满足撤回条件!");
|
||||
ErrorCode TASK_WITHDRAW_FAIL_NEXT_TASK_NOT_ALLOW = new ErrorCode(1_009_005_020, "撤回失败,下一节点不满足撤回条件!");
|
||||
|
||||
// ========== 动态表单模块 1-009-010-000 ==========
|
||||
ErrorCode FORM_NOT_EXISTS = new ErrorCode(1_009_010_000, "动态表单不存在");
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.bpm.enums.task;
|
||||
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.iocoder.yudao.framework.common.core.ArrayValuable;
|
||||
import cn.iocoder.yudao.framework.common.util.object.ObjectUtils;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -47,4 +48,8 @@ public enum BpmProcessInstanceStatusEnum implements ArrayValuable<Integer> {
|
||||
APPROVE.getStatus(), REJECT.getStatus(), CANCEL.getStatus());
|
||||
}
|
||||
|
||||
public static BpmProcessInstanceStatusEnum valueOf(Integer status) {
|
||||
return ArrayUtil.firstMatch(item -> item.getStatus().equals(status), values());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
package cn.iocoder.yudao.module.bpm.enums.task;
|
||||
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.iocoder.yudao.framework.common.core.ArrayValuable;
|
||||
import cn.iocoder.yudao.framework.common.util.object.ObjectUtils;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 流程任务 Task 的状态枚举
|
||||
*
|
||||
@@ -12,7 +16,7 @@ import lombok.Getter;
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum BpmTaskStatusEnum {
|
||||
public enum BpmTaskStatusEnum implements ArrayValuable<Integer> {
|
||||
|
||||
SKIP(-2, "跳过"),
|
||||
NOT_START(-1, "未开始"),
|
||||
@@ -35,6 +39,8 @@ public enum BpmTaskStatusEnum {
|
||||
*/
|
||||
WAIT(0, "待审批");
|
||||
|
||||
public static final Integer[] ARRAYS = Arrays.stream(values()).map(BpmTaskStatusEnum::getStatus).toArray(Integer[]::new);
|
||||
|
||||
/**
|
||||
* 状态
|
||||
* <p>
|
||||
@@ -46,6 +52,11 @@ public enum BpmTaskStatusEnum {
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
@Override
|
||||
public Integer[] array() {
|
||||
return ARRAYS;
|
||||
}
|
||||
|
||||
public static boolean isRejectStatus(Integer status) {
|
||||
return REJECT.getStatus().equals(status);
|
||||
}
|
||||
@@ -68,4 +79,8 @@ public enum BpmTaskStatusEnum {
|
||||
return ObjUtil.equal(status, CANCEL.getStatus());
|
||||
}
|
||||
|
||||
public static BpmTaskStatusEnum valueOf(Integer status) {
|
||||
return ArrayUtil.firstMatch(item -> item.getStatus().equals(status), values());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -224,4 +224,10 @@ public class BpmProcessDefinitionInfoDO extends BaseDO {
|
||||
@TableField(typeHandler = JacksonTypeHandler.class)
|
||||
private BpmModelMetaInfoVO.HttpRequestSetting taskAfterTriggerSetting;
|
||||
|
||||
/**
|
||||
* 自定义打印模板设置
|
||||
*/
|
||||
@TableField(typeHandler = JacksonTypeHandler.class)
|
||||
private BpmModelMetaInfoVO.PrintTemplateSetting printTemplateSetting;
|
||||
|
||||
}
|
||||
|
||||
@@ -51,8 +51,8 @@ public class BpmProcessIdRedisDAO {
|
||||
String noPrefix = processIdRule.getPrefix() + infix + processIdRule.getPostfix();
|
||||
String key = RedisKeyConstants.BPM_PROCESS_ID + noPrefix;
|
||||
Long no = stringRedisTemplate.opsForValue().increment(key);
|
||||
if (StrUtil.isNotEmpty(infix)) {
|
||||
// 特殊:没有前缀,则不能过期,不能每次都是从 0 开始
|
||||
if (StrUtil.isEmpty(infix)) {
|
||||
// 特殊:没有前缀,则不能过期,不能每次都是从 0 开始。可见 https://t.zsxq.com/MU1E2 讨论
|
||||
stringRedisTemplate.expire(key, Duration.ofDays(1L));
|
||||
}
|
||||
return noPrefix + String.format("%0" + processIdRule.getLength() + "d", no);
|
||||
|
||||
@@ -658,10 +658,11 @@ public class BpmnModelUtils {
|
||||
|
||||
// 根据类型,获取入口连线
|
||||
List<SequenceFlow> sequenceFlows = getElementIncomingFlows(source);
|
||||
// 1. 没有入口连线,则返回 false
|
||||
if (CollUtil.isEmpty(sequenceFlows)) {
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
// 循环找到目标元素
|
||||
// 2. 循环找目标元素, 找到目标节点
|
||||
for (SequenceFlow sequenceFlow : sequenceFlows) {
|
||||
// 如果发现连线重复,说明循环了,跳过这个循环
|
||||
if (visitedElements.contains(sequenceFlow.getId())) {
|
||||
@@ -669,21 +670,22 @@ public class BpmnModelUtils {
|
||||
}
|
||||
// 添加已经走过的连线
|
||||
visitedElements.add(sequenceFlow.getId());
|
||||
// 这条线路存在目标节点,这条线路完成,进入下个线路
|
||||
// 这条线路存在目标节点,直接返回 true
|
||||
FlowElement sourceFlowElement = sequenceFlow.getSourceFlowElement();
|
||||
if (target.getId().equals(sourceFlowElement.getId())) {
|
||||
return true;
|
||||
}
|
||||
// 如果目标节点为并行网关,跳过这个循环 (TODO 疑问:这个判断作用是防止回退到并行网关分支上的节点吗?)
|
||||
if (sourceFlowElement instanceof ParallelGateway) {
|
||||
continue;
|
||||
}
|
||||
// 如果目标节点为并行网关,则不继续
|
||||
if (sourceFlowElement instanceof ParallelGateway) {
|
||||
return false;
|
||||
}
|
||||
// 否则就继续迭代
|
||||
if (!isSequentialReachable(sourceFlowElement, target, visitedElements)) {
|
||||
return false;
|
||||
// 继续迭代,如果找到目标节点直接返回 true
|
||||
if (isSequentialReachable(sourceFlowElement, target, visitedElements)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
// 未找到返回 false
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -783,7 +785,6 @@ public class BpmnModelUtils {
|
||||
return resultElements;
|
||||
}
|
||||
|
||||
@SuppressWarnings("PatternVariableCanBeUsed")
|
||||
private static void simulateNextFlowElements(FlowElement currentElement, Map<String, Object> variables,
|
||||
List<FlowElement> resultElements, Set<FlowElement> visitElements) {
|
||||
// 如果为空,或者已经遍历过,则直接结束
|
||||
|
||||
@@ -737,10 +737,10 @@ public class SimpleModelUtils {
|
||||
BoundaryEvent boundaryEvent = null;
|
||||
if (node.getDelaySetting().getDelayType().equals(BpmDelayTimerTypeEnum.FIXED_DATE_TIME.getType())) {
|
||||
boundaryEvent = buildTimeoutBoundaryEvent(receiveTask, BpmBoundaryEventTypeEnum.DELAY_TIMER_TIMEOUT.getType(),
|
||||
node.getDelaySetting().getDelayTime(), null, null);
|
||||
null, null, node.getDelaySetting().getDelayTime());
|
||||
} else if (node.getDelaySetting().getDelayType().equals(BpmDelayTimerTypeEnum.FIXED_TIME_DURATION.getType())) {
|
||||
boundaryEvent = buildTimeoutBoundaryEvent(receiveTask, BpmBoundaryEventTypeEnum.DELAY_TIMER_TIMEOUT.getType(),
|
||||
null, null, node.getDelaySetting().getDelayTime());
|
||||
node.getDelaySetting().getDelayTime(), null, null);
|
||||
} else {
|
||||
throw new UnsupportedOperationException("不支持的延迟类型:" + node.getDelaySetting());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user