Merge branch 'v3.0.0' into main

合并 v3.0.0 分支到 main,包含以下主要更新:
- 重构聊天模块架构,引入Handler模式
- 添加 Docker 部署支持
- 恢复 MCP 模块功能
- 工作流与大模型聊天对话整合
- 多项 bug 修复和文档更新

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
ageerle
2026-03-21 12:15:40 +08:00
1570 changed files with 51500 additions and 77494 deletions

View File

@@ -1,222 +0,0 @@
## RuoYi-AI 后端部署教程Docker 部署版)
### 一、前置条件
在部署前,请确保系统已满足以下条件:
#### ✅ 系统环境要求
- 操作系统Linux / MacOS推荐 Linux 服务器)
- CPU4 核以上
- 内存:≥ 4GB
- 磁盘空间:≥ 10GB建议 20GB+
#### ✅ 已安装软件
- **Docker**
- **Docker Compose**
验证命令是否可用:
```
docker -v
docker compose version
```
若无输出或提示“command not found”请先安装 Docker 及 Compose。
------
### 二、目录结构配置
#### 1⃣ 创建部署目录
在目标服务器执行以下命令:
```
# 第一级目录
mkdir /ruoyi-ai
cd /ruoyi-ai
# 第二级目录
mkdir deploy
cd deploy
# 第三级目录
mkdir data mysql-init
# 第四级目录
mkdir logs minio minio-config mysql redis weaviate
```
> 💡 `data` 目录用于挂载容器运行期间生成的数据文件。
最终目录结构示例:
```
/ruoyi-ai
└── deploy
├── data/
├── mysql-init/
├── logs/
├── minio/
├── minio-config/
├── mysql/
├── redis/
├── weaviate/
```
------
### 三、上传配置文件
将以下配置文件上传到 `/ruoyi-ai/deploy` 目录:
- `docker-compose.yaml`
- `.env`
- `ruoyi-ai.sql`
- `Dockerfile`
> 📂 这些文件在项目目录 `/script/deploy/deploy` 下。
> 上传后请检查文件路径是否与上方目录结构一致。
------
### 四、构建 Jar 包
1. 打开 IDEA 或其他构建工具
2. 选择 **Maven 构建配置**,勾选 `prod` 环境,取消 `dev` 环境
3. 点击 `package` 进行打包
4. **注意:** 在构建前请将 `application-prod.yml` 拖入
`ruoyi-admin/src/main/resources` 目录中
构建完成后会在:
```
ruoyi-admin/target/ruoyi-admin.jar
```
生成打包文件。
------
### 五、上传 Jar 包至服务器
将生成的 `ruoyi-admin.jar` 上传到服务器 `/ruoyi-ai/deploy` 目录下。
确保与 `Dockerfile` 同目录。
------
### 六、构建 Docker 镜像
`Dockerfile` 内容如下:
```
FROM openjdk:17-jdk
RUN mkdir -p /ruoyi/server/logs \
/ruoyi/server/temp
WORKDIR /ruoyi/server
COPY ruoyi-admin.jar ruoyi-admin.jar
ENTRYPOINT ["java","-jar","ruoyi-admin.jar"]
```
`/ruoyi-ai/deploy` 目录执行以下命令:
```
# 构建镜像
docker build -t ruoyi-ai-backend:v20251013 .
# 查看镜像是否构建成功
docker image ls
```
然后在 `docker-compose.yaml` 文件中,将对应服务的镜像名修改为:
```
image: ruoyi-ai-backend:v20251013
```
------
### 七、启动容器服务
在启动前请确认:
- `.env` 中端口号、数据库密码、环境变量已正确配置
- `docker-compose.yaml` 中 MySQL 的端口已开放(用于导入数据)
如示例:
```
ports:
- "3306:3306"
```
#### 启动命令:
```
cd /ruoyi-ai/deploy
docker compose up -d
```
#### 查看运行状态:
```
docker compose ps
```
#### 查看日志:
```
docker logs -f <容器名称>
```
> ⚠️ 初次启动时可仅运行 `ruoyi-admin`(后端)模块,将前端 `ruoyi-web` 服务暂时注释,确认后端服务正常后再启用前端容器。
------
### 八、数据库初始化
启动 MySQL 容器后,执行以下操作:
```
docker exec -it <mysql_container_name> bash
mysql -uroot -p
source /docker-entrypoint-initdb.d/ruoyi-ai.sql;
```
或手动在客户端中导入 `/ruoyi-ai/deploy/ruoyi-ai.sql` 文件。
------
### 九、常用 Docker 命令
| 功能 | 命令 |
|-----------|-----------------------------------|
| 查看容器状态 | `docker ps -a` |
| 查看日志 | `docker logs -f <容器名>` |
| 停止服务 | `docker compose down` |
| 重启服务 | `docker compose restart` |
| 重新构建镜像 | `docker compose build --no-cache` |
| 清理无用镜像/容器 | `docker system prune -a` |
------
### 🔍 十、部署验证
1. 检查容器是否全部启动成功:
```
docker compose ps
```
2. 访问后端接口:
```
http://<服务器IP>:<后端端口>
```
3. 检查日志输出无异常。

View File

@@ -0,0 +1,28 @@
---
version: '3.8'
services:
minio:
image: minio/minio
container_name: minio
ports:
- "9000:9000"
- "9090:9090"
environment:
- MINIO_ACCESS_KEY=ruoyi
- MINIO_SECRET_KEY=ruoyi123
volumes:
- minio_data:/data
- minio_config:/root/.minio
command: server /data --console-address ":9090"
restart: always
networks:
- minio-net
networks:
minio-net:
driver: bridge
volumes:
minio_data:
minio_config:

View File

@@ -0,0 +1,65 @@
version: '3.8'
services:
neo4j:
image: neo4j:5.15.0
container_name: ruoyi-neo4j
restart: unless-stopped
ports:
# HTTP端口
- "7474:7474"
# HTTPS端口
- "7473:7473"
# Bolt端口
- "7687:7687"
environment:
# 初始密码设置(首次启动后需要修改)
- NEO4J_AUTH=neo4j/your_password
# 接受许可协议
- NEO4J_ACCEPT_LICENSE_AGREEMENT=yes
# 内存配置(根据服务器配置调整)
- NEO4J_dbms_memory_heap_initial__size=512m
- NEO4J_dbms_memory_heap_max__size=2g
- NEO4J_dbms_memory_pagecache_size=1g
# 事务日志配置
- NEO4J_dbms_tx__log_rotation_retention__policy=3 days
# 允许从任何主机连接
- NEO4J_dbms_default__listen__address=0.0.0.0
# 启用APOC插件
- NEO4J_dbms_security_procedures_unrestricted=apoc.*
- NEO4J_dbms_security_procedures_allowlist=apoc.*
# 日志级别
- NEO4J_dbms_logs_debug_level=INFO
volumes:
# 数据持久化
- neo4j_data:/data
# 日志持久化
- neo4j_logs:/logs
# 导入目录
- neo4j_import:/var/lib/neo4j/import
# 插件目录
- neo4j_plugins:/plugins
networks:
- ruoyi-network
healthcheck:
test: [ "CMD-SHELL", "wget --no-verbose --tries=1 --spider localhost:7474 || exit 1" ]
interval: 30s
timeout: 10s
retries: 5
start_period: 40s
volumes:
neo4j_data:
name: ruoyi-neo4j-data
neo4j_logs:
name: ruoyi-neo4j-logs
neo4j_import:
name: ruoyi-neo4j-import
neo4j_plugins:
name: ruoyi-neo4j-plugins
networks:
ruoyi-network:
name: ruoyi-network
driver: bridge

View File

@@ -0,0 +1,75 @@
version: '3.5'
services:
etcd:
container_name: milvus-etcd
image: quay.io/coreos/etcd:v3.5.18
environment:
- ETCD_AUTO_COMPACTION_MODE=revision
- ETCD_AUTO_COMPACTION_RETENTION=1000
- ETCD_QUOTA_BACKEND_BYTES=4294967296
- ETCD_SNAPSHOT_COUNT=50000
volumes:
- ${DOCKER_VOLUME_DIRECTORY:-.}/volumes/etcd:/etcd
command: etcd -advertise-client-urls=http://etcd:2379 -listen-client-urls http://0.0.0.0:2379 --data-dir /etcd
healthcheck:
test: ["CMD", "etcdctl", "endpoint", "health"]
interval: 30s
timeout: 20s
retries: 3
minio:
container_name: milvus-minio
image: minio/minio:RELEASE.2023-03-20T20-16-18Z
environment:
MINIO_ACCESS_KEY: minioadmin
MINIO_SECRET_KEY: minioadmin
ports:
- "9001:9001"
- "9000:9000"
volumes:
- ${DOCKER_VOLUME_DIRECTORY:-.}/volumes/minio:/minio_data
command: minio server /minio_data --console-address ":9001"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 30s
timeout: 20s
retries: 3
standalone:
container_name: milvus-standalone
image: milvusdb/milvus:v2.5.7
command: ["milvus", "run", "standalone"]
security_opt:
- seccomp:unconfined
environment:
ETCD_ENDPOINTS: etcd:2379
MINIO_ADDRESS: minio:9000
volumes:
- ${DOCKER_VOLUME_DIRECTORY:-.}/volumes/milvus:/var/lib/milvus
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9091/healthz"]
interval: 30s
start_period: 90s
timeout: 20s
retries: 3
ports:
- "19530:19530"
- "9091:9091"
depends_on:
- "etcd"
- "minio"
attu:
container_name: attu
image: zilliz/attu:v2.5.7
environment:
MILVUS_URL: milvus-standalone:19530
ports:
- "19500:3000" # 外部端口19500可以自定义
depends_on:
- "standalone"
networks:
default:
name: milvus

View File

@@ -0,0 +1,36 @@
# RuoYi-AI 后端 Dockerfile
# 基于 Maven + OpenJDK 17
FROM maven:3.9-eclipse-temurin-17 AS builder
# 设置工作目录
WORKDIR /build
# 复制 pom.xml 和源码
COPY pom.xml .
COPY ruoyi-admin ./ruoyi-admin
COPY ruoyi-common ./ruoyi-common
COPY ruoyi-modules ./ruoyi-modules
COPY ruoyi-extend ./ruoyi-extend
# 构建项目 (使用 prod profile)
RUN mvn clean package -Pprod -DskipTests
# 最终运行镜像
FROM eclipse-temurin:17-jre-alpine
# 设置工作目录
WORKDIR /app
# 从构建阶段复制 jar 包
COPY --from=builder /build/ruoyi-admin/target/ruoyi-admin.jar ./ruoyi-admin.jar
# 创建日志目录
RUN mkdir -p /ruoyi/server/logs
# 暴露端口
EXPOSE 6039
# 启动命令
ENTRYPOINT ["java", "-jar", "ruoyi-admin.jar", "--spring.profiles.active=prod"]

View File

@@ -0,0 +1,21 @@
# 基于官方MySQL 8.0镜像构建自定义镜像
# 构建命令: docker build -t registry.cn-hangzhou.aliyuncs.com/ruoyi-ai/mysql:v3 -f Dockerfile.mysql .
FROM mysql:8.0.33
# 设置时区
ENV TZ=Asia/Shanghai
# 复制初始化脚本和SQL文件到镜像中
COPY docs/script/docker/mysql/init/init-db.sh /docker-entrypoint-initdb.d/init-db.sh
COPY docs/script/sql/ruoyi-ai-v3_mysql8.sql /docker-entrypoint-initdb.d/ruoyi-ai-v3_mysql8.sql
# 设置脚本可执行权限
RUN chmod +x /docker-entrypoint-initdb.d/init-db.sh
# MySQL启动参数
CMD ["--default-authentication-plugin=mysql_native_password", \
"--character-set-server=utf8mb4", \
"--collation-server=utf8mb4_general_ci", \
"--explicit_defaults_for_timestamp=true", \
"--lower_case_table_names=1", \
"--skip-ssl"]

View File

@@ -0,0 +1,180 @@
# RuoYi-AI 一键启动全部服务
# 使用方式: docker-compose up -d
#
# 包含服务:
# - MySQL 8.0 (数据库包含初始化SQL)
# - Redis 6.2 (缓存)
# - Weaviate (向量数据库)
# - MinIO (对象存储)
# - RuoYi-Backend (后端服务)
# - RuoYi-Admin (管理端前端)
# - RuoYi-Web (用户端前端)
#
# 镜像仓库地址: crpi-31mraxd99y2gqdgr.cn-beijing.personal.cr.aliyuncs.com/ruoyi_ai
version: '3.8'
services:
# ==================== MySQL 数据库 ====================
mysql:
# 阿里云镜像地址包含初始化SQL
image: crpi-31mraxd99y2gqdgr.cn-beijing.personal.cr.aliyuncs.com/ruoyi_ai/mysql:v3
container_name: ruoyi-ai-mysql
restart: always
ports:
- "23306:3306"
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: ruoyi-ai-agent
TZ: Asia/Shanghai
volumes:
- mysql-data:/var/lib/mysql
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-proot"]
interval: 15s
timeout: 10s
retries: 10
start_period: 60s
networks:
- ruoyi-net
# ==================== Redis 缓存 ====================
redis:
image: crpi-31mraxd99y2gqdgr.cn-beijing.personal.cr.aliyuncs.com/ruoyi_ai/redis:6.2
container_name: ruoyi-ai-redis
restart: always
ports:
- "26379:6379"
volumes:
- redis-data:/data
command: redis-server --appendonly yes
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
networks:
- ruoyi-net
# ==================== Weaviate 向量数据库 ====================
weaviate:
image: crpi-31mraxd99y2gqdgr.cn-beijing.personal.cr.aliyuncs.com/ruoyi_ai/weaviate:1.30.0
container_name: ruoyi-ai-weaviate
restart: always
ports:
- "28080:8080"
environment:
QUERY_DEFAULTS_LIMIT: 25
AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: true
PERSISTENCE_DATA_PATH: /var/lib/weaviate
DEFAULT_VECTORIZER_MODULE: none
ENABLE_MODULES: text2vec-cohere,text2vec-huggingface,text2vec-palm,text2vec-openai,generative-openai,generative-cohere,generative-palm,ref2vec-centroid,reranker-cohere,qna-openai
CLUSTER_HOSTNAME: node1
volumes:
- weaviate-data:/var/lib/weaviate
networks:
- ruoyi-net
# ==================== MinIO 对象存储 ====================
minio:
image: crpi-31mraxd99y2gqdgr.cn-beijing.personal.cr.aliyuncs.com/ruoyi_ai/minio:latest
container_name: ruoyi-ai-minio
restart: always
ports:
- "29000:9000"
- "29090:9090"
environment:
MINIO_ROOT_USER: ruoyi
MINIO_ROOT_PASSWORD: ruoyi123
volumes:
- minio-data:/data
command: server /data --console-address ":9090"
networks:
- ruoyi-net
# ==================== RuoYi-AI 后端服务 ====================
backend:
image: crpi-31mraxd99y2gqdgr.cn-beijing.personal.cr.aliyuncs.com/ruoyi_ai/ruoyi-ai-backend:latest
container_name: ruoyi-ai-backend
restart: always
ports:
- "26039:6039"
environment:
TZ: Asia/Shanghai
# MySQL 配置
SPRING_DATASOURCE_DYNAMIC_PRIMARY: master
SPRING_DATASOURCE_DYNAMIC_DATASOURCE_MASTER_DRIVERCLASSNAME: com.mysql.cj.jdbc.Driver
SPRING_DATASOURCE_DYNAMIC_DATASOURCE_MASTER_URL: jdbc:mysql://mysql:3306/ruoyi-ai-agent?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true
SPRING_DATASOURCE_DYNAMIC_DATASOURCE_MASTER_USERNAME: root
SPRING_DATASOURCE_DYNAMIC_DATASOURCE_MASTER_PASSWORD: root
# Redis 配置
SPRING_DATA_REDIS_HOST: redis
SPRING_DATA_REDIS_PORT: 6379
SPRING_DATA_REDIS_DATABASE: 0
# 日志配置
LOGGING_LEVEL_ORG_RUOYI: info
LOGGING_LEVEL_ORG_SPRINGFRAMEWORK: warn
SYS_UPLOAD_PATH: /ruoyi/upload
volumes:
- logs-data:/ruoyi/server/logs
- upload-data:/ruoyi/upload
depends_on:
mysql:
condition: service_healthy
redis:
condition: service_started
networks:
- ruoyi-net
# ==================== RuoYi-AI 管理端前端 ====================
admin-frontend:
image: crpi-31mraxd99y2gqdgr.cn-beijing.personal.cr.aliyuncs.com/ruoyi_ai/ruoyi-ai-admin:latest
container_name: ruoyi-ai-admin
restart: always
ports:
- "25666:5666"
environment:
# 后端 API 地址 - 运行时动态配置(无需重新构建镜像)
# nginx upstream 配置不需要 http:// 前缀,直接使用 host:port
UPSTREAM_HOST: backend:6039
# 资源限制 - 防止 CPU 和内存耗尽
deploy:
resources:
limits:
cpus: '2'
memory: 3G
reservations:
cpus: '1'
memory: 1G
depends_on:
- backend
networks:
- ruoyi-net
# ==================== RuoYi-AI 用户端前端 ====================
web-frontend:
image: crpi-31mraxd99y2gqdgr.cn-beijing.personal.cr.aliyuncs.com/ruoyi_ai/ruoyi-ai-web:latest
container_name: ruoyi-ai-web
restart: always
ports:
- "25137:5137"
environment:
UPSTREAM_URL: http://backend:6039
depends_on:
- backend
networks:
- ruoyi-net
# ==================== 网络配置 ====================
networks:
ruoyi-net:
driver: bridge
# ==================== 数据卷配置 ====================
volumes:
mysql-data:
redis-data:
weaviate-data:
minio-data:
logs-data:
upload-data:

View File

@@ -0,0 +1,144 @@
# RuoYi-AI 一键启动后端服务
# 使用方式: docker-compose up -d --build
#
# 包含服务:
# - MySQL 8.0 (数据库)
# - Redis 6.2 (缓存)
# - Weaviate (向量数据库)
# - MinIO (对象存储)
# - RuoYi-Backend (后端服务,源码编译)
services:
# MySQL 数据库
mysql:
image: mysql:8.0.33
container_name: ruoyi-ai-mysql
restart: always
ports:
- "23306:3306"
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: ruoyi-ai-agent
TZ: Asia/Shanghai
volumes:
- ./docs/script/docker/mysql/init/init-db.sh:/docker-entrypoint-initdb.d/init-db.sh:ro
- ./docs/script/sql/ruoyi-ai-v3_mysql8.sql:/docker-entrypoint-initdb.d/ruoyi-ai-v3_mysql8.sql:ro
- mysql-data:/var/lib/mysql
command:
--default-authentication-plugin=mysql_native_password
--character-set-server=utf8mb4
--collation-server=utf8mb4_general_ci
--explicit_defaults_for_timestamp=true
--lower_case_table_names=1
--skip-ssl
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-proot"]
interval: 15s
timeout: 10s
retries: 10
start_period: 60s
networks:
- ruoyi-net
# Redis 缓存
redis:
image: redis:6.2
container_name: ruoyi-ai-redis
restart: always
ports:
- "6379:6379"
volumes:
- redis-data:/data
command: redis-server --appendonly yes
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
networks:
- ruoyi-net
# Weaviate 向量数据库
weaviate:
image: semitechnologies/weaviate:1.30.0
container_name: ruoyi-ai-weaviate
restart: always
ports:
- "28080:8080"
environment:
QUERY_DEFAULTS_LIMIT: 25
AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: true
PERSISTENCE_DATA_PATH: /var/lib/weaviate
DEFAULT_VECTORIZER_MODULE: none
ENABLE_MODULES: text2vec-cohere,text2vec-huggingface,text2vec-palm,text2vec-openai,generative-openai,generative-cohere,generative-palm,ref2vec-centroid,reranker-cohere,qna-openai
CLUSTER_HOSTNAME: node1
volumes:
- weaviate-data:/var/lib/weaviate
networks:
- ruoyi-net
# MinIO 对象存储
minio:
image: minio/minio
container_name: ruoyi-ai-minio
restart: always
ports:
- "9000:9000"
- "9090:9090"
environment:
MINIO_ROOT_USER: ruoyi
MINIO_ROOT_PASSWORD: ruoyi123
volumes:
- minio-data:/data
command: server /data --console-address ":9090"
networks:
- ruoyi-net
# RuoYi-AI 后端服务 (源码编译)
backend:
build:
context: .
dockerfile: Dockerfile.backend
container_name: ruoyi-ai-backend
restart: always
ports:
- "26039:6039"
environment:
TZ: Asia/Shanghai
# MySQL 配置
SPRING_DATASOURCE_DYNAMIC_PRIMARY: master
SPRING_DATASOURCE_DYNAMIC_DATASOURCE_MASTER_DRIVERCLASSNAME: com.mysql.cj.jdbc.Driver
SPRING_DATASOURCE_DYNAMIC_DATASOURCE_MASTER_URL: jdbc:mysql://mysql:3306/ruoyi-ai-agent?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true
SPRING_DATASOURCE_DYNAMIC_DATASOURCE_MASTER_USERNAME: root
SPRING_DATASOURCE_DYNAMIC_DATASOURCE_MASTER_PASSWORD: root
# Redis 配置
SPRING_DATA_REDIS_HOST: redis
SPRING_DATA_REDIS_PORT: 6379
SPRING_DATA_REDIS_DATABASE: 0
# 日志配置
LOGGING_LEVEL_ORG_RUOYI: info
LOGGING_LEVEL_ORG_SPRINGFRAMEWORK: warn
SYS_UPLOAD_PATH: /ruoyi/upload # 新增:对应 sys.upload.path
volumes:
- logs-data:/ruoyi/server/logs
- upload-data:/ruoyi/upload
depends_on:
mysql:
condition: service_healthy
redis:
condition: service_started
networks:
- ruoyi-net
networks:
ruoyi-net:
driver: bridge
# 数据卷 支持手动指定 空为默认值
volumes:
mysql-data:
redis-data:
weaviate-data:
minio-data:
logs-data:
upload-data:

View File

@@ -0,0 +1,25 @@
---
services:
weaviate:
command:
- --host
- 0.0.0.0
- --port
- '6038'
- --scheme
- http
image: semitechnologies/weaviate:1.19.7
ports:
- 6038:6038
- 50051:50051
volumes:
- weaviate_data:/var/lib/weaviate
environment:
QUERY_DEFAULTS_LIMIT: 25
AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'true'
PERSISTENCE_DATA_PATH: '/var/lib/weaviate'
DEFAULT_VECTORIZER_MODULE: 'none'
CLUSTER_HOSTNAME: 'node1'
volumes:
weaviate_data:
...

BIN
docs/image/bibi.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

BIN
docs/image/dy.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

BIN
docs/image/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

BIN
docs/image/qq.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 KiB

BIN
docs/image/wx.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 KiB

View File

@@ -0,0 +1,10 @@
#!/bin/bash
# 数据库初始化脚本
# 使用 --force 参数确保即使出错也继续执行
echo "开始初始化数据库..."
# 使用 --force 参数忽略错误继续执行
mysql -uroot -proot ruoyi-ai-agent --force < /docker-entrypoint-initdb.d/ruoyi-ai-v3_mysql8.sql
echo "数据库初始化完成"

View File

@@ -0,0 +1,129 @@
{
"nodeList": [
{
"nodeType": "0",
"nodeCode": "d5ee3ddf-3968-4379-a86f-9ceabde5faac",
"nodeName": "开始",
"permissionFlag": null,
"nodeRatio": "0.000",
"anyNodeSkip": null,
"listenerType": null,
"listenerPath": null,
"formCustom": "N",
"formPath": null,
"ext": "[]",
"coordinate": "200,200|200,200",
"version": "1",
"skipList": [
{
"skipType": "PASS",
"skipCondition": null,
"skipName": null,
"nowNodeCode": "d5ee3ddf-3968-4379-a86f-9ceabde5faac",
"nextNodeCode": "dd515cdd-59f6-446f-94ca-25ca062afb42",
"coordinate": "220,200;310,200"
}
]
},
{
"nodeType": "1",
"nodeCode": "dd515cdd-59f6-446f-94ca-25ca062afb42",
"nodeName": "申请人",
"permissionFlag": "",
"nodeRatio": "0.000",
"anyNodeSkip": null,
"listenerType": "",
"listenerPath": "",
"formCustom": "N",
"formPath": null,
"ext": "[{\"code\":\"ButtonPermissionEnum\",\"value\":\"back,termination,file,copy\"}]",
"coordinate": "360,200|360,200",
"version": "1",
"skipList": [
{
"skipType": "PASS",
"skipCondition": null,
"skipName": null,
"nowNodeCode": "dd515cdd-59f6-446f-94ca-25ca062afb42",
"nextNodeCode": "78fa8e5b-e809-44ed-978a-41092409ebcf",
"coordinate": "410,200;490,200"
}
]
},
{
"nodeType": "1",
"nodeCode": "78fa8e5b-e809-44ed-978a-41092409ebcf",
"nodeName": "组长",
"permissionFlag": "role:1",
"nodeRatio": "0.000",
"anyNodeSkip": null,
"listenerType": "",
"listenerPath": "",
"formCustom": "N",
"formPath": null,
"ext": "[{\"code\":\"ButtonPermissionEnum\",\"value\":\"back,termination,copy,transfer,trust,file\"}]",
"coordinate": "540,200|540,200",
"version": "1",
"skipList": [
{
"skipType": "PASS",
"skipCondition": null,
"skipName": null,
"nowNodeCode": "78fa8e5b-e809-44ed-978a-41092409ebcf",
"nextNodeCode": "a8abf15f-b83e-428a-86cc-033555ea9bbe",
"coordinate": "590,200;670,200"
}
]
},
{
"nodeType": "1",
"nodeCode": "a8abf15f-b83e-428a-86cc-033555ea9bbe",
"nodeName": "部门主管",
"permissionFlag": "role:3@@role:4",
"nodeRatio": "0.000",
"anyNodeSkip": null,
"listenerType": "",
"listenerPath": "",
"formCustom": "N",
"formPath": null,
"ext": "[{\"code\":\"ButtonPermissionEnum\",\"value\":\"back,termination,copy,transfer,trust,file\"}]",
"coordinate": "720,200|720,200",
"version": "1",
"skipList": [
{
"skipType": "PASS",
"skipCondition": null,
"skipName": null,
"nowNodeCode": "a8abf15f-b83e-428a-86cc-033555ea9bbe",
"nextNodeCode": "8b82b7d7-8660-455e-b880-d6d22ea3eb6d",
"coordinate": "770,200;880,200"
}
]
},
{
"nodeType": "2",
"nodeCode": "8b82b7d7-8660-455e-b880-d6d22ea3eb6d",
"nodeName": "结束",
"permissionFlag": null,
"nodeRatio": "0.000",
"anyNodeSkip": null,
"listenerType": null,
"listenerPath": null,
"formCustom": "N",
"formPath": null,
"ext": "[]",
"coordinate": "900,200|900,200",
"version": "1",
"skipList": []
}
],
"flowCode": "leave1",
"flowName": "请假申请-普通",
"modelValue": "CLASSICS",
"category": "103",
"version": "1",
"formCustom": "N",
"formPath": "/workflow/leaveEdit/index",
"listenerType": null,
"listenerPath": null
}

View File

@@ -0,0 +1,187 @@
{
"nodeList": [
{
"nodeType": "0",
"nodeCode": "cef3895c-f7d8-4598-8bf3-8ec2ef6ce84a",
"nodeName": "开始",
"permissionFlag": null,
"nodeRatio": "0.000",
"anyNodeSkip": null,
"listenerType": null,
"listenerPath": null,
"formCustom": "N",
"formPath": null,
"ext": "[]",
"coordinate": "300,240|300,240",
"version": "1",
"skipList": [
{
"skipType": "PASS",
"skipCondition": null,
"skipName": null,
"nowNodeCode": "cef3895c-f7d8-4598-8bf3-8ec2ef6ce84a",
"nextNodeCode": "fdcae93b-b69c-498a-b231-09255e74bcbd",
"coordinate": "320,240;390,240"
}
]
},
{
"nodeType": "1",
"nodeCode": "fdcae93b-b69c-498a-b231-09255e74bcbd",
"nodeName": "申请人",
"permissionFlag": "",
"nodeRatio": "0.000",
"anyNodeSkip": null,
"listenerType": "",
"listenerPath": "",
"formCustom": "N",
"formPath": null,
"ext": "[{\"code\":\"ButtonPermissionEnum\",\"value\":\"back,termination,file\"}]",
"coordinate": "440,240|440,240",
"version": "1",
"skipList": [
{
"skipType": "PASS",
"skipCondition": null,
"skipName": null,
"nowNodeCode": "fdcae93b-b69c-498a-b231-09255e74bcbd",
"nextNodeCode": "7b8c7ead-7dc8-4951-a7f3-f0c41995909e",
"coordinate": "490,240;535,240"
}
]
},
{
"nodeType": "3",
"nodeCode": "7b8c7ead-7dc8-4951-a7f3-f0c41995909e",
"permissionFlag": null,
"nodeRatio": "0.000",
"anyNodeSkip": null,
"listenerType": null,
"listenerPath": null,
"formCustom": "N",
"formPath": null,
"ext": "[]",
"coordinate": "560,240",
"version": "1",
"skipList": [
{
"skipType": "PASS",
"skipCondition": "le@@leaveDays|2",
"skipName": null,
"nowNodeCode": "7b8c7ead-7dc8-4951-a7f3-f0c41995909e",
"nextNodeCode": "b3528155-dcb7-4445-bbdf-3d00e3499e86",
"coordinate": "560,265;560,320;670,320"
},
{
"skipType": "PASS",
"skipCondition": "gt@@leaveDays|2",
"skipName": "大于两天",
"nowNodeCode": "7b8c7ead-7dc8-4951-a7f3-f0c41995909e",
"nextNodeCode": "5ed2362b-fc0c-4d52-831f-95208b830605",
"coordinate": "560,215;560,160;670,160|560,187"
}
]
},
{
"nodeType": "1",
"nodeCode": "b3528155-dcb7-4445-bbdf-3d00e3499e86",
"nodeName": "组长",
"permissionFlag": "3@@4",
"nodeRatio": "0.000",
"anyNodeSkip": null,
"listenerType": "",
"listenerPath": "",
"formCustom": "N",
"formPath": null,
"ext": "[{\"code\":\"ButtonPermissionEnum\",\"value\":\"back,termination,file,transfer,trust,copy\"}]",
"coordinate": "720,320|720,320",
"version": "1",
"skipList": [
{
"skipType": "PASS",
"skipCondition": null,
"skipName": null,
"nowNodeCode": "b3528155-dcb7-4445-bbdf-3d00e3499e86",
"nextNodeCode": "c9fa6d7d-2a74-4e78-b947-0cad8a6af869",
"coordinate": "770,320;860,320;860,280"
}
]
},
{
"nodeType": "1",
"nodeCode": "c9fa6d7d-2a74-4e78-b947-0cad8a6af869",
"nodeName": "总经理",
"permissionFlag": "role:1",
"nodeRatio": "0.000",
"anyNodeSkip": null,
"listenerType": "",
"listenerPath": "",
"formCustom": "N",
"formPath": null,
"ext": "[{\"code\":\"ButtonPermissionEnum\",\"value\":\"back,termination,file,transfer,trust,copy\"}]",
"coordinate": "860,240|860,240",
"version": "1",
"skipList": [
{
"skipType": "PASS",
"skipCondition": null,
"skipName": null,
"nowNodeCode": "c9fa6d7d-2a74-4e78-b947-0cad8a6af869",
"nextNodeCode": "40aa65fd-0712-4d23-b6f7-d0432b920fd1",
"coordinate": "910,240;980,240"
}
]
},
{
"nodeType": "2",
"nodeCode": "40aa65fd-0712-4d23-b6f7-d0432b920fd1",
"nodeName": "结束",
"permissionFlag": null,
"nodeRatio": "0.000",
"anyNodeSkip": null,
"listenerType": null,
"listenerPath": null,
"formCustom": "N",
"formPath": null,
"ext": "[]",
"coordinate": "1000,240|1000,240",
"version": "1",
"skipList": []
},
{
"nodeType": "1",
"nodeCode": "5ed2362b-fc0c-4d52-831f-95208b830605",
"nodeName": "部门领导",
"permissionFlag": "role:1",
"nodeRatio": "0.000",
"anyNodeSkip": null,
"listenerType": "",
"listenerPath": "",
"formCustom": "N",
"formPath": null,
"ext": "[{\"code\":\"ButtonPermissionEnum\",\"value\":\"back,termination,file,transfer,trust,copy\"}]",
"coordinate": "720,160|720,160",
"version": "1",
"skipList": [
{
"skipType": "PASS",
"skipCondition": null,
"skipName": null,
"nowNodeCode": "5ed2362b-fc0c-4d52-831f-95208b830605",
"nextNodeCode": "c9fa6d7d-2a74-4e78-b947-0cad8a6af869",
"nextNodeType": "1",
"coordinate": "770,160;860,160;860,200"
}
]
}
],
"flowCode": "leave2",
"flowName": "请假申请-排他网关",
"modelValue": "CLASSICS",
"category": "103",
"version": "1",
"formCustom": "N",
"formPath": "/workflow/leaveEdit/index",
"listenerType": null,
"listenerPath": null
}

View File

@@ -0,0 +1,211 @@
{
"nodeList": [
{
"nodeType": "0",
"nodeCode": "a80ecf9f-f465-4ae5-a429-e30ec5d0f957",
"nodeName": "开始",
"permissionFlag": null,
"nodeRatio": "0.000",
"anyNodeSkip": null,
"listenerType": null,
"listenerPath": null,
"formCustom": "N",
"formPath": null,
"ext": "[]",
"coordinate": "380,220|380,220",
"version": "1",
"skipList": [
{
"skipType": "PASS",
"skipCondition": null,
"skipName": null,
"nowNodeCode": "a80ecf9f-f465-4ae5-a429-e30ec5d0f957",
"nextNodeCode": "b7bbb571-06de-455c-8083-f83c07bf0b99",
"coordinate": "400,220;470,220"
}
]
},
{
"nodeType": "1",
"nodeCode": "b7bbb571-06de-455c-8083-f83c07bf0b99",
"nodeName": "申请人",
"permissionFlag": "",
"nodeRatio": "0.000",
"anyNodeSkip": null,
"listenerType": "",
"listenerPath": "",
"formCustom": "N",
"formPath": null,
"ext": "[{\"code\":\"ButtonPermissionEnum\",\"value\":\"back,termination,file\"}]",
"coordinate": "520,220|520,220",
"version": "1",
"skipList": [
{
"skipType": "PASS",
"skipCondition": null,
"skipName": null,
"nowNodeCode": "b7bbb571-06de-455c-8083-f83c07bf0b99",
"nextNodeCode": "84d7ed24-bb44-4ba1-bf1f-e6f5092d3f0a",
"coordinate": "570,220;655,220"
}
]
},
{
"nodeType": "4",
"nodeCode": "84d7ed24-bb44-4ba1-bf1f-e6f5092d3f0a",
"permissionFlag": null,
"nodeRatio": "0.000",
"anyNodeSkip": null,
"listenerType": null,
"listenerPath": null,
"formCustom": "N",
"formPath": null,
"ext": "[]",
"coordinate": "680,220",
"version": "1",
"skipList": [
{
"skipType": "PASS",
"skipCondition": null,
"skipName": null,
"nowNodeCode": "84d7ed24-bb44-4ba1-bf1f-e6f5092d3f0a",
"nextNodeCode": "4b7743cd-940c-431b-926f-e7b614fbf1fe",
"coordinate": "680,195;680,140;750,140"
},
{
"skipType": "PASS",
"skipCondition": null,
"skipName": null,
"nowNodeCode": "84d7ed24-bb44-4ba1-bf1f-e6f5092d3f0a",
"nextNodeCode": "762cb975-37d8-4276-b6db-79a4c3606394",
"coordinate": "680,245;680,300;750,300"
}
]
},
{
"nodeType": "1",
"nodeCode": "4b7743cd-940c-431b-926f-e7b614fbf1fe",
"nodeName": "市场部",
"permissionFlag": "role:1",
"nodeRatio": "0.000",
"anyNodeSkip": null,
"listenerType": "",
"listenerPath": "",
"formCustom": "N",
"formPath": null,
"ext": "[{\"code\":\"ButtonPermissionEnum\",\"value\":\"back,termination,file,transfer,trust,copy\"}]",
"coordinate": "800,140|800,140",
"version": "1",
"skipList": [
{
"skipType": "PASS",
"skipCondition": null,
"skipName": null,
"nowNodeCode": "4b7743cd-940c-431b-926f-e7b614fbf1fe",
"nextNodeCode": "b66b6563-f9fe-41cc-a782-f7837bb6f3d2",
"coordinate": "850,140;920,140;920,195"
}
]
},
{
"nodeType": "4",
"nodeCode": "b66b6563-f9fe-41cc-a782-f7837bb6f3d2",
"permissionFlag": null,
"nodeRatio": "0.000",
"anyNodeSkip": null,
"listenerType": null,
"listenerPath": null,
"formCustom": "N",
"formPath": null,
"ext": "[]",
"coordinate": "920,220",
"version": "1",
"skipList": [
{
"skipType": "PASS",
"skipCondition": null,
"skipName": null,
"nowNodeCode": "b66b6563-f9fe-41cc-a782-f7837bb6f3d2",
"nextNodeCode": "23e7429e-2b47-4431-b93e-40db7c431ce6",
"coordinate": "945,220;975,220;975,220;960,220;960,220;990,220"
}
]
},
{
"nodeType": "1",
"nodeCode": "23e7429e-2b47-4431-b93e-40db7c431ce6",
"nodeName": "CEO",
"permissionFlag": "1",
"nodeRatio": "0.000",
"anyNodeSkip": null,
"listenerType": "",
"listenerPath": "",
"formCustom": "N",
"formPath": null,
"ext": "[{\"code\":\"ButtonPermissionEnum\",\"value\":\"back,termination,file,transfer,trust,copy\"}]",
"coordinate": "1040,220|1040,220",
"version": "1",
"skipList": [
{
"skipType": "PASS",
"skipCondition": null,
"skipName": null,
"nowNodeCode": "23e7429e-2b47-4431-b93e-40db7c431ce6",
"nextNodeCode": "f5ace37f-5a5e-4e64-a6f6-913ab9a71cd1",
"coordinate": "1090,220;1140,220"
}
]
},
{
"nodeType": "2",
"nodeCode": "f5ace37f-5a5e-4e64-a6f6-913ab9a71cd1",
"nodeName": "结束",
"permissionFlag": null,
"nodeRatio": "0.000",
"anyNodeSkip": null,
"listenerType": null,
"listenerPath": null,
"formCustom": "N",
"formPath": null,
"ext": "[]",
"coordinate": "1160,220|1160,220",
"version": "1",
"skipList": []
},
{
"nodeType": "1",
"nodeCode": "762cb975-37d8-4276-b6db-79a4c3606394",
"nodeName": "综合部",
"permissionFlag": "role:3@@role:4",
"nodeRatio": "0.000",
"anyNodeSkip": null,
"listenerType": "",
"listenerPath": "",
"formCustom": "N",
"formPath": null,
"ext": "[{\"code\":\"ButtonPermissionEnum\",\"value\":\"back,termination,file,transfer,trust,copy\"}]",
"coordinate": "800,300|800,300",
"version": "1",
"skipList": [
{
"skipType": "PASS",
"skipCondition": null,
"skipName": null,
"nowNodeCode": "762cb975-37d8-4276-b6db-79a4c3606394",
"nextNodeCode": "b66b6563-f9fe-41cc-a782-f7837bb6f3d2",
"nextNodeType": "4",
"coordinate": "850,300;920,300;920,245"
}
]
}
],
"flowCode": "leave3",
"flowName": "请假申请-并行网关",
"modelValue": "CLASSICS",
"category": "103",
"version": "1",
"formCustom": "N",
"formPath": "/workflow/leaveEdit/index",
"listenerType": null,
"listenerPath": null
}

View File

@@ -0,0 +1,154 @@
{
"nodeList": [
{
"nodeType": "0",
"nodeCode": "9ce8bf00-f25b-4fc6-91b8-827082fc4876",
"nodeName": "开始",
"permissionFlag": null,
"nodeRatio": "0.000",
"anyNodeSkip": null,
"listenerType": null,
"listenerPath": null,
"formCustom": "N",
"formPath": null,
"ext": "[]",
"coordinate": "320,240|320,240",
"version": "1",
"skipList": [
{
"skipType": "PASS",
"skipCondition": null,
"skipName": null,
"nowNodeCode": "9ce8bf00-f25b-4fc6-91b8-827082fc4876",
"nextNodeCode": "e90b98ef-35b4-410c-a663-bae8b7624b9f",
"coordinate": "340,240;410,240"
}
]
},
{
"nodeType": "1",
"nodeCode": "e90b98ef-35b4-410c-a663-bae8b7624b9f",
"nodeName": "申请人",
"permissionFlag": "",
"nodeRatio": "0.000",
"anyNodeSkip": null,
"listenerType": "",
"listenerPath": "",
"formCustom": "N",
"formPath": null,
"ext": "[{\"code\":\"ButtonPermissionEnum\",\"value\":\"back,termination,file\"}]",
"coordinate": "460,240|460,240",
"version": "1",
"skipList": [
{
"skipType": "PASS",
"skipCondition": null,
"skipName": null,
"nowNodeCode": "e90b98ef-35b4-410c-a663-bae8b7624b9f",
"nextNodeCode": "768b5b1a-6726-4d67-8853-4cc70d5b1045",
"coordinate": "510,240;590,240"
}
]
},
{
"nodeType": "1",
"nodeCode": "768b5b1a-6726-4d67-8853-4cc70d5b1045",
"nodeName": "百分之60通过",
"permissionFlag": "${userList}",
"nodeRatio": "60.000",
"anyNodeSkip": null,
"listenerType": "",
"listenerPath": "",
"formCustom": "N",
"formPath": null,
"ext": "[{\"code\":\"ButtonPermissionEnum\",\"value\":\"back,termination,file,addSign,subSign\"}]",
"coordinate": "640,240|640,240",
"version": "1",
"skipList": [
{
"skipType": "PASS",
"skipCondition": null,
"skipName": null,
"nowNodeCode": "768b5b1a-6726-4d67-8853-4cc70d5b1045",
"nextNodeCode": "2f9f2e21-9bcf-42a3-a07c-13037aad22d1",
"coordinate": "690,240;770,240"
}
]
},
{
"nodeType": "1",
"nodeCode": "2f9f2e21-9bcf-42a3-a07c-13037aad22d1",
"nodeName": "全部审批通过",
"permissionFlag": "role:1@@role:3",
"nodeRatio": "100.000",
"anyNodeSkip": null,
"listenerType": "",
"listenerPath": "",
"formCustom": "N",
"formPath": null,
"ext": "[{\"code\":\"ButtonPermissionEnum\",\"value\":\"back,termination,file,addSign,subSign\"}]",
"coordinate": "820,240|820,240",
"version": "1",
"skipList": [
{
"skipType": "PASS",
"skipCondition": null,
"skipName": null,
"nowNodeCode": "2f9f2e21-9bcf-42a3-a07c-13037aad22d1",
"nextNodeCode": "27461e01-3d9f-4530-8fe3-bd5ec7f9571f",
"coordinate": "870,240;950,240"
}
]
},
{
"nodeType": "1",
"nodeCode": "27461e01-3d9f-4530-8fe3-bd5ec7f9571f",
"nodeName": "CEO",
"permissionFlag": "1",
"nodeRatio": "0.000",
"anyNodeSkip": null,
"listenerType": "",
"listenerPath": "",
"formCustom": "N",
"formPath": null,
"ext": "[{\"code\":\"ButtonPermissionEnum\",\"value\":\"back,termination,file,transfer,trust,copy\"}]",
"coordinate": "1000,240|1000,240",
"version": "1",
"skipList": [
{
"skipType": "PASS",
"skipCondition": null,
"skipName": null,
"nowNodeCode": "27461e01-3d9f-4530-8fe3-bd5ec7f9571f",
"nextNodeCode": "b62b88c3-8d8d-4969-911e-2aaea219e7fc",
"coordinate": "1050,240;1080,240;1080,240;1070,240;1070,240;1100,240"
}
]
},
{
"nodeType": "2",
"nodeCode": "b62b88c3-8d8d-4969-911e-2aaea219e7fc",
"nodeName": "结束",
"permissionFlag": null,
"nodeRatio": "0.000",
"anyNodeSkip": null,
"listenerType": null,
"listenerPath": null,
"formCustom": "N",
"formPath": null,
"ext": "[]",
"coordinate": "1120,240|1120,240",
"version": "1",
"skipList": []
}
],
"flowCode": "leave4",
"flowName": "请假申请-会签",
"modelValue": "CLASSICS",
"category": "103",
"version": "1",
"formCustom": "N",
"formPath": "/workflow/leaveEdit/index",
"listenerType": null,
"listenerPath": null
}

View File

@@ -0,0 +1,211 @@
{
"nodeList": [
{
"nodeType": "0",
"nodeCode": "ebebaf26-9cb6-497e-8119-4c9fed4c597c",
"nodeName": "开始",
"permissionFlag": null,
"nodeRatio": "0.000",
"anyNodeSkip": null,
"listenerType": null,
"listenerPath": null,
"formCustom": "N",
"formPath": null,
"ext": "[]",
"coordinate": "300,220|300,220",
"version": "1",
"skipList": [
{
"skipType": "PASS",
"skipCondition": null,
"skipName": null,
"nowNodeCode": "ebebaf26-9cb6-497e-8119-4c9fed4c597c",
"nextNodeCode": "e1b04e96-dc81-4858-a309-2fe945d2f374",
"coordinate": "320,220;350,220;350,220;340,220;340,220;370,220"
}
]
},
{
"nodeType": "1",
"nodeCode": "e1b04e96-dc81-4858-a309-2fe945d2f374",
"nodeName": "申请人",
"permissionFlag": "",
"nodeRatio": "0.000",
"anyNodeSkip": null,
"listenerType": "",
"listenerPath": "",
"formCustom": "N",
"formPath": null,
"ext": "[{\"code\":\"ButtonPermissionEnum\",\"value\":\"back,termination,file\"}]",
"coordinate": "420,220|420,220",
"version": "1",
"skipList": [
{
"skipType": "PASS",
"skipCondition": null,
"skipName": null,
"nowNodeCode": "e1b04e96-dc81-4858-a309-2fe945d2f374",
"nextNodeCode": "3e743f4f-51ca-41d4-8e94-21f5dd9b59c9",
"coordinate": "470,220;535,220"
}
]
},
{
"nodeType": "4",
"nodeCode": "3e743f4f-51ca-41d4-8e94-21f5dd9b59c9",
"permissionFlag": null,
"nodeRatio": "0.000",
"anyNodeSkip": null,
"listenerType": null,
"listenerPath": null,
"formCustom": "N",
"formPath": null,
"ext": "[]",
"coordinate": "560,220",
"version": "1",
"skipList": [
{
"skipType": "PASS",
"skipCondition": null,
"skipName": null,
"nowNodeCode": "3e743f4f-51ca-41d4-8e94-21f5dd9b59c9",
"nextNodeCode": "c80f273e-1f17-4bd8-9ad1-04a4a94ea862",
"coordinate": "560,245;560,320;650,320"
},
{
"skipType": "PASS",
"skipCondition": null,
"skipName": null,
"nowNodeCode": "3e743f4f-51ca-41d4-8e94-21f5dd9b59c9",
"nextNodeCode": "1e3e8d3b-18ae-4d6c-a814-ce0d724adfa4",
"coordinate": "560,195;560,120;650,120"
}
]
},
{
"nodeType": "1",
"nodeCode": "c80f273e-1f17-4bd8-9ad1-04a4a94ea862",
"nodeName": "会签",
"permissionFlag": "role:1@@role:3",
"nodeRatio": "100.000",
"anyNodeSkip": null,
"listenerType": "",
"listenerPath": "",
"formCustom": "N",
"formPath": null,
"ext": "[{\"code\":\"ButtonPermissionEnum\",\"value\":\"back,termination,file,addSign,subSign\"}]",
"coordinate": "700,320|700,320",
"version": "1",
"skipList": [
{
"skipType": "PASS",
"skipCondition": null,
"skipName": null,
"nowNodeCode": "c80f273e-1f17-4bd8-9ad1-04a4a94ea862",
"nextNodeCode": "1a20169e-3d82-4926-a151-e2daad28de1b",
"coordinate": "750,320;860,320;860,245"
}
]
},
{
"nodeType": "4",
"nodeCode": "1a20169e-3d82-4926-a151-e2daad28de1b",
"permissionFlag": null,
"nodeRatio": "0.000",
"anyNodeSkip": null,
"listenerType": null,
"listenerPath": null,
"formCustom": "N",
"formPath": null,
"ext": "[]",
"coordinate": "860,220",
"version": "1",
"skipList": [
{
"skipType": "PASS",
"skipCondition": null,
"skipName": null,
"nowNodeCode": "1a20169e-3d82-4926-a151-e2daad28de1b",
"nextNodeCode": "7a8f0473-e409-442e-a843-5c2b813d00e9",
"coordinate": "885,220;950,220"
}
]
},
{
"nodeType": "1",
"nodeCode": "7a8f0473-e409-442e-a843-5c2b813d00e9",
"nodeName": "CEO",
"permissionFlag": "1",
"nodeRatio": "0.000",
"anyNodeSkip": null,
"listenerType": "",
"listenerPath": "",
"formCustom": "N",
"formPath": null,
"ext": "[{\"code\":\"ButtonPermissionEnum\",\"value\":\"back,termination,file,transfer,trust,copy\"}]",
"coordinate": "1000,220|1000,220",
"version": "1",
"skipList": [
{
"skipType": "PASS",
"skipCondition": null,
"skipName": null,
"nowNodeCode": "7a8f0473-e409-442e-a843-5c2b813d00e9",
"nextNodeCode": "03c4d2bc-58b5-4408-a2e4-65afb046f169",
"coordinate": "1050,220;1120,220"
}
]
},
{
"nodeType": "2",
"nodeCode": "03c4d2bc-58b5-4408-a2e4-65afb046f169",
"nodeName": "结束",
"permissionFlag": null,
"nodeRatio": "0.000",
"anyNodeSkip": null,
"listenerType": null,
"listenerPath": null,
"formCustom": "N",
"formPath": null,
"ext": "[]",
"coordinate": "1140,220|1140,220",
"version": "1",
"skipList": []
},
{
"nodeType": "1",
"nodeCode": "1e3e8d3b-18ae-4d6c-a814-ce0d724adfa4",
"nodeName": "百分之60票签",
"permissionFlag": "${userList}",
"nodeRatio": "60.000",
"anyNodeSkip": null,
"listenerType": "",
"listenerPath": "",
"formCustom": "N",
"formPath": null,
"ext": "[{\"code\":\"ButtonPermissionEnum\",\"value\":\"back,termination,file,addSign,subSign\"}]",
"coordinate": "700,120|700,120",
"version": "1",
"skipList": [
{
"skipType": "PASS",
"skipCondition": null,
"skipName": null,
"nowNodeCode": "1e3e8d3b-18ae-4d6c-a814-ce0d724adfa4",
"nextNodeCode": "1a20169e-3d82-4926-a151-e2daad28de1b",
"nextNodeType": "4",
"coordinate": "750,120;860,120;860,195"
}
]
}
],
"flowCode": "leave5",
"flowName": "请假申请-并行会签网关",
"modelValue": "CLASSICS",
"category": "103",
"version": "1",
"formCustom": "N",
"formPath": "/workflow/leaveEdit/index",
"listenerType": null,
"listenerPath": null
}

View File

@@ -0,0 +1,368 @@
{
"nodeList": [
{
"nodeType": "0",
"nodeCode": "122b89a5-7c6f-40a3-aa09-7a263f902054",
"nodeName": "开始",
"permissionFlag": null,
"nodeRatio": "0.000",
"anyNodeSkip": null,
"listenerType": null,
"listenerPath": null,
"formCustom": "N",
"formPath": null,
"ext": "[]",
"coordinate": "240,300|240,300",
"version": "1",
"skipList": [
{
"skipType": "PASS",
"skipCondition": null,
"skipName": null,
"nowNodeCode": "122b89a5-7c6f-40a3-aa09-7a263f902054",
"nextNodeCode": "c25a0e86-fdd1-4f03-8e22-14db70389dbd",
"coordinate": "260,300;350,300"
}
]
},
{
"nodeType": "1",
"nodeCode": "c25a0e86-fdd1-4f03-8e22-14db70389dbd",
"nodeName": "申请人",
"permissionFlag": "",
"nodeRatio": "0.000",
"anyNodeSkip": null,
"listenerType": "",
"listenerPath": "",
"formCustom": "N",
"formPath": null,
"ext": "[{\"code\":\"ButtonPermissionEnum\",\"value\":\"back,termination,file\"}]",
"coordinate": "400,300|400,300",
"version": "1",
"skipList": [
{
"skipType": "PASS",
"skipCondition": null,
"skipName": null,
"nowNodeCode": "c25a0e86-fdd1-4f03-8e22-14db70389dbd",
"nextNodeCode": "07ecda1d-7a0a-47b5-8a91-6186c9473742",
"coordinate": "450,300;510,300"
}
]
},
{
"nodeType": "1",
"nodeCode": "2bfa3919-78cf-4bc1-b59b-df463a4546f9",
"nodeName": "副经理",
"permissionFlag": "role:1@@role:3@@role:4",
"nodeRatio": "0.000",
"anyNodeSkip": null,
"listenerType": "",
"listenerPath": "",
"formCustom": "N",
"formPath": null,
"ext": "[{\"code\":\"ButtonPermissionEnum\",\"value\":\"back,termination\"}]",
"coordinate": "860,200|860,200",
"version": "1",
"skipList": [
{
"skipType": "PASS",
"skipCondition": null,
"skipName": null,
"nowNodeCode": "2bfa3919-78cf-4bc1-b59b-df463a4546f9",
"nextNodeCode": "394e1cc8-b8b2-4189-9f81-44448e88ac32",
"coordinate": "910,200;1000,200;1000,275"
}
]
},
{
"nodeType": "1",
"nodeCode": "ec17f60e-94e0-4d96-a3ce-3417e9d32d60",
"nodeName": "组长",
"permissionFlag": "1",
"nodeRatio": "0.000",
"anyNodeSkip": null,
"listenerType": "",
"listenerPath": "",
"formCustom": "N",
"formPath": null,
"ext": "[{\"code\":\"ButtonPermissionEnum\",\"value\":\"back,termination\"}]",
"coordinate": "860,400|860,400",
"version": "1",
"skipList": [
{
"skipType": "PASS",
"skipCondition": null,
"skipName": null,
"nowNodeCode": "ec17f60e-94e0-4d96-a3ce-3417e9d32d60",
"nextNodeCode": "394e1cc8-b8b2-4189-9f81-44448e88ac32",
"coordinate": "910,400;1000,400;1000,325"
}
]
},
{
"nodeType": "1",
"nodeCode": "07ecda1d-7a0a-47b5-8a91-6186c9473742",
"nodeName": "副组长",
"permissionFlag": "1",
"nodeRatio": "0.000",
"anyNodeSkip": null,
"listenerType": "",
"listenerPath": "",
"formCustom": "N",
"formPath": null,
"ext": "[{\"code\":\"ButtonPermissionEnum\",\"value\":\"back,termination,transfer,copy,pop\"}]",
"coordinate": "560,300|560,300",
"version": "1",
"skipList": [
{
"skipType": "PASS",
"skipCondition": null,
"skipName": null,
"nowNodeCode": "07ecda1d-7a0a-47b5-8a91-6186c9473742",
"nextNodeCode": "48117e2c-6328-406b-b102-c4a9d115bb13",
"coordinate": "610,300;675,300"
}
]
},
{
"nodeType": "3",
"nodeCode": "48117e2c-6328-406b-b102-c4a9d115bb13",
"permissionFlag": null,
"nodeRatio": "0.000",
"anyNodeSkip": null,
"listenerType": null,
"listenerPath": null,
"formCustom": "N",
"formPath": null,
"ext": "[]",
"coordinate": "700,300",
"version": "1",
"skipList": [
{
"skipType": "PASS",
"skipCondition": "default@@${leaveDays > 2}",
"skipName": "大于两天",
"nowNodeCode": "48117e2c-6328-406b-b102-c4a9d115bb13",
"nextNodeCode": "2bfa3919-78cf-4bc1-b59b-df463a4546f9",
"nextNodeType": "1",
"coordinate": "700,275;700,200;810,200|700,237"
},
{
"skipType": "PASS",
"skipCondition": "spel@@#{@testLeaveServiceImpl.eval(#leaveDays)}",
"skipName": null,
"nowNodeCode": "48117e2c-6328-406b-b102-c4a9d115bb13",
"nextNodeCode": "ec17f60e-94e0-4d96-a3ce-3417e9d32d60",
"nextNodeType": "1",
"coordinate": "700,325;700,400;810,400"
}
]
},
{
"nodeType": "3",
"nodeCode": "394e1cc8-b8b2-4189-9f81-44448e88ac32",
"permissionFlag": null,
"nodeRatio": "0.000",
"anyNodeSkip": null,
"listenerType": null,
"listenerPath": null,
"formCustom": "N",
"formPath": null,
"ext": "[]",
"coordinate": "1000,300",
"version": "1",
"skipList": [
{
"skipType": "PASS",
"skipCondition": null,
"skipName": null,
"nowNodeCode": "394e1cc8-b8b2-4189-9f81-44448e88ac32",
"nextNodeCode": "9c93a195-cff2-4e17-ab0a-a4f264191496",
"coordinate": "1025,300;1130,300"
}
]
},
{
"nodeType": "1",
"nodeCode": "9c93a195-cff2-4e17-ab0a-a4f264191496",
"nodeName": "经理会签",
"permissionFlag": "1@@3",
"nodeRatio": "100.000",
"anyNodeSkip": null,
"listenerType": "",
"listenerPath": "",
"formCustom": "N",
"formPath": null,
"ext": "[{\"code\":\"ButtonPermissionEnum\",\"value\":\"back,termination,pop,addSign,subSign\"}]",
"coordinate": "1180,300|1180,300",
"version": "1",
"skipList": [
{
"skipType": "PASS",
"skipCondition": null,
"skipName": null,
"nowNodeCode": "9c93a195-cff2-4e17-ab0a-a4f264191496",
"nextNodeCode": "a1a42056-afd1-4e90-88bc-36cbf5a66992",
"coordinate": "1230,300;1315,300"
}
]
},
{
"nodeType": "4",
"nodeCode": "a1a42056-afd1-4e90-88bc-36cbf5a66992",
"permissionFlag": null,
"nodeRatio": "0.000",
"anyNodeSkip": null,
"listenerType": null,
"listenerPath": null,
"formCustom": "N",
"formPath": null,
"ext": "[]",
"coordinate": "1340,300",
"version": "1",
"skipList": [
{
"skipType": "PASS",
"skipCondition": null,
"skipName": null,
"nowNodeCode": "a1a42056-afd1-4e90-88bc-36cbf5a66992",
"nextNodeCode": "fcfdd9f6-f526-4c1a-b71d-88afa31aebc5",
"coordinate": "1340,325;1340,400;1430,400"
},
{
"skipType": "PASS",
"skipCondition": null,
"skipName": null,
"nowNodeCode": "a1a42056-afd1-4e90-88bc-36cbf5a66992",
"nextNodeCode": "350dfa0c-a77c-4efa-8527-10efa02d8be4",
"coordinate": "1340,275;1340,200;1430,200"
}
]
},
{
"nodeType": "1",
"nodeCode": "350dfa0c-a77c-4efa-8527-10efa02d8be4",
"nodeName": "总经理",
"permissionFlag": "3@@1",
"nodeRatio": "0.000",
"anyNodeSkip": null,
"listenerType": "",
"listenerPath": "",
"formCustom": "N",
"formPath": null,
"ext": "[{\"code\":\"ButtonPermissionEnum\",\"value\":\"back,termination\"}]",
"coordinate": "1480,200|1480,200",
"version": "1",
"skipList": [
{
"skipType": "PASS",
"skipCondition": null,
"skipName": null,
"nowNodeCode": "350dfa0c-a77c-4efa-8527-10efa02d8be4",
"nextNodeCode": "c36a46ef-04f9-463f-bad7-4b395c818519",
"coordinate": "1530,200;1640,200;1640,275"
}
]
},
{
"nodeType": "1",
"nodeCode": "fcfdd9f6-f526-4c1a-b71d-88afa31aebc5",
"nodeName": "副总经理",
"permissionFlag": "1@@3",
"nodeRatio": "0.000",
"anyNodeSkip": null,
"listenerType": "",
"listenerPath": "",
"formCustom": "N",
"formPath": null,
"ext": "[{\"code\":\"ButtonPermissionEnum\",\"value\":\"back,termination\"}]",
"coordinate": "1480,400|1480,400",
"version": "1",
"skipList": [
{
"skipType": "PASS",
"skipCondition": null,
"skipName": null,
"nowNodeCode": "fcfdd9f6-f526-4c1a-b71d-88afa31aebc5",
"nextNodeCode": "c36a46ef-04f9-463f-bad7-4b395c818519",
"coordinate": "1530,400;1640,400;1640,325"
}
]
},
{
"nodeType": "4",
"nodeCode": "c36a46ef-04f9-463f-bad7-4b395c818519",
"permissionFlag": null,
"nodeRatio": "0.000",
"anyNodeSkip": null,
"listenerType": null,
"listenerPath": null,
"formCustom": "N",
"formPath": null,
"ext": "[]",
"coordinate": "1640,300",
"version": "1",
"skipList": [
{
"skipType": "PASS",
"skipCondition": null,
"skipName": null,
"nowNodeCode": "c36a46ef-04f9-463f-bad7-4b395c818519",
"nextNodeCode": "3fcea762-b53a-4ae1-8365-7bec90444828",
"coordinate": "1665,300;1770,300"
}
]
},
{
"nodeType": "1",
"nodeCode": "3fcea762-b53a-4ae1-8365-7bec90444828",
"nodeName": "董事",
"permissionFlag": "1",
"nodeRatio": "0.000",
"anyNodeSkip": null,
"listenerType": "",
"listenerPath": "",
"formCustom": "N",
"formPath": null,
"ext": "[{\"code\":\"ButtonPermissionEnum\",\"value\":\"back,termination\"}]",
"coordinate": "1820,300|1820,300",
"version": "1",
"skipList": [
{
"skipType": "PASS",
"skipCondition": null,
"skipName": null,
"nowNodeCode": "3fcea762-b53a-4ae1-8365-7bec90444828",
"nextNodeCode": "9cfbfd3e-6c04-41d6-9fc2-6787a7d2cd31",
"coordinate": "1870,300;1960,300"
}
]
},
{
"nodeType": "2",
"nodeCode": "9cfbfd3e-6c04-41d6-9fc2-6787a7d2cd31",
"nodeName": "结束",
"permissionFlag": null,
"nodeRatio": "0.000",
"anyNodeSkip": null,
"listenerType": null,
"listenerPath": null,
"formCustom": "N",
"formPath": null,
"ext": "[]",
"coordinate": "1980,300|1980,300",
"version": "1",
"skipList": []
}
],
"flowCode": "leave6",
"flowName": "请假申请-排他并行会签",
"modelValue": "CLASSICS",
"category": "103",
"version": "1",
"formCustom": "N",
"formPath": "/workflow/leaveEdit/index",
"listenerType": null,
"listenerPath": null
}

File diff suppressed because one or more lines are too long

View File

@@ -1,452 +0,0 @@
# Ruoyi-AI 工作流模块详细说明文档
## 概述
Ruoyi-AI 工作流模块是一个基于 LangGraph4j 的智能工作流引擎支持可视化工作流设计、AI 模型集成、条件分支、人机交互等高级功能。该模块采用微服务架构,提供完整的
RESTful API 和流式响应支持。
## 模块架构
### 1. 模块结构
```
ruoyi-ai/
├── ruoyi-modules/
│ └── ruoyi-workflow/ # 工作流核心模块
│ ├── pom.xml
│ └── src/main/java/org/ruoyi/workflow/
│ └── controller/ # 控制器层
│ ├── WorkflowController.java
│ ├── WorkflowRuntimeController.java
│ └── admin/ # 管理端控制器
│ ├── AdminWorkflowController.java
│ └── AdminWorkflowComponentController.java
└── ruoyi-modules-api/
└── ruoyi-workflow-api/ # 工作流API模块
├── pom.xml
└── src/main/java/org/ruoyi/workflow/
├── entity/ # 实体类
├── dto/ # 数据传输对象
├── service/ # 服务接口
├── mapper/ # 数据访问层
├── workflow/ # 工作流核心逻辑
├── enums/ # 枚举类
├── util/ # 工具类
└── exception/ # 异常处理
```
### 2. 核心依赖
- **LangGraph4j**: 1.5.3 - 工作流图执行引擎
- **LangChain4j**: 1.2.0 - AI 模型集成框架
- **Spring Boot**: 3.x - 应用框架
- **MyBatis Plus**: 数据访问层
- **Redis**: 缓存和状态管理
- **Swagger/OpenAPI**: API 文档
## 核心功能
### 1. 工作流管理
#### 1.1 工作流定义
- **创建工作流**: 支持自定义标题、描述、公开性设置
- **编辑工作流**: 可视化节点编辑、连接线配置
- **版本控制**: 支持工作流的版本管理和回滚
- **权限管理**: 支持公开/私有工作流设置
#### 1.2 工作流执行
- **流式执行**: 基于 SSE 的实时流式响应
- **状态管理**: 完整的执行状态跟踪
- **错误处理**: 详细的错误信息和异常处理
- **中断恢复**: 支持工作流中断和恢复执行
### 2. 节点类型
#### 2.1 基础节点
- **Start**: 开始节点,定义工作流入口
- **End**: 结束节点,定义工作流出口
#### 2.2 AI 模型节点
- **Answer**: 大语言模型问答节点
- **Dalle3**: DALL-E 3 图像生成
- **Tongyiwanx**: 通义万相图像生成
- **Classifier**: 内容分类节点
#### 2.3 数据处理节点
- **DocumentExtractor**: 文档信息提取
- **KeywordExtractor**: 关键词提取
- **FaqExtractor**: 常见问题提取
- **KnowledgeRetrieval**: 知识库检索
#### 2.4 控制流节点
- **Switcher**: 条件分支节点
- **HumanFeedback**: 人机交互节点
#### 2.5 外部集成节点
- **Google**: Google 搜索集成
- **MailSend**: 邮件发送
- **HttpRequest**: HTTP 请求
- **Template**: 模板转换
### 3. 数据流管理
#### 3.1 输入输出定义
```java
// 节点输入输出数据结构
public class NodeIOData {
private String name; // 参数名称
private NodeIODataContent content; // 参数内容
}
// 支持的数据类型
public enum WfIODataTypeEnum {
TEXT, // 文本
NUMBER, // 数字
BOOLEAN, // 布尔值
FILES, // 文件
OPTIONS // 选项
}
```
#### 3.2 参数引用
- **节点间引用**: 支持上游节点输出作为下游节点输入
- **参数映射**: 自动处理参数名称映射
- **类型转换**: 自动进行数据类型转换
## 数据库设计
### 1. 核心表结构
#### 1.1 工作流定义表 (t_workflow)
```sql
CREATE TABLE t_workflow (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
uuid VARCHAR(32) NOT NULL DEFAULT '',
title VARCHAR(100) NOT NULL DEFAULT '',
remark TEXT NOT NULL DEFAULT '',
user_id BIGINT NOT NULL DEFAULT 0,
is_public TINYINT(1) NOT NULL DEFAULT 0,
is_enable TINYINT(1) NOT NULL DEFAULT 1,
create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
update_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
is_deleted TINYINT(1) NOT NULL DEFAULT 0
);
```
#### 1.2 工作流节点表 (t_workflow_node)
```sql
CREATE TABLE t_workflow_node (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
uuid VARCHAR(32) NOT NULL DEFAULT '',
workflow_id BIGINT NOT NULL DEFAULT 0,
workflow_component_id BIGINT NOT NULL DEFAULT 0,
user_id BIGINT NOT NULL DEFAULT 0,
title VARCHAR(100) NOT NULL DEFAULT '',
remark VARCHAR(500) NOT NULL DEFAULT '',
input_config JSON NOT NULL DEFAULT ('{}'),
node_config JSON NOT NULL DEFAULT ('{}'),
position_x DOUBLE NOT NULL DEFAULT 0,
position_y DOUBLE NOT NULL DEFAULT 0,
create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
update_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
is_deleted TINYINT(1) NOT NULL DEFAULT 0
);
```
#### 1.3 工作流边表 (t_workflow_edge)
```sql
CREATE TABLE t_workflow_edge (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
uuid VARCHAR(32) NOT NULL DEFAULT '',
workflow_id BIGINT NOT NULL DEFAULT 0,
source_node_uuid VARCHAR(32) NOT NULL DEFAULT '',
source_handle VARCHAR(32) NOT NULL DEFAULT '',
target_node_uuid VARCHAR(32) NOT NULL DEFAULT '',
create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
update_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
is_deleted TINYINT(1) NOT NULL DEFAULT 0
);
```
#### 1.4 工作流运行时表 (t_workflow_runtime)
```sql
CREATE TABLE t_workflow_runtime (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
uuid VARCHAR(32) NOT NULL DEFAULT '',
user_id BIGINT NOT NULL DEFAULT 0,
workflow_id BIGINT NOT NULL DEFAULT 0,
input JSON NOT NULL DEFAULT ('{}'),
output JSON NOT NULL DEFAULT ('{}'),
status SMALLINT NOT NULL DEFAULT 1,
status_remark VARCHAR(250) NOT NULL DEFAULT '',
create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
update_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
is_deleted TINYINT(1) NOT NULL DEFAULT 0
);
```
#### 1.5 工作流组件表 (t_workflow_component)
```sql
CREATE TABLE t_workflow_component (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
uuid VARCHAR(32) DEFAULT '' NOT NULL,
name VARCHAR(32) DEFAULT '' NOT NULL,
title VARCHAR(100) DEFAULT '' NOT NULL,
remark TEXT NOT NULL,
display_order INT DEFAULT 0 NOT NULL,
is_enable TINYINT(1) DEFAULT 0 NOT NULL,
create_time DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL,
update_time DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL,
is_deleted TINYINT(1) DEFAULT 0 NOT NULL
);
```
## API 接口
### 1. 工作流管理接口
#### 1.1 基础操作
```http
#
POST /workflow/add
Content-Type: application/json
{
"title": "",
"remark": "",
"isPublic": false
}
#
POST /workflow/update
Content-Type: application/json
{
"uuid": "UUID",
"title": "",
"remark": ""
}
#
POST /workflow/del/{uuid}
# /
POST /workflow/enable/{uuid}?enable=true
```
#### 1.2 搜索和查询
```http
#
GET /workflow/mine/search?keyword=&isPublic=true&currentPage=1&pageSize=10
#
GET /workflow/public/search?keyword=&currentPage=1&pageSize=10
#
GET /workflow/public/component/list
```
### 2. 工作流执行接口
#### 2.1 流式执行
```http
#
POST /workflow/run
Content-Type: application/json
Accept: text/event-stream
{
"uuid": "UUID",
"inputs": [
{
"name": "input",
"content": {
"type": 1,
"textContent": ""
}
}
]
}
```
#### 2.2 运行时管理
```http
#
POST /workflow/runtime/resume/{runtimeUuid}
Content-Type: application/json
{
"feedbackContent": ""
}
#
GET /workflow/runtime/page?wfUuid=UUID&currentPage=1&pageSize=10
#
GET /workflow/runtime/nodes/{runtimeUuid}
#
POST /workflow/runtime/clear?wfUuid=UUID
```
### 3. 管理端接口
#### 3.1 工作流管理
```http
#
POST /admin/workflow/search
Content-Type: application/json
{
"title": "",
"isPublic": true,
"isEnable": true
}
# /
POST /admin/workflow/enable?uuid=UUID&isEnable=true
```
## 核心实现
### 1. 工作流引擎 (WorkflowEngine)
工作流引擎是整个模块的核心,负责:
- 工作流图的构建和编译
- 节点执行调度
- 状态管理和持久化
- 流式输出处理
```java
public class WorkflowEngine {
// 核心执行方法
public void run(User user, List<ObjectNode> userInputs, SseEmitter sseEmitter) {
// 1. 验证工作流状态
// 2. 创建运行时实例
// 3. 构建状态图
// 4. 执行工作流
// 5. 处理流式输出
}
// 恢复执行方法
public void resume(String userInput) {
// 1. 更新状态
// 2. 继续执行
}
}
```
### 2. 节点工厂 (WfNodeFactory)
节点工厂负责根据组件类型创建对应的节点实例:
```java
public class WfNodeFactory {
public static AbstractWfNode create(WorkflowComponent component,
WorkflowNode node,
WfState wfState,
WfNodeState nodeState) {
// 根据组件类型创建对应的节点实例
switch (component.getName()) {
case "Answer":
return new LLMAnswerNode(component, node, wfState, nodeState);
case "Switcher":
return new SwitcherNode(component, node, wfState, nodeState);
// ... 其他节点类型
}
}
}
```
### 3. 图构建器 (WorkflowGraphBuilder)
图构建器负责将工作流定义转换为可执行的状态图:
```java
public class WorkflowGraphBuilder {
public StateGraph<WfNodeState> build(WorkflowNode startNode) {
// 1. 构建编译节点树
// 2. 转换为状态图
// 3. 添加节点和边
// 4. 处理条件分支
// 5. 处理并行执行
}
}
```
## 流式响应机制
### 1. SSE 事件类型
工作流执行过程中会发送多种类型的 SSE 事件:
```javascript
// 节点开始执行
[NODE_RUN_节点UUID] - 节点执行开始事件
// 节点输入数据
[NODE_INPUT_节点UUID] - 节点输入数据事件
// 节点输出数据
[NODE_OUTPUT_节点UUID] - 节点输出数据事件
// 流式内容块
[NODE_CHUNK_节点UUID] - 流式内容块事件
// 等待用户输入
[NODE_WAIT_FEEDBACK_BY_节点UUID] - 等待用户输入事件
```
### 2. 流式处理流程
1. **初始化**: 创建工作流运行时实例
2. **节点执行**: 逐个执行工作流节点
3. **实时输出**: 通过 SSE 实时推送执行结果
4. **状态更新**: 实时更新节点和工作流状态
5. **错误处理**: 捕获并处理执行过程中的错误
## 扩展开发
### 1. 自定义节点开发
要开发自定义工作流节点,需要:
1. **创建节点类**:继承 `AbstractWfNode`
2. **实现处理逻辑**:重写 `onProcess()` 方法
3. **定义配置类**:创建节点配置类
4. **注册组件**:在组件表中注册新组件
```java
public class CustomNode extends AbstractWfNode {
@Override
protected NodeProcessResult onProcess() {
// 实现自定义处理逻辑
List<NodeIOData> outputs = new ArrayList<>();
// ... 处理逻辑
return NodeProcessResult.success(outputs);
}
}
```
### 2. 自定义组件注册
```sql
-- 在 t_workflow_component 表中添加新组件
INSERT INTO t_workflow_component (uuid, name, title, remark, is_enable)
VALUES (REPLACE(UUID(), '-', ''), 'CustomNode', '自定义节点', '自定义节点描述', true);
```