This commit is contained in:
shiziyuan9527 2020-10-19 16:06:45 +08:00
commit 4e7babcda0
13 changed files with 166 additions and 62 deletions

View File

@ -1,8 +1,7 @@
package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable;
import lombok.Data;
@Data
public class MessageTask implements Serializable {
@ -18,5 +17,7 @@ public class MessageTask implements Serializable {
private String webhook;
private String identification;
private static final long serialVersionUID = 1L;
}

View File

@ -523,6 +523,76 @@ public class MessageTaskExample {
addCriterion("webhook not between", value1, value2, "webhook");
return (Criteria) this;
}
public Criteria andIdentificationIsNull() {
addCriterion("identification is null");
return (Criteria) this;
}
public Criteria andIdentificationIsNotNull() {
addCriterion("identification is not null");
return (Criteria) this;
}
public Criteria andIdentificationEqualTo(String value) {
addCriterion("identification =", value, "identification");
return (Criteria) this;
}
public Criteria andIdentificationNotEqualTo(String value) {
addCriterion("identification <>", value, "identification");
return (Criteria) this;
}
public Criteria andIdentificationGreaterThan(String value) {
addCriterion("identification >", value, "identification");
return (Criteria) this;
}
public Criteria andIdentificationGreaterThanOrEqualTo(String value) {
addCriterion("identification >=", value, "identification");
return (Criteria) this;
}
public Criteria andIdentificationLessThan(String value) {
addCriterion("identification <", value, "identification");
return (Criteria) this;
}
public Criteria andIdentificationLessThanOrEqualTo(String value) {
addCriterion("identification <=", value, "identification");
return (Criteria) this;
}
public Criteria andIdentificationLike(String value) {
addCriterion("identification like", value, "identification");
return (Criteria) this;
}
public Criteria andIdentificationNotLike(String value) {
addCriterion("identification not like", value, "identification");
return (Criteria) this;
}
public Criteria andIdentificationIn(List<String> values) {
addCriterion("identification in", values, "identification");
return (Criteria) this;
}
public Criteria andIdentificationNotIn(List<String> values) {
addCriterion("identification not in", values, "identification");
return (Criteria) this;
}
public Criteria andIdentificationBetween(String value1, String value2) {
addCriterion("identification between", value1, value2, "identification");
return (Criteria) this;
}
public Criteria andIdentificationNotBetween(String value1, String value2) {
addCriterion("identification not between", value1, value2, "identification");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

View File

@ -1,8 +1,7 @@
package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable;
import lombok.Data;
@Data
public class Notice implements Serializable {

View File

@ -2,9 +2,8 @@ package io.metersphere.base.mapper;
import io.metersphere.base.domain.MessageTask;
import io.metersphere.base.domain.MessageTaskExample;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface MessageTaskMapper {
long countByExample(MessageTaskExample example);

View File

@ -8,6 +8,7 @@
<result column="user_id" jdbcType="VARCHAR" property="userId" />
<result column="task_type" jdbcType="VARCHAR" property="taskType" />
<result column="webhook" jdbcType="VARCHAR" property="webhook" />
<result column="identification" jdbcType="VARCHAR" property="identification" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -20,13 +21,13 @@
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
AND ${criterion.condition} #{criterion.value}
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
AND ${criterion.condition} #{criterion.value} AND #{criterion.secondValue}
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
AND ${criterion.condition}
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
@ -49,13 +50,13 @@
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
AND ${criterion.condition} #{criterion.value}
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
AND ${criterion.condition} #{criterion.value} AND #{criterion.secondValue}
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
AND ${criterion.condition}
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
@ -68,48 +69,48 @@
</where>
</sql>
<sql id="Base_Column_List">
id, `type`, event, user_id, task_type, webhook
id, `type`, event, user_id, task_type, webhook, identification
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.MessageTaskExample" resultMap="BaseResultMap">
SELECT
select
<if test="distinct">
DISTINCT
distinct
</if>
<include refid="Base_Column_List" />
FROM message_task
from message_task
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
ORDER BY ${orderByClause}
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
SELECT
select
<include refid="Base_Column_List" />
FROM message_task
WHERE id = #{id,jdbcType=VARCHAR}
from message_task
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
DELETE FROM message_task
WHERE id = #{id,jdbcType=VARCHAR}
delete from message_task
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.MessageTaskExample">
DELETE FROM message_task
delete from message_task
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.MessageTask">
INSERT INTO message_task (id, `type`, event,
user_id, task_type, webhook
)
VALUES (#{id,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{event,jdbcType=VARCHAR},
#{userId,jdbcType=VARCHAR}, #{taskType,jdbcType=VARCHAR}, #{webhook,jdbcType=VARCHAR}
)
insert into message_task (id, `type`, event,
user_id, task_type, webhook,
identification)
values (#{id,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{event,jdbcType=VARCHAR},
#{userId,jdbcType=VARCHAR}, #{taskType,jdbcType=VARCHAR}, #{webhook,jdbcType=VARCHAR},
#{identification,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.MessageTask">
INSERT INTO message_task
insert into message_task
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
@ -129,6 +130,9 @@
<if test="webhook != null">
webhook,
</if>
<if test="identification != null">
identification,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -149,16 +153,19 @@
<if test="webhook != null">
#{webhook,jdbcType=VARCHAR},
</if>
<if test="identification != null">
#{identification,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.MessageTaskExample" resultType="java.lang.Long">
SELECT count(*) FROM message_task
select count(*) from message_task
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
UPDATE message_task
update message_task
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
@ -178,25 +185,29 @@
<if test="record.webhook != null">
webhook = #{record.webhook,jdbcType=VARCHAR},
</if>
<if test="record.identification != null">
identification = #{record.identification,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
UPDATE message_task
SET id = #{record.id,jdbcType=VARCHAR},
update message_task
set id = #{record.id,jdbcType=VARCHAR},
`type` = #{record.type,jdbcType=VARCHAR},
event = #{record.event,jdbcType=VARCHAR},
user_id = #{record.userId,jdbcType=VARCHAR},
task_type = #{record.taskType,jdbcType=VARCHAR},
webhook = #{record.webhook,jdbcType=VARCHAR}
webhook = #{record.webhook,jdbcType=VARCHAR},
identification = #{record.identification,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.MessageTask">
UPDATE message_task
update message_task
<set>
<if test="type != null">
`type` = #{type,jdbcType=VARCHAR},
@ -213,16 +224,20 @@
<if test="webhook != null">
webhook = #{webhook,jdbcType=VARCHAR},
</if>
<if test="identification != null">
identification = #{identification,jdbcType=VARCHAR},
</if>
</set>
WHERE id = #{id,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.MessageTask">
UPDATE message_task
SET `type` = #{type,jdbcType=VARCHAR},
update message_task
set `type` = #{type,jdbcType=VARCHAR},
event = #{event,jdbcType=VARCHAR},
user_id = #{userId,jdbcType=VARCHAR},
task_type = #{taskType,jdbcType=VARCHAR},
webhook = #{webhook,jdbcType=VARCHAR}
WHERE id = #{id,jdbcType=VARCHAR}
webhook = #{webhook,jdbcType=VARCHAR},
identification = #{identification,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -2,9 +2,8 @@ package io.metersphere.base.mapper;
import io.metersphere.base.domain.Notice;
import io.metersphere.base.domain.NoticeExample;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface NoticeMapper {
long countByExample(NoticeExample example);

View File

@ -91,8 +91,8 @@
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
DELETE FROM notice
WHERE id = #{id,jdbcType=VARCHAR}
delete from notice
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.NoticeExample">
delete from notice
@ -101,10 +101,10 @@
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.Notice">
INSERT INTO notice (id, EVENT, TEST_ID,
insert into notice (id, EVENT, TEST_ID,
`ENABLE`, `type`, user_id
)
VALUES (#{id,jdbcType=VARCHAR}, #{event,jdbcType=VARCHAR}, #{testId,jdbcType=VARCHAR},
values (#{id,jdbcType=VARCHAR}, #{event,jdbcType=VARCHAR}, #{testId,jdbcType=VARCHAR},
#{enable,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}
)
</insert>
@ -217,12 +217,12 @@
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.Notice">
UPDATE notice
SET EVENT = #{event,jdbcType=VARCHAR},
update notice
set EVENT = #{event,jdbcType=VARCHAR},
TEST_ID = #{testId,jdbcType=VARCHAR},
`ENABLE` = #{enable,jdbcType=VARCHAR},
`type` = #{type,jdbcType=VARCHAR},
user_id = #{userId,jdbcType=VARCHAR}
WHERE id = #{id,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -86,6 +86,7 @@ public class NoticeService {
}
public void saveMessageTask(MessageRequest messageRequest) {
String identification=UUID.randomUUID().toString();
messageRequest.getMessageDetail().forEach(list -> {
list.getEvents().forEach(n -> {
list.getUserIds().forEach(m -> {
@ -96,6 +97,7 @@ public class NoticeService {
message.setUserId(m);
message.setType(list.getType());
message.setWebhook(list.getWebhook());
message.setIdentification(identification);
messageTaskMapper.insert(message);
});
});

View File

@ -0,0 +1,2 @@
alter table message_task
add identification varchar(255) not null;

View File

@ -66,6 +66,7 @@
<table tableName="schedule"/>
<table tableName="notice"/>
<table tableName="message_task"/>
</context>

View File

@ -201,6 +201,9 @@ export default {
case RPS_LIMIT:
this.rpsLimit = d.value;
break;
case RPS_LIMIT_ENABLE:
this.rpsLimitEnable = d.value;
break;
default:
break;
}

View File

@ -22,11 +22,12 @@
class="tb-edit"
border
size="mini"
:header-cell-style="{background:'#EDEDED'}"
:header-cell-style="{background:'#ededed'}"
>
<el-table-column :label="$t('schedule.event')" min-width="20%" prop="events">
<template slot-scope="scope">
<el-select v-model="scope.row.events" multiple :placeholder="$t('organization.message.select_events')"
<el-select :disabled="isReadOnly" v-model="scope.row.events" multiple
:placeholder="$t('organization.message.select_events')"
prop="events">
<el-option
v-for="item in jenkinsEventOptions"
@ -456,7 +457,15 @@ export default {
defectReceiverOptions: [],
}
},
mounted: function () {
this.initForm()
},
methods: {
initForm() {
this.result = this.$get('/notice/search/message', response => {
})
},
userList() {
this.result = this.$get('user/list', response => {
this.jenkinsReceiverOptions = response.data
@ -488,12 +497,16 @@ export default {
showDelete: false,
}
if (type === 'jenkinsTask') {
Task.taskType = 'jenkinsTask'
this.form.jenkinsTask.unshift(Task)
} else if (type === 'testPlanTask') {
Task.taskType = 'testPlanTask'
this.form.testPlanTask.unshift(Task)
} else if (type === 'reviewTask') {
Task.taskType = 'reviewTask'
this.form.reviewTask.unshift(Task)
} else {
Task.taskType = 'defect'
this.form.defectTask.unshift(Task)
}
},

View File

@ -2,7 +2,7 @@
<el-form :model="form" ref="caseFrom" v-loading="result.loading">
<el-row>
<el-col :span="8" :offset="1">
<el-col :span="10" :offset="1">
<el-form-item
:placeholder="$t('test_track.case.input_name')"
:label="$t('test_track.case.name')"
@ -12,7 +12,7 @@
</el-form-item>
</el-col>
<el-col :span="11" :offset="2">
<el-col :span="12">
<el-form-item :label="$t('test_track.case.module')" :label-width="formLabelWidth" prop="module">
<el-input class="case-name" :disabled="readOnly" v-model="testCase.nodePath"></el-input>
</el-form-item>
@ -59,14 +59,14 @@
</el-row>
<el-row v-if="testCase.method && testCase.method == 'auto'">
<el-col :span="9" :offset="1">
<el-col :span="10" :offset="1">
<el-form-item :label="$t('test_track.case.relate_test')" :label-width="formLabelWidth" prop="testId">
<el-select filterable :disabled="readOnly" v-model="testCase.testId"
:placeholder="$t('test_track.case.input_type')">
</el-select>
</el-form-item>
</el-col>
<el-col :span="9" :offset="1" v-if="testCase.testId=='other'">
<el-col :span="12" v-if="testCase.testId=='other'">
<el-form-item :label="$t('test_track.case.test_name')" :label-width="formLabelWidth" prop="testId">
<el-input v-model="testCase.otherTestName" :placeholder="$t('test_track.case.input_test_case')"
:disabled="readOnly"></el-input>
@ -74,10 +74,10 @@
</el-col>
</el-row>
<el-row style="margin-top: 15px;">
<el-col :offset="2">{{ $t('test_track.case.prerequisite') }}:</el-col>
<el-col :offset="1">{{ $t('test_track.case.prerequisite') }}:</el-col>
</el-row>
<el-row type="flex" justify="center" style="margin-top: 10px;">
<el-col :span="20">
<el-col :span="22">
<el-form-item prop="prerequisite">
<el-input :disabled="readOnly" v-model="testCase.prerequisite"
type="textarea"
@ -89,11 +89,11 @@
</el-row>
<el-row v-if="testCase.method && testCase.method != 'auto'" style="margin-bottom: 10px">
<el-col :offset="2">{{ $t('test_track.case.steps') }}:</el-col>
<el-col :offset="1">{{ $t('test_track.case.steps') }}:</el-col>
</el-row>
<el-row v-if="testCase.method && testCase.method != 'auto'" type="flex" justify="center">
<el-col :span="20">
<el-col :span="22">
<el-table
v-if="isStepTableAlive"
:data="JSON.parse(testCase.steps)"
@ -136,10 +136,10 @@
</el-row>
<el-row style="margin-top: 15px;margin-bottom: 10px">
<el-col :offset="2">{{ $t('commons.remark') }}:</el-col>
<el-col :offset="1">{{ $t('commons.remark') }}:</el-col>
</el-row>
<el-row type="flex" justify="center">
<el-col :span="20">
<el-col :span="22">
<el-form-item prop="remark">
<el-input v-model="testCase.remark"
:autosize="{ minRows: 2, maxRows: 4}"