Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
T
travel-cloud
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
cloud
travel-cloud
Commits
7f260ac6
提交
7f260ac6
authored
5月 21, 2025
作者:
hzh
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
代码优化
上级
c546b748
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
69 行增加
和
8 行删除
+69
-8
pom.xml
ruoyi-modules/ruoyi-workflow/pom.xml
+14
-0
FlowableConfig.java
.../org/dromara/workflow/flowable/config/FlowableConfig.java
+6
-0
DynamicAssigneeListener.java
...a/workflow/flowable/listener/DynamicAssigneeListener.java
+8
-8
WorkflowApplicationRunner.java
...rg/dromara/workflow/runner/WorkflowApplicationRunner.java
+3
-0
IDeptService.java
.../main/java/org/dromara/workflow/service/IDeptService.java
+13
-0
DeptServiceImpl.java
...va/org/dromara/workflow/service/impl/DeptServiceImpl.java
+25
-0
没有找到文件。
ruoyi-modules/ruoyi-workflow/pom.xml
浏览文件 @
7f260ac6
...
@@ -22,6 +22,11 @@
...
@@ -22,6 +22,11 @@
<artifactId>
ruoyi-common-nacos
</artifactId>
<artifactId>
ruoyi-common-nacos
</artifactId>
</dependency>
</dependency>
<dependency>
<groupId>
org.dromara
</groupId>
<artifactId>
ruoyi-common-sentinel
</artifactId>
</dependency>
<!--引入flowable依赖-->
<!--引入flowable依赖-->
<dependency>
<dependency>
<groupId>
org.flowable
</groupId>
<groupId>
org.flowable
</groupId>
...
@@ -113,6 +118,10 @@
...
@@ -113,6 +118,10 @@
<groupId>
org.dromara
</groupId>
<groupId>
org.dromara
</groupId>
<artifactId>
ruoyi-common-tenant
</artifactId>
<artifactId>
ruoyi-common-tenant
</artifactId>
</dependency>
</dependency>
<dependency>
<groupId>
org.dromara
</groupId>
<artifactId>
ruoyi-api-system
</artifactId>
</dependency>
<dependency>
<dependency>
<groupId>
org.dromara
</groupId>
<groupId>
org.dromara
</groupId>
...
@@ -134,6 +143,11 @@
...
@@ -134,6 +143,11 @@
<artifactId>
ruoyi-api-workflow
</artifactId>
<artifactId>
ruoyi-api-workflow
</artifactId>
</dependency>
</dependency>
<dependency>
<groupId>
org.dromara
</groupId>
<artifactId>
ruoyi-common-core
</artifactId>
</dependency>
<dependency>
<dependency>
<groupId>
commons-io
</groupId>
<groupId>
commons-io
</groupId>
<artifactId>
commons-io
</artifactId>
<artifactId>
commons-io
</artifactId>
...
...
ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/flowable/config/FlowableConfig.java
浏览文件 @
7f260ac6
...
@@ -2,11 +2,14 @@ package org.dromara.workflow.flowable.config;
...
@@ -2,11 +2,14 @@ package org.dromara.workflow.flowable.config;
import
com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator
;
import
com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator
;
import
org.dromara.workflow.flowable.handler.TaskTimeoutJobHandler
;
import
org.dromara.workflow.flowable.handler.TaskTimeoutJobHandler
;
import
org.flowable.common.engine.impl.cfg.SpringBeanFactoryProxyMap
;
import
org.flowable.spring.SpringProcessEngineConfiguration
;
import
org.flowable.spring.SpringProcessEngineConfiguration
;
import
org.flowable.spring.boot.EngineConfigurationConfigurer
;
import
org.flowable.spring.boot.EngineConfigurationConfigurer
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
javax.annotation.Resource
;
import
java.util.Collections
;
import
java.util.Collections
;
...
@@ -22,11 +25,14 @@ public class FlowableConfig implements EngineConfigurationConfigurer<SpringProce
...
@@ -22,11 +25,14 @@ public class FlowableConfig implements EngineConfigurationConfigurer<SpringProce
private
GlobalFlowableListener
globalFlowableListener
;
private
GlobalFlowableListener
globalFlowableListener
;
@Autowired
@Autowired
private
IdentifierGenerator
identifierGenerator
;
private
IdentifierGenerator
identifierGenerator
;
@Resource
private
ApplicationContext
applicationContext
;
@Override
@Override
public
void
configure
(
SpringProcessEngineConfiguration
processEngineConfiguration
)
{
public
void
configure
(
SpringProcessEngineConfiguration
processEngineConfiguration
)
{
processEngineConfiguration
.
setIdGenerator
(()
->
identifierGenerator
.
nextId
(
null
).
toString
());
processEngineConfiguration
.
setIdGenerator
(()
->
identifierGenerator
.
nextId
(
null
).
toString
());
processEngineConfiguration
.
setEventListeners
(
Collections
.
singletonList
(
globalFlowableListener
));
processEngineConfiguration
.
setEventListeners
(
Collections
.
singletonList
(
globalFlowableListener
));
processEngineConfiguration
.
addCustomJobHandler
(
new
TaskTimeoutJobHandler
());
processEngineConfiguration
.
addCustomJobHandler
(
new
TaskTimeoutJobHandler
());
processEngineConfiguration
.
setBeans
(
new
SpringBeanFactoryProxyMap
(
applicationContext
));
}
}
}
}
ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/flowable/listener/DynamicAssigneeListener.java
浏览文件 @
7f260ac6
package
org
.
dromara
.
workflow
.
flowable
.
listener
;
package
org
.
dromara
.
workflow
.
flowable
.
listener
;
import
org.apache.dubbo.config.annotation.DubboReference
;
import
org.dromara.common.core.utils.SpringUtils
;
import
org.dromara.system.api.RemoteDeptService
;
import
org.dromara.workflow.common.constant.FlowConstant
;
import
org.dromara.workflow.service.IDeptService
;
import
org.flowable.task.service.delegate.DelegateTask
;
import
org.flowable.task.service.delegate.DelegateTask
;
import
org.flowable.task.service.delegate.TaskListener
;
import
org.flowable.task.service.delegate.TaskListener
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
@@ -12,18 +13,17 @@ import java.util.Objects;
...
@@ -12,18 +13,17 @@ import java.util.Objects;
@Component
@Component
public
class
DynamicAssigneeListener
implements
TaskListener
{
public
class
DynamicAssigneeListener
implements
TaskListener
{
@DubboReference
private
RemoteDeptService
remoteDeptService
;
@Override
@Override
public
void
notify
(
DelegateTask
delegateTask
)
{
public
void
notify
(
DelegateTask
delegateTask
)
{
// 获取申请人ID(从流程变量中获取)
// 获取申请人ID(从流程变量中获取)
Long
applicantId
=
(
Long
)
delegateTask
.
getVariable
(
"applicantId"
);
Long
applicantId
=
Long
.
parseLong
(
delegateTask
.
getVariable
(
FlowConstant
.
INITIATOR
).
toString
());
IDeptService
deptService
=
SpringUtils
.
getBean
(
IDeptService
.
class
);
// 调用服务获取审批人列表
// 调用服务获取审批人列表
Long
approveId
=
remoteD
eptService
.
selectLeaderIdByUserId
(
applicantId
);
Long
approveId
=
d
eptService
.
selectLeaderIdByUserId
(
applicantId
);
// 设置候选用户
// 设置候选用户
delegateTask
.
addCandidateUser
(
Objects
.
isNull
(
approveId
)
?
null
:
approveId
.
toString
());
delegateTask
.
setAssignee
(
Objects
.
isNull
(
approveId
)
?
null
:
approveId
.
toString
());
}
}
}
}
ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/runner/WorkflowApplicationRunner.java
浏览文件 @
7f260ac6
...
@@ -4,6 +4,7 @@ import lombok.RequiredArgsConstructor;
...
@@ -4,6 +4,7 @@ import lombok.RequiredArgsConstructor;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.dubbo.config.annotation.DubboReference
;
import
org.apache.dubbo.config.annotation.DubboReference
;
import
org.dromara.resource.api.RemoteFileService
;
import
org.dromara.resource.api.RemoteFileService
;
import
org.dromara.system.api.RemoteDeptService
;
import
org.dromara.system.api.RemoteUserService
;
import
org.dromara.system.api.RemoteUserService
;
import
org.springframework.boot.ApplicationArguments
;
import
org.springframework.boot.ApplicationArguments
;
import
org.springframework.boot.ApplicationRunner
;
import
org.springframework.boot.ApplicationRunner
;
...
@@ -23,6 +24,8 @@ public class WorkflowApplicationRunner implements ApplicationRunner {
...
@@ -23,6 +24,8 @@ public class WorkflowApplicationRunner implements ApplicationRunner {
private
RemoteUserService
remoteUserService
;
private
RemoteUserService
remoteUserService
;
@DubboReference
@DubboReference
private
RemoteFileService
remoteFileService
;
private
RemoteFileService
remoteFileService
;
@DubboReference
private
RemoteDeptService
remoteDeptService
;
@Override
@Override
public
void
run
(
ApplicationArguments
args
)
throws
Exception
{
public
void
run
(
ApplicationArguments
args
)
throws
Exception
{
...
...
ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/IDeptService.java
0 → 100644
浏览文件 @
7f260ac6
package
org
.
dromara
.
workflow
.
service
;
public
interface
IDeptService
{
/**
* 获取部门负责人id
*
* @param userId 用户id
* @return 负责人id
*/
Long
selectLeaderIdByUserId
(
Long
userId
);
}
ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/impl/DeptServiceImpl.java
0 → 100644
浏览文件 @
7f260ac6
package
org
.
dromara
.
workflow
.
service
.
impl
;
import
lombok.RequiredArgsConstructor
;
import
org.apache.dubbo.config.annotation.DubboReference
;
import
org.dromara.system.api.RemoteDeptService
;
import
org.dromara.workflow.service.IDeptService
;
import
org.springframework.stereotype.Service
;
/**
* @author hzh
* @date 2025-05-20
* @desc TODO
**/
@Service
@RequiredArgsConstructor
public
class
DeptServiceImpl
implements
IDeptService
{
@DubboReference
private
RemoteDeptService
remoteDeptService
;
@Override
public
Long
selectLeaderIdByUserId
(
Long
userId
)
{
return
remoteDeptService
.
selectLeaderIdByUserId
(
userId
);
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论