perf(消息管理): 优化消息通知数据结果,简化维护代码成本

This commit is contained in:
guoyuqi 2024-02-07 13:00:02 +08:00 committed by Craftsman
parent 2c7cde2d52
commit 110cbe7005
17 changed files with 446 additions and 502 deletions

View File

@ -3,11 +3,10 @@ package io.metersphere.project.domain;
import io.metersphere.validation.groups.*; import io.metersphere.validation.groups.*;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.*; import jakarta.validation.constraints.*;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
import lombok.Data; import lombok.Data;
@Data @Data
@ -22,16 +21,15 @@ public class MessageTask implements Serializable {
@Size(min = 1, max = 255, message = "{message_task.event.length_range}", groups = {Created.class, Updated.class}) @Size(min = 1, max = 255, message = "{message_task.event.length_range}", groups = {Created.class, Updated.class})
private String event; private String event;
@Schema(description = "接收人id", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{message_task.receiver.not_blank}", groups = {Created.class})
@Size(min = 1, max = 50, message = "{message_task.receiver.length_range}", groups = {Created.class, Updated.class})
private String receiver;
@Schema(description = "机器人id", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "机器人id", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{message_task.project_robot_id.not_blank}", groups = {Created.class}) @NotBlank(message = "{message_task.project_robot_id.not_blank}", groups = {Created.class})
@Size(min = 1, max = 50, message = "{message_task.project_robot_id.length_range}", groups = {Created.class, Updated.class}) @Size(min = 1, max = 50, message = "{message_task.project_robot_id.length_range}", groups = {Created.class, Updated.class})
private String projectRobotId; private String projectRobotId;
@Schema(description = "接收人ID集合", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "{message_task.receivers.not_blank}", groups = {Created.class})
private java.util.List<String> receivers;
@Schema(description = "任务类型", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "任务类型", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{message_task.task_type.not_blank}", groups = {Created.class}) @NotBlank(message = "{message_task.task_type.not_blank}", groups = {Created.class})
@Size(min = 1, max = 64, message = "{message_task.task_type.length_range}", groups = {Created.class, Updated.class}) @Size(min = 1, max = 64, message = "{message_task.task_type.length_range}", groups = {Created.class, Updated.class})
@ -78,8 +76,8 @@ public class MessageTask implements Serializable {
public enum Column { public enum Column {
id("id", "id", "VARCHAR", false), id("id", "id", "VARCHAR", false),
event("event", "event", "VARCHAR", false), event("event", "event", "VARCHAR", false),
receiver("receiver", "receiver", "VARCHAR", false),
projectRobotId("project_robot_id", "projectRobotId", "VARCHAR", false), projectRobotId("project_robot_id", "projectRobotId", "VARCHAR", false),
receivers("receivers", "receivers", "VARCHAR", false),
taskType("task_type", "taskType", "VARCHAR", false), taskType("task_type", "taskType", "VARCHAR", false),
testId("test_id", "testId", "VARCHAR", false), testId("test_id", "testId", "VARCHAR", false),
projectId("project_id", "projectId", "VARCHAR", false), projectId("project_id", "projectId", "VARCHAR", false),
@ -135,7 +133,7 @@ public class MessageTask implements Serializable {
return this.getEscapedColumnName() + " ASC"; return this.getEscapedColumnName() + " ASC";
} }
public static Column[] excludes(Column... excludes) { public static Column[] excludes(Column ... excludes) {
ArrayList<Column> columns = new ArrayList<>(Arrays.asList(Column.values())); ArrayList<Column> columns = new ArrayList<>(Arrays.asList(Column.values()));
if (excludes != null && excludes.length > 0) { if (excludes != null && excludes.length > 0) {
columns.removeAll(new ArrayList<>(Arrays.asList(excludes))); columns.removeAll(new ArrayList<>(Arrays.asList(excludes)));

View File

@ -64,19 +64,50 @@ public class MessageTaskExample {
} }
protected abstract static class GeneratedCriteria { protected abstract static class GeneratedCriteria {
protected List<Criterion> receiversCriteria;
protected List<Criterion> allCriteria;
protected List<Criterion> criteria; protected List<Criterion> criteria;
protected GeneratedCriteria() { protected GeneratedCriteria() {
super(); super();
criteria = new ArrayList<Criterion>(); criteria = new ArrayList<Criterion>();
receiversCriteria = new ArrayList<Criterion>();
}
public List<Criterion> getReceiversCriteria() {
return receiversCriteria;
}
protected void addReceiversCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
receiversCriteria.add(new Criterion(condition, value, "io.metersphere.handler.ListTypeHandler"));
allCriteria = null;
}
protected void addReceiversCriterion(String condition, List<String> value1, List<String> value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
receiversCriteria.add(new Criterion(condition, value1, value2, "io.metersphere.handler.ListTypeHandler"));
allCriteria = null;
} }
public boolean isValid() { public boolean isValid() {
return criteria.size() > 0; return criteria.size() > 0
|| receiversCriteria.size() > 0;
} }
public List<Criterion> getAllCriteria() { public List<Criterion> getAllCriteria() {
return criteria; if (allCriteria == null) {
allCriteria = new ArrayList<Criterion>();
allCriteria.addAll(criteria);
allCriteria.addAll(receiversCriteria);
}
return allCriteria;
} }
public List<Criterion> getCriteria() { public List<Criterion> getCriteria() {
@ -88,6 +119,7 @@ public class MessageTaskExample {
throw new RuntimeException("Value for condition cannot be null"); throw new RuntimeException("Value for condition cannot be null");
} }
criteria.add(new Criterion(condition)); criteria.add(new Criterion(condition));
allCriteria = null;
} }
protected void addCriterion(String condition, Object value, String property) { protected void addCriterion(String condition, Object value, String property) {
@ -95,6 +127,7 @@ public class MessageTaskExample {
throw new RuntimeException("Value for " + property + " cannot be null"); throw new RuntimeException("Value for " + property + " cannot be null");
} }
criteria.add(new Criterion(condition, value)); criteria.add(new Criterion(condition, value));
allCriteria = null;
} }
protected void addCriterion(String condition, Object value1, Object value2, String property) { protected void addCriterion(String condition, Object value1, Object value2, String property) {
@ -102,6 +135,7 @@ public class MessageTaskExample {
throw new RuntimeException("Between values for " + property + " cannot be null"); throw new RuntimeException("Between values for " + property + " cannot be null");
} }
criteria.add(new Criterion(condition, value1, value2)); criteria.add(new Criterion(condition, value1, value2));
allCriteria = null;
} }
public Criteria andIdIsNull() { public Criteria andIdIsNull() {
@ -244,76 +278,6 @@ public class MessageTaskExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andReceiverIsNull() {
addCriterion("receiver is null");
return (Criteria) this;
}
public Criteria andReceiverIsNotNull() {
addCriterion("receiver is not null");
return (Criteria) this;
}
public Criteria andReceiverEqualTo(String value) {
addCriterion("receiver =", value, "receiver");
return (Criteria) this;
}
public Criteria andReceiverNotEqualTo(String value) {
addCriterion("receiver <>", value, "receiver");
return (Criteria) this;
}
public Criteria andReceiverGreaterThan(String value) {
addCriterion("receiver >", value, "receiver");
return (Criteria) this;
}
public Criteria andReceiverGreaterThanOrEqualTo(String value) {
addCriterion("receiver >=", value, "receiver");
return (Criteria) this;
}
public Criteria andReceiverLessThan(String value) {
addCriterion("receiver <", value, "receiver");
return (Criteria) this;
}
public Criteria andReceiverLessThanOrEqualTo(String value) {
addCriterion("receiver <=", value, "receiver");
return (Criteria) this;
}
public Criteria andReceiverLike(String value) {
addCriterion("receiver like", value, "receiver");
return (Criteria) this;
}
public Criteria andReceiverNotLike(String value) {
addCriterion("receiver not like", value, "receiver");
return (Criteria) this;
}
public Criteria andReceiverIn(List<String> values) {
addCriterion("receiver in", values, "receiver");
return (Criteria) this;
}
public Criteria andReceiverNotIn(List<String> values) {
addCriterion("receiver not in", values, "receiver");
return (Criteria) this;
}
public Criteria andReceiverBetween(String value1, String value2) {
addCriterion("receiver between", value1, value2, "receiver");
return (Criteria) this;
}
public Criteria andReceiverNotBetween(String value1, String value2) {
addCriterion("receiver not between", value1, value2, "receiver");
return (Criteria) this;
}
public Criteria andProjectRobotIdIsNull() { public Criteria andProjectRobotIdIsNull() {
addCriterion("project_robot_id is null"); addCriterion("project_robot_id is null");
return (Criteria) this; return (Criteria) this;
@ -384,6 +348,76 @@ public class MessageTaskExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andReceiversIsNull() {
addCriterion("receivers is null");
return (Criteria) this;
}
public Criteria andReceiversIsNotNull() {
addCriterion("receivers is not null");
return (Criteria) this;
}
public Criteria andReceiversEqualTo(List<String> value) {
addReceiversCriterion("receivers =", value, "receivers");
return (Criteria) this;
}
public Criteria andReceiversNotEqualTo(List<String> value) {
addReceiversCriterion("receivers <>", value, "receivers");
return (Criteria) this;
}
public Criteria andReceiversGreaterThan(List<String> value) {
addReceiversCriterion("receivers >", value, "receivers");
return (Criteria) this;
}
public Criteria andReceiversGreaterThanOrEqualTo(List<String> value) {
addReceiversCriterion("receivers >=", value, "receivers");
return (Criteria) this;
}
public Criteria andReceiversLessThan(List<String> value) {
addReceiversCriterion("receivers <", value, "receivers");
return (Criteria) this;
}
public Criteria andReceiversLessThanOrEqualTo(List<String> value) {
addReceiversCriterion("receivers <=", value, "receivers");
return (Criteria) this;
}
public Criteria andReceiversLike(List<String> value) {
addReceiversCriterion("receivers like", value, "receivers");
return (Criteria) this;
}
public Criteria andReceiversNotLike(List<String> value) {
addReceiversCriterion("receivers not like", value, "receivers");
return (Criteria) this;
}
public Criteria andReceiversIn(List<List<String>> values) {
addReceiversCriterion("receivers in", values, "receivers");
return (Criteria) this;
}
public Criteria andReceiversNotIn(List<List<String>> values) {
addReceiversCriterion("receivers not in", values, "receivers");
return (Criteria) this;
}
public Criteria andReceiversBetween(List<String> value1, List<String> value2) {
addReceiversCriterion("receivers between", value1, value2, "receivers");
return (Criteria) this;
}
public Criteria andReceiversNotBetween(List<String> value1, List<String> value2) {
addReceiversCriterion("receivers not between", value1, value2, "receivers");
return (Criteria) this;
}
public Criteria andTaskTypeIsNull() { public Criteria andTaskTypeIsNull() {
addCriterion("task_type is null"); addCriterion("task_type is null");
return (Criteria) this; return (Criteria) this;

View File

@ -4,8 +4,8 @@
<resultMap id="BaseResultMap" type="io.metersphere.project.domain.MessageTask"> <resultMap id="BaseResultMap" type="io.metersphere.project.domain.MessageTask">
<id column="id" jdbcType="VARCHAR" property="id" /> <id column="id" jdbcType="VARCHAR" property="id" />
<result column="event" jdbcType="VARCHAR" property="event" /> <result column="event" jdbcType="VARCHAR" property="event" />
<result column="receiver" jdbcType="VARCHAR" property="receiver" />
<result column="project_robot_id" jdbcType="VARCHAR" property="projectRobotId" /> <result column="project_robot_id" jdbcType="VARCHAR" property="projectRobotId" />
<result column="receivers" jdbcType="VARCHAR" property="receivers" typeHandler="io.metersphere.handler.ListTypeHandler" />
<result column="task_type" jdbcType="VARCHAR" property="taskType" /> <result column="task_type" jdbcType="VARCHAR" property="taskType" />
<result column="test_id" jdbcType="VARCHAR" property="testId" /> <result column="test_id" jdbcType="VARCHAR" property="testId" />
<result column="project_id" jdbcType="VARCHAR" property="projectId" /> <result column="project_id" jdbcType="VARCHAR" property="projectId" />
@ -42,6 +42,25 @@
</when> </when>
</choose> </choose>
</foreach> </foreach>
<foreach collection="criteria.receiversCriteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value,typeHandler=io.metersphere.handler.ListTypeHandler}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value,typeHandler=io.metersphere.handler.ListTypeHandler} and #{criterion.secondValue,typeHandler=io.metersphere.handler.ListTypeHandler}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem,typeHandler=io.metersphere.handler.ListTypeHandler}
</foreach>
</when>
</choose>
</foreach>
</trim> </trim>
</if> </if>
</foreach> </foreach>
@ -71,13 +90,32 @@
</when> </when>
</choose> </choose>
</foreach> </foreach>
<foreach collection="criteria.receiversCriteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value,typeHandler=io.metersphere.handler.ListTypeHandler}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value,typeHandler=io.metersphere.handler.ListTypeHandler} and #{criterion.secondValue,typeHandler=io.metersphere.handler.ListTypeHandler}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem,typeHandler=io.metersphere.handler.ListTypeHandler}
</foreach>
</when>
</choose>
</foreach>
</trim> </trim>
</if> </if>
</foreach> </foreach>
</where> </where>
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, event, receiver, project_robot_id, task_type, test_id, project_id, `enable`, id, event, project_robot_id, receivers, task_type, test_id, project_id, `enable`,
create_user, create_time, update_user, update_time, use_default_template, use_default_subject, create_user, create_time, update_user, update_time, use_default_template, use_default_subject,
subject subject
</sql> </sql>
@ -112,18 +150,18 @@
</if> </if>
</delete> </delete>
<insert id="insert" parameterType="io.metersphere.project.domain.MessageTask"> <insert id="insert" parameterType="io.metersphere.project.domain.MessageTask">
insert into message_task (id, event, receiver, insert into message_task (id, event, project_robot_id,
project_robot_id, task_type, test_id, receivers,
project_id, `enable`, create_user, task_type, test_id, project_id,
create_time, update_user, update_time, `enable`, create_user, create_time,
use_default_template, use_default_subject, subject update_user, update_time, use_default_template,
) use_default_subject, subject)
values (#{id,jdbcType=VARCHAR}, #{event,jdbcType=VARCHAR}, #{receiver,jdbcType=VARCHAR}, values (#{id,jdbcType=VARCHAR}, #{event,jdbcType=VARCHAR}, #{projectRobotId,jdbcType=VARCHAR},
#{projectRobotId,jdbcType=VARCHAR}, #{taskType,jdbcType=VARCHAR}, #{testId,jdbcType=VARCHAR}, #{receivers,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
#{projectId,jdbcType=VARCHAR}, #{enable,jdbcType=BIT}, #{createUser,jdbcType=VARCHAR}, #{taskType,jdbcType=VARCHAR}, #{testId,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR},
#{createTime,jdbcType=BIGINT}, #{updateUser,jdbcType=VARCHAR}, #{updateTime,jdbcType=BIGINT}, #{enable,jdbcType=BIT}, #{createUser,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT},
#{useDefaultTemplate,jdbcType=BIT}, #{useDefaultSubject,jdbcType=BIT}, #{subject,jdbcType=VARCHAR} #{updateUser,jdbcType=VARCHAR}, #{updateTime,jdbcType=BIGINT}, #{useDefaultTemplate,jdbcType=BIT},
) #{useDefaultSubject,jdbcType=BIT}, #{subject,jdbcType=VARCHAR})
</insert> </insert>
<insert id="insertSelective" parameterType="io.metersphere.project.domain.MessageTask"> <insert id="insertSelective" parameterType="io.metersphere.project.domain.MessageTask">
insert into message_task insert into message_task
@ -134,12 +172,12 @@
<if test="event != null"> <if test="event != null">
event, event,
</if> </if>
<if test="receiver != null">
receiver,
</if>
<if test="projectRobotId != null"> <if test="projectRobotId != null">
project_robot_id, project_robot_id,
</if> </if>
<if test="receivers != null">
receivers,
</if>
<if test="taskType != null"> <if test="taskType != null">
task_type, task_type,
</if> </if>
@ -181,12 +219,12 @@
<if test="event != null"> <if test="event != null">
#{event,jdbcType=VARCHAR}, #{event,jdbcType=VARCHAR},
</if> </if>
<if test="receiver != null">
#{receiver,jdbcType=VARCHAR},
</if>
<if test="projectRobotId != null"> <if test="projectRobotId != null">
#{projectRobotId,jdbcType=VARCHAR}, #{projectRobotId,jdbcType=VARCHAR},
</if> </if>
<if test="receivers != null">
#{receivers,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
</if>
<if test="taskType != null"> <if test="taskType != null">
#{taskType,jdbcType=VARCHAR}, #{taskType,jdbcType=VARCHAR},
</if> </if>
@ -237,12 +275,12 @@
<if test="record.event != null"> <if test="record.event != null">
event = #{record.event,jdbcType=VARCHAR}, event = #{record.event,jdbcType=VARCHAR},
</if> </if>
<if test="record.receiver != null">
receiver = #{record.receiver,jdbcType=VARCHAR},
</if>
<if test="record.projectRobotId != null"> <if test="record.projectRobotId != null">
project_robot_id = #{record.projectRobotId,jdbcType=VARCHAR}, project_robot_id = #{record.projectRobotId,jdbcType=VARCHAR},
</if> </if>
<if test="record.receivers != null">
receivers = #{record.receivers,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
</if>
<if test="record.taskType != null"> <if test="record.taskType != null">
task_type = #{record.taskType,jdbcType=VARCHAR}, task_type = #{record.taskType,jdbcType=VARCHAR},
</if> </if>
@ -285,8 +323,8 @@
update message_task update message_task
set id = #{record.id,jdbcType=VARCHAR}, set id = #{record.id,jdbcType=VARCHAR},
event = #{record.event,jdbcType=VARCHAR}, event = #{record.event,jdbcType=VARCHAR},
receiver = #{record.receiver,jdbcType=VARCHAR},
project_robot_id = #{record.projectRobotId,jdbcType=VARCHAR}, project_robot_id = #{record.projectRobotId,jdbcType=VARCHAR},
receivers = #{record.receivers,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
task_type = #{record.taskType,jdbcType=VARCHAR}, task_type = #{record.taskType,jdbcType=VARCHAR},
test_id = #{record.testId,jdbcType=VARCHAR}, test_id = #{record.testId,jdbcType=VARCHAR},
project_id = #{record.projectId,jdbcType=VARCHAR}, project_id = #{record.projectId,jdbcType=VARCHAR},
@ -308,12 +346,12 @@
<if test="event != null"> <if test="event != null">
event = #{event,jdbcType=VARCHAR}, event = #{event,jdbcType=VARCHAR},
</if> </if>
<if test="receiver != null">
receiver = #{receiver,jdbcType=VARCHAR},
</if>
<if test="projectRobotId != null"> <if test="projectRobotId != null">
project_robot_id = #{projectRobotId,jdbcType=VARCHAR}, project_robot_id = #{projectRobotId,jdbcType=VARCHAR},
</if> </if>
<if test="receivers != null">
receivers = #{receivers,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
</if>
<if test="taskType != null"> <if test="taskType != null">
task_type = #{taskType,jdbcType=VARCHAR}, task_type = #{taskType,jdbcType=VARCHAR},
</if> </if>
@ -353,8 +391,8 @@
<update id="updateByPrimaryKey" parameterType="io.metersphere.project.domain.MessageTask"> <update id="updateByPrimaryKey" parameterType="io.metersphere.project.domain.MessageTask">
update message_task update message_task
set event = #{event,jdbcType=VARCHAR}, set event = #{event,jdbcType=VARCHAR},
receiver = #{receiver,jdbcType=VARCHAR},
project_robot_id = #{projectRobotId,jdbcType=VARCHAR}, project_robot_id = #{projectRobotId,jdbcType=VARCHAR},
receivers = #{receivers,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
task_type = #{taskType,jdbcType=VARCHAR}, task_type = #{taskType,jdbcType=VARCHAR},
test_id = #{testId,jdbcType=VARCHAR}, test_id = #{testId,jdbcType=VARCHAR},
project_id = #{projectId,jdbcType=VARCHAR}, project_id = #{projectId,jdbcType=VARCHAR},
@ -370,17 +408,17 @@
</update> </update>
<insert id="batchInsert" parameterType="map"> <insert id="batchInsert" parameterType="map">
insert into message_task insert into message_task
(id, event, receiver, project_robot_id, task_type, test_id, project_id, `enable`, (id, event, project_robot_id, receivers, task_type, test_id, project_id, `enable`,
create_user, create_time, update_user, update_time, use_default_template, use_default_subject, create_user, create_time, update_user, update_time, use_default_template, use_default_subject,
subject) subject)
values values
<foreach collection="list" item="item" separator=","> <foreach collection="list" item="item" separator=",">
(#{item.id,jdbcType=VARCHAR}, #{item.event,jdbcType=VARCHAR}, #{item.receiver,jdbcType=VARCHAR}, (#{item.id,jdbcType=VARCHAR}, #{item.event,jdbcType=VARCHAR}, #{item.projectRobotId,jdbcType=VARCHAR},
#{item.projectRobotId,jdbcType=VARCHAR}, #{item.taskType,jdbcType=VARCHAR}, #{item.testId,jdbcType=VARCHAR}, #{item.receivers,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
#{item.projectId,jdbcType=VARCHAR}, #{item.enable,jdbcType=BIT}, #{item.createUser,jdbcType=VARCHAR}, #{item.taskType,jdbcType=VARCHAR}, #{item.testId,jdbcType=VARCHAR}, #{item.projectId,jdbcType=VARCHAR},
#{item.createTime,jdbcType=BIGINT}, #{item.updateUser,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=BIGINT}, #{item.enable,jdbcType=BIT}, #{item.createUser,jdbcType=VARCHAR}, #{item.createTime,jdbcType=BIGINT},
#{item.useDefaultTemplate,jdbcType=BIT}, #{item.useDefaultSubject,jdbcType=BIT}, #{item.updateUser,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=BIGINT}, #{item.useDefaultTemplate,jdbcType=BIT},
#{item.subject,jdbcType=VARCHAR}) #{item.useDefaultSubject,jdbcType=BIT}, #{item.subject,jdbcType=VARCHAR})
</foreach> </foreach>
</insert> </insert>
<insert id="batchInsertSelective" parameterType="map"> <insert id="batchInsertSelective" parameterType="map">
@ -399,12 +437,12 @@
<if test="'event'.toString() == column.value"> <if test="'event'.toString() == column.value">
#{item.event,jdbcType=VARCHAR} #{item.event,jdbcType=VARCHAR}
</if> </if>
<if test="'receiver'.toString() == column.value">
#{item.receiver,jdbcType=VARCHAR}
</if>
<if test="'project_robot_id'.toString() == column.value"> <if test="'project_robot_id'.toString() == column.value">
#{item.projectRobotId,jdbcType=VARCHAR} #{item.projectRobotId,jdbcType=VARCHAR}
</if> </if>
<if test="'receivers'.toString() == column.value">
#{item.receivers,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler}
</if>
<if test="'task_type'.toString() == column.value"> <if test="'task_type'.toString() == column.value">
#{item.taskType,jdbcType=VARCHAR} #{item.taskType,jdbcType=VARCHAR}
</if> </if>

View File

@ -253,7 +253,7 @@ CREATE TABLE IF NOT EXISTS custom_function_blob
CREATE TABLE IF NOT EXISTS message_task( CREATE TABLE IF NOT EXISTS message_task(
`id` VARCHAR(50) NOT NULL COMMENT '' , `id` VARCHAR(50) NOT NULL COMMENT '' ,
`event` VARCHAR(255) NOT NULL COMMENT '通知事件类型' , `event` VARCHAR(255) NOT NULL COMMENT '通知事件类型' ,
`receiver` VARCHAR(50) NOT NULL COMMENT '接收人id' , `receivers` VARCHAR(1000) NOT NULL COMMENT '接收人id集合' ,
`project_robot_id` VARCHAR(50) NOT NULL DEFAULT 'NONE' COMMENT '机器人id' , `project_robot_id` VARCHAR(50) NOT NULL DEFAULT 'NONE' COMMENT '机器人id' ,
`task_type` VARCHAR(64) NOT NULL COMMENT '任务类型' , `task_type` VARCHAR(64) NOT NULL COMMENT '任务类型' ,
`test_id` VARCHAR(50) NOT NULL DEFAULT 'NONE' COMMENT '具体测试的ID' , `test_id` VARCHAR(50) NOT NULL DEFAULT 'NONE' COMMENT '具体测试的ID' ,
@ -276,7 +276,6 @@ CREATE TABLE IF NOT EXISTS message_task(
CREATE INDEX idx_project_id ON message_task(project_id); CREATE INDEX idx_project_id ON message_task(project_id);
CREATE INDEX idx_create_time ON message_task(create_time desc); CREATE INDEX idx_create_time ON message_task(create_time desc);
CREATE INDEX idx_test_id ON message_task(test_id); CREATE INDEX idx_test_id ON message_task(test_id);
CREATE INDEX idx_receiver ON message_task(receiver);
CREATE INDEX idx_task_type ON message_task(task_type); CREATE INDEX idx_task_type ON message_task(task_type);
CREATE INDEX idx_project_robot_id ON message_task(project_robot_id); CREATE INDEX idx_project_robot_id ON message_task(project_robot_id);
CREATE INDEX idx_event ON message_task(event); CREATE INDEX idx_event ON message_task(event);

View File

@ -397,135 +397,119 @@ Insert into project_robot(id, project_id, name, platform, webhook, type, app_key
-- 初始化消息设置数据 -- 初始化消息设置数据
-- 初始化测试计划相关的消息数据 -- 初始化测试计划相关的消息数据
SET @test_plan_task_update_creator_id = UUID_SHORT(); SET @test_plan_task_update_creator_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@test_plan_task_update_creator_id, 'UPDATE', 'CREATE_USER', @robot_in_site_id, 'TEST_PLAN_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.test_plan_task_update'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@test_plan_task_update_creator_id, 'UPDATE', '["CREATE_USER", "FOLLOW_PEOPLE"]', @robot_in_site_id, 'TEST_PLAN_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.test_plan_task_update');
INSERT INTO message_task_blob(id, template) VALUES (@test_plan_task_update_creator_id, 'message.test_plan_task_update'); INSERT INTO message_task_blob(id, template) VALUES (@test_plan_task_update_creator_id, 'message.test_plan_task_update');
SET @test_plan_task_update_follower_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@test_plan_task_update_follower_id, 'UPDATE', 'FOLLOW_PEOPLE', @robot_in_site_id, 'TEST_PLAN_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.test_plan_task_update');
INSERT INTO message_task_blob(id, template) VALUES (@test_plan_task_update_follower_id, 'message.test_plan_task_update');
SET @test_plan_task_delete_id = UUID_SHORT(); SET @test_plan_task_delete_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@test_plan_task_delete_id, 'DELETE', 'CREATE_USER', @robot_in_site_id, 'TEST_PLAN_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.test_plan_task_delete'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@test_plan_task_delete_id, 'DELETE', '["CREATE_USER"]', @robot_in_site_id, 'TEST_PLAN_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.test_plan_task_delete');
INSERT INTO message_task_blob(id, template) VALUES (@test_plan_task_delete_id, 'message.test_plan_task_update'); INSERT INTO message_task_blob(id, template) VALUES (@test_plan_task_delete_id, 'message.test_plan_task_update');
SET @test_plan_task_execute_id = UUID_SHORT(); SET @test_plan_task_execute_success_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@test_plan_task_execute_id, 'EXECUTE_SUCCESSFUL', 'CREATE_USER', @robot_in_site_id, 'TEST_PLAN_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.test_plan_task_execute_success'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@test_plan_task_execute_success_id, 'EXECUTE_SUCCESSFUL', '["CREATE_USER"]', @robot_in_site_id, 'TEST_PLAN_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.test_plan_task_execute_success');
INSERT INTO message_task_blob(id, template) VALUES (@test_plan_task_execute_id, 'message.test_plan_task_execute'); INSERT INTO message_task_blob(id, template) VALUES (@test_plan_task_execute_success_id, 'message.test_plan_task_execute');
SET @test_plan_task_execute_id = UUID_SHORT(); SET @test_plan_task_execute_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@test_plan_task_execute_id, 'EXECUTE_FAILED', 'OPERATOR', @robot_in_site_id, 'TEST_PLAN_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.test_plan_task_execute_failed'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@test_plan_task_execute_id, 'EXECUTE_FAILED', '["OPERATOR"]', @robot_in_site_id, 'TEST_PLAN_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.test_plan_task_execute_failed');
INSERT INTO message_task_blob(id, template) VALUES (@test_plan_task_execute_id, 'message.test_plan_task_execute'); INSERT INTO message_task_blob(id, template) VALUES (@test_plan_task_execute_id, 'message.test_plan_task_execute');
SET @test_plan_task_report_id = UUID_SHORT(); SET @test_plan_task_report_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@test_plan_task_report_id, 'DELETE', 'CREATE_USER', @robot_in_site_id, 'TEST_PLAN_REPORT_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.test_plan_report_task_delete'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@test_plan_task_report_id, 'DELETE', '["CREATE_USER"]', @robot_in_site_id, 'TEST_PLAN_REPORT_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.test_plan_report_task_delete');
INSERT INTO message_task_blob(id, template) VALUES (@test_plan_task_report_id, 'message.test_plan_report_task_delete'); INSERT INTO message_task_blob(id, template) VALUES (@test_plan_task_report_id, 'message.test_plan_report_task_delete');
-- 初始化缺陷相关的消息数据 -- 初始化缺陷相关的消息数据
SET @bug_update_creator_id = UUID_SHORT(); SET @bug_update_creator_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@bug_update_creator_id, 'UPDATE', 'CREATE_USER', @robot_in_site_id, 'BUG_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.bug_task_update'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@bug_update_creator_id, 'UPDATE', '["CREATE_USER", "FOLLOW_PEOPLE"]', @robot_in_site_id, 'BUG_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.bug_task_update');
INSERT INTO message_task_blob(id, template) VALUES (@bug_update_creator_id, 'message.bug_task_update'); INSERT INTO message_task_blob(id, template) VALUES (@bug_update_creator_id, 'message.bug_task_update');
SET @bug_update_follower_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@bug_update_follower_id, 'UPDATE', 'FOLLOW_PEOPLE', @robot_in_site_id, 'BUG_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.bug_task_update');
INSERT INTO message_task_blob(id, template) VALUES (@bug_update_follower_id, 'message.bug_task_update');
SET @bug_delete_id = UUID_SHORT(); SET @bug_delete_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@bug_delete_id, 'DELETE', 'CREATE_USER', @robot_in_site_id, 'BUG_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.bug_task_delete'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@bug_delete_id, 'DELETE', '["CREATE_USER"]', @robot_in_site_id, 'BUG_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.bug_task_delete');
INSERT INTO message_task_blob(id, template) VALUES (@bug_delete_id, 'message.bug_task_delete'); INSERT INTO message_task_blob(id, template) VALUES (@bug_delete_id, 'message.bug_task_delete');
SET @bug_comment_id = UUID_SHORT(); SET @bug_comment_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@bug_comment_id, 'COMMENT', 'CREATE_USER', @robot_in_site_id, 'BUG_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.bug_task_comment'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@bug_comment_id, 'COMMENT', '["CREATE_USER"]', @robot_in_site_id, 'BUG_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.bug_task_comment');
INSERT INTO message_task_blob(id, template) VALUES (@bug_comment_id, 'message.bug_task_comment'); INSERT INTO message_task_blob(id, template) VALUES (@bug_comment_id, 'message.bug_task_comment');
SET @bug_sync_id = UUID_SHORT(); SET @bug_sync_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@bug_sync_id, 'EXECUTE_COMPLETED', 'OPERATOR', @robot_in_site_id, 'BUG_SYNC_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.bug_sync_task_execute_completed'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@bug_sync_id, 'EXECUTE_COMPLETED', '["OPERATOR"]', @robot_in_site_id, 'BUG_SYNC_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.bug_sync_task_execute_completed');
INSERT INTO message_task_blob(id, template) VALUES (@bug_sync_id, 'message.bug_sync_task_execute_completed'); INSERT INTO message_task_blob(id, template) VALUES (@bug_sync_id, 'message.bug_sync_task_execute_completed');
-- 初始化用例管理消息设置数据 -- 初始化用例管理消息设置数据
SET @functional_creator_id = UUID_SHORT(); SET @functional_creator_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@functional_creator_id, 'UPDATE', 'CREATE_USER', @robot_in_site_id, 'FUNCTIONAL_CASE_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.functional_case_task_update'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@functional_creator_id, 'UPDATE', '["CREATE_USER", "FOLLOW_PEOPLE"]', @robot_in_site_id, 'FUNCTIONAL_CASE_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.functional_case_task_update');
INSERT INTO message_task_blob(id, template) VALUES (@functional_creator_id, 'message.functional_case_task_update'); INSERT INTO message_task_blob(id, template) VALUES (@functional_creator_id, 'message.functional_case_task_update');
SET @functional_follower_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@functional_follower_id, 'UPDATE', 'FOLLOW_PEOPLE', @robot_in_site_id, 'FUNCTIONAL_CASE_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.functional_case_task_update');
INSERT INTO message_task_blob(id, template) VALUES (@functional_follower_id, 'message.functional_case_task_update');
SET @functional_delete_id = UUID_SHORT(); SET @functional_delete_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@functional_delete_id, 'DELETE', 'CREATE_USER', @robot_in_site_id, 'FUNCTIONAL_CASE_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.functional_case_task_delete'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@functional_delete_id, 'DELETE', '["CREATE_USER"]', @robot_in_site_id, 'FUNCTIONAL_CASE_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.functional_case_task_delete');
INSERT INTO message_task_blob(id, template) VALUES (@functional_delete_id, 'message.functional_case_task_delete'); INSERT INTO message_task_blob(id, template) VALUES (@functional_delete_id, 'message.functional_case_task_delete');
SET @functional_review_passed_id = UUID_SHORT(); SET @functional_review_passed_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@functional_review_passed_id, 'REVIEW_PASSED', 'CREATE_USER', @robot_in_site_id, 'FUNCTIONAL_CASE_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.functional_case_task_review_passed'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@functional_review_passed_id, 'REVIEW_PASSED', '["CREATE_USER"]', @robot_in_site_id, 'FUNCTIONAL_CASE_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.functional_case_task_review_passed');
INSERT INTO message_task_blob(id, template) VALUES (@functional_review_passed_id, 'message.functional_case_task_review'); INSERT INTO message_task_blob(id, template) VALUES (@functional_review_passed_id, 'message.functional_case_task_review');
SET @functional_review_fail_id = UUID_SHORT(); SET @functional_review_fail_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@functional_review_fail_id, 'REVIEW_FAIL', 'CREATE_USER', @robot_in_site_id, 'FUNCTIONAL_CASE_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.functional_case_task_review_fail'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@functional_review_fail_id, 'REVIEW_FAIL', '["CREATE_USER"]', @robot_in_site_id, 'FUNCTIONAL_CASE_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.functional_case_task_review_fail');
INSERT INTO message_task_blob(id, template) VALUES (@functional_review_fail_id, 'message.functional_case_task_review'); INSERT INTO message_task_blob(id, template) VALUES (@functional_review_fail_id, 'message.functional_case_task_review');
SET @functional_execute_passed_id = UUID_SHORT(); SET @functional_execute_passed_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@functional_execute_passed_id, 'EXECUTE_PASSED', 'CREATE_USER', @robot_in_site_id, 'FUNCTIONAL_CASE_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.functional_case_task_execute_passed'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@functional_execute_passed_id, 'EXECUTE_PASSED', '["CREATE_USER"]', @robot_in_site_id, 'FUNCTIONAL_CASE_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.functional_case_task_execute_passed');
INSERT INTO message_task_blob(id, template) VALUES (@functional_execute_passed_id, 'message.functional_case_task_plan'); INSERT INTO message_task_blob(id, template) VALUES (@functional_execute_passed_id, 'message.functional_case_task_plan');
SET @functional_execute_fail_id = UUID_SHORT(); SET @functional_execute_fail_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@functional_execute_fail_id, 'EXECUTE_FAIL', 'CREATE_USER', @robot_in_site_id, 'FUNCTIONAL_CASE_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.functional_case_task_execute_fail'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@functional_execute_fail_id, 'EXECUTE_FAIL', '["CREATE_USER"]', @robot_in_site_id, 'FUNCTIONAL_CASE_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.functional_case_task_execute_fail');
INSERT INTO message_task_blob(id, template) VALUES (@functional_execute_fail_id, 'message.functional_case_task_plan'); INSERT INTO message_task_blob(id, template) VALUES (@functional_execute_fail_id, 'message.functional_case_task_plan');
SET @functional_comment_id = UUID_SHORT(); SET @functional_comment_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@functional_comment_id, 'COMMENT', 'CREATE_USER', @robot_in_site_id, 'FUNCTIONAL_CASE_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.functional_case_task_comment'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@functional_comment_id, 'COMMENT', '["CREATE_USER"]', @robot_in_site_id, 'FUNCTIONAL_CASE_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.functional_case_task_comment');
INSERT INTO message_task_blob(id, template) VALUES (@functional_comment_id, 'message.functional_case_task_comment'); INSERT INTO message_task_blob(id, template) VALUES (@functional_comment_id, 'message.functional_case_task_comment');
SET @case_creator_id = UUID_SHORT(); SET @case_creator_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@case_creator_id, 'UPDATE', 'CREATE_USER', @robot_in_site_id, 'CASE_REVIEW_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.case_review_task_update'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@case_creator_id, 'UPDATE', '["CREATE_USER", "FOLLOW_PEOPLE"]', @robot_in_site_id, 'CASE_REVIEW_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.case_review_task_update');
INSERT INTO message_task_blob(id, template) VALUES (@case_creator_id, 'message.case_review_task_update'); INSERT INTO message_task_blob(id, template) VALUES (@case_creator_id, 'message.case_review_task_update');
SET @case_follower_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@case_follower_id, 'UPDATE', 'FOLLOW_PEOPLE', @robot_in_site_id, 'CASE_REVIEW_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.case_review_task_update');
INSERT INTO message_task_blob(id, template) VALUES (@case_follower_id, 'message.case_review_task_update');
SET @case_delete_id = UUID_SHORT(); SET @case_delete_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@case_delete_id, 'DELETE', 'CREATE_USER', @robot_in_site_id, 'CASE_REVIEW_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.case_review_task_delete'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@case_delete_id, 'DELETE', '["CREATE_USER"]', @robot_in_site_id, 'CASE_REVIEW_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.case_review_task_delete');
INSERT INTO message_task_blob(id, template) VALUES (@case_delete_id, 'message.case_review_task_delete'); INSERT INTO message_task_blob(id, template) VALUES (@case_delete_id, 'message.case_review_task_delete');
SET @case_review_id = UUID_SHORT(); SET @case_review_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@case_review_id, 'REVIEW_COMPLETED', 'CREATE_USER', @robot_in_site_id, 'CASE_REVIEW_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.case_review_task_review_completed'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@case_review_id, 'REVIEW_COMPLETED', '["CREATE_USER"]', @robot_in_site_id, 'CASE_REVIEW_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.case_review_task_review_completed');
INSERT INTO message_task_blob(id, template) VALUES (@case_review_id, 'message.case_review_task_review_completed'); INSERT INTO message_task_blob(id, template) VALUES (@case_review_id, 'message.case_review_task_review_completed');
-- 初始化接口文档消息数据 -- 初始化接口文档消息数据
SET @api_creator_id = UUID_SHORT(); SET @api_creator_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@api_creator_id, 'UPDATE', 'CREATE_USER', @robot_in_site_id, 'API_DEFINITION_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.api_definition_task_update'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@api_creator_id, 'UPDATE', '["CREATE_USER"]', @robot_in_site_id, 'API_DEFINITION_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.api_definition_task_update');
INSERT INTO message_task_blob(id, template) VALUES (@api_creator_id, 'message.api_definition_task_update'); INSERT INTO message_task_blob(id, template) VALUES (@api_creator_id, 'message.api_definition_task_update');
SET @api_delete_id = UUID_SHORT(); SET @api_delete_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@api_delete_id, 'DELETE', 'CREATE_USER', @robot_in_site_id, 'API_DEFINITION_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.api_definition_task_delete'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@api_delete_id, 'DELETE', '["CREATE_USER"]', @robot_in_site_id, 'API_DEFINITION_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.api_definition_task_delete');
INSERT INTO message_task_blob(id, template) VALUES (@api_delete_id, 'message.api_definition_task_delete'); INSERT INTO message_task_blob(id, template) VALUES (@api_delete_id, 'message.api_definition_task_delete');
SET @api_case_update_id = UUID_SHORT(); SET @api_case_update_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@api_case_update_id, 'CASE_UPDATE', 'CREATE_USER', @robot_in_site_id, 'API_DEFINITION_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.api_definition_task_case_update'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@api_case_update_id, 'CASE_UPDATE', '["CREATE_USER"]', @robot_in_site_id, 'API_DEFINITION_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.api_definition_task_case_update');
INSERT INTO message_task_blob(id, template) VALUES (@api_case_update_id, 'message.api_definition_task_case_update'); INSERT INTO message_task_blob(id, template) VALUES (@api_case_update_id, 'message.api_definition_task_case_update');
SET @api_case_delete_id = UUID_SHORT(); SET @api_case_delete_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@api_case_delete_id, 'CASE_DELETE', 'CREATE_USER', @robot_in_site_id, 'API_DEFINITION_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.api_definition_task_case_delete'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@api_case_delete_id, 'CASE_DELETE', '["CREATE_USER"]', @robot_in_site_id, 'API_DEFINITION_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.api_definition_task_case_delete');
INSERT INTO message_task_blob(id, template) VALUES (@api_case_delete_id, 'message.api_definition_task_case_delete'); INSERT INTO message_task_blob(id, template) VALUES (@api_case_delete_id, 'message.api_definition_task_case_delete');
SET @api_execute_success_id = UUID_SHORT(); SET @api_execute_success_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@api_execute_success_id, 'CASE_EXECUTE_SUCCESSFUL', 'CREATE_USER', @robot_in_site_id, 'API_DEFINITION_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.api_definition_task_case_execute_successful'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@api_execute_success_id, 'CASE_EXECUTE_SUCCESSFUL', '["CREATE_USER"]', @robot_in_site_id, 'API_DEFINITION_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.api_definition_task_case_execute_successful');
INSERT INTO message_task_blob(id, template) VALUES (@api_execute_success_id, 'message.api_definition_task_case_execute'); INSERT INTO message_task_blob(id, template) VALUES (@api_execute_success_id, 'message.api_definition_task_case_execute');
SET @api_fake_error_id = UUID_SHORT(); SET @api_fake_error_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@api_fake_error_id, 'CASE_EXECUTE_FAKE_ERROR', 'CREATE_USER', @robot_in_site_id, 'API_DEFINITION_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.api_definition_task_case_execute_fake_error'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@api_fake_error_id, 'CASE_EXECUTE_FAKE_ERROR', '["CREATE_USER"]', @robot_in_site_id, 'API_DEFINITION_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.api_definition_task_case_execute_fake_error');
INSERT INTO message_task_blob(id, template) VALUES (@api_fake_error_id, 'message.api_definition_task_case_execute'); INSERT INTO message_task_blob(id, template) VALUES (@api_fake_error_id, 'message.api_definition_task_case_execute');
SET @api_execute_failed_id = UUID_SHORT(); SET @api_execute_failed_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@api_execute_failed_id, 'CASE_EXECUTE_FAILED', 'CREATE_USER', @robot_in_site_id, 'API_DEFINITION_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.api_definition_task_case_execute_failed'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@api_execute_failed_id, 'CASE_EXECUTE_FAILED', '["CREATE_USER"]', @robot_in_site_id, 'API_DEFINITION_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.api_definition_task_case_execute_failed');
INSERT INTO message_task_blob(id, template) VALUES (@api_execute_failed_id, 'message.api_definition_task_case_execute'); INSERT INTO message_task_blob(id, template) VALUES (@api_execute_failed_id, 'message.api_definition_task_case_execute');
SET @api_mock_update_id = UUID_SHORT(); SET @api_mock_update_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@api_mock_update_id, 'MOCK_UPDATE', 'CREATE_USER', @robot_in_site_id, 'API_DEFINITION_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.api_definition_task_mock_update'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@api_mock_update_id, 'MOCK_UPDATE', '["CREATE_USER"]', @robot_in_site_id, 'API_DEFINITION_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.api_definition_task_mock_update');
INSERT INTO message_task_blob(id, template) VALUES (@api_mock_update_id, 'message.api_definition_task_mock_update'); INSERT INTO message_task_blob(id, template) VALUES (@api_mock_update_id, 'message.api_definition_task_mock_update');
SET @api_mock_delete_id = UUID_SHORT(); SET @api_mock_delete_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@api_mock_delete_id, 'MOCK_DELETE', 'CREATE_USER', @robot_in_site_id, 'API_DEFINITION_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.api_definition_task_mock_delete'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@api_mock_delete_id, 'MOCK_DELETE', '["CREATE_USER"]', @robot_in_site_id, 'API_DEFINITION_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.api_definition_task_mock_delete');
INSERT INTO message_task_blob(id, template) VALUES (@api_mock_delete_id, 'message.api_definition_task_mock_delete'); INSERT INTO message_task_blob(id, template) VALUES (@api_mock_delete_id, 'message.api_definition_task_mock_delete');
SET @api_fake_error_id = UUID_SHORT(); SET @api_fake_error_id = UUID_SHORT();
@ -534,109 +518,109 @@ INSERT INTO message_task_blob(id, template) VALUES (@api_fake_error_id, 'message
-- 初始化接口场景消息设置数据 -- 初始化接口场景消息设置数据
SET @api_scenario_update_id = UUID_SHORT(); SET @api_scenario_update_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@api_scenario_update_id, 'UPDATE', 'CREATE_USER', @robot_in_site_id, 'API_SCENARIO_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.api_scenario_task_update'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@api_scenario_update_id, 'UPDATE', '["CREATE_USER"]', @robot_in_site_id, 'API_SCENARIO_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.api_scenario_task_update');
INSERT INTO message_task_blob(id, template) VALUES (@api_scenario_update_id, 'message.api_scenario_task_update'); INSERT INTO message_task_blob(id, template) VALUES (@api_scenario_update_id, 'message.api_scenario_task_update');
SET @api_scenario_delete_id = UUID_SHORT(); SET @api_scenario_delete_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@api_scenario_delete_id, 'DELETE', 'CREATE_USER', @robot_in_site_id, 'API_SCENARIO_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.api_scenario_task_delete'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@api_scenario_delete_id, 'DELETE', '["CREATE_USER"]', @robot_in_site_id, 'API_SCENARIO_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.api_scenario_task_delete');
INSERT INTO message_task_blob(id, template) VALUES (@api_scenario_delete_id, 'message.api_scenario_task_delete'); INSERT INTO message_task_blob(id, template) VALUES (@api_scenario_delete_id, 'message.api_scenario_task_delete');
SET @api_scenario_execute_success_id = UUID_SHORT(); SET @api_scenario_execute_success_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@api_scenario_execute_success_id, 'SCENARIO_EXECUTE_SUCCESSFUL', 'CREATE_USER', @robot_in_site_id, 'API_SCENARIO_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.api_scenario_task_scenario_execute_successful'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@api_scenario_execute_success_id, 'SCENARIO_EXECUTE_SUCCESSFUL', '["CREATE_USER"]', @robot_in_site_id, 'API_SCENARIO_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.api_scenario_task_scenario_execute_successful');
INSERT INTO message_task_blob(id, template) VALUES (@api_scenario_execute_success_id, 'message.api_scenario_task_scenario_execute'); INSERT INTO message_task_blob(id, template) VALUES (@api_scenario_execute_success_id, 'message.api_scenario_task_scenario_execute');
SET @api_scenario_fake_error_id = UUID_SHORT(); SET @api_scenario_fake_error_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@api_scenario_fake_error_id, 'SCENARIO_EXECUTE_FAKE_ERROR', 'CREATE_USER', @robot_in_site_id, 'API_SCENARIO_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.api_scenario_task_scenario_execute_fake_error'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@api_scenario_fake_error_id, 'SCENARIO_EXECUTE_FAKE_ERROR', '["CREATE_USER"]', @robot_in_site_id, 'API_SCENARIO_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.api_scenario_task_scenario_execute_fake_error');
INSERT INTO message_task_blob(id, template) VALUES (@api_scenario_fake_error_id, 'message.api_scenario_task_scenario_execute'); INSERT INTO message_task_blob(id, template) VALUES (@api_scenario_fake_error_id, 'message.api_scenario_task_scenario_execute');
SET @api_scenario_execute_failed_id = UUID_SHORT(); SET @api_scenario_execute_failed_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@api_scenario_execute_failed_id, 'SCENARIO_EXECUTE_FAILED', 'CREATE_USER', @robot_in_site_id, 'API_SCENARIO_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.api_scenario_task_scenario_execute_failed'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@api_scenario_execute_failed_id, 'SCENARIO_EXECUTE_FAILED', '["CREATE_USER"]', @robot_in_site_id, 'API_SCENARIO_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.api_scenario_task_scenario_execute_failed');
INSERT INTO message_task_blob(id, template) VALUES (@api_scenario_execute_failed_id, 'message.api_scenario_task_scenario_execute'); INSERT INTO message_task_blob(id, template) VALUES (@api_scenario_execute_failed_id, 'message.api_scenario_task_scenario_execute');
SET @api_scenario_report_id = UUID_SHORT(); SET @api_scenario_report_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@api_scenario_report_id, 'DELETE', 'CREATE_USER', @robot_in_site_id, 'API_REPORT_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.api_report_task_delete'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@api_scenario_report_id, 'DELETE', '["CREATE_USER"]', @robot_in_site_id, 'API_REPORT_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.api_report_task_delete');
INSERT INTO message_task_blob(id, template) VALUES (@api_scenario_report_id, 'message.api_report_task_delete'); INSERT INTO message_task_blob(id, template) VALUES (@api_scenario_report_id, 'message.api_report_task_delete');
-- 初始化UI消息数据 -- 初始化UI消息数据
SET @ui_update_id = UUID_SHORT(); SET @ui_update_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@ui_update_id, 'UPDATE', 'CREATE_USER', @robot_in_site_id, 'UI_SCENARIO_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.ui_scenario_task_update'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@ui_update_id, 'UPDATE', '["CREATE_USER"]', @robot_in_site_id, 'UI_SCENARIO_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.ui_scenario_task_update');
INSERT INTO message_task_blob(id, template) VALUES (@ui_update_id, 'message.ui_scenario_task_update'); INSERT INTO message_task_blob(id, template) VALUES (@ui_update_id, 'message.ui_scenario_task_update');
SET @ui_delete_id = UUID_SHORT(); SET @ui_delete_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@ui_delete_id, 'DELETE', 'CREATE_USER', @robot_in_site_id, 'UI_SCENARIO_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.ui_scenario_task_delete'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@ui_delete_id, 'DELETE', '["CREATE_USER"]', @robot_in_site_id, 'UI_SCENARIO_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.ui_scenario_task_delete');
INSERT INTO message_task_blob(id, template) VALUES (@ui_delete_id, 'message.ui_scenario_task_delete'); INSERT INTO message_task_blob(id, template) VALUES (@ui_delete_id, 'message.ui_scenario_task_delete');
SET @ui_execute_successful_id = UUID_SHORT(); SET @ui_execute_successful_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@ui_execute_successful_id, 'EXECUTE_SUCCESSFUL', 'CREATE_USER', @robot_in_site_id, 'UI_SCENARIO_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.ui_scenario_task_execute_successful'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@ui_execute_successful_id, 'EXECUTE_SUCCESSFUL', '["CREATE_USER"]', @robot_in_site_id, 'UI_SCENARIO_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.ui_scenario_task_execute_successful');
INSERT INTO message_task_blob(id, template) VALUES (@ui_execute_successful_id, 'message.ui_scenario_task_execute'); INSERT INTO message_task_blob(id, template) VALUES (@ui_execute_successful_id, 'message.ui_scenario_task_execute');
SET @ui_execute_failed_id = UUID_SHORT(); SET @ui_execute_failed_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@ui_execute_failed_id, 'EXECUTE_FAILED', 'CREATE_USER', @robot_in_site_id, 'UI_SCENARIO_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.ui_scenario_task_execute_failed'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@ui_execute_failed_id, 'EXECUTE_FAILED', '["CREATE_USER"]', @robot_in_site_id, 'UI_SCENARIO_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.ui_scenario_task_execute_failed');
INSERT INTO message_task_blob(id, template) VALUES (@ui_execute_failed_id, 'message.ui_scenario_task_execute'); INSERT INTO message_task_blob(id, template) VALUES (@ui_execute_failed_id, 'message.ui_scenario_task_execute');
SET @ui_report_id = UUID_SHORT(); SET @ui_report_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@ui_report_id, 'DELETE', 'CREATE_USER', @robot_in_site_id, 'UI_REPORT_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.ui_report_task_delete'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@ui_report_id, 'DELETE', '["CREATE_USER"]', @robot_in_site_id, 'UI_REPORT_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.ui_report_task_delete');
INSERT INTO message_task_blob(id, template) VALUES (@ui_report_id, 'message.ui_report_task_delete'); INSERT INTO message_task_blob(id, template) VALUES (@ui_report_id, 'message.ui_report_task_delete');
-- 初始化性能测试消息数据 -- 初始化性能测试消息数据
SET @load_create_id = UUID_SHORT(); SET @load_create_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@load_create_id, 'UPDATE', 'CREATE_USER', @robot_in_site_id, 'LOAD_TEST_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.load_test_task_update'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@load_create_id, 'UPDATE', '["CREATE_USER"]', @robot_in_site_id, 'LOAD_TEST_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.load_test_task_update');
INSERT INTO message_task_blob(id, template) VALUES (@load_create_id, 'message.load_test_task_update'); INSERT INTO message_task_blob(id, template) VALUES (@load_create_id, 'message.load_test_task_update');
SET @load_delete_id = UUID_SHORT(); SET @load_delete_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@load_delete_id, 'DELETE', 'CREATE_USER', @robot_in_site_id, 'LOAD_TEST_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.load_test_task_delete'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@load_delete_id, 'DELETE', '["CREATE_USER"]', @robot_in_site_id, 'LOAD_TEST_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.load_test_task_delete');
INSERT INTO message_task_blob(id, template) VALUES (@load_delete_id, 'message.load_test_task_delete'); INSERT INTO message_task_blob(id, template) VALUES (@load_delete_id, 'message.load_test_task_delete');
SET @load_execute_id = UUID_SHORT(); SET @load_execute_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@load_execute_id, 'EXECUTE_COMPLETED', 'OPERATOR', @robot_in_site_id, 'LOAD_TEST_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.load_test_task_execute_completed'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@load_execute_id, 'EXECUTE_COMPLETED', '["OPERATOR"]', @robot_in_site_id, 'LOAD_TEST_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.load_test_task_execute_completed');
INSERT INTO message_task_blob(id, template) VALUES (@load_execute_id, 'message.load_test_task_execute_completed'); INSERT INTO message_task_blob(id, template) VALUES (@load_execute_id, 'message.load_test_task_execute_completed');
SET @load_report_id = UUID_SHORT(); SET @load_report_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@load_report_id, 'DELETE', 'CREATE_USER', @robot_in_site_id, 'LOAD_REPORT_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.load_report_task_delete'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@load_report_id, 'DELETE', '["CREATE_USER"]', @robot_in_site_id, 'LOAD_REPORT_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.load_report_task_delete');
INSERT INTO message_task_blob(id, template) VALUES (@load_report_id, 'message.load_report_task_delete'); INSERT INTO message_task_blob(id, template) VALUES (@load_report_id, 'message.load_report_task_delete');
-- 初始化Jenkins消息数据 -- 初始化Jenkins消息数据
SET @jenkins_execute_successful_id = UUID_SHORT(); SET @jenkins_execute_successful_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@jenkins_execute_successful_id, 'EXECUTE_SUCCESSFUL', 'CREATE_USER', @robot_in_site_id, 'JENKINS_TASK', 'NONE', '100001100001', false, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.jenkins_task_execute_successful'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@jenkins_execute_successful_id, 'EXECUTE_SUCCESSFUL', '["CREATE_USER"]', @robot_in_site_id, 'JENKINS_TASK', 'NONE', '100001100001', false, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.jenkins_task_execute_successful');
INSERT INTO message_task_blob(id, template) VALUES (@jenkins_execute_successful_id, 'message.jenkins_task_execute'); INSERT INTO message_task_blob(id, template) VALUES (@jenkins_execute_successful_id, 'message.jenkins_task_execute');
SET @jenkins_execute_failed_id = UUID_SHORT(); SET @jenkins_execute_failed_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@jenkins_execute_failed_id, 'EXECUTE_FAILED', 'CREATE_USER', @robot_in_site_id, 'JENKINS_TASK', 'NONE', '100001100001', false, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.jenkins_task_execute_failed'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@jenkins_execute_failed_id, 'EXECUTE_FAILED', '["CREATE_USER"]', @robot_in_site_id, 'JENKINS_TASK', 'NONE', '100001100001', false, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.jenkins_task_execute_failed');
INSERT INTO message_task_blob(id, template) VALUES (@jenkins_execute_failed_id, 'message.jenkins_task_execute'); INSERT INTO message_task_blob(id, template) VALUES (@jenkins_execute_failed_id, 'message.jenkins_task_execute');
-- 初始化定时任务消息数据 -- 初始化定时任务消息数据
SET @schedule_open_id = UUID_SHORT(); SET @schedule_open_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@schedule_open_id, 'OPEN', 'CREATE_USER', @robot_in_site_id, 'SCHEDULE_TASK', 'NONE', '100001100001', false, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.schedule_task_open'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@schedule_open_id, 'OPEN', '["CREATE_USER"]', @robot_in_site_id, 'SCHEDULE_TASK', 'NONE', '100001100001', false, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.schedule_task_open');
INSERT INTO message_task_blob(id, template) VALUES (@schedule_open_id, 'message.schedule_task_open'); INSERT INTO message_task_blob(id, template) VALUES (@schedule_open_id, 'message.schedule_task_open');
SET @schedule_close_id = UUID_SHORT(); SET @schedule_close_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@schedule_close_id, 'CLOSE', 'CREATE_USER', @robot_in_site_id, 'SCHEDULE_TASK', 'NONE', '100001100001', false, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.schedule_task_close'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@schedule_close_id, 'CLOSE', '["CREATE_USER"]', @robot_in_site_id, 'SCHEDULE_TASK', 'NONE', '100001100001', false, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.schedule_task_close');
INSERT INTO message_task_blob(id, template) VALUES (@schedule_close_id, 'message.schedule_task_close'); INSERT INTO message_task_blob(id, template) VALUES (@schedule_close_id, 'message.schedule_task_close');
-- 初始化内部at 消息通知 -- 初始化内部at 消息通知
SET @case_comment_at_id = UUID_SHORT(); SET @case_comment_at_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@case_comment_at_id, 'AT', 'NONE', @robot_in_site_id, 'FUNCTIONAL_CASE_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.functional_case_task_comment'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@case_comment_at_id, 'AT', '[]', @robot_in_site_id, 'FUNCTIONAL_CASE_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.functional_case_task_comment');
INSERT INTO message_task_blob(id, template) VALUES (@case_comment_at_id, 'message.functional_case_task_at_comment'); INSERT INTO message_task_blob(id, template) VALUES (@case_comment_at_id, 'message.functional_case_task_at_comment');
SET @case_comment_reply_id = UUID_SHORT(); SET @case_comment_reply_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@case_comment_reply_id, 'REPLY', 'NONE', @robot_in_site_id, 'FUNCTIONAL_CASE_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.functional_case_task_comment'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@case_comment_reply_id, 'REPLY', '[]', @robot_in_site_id, 'FUNCTIONAL_CASE_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.functional_case_task_comment');
INSERT INTO message_task_blob(id, template) VALUES (@case_comment_reply_id, 'message.functional_case_task_reply_comment'); INSERT INTO message_task_blob(id, template) VALUES (@case_comment_reply_id, 'message.functional_case_task_reply_comment');
SET @case_review_at_id = UUID_SHORT(); SET @case_review_at_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@case_review_at_id, 'REVIEW_AT', 'NONE', @robot_in_site_id, 'FUNCTIONAL_CASE_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.functional_case_task_review_at'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@case_review_at_id, 'REVIEW_AT', '[]', @robot_in_site_id, 'FUNCTIONAL_CASE_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.functional_case_task_review_at');
INSERT INTO message_task_blob(id, template) VALUES (@case_review_at_id, 'message.functional_case_task_review_at'); INSERT INTO message_task_blob(id, template) VALUES (@case_review_at_id, 'message.functional_case_task_review_at');
SET @case_plan_at_id = UUID_SHORT(); SET @case_plan_at_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@case_plan_at_id, 'EXECUTE_AT', 'NONE', @robot_in_site_id, 'FUNCTIONAL_CASE_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.functional_case_task_execute_at'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@case_plan_at_id, 'EXECUTE_AT', '[]', @robot_in_site_id, 'FUNCTIONAL_CASE_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.functional_case_task_execute_at');
INSERT INTO message_task_blob(id, template) VALUES (@case_plan_at_id, 'message.functional_case_task_plan_at'); INSERT INTO message_task_blob(id, template) VALUES (@case_plan_at_id, 'message.functional_case_task_plan_at');
SET @bug_comment_at_id = UUID_SHORT(); SET @bug_comment_at_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@bug_comment_at_id, 'AT', 'NONE', @robot_in_site_id, 'BUG_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.bug_task_comment'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@bug_comment_at_id, 'AT', '[]', @robot_in_site_id, 'BUG_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.bug_task_comment');
INSERT INTO message_task_blob(id, template) VALUES (@bug_comment_at_id, 'message.bug_task_at_comment'); INSERT INTO message_task_blob(id, template) VALUES (@bug_comment_at_id, 'message.bug_task_at_comment');
SET @bug_comment_reply_id = UUID_SHORT(); SET @bug_comment_reply_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@bug_comment_reply_id, 'REPLY', 'NONE', @robot_in_site_id, 'BUG_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.bug_task_comment'); Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@bug_comment_reply_id, 'REPLY', '[]', @robot_in_site_id, 'BUG_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.bug_task_comment');
INSERT INTO message_task_blob(id, template) VALUES (@bug_comment_reply_id, 'message.bug_task_reply_comment'); INSERT INTO message_task_blob(id, template) VALUES (@bug_comment_reply_id, 'message.bug_task_reply_comment');

View File

@ -12,51 +12,46 @@ INSERT INTO project_robot(id, project_id, name, platform, webhook, type, app_key
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject)
VALUES ('case-comment_message1', 'UPDATE', 'CREATE_USER', 'test_comment_message_robot1', 'FUNCTIONAL_CASE_TASK', 'NONE', 'project-case-comment-test', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.functional_case_task_update'); VALUES ('case-comment_message1', 'UPDATE', '["CREATE_USER", "FOLLOW_PEOPLE"]', 'test_comment_message_robot1', 'FUNCTIONAL_CASE_TASK', 'NONE', 'project-case-comment-test', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.functional_case_task_update');
INSERT INTO message_task_blob(id, template) VALUES ('case-comment_message1', 'message.functional_case_task_update'); INSERT INTO message_task_blob(id, template) VALUES ('case-comment_message1', 'message.functional_case_task_update');
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject)
VALUES ('case-comment_message2', 'UPDATE', 'FOLLOW_PEOPLE', 'test_comment_message_robot1', 'FUNCTIONAL_CASE_TASK', 'NONE', 'project-case-comment-test', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.functional_case_task_update'); VALUES ('case-comment_message3', 'DELETE', '["CREATE_USER"]', 'test_comment_message_robot1', 'FUNCTIONAL_CASE_TASK', 'NONE', 'project-case-comment-test', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.functional_case_task_delete');
INSERT INTO message_task_blob(id, template) VALUES ('case-comment_message2', 'message.functional_case_task_update');
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject)
VALUES ('case-comment_message3', 'DELETE', 'CREATE_USER', 'test_comment_message_robot1', 'FUNCTIONAL_CASE_TASK', 'NONE', 'project-case-comment-test', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.functional_case_task_delete');
INSERT INTO message_task_blob(id, template) VALUES ('case-comment_message3', 'message.functional_case_task_delete'); INSERT INTO message_task_blob(id, template) VALUES ('case-comment_message3', 'message.functional_case_task_delete');
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject)
VALUES ('case-comment_message4', 'REVIEW_PASSED', 'CREATE_USER', 'test_comment_message_robot1', 'FUNCTIONAL_CASE_TASK', 'NONE', 'project-case-comment-test', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.functional_case_task_review_passed'); VALUES ('case-comment_message4', 'REVIEW_PASSED', '["CREATE_USER"]', 'test_comment_message_robot1', 'FUNCTIONAL_CASE_TASK', 'NONE', 'project-case-comment-test', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.functional_case_task_review_passed');
INSERT INTO message_task_blob(id, template) VALUES ('case-comment_message4', 'message.functional_case_task_review'); INSERT INTO message_task_blob(id, template) VALUES ('case-comment_message4', 'message.functional_case_task_review');
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject)
VALUES ('case-comment_message5', 'REVIEW_FAIL', 'CREATE_USER', 'test_comment_message_robot1', 'FUNCTIONAL_CASE_TASK', 'NONE', 'project-case-comment-test', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.functional_case_task_review_fail'); VALUES ('case-comment_message5', 'REVIEW_FAIL', '["CREATE_USER"]', 'test_comment_message_robot1', 'FUNCTIONAL_CASE_TASK', 'NONE', 'project-case-comment-test', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.functional_case_task_review_fail');
INSERT INTO message_task_blob(id, template) VALUES ('case-comment_message5', 'message.functional_case_task_review'); INSERT INTO message_task_blob(id, template) VALUES ('case-comment_message5', 'message.functional_case_task_review');
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject)
VALUES ('case-comment_message6', 'EXECUTE_PASSED', 'CREATE_USER', 'test_comment_message_robot1', 'FUNCTIONAL_CASE_TASK', 'NONE', 'project-case-comment-test', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.functional_case_task_execute_passed'); VALUES ('case-comment_message6', 'EXECUTE_PASSED', '["CREATE_USER"]', 'test_comment_message_robot1', 'FUNCTIONAL_CASE_TASK', 'NONE', 'project-case-comment-test', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.functional_case_task_execute_passed');
INSERT INTO message_task_blob(id, template) VALUES ('case-comment_message6', 'message.functional_case_task_plan'); INSERT INTO message_task_blob(id, template) VALUES ('case-comment_message6', 'message.functional_case_task_plan');
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject)
VALUES ('case-comment_message7', 'EXECUTE_FAIL', 'CREATE_USER', 'test_comment_message_robot1', 'FUNCTIONAL_CASE_TASK', 'NONE', 'project-case-comment-test', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.functional_case_task_execute_fail'); VALUES ('case-comment_message7', 'EXECUTE_FAIL', '["CREATE_USER"]', 'test_comment_message_robot1', 'FUNCTIONAL_CASE_TASK', 'NONE', 'project-case-comment-test', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.functional_case_task_execute_fail');
INSERT INTO message_task_blob(id, template) VALUES ('case-comment_message7', 'message.functional_case_task_plan'); INSERT INTO message_task_blob(id, template) VALUES ('case-comment_message7', 'message.functional_case_task_plan');
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject)
VALUES ('case-comment_message8', 'COMMENT', 'CREATE_USER', 'test_comment_message_robot1', 'FUNCTIONAL_CASE_TASK', 'NONE', 'project-case-comment-test', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.functional_case_task_comment'); VALUES ('case-comment_message8', 'COMMENT', '["CREATE_USER"]', 'test_comment_message_robot1', 'FUNCTIONAL_CASE_TASK', 'NONE', 'project-case-comment-test', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.functional_case_task_comment');
INSERT INTO message_task_blob(id, template) VALUES ('case-comment_message8', 'message.functional_case_task_comment'); INSERT INTO message_task_blob(id, template) VALUES ('case-comment_message8', 'message.functional_case_task_comment');
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject)
VALUES ('case-comment_message9', 'AT', 'NONE', 'test_comment_message_robot1', 'FUNCTIONAL_CASE_TASK', 'NONE', 'project-case-comment-test', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.functional_case_task_comment'); VALUES ('case-comment_message9', 'AT', '[]', 'test_comment_message_robot1', 'FUNCTIONAL_CASE_TASK', 'NONE', 'project-case-comment-test', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.functional_case_task_comment');
INSERT INTO message_task_blob(id, template) VALUES ('case-comment_message9', 'message.functional_case_task_at_comment'); INSERT INTO message_task_blob(id, template) VALUES ('case-comment_message9', 'message.functional_case_task_at_comment');
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject)
VALUES ('case-comment_message10', 'REPLY', 'NONE', 'test_comment_message_robot1', 'FUNCTIONAL_CASE_TASK', 'NONE', 'project-case-comment-test', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.functional_case_task_comment'); VALUES ('case-comment_message10', 'REPLY', '[]', 'test_comment_message_robot1', 'FUNCTIONAL_CASE_TASK', 'NONE', 'project-case-comment-test', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.functional_case_task_comment');
INSERT INTO message_task_blob(id, template) VALUES ('case-comment_message10', 'message.functional_case_task_reply_comment'); INSERT INTO message_task_blob(id, template) VALUES ('case-comment_message10', 'message.functional_case_task_reply_comment');
INSERT INTO functional_case(id, num, module_id, project_id, template_id, name, review_status, tags, case_edit_type, pos, INSERT INTO functional_case(id, num, module_id, project_id, template_id, name, review_status, tags, case_edit_type, pos,

View File

@ -71,37 +71,19 @@ INSERT INTO user_role_relation (id, user_id, role_id, source_id, organization_id
INSERT INTO project_robot(id, project_id, name, platform, webhook, type, app_key, app_secret, enable, create_user, create_time, update_user, update_time, description) VALUES ('test_case_review_message_robot1', 'project-gyq-case-review-test', '测试机器人1', 'IN_SITE', 'NONE', null, null, null, true, 'admin', unix_timestamp() * 1000,'admin', unix_timestamp() * 1000, null); INSERT INTO project_robot(id, project_id, name, platform, webhook, type, app_key, app_secret, enable, create_user, create_time, update_user, update_time, description) VALUES ('test_case_review_message_robot1', 'project-gyq-case-review-test', '测试机器人1', 'IN_SITE', 'NONE', null, null, null, true, 'admin', unix_timestamp() * 1000,'admin', unix_timestamp() * 1000, null);
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject)
VALUES ('case-review_message0', 'CREATE', 'gyq_review_test', 'test_case_review_message_robot1', 'CASE_REVIEW_TASK', 'NONE', 'project-gyq-case-review-test', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.case_review_task_create'); VALUES ('case-review_message0', 'CREATE', '["gyq_review_test","CREATE_USER"]', 'test_case_review_message_robot1', 'CASE_REVIEW_TASK', 'NONE', 'project-gyq-case-review-test', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.case_review_task_create');
INSERT INTO message_task_blob(id, template) VALUES ('case-review_message0', 'message.case_review_task_create'); INSERT INTO message_task_blob(id, template) VALUES ('case-review_message0', 'message.case_review_task_create');
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject)
VALUES ('case-review_message9', 'CREATE', 'CREATE_USER', 'test_case_review_message_robot1', 'CASE_REVIEW_TASK', 'NONE', 'project-gyq-case-review-test', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.case_review_task_create'); VALUES ('case-review_message1', 'UPDATE', '["CREATE_USER", "FOLLOW_PEOPLE", "gyq_review_test2"]', 'test_case_review_message_robot1', 'CASE_REVIEW_TASK', 'NONE', 'project-gyq-case-review-test', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.case_review_task_update');
INSERT INTO message_task_blob(id, template) VALUES ('case-review_message9', 'message.case_review_task_create');
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject)
VALUES ('case-review_message1', 'UPDATE', 'CREATE_USER', 'test_case_review_message_robot1', 'CASE_REVIEW_TASK', 'NONE', 'project-gyq-case-review-test', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.case_review_task_update');
INSERT INTO message_task_blob(id, template) VALUES ('case-review_message1', 'message.case_review_task_update'); INSERT INTO message_task_blob(id, template) VALUES ('case-review_message1', 'message.case_review_task_update');
Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject)
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES ('case-review_message3', 'DELETE', '["CREATE_USER", "gyq_review_test2"]', 'test_case_review_message_robot1', 'CASE_REVIEW_TASK', 'NONE', 'project-gyq-case-review-test', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.case_review_task_delete');
VALUES ('case-review_message2', 'UPDATE', 'FOLLOW_PEOPLE', 'test_case_review_message_robot1', 'CASE_REVIEW_TASK', 'NONE', 'project-gyq-case-review-test', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.case_review_task_update');
INSERT INTO message_task_blob(id, template) VALUES ('case-review_message2', 'message.case_review_task_update');
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject)
VALUES ('case-review_message5', 'UPDATE', 'gyq_review_test2', 'test_case_review_message_robot1', 'CASE_REVIEW_TASK', 'NONE', 'project-gyq-case-review-test', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.case_review_task_update');
INSERT INTO message_task_blob(id, template) VALUES ('case-review_message5', 'message.case_review_task_update');
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject)
VALUES ('case-review_message3', 'DELETE', 'CREATE_USER', 'test_case_review_message_robot1', 'CASE_REVIEW_TASK', 'NONE', 'project-gyq-case-review-test', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.case_review_task_delete');
INSERT INTO message_task_blob(id, template) VALUES ('case-review_message3', 'message.case_review_task_delete'); INSERT INTO message_task_blob(id, template) VALUES ('case-review_message3', 'message.case_review_task_delete');
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject)
VALUES ('case-review_message7', 'DELETE', 'gyq_review_test2', 'test_case_review_message_robot1', 'CASE_REVIEW_TASK', 'NONE', 'project-gyq-case-review-test', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.case_review_task_delete'); VALUES ('case-review_message4', 'REVIEW_COMPLETED', '["CREATE_USER"]', 'test_case_review_message_robot1', 'CASE_REVIEW_TASK', 'NONE', 'project-gyq-case-review-test', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.case_review_task_review_completed');
INSERT INTO message_task_blob(id, template) VALUES ('case-review_message7', 'message.case_review_task_delete');
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject)
VALUES ('case-review_message4', 'REVIEW_COMPLETED', 'CREATE_USER', 'test_case_review_message_robot1', 'CASE_REVIEW_TASK', 'NONE', 'project-gyq-case-review-test', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.case_review_task_review_completed');
INSERT INTO message_task_blob(id, template) VALUES ('case-review_message4', 'message.case_review_task_review_completed'); INSERT INTO message_task_blob(id, template) VALUES ('case-review_message4', 'message.case_review_task_review_completed');

View File

@ -20,88 +20,61 @@ VALUES ('test_review_case_message_robot1', 'project-review-case-test', '测试
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user,
create_time, update_user, update_time, use_default_template, use_default_subject, subject) create_time, update_user, update_time, use_default_template, use_default_subject, subject)
VALUES ('review-case_messageOne', 'UPDATE', 'CREATE_USER', 'test_review_case_message_robot1', 'CASE_REVIEW_TASK', VALUES ('review-case_messageOne', 'UPDATE', '["CREATE_USER","FOLLOW_PEOPLE"]', 'test_review_case_message_robot1', 'CASE_REVIEW_TASK',
'NONE', 'project-review-case-test', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, 'NONE', 'project-review-case-test', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000,
true, true, 'message.title.case_review_task_update'); true, true, 'message.title.case_review_task_update');
INSERT INTO message_task_blob(id, template) INSERT INTO message_task_blob(id, template)
VALUES ('review-case_messageOne', 'message.case_review_task_update'); VALUES ('review-case_messageOne', 'message.case_review_task_update');
Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user,
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user,
create_time, update_user, update_time, use_default_template, use_default_subject, subject) create_time, update_user, update_time, use_default_template, use_default_subject, subject)
VALUES ('review-case_message2', 'UPDATE', 'FOLLOW_PEOPLE', 'test_review_case_message_robot1', 'CASE_REVIEW_TASK', VALUES ('review-case_message3', 'DELETE', '["CREATE_USER"]', 'test_review_case_message_robot1', 'CASE_REVIEW_TASK', 'NONE',
'NONE', 'project-review-case-test', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000,
true, true, 'message.title.case_review_task_update');
INSERT INTO message_task_blob(id, template)
VALUES ('review-case_message2', 'message.case_review_task_update');
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user,
create_time, update_user, update_time, use_default_template, use_default_subject, subject)
VALUES ('review-case_message3', 'DELETE', 'CREATE_USER', 'test_review_case_message_robot1', 'CASE_REVIEW_TASK', 'NONE',
'project-review-case-test', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, 'project-review-case-test', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true,
true, 'message.title.case_review_task_delete'); true, 'message.title.case_review_task_delete');
INSERT INTO message_task_blob(id, template) INSERT INTO message_task_blob(id, template)
VALUES ('review-case_message3', 'message.case_review_task_delete'); VALUES ('review-case_message3', 'message.case_review_task_delete');
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user,
create_time, update_user, update_time, use_default_template, use_default_subject, subject) create_time, update_user, update_time, use_default_template, use_default_subject, subject)
VALUES ('review-case_message4', 'REVIEW_COMPLETED', 'CREATE_USER', 'test_review_case_message_robot1', VALUES ('review-case_message4', 'REVIEW_COMPLETED', '["CREATE_USER","default-project-member-user-gyq"]', 'test_review_case_message_robot1',
'CASE_REVIEW_TASK', 'NONE', 'project-review-case-test', true, 'admin', unix_timestamp() * 1000, 'admin', 'CASE_REVIEW_TASK', 'NONE', 'project-review-case-test', true, 'admin', unix_timestamp() * 1000, 'admin',
unix_timestamp() * 1000, true, true, 'message.title.case_review_task_review_completed'); unix_timestamp() * 1000, true, true, 'message.title.case_review_task_review_completed');
INSERT INTO message_task_blob(id, template) INSERT INTO message_task_blob(id, template)
VALUES ('review-case_message4', 'message.case_review_task_review_completed'); VALUES ('review-case_message4', 'message.case_review_task_review_completed');
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user,
create_time, update_user, update_time, use_default_template, use_default_subject, subject)
VALUES ('review-case_messageA', 'REVIEW_COMPLETED', 'default-project-member-user-gyq',
'test_review_case_message_robot1', 'CASE_REVIEW_TASK', 'NONE', 'project-review-case-test', true, 'admin',
unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true,
'message.title.case_review_task_review_completed');
INSERT INTO message_task_blob(id, template)
VALUES ('review-case_messageA', 'message.case_review_task_review_completed');
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user,
create_time, update_user, update_time, use_default_template, use_default_subject, subject) create_time, update_user, update_time, use_default_template, use_default_subject, subject)
VALUES ('review-case_message5', 'CREATE', 'CREATE_USER', 'test_review_case_message_robot1', 'CASE_REVIEW_TASK', 'NONE', VALUES ('review-case_message5', 'CREATE', '["CREATE_USER","default-project-member-user-gyq"]', 'test_review_case_message_robot1', 'CASE_REVIEW_TASK', 'NONE',
'project-review-case-test', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, 'project-review-case-test', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true,
true, 'message.title.case_review_task_create'); true, 'message.title.case_review_task_create');
INSERT INTO message_task_blob(id, template) INSERT INTO message_task_blob(id, template)
VALUES ('review-case_message5', 'message.case_review_task_create'); VALUES ('review-case_message5', 'message.case_review_task_create');
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user,
create_time, update_user, update_time, use_default_template, use_default_subject, subject) create_time, update_user, update_time, use_default_template, use_default_subject, subject)
VALUES ('review-case_message6', 'CREATE', 'default-project-member-user-gyq', 'test_review_case_message_robot1', VALUES ('review-case_message7', 'REVIEW_AT', '[]', 'test_review_case_message_robot1', 'FUNCTIONAL_CASE_TASK', 'NONE',
'CASE_REVIEW_TASK', 'NONE', 'project-review-case-test', true, 'admin', unix_timestamp() * 1000, 'admin',
unix_timestamp() * 1000, true, true, 'message.title.case_review_task_create');
INSERT INTO message_task_blob(id, template)
VALUES ('review-case_message6', 'message.case_review_task_create');
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user,
create_time, update_user, update_time, use_default_template, use_default_subject, subject)
VALUES ('review-case_message7', 'REVIEW_AT', 'NONE', 'test_review_case_message_robot1', 'FUNCTIONAL_CASE_TASK', 'NONE',
'project-review-case-test', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, 'project-review-case-test', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true,
true, 'message.title.functional_case_task_review_at'); true, 'message.title.functional_case_task_review_at');
INSERT INTO message_task_blob(id, template) INSERT INTO message_task_blob(id, template)
VALUES ('review-case_message7', 'message.functional_case_task_review_at'); VALUES ('review-case_message7', 'message.functional_case_task_review_at');
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user,
create_time, update_user, update_time, use_default_template, use_default_subject, subject) create_time, update_user, update_time, use_default_template, use_default_subject, subject)
VALUES ('review-case_message8', 'REVIEW_PASSED', 'default-project-member-user-gyq-2', 'test_review_case_message_robot1', VALUES ('review-case_message8', 'REVIEW_PASSED', '["default-project-member-user-gyq-2"]', 'test_review_case_message_robot1',
'FUNCTIONAL_CASE_TASK', 'NONE', 'project-review-case-test', true, 'admin', unix_timestamp() * 1000, 'admin', 'FUNCTIONAL_CASE_TASK', 'NONE', 'project-review-case-test', true, 'admin', unix_timestamp() * 1000, 'admin',
unix_timestamp() * 1000, true, true, 'message.title.functional_case_task_review_passed'); unix_timestamp() * 1000, true, true, 'message.title.functional_case_task_review_passed');
INSERT INTO message_task_blob(id, template) INSERT INTO message_task_blob(id, template)
VALUES ('review-case_message8', 'message.functional_case_task_review'); VALUES ('review-case_message8', 'message.functional_case_task_review');
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, Insert into message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user,
create_time, update_user, update_time, use_default_template, use_default_subject, subject) create_time, update_user, update_time, use_default_template, use_default_subject, subject)
VALUES ('review-case_message9', 'REVIEW_FAIL', 'default-project-member-user-gyq-2', 'test_review_case_message_robot1', VALUES ('review-case_message9', 'REVIEW_FAIL', '["default-project-member-user-gyq-2"]', 'test_review_case_message_robot1',
'FUNCTIONAL_CASE_TASK', 'NONE', 'project-review-case-test', true, 'admin', unix_timestamp() * 1000, 'admin', 'FUNCTIONAL_CASE_TASK', 'NONE', 'project-review-case-test', true, 'admin', unix_timestamp() * 1000, 'admin',
unix_timestamp() * 1000, true, true, 'message.title.functional_case_task_review_fail'); unix_timestamp() * 1000, true, true, 'message.title.functional_case_task_review_fail');
INSERT INTO message_task_blob(id, template) INSERT INTO message_task_blob(id, template)

View File

@ -1,11 +0,0 @@
package io.metersphere.project.mapper;
import io.metersphere.project.domain.MessageTask;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ExtMessageTaskMapper {
List<MessageTask> getRobotType(@Param("projectId") String projectId, @Param("taskType") String taskType, @Param("event") String event);
}

View File

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.project.mapper.ExtMessageTaskMapper">
<select id="getRobotType" resultType="io.metersphere.project.domain.MessageTask">
select * from message_task where project_id = #{projectId}
and task_type = #{taskType} and event = #{event} and enable = true group by project_robot_id
</select>
</mapper>

View File

@ -116,30 +116,29 @@ public class CreateRobotResourceService implements CreateProjectResourceService
if (StringUtils.equalsIgnoreCase(event, NoticeConstants.Event.CREATE) || StringUtils.equalsIgnoreCase(event, NoticeConstants.Event.CASE_CREATE) || StringUtils.equalsIgnoreCase(event, NoticeConstants.Event.MOCK_CREATE) || CollectionUtils.isEmpty(receivers)) { if (StringUtils.equalsIgnoreCase(event, NoticeConstants.Event.CREATE) || StringUtils.equalsIgnoreCase(event, NoticeConstants.Event.CASE_CREATE) || StringUtils.equalsIgnoreCase(event, NoticeConstants.Event.MOCK_CREATE) || CollectionUtils.isEmpty(receivers)) {
continue; continue;
} }
for (OptionDTO receiver : receivers) { List<String> receiverIds = receivers.stream().map(OptionDTO::getId).toList();
String id = IDGenerator.nextStr(); String id = IDGenerator.nextStr();
MessageTask messageTask = new MessageTask(); MessageTask messageTask = new MessageTask();
messageTask.setId(id); messageTask.setId(id);
messageTask.setEvent(event); messageTask.setEvent(event);
messageTask.setTaskType(taskType); messageTask.setTaskType(taskType);
messageTask.setReceiver(receiver.getId()); messageTask.setReceivers(receiverIds);
messageTask.setProjectId(projectId); messageTask.setProjectId(projectId);
messageTask.setProjectRobotId(defaultRobotId); messageTask.setProjectRobotId(defaultRobotId);
messageTask.setEnable(true); messageTask.setEnable(true);
messageTask.setTestId("NONE"); messageTask.setTestId("NONE");
messageTask.setCreateUser("admin"); messageTask.setCreateUser("admin");
messageTask.setCreateTime(System.currentTimeMillis()); messageTask.setCreateTime(System.currentTimeMillis());
messageTask.setUpdateUser("admin"); messageTask.setUpdateUser("admin");
messageTask.setUpdateTime(System.currentTimeMillis()); messageTask.setUpdateTime(System.currentTimeMillis());
messageTask.setSubject(""); messageTask.setSubject("");
messageTask.setUseDefaultSubject(true); messageTask.setUseDefaultSubject(true);
messageTask.setUseDefaultTemplate(true); messageTask.setUseDefaultTemplate(true);
MessageTaskBlob messageTaskBlob = new MessageTaskBlob(); MessageTaskBlob messageTaskBlob = new MessageTaskBlob();
messageTaskBlob.setId(id); messageTaskBlob.setId(id);
messageTaskBlob.setTemplate(""); messageTaskBlob.setTemplate("");
mapper.insert(messageTask); mapper.insert(messageTask);
blobMapper.insert(messageTaskBlob); blobMapper.insert(messageTaskBlob);
}
} }
} }
} }
@ -164,7 +163,7 @@ public class CreateRobotResourceService implements CreateProjectResourceService
messageTask.setId(id); messageTask.setId(id);
messageTask.setEvent(event); messageTask.setEvent(event);
messageTask.setTaskType(taskType); messageTask.setTaskType(taskType);
messageTask.setReceiver("NONE"); messageTask.setReceivers(new ArrayList<>());
messageTask.setProjectId(projectId); messageTask.setProjectId(projectId);
messageTask.setProjectRobotId(defaultRobotId); messageTask.setProjectRobotId(defaultRobotId);
messageTask.setEnable(true); messageTask.setEnable(true);

View File

@ -22,7 +22,6 @@ import io.metersphere.system.notice.utils.MessageTemplateUtils;
import io.metersphere.system.uid.IDGenerator; import io.metersphere.system.uid.IDGenerator;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.session.ExecutorType; import org.apache.ibatis.session.ExecutorType;
import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSession;
@ -58,8 +57,6 @@ public class NoticeMessageTaskService {
private ExtProjectUserRoleMapper extProjectUserRoleMapper; private ExtProjectUserRoleMapper extProjectUserRoleMapper;
@Resource @Resource
protected CustomFieldMapper customFieldMapper; protected CustomFieldMapper customFieldMapper;
@Resource
protected ExtMessageTaskMapper extMessageTaskMapper;
public static final String USER_IDS = "user_ids"; public static final String USER_IDS = "user_ids";
@ -69,22 +66,19 @@ public class NoticeMessageTaskService {
public ResultHolder saveMessageTask(MessageTaskRequest messageTaskRequest, String userId) { public ResultHolder saveMessageTask(MessageTaskRequest messageTaskRequest, String userId) {
String projectId = messageTaskRequest.getProjectId(); String projectId = messageTaskRequest.getProjectId();
//删除用户数据不在当前传送用户内的数据
deleteUserData(messageTaskRequest, projectId);
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH); SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
MessageTaskMapper mapper = sqlSession.getMapper(MessageTaskMapper.class); MessageTaskMapper mapper = sqlSession.getMapper(MessageTaskMapper.class);
MessageTaskBlobMapper blobMapper = sqlSession.getMapper(MessageTaskBlobMapper.class); MessageTaskBlobMapper blobMapper = sqlSession.getMapper(MessageTaskBlobMapper.class);
//检查用户是否存在 //检查用户是否存在
Map<String, List<String>> stringListMap = checkUserExistProject(messageTaskRequest.getReceiverIds(), projectId); Map<String, List<String>> stringListMap = checkUserExistProject(messageTaskRequest.getReceiverIds(), projectId);
List<String> existUserIds = stringListMap.get(USER_IDS); List<String> existUserIds = stringListMap.get(USER_IDS);
List<MessageTask> robotType = extMessageTaskMapper.getRobotType(projectId, messageTaskRequest.getTaskType(), messageTaskRequest.event);
Map<String, List<MessageTask>> robotEnasleMap = robotType.stream().collect(Collectors.groupingBy(MessageTask::getProjectRobotId));
//检查设置的通知是否存在如果存在则更新 //检查设置的通知是否存在如果存在则更新
List<MessageTask> messageTasks = updateMessageTasks(messageTaskRequest, userId, mapper, blobMapper, existUserIds); List<MessageTask> messageTasks = updateMessageTasks(messageTaskRequest, userId, mapper, blobMapper, existUserIds);
Map<String, List<MessageTask>> robotMap = messageTasks.stream().collect(Collectors.groupingBy(MessageTask::getProjectRobotId)); //不存在则新增
//保存消息任务 if (CollectionUtils.isEmpty(messageTasks)) {
insertMessageTask(messageTaskRequest, userId, mapper, blobMapper, existUserIds, robotMap, robotEnasleMap); insertMessageTask(messageTaskRequest, userId, mapper, blobMapper, existUserIds);
}
sqlSession.flushStatements(); sqlSession.flushStatements();
SqlSessionUtils.closeSqlSession(sqlSession, sqlSessionFactory); SqlSessionUtils.closeSqlSession(sqlSession, sqlSessionFactory);
if (CollectionUtils.isNotEmpty(stringListMap.get(NO_USER_NAMES))) { if (CollectionUtils.isNotEmpty(stringListMap.get(NO_USER_NAMES))) {
@ -94,22 +88,6 @@ public class NoticeMessageTaskService {
return ResultHolder.success("OK"); return ResultHolder.success("OK");
} }
private void deleteUserData(MessageTaskRequest messageTaskRequest, String projectId) {
MessageTaskExample messageTaskExample = new MessageTaskExample();
messageTaskExample.createCriteria().andReceiverNotIn(messageTaskRequest.getReceiverIds())
.andProjectIdEqualTo(projectId).andTaskTypeEqualTo(messageTaskRequest.getTaskType()).andEventEqualTo(messageTaskRequest.getEvent());
List<MessageTask> delData = messageTaskMapper.selectByExample(messageTaskExample);
List<String> delIds = delData.stream().map(MessageTask::getId).toList();
if (CollectionUtils.isNotEmpty(delIds)) {
MessageTaskBlobExample messageTaskBlobExample = new MessageTaskBlobExample();
messageTaskBlobExample.createCriteria().andIdIn(delIds);
messageTaskBlobMapper.deleteByExample(messageTaskBlobExample);
messageTaskExample = new MessageTaskExample();
messageTaskExample.createCriteria().andIdIn(delIds);
messageTaskMapper.deleteByExample(messageTaskExample);
}
}
/** /**
* 新增MessageTask * 新增MessageTask
* *
@ -118,61 +96,23 @@ public class NoticeMessageTaskService {
* @param mapper MessageTaskMapper * @param mapper MessageTaskMapper
* @param blobMapper MessageTaskBlobMapper * @param blobMapper MessageTaskBlobMapper
* @param existUserIds 系统中还存在的入参传过来的接收人 * @param existUserIds 系统中还存在的入参传过来的接收人
* @param robotMap 更新过后机器人消息通知map
* @param robotEnableMap 数据库里已开起的机器人
*/ */
private void insertMessageTask(MessageTaskRequest messageTaskRequest, String userId, MessageTaskMapper mapper, MessageTaskBlobMapper blobMapper, List<String> existUserIds, Map<String, List<MessageTask>> robotMap, Map<String, List<MessageTask>> robotEnableMap) { private void insertMessageTask(MessageTaskRequest messageTaskRequest, String userId, MessageTaskMapper mapper, MessageTaskBlobMapper blobMapper, List<String> existUserIds) {
if (MapUtils.isEmpty(robotEnableMap) || StringUtils.isNotBlank(messageTaskRequest.getRobotId())) { //如果新增时只选了用户没有选机器人默认机器人为站内信
//如果新增时只选了用户没有选机器人默认机器人为站内信 ProjectRobot projectRobot = getDefaultRobot(messageTaskRequest.getProjectId(), messageTaskRequest.getRobotId());
ProjectRobot projectRobot = getDefaultRobot(messageTaskRequest.getProjectId(), messageTaskRequest.getRobotId()); String robotId = projectRobot.getId();
String robotId = projectRobot.getId(); messageTaskRequest.setRobotId(robotId);
boolean enable = getEnable(robotMap, robotId); MessageTask messageTask = new MessageTask();
messageTaskRequest.setRobotId(robotId); buildMessageTask(messageTaskRequest, userId, messageTask, existUserIds);
if (messageTaskRequest.getEnable() == null) { mapper.insert(messageTask);
messageTaskRequest.setEnable(enable); MessageTaskBlob messageTaskBlob = new MessageTaskBlob();
} messageTaskBlob.setId(messageTask.getId());
setUserMessageTaskInfo(messageTaskRequest, userId, mapper, blobMapper, existUserIds, robotMap); if (!messageTask.getUseDefaultTemplate()) {
} else {
robotEnableMap.forEach((robotId, v) -> {
boolean enable = getEnable(robotMap, robotId);
messageTaskRequest.setRobotId(robotId);
messageTaskRequest.setEnable(enable);
setUserMessageTaskInfo(messageTaskRequest, userId, mapper, blobMapper, existUserIds, robotMap);
});
}
}
private boolean getEnable(Map<String, List<MessageTask>> robotMap, String robotId) {
List<MessageTask> messageTasks = robotMap.get(robotId);
if (CollectionUtils.isEmpty(messageTasks)) {
return false;
} else {
return messageTasks.get(0).getEnable();
}
}
private static void setUserMessageTaskInfo(MessageTaskRequest messageTaskRequest, String userId, MessageTaskMapper mapper, MessageTaskBlobMapper blobMapper, List<String> existUserIds, Map<String, List<MessageTask>> robotMap) {
//判断是否需要完整的新增机器人数据
List<MessageTask> messageTasks = robotMap.get(messageTaskRequest.getRobotId());
for (String receiverId : existUserIds) {
//如果为空则需要完整新增新增人,则需要过滤数据里是否有这个人有则过滤
if (!CollectionUtils.isEmpty(messageTasks)) {
List<String> receivers = messageTasks.stream().map(MessageTask::getReceiver).toList();
if (CollectionUtils.isNotEmpty(receivers) && receivers.contains(receiverId)) {
continue;
}
}
MessageTask messageTask = new MessageTask();
buildMessageTask(messageTaskRequest, userId, receiverId, messageTask);
mapper.insert(messageTask);
MessageTaskBlob messageTaskBlob = new MessageTaskBlob();
messageTaskBlob.setId(messageTask.getId());
if (!messageTask.getUseDefaultTemplate()) {
messageTaskBlob.setTemplate(messageTaskRequest.getTemplate());
}
messageTaskBlob.setTemplate(messageTaskRequest.getTemplate()); messageTaskBlob.setTemplate(messageTaskRequest.getTemplate());
blobMapper.insert(messageTaskBlob);
} }
messageTaskBlob.setTemplate(messageTaskRequest.getTemplate());
blobMapper.insert(messageTaskBlob);
} }
/** /**
@ -201,7 +141,6 @@ public class NoticeMessageTaskService {
* @param mapper MessageTaskMapper * @param mapper MessageTaskMapper
* @param blobMapper MessageTaskBlobMapper * @param blobMapper MessageTaskBlobMapper
* @param existUserIds 系统中还存在的入参传过来的接收人 * @param existUserIds 系统中还存在的入参传过来的接收人
* @return List<MessageTask>
*/ */
private List<MessageTask> updateMessageTasks(MessageTaskRequest messageTaskRequest, String userId, MessageTaskMapper mapper, MessageTaskBlobMapper blobMapper, List<String> existUserIds) { private List<MessageTask> updateMessageTasks(MessageTaskRequest messageTaskRequest, String userId, MessageTaskMapper mapper, MessageTaskBlobMapper blobMapper, List<String> existUserIds) {
boolean enable = messageTaskRequest.getEnable() != null && messageTaskRequest.getEnable(); boolean enable = messageTaskRequest.getEnable() != null && messageTaskRequest.getEnable();
@ -210,12 +149,22 @@ public class NoticeMessageTaskService {
//查询在当前事件和已存在的通知人员下的数据即数据库已存在的数据 //查询在当前事件和已存在的通知人员下的数据即数据库已存在的数据
MessageTaskExample messageTaskExample = new MessageTaskExample(); MessageTaskExample messageTaskExample = new MessageTaskExample();
messageTaskExample.createCriteria().andReceiverIn(existUserIds).andProjectIdEqualTo(messageTaskRequest.getProjectId()).andTaskTypeEqualTo(messageTaskRequest.getTaskType()).andEventEqualTo(messageTaskRequest.getEvent()); messageTaskExample.createCriteria().andProjectIdEqualTo(messageTaskRequest.getProjectId()).andTaskTypeEqualTo(messageTaskRequest.getTaskType()).andEventEqualTo(messageTaskRequest.getEvent());
List<MessageTask> messageTasks = messageTaskMapper.selectByExample(messageTaskExample); List<MessageTask> messageTasks = messageTaskMapper.selectByExample(messageTaskExample);
List<String> messageTaskIds = messageTasks.stream().map(MessageTask::getId).toList();
if (CollectionUtils.isEmpty(messageTasks)) { if (CollectionUtils.isEmpty(messageTasks)) {
return new ArrayList<>(); return new ArrayList<>();
} }
//如果没有机器人id,则更新人如果有机器人id,过滤已存在的是否有当前机器人
if (StringUtils.isNotBlank(messageTaskRequest.getRobotId())) {
List<MessageTask> list = messageTasks.stream().filter(t -> StringUtils.equalsIgnoreCase(t.getProjectRobotId(), messageTaskRequest.getRobotId())).toList();
if (CollectionUtils.isEmpty(list)) {
return new ArrayList<>();
}
}
List<String> messageTaskIds = messageTasks.stream().map(MessageTask::getId).toList();
MessageTaskBlobExample messageTaskBlobExample = new MessageTaskBlobExample();
messageTaskBlobExample.createCriteria().andIdIn(messageTaskIds);
List<MessageTaskBlob> messageTaskBlobs = messageTaskBlobMapper.selectByExample(messageTaskBlobExample);
for (MessageTask messageTask : messageTasks) { for (MessageTask messageTask : messageTasks) {
messageTask.setUpdateTime(System.currentTimeMillis()); messageTask.setUpdateTime(System.currentTimeMillis());
messageTask.setUpdateUser(userId); messageTask.setUpdateUser(userId);
@ -231,23 +180,19 @@ public class NoticeMessageTaskService {
//如果没有机器人id,则只是修改人其余配置不变 //如果没有机器人id,则只是修改人其余配置不变
useDefaultTemplate = messageTask.getUseDefaultTemplate(); useDefaultTemplate = messageTask.getUseDefaultTemplate();
} }
messageTask.setReceivers(existUserIds);
mapper.updateByPrimaryKeySelective(messageTask); mapper.updateByPrimaryKeySelective(messageTask);
} }
MessageTaskBlobExample messageTaskBlobExample = new MessageTaskBlobExample();
messageTaskBlobExample.createCriteria().andIdIn(messageTaskIds);
List<MessageTaskBlob> messageTaskBlobs = messageTaskBlobMapper.selectByExample(messageTaskBlobExample);
for (MessageTaskBlob messageTaskBlob : messageTaskBlobs) { for (MessageTaskBlob messageTaskBlob : messageTaskBlobs) {
if (StringUtils.isNotBlank(messageTaskRequest.getRobotId())) { if (StringUtils.isNotBlank(messageTaskRequest.getRobotId()) && !useDefaultTemplate) {
if (!useDefaultTemplate) { messageTaskBlob.setTemplate(messageTaskRequest.getTemplate());
messageTaskBlob.setTemplate(messageTaskRequest.getTemplate()); blobMapper.updateByPrimaryKeyWithBLOBs(messageTaskBlob);
blobMapper.updateByPrimaryKeySelective(messageTaskBlob);
}
} }
} }
return messageTasks; return messageTasks;
} }
private static void buildMessageTask(MessageTaskRequest messageTaskRequest, String userId, String receiverId, MessageTask messageTask) { private static void buildMessageTask(MessageTaskRequest messageTaskRequest, String userId, MessageTask messageTask, List<String> existUserIds) {
String testId = messageTaskRequest.getTestId() == null ? "NONE" : messageTaskRequest.getTestId(); String testId = messageTaskRequest.getTestId() == null ? "NONE" : messageTaskRequest.getTestId();
boolean enable = messageTaskRequest.getEnable() != null && messageTaskRequest.getEnable(); boolean enable = messageTaskRequest.getEnable() != null && messageTaskRequest.getEnable();
boolean useDefaultSubject = messageTaskRequest.getUseDefaultSubject() == null || messageTaskRequest.getUseDefaultSubject(); boolean useDefaultSubject = messageTaskRequest.getUseDefaultSubject() == null || messageTaskRequest.getUseDefaultSubject();
@ -257,7 +202,7 @@ public class NoticeMessageTaskService {
messageTask.setId(insertId); messageTask.setId(insertId);
messageTask.setTaskType(messageTaskRequest.getTaskType()); messageTask.setTaskType(messageTaskRequest.getTaskType());
messageTask.setEvent(messageTaskRequest.getEvent()); messageTask.setEvent(messageTaskRequest.getEvent());
messageTask.setReceiver(receiverId); messageTask.setReceivers(existUserIds);
messageTask.setProjectId(messageTaskRequest.getProjectId()); messageTask.setProjectId(messageTaskRequest.getProjectId());
messageTask.setProjectRobotId(messageTaskRequest.getRobotId()); messageTask.setProjectRobotId(messageTaskRequest.getRobotId());
messageTask.setTestId(testId); messageTask.setTestId(testId);
@ -381,12 +326,16 @@ public class NoticeMessageTaskService {
MessageTaskBlobExample messageTaskBlobExample = new MessageTaskBlobExample(); MessageTaskBlobExample messageTaskBlobExample = new MessageTaskBlobExample();
messageTaskBlobExample.createCriteria().andIdIn(messageTaskIds); messageTaskBlobExample.createCriteria().andIdIn(messageTaskIds);
List<MessageTaskBlob> messageTaskBlobs = messageTaskBlobMapper.selectByExampleWithBLOBs(messageTaskBlobExample); List<MessageTaskBlob> messageTaskBlobs = messageTaskBlobMapper.selectByExampleWithBLOBs(messageTaskBlobExample);
List<String> robotIds = messageTasks.stream().map(MessageTask::getProjectRobotId).toList(); List<String> robotIds = new ArrayList<>();
List<String> userIds = new ArrayList<>();
messageTasks.forEach(t->{
robotIds.add(t.getProjectRobotId());
userIds.addAll(t.getReceivers());
});
ProjectRobotExample projectRobotExample = new ProjectRobotExample(); ProjectRobotExample projectRobotExample = new ProjectRobotExample();
projectRobotExample.createCriteria().andIdIn(robotIds); projectRobotExample.createCriteria().andIdIn(robotIds);
List<ProjectRobot> projectRobots = projectRobotMapper.selectByExample(projectRobotExample); List<ProjectRobot> projectRobots = projectRobotMapper.selectByExample(projectRobotExample);
Map<String, ProjectRobot> robotMap = projectRobots.stream().collect(Collectors.toMap(ProjectRobot::getId, item -> item)); Map<String, ProjectRobot> robotMap = projectRobots.stream().collect(Collectors.toMap(ProjectRobot::getId, item -> item));
List<String> userIds = messageTasks.stream().map(MessageTask::getReceiver).toList();
UserExample userExample = new UserExample(); UserExample userExample = new UserExample();
userExample.createCriteria().andIdIn(userIds).andDeletedEqualTo(false); userExample.createCriteria().andIdIn(userIds).andDeletedEqualTo(false);
List<User> users = userMapper.selectByExample(userExample); List<User> users = userMapper.selectByExample(userExample);
@ -432,10 +381,13 @@ public class NoticeMessageTaskService {
} else { } else {
for (MessageTask messageTask : messageTaskList) { for (MessageTask messageTask : messageTaskList) {
MessageTaskBlob messageTaskBlob = messageTaskBlobMap.get(messageTask.getId()); MessageTaskBlob messageTaskBlob = messageTaskBlobMap.get(messageTask.getId());
OptionDTO optionDTO = new OptionDTO(); List<String> receiverIds = messageTask.getReceivers();
optionDTO.setId(messageTask.getReceiver()); for (String receiverId : receiverIds) {
optionDTO.setName(userNameMap.get(messageTask.getReceiver())); OptionDTO optionDTO = new OptionDTO();
receivers.add(optionDTO); optionDTO.setId(receiverId);
optionDTO.setName(userNameMap.get(receiverId));
receivers.add(optionDTO);
}
String platform = robotMap.get(messageTask.getProjectRobotId()).getPlatform(); String platform = robotMap.get(messageTask.getProjectRobotId()).getPlatform();
String defaultSubject; String defaultSubject;
if (StringUtils.equalsIgnoreCase(platform, NoticeConstants.Type.MAIL)) { if (StringUtils.equalsIgnoreCase(platform, NoticeConstants.Type.MAIL)) {
@ -545,7 +497,6 @@ public class NoticeMessageTaskService {
messageTask.setProjectId(projectId); messageTask.setProjectId(projectId);
messageTasks.add(messageTask); messageTasks.add(messageTask);
} }
List<String> receiverIds = messageTasks.stream().map(MessageTask::getReceiver).filter(Objects::nonNull).distinct().toList();
Map<String, List<MessageTask>> messageRobotMap = messageTasks.stream().collect(Collectors.groupingBy(MessageTask::getProjectRobotId)); Map<String, List<MessageTask>> messageRobotMap = messageTasks.stream().collect(Collectors.groupingBy(MessageTask::getProjectRobotId));
if (CollectionUtils.isNotEmpty(messageRobotMap.get(robotId))) { if (CollectionUtils.isNotEmpty(messageRobotMap.get(robotId))) {
messageTask = messageRobotMap.get(robotId).get(0); messageTask = messageRobotMap.get(robotId).get(0);
@ -565,7 +516,7 @@ public class NoticeMessageTaskService {
Map<String, String> eventMap = MessageTemplateUtils.getEventMap(); Map<String, String> eventMap = MessageTemplateUtils.getEventMap();
messageTemplateConfigDTO.setTaskTypeName(taskTypeMap.get(messageTask.getTaskType())); messageTemplateConfigDTO.setTaskTypeName(taskTypeMap.get(messageTask.getTaskType()));
messageTemplateConfigDTO.setEventName(eventMap.get(messageTask.getEvent())); messageTemplateConfigDTO.setEventName(eventMap.get(messageTask.getEvent()));
messageTemplateConfigDTO.setReceiverIds(receiverIds); messageTemplateConfigDTO.setReceiverIds(messageTask.getReceivers());
return messageTemplateConfigDTO; return messageTemplateConfigDTO;
} }

View File

@ -77,7 +77,10 @@
<!-- typeHandler="io.metersphere.handler.ListTypeHandler"/>--> <!-- typeHandler="io.metersphere.handler.ListTypeHandler"/>-->
<!-- </table>--> <!-- </table>-->
<table tableName="file_association"/> <table tableName="message_task">
<columnOverride column="receivers" javaType="java.util.List&lt;String&gt;" jdbcType="VARCHAR"
typeHandler="io.metersphere.handler.ListTypeHandler"/>
</table>
<!-- <table tableName="file_metadata_repository"/>--> <!-- <table tableName="file_metadata_repository"/>-->
<!-- <table tableName="file_module_repository"/>--> <!-- <table tableName="file_module_repository"/>-->
<!-- <table tableName="project"/>--> <!-- <table tableName="project"/>-->

View File

@ -8,11 +8,11 @@ import io.metersphere.project.dto.*;
import io.metersphere.project.mapper.MessageTaskBlobMapper; import io.metersphere.project.mapper.MessageTaskBlobMapper;
import io.metersphere.project.mapper.MessageTaskMapper; import io.metersphere.project.mapper.MessageTaskMapper;
import io.metersphere.sdk.constants.SessionConstants; import io.metersphere.sdk.constants.SessionConstants;
import io.metersphere.system.dto.sdk.OptionDTO;
import io.metersphere.system.dto.sdk.request.MessageTaskRequest;
import io.metersphere.sdk.util.JSON; import io.metersphere.sdk.util.JSON;
import io.metersphere.system.base.BaseTest; import io.metersphere.system.base.BaseTest;
import io.metersphere.system.controller.handler.ResultHolder; import io.metersphere.system.controller.handler.ResultHolder;
import io.metersphere.system.dto.sdk.OptionDTO;
import io.metersphere.system.dto.sdk.request.MessageTaskRequest;
import io.metersphere.system.notice.constants.NoticeConstants; import io.metersphere.system.notice.constants.NoticeConstants;
import io.metersphere.system.uid.IDGenerator; import io.metersphere.system.uid.IDGenerator;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
@ -138,7 +138,7 @@ public class NoticeMessageTaskControllerTests extends BaseTest {
Assertions.assertEquals(100200, resultHolder.getCode()); Assertions.assertEquals(100200, resultHolder.getCode());
MessageTaskExample messageTaskExample = new MessageTaskExample(); MessageTaskExample messageTaskExample = new MessageTaskExample();
messageTaskExample.createCriteria().andReceiverEqualTo("project-message-user-1") messageTaskExample.createCriteria()
.andProjectIdEqualTo("project-message-test").andProjectRobotIdEqualTo("test_message_robot2").andTaskTypeEqualTo(NoticeConstants.TaskType.API_DEFINITION_TASK).andEventEqualTo(NoticeConstants.Event.CREATE); .andProjectIdEqualTo("project-message-test").andProjectRobotIdEqualTo("test_message_robot2").andTaskTypeEqualTo(NoticeConstants.TaskType.API_DEFINITION_TASK).andEventEqualTo(NoticeConstants.Event.CREATE);
List<MessageTask> messageTasks1 = messageTaskMapper.selectByExample(messageTaskExample); List<MessageTask> messageTasks1 = messageTaskMapper.selectByExample(messageTaskExample);
Assertions.assertTrue(messageTasks1.get(0).getEnable()); Assertions.assertTrue(messageTasks1.get(0).getEnable());
@ -148,10 +148,6 @@ public class NoticeMessageTaskControllerTests extends BaseTest {
messageTaskExample.createCriteria().andProjectIdEqualTo("project-message-test").andTaskTypeEqualTo(NoticeConstants.TaskType.API_DEFINITION_TASK).andEventEqualTo(NoticeConstants.Event.CREATE); messageTaskExample.createCriteria().andProjectIdEqualTo("project-message-test").andTaskTypeEqualTo(NoticeConstants.TaskType.API_DEFINITION_TASK).andEventEqualTo(NoticeConstants.Event.CREATE);
List<MessageTask> messageTasks = messageTaskMapper.selectByExample(messageTaskExample); List<MessageTask> messageTasks = messageTaskMapper.selectByExample(messageTaskExample);
Assertions.assertEquals(1, messageTasks.size()); Assertions.assertEquals(1, messageTasks.size());
messageTaskExample = new MessageTaskExample();
messageTaskExample.createCriteria().andProjectIdEqualTo("project-message-test").andTaskTypeEqualTo(NoticeConstants.TaskType.API_DEFINITION_TASK).andEventEqualTo(NoticeConstants.Event.CREATE).andReceiverEqualTo("project-message-user-3");
messageTasks = messageTaskMapper.selectByExample(messageTaskExample);
Assertions.assertEquals(0, messageTasks.size());
//projectId 存在 用户有部分被删除的测试 //projectId 存在 用户有部分被删除的测试
messageTaskRequest = new MessageTaskRequest(); messageTaskRequest = new MessageTaskRequest();
@ -191,11 +187,11 @@ public class NoticeMessageTaskControllerTests extends BaseTest {
.header(SessionConstants.CSRF_TOKEN, csrfToken) .header(SessionConstants.CSRF_TOKEN, csrfToken)
.content(JSON.toJSONString(messageTaskRequest)) .content(JSON.toJSONString(messageTaskRequest))
.contentType(MediaType.APPLICATION_JSON)) .contentType(MediaType.APPLICATION_JSON))
.andExpect(status().is5xxServerError()) .andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON)).andReturn(); .andExpect(content().contentType(MediaType.APPLICATION_JSON)).andReturn();
String contentAsString = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8); String contentAsString = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
ResultHolder resultHolder = JSON.parseObject(contentAsString, ResultHolder.class); ResultHolder resultHolder = JSON.parseObject(contentAsString, ResultHolder.class);
Assertions.assertEquals(100500, resultHolder.getCode()); Assertions.assertEquals(102001, resultHolder.getCode());
} }
@Test @Test
@ -209,6 +205,7 @@ public class NoticeMessageTaskControllerTests extends BaseTest {
List<String> userIds = new ArrayList<>(); List<String> userIds = new ArrayList<>();
userIds.add("project-message-user-7"); userIds.add("project-message-user-7");
userIds.add("project-message-user-8"); userIds.add("project-message-user-8");
messageTaskRequest.setRobotId("test_message_robot2");
messageTaskRequest.setReceiverIds(userIds); messageTaskRequest.setReceiverIds(userIds);
messageTaskRequest.setEnable(null); messageTaskRequest.setEnable(null);
messageTaskRequest.setTestId("testId"); messageTaskRequest.setTestId("testId");
@ -224,11 +221,14 @@ public class NoticeMessageTaskControllerTests extends BaseTest {
Assertions.assertEquals(100200, resultHolder.getCode()); Assertions.assertEquals(100200, resultHolder.getCode());
MessageTaskExample messageTaskExample = new MessageTaskExample(); MessageTaskExample messageTaskExample = new MessageTaskExample();
messageTaskExample.createCriteria().andTaskTypeEqualTo(NoticeConstants.TaskType.API_DEFINITION_TASK) messageTaskExample.createCriteria().andTaskTypeEqualTo(NoticeConstants.TaskType.API_DEFINITION_TASK)
.andEventEqualTo(NoticeConstants.Event.CREATE).andReceiverEqualTo("project-message-user-8").andProjectIdEqualTo("project-message-test-1"); .andEventEqualTo(NoticeConstants.Event.CREATE).andProjectIdEqualTo("project-message-test-1");
List<MessageTask> messageTasks = messageTaskMapper.selectByExample(messageTaskExample); List<MessageTask> messageTasks = messageTaskMapper.selectByExample(messageTaskExample);
Assertions.assertEquals("test_message_robot1", messageTasks.get(0).getProjectRobotId()); for (MessageTask messageTask : messageTasks) {
Assertions.assertEquals(false, messageTasks.get(0).getEnable()); if (messageTask.getReceivers().contains("project-message-user-8")) {
Assertions.assertEquals("test_message_robot2", messageTask.getProjectRobotId());
Assertions.assertEquals(false, messageTask.getEnable());
}
}
} }
@Test @Test
@ -258,9 +258,16 @@ public class NoticeMessageTaskControllerTests extends BaseTest {
Assertions.assertEquals(100200, resultHolder.getCode()); Assertions.assertEquals(100200, resultHolder.getCode());
MessageTaskExample messageTaskExample = new MessageTaskExample(); MessageTaskExample messageTaskExample = new MessageTaskExample();
messageTaskExample.createCriteria().andTaskTypeEqualTo(NoticeConstants.TaskType.API_DEFINITION_TASK) messageTaskExample.createCriteria().andTaskTypeEqualTo(NoticeConstants.TaskType.API_DEFINITION_TASK)
.andEventEqualTo(NoticeConstants.Event.CREATE).andReceiverEqualTo("project-message-user-8").andProjectIdEqualTo("project-message-test-1"); .andEventEqualTo(NoticeConstants.Event.CREATE).andProjectIdEqualTo("project-message-test-1");
List<MessageTask> messageTasks = messageTaskMapper.selectByExample(messageTaskExample); List<MessageTask> messageTasks = messageTaskMapper.selectByExample(messageTaskExample);
Assertions.assertEquals("test_message_robot1", messageTasks.get(0).getProjectRobotId()); for (MessageTask messageTask : messageTasks) {
if (messageTask.getReceivers().contains("project-message-user-8")) {
Assertions.assertEquals("test_message_robot2", messageTask.getProjectRobotId());
Assertions.assertEquals(false, messageTask.getEnable());
}
}
Assertions.assertEquals("test_message_robot2", messageTasks.get(0).getProjectRobotId());
Assertions.assertEquals(false, messageTasks.get(0).getEnable()); Assertions.assertEquals(false, messageTasks.get(0).getEnable());
} }
@ -294,11 +301,16 @@ public class NoticeMessageTaskControllerTests extends BaseTest {
Assertions.assertEquals(100200, resultHolder.getCode()); Assertions.assertEquals(100200, resultHolder.getCode());
MessageTaskExample messageTaskExample = new MessageTaskExample(); MessageTaskExample messageTaskExample = new MessageTaskExample();
messageTaskExample.createCriteria().andTaskTypeEqualTo(NoticeConstants.TaskType.API_DEFINITION_TASK) messageTaskExample.createCriteria().andTaskTypeEqualTo(NoticeConstants.TaskType.API_DEFINITION_TASK)
.andEventEqualTo(NoticeConstants.Event.CREATE).andReceiverEqualTo("project-message-user-9").andProjectIdEqualTo("project-message-test-1"); .andEventEqualTo(NoticeConstants.Event.CREATE).andProjectIdEqualTo("project-message-test-1").andProjectRobotIdEqualTo("test_message_robot1");
List<MessageTask> messageTasks = messageTaskMapper.selectByExample(messageTaskExample); List<MessageTask> messageTasks = messageTaskMapper.selectByExample(messageTaskExample);
MessageTaskBlob messageTaskBlob = messageTaskBlobMapper.selectByPrimaryKey(messageTasks.get(0).getId()); for (MessageTask messageTask : messageTasks) {
Assertions.assertEquals("测试新加数据模版生效", messageTaskBlob.getTemplate()); if (messageTask.getReceivers().contains("project-message-user-9")) {
Assertions.assertEquals("测试新加数据模版标题生效", messageTasks.get(0).getSubject()); MessageTaskBlob messageTaskBlob = messageTaskBlobMapper.selectByPrimaryKey(messageTask.getId());
Assertions.assertEquals("测试新加数据模版生效", messageTaskBlob.getTemplate());
Assertions.assertEquals("测试新加数据模版标题生效", messageTask.getSubject());
}
}
} }
@Test @Test
@ -320,7 +332,7 @@ public class NoticeMessageTaskControllerTests extends BaseTest {
.header(SessionConstants.CSRF_TOKEN, csrfToken) .header(SessionConstants.CSRF_TOKEN, csrfToken)
.content(JSON.toJSONString(messageTaskRequest)) .content(JSON.toJSONString(messageTaskRequest))
.contentType(MediaType.APPLICATION_JSON)) .contentType(MediaType.APPLICATION_JSON))
.andExpect(status().is5xxServerError()) .andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON)).andReturn(); .andExpect(content().contentType(MediaType.APPLICATION_JSON)).andReturn();
} }
@ -492,7 +504,7 @@ public class NoticeMessageTaskControllerTests extends BaseTest {
List<MessageTaskDetailDTO> collect2 = messageTaskDetailDTOList1.stream().filter(t -> t.event.equals(NoticeConstants.Event.CREATE)).toList(); List<MessageTaskDetailDTO> collect2 = messageTaskDetailDTOList1.stream().filter(t -> t.event.equals(NoticeConstants.Event.CREATE)).toList();
Map<String, ProjectRobotConfigDTO> projectRobotConfigMap = collect2.get(0).getProjectRobotConfigMap(); Map<String, ProjectRobotConfigDTO> projectRobotConfigMap = collect2.get(0).getProjectRobotConfigMap();
ProjectRobotConfigDTO projectRobotConfigDTO = projectRobotConfigMap.get("test_message_robot2"); ProjectRobotConfigDTO projectRobotConfigDTO = projectRobotConfigMap.get("test_message_robot2");
Assertions.assertTrue(StringUtils.equals(projectRobotConfigDTO.getTemplate(),"发送消息测试")); Assertions.assertFalse(StringUtils.equals(projectRobotConfigDTO.getTemplate(),"发送消息测试"));
} }
@ -673,30 +685,29 @@ public class NoticeMessageTaskControllerTests extends BaseTest {
if (StringUtils.equalsIgnoreCase(event, NoticeConstants.Event.CREATE) || StringUtils.equalsIgnoreCase(event, NoticeConstants.Event.CASE_CREATE) || StringUtils.equalsIgnoreCase(event, NoticeConstants.Event.MOCK_CREATE) || CollectionUtils.isEmpty(receivers)) { if (StringUtils.equalsIgnoreCase(event, NoticeConstants.Event.CREATE) || StringUtils.equalsIgnoreCase(event, NoticeConstants.Event.CASE_CREATE) || StringUtils.equalsIgnoreCase(event, NoticeConstants.Event.MOCK_CREATE) || CollectionUtils.isEmpty(receivers)) {
continue; continue;
} }
for (OptionDTO receiver : receivers) { List<String> receiverIds = receivers.stream().map(OptionDTO::getId).toList();
String id = IDGenerator.nextStr(); String id = IDGenerator.nextStr();
MessageTask messageTask = new MessageTask(); MessageTask messageTask = new MessageTask();
messageTask.setId(id); messageTask.setId(id);
messageTask.setEvent(event); messageTask.setEvent(event);
messageTask.setTaskType(taskType); messageTask.setTaskType(taskType);
messageTask.setReceiver(receiver.getId()); messageTask.setReceivers(receiverIds);
messageTask.setProjectId(projectId); messageTask.setProjectId(projectId);
messageTask.setProjectRobotId(defaultRobotId); messageTask.setProjectRobotId(defaultRobotId);
messageTask.setEnable(true); messageTask.setEnable(true);
messageTask.setTestId("NONE"); messageTask.setTestId("NONE");
messageTask.setCreateUser("admin"); messageTask.setCreateUser("admin");
messageTask.setCreateTime(System.currentTimeMillis()); messageTask.setCreateTime(System.currentTimeMillis());
messageTask.setUpdateUser("admin"); messageTask.setUpdateUser("admin");
messageTask.setUpdateTime(System.currentTimeMillis()); messageTask.setUpdateTime(System.currentTimeMillis());
messageTask.setSubject(""); messageTask.setSubject("");
messageTask.setUseDefaultSubject(true); messageTask.setUseDefaultSubject(true);
messageTask.setUseDefaultTemplate(true); messageTask.setUseDefaultTemplate(true);
MessageTaskBlob messageTaskBlob = new MessageTaskBlob(); MessageTaskBlob messageTaskBlob = new MessageTaskBlob();
messageTaskBlob.setId(id); messageTaskBlob.setId(id);
messageTaskBlob.setTemplate(""); messageTaskBlob.setTemplate("");
mapper.insert(messageTask); mapper.insert(messageTask);
blobMapper.insert(messageTaskBlob); blobMapper.insert(messageTaskBlob);
}
} }
} }
} }

View File

@ -549,30 +549,29 @@ public class ProjectRobotControllerTests extends BaseTest {
if (StringUtils.equalsIgnoreCase(event, NoticeConstants.Event.CREATE) || StringUtils.equalsIgnoreCase(event, NoticeConstants.Event.CASE_CREATE) || StringUtils.equalsIgnoreCase(event, NoticeConstants.Event.MOCK_CREATE) || CollectionUtils.isEmpty(receivers)) { if (StringUtils.equalsIgnoreCase(event, NoticeConstants.Event.CREATE) || StringUtils.equalsIgnoreCase(event, NoticeConstants.Event.CASE_CREATE) || StringUtils.equalsIgnoreCase(event, NoticeConstants.Event.MOCK_CREATE) || CollectionUtils.isEmpty(receivers)) {
continue; continue;
} }
for (OptionDTO receiver : receivers) { List<String> receiverIds = receivers.stream().map(OptionDTO::getId).toList();
String id = IDGenerator.nextStr(); String id = IDGenerator.nextStr();
MessageTask messageTask = new MessageTask(); MessageTask messageTask = new MessageTask();
messageTask.setId(id); messageTask.setId(id);
messageTask.setEvent(event); messageTask.setEvent(event);
messageTask.setTaskType(taskType); messageTask.setTaskType(taskType);
messageTask.setReceiver(receiver.getId()); messageTask.setReceivers(receiverIds);
messageTask.setProjectId(projectId); messageTask.setProjectId(projectId);
messageTask.setProjectRobotId(defaultRobotId); messageTask.setProjectRobotId(defaultRobotId);
messageTask.setEnable(true); messageTask.setEnable(true);
messageTask.setTestId("NONE"); messageTask.setTestId("NONE");
messageTask.setCreateUser("admin"); messageTask.setCreateUser("admin");
messageTask.setCreateTime(System.currentTimeMillis()); messageTask.setCreateTime(System.currentTimeMillis());
messageTask.setUpdateUser("admin"); messageTask.setUpdateUser("admin");
messageTask.setUpdateTime(System.currentTimeMillis()); messageTask.setUpdateTime(System.currentTimeMillis());
messageTask.setSubject(""); messageTask.setSubject("");
messageTask.setUseDefaultSubject(true); messageTask.setUseDefaultSubject(true);
messageTask.setUseDefaultTemplate(true); messageTask.setUseDefaultTemplate(true);
MessageTaskBlob messageTaskBlob = new MessageTaskBlob(); MessageTaskBlob messageTaskBlob = new MessageTaskBlob();
messageTaskBlob.setId(id); messageTaskBlob.setId(id);
messageTaskBlob.setTemplate(""); messageTaskBlob.setTemplate("");
mapper.insert(messageTask); mapper.insert(messageTask);
blobMapper.insert(messageTaskBlob); blobMapper.insert(messageTaskBlob);
}
} }
} }
} }

View File

@ -8,8 +8,8 @@ replace INTO project (id, num, organization_id, name, description, create_user,
replace INTO project_robot(id, project_id, name, platform, webhook, type, app_key, app_secret, enable, create_user, create_time, update_user, update_time, description) values ('message_task_robot1', 'test', '测试机器人1', 'IN_SITE', 'NONE', null, null, null, true, 'admin', unix_timestamp() * 1000,'admin', unix_timestamp() * 1000, null); replace INTO project_robot(id, project_id, name, platform, webhook, type, app_key, app_secret, enable, create_user, create_time, update_user, update_time, description) values ('message_task_robot1', 'test', '测试机器人1', 'IN_SITE', 'NONE', null, null, null, true, 'admin', unix_timestamp() * 1000,'admin', unix_timestamp() * 1000, null);
replace INTO message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) replace INTO message_task(id, event, receivers, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject)
VALUES ('message_task_id1', 'CASE_EXECUTE_FAKE_ERROR', 'FOLLOW_PEOPLE', 'message_task_robot1', 'API_DEFINITION_TASK', 'NONE', 'test', true, 'admin', unix_timestamp() * 1000,'admin', unix_timestamp() * 1000, true, true, 'message.title.api_definition_task_case_delete'); VALUES ('message_task_id1', 'CASE_EXECUTE_FAKE_ERROR', '["FOLLOW_PEOPLE"]', 'message_task_robot1', 'API_DEFINITION_TASK', 'NONE', 'test', true, 'admin', unix_timestamp() * 1000,'admin', unix_timestamp() * 1000, true, true, 'message.title.api_definition_task_case_delete');
replace INTO message_task_blob(id, template) VALUES ('message_task_id1', 'message.api_definition_task_case_execute'); replace INTO message_task_blob(id, template) VALUES ('message_task_id1', 'message.api_definition_task_case_execute');

View File

@ -83,10 +83,9 @@ public class MessageDetailService {
Map<String, List<MessageTask>> messageTaskGroup = messageTaskLists.stream().collect(Collectors.groupingBy(t -> (t.getTaskType() + t.getEvent() + t.getProjectRobotId()))); Map<String, List<MessageTask>> messageTaskGroup = messageTaskLists.stream().collect(Collectors.groupingBy(t -> (t.getTaskType() + t.getEvent() + t.getProjectRobotId())));
messageTaskGroup.forEach((messageTaskId, messageTaskList) -> { messageTaskGroup.forEach((messageTaskId, messageTaskList) -> {
//获取同一任务所有的接收人 //获取同一任务所有的接收人
List<String> receivers = messageTaskList.stream().map(MessageTask::getReceiver).collect(Collectors.toList());
MessageDetail messageDetail = new MessageDetail(); MessageDetail messageDetail = new MessageDetail();
MessageTask messageTask = messageTaskList.get(0); MessageTask messageTask = messageTaskList.get(0);
messageDetail.setReceiverIds(receivers); messageDetail.setReceiverIds(messageTask.getReceivers());
messageDetail.setTaskType(messageTask.getTaskType()); messageDetail.setTaskType(messageTask.getTaskType());
messageDetail.setEvent(messageTask.getEvent()); messageDetail.setEvent(messageTask.getEvent());
messageDetail.setCreateTime(messageTask.getCreateTime()); messageDetail.setCreateTime(messageTask.getCreateTime());