diff --git a/continew-admin-extension/continew-admin-job-server/pom.xml b/continew-admin-extension/continew-admin-job-server/pom.xml
new file mode 100644
index 000000000..1ebbaa9ca
--- /dev/null
+++ b/continew-admin-extension/continew-admin-job-server/pom.xml
@@ -0,0 +1,75 @@
+
+
+ 4.0.0
+
+ top.continew
+ continew-admin-extension
+ ${revision}
+
+
+ continew-admin-job-server
+ 任务调度服务模块
+
+
+
+ 1.1.0-beta1
+
+
+
+
+
+ com.aizuda
+ snail-job-server-starter
+ ${snail-job.version}
+
+
+
+
+ com.baomidou
+ mybatis-plus-spring-boot3-starter
+
+
+
+
+ com.baomidou
+ dynamic-datasource-spring-boot3-starter
+
+
+
+
+ org.liquibase
+ liquibase-core
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+
+
+ ${project.artifactId}
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+ repackage
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/continew-admin-extension/continew-admin-job-server/src/main/java/top/continew/admin/extension/job/ContinewAdminJobApplication.java b/continew-admin-extension/continew-admin-job-server/src/main/java/top/continew/admin/extension/job/ContinewAdminJobApplication.java
new file mode 100644
index 000000000..99d9ff8ab
--- /dev/null
+++ b/continew-admin-extension/continew-admin-job-server/src/main/java/top/continew/admin/extension/job/ContinewAdminJobApplication.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
+ *
+ * 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
+ *
+ * http://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 top.continew.admin.extension.job;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+/**
+ * 任务调度服务启动程序
+ *
+ * @author KAI
+ * @since 2024/6/25 22:24
+ */
+@SpringBootApplication
+public class ContinewAdminJobApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(com.aizuda.snailjob.server.SnailJobServerApplication.class, args);
+ }
+}
diff --git a/continew-admin-extension/continew-admin-job-server/src/main/resources/config/application-dev.yml b/continew-admin-extension/continew-admin-job-server/src/main/resources/config/application-dev.yml
new file mode 100644
index 000000000..9565200f0
--- /dev/null
+++ b/continew-admin-extension/continew-admin-job-server/src/main/resources/config/application-dev.yml
@@ -0,0 +1,69 @@
+server:
+ port: 8001
+
+--- ### 数据源配置
+spring.datasource:
+ type: com.zaxxer.hikari.HikariDataSource
+ ## 动态数据源配置(可配多主多从:m1、s1...;纯粹多库:mysql、oracle...;混合配置:m1、s1、oracle...)
+ dynamic:
+ # 设置默认的数据源或者数据源组(默认:master)
+ primary: master
+ # 严格匹配数据源(true:未匹配到指定数据源时抛异常;false:使用默认数据源;默认 false)
+ strict: false
+ datasource:
+ # 主库配置(可配多个,构成多主)
+ master:
+ url: jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:continew_admin_job}?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&rewriteBatchedStatements=true&autoReconnect=true&maxReconnects=10&failOverReadOnly=false&allowPublicKeyRetrieval=true
+ username: ${DB_USER:root}
+ password: ${DB_PWD:123456}
+ driver-class-name: com.mysql.cj.jdbc.Driver
+ type: ${spring.datasource.type}
+ hikari:
+ # 最大连接数量(默认 10,根据实际环境调整)
+ # 注意:当连接达到上限,并且没有空闲连接可用时,获取连接将在超时前阻塞最多 connectionTimeout 毫秒
+ max-pool-size: 20
+ # 获取连接超时时间(默认 30000 毫秒,30 秒)
+ connection-timeout: 30000
+ # 空闲连接最大存活时间(默认 600000 毫秒,10 分钟)
+ idle-timeout: 600000
+ # 保持连接活动的频率,以防止它被数据库或网络基础设施超时。该值必须小于 maxLifetime(默认 0,禁用)
+ keepaliveTime: 30000
+ # 连接最大生存时间(默认 1800000 毫秒,30 分钟)
+ max-lifetime: 1800000
+## Liquibase 配置
+spring.liquibase:
+ # 是否启用
+ enabled: true
+ # 配置文件路径
+ change-log: classpath:/db/changelogs/db.changelog-master.yaml
+
+--- ### Snail Job 服务端配置
+snail-job:
+ # Netty 端口
+ netty-port: 1788
+ # 合并日志默认保存天数
+ merge-Log-days: 1
+ # 合并日志默认的条数
+ merge-Log-num: 500
+ # 配置日志保存时间(单位:天)
+ log-storage: 90
+ # 配置每批次拉取重试数据的大小
+ retry-pull-page-size: 100
+ # 配置一个客户端每秒最多接收的重试数量指令
+ limiter: 10
+ # 配置号段模式下的步长
+ step: 100
+ # bucket 的总数量
+ bucket-total: 128
+ # Dashboard 任务容错天数
+ summary-day: 7
+ # 配置负载均衡周期时间
+ load-balance-cycle-time: 10
+ ## 回调配置
+ callback:
+ # 回调 uniqueId 前缀
+ prefix: CB
+ # 配置回调的最大执行次数
+ max-count: 288
+ # 配置回调触发的间隔时间
+ trigger-interval: 900
diff --git a/continew-admin-extension/continew-admin-job-server/src/main/resources/config/application-prod.yml b/continew-admin-extension/continew-admin-job-server/src/main/resources/config/application-prod.yml
new file mode 100644
index 000000000..6bbc85b9b
--- /dev/null
+++ b/continew-admin-extension/continew-admin-job-server/src/main/resources/config/application-prod.yml
@@ -0,0 +1,69 @@
+server:
+ port: 18001
+
+--- ### 数据源配置
+spring.datasource:
+ type: com.zaxxer.hikari.HikariDataSource
+ ## 动态数据源配置(可配多主多从:m1、s1...;纯粹多库:mysql、oracle...;混合配置:m1、s1、oracle...)
+ dynamic:
+ # 设置默认的数据源或者数据源组(默认:master)
+ primary: master
+ # 严格匹配数据源(true:未匹配到指定数据源时抛异常;false:使用默认数据源;默认 false)
+ strict: false
+ datasource:
+ # 主库配置(可配多个,构成多主)
+ master:
+ url: jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:continew_admin_job}?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&rewriteBatchedStatements=true&autoReconnect=true&maxReconnects=10&failOverReadOnly=false
+ username: ${DB_USER:root}
+ password: ${DB_PWD:123456}
+ driver-class-name: com.mysql.cj.jdbc.Driver
+ type: ${spring.datasource.type}
+ hikari:
+ # 最大连接数量(默认 10,根据实际环境调整)
+ # 注意:当连接达到上限,并且没有空闲连接可用时,获取连接将在超时前阻塞最多 connectionTimeout 毫秒
+ max-pool-size: 20
+ # 获取连接超时时间(默认 30000 毫秒,30 秒)
+ connection-timeout: 30000
+ # 空闲连接最大存活时间(默认 600000 毫秒,10 分钟)
+ idle-timeout: 600000
+ # 保持连接活动的频率,以防止它被数据库或网络基础设施超时。该值必须小于 maxLifetime(默认 0,禁用)
+ keepaliveTime: 30000
+ # 连接最大生存时间(默认 1800000 毫秒,30 分钟)
+ max-lifetime: 1800000
+## Liquibase 配置
+spring.liquibase:
+ # 是否启用
+ enabled: true
+ # 配置文件路径
+ change-log: classpath:/db/changelogs/db.changelog-master.yaml
+
+--- ### Snail Job 服务端配置
+snail-job:
+ # Netty 端口
+ netty-port: 1788
+ # 合并日志默认保存天数
+ merge-Log-days: 1
+ # 合并日志默认的条数
+ merge-Log-num: 500
+ # 配置日志保存时间(单位:天)
+ log-storage: 90
+ # 配置每批次拉取重试数据的大小
+ retry-pull-page-size: 100
+ # 配置一个客户端每秒最多接收的重试数量指令
+ limiter: 10
+ # 配置号段模式下的步长
+ step: 100
+ # bucket 的总数量
+ bucket-total: 128
+ # Dashboard 任务容错天数
+ summary-day: 7
+ # 配置负载均衡周期时间
+ load-balance-cycle-time: 10
+ ## 回调配置
+ callback:
+ # 回调 uniqueId 前缀
+ prefix: CB
+ # 配置回调的最大执行次数
+ max-count: 288
+ # 配置回调触发的间隔时间
+ trigger-interval: 900
diff --git a/continew-admin-extension/continew-admin-job-server/src/main/resources/config/application.yml b/continew-admin-extension/continew-admin-job-server/src/main/resources/config/application.yml
new file mode 100644
index 000000000..70d8cbed9
--- /dev/null
+++ b/continew-admin-extension/continew-admin-job-server/src/main/resources/config/application.yml
@@ -0,0 +1,26 @@
+--- ### Spring 配置
+spring:
+ application:
+ name: continew-admin-job-server
+
+--- ### MyBatis Plus 配置
+mybatis-plus:
+ # 类型别名扫描包配置
+ typeAliasesPackage: com.aizuda.snailjob.template.datasource.persistence.po
+ ## MyBatis 配置
+ configuration:
+ map-underscore-to-camel-case: true
+ cache-enabled: true
+ ## 全局配置
+ global-config:
+ db-config:
+ where-strategy: NOT_EMPTY
+ capital-mode: false
+ # 逻辑删除全局值(默认 1,表示已删除)
+ logic-delete-value: 1
+ # 逻辑未删除全局值(默认 0,表示未删除)
+ logic-not-delete-value: 0
+
+--- ### 日志配置
+logging:
+ config: classpath:logback-spring.xml
\ No newline at end of file
diff --git a/continew-admin-extension/continew-admin-job-server/src/main/resources/db/changelogs/db.changelog-master.yaml b/continew-admin-extension/continew-admin-job-server/src/main/resources/db/changelogs/db.changelog-master.yaml
new file mode 100644
index 000000000..02f233979
--- /dev/null
+++ b/continew-admin-extension/continew-admin-job-server/src/main/resources/db/changelogs/db.changelog-master.yaml
@@ -0,0 +1,3 @@
+databaseChangeLog:
+ - include:
+ file: db/changelogs/mysql/snail_job.sql
diff --git a/continew-admin-extension/continew-admin-job-server/src/main/resources/db/changelogs/dm/snail_job.sql b/continew-admin-extension/continew-admin-job-server/src/main/resources/db/changelogs/dm/snail_job.sql
new file mode 100644
index 000000000..5f0d4e40f
--- /dev/null
+++ b/continew-admin-extension/continew-admin-job-server/src/main/resources/db/changelogs/dm/snail_job.sql
@@ -0,0 +1,816 @@
+-- liquibase formatted sql
+
+-- changeset snail-job-server:1
+-- sj_namespace
+CREATE TABLE sj_namespace
+(
+ id bigint NOT NULL PRIMARY KEY IDENTITY,
+ name varchar(64) NULL,
+ unique_id varchar(64) NULL,
+ description varchar(256) DEFAULT '' NULL,
+ deleted smallint DEFAULT 0 NOT NULL,
+ create_dt datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ update_dt datetime DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+
+CREATE INDEX idx_sj_namespace_01 ON sj_namespace (name);
+
+COMMENT ON COLUMN sj_namespace.id IS '主键';
+COMMENT ON COLUMN sj_namespace.name IS '名称';
+COMMENT ON COLUMN sj_namespace.unique_id IS '唯一id';
+COMMENT ON COLUMN sj_namespace.description IS '描述';
+COMMENT ON COLUMN sj_namespace.deleted IS '逻辑删除 1、删除';
+COMMENT ON COLUMN sj_namespace.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_namespace.update_dt IS '修改时间';
+COMMENT ON TABLE sj_namespace IS '命名空间';
+
+INSERT INTO sj_namespace (name, unique_id, create_dt, update_dt, deleted)
+VALUES ('Default', '764d604ec6fc45f68cd92514c40e9e1a', sysdate, sysdate, 0);
+
+-- sj_group_config
+CREATE TABLE sj_group_config
+(
+ id bigint NOT NULL PRIMARY KEY IDENTITY,
+ namespace_id varchar(64) DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' NULL,
+ group_name varchar(64) DEFAULT '' NULL,
+ description varchar(256) DEFAULT '' NULL,
+ token varchar(64) DEFAULT 'SJ_cKqBTPzCsWA3VyuCfFoccmuIEGXjr5KT' NULL,
+ group_status smallint DEFAULT 0 NOT NULL,
+ version int NOT NULL,
+ group_partition int NOT NULL,
+ id_generator_mode smallint DEFAULT 1 NOT NULL,
+ init_scene smallint DEFAULT 0 NOT NULL,
+ bucket_index int DEFAULT 0 NOT NULL,
+ create_dt datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ update_dt datetime DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+
+CREATE UNIQUE INDEX uk_sj_group_config_01 ON sj_group_config (namespace_id, group_name);
+
+COMMENT ON COLUMN sj_group_config.id IS '主键';
+COMMENT ON COLUMN sj_group_config.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_group_config.group_name IS '组名称';
+COMMENT ON COLUMN sj_group_config.description IS '组描述';
+COMMENT ON COLUMN sj_group_config.token IS 'token';
+COMMENT ON COLUMN sj_group_config.group_status IS '组状态 0、未启用 1、启用';
+COMMENT ON COLUMN sj_group_config.version IS '版本号';
+COMMENT ON COLUMN sj_group_config.group_partition IS '分区';
+COMMENT ON COLUMN sj_group_config.id_generator_mode IS '唯一id生成模式 默认号段模式';
+COMMENT ON COLUMN sj_group_config.init_scene IS '是否初始化场景 0:否 1:是';
+COMMENT ON COLUMN sj_group_config.bucket_index IS 'bucket';
+COMMENT ON COLUMN sj_group_config.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_group_config.update_dt IS '修改时间';
+COMMENT ON TABLE sj_group_config IS '组配置';
+
+-- sj_notify_config
+CREATE TABLE sj_notify_config
+(
+ id bigint NOT NULL PRIMARY KEY IDENTITY,
+ namespace_id varchar(64) DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' NULL,
+ group_name varchar(64) NULL,
+ business_id varchar(64) NULL,
+ system_task_type smallint DEFAULT 3 NOT NULL,
+ notify_status smallint DEFAULT 0 NOT NULL,
+ recipient_ids varchar(128) NULL,
+ notify_threshold int DEFAULT 0 NOT NULL,
+ notify_scene smallint DEFAULT 0 NOT NULL,
+ rate_limiter_status smallint DEFAULT 0 NOT NULL,
+ rate_limiter_threshold int DEFAULT 0 NOT NULL,
+ description varchar(256) DEFAULT '' NULL,
+ create_dt datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ update_dt datetime DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+
+CREATE INDEX idx_sj_notify_config_01 ON sj_notify_config (namespace_id, group_name, business_id);
+
+COMMENT ON COLUMN sj_notify_config.id IS '主键';
+COMMENT ON COLUMN sj_notify_config.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_notify_config.group_name IS '组名称';
+COMMENT ON COLUMN sj_notify_config.business_id IS '业务id ( job_id或workflow_id或scene_name ) ';
+COMMENT ON COLUMN sj_notify_config.system_task_type IS '任务类型 1. 重试任务 2. 重试回调 3、JOB任务 4、WORKFLOW任务';
+COMMENT ON COLUMN sj_notify_config.notify_status IS '通知状态 0、未启用 1、启用';
+COMMENT ON COLUMN sj_notify_config.recipient_ids IS '接收人id列表';
+COMMENT ON COLUMN sj_notify_config.notify_threshold IS '通知阈值';
+COMMENT ON COLUMN sj_notify_config.notify_scene IS '通知场景';
+COMMENT ON COLUMN sj_notify_config.rate_limiter_status IS '限流状态 0、未启用 1、启用';
+COMMENT ON COLUMN sj_notify_config.rate_limiter_threshold IS '每秒限流阈值';
+COMMENT ON COLUMN sj_notify_config.description IS '描述';
+COMMENT ON COLUMN sj_notify_config.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_notify_config.update_dt IS '修改时间';
+COMMENT ON TABLE sj_notify_config IS '通知配置';
+
+-- sj_notify_recipient
+CREATE TABLE sj_notify_recipient
+(
+ id bigint NOT NULL PRIMARY KEY IDENTITY,
+ namespace_id varchar(64) DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' NULL,
+ recipient_name varchar(64) NULL,
+ notify_type smallint DEFAULT 0 NOT NULL,
+ notify_attribute varchar(512) NULL,
+ description varchar(256) DEFAULT '' NULL,
+ create_dt datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ update_dt datetime DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+
+CREATE INDEX idx_sj_notify_recipient_01 ON sj_notify_recipient (namespace_id);
+
+COMMENT ON COLUMN sj_notify_recipient.id IS '主键';
+COMMENT ON COLUMN sj_notify_recipient.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_notify_recipient.recipient_name IS '接收人名称';
+COMMENT ON COLUMN sj_notify_recipient.notify_type IS '通知类型 1、钉钉 2、邮件 3、企业微信 4 飞书 5 webhook';
+COMMENT ON COLUMN sj_notify_recipient.notify_attribute IS '配置属性';
+COMMENT ON COLUMN sj_notify_recipient.description IS '描述';
+COMMENT ON COLUMN sj_notify_recipient.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_notify_recipient.update_dt IS '修改时间';
+COMMENT ON TABLE sj_notify_recipient IS '告警通知接收人';
+
+-- sj_retry_dead_letter_0
+CREATE TABLE sj_retry_dead_letter_0
+(
+ id bigint NOT NULL PRIMARY KEY IDENTITY,
+ namespace_id varchar(64) DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' NULL,
+ unique_id varchar(64) NULL,
+ group_name varchar(64) NULL,
+ scene_name varchar(64) NULL,
+ idempotent_id varchar(64) NULL,
+ biz_no varchar(64) DEFAULT '' NULL,
+ executor_name varchar(512) DEFAULT '' NULL,
+ args_str text NULL,
+ ext_attrs text NULL,
+ task_type smallint DEFAULT 1 NOT NULL,
+ create_dt datetime DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+
+CREATE UNIQUE INDEX uk_sj_retry_dead_letter_0_01 ON sj_retry_dead_letter_0 (namespace_id, group_name, unique_id);
+
+CREATE INDEX idx_sj_retry_dead_letter_0_01 ON sj_retry_dead_letter_0 (namespace_id, group_name, scene_name);
+CREATE INDEX idx_sj_retry_dead_letter_0_02 ON sj_retry_dead_letter_0 (idempotent_id);
+CREATE INDEX idx_sj_retry_dead_letter_0_03 ON sj_retry_dead_letter_0 (biz_no);
+CREATE INDEX idx_sj_retry_dead_letter_0_04 ON sj_retry_dead_letter_0 (create_dt);
+
+COMMENT ON COLUMN sj_retry_dead_letter_0.id IS '主键';
+COMMENT ON COLUMN sj_retry_dead_letter_0.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_retry_dead_letter_0.unique_id IS '同组下id唯一';
+COMMENT ON COLUMN sj_retry_dead_letter_0.group_name IS '组名称';
+COMMENT ON COLUMN sj_retry_dead_letter_0.scene_name IS '场景名称';
+COMMENT ON COLUMN sj_retry_dead_letter_0.idempotent_id IS '幂等id';
+COMMENT ON COLUMN sj_retry_dead_letter_0.biz_no IS '业务编号';
+COMMENT ON COLUMN sj_retry_dead_letter_0.executor_name IS '执行器名称';
+COMMENT ON COLUMN sj_retry_dead_letter_0.args_str IS '执行方法参数';
+COMMENT ON COLUMN sj_retry_dead_letter_0.ext_attrs IS '扩展字段';
+COMMENT ON COLUMN sj_retry_dead_letter_0.task_type IS '任务类型 1、重试数据 2、回调数据';
+COMMENT ON COLUMN sj_retry_dead_letter_0.create_dt IS '创建时间';
+COMMENT ON TABLE sj_retry_dead_letter_0 IS '死信队列表';
+
+-- sj_retry_task_0
+CREATE TABLE sj_retry_task_0
+(
+ id bigint NOT NULL PRIMARY KEY IDENTITY,
+ namespace_id varchar(64) DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' NULL,
+ unique_id varchar(64) NULL,
+ group_name varchar(64) NULL,
+ scene_name varchar(64) NULL,
+ idempotent_id varchar(64) NULL,
+ biz_no varchar(64) DEFAULT '' NULL,
+ executor_name varchar(512) DEFAULT '' NULL,
+ args_str text NULL,
+ ext_attrs text NULL,
+ next_trigger_at datetime NOT NULL,
+ retry_count int DEFAULT 0 NOT NULL,
+ retry_status smallint DEFAULT 0 NOT NULL,
+ task_type smallint DEFAULT 1 NOT NULL,
+ create_dt datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ update_dt datetime DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+
+CREATE UNIQUE INDEX uk_sj_retry_task_0_01 ON sj_retry_task_0 (namespace_id, group_name, unique_id);
+
+CREATE INDEX idx_sj_retry_task_0_01 ON sj_retry_task_0 (namespace_id, group_name, scene_name);
+CREATE INDEX idx_sj_retry_task_0_02 ON sj_retry_task_0 (namespace_id, group_name, task_type);
+CREATE INDEX idx_sj_retry_task_0_03 ON sj_retry_task_0 (namespace_id, group_name, retry_status);
+CREATE INDEX idx_sj_retry_task_0_04 ON sj_retry_task_0 (idempotent_id);
+CREATE INDEX idx_sj_retry_task_0_05 ON sj_retry_task_0 (biz_no);
+CREATE INDEX idx_sj_retry_task_0_06 ON sj_retry_task_0 (create_dt);
+
+COMMENT ON COLUMN sj_retry_task_0.id IS '主键';
+COMMENT ON COLUMN sj_retry_task_0.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_retry_task_0.unique_id IS '同组下id唯一';
+COMMENT ON COLUMN sj_retry_task_0.group_name IS '组名称';
+COMMENT ON COLUMN sj_retry_task_0.scene_name IS '场景名称';
+COMMENT ON COLUMN sj_retry_task_0.idempotent_id IS '幂等id';
+COMMENT ON COLUMN sj_retry_task_0.biz_no IS '业务编号';
+COMMENT ON COLUMN sj_retry_task_0.executor_name IS '执行器名称';
+COMMENT ON COLUMN sj_retry_task_0.args_str IS '执行方法参数';
+COMMENT ON COLUMN sj_retry_task_0.ext_attrs IS '扩展字段';
+COMMENT ON COLUMN sj_retry_task_0.next_trigger_at IS '下次触发时间';
+COMMENT ON COLUMN sj_retry_task_0.retry_count IS '重试次数';
+COMMENT ON COLUMN sj_retry_task_0.retry_status IS '重试状态 0、重试中 1、成功 2、最大重试次数';
+COMMENT ON COLUMN sj_retry_task_0.task_type IS '任务类型 1、重试数据 2、回调数据';
+COMMENT ON COLUMN sj_retry_task_0.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_retry_task_0.update_dt IS '修改时间';
+COMMENT ON TABLE sj_retry_task_0 IS '任务表';
+
+-- sj_retry_task_log
+CREATE TABLE sj_retry_task_log
+(
+ id bigint NOT NULL PRIMARY KEY IDENTITY,
+ namespace_id varchar(64) DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' NULL,
+ unique_id varchar(64) NULL,
+ group_name varchar(64) NULL,
+ scene_name varchar(64) NULL,
+ idempotent_id varchar(64) NULL,
+ biz_no varchar(64) DEFAULT '' NULL,
+ executor_name varchar(512) DEFAULT '' NULL,
+ args_str text NULL,
+ ext_attrs text NULL,
+ retry_status smallint DEFAULT 0 NOT NULL,
+ task_type smallint DEFAULT 1 NOT NULL,
+ create_dt datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ update_dt datetime DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+
+CREATE INDEX idx_sj_retry_task_log_01 ON sj_retry_task_log (namespace_id, group_name, scene_name);
+CREATE INDEX idx_sj_retry_task_log_02 ON sj_retry_task_log (retry_status);
+CREATE INDEX idx_sj_retry_task_log_03 ON sj_retry_task_log (idempotent_id);
+CREATE INDEX idx_sj_retry_task_log_04 ON sj_retry_task_log (unique_id);
+CREATE INDEX idx_sj_retry_task_log_05 ON sj_retry_task_log (biz_no);
+CREATE INDEX idx_sj_retry_task_log_06 ON sj_retry_task_log (create_dt);
+
+COMMENT ON COLUMN sj_retry_task_log.id IS '主键';
+COMMENT ON COLUMN sj_retry_task_log.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_retry_task_log.unique_id IS '同组下id唯一';
+COMMENT ON COLUMN sj_retry_task_log.group_name IS '组名称';
+COMMENT ON COLUMN sj_retry_task_log.scene_name IS '场景名称';
+COMMENT ON COLUMN sj_retry_task_log.idempotent_id IS '幂等id';
+COMMENT ON COLUMN sj_retry_task_log.biz_no IS '业务编号';
+COMMENT ON COLUMN sj_retry_task_log.executor_name IS '执行器名称';
+COMMENT ON COLUMN sj_retry_task_log.args_str IS '执行方法参数';
+COMMENT ON COLUMN sj_retry_task_log.ext_attrs IS '扩展字段';
+COMMENT ON COLUMN sj_retry_task_log.retry_status IS '重试状态 0、重试中 1、成功 2、最大次数';
+COMMENT ON COLUMN sj_retry_task_log.task_type IS '任务类型 1、重试数据 2、回调数据';
+COMMENT ON COLUMN sj_retry_task_log.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_retry_task_log.update_dt IS '修改时间';
+COMMENT ON TABLE sj_retry_task_log IS '任务日志基础信息表';
+
+-- sj_retry_task_log_message
+CREATE TABLE sj_retry_task_log_message
+(
+ id bigint NOT NULL PRIMARY KEY IDENTITY,
+ namespace_id varchar(64) DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' NULL,
+ group_name varchar(64) NULL,
+ unique_id varchar(64) NULL,
+ message text NULL,
+ log_num int DEFAULT 1 NOT NULL,
+ real_time bigint DEFAULT 0 NOT NULL,
+ create_dt datetime DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+
+CREATE INDEX idx_sj_retry_task_log_message_01 ON sj_retry_task_log_message (namespace_id, group_name, unique_id);
+CREATE INDEX idx_sj_retry_task_log_message_02 ON sj_retry_task_log_message (create_dt);
+
+COMMENT ON COLUMN sj_retry_task_log_message.id IS '主键';
+COMMENT ON COLUMN sj_retry_task_log_message.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_retry_task_log_message.group_name IS '组名称';
+COMMENT ON COLUMN sj_retry_task_log_message.unique_id IS '同组下id唯一';
+COMMENT ON COLUMN sj_retry_task_log_message.message IS '异常信息';
+COMMENT ON COLUMN sj_retry_task_log_message.log_num IS '日志数量';
+COMMENT ON COLUMN sj_retry_task_log_message.real_time IS '上报时间';
+COMMENT ON COLUMN sj_retry_task_log_message.create_dt IS '创建时间';
+COMMENT ON TABLE sj_retry_task_log_message IS '任务调度日志信息记录表';
+
+-- sj_retry_scene_config
+CREATE TABLE sj_retry_scene_config
+(
+ id bigint NOT NULL PRIMARY KEY IDENTITY,
+ namespace_id varchar(64) DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' NULL,
+ scene_name varchar(64) NULL,
+ group_name varchar(64) NULL,
+ scene_status smallint DEFAULT 0 NOT NULL,
+ max_retry_count int DEFAULT 5 NOT NULL,
+ back_off smallint DEFAULT 1 NOT NULL,
+ trigger_interval varchar(16) DEFAULT '' NULL,
+ deadline_request bigint DEFAULT 60000 NOT NULL,
+ executor_timeout int DEFAULT 5 NOT NULL,
+ route_key smallint DEFAULT 4 NOT NULL,
+ description varchar(256) DEFAULT '' NULL,
+ create_dt datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ update_dt datetime DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+
+CREATE UNIQUE INDEX uk_sj_retry_scene_config_01 ON sj_retry_scene_config (namespace_id, group_name, scene_name);
+
+COMMENT ON COLUMN sj_retry_scene_config.id IS '主键';
+COMMENT ON COLUMN sj_retry_scene_config.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_retry_scene_config.scene_name IS '场景名称';
+COMMENT ON COLUMN sj_retry_scene_config.group_name IS '组名称';
+COMMENT ON COLUMN sj_retry_scene_config.scene_status IS '组状态 0、未启用 1、启用';
+COMMENT ON COLUMN sj_retry_scene_config.max_retry_count IS '最大重试次数';
+COMMENT ON COLUMN sj_retry_scene_config.back_off IS '1、默认等级 2、固定间隔时间 3、CRON 表达式';
+COMMENT ON COLUMN sj_retry_scene_config.trigger_interval IS '间隔时长';
+COMMENT ON COLUMN sj_retry_scene_config.deadline_request IS 'Deadline Request 调用链超时 单位毫秒';
+COMMENT ON COLUMN sj_retry_scene_config.executor_timeout IS '任务执行超时时间,单位秒';
+COMMENT ON COLUMN sj_retry_scene_config.route_key IS '路由策略';
+COMMENT ON COLUMN sj_retry_scene_config.description IS '描述';
+COMMENT ON COLUMN sj_retry_scene_config.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_retry_scene_config.update_dt IS '修改时间';
+COMMENT ON TABLE sj_retry_scene_config IS '场景配置';
+
+-- sj_server_node
+CREATE TABLE sj_server_node
+(
+ id bigint NOT NULL PRIMARY KEY IDENTITY,
+ namespace_id varchar(64) DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' NULL,
+ group_name varchar(64) NULL,
+ host_id varchar(64) NULL,
+ host_ip varchar(64) NULL,
+ host_port int NOT NULL,
+ expire_at datetime NOT NULL,
+ node_type smallint NOT NULL,
+ ext_attrs varchar(256) DEFAULT '' NULL,
+ create_dt datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ update_dt datetime DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+
+CREATE UNIQUE INDEX uk_sj_server_node_01 ON sj_server_node (host_id, host_ip);
+
+CREATE INDEX idx_sj_server_node_01 ON sj_server_node (namespace_id, group_name);
+CREATE INDEX idx_sj_server_node_02 ON sj_server_node (expire_at, node_type);
+
+COMMENT ON COLUMN sj_server_node.id IS '主键';
+COMMENT ON COLUMN sj_server_node.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_server_node.group_name IS '组名称';
+COMMENT ON COLUMN sj_server_node.host_id IS '主机id';
+COMMENT ON COLUMN sj_server_node.host_ip IS '机器ip';
+COMMENT ON COLUMN sj_server_node.host_port IS '机器端口';
+COMMENT ON COLUMN sj_server_node.expire_at IS '过期时间';
+COMMENT ON COLUMN sj_server_node.node_type IS '节点类型 1、客户端 2、是服务端';
+COMMENT ON COLUMN sj_server_node.ext_attrs IS '扩展字段';
+COMMENT ON COLUMN sj_server_node.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_server_node.update_dt IS '修改时间';
+COMMENT ON TABLE sj_server_node IS '服务器节点';
+
+-- sj_distributed_lock
+CREATE TABLE sj_distributed_lock
+(
+ id bigint NOT NULL PRIMARY KEY IDENTITY,
+ name varchar(64) NULL,
+ lock_until timestamp(3) DEFAULT CURRENT_TIMESTAMP(3) NOT NULL,
+ locked_at timestamp(3) DEFAULT CURRENT_TIMESTAMP(3) NOT NULL,
+ locked_by varchar(255) NULL,
+ create_dt datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ update_dt datetime DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+
+COMMENT ON COLUMN sj_distributed_lock.id IS '主键';
+COMMENT ON COLUMN sj_distributed_lock.name IS '锁名称';
+COMMENT ON COLUMN sj_distributed_lock.lock_until IS '锁定时长';
+COMMENT ON COLUMN sj_distributed_lock.locked_at IS '锁定时间';
+COMMENT ON COLUMN sj_distributed_lock.locked_by IS '锁定者';
+COMMENT ON COLUMN sj_distributed_lock.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_distributed_lock.update_dt IS '修改时间';
+COMMENT ON TABLE sj_distributed_lock IS '锁定表';
+
+-- sj_system_user
+CREATE TABLE sj_system_user
+(
+ id bigint NOT NULL PRIMARY KEY IDENTITY,
+ username varchar(64) NULL,
+ password varchar(128) NULL,
+ role smallint DEFAULT 0 NOT NULL,
+ create_dt datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ update_dt datetime DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+
+COMMENT ON COLUMN sj_system_user.id IS '主键';
+COMMENT ON COLUMN sj_system_user.username IS '账号';
+COMMENT ON COLUMN sj_system_user.password IS '密码';
+COMMENT ON COLUMN sj_system_user.role IS '角色:1-普通用户、2-管理员';
+COMMENT ON COLUMN sj_system_user.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_system_user.update_dt IS '修改时间';
+COMMENT ON TABLE sj_system_user IS '系统用户表';
+
+INSERT INTO sj_system_user (username, password, role)
+VALUES ('admin', '465c194afb65670f38322df087f0a9bb225cc257e43eb4ac5a0c98ef5b3173ac', 2);
+
+-- sj_system_user_permission
+CREATE TABLE sj_system_user_permission
+(
+ id bigint NOT NULL PRIMARY KEY IDENTITY,
+ group_name varchar(64) NULL,
+ namespace_id varchar(64) DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' NULL,
+ system_user_id bigint NOT NULL,
+ create_dt datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ update_dt datetime DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+
+CREATE UNIQUE INDEX uk_sj_system_user_permission_01 ON sj_system_user_permission (namespace_id, group_name, system_user_id);
+
+COMMENT ON COLUMN sj_system_user_permission.id IS '主键';
+COMMENT ON COLUMN sj_system_user_permission.group_name IS '组名称';
+COMMENT ON COLUMN sj_system_user_permission.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_system_user_permission.system_user_id IS '系统用户id';
+COMMENT ON COLUMN sj_system_user_permission.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_system_user_permission.update_dt IS '修改时间';
+COMMENT ON TABLE sj_system_user_permission IS '系统用户权限表';
+
+-- sj_sequence_alloc
+CREATE TABLE sj_sequence_alloc
+(
+ id bigint NOT NULL PRIMARY KEY IDENTITY,
+ namespace_id varchar(64) DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' NULL,
+ group_name varchar(64) DEFAULT '' NULL,
+ max_id bigint DEFAULT 1 NOT NULL,
+ step int DEFAULT 100 NOT NULL,
+ update_dt datetime DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+
+CREATE UNIQUE INDEX uk_sj_sequence_alloc_01 ON sj_sequence_alloc (namespace_id, group_name);
+
+COMMENT ON COLUMN sj_sequence_alloc.id IS '主键';
+COMMENT ON COLUMN sj_sequence_alloc.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_sequence_alloc.group_name IS '组名称';
+COMMENT ON COLUMN sj_sequence_alloc.max_id IS '最大id';
+COMMENT ON COLUMN sj_sequence_alloc.step IS '步长';
+COMMENT ON COLUMN sj_sequence_alloc.update_dt IS '更新时间';
+COMMENT ON TABLE sj_sequence_alloc IS '号段模式序号ID分配表';
+
+-- sj_job
+CREATE TABLE sj_job
+(
+ id bigint NOT NULL PRIMARY KEY IDENTITY,
+ namespace_id varchar(64) DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' NULL,
+ group_name varchar(64) NULL,
+ job_name varchar(64) NULL,
+ args_str text DEFAULT NULL NULL,
+ args_type smallint DEFAULT 1 NOT NULL,
+ next_trigger_at bigint NOT NULL,
+ job_status smallint DEFAULT 1 NOT NULL,
+ task_type smallint DEFAULT 1 NOT NULL,
+ route_key smallint DEFAULT 4 NOT NULL,
+ executor_type smallint DEFAULT 1 NOT NULL,
+ executor_info varchar(255) DEFAULT NULL NULL,
+ trigger_type smallint NOT NULL,
+ trigger_interval varchar(255) NULL,
+ block_strategy smallint DEFAULT 1 NOT NULL,
+ executor_timeout int DEFAULT 0 NOT NULL,
+ max_retry_times int DEFAULT 0 NOT NULL,
+ parallel_num int DEFAULT 1 NOT NULL,
+ retry_interval int DEFAULT 0 NOT NULL,
+ bucket_index int DEFAULT 0 NOT NULL,
+ resident smallint DEFAULT 0 NOT NULL,
+ description varchar(256) DEFAULT '' NULL,
+ ext_attrs varchar(256) DEFAULT '' NULL,
+ deleted smallint DEFAULT 0 NOT NULL,
+ create_dt datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ update_dt datetime DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+
+CREATE INDEX idx_sj_job_01 ON sj_job (namespace_id, group_name);
+CREATE INDEX idx_sj_job_02 ON sj_job (job_status, bucket_index);
+CREATE INDEX idx_sj_job_03 ON sj_job (create_dt);
+
+COMMENT ON COLUMN sj_job.id IS '主键';
+COMMENT ON COLUMN sj_job.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_job.group_name IS '组名称';
+COMMENT ON COLUMN sj_job.job_name IS '名称';
+COMMENT ON COLUMN sj_job.args_str IS '执行方法参数';
+COMMENT ON COLUMN sj_job.args_type IS '参数类型 ';
+COMMENT ON COLUMN sj_job.next_trigger_at IS '下次触发时间';
+COMMENT ON COLUMN sj_job.job_status IS '任务状态 0、关闭、1、开启';
+COMMENT ON COLUMN sj_job.task_type IS '任务类型 1、集群 2、广播 3、切片';
+COMMENT ON COLUMN sj_job.route_key IS '路由策略';
+COMMENT ON COLUMN sj_job.executor_type IS '执行器类型';
+COMMENT ON COLUMN sj_job.executor_info IS '执行器名称';
+COMMENT ON COLUMN sj_job.trigger_type IS '触发类型 1.CRON 表达式 2. 固定时间';
+COMMENT ON COLUMN sj_job.trigger_interval IS '间隔时长';
+COMMENT ON COLUMN sj_job.block_strategy IS '阻塞策略 1、丢弃 2、覆盖 3、并行';
+COMMENT ON COLUMN sj_job.executor_timeout IS '任务执行超时时间,单位秒';
+COMMENT ON COLUMN sj_job.max_retry_times IS '最大重试次数';
+COMMENT ON COLUMN sj_job.parallel_num IS '并行数';
+COMMENT ON COLUMN sj_job.retry_interval IS '重试间隔 ( s ) ';
+COMMENT ON COLUMN sj_job.bucket_index IS 'bucket';
+COMMENT ON COLUMN sj_job.resident IS '是否是常驻任务';
+COMMENT ON COLUMN sj_job.description IS '描述';
+COMMENT ON COLUMN sj_job.ext_attrs IS '扩展字段';
+COMMENT ON COLUMN sj_job.deleted IS '逻辑删除 1、删除';
+COMMENT ON COLUMN sj_job.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_job.update_dt IS '修改时间';
+COMMENT ON TABLE sj_job IS '任务信息';
+
+-- sj_job_log_message
+CREATE TABLE sj_job_log_message
+(
+ id bigint NOT NULL PRIMARY KEY IDENTITY,
+ namespace_id varchar(64) DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' NULL,
+ group_name varchar(64) NULL,
+ job_id bigint NOT NULL,
+ task_batch_id bigint NOT NULL,
+ task_id bigint NOT NULL,
+ message text NULL,
+ log_num int DEFAULT 1 NOT NULL,
+ real_time bigint DEFAULT 0 NOT NULL,
+ ext_attrs varchar(256) DEFAULT '' NULL,
+ create_dt datetime DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+
+CREATE INDEX idx_sj_job_log_message_01 ON sj_job_log_message (task_batch_id, task_id);
+CREATE INDEX idx_sj_job_log_message_02 ON sj_job_log_message (create_dt);
+CREATE INDEX idx_sj_job_log_message_03 ON sj_job_log_message (namespace_id, group_name);
+
+COMMENT ON COLUMN sj_job_log_message.id IS '主键';
+COMMENT ON COLUMN sj_job_log_message.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_job_log_message.group_name IS '组名称';
+COMMENT ON COLUMN sj_job_log_message.job_id IS '任务信息id';
+COMMENT ON COLUMN sj_job_log_message.task_batch_id IS '任务批次id';
+COMMENT ON COLUMN sj_job_log_message.task_id IS '调度任务id';
+COMMENT ON COLUMN sj_job_log_message.message IS '调度信息';
+COMMENT ON COLUMN sj_job_log_message.log_num IS '日志数量';
+COMMENT ON COLUMN sj_job_log_message.real_time IS '上报时间';
+COMMENT ON COLUMN sj_job_log_message.ext_attrs IS '扩展字段';
+COMMENT ON COLUMN sj_job_log_message.create_dt IS '创建时间';
+COMMENT ON TABLE sj_job_log_message IS '调度日志';
+
+-- sj_job_task
+CREATE TABLE sj_job_task
+(
+ id bigint NOT NULL PRIMARY KEY IDENTITY,
+ namespace_id varchar(64) DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' NULL,
+ group_name varchar(64) NULL,
+ job_id bigint NOT NULL,
+ task_batch_id bigint NOT NULL,
+ parent_id bigint DEFAULT 0 NOT NULL,
+ task_status smallint DEFAULT 0 NOT NULL,
+ retry_count int DEFAULT 0 NOT NULL,
+ client_info varchar(128) DEFAULT NULL NULL,
+ result_message text NULL,
+ args_str text DEFAULT NULL NULL,
+ args_type smallint DEFAULT 1 NOT NULL,
+ ext_attrs varchar(256) DEFAULT '' NULL,
+ create_dt datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ update_dt datetime DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+
+CREATE INDEX idx_sj_job_task_01 ON sj_job_task (task_batch_id, task_status);
+CREATE INDEX idx_sj_job_task_02 ON sj_job_task (create_dt);
+CREATE INDEX idx_sj_job_task_03 ON sj_job_task (namespace_id, group_name);
+
+COMMENT ON COLUMN sj_job_task.id IS '主键';
+COMMENT ON COLUMN sj_job_task.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_job_task.group_name IS '组名称';
+COMMENT ON COLUMN sj_job_task.job_id IS '任务信息id';
+COMMENT ON COLUMN sj_job_task.task_batch_id IS '调度任务id';
+COMMENT ON COLUMN sj_job_task.parent_id IS '父执行器id';
+COMMENT ON COLUMN sj_job_task.task_status IS '执行的状态 0、失败 1、成功';
+COMMENT ON COLUMN sj_job_task.retry_count IS '重试次数';
+COMMENT ON COLUMN sj_job_task.client_info IS '客户端地址 clientId#ip:port';
+COMMENT ON COLUMN sj_job_task.result_message IS '执行结果';
+COMMENT ON COLUMN sj_job_task.args_str IS '执行方法参数';
+COMMENT ON COLUMN sj_job_task.args_type IS '参数类型 ';
+COMMENT ON COLUMN sj_job_task.ext_attrs IS '扩展字段';
+COMMENT ON COLUMN sj_job_task.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_job_task.update_dt IS '修改时间';
+COMMENT ON TABLE sj_job_task IS '任务实例';
+
+-- sj_job_task_batch
+CREATE TABLE sj_job_task_batch
+(
+ id bigint NOT NULL PRIMARY KEY IDENTITY,
+ namespace_id varchar(64) DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' NULL,
+ group_name varchar(64) NULL,
+ job_id bigint NOT NULL,
+ workflow_node_id bigint DEFAULT 0 NOT NULL,
+ parent_workflow_node_id bigint DEFAULT 0 NOT NULL,
+ workflow_task_batch_id bigint DEFAULT 0 NOT NULL,
+ task_batch_status smallint DEFAULT 0 NOT NULL,
+ operation_reason smallint DEFAULT 0 NOT NULL,
+ execution_at bigint DEFAULT 0 NOT NULL,
+ system_task_type smallint DEFAULT 3 NOT NULL,
+ parent_id varchar(64) DEFAULT '' NULL,
+ ext_attrs varchar(256) DEFAULT '' NULL,
+ deleted smallint DEFAULT 0 NOT NULL,
+ create_dt datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ update_dt datetime DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+
+CREATE INDEX idx_sj_job_task_batch_01 ON sj_job_task_batch (job_id, task_batch_status);
+CREATE INDEX idx_sj_job_task_batch_02 ON sj_job_task_batch (create_dt);
+CREATE INDEX idx_sj_job_task_batch_03 ON sj_job_task_batch (namespace_id, group_name);
+CREATE INDEX idx_sj_job_task_batch_04 ON sj_job_task_batch (workflow_task_batch_id, workflow_node_id);
+
+COMMENT ON COLUMN sj_job_task_batch.id IS '主键';
+COMMENT ON COLUMN sj_job_task_batch.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_job_task_batch.group_name IS '组名称';
+COMMENT ON COLUMN sj_job_task_batch.job_id IS '任务id';
+COMMENT ON COLUMN sj_job_task_batch.workflow_node_id IS '工作流节点id';
+COMMENT ON COLUMN sj_job_task_batch.parent_workflow_node_id IS '工作流任务父批次id';
+COMMENT ON COLUMN sj_job_task_batch.workflow_task_batch_id IS '工作流任务批次id';
+COMMENT ON COLUMN sj_job_task_batch.task_batch_status IS '任务批次状态 0、失败 1、成功';
+COMMENT ON COLUMN sj_job_task_batch.operation_reason IS '操作原因';
+COMMENT ON COLUMN sj_job_task_batch.execution_at IS '任务执行时间';
+COMMENT ON COLUMN sj_job_task_batch.system_task_type IS '任务类型 3、JOB任务 4、WORKFLOW任务';
+COMMENT ON COLUMN sj_job_task_batch.parent_id IS '父节点';
+COMMENT ON COLUMN sj_job_task_batch.ext_attrs IS '扩展字段';
+COMMENT ON COLUMN sj_job_task_batch.deleted IS '逻辑删除 1、删除';
+COMMENT ON COLUMN sj_job_task_batch.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_job_task_batch.update_dt IS '修改时间';
+COMMENT ON TABLE sj_job_task_batch IS '任务批次';
+
+-- sj_job_summary
+CREATE TABLE sj_job_summary
+(
+ id bigint NOT NULL PRIMARY KEY IDENTITY,
+ namespace_id varchar(64) DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' NULL,
+ group_name varchar(64) DEFAULT '' NULL,
+ business_id bigint NOT NULL,
+ system_task_type smallint DEFAULT 3 NOT NULL,
+ trigger_at datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ success_num int DEFAULT 0 NOT NULL,
+ fail_num int DEFAULT 0 NOT NULL,
+ fail_reason varchar(512) DEFAULT '' NULL,
+ stop_num int DEFAULT 0 NOT NULL,
+ stop_reason varchar(512) DEFAULT '' NULL,
+ cancel_num int DEFAULT 0 NOT NULL,
+ cancel_reason varchar(512) DEFAULT '' NULL,
+ create_dt datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ update_dt datetime DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+
+CREATE UNIQUE INDEX uk_sj_job_summary_01 ON sj_job_summary (trigger_at, system_task_type, business_id);
+
+CREATE INDEX idx_sj_job_summary_01 ON sj_job_summary (namespace_id, group_name, business_id);
+
+COMMENT ON COLUMN sj_job_summary.id IS '主键';
+COMMENT ON COLUMN sj_job_summary.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_job_summary.group_name IS '组名称';
+COMMENT ON COLUMN sj_job_summary.business_id IS '业务id ( job_id或workflow_id ) ';
+COMMENT ON COLUMN sj_job_summary.system_task_type IS '任务类型 3、JOB任务 4、WORKFLOW任务';
+COMMENT ON COLUMN sj_job_summary.trigger_at IS '统计时间';
+COMMENT ON COLUMN sj_job_summary.success_num IS '执行成功-日志数量';
+COMMENT ON COLUMN sj_job_summary.fail_num IS '执行失败-日志数量';
+COMMENT ON COLUMN sj_job_summary.fail_reason IS '失败原因';
+COMMENT ON COLUMN sj_job_summary.stop_num IS '执行失败-日志数量';
+COMMENT ON COLUMN sj_job_summary.stop_reason IS '失败原因';
+COMMENT ON COLUMN sj_job_summary.cancel_num IS '执行失败-日志数量';
+COMMENT ON COLUMN sj_job_summary.cancel_reason IS '失败原因';
+COMMENT ON COLUMN sj_job_summary.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_job_summary.update_dt IS '修改时间';
+COMMENT ON TABLE sj_job_summary IS 'DashBoard_Job';
+
+-- sj_retry_summary
+CREATE TABLE sj_retry_summary
+(
+ id bigint NOT NULL PRIMARY KEY IDENTITY,
+ namespace_id varchar(64) DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' NULL,
+ group_name varchar(64) DEFAULT '' NULL,
+ scene_name varchar(50) DEFAULT '' NULL,
+ trigger_at datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ running_num int DEFAULT 0 NOT NULL,
+ finish_num int DEFAULT 0 NOT NULL,
+ max_count_num int DEFAULT 0 NOT NULL,
+ suspend_num int DEFAULT 0 NOT NULL,
+ create_dt datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ update_dt datetime DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+
+CREATE UNIQUE INDEX uk_sj_retry_summary_01 ON sj_retry_summary (namespace_id, group_name, scene_name, trigger_at);
+
+CREATE INDEX idx_sj_retry_summary_01 ON sj_retry_summary (trigger_at);
+
+COMMENT ON COLUMN sj_retry_summary.id IS '主键';
+COMMENT ON COLUMN sj_retry_summary.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_retry_summary.group_name IS '组名称';
+COMMENT ON COLUMN sj_retry_summary.scene_name IS '场景名称';
+COMMENT ON COLUMN sj_retry_summary.trigger_at IS '统计时间';
+COMMENT ON COLUMN sj_retry_summary.running_num IS '重试中-日志数量';
+COMMENT ON COLUMN sj_retry_summary.finish_num IS '重试完成-日志数量';
+COMMENT ON COLUMN sj_retry_summary.max_count_num IS '重试到达最大次数-日志数量';
+COMMENT ON COLUMN sj_retry_summary.suspend_num IS '暂停重试-日志数量';
+COMMENT ON COLUMN sj_retry_summary.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_retry_summary.update_dt IS '修改时间';
+COMMENT ON TABLE sj_retry_summary IS 'DashBoard_Retry';
+
+-- sj_workflow
+CREATE TABLE sj_workflow
+(
+ id bigint NOT NULL PRIMARY KEY IDENTITY,
+ workflow_name varchar(64) NULL,
+ namespace_id varchar(64) DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' NULL,
+ group_name varchar(64) NULL,
+ workflow_status smallint DEFAULT 1 NOT NULL,
+ trigger_type smallint NOT NULL,
+ trigger_interval varchar(255) NULL,
+ next_trigger_at bigint NOT NULL,
+ block_strategy smallint DEFAULT 1 NOT NULL,
+ executor_timeout int DEFAULT 0 NOT NULL,
+ description varchar(256) DEFAULT '' NULL,
+ flow_info text DEFAULT NULL NULL,
+ bucket_index int DEFAULT 0 NOT NULL,
+ version int NOT NULL,
+ ext_attrs varchar(256) DEFAULT '' NULL,
+ deleted smallint DEFAULT 0 NOT NULL,
+ create_dt datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ update_dt datetime DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+
+CREATE INDEX idx_sj_workflow_01 ON sj_workflow (create_dt);
+CREATE INDEX idx_sj_workflow_02 ON sj_workflow (namespace_id, group_name);
+
+COMMENT ON COLUMN sj_workflow.id IS '主键';
+COMMENT ON COLUMN sj_workflow.workflow_name IS '工作流名称';
+COMMENT ON COLUMN sj_workflow.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_workflow.group_name IS '组名称';
+COMMENT ON COLUMN sj_workflow.workflow_status IS '工作流状态 0、关闭、1、开启';
+COMMENT ON COLUMN sj_workflow.trigger_type IS '触发类型 1.CRON 表达式 2. 固定时间';
+COMMENT ON COLUMN sj_workflow.trigger_interval IS '间隔时长';
+COMMENT ON COLUMN sj_workflow.next_trigger_at IS '下次触发时间';
+COMMENT ON COLUMN sj_workflow.block_strategy IS '阻塞策略 1、丢弃 2、覆盖 3、并行';
+COMMENT ON COLUMN sj_workflow.executor_timeout IS '任务执行超时时间,单位秒';
+COMMENT ON COLUMN sj_workflow.description IS '描述';
+COMMENT ON COLUMN sj_workflow.flow_info IS '流程信息';
+COMMENT ON COLUMN sj_workflow.bucket_index IS 'bucket';
+COMMENT ON COLUMN sj_workflow.version IS '版本号';
+COMMENT ON COLUMN sj_workflow.ext_attrs IS '扩展字段';
+COMMENT ON COLUMN sj_workflow.deleted IS '逻辑删除 1、删除';
+COMMENT ON COLUMN sj_workflow.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_workflow.update_dt IS '修改时间';
+COMMENT ON TABLE sj_workflow IS '工作流';
+
+-- sj_workflow_node
+CREATE TABLE sj_workflow_node
+(
+ id bigint NOT NULL PRIMARY KEY IDENTITY,
+ namespace_id varchar(64) DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' NULL,
+ node_name varchar(64) NULL,
+ group_name varchar(64) NULL,
+ job_id bigint NOT NULL,
+ workflow_id bigint NOT NULL,
+ node_type smallint DEFAULT 1 NOT NULL,
+ expression_type smallint DEFAULT 0 NOT NULL,
+ fail_strategy smallint DEFAULT 1 NOT NULL,
+ workflow_node_status smallint DEFAULT 1 NOT NULL,
+ priority_level int DEFAULT 1 NOT NULL,
+ node_info text DEFAULT NULL NULL,
+ version int NOT NULL,
+ ext_attrs varchar(256) DEFAULT '' NULL,
+ deleted smallint DEFAULT 0 NOT NULL,
+ create_dt datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ update_dt datetime DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+
+CREATE INDEX idx_sj_workflow_node_01 ON sj_workflow_node (create_dt);
+CREATE INDEX idx_sj_workflow_node_02 ON sj_workflow_node (namespace_id, group_name);
+
+COMMENT ON COLUMN sj_workflow_node.id IS '主键';
+COMMENT ON COLUMN sj_workflow_node.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_workflow_node.node_name IS '节点名称';
+COMMENT ON COLUMN sj_workflow_node.group_name IS '组名称';
+COMMENT ON COLUMN sj_workflow_node.job_id IS '任务信息id';
+COMMENT ON COLUMN sj_workflow_node.workflow_id IS '工作流ID';
+COMMENT ON COLUMN sj_workflow_node.node_type IS '1、任务节点 2、条件节点';
+COMMENT ON COLUMN sj_workflow_node.expression_type IS '1、SpEl、2、Aviator 3、QL';
+COMMENT ON COLUMN sj_workflow_node.fail_strategy IS '失败策略 1、跳过 2、阻塞';
+COMMENT ON COLUMN sj_workflow_node.workflow_node_status IS '工作流节点状态 0、关闭、1、开启';
+COMMENT ON COLUMN sj_workflow_node.priority_level IS '优先级';
+COMMENT ON COLUMN sj_workflow_node.node_info IS '节点信息 ';
+COMMENT ON COLUMN sj_workflow_node.version IS '版本号';
+COMMENT ON COLUMN sj_workflow_node.ext_attrs IS '扩展字段';
+COMMENT ON COLUMN sj_workflow_node.deleted IS '逻辑删除 1、删除';
+COMMENT ON COLUMN sj_workflow_node.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_workflow_node.update_dt IS '修改时间';
+COMMENT ON TABLE sj_workflow_node IS '工作流节点';
+
+-- sj_workflow_task_batch
+CREATE TABLE sj_workflow_task_batch
+(
+ id bigint NOT NULL PRIMARY KEY IDENTITY,
+ namespace_id varchar(64) DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' NULL,
+ group_name varchar(64) NULL,
+ workflow_id bigint NOT NULL,
+ task_batch_status smallint DEFAULT 0 NOT NULL,
+ operation_reason smallint DEFAULT 0 NOT NULL,
+ flow_info text DEFAULT NULL NULL,
+ execution_at bigint DEFAULT 0 NOT NULL,
+ ext_attrs varchar(256) DEFAULT '' NULL,
+ deleted smallint DEFAULT 0 NOT NULL,
+ create_dt datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ update_dt datetime DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+
+CREATE INDEX idx_sj_workflow_task_batch_01 ON sj_workflow_task_batch (workflow_id, task_batch_status);
+CREATE INDEX idx_sj_workflow_task_batch_02 ON sj_workflow_task_batch (create_dt);
+CREATE INDEX idx_sj_workflow_task_batch_03 ON sj_workflow_task_batch (namespace_id, group_name);
+
+COMMENT ON COLUMN sj_workflow_task_batch.id IS '主键';
+COMMENT ON COLUMN sj_workflow_task_batch.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_workflow_task_batch.group_name IS '组名称';
+COMMENT ON COLUMN sj_workflow_task_batch.workflow_id IS '工作流任务id';
+COMMENT ON COLUMN sj_workflow_task_batch.task_batch_status IS '任务批次状态 0、失败 1、成功';
+COMMENT ON COLUMN sj_workflow_task_batch.operation_reason IS '操作原因';
+COMMENT ON COLUMN sj_workflow_task_batch.flow_info IS '流程信息';
+COMMENT ON COLUMN sj_workflow_task_batch.execution_at IS '任务执行时间';
+COMMENT ON COLUMN sj_workflow_task_batch.ext_attrs IS '扩展字段';
+COMMENT ON COLUMN sj_workflow_task_batch.deleted IS '逻辑删除 1、删除';
+COMMENT ON COLUMN sj_workflow_task_batch.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_workflow_task_batch.update_dt IS '修改时间';
+COMMENT ON TABLE sj_workflow_task_batch IS '工作流批次';
+
diff --git a/continew-admin-extension/continew-admin-job-server/src/main/resources/db/changelogs/mysql/snail_job.sql b/continew-admin-extension/continew-admin-job-server/src/main/resources/db/changelogs/mysql/snail_job.sql
new file mode 100644
index 000000000..8bff12f6e
--- /dev/null
+++ b/continew-admin-extension/continew-admin-job-server/src/main/resources/db/changelogs/mysql/snail_job.sql
@@ -0,0 +1,521 @@
+-- liquibase formatted sql
+
+-- changeset snail-job-server:1
+SET NAMES utf8mb4;
+
+CREATE TABLE `sj_namespace`
+(
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
+ `name` varchar(64) NOT NULL COMMENT '名称',
+ `unique_id` varchar(64) NOT NULL COMMENT '唯一id',
+ `description` varchar(256) NOT NULL DEFAULT '' COMMENT '描述',
+ `deleted` tinyint(4) NOT NULL DEFAULT 0 COMMENT '逻辑删除 1、删除',
+ `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
+ PRIMARY KEY (`id`),
+ KEY `idx_name` (`name`),
+ UNIQUE KEY `uk_unique_id` (`unique_id`)
+) ENGINE = InnoDB
+ DEFAULT CHARSET = utf8mb4 COMMENT ='命名空间';
+
+INSERT INTO `sj_namespace` (`id`, `name`, `unique_id`, `create_dt`, `update_dt`, `deleted`)
+VALUES (1, 'Default', '764d604ec6fc45f68cd92514c40e9e1a', now(), now(), 0);
+
+
+CREATE TABLE `sj_group_config`
+(
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
+ `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
+ `group_name` varchar(64) NOT NULL DEFAULT '' COMMENT '组名称',
+ `description` varchar(256) NOT NULL DEFAULT '' COMMENT '组描述',
+ `token` varchar(64) NOT NULL DEFAULT 'SJ_cKqBTPzCsWA3VyuCfFoccmuIEGXjr5KT' COMMENT 'token',
+ `group_status` tinyint(4) NOT NULL DEFAULT 0 COMMENT '组状态 0、未启用 1、启用',
+ `version` int(11) NOT NULL COMMENT '版本号',
+ `group_partition` int(11) NOT NULL COMMENT '分区',
+ `id_generator_mode` tinyint(4) NOT NULL DEFAULT 1 COMMENT '唯一id生成模式 默认号段模式',
+ `init_scene` tinyint(4) NOT NULL DEFAULT 0 COMMENT '是否初始化场景 0:否 1:是',
+ `bucket_index` int(11) NOT NULL DEFAULT 0 COMMENT 'bucket',
+ `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `uk_namespace_id_group_name` (`namespace_id`, `group_name`)
+) ENGINE = InnoDB
+ AUTO_INCREMENT = 0
+ DEFAULT CHARSET = utf8mb4 COMMENT ='组配置'
+;
+
+CREATE TABLE `sj_notify_config`
+(
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
+ `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
+ `group_name` varchar(64) NOT NULL COMMENT '组名称',
+ `business_id` varchar(64) NOT NULL COMMENT '业务id (job_id或workflow_id或scene_name)',
+ `system_task_type` tinyint(4) NOT NULL DEFAULT 3 COMMENT '任务类型 1. 重试任务 2. 重试回调 3、JOB任务 4、WORKFLOW任务',
+ `notify_status` tinyint(4) NOT NULL DEFAULT 0 COMMENT '通知状态 0、未启用 1、启用',
+ `recipient_ids` varchar(128) NOT NULL COMMENT '接收人id列表',
+ `notify_threshold` int(11) NOT NULL DEFAULT 0 COMMENT '通知阈值',
+ `notify_scene` tinyint(4) NOT NULL DEFAULT 0 COMMENT '通知场景',
+ `rate_limiter_status` tinyint(4) NOT NULL DEFAULT 0 COMMENT '限流状态 0、未启用 1、启用',
+ `rate_limiter_threshold` int(11) NOT NULL DEFAULT 0 COMMENT '每秒限流阈值',
+ `description` varchar(256) NOT NULL DEFAULT '' COMMENT '描述',
+ `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
+ PRIMARY KEY (`id`),
+ KEY `idx_namespace_id_group_name_scene_name` (`namespace_id`, `group_name`, `business_id`)
+) ENGINE = InnoDB
+ AUTO_INCREMENT = 0
+ DEFAULT CHARSET = utf8mb4 COMMENT ='通知配置'
+;
+
+CREATE TABLE `sj_notify_recipient`
+(
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
+ `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
+ `recipient_name` varchar(64) NOT NULL COMMENT '接收人名称',
+ `notify_type` tinyint(4) NOT NULL DEFAULT 0 COMMENT '通知类型 1、钉钉 2、邮件 3、企业微信 4 飞书 5 webhook',
+ `notify_attribute` varchar(512) NOT NULL COMMENT '配置属性',
+ `description` varchar(256) NOT NULL DEFAULT '' COMMENT '描述',
+ `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
+ PRIMARY KEY (`id`),
+ KEY `idx_namespace_id` (`namespace_id`)
+) ENGINE = InnoDB
+ AUTO_INCREMENT = 0
+ DEFAULT CHARSET = utf8mb4 COMMENT ='告警通知接收人'
+;
+
+
+CREATE TABLE `sj_retry_dead_letter_0`
+(
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
+ `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
+ `unique_id` varchar(64) NOT NULL COMMENT '同组下id唯一',
+ `group_name` varchar(64) NOT NULL COMMENT '组名称',
+ `scene_name` varchar(64) NOT NULL COMMENT '场景名称',
+ `idempotent_id` varchar(64) NOT NULL COMMENT '幂等id',
+ `biz_no` varchar(64) NOT NULL DEFAULT '' COMMENT '业务编号',
+ `executor_name` varchar(512) NOT NULL DEFAULT '' COMMENT '执行器名称',
+ `args_str` text NOT NULL COMMENT '执行方法参数',
+ `ext_attrs` text NOT NULL COMMENT '扩展字段',
+ `task_type` tinyint(4) NOT NULL DEFAULT 1 COMMENT '任务类型 1、重试数据 2、回调数据',
+ `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ PRIMARY KEY (`id`),
+ KEY `idx_namespace_id_group_name_scene_name` (`namespace_id`, `group_name`, `scene_name`),
+ KEY `idx_idempotent_id` (`idempotent_id`),
+ KEY `idx_biz_no` (`biz_no`),
+ KEY `idx_create_dt` (`create_dt`),
+ UNIQUE KEY `uk_namespace_id_group_name_unique_id` (`namespace_id`, `group_name`, `unique_id`)
+) ENGINE = InnoDB
+ AUTO_INCREMENT = 0
+ DEFAULT CHARSET = utf8mb4 COMMENT ='死信队列表'
+;
+
+CREATE TABLE `sj_retry_task_0`
+(
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
+ `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
+ `unique_id` varchar(64) NOT NULL COMMENT '同组下id唯一',
+ `group_name` varchar(64) NOT NULL COMMENT '组名称',
+ `scene_name` varchar(64) NOT NULL COMMENT '场景名称',
+ `idempotent_id` varchar(64) NOT NULL COMMENT '幂等id',
+ `biz_no` varchar(64) NOT NULL DEFAULT '' COMMENT '业务编号',
+ `executor_name` varchar(512) NOT NULL DEFAULT '' COMMENT '执行器名称',
+ `args_str` text NOT NULL COMMENT '执行方法参数',
+ `ext_attrs` text NOT NULL COMMENT '扩展字段',
+ `next_trigger_at` datetime NOT NULL COMMENT '下次触发时间',
+ `retry_count` int(11) NOT NULL DEFAULT 0 COMMENT '重试次数',
+ `retry_status` tinyint(4) NOT NULL DEFAULT 0 COMMENT '重试状态 0、重试中 1、成功 2、最大重试次数',
+ `task_type` tinyint(4) NOT NULL DEFAULT 1 COMMENT '任务类型 1、重试数据 2、回调数据',
+ `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
+ PRIMARY KEY (`id`),
+ KEY `idx_namespace_id_group_name_scene_name` (`namespace_id`, `group_name`, `scene_name`),
+ KEY `idx_namespace_id_group_name_task_type` (`namespace_id`, `group_name`, `task_type`),
+ KEY `idx_namespace_id_group_name_retry_status` (`namespace_id`, `group_name`, `retry_status`),
+ KEY `idx_idempotent_id` (`idempotent_id`),
+ KEY `idx_biz_no` (`biz_no`),
+ KEY `idx_create_dt` (`create_dt`),
+ UNIQUE KEY `uk_name_unique_id` (`namespace_id`, `group_name`, `unique_id`)
+) ENGINE = InnoDB
+ AUTO_INCREMENT = 0
+ DEFAULT CHARSET = utf8mb4 COMMENT ='任务表'
+;
+
+CREATE TABLE `sj_retry_task_log`
+(
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
+ `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
+ `unique_id` varchar(64) NOT NULL COMMENT '同组下id唯一',
+ `group_name` varchar(64) NOT NULL COMMENT '组名称',
+ `scene_name` varchar(64) NOT NULL COMMENT '场景名称',
+ `idempotent_id` varchar(64) NOT NULL COMMENT '幂等id',
+ `biz_no` varchar(64) NOT NULL DEFAULT '' COMMENT '业务编号',
+ `executor_name` varchar(512) NOT NULL DEFAULT '' COMMENT '执行器名称',
+ `args_str` text NOT NULL COMMENT '执行方法参数',
+ `ext_attrs` text NOT NULL COMMENT '扩展字段',
+ `retry_status` tinyint(4) NOT NULL DEFAULT 0 COMMENT '重试状态 0、重试中 1、成功 2、最大次数',
+ `task_type` tinyint(4) NOT NULL DEFAULT 1 COMMENT '任务类型 1、重试数据 2、回调数据',
+ `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
+ PRIMARY KEY (`id`),
+ KEY `idx_group_name_scene_name` (`namespace_id`, `group_name`, `scene_name`),
+ KEY `idx_retry_status` (`retry_status`),
+ KEY `idx_idempotent_id` (`idempotent_id`),
+ KEY `idx_unique_id` (`unique_id`),
+ KEY `idx_biz_no` (`biz_no`),
+ KEY `idx_create_dt` (`create_dt`)
+) ENGINE = InnoDB
+ AUTO_INCREMENT = 0
+ DEFAULT CHARSET = utf8mb4 COMMENT ='任务日志基础信息表'
+;
+
+CREATE TABLE `sj_retry_task_log_message`
+(
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
+ `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
+ `group_name` varchar(64) NOT NULL COMMENT '组名称',
+ `unique_id` varchar(64) NOT NULL COMMENT '同组下id唯一',
+ `message` longtext NOT NULL COMMENT '异常信息',
+ `log_num` int(11) NOT NULL DEFAULT 1 COMMENT '日志数量',
+ `real_time` bigint(13) NOT NULL DEFAULT 0 COMMENT '上报时间',
+ `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ PRIMARY KEY (`id`),
+ KEY `idx_namespace_id_group_name_scene_name` (`namespace_id`, `group_name`, `unique_id`),
+ KEY `idx_create_dt` (`create_dt`)
+) ENGINE = InnoDB
+ AUTO_INCREMENT = 0
+ DEFAULT CHARSET = utf8mb4 COMMENT ='任务调度日志信息记录表'
+;
+
+CREATE TABLE `sj_retry_scene_config`
+(
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
+ `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
+ `scene_name` varchar(64) NOT NULL COMMENT '场景名称',
+ `group_name` varchar(64) NOT NULL COMMENT '组名称',
+ `scene_status` tinyint(4) NOT NULL DEFAULT 0 COMMENT '组状态 0、未启用 1、启用',
+ `max_retry_count` int(11) NOT NULL DEFAULT 5 COMMENT '最大重试次数',
+ `back_off` tinyint(4) NOT NULL DEFAULT 1 COMMENT '1、默认等级 2、固定间隔时间 3、CRON 表达式',
+ `trigger_interval` varchar(16) NOT NULL DEFAULT '' COMMENT '间隔时长',
+ `deadline_request` bigint(20) unsigned NOT NULL DEFAULT 60000 COMMENT 'Deadline Request 调用链超时 单位毫秒',
+ `executor_timeout` int(11) unsigned NOT NULL DEFAULT 5 COMMENT '任务执行超时时间,单位秒',
+ `route_key` tinyint(4) NOT NULL DEFAULT 4 COMMENT '路由策略',
+ `description` varchar(256) NOT NULL DEFAULT '' COMMENT '描述',
+ `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `uk_namespace_id_group_name_scene_name` (`namespace_id`, `group_name`, `scene_name`)
+) ENGINE = InnoDB
+ AUTO_INCREMENT = 0
+ DEFAULT CHARSET = utf8mb4 COMMENT ='场景配置'
+;
+
+CREATE TABLE `sj_server_node`
+(
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
+ `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
+ `group_name` varchar(64) NOT NULL COMMENT '组名称',
+ `host_id` varchar(64) NOT NULL COMMENT '主机id',
+ `host_ip` varchar(64) NOT NULL COMMENT '机器ip',
+ `host_port` int(16) NOT NULL COMMENT '机器端口',
+ `expire_at` datetime NOT NULL COMMENT '过期时间',
+ `node_type` tinyint(4) NOT NULL COMMENT '节点类型 1、客户端 2、是服务端',
+ `ext_attrs` varchar(256) NULL DEFAULT '' COMMENT '扩展字段',
+ `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
+ PRIMARY KEY (`id`),
+ KEY `idx_namespace_id_group_name` (`namespace_id`, `group_name`),
+ KEY `idx_expire_at_node_type` (`expire_at`, `node_type`),
+ UNIQUE KEY `uk_host_id_host_ip` (`host_id`, `host_ip`)
+) ENGINE = InnoDB
+ AUTO_INCREMENT = 0
+ DEFAULT CHARSET = utf8mb4 COMMENT ='服务器节点'
+;
+
+CREATE TABLE `sj_distributed_lock`
+(
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
+ `name` varchar(64) NOT NULL COMMENT '锁名称',
+ `lock_until` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT '锁定时长',
+ `locked_at` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '锁定时间',
+ `locked_by` varchar(255) NOT NULL COMMENT '锁定者',
+ `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `uk_name` (`name`)
+) ENGINE = InnoDB
+ AUTO_INCREMENT = 0
+ DEFAULT CHARSET = utf8mb4 COMMENT ='锁定表'
+;
+
+CREATE TABLE `sj_system_user`
+(
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
+ `username` varchar(64) NOT NULL COMMENT '账号',
+ `password` varchar(128) NOT NULL COMMENT '密码',
+ `role` tinyint(4) NOT NULL DEFAULT 0 COMMENT '角色:1-普通用户、2-管理员',
+ `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `uk_username` (`username`) USING BTREE
+) ENGINE = InnoDB
+ DEFAULT CHARSET = utf8mb4 COMMENT ='系统用户表';
+
+-- pwd: admin
+INSERT INTO `sj_system_user` (username, password, role)
+VALUES ('admin', '465c194afb65670f38322df087f0a9bb225cc257e43eb4ac5a0c98ef5b3173ac', 2);
+
+CREATE TABLE `sj_system_user_permission`
+(
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
+ `group_name` varchar(64) NOT NULL COMMENT '组名称',
+ `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
+ `system_user_id` bigint(20) NOT NULL COMMENT '系统用户id',
+ `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `uk_namespace_id_group_name_system_user_id` (`namespace_id`, `group_name`, `system_user_id`)
+) ENGINE = InnoDB
+ DEFAULT CHARSET = utf8mb4 COMMENT ='系统用户权限表';
+
+CREATE TABLE `sj_sequence_alloc`
+(
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
+ `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
+ `group_name` varchar(64) NOT NULL DEFAULT '' COMMENT '组名称',
+ `max_id` bigint(20) NOT NULL DEFAULT 1 COMMENT '最大id',
+ `step` int(11) NOT NULL DEFAULT 100 COMMENT '步长',
+ `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `uk_namespace_id_group_name` (`namespace_id`, `group_name`)
+) ENGINE = InnoDB
+ DEFAULT CHARSET = utf8mb4 COMMENT ='号段模式序号ID分配表';
+
+-- 分布式调度DDL
+CREATE TABLE `sj_job`
+(
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
+ `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
+ `group_name` varchar(64) NOT NULL COMMENT '组名称',
+ `job_name` varchar(64) NOT NULL COMMENT '名称',
+ `args_str` text DEFAULT NULL COMMENT '执行方法参数',
+ `args_type` tinyint(4) NOT NULL DEFAULT 1 COMMENT '参数类型 ',
+ `next_trigger_at` bigint(13) NOT NULL COMMENT '下次触发时间',
+ `job_status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '任务状态 0、关闭、1、开启',
+ `task_type` tinyint(4) NOT NULL DEFAULT 1 COMMENT '任务类型 1、集群 2、广播 3、切片',
+ `route_key` tinyint(4) NOT NULL DEFAULT 4 COMMENT '路由策略',
+ `executor_type` tinyint(4) NOT NULL DEFAULT 1 COMMENT '执行器类型',
+ `executor_info` varchar(255) DEFAULT NULL COMMENT '执行器名称',
+ `trigger_type` tinyint(4) NOT NULL COMMENT '触发类型 1.CRON 表达式 2. 固定时间',
+ `trigger_interval` varchar(255) NOT NULL COMMENT '间隔时长',
+ `block_strategy` tinyint(4) NOT NULL DEFAULT 1 COMMENT '阻塞策略 1、丢弃 2、覆盖 3、并行',
+ `executor_timeout` int(11) NOT NULL DEFAULT 0 COMMENT '任务执行超时时间,单位秒',
+ `max_retry_times` int(11) NOT NULL DEFAULT 0 COMMENT '最大重试次数',
+ `parallel_num` int(11) NOT NULL DEFAULT 1 COMMENT '并行数',
+ `retry_interval` int(11) NOT NULL DEFAULT 0 COMMENT '重试间隔(s)',
+ `bucket_index` int(11) NOT NULL DEFAULT 0 COMMENT 'bucket',
+ `resident` tinyint(4) NOT NULL DEFAULT 0 COMMENT '是否是常驻任务',
+ `description` varchar(256) NOT NULL DEFAULT '' COMMENT '描述',
+ `ext_attrs` varchar(256) NULL DEFAULT '' COMMENT '扩展字段',
+ `deleted` tinyint(4) NOT NULL DEFAULT 0 COMMENT '逻辑删除 1、删除',
+ `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
+ PRIMARY KEY (`id`),
+ KEY `idx_namespace_id_group_name` (`namespace_id`, `group_name`),
+ KEY `idx_job_status_bucket_index` (`job_status`, `bucket_index`),
+ KEY `idx_create_dt` (`create_dt`)
+) ENGINE = InnoDB
+ AUTO_INCREMENT = 0
+ DEFAULT CHARSET = utf8mb4 COMMENT ='任务信息';
+
+CREATE TABLE `sj_job_log_message`
+(
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
+ `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
+ `group_name` varchar(64) NOT NULL COMMENT '组名称',
+ `job_id` bigint(20) NOT NULL COMMENT '任务信息id',
+ `task_batch_id` bigint(20) NOT NULL COMMENT '任务批次id',
+ `task_id` bigint(20) NOT NULL COMMENT '调度任务id',
+ `message` longtext NOT NULL COMMENT '调度信息',
+ `log_num` int(11) NOT NULL DEFAULT 1 COMMENT '日志数量',
+ `real_time` bigint(13) NOT NULL DEFAULT 0 COMMENT '上报时间',
+ `ext_attrs` varchar(256) NULL DEFAULT '' COMMENT '扩展字段',
+ `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ PRIMARY KEY (`id`),
+ KEY `idx_task_batch_id_task_id` (`task_batch_id`, `task_id`),
+ KEY `idx_create_dt` (`create_dt`),
+ KEY `idx_namespace_id_group_name` (`namespace_id`, `group_name`)
+) ENGINE = InnoDB
+ AUTO_INCREMENT = 0
+ DEFAULT CHARSET = utf8mb4 COMMENT ='调度日志';
+
+CREATE TABLE `sj_job_task`
+(
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
+ `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
+ `group_name` varchar(64) NOT NULL COMMENT '组名称',
+ `job_id` bigint(20) NOT NULL COMMENT '任务信息id',
+ `task_batch_id` bigint(20) NOT NULL COMMENT '调度任务id',
+ `parent_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '父执行器id',
+ `task_status` tinyint(4) NOT NULL DEFAULT 0 COMMENT '执行的状态 0、失败 1、成功',
+ `retry_count` int(11) NOT NULL DEFAULT 0 COMMENT '重试次数',
+ `client_info` varchar(128) DEFAULT NULL COMMENT '客户端地址 clientId#ip:port',
+ `result_message` text NOT NULL COMMENT '执行结果',
+ `args_str` text DEFAULT NULL COMMENT '执行方法参数',
+ `args_type` tinyint(4) NOT NULL DEFAULT 1 COMMENT '参数类型 ',
+ `ext_attrs` varchar(256) NULL DEFAULT '' COMMENT '扩展字段',
+ `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
+ PRIMARY KEY (`id`),
+ KEY `idx_task_batch_id_task_status` (`task_batch_id`, `task_status`),
+ KEY `idx_create_dt` (`create_dt`),
+ KEY `idx_namespace_id_group_name` (`namespace_id`, `group_name`)
+) ENGINE = InnoDB
+ AUTO_INCREMENT = 0
+ DEFAULT CHARSET = utf8mb4 COMMENT ='任务实例';
+
+CREATE TABLE `sj_job_task_batch`
+(
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
+ `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
+ `group_name` varchar(64) NOT NULL COMMENT '组名称',
+ `job_id` bigint(20) NOT NULL COMMENT '任务id',
+ `workflow_node_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '工作流节点id',
+ `parent_workflow_node_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '工作流任务父批次id',
+ `workflow_task_batch_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '工作流任务批次id',
+ `task_batch_status` tinyint(4) NOT NULL DEFAULT 0 COMMENT '任务批次状态 0、失败 1、成功',
+ `operation_reason` tinyint(4) NOT NULL DEFAULT 0 COMMENT '操作原因',
+ `execution_at` bigint(13) NOT NULL DEFAULT 0 COMMENT '任务执行时间',
+ `system_task_type` tinyint(4) NOT NULL DEFAULT 3 COMMENT '任务类型 3、JOB任务 4、WORKFLOW任务',
+ `parent_id` varchar(64) NOT NULL DEFAULT '' COMMENT '父节点',
+ `ext_attrs` varchar(256) NULL DEFAULT '' COMMENT '扩展字段',
+ `deleted` tinyint(4) NOT NULL DEFAULT 0 COMMENT '逻辑删除 1、删除',
+ `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
+ PRIMARY KEY (`id`),
+ KEY `idx_job_id_task_batch_status` (`job_id`, `task_batch_status`),
+ KEY `idx_create_dt` (`create_dt`),
+ KEY `idx_namespace_id_group_name` (`namespace_id`, `group_name`),
+ KEY `idx_workflow_task_batch_id_workflow_node_id` (`workflow_task_batch_id`, `workflow_node_id`)
+) ENGINE = InnoDB
+ AUTO_INCREMENT = 0
+ DEFAULT CHARSET = utf8mb4 COMMENT ='任务批次';
+
+CREATE TABLE `sj_job_summary`
+(
+ `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
+ `namespace_id` VARCHAR(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
+ `group_name` VARCHAR(64) NOT NULL DEFAULT '' COMMENT '组名称',
+ `business_id` bigint NOT NULL COMMENT '业务id (job_id或workflow_id)',
+ `system_task_type` tinyint(4) NOT NULL DEFAULT 3 COMMENT '任务类型 3、JOB任务 4、WORKFLOW任务',
+ `trigger_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '统计时间',
+ `success_num` int NOT NULL DEFAULT 0 COMMENT '执行成功-日志数量',
+ `fail_num` int NOT NULL DEFAULT 0 COMMENT '执行失败-日志数量',
+ `fail_reason` varchar(512) NOT NULL DEFAULT '' COMMENT '失败原因',
+ `stop_num` int NOT NULL DEFAULT 0 COMMENT '执行失败-日志数量',
+ `stop_reason` varchar(512) NOT NULL DEFAULT '' COMMENT '失败原因',
+ `cancel_num` int NOT NULL DEFAULT 0 COMMENT '执行失败-日志数量',
+ `cancel_reason` varchar(512) NOT NULL DEFAULT '' COMMENT '失败原因',
+ `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
+ PRIMARY KEY (`id`),
+ KEY `idx_namespace_id_group_name_business_id` (`namespace_id`, `group_name`, business_id),
+ UNIQUE KEY `uk_trigger_at_system_task_type_business_id` (`trigger_at`, `system_task_type`, `business_id`) USING BTREE
+) ENGINE = InnoDB
+ AUTO_INCREMENT = 1
+ DEFAULT CHARSET = utf8mb4 COMMENT ='DashBoard_Job';
+
+CREATE TABLE `sj_retry_summary`
+(
+ `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
+ `namespace_id` VARCHAR(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
+ `group_name` VARCHAR(64) NOT NULL DEFAULT '' COMMENT '组名称',
+ `scene_name` VARCHAR(50) NOT NULL DEFAULT '' COMMENT '场景名称',
+ `trigger_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '统计时间',
+ `running_num` int NOT NULL DEFAULT 0 COMMENT '重试中-日志数量',
+ `finish_num` int NOT NULL DEFAULT 0 COMMENT '重试完成-日志数量',
+ `max_count_num` int NOT NULL DEFAULT 0 COMMENT '重试到达最大次数-日志数量',
+ `suspend_num` int NOT NULL DEFAULT 0 COMMENT '暂停重试-日志数量',
+ `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
+ PRIMARY KEY (`id`),
+ KEY `idx_trigger_at` (`trigger_at`),
+ UNIQUE KEY `uk_scene_name_trigger_at` (`namespace_id`, `group_name`, `scene_name`, `trigger_at`) USING BTREE
+) ENGINE = InnoDB
+ AUTO_INCREMENT = 1
+ DEFAULT CHARSET = utf8mb4 COMMENT ='DashBoard_Retry';
+
+CREATE TABLE `sj_workflow`
+(
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
+ `workflow_name` varchar(64) NOT NULL COMMENT '工作流名称',
+ `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
+ `group_name` varchar(64) NOT NULL COMMENT '组名称',
+ `workflow_status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '工作流状态 0、关闭、1、开启',
+ `trigger_type` tinyint(4) NOT NULL COMMENT '触发类型 1.CRON 表达式 2. 固定时间',
+ `trigger_interval` varchar(255) NOT NULL COMMENT '间隔时长',
+ `next_trigger_at` bigint(13) NOT NULL COMMENT '下次触发时间',
+ `block_strategy` tinyint(4) NOT NULL DEFAULT 1 COMMENT '阻塞策略 1、丢弃 2、覆盖 3、并行',
+ `executor_timeout` int(11) NOT NULL DEFAULT 0 COMMENT '任务执行超时时间,单位秒',
+ `description` varchar(256) NOT NULL DEFAULT '' COMMENT '描述',
+ `flow_info` text DEFAULT NULL COMMENT '流程信息',
+ `bucket_index` int(11) NOT NULL DEFAULT 0 COMMENT 'bucket',
+ `version` int(11) NOT NULL COMMENT '版本号',
+ `ext_attrs` varchar(256) NULL DEFAULT '' COMMENT '扩展字段',
+ `deleted` tinyint(4) NOT NULL DEFAULT 0 COMMENT '逻辑删除 1、删除',
+ `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
+ PRIMARY KEY (`id`),
+ KEY `idx_create_dt` (`create_dt`),
+ KEY `idx_namespace_id_group_name` (`namespace_id`, `group_name`)
+) ENGINE = InnoDB
+ AUTO_INCREMENT = 0
+ DEFAULT CHARSET = utf8mb4 COMMENT ='工作流';
+
+CREATE TABLE `sj_workflow_node`
+(
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
+ `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
+ `node_name` varchar(64) NOT NULL COMMENT '节点名称',
+ `group_name` varchar(64) NOT NULL COMMENT '组名称',
+ `job_id` bigint(20) NOT NULL COMMENT '任务信息id',
+ `workflow_id` bigint(20) NOT NULL COMMENT '工作流ID',
+ `node_type` tinyint(4) NOT NULL DEFAULT 1 COMMENT '1、任务节点 2、条件节点',
+ `expression_type` tinyint(4) NOT NULL DEFAULT 0 COMMENT '1、SpEl、2、Aviator 3、QL',
+ `fail_strategy` tinyint(4) NOT NULL DEFAULT 1 COMMENT '失败策略 1、跳过 2、阻塞',
+ `workflow_node_status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '工作流节点状态 0、关闭、1、开启',
+ `priority_level` int(11) NOT NULL DEFAULT 1 COMMENT '优先级',
+ `node_info` text DEFAULT NULL COMMENT '节点信息 ',
+ `version` int(11) NOT NULL COMMENT '版本号',
+ `ext_attrs` varchar(256) NULL DEFAULT '' COMMENT '扩展字段',
+ `deleted` tinyint(4) NOT NULL DEFAULT 0 COMMENT '逻辑删除 1、删除',
+ `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
+ PRIMARY KEY (`id`),
+ KEY `idx_create_dt` (`create_dt`),
+ KEY `idx_namespace_id_group_name` (`namespace_id`, `group_name`)
+) ENGINE = InnoDB
+ AUTO_INCREMENT = 0
+ DEFAULT CHARSET = utf8mb4 COMMENT ='工作流节点';
+
+CREATE TABLE `sj_workflow_task_batch`
+(
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
+ `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
+ `group_name` varchar(64) NOT NULL COMMENT '组名称',
+ `workflow_id` bigint(20) NOT NULL COMMENT '工作流任务id',
+ `task_batch_status` tinyint(4) NOT NULL DEFAULT 0 COMMENT '任务批次状态 0、失败 1、成功',
+ `operation_reason` tinyint(4) NOT NULL DEFAULT 0 COMMENT '操作原因',
+ `flow_info` text DEFAULT NULL COMMENT '流程信息',
+ `execution_at` bigint(13) NOT NULL DEFAULT 0 COMMENT '任务执行时间',
+ `ext_attrs` varchar(256) NULL DEFAULT '' COMMENT '扩展字段',
+ `deleted` tinyint(4) NOT NULL DEFAULT 0 COMMENT '逻辑删除 1、删除',
+ `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
+ PRIMARY KEY (`id`),
+ KEY `idx_job_id_task_batch_status` (`workflow_id`, `task_batch_status`),
+ KEY `idx_create_dt` (`create_dt`),
+ KEY `idx_namespace_id_group_name` (`namespace_id`, `group_name`)
+) ENGINE = InnoDB
+ AUTO_INCREMENT = 0
+ DEFAULT CHARSET = utf8mb4 COMMENT ='工作流批次';
diff --git a/continew-admin-extension/continew-admin-job-server/src/main/resources/db/changelogs/oracle/snail_job.sql b/continew-admin-extension/continew-admin-job-server/src/main/resources/db/changelogs/oracle/snail_job.sql
new file mode 100644
index 000000000..76204ef76
--- /dev/null
+++ b/continew-admin-extension/continew-admin-job-server/src/main/resources/db/changelogs/oracle/snail_job.sql
@@ -0,0 +1,885 @@
+-- liquibase formatted sql
+
+-- changeset snail-job-server:1
+-- sj_namespace
+CREATE TABLE sj_namespace
+(
+ id number GENERATED ALWAYS AS IDENTITY,
+ name varchar2(64) NULL,
+ unique_id varchar2(64) NULL,
+ description varchar2(256) DEFAULT '' NULL,
+ deleted smallint DEFAULT 0 NOT NULL,
+ create_dt date DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ update_dt date DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+
+ALTER TABLE sj_namespace
+ ADD CONSTRAINT pk_sj_namespace PRIMARY KEY (id);
+
+CREATE INDEX idx_sj_namespace_01 ON sj_namespace (name);
+
+COMMENT ON COLUMN sj_namespace.id IS '主键';
+COMMENT ON COLUMN sj_namespace.name IS '名称';
+COMMENT ON COLUMN sj_namespace.unique_id IS '唯一id';
+COMMENT ON COLUMN sj_namespace.description IS '描述';
+COMMENT ON COLUMN sj_namespace.deleted IS '逻辑删除 1、删除';
+COMMENT ON COLUMN sj_namespace.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_namespace.update_dt IS '修改时间';
+COMMENT ON TABLE sj_namespace IS '命名空间';
+
+INSERT INTO sj_namespace (name, unique_id, create_dt, update_dt, deleted)
+VALUES ('Default', '764d604ec6fc45f68cd92514c40e9e1a', sysdate, sysdate, 0);
+
+-- sj_group_config
+CREATE TABLE sj_group_config
+(
+ id number GENERATED ALWAYS AS IDENTITY,
+ namespace_id varchar2(64) DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' NULL,
+ group_name varchar2(64) DEFAULT '' NULL,
+ description varchar2(256) DEFAULT '' NULL,
+ token varchar2(64) DEFAULT 'SJ_cKqBTPzCsWA3VyuCfFoccmuIEGXjr5KT' NULL,
+ group_status smallint DEFAULT 0 NOT NULL,
+ version number NOT NULL,
+ group_partition number NOT NULL,
+ id_generator_mode smallint DEFAULT 1 NOT NULL,
+ init_scene smallint DEFAULT 0 NOT NULL,
+ bucket_index number DEFAULT 0 NOT NULL,
+ create_dt date DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ update_dt date DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+
+ALTER TABLE sj_group_config
+ ADD CONSTRAINT pk_sj_group_config PRIMARY KEY (id);
+
+CREATE UNIQUE INDEX uk_sj_group_config_01 ON sj_group_config (namespace_id, group_name);
+
+COMMENT ON COLUMN sj_group_config.id IS '主键';
+COMMENT ON COLUMN sj_group_config.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_group_config.group_name IS '组名称';
+COMMENT ON COLUMN sj_group_config.description IS '组描述';
+COMMENT ON COLUMN sj_group_config.token IS 'token';
+COMMENT ON COLUMN sj_group_config.group_status IS '组状态 0、未启用 1、启用';
+COMMENT ON COLUMN sj_group_config.version IS '版本号';
+COMMENT ON COLUMN sj_group_config.group_partition IS '分区';
+COMMENT ON COLUMN sj_group_config.id_generator_mode IS '唯一id生成模式 默认号段模式';
+COMMENT ON COLUMN sj_group_config.init_scene IS '是否初始化场景 0:否 1:是';
+COMMENT ON COLUMN sj_group_config.bucket_index IS 'bucket';
+COMMENT ON COLUMN sj_group_config.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_group_config.update_dt IS '修改时间';
+COMMENT ON TABLE sj_group_config IS '组配置';
+
+-- sj_notify_config
+CREATE TABLE sj_notify_config
+(
+ id number GENERATED ALWAYS AS IDENTITY,
+ namespace_id varchar2(64) DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' NULL,
+ group_name varchar2(64) NULL,
+ business_id varchar2(64) NULL,
+ system_task_type smallint DEFAULT 3 NOT NULL,
+ notify_status smallint DEFAULT 0 NOT NULL,
+ recipient_ids varchar2(128) NULL,
+ notify_threshold number DEFAULT 0 NOT NULL,
+ notify_scene smallint DEFAULT 0 NOT NULL,
+ rate_limiter_status smallint DEFAULT 0 NOT NULL,
+ rate_limiter_threshold number DEFAULT 0 NOT NULL,
+ description varchar2(256) DEFAULT '' NULL,
+ create_dt date DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ update_dt date DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+
+ALTER TABLE sj_notify_config
+ ADD CONSTRAINT pk_sj_notify_config PRIMARY KEY (id);
+
+CREATE INDEX idx_sj_notify_config_01 ON sj_notify_config (namespace_id, group_name, business_id);
+
+COMMENT ON COLUMN sj_notify_config.id IS '主键';
+COMMENT ON COLUMN sj_notify_config.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_notify_config.group_name IS '组名称';
+COMMENT ON COLUMN sj_notify_config.business_id IS '业务id ( job_id或workflow_id或scene_name ) ';
+COMMENT ON COLUMN sj_notify_config.system_task_type IS '任务类型 1. 重试任务 2. 重试回调 3、JOB任务 4、WORKFLOW任务';
+COMMENT ON COLUMN sj_notify_config.notify_status IS '通知状态 0、未启用 1、启用';
+COMMENT ON COLUMN sj_notify_config.recipient_ids IS '接收人id列表';
+COMMENT ON COLUMN sj_notify_config.notify_threshold IS '通知阈值';
+COMMENT ON COLUMN sj_notify_config.notify_scene IS '通知场景';
+COMMENT ON COLUMN sj_notify_config.rate_limiter_status IS '限流状态 0、未启用 1、启用';
+COMMENT ON COLUMN sj_notify_config.rate_limiter_threshold IS '每秒限流阈值';
+COMMENT ON COLUMN sj_notify_config.description IS '描述';
+COMMENT ON COLUMN sj_notify_config.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_notify_config.update_dt IS '修改时间';
+COMMENT ON TABLE sj_notify_config IS '通知配置';
+
+-- sj_notify_recipient
+CREATE TABLE sj_notify_recipient
+(
+ id number GENERATED ALWAYS AS IDENTITY,
+ namespace_id varchar2(64) DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' NULL,
+ recipient_name varchar2(64) NULL,
+ notify_type smallint DEFAULT 0 NOT NULL,
+ notify_attribute varchar2(512) NULL,
+ description varchar2(256) DEFAULT '' NULL,
+ create_dt date DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ update_dt date DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+
+ALTER TABLE sj_notify_recipient
+ ADD CONSTRAINT pk_sj_notify_recipient PRIMARY KEY (id);
+
+CREATE INDEX idx_sj_notify_recipient_01 ON sj_notify_recipient (namespace_id);
+
+COMMENT ON COLUMN sj_notify_recipient.id IS '主键';
+COMMENT ON COLUMN sj_notify_recipient.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_notify_recipient.recipient_name IS '接收人名称';
+COMMENT ON COLUMN sj_notify_recipient.notify_type IS '通知类型 1、钉钉 2、邮件 3、企业微信 4 飞书 5 webhook';
+COMMENT ON COLUMN sj_notify_recipient.notify_attribute IS '配置属性';
+COMMENT ON COLUMN sj_notify_recipient.description IS '描述';
+COMMENT ON COLUMN sj_notify_recipient.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_notify_recipient.update_dt IS '修改时间';
+COMMENT ON TABLE sj_notify_recipient IS '告警通知接收人';
+
+-- sj_retry_dead_letter_0
+CREATE TABLE sj_retry_dead_letter_0
+(
+ id number GENERATED ALWAYS AS IDENTITY,
+ namespace_id varchar2(64) DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' NULL,
+ unique_id varchar2(64) NULL,
+ group_name varchar2(64) NULL,
+ scene_name varchar2(64) NULL,
+ idempotent_id varchar2(64) NULL,
+ biz_no varchar2(64) DEFAULT '' NULL,
+ executor_name varchar2(512) DEFAULT '' NULL,
+ args_str clob NULL,
+ ext_attrs clob NULL,
+ task_type smallint DEFAULT 1 NOT NULL,
+ create_dt date DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+
+ALTER TABLE sj_retry_dead_letter_0
+ ADD CONSTRAINT pk_sj_retry_dead_letter_0 PRIMARY KEY (id);
+
+CREATE UNIQUE INDEX uk_sj_retry_dead_letter_0_01 ON sj_retry_dead_letter_0 (namespace_id, group_name, unique_id);
+
+CREATE INDEX idx_sj_retry_dead_letter_0_01 ON sj_retry_dead_letter_0 (namespace_id, group_name, scene_name);
+CREATE INDEX idx_sj_retry_dead_letter_0_02 ON sj_retry_dead_letter_0 (idempotent_id);
+CREATE INDEX idx_sj_retry_dead_letter_0_03 ON sj_retry_dead_letter_0 (biz_no);
+CREATE INDEX idx_sj_retry_dead_letter_0_04 ON sj_retry_dead_letter_0 (create_dt);
+
+COMMENT ON COLUMN sj_retry_dead_letter_0.id IS '主键';
+COMMENT ON COLUMN sj_retry_dead_letter_0.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_retry_dead_letter_0.unique_id IS '同组下id唯一';
+COMMENT ON COLUMN sj_retry_dead_letter_0.group_name IS '组名称';
+COMMENT ON COLUMN sj_retry_dead_letter_0.scene_name IS '场景名称';
+COMMENT ON COLUMN sj_retry_dead_letter_0.idempotent_id IS '幂等id';
+COMMENT ON COLUMN sj_retry_dead_letter_0.biz_no IS '业务编号';
+COMMENT ON COLUMN sj_retry_dead_letter_0.executor_name IS '执行器名称';
+COMMENT ON COLUMN sj_retry_dead_letter_0.args_str IS '执行方法参数';
+COMMENT ON COLUMN sj_retry_dead_letter_0.ext_attrs IS '扩展字段';
+COMMENT ON COLUMN sj_retry_dead_letter_0.task_type IS '任务类型 1、重试数据 2、回调数据';
+COMMENT ON COLUMN sj_retry_dead_letter_0.create_dt IS '创建时间';
+COMMENT ON TABLE sj_retry_dead_letter_0 IS '死信队列表';
+
+-- sj_retry_task_0
+CREATE TABLE sj_retry_task_0
+(
+ id number GENERATED ALWAYS AS IDENTITY,
+ namespace_id varchar2(64) DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' NULL,
+ unique_id varchar2(64) NULL,
+ group_name varchar2(64) NULL,
+ scene_name varchar2(64) NULL,
+ idempotent_id varchar2(64) NULL,
+ biz_no varchar2(64) DEFAULT '' NULL,
+ executor_name varchar2(512) DEFAULT '' NULL,
+ args_str clob NULL,
+ ext_attrs clob NULL,
+ next_trigger_at date NOT NULL,
+ retry_count number DEFAULT 0 NOT NULL,
+ retry_status smallint DEFAULT 0 NOT NULL,
+ task_type smallint DEFAULT 1 NOT NULL,
+ create_dt date DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ update_dt date DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+
+ALTER TABLE sj_retry_task_0
+ ADD CONSTRAINT pk_sj_retry_task_0 PRIMARY KEY (id);
+
+CREATE UNIQUE INDEX uk_sj_retry_task_0_01 ON sj_retry_task_0 (namespace_id, group_name, unique_id);
+
+CREATE INDEX idx_sj_retry_task_0_01 ON sj_retry_task_0 (namespace_id, group_name, scene_name);
+CREATE INDEX idx_sj_retry_task_0_02 ON sj_retry_task_0 (namespace_id, group_name, task_type);
+CREATE INDEX idx_sj_retry_task_0_03 ON sj_retry_task_0 (namespace_id, group_name, retry_status);
+CREATE INDEX idx_sj_retry_task_0_04 ON sj_retry_task_0 (idempotent_id);
+CREATE INDEX idx_sj_retry_task_0_05 ON sj_retry_task_0 (biz_no);
+CREATE INDEX idx_sj_retry_task_0_06 ON sj_retry_task_0 (create_dt);
+
+COMMENT ON COLUMN sj_retry_task_0.id IS '主键';
+COMMENT ON COLUMN sj_retry_task_0.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_retry_task_0.unique_id IS '同组下id唯一';
+COMMENT ON COLUMN sj_retry_task_0.group_name IS '组名称';
+COMMENT ON COLUMN sj_retry_task_0.scene_name IS '场景名称';
+COMMENT ON COLUMN sj_retry_task_0.idempotent_id IS '幂等id';
+COMMENT ON COLUMN sj_retry_task_0.biz_no IS '业务编号';
+COMMENT ON COLUMN sj_retry_task_0.executor_name IS '执行器名称';
+COMMENT ON COLUMN sj_retry_task_0.args_str IS '执行方法参数';
+COMMENT ON COLUMN sj_retry_task_0.ext_attrs IS '扩展字段';
+COMMENT ON COLUMN sj_retry_task_0.next_trigger_at IS '下次触发时间';
+COMMENT ON COLUMN sj_retry_task_0.retry_count IS '重试次数';
+COMMENT ON COLUMN sj_retry_task_0.retry_status IS '重试状态 0、重试中 1、成功 2、最大重试次数';
+COMMENT ON COLUMN sj_retry_task_0.task_type IS '任务类型 1、重试数据 2、回调数据';
+COMMENT ON COLUMN sj_retry_task_0.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_retry_task_0.update_dt IS '修改时间';
+COMMENT ON TABLE sj_retry_task_0 IS '任务表';
+
+-- sj_retry_task_log
+CREATE TABLE sj_retry_task_log
+(
+ id number GENERATED ALWAYS AS IDENTITY,
+ namespace_id varchar2(64) DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' NULL,
+ unique_id varchar2(64) NULL,
+ group_name varchar2(64) NULL,
+ scene_name varchar2(64) NULL,
+ idempotent_id varchar2(64) NULL,
+ biz_no varchar2(64) DEFAULT '' NULL,
+ executor_name varchar2(512) DEFAULT '' NULL,
+ args_str clob NULL,
+ ext_attrs clob NULL,
+ retry_status smallint DEFAULT 0 NOT NULL,
+ task_type smallint DEFAULT 1 NOT NULL,
+ create_dt date DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ update_dt date DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+
+ALTER TABLE sj_retry_task_log
+ ADD CONSTRAINT pk_sj_retry_task_log PRIMARY KEY (id);
+
+CREATE INDEX idx_sj_retry_task_log_01 ON sj_retry_task_log (namespace_id, group_name, scene_name);
+CREATE INDEX idx_sj_retry_task_log_02 ON sj_retry_task_log (retry_status);
+CREATE INDEX idx_sj_retry_task_log_03 ON sj_retry_task_log (idempotent_id);
+CREATE INDEX idx_sj_retry_task_log_04 ON sj_retry_task_log (unique_id);
+CREATE INDEX idx_sj_retry_task_log_05 ON sj_retry_task_log (biz_no);
+CREATE INDEX idx_sj_retry_task_log_06 ON sj_retry_task_log (create_dt);
+
+COMMENT ON COLUMN sj_retry_task_log.id IS '主键';
+COMMENT ON COLUMN sj_retry_task_log.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_retry_task_log.unique_id IS '同组下id唯一';
+COMMENT ON COLUMN sj_retry_task_log.group_name IS '组名称';
+COMMENT ON COLUMN sj_retry_task_log.scene_name IS '场景名称';
+COMMENT ON COLUMN sj_retry_task_log.idempotent_id IS '幂等id';
+COMMENT ON COLUMN sj_retry_task_log.biz_no IS '业务编号';
+COMMENT ON COLUMN sj_retry_task_log.executor_name IS '执行器名称';
+COMMENT ON COLUMN sj_retry_task_log.args_str IS '执行方法参数';
+COMMENT ON COLUMN sj_retry_task_log.ext_attrs IS '扩展字段';
+COMMENT ON COLUMN sj_retry_task_log.retry_status IS '重试状态 0、重试中 1、成功 2、最大次数';
+COMMENT ON COLUMN sj_retry_task_log.task_type IS '任务类型 1、重试数据 2、回调数据';
+COMMENT ON COLUMN sj_retry_task_log.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_retry_task_log.update_dt IS '修改时间';
+COMMENT ON TABLE sj_retry_task_log IS '任务日志基础信息表';
+
+-- sj_retry_task_log_message
+CREATE TABLE sj_retry_task_log_message
+(
+ id number GENERATED ALWAYS AS IDENTITY,
+ namespace_id varchar2(64) DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' NULL,
+ group_name varchar2(64) NULL,
+ unique_id varchar2(64) NULL,
+ message clob NULL,
+ log_num number DEFAULT 1 NOT NULL,
+ real_time number DEFAULT 0 NOT NULL,
+ create_dt date DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+
+ALTER TABLE sj_retry_task_log_message
+ ADD CONSTRAINT pk_sj_retry_task_log_message PRIMARY KEY (id);
+
+CREATE INDEX idx_sj_retry_task_log_message_01 ON sj_retry_task_log_message (namespace_id, group_name, unique_id);
+CREATE INDEX idx_sj_retry_task_log_message_02 ON sj_retry_task_log_message (create_dt);
+
+COMMENT ON COLUMN sj_retry_task_log_message.id IS '主键';
+COMMENT ON COLUMN sj_retry_task_log_message.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_retry_task_log_message.group_name IS '组名称';
+COMMENT ON COLUMN sj_retry_task_log_message.unique_id IS '同组下id唯一';
+COMMENT ON COLUMN sj_retry_task_log_message.message IS '异常信息';
+COMMENT ON COLUMN sj_retry_task_log_message.log_num IS '日志数量';
+COMMENT ON COLUMN sj_retry_task_log_message.real_time IS '上报时间';
+COMMENT ON COLUMN sj_retry_task_log_message.create_dt IS '创建时间';
+COMMENT ON TABLE sj_retry_task_log_message IS '任务调度日志信息记录表';
+
+-- sj_retry_scene_config
+CREATE TABLE sj_retry_scene_config
+(
+ id number GENERATED ALWAYS AS IDENTITY,
+ namespace_id varchar2(64) DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' NULL,
+ scene_name varchar2(64) NULL,
+ group_name varchar2(64) NULL,
+ scene_status smallint DEFAULT 0 NOT NULL,
+ max_retry_count number DEFAULT 5 NOT NULL,
+ back_off smallint DEFAULT 1 NOT NULL,
+ trigger_interval varchar2(16) DEFAULT '' NULL,
+ deadline_request number DEFAULT 60000 NOT NULL,
+ executor_timeout number DEFAULT 5 NOT NULL,
+ route_key smallint DEFAULT 4 NOT NULL,
+ description varchar2(256) DEFAULT '' NULL,
+ create_dt date DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ update_dt date DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+
+ALTER TABLE sj_retry_scene_config
+ ADD CONSTRAINT pk_sj_retry_scene_config PRIMARY KEY (id);
+
+CREATE UNIQUE INDEX uk_sj_retry_scene_config_01 ON sj_retry_scene_config (namespace_id, group_name, scene_name);
+
+COMMENT ON COLUMN sj_retry_scene_config.id IS '主键';
+COMMENT ON COLUMN sj_retry_scene_config.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_retry_scene_config.scene_name IS '场景名称';
+COMMENT ON COLUMN sj_retry_scene_config.group_name IS '组名称';
+COMMENT ON COLUMN sj_retry_scene_config.scene_status IS '组状态 0、未启用 1、启用';
+COMMENT ON COLUMN sj_retry_scene_config.max_retry_count IS '最大重试次数';
+COMMENT ON COLUMN sj_retry_scene_config.back_off IS '1、默认等级 2、固定间隔时间 3、CRON 表达式';
+COMMENT ON COLUMN sj_retry_scene_config.trigger_interval IS '间隔时长';
+COMMENT ON COLUMN sj_retry_scene_config.deadline_request IS 'Deadline Request 调用链超时 单位毫秒';
+COMMENT ON COLUMN sj_retry_scene_config.executor_timeout IS '任务执行超时时间,单位秒';
+COMMENT ON COLUMN sj_retry_scene_config.route_key IS '路由策略';
+COMMENT ON COLUMN sj_retry_scene_config.description IS '描述';
+COMMENT ON COLUMN sj_retry_scene_config.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_retry_scene_config.update_dt IS '修改时间';
+COMMENT ON TABLE sj_retry_scene_config IS '场景配置';
+
+-- sj_server_node
+CREATE TABLE sj_server_node
+(
+ id number GENERATED ALWAYS AS IDENTITY,
+ namespace_id varchar2(64) DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' NULL,
+ group_name varchar2(64) NULL,
+ host_id varchar2(64) NULL,
+ host_ip varchar2(64) NULL,
+ host_port number NOT NULL,
+ expire_at date NOT NULL,
+ node_type smallint NOT NULL,
+ ext_attrs varchar2(256) DEFAULT '' NULL,
+ create_dt date DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ update_dt date DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+
+ALTER TABLE sj_server_node
+ ADD CONSTRAINT pk_sj_server_node PRIMARY KEY (id);
+
+CREATE UNIQUE INDEX uk_sj_server_node_01 ON sj_server_node (host_id, host_ip);
+
+CREATE INDEX idx_sj_server_node_01 ON sj_server_node (namespace_id, group_name);
+CREATE INDEX idx_sj_server_node_02 ON sj_server_node (expire_at, node_type);
+
+COMMENT ON COLUMN sj_server_node.id IS '主键';
+COMMENT ON COLUMN sj_server_node.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_server_node.group_name IS '组名称';
+COMMENT ON COLUMN sj_server_node.host_id IS '主机id';
+COMMENT ON COLUMN sj_server_node.host_ip IS '机器ip';
+COMMENT ON COLUMN sj_server_node.host_port IS '机器端口';
+COMMENT ON COLUMN sj_server_node.expire_at IS '过期时间';
+COMMENT ON COLUMN sj_server_node.node_type IS '节点类型 1、客户端 2、是服务端';
+COMMENT ON COLUMN sj_server_node.ext_attrs IS '扩展字段';
+COMMENT ON COLUMN sj_server_node.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_server_node.update_dt IS '修改时间';
+COMMENT ON TABLE sj_server_node IS '服务器节点';
+
+-- sj_distributed_lock
+CREATE TABLE sj_distributed_lock
+(
+ id number GENERATED ALWAYS AS IDENTITY,
+ name varchar2(64) NULL,
+ lock_until timestamp(3) DEFAULT CURRENT_TIMESTAMP(3) NOT NULL,
+ locked_at timestamp(3) DEFAULT CURRENT_TIMESTAMP(3) NOT NULL,
+ locked_by varchar2(255) NULL,
+ create_dt date DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ update_dt date DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+
+ALTER TABLE sj_distributed_lock
+ ADD CONSTRAINT pk_sj_distributed_lock PRIMARY KEY (id);
+
+COMMENT ON COLUMN sj_distributed_lock.id IS '主键';
+COMMENT ON COLUMN sj_distributed_lock.name IS '锁名称';
+COMMENT ON COLUMN sj_distributed_lock.lock_until IS '锁定时长';
+COMMENT ON COLUMN sj_distributed_lock.locked_at IS '锁定时间';
+COMMENT ON COLUMN sj_distributed_lock.locked_by IS '锁定者';
+COMMENT ON COLUMN sj_distributed_lock.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_distributed_lock.update_dt IS '修改时间';
+COMMENT ON TABLE sj_distributed_lock IS '锁定表';
+
+-- sj_system_user
+CREATE TABLE sj_system_user
+(
+ id number GENERATED ALWAYS AS IDENTITY,
+ username varchar2(64) NULL,
+ password varchar2(128) NULL,
+ role smallint DEFAULT 0 NOT NULL,
+ create_dt date DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ update_dt date DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+
+ALTER TABLE sj_system_user
+ ADD CONSTRAINT pk_sj_system_user PRIMARY KEY (id);
+
+COMMENT ON COLUMN sj_system_user.id IS '主键';
+COMMENT ON COLUMN sj_system_user.username IS '账号';
+COMMENT ON COLUMN sj_system_user.password IS '密码';
+COMMENT ON COLUMN sj_system_user.role IS '角色:1-普通用户、2-管理员';
+COMMENT ON COLUMN sj_system_user.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_system_user.update_dt IS '修改时间';
+COMMENT ON TABLE sj_system_user IS '系统用户表';
+
+INSERT INTO sj_system_user (username, password, role)
+VALUES ('admin', '465c194afb65670f38322df087f0a9bb225cc257e43eb4ac5a0c98ef5b3173ac', 2);
+
+-- sj_system_user_permission
+CREATE TABLE sj_system_user_permission
+(
+ id number GENERATED ALWAYS AS IDENTITY,
+ group_name varchar2(64) NULL,
+ namespace_id varchar2(64) DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' NULL,
+ system_user_id number NOT NULL,
+ create_dt date DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ update_dt date DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+
+ALTER TABLE sj_system_user_permission
+ ADD CONSTRAINT pk_sj_system_user_permission PRIMARY KEY (id);
+
+CREATE UNIQUE INDEX uk_sj_system_user_permission_01 ON sj_system_user_permission (namespace_id, group_name, system_user_id);
+
+COMMENT ON COLUMN sj_system_user_permission.id IS '主键';
+COMMENT ON COLUMN sj_system_user_permission.group_name IS '组名称';
+COMMENT ON COLUMN sj_system_user_permission.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_system_user_permission.system_user_id IS '系统用户id';
+COMMENT ON COLUMN sj_system_user_permission.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_system_user_permission.update_dt IS '修改时间';
+COMMENT ON TABLE sj_system_user_permission IS '系统用户权限表';
+
+-- sj_sequence_alloc
+CREATE TABLE sj_sequence_alloc
+(
+ id number GENERATED ALWAYS AS IDENTITY,
+ namespace_id varchar2(64) DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' NULL,
+ group_name varchar2(64) DEFAULT '' NULL,
+ max_id number DEFAULT 1 NOT NULL,
+ step number DEFAULT 100 NOT NULL,
+ update_dt date DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+
+ALTER TABLE sj_sequence_alloc
+ ADD CONSTRAINT pk_sj_sequence_alloc PRIMARY KEY (id);
+
+CREATE UNIQUE INDEX uk_sj_sequence_alloc_01 ON sj_sequence_alloc (namespace_id, group_name);
+
+COMMENT ON COLUMN sj_sequence_alloc.id IS '主键';
+COMMENT ON COLUMN sj_sequence_alloc.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_sequence_alloc.group_name IS '组名称';
+COMMENT ON COLUMN sj_sequence_alloc.max_id IS '最大id';
+COMMENT ON COLUMN sj_sequence_alloc.step IS '步长';
+COMMENT ON COLUMN sj_sequence_alloc.update_dt IS '更新时间';
+COMMENT ON TABLE sj_sequence_alloc IS '号段模式序号ID分配表';
+
+-- sj_job
+CREATE TABLE sj_job
+(
+ id number GENERATED ALWAYS AS IDENTITY,
+ namespace_id varchar2(64) DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' NULL,
+ group_name varchar2(64) NULL,
+ job_name varchar2(64) NULL,
+ args_str clob DEFAULT NULL NULL,
+ args_type smallint DEFAULT 1 NOT NULL,
+ next_trigger_at number NOT NULL,
+ job_status smallint DEFAULT 1 NOT NULL,
+ task_type smallint DEFAULT 1 NOT NULL,
+ route_key smallint DEFAULT 4 NOT NULL,
+ executor_type smallint DEFAULT 1 NOT NULL,
+ executor_info varchar2(255) DEFAULT NULL NULL,
+ trigger_type smallint NOT NULL,
+ trigger_interval varchar2(255) NULL,
+ block_strategy smallint DEFAULT 1 NOT NULL,
+ executor_timeout number DEFAULT 0 NOT NULL,
+ max_retry_times number DEFAULT 0 NOT NULL,
+ parallel_num number DEFAULT 1 NOT NULL,
+ retry_interval number DEFAULT 0 NOT NULL,
+ bucket_index number DEFAULT 0 NOT NULL,
+ resident smallint DEFAULT 0 NOT NULL,
+ description varchar2(256) DEFAULT '' NULL,
+ ext_attrs varchar2(256) DEFAULT '' NULL,
+ deleted smallint DEFAULT 0 NOT NULL,
+ create_dt date DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ update_dt date DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+
+ALTER TABLE sj_job
+ ADD CONSTRAINT pk_sj_job PRIMARY KEY (id);
+
+CREATE INDEX idx_sj_job_01 ON sj_job (namespace_id, group_name);
+CREATE INDEX idx_sj_job_02 ON sj_job (job_status, bucket_index);
+CREATE INDEX idx_sj_job_03 ON sj_job (create_dt);
+
+COMMENT ON COLUMN sj_job.id IS '主键';
+COMMENT ON COLUMN sj_job.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_job.group_name IS '组名称';
+COMMENT ON COLUMN sj_job.job_name IS '名称';
+COMMENT ON COLUMN sj_job.args_str IS '执行方法参数';
+COMMENT ON COLUMN sj_job.args_type IS '参数类型 ';
+COMMENT ON COLUMN sj_job.next_trigger_at IS '下次触发时间';
+COMMENT ON COLUMN sj_job.job_status IS '任务状态 0、关闭、1、开启';
+COMMENT ON COLUMN sj_job.task_type IS '任务类型 1、集群 2、广播 3、切片';
+COMMENT ON COLUMN sj_job.route_key IS '路由策略';
+COMMENT ON COLUMN sj_job.executor_type IS '执行器类型';
+COMMENT ON COLUMN sj_job.executor_info IS '执行器名称';
+COMMENT ON COLUMN sj_job.trigger_type IS '触发类型 1.CRON 表达式 2. 固定时间';
+COMMENT ON COLUMN sj_job.trigger_interval IS '间隔时长';
+COMMENT ON COLUMN sj_job.block_strategy IS '阻塞策略 1、丢弃 2、覆盖 3、并行';
+COMMENT ON COLUMN sj_job.executor_timeout IS '任务执行超时时间,单位秒';
+COMMENT ON COLUMN sj_job.max_retry_times IS '最大重试次数';
+COMMENT ON COLUMN sj_job.parallel_num IS '并行数';
+COMMENT ON COLUMN sj_job.retry_interval IS '重试间隔 ( s ) ';
+COMMENT ON COLUMN sj_job.bucket_index IS 'bucket';
+COMMENT ON COLUMN sj_job.resident IS '是否是常驻任务';
+COMMENT ON COLUMN sj_job.description IS '描述';
+COMMENT ON COLUMN sj_job.ext_attrs IS '扩展字段';
+COMMENT ON COLUMN sj_job.deleted IS '逻辑删除 1、删除';
+COMMENT ON COLUMN sj_job.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_job.update_dt IS '修改时间';
+COMMENT ON TABLE sj_job IS '任务信息';
+
+-- sj_job_log_message
+CREATE TABLE sj_job_log_message
+(
+ id number GENERATED ALWAYS AS IDENTITY,
+ namespace_id varchar2(64) DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' NULL,
+ group_name varchar2(64) NULL,
+ job_id number NOT NULL,
+ task_batch_id number NOT NULL,
+ task_id number NOT NULL,
+ message clob NULL,
+ log_num number DEFAULT 1 NOT NULL,
+ real_time number DEFAULT 0 NOT NULL,
+ ext_attrs varchar2(256) DEFAULT '' NULL,
+ create_dt date DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+
+ALTER TABLE sj_job_log_message
+ ADD CONSTRAINT pk_sj_job_log_message PRIMARY KEY (id);
+
+CREATE INDEX idx_sj_job_log_message_01 ON sj_job_log_message (task_batch_id, task_id);
+CREATE INDEX idx_sj_job_log_message_02 ON sj_job_log_message (create_dt);
+CREATE INDEX idx_sj_job_log_message_03 ON sj_job_log_message (namespace_id, group_name);
+
+COMMENT ON COLUMN sj_job_log_message.id IS '主键';
+COMMENT ON COLUMN sj_job_log_message.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_job_log_message.group_name IS '组名称';
+COMMENT ON COLUMN sj_job_log_message.job_id IS '任务信息id';
+COMMENT ON COLUMN sj_job_log_message.task_batch_id IS '任务批次id';
+COMMENT ON COLUMN sj_job_log_message.task_id IS '调度任务id';
+COMMENT ON COLUMN sj_job_log_message.message IS '调度信息';
+COMMENT ON COLUMN sj_job_log_message.log_num IS '日志数量';
+COMMENT ON COLUMN sj_job_log_message.real_time IS '上报时间';
+COMMENT ON COLUMN sj_job_log_message.ext_attrs IS '扩展字段';
+COMMENT ON COLUMN sj_job_log_message.create_dt IS '创建时间';
+COMMENT ON TABLE sj_job_log_message IS '调度日志';
+
+-- sj_job_task
+CREATE TABLE sj_job_task
+(
+ id number GENERATED ALWAYS AS IDENTITY,
+ namespace_id varchar2(64) DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' NULL,
+ group_name varchar2(64) NULL,
+ job_id number NOT NULL,
+ task_batch_id number NOT NULL,
+ parent_id number DEFAULT 0 NOT NULL,
+ task_status smallint DEFAULT 0 NOT NULL,
+ retry_count number DEFAULT 0 NOT NULL,
+ client_info varchar2(128) DEFAULT NULL NULL,
+ result_message clob NULL,
+ args_str clob DEFAULT NULL NULL,
+ args_type smallint DEFAULT 1 NOT NULL,
+ ext_attrs varchar2(256) DEFAULT '' NULL,
+ create_dt date DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ update_dt date DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+
+ALTER TABLE sj_job_task
+ ADD CONSTRAINT pk_sj_job_task PRIMARY KEY (id);
+
+CREATE INDEX idx_sj_job_task_01 ON sj_job_task (task_batch_id, task_status);
+CREATE INDEX idx_sj_job_task_02 ON sj_job_task (create_dt);
+CREATE INDEX idx_sj_job_task_03 ON sj_job_task (namespace_id, group_name);
+
+COMMENT ON COLUMN sj_job_task.id IS '主键';
+COMMENT ON COLUMN sj_job_task.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_job_task.group_name IS '组名称';
+COMMENT ON COLUMN sj_job_task.job_id IS '任务信息id';
+COMMENT ON COLUMN sj_job_task.task_batch_id IS '调度任务id';
+COMMENT ON COLUMN sj_job_task.parent_id IS '父执行器id';
+COMMENT ON COLUMN sj_job_task.task_status IS '执行的状态 0、失败 1、成功';
+COMMENT ON COLUMN sj_job_task.retry_count IS '重试次数';
+COMMENT ON COLUMN sj_job_task.client_info IS '客户端地址 clientId#ip:port';
+COMMENT ON COLUMN sj_job_task.result_message IS '执行结果';
+COMMENT ON COLUMN sj_job_task.args_str IS '执行方法参数';
+COMMENT ON COLUMN sj_job_task.args_type IS '参数类型 ';
+COMMENT ON COLUMN sj_job_task.ext_attrs IS '扩展字段';
+COMMENT ON COLUMN sj_job_task.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_job_task.update_dt IS '修改时间';
+COMMENT ON TABLE sj_job_task IS '任务实例';
+
+-- sj_job_task_batch
+CREATE TABLE sj_job_task_batch
+(
+ id number GENERATED ALWAYS AS IDENTITY,
+ namespace_id varchar2(64) DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' NULL,
+ group_name varchar2(64) NULL,
+ job_id number NOT NULL,
+ workflow_node_id number DEFAULT 0 NOT NULL,
+ parent_workflow_node_id number DEFAULT 0 NOT NULL,
+ workflow_task_batch_id number DEFAULT 0 NOT NULL,
+ task_batch_status smallint DEFAULT 0 NOT NULL,
+ operation_reason smallint DEFAULT 0 NOT NULL,
+ execution_at number DEFAULT 0 NOT NULL,
+ system_task_type smallint DEFAULT 3 NOT NULL,
+ parent_id varchar2(64) DEFAULT '' NULL,
+ ext_attrs varchar2(256) DEFAULT '' NULL,
+ deleted smallint DEFAULT 0 NOT NULL,
+ create_dt date DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ update_dt date DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+
+ALTER TABLE sj_job_task_batch
+ ADD CONSTRAINT pk_sj_job_task_batch PRIMARY KEY (id);
+
+CREATE INDEX idx_sj_job_task_batch_01 ON sj_job_task_batch (job_id, task_batch_status);
+CREATE INDEX idx_sj_job_task_batch_02 ON sj_job_task_batch (create_dt);
+CREATE INDEX idx_sj_job_task_batch_03 ON sj_job_task_batch (namespace_id, group_name);
+CREATE INDEX idx_sj_job_task_batch_04 ON sj_job_task_batch (workflow_task_batch_id, workflow_node_id);
+
+COMMENT ON COLUMN sj_job_task_batch.id IS '主键';
+COMMENT ON COLUMN sj_job_task_batch.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_job_task_batch.group_name IS '组名称';
+COMMENT ON COLUMN sj_job_task_batch.job_id IS '任务id';
+COMMENT ON COLUMN sj_job_task_batch.workflow_node_id IS '工作流节点id';
+COMMENT ON COLUMN sj_job_task_batch.parent_workflow_node_id IS '工作流任务父批次id';
+COMMENT ON COLUMN sj_job_task_batch.workflow_task_batch_id IS '工作流任务批次id';
+COMMENT ON COLUMN sj_job_task_batch.task_batch_status IS '任务批次状态 0、失败 1、成功';
+COMMENT ON COLUMN sj_job_task_batch.operation_reason IS '操作原因';
+COMMENT ON COLUMN sj_job_task_batch.execution_at IS '任务执行时间';
+COMMENT ON COLUMN sj_job_task_batch.system_task_type IS '任务类型 3、JOB任务 4、WORKFLOW任务';
+COMMENT ON COLUMN sj_job_task_batch.parent_id IS '父节点';
+COMMENT ON COLUMN sj_job_task_batch.ext_attrs IS '扩展字段';
+COMMENT ON COLUMN sj_job_task_batch.deleted IS '逻辑删除 1、删除';
+COMMENT ON COLUMN sj_job_task_batch.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_job_task_batch.update_dt IS '修改时间';
+COMMENT ON TABLE sj_job_task_batch IS '任务批次';
+
+-- sj_job_summary
+CREATE TABLE sj_job_summary
+(
+ id number GENERATED ALWAYS AS IDENTITY,
+ namespace_id varchar2(64) DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' NULL,
+ group_name varchar2(64) DEFAULT '' NULL,
+ business_id number NOT NULL,
+ system_task_type smallint DEFAULT 3 NOT NULL,
+ trigger_at date DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ success_num number DEFAULT 0 NOT NULL,
+ fail_num number DEFAULT 0 NOT NULL,
+ fail_reason varchar2(512) DEFAULT '' NULL,
+ stop_num number DEFAULT 0 NOT NULL,
+ stop_reason varchar2(512) DEFAULT '' NULL,
+ cancel_num number DEFAULT 0 NOT NULL,
+ cancel_reason varchar2(512) DEFAULT '' NULL,
+ create_dt date DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ update_dt date DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+
+ALTER TABLE sj_job_summary
+ ADD CONSTRAINT pk_sj_job_summary PRIMARY KEY (id);
+
+CREATE UNIQUE INDEX uk_sj_job_summary_01 ON sj_job_summary (trigger_at, system_task_type, business_id);
+
+CREATE INDEX idx_sj_job_summary_01 ON sj_job_summary (namespace_id, group_name, business_id);
+
+COMMENT ON COLUMN sj_job_summary.id IS '主键';
+COMMENT ON COLUMN sj_job_summary.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_job_summary.group_name IS '组名称';
+COMMENT ON COLUMN sj_job_summary.business_id IS '业务id ( job_id或workflow_id ) ';
+COMMENT ON COLUMN sj_job_summary.system_task_type IS '任务类型 3、JOB任务 4、WORKFLOW任务';
+COMMENT ON COLUMN sj_job_summary.trigger_at IS '统计时间';
+COMMENT ON COLUMN sj_job_summary.success_num IS '执行成功-日志数量';
+COMMENT ON COLUMN sj_job_summary.fail_num IS '执行失败-日志数量';
+COMMENT ON COLUMN sj_job_summary.fail_reason IS '失败原因';
+COMMENT ON COLUMN sj_job_summary.stop_num IS '执行失败-日志数量';
+COMMENT ON COLUMN sj_job_summary.stop_reason IS '失败原因';
+COMMENT ON COLUMN sj_job_summary.cancel_num IS '执行失败-日志数量';
+COMMENT ON COLUMN sj_job_summary.cancel_reason IS '失败原因';
+COMMENT ON COLUMN sj_job_summary.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_job_summary.update_dt IS '修改时间';
+COMMENT ON TABLE sj_job_summary IS 'DashBoard_Job';
+
+-- sj_retry_summary
+CREATE TABLE sj_retry_summary
+(
+ id number GENERATED ALWAYS AS IDENTITY,
+ namespace_id varchar2(64) DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' NULL,
+ group_name varchar2(64) DEFAULT '' NULL,
+ scene_name varchar2(50) DEFAULT '' NULL,
+ trigger_at date DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ running_num number DEFAULT 0 NOT NULL,
+ finish_num number DEFAULT 0 NOT NULL,
+ max_count_num number DEFAULT 0 NOT NULL,
+ suspend_num number DEFAULT 0 NOT NULL,
+ create_dt date DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ update_dt date DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+
+ALTER TABLE sj_retry_summary
+ ADD CONSTRAINT pk_sj_retry_summary PRIMARY KEY (id);
+
+CREATE UNIQUE INDEX uk_sj_retry_summary_01 ON sj_retry_summary (namespace_id, group_name, scene_name, trigger_at);
+
+CREATE INDEX idx_sj_retry_summary_01 ON sj_retry_summary (trigger_at);
+
+COMMENT ON COLUMN sj_retry_summary.id IS '主键';
+COMMENT ON COLUMN sj_retry_summary.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_retry_summary.group_name IS '组名称';
+COMMENT ON COLUMN sj_retry_summary.scene_name IS '场景名称';
+COMMENT ON COLUMN sj_retry_summary.trigger_at IS '统计时间';
+COMMENT ON COLUMN sj_retry_summary.running_num IS '重试中-日志数量';
+COMMENT ON COLUMN sj_retry_summary.finish_num IS '重试完成-日志数量';
+COMMENT ON COLUMN sj_retry_summary.max_count_num IS '重试到达最大次数-日志数量';
+COMMENT ON COLUMN sj_retry_summary.suspend_num IS '暂停重试-日志数量';
+COMMENT ON COLUMN sj_retry_summary.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_retry_summary.update_dt IS '修改时间';
+COMMENT ON TABLE sj_retry_summary IS 'DashBoard_Retry';
+
+-- sj_workflow
+CREATE TABLE sj_workflow
+(
+ id number GENERATED ALWAYS AS IDENTITY,
+ workflow_name varchar2(64) NULL,
+ namespace_id varchar2(64) DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' NULL,
+ group_name varchar2(64) NULL,
+ workflow_status smallint DEFAULT 1 NOT NULL,
+ trigger_type smallint NOT NULL,
+ trigger_interval varchar2(255) NULL,
+ next_trigger_at number NOT NULL,
+ block_strategy smallint DEFAULT 1 NOT NULL,
+ executor_timeout number DEFAULT 0 NOT NULL,
+ description varchar2(256) DEFAULT '' NULL,
+ flow_info clob DEFAULT NULL NULL,
+ bucket_index number DEFAULT 0 NOT NULL,
+ version number NOT NULL,
+ ext_attrs varchar2(256) DEFAULT '' NULL,
+ deleted smallint DEFAULT 0 NOT NULL,
+ create_dt date DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ update_dt date DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+
+ALTER TABLE sj_workflow
+ ADD CONSTRAINT pk_sj_workflow PRIMARY KEY (id);
+
+CREATE INDEX idx_sj_workflow_01 ON sj_workflow (create_dt);
+CREATE INDEX idx_sj_workflow_02 ON sj_workflow (namespace_id, group_name);
+
+COMMENT ON COLUMN sj_workflow.id IS '主键';
+COMMENT ON COLUMN sj_workflow.workflow_name IS '工作流名称';
+COMMENT ON COLUMN sj_workflow.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_workflow.group_name IS '组名称';
+COMMENT ON COLUMN sj_workflow.workflow_status IS '工作流状态 0、关闭、1、开启';
+COMMENT ON COLUMN sj_workflow.trigger_type IS '触发类型 1.CRON 表达式 2. 固定时间';
+COMMENT ON COLUMN sj_workflow.trigger_interval IS '间隔时长';
+COMMENT ON COLUMN sj_workflow.next_trigger_at IS '下次触发时间';
+COMMENT ON COLUMN sj_workflow.block_strategy IS '阻塞策略 1、丢弃 2、覆盖 3、并行';
+COMMENT ON COLUMN sj_workflow.executor_timeout IS '任务执行超时时间,单位秒';
+COMMENT ON COLUMN sj_workflow.description IS '描述';
+COMMENT ON COLUMN sj_workflow.flow_info IS '流程信息';
+COMMENT ON COLUMN sj_workflow.bucket_index IS 'bucket';
+COMMENT ON COLUMN sj_workflow.version IS '版本号';
+COMMENT ON COLUMN sj_workflow.ext_attrs IS '扩展字段';
+COMMENT ON COLUMN sj_workflow.deleted IS '逻辑删除 1、删除';
+COMMENT ON COLUMN sj_workflow.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_workflow.update_dt IS '修改时间';
+COMMENT ON TABLE sj_workflow IS '工作流';
+
+-- sj_workflow_node
+CREATE TABLE sj_workflow_node
+(
+ id number GENERATED ALWAYS AS IDENTITY,
+ namespace_id varchar2(64) DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' NULL,
+ node_name varchar2(64) NULL,
+ group_name varchar2(64) NULL,
+ job_id number NOT NULL,
+ workflow_id number NOT NULL,
+ node_type smallint DEFAULT 1 NOT NULL,
+ expression_type smallint DEFAULT 0 NOT NULL,
+ fail_strategy smallint DEFAULT 1 NOT NULL,
+ workflow_node_status smallint DEFAULT 1 NOT NULL,
+ priority_level number DEFAULT 1 NOT NULL,
+ node_info clob DEFAULT NULL NULL,
+ version number NOT NULL,
+ ext_attrs varchar2(256) DEFAULT '' NULL,
+ deleted smallint DEFAULT 0 NOT NULL,
+ create_dt date DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ update_dt date DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+
+ALTER TABLE sj_workflow_node
+ ADD CONSTRAINT pk_sj_workflow_node PRIMARY KEY (id);
+
+CREATE INDEX idx_sj_workflow_node_01 ON sj_workflow_node (create_dt);
+CREATE INDEX idx_sj_workflow_node_02 ON sj_workflow_node (namespace_id, group_name);
+
+COMMENT ON COLUMN sj_workflow_node.id IS '主键';
+COMMENT ON COLUMN sj_workflow_node.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_workflow_node.node_name IS '节点名称';
+COMMENT ON COLUMN sj_workflow_node.group_name IS '组名称';
+COMMENT ON COLUMN sj_workflow_node.job_id IS '任务信息id';
+COMMENT ON COLUMN sj_workflow_node.workflow_id IS '工作流ID';
+COMMENT ON COLUMN sj_workflow_node.node_type IS '1、任务节点 2、条件节点';
+COMMENT ON COLUMN sj_workflow_node.expression_type IS '1、SpEl、2、Aviator 3、QL';
+COMMENT ON COLUMN sj_workflow_node.fail_strategy IS '失败策略 1、跳过 2、阻塞';
+COMMENT ON COLUMN sj_workflow_node.workflow_node_status IS '工作流节点状态 0、关闭、1、开启';
+COMMENT ON COLUMN sj_workflow_node.priority_level IS '优先级';
+COMMENT ON COLUMN sj_workflow_node.node_info IS '节点信息 ';
+COMMENT ON COLUMN sj_workflow_node.version IS '版本号';
+COMMENT ON COLUMN sj_workflow_node.ext_attrs IS '扩展字段';
+COMMENT ON COLUMN sj_workflow_node.deleted IS '逻辑删除 1、删除';
+COMMENT ON COLUMN sj_workflow_node.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_workflow_node.update_dt IS '修改时间';
+COMMENT ON TABLE sj_workflow_node IS '工作流节点';
+
+-- sj_workflow_task_batch
+CREATE TABLE sj_workflow_task_batch
+(
+ id number GENERATED ALWAYS AS IDENTITY,
+ namespace_id varchar2(64) DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' NULL,
+ group_name varchar2(64) NULL,
+ workflow_id number NOT NULL,
+ task_batch_status smallint DEFAULT 0 NOT NULL,
+ operation_reason smallint DEFAULT 0 NOT NULL,
+ flow_info clob DEFAULT NULL NULL,
+ execution_at number DEFAULT 0 NOT NULL,
+ ext_attrs varchar2(256) DEFAULT '' NULL,
+ deleted smallint DEFAULT 0 NOT NULL,
+ create_dt date DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ update_dt date DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+
+ALTER TABLE sj_workflow_task_batch
+ ADD CONSTRAINT pk_sj_workflow_task_batch PRIMARY KEY (id);
+
+CREATE INDEX idx_sj_workflow_task_batch_01 ON sj_workflow_task_batch (workflow_id, task_batch_status);
+CREATE INDEX idx_sj_workflow_task_batch_02 ON sj_workflow_task_batch (create_dt);
+CREATE INDEX idx_sj_workflow_task_batch_03 ON sj_workflow_task_batch (namespace_id, group_name);
+
+COMMENT ON COLUMN sj_workflow_task_batch.id IS '主键';
+COMMENT ON COLUMN sj_workflow_task_batch.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_workflow_task_batch.group_name IS '组名称';
+COMMENT ON COLUMN sj_workflow_task_batch.workflow_id IS '工作流任务id';
+COMMENT ON COLUMN sj_workflow_task_batch.task_batch_status IS '任务批次状态 0、失败 1、成功';
+COMMENT ON COLUMN sj_workflow_task_batch.operation_reason IS '操作原因';
+COMMENT ON COLUMN sj_workflow_task_batch.flow_info IS '流程信息';
+COMMENT ON COLUMN sj_workflow_task_batch.execution_at IS '任务执行时间';
+COMMENT ON COLUMN sj_workflow_task_batch.ext_attrs IS '扩展字段';
+COMMENT ON COLUMN sj_workflow_task_batch.deleted IS '逻辑删除 1、删除';
+COMMENT ON COLUMN sj_workflow_task_batch.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_workflow_task_batch.update_dt IS '修改时间';
+COMMENT ON TABLE sj_workflow_task_batch IS '工作流批次';
+
diff --git a/continew-admin-extension/continew-admin-job-server/src/main/resources/db/changelogs/postgresql/snail_job.sql b/continew-admin-extension/continew-admin-job-server/src/main/resources/db/changelogs/postgresql/snail_job.sql
new file mode 100644
index 000000000..45250036d
--- /dev/null
+++ b/continew-admin-extension/continew-admin-job-server/src/main/resources/db/changelogs/postgresql/snail_job.sql
@@ -0,0 +1,816 @@
+-- liquibase formatted sql
+
+-- changeset snail-job-server:1
+-- sj_namespace
+CREATE TABLE sj_namespace
+(
+ id bigserial PRIMARY KEY,
+ name varchar(64) NOT NULL,
+ unique_id varchar(64) NOT NULL,
+ description varchar(256) NOT NULL DEFAULT '',
+ deleted smallint NOT NULL DEFAULT 0,
+ create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ update_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
+);
+
+CREATE INDEX idx_sj_namespace_01 ON sj_namespace (name);
+
+COMMENT ON COLUMN sj_namespace.id IS '主键';
+COMMENT ON COLUMN sj_namespace.name IS '名称';
+COMMENT ON COLUMN sj_namespace.unique_id IS '唯一id';
+COMMENT ON COLUMN sj_namespace.description IS '描述';
+COMMENT ON COLUMN sj_namespace.deleted IS '逻辑删除 1、删除';
+COMMENT ON COLUMN sj_namespace.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_namespace.update_dt IS '修改时间';
+COMMENT ON TABLE sj_namespace IS '命名空间';
+
+INSERT INTO sj_namespace (id, name, unique_id, create_dt, update_dt, deleted)
+VALUES (1, 'Default', '764d604ec6fc45f68cd92514c40e9e1a', now(), now(), 0);
+
+-- sj_group_config
+CREATE TABLE sj_group_config
+(
+ id bigserial PRIMARY KEY,
+ namespace_id varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
+ group_name varchar(64) NOT NULL DEFAULT '',
+ description varchar(256) NOT NULL DEFAULT '',
+ token varchar(64) NOT NULL DEFAULT 'SJ_cKqBTPzCsWA3VyuCfFoccmuIEGXjr5KT',
+ group_status smallint NOT NULL DEFAULT 0,
+ version int NOT NULL,
+ group_partition int NOT NULL,
+ id_generator_mode smallint NOT NULL DEFAULT 1,
+ init_scene smallint NOT NULL DEFAULT 0,
+ bucket_index int NOT NULL DEFAULT 0,
+ create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ update_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
+);
+
+CREATE UNIQUE INDEX uk_sj_group_config_01 ON sj_group_config (namespace_id, group_name);
+
+COMMENT ON COLUMN sj_group_config.id IS '主键';
+COMMENT ON COLUMN sj_group_config.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_group_config.group_name IS '组名称';
+COMMENT ON COLUMN sj_group_config.description IS '组描述';
+COMMENT ON COLUMN sj_group_config.token IS 'token';
+COMMENT ON COLUMN sj_group_config.group_status IS '组状态 0、未启用 1、启用';
+COMMENT ON COLUMN sj_group_config.version IS '版本号';
+COMMENT ON COLUMN sj_group_config.group_partition IS '分区';
+COMMENT ON COLUMN sj_group_config.id_generator_mode IS '唯一id生成模式 默认号段模式';
+COMMENT ON COLUMN sj_group_config.init_scene IS '是否初始化场景 0:否 1:是';
+COMMENT ON COLUMN sj_group_config.bucket_index IS 'bucket';
+COMMENT ON COLUMN sj_group_config.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_group_config.update_dt IS '修改时间';
+COMMENT ON TABLE sj_group_config IS '组配置';
+
+-- sj_notify_config
+CREATE TABLE sj_notify_config
+(
+ id bigserial PRIMARY KEY,
+ namespace_id varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
+ group_name varchar(64) NOT NULL,
+ business_id varchar(64) NOT NULL,
+ system_task_type smallint NOT NULL DEFAULT 3,
+ notify_status smallint NOT NULL DEFAULT 0,
+ recipient_ids varchar(128) NOT NULL,
+ notify_threshold int NOT NULL DEFAULT 0,
+ notify_scene smallint NOT NULL DEFAULT 0,
+ rate_limiter_status smallint NOT NULL DEFAULT 0,
+ rate_limiter_threshold int NOT NULL DEFAULT 0,
+ description varchar(256) NOT NULL DEFAULT '',
+ create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ update_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
+);
+
+CREATE INDEX idx_sj_notify_config_01 ON sj_notify_config (namespace_id, group_name, business_id);
+
+COMMENT ON COLUMN sj_notify_config.id IS '主键';
+COMMENT ON COLUMN sj_notify_config.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_notify_config.group_name IS '组名称';
+COMMENT ON COLUMN sj_notify_config.business_id IS '业务id ( job_id或workflow_id或scene_name ) ';
+COMMENT ON COLUMN sj_notify_config.system_task_type IS '任务类型 1. 重试任务 2. 重试回调 3、JOB任务 4、WORKFLOW任务';
+COMMENT ON COLUMN sj_notify_config.notify_status IS '通知状态 0、未启用 1、启用';
+COMMENT ON COLUMN sj_notify_config.recipient_ids IS '接收人id列表';
+COMMENT ON COLUMN sj_notify_config.notify_threshold IS '通知阈值';
+COMMENT ON COLUMN sj_notify_config.notify_scene IS '通知场景';
+COMMENT ON COLUMN sj_notify_config.rate_limiter_status IS '限流状态 0、未启用 1、启用';
+COMMENT ON COLUMN sj_notify_config.rate_limiter_threshold IS '每秒限流阈值';
+COMMENT ON COLUMN sj_notify_config.description IS '描述';
+COMMENT ON COLUMN sj_notify_config.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_notify_config.update_dt IS '修改时间';
+COMMENT ON TABLE sj_notify_config IS '通知配置';
+
+-- sj_notify_recipient
+CREATE TABLE sj_notify_recipient
+(
+ id bigserial PRIMARY KEY,
+ namespace_id varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
+ recipient_name varchar(64) NOT NULL,
+ notify_type smallint NOT NULL DEFAULT 0,
+ notify_attribute varchar(512) NOT NULL,
+ description varchar(256) NOT NULL DEFAULT '',
+ create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ update_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
+);
+
+CREATE INDEX idx_sj_notify_recipient_01 ON sj_notify_recipient (namespace_id);
+
+COMMENT ON COLUMN sj_notify_recipient.id IS '主键';
+COMMENT ON COLUMN sj_notify_recipient.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_notify_recipient.recipient_name IS '接收人名称';
+COMMENT ON COLUMN sj_notify_recipient.notify_type IS '通知类型 1、钉钉 2、邮件 3、企业微信 4 飞书 5 webhook';
+COMMENT ON COLUMN sj_notify_recipient.notify_attribute IS '配置属性';
+COMMENT ON COLUMN sj_notify_recipient.description IS '描述';
+COMMENT ON COLUMN sj_notify_recipient.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_notify_recipient.update_dt IS '修改时间';
+COMMENT ON TABLE sj_notify_recipient IS '告警通知接收人';
+
+-- sj_retry_dead_letter_0
+CREATE TABLE sj_retry_dead_letter_0
+(
+ id bigserial PRIMARY KEY,
+ namespace_id varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
+ unique_id varchar(64) NOT NULL,
+ group_name varchar(64) NOT NULL,
+ scene_name varchar(64) NOT NULL,
+ idempotent_id varchar(64) NOT NULL,
+ biz_no varchar(64) NOT NULL DEFAULT '',
+ executor_name varchar(512) NOT NULL DEFAULT '',
+ args_str text NOT NULL,
+ ext_attrs text NOT NULL,
+ task_type smallint NOT NULL DEFAULT 1,
+ create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
+);
+
+CREATE UNIQUE INDEX uk_sj_retry_dead_letter_0_01 ON sj_retry_dead_letter_0 (namespace_id, group_name, unique_id);
+
+CREATE INDEX idx_sj_retry_dead_letter_0_01 ON sj_retry_dead_letter_0 (namespace_id, group_name, scene_name);
+CREATE INDEX idx_sj_retry_dead_letter_0_02 ON sj_retry_dead_letter_0 (idempotent_id);
+CREATE INDEX idx_sj_retry_dead_letter_0_03 ON sj_retry_dead_letter_0 (biz_no);
+CREATE INDEX idx_sj_retry_dead_letter_0_04 ON sj_retry_dead_letter_0 (create_dt);
+
+COMMENT ON COLUMN sj_retry_dead_letter_0.id IS '主键';
+COMMENT ON COLUMN sj_retry_dead_letter_0.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_retry_dead_letter_0.unique_id IS '同组下id唯一';
+COMMENT ON COLUMN sj_retry_dead_letter_0.group_name IS '组名称';
+COMMENT ON COLUMN sj_retry_dead_letter_0.scene_name IS '场景名称';
+COMMENT ON COLUMN sj_retry_dead_letter_0.idempotent_id IS '幂等id';
+COMMENT ON COLUMN sj_retry_dead_letter_0.biz_no IS '业务编号';
+COMMENT ON COLUMN sj_retry_dead_letter_0.executor_name IS '执行器名称';
+COMMENT ON COLUMN sj_retry_dead_letter_0.args_str IS '执行方法参数';
+COMMENT ON COLUMN sj_retry_dead_letter_0.ext_attrs IS '扩展字段';
+COMMENT ON COLUMN sj_retry_dead_letter_0.task_type IS '任务类型 1、重试数据 2、回调数据';
+COMMENT ON COLUMN sj_retry_dead_letter_0.create_dt IS '创建时间';
+COMMENT ON TABLE sj_retry_dead_letter_0 IS '死信队列表';
+
+-- sj_retry_task_0
+CREATE TABLE sj_retry_task_0
+(
+ id bigserial PRIMARY KEY,
+ namespace_id varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
+ unique_id varchar(64) NOT NULL,
+ group_name varchar(64) NOT NULL,
+ scene_name varchar(64) NOT NULL,
+ idempotent_id varchar(64) NOT NULL,
+ biz_no varchar(64) NOT NULL DEFAULT '',
+ executor_name varchar(512) NOT NULL DEFAULT '',
+ args_str text NOT NULL,
+ ext_attrs text NOT NULL,
+ next_trigger_at timestamp NOT NULL,
+ retry_count int NOT NULL DEFAULT 0,
+ retry_status smallint NOT NULL DEFAULT 0,
+ task_type smallint NOT NULL DEFAULT 1,
+ create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ update_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
+);
+
+CREATE UNIQUE INDEX uk_sj_retry_task_0_01 ON sj_retry_task_0 (namespace_id, group_name, unique_id);
+
+CREATE INDEX idx_sj_retry_task_0_01 ON sj_retry_task_0 (namespace_id, group_name, scene_name);
+CREATE INDEX idx_sj_retry_task_0_02 ON sj_retry_task_0 (namespace_id, group_name, task_type);
+CREATE INDEX idx_sj_retry_task_0_03 ON sj_retry_task_0 (namespace_id, group_name, retry_status);
+CREATE INDEX idx_sj_retry_task_0_04 ON sj_retry_task_0 (idempotent_id);
+CREATE INDEX idx_sj_retry_task_0_05 ON sj_retry_task_0 (biz_no);
+CREATE INDEX idx_sj_retry_task_0_06 ON sj_retry_task_0 (create_dt);
+
+COMMENT ON COLUMN sj_retry_task_0.id IS '主键';
+COMMENT ON COLUMN sj_retry_task_0.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_retry_task_0.unique_id IS '同组下id唯一';
+COMMENT ON COLUMN sj_retry_task_0.group_name IS '组名称';
+COMMENT ON COLUMN sj_retry_task_0.scene_name IS '场景名称';
+COMMENT ON COLUMN sj_retry_task_0.idempotent_id IS '幂等id';
+COMMENT ON COLUMN sj_retry_task_0.biz_no IS '业务编号';
+COMMENT ON COLUMN sj_retry_task_0.executor_name IS '执行器名称';
+COMMENT ON COLUMN sj_retry_task_0.args_str IS '执行方法参数';
+COMMENT ON COLUMN sj_retry_task_0.ext_attrs IS '扩展字段';
+COMMENT ON COLUMN sj_retry_task_0.next_trigger_at IS '下次触发时间';
+COMMENT ON COLUMN sj_retry_task_0.retry_count IS '重试次数';
+COMMENT ON COLUMN sj_retry_task_0.retry_status IS '重试状态 0、重试中 1、成功 2、最大重试次数';
+COMMENT ON COLUMN sj_retry_task_0.task_type IS '任务类型 1、重试数据 2、回调数据';
+COMMENT ON COLUMN sj_retry_task_0.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_retry_task_0.update_dt IS '修改时间';
+COMMENT ON TABLE sj_retry_task_0 IS '任务表';
+
+-- sj_retry_task_log
+CREATE TABLE sj_retry_task_log
+(
+ id bigserial PRIMARY KEY,
+ namespace_id varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
+ unique_id varchar(64) NOT NULL,
+ group_name varchar(64) NOT NULL,
+ scene_name varchar(64) NOT NULL,
+ idempotent_id varchar(64) NOT NULL,
+ biz_no varchar(64) NOT NULL DEFAULT '',
+ executor_name varchar(512) NOT NULL DEFAULT '',
+ args_str text NOT NULL,
+ ext_attrs text NOT NULL,
+ retry_status smallint NOT NULL DEFAULT 0,
+ task_type smallint NOT NULL DEFAULT 1,
+ create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ update_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
+);
+
+CREATE INDEX idx_sj_retry_task_log_01 ON sj_retry_task_log (namespace_id, group_name, scene_name);
+CREATE INDEX idx_sj_retry_task_log_02 ON sj_retry_task_log (retry_status);
+CREATE INDEX idx_sj_retry_task_log_03 ON sj_retry_task_log (idempotent_id);
+CREATE INDEX idx_sj_retry_task_log_04 ON sj_retry_task_log (unique_id);
+CREATE INDEX idx_sj_retry_task_log_05 ON sj_retry_task_log (biz_no);
+CREATE INDEX idx_sj_retry_task_log_06 ON sj_retry_task_log (create_dt);
+
+COMMENT ON COLUMN sj_retry_task_log.id IS '主键';
+COMMENT ON COLUMN sj_retry_task_log.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_retry_task_log.unique_id IS '同组下id唯一';
+COMMENT ON COLUMN sj_retry_task_log.group_name IS '组名称';
+COMMENT ON COLUMN sj_retry_task_log.scene_name IS '场景名称';
+COMMENT ON COLUMN sj_retry_task_log.idempotent_id IS '幂等id';
+COMMENT ON COLUMN sj_retry_task_log.biz_no IS '业务编号';
+COMMENT ON COLUMN sj_retry_task_log.executor_name IS '执行器名称';
+COMMENT ON COLUMN sj_retry_task_log.args_str IS '执行方法参数';
+COMMENT ON COLUMN sj_retry_task_log.ext_attrs IS '扩展字段';
+COMMENT ON COLUMN sj_retry_task_log.retry_status IS '重试状态 0、重试中 1、成功 2、最大次数';
+COMMENT ON COLUMN sj_retry_task_log.task_type IS '任务类型 1、重试数据 2、回调数据';
+COMMENT ON COLUMN sj_retry_task_log.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_retry_task_log.update_dt IS '修改时间';
+COMMENT ON TABLE sj_retry_task_log IS '任务日志基础信息表';
+
+-- sj_retry_task_log_message
+CREATE TABLE sj_retry_task_log_message
+(
+ id bigserial PRIMARY KEY,
+ namespace_id varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
+ group_name varchar(64) NOT NULL,
+ unique_id varchar(64) NOT NULL,
+ message text NOT NULL,
+ log_num int NOT NULL DEFAULT 1,
+ real_time bigint NOT NULL DEFAULT 0,
+ create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
+);
+
+CREATE INDEX idx_sj_retry_task_log_message_01 ON sj_retry_task_log_message (namespace_id, group_name, unique_id);
+CREATE INDEX idx_sj_retry_task_log_message_02 ON sj_retry_task_log_message (create_dt);
+
+COMMENT ON COLUMN sj_retry_task_log_message.id IS '主键';
+COMMENT ON COLUMN sj_retry_task_log_message.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_retry_task_log_message.group_name IS '组名称';
+COMMENT ON COLUMN sj_retry_task_log_message.unique_id IS '同组下id唯一';
+COMMENT ON COLUMN sj_retry_task_log_message.message IS '异常信息';
+COMMENT ON COLUMN sj_retry_task_log_message.log_num IS '日志数量';
+COMMENT ON COLUMN sj_retry_task_log_message.real_time IS '上报时间';
+COMMENT ON COLUMN sj_retry_task_log_message.create_dt IS '创建时间';
+COMMENT ON TABLE sj_retry_task_log_message IS '任务调度日志信息记录表';
+
+-- sj_retry_scene_config
+CREATE TABLE sj_retry_scene_config
+(
+ id bigserial PRIMARY KEY,
+ namespace_id varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
+ scene_name varchar(64) NOT NULL,
+ group_name varchar(64) NOT NULL,
+ scene_status smallint NOT NULL DEFAULT 0,
+ max_retry_count int NOT NULL DEFAULT 5,
+ back_off smallint NOT NULL DEFAULT 1,
+ trigger_interval varchar(16) NOT NULL DEFAULT '',
+ deadline_request bigint NOT NULL DEFAULT 60000,
+ executor_timeout int NOT NULL DEFAULT 5,
+ route_key smallint NOT NULL DEFAULT 4,
+ description varchar(256) NOT NULL DEFAULT '',
+ create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ update_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
+);
+
+CREATE UNIQUE INDEX uk_sj_retry_scene_config_01 ON sj_retry_scene_config (namespace_id, group_name, scene_name);
+
+COMMENT ON COLUMN sj_retry_scene_config.id IS '主键';
+COMMENT ON COLUMN sj_retry_scene_config.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_retry_scene_config.scene_name IS '场景名称';
+COMMENT ON COLUMN sj_retry_scene_config.group_name IS '组名称';
+COMMENT ON COLUMN sj_retry_scene_config.scene_status IS '组状态 0、未启用 1、启用';
+COMMENT ON COLUMN sj_retry_scene_config.max_retry_count IS '最大重试次数';
+COMMENT ON COLUMN sj_retry_scene_config.back_off IS '1、默认等级 2、固定间隔时间 3、CRON 表达式';
+COMMENT ON COLUMN sj_retry_scene_config.trigger_interval IS '间隔时长';
+COMMENT ON COLUMN sj_retry_scene_config.deadline_request IS 'Deadline Request 调用链超时 单位毫秒';
+COMMENT ON COLUMN sj_retry_scene_config.executor_timeout IS '任务执行超时时间,单位秒';
+COMMENT ON COLUMN sj_retry_scene_config.route_key IS '路由策略';
+COMMENT ON COLUMN sj_retry_scene_config.description IS '描述';
+COMMENT ON COLUMN sj_retry_scene_config.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_retry_scene_config.update_dt IS '修改时间';
+COMMENT ON TABLE sj_retry_scene_config IS '场景配置';
+
+-- sj_server_node
+CREATE TABLE sj_server_node
+(
+ id bigserial PRIMARY KEY,
+ namespace_id varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
+ group_name varchar(64) NOT NULL,
+ host_id varchar(64) NOT NULL,
+ host_ip varchar(64) NOT NULL,
+ host_port int NOT NULL,
+ expire_at timestamp NOT NULL,
+ node_type smallint NOT NULL,
+ ext_attrs varchar(256) NULL DEFAULT '',
+ create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ update_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
+);
+
+CREATE UNIQUE INDEX uk_sj_server_node_01 ON sj_server_node (host_id, host_ip);
+
+CREATE INDEX idx_sj_server_node_01 ON sj_server_node (namespace_id, group_name);
+CREATE INDEX idx_sj_server_node_02 ON sj_server_node (expire_at, node_type);
+
+COMMENT ON COLUMN sj_server_node.id IS '主键';
+COMMENT ON COLUMN sj_server_node.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_server_node.group_name IS '组名称';
+COMMENT ON COLUMN sj_server_node.host_id IS '主机id';
+COMMENT ON COLUMN sj_server_node.host_ip IS '机器ip';
+COMMENT ON COLUMN sj_server_node.host_port IS '机器端口';
+COMMENT ON COLUMN sj_server_node.expire_at IS '过期时间';
+COMMENT ON COLUMN sj_server_node.node_type IS '节点类型 1、客户端 2、是服务端';
+COMMENT ON COLUMN sj_server_node.ext_attrs IS '扩展字段';
+COMMENT ON COLUMN sj_server_node.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_server_node.update_dt IS '修改时间';
+COMMENT ON TABLE sj_server_node IS '服务器节点';
+
+-- sj_distributed_lock
+CREATE TABLE sj_distributed_lock
+(
+ id bigserial PRIMARY KEY,
+ name varchar(64) NOT NULL,
+ lock_until timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
+ locked_at timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
+ locked_by varchar(255) NOT NULL,
+ create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ update_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
+);
+
+COMMENT ON COLUMN sj_distributed_lock.id IS '主键';
+COMMENT ON COLUMN sj_distributed_lock.name IS '锁名称';
+COMMENT ON COLUMN sj_distributed_lock.lock_until IS '锁定时长';
+COMMENT ON COLUMN sj_distributed_lock.locked_at IS '锁定时间';
+COMMENT ON COLUMN sj_distributed_lock.locked_by IS '锁定者';
+COMMENT ON COLUMN sj_distributed_lock.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_distributed_lock.update_dt IS '修改时间';
+COMMENT ON TABLE sj_distributed_lock IS '锁定表';
+
+-- sj_system_user
+CREATE TABLE sj_system_user
+(
+ id bigserial PRIMARY KEY,
+ username varchar(64) NOT NULL,
+ password varchar(128) NOT NULL,
+ role smallint NOT NULL DEFAULT 0,
+ create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ update_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
+);
+
+COMMENT ON COLUMN sj_system_user.id IS '主键';
+COMMENT ON COLUMN sj_system_user.username IS '账号';
+COMMENT ON COLUMN sj_system_user.password IS '密码';
+COMMENT ON COLUMN sj_system_user.role IS '角色:1-普通用户、2-管理员';
+COMMENT ON COLUMN sj_system_user.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_system_user.update_dt IS '修改时间';
+COMMENT ON TABLE sj_system_user IS '系统用户表';
+
+INSERT INTO sj_system_user (username, password, role)
+VALUES ('admin', '465c194afb65670f38322df087f0a9bb225cc257e43eb4ac5a0c98ef5b3173ac', 2);
+
+-- sj_system_user_permission
+CREATE TABLE sj_system_user_permission
+(
+ id bigserial PRIMARY KEY,
+ group_name varchar(64) NOT NULL,
+ namespace_id varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
+ system_user_id bigint NOT NULL,
+ create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ update_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
+);
+
+CREATE UNIQUE INDEX uk_sj_system_user_permission_01 ON sj_system_user_permission (namespace_id, group_name, system_user_id);
+
+COMMENT ON COLUMN sj_system_user_permission.id IS '主键';
+COMMENT ON COLUMN sj_system_user_permission.group_name IS '组名称';
+COMMENT ON COLUMN sj_system_user_permission.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_system_user_permission.system_user_id IS '系统用户id';
+COMMENT ON COLUMN sj_system_user_permission.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_system_user_permission.update_dt IS '修改时间';
+COMMENT ON TABLE sj_system_user_permission IS '系统用户权限表';
+
+-- sj_sequence_alloc
+CREATE TABLE sj_sequence_alloc
+(
+ id bigserial PRIMARY KEY,
+ namespace_id varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
+ group_name varchar(64) NOT NULL DEFAULT '',
+ max_id bigint NOT NULL DEFAULT 1,
+ step int NOT NULL DEFAULT 100,
+ update_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
+);
+
+CREATE UNIQUE INDEX uk_sj_sequence_alloc_01 ON sj_sequence_alloc (namespace_id, group_name);
+
+COMMENT ON COLUMN sj_sequence_alloc.id IS '主键';
+COMMENT ON COLUMN sj_sequence_alloc.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_sequence_alloc.group_name IS '组名称';
+COMMENT ON COLUMN sj_sequence_alloc.max_id IS '最大id';
+COMMENT ON COLUMN sj_sequence_alloc.step IS '步长';
+COMMENT ON COLUMN sj_sequence_alloc.update_dt IS '更新时间';
+COMMENT ON TABLE sj_sequence_alloc IS '号段模式序号ID分配表';
+
+-- sj_job
+CREATE TABLE sj_job
+(
+ id bigserial PRIMARY KEY,
+ namespace_id varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
+ group_name varchar(64) NOT NULL,
+ job_name varchar(64) NOT NULL,
+ args_str text NULL DEFAULT NULL,
+ args_type smallint NOT NULL DEFAULT 1,
+ next_trigger_at bigint NOT NULL,
+ job_status smallint NOT NULL DEFAULT 1,
+ task_type smallint NOT NULL DEFAULT 1,
+ route_key smallint NOT NULL DEFAULT 4,
+ executor_type smallint NOT NULL DEFAULT 1,
+ executor_info varchar(255) NULL DEFAULT NULL,
+ trigger_type smallint NOT NULL,
+ trigger_interval varchar(255) NOT NULL,
+ block_strategy smallint NOT NULL DEFAULT 1,
+ executor_timeout int NOT NULL DEFAULT 0,
+ max_retry_times int NOT NULL DEFAULT 0,
+ parallel_num int NOT NULL DEFAULT 1,
+ retry_interval int NOT NULL DEFAULT 0,
+ bucket_index int NOT NULL DEFAULT 0,
+ resident smallint NOT NULL DEFAULT 0,
+ description varchar(256) NOT NULL DEFAULT '',
+ ext_attrs varchar(256) NULL DEFAULT '',
+ deleted smallint NOT NULL DEFAULT 0,
+ create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ update_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
+);
+
+CREATE INDEX idx_sj_job_01 ON sj_job (namespace_id, group_name);
+CREATE INDEX idx_sj_job_02 ON sj_job (job_status, bucket_index);
+CREATE INDEX idx_sj_job_03 ON sj_job (create_dt);
+
+COMMENT ON COLUMN sj_job.id IS '主键';
+COMMENT ON COLUMN sj_job.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_job.group_name IS '组名称';
+COMMENT ON COLUMN sj_job.job_name IS '名称';
+COMMENT ON COLUMN sj_job.args_str IS '执行方法参数';
+COMMENT ON COLUMN sj_job.args_type IS '参数类型 ';
+COMMENT ON COLUMN sj_job.next_trigger_at IS '下次触发时间';
+COMMENT ON COLUMN sj_job.job_status IS '任务状态 0、关闭、1、开启';
+COMMENT ON COLUMN sj_job.task_type IS '任务类型 1、集群 2、广播 3、切片';
+COMMENT ON COLUMN sj_job.route_key IS '路由策略';
+COMMENT ON COLUMN sj_job.executor_type IS '执行器类型';
+COMMENT ON COLUMN sj_job.executor_info IS '执行器名称';
+COMMENT ON COLUMN sj_job.trigger_type IS '触发类型 1.CRON 表达式 2. 固定时间';
+COMMENT ON COLUMN sj_job.trigger_interval IS '间隔时长';
+COMMENT ON COLUMN sj_job.block_strategy IS '阻塞策略 1、丢弃 2、覆盖 3、并行';
+COMMENT ON COLUMN sj_job.executor_timeout IS '任务执行超时时间,单位秒';
+COMMENT ON COLUMN sj_job.max_retry_times IS '最大重试次数';
+COMMENT ON COLUMN sj_job.parallel_num IS '并行数';
+COMMENT ON COLUMN sj_job.retry_interval IS '重试间隔 ( s ) ';
+COMMENT ON COLUMN sj_job.bucket_index IS 'bucket';
+COMMENT ON COLUMN sj_job.resident IS '是否是常驻任务';
+COMMENT ON COLUMN sj_job.description IS '描述';
+COMMENT ON COLUMN sj_job.ext_attrs IS '扩展字段';
+COMMENT ON COLUMN sj_job.deleted IS '逻辑删除 1、删除';
+COMMENT ON COLUMN sj_job.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_job.update_dt IS '修改时间';
+COMMENT ON TABLE sj_job IS '任务信息';
+
+-- sj_job_log_message
+CREATE TABLE sj_job_log_message
+(
+ id bigserial PRIMARY KEY,
+ namespace_id varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
+ group_name varchar(64) NOT NULL,
+ job_id bigint NOT NULL,
+ task_batch_id bigint NOT NULL,
+ task_id bigint NOT NULL,
+ message text NOT NULL,
+ log_num int NOT NULL DEFAULT 1,
+ real_time bigint NOT NULL DEFAULT 0,
+ ext_attrs varchar(256) NULL DEFAULT '',
+ create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
+);
+
+CREATE INDEX idx_sj_job_log_message_01 ON sj_job_log_message (task_batch_id, task_id);
+CREATE INDEX idx_sj_job_log_message_02 ON sj_job_log_message (create_dt);
+CREATE INDEX idx_sj_job_log_message_03 ON sj_job_log_message (namespace_id, group_name);
+
+COMMENT ON COLUMN sj_job_log_message.id IS '主键';
+COMMENT ON COLUMN sj_job_log_message.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_job_log_message.group_name IS '组名称';
+COMMENT ON COLUMN sj_job_log_message.job_id IS '任务信息id';
+COMMENT ON COLUMN sj_job_log_message.task_batch_id IS '任务批次id';
+COMMENT ON COLUMN sj_job_log_message.task_id IS '调度任务id';
+COMMENT ON COLUMN sj_job_log_message.message IS '调度信息';
+COMMENT ON COLUMN sj_job_log_message.log_num IS '日志数量';
+COMMENT ON COLUMN sj_job_log_message.real_time IS '上报时间';
+COMMENT ON COLUMN sj_job_log_message.ext_attrs IS '扩展字段';
+COMMENT ON COLUMN sj_job_log_message.create_dt IS '创建时间';
+COMMENT ON TABLE sj_job_log_message IS '调度日志';
+
+-- sj_job_task
+CREATE TABLE sj_job_task
+(
+ id bigserial PRIMARY KEY,
+ namespace_id varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
+ group_name varchar(64) NOT NULL,
+ job_id bigint NOT NULL,
+ task_batch_id bigint NOT NULL,
+ parent_id bigint NOT NULL DEFAULT 0,
+ task_status smallint NOT NULL DEFAULT 0,
+ retry_count int NOT NULL DEFAULT 0,
+ client_info varchar(128) NULL DEFAULT NULL,
+ result_message text NOT NULL,
+ args_str text NULL DEFAULT NULL,
+ args_type smallint NOT NULL DEFAULT 1,
+ ext_attrs varchar(256) NULL DEFAULT '',
+ create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ update_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
+);
+
+CREATE INDEX idx_sj_job_task_01 ON sj_job_task (task_batch_id, task_status);
+CREATE INDEX idx_sj_job_task_02 ON sj_job_task (create_dt);
+CREATE INDEX idx_sj_job_task_03 ON sj_job_task (namespace_id, group_name);
+
+COMMENT ON COLUMN sj_job_task.id IS '主键';
+COMMENT ON COLUMN sj_job_task.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_job_task.group_name IS '组名称';
+COMMENT ON COLUMN sj_job_task.job_id IS '任务信息id';
+COMMENT ON COLUMN sj_job_task.task_batch_id IS '调度任务id';
+COMMENT ON COLUMN sj_job_task.parent_id IS '父执行器id';
+COMMENT ON COLUMN sj_job_task.task_status IS '执行的状态 0、失败 1、成功';
+COMMENT ON COLUMN sj_job_task.retry_count IS '重试次数';
+COMMENT ON COLUMN sj_job_task.client_info IS '客户端地址 clientId#ip:port';
+COMMENT ON COLUMN sj_job_task.result_message IS '执行结果';
+COMMENT ON COLUMN sj_job_task.args_str IS '执行方法参数';
+COMMENT ON COLUMN sj_job_task.args_type IS '参数类型 ';
+COMMENT ON COLUMN sj_job_task.ext_attrs IS '扩展字段';
+COMMENT ON COLUMN sj_job_task.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_job_task.update_dt IS '修改时间';
+COMMENT ON TABLE sj_job_task IS '任务实例';
+
+-- sj_job_task_batch
+CREATE TABLE sj_job_task_batch
+(
+ id bigserial PRIMARY KEY,
+ namespace_id varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
+ group_name varchar(64) NOT NULL,
+ job_id bigint NOT NULL,
+ workflow_node_id bigint NOT NULL DEFAULT 0,
+ parent_workflow_node_id bigint NOT NULL DEFAULT 0,
+ workflow_task_batch_id bigint NOT NULL DEFAULT 0,
+ task_batch_status smallint NOT NULL DEFAULT 0,
+ operation_reason smallint NOT NULL DEFAULT 0,
+ execution_at bigint NOT NULL DEFAULT 0,
+ system_task_type smallint NOT NULL DEFAULT 3,
+ parent_id varchar(64) NOT NULL DEFAULT '',
+ ext_attrs varchar(256) NULL DEFAULT '',
+ deleted smallint NOT NULL DEFAULT 0,
+ create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ update_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
+);
+
+CREATE INDEX idx_sj_job_task_batch_01 ON sj_job_task_batch (job_id, task_batch_status);
+CREATE INDEX idx_sj_job_task_batch_02 ON sj_job_task_batch (create_dt);
+CREATE INDEX idx_sj_job_task_batch_03 ON sj_job_task_batch (namespace_id, group_name);
+CREATE INDEX idx_sj_job_task_batch_04 ON sj_job_task_batch (workflow_task_batch_id, workflow_node_id);
+
+COMMENT ON COLUMN sj_job_task_batch.id IS '主键';
+COMMENT ON COLUMN sj_job_task_batch.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_job_task_batch.group_name IS '组名称';
+COMMENT ON COLUMN sj_job_task_batch.job_id IS '任务id';
+COMMENT ON COLUMN sj_job_task_batch.workflow_node_id IS '工作流节点id';
+COMMENT ON COLUMN sj_job_task_batch.parent_workflow_node_id IS '工作流任务父批次id';
+COMMENT ON COLUMN sj_job_task_batch.workflow_task_batch_id IS '工作流任务批次id';
+COMMENT ON COLUMN sj_job_task_batch.task_batch_status IS '任务批次状态 0、失败 1、成功';
+COMMENT ON COLUMN sj_job_task_batch.operation_reason IS '操作原因';
+COMMENT ON COLUMN sj_job_task_batch.execution_at IS '任务执行时间';
+COMMENT ON COLUMN sj_job_task_batch.system_task_type IS '任务类型 3、JOB任务 4、WORKFLOW任务';
+COMMENT ON COLUMN sj_job_task_batch.parent_id IS '父节点';
+COMMENT ON COLUMN sj_job_task_batch.ext_attrs IS '扩展字段';
+COMMENT ON COLUMN sj_job_task_batch.deleted IS '逻辑删除 1、删除';
+COMMENT ON COLUMN sj_job_task_batch.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_job_task_batch.update_dt IS '修改时间';
+COMMENT ON TABLE sj_job_task_batch IS '任务批次';
+
+-- sj_job_summary
+CREATE TABLE sj_job_summary
+(
+ id bigserial PRIMARY KEY,
+ namespace_id varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
+ group_name varchar(64) NOT NULL DEFAULT '',
+ business_id bigint NOT NULL,
+ system_task_type smallint NOT NULL DEFAULT 3,
+ trigger_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ success_num int NOT NULL DEFAULT 0,
+ fail_num int NOT NULL DEFAULT 0,
+ fail_reason varchar(512) NOT NULL DEFAULT '',
+ stop_num int NOT NULL DEFAULT 0,
+ stop_reason varchar(512) NOT NULL DEFAULT '',
+ cancel_num int NOT NULL DEFAULT 0,
+ cancel_reason varchar(512) NOT NULL DEFAULT '',
+ create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ update_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
+);
+
+CREATE UNIQUE INDEX uk_sj_job_summary_01 ON sj_job_summary (trigger_at, system_task_type, business_id);
+
+CREATE INDEX idx_sj_job_summary_01 ON sj_job_summary (namespace_id, group_name, business_id);
+
+COMMENT ON COLUMN sj_job_summary.id IS '主键';
+COMMENT ON COLUMN sj_job_summary.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_job_summary.group_name IS '组名称';
+COMMENT ON COLUMN sj_job_summary.business_id IS '业务id ( job_id或workflow_id ) ';
+COMMENT ON COLUMN sj_job_summary.system_task_type IS '任务类型 3、JOB任务 4、WORKFLOW任务';
+COMMENT ON COLUMN sj_job_summary.trigger_at IS '统计时间';
+COMMENT ON COLUMN sj_job_summary.success_num IS '执行成功-日志数量';
+COMMENT ON COLUMN sj_job_summary.fail_num IS '执行失败-日志数量';
+COMMENT ON COLUMN sj_job_summary.fail_reason IS '失败原因';
+COMMENT ON COLUMN sj_job_summary.stop_num IS '执行失败-日志数量';
+COMMENT ON COLUMN sj_job_summary.stop_reason IS '失败原因';
+COMMENT ON COLUMN sj_job_summary.cancel_num IS '执行失败-日志数量';
+COMMENT ON COLUMN sj_job_summary.cancel_reason IS '失败原因';
+COMMENT ON COLUMN sj_job_summary.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_job_summary.update_dt IS '修改时间';
+COMMENT ON TABLE sj_job_summary IS 'DashBoard_Job';
+
+-- sj_retry_summary
+CREATE TABLE sj_retry_summary
+(
+ id bigserial PRIMARY KEY,
+ namespace_id varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
+ group_name varchar(64) NOT NULL DEFAULT '',
+ scene_name varchar(50) NOT NULL DEFAULT '',
+ trigger_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ running_num int NOT NULL DEFAULT 0,
+ finish_num int NOT NULL DEFAULT 0,
+ max_count_num int NOT NULL DEFAULT 0,
+ suspend_num int NOT NULL DEFAULT 0,
+ create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ update_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
+);
+
+CREATE UNIQUE INDEX uk_sj_retry_summary_01 ON sj_retry_summary (namespace_id, group_name, scene_name, trigger_at);
+
+CREATE INDEX idx_sj_retry_summary_01 ON sj_retry_summary (trigger_at);
+
+COMMENT ON COLUMN sj_retry_summary.id IS '主键';
+COMMENT ON COLUMN sj_retry_summary.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_retry_summary.group_name IS '组名称';
+COMMENT ON COLUMN sj_retry_summary.scene_name IS '场景名称';
+COMMENT ON COLUMN sj_retry_summary.trigger_at IS '统计时间';
+COMMENT ON COLUMN sj_retry_summary.running_num IS '重试中-日志数量';
+COMMENT ON COLUMN sj_retry_summary.finish_num IS '重试完成-日志数量';
+COMMENT ON COLUMN sj_retry_summary.max_count_num IS '重试到达最大次数-日志数量';
+COMMENT ON COLUMN sj_retry_summary.suspend_num IS '暂停重试-日志数量';
+COMMENT ON COLUMN sj_retry_summary.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_retry_summary.update_dt IS '修改时间';
+COMMENT ON TABLE sj_retry_summary IS 'DashBoard_Retry';
+
+-- sj_workflow
+CREATE TABLE sj_workflow
+(
+ id bigserial PRIMARY KEY,
+ workflow_name varchar(64) NOT NULL,
+ namespace_id varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
+ group_name varchar(64) NOT NULL,
+ workflow_status smallint NOT NULL DEFAULT 1,
+ trigger_type smallint NOT NULL,
+ trigger_interval varchar(255) NOT NULL,
+ next_trigger_at bigint NOT NULL,
+ block_strategy smallint NOT NULL DEFAULT 1,
+ executor_timeout int NOT NULL DEFAULT 0,
+ description varchar(256) NOT NULL DEFAULT '',
+ flow_info text NULL DEFAULT NULL,
+ bucket_index int NOT NULL DEFAULT 0,
+ version int NOT NULL,
+ ext_attrs varchar(256) NULL DEFAULT '',
+ deleted smallint NOT NULL DEFAULT 0,
+ create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ update_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
+);
+
+CREATE INDEX idx_sj_workflow_01 ON sj_workflow (create_dt);
+CREATE INDEX idx_sj_workflow_02 ON sj_workflow (namespace_id, group_name);
+
+COMMENT ON COLUMN sj_workflow.id IS '主键';
+COMMENT ON COLUMN sj_workflow.workflow_name IS '工作流名称';
+COMMENT ON COLUMN sj_workflow.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_workflow.group_name IS '组名称';
+COMMENT ON COLUMN sj_workflow.workflow_status IS '工作流状态 0、关闭、1、开启';
+COMMENT ON COLUMN sj_workflow.trigger_type IS '触发类型 1.CRON 表达式 2. 固定时间';
+COMMENT ON COLUMN sj_workflow.trigger_interval IS '间隔时长';
+COMMENT ON COLUMN sj_workflow.next_trigger_at IS '下次触发时间';
+COMMENT ON COLUMN sj_workflow.block_strategy IS '阻塞策略 1、丢弃 2、覆盖 3、并行';
+COMMENT ON COLUMN sj_workflow.executor_timeout IS '任务执行超时时间,单位秒';
+COMMENT ON COLUMN sj_workflow.description IS '描述';
+COMMENT ON COLUMN sj_workflow.flow_info IS '流程信息';
+COMMENT ON COLUMN sj_workflow.bucket_index IS 'bucket';
+COMMENT ON COLUMN sj_workflow.version IS '版本号';
+COMMENT ON COLUMN sj_workflow.ext_attrs IS '扩展字段';
+COMMENT ON COLUMN sj_workflow.deleted IS '逻辑删除 1、删除';
+COMMENT ON COLUMN sj_workflow.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_workflow.update_dt IS '修改时间';
+COMMENT ON TABLE sj_workflow IS '工作流';
+
+-- sj_workflow_node
+CREATE TABLE sj_workflow_node
+(
+ id bigserial PRIMARY KEY,
+ namespace_id varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
+ node_name varchar(64) NOT NULL,
+ group_name varchar(64) NOT NULL,
+ job_id bigint NOT NULL,
+ workflow_id bigint NOT NULL,
+ node_type smallint NOT NULL DEFAULT 1,
+ expression_type smallint NOT NULL DEFAULT 0,
+ fail_strategy smallint NOT NULL DEFAULT 1,
+ workflow_node_status smallint NOT NULL DEFAULT 1,
+ priority_level int NOT NULL DEFAULT 1,
+ node_info text NULL DEFAULT NULL,
+ version int NOT NULL,
+ ext_attrs varchar(256) NULL DEFAULT '',
+ deleted smallint NOT NULL DEFAULT 0,
+ create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ update_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
+);
+
+CREATE INDEX idx_sj_workflow_node_01 ON sj_workflow_node (create_dt);
+CREATE INDEX idx_sj_workflow_node_02 ON sj_workflow_node (namespace_id, group_name);
+
+COMMENT ON COLUMN sj_workflow_node.id IS '主键';
+COMMENT ON COLUMN sj_workflow_node.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_workflow_node.node_name IS '节点名称';
+COMMENT ON COLUMN sj_workflow_node.group_name IS '组名称';
+COMMENT ON COLUMN sj_workflow_node.job_id IS '任务信息id';
+COMMENT ON COLUMN sj_workflow_node.workflow_id IS '工作流ID';
+COMMENT ON COLUMN sj_workflow_node.node_type IS '1、任务节点 2、条件节点';
+COMMENT ON COLUMN sj_workflow_node.expression_type IS '1、SpEl、2、Aviator 3、QL';
+COMMENT ON COLUMN sj_workflow_node.fail_strategy IS '失败策略 1、跳过 2、阻塞';
+COMMENT ON COLUMN sj_workflow_node.workflow_node_status IS '工作流节点状态 0、关闭、1、开启';
+COMMENT ON COLUMN sj_workflow_node.priority_level IS '优先级';
+COMMENT ON COLUMN sj_workflow_node.node_info IS '节点信息 ';
+COMMENT ON COLUMN sj_workflow_node.version IS '版本号';
+COMMENT ON COLUMN sj_workflow_node.ext_attrs IS '扩展字段';
+COMMENT ON COLUMN sj_workflow_node.deleted IS '逻辑删除 1、删除';
+COMMENT ON COLUMN sj_workflow_node.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_workflow_node.update_dt IS '修改时间';
+COMMENT ON TABLE sj_workflow_node IS '工作流节点';
+
+-- sj_workflow_task_batch
+CREATE TABLE sj_workflow_task_batch
+(
+ id bigserial PRIMARY KEY,
+ namespace_id varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
+ group_name varchar(64) NOT NULL,
+ workflow_id bigint NOT NULL,
+ task_batch_status smallint NOT NULL DEFAULT 0,
+ operation_reason smallint NOT NULL DEFAULT 0,
+ flow_info text NULL DEFAULT NULL,
+ execution_at bigint NOT NULL DEFAULT 0,
+ ext_attrs varchar(256) NULL DEFAULT '',
+ deleted smallint NOT NULL DEFAULT 0,
+ create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ update_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
+);
+
+CREATE INDEX idx_sj_workflow_task_batch_01 ON sj_workflow_task_batch (workflow_id, task_batch_status);
+CREATE INDEX idx_sj_workflow_task_batch_02 ON sj_workflow_task_batch (create_dt);
+CREATE INDEX idx_sj_workflow_task_batch_03 ON sj_workflow_task_batch (namespace_id, group_name);
+
+COMMENT ON COLUMN sj_workflow_task_batch.id IS '主键';
+COMMENT ON COLUMN sj_workflow_task_batch.namespace_id IS '命名空间id';
+COMMENT ON COLUMN sj_workflow_task_batch.group_name IS '组名称';
+COMMENT ON COLUMN sj_workflow_task_batch.workflow_id IS '工作流任务id';
+COMMENT ON COLUMN sj_workflow_task_batch.task_batch_status IS '任务批次状态 0、失败 1、成功';
+COMMENT ON COLUMN sj_workflow_task_batch.operation_reason IS '操作原因';
+COMMENT ON COLUMN sj_workflow_task_batch.flow_info IS '流程信息';
+COMMENT ON COLUMN sj_workflow_task_batch.execution_at IS '任务执行时间';
+COMMENT ON COLUMN sj_workflow_task_batch.ext_attrs IS '扩展字段';
+COMMENT ON COLUMN sj_workflow_task_batch.deleted IS '逻辑删除 1、删除';
+COMMENT ON COLUMN sj_workflow_task_batch.create_dt IS '创建时间';
+COMMENT ON COLUMN sj_workflow_task_batch.update_dt IS '修改时间';
+COMMENT ON TABLE sj_workflow_task_batch IS '工作流批次';
+
diff --git a/continew-admin-extension/continew-admin-job-server/src/main/resources/db/changelogs/sqlserver/snail_job.sql b/continew-admin-extension/continew-admin-job-server/src/main/resources/db/changelogs/sqlserver/snail_job.sql
new file mode 100644
index 000000000..93efaa63b
--- /dev/null
+++ b/continew-admin-extension/continew-admin-job-server/src/main/resources/db/changelogs/sqlserver/snail_job.sql
@@ -0,0 +1,2685 @@
+-- liquibase formatted sql
+
+-- changeset snail-job-server:1
+-- sj_namespace
+CREATE TABLE sj_namespace
+(
+ id bigint NOT NULL PRIMARY KEY IDENTITY,
+ name nvarchar(64) NOT NULL,
+ unique_id nvarchar(64) NOT NULL,
+ description nvarchar(256) NOT NULL DEFAULT '',
+ deleted tinyint NOT NULL DEFAULT 0,
+ create_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ update_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP
+)
+GO
+
+CREATE INDEX idx_sj_namespace_01 ON sj_namespace (name)
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'主键',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_namespace',
+ 'COLUMN', N'id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'名称',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_namespace',
+ 'COLUMN', N'name'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'唯一id',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_namespace',
+ 'COLUMN', N'unique_id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'描述',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_namespace',
+ 'COLUMN', N'description'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'逻辑删除 1、删除',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_namespace',
+ 'COLUMN', N'deleted'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'创建时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_namespace',
+ 'COLUMN', N'create_dt'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'修改时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_namespace',
+ 'COLUMN', N'update_dt'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'命名空间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_namespace'
+GO
+
+INSERT INTO sj_namespace (name, unique_id, create_dt, update_dt, deleted)
+VALUES (N'Default', N'764d604ec6fc45f68cd92514c40e9e1a', getdate(), getdate(), 0)
+GO
+
+-- sj_group_config
+CREATE TABLE sj_group_config
+(
+ id bigint NOT NULL PRIMARY KEY IDENTITY,
+ namespace_id nvarchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
+ group_name nvarchar(64) NOT NULL DEFAULT '',
+ description nvarchar(256) NOT NULL DEFAULT '',
+ token nvarchar(64) NOT NULL DEFAULT 'SJ_cKqBTPzCsWA3VyuCfFoccmuIEGXjr5KT',
+ group_status tinyint NOT NULL DEFAULT 0,
+ version int NOT NULL,
+ group_partition int NOT NULL,
+ id_generator_mode tinyint NOT NULL DEFAULT 1,
+ init_scene tinyint NOT NULL DEFAULT 0,
+ bucket_index int NOT NULL DEFAULT 0,
+ create_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ update_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP
+)
+GO
+
+CREATE UNIQUE INDEX uk_sj_group_config_01 ON sj_group_config (namespace_id, group_name)
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'主键',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_group_config',
+ 'COLUMN', N'id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'命名空间id',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_group_config',
+ 'COLUMN', N'namespace_id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'组名称',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_group_config',
+ 'COLUMN', N'group_name'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'组描述',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_group_config',
+ 'COLUMN', N'description'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'token',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_group_config',
+ 'COLUMN', N'token'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'组状态 0、未启用 1、启用',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_group_config',
+ 'COLUMN', N'group_status'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'版本号',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_group_config',
+ 'COLUMN', N'version'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'分区',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_group_config',
+ 'COLUMN', N'group_partition'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'唯一id生成模式 默认号段模式',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_group_config',
+ 'COLUMN', N'id_generator_mode'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'是否初始化场景 0:否 1:是',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_group_config',
+ 'COLUMN', N'init_scene'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'bucket',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_group_config',
+ 'COLUMN', N'bucket_index'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'创建时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_group_config',
+ 'COLUMN', N'create_dt'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'修改时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_group_config',
+ 'COLUMN', N'update_dt'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'组配置',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_group_config'
+GO
+
+-- sj_notify_config
+CREATE TABLE sj_notify_config
+(
+ id bigint NOT NULL PRIMARY KEY IDENTITY,
+ namespace_id nvarchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
+ group_name nvarchar(64) NOT NULL,
+ business_id nvarchar(64) NOT NULL,
+ system_task_type tinyint NOT NULL DEFAULT 3,
+ notify_status tinyint NOT NULL DEFAULT 0,
+ recipient_ids nvarchar(128) NOT NULL,
+ notify_threshold int NOT NULL DEFAULT 0,
+ notify_scene tinyint NOT NULL DEFAULT 0,
+ rate_limiter_status tinyint NOT NULL DEFAULT 0,
+ rate_limiter_threshold int NOT NULL DEFAULT 0,
+ description nvarchar(256) NOT NULL DEFAULT '',
+ create_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ update_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP
+)
+GO
+
+CREATE INDEX idx_sj_notify_config_01 ON sj_notify_config (namespace_id, group_name, business_id)
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'主键',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_notify_config',
+ 'COLUMN', N'id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'命名空间id',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_notify_config',
+ 'COLUMN', N'namespace_id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'组名称',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_notify_config',
+ 'COLUMN', N'group_name'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'业务id ( job_id或workflow_id或scene_name ) ',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_notify_config',
+ 'COLUMN', N'business_id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'任务类型 1. 重试任务 2. 重试回调 3、JOB任务 4、WORKFLOW任务',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_notify_config',
+ 'COLUMN', N'system_task_type'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'通知状态 0、未启用 1、启用',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_notify_config',
+ 'COLUMN', N'notify_status'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'接收人id列表',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_notify_config',
+ 'COLUMN', N'recipient_ids'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'通知阈值',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_notify_config',
+ 'COLUMN', N'notify_threshold'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'通知场景',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_notify_config',
+ 'COLUMN', N'notify_scene'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'限流状态 0、未启用 1、启用',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_notify_config',
+ 'COLUMN', N'rate_limiter_status'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'每秒限流阈值',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_notify_config',
+ 'COLUMN', N'rate_limiter_threshold'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'描述',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_notify_config',
+ 'COLUMN', N'description'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'创建时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_notify_config',
+ 'COLUMN', N'create_dt'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'修改时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_notify_config',
+ 'COLUMN', N'update_dt'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'通知配置',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_notify_config'
+GO
+
+-- sj_notify_recipient
+CREATE TABLE sj_notify_recipient
+(
+ id bigint NOT NULL PRIMARY KEY IDENTITY,
+ namespace_id nvarchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
+ recipient_name nvarchar(64) NOT NULL,
+ notify_type tinyint NOT NULL DEFAULT 0,
+ notify_attribute nvarchar(512) NOT NULL,
+ description nvarchar(256) NOT NULL DEFAULT '',
+ create_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ update_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP
+)
+GO
+
+CREATE INDEX idx_sj_notify_recipient_01 ON sj_notify_recipient (namespace_id)
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'主键',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_notify_recipient',
+ 'COLUMN', N'id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'命名空间id',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_notify_recipient',
+ 'COLUMN', N'namespace_id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'接收人名称',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_notify_recipient',
+ 'COLUMN', N'recipient_name'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'通知类型 1、钉钉 2、邮件 3、企业微信 4 飞书 5 webhook',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_notify_recipient',
+ 'COLUMN', N'notify_type'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'配置属性',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_notify_recipient',
+ 'COLUMN', N'notify_attribute'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'描述',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_notify_recipient',
+ 'COLUMN', N'description'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'创建时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_notify_recipient',
+ 'COLUMN', N'create_dt'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'修改时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_notify_recipient',
+ 'COLUMN', N'update_dt'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'告警通知接收人',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_notify_recipient'
+GO
+
+-- sj_retry_dead_letter_0
+CREATE TABLE sj_retry_dead_letter_0
+(
+ id bigint NOT NULL PRIMARY KEY IDENTITY,
+ namespace_id nvarchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
+ unique_id nvarchar(64) NOT NULL,
+ group_name nvarchar(64) NOT NULL,
+ scene_name nvarchar(64) NOT NULL,
+ idempotent_id nvarchar(64) NOT NULL,
+ biz_no nvarchar(64) NOT NULL DEFAULT '',
+ executor_name nvarchar(512) NOT NULL DEFAULT '',
+ args_str nvarchar(max) NOT NULL,
+ ext_attrs nvarchar(max) NOT NULL,
+ task_type tinyint NOT NULL DEFAULT 1,
+ create_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP
+)
+GO
+
+CREATE UNIQUE INDEX uk_sj_retry_dead_letter_0_01 ON sj_retry_dead_letter_0 (namespace_id, group_name, unique_id)
+GO
+
+CREATE INDEX idx_sj_retry_dead_letter_0_01 ON sj_retry_dead_letter_0 (namespace_id, group_name, scene_name)
+GO
+CREATE INDEX idx_sj_retry_dead_letter_0_02 ON sj_retry_dead_letter_0 (idempotent_id)
+GO
+CREATE INDEX idx_sj_retry_dead_letter_0_03 ON sj_retry_dead_letter_0 (biz_no)
+GO
+CREATE INDEX idx_sj_retry_dead_letter_0_04 ON sj_retry_dead_letter_0 (create_dt)
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'主键',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_dead_letter_0',
+ 'COLUMN', N'id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'命名空间id',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_dead_letter_0',
+ 'COLUMN', N'namespace_id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'同组下id唯一',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_dead_letter_0',
+ 'COLUMN', N'unique_id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'组名称',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_dead_letter_0',
+ 'COLUMN', N'group_name'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'场景名称',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_dead_letter_0',
+ 'COLUMN', N'scene_name'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'幂等id',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_dead_letter_0',
+ 'COLUMN', N'idempotent_id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'业务编号',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_dead_letter_0',
+ 'COLUMN', N'biz_no'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'执行器名称',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_dead_letter_0',
+ 'COLUMN', N'executor_name'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'执行方法参数',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_dead_letter_0',
+ 'COLUMN', N'args_str'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'扩展字段',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_dead_letter_0',
+ 'COLUMN', N'ext_attrs'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'任务类型 1、重试数据 2、回调数据',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_dead_letter_0',
+ 'COLUMN', N'task_type'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'创建时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_dead_letter_0',
+ 'COLUMN', N'create_dt'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'死信队列表',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_dead_letter_0'
+GO
+
+-- sj_retry_task_0
+CREATE TABLE sj_retry_task_0
+(
+ id bigint NOT NULL PRIMARY KEY IDENTITY,
+ namespace_id nvarchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
+ unique_id nvarchar(64) NOT NULL,
+ group_name nvarchar(64) NOT NULL,
+ scene_name nvarchar(64) NOT NULL,
+ idempotent_id nvarchar(64) NOT NULL,
+ biz_no nvarchar(64) NOT NULL DEFAULT '',
+ executor_name nvarchar(512) NOT NULL DEFAULT '',
+ args_str nvarchar(max) NOT NULL,
+ ext_attrs nvarchar(max) NOT NULL,
+ next_trigger_at datetime2 NOT NULL,
+ retry_count int NOT NULL DEFAULT 0,
+ retry_status tinyint NOT NULL DEFAULT 0,
+ task_type tinyint NOT NULL DEFAULT 1,
+ create_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ update_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP
+)
+GO
+
+CREATE UNIQUE INDEX uk_sj_retry_task_0_01 ON sj_retry_task_0 (namespace_id, group_name, unique_id)
+GO
+
+CREATE INDEX idx_sj_retry_task_0_01 ON sj_retry_task_0 (namespace_id, group_name, scene_name)
+GO
+CREATE INDEX idx_sj_retry_task_0_02 ON sj_retry_task_0 (namespace_id, group_name, task_type)
+GO
+CREATE INDEX idx_sj_retry_task_0_03 ON sj_retry_task_0 (namespace_id, group_name, retry_status)
+GO
+CREATE INDEX idx_sj_retry_task_0_04 ON sj_retry_task_0 (idempotent_id)
+GO
+CREATE INDEX idx_sj_retry_task_0_05 ON sj_retry_task_0 (biz_no)
+GO
+CREATE INDEX idx_sj_retry_task_0_06 ON sj_retry_task_0 (create_dt)
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'主键',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_task_0',
+ 'COLUMN', N'id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'命名空间id',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_task_0',
+ 'COLUMN', N'namespace_id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'同组下id唯一',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_task_0',
+ 'COLUMN', N'unique_id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'组名称',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_task_0',
+ 'COLUMN', N'group_name'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'场景名称',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_task_0',
+ 'COLUMN', N'scene_name'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'幂等id',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_task_0',
+ 'COLUMN', N'idempotent_id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'业务编号',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_task_0',
+ 'COLUMN', N'biz_no'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'执行器名称',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_task_0',
+ 'COLUMN', N'executor_name'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'执行方法参数',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_task_0',
+ 'COLUMN', N'args_str'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'扩展字段',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_task_0',
+ 'COLUMN', N'ext_attrs'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'下次触发时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_task_0',
+ 'COLUMN', N'next_trigger_at'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'重试次数',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_task_0',
+ 'COLUMN', N'retry_count'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'重试状态 0、重试中 1、成功 2、最大重试次数',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_task_0',
+ 'COLUMN', N'retry_status'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'任务类型 1、重试数据 2、回调数据',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_task_0',
+ 'COLUMN', N'task_type'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'创建时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_task_0',
+ 'COLUMN', N'create_dt'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'修改时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_task_0',
+ 'COLUMN', N'update_dt'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'任务表',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_task_0'
+GO
+
+-- sj_retry_task_log
+CREATE TABLE sj_retry_task_log
+(
+ id bigint NOT NULL PRIMARY KEY IDENTITY,
+ namespace_id nvarchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
+ unique_id nvarchar(64) NOT NULL,
+ group_name nvarchar(64) NOT NULL,
+ scene_name nvarchar(64) NOT NULL,
+ idempotent_id nvarchar(64) NOT NULL,
+ biz_no nvarchar(64) NOT NULL DEFAULT '',
+ executor_name nvarchar(512) NOT NULL DEFAULT '',
+ args_str nvarchar(max) NOT NULL,
+ ext_attrs nvarchar(max) NOT NULL,
+ retry_status tinyint NOT NULL DEFAULT 0,
+ task_type tinyint NOT NULL DEFAULT 1,
+ create_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ update_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP
+)
+GO
+
+CREATE INDEX idx_sj_retry_task_log_01 ON sj_retry_task_log (namespace_id, group_name, scene_name)
+GO
+CREATE INDEX idx_sj_retry_task_log_02 ON sj_retry_task_log (retry_status)
+GO
+CREATE INDEX idx_sj_retry_task_log_03 ON sj_retry_task_log (idempotent_id)
+GO
+CREATE INDEX idx_sj_retry_task_log_04 ON sj_retry_task_log (unique_id)
+GO
+CREATE INDEX idx_sj_retry_task_log_05 ON sj_retry_task_log (biz_no)
+GO
+CREATE INDEX idx_sj_retry_task_log_06 ON sj_retry_task_log (create_dt)
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'主键',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_task_log',
+ 'COLUMN', N'id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'命名空间id',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_task_log',
+ 'COLUMN', N'namespace_id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'同组下id唯一',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_task_log',
+ 'COLUMN', N'unique_id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'组名称',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_task_log',
+ 'COLUMN', N'group_name'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'场景名称',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_task_log',
+ 'COLUMN', N'scene_name'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'幂等id',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_task_log',
+ 'COLUMN', N'idempotent_id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'业务编号',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_task_log',
+ 'COLUMN', N'biz_no'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'执行器名称',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_task_log',
+ 'COLUMN', N'executor_name'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'执行方法参数',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_task_log',
+ 'COLUMN', N'args_str'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'扩展字段',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_task_log',
+ 'COLUMN', N'ext_attrs'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'重试状态 0、重试中 1、成功 2、最大次数',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_task_log',
+ 'COLUMN', N'retry_status'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'任务类型 1、重试数据 2、回调数据',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_task_log',
+ 'COLUMN', N'task_type'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'创建时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_task_log',
+ 'COLUMN', N'create_dt'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'修改时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_task_log',
+ 'COLUMN', N'update_dt'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'任务日志基础信息表',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_task_log'
+GO
+
+-- sj_retry_task_log_message
+CREATE TABLE sj_retry_task_log_message
+(
+ id bigint NOT NULL PRIMARY KEY IDENTITY,
+ namespace_id nvarchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
+ group_name nvarchar(64) NOT NULL,
+ unique_id nvarchar(64) NOT NULL,
+ message nvarchar(max) NOT NULL,
+ log_num int NOT NULL DEFAULT 1,
+ real_time bigint NOT NULL DEFAULT 0,
+ create_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP
+)
+GO
+
+CREATE INDEX idx_sj_retry_task_log_message_01 ON sj_retry_task_log_message (namespace_id, group_name, unique_id)
+GO
+CREATE INDEX idx_sj_retry_task_log_message_02 ON sj_retry_task_log_message (create_dt)
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'主键',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_task_log_message',
+ 'COLUMN', N'id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'命名空间id',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_task_log_message',
+ 'COLUMN', N'namespace_id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'组名称',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_task_log_message',
+ 'COLUMN', N'group_name'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'同组下id唯一',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_task_log_message',
+ 'COLUMN', N'unique_id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'异常信息',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_task_log_message',
+ 'COLUMN', N'message'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'日志数量',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_task_log_message',
+ 'COLUMN', N'log_num'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'上报时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_task_log_message',
+ 'COLUMN', N'real_time'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'创建时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_task_log_message',
+ 'COLUMN', N'create_dt'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'任务调度日志信息记录表',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_task_log_message'
+GO
+
+-- sj_retry_scene_config
+CREATE TABLE sj_retry_scene_config
+(
+ id bigint NOT NULL PRIMARY KEY IDENTITY,
+ namespace_id nvarchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
+ scene_name nvarchar(64) NOT NULL,
+ group_name nvarchar(64) NOT NULL,
+ scene_status tinyint NOT NULL DEFAULT 0,
+ max_retry_count int NOT NULL DEFAULT 5,
+ back_off tinyint NOT NULL DEFAULT 1,
+ trigger_interval nvarchar(16) NOT NULL DEFAULT '',
+ deadline_request bigint NOT NULL DEFAULT 60000,
+ executor_timeout int NOT NULL DEFAULT 5,
+ route_key tinyint NOT NULL DEFAULT 4,
+ description nvarchar(256) NOT NULL DEFAULT '',
+ create_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ update_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP
+)
+GO
+
+CREATE UNIQUE INDEX uk_sj_retry_scene_config_01 ON sj_retry_scene_config (namespace_id, group_name, scene_name)
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'主键',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_scene_config',
+ 'COLUMN', N'id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'命名空间id',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_scene_config',
+ 'COLUMN', N'namespace_id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'场景名称',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_scene_config',
+ 'COLUMN', N'scene_name'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'组名称',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_scene_config',
+ 'COLUMN', N'group_name'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'组状态 0、未启用 1、启用',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_scene_config',
+ 'COLUMN', N'scene_status'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'最大重试次数',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_scene_config',
+ 'COLUMN', N'max_retry_count'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'1、默认等级 2、固定间隔时间 3、CRON 表达式',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_scene_config',
+ 'COLUMN', N'back_off'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'间隔时长',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_scene_config',
+ 'COLUMN', N'trigger_interval'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'Deadline Request 调用链超时 单位毫秒',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_scene_config',
+ 'COLUMN', N'deadline_request'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'任务执行超时时间,单位秒',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_scene_config',
+ 'COLUMN', N'executor_timeout'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'路由策略',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_scene_config',
+ 'COLUMN', N'route_key'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'描述',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_scene_config',
+ 'COLUMN', N'description'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'创建时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_scene_config',
+ 'COLUMN', N'create_dt'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'修改时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_scene_config',
+ 'COLUMN', N'update_dt'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'场景配置',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_scene_config'
+GO
+
+-- sj_server_node
+CREATE TABLE sj_server_node
+(
+ id bigint NOT NULL PRIMARY KEY IDENTITY,
+ namespace_id nvarchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
+ group_name nvarchar(64) NOT NULL,
+ host_id nvarchar(64) NOT NULL,
+ host_ip nvarchar(64) NOT NULL,
+ host_port int NOT NULL,
+ expire_at datetime2 NOT NULL,
+ node_type tinyint NOT NULL,
+ ext_attrs nvarchar(256) NULL DEFAULT '',
+ create_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ update_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP
+)
+GO
+
+CREATE UNIQUE INDEX uk_sj_server_node_01 ON sj_server_node (host_id, host_ip)
+GO
+
+CREATE INDEX idx_sj_server_node_01 ON sj_server_node (namespace_id, group_name)
+GO
+CREATE INDEX idx_sj_server_node_02 ON sj_server_node (expire_at, node_type)
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'主键',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_server_node',
+ 'COLUMN', N'id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'命名空间id',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_server_node',
+ 'COLUMN', N'namespace_id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'组名称',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_server_node',
+ 'COLUMN', N'group_name'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'主机id',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_server_node',
+ 'COLUMN', N'host_id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'机器ip',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_server_node',
+ 'COLUMN', N'host_ip'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'机器端口',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_server_node',
+ 'COLUMN', N'host_port'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'过期时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_server_node',
+ 'COLUMN', N'expire_at'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'节点类型 1、客户端 2、是服务端',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_server_node',
+ 'COLUMN', N'node_type'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'扩展字段',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_server_node',
+ 'COLUMN', N'ext_attrs'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'创建时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_server_node',
+ 'COLUMN', N'create_dt'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'修改时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_server_node',
+ 'COLUMN', N'update_dt'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'服务器节点',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_server_node'
+GO
+
+-- sj_distributed_lock
+CREATE TABLE sj_distributed_lock
+(
+ id bigint NOT NULL PRIMARY KEY IDENTITY,
+ name nvarchar(64) NOT NULL,
+ lock_until datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ locked_at datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ locked_by nvarchar(255) NOT NULL,
+ create_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ update_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP
+)
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'主键',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_distributed_lock',
+ 'COLUMN', N'id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'锁名称',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_distributed_lock',
+ 'COLUMN', N'name'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'锁定时长',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_distributed_lock',
+ 'COLUMN', N'lock_until'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'锁定时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_distributed_lock',
+ 'COLUMN', N'locked_at'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'锁定者',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_distributed_lock',
+ 'COLUMN', N'locked_by'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'创建时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_distributed_lock',
+ 'COLUMN', N'create_dt'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'修改时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_distributed_lock',
+ 'COLUMN', N'update_dt'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'锁定表',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_distributed_lock'
+GO
+
+-- sj_system_user
+CREATE TABLE sj_system_user
+(
+ id bigint NOT NULL PRIMARY KEY IDENTITY,
+ username nvarchar(64) NOT NULL,
+ password nvarchar(128) NOT NULL,
+ role tinyint NOT NULL DEFAULT 0,
+ create_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ update_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP
+)
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'主键',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_system_user',
+ 'COLUMN', N'id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'账号',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_system_user',
+ 'COLUMN', N'username'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'密码',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_system_user',
+ 'COLUMN', N'password'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'角色:1-普通用户、2-管理员',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_system_user',
+ 'COLUMN', N'role'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'创建时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_system_user',
+ 'COLUMN', N'create_dt'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'修改时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_system_user',
+ 'COLUMN', N'update_dt'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'系统用户表',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_system_user'
+GO
+
+INSERT INTO sj_system_user (username, password, role)
+VALUES (N'admin', N'465c194afb65670f38322df087f0a9bb225cc257e43eb4ac5a0c98ef5b3173ac', 2)
+GO
+
+-- sj_system_user_permission
+CREATE TABLE sj_system_user_permission
+(
+ id bigint NOT NULL PRIMARY KEY IDENTITY,
+ group_name nvarchar(64) NOT NULL,
+ namespace_id nvarchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
+ system_user_id bigint NOT NULL,
+ create_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ update_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP
+)
+GO
+
+CREATE UNIQUE INDEX uk_sj_system_user_permission_01 ON sj_system_user_permission (namespace_id, group_name, system_user_id)
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'主键',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_system_user_permission',
+ 'COLUMN', N'id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'组名称',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_system_user_permission',
+ 'COLUMN', N'group_name'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'命名空间id',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_system_user_permission',
+ 'COLUMN', N'namespace_id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'系统用户id',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_system_user_permission',
+ 'COLUMN', N'system_user_id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'创建时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_system_user_permission',
+ 'COLUMN', N'create_dt'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'修改时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_system_user_permission',
+ 'COLUMN', N'update_dt'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'系统用户权限表',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_system_user_permission'
+GO
+
+-- sj_sequence_alloc
+CREATE TABLE sj_sequence_alloc
+(
+ id bigint NOT NULL PRIMARY KEY IDENTITY,
+ namespace_id nvarchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
+ group_name nvarchar(64) NOT NULL DEFAULT '',
+ max_id bigint NOT NULL DEFAULT 1,
+ step int NOT NULL DEFAULT 100,
+ update_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP
+)
+GO
+
+CREATE UNIQUE INDEX uk_sj_sequence_alloc_01 ON sj_sequence_alloc (namespace_id, group_name)
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'主键',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_sequence_alloc',
+ 'COLUMN', N'id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'命名空间id',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_sequence_alloc',
+ 'COLUMN', N'namespace_id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'组名称',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_sequence_alloc',
+ 'COLUMN', N'group_name'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'最大id',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_sequence_alloc',
+ 'COLUMN', N'max_id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'步长',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_sequence_alloc',
+ 'COLUMN', N'step'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'更新时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_sequence_alloc',
+ 'COLUMN', N'update_dt'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'号段模式序号ID分配表',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_sequence_alloc'
+GO
+
+-- sj_job
+CREATE TABLE sj_job
+(
+ id bigint NOT NULL PRIMARY KEY IDENTITY,
+ namespace_id nvarchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
+ group_name nvarchar(64) NOT NULL,
+ job_name nvarchar(64) NOT NULL,
+ args_str nvarchar(max) NULL DEFAULT NULL,
+ args_type tinyint NOT NULL DEFAULT 1,
+ next_trigger_at bigint NOT NULL,
+ job_status tinyint NOT NULL DEFAULT 1,
+ task_type tinyint NOT NULL DEFAULT 1,
+ route_key tinyint NOT NULL DEFAULT 4,
+ executor_type tinyint NOT NULL DEFAULT 1,
+ executor_info nvarchar(255) NULL DEFAULT NULL,
+ trigger_type tinyint NOT NULL,
+ trigger_interval nvarchar(255) NOT NULL,
+ block_strategy tinyint NOT NULL DEFAULT 1,
+ executor_timeout int NOT NULL DEFAULT 0,
+ max_retry_times int NOT NULL DEFAULT 0,
+ parallel_num int NOT NULL DEFAULT 1,
+ retry_interval int NOT NULL DEFAULT 0,
+ bucket_index int NOT NULL DEFAULT 0,
+ resident tinyint NOT NULL DEFAULT 0,
+ description nvarchar(256) NOT NULL DEFAULT '',
+ ext_attrs nvarchar(256) NULL DEFAULT '',
+ deleted tinyint NOT NULL DEFAULT 0,
+ create_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ update_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP
+)
+GO
+
+CREATE INDEX idx_sj_job_01 ON sj_job (namespace_id, group_name)
+GO
+CREATE INDEX idx_sj_job_02 ON sj_job (job_status, bucket_index)
+GO
+CREATE INDEX idx_sj_job_03 ON sj_job (create_dt)
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'主键',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job',
+ 'COLUMN', N'id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'命名空间id',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job',
+ 'COLUMN', N'namespace_id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'组名称',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job',
+ 'COLUMN', N'group_name'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'名称',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job',
+ 'COLUMN', N'job_name'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'执行方法参数',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job',
+ 'COLUMN', N'args_str'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'参数类型 ',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job',
+ 'COLUMN', N'args_type'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'下次触发时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job',
+ 'COLUMN', N'next_trigger_at'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'任务状态 0、关闭、1、开启',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job',
+ 'COLUMN', N'job_status'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'任务类型 1、集群 2、广播 3、切片',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job',
+ 'COLUMN', N'task_type'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'路由策略',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job',
+ 'COLUMN', N'route_key'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'执行器类型',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job',
+ 'COLUMN', N'executor_type'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'执行器名称',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job',
+ 'COLUMN', N'executor_info'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'触发类型 1.CRON 表达式 2. 固定时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job',
+ 'COLUMN', N'trigger_type'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'间隔时长',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job',
+ 'COLUMN', N'trigger_interval'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'阻塞策略 1、丢弃 2、覆盖 3、并行',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job',
+ 'COLUMN', N'block_strategy'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'任务执行超时时间,单位秒',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job',
+ 'COLUMN', N'executor_timeout'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'最大重试次数',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job',
+ 'COLUMN', N'max_retry_times'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'并行数',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job',
+ 'COLUMN', N'parallel_num'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'重试间隔 ( s ) ',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job',
+ 'COLUMN', N'retry_interval'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'bucket',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job',
+ 'COLUMN', N'bucket_index'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'是否是常驻任务',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job',
+ 'COLUMN', N'resident'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'描述',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job',
+ 'COLUMN', N'description'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'扩展字段',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job',
+ 'COLUMN', N'ext_attrs'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'逻辑删除 1、删除',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job',
+ 'COLUMN', N'deleted'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'创建时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job',
+ 'COLUMN', N'create_dt'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'修改时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job',
+ 'COLUMN', N'update_dt'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'任务信息',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job'
+GO
+
+-- sj_job_log_message
+CREATE TABLE sj_job_log_message
+(
+ id bigint NOT NULL PRIMARY KEY IDENTITY,
+ namespace_id nvarchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
+ group_name nvarchar(64) NOT NULL,
+ job_id bigint NOT NULL,
+ task_batch_id bigint NOT NULL,
+ task_id bigint NOT NULL,
+ message nvarchar(max) NOT NULL,
+ log_num int NOT NULL DEFAULT 1,
+ real_time bigint NOT NULL DEFAULT 0,
+ ext_attrs nvarchar(256) NULL DEFAULT '',
+ create_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP
+)
+GO
+
+CREATE INDEX idx_sj_job_log_message_01 ON sj_job_log_message (task_batch_id, task_id)
+GO
+CREATE INDEX idx_sj_job_log_message_02 ON sj_job_log_message (create_dt)
+GO
+CREATE INDEX idx_sj_job_log_message_03 ON sj_job_log_message (namespace_id, group_name)
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'主键',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_log_message',
+ 'COLUMN', N'id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'命名空间id',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_log_message',
+ 'COLUMN', N'namespace_id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'组名称',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_log_message',
+ 'COLUMN', N'group_name'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'任务信息id',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_log_message',
+ 'COLUMN', N'job_id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'任务批次id',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_log_message',
+ 'COLUMN', N'task_batch_id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'调度任务id',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_log_message',
+ 'COLUMN', N'task_id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'调度信息',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_log_message',
+ 'COLUMN', N'message'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'日志数量',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_log_message',
+ 'COLUMN', N'log_num'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'上报时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_log_message',
+ 'COLUMN', N'real_time'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'扩展字段',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_log_message',
+ 'COLUMN', N'ext_attrs'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'创建时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_log_message',
+ 'COLUMN', N'create_dt'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'调度日志',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_log_message'
+GO
+
+-- sj_job_task
+CREATE TABLE sj_job_task
+(
+ id bigint NOT NULL PRIMARY KEY IDENTITY,
+ namespace_id nvarchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
+ group_name nvarchar(64) NOT NULL,
+ job_id bigint NOT NULL,
+ task_batch_id bigint NOT NULL,
+ parent_id bigint NOT NULL DEFAULT 0,
+ task_status tinyint NOT NULL DEFAULT 0,
+ retry_count int NOT NULL DEFAULT 0,
+ client_info nvarchar(128) NULL DEFAULT NULL,
+ result_message nvarchar(max) NOT NULL,
+ args_str nvarchar(max) NULL DEFAULT NULL,
+ args_type tinyint NOT NULL DEFAULT 1,
+ ext_attrs nvarchar(256) NULL DEFAULT '',
+ create_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ update_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP
+)
+GO
+
+CREATE INDEX idx_sj_job_task_01 ON sj_job_task (task_batch_id, task_status)
+GO
+CREATE INDEX idx_sj_job_task_02 ON sj_job_task (create_dt)
+GO
+CREATE INDEX idx_sj_job_task_03 ON sj_job_task (namespace_id, group_name)
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'主键',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_task',
+ 'COLUMN', N'id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'命名空间id',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_task',
+ 'COLUMN', N'namespace_id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'组名称',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_task',
+ 'COLUMN', N'group_name'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'任务信息id',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_task',
+ 'COLUMN', N'job_id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'调度任务id',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_task',
+ 'COLUMN', N'task_batch_id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'父执行器id',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_task',
+ 'COLUMN', N'parent_id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'执行的状态 0、失败 1、成功',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_task',
+ 'COLUMN', N'task_status'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'重试次数',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_task',
+ 'COLUMN', N'retry_count'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'客户端地址 clientId#ip:port',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_task',
+ 'COLUMN', N'client_info'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'执行结果',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_task',
+ 'COLUMN', N'result_message'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'执行方法参数',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_task',
+ 'COLUMN', N'args_str'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'参数类型 ',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_task',
+ 'COLUMN', N'args_type'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'扩展字段',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_task',
+ 'COLUMN', N'ext_attrs'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'创建时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_task',
+ 'COLUMN', N'create_dt'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'修改时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_task',
+ 'COLUMN', N'update_dt'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'任务实例',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_task'
+GO
+
+-- sj_job_task_batch
+CREATE TABLE sj_job_task_batch
+(
+ id bigint NOT NULL PRIMARY KEY IDENTITY,
+ namespace_id nvarchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
+ group_name nvarchar(64) NOT NULL,
+ job_id bigint NOT NULL,
+ workflow_node_id bigint NOT NULL DEFAULT 0,
+ parent_workflow_node_id bigint NOT NULL DEFAULT 0,
+ workflow_task_batch_id bigint NOT NULL DEFAULT 0,
+ task_batch_status tinyint NOT NULL DEFAULT 0,
+ operation_reason tinyint NOT NULL DEFAULT 0,
+ execution_at bigint NOT NULL DEFAULT 0,
+ system_task_type tinyint NOT NULL DEFAULT 3,
+ parent_id nvarchar(64) NOT NULL DEFAULT '',
+ ext_attrs nvarchar(256) NULL DEFAULT '',
+ deleted tinyint NOT NULL DEFAULT 0,
+ create_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ update_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP
+)
+GO
+
+CREATE INDEX idx_sj_job_task_batch_01 ON sj_job_task_batch (job_id, task_batch_status)
+GO
+CREATE INDEX idx_sj_job_task_batch_02 ON sj_job_task_batch (create_dt)
+GO
+CREATE INDEX idx_sj_job_task_batch_03 ON sj_job_task_batch (namespace_id, group_name)
+GO
+CREATE INDEX idx_sj_job_task_batch_04 ON sj_job_task_batch (workflow_task_batch_id, workflow_node_id)
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'主键',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_task_batch',
+ 'COLUMN', N'id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'命名空间id',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_task_batch',
+ 'COLUMN', N'namespace_id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'组名称',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_task_batch',
+ 'COLUMN', N'group_name'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'任务id',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_task_batch',
+ 'COLUMN', N'job_id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'工作流节点id',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_task_batch',
+ 'COLUMN', N'workflow_node_id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'工作流任务父批次id',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_task_batch',
+ 'COLUMN', N'parent_workflow_node_id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'工作流任务批次id',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_task_batch',
+ 'COLUMN', N'workflow_task_batch_id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'任务批次状态 0、失败 1、成功',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_task_batch',
+ 'COLUMN', N'task_batch_status'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'操作原因',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_task_batch',
+ 'COLUMN', N'operation_reason'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'任务执行时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_task_batch',
+ 'COLUMN', N'execution_at'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'任务类型 3、JOB任务 4、WORKFLOW任务',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_task_batch',
+ 'COLUMN', N'system_task_type'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'父节点',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_task_batch',
+ 'COLUMN', N'parent_id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'扩展字段',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_task_batch',
+ 'COLUMN', N'ext_attrs'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'逻辑删除 1、删除',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_task_batch',
+ 'COLUMN', N'deleted'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'创建时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_task_batch',
+ 'COLUMN', N'create_dt'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'修改时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_task_batch',
+ 'COLUMN', N'update_dt'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'任务批次',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_task_batch'
+GO
+
+-- sj_job_summary
+CREATE TABLE sj_job_summary
+(
+ id bigint NOT NULL PRIMARY KEY IDENTITY,
+ namespace_id nvarchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
+ group_name nvarchar(64) NOT NULL DEFAULT '',
+ business_id bigint NOT NULL,
+ system_task_type tinyint NOT NULL DEFAULT 3,
+ trigger_at datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ success_num int NOT NULL DEFAULT 0,
+ fail_num int NOT NULL DEFAULT 0,
+ fail_reason nvarchar(512) NOT NULL DEFAULT '',
+ stop_num int NOT NULL DEFAULT 0,
+ stop_reason nvarchar(512) NOT NULL DEFAULT '',
+ cancel_num int NOT NULL DEFAULT 0,
+ cancel_reason nvarchar(512) NOT NULL DEFAULT '',
+ create_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ update_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP
+)
+GO
+
+CREATE UNIQUE INDEX uk_sj_job_summary_01 ON sj_job_summary (trigger_at, system_task_type, business_id)
+GO
+
+CREATE INDEX idx_sj_job_summary_01 ON sj_job_summary (namespace_id, group_name, business_id)
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'主键',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_summary',
+ 'COLUMN', N'id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'命名空间id',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_summary',
+ 'COLUMN', N'namespace_id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'组名称',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_summary',
+ 'COLUMN', N'group_name'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'业务id ( job_id或workflow_id ) ',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_summary',
+ 'COLUMN', N'business_id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'任务类型 3、JOB任务 4、WORKFLOW任务',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_summary',
+ 'COLUMN', N'system_task_type'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'统计时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_summary',
+ 'COLUMN', N'trigger_at'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'执行成功-日志数量',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_summary',
+ 'COLUMN', N'success_num'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'执行失败-日志数量',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_summary',
+ 'COLUMN', N'fail_num'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'失败原因',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_summary',
+ 'COLUMN', N'fail_reason'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'执行失败-日志数量',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_summary',
+ 'COLUMN', N'stop_num'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'失败原因',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_summary',
+ 'COLUMN', N'stop_reason'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'执行失败-日志数量',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_summary',
+ 'COLUMN', N'cancel_num'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'失败原因',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_summary',
+ 'COLUMN', N'cancel_reason'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'创建时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_summary',
+ 'COLUMN', N'create_dt'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'修改时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_summary',
+ 'COLUMN', N'update_dt'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'DashBoard_Job',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_job_summary'
+GO
+
+-- sj_retry_summary
+CREATE TABLE sj_retry_summary
+(
+ id bigint NOT NULL PRIMARY KEY IDENTITY,
+ namespace_id nvarchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
+ group_name nvarchar(64) NOT NULL DEFAULT '',
+ scene_name nvarchar(50) NOT NULL DEFAULT '',
+ trigger_at datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ running_num int NOT NULL DEFAULT 0,
+ finish_num int NOT NULL DEFAULT 0,
+ max_count_num int NOT NULL DEFAULT 0,
+ suspend_num int NOT NULL DEFAULT 0,
+ create_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ update_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP
+)
+GO
+
+CREATE UNIQUE INDEX uk_sj_retry_summary_01 ON sj_retry_summary (namespace_id, group_name, scene_name, trigger_at)
+GO
+
+CREATE INDEX idx_sj_retry_summary_01 ON sj_retry_summary (trigger_at)
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'主键',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_summary',
+ 'COLUMN', N'id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'命名空间id',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_summary',
+ 'COLUMN', N'namespace_id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'组名称',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_summary',
+ 'COLUMN', N'group_name'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'场景名称',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_summary',
+ 'COLUMN', N'scene_name'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'统计时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_summary',
+ 'COLUMN', N'trigger_at'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'重试中-日志数量',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_summary',
+ 'COLUMN', N'running_num'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'重试完成-日志数量',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_summary',
+ 'COLUMN', N'finish_num'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'重试到达最大次数-日志数量',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_summary',
+ 'COLUMN', N'max_count_num'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'暂停重试-日志数量',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_summary',
+ 'COLUMN', N'suspend_num'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'创建时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_summary',
+ 'COLUMN', N'create_dt'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'修改时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_summary',
+ 'COLUMN', N'update_dt'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'DashBoard_Retry',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_retry_summary'
+GO
+
+-- sj_workflow
+CREATE TABLE sj_workflow
+(
+ id bigint NOT NULL PRIMARY KEY IDENTITY,
+ workflow_name nvarchar(64) NOT NULL,
+ namespace_id nvarchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
+ group_name nvarchar(64) NOT NULL,
+ workflow_status tinyint NOT NULL DEFAULT 1,
+ trigger_type tinyint NOT NULL,
+ trigger_interval nvarchar(255) NOT NULL,
+ next_trigger_at bigint NOT NULL,
+ block_strategy tinyint NOT NULL DEFAULT 1,
+ executor_timeout int NOT NULL DEFAULT 0,
+ description nvarchar(256) NOT NULL DEFAULT '',
+ flow_info nvarchar(max) NULL DEFAULT NULL,
+ bucket_index int NOT NULL DEFAULT 0,
+ version int NOT NULL,
+ ext_attrs nvarchar(256) NULL DEFAULT '',
+ deleted tinyint NOT NULL DEFAULT 0,
+ create_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ update_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP
+)
+GO
+
+CREATE INDEX idx_sj_workflow_01 ON sj_workflow (create_dt)
+GO
+CREATE INDEX idx_sj_workflow_02 ON sj_workflow (namespace_id, group_name)
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'主键',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow',
+ 'COLUMN', N'id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'工作流名称',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow',
+ 'COLUMN', N'workflow_name'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'命名空间id',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow',
+ 'COLUMN', N'namespace_id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'组名称',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow',
+ 'COLUMN', N'group_name'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'工作流状态 0、关闭、1、开启',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow',
+ 'COLUMN', N'workflow_status'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'触发类型 1.CRON 表达式 2. 固定时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow',
+ 'COLUMN', N'trigger_type'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'间隔时长',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow',
+ 'COLUMN', N'trigger_interval'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'下次触发时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow',
+ 'COLUMN', N'next_trigger_at'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'阻塞策略 1、丢弃 2、覆盖 3、并行',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow',
+ 'COLUMN', N'block_strategy'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'任务执行超时时间,单位秒',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow',
+ 'COLUMN', N'executor_timeout'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'描述',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow',
+ 'COLUMN', N'description'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'流程信息',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow',
+ 'COLUMN', N'flow_info'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'bucket',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow',
+ 'COLUMN', N'bucket_index'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'版本号',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow',
+ 'COLUMN', N'version'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'扩展字段',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow',
+ 'COLUMN', N'ext_attrs'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'逻辑删除 1、删除',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow',
+ 'COLUMN', N'deleted'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'创建时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow',
+ 'COLUMN', N'create_dt'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'修改时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow',
+ 'COLUMN', N'update_dt'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'工作流',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow'
+GO
+
+-- sj_workflow_node
+CREATE TABLE sj_workflow_node
+(
+ id bigint NOT NULL PRIMARY KEY IDENTITY,
+ namespace_id nvarchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
+ node_name nvarchar(64) NOT NULL,
+ group_name nvarchar(64) NOT NULL,
+ job_id bigint NOT NULL,
+ workflow_id bigint NOT NULL,
+ node_type tinyint NOT NULL DEFAULT 1,
+ expression_type tinyint NOT NULL DEFAULT 0,
+ fail_strategy tinyint NOT NULL DEFAULT 1,
+ workflow_node_status tinyint NOT NULL DEFAULT 1,
+ priority_level int NOT NULL DEFAULT 1,
+ node_info nvarchar(max) NULL DEFAULT NULL,
+ version int NOT NULL,
+ ext_attrs nvarchar(256) NULL DEFAULT '',
+ deleted tinyint NOT NULL DEFAULT 0,
+ create_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ update_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP
+)
+GO
+
+CREATE INDEX idx_sj_workflow_node_01 ON sj_workflow_node (create_dt)
+GO
+CREATE INDEX idx_sj_workflow_node_02 ON sj_workflow_node (namespace_id, group_name)
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'主键',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow_node',
+ 'COLUMN', N'id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'命名空间id',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow_node',
+ 'COLUMN', N'namespace_id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'节点名称',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow_node',
+ 'COLUMN', N'node_name'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'组名称',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow_node',
+ 'COLUMN', N'group_name'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'任务信息id',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow_node',
+ 'COLUMN', N'job_id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'工作流ID',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow_node',
+ 'COLUMN', N'workflow_id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'1、任务节点 2、条件节点',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow_node',
+ 'COLUMN', N'node_type'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'1、SpEl、2、Aviator 3、QL',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow_node',
+ 'COLUMN', N'expression_type'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'失败策略 1、跳过 2、阻塞',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow_node',
+ 'COLUMN', N'fail_strategy'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'工作流节点状态 0、关闭、1、开启',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow_node',
+ 'COLUMN', N'workflow_node_status'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'优先级',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow_node',
+ 'COLUMN', N'priority_level'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'节点信息 ',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow_node',
+ 'COLUMN', N'node_info'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'版本号',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow_node',
+ 'COLUMN', N'version'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'扩展字段',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow_node',
+ 'COLUMN', N'ext_attrs'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'逻辑删除 1、删除',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow_node',
+ 'COLUMN', N'deleted'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'创建时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow_node',
+ 'COLUMN', N'create_dt'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'修改时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow_node',
+ 'COLUMN', N'update_dt'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'工作流节点',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow_node'
+GO
+
+-- sj_workflow_task_batch
+CREATE TABLE sj_workflow_task_batch
+(
+ id bigint NOT NULL PRIMARY KEY IDENTITY,
+ namespace_id nvarchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
+ group_name nvarchar(64) NOT NULL,
+ workflow_id bigint NOT NULL,
+ task_batch_status tinyint NOT NULL DEFAULT 0,
+ operation_reason tinyint NOT NULL DEFAULT 0,
+ flow_info nvarchar(max) NULL DEFAULT NULL,
+ execution_at bigint NOT NULL DEFAULT 0,
+ ext_attrs nvarchar(256) NULL DEFAULT '',
+ deleted tinyint NOT NULL DEFAULT 0,
+ create_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ update_dt datetime2 NOT NULL DEFAULT CURRENT_TIMESTAMP
+)
+GO
+
+CREATE INDEX idx_sj_workflow_task_batch_01 ON sj_workflow_task_batch (workflow_id, task_batch_status)
+GO
+CREATE INDEX idx_sj_workflow_task_batch_02 ON sj_workflow_task_batch (create_dt)
+GO
+CREATE INDEX idx_sj_workflow_task_batch_03 ON sj_workflow_task_batch (namespace_id, group_name)
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'主键',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow_task_batch',
+ 'COLUMN', N'id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'命名空间id',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow_task_batch',
+ 'COLUMN', N'namespace_id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'组名称',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow_task_batch',
+ 'COLUMN', N'group_name'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'工作流任务id',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow_task_batch',
+ 'COLUMN', N'workflow_id'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'任务批次状态 0、失败 1、成功',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow_task_batch',
+ 'COLUMN', N'task_batch_status'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'操作原因',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow_task_batch',
+ 'COLUMN', N'operation_reason'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'流程信息',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow_task_batch',
+ 'COLUMN', N'flow_info'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'任务执行时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow_task_batch',
+ 'COLUMN', N'execution_at'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'扩展字段',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow_task_batch',
+ 'COLUMN', N'ext_attrs'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'逻辑删除 1、删除',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow_task_batch',
+ 'COLUMN', N'deleted'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'创建时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow_task_batch',
+ 'COLUMN', N'create_dt'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'修改时间',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow_task_batch',
+ 'COLUMN', N'update_dt'
+GO
+
+EXEC sp_addextendedproperty
+ 'MS_Description', N'工作流批次',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sj_workflow_task_batch'
+GO
+
diff --git a/continew-admin-extension/continew-admin-job-server/src/main/resources/logback-spring.xml b/continew-admin-extension/continew-admin-job-server/src/main/resources/logback-spring.xml
new file mode 100644
index 000000000..8a911d227
--- /dev/null
+++ b/continew-admin-extension/continew-admin-job-server/src/main/resources/logback-spring.xml
@@ -0,0 +1,88 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ${CONSOLE_LOG_PATTERN}
+ ${LOG_CHARSET}
+
+
+
+
+
+
+ ${FILE_LOG_PATTERN}
+ ${LOG_CHARSET}
+
+
+
+
+
+
+ ${LOG_PATH}/${APP_NAME}.log
+
+
+
+ ${LOG_PATH}/%d{yyyy-MM-dd}/${APP_NAME}.%d{yyyy-MM-dd}.%i.log.gz
+
+ ${FILE_MAX_SIZE}
+
+ ${FILE_MAX_HISTORY}
+
+
+ ${FILE_LOG_PATTERN}
+ ${LOG_CHARSET}
+
+
+
+
+
+
+ 0
+
+ 512
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/continew-admin-extension/pom.xml b/continew-admin-extension/pom.xml
new file mode 100644
index 000000000..486ac5554
--- /dev/null
+++ b/continew-admin-extension/pom.xml
@@ -0,0 +1,18 @@
+
+ 4.0.0
+
+ top.continew
+ continew-admin
+ ${revision}
+
+
+ continew-admin-extension
+ pom
+ 扩展模块(存放其他扩展模块)
+
+
+
+ continew-admin-job-server
+
+
diff --git a/continew-admin-plugins/continew-admin-job/pom.xml b/continew-admin-plugins/continew-admin-job/pom.xml
new file mode 100644
index 000000000..cc5f8923b
--- /dev/null
+++ b/continew-admin-plugins/continew-admin-job/pom.xml
@@ -0,0 +1,39 @@
+
+ 4.0.0
+
+ top.continew
+ continew-admin-plugins
+ ${revision}
+
+
+ continew-admin-job
+ 任务调度插件
+
+
+
+
+ com.aizuda
+ snail-job-client-starter
+
+
+ com.aizuda
+ snail-job-client-retry-core
+
+
+ com.aizuda
+ snail-job-client-job-core
+
+
+
+
+ org.springframework
+ spring-webflux
+
+
+
+ io.projectreactor.netty
+ reactor-netty-http
+
+
+
diff --git a/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/api/JobApi.java b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/api/JobApi.java
new file mode 100644
index 000000000..b7d9e4278
--- /dev/null
+++ b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/api/JobApi.java
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
+ *
+ * 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
+ *
+ * http://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 top.continew.admin.job.api;
+
+import com.aizuda.snailjob.common.core.model.Result;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.service.annotation.*;
+import top.continew.admin.job.model.JobPageResult;
+import top.continew.admin.job.model.req.JobReq;
+import top.continew.admin.job.model.req.JobStatusReq;
+import top.continew.admin.job.model.resp.JobResp;
+
+import java.util.List;
+
+/**
+ * 任务 REST API
+ *
+ * @author KAI
+ * @author Charles7c
+ * @since 2024/6/25 18:20
+ */
+@HttpExchange(accept = MediaType.APPLICATION_JSON_VALUE)
+public interface JobApi {
+
+ /**
+ * 分页查询列表
+ *
+ * @param groupName 任务组
+ * @param jobName 任务名称
+ * @param jobStatus 任务状态
+ * @param page 页码
+ * @param size 每页条数
+ * @return 响应信息
+ */
+ @GetExchange("/job/page/list")
+ ResponseEntity>> page(@RequestParam(value = "groupName", required = false) String groupName,
+ @RequestParam(value = "jobName", required = false) String jobName,
+ @RequestParam(value = "jobStatus", required = false) Integer jobStatus,
+ @RequestParam("page") int page,
+ @RequestParam("size") int size);
+
+ /**
+ * 新增
+ *
+ * @param req 新增信息
+ * @return 响应信息
+ */
+ @PostExchange("/job")
+ ResponseEntity> add(@RequestBody JobReq req);
+
+ /**
+ * 修改
+ *
+ * @param req 修改信息
+ * @return 响应信息
+ */
+ @PutExchange("/job")
+ ResponseEntity> update(@RequestBody JobReq req);
+
+ /**
+ * 修改状态
+ *
+ * @param req 修改信息
+ * @return 响应信息
+ */
+ @PutExchange("/job/status")
+ ResponseEntity> updateStatus(@RequestBody JobStatusReq req);
+
+ /**
+ * 删除
+ *
+ * @param id ID
+ * @return 响应信息
+ */
+ @DeleteExchange("/job/{id}")
+ ResponseEntity> delete(@PathVariable("id") Long id);
+
+ /**
+ * 执行
+ *
+ * @param id ID
+ * @return 响应信息
+ */
+ @PostExchange("/job/trigger/{id}")
+ ResponseEntity> trigger(@PathVariable("id") Long id);
+
+ /**
+ * 查询分组列表
+ *
+ * @return 响应信息
+ */
+ @GetExchange("/group/all/group-name/list")
+ ResponseEntity>> listGroup();
+}
diff --git a/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/api/JobBatchApi.java b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/api/JobBatchApi.java
new file mode 100644
index 000000000..98457fd3d
--- /dev/null
+++ b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/api/JobBatchApi.java
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
+ *
+ * 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
+ *
+ * http://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 top.continew.admin.job.api;
+
+import com.aizuda.snailjob.common.core.model.Result;
+import com.aizuda.snailjob.common.core.model.Result;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.service.annotation.GetExchange;
+import org.springframework.web.service.annotation.HttpExchange;
+import org.springframework.web.service.annotation.PostExchange;
+import top.continew.admin.job.model.JobInstanceLogPageResult;
+import top.continew.admin.job.model.JobPageResult;
+import top.continew.admin.job.model.resp.JobLogResp;
+import top.continew.admin.job.model.resp.JobInstanceResp;
+
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ * 任务批次 REST API
+ *
+ * @author KAI
+ * @author Charles7c
+ * @since 2024/6/27 23:03
+ */
+@HttpExchange(value = "/job", accept = MediaType.APPLICATION_JSON_VALUE)
+public interface JobBatchApi {
+
+ /**
+ * 分页查询列表
+ *
+ * @param jobId 任务 ID
+ * @param jobName 任务名称
+ * @param groupName 组名称
+ * @param taskBatchStatus 任务批次状态
+ * @param datetimeRange 时间范围
+ * @param page 页码
+ * @param size 每页条数
+ * @return 响应信息
+ */
+ @GetExchange("/batch/list")
+ ResponseEntity>> page(@RequestParam(value = "jobId", required = false) Long jobId,
+ @RequestParam(value = "jobName", required = false) String jobName,
+ @RequestParam(value = "groupName", required = false) String groupName,
+ @RequestParam(value = "taskBatchStatus", required = false) Integer taskBatchStatus,
+ @RequestParam(value = "datetimeRange", required = false) LocalDateTime[] datetimeRange,
+ @RequestParam(value = "page") Integer page,
+ @RequestParam(value = "size") Integer size);
+
+ /**
+ * 停止
+ *
+ * @param id ID
+ * @return 响应信息
+ */
+ @PostExchange("/batch/stop/{id}")
+ ResponseEntity> stop(@PathVariable("id") Long id);
+
+ /**
+ * 重试
+ *
+ * @param id ID
+ * @return 响应信息
+ */
+ @PostExchange("/batch/retry/{id}")
+ ResponseEntity> retry(@PathVariable("id") Long id);
+
+ /**
+ * 分页查询任务实例列表
+ *
+ * @param jobId 任务 ID
+ * @param taskBatchId 任务批次 ID
+ * @param page 页码
+ * @param size 每页条数
+ * @return 响应信息
+ */
+ @GetExchange("/task/list")
+ ResponseEntity>> pageTask(@RequestParam(value = "jobId", required = false) Long jobId,
+ @RequestParam(value = "taskBatchId") Long taskBatchId,
+ @RequestParam(value = "page") Integer page,
+ @RequestParam(value = "size") Integer size);
+
+ /**
+ * 分页查询任务实例日志列表
+ *
+ * @param jobId 任务 ID
+ * @param taskBatchId 任务批次 ID
+ * @param fromIndex 起始索引
+ * @param size 每页条数
+ * @return 响应信息
+ */
+ @GetExchange("/log/list")
+ ResponseEntity> pageLog(@RequestParam(value = "jobId", required = false) Long jobId,
+ @RequestParam(value = "taskBatchId") Long taskBatchId,
+ @RequestParam(value = "taskId") Long taskId,
+ @RequestParam(value = "startId") Integer startId,
+ @RequestParam(value = "fromIndex") Integer fromIndex,
+ @RequestParam(value = "size") Integer size);
+}
diff --git a/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/api/JobClient.java b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/api/JobClient.java
new file mode 100644
index 000000000..f04439846
--- /dev/null
+++ b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/api/JobClient.java
@@ -0,0 +1,166 @@
+/*
+ * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
+ *
+ * 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
+ *
+ * http://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 top.continew.admin.job.api;
+
+import cn.hutool.core.convert.Convert;
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.lang.Assert;
+import cn.hutool.core.map.MapUtil;
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.crypto.SecureUtil;
+import cn.hutool.http.HttpRequest;
+import cn.hutool.http.HttpResponse;
+import cn.hutool.http.HttpUtil;
+import cn.hutool.json.JSONUtil;
+import cn.hutool.jwt.JWTUtil;
+import cn.hutool.jwt.RegisteredPayload;
+import com.aizuda.snailjob.common.core.model.Result;
+import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.http.ResponseEntity;
+import top.continew.admin.job.constant.JobConstants;
+import top.continew.admin.job.model.JobPageResult;
+import top.continew.starter.cache.redisson.util.RedisUtils;
+import top.continew.starter.extension.crud.model.resp.PageResp;
+
+import java.time.Duration;
+import java.util.List;
+import java.util.Map;
+import java.util.function.Supplier;
+
+/**
+ * 任务调度客户端
+ *
+ * @author Charles7c
+ * @since 2024/7/4 23:07
+ */
+@Slf4j
+@Data
+public class JobClient {
+
+ public static final Integer STATUS_SUCCESS = 1;
+ private static final String AUTH_URL = "/auth/login";
+ private final String url;
+ private final String username;
+ private final String password;
+
+ public JobClient(String url, String username, String password) {
+ Assert.notBlank(url, "任务调度服务 URL 不能为空");
+ Assert.notBlank(username, "任务调度服务用户名不能为空");
+ Assert.notBlank(password, "任务调度服务密码不能为空");
+ this.url = url;
+ this.username = username;
+ this.password = password;
+ }
+
+ /**
+ * 请求
+ *
+ * @param apiSupplier API 请求
+ * @param 响应类型
+ * @return 响应信息
+ */
+ public T request(Supplier>> apiSupplier) {
+ try {
+ ResponseEntity> responseEntity = apiSupplier.get();
+ this.checkResponse(responseEntity);
+ Result result = responseEntity.getBody();
+ if (!STATUS_SUCCESS.equals(result.getStatus())) {
+ throw new IllegalStateException(result.getMessage());
+ }
+ return result.getData();
+ } catch (Exception e) {
+ log.error("Request job server failed, error msg: {}", e.getMessage(), e);
+ throw new IllegalStateException(e);
+ }
+ }
+
+ /**
+ * 分页请求
+ *
+ * @param apiSupplier API 请求
+ * @param 响应类型
+ * @return 分页列表信息
+ */
+ public PageResp requestPage(Supplier>>> apiSupplier) {
+ try {
+ ResponseEntity>> responseEntity = apiSupplier.get();
+ this.checkResponse(responseEntity);
+ JobPageResult> result = responseEntity.getBody();
+ if (!STATUS_SUCCESS.equals(result.getStatus())) {
+ throw new IllegalStateException(result.getMessage());
+ }
+ PageResp page = new PageResp<>();
+ page.setList(result.getData());
+ page.setTotal(result.getTotal());
+ return page;
+ } catch (Exception e) {
+ log.error("Request job server failed, error msg: {}", e.getMessage(), e);
+ throw new IllegalStateException(e);
+ }
+ }
+
+ /**
+ * 获取 Token
+ *
+ * @return Token
+ */
+ public String getToken() {
+ String token = RedisUtils.get(JobConstants.AUTH_TOKEN_HEADER);
+ if (StrUtil.isBlank(token)) {
+ token = this.authenticate();
+ Object expiresAtSeconds = JWTUtil.parseToken(token).getPayload(RegisteredPayload.EXPIRES_AT);
+ RedisUtils.set(JobConstants.AUTH_TOKEN_HEADER, token, Duration.ofSeconds(Convert
+ .toLong(expiresAtSeconds) - DateUtil.currentSeconds() - 60));
+ }
+ return token;
+ }
+
+ /**
+ * 密码认证
+ *
+ * @return Token
+ */
+ private String authenticate() {
+ Map paramMap = MapUtil.newHashMap(2);
+ paramMap.put("username", username);
+ paramMap.put("password", SecureUtil.md5(password));
+ HttpRequest httpRequest = HttpUtil.createPost("%s%s".formatted(url, AUTH_URL));
+ httpRequest.body(JSONUtil.toJsonStr(paramMap));
+ HttpResponse response = httpRequest.execute();
+ if (!response.isOk() || response.body() == null) {
+ throw new IllegalStateException("连接任务调度中心错误");
+ }
+ Result> result = JSONUtil.toBean(response.body(), Result.class);
+ if (!STATUS_SUCCESS.equals(result.getStatus())) {
+ throw new IllegalStateException("Password Authentication failed, expected a successful response. error msg: %s"
+ .formatted(result.getMessage()));
+ }
+ return JSONUtil.parseObj(result.getData()).getStr("token");
+ }
+
+ /**
+ * 检查响应
+ *
+ * @param responseEntity 响应信息
+ */
+ private void checkResponse(ResponseEntity> responseEntity) {
+ if (!responseEntity.getStatusCode().is2xxSuccessful() || responseEntity.getBody() == null) {
+ throw new IllegalStateException("连接任务调度中心错误");
+ }
+ }
+}
diff --git a/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/config/HttpExchangeConfiguration.java b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/config/HttpExchangeConfiguration.java
new file mode 100644
index 000000000..1c7f16a13
--- /dev/null
+++ b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/config/HttpExchangeConfiguration.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
+ *
+ * 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
+ *
+ * http://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 top.continew.admin.job.config;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import io.netty.channel.ChannelOption;
+import io.netty.handler.timeout.ReadTimeoutHandler;
+import io.netty.handler.timeout.WriteTimeoutHandler;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.http.client.reactive.ReactorClientHttpConnector;
+import org.springframework.http.codec.json.Jackson2JsonDecoder;
+import org.springframework.http.codec.json.Jackson2JsonEncoder;
+import org.springframework.web.reactive.function.client.ClientRequest;
+import org.springframework.web.reactive.function.client.WebClient;
+import org.springframework.web.reactive.function.client.support.WebClientAdapter;
+import org.springframework.web.service.invoker.HttpServiceProxyFactory;
+import reactor.netty.http.client.HttpClient;
+import top.continew.admin.job.api.JobApi;
+import top.continew.admin.job.api.JobBatchApi;
+import top.continew.admin.job.api.JobClient;
+import top.continew.admin.job.constant.JobConstants;
+
+/**
+ * HTTP Exchange 配置
+ *
+ * @author KAI
+ * @author Charles7c
+ * @since 2024/6/25 18:03
+ */
+@Configuration
+@RequiredArgsConstructor
+public class HttpExchangeConfiguration {
+
+ private final ObjectMapper objectMapper;
+ @Value("${snail-job.server.url}")
+ private String baseUrl;
+
+ @Value("${snail-job.namespace}")
+ private String namespace;
+
+ @Value("${snail-job.server.username}")
+ private String username;
+
+ @Value("${snail-job.server.password}")
+ private String password;
+
+ @Bean
+ public JobApi jobApi() {
+ return httpServiceProxyFactory().createClient(JobApi.class);
+ }
+
+ @Bean
+ public JobBatchApi jobBatchApi() {
+ return httpServiceProxyFactory().createClient(JobBatchApi.class);
+ }
+
+ @Bean
+ public HttpServiceProxyFactory httpServiceProxyFactory() {
+ HttpClient httpClient = HttpClient.create()
+ .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 30000)
+ .doOnConnected(conn -> {
+ conn.addHandlerLast(new ReadTimeoutHandler(10));
+ conn.addHandlerLast(new WriteTimeoutHandler(10));
+ });
+ WebClient webClient = WebClient.builder()
+ .codecs(config -> config.defaultCodecs().jackson2JsonEncoder(new Jackson2JsonEncoder(objectMapper)))
+ .codecs(config -> config.defaultCodecs().jackson2JsonDecoder(new Jackson2JsonDecoder(objectMapper)))
+ .clientConnector(new ReactorClientHttpConnector(httpClient))
+ .filter((request, next) -> {
+ // 设置请求头
+ ClientRequest filtered = ClientRequest.from(request)
+ .header(JobConstants.NAMESPACE_ID_HEADER, namespace)
+ .header(JobConstants.AUTH_TOKEN_HEADER, jobClient().getToken())
+ .build();
+ return next.exchange(filtered);
+ })
+ .baseUrl(baseUrl)
+ .build();
+ return HttpServiceProxyFactory.builder(WebClientAdapter.forClient(webClient)).build();
+ }
+
+ @Bean
+ public JobClient jobClient() {
+ return new JobClient(baseUrl, username, password);
+ }
+}
diff --git a/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/config/SnailJobConfiguration.java b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/config/SnailJobConfiguration.java
new file mode 100644
index 000000000..04cb721ea
--- /dev/null
+++ b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/config/SnailJobConfiguration.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
+ *
+ * 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
+ *
+ * http://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 top.continew.admin.job.config;
+
+import ch.qos.logback.classic.Logger;
+import ch.qos.logback.classic.LoggerContext;
+import ch.qos.logback.classic.spi.ILoggingEvent;
+import com.aizuda.snailjob.client.common.appender.SnailLogbackAppender;
+import com.aizuda.snailjob.client.common.event.SnailClientStartingEvent;
+import com.aizuda.snailjob.client.starter.EnableSnailJob;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.event.EventListener;
+
+/**
+ * Snail Job 配置
+ *
+ * @author KAI
+ * @since 2024/6/26 9:19
+ */
+@Configuration
+@EnableSnailJob
+public class SnailJobConfiguration {
+
+ /**
+ * 日志上报
+ */
+ @EventListener(SnailClientStartingEvent.class)
+ public void onStarting() {
+ SnailLogbackAppender appender = new SnailLogbackAppender<>();
+ appender.start();
+ LoggerContext loggerContext = (LoggerContext)LoggerFactory.getILoggerFactory();
+ Logger rootLogger = loggerContext.getLogger(Logger.ROOT_LOGGER_NAME);
+ rootLogger.addAppender(appender);
+ }
+}
\ No newline at end of file
diff --git a/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/constant/JobConstants.java b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/constant/JobConstants.java
new file mode 100644
index 000000000..ec6443340
--- /dev/null
+++ b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/constant/JobConstants.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
+ *
+ * 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
+ *
+ * http://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 top.continew.admin.job.constant;
+
+/**
+ * 任务调度常量
+ *
+ * @author KAI
+ * @since 2024/6/26 9:19
+ */
+public class JobConstants {
+
+ /**
+ * 请求头:命名空间 ID
+ */
+ public static final String NAMESPACE_ID_HEADER = "SNAIL-JOB-NAMESPACE-ID";
+
+ /**
+ * 请求头:认证令牌
+ */
+ public static final String AUTH_TOKEN_HEADER = "Snail-Job-Auth";
+
+ private JobConstants() {
+ }
+}
diff --git a/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/enums/JobBlockStrategyEnum.java b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/enums/JobBlockStrategyEnum.java
new file mode 100644
index 000000000..fe5a6d25b
--- /dev/null
+++ b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/enums/JobBlockStrategyEnum.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
+ *
+ * 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
+ *
+ * http://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 top.continew.admin.job.enums;
+
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import top.continew.starter.data.mybatis.plus.base.IBaseEnum;
+
+/**
+ * 任务阻塞策略枚举
+ *
+ * @author Charles7c
+ * @since 2024/7/11 22:28
+ */
+@Getter
+@RequiredArgsConstructor
+public enum JobBlockStrategyEnum implements IBaseEnum {
+
+ /**
+ * 丢弃
+ */
+ DISCARD(1, "丢弃"),
+
+ /**
+ * 覆盖
+ */
+ COVER(2, "覆盖"),
+
+ /**
+ * 并行
+ */
+ PARALLEL(3, "并行"),;
+
+ private final Integer value;
+ private final String description;
+}
diff --git a/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/enums/JobExecuteReasonEnum.java b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/enums/JobExecuteReasonEnum.java
new file mode 100644
index 000000000..42c18c555
--- /dev/null
+++ b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/enums/JobExecuteReasonEnum.java
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
+ *
+ * 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
+ *
+ * http://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 top.continew.admin.job.enums;
+
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import top.continew.starter.data.mybatis.plus.base.IBaseEnum;
+
+/**
+ * 任务执行原因枚举
+ *
+ * @author Charles7c
+ * @since 2024/7/11 22:28
+ */
+@Getter
+@RequiredArgsConstructor
+public enum JobExecuteReasonEnum implements IBaseEnum {
+
+ /**
+ * 无
+ */
+ NONE(0, "无"),
+
+ /**
+ * 任务执行超时
+ */
+ TIME_OUT(1, "任务执行超时"),
+
+ /**
+ * 无客户端节点
+ */
+ CLIENT_NOT_FOUND(2, "无客户端节点"),
+
+ /**
+ * 任务已关闭
+ */
+ TASK_CLOSED(3, "任务已关闭"),
+
+ /**
+ * 任务丢弃
+ */
+ TASK_DROPPED(4, "任务丢弃"),
+
+ /**
+ * 任务被覆盖
+ */
+ TASK_COVERED(5, "任务被覆盖"),
+
+ /**
+ * 无可执行任务项
+ */
+ TASK_NONE(6, "无可执行任务项"),
+
+ /**
+ * 任务执行期间发生非预期异常
+ */
+ TASK_EXCEPTION(7, "任务执行期间发生非预期异常"),
+
+ /**
+ * 手动停止
+ */
+ MANUAL_STOP(8, "手动停止"),
+
+ /**
+ * 条件节点执行异常
+ */
+ NODE_EXCEPTION(9, "条件节点执行异常"),
+
+ /**
+ * 任务中断
+ */
+ TASK_INTERRUPT(10, "任务中断"),
+
+ /**
+ * 回调节点执行异常
+ */
+ CALLBACK_EXCEPTION(11, "回调节点执行异常"),
+
+ /**
+ * 无需处理
+ */
+ NO_NEED_PROCESS(12, "无需处理"),
+
+ /**
+ * 节点关闭跳过执行
+ */
+ NODE_SKIP(13, "节点关闭跳过执行"),
+
+ /**
+ * 判定未通过
+ */
+ NOT_PASS(14, "判定未通过"),
+
+ /**
+ * 任务已完成
+ */
+ TASK_FINISHED(15, "任务已完成"),
+
+ /**
+ * 任务状态
+ */
+ TASK_RUNNING(16, "任务正在执行"),
+
+ /**
+ * 任务等待执行
+ */
+ TASK_WAITING(17, "任务等待执行"),
+
+ /**
+ * 任务执行失败
+ */
+ TASK_FAILED(18, "任务执行失败"),
+
+ /**
+ * 任务执行成功
+ */
+ TASK_SUCCESS(19, "任务执行成功"),;
+
+ private final Integer value;
+ private final String description;
+}
diff --git a/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/enums/JobExecuteStatusEnum.java b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/enums/JobExecuteStatusEnum.java
new file mode 100644
index 000000000..7fbf109c5
--- /dev/null
+++ b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/enums/JobExecuteStatusEnum.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
+ *
+ * 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
+ *
+ * http://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 top.continew.admin.job.enums;
+
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import top.continew.admin.common.constant.UiConstants;
+import top.continew.starter.data.mybatis.plus.base.IBaseEnum;
+
+/**
+ * 任务执行状态枚举
+ *
+ * @author Charles7c
+ * @since 2024/7/11 22:28
+ */
+@Getter
+@RequiredArgsConstructor
+public enum JobExecuteStatusEnum implements IBaseEnum {
+
+ /**
+ * 待处理
+ */
+ WAITING(1, "待处理", UiConstants.COLOR_PRIMARY),
+
+ /**
+ * 运行中
+ */
+ RUNNING(2, "运行中", UiConstants.COLOR_WARNING),
+
+ /**
+ * 成功
+ */
+ SUCCEEDED(3, "成功", UiConstants.COLOR_SUCCESS),
+
+ /**
+ * 已失败
+ */
+ FAILED(4, "已失败", UiConstants.COLOR_ERROR),
+
+ /**
+ * 已停止
+ */
+ STOPPED(5, "已停止", UiConstants.COLOR_ERROR),
+
+ /**
+ * 已取消
+ */
+ CANCELED(6, "已取消", UiConstants.COLOR_DEFAULT),;
+
+ private final Integer value;
+ private final String description;
+ private final String color;
+}
diff --git a/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/enums/JobRouteStrategyEnum.java b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/enums/JobRouteStrategyEnum.java
new file mode 100644
index 000000000..8049eafd3
--- /dev/null
+++ b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/enums/JobRouteStrategyEnum.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
+ *
+ * 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
+ *
+ * http://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 top.continew.admin.job.enums;
+
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import top.continew.starter.data.mybatis.plus.base.IBaseEnum;
+
+/**
+ * 任务路由策略枚举
+ *
+ * @author Charles7c
+ * @since 2024/7/11 22:28
+ */
+@Getter
+@RequiredArgsConstructor
+public enum JobRouteStrategyEnum implements IBaseEnum {
+
+ /**
+ * 轮询
+ */
+ POLLING(4, "轮询"),
+
+ /**
+ * 随机
+ */
+ RANDOM(2, "随机"),
+
+ /**
+ * 一致性哈希
+ */
+ HASH(1, "一致性哈希"),
+
+ /**
+ * LRU
+ */
+ LRU(3, "LRU"),;
+
+ private final Integer value;
+ private final String description;
+}
diff --git a/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/enums/JobStatusEnum.java b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/enums/JobStatusEnum.java
new file mode 100644
index 000000000..d902e4ea1
--- /dev/null
+++ b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/enums/JobStatusEnum.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
+ *
+ * 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
+ *
+ * http://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 top.continew.admin.job.enums;
+
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import top.continew.admin.common.constant.UiConstants;
+import top.continew.starter.data.mybatis.plus.base.IBaseEnum;
+
+/**
+ * 任务状态枚举
+ *
+ * @author Charles7c
+ * @since 2024/7/11 22:28
+ */
+@Getter
+@RequiredArgsConstructor
+public enum JobStatusEnum implements IBaseEnum {
+
+ /**
+ * 禁用
+ */
+ DISABLED(0, "禁用", UiConstants.COLOR_ERROR),
+
+ /**
+ * 启用
+ */
+ ENABLED(1, "启用", UiConstants.COLOR_SUCCESS),;
+
+ private final Integer value;
+ private final String description;
+ private final String color;
+}
diff --git a/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/enums/JobTaskTypeEnum.java b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/enums/JobTaskTypeEnum.java
new file mode 100644
index 000000000..e6a2b737e
--- /dev/null
+++ b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/enums/JobTaskTypeEnum.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
+ *
+ * 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
+ *
+ * http://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 top.continew.admin.job.enums;
+
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import top.continew.admin.common.constant.UiConstants;
+import top.continew.starter.data.mybatis.plus.base.IBaseEnum;
+
+/**
+ * 任务类型枚举
+ *
+ * @author Charles7c
+ * @since 2024/7/11 22:28
+ */
+@Getter
+@RequiredArgsConstructor
+public enum JobTaskTypeEnum implements IBaseEnum {
+
+ /**
+ * 集群
+ */
+ CLUSTER(1, "集群", UiConstants.COLOR_PRIMARY),
+
+ /**
+ * 广播
+ */
+ BROADCAST(2, "广播", UiConstants.COLOR_PRIMARY),
+
+ /**
+ * 静态切片
+ */
+ SLICE(3, "静态切片", UiConstants.COLOR_PRIMARY),;
+
+ private final Integer value;
+ private final String description;
+ private final String color;
+}
diff --git a/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/enums/JobTriggerTypeEnum.java b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/enums/JobTriggerTypeEnum.java
new file mode 100644
index 000000000..55ea91019
--- /dev/null
+++ b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/enums/JobTriggerTypeEnum.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
+ *
+ * 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
+ *
+ * http://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 top.continew.admin.job.enums;
+
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import top.continew.starter.data.mybatis.plus.base.IBaseEnum;
+
+/**
+ * 任务触发类型枚举
+ *
+ * @author Charles7c
+ * @since 2024/7/11 22:28
+ */
+@Getter
+@RequiredArgsConstructor
+public enum JobTriggerTypeEnum implements IBaseEnum {
+
+ /**
+ * CRON
+ */
+ CRON(1, "CRON"),
+
+ /**
+ * 固定时间
+ */
+ FIXED_TIME(2, "固定时间"),;
+
+ private final Integer value;
+ private final String description;
+}
diff --git a/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/model/JobInstanceLogPageResult.java b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/model/JobInstanceLogPageResult.java
new file mode 100644
index 000000000..754004af2
--- /dev/null
+++ b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/model/JobInstanceLogPageResult.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
+ *
+ * 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
+ *
+ * http://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 top.continew.admin.job.model;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import java.util.List;
+
+import java.io.Serial;
+import java.io.Serializable;
+
+/**
+ * 任务实例日志分页信息
+ *
+ * @author Charles7c
+ * @since 2024/7/14 21:51
+ */
+@Data
+@Schema(description = "任务实例日志分页信息")
+public class JobInstanceLogPageResult implements Serializable {
+
+ @Serial
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * ID
+ */
+ @Schema(description = "ID", example = "1")
+ private Long id;
+
+ /**
+ * 日志详情
+ */
+ @Schema(description = "日志详情")
+ private List message;
+
+ /**
+ * 是否结束
+ */
+ @Schema(description = "是否结束", example = "true")
+ private boolean isFinished;
+
+ /**
+ * 起始索引
+ */
+ @Schema(description = "起始索引", example = "0")
+ private Integer fromIndex;
+
+ /**
+ * 下一个开始 ID
+ */
+ @Schema(description = "下一个开始ID", example = "9")
+ private Long nextStartId;
+}
diff --git a/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/model/JobPageResult.java b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/model/JobPageResult.java
new file mode 100644
index 000000000..4cd3b2ff0
--- /dev/null
+++ b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/model/JobPageResult.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
+ *
+ * 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
+ *
+ * http://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 top.continew.admin.job.model;
+
+import com.aizuda.snailjob.common.core.model.Result;
+import lombok.Data;
+
+/**
+ * 任务调度服务端分页返回对象
+ *
+ * @author KAI
+ * @author Charles7c
+ * @since 2024/6/26 22:27
+ */
+@Data
+public class JobPageResult extends Result {
+
+ /**
+ * 页码
+ */
+ private long page;
+
+ /**
+ * 每页条数
+ */
+ private long size;
+
+ /**
+ * 总条数
+ */
+ private long total;
+}
diff --git a/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/model/query/JobInstanceLogQuery.java b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/model/query/JobInstanceLogQuery.java
new file mode 100644
index 000000000..eb4e4d6fb
--- /dev/null
+++ b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/model/query/JobInstanceLogQuery.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
+ *
+ * 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
+ *
+ * http://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 top.continew.admin.job.model.query;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.Min;
+import lombok.Data;
+import org.hibernate.validator.constraints.Range;
+
+import java.io.Serial;
+import java.io.Serializable;
+
+/**
+ * 任务实例日志查询条件
+ *
+ * @author KAI
+ * @since 2024/6/28 16:58
+ */
+@Data
+@Schema(description = "任务实例日志查询条件")
+public class JobInstanceLogQuery implements Serializable {
+
+ @Serial
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 任务 ID
+ */
+ @Schema(description = "任务ID", example = "1")
+ private Long jobId;
+
+ /**
+ * 任务批次 ID
+ */
+ @Schema(description = "任务批次ID", example = "1")
+ private Long taskBatchId;
+
+ /**
+ * 任务实例 ID
+ */
+ @Schema(description = "任务实例ID", example = "1")
+ private Long taskId;
+
+ /**
+ * 开始 ID
+ */
+ @Schema(description = "开始ID", example = "2850")
+ private Integer startId;
+
+ /**
+ * 起始索引
+ */
+ @Schema(description = "起始索引", example = "0")
+ @Min(value = 0, message = "起始索引最小值为 {value}")
+ private Integer fromIndex = 0;
+
+ /**
+ * 每页条数
+ */
+ @Schema(description = "每页条数", example = "50")
+ @Range(min = 1, max = 1000, message = "每页条数(取值范围 {min}-{max})")
+ private Integer size = 50;
+}
diff --git a/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/model/query/JobInstanceQuery.java b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/model/query/JobInstanceQuery.java
new file mode 100644
index 000000000..4529e1109
--- /dev/null
+++ b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/model/query/JobInstanceQuery.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
+ *
+ * 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
+ *
+ * http://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 top.continew.admin.job.model.query;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.io.Serial;
+import java.io.Serializable;
+
+/**
+ * 任务实例查询条件
+ *
+ * @author KAI
+ * @since 2024/6/28 16:58
+ */
+@Data
+@Schema(description = "任务实例查询条件")
+public class JobInstanceQuery implements Serializable {
+
+ @Serial
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 任务 ID
+ */
+ @Schema(description = "任务ID", example = "1")
+ private Long jobId;
+
+ /**
+ * 任务批次 ID
+ */
+ @Schema(description = "任务批次ID", example = "1")
+ private Long taskBatchId;
+}
diff --git a/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/model/query/JobLogQuery.java b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/model/query/JobLogQuery.java
new file mode 100644
index 000000000..b1fc4e439
--- /dev/null
+++ b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/model/query/JobLogQuery.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
+ *
+ * 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
+ *
+ * http://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 top.continew.admin.job.model.query;
+
+import cn.hutool.core.date.DatePattern;
+import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.Min;
+import jakarta.validation.constraints.Size;
+import lombok.Data;
+import org.hibernate.validator.constraints.Range;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serial;
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * 任务日志查询条件
+ *
+ * @author KAI
+ * @since 2024/6/27 23:58
+ */
+@Data
+@Schema(description = "任务日志查询条件")
+public class JobLogQuery implements Serializable {
+
+ @Serial
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 任务 ID
+ */
+ @Schema(description = "任务ID", example = "1")
+ private Long jobId;
+
+ /**
+ * 任务组
+ */
+ @Schema(description = "任务组", example = "continew-admin")
+ private String groupName;
+
+ /**
+ * 任务名称
+ */
+ @Schema(description = "任务名称", example = "定时任务1")
+ private String jobName;
+
+ /**
+ * 任务批次状态
+ */
+ @Schema(description = "任务批次状态", example = "1")
+ private Integer taskBatchStatus;
+
+ /**
+ * 创建时间
+ */
+ @Schema(description = "创建时间", example = "2023-08-08 00:00:00,2023-08-08 23:59:59")
+ @DateTimeFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
+ @Size(max = 2, message = "创建时间必须是一个范围")
+ private LocalDateTime[] datetimeRange;
+
+ /**
+ * 页码
+ */
+ @Schema(description = "页码", example = "1")
+ @Min(value = 1, message = "页码最小值为 {value}")
+ private Integer page = 1;
+
+ /**
+ * 每页条数
+ */
+ @Schema(description = "每页条数", example = "10")
+ @Range(min = 1, max = 1000, message = "每页条数(取值范围 {min}-{max})")
+ private Integer size = 10;
+}
\ No newline at end of file
diff --git a/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/model/query/JobQuery.java b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/model/query/JobQuery.java
new file mode 100644
index 000000000..da53bf2b6
--- /dev/null
+++ b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/model/query/JobQuery.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
+ *
+ * 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
+ *
+ * http://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 top.continew.admin.job.model.query;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.Min;
+import lombok.Data;
+import org.hibernate.validator.constraints.Range;
+
+import java.io.Serial;
+import java.io.Serializable;
+
+/**
+ * 任务查询条件
+ *
+ * @author KAI
+ * @since 2024/6/25 16:43
+ */
+@Data
+@Schema(description = "任务查询条件")
+public class JobQuery implements Serializable {
+
+ @Serial
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 任务组
+ */
+ @Schema(description = "任务组", example = "continew-admin")
+ private String groupName;
+
+ /**
+ * 任务名称
+ */
+ @Schema(description = "任务名称", example = "定时任务1")
+ private String jobName;
+
+ /**
+ * 任务状态
+ */
+ @Schema(description = "任务状态", example = "1")
+ private Integer jobStatus;
+
+ /**
+ * 页码
+ */
+ @Schema(description = "页码", example = "1")
+ @Min(value = 1, message = "页码最小值为 {value}")
+ private Integer page = 1;
+
+ /**
+ * 每页条数
+ */
+ @Schema(description = "每页条数", example = "10")
+ @Range(min = 1, max = 1000, message = "每页条数(取值范围 {min}-{max})")
+ private Integer size = 10;
+}
diff --git a/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/model/req/JobReq.java b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/model/req/JobReq.java
new file mode 100644
index 000000000..88f099cc0
--- /dev/null
+++ b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/model/req/JobReq.java
@@ -0,0 +1,163 @@
+/*
+ * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
+ *
+ * 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
+ *
+ * http://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 top.continew.admin.job.model.req;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotNull;
+import lombok.Data;
+import org.hibernate.validator.constraints.Length;
+import top.continew.admin.job.enums.*;
+
+import java.io.Serial;
+import java.io.Serializable;
+
+/**
+ * 创建或修改任务信息
+ *
+ * @author KAI
+ * @author Charles7c
+ * @since 2024/6/25 16:40
+ */
+@Data
+@Schema(description = "创建或修改任务信息")
+public class JobReq implements Serializable {
+
+ @Serial
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 任务组
+ */
+ @Schema(description = "任务组", example = "continew-admin")
+ @NotBlank(message = "任务组不能为空")
+ private String groupName;
+
+ /**
+ * 任务名称
+ */
+ @Schema(description = "任务名称", example = "定时任务1")
+ @NotBlank(message = "任务名称不能为空")
+ @Length(max = 64, message = "任务名称不能超过 {max} 个字符")
+ private String jobName;
+
+ /**
+ * 描述
+ */
+ @Schema(description = "描述", example = "定时任务1的描述")
+ private String description;
+
+ /**
+ * 触发类型
+ */
+ @Schema(description = "触发类型", example = "2")
+ @NotNull(message = "触发类型非法")
+ private JobTriggerTypeEnum triggerType;
+
+ /**
+ * 间隔时长
+ */
+ @Schema(description = "间隔时长", example = "60")
+ @NotBlank(message = "间隔时长不能为空")
+ private String triggerInterval;
+
+ /**
+ * 执行器类型
+ */
+ @Schema(description = "执行器类型", example = "1", defaultValue = "1")
+ private Integer executorType = 1;
+
+ /**
+ * 任务类型
+ */
+ @Schema(description = "任务类型", example = "1")
+ @NotNull(message = "任务类型非法")
+ private JobTaskTypeEnum taskType;
+
+ /**
+ * 执行器名称
+ */
+ @Schema(description = "执行器名称", example = "test")
+ @NotBlank(message = "执行器名称不能为空")
+ private String executorInfo;
+
+ /**
+ * 任务参数
+ */
+ @Schema(description = "任务参数", example = "")
+ private String argsStr;
+
+ /**
+ * 参数类型
+ */
+ @Schema(description = "参数类型", example = "1")
+ private Integer argsType;
+
+ /**
+ * 路由策略
+ */
+ @Schema(description = "路由策略", example = "4")
+ @NotNull(message = "路由策略非法")
+ private JobRouteStrategyEnum routeKey;
+
+ /**
+ * 阻塞策略
+ */
+ @Schema(description = "阻塞策略", example = "1")
+ @NotNull(message = "阻塞策略非法")
+ private JobBlockStrategyEnum blockStrategy;
+
+ /**
+ * 超时时间(单位:秒)
+ */
+ @Schema(description = "超时时间(单位:秒)", example = "60")
+ @NotNull(message = "超时时间不能为空")
+ private Integer executorTimeout;
+
+ /**
+ * 最大重试次数
+ */
+ @Schema(description = "最大重试次数", example = "3")
+ @NotNull(message = "最大重试次数不能为空")
+ private Integer maxRetryTimes;
+
+ /**
+ * 重试间隔(单位:秒)
+ */
+ @Schema(description = "重试间隔(单位:秒)", example = "1")
+ @NotNull(message = "重试间隔不能为空")
+ private Integer retryInterval;
+
+ /**
+ * 并行数
+ */
+ @Schema(description = "并行数", example = "1")
+ @NotNull(message = "并行数不能为空")
+ private Integer parallelNum;
+
+ /**
+ * 任务状态
+ */
+ @Schema(description = "任务状态", example = "0", defaultValue = "0")
+ private JobStatusEnum jobStatus = JobStatusEnum.DISABLED;
+
+ /**
+ * ID
+ */
+ @Schema(hidden = true)
+ private Long id;
+}
diff --git a/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/model/req/JobStatusReq.java b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/model/req/JobStatusReq.java
new file mode 100644
index 000000000..b55491bfa
--- /dev/null
+++ b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/model/req/JobStatusReq.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
+ *
+ * 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
+ *
+ * http://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 top.continew.admin.job.model.req;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotNull;
+import lombok.Data;
+import top.continew.admin.job.enums.JobStatusEnum;
+
+import java.io.Serial;
+import java.io.Serializable;
+
+/**
+ * 修改任务状态信息
+ *
+ * @author KAI
+ * @author Charles7c
+ * @since 2024/6/27 9:24
+ */
+@Data
+@Schema(description = "修改任务状态信息")
+public class JobStatusReq implements Serializable {
+
+ @Serial
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 任务状态
+ */
+ @Schema(description = "任务状态", example = "1")
+ @NotNull(message = "任务状态非法")
+ private JobStatusEnum jobStatus;
+
+ /**
+ * ID
+ */
+ @Schema(hidden = true)
+ private Long id;
+}
diff --git a/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/model/resp/JobInstanceResp.java b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/model/resp/JobInstanceResp.java
new file mode 100644
index 000000000..07a606bd7
--- /dev/null
+++ b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/model/resp/JobInstanceResp.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
+ *
+ * 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
+ *
+ * http://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 top.continew.admin.job.model.resp;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.io.Serial;
+import java.io.Serializable;
+
+/**
+ * 任务实例信息
+ *
+ * @author KAI
+ * @author Charles7c
+ * @since 2024/6/28 16:58
+ */
+@Data
+@Schema(description = "任务实例信息")
+public class JobInstanceResp implements Serializable {
+
+ @Serial
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * ID
+ */
+ @Schema(description = "ID", example = "1")
+ private Long id;
+
+ /**
+ * 任务组
+ */
+ @Schema(description = "任务组", example = "continew-admin")
+ private String groupName;
+
+ /**
+ * 任务 ID
+ */
+ @Schema(description = "任务ID", example = "1")
+ private Long jobId;
+
+ /**
+ * 任务批次 ID
+ */
+ @Schema(description = "任务批次ID", example = "1")
+ private Long taskBatchId;
+
+ /**
+ * 执行状态
+ */
+ @Schema(description = "执行状态", example = "1")
+ private Integer taskStatus;
+
+ /**
+ * 重试次数
+ */
+ @Schema(description = "重试次数", example = "1")
+ private Integer retryCount;
+
+ /**
+ * 执行结果
+ */
+ @Schema(description = "执行结果", example = "")
+ private String resultMessage;
+
+ /**
+ * 客户端信息
+ */
+ @Schema(description = "客户端信息", example = "1812406095098114048@192.168.138.48:1789")
+ private String clientInfo;
+}
diff --git a/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/model/resp/JobLogResp.java b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/model/resp/JobLogResp.java
new file mode 100644
index 000000000..3a578ad50
--- /dev/null
+++ b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/model/resp/JobLogResp.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
+ *
+ * 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
+ *
+ * http://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 top.continew.admin.job.model.resp;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import top.continew.admin.job.enums.JobExecuteReasonEnum;
+import top.continew.admin.job.enums.JobExecuteStatusEnum;
+
+import java.io.Serial;
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * 任务日志信息
+ *
+ * @author KAI
+ * @author Charles7c
+ * @since 2024/6/27 22:50
+ */
+@Data
+@Schema(description = "任务日志信息")
+public class JobLogResp implements Serializable {
+
+ @Serial
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * ID
+ */
+ @Schema(description = "ID", example = "1")
+ private Long id;
+
+ /**
+ * 任务组
+ */
+ @Schema(description = "任务组", example = "continew-admin")
+ private String groupName;
+
+ /**
+ * 任务名称
+ */
+ @Schema(description = "任务名称", example = "定时任务1")
+ private String jobName;
+
+ /**
+ * 任务 ID
+ */
+ @Schema(description = "任务ID", example = "1")
+ private Long jobId;
+
+ /**
+ * 任务状态
+ */
+ @Schema(description = "任务状态", example = "3")
+ private JobExecuteStatusEnum taskBatchStatus;
+
+ /**
+ * 操作原因
+ */
+ @Schema(description = "操作原因", example = "0")
+ private JobExecuteReasonEnum operationReason;
+
+ /**
+ * 执行器类型
+ */
+ @Schema(description = "执行器类型", example = "1")
+ private Integer executorType;
+
+ /**
+ * 执行器名称
+ */
+ @Schema(description = "执行器名称", example = "test")
+ private String executorInfo;
+
+ /**
+ * 执行时间
+ */
+ @Schema(description = "执行时间", example = "2023-08-08 08:08:08", type = "string")
+ private LocalDateTime executionAt;
+
+ /**
+ * 创建时间
+ */
+ @Schema(description = "创建时间", example = "2023-08-08 08:08:08", type = "string")
+ private LocalDateTime createDt;
+}
diff --git a/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/model/resp/JobResp.java b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/model/resp/JobResp.java
new file mode 100644
index 000000000..0d96f0f53
--- /dev/null
+++ b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/model/resp/JobResp.java
@@ -0,0 +1,166 @@
+/*
+ * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
+ *
+ * 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
+ *
+ * http://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 top.continew.admin.job.model.resp;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import top.continew.admin.job.enums.*;
+
+import java.io.Serial;
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * 任务信息
+ *
+ * @author KAI
+ * @author Charles7c
+ * @since 2024/6/25 17:15
+ */
+@Data
+@Schema(description = "任务信息")
+public class JobResp implements Serializable {
+
+ @Serial
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * ID
+ */
+ @Schema(description = "ID", example = "1")
+ private Long id;
+
+ /**
+ * 任务组
+ */
+ @Schema(description = "任务组", example = "continew-admin")
+ private String groupName;
+
+ /**
+ * 任务名称
+ */
+ @Schema(description = "任务名称", example = "定时任务1")
+ private String jobName;
+
+ /**
+ * 描述
+ */
+ @Schema(description = "描述", example = "定时任务1的描述")
+ private String description;
+
+ /**
+ * 触发类型
+ */
+ @Schema(description = "触发类型", example = "2")
+ private JobTriggerTypeEnum triggerType;
+
+ /**
+ * 间隔时长
+ */
+ @Schema(description = "间隔时长", example = "60")
+ private String triggerInterval;
+
+ /**
+ * 执行器类型
+ */
+ @Schema(description = " 执行器类型", example = "1")
+ private Integer executorType;
+
+ /**
+ * 任务类型
+ */
+ @Schema(description = "任务类型", example = "1")
+ private JobTaskTypeEnum taskType;
+
+ /**
+ * 执行器名称
+ */
+ @Schema(description = "执行器名称", example = "test")
+ private String executorInfo;
+
+ /**
+ * 任务参数
+ */
+ @Schema(description = "任务参数", example = "")
+ private String argsStr;
+
+ /**
+ * 参数类型
+ */
+ @Schema(description = "参数类型", example = "1")
+ private String argsType;
+
+ /**
+ * 路由策略
+ */
+ @Schema(description = "路由策略", example = "1")
+ private JobRouteStrategyEnum routeKey;
+
+ /**
+ * 阻塞策略
+ */
+ @Schema(description = "阻塞策略", example = "1")
+ private JobBlockStrategyEnum blockStrategy;
+
+ /**
+ * 超时时间(单位:秒)
+ */
+ @Schema(description = "超时时间(单位:秒)", example = "60")
+ private Integer executorTimeout;
+
+ /**
+ * 最大重试次数
+ */
+ @Schema(description = "最大重试次数", example = "3")
+ private Integer maxRetryTimes;
+
+ /**
+ * 重试间隔(单位:秒)
+ */
+ @Schema(description = "重试间隔", example = "1")
+ private Integer retryInterval;
+
+ /**
+ * 并行数
+ */
+ @Schema(description = "并行数", example = "1")
+ private Integer parallelNum;
+
+ /**
+ * 任务状态
+ */
+ @Schema(description = "任务状态", example = "1")
+ private JobStatusEnum jobStatus;
+
+ /**
+ * 下次触发时间
+ */
+ @Schema(description = "下次触发时间", example = "2023-08-08 08:09:00", type = "string")
+ private LocalDateTime nextTriggerAt;
+
+ /**
+ * 创建时间
+ */
+ @Schema(description = "创建时间", example = "2023-08-08 08:08:00", type = "string")
+ private LocalDateTime createDt;
+
+ /**
+ * 修改时间
+ */
+ @Schema(description = "修改时间", example = "2023-08-08 08:08:00", type = "string")
+ private LocalDateTime updateDt;
+}
\ No newline at end of file
diff --git a/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/service/JobLogService.java b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/service/JobLogService.java
new file mode 100644
index 000000000..67a0b86c1
--- /dev/null
+++ b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/service/JobLogService.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
+ *
+ * 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
+ *
+ * http://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 top.continew.admin.job.service;
+
+import top.continew.admin.job.model.JobInstanceLogPageResult;
+import top.continew.admin.job.model.query.JobInstanceLogQuery;
+import top.continew.admin.job.model.query.JobLogQuery;
+import top.continew.admin.job.model.query.JobInstanceQuery;
+import top.continew.admin.job.model.resp.JobLogResp;
+import top.continew.admin.job.model.resp.JobInstanceResp;
+import top.continew.starter.extension.crud.model.resp.PageResp;
+
+import java.util.List;
+
+/**
+ * 任务日志业务接口
+ *
+ * @author KAI
+ * @author Charles7c
+ * @since 2024/6/27 22:52
+ */
+public interface JobLogService {
+
+ /**
+ * 分页查询列表
+ *
+ * @param query 查询条件
+ * @return 分页列表信息
+ */
+ PageResp page(JobLogQuery query);
+
+ /**
+ * 停止
+ *
+ * @param id ID
+ * @return 停止结果
+ */
+ boolean stop(Long id);
+
+ /**
+ * 重试
+ *
+ * @param id ID
+ * @return 重试结果
+ */
+ boolean retry(Long id);
+
+ /**
+ * 查询任务实例列表
+ *
+ * @param query 查询条件
+ * @return 列表信息
+ */
+ List listInstance(JobInstanceQuery query);
+
+ /**
+ * 分页查询任务实例日志列表
+ *
+ * @param query 查询条件
+ * @return 分页列表信息
+ */
+ JobInstanceLogPageResult pageInstanceLog(JobInstanceLogQuery query);
+}
diff --git a/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/service/JobService.java b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/service/JobService.java
new file mode 100644
index 000000000..af3e989ed
--- /dev/null
+++ b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/service/JobService.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
+ *
+ * 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
+ *
+ * http://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 top.continew.admin.job.service;
+
+import top.continew.admin.job.model.query.JobQuery;
+import top.continew.admin.job.model.req.JobReq;
+import top.continew.admin.job.model.req.JobStatusReq;
+import top.continew.admin.job.model.resp.JobResp;
+import top.continew.starter.extension.crud.model.resp.PageResp;
+
+import java.util.List;
+
+/**
+ * 任务业务接口
+ *
+ * @author KAI
+ * @author Charles7c
+ * @since 2024/6/25 17:20
+ */
+public interface JobService {
+
+ /**
+ * 分页查询列表
+ *
+ * @param query 查询条件
+ * @return 分页列表信息
+ */
+ PageResp page(JobQuery query);
+
+ /**
+ * 新增
+ *
+ * @param req 创建信息
+ * @return 新增结果
+ */
+ boolean add(JobReq req);
+
+ /**
+ * 修改
+ *
+ * @param req 修改信息
+ * @param id ID
+ * @return 修改结果
+ */
+ boolean update(JobReq req, Long id);
+
+ /**
+ * 修改状态
+ *
+ * @param req 修改状态信息
+ * @param id ID
+ * @return 修改状态结果
+ */
+ boolean updateStatus(JobStatusReq req, Long id);
+
+ /**
+ * 删除
+ *
+ * @param id ID
+ * @return 删除结果
+ */
+ boolean delete(Long id);
+
+ /**
+ * 执行
+ *
+ * @param id ID
+ * @return 执行结果
+ */
+ boolean trigger(Long id);
+
+ /**
+ * 查询分组列表
+ *
+ * @return 分组列表
+ */
+ List listGroup();
+}
diff --git a/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/service/impl/JobLogServiceImpl.java b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/service/impl/JobLogServiceImpl.java
new file mode 100644
index 000000000..f881f6163
--- /dev/null
+++ b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/service/impl/JobLogServiceImpl.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
+ *
+ * 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
+ *
+ * http://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 top.continew.admin.job.service.impl;
+
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+import top.continew.admin.job.api.JobBatchApi;
+import top.continew.admin.job.api.JobClient;
+import top.continew.admin.job.model.JobInstanceLogPageResult;
+import top.continew.admin.job.model.query.JobInstanceLogQuery;
+import top.continew.admin.job.model.query.JobLogQuery;
+import top.continew.admin.job.model.query.JobInstanceQuery;
+import top.continew.admin.job.model.resp.JobLogResp;
+import top.continew.admin.job.model.resp.JobInstanceResp;
+import top.continew.admin.job.service.JobLogService;
+import top.continew.starter.extension.crud.model.resp.PageResp;
+
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * 任务日志业务实现
+ *
+ * @author KAI
+ * @author Charles7c
+ * @since 2024/6/27 22:54
+ */
+@Service
+@RequiredArgsConstructor
+public class JobLogServiceImpl implements JobLogService {
+
+ private final JobClient jobClient;
+ private final JobBatchApi jobBatchApi;
+
+ @Override
+ public PageResp page(JobLogQuery query) {
+ return jobClient.requestPage(() -> jobBatchApi.page(query.getJobId(), query.getJobName(), query
+ .getGroupName(), query.getTaskBatchStatus(), query.getDatetimeRange(), query.getPage(), query.getSize()));
+ }
+
+ @Override
+ public boolean stop(Long id) {
+ return Boolean.TRUE.equals(jobClient.request(() -> jobBatchApi.stop(id)));
+ }
+
+ @Override
+ public boolean retry(Long id) {
+ return Boolean.TRUE.equals(jobClient.request(() -> jobBatchApi.retry(id)));
+ }
+
+ @Override
+ public List listInstance(JobInstanceQuery query) {
+ return jobClient.requestPage(() -> jobBatchApi.pageTask(query.getJobId(), query.getTaskBatchId(), 1, 100))
+ .getList();
+ }
+
+ @Override
+ public JobInstanceLogPageResult pageInstanceLog(JobInstanceLogQuery query) {
+ return Objects.requireNonNull(jobBatchApi.pageLog(query.getJobId(), query.getTaskBatchId(), query
+ .getTaskId(), query.getStartId(), query.getFromIndex(), query.getSize()).getBody()).getData();
+ }
+}
diff --git a/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/service/impl/JobServiceImpl.java b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/service/impl/JobServiceImpl.java
new file mode 100644
index 000000000..2b9c85ae8
--- /dev/null
+++ b/continew-admin-plugins/continew-admin-job/src/main/java/top/continew/admin/job/service/impl/JobServiceImpl.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
+ *
+ * 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
+ *
+ * http://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 top.continew.admin.job.service.impl;
+
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+import top.continew.admin.job.api.JobApi;
+import top.continew.admin.job.api.JobClient;
+import top.continew.admin.job.model.query.JobQuery;
+import top.continew.admin.job.model.req.JobReq;
+import top.continew.admin.job.model.req.JobStatusReq;
+import top.continew.admin.job.model.resp.JobResp;
+import top.continew.admin.job.service.JobService;
+import top.continew.starter.extension.crud.model.resp.PageResp;
+
+import java.util.List;
+
+/**
+ * 任务业务实现
+ *
+ * @author KAI
+ * @author Charles7c
+ * @since 2024/6/25 17:25
+ */
+@Service
+@RequiredArgsConstructor
+public class JobServiceImpl implements JobService {
+
+ private final JobClient jobClient;
+ private final JobApi jobApi;
+
+ @Override
+ public PageResp page(JobQuery query) {
+ return jobClient.requestPage(() -> jobApi.page(query.getGroupName(), query.getJobName(), query
+ .getJobStatus(), query.getPage(), query.getSize()));
+ }
+
+ @Override
+ public boolean add(JobReq req) {
+ return Boolean.TRUE.equals(jobClient.request(() -> jobApi.add(req)));
+ }
+
+ @Override
+ public boolean update(JobReq req, Long id) {
+ req.setId(id);
+ return Boolean.TRUE.equals(jobClient.request(() -> jobApi.update(req)));
+ }
+
+ @Override
+ public boolean updateStatus(JobStatusReq req, Long id) {
+ req.setId(id);
+ return Boolean.TRUE.equals(jobClient.request(() -> jobApi.updateStatus(req)));
+ }
+
+ @Override
+ public boolean delete(Long id) {
+ return Boolean.TRUE.equals(jobClient.request(() -> jobApi.delete(id)));
+ }
+
+ @Override
+ public boolean trigger(Long id) {
+ return Boolean.TRUE.equals(jobClient.request(() -> jobApi.trigger(id)));
+ }
+
+ @Override
+ public List listGroup() {
+ return jobClient.request(jobApi::listGroup);
+ }
+}
\ No newline at end of file
diff --git a/continew-admin-plugins/pom.xml b/continew-admin-plugins/pom.xml
index fcdb848fa..db22cca0d 100644
--- a/continew-admin-plugins/pom.xml
+++ b/continew-admin-plugins/pom.xml
@@ -15,6 +15,7 @@
continew-admin-generator
+ continew-admin-job
diff --git a/continew-admin-webapi/pom.xml b/continew-admin-webapi/pom.xml
index 31a77954f..afdbe8a1d 100644
--- a/continew-admin-webapi/pom.xml
+++ b/continew-admin-webapi/pom.xml
@@ -25,16 +25,10 @@
-
-
- org.liquibase
- liquibase-core
-
-
+
- org.springframework.boot
- spring-boot-starter-test
- test
+ top.continew
+ continew-admin-system
@@ -43,10 +37,23 @@
continew-admin-generator
-
+
top.continew
- continew-admin-system
+ continew-admin-job
+ ${revision}
+
+
+
+
+ org.liquibase
+ liquibase-core
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
diff --git a/continew-admin-webapi/src/main/java/top/continew/admin/controller/schedule/JobController.java b/continew-admin-webapi/src/main/java/top/continew/admin/controller/schedule/JobController.java
new file mode 100644
index 000000000..6d52f0617
--- /dev/null
+++ b/continew-admin-webapi/src/main/java/top/continew/admin/controller/schedule/JobController.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
+ *
+ * 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
+ *
+ * http://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 top.continew.admin.controller.schedule;
+
+import cn.dev33.satoken.annotation.SaCheckPermission;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.enums.ParameterIn;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.RequiredArgsConstructor;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+import top.continew.admin.job.model.query.JobQuery;
+import top.continew.admin.job.model.req.JobReq;
+import top.continew.admin.job.model.req.JobStatusReq;
+import top.continew.admin.job.model.resp.JobResp;
+import top.continew.admin.job.service.JobService;
+import top.continew.starter.extension.crud.model.resp.PageResp;
+import top.continew.starter.extension.crud.util.ValidateGroup;
+import top.continew.starter.log.core.annotation.Log;
+import top.continew.starter.web.model.R;
+
+import java.util.List;
+
+/**
+ * 任务 API
+ *
+ * @author KAI
+ * @author Charles7c
+ * @since 2024/6/25 22:24
+ */
+@Tag(name = " 任务 API")
+@Validated
+@RestController
+@RequiredArgsConstructor
+@RequestMapping("/schedule/job")
+public class JobController {
+
+ private final JobService baseService;
+
+ @Operation(summary = "分页查询任务列表", description = "分页查询任务列表")
+ @SaCheckPermission("schedule:job:list")
+ @GetMapping
+ public R> page(JobQuery query) {
+ return R.ok(baseService.page(query));
+ }
+
+ @Operation(summary = "新增任务", description = "新增任务")
+ @SaCheckPermission("schedule:job:add")
+ @PostMapping
+ public R add(@Validated(ValidateGroup.Crud.Add.class) @RequestBody JobReq req) {
+ return baseService.add(req) ? R.ok() : R.fail();
+ }
+
+ @Operation(summary = "修改任务", description = "修改任务")
+ @Parameter(name = "id", description = "ID", example = "1", in = ParameterIn.PATH)
+ @SaCheckPermission("schedule:job:update")
+ @PutMapping("/{id}")
+ public R update(@Validated(ValidateGroup.Crud.Update.class) @RequestBody JobReq req, @PathVariable Long id) {
+ return baseService.update(req, id) ? R.ok() : R.fail();
+ }
+
+ @Operation(summary = "修改任务状态", description = "修改任务状态")
+ @SaCheckPermission("schedule:job:update")
+ @PatchMapping("/{id}/status")
+ public R updateStatus(@Validated @RequestBody JobStatusReq req, @PathVariable Long id) {
+ return baseService.updateStatus(req, id) ? R.ok() : R.fail();
+ }
+
+ @Operation(summary = "删除任务", description = "删除任务")
+ @Parameter(name = "id", description = "ID", example = "1", in = ParameterIn.PATH)
+ @SaCheckPermission("schedule:job:delete")
+ @DeleteMapping("/{id}")
+ public R delete(@PathVariable Long id) {
+ return baseService.delete(id) ? R.ok() : R.fail();
+ }
+
+ @Operation(summary = "执行任务", description = "执行任务")
+ @Parameter(name = "id", description = "ID", example = "1", in = ParameterIn.PATH)
+ @SaCheckPermission("schedule:job:trigger")
+ @PostMapping("/trigger/{id}")
+ public R trigger(@PathVariable Long id) {
+ return baseService.trigger(id) ? R.ok() : R.fail();
+ }
+
+ @Log(ignore = true)
+ @Operation(summary = "查询任务分组列表", description = "查询任务分组列表")
+ @SaCheckPermission("schedule:job:list")
+ @GetMapping("/group")
+ public R> listGroup() {
+ List groupList = baseService.listGroup();
+ return R.ok(groupList);
+ }
+}
diff --git a/continew-admin-webapi/src/main/java/top/continew/admin/controller/schedule/JobLogController.java b/continew-admin-webapi/src/main/java/top/continew/admin/controller/schedule/JobLogController.java
new file mode 100644
index 000000000..e924e2dc6
--- /dev/null
+++ b/continew-admin-webapi/src/main/java/top/continew/admin/controller/schedule/JobLogController.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
+ *
+ * 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
+ *
+ * http://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 top.continew.admin.controller.schedule;
+
+import cn.dev33.satoken.annotation.SaCheckPermission;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.enums.ParameterIn;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.RequiredArgsConstructor;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+import top.continew.admin.job.model.JobInstanceLogPageResult;
+import top.continew.admin.job.model.query.JobInstanceLogQuery;
+import top.continew.admin.job.model.query.JobLogQuery;
+import top.continew.admin.job.model.query.JobInstanceQuery;
+import top.continew.admin.job.model.resp.JobLogResp;
+import top.continew.admin.job.model.resp.JobInstanceResp;
+import top.continew.admin.job.service.JobLogService;
+import top.continew.starter.extension.crud.model.resp.PageResp;
+import top.continew.starter.web.model.R;
+
+import java.util.List;
+
+/**
+ * 任务日志 API
+ *
+ * @author KAI
+ * @author Charles7c
+ * @since 2024/6/27 22:24
+ */
+@Tag(name = " 任务日志 API")
+@Validated
+@RestController
+@RequiredArgsConstructor
+@RequestMapping("/schedule/log")
+public class JobLogController {
+
+ private final JobLogService baseService;
+
+ @Operation(summary = "分页查询任务日志列表", description = "分页查询任务日志列表")
+ @SaCheckPermission("schedule:log:list")
+ @GetMapping
+ public R> page(JobLogQuery query) {
+ return R.ok(baseService.page(query));
+ }
+
+ @Operation(summary = "停止任务", description = "停止任务")
+ @Parameter(name = "id", description = "ID", example = "1", in = ParameterIn.PATH)
+ @SaCheckPermission("schedule:log:stop")
+ @PostMapping("/stop/{id}")
+ public R stop(@PathVariable Long id) {
+ return baseService.stop(id) ? R.ok() : R.fail();
+ }
+
+ @Operation(summary = "重试任务", description = "重试任务")
+ @Parameter(name = "id", description = "ID", example = "1", in = ParameterIn.PATH)
+ @SaCheckPermission("schedule:log:retry")
+ @PostMapping("/retry/{id}")
+ public R retry(@PathVariable Long id) {
+ return baseService.retry(id) ? R.ok() : R.fail();
+ }
+
+ @Operation(summary = "查询任务实例列表", description = "查询任务实例列表")
+ @SaCheckPermission("schedule:log:list")
+ @GetMapping("/instance")
+ public R> listInstance(JobInstanceQuery query) {
+ return R.ok(baseService.listInstance(query));
+ }
+
+ @Operation(summary = "分页查询任务实例日志列表", description = "分页查询任务实例日志列表")
+ @SaCheckPermission("schedule:log:list")
+ @GetMapping("/instance/log")
+ public R pageInstanceLog(JobInstanceLogQuery query) {
+ return R.ok(baseService.pageInstanceLog(query));
+ }
+}
diff --git a/continew-admin-webapi/src/main/resources/config/application-dev.yml b/continew-admin-webapi/src/main/resources/config/application-dev.yml
index 02da27554..8d5c0433f 100644
--- a/continew-admin-webapi/src/main/resources/config/application-dev.yml
+++ b/continew-admin-webapi/src/main/resources/config/application-dev.yml
@@ -286,3 +286,51 @@ spring.servlet:
## 头像支持格式配置
avatar:
support-suffix: jpg,jpeg,png,gif
+
+--- ### Snail Job 配置
+snail-job:
+ # 分组名
+ group: continew-admin
+ # 客户端地址(默认自动获取本机 IP)
+ #host: 127.0.0.1
+ # 客户端端口(默认:1789)
+ port: 1789
+ # 名称空间 ID
+ namespace: 764d604ec6fc45f68cd92514c40e9e1a
+ # 令牌
+ token: SJ_Wyz3dmsdbDOkDujOTSSoBjGQP1BMsVnj
+ ## 服务端配置
+ server:
+ # 服务端地址
+ url: http://127.0.0.1:8001/snail-job
+ # 服务端用户名
+ username: admin
+ # 服务端密码
+ password: admin
+ # 服务端地址,若服务端集群部署则此处配置域名
+ host: 127.0.0.1
+ # 服务端端口号
+ port: 1788
+ ## 重试数据批量上报滑动窗口配置
+ retry:
+ reportSlidingWindow:
+ # 窗口期单位
+ chrono-unit: SECONDS
+ # 窗口期时间长度
+ duration: 10
+ # 总量窗口期阈值
+ total-threshold: 50
+ # 窗口数量预警
+ window-total-threshold: 150
+ ## 调度线程池配置
+ dispatcherThreadPool:
+ # 核心线程数
+ corePoolSize: 16
+ # 最大线程数
+ maximumPoolSize: 16
+ # 线程存活时间
+ keepAliveTime: 1
+ # 时间单位
+ timeUnit: SECONDS
+ # 队列容量
+ queueCapacity: 10000
\ No newline at end of file
diff --git a/continew-admin-webapi/src/main/resources/config/application-prod.yml b/continew-admin-webapi/src/main/resources/config/application-prod.yml
index 50b1d9fc0..d1b80bd76 100644
--- a/continew-admin-webapi/src/main/resources/config/application-prod.yml
+++ b/continew-admin-webapi/src/main/resources/config/application-prod.yml
@@ -283,3 +283,51 @@ spring.servlet:
## 头像支持格式配置
avatar:
support-suffix: jpg,jpeg,png,gif
+
+--- ### Snail Job 配置
+snail-job:
+ # 分组名
+ group: continew_admin
+ # 客户端地址(默认自动获取本机 IP)
+ #host: 127.0.0.1
+ # 客户端端口(默认:1789)
+ port: 1789
+ # 名称空间 ID
+ namespace: 764d604ec6fc45f68cd92514c40e9e1a
+ # 令牌
+ token: SJ_Wyz3dmsdbDOkDujOTSSoBjGQP1BMsVnj
+ ## 服务端配置
+ server:
+ # 服务端地址
+ url: http://127.0.0.1:8001/snail-job
+ # 服务端用户名
+ username: admin
+ # 服务端密码
+ password: admin
+ # 服务端地址,若服务端集群部署则此处配置域名
+ host: 127.0.0.1
+ # 服务端端口号
+ port: 1788
+ ## 重试数据批量上报滑动窗口配置
+ retry:
+ reportSlidingWindow:
+ # 窗口期单位
+ chrono-unit: SECONDS
+ # 窗口期时间长度
+ duration: 10
+ # 总量窗口期阈值
+ total-threshold: 50
+ # 窗口数量预警
+ window-total-threshold: 150
+ ## 调度线程池配置
+ dispatcherThreadPool:
+ # 核心线程数
+ corePoolSize: 16
+ # 最大线程数
+ maximumPoolSize: 16
+ # 线程存活时间
+ keepAliveTime: 1
+ # 时间单位
+ timeUnit: SECONDS
+ # 队列容量
+ queueCapacity: 10000
\ No newline at end of file
diff --git a/continew-admin-webapi/src/main/resources/config/application.yml b/continew-admin-webapi/src/main/resources/config/application.yml
index ef4ac2caa..7e38f18e1 100644
--- a/continew-admin-webapi/src/main/resources/config/application.yml
+++ b/continew-admin-webapi/src/main/resources/config/application.yml
@@ -122,10 +122,12 @@ mybatis-plus:
mapper-locations: classpath*:/mapper/**/*Mapper.xml
# 类型别名扫描包配置
type-aliases-package: ${project.base-package}.**.model
+ ## MyBatis 配置
configuration:
# MyBatis 自动映射策略
# NONE:不启用 PARTIAL:只对非嵌套 resultMap 自动映射 FULL:对所有 resultMap 自动映射
auto-mapping-behavior: PARTIAL
+ ## 全局配置
global-config:
banner: true
db-config:
diff --git a/continew-admin-webapi/src/main/resources/db/changelog/mysql/continew-admin_data.sql b/continew-admin-webapi/src/main/resources/db/changelog/mysql/continew-admin_data.sql
index b573fe7db..68b78a065 100644
--- a/continew-admin-webapi/src/main/resources/db/changelog/mysql/continew-admin_data.sql
+++ b/continew-admin-webapi/src/main/resources/db/changelog/mysql/continew-admin_data.sql
@@ -172,4 +172,19 @@ INSERT INTO `sys_storage`
(`id`, `name`, `code`, `type`, `access_key`, `secret_key`, `endpoint`, `bucket_name`, `domain`, `description`, `is_default`, `sort`, `status`, `create_user`, `create_time`, `update_user`, `update_time`)
VALUES
(1, '开发环境', 'local_dev', 2, NULL, NULL, NULL, 'C:/continew-admin/data/file/', 'http://localhost:8000/file', '本地存储', b'1', 1, 1, 1, NOW(), NULL, NULL),
-(2, '生产环境', 'local_prod', 2, NULL, NULL, NULL, '../data/file/', 'http://api.continew.top/file', '本地存储', b'0', 2, 2, 1, NOW(), NULL, NULL);
\ No newline at end of file
+(2, '生产环境', 'local_prod', 2, NULL, NULL, NULL, '../data/file/', 'http://api.continew.top/file', '本地存储', b'0', 2, 2, 1, NOW(), NULL, NULL);
+
+-- changeset Kai:3.2-1
+INSERT INTO `sys_menu` (`id`, `title`, `parent_id`, `type`, `path`, `name`, `component`, `redirect`, `icon`, `is_external`, `is_cache`, `is_hidden`, `permission`, `sort`, `status`, `create_user`, `create_time`, `update_user`, `update_time`)
+VALUES
+(4000, '任务调度', 0, 1, '/schedule', 'Schedule', 'Layout', '/schedule/job', 'schedule', b'0', b'0', b'0', NULL, 997, 1, 1, NOW(), NULL, NULL),
+(4010, '任务管理', 4000, 2, '/schedule/job', 'ScheduleJob', 'schedule/job/index', NULL, 'select-all', b'0', b'0', b'0', NULL, 1, 1, 1, NOW(), NULL, NULL),
+(4011, '查看', 4010, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'schedule:job:list', 1, 1, 1, NOW(), NULL, NULL),
+(4012, '新增', 4010, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'schedule:job:add', 2, 1, 1, NOW(), NULL, NULL),
+(4013, '修改', 4010, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'schedule:job:update', 3, 1, 1, NOW(), NULL, NULL),
+(4014, '删除', 4010, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'schedule:job:delete', 4, 1, 1, NOW(), NULL, NULL),
+(4015, '执行', 1010, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'schedule:job:trigger', 5, 1, 1, NOW(), NULL, NULL),
+(4020, '任务日志', 4000, 2, '/schedule/log', 'ScheduleLog', 'schedule/log/index', NULL, 'find-replace', b'0', b'0', b'0', NULL, 2, 1, 1, NOW(), NULL, NULL),
+(4021, '查看', 4020, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'schedule:log:list', 1, 1, 1, NOW(), NULL, NULL),
+(4022, '停止', 4020, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'schedule:log:stop', 2, 1, 1, NOW(), NULL, NULL),
+(4023, '重试', 4020, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'schedule:log:retry', 3, 1, 1, NOW(), NULL, NULL);
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 5714951bc..7cda44738 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,27 +28,40 @@
continew-admin-plugins
continew-admin-system
continew-admin-common
+ continew-admin-extension
3.1.0
+
+ 1.1.0-beta1
-
+
- top.continew
- continew-admin-webapi
- ${revision}
+ com.aizuda
+ snail-job-client-starter
+ ${snail-job.version}
+
+
+ com.aizuda
+ snail-job-client-retry-core
+ ${snail-job.version}
+
+
+ com.aizuda
+ snail-job-client-job-core
+ ${snail-job.version}
-
+
top.continew
- continew-admin-generator
+ continew-admin-webapi
${revision}
@@ -65,6 +78,20 @@
continew-admin-common
${revision}
+
+
+
+ top.continew
+ continew-admin-generator
+ ${revision}
+
+
+
+
+ top.continew
+ continew-admin-job
+ ${revision}
+