refactor(系统设置): 定时任务增加资源类型
This commit is contained in:
parent
133119f41b
commit
72b6e303f7
|
@ -10,51 +10,56 @@ import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class Schedule implements Serializable {
|
public class Schedule implements Serializable {
|
||||||
@Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@NotBlank(message = "{schedule.id.not_blank}", groups = {Updated.class})
|
@NotBlank(message = "{schedule.id.not_blank}", groups = {Updated.class})
|
||||||
@Size(min = 1, max = 50, message = "{schedule.id.length_range}", groups = {Created.class, Updated.class})
|
@Size(min = 1, max = 50, message = "{schedule.id.length_range}", groups = {Created.class, Updated.class})
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
@Schema(description = "qrtz UUID")
|
@Schema(description = "qrtz UUID")
|
||||||
private String key;
|
private String key;
|
||||||
|
|
||||||
@Schema(description = "资源类型", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "执行类型 cron", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@NotBlank(message = "{schedule.type.not_blank}", groups = {Created.class})
|
@NotBlank(message = "{schedule.type.not_blank}", groups = {Created.class})
|
||||||
@Size(min = 1, max = 50, message = "{schedule.type.length_range}", groups = {Created.class, Updated.class})
|
@Size(min = 1, max = 50, message = "{schedule.type.length_range}", groups = {Created.class, Updated.class})
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
@Schema(description = "cron 表达式", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "cron 表达式", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@NotBlank(message = "{schedule.value.not_blank}", groups = {Created.class})
|
@NotBlank(message = "{schedule.value.not_blank}", groups = {Created.class})
|
||||||
@Size(min = 1, max = 255, message = "{schedule.value.length_range}", groups = {Created.class, Updated.class})
|
@Size(min = 1, max = 255, message = "{schedule.value.length_range}", groups = {Created.class, Updated.class})
|
||||||
private String value;
|
private String value;
|
||||||
|
|
||||||
@Schema(description = "Schedule Job Class Name", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "Schedule Job Class Name", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@NotBlank(message = "{schedule.job.not_blank}", groups = {Created.class})
|
@NotBlank(message = "{schedule.job.not_blank}", groups = {Created.class})
|
||||||
@Size(min = 1, max = 64, message = "{schedule.job.length_range}", groups = {Created.class, Updated.class})
|
@Size(min = 1, max = 64, message = "{schedule.job.length_range}", groups = {Created.class, Updated.class})
|
||||||
private String job;
|
private String job;
|
||||||
|
|
||||||
@Schema(description = "是否开启")
|
@Schema(description = "资源类型 API/TESL_PLAN", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotBlank(message = "{schedule.resource_type.not_blank}", groups = {Created.class})
|
||||||
|
@Size(min = 1, max = 50, message = "{schedule.resource_type.length_range}", groups = {Created.class, Updated.class})
|
||||||
|
private String resourceType;
|
||||||
|
|
||||||
|
@Schema(description = "是否开启")
|
||||||
private Boolean enable;
|
private Boolean enable;
|
||||||
|
|
||||||
@Schema(description = "资源ID,api_scenario ui_scenario load_test")
|
@Schema(description = "资源ID,api_scenario ui_scenario load_test")
|
||||||
private String resourceId;
|
private String resourceId;
|
||||||
|
|
||||||
@Schema(description = "创建人")
|
@Schema(description = "创建人")
|
||||||
private String createUser;
|
private String createUser;
|
||||||
|
|
||||||
@Schema(description = "创建时间")
|
@Schema(description = "创建时间")
|
||||||
private Long createTime;
|
private Long createTime;
|
||||||
|
|
||||||
@Schema(description = "更新时间")
|
@Schema(description = "更新时间")
|
||||||
private Long updateTime;
|
private Long updateTime;
|
||||||
|
|
||||||
@Schema(description = "项目ID")
|
@Schema(description = "项目ID")
|
||||||
private String projectId;
|
private String projectId;
|
||||||
|
|
||||||
@Schema(description = "名称")
|
@Schema(description = "名称")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@Schema(description = "配置")
|
@Schema(description = "配置")
|
||||||
private String config;
|
private String config;
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
@ -65,6 +70,7 @@ public class Schedule implements Serializable {
|
||||||
type("type", "type", "VARCHAR", true),
|
type("type", "type", "VARCHAR", true),
|
||||||
value("value", "value", "VARCHAR", true),
|
value("value", "value", "VARCHAR", true),
|
||||||
job("job", "job", "VARCHAR", false),
|
job("job", "job", "VARCHAR", false),
|
||||||
|
resourceType("resource_type", "resourceType", "VARCHAR", false),
|
||||||
enable("enable", "enable", "BIT", true),
|
enable("enable", "enable", "BIT", true),
|
||||||
resourceId("resource_id", "resourceId", "VARCHAR", false),
|
resourceId("resource_id", "resourceId", "VARCHAR", false),
|
||||||
createUser("create_user", "createUser", "VARCHAR", false),
|
createUser("create_user", "createUser", "VARCHAR", false),
|
||||||
|
|
|
@ -454,6 +454,76 @@ public class ScheduleExample {
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Criteria andResourceTypeIsNull() {
|
||||||
|
addCriterion("resource_type is null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andResourceTypeIsNotNull() {
|
||||||
|
addCriterion("resource_type is not null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andResourceTypeEqualTo(String value) {
|
||||||
|
addCriterion("resource_type =", value, "resourceType");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andResourceTypeNotEqualTo(String value) {
|
||||||
|
addCriterion("resource_type <>", value, "resourceType");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andResourceTypeGreaterThan(String value) {
|
||||||
|
addCriterion("resource_type >", value, "resourceType");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andResourceTypeGreaterThanOrEqualTo(String value) {
|
||||||
|
addCriterion("resource_type >=", value, "resourceType");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andResourceTypeLessThan(String value) {
|
||||||
|
addCriterion("resource_type <", value, "resourceType");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andResourceTypeLessThanOrEqualTo(String value) {
|
||||||
|
addCriterion("resource_type <=", value, "resourceType");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andResourceTypeLike(String value) {
|
||||||
|
addCriterion("resource_type like", value, "resourceType");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andResourceTypeNotLike(String value) {
|
||||||
|
addCriterion("resource_type not like", value, "resourceType");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andResourceTypeIn(List<String> values) {
|
||||||
|
addCriterion("resource_type in", values, "resourceType");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andResourceTypeNotIn(List<String> values) {
|
||||||
|
addCriterion("resource_type not in", values, "resourceType");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andResourceTypeBetween(String value1, String value2) {
|
||||||
|
addCriterion("resource_type between", value1, value2, "resourceType");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andResourceTypeNotBetween(String value1, String value2) {
|
||||||
|
addCriterion("resource_type not between", value1, value2, "resourceType");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
public Criteria andEnableIsNull() {
|
public Criteria andEnableIsNull() {
|
||||||
addCriterion("`enable` is null");
|
addCriterion("`enable` is null");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
<result column="type" jdbcType="VARCHAR" property="type" />
|
<result column="type" jdbcType="VARCHAR" property="type" />
|
||||||
<result column="value" jdbcType="VARCHAR" property="value" />
|
<result column="value" jdbcType="VARCHAR" property="value" />
|
||||||
<result column="job" jdbcType="VARCHAR" property="job" />
|
<result column="job" jdbcType="VARCHAR" property="job" />
|
||||||
|
<result column="resource_type" jdbcType="VARCHAR" property="resourceType" />
|
||||||
<result column="enable" jdbcType="BIT" property="enable" />
|
<result column="enable" jdbcType="BIT" property="enable" />
|
||||||
<result column="resource_id" jdbcType="VARCHAR" property="resourceId" />
|
<result column="resource_id" jdbcType="VARCHAR" property="resourceId" />
|
||||||
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
|
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
|
||||||
|
@ -75,8 +76,8 @@
|
||||||
</where>
|
</where>
|
||||||
</sql>
|
</sql>
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id, `key`, `type`, `value`, job, `enable`, resource_id, create_user, create_time,
|
id, `key`, `type`, `value`, job, resource_type, `enable`, resource_id, create_user,
|
||||||
update_time, project_id, `name`, config
|
create_time, update_time, project_id, `name`, config
|
||||||
</sql>
|
</sql>
|
||||||
<select id="selectByExample" parameterType="io.metersphere.system.domain.ScheduleExample" resultMap="BaseResultMap">
|
<select id="selectByExample" parameterType="io.metersphere.system.domain.ScheduleExample" resultMap="BaseResultMap">
|
||||||
select
|
select
|
||||||
|
@ -110,15 +111,15 @@
|
||||||
</delete>
|
</delete>
|
||||||
<insert id="insert" parameterType="io.metersphere.system.domain.Schedule">
|
<insert id="insert" parameterType="io.metersphere.system.domain.Schedule">
|
||||||
insert into schedule (id, `key`, `type`,
|
insert into schedule (id, `key`, `type`,
|
||||||
`value`, job, `enable`, resource_id,
|
`value`, job, resource_type,
|
||||||
create_user, create_time, update_time,
|
`enable`, resource_id, create_user,
|
||||||
project_id, `name`, config
|
create_time, update_time, project_id,
|
||||||
)
|
`name`, config)
|
||||||
values (#{id,jdbcType=VARCHAR}, #{key,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
|
values (#{id,jdbcType=VARCHAR}, #{key,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
|
||||||
#{value,jdbcType=VARCHAR}, #{job,jdbcType=VARCHAR}, #{enable,jdbcType=BIT}, #{resourceId,jdbcType=VARCHAR},
|
#{value,jdbcType=VARCHAR}, #{job,jdbcType=VARCHAR}, #{resourceType,jdbcType=VARCHAR},
|
||||||
#{createUser,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
|
#{enable,jdbcType=BIT}, #{resourceId,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR},
|
||||||
#{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{config,jdbcType=VARCHAR}
|
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{projectId,jdbcType=VARCHAR},
|
||||||
)
|
#{name,jdbcType=VARCHAR}, #{config,jdbcType=VARCHAR})
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insertSelective" parameterType="io.metersphere.system.domain.Schedule">
|
<insert id="insertSelective" parameterType="io.metersphere.system.domain.Schedule">
|
||||||
insert into schedule
|
insert into schedule
|
||||||
|
@ -138,6 +139,9 @@
|
||||||
<if test="job != null">
|
<if test="job != null">
|
||||||
job,
|
job,
|
||||||
</if>
|
</if>
|
||||||
|
<if test="resourceType != null">
|
||||||
|
resource_type,
|
||||||
|
</if>
|
||||||
<if test="enable != null">
|
<if test="enable != null">
|
||||||
`enable`,
|
`enable`,
|
||||||
</if>
|
</if>
|
||||||
|
@ -179,6 +183,9 @@
|
||||||
<if test="job != null">
|
<if test="job != null">
|
||||||
#{job,jdbcType=VARCHAR},
|
#{job,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="resourceType != null">
|
||||||
|
#{resourceType,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
<if test="enable != null">
|
<if test="enable != null">
|
||||||
#{enable,jdbcType=BIT},
|
#{enable,jdbcType=BIT},
|
||||||
</if>
|
</if>
|
||||||
|
@ -229,6 +236,9 @@
|
||||||
<if test="record.job != null">
|
<if test="record.job != null">
|
||||||
job = #{record.job,jdbcType=VARCHAR},
|
job = #{record.job,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="record.resourceType != null">
|
||||||
|
resource_type = #{record.resourceType,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
<if test="record.enable != null">
|
<if test="record.enable != null">
|
||||||
`enable` = #{record.enable,jdbcType=BIT},
|
`enable` = #{record.enable,jdbcType=BIT},
|
||||||
</if>
|
</if>
|
||||||
|
@ -265,6 +275,7 @@
|
||||||
`type` = #{record.type,jdbcType=VARCHAR},
|
`type` = #{record.type,jdbcType=VARCHAR},
|
||||||
`value` = #{record.value,jdbcType=VARCHAR},
|
`value` = #{record.value,jdbcType=VARCHAR},
|
||||||
job = #{record.job,jdbcType=VARCHAR},
|
job = #{record.job,jdbcType=VARCHAR},
|
||||||
|
resource_type = #{record.resourceType,jdbcType=VARCHAR},
|
||||||
`enable` = #{record.enable,jdbcType=BIT},
|
`enable` = #{record.enable,jdbcType=BIT},
|
||||||
resource_id = #{record.resourceId,jdbcType=VARCHAR},
|
resource_id = #{record.resourceId,jdbcType=VARCHAR},
|
||||||
create_user = #{record.createUser,jdbcType=VARCHAR},
|
create_user = #{record.createUser,jdbcType=VARCHAR},
|
||||||
|
@ -292,6 +303,9 @@
|
||||||
<if test="job != null">
|
<if test="job != null">
|
||||||
job = #{job,jdbcType=VARCHAR},
|
job = #{job,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="resourceType != null">
|
||||||
|
resource_type = #{resourceType,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
<if test="enable != null">
|
<if test="enable != null">
|
||||||
`enable` = #{enable,jdbcType=BIT},
|
`enable` = #{enable,jdbcType=BIT},
|
||||||
</if>
|
</if>
|
||||||
|
@ -325,6 +339,7 @@
|
||||||
`type` = #{type,jdbcType=VARCHAR},
|
`type` = #{type,jdbcType=VARCHAR},
|
||||||
`value` = #{value,jdbcType=VARCHAR},
|
`value` = #{value,jdbcType=VARCHAR},
|
||||||
job = #{job,jdbcType=VARCHAR},
|
job = #{job,jdbcType=VARCHAR},
|
||||||
|
resource_type = #{resourceType,jdbcType=VARCHAR},
|
||||||
`enable` = #{enable,jdbcType=BIT},
|
`enable` = #{enable,jdbcType=BIT},
|
||||||
resource_id = #{resourceId,jdbcType=VARCHAR},
|
resource_id = #{resourceId,jdbcType=VARCHAR},
|
||||||
create_user = #{createUser,jdbcType=VARCHAR},
|
create_user = #{createUser,jdbcType=VARCHAR},
|
||||||
|
@ -337,15 +352,15 @@
|
||||||
</update>
|
</update>
|
||||||
<insert id="batchInsert" parameterType="map">
|
<insert id="batchInsert" parameterType="map">
|
||||||
insert into schedule
|
insert into schedule
|
||||||
(id, `key`, `type`, `value`, job, `enable`, resource_id, create_user, create_time,
|
(id, `key`, `type`, `value`, job, resource_type, `enable`, resource_id, create_user,
|
||||||
update_time, project_id, `name`, config)
|
create_time, update_time, project_id, `name`, config)
|
||||||
values
|
values
|
||||||
<foreach collection="list" item="item" separator=",">
|
<foreach collection="list" item="item" separator=",">
|
||||||
(#{item.id,jdbcType=VARCHAR}, #{item.key,jdbcType=VARCHAR}, #{item.type,jdbcType=VARCHAR},
|
(#{item.id,jdbcType=VARCHAR}, #{item.key,jdbcType=VARCHAR}, #{item.type,jdbcType=VARCHAR},
|
||||||
#{item.value,jdbcType=VARCHAR}, #{item.job,jdbcType=VARCHAR}, #{item.enable,jdbcType=BIT},
|
#{item.value,jdbcType=VARCHAR}, #{item.job,jdbcType=VARCHAR}, #{item.resourceType,jdbcType=VARCHAR},
|
||||||
#{item.resourceId,jdbcType=VARCHAR}, #{item.createUser,jdbcType=VARCHAR}, #{item.createTime,jdbcType=BIGINT},
|
#{item.enable,jdbcType=BIT}, #{item.resourceId,jdbcType=VARCHAR}, #{item.createUser,jdbcType=VARCHAR},
|
||||||
#{item.updateTime,jdbcType=BIGINT}, #{item.projectId,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR},
|
#{item.createTime,jdbcType=BIGINT}, #{item.updateTime,jdbcType=BIGINT}, #{item.projectId,jdbcType=VARCHAR},
|
||||||
#{item.config,jdbcType=VARCHAR})
|
#{item.name,jdbcType=VARCHAR}, #{item.config,jdbcType=VARCHAR})
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="batchInsertSelective" parameterType="map">
|
<insert id="batchInsertSelective" parameterType="map">
|
||||||
|
@ -373,6 +388,9 @@
|
||||||
<if test="'job'.toString() == column.value">
|
<if test="'job'.toString() == column.value">
|
||||||
#{item.job,jdbcType=VARCHAR}
|
#{item.job,jdbcType=VARCHAR}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="'resource_type'.toString() == column.value">
|
||||||
|
#{item.resourceType,jdbcType=VARCHAR}
|
||||||
|
</if>
|
||||||
<if test="'enable'.toString() == column.value">
|
<if test="'enable'.toString() == column.value">
|
||||||
#{item.enable,jdbcType=BIT}
|
#{item.enable,jdbcType=BIT}
|
||||||
</if>
|
</if>
|
||||||
|
|
|
@ -113,9 +113,10 @@ CREATE TABLE IF NOT EXISTS schedule
|
||||||
(
|
(
|
||||||
`id` VARCHAR(50) NOT NULL COMMENT '',
|
`id` VARCHAR(50) NOT NULL COMMENT '',
|
||||||
`key` VARCHAR(50) COMMENT 'qrtz UUID',
|
`key` VARCHAR(50) COMMENT 'qrtz UUID',
|
||||||
`type` VARCHAR(50) NOT NULL COMMENT '资源类型',
|
`type` VARCHAR(50) NOT NULL COMMENT '执行类型 cron',
|
||||||
`value` VARCHAR(255) NOT NULL COMMENT 'cron 表达式',
|
`value` VARCHAR(255) NOT NULL COMMENT 'cron 表达式',
|
||||||
`job` VARCHAR(64) NOT NULL COMMENT 'Schedule Job Class Name',
|
`job` VARCHAR(64) NOT NULL COMMENT 'Schedule Job Class Name',
|
||||||
|
`resource_type` VARCHAR(50) NOT NULL DEFAULT 'NONE' COMMENT '资源类型 API_IMPORT,API_SCENARIO,UI_SCENARIO,LOAD_TEST,TEST_PLAN,CLEAN_REPORT,BUG_SYNC' ,
|
||||||
`enable` BIT COMMENT '是否开启',
|
`enable` BIT COMMENT '是否开启',
|
||||||
`resource_id` VARCHAR(50) COMMENT '资源ID,api_scenario ui_scenario load_test',
|
`resource_id` VARCHAR(50) COMMENT '资源ID,api_scenario ui_scenario load_test',
|
||||||
`create_user` VARCHAR(50) NOT NULL COMMENT '创建人',
|
`create_user` VARCHAR(50) NOT NULL COMMENT '创建人',
|
||||||
|
@ -138,6 +139,7 @@ CREATE INDEX idx_project_id ON schedule (`project_id`);
|
||||||
CREATE INDEX idx_enable ON schedule (`enable`);
|
CREATE INDEX idx_enable ON schedule (`enable`);
|
||||||
CREATE INDEX idx_name ON schedule (`name`);
|
CREATE INDEX idx_name ON schedule (`name`);
|
||||||
CREATE INDEX idx_type ON schedule (`type`);
|
CREATE INDEX idx_type ON schedule (`type`);
|
||||||
|
CREATE INDEX idx_resource_type ON schedule(`resource_type`);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS service_integration
|
CREATE TABLE IF NOT EXISTS service_integration
|
||||||
(
|
(
|
||||||
|
|
|
@ -712,7 +712,7 @@ INSERT INTO message_task_blob(id, template) VALUES (@bug_comment_reply_id, 'mess
|
||||||
|
|
||||||
|
|
||||||
-- 初始化定时任务数据
|
-- 初始化定时任务数据
|
||||||
INSERT INTO schedule(`id`, `key`, `type`, `value`, `job`, `enable`, `resource_id`, `create_user`, `create_time`, `update_time`, `project_id`, `name`, `config`) VALUES (UUID_SHORT(), '100001100001', 'CRON', '0 0 2 * * ?', 'io.metersphere.project.job.CleanUpReportJob', true, '100001100001', 'admin', unix_timestamp() * 1000, unix_timestamp() * 1000, '100001100001', 'Clean Report Job', NULL);
|
INSERT INTO schedule(`id`, `key`, `type`,`resource_type`, `value`, `job`, `enable`, `resource_id`, `create_user`, `create_time`, `update_time`, `project_id`, `name`, `config`) VALUES (UUID_SHORT(), '100001100001', 'CRON','CLEAN_REPORT', '0 0 2 * * ?', 'io.metersphere.project.job.CleanUpReportJob', true, '100001100001', 'admin', unix_timestamp() * 1000, unix_timestamp() * 1000, '100001100001', 'Clean Report Job', NULL);
|
||||||
|
|
||||||
-- 初始化默认项目版本配置项
|
-- 初始化默认项目版本配置项
|
||||||
INSERT INTO project_application (`project_id`, `type`, `type_value`) VALUES ('100001100001', 'VERSION_ENABLE', 'FALSE');
|
INSERT INTO project_application (`project_id`, `type`, `type_value`) VALUES ('100001100001', 'VERSION_ENABLE', 'FALSE');
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
package io.metersphere.sdk.constants;
|
||||||
|
|
||||||
|
public enum ScheduleResourceType {
|
||||||
|
API_IMPORT,
|
||||||
|
API_SCENARIO,
|
||||||
|
UI_SCENARIO,
|
||||||
|
LOAD_TEST,
|
||||||
|
TEST_PLAN,
|
||||||
|
CLEAN_REPORT,
|
||||||
|
|
||||||
|
BUG_SYNC
|
||||||
|
}
|
|
@ -11,6 +11,7 @@ import io.metersphere.api.utils.ApiDataUtils;
|
||||||
import io.metersphere.project.mapper.ProjectMapper;
|
import io.metersphere.project.mapper.ProjectMapper;
|
||||||
import io.metersphere.sdk.constants.ApplicationNumScope;
|
import io.metersphere.sdk.constants.ApplicationNumScope;
|
||||||
import io.metersphere.sdk.constants.HttpMethodConstants;
|
import io.metersphere.sdk.constants.HttpMethodConstants;
|
||||||
|
import io.metersphere.sdk.constants.ScheduleResourceType;
|
||||||
import io.metersphere.sdk.constants.ScheduleType;
|
import io.metersphere.sdk.constants.ScheduleType;
|
||||||
import io.metersphere.sdk.exception.MSException;
|
import io.metersphere.sdk.exception.MSException;
|
||||||
import io.metersphere.sdk.util.BeanUtils;
|
import io.metersphere.sdk.util.BeanUtils;
|
||||||
|
@ -66,6 +67,7 @@ public class ApiDefinitionScheduleService {
|
||||||
schedule.setResourceId(apiSwagger.getId());
|
schedule.setResourceId(apiSwagger.getId());
|
||||||
schedule.setJob(SwaggerUrlImportJob.class.getName());
|
schedule.setJob(SwaggerUrlImportJob.class.getName());
|
||||||
schedule.setType(ScheduleType.CRON.name());
|
schedule.setType(ScheduleType.CRON.name());
|
||||||
|
schedule.setResourceType(ScheduleResourceType.API_IMPORT.name());
|
||||||
scheduleService.addSchedule(schedule);
|
scheduleService.addSchedule(schedule);
|
||||||
scheduleService.addOrUpdateCronJob(schedule,
|
scheduleService.addOrUpdateCronJob(schedule,
|
||||||
SwaggerUrlImportJob.getJobKey(apiSwagger.getId()),
|
SwaggerUrlImportJob.getJobKey(apiSwagger.getId()),
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package io.metersphere.project.service;
|
package io.metersphere.project.service;
|
||||||
|
|
||||||
import io.metersphere.project.job.CleanUpReportJob;
|
import io.metersphere.project.job.CleanUpReportJob;
|
||||||
|
import io.metersphere.sdk.constants.ScheduleResourceType;
|
||||||
import io.metersphere.sdk.constants.ScheduleType;
|
import io.metersphere.sdk.constants.ScheduleType;
|
||||||
import io.metersphere.system.domain.Schedule;
|
import io.metersphere.system.domain.Schedule;
|
||||||
import io.metersphere.system.sechedule.ScheduleService;
|
import io.metersphere.system.sechedule.ScheduleService;
|
||||||
|
@ -32,6 +33,7 @@ public class CreateApplicationResourceService implements CreateProjectResourceSe
|
||||||
// 每天凌晨2点执行清理任务
|
// 每天凌晨2点执行清理任务
|
||||||
request.setValue("0 0 2 * * ?");
|
request.setValue("0 0 2 * * ?");
|
||||||
request.setJob(CleanUpReportJob.class.getName());
|
request.setJob(CleanUpReportJob.class.getName());
|
||||||
|
request.setResourceType(ScheduleResourceType.CLEAN_REPORT.name());
|
||||||
scheduleService.addSchedule(request);
|
scheduleService.addSchedule(request);
|
||||||
scheduleService.addOrUpdateCronJob(request,
|
scheduleService.addOrUpdateCronJob(request,
|
||||||
CleanUpReportJob.getJobKey(projectId),
|
CleanUpReportJob.getJobKey(projectId),
|
||||||
|
|
|
@ -15,6 +15,7 @@ import io.metersphere.project.request.ProjectApplicationRequest;
|
||||||
import io.metersphere.project.utils.ModuleSortUtils;
|
import io.metersphere.project.utils.ModuleSortUtils;
|
||||||
import io.metersphere.sdk.constants.OperationLogConstants;
|
import io.metersphere.sdk.constants.OperationLogConstants;
|
||||||
import io.metersphere.sdk.constants.ProjectApplicationType;
|
import io.metersphere.sdk.constants.ProjectApplicationType;
|
||||||
|
import io.metersphere.sdk.constants.ScheduleResourceType;
|
||||||
import io.metersphere.sdk.constants.ScheduleType;
|
import io.metersphere.sdk.constants.ScheduleType;
|
||||||
import io.metersphere.sdk.exception.MSException;
|
import io.metersphere.sdk.exception.MSException;
|
||||||
import io.metersphere.sdk.util.JSON;
|
import io.metersphere.sdk.util.JSON;
|
||||||
|
@ -142,6 +143,7 @@ public class ProjectApplicationService {
|
||||||
// 每天凌晨2点执行清理任务
|
// 每天凌晨2点执行清理任务
|
||||||
request.setValue("0 0 2 * * ?");
|
request.setValue("0 0 2 * * ?");
|
||||||
request.setJob(CleanUpReportJob.class.getName());
|
request.setJob(CleanUpReportJob.class.getName());
|
||||||
|
request.setResourceType(ScheduleResourceType.CLEAN_REPORT.name());
|
||||||
scheduleService.addSchedule(request);
|
scheduleService.addSchedule(request);
|
||||||
scheduleService.addOrUpdateCronJob(request,
|
scheduleService.addOrUpdateCronJob(request,
|
||||||
CleanUpReportJob.getJobKey(projectId),
|
CleanUpReportJob.getJobKey(projectId),
|
||||||
|
@ -280,6 +282,7 @@ public class ProjectApplicationService {
|
||||||
// 每天凌晨2点执行清理任务
|
// 每天凌晨2点执行清理任务
|
||||||
request.setValue(typeValue);
|
request.setValue(typeValue);
|
||||||
request.setJob(BugSyncJob.class.getName());
|
request.setJob(BugSyncJob.class.getName());
|
||||||
|
request.setResourceType(ScheduleResourceType.BUG_SYNC.name());
|
||||||
scheduleService.addSchedule(request);
|
scheduleService.addSchedule(request);
|
||||||
scheduleService.addOrUpdateCronJob(request,
|
scheduleService.addOrUpdateCronJob(request,
|
||||||
BugSyncJob.getJobKey(projectId),
|
BugSyncJob.getJobKey(projectId),
|
||||||
|
|
Loading…
Reference in New Issue