mirror of
https://github.com/dromara/RuoYi-Vue-Plus.git
synced 2025-09-17 16:56:39 +08:00
update snailjob 1.6.0 => 1.7.0(新增的网卡配置有异常等待官方修复 不耽误正常使用)
This commit is contained in:
parent
343d5d21d8
commit
6c33fa48ec
2
pom.xml
2
pom.xml
@ -31,7 +31,7 @@
|
|||||||
<redisson.version>3.50.0</redisson.version>
|
<redisson.version>3.50.0</redisson.version>
|
||||||
<lock4j.version>2.2.7</lock4j.version>
|
<lock4j.version>2.2.7</lock4j.version>
|
||||||
<dynamic-ds.version>4.3.1</dynamic-ds.version>
|
<dynamic-ds.version>4.3.1</dynamic-ds.version>
|
||||||
<snailjob.version>1.6.0</snailjob.version>
|
<snailjob.version>1.7.0</snailjob.version>
|
||||||
<mapstruct-plus.version>1.4.8</mapstruct-plus.version>
|
<mapstruct-plus.version>1.4.8</mapstruct-plus.version>
|
||||||
<mapstruct-plus.lombok.version>0.2.0</mapstruct-plus.lombok.version>
|
<mapstruct-plus.lombok.version>0.2.0</mapstruct-plus.lombok.version>
|
||||||
<lombok.version>1.18.38</lombok.version>
|
<lombok.version>1.18.38</lombok.version>
|
||||||
|
@ -27,8 +27,6 @@ snail-job:
|
|||||||
port: 2${server.port}
|
port: 2${server.port}
|
||||||
# 客户端ip指定
|
# 客户端ip指定
|
||||||
host:
|
host:
|
||||||
# RPC类型: netty, grpc
|
|
||||||
rpc-type: grpc
|
|
||||||
|
|
||||||
--- # 数据源配置
|
--- # 数据源配置
|
||||||
spring:
|
spring:
|
||||||
|
@ -30,8 +30,6 @@ snail-job:
|
|||||||
port: 2${server.port}
|
port: 2${server.port}
|
||||||
# 客户端ip指定
|
# 客户端ip指定
|
||||||
host:
|
host:
|
||||||
# RPC类型: netty, grpc
|
|
||||||
rpc-type: grpc
|
|
||||||
|
|
||||||
--- # 数据源配置
|
--- # 数据源配置
|
||||||
spring:
|
spring:
|
||||||
|
@ -34,8 +34,6 @@ snail-job:
|
|||||||
summary-day: 7
|
summary-day: 7
|
||||||
# 配置负载均衡周期时间
|
# 配置负载均衡周期时间
|
||||||
load-balance-cycle-time: 10
|
load-balance-cycle-time: 10
|
||||||
# 通知类型默认使用grpc(netty 已经下线)
|
|
||||||
rpc-type: grpc
|
|
||||||
# 重试任务拉取的并行度
|
# 重试任务拉取的并行度
|
||||||
retry-max-pull-parallel: 2
|
retry-max-pull-parallel: 2
|
||||||
|
|
||||||
|
@ -34,8 +34,6 @@ snail-job:
|
|||||||
summary-day: 7
|
summary-day: 7
|
||||||
# 配置负载均衡周期时间
|
# 配置负载均衡周期时间
|
||||||
load-balance-cycle-time: 10
|
load-balance-cycle-time: 10
|
||||||
# 通知类型默认使用grpc(netty 已经下线)
|
|
||||||
rpc-type: grpc
|
|
||||||
# 重试任务拉取的并行度
|
# 重试任务拉取的并行度
|
||||||
retry-max-pull-parallel: 2
|
retry-max-pull-parallel: 2
|
||||||
|
|
||||||
|
@ -4,8 +4,8 @@ import cn.hutool.core.date.DateUtil;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.aizuda.snailjob.client.job.core.annotation.JobExecutor;
|
import com.aizuda.snailjob.client.job.core.annotation.JobExecutor;
|
||||||
import com.aizuda.snailjob.client.job.core.dto.JobArgs;
|
import com.aizuda.snailjob.client.job.core.dto.JobArgs;
|
||||||
import com.aizuda.snailjob.client.model.ExecuteResult;
|
|
||||||
import com.aizuda.snailjob.common.log.SnailJobLog;
|
import com.aizuda.snailjob.common.log.SnailJobLog;
|
||||||
|
import com.aizuda.snailjob.model.dto.ExecuteResult;
|
||||||
import org.dromara.common.json.utils.JsonUtils;
|
import org.dromara.common.json.utils.JsonUtils;
|
||||||
import org.dromara.job.entity.BillDto;
|
import org.dromara.job.entity.BillDto;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -3,8 +3,8 @@ package org.dromara.job.snailjob;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.aizuda.snailjob.client.job.core.annotation.JobExecutor;
|
import com.aizuda.snailjob.client.job.core.annotation.JobExecutor;
|
||||||
import com.aizuda.snailjob.client.job.core.dto.JobArgs;
|
import com.aizuda.snailjob.client.job.core.dto.JobArgs;
|
||||||
import com.aizuda.snailjob.client.model.ExecuteResult;
|
|
||||||
import com.aizuda.snailjob.common.log.SnailJobLog;
|
import com.aizuda.snailjob.common.log.SnailJobLog;
|
||||||
|
import com.aizuda.snailjob.model.dto.ExecuteResult;
|
||||||
import org.dromara.common.json.utils.JsonUtils;
|
import org.dromara.common.json.utils.JsonUtils;
|
||||||
import org.dromara.job.entity.BillDto;
|
import org.dromara.job.entity.BillDto;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -2,9 +2,9 @@ package org.dromara.job.snailjob;
|
|||||||
|
|
||||||
import com.aizuda.snailjob.client.job.core.annotation.JobExecutor;
|
import com.aizuda.snailjob.client.job.core.annotation.JobExecutor;
|
||||||
import com.aizuda.snailjob.client.job.core.dto.JobArgs;
|
import com.aizuda.snailjob.client.job.core.dto.JobArgs;
|
||||||
import com.aizuda.snailjob.client.model.ExecuteResult;
|
|
||||||
import com.aizuda.snailjob.common.core.util.JsonUtil;
|
import com.aizuda.snailjob.common.core.util.JsonUtil;
|
||||||
import com.aizuda.snailjob.common.log.SnailJobLog;
|
import com.aizuda.snailjob.common.log.SnailJobLog;
|
||||||
|
import com.aizuda.snailjob.model.dto.ExecuteResult;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3,8 +3,8 @@ package org.dromara.job.snailjob;
|
|||||||
import cn.hutool.core.util.RandomUtil;
|
import cn.hutool.core.util.RandomUtil;
|
||||||
import com.aizuda.snailjob.client.job.core.annotation.JobExecutor;
|
import com.aizuda.snailjob.client.job.core.annotation.JobExecutor;
|
||||||
import com.aizuda.snailjob.client.job.core.dto.JobArgs;
|
import com.aizuda.snailjob.client.job.core.dto.JobArgs;
|
||||||
import com.aizuda.snailjob.client.model.ExecuteResult;
|
|
||||||
import com.aizuda.snailjob.common.log.SnailJobLog;
|
import com.aizuda.snailjob.common.log.SnailJobLog;
|
||||||
|
import com.aizuda.snailjob.model.dto.ExecuteResult;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -2,7 +2,7 @@ package org.dromara.job.snailjob;
|
|||||||
|
|
||||||
import com.aizuda.snailjob.client.job.core.dto.JobArgs;
|
import com.aizuda.snailjob.client.job.core.dto.JobArgs;
|
||||||
import com.aizuda.snailjob.client.job.core.executor.AbstractJobExecutor;
|
import com.aizuda.snailjob.client.job.core.executor.AbstractJobExecutor;
|
||||||
import com.aizuda.snailjob.client.model.ExecuteResult;
|
import com.aizuda.snailjob.model.dto.ExecuteResult;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6,8 +6,8 @@ import com.aizuda.snailjob.client.job.core.MapHandler;
|
|||||||
import com.aizuda.snailjob.client.job.core.annotation.JobExecutor;
|
import com.aizuda.snailjob.client.job.core.annotation.JobExecutor;
|
||||||
import com.aizuda.snailjob.client.job.core.annotation.MapExecutor;
|
import com.aizuda.snailjob.client.job.core.annotation.MapExecutor;
|
||||||
import com.aizuda.snailjob.client.job.core.dto.MapArgs;
|
import com.aizuda.snailjob.client.job.core.dto.MapArgs;
|
||||||
import com.aizuda.snailjob.client.model.ExecuteResult;
|
|
||||||
import com.aizuda.snailjob.common.log.SnailJobLog;
|
import com.aizuda.snailjob.common.log.SnailJobLog;
|
||||||
|
import com.aizuda.snailjob.model.dto.ExecuteResult;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -8,8 +8,8 @@ import com.aizuda.snailjob.client.job.core.annotation.MapExecutor;
|
|||||||
import com.aizuda.snailjob.client.job.core.annotation.ReduceExecutor;
|
import com.aizuda.snailjob.client.job.core.annotation.ReduceExecutor;
|
||||||
import com.aizuda.snailjob.client.job.core.dto.MapArgs;
|
import com.aizuda.snailjob.client.job.core.dto.MapArgs;
|
||||||
import com.aizuda.snailjob.client.job.core.dto.ReduceArgs;
|
import com.aizuda.snailjob.client.job.core.dto.ReduceArgs;
|
||||||
import com.aizuda.snailjob.client.model.ExecuteResult;
|
|
||||||
import com.aizuda.snailjob.common.log.SnailJobLog;
|
import com.aizuda.snailjob.common.log.SnailJobLog;
|
||||||
|
import com.aizuda.snailjob.model.dto.ExecuteResult;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -3,8 +3,8 @@ package org.dromara.job.snailjob;
|
|||||||
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
import com.aizuda.snailjob.client.job.core.annotation.JobExecutor;
|
import com.aizuda.snailjob.client.job.core.annotation.JobExecutor;
|
||||||
import com.aizuda.snailjob.client.job.core.dto.JobArgs;
|
import com.aizuda.snailjob.client.job.core.dto.JobArgs;
|
||||||
import com.aizuda.snailjob.client.model.ExecuteResult;
|
|
||||||
import com.aizuda.snailjob.common.log.SnailJobLog;
|
import com.aizuda.snailjob.common.log.SnailJobLog;
|
||||||
|
import com.aizuda.snailjob.model.dto.ExecuteResult;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4,8 +4,8 @@ import cn.hutool.core.date.DateUtil;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.aizuda.snailjob.client.job.core.annotation.JobExecutor;
|
import com.aizuda.snailjob.client.job.core.annotation.JobExecutor;
|
||||||
import com.aizuda.snailjob.client.job.core.dto.JobArgs;
|
import com.aizuda.snailjob.client.job.core.dto.JobArgs;
|
||||||
import com.aizuda.snailjob.client.model.ExecuteResult;
|
|
||||||
import com.aizuda.snailjob.common.log.SnailJobLog;
|
import com.aizuda.snailjob.common.log.SnailJobLog;
|
||||||
|
import com.aizuda.snailjob.model.dto.ExecuteResult;
|
||||||
import org.dromara.common.json.utils.JsonUtils;
|
import org.dromara.common.json.utils.JsonUtils;
|
||||||
import org.dromara.job.entity.BillDto;
|
import org.dromara.job.entity.BillDto;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -0,0 +1,339 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2024-2025, Warm-Flow (290631660@qq.com).
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.dromara.warm.flow.ui.service;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.dromara.warm.flow.core.FlowEngine;
|
||||||
|
import org.dromara.warm.flow.core.config.WarmFlow;
|
||||||
|
import org.dromara.warm.flow.core.dto.*;
|
||||||
|
import org.dromara.warm.flow.core.entity.Form;
|
||||||
|
import org.dromara.warm.flow.core.entity.Instance;
|
||||||
|
import org.dromara.warm.flow.core.enums.FormCustomEnum;
|
||||||
|
import org.dromara.warm.flow.core.enums.ModeEnum;
|
||||||
|
import org.dromara.warm.flow.core.exception.FlowException;
|
||||||
|
import org.dromara.warm.flow.core.invoker.FrameInvoker;
|
||||||
|
import org.dromara.warm.flow.core.utils.ExceptionUtil;
|
||||||
|
import org.dromara.warm.flow.core.utils.StreamUtils;
|
||||||
|
import org.dromara.warm.flow.core.utils.StringUtils;
|
||||||
|
import org.dromara.warm.flow.ui.dto.HandlerFeedBackDto;
|
||||||
|
import org.dromara.warm.flow.ui.dto.HandlerQuery;
|
||||||
|
import org.dromara.warm.flow.ui.utils.TreeUtil;
|
||||||
|
import org.dromara.warm.flow.ui.vo.*;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设计器Controller 可选择是否放行,放行可与业务系统共享权限,主要是用来访问业务系统数据
|
||||||
|
*
|
||||||
|
* @author warm
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public class WarmFlowService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回流程定义的配置
|
||||||
|
* @return ApiResult<WarmFlowVo>
|
||||||
|
*/
|
||||||
|
public static ApiResult<WarmFlowVo> config() {
|
||||||
|
WarmFlowVo warmFlowVo = new WarmFlowVo();
|
||||||
|
WarmFlow warmFlow = FlowEngine.getFlowConfig();
|
||||||
|
// 获取tokenName
|
||||||
|
String tokenName = warmFlow.getTokenName();
|
||||||
|
if (StringUtils.isEmpty(tokenName)) {
|
||||||
|
return ApiResult.fail("未配置tokenName");
|
||||||
|
}
|
||||||
|
String[] tokenNames = tokenName.split(",");
|
||||||
|
List<String> tokenNameList = Arrays.stream(tokenNames).filter(StringUtils::isNotEmpty)
|
||||||
|
.map(String::trim).collect(Collectors.toList());
|
||||||
|
warmFlowVo.setTokenNameList(tokenNameList);
|
||||||
|
|
||||||
|
return ApiResult.ok(warmFlowVo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存流程json字符串
|
||||||
|
*
|
||||||
|
* @param defJson 流程数据集合
|
||||||
|
* @return ApiResult<Void>
|
||||||
|
* @throws Exception 异常
|
||||||
|
* @author xiarg
|
||||||
|
* @since 2024/10/29 16:31
|
||||||
|
*/
|
||||||
|
public static ApiResult<Void> saveJson(DefJson defJson) throws Exception {
|
||||||
|
FlowEngine.defService().saveDef(defJson);
|
||||||
|
return ApiResult.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取流程定义数据(包含节点和跳转)
|
||||||
|
*
|
||||||
|
* @param id 流程定义id
|
||||||
|
* @return ApiResult<DefVo>
|
||||||
|
* @author xiarg
|
||||||
|
* @since 2024/10/29 16:31
|
||||||
|
*/
|
||||||
|
public static ApiResult<DefJson> queryDef(Long id) {
|
||||||
|
try {
|
||||||
|
DefJson defJson;
|
||||||
|
if (id == null) {
|
||||||
|
defJson = new DefJson()
|
||||||
|
.setModelValue(ModeEnum.CLASSICS.name())
|
||||||
|
.setFormCustom(FormCustomEnum.N.name());
|
||||||
|
} else {
|
||||||
|
defJson = FlowEngine.defService().queryDesign(id);
|
||||||
|
}
|
||||||
|
CategoryService categoryService = FrameInvoker.getBean(CategoryService.class);
|
||||||
|
if (categoryService != null) {
|
||||||
|
List<Tree> treeList = categoryService.queryCategory();
|
||||||
|
defJson.setCategoryList(TreeUtil.buildTree(treeList));
|
||||||
|
}
|
||||||
|
return ApiResult.ok(defJson);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("获取流程json字符串", e);
|
||||||
|
throw new FlowException(ExceptionUtil.handleMsg("获取流程json字符串失败", e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取流程图
|
||||||
|
*
|
||||||
|
* @param id 流程实例id
|
||||||
|
* @return ApiResult<DefJson>
|
||||||
|
*/
|
||||||
|
public static ApiResult<DefJson> queryFlowChart(Long id) {
|
||||||
|
try {
|
||||||
|
Instance instance = FlowEngine.insService().getById(id);
|
||||||
|
String defJsonStr = instance.getDefJson();
|
||||||
|
DefJson defJson = FlowEngine.jsonConvert.strToBean(defJsonStr, DefJson.class);
|
||||||
|
if (StringUtils.isEmpty(defJson.getModelValue())) {
|
||||||
|
defJson.setModelValue(ModeEnum.CLASSICS.name());
|
||||||
|
}
|
||||||
|
defJson.setInstance(instance);
|
||||||
|
|
||||||
|
// 获取流程图三原色
|
||||||
|
defJson.setChartStatusColor(FlowEngine.chartService().getChartRgb());
|
||||||
|
// 是否显示流程图顶部文字
|
||||||
|
defJson.setTopTextShow(FlowEngine.getFlowConfig().isTopTextShow());
|
||||||
|
// 需要业务系统实现该接口
|
||||||
|
ChartExtService chartExtService = FrameInvoker.getBean(ChartExtService.class);
|
||||||
|
if (chartExtService != null) {
|
||||||
|
chartExtService.initPromptContent(defJson);
|
||||||
|
chartExtService.execute(defJson);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ApiResult.ok(defJson);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("获取流程图", e);
|
||||||
|
throw new FlowException(ExceptionUtil.handleMsg("获取流程图失败", e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 办理人权限设置列表tabs页签
|
||||||
|
* @return List<String>
|
||||||
|
*/
|
||||||
|
public static ApiResult<List<String>> handlerType() {
|
||||||
|
try {
|
||||||
|
// 需要业务系统实现该接口
|
||||||
|
HandlerSelectService handlerSelectService = FrameInvoker.getBean(HandlerSelectService.class);
|
||||||
|
if (handlerSelectService == null) {
|
||||||
|
return ApiResult.ok(Collections.emptyList());
|
||||||
|
}
|
||||||
|
List<String> handlerType = handlerSelectService.getHandlerType();
|
||||||
|
return ApiResult.ok(handlerType);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("办理人权限设置列表tabs页签异常", e);
|
||||||
|
throw new FlowException(ExceptionUtil.handleMsg("办理人权限设置列表tabs页签失败", e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 办理人权限设置列表结果
|
||||||
|
* @return HandlerSelectVo
|
||||||
|
*/
|
||||||
|
public static ApiResult<HandlerSelectVo> handlerResult(HandlerQuery query) {
|
||||||
|
try {
|
||||||
|
// 需要业务系统实现该接口
|
||||||
|
HandlerSelectService handlerSelectService = FrameInvoker.getBean(HandlerSelectService.class);
|
||||||
|
if (handlerSelectService == null) {
|
||||||
|
return ApiResult.ok(new HandlerSelectVo());
|
||||||
|
}
|
||||||
|
HandlerSelectVo handlerSelectVo = handlerSelectService.getHandlerSelect(query);
|
||||||
|
return ApiResult.ok(handlerSelectVo);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("办理人权限设置列表结果异常", e);
|
||||||
|
throw new FlowException(ExceptionUtil.handleMsg("办理人权限设置列表结果失败", e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 办理人权限名称回显
|
||||||
|
* @return HandlerSelectVo
|
||||||
|
*/
|
||||||
|
public static ApiResult<List<HandlerFeedBackVo>> handlerFeedback(HandlerFeedBackDto handlerFeedBackDto) {
|
||||||
|
try {
|
||||||
|
// 需要业务系统实现该接口
|
||||||
|
HandlerSelectService handlerSelectService = FrameInvoker.getBean(HandlerSelectService.class);
|
||||||
|
if (handlerSelectService == null) {
|
||||||
|
List<HandlerFeedBackVo> handlerFeedBackVos = StreamUtils.toList(handlerFeedBackDto.getStorageIds(),
|
||||||
|
storageId -> new HandlerFeedBackVo(storageId, null));
|
||||||
|
return ApiResult.ok(handlerFeedBackVos);
|
||||||
|
}
|
||||||
|
List<HandlerFeedBackVo> handlerFeedBackVos = handlerSelectService.handlerFeedback(handlerFeedBackDto.getStorageIds());
|
||||||
|
return ApiResult.ok(handlerFeedBackVos);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("办理人权限名称回显", e);
|
||||||
|
throw new FlowException(ExceptionUtil.handleMsg("办理人权限名称回显", e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 办理人选择项
|
||||||
|
* @return List<Dict>
|
||||||
|
*/
|
||||||
|
public static ApiResult<List<Dict>> handlerDict() {
|
||||||
|
try {
|
||||||
|
// 需要业务系统实现该接口
|
||||||
|
HandlerDictService handlerDictService = FrameInvoker.getBean(HandlerDictService.class);
|
||||||
|
if (handlerDictService == null) {
|
||||||
|
List<Dict> dictList = new ArrayList<>();
|
||||||
|
Dict dict = new Dict();
|
||||||
|
dict.setLabel("默认表达式");
|
||||||
|
dict.setValue("${handler}");
|
||||||
|
Dict dict1 = new Dict();
|
||||||
|
dict1.setLabel("spel表达式");
|
||||||
|
dict1.setValue("#{@user.evalVar(#handler)}");
|
||||||
|
Dict dict2 = new Dict();
|
||||||
|
dict2.setLabel("其他");
|
||||||
|
dict2.setValue("");
|
||||||
|
dictList.add(dict);
|
||||||
|
dictList.add(dict1);
|
||||||
|
dictList.add(dict2);
|
||||||
|
|
||||||
|
return ApiResult.ok(dictList);
|
||||||
|
}
|
||||||
|
return ApiResult.ok(handlerDictService.getHandlerDict());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("办理人权限设置列表结果异常", e);
|
||||||
|
throw new FlowException(ExceptionUtil.handleMsg("办理人权限设置列表结果失败", e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 已发布表单列表 该接口不需要业务系统实现
|
||||||
|
*/
|
||||||
|
public static ApiResult<List<Form>> publishedForm() {
|
||||||
|
try {
|
||||||
|
return ApiResult.ok(FlowEngine.formService().list(FlowEngine.newForm().setIsPublish(1)));
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("已发布表单列表异常", e);
|
||||||
|
throw new FlowException(ExceptionUtil.handleMsg("已发布表单列表异常", e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 读取表单内容
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static ApiResult<String> getFormContent(Long id) {
|
||||||
|
try {return ApiResult.ok(FlowEngine.formService().getById(id).getFormContent());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("获取表单内容字符串", e);
|
||||||
|
throw new FlowException(ExceptionUtil.handleMsg("获取表单内容字符串失败", e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存表单内容,该接口不需要系统实现
|
||||||
|
* @param flowDto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static ApiResult<Void> saveFormContent(FlowDto flowDto) {
|
||||||
|
FlowEngine.formService().saveContent(flowDto.getId(), flowDto.getFormContent());
|
||||||
|
return ApiResult.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据任务id获取待办任务表单及数据
|
||||||
|
*
|
||||||
|
* @param taskId 当前任务id
|
||||||
|
* @return {@link ApiResult<FlowDto>}
|
||||||
|
* @author liangli
|
||||||
|
* @date 2024/8/21 17:08
|
||||||
|
**/
|
||||||
|
public static ApiResult<FlowDto> load(Long taskId) {
|
||||||
|
FlowParams flowParams = FlowParams.build();
|
||||||
|
|
||||||
|
return ApiResult.ok(FlowEngine.taskService().load(taskId, flowParams));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据任务id获取已办任务表单及数据
|
||||||
|
*
|
||||||
|
* @param hisTaskId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static ApiResult<FlowDto> hisLoad(Long hisTaskId) {
|
||||||
|
FlowParams flowParams = FlowParams.build();
|
||||||
|
|
||||||
|
return ApiResult.ok(FlowEngine.taskService().hisLoad(hisTaskId, flowParams));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用表单流程审批接口
|
||||||
|
*
|
||||||
|
* @param formData
|
||||||
|
* @param taskId
|
||||||
|
* @param skipType
|
||||||
|
* @param message
|
||||||
|
* @param nodeCode
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static ApiResult<Instance> handle(Map<String, Object> formData, Long taskId, String skipType
|
||||||
|
, String message, String nodeCode) {
|
||||||
|
FlowParams flowParams = FlowParams.build()
|
||||||
|
.skipType(skipType)
|
||||||
|
.nodeCode(nodeCode)
|
||||||
|
.message(message);
|
||||||
|
|
||||||
|
flowParams.formData(formData);
|
||||||
|
|
||||||
|
return ApiResult.ok(FlowEngine.taskService().skip(taskId, flowParams));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取节点扩展属性
|
||||||
|
* @return List<NodeExt>
|
||||||
|
*/
|
||||||
|
public static ApiResult<List<NodeExt>> nodeExt() {
|
||||||
|
try {
|
||||||
|
// 需要业务系统实现该接口
|
||||||
|
NodeExtService nodeExtService = FrameInvoker.getBean(NodeExtService.class);
|
||||||
|
if (nodeExtService == null) {
|
||||||
|
return ApiResult.ok(Collections.emptyList());
|
||||||
|
}
|
||||||
|
List<NodeExt> nodeExts = nodeExtService.getNodeExt();
|
||||||
|
return ApiResult.ok(nodeExts);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("获取节点扩展属性", e);
|
||||||
|
throw new FlowException(ExceptionUtil.handleMsg("获取节点扩展属性失败", e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user