feat: 性能测试报告字段优化

This commit is contained in:
wenyann 2020-10-19 12:27:03 +08:00
parent f18c55b67f
commit d838073c59
15 changed files with 1640 additions and 457 deletions

View File

@ -0,0 +1,24 @@
package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable;
@Data
public class MessageTask implements Serializable {
private String id;
private String type;
private String event;
private String userid;
private String username;
private String tasktype;
private String webhook;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,690 @@
package io.metersphere.base.domain;
import java.util.ArrayList;
import java.util.List;
public class MessageTaskExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public MessageTaskExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(String value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(String value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(String value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(String value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(String value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(String value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdLike(String value) {
addCriterion("id like", value, "id");
return (Criteria) this;
}
public Criteria andIdNotLike(String value) {
addCriterion("id not like", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<String> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<String> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(String value1, String value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(String value1, String value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andTypeIsNull() {
addCriterion("`type` is null");
return (Criteria) this;
}
public Criteria andTypeIsNotNull() {
addCriterion("`type` is not null");
return (Criteria) this;
}
public Criteria andTypeEqualTo(String value) {
addCriterion("`type` =", value, "type");
return (Criteria) this;
}
public Criteria andTypeNotEqualTo(String value) {
addCriterion("`type` <>", value, "type");
return (Criteria) this;
}
public Criteria andTypeGreaterThan(String value) {
addCriterion("`type` >", value, "type");
return (Criteria) this;
}
public Criteria andTypeGreaterThanOrEqualTo(String value) {
addCriterion("`type` >=", value, "type");
return (Criteria) this;
}
public Criteria andTypeLessThan(String value) {
addCriterion("`type` <", value, "type");
return (Criteria) this;
}
public Criteria andTypeLessThanOrEqualTo(String value) {
addCriterion("`type` <=", value, "type");
return (Criteria) this;
}
public Criteria andTypeLike(String value) {
addCriterion("`type` like", value, "type");
return (Criteria) this;
}
public Criteria andTypeNotLike(String value) {
addCriterion("`type` not like", value, "type");
return (Criteria) this;
}
public Criteria andTypeIn(List<String> values) {
addCriterion("`type` in", values, "type");
return (Criteria) this;
}
public Criteria andTypeNotIn(List<String> values) {
addCriterion("`type` not in", values, "type");
return (Criteria) this;
}
public Criteria andTypeBetween(String value1, String value2) {
addCriterion("`type` between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andTypeNotBetween(String value1, String value2) {
addCriterion("`type` not between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andEventIsNull() {
addCriterion("event is null");
return (Criteria) this;
}
public Criteria andEventIsNotNull() {
addCriterion("event is not null");
return (Criteria) this;
}
public Criteria andEventEqualTo(String value) {
addCriterion("event =", value, "event");
return (Criteria) this;
}
public Criteria andEventNotEqualTo(String value) {
addCriterion("event <>", value, "event");
return (Criteria) this;
}
public Criteria andEventGreaterThan(String value) {
addCriterion("event >", value, "event");
return (Criteria) this;
}
public Criteria andEventGreaterThanOrEqualTo(String value) {
addCriterion("event >=", value, "event");
return (Criteria) this;
}
public Criteria andEventLessThan(String value) {
addCriterion("event <", value, "event");
return (Criteria) this;
}
public Criteria andEventLessThanOrEqualTo(String value) {
addCriterion("event <=", value, "event");
return (Criteria) this;
}
public Criteria andEventLike(String value) {
addCriterion("event like", value, "event");
return (Criteria) this;
}
public Criteria andEventNotLike(String value) {
addCriterion("event not like", value, "event");
return (Criteria) this;
}
public Criteria andEventIn(List<String> values) {
addCriterion("event in", values, "event");
return (Criteria) this;
}
public Criteria andEventNotIn(List<String> values) {
addCriterion("event not in", values, "event");
return (Criteria) this;
}
public Criteria andEventBetween(String value1, String value2) {
addCriterion("event between", value1, value2, "event");
return (Criteria) this;
}
public Criteria andEventNotBetween(String value1, String value2) {
addCriterion("event not between", value1, value2, "event");
return (Criteria) this;
}
public Criteria andUseridIsNull() {
addCriterion("userId is null");
return (Criteria) this;
}
public Criteria andUseridIsNotNull() {
addCriterion("userId is not null");
return (Criteria) this;
}
public Criteria andUseridEqualTo(String value) {
addCriterion("userId =", value, "userid");
return (Criteria) this;
}
public Criteria andUseridNotEqualTo(String value) {
addCriterion("userId <>", value, "userid");
return (Criteria) this;
}
public Criteria andUseridGreaterThan(String value) {
addCriterion("userId >", value, "userid");
return (Criteria) this;
}
public Criteria andUseridGreaterThanOrEqualTo(String value) {
addCriterion("userId >=", value, "userid");
return (Criteria) this;
}
public Criteria andUseridLessThan(String value) {
addCriterion("userId <", value, "userid");
return (Criteria) this;
}
public Criteria andUseridLessThanOrEqualTo(String value) {
addCriterion("userId <=", value, "userid");
return (Criteria) this;
}
public Criteria andUseridLike(String value) {
addCriterion("userId like", value, "userid");
return (Criteria) this;
}
public Criteria andUseridNotLike(String value) {
addCriterion("userId not like", value, "userid");
return (Criteria) this;
}
public Criteria andUseridIn(List<String> values) {
addCriterion("userId in", values, "userid");
return (Criteria) this;
}
public Criteria andUseridNotIn(List<String> values) {
addCriterion("userId not in", values, "userid");
return (Criteria) this;
}
public Criteria andUseridBetween(String value1, String value2) {
addCriterion("userId between", value1, value2, "userid");
return (Criteria) this;
}
public Criteria andUseridNotBetween(String value1, String value2) {
addCriterion("userId not between", value1, value2, "userid");
return (Criteria) this;
}
public Criteria andUsernameIsNull() {
addCriterion("userName is null");
return (Criteria) this;
}
public Criteria andUsernameIsNotNull() {
addCriterion("userName is not null");
return (Criteria) this;
}
public Criteria andUsernameEqualTo(String value) {
addCriterion("userName =", value, "username");
return (Criteria) this;
}
public Criteria andUsernameNotEqualTo(String value) {
addCriterion("userName <>", value, "username");
return (Criteria) this;
}
public Criteria andUsernameGreaterThan(String value) {
addCriterion("userName >", value, "username");
return (Criteria) this;
}
public Criteria andUsernameGreaterThanOrEqualTo(String value) {
addCriterion("userName >=", value, "username");
return (Criteria) this;
}
public Criteria andUsernameLessThan(String value) {
addCriterion("userName <", value, "username");
return (Criteria) this;
}
public Criteria andUsernameLessThanOrEqualTo(String value) {
addCriterion("userName <=", value, "username");
return (Criteria) this;
}
public Criteria andUsernameLike(String value) {
addCriterion("userName like", value, "username");
return (Criteria) this;
}
public Criteria andUsernameNotLike(String value) {
addCriterion("userName not like", value, "username");
return (Criteria) this;
}
public Criteria andUsernameIn(List<String> values) {
addCriterion("userName in", values, "username");
return (Criteria) this;
}
public Criteria andUsernameNotIn(List<String> values) {
addCriterion("userName not in", values, "username");
return (Criteria) this;
}
public Criteria andUsernameBetween(String value1, String value2) {
addCriterion("userName between", value1, value2, "username");
return (Criteria) this;
}
public Criteria andUsernameNotBetween(String value1, String value2) {
addCriterion("userName not between", value1, value2, "username");
return (Criteria) this;
}
public Criteria andTasktypeIsNull() {
addCriterion("taskType is null");
return (Criteria) this;
}
public Criteria andTasktypeIsNotNull() {
addCriterion("taskType is not null");
return (Criteria) this;
}
public Criteria andTasktypeEqualTo(String value) {
addCriterion("taskType =", value, "tasktype");
return (Criteria) this;
}
public Criteria andTasktypeNotEqualTo(String value) {
addCriterion("taskType <>", value, "tasktype");
return (Criteria) this;
}
public Criteria andTasktypeGreaterThan(String value) {
addCriterion("taskType >", value, "tasktype");
return (Criteria) this;
}
public Criteria andTasktypeGreaterThanOrEqualTo(String value) {
addCriterion("taskType >=", value, "tasktype");
return (Criteria) this;
}
public Criteria andTasktypeLessThan(String value) {
addCriterion("taskType <", value, "tasktype");
return (Criteria) this;
}
public Criteria andTasktypeLessThanOrEqualTo(String value) {
addCriterion("taskType <=", value, "tasktype");
return (Criteria) this;
}
public Criteria andTasktypeLike(String value) {
addCriterion("taskType like", value, "tasktype");
return (Criteria) this;
}
public Criteria andTasktypeNotLike(String value) {
addCriterion("taskType not like", value, "tasktype");
return (Criteria) this;
}
public Criteria andTasktypeIn(List<String> values) {
addCriterion("taskType in", values, "tasktype");
return (Criteria) this;
}
public Criteria andTasktypeNotIn(List<String> values) {
addCriterion("taskType not in", values, "tasktype");
return (Criteria) this;
}
public Criteria andTasktypeBetween(String value1, String value2) {
addCriterion("taskType between", value1, value2, "tasktype");
return (Criteria) this;
}
public Criteria andTasktypeNotBetween(String value1, String value2) {
addCriterion("taskType not between", value1, value2, "tasktype");
return (Criteria) this;
}
public Criteria andWebhookIsNull() {
addCriterion("webhook is null");
return (Criteria) this;
}
public Criteria andWebhookIsNotNull() {
addCriterion("webhook is not null");
return (Criteria) this;
}
public Criteria andWebhookEqualTo(String value) {
addCriterion("webhook =", value, "webhook");
return (Criteria) this;
}
public Criteria andWebhookNotEqualTo(String value) {
addCriterion("webhook <>", value, "webhook");
return (Criteria) this;
}
public Criteria andWebhookGreaterThan(String value) {
addCriterion("webhook >", value, "webhook");
return (Criteria) this;
}
public Criteria andWebhookGreaterThanOrEqualTo(String value) {
addCriterion("webhook >=", value, "webhook");
return (Criteria) this;
}
public Criteria andWebhookLessThan(String value) {
addCriterion("webhook <", value, "webhook");
return (Criteria) this;
}
public Criteria andWebhookLessThanOrEqualTo(String value) {
addCriterion("webhook <=", value, "webhook");
return (Criteria) this;
}
public Criteria andWebhookLike(String value) {
addCriterion("webhook like", value, "webhook");
return (Criteria) this;
}
public Criteria andWebhookNotLike(String value) {
addCriterion("webhook not like", value, "webhook");
return (Criteria) this;
}
public Criteria andWebhookIn(List<String> values) {
addCriterion("webhook in", values, "webhook");
return (Criteria) this;
}
public Criteria andWebhookNotIn(List<String> values) {
addCriterion("webhook not in", values, "webhook");
return (Criteria) this;
}
public Criteria andWebhookBetween(String value1, String value2) {
addCriterion("webhook between", value1, value2, "webhook");
return (Criteria) this;
}
public Criteria andWebhookNotBetween(String value1, String value2) {
addCriterion("webhook not between", value1, value2, "webhook");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@ -0,0 +1,31 @@
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;
public interface MessageTaskMapper {
long countByExample(MessageTaskExample example);
int deleteByExample(MessageTaskExample example);
int deleteByPrimaryKey(String id);
int insert(MessageTask record);
int insertSelective(MessageTask record);
List<MessageTask> selectByExample(MessageTaskExample example);
MessageTask selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") MessageTask record, @Param("example") MessageTaskExample example);
int updateByExample(@Param("record") MessageTask record, @Param("example") MessageTaskExample example);
int updateByPrimaryKeySelective(MessageTask record);
int updateByPrimaryKey(MessageTask record);
}

View File

@ -0,0 +1,247 @@
<?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.base.mapper.MessageTaskMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.MessageTask">
<id column="id" jdbcType="VARCHAR" property="id"/>
<result column="type" jdbcType="VARCHAR" property="type"/>
<result column="event" jdbcType="VARCHAR" property="event"/>
<result column="userId" jdbcType="VARCHAR" property="userid"/>
<result column="userName" jdbcType="VARCHAR" property="username"/>
<result column="taskType" jdbcType="VARCHAR" property="tasktype"/>
<result column="webhook" jdbcType="VARCHAR" property="webhook"/>
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="("
separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="("
separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, `type`, event, userId, userName, taskType, webhook
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.MessageTaskExample"
resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List"/>
from message_task
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
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>
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.MessageTaskExample">
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,
userId, userName, taskType,
webhook)
values (#{id,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{event,jdbcType=VARCHAR},
#{userid,jdbcType=VARCHAR}, #{username,jdbcType=VARCHAR}, #{tasktype,jdbcType=VARCHAR},
#{webhook,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.MessageTask">
insert into message_task
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="type != null">
`type`,
</if>
<if test="event != null">
event,
</if>
<if test="userid != null">
userId,
</if>
<if test="username != null">
userName,
</if>
<if test="tasktype != null">
taskType,
</if>
<if test="webhook != null">
webhook,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="type != null">
#{type,jdbcType=VARCHAR},
</if>
<if test="event != null">
#{event,jdbcType=VARCHAR},
</if>
<if test="userid != null">
#{userid,jdbcType=VARCHAR},
</if>
<if test="username != null">
#{username,jdbcType=VARCHAR},
</if>
<if test="tasktype != null">
#{tasktype,jdbcType=VARCHAR},
</if>
<if test="webhook != null">
#{webhook,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.MessageTaskExample"
resultType="java.lang.Long">
select count(*) from message_task
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update message_task
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.type != null">
`type` = #{record.type,jdbcType=VARCHAR},
</if>
<if test="record.event != null">
event = #{record.event,jdbcType=VARCHAR},
</if>
<if test="record.userid != null">
userId = #{record.userid,jdbcType=VARCHAR},
</if>
<if test="record.username != null">
userName = #{record.username,jdbcType=VARCHAR},
</if>
<if test="record.tasktype != null">
taskType = #{record.tasktype,jdbcType=VARCHAR},
</if>
<if test="record.webhook != null">
webhook = #{record.webhook,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},
`type` = #{record.type,jdbcType=VARCHAR},
event = #{record.event,jdbcType=VARCHAR},
userId = #{record.userid,jdbcType=VARCHAR},
userName = #{record.username,jdbcType=VARCHAR},
taskType = #{record.tasktype,jdbcType=VARCHAR},
webhook = #{record.webhook,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
<set>
<if test="type != null">
`type` = #{type,jdbcType=VARCHAR},
</if>
<if test="event != null">
event = #{event,jdbcType=VARCHAR},
</if>
<if test="userid != null">
userId = #{userid,jdbcType=VARCHAR},
</if>
<if test="username != null">
userName = #{username,jdbcType=VARCHAR},
</if>
<if test="tasktype != null">
taskType = #{tasktype,jdbcType=VARCHAR},
</if>
<if test="webhook != null">
webhook = #{webhook,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.MessageTask">
update message_task
set `type` = #{type,jdbcType=VARCHAR},
event = #{event,jdbcType=VARCHAR},
userId = #{userid,jdbcType=VARCHAR},
userName = #{username,jdbcType=VARCHAR},
taskType = #{tasktype,jdbcType=VARCHAR},
webhook = #{webhook,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -3,4 +3,11 @@ package io.metersphere.commons.constants;
public interface NoticeConstants { public interface NoticeConstants {
String EXECUTE_SUCCESSFUL = "EXECUTE_SUCCESSFUL"; String EXECUTE_SUCCESSFUL = "EXECUTE_SUCCESSFUL";
String EXECUTE_FAILED = "EXECUTE_FAILED"; String EXECUTE_FAILED = "EXECUTE_FAILED";
String EMAIL = "EMAIL";
String NAIL_ROBOT = "NAIL_ROBOT";
String WECHAT_ROBOT = "WECHAT_ROBOT";
String CREATE = "CREATE";
String UPDATE = "CREATE";
String DELETE = "DELETE";
} }

View File

@ -1,7 +1,8 @@
package io.metersphere.notice.controller; package io.metersphere.notice.controller;
import io.metersphere.notice.controller.request.MessageRequest;
import io.metersphere.notice.controller.request.NoticeRequest; import io.metersphere.notice.controller.request.NoticeRequest;
import io.metersphere.notice.domain.MessageDetail; import io.metersphere.notice.domain.MessageSettingDetail;
import io.metersphere.notice.domain.NoticeDetail; import io.metersphere.notice.domain.NoticeDetail;
import io.metersphere.notice.service.NoticeService; import io.metersphere.notice.service.NoticeService;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -25,9 +26,19 @@ public class NoticeController {
return noticeService.queryNotice(testId); return noticeService.queryNotice(testId);
} }
@PostMapping("save/message") @PostMapping("save/message/task")
public void saveMessage(@RequestBody MessageDetail messageDetail) { public void saveMessage(@RequestBody MessageRequest messageRequest) {
noticeService.saveMessageTask(messageDetail); noticeService.saveMessageTask(messageRequest);
}
@GetMapping("/search/message")
public List<MessageSettingDetail> searchMessage() {
return noticeService.searchMessage();
}
@GetMapping("/delete/message")
public void deleteMessage() {
} }
} }

View File

@ -0,0 +1,11 @@
package io.metersphere.notice.controller.request;
import io.metersphere.notice.domain.MessageDetail;
import lombok.Data;
import java.util.List;
@Data
public class MessageRequest {
private List<MessageDetail> messageDetail;
}

View File

@ -1,18 +1,17 @@
package io.metersphere.notice.domain; package io.metersphere.notice.domain;
import io.metersphere.base.domain.MessageTask;
import lombok.Data; import lombok.Data;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@Data @Data
public class MessageDetail { public class MessageDetail extends MessageTask {
private List<String> userIds = new ArrayList<>(); private List<String> userIds = new ArrayList<>();
private List<String> userNames = new ArrayList<>(); private List<String> userNames = new ArrayList<>();
private List<String> events = new ArrayList<>(); private List<String> events = new ArrayList<>();
private String id;
private String type;
private String taskType; private String taskType;
private String webhook;
private String type;
} }

View File

@ -0,0 +1,13 @@
package io.metersphere.notice.domain;
import lombok.Data;
import java.util.List;
@Data
public class MessageSettingDetail {
private List<MessageDetail> jenkinsTask;
private List<MessageDetail> testCasePlanTask;
private List<MessageDetail> reviewTask;
private List<MessageDetail> defectTask;
}

View File

@ -8,15 +8,16 @@ import com.taobao.api.ApiException;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
@Service @Service
public class DingTaskService { public class DingTaskService {
public void sendDingTask() { public void sendDingTask(String context, List<String> userIds) {
DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/robot/send?access_token=5129dc4c073d28f67c7452e0de6536c3ca496728d8c014d0a209b88a8814307a"); DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/robot/send?access_token=5129dc4c073d28f67c7452e0de6536c3ca496728d8c014d0a209b88a8814307a");
OapiRobotSendRequest request = new OapiRobotSendRequest(); OapiRobotSendRequest request = new OapiRobotSendRequest();
request.setMsgtype("text"); request.setMsgtype("text");
OapiRobotSendRequest.Text text = new OapiRobotSendRequest.Text(); OapiRobotSendRequest.Text text = new OapiRobotSendRequest.Text();
text.setContent("测试计划任务通知:‘创建人’发起的‘测试计划名称‘ 的’计划开始时间‘,’计划结束时间‘请跟进!"); text.setContent(context);
request.setText(text); request.setText(text);
OapiRobotSendRequest.At at = new OapiRobotSendRequest.At(); OapiRobotSendRequest.At at = new OapiRobotSendRequest.At();
at.setAtMobiles(Arrays.asList("15135125273")); at.setAtMobiles(Arrays.asList("15135125273"));

View File

@ -250,5 +250,6 @@ public class MailService {
return recipientEmails; return recipientEmails;
} }
} }

View File

@ -1,10 +1,14 @@
package io.metersphere.notice.service; package io.metersphere.notice.service;
import io.metersphere.base.domain.MessageTask;
import io.metersphere.base.domain.MessageTaskExample;
import io.metersphere.base.domain.Notice; import io.metersphere.base.domain.Notice;
import io.metersphere.base.domain.NoticeExample; import io.metersphere.base.domain.NoticeExample;
import io.metersphere.base.mapper.MessageTaskMapper;
import io.metersphere.base.mapper.NoticeMapper; import io.metersphere.base.mapper.NoticeMapper;
import io.metersphere.notice.controller.request.MessageRequest;
import io.metersphere.notice.controller.request.NoticeRequest; import io.metersphere.notice.controller.request.NoticeRequest;
import io.metersphere.notice.domain.MessageDetail; import io.metersphere.notice.domain.MessageSettingDetail;
import io.metersphere.notice.domain.NoticeDetail; import io.metersphere.notice.domain.NoticeDetail;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -21,6 +25,8 @@ import static io.metersphere.commons.constants.NoticeConstants.EXECUTE_SUCCESSFU
public class NoticeService { public class NoticeService {
@Resource @Resource
private NoticeMapper noticeMapper; private NoticeMapper noticeMapper;
@Resource
private MessageTaskMapper messageTaskMapper;
public void saveNotice(NoticeRequest noticeRequest) { public void saveNotice(NoticeRequest noticeRequest) {
NoticeExample example = new NoticeExample(); NoticeExample example = new NoticeExample();
@ -79,7 +85,32 @@ public class NoticeService {
return result; return result;
} }
public void saveMessageTask(MessageDetail messageDetail) { public void saveMessageTask(MessageRequest messageRequest) {
messageRequest.getMessageDetail().forEach(list -> {
list.getEvents().forEach(n -> {
list.getUserIds().forEach(m -> {
MessageTask message = new MessageTask();
message.setId(UUID.randomUUID().toString());
message.setEvent(n);
message.setTasktype(list.getTaskType());
message.setUserid(m);
message.setType(list.getType());
message.setUsername("a");
message.setWebhook(list.getWebhook());
messageTaskMapper.insert(message);
});
});
});
} }
public List<MessageSettingDetail> searchMessage() {
MessageTaskExample messageTaskExample = new MessageTaskExample();
messageTaskExample.createCriteria();
List<MessageTask> messageTasks = new ArrayList<>();
List<MessageSettingDetail> messageSettingDetail = new ArrayList<>();
messageTasks = messageTaskMapper.selectByExample(messageTaskExample);
return messageSettingDetail;
}
} }

View File

@ -8,10 +8,15 @@ import io.metersphere.base.mapper.TestCaseCommentMapper;
import io.metersphere.base.mapper.TestCaseMapper; import io.metersphere.base.mapper.TestCaseMapper;
import io.metersphere.base.mapper.TestCaseReviewMapper; import io.metersphere.base.mapper.TestCaseReviewMapper;
import io.metersphere.base.mapper.UserMapper; import io.metersphere.base.mapper.UserMapper;
import io.metersphere.commons.constants.NoticeConstants;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.commons.utils.SessionUtils; import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.notice.service.DingTaskService;
import io.metersphere.notice.service.MailService; import io.metersphere.notice.service.MailService;
import io.metersphere.notice.service.WxChatTaskService;
import io.metersphere.track.request.testreview.SaveCommentRequest; import io.metersphere.track.request.testreview.SaveCommentRequest;
import io.metersphere.track.request.testreview.SaveTestCaseReviewRequest; import io.metersphere.track.request.testreview.SaveTestCaseReviewRequest;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -34,6 +39,10 @@ public class TestCaseCommentService {
MailService mailService; MailService mailService;
@Resource @Resource
TestCaseMapper testCaseMapper; TestCaseMapper testCaseMapper;
@Resource
DingTaskService dingTaskService;
@Resource
WxChatTaskService wxChatTaskService;
public void saveComment(SaveCommentRequest request) { public void saveComment(SaveCommentRequest request) {
TestCaseComment testCaseComment = new TestCaseComment(); TestCaseComment testCaseComment = new TestCaseComment();
@ -49,7 +58,18 @@ public class TestCaseCommentService {
SaveTestCaseReviewRequest caseReviewRequest = new SaveTestCaseReviewRequest(); SaveTestCaseReviewRequest caseReviewRequest = new SaveTestCaseReviewRequest();
List<String> userIds = new ArrayList<>(); List<String> userIds = new ArrayList<>();
userIds.add(testCaseWithBLOBs.getMaintainer()); userIds.add(testCaseWithBLOBs.getMaintainer());
mailService.sendCommentNotice(userIds, request, testCaseWithBLOBs); String context = getReviewContext(request, testCaseWithBLOBs);
try {
if (StringUtils.equals(NoticeConstants.NAIL_ROBOT, "NAIL_ROBOT")) {
dingTaskService.sendDingTask(context, userIds);
} else if (StringUtils.equals(NoticeConstants.WECHAT_ROBOT, "WECHAT_ROBOT")) {
wxChatTaskService.enterpriseWechatTask();
} else {
mailService.sendCommentNotice(userIds, request, testCaseWithBLOBs);
}
} catch (Exception e) {
LogUtil.error(e);
}
} }
@ -72,4 +92,10 @@ public class TestCaseCommentService {
testCaseCommentExample.createCriteria().andCaseIdEqualTo(caseId); testCaseCommentExample.createCriteria().andCaseIdEqualTo(caseId);
testCaseCommentMapper.deleteByExample(testCaseCommentExample); testCaseCommentMapper.deleteByExample(testCaseCommentExample);
} }
private String getReviewContext(SaveCommentRequest request, TestCaseWithBLOBs testCaseWithBLOBs) {
String context = "";
context = testCaseWithBLOBs.getMaintainer() + "发起的" + "'" + testCaseWithBLOBs.getName() + "'" + "添加评论:" + request.getDescription();
return context;
}
} }

View File

@ -6,6 +6,7 @@ import io.metersphere.base.mapper.ext.ExtProjectMapper;
import io.metersphere.base.mapper.ext.ExtTestCaseMapper; import io.metersphere.base.mapper.ext.ExtTestCaseMapper;
import io.metersphere.base.mapper.ext.ExtTestCaseReviewMapper; import io.metersphere.base.mapper.ext.ExtTestCaseReviewMapper;
import io.metersphere.base.mapper.ext.ExtTestReviewCaseMapper; import io.metersphere.base.mapper.ext.ExtTestReviewCaseMapper;
import io.metersphere.commons.constants.NoticeConstants;
import io.metersphere.commons.constants.TestCaseReviewStatus; import io.metersphere.commons.constants.TestCaseReviewStatus;
import io.metersphere.commons.constants.TestReviewCaseStatus; import io.metersphere.commons.constants.TestReviewCaseStatus;
import io.metersphere.commons.exception.MSException; import io.metersphere.commons.exception.MSException;
@ -14,7 +15,9 @@ import io.metersphere.commons.utils.LogUtil;
import io.metersphere.commons.utils.ServiceUtils; import io.metersphere.commons.utils.ServiceUtils;
import io.metersphere.commons.utils.SessionUtils; import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.controller.request.member.QueryMemberRequest; import io.metersphere.controller.request.member.QueryMemberRequest;
import io.metersphere.notice.service.DingTaskService;
import io.metersphere.notice.service.MailService; import io.metersphere.notice.service.MailService;
import io.metersphere.notice.service.WxChatTaskService;
import io.metersphere.service.UserService; import io.metersphere.service.UserService;
import io.metersphere.track.dto.TestCaseReviewDTO; import io.metersphere.track.dto.TestCaseReviewDTO;
import io.metersphere.track.dto.TestReviewCaseDTO; import io.metersphere.track.dto.TestReviewCaseDTO;
@ -34,6 +37,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -69,6 +73,10 @@ public class TestCaseReviewService {
MailService mailService; MailService mailService;
@Resource @Resource
ExtTestCaseMapper extTestCaseMapper; ExtTestCaseMapper extTestCaseMapper;
@Resource
DingTaskService dingTaskService;
@Resource
WxChatTaskService wxChatTaskService;
public void saveTestCaseReview(SaveTestCaseReviewRequest reviewRequest) { public void saveTestCaseReview(SaveTestCaseReviewRequest reviewRequest) {
checkCaseReviewExist(reviewRequest); checkCaseReviewExist(reviewRequest);
@ -96,9 +104,15 @@ public class TestCaseReviewService {
reviewRequest.setCreator(SessionUtils.getUser().getId()); reviewRequest.setCreator(SessionUtils.getUser().getId());
reviewRequest.setStatus(TestCaseReviewStatus.Prepare.name()); reviewRequest.setStatus(TestCaseReviewStatus.Prepare.name());
testCaseReviewMapper.insert(reviewRequest); testCaseReviewMapper.insert(reviewRequest);
String context = getReviewContext(reviewRequest, "create");
try { try {
mailService.sendReviewerNotice(userIds, reviewRequest); if (StringUtils.equals(NoticeConstants.NAIL_ROBOT, "NAIL_ROBOT")) {
dingTaskService.sendDingTask(context, userIds);
} else if (StringUtils.equals(NoticeConstants.WECHAT_ROBOT, "WECHAT_ROBOT")) {
wxChatTaskService.enterpriseWechatTask();
} else {
mailService.sendReviewerNotice(userIds, reviewRequest);
}
} catch (Exception e) { } catch (Exception e) {
LogUtil.error(e); LogUtil.error(e);
} }
@ -372,7 +386,14 @@ public class TestCaseReviewService {
testCaseReviewMapper.updateByPrimaryKeySelective(testCaseReview); testCaseReviewMapper.updateByPrimaryKeySelective(testCaseReview);
try { try {
BeanUtils.copyProperties(testCaseReviewRequest, _testCaseReview); BeanUtils.copyProperties(testCaseReviewRequest, _testCaseReview);
mailService.sendEndNotice(userIds, testCaseReviewRequest); String context = getReviewContext(testCaseReviewRequest, "create");
if (StringUtils.equals(NoticeConstants.NAIL_ROBOT, "NAIL_ROBOT")) {
dingTaskService.sendDingTask(context, userIds);
} else if (StringUtils.equals(NoticeConstants.WECHAT_ROBOT, "WECHAT_ROBOT")) {
wxChatTaskService.enterpriseWechatTask();
} else {
mailService.sendEndNotice(userIds, testCaseReviewRequest);
}
} catch (Exception e) { } catch (Exception e) {
LogUtil.error(e); LogUtil.error(e);
} }
@ -463,4 +484,28 @@ public class TestCaseReviewService {
request.setProjectIds(projectIds); request.setProjectIds(projectIds);
return extTestReviewCaseMapper.list(request); return extTestReviewCaseMapper.list(request);
} }
private String getReviewContext(SaveTestCaseReviewRequest reviewRequest, String type) {
Long startTime = reviewRequest.getCreateTime();
Long endTime = reviewRequest.getEndTime();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String start = null;
String sTime = String.valueOf(startTime);
String eTime = String.valueOf(endTime);
if (!sTime.equals("null")) {
start = sdf.format(new Date(Long.parseLong(sTime)));
}
String end = null;
if (!eTime.equals("null")) {
end = sdf.format(new Date(Long.parseLong(eTime)));
}
String context = "";
if (StringUtils.equals("create", type)) {
context = reviewRequest.getCreator() + "发起的" + "'" + reviewRequest.getName() + "'" + "待开始,计划开始时间是" + start + "计划结束时间为" + end + "请跟进";
} else if (StringUtils.equals("end", type)) {
context = reviewRequest.getCreator() + "发起的" + "'" + reviewRequest.getName() + "'" + "已完成,计划开始时间是" + start + "计划结束时间为" + end + "已完成";
}
return context;
}
} }

View File

@ -1,369 +1,379 @@
<template> <template>
<div style="margin-left: 40px"> <div style="margin-left: 40px">
<el-row class="row"> <el-form :model="form" ref="from">
<el-col :span="20"> <el-row class="row">
<div class="grid-content bg-purple-dark"> <el-col :span="20">
<el-row> <div class="grid-content bg-purple-dark">
<el-col :span="6"> <el-row>
<span style="font-weight:bold;">{{$t('organization.message.jenkins_task_notification')}}</span> <el-col :span="6">
</el-col> <span style="font-weight:bold;">{{ $t('organization.message.jenkins_task_notification') }}</span>
<el-col :span="14"> </el-col>
<el-button type="text" icon="el-icon-plus" size="mini" @click="handleAddJenkins('jenkinsTask')"> <el-col :span="14">
{{$t('organization.message.create_new_notification')}} <el-button type="text" icon="el-icon-plus" size="mini"
</el-button> @click="handleAddTaskModel('jenkinsTask')">
</el-col> {{ $t('organization.message.create_new_notification') }}
</el-row> </el-button>
</div> </el-col>
<el-table </el-row>
:data="jenkinsTask" </div>
class="tb-edit"
border <el-table
size="mini" :data="form.jenkinsTask"
:header-cell-style="{background:'#EDEDED'}" class="tb-edit"
> border
<el-table-column :label="$t('schedule.event')" min-width="20%" prop="event"> size="mini"
<template slot-scope="scope"> :header-cell-style="{background:'#EDEDED'}"
<el-select v-model="scope.row.event" multiple :placeholder="$t('organization.message.select_events')" prop="event"> >
<el-option <el-table-column :label="$t('schedule.event')" min-width="20%" prop="events">
v-for="item in jenkinsEventOptions" <template slot-scope="scope">
:key="item.value" <el-select v-model="scope.row.events" multiple :placeholder="$t('organization.message.select_events')"
:label="item.label" prop="events">
:value="item.value"> <el-option
</el-option> v-for="item in jenkinsEventOptions"
</el-select> :key="item.value"
</template> :label="item.label"
</el-table-column> :value="item.value">
<el-table-column :label="$t('schedule.receiver')" prop="receiver" min-width="20%"> </el-option>
<template v-slot:default="{row}"> </el-select>
<el-select v-model="row.userIds" filterable multiple </template>
:placeholder="$t('commons.please_select')" </el-table-column>
@click.native="userList()" style="width: 100%;"> <el-table-column :label="$t('schedule.receiver')" prop="userIds" min-width="20%">
<el-option <template v-slot:default="{row}">
v-for="item in jenkinsReceiverOptions" <el-select v-model="row.userIds" filterable multiple
:key="item.id" :placeholder="$t('commons.please_select')"
:label="item.name" @click.native="userList()" style="width: 100%;">
:value="item.id"> <el-option
</el-option> v-for="item in jenkinsReceiverOptions"
</el-select> :key="item.id"
</template> :label="item.name"
</el-table-column> :value="item.id">
<el-table-column :label="$t('schedule.receiving_mode')" min-width="20%" prop="type"> </el-option>
<template slot-scope="scope"> </el-select>
<el-select v-model="scope.row.type" :placeholder="$t('organization.message.select_receiving_method')"> </template>
<el-option </el-table-column>
v-for="item in receiveOptions" <el-table-column :label="$t('schedule.receiving_mode')" min-width="20%" prop="type">
:key="item.value" <template slot-scope="scope">
:label="item.label" <el-select v-model="scope.row.type" :placeholder="$t('organization.message.select_receiving_method')">
:value="item.value"> <el-option
</el-option> v-for="item in receiveTypeOptions"
</el-select> :key="item.value"
</template> :label="item.label"
</el-table-column> :value="item.value">
<el-table-column label="webhook" min-width="20%" prop="webhook"> </el-option>
<template v-slot:default="scope"> </el-select>
<el-input v-model="scope.row.webhook" placeholder="webhook地址"></el-input> </template>
</template> </el-table-column>
</el-table-column> <el-table-column label="webhook" min-width="20%" prop="webhook">
<el-table-column :label="$t('commons.operating')" min-width="20%" prop="result"> <template v-slot:default="scope">
<template v-slot:default="scope"> <el-input v-model="scope.row.webhook" placeholder="webhook地址"></el-input>
<el-button </template>
type="primary" </el-table-column>
size="mini" <el-table-column :label="$t('commons.operating')" min-width="20%" prop="result">
v-show="!scope.row.showAdd" <template v-slot:default="scope">
@click="handleAddTask(scope.$index,scope.row)" <el-button
>{{$t('commons.add')}} type="primary"
</el-button> size="mini"
<el-button v-show="scope.row.result.showSave"
size="mini" @click="handleAddTask(scope.$index,scope.row)"
v-show="!scope.row.showCancel" >{{ $t('commons.add') }}
@click="removeRow(scope.$index,scope.row)" </el-button>
>{{$t('commons.cancel')}} <el-button
</el-button> size="mini"
<el-button v-show="scope.row.result.showCancel"
type="danger" @click.native.prevent="removeRowTask(scope.$index,form.jenkinsTask)"
icon="el-icon-delete" >{{ $t('commons.cancel') }}
size="mini" </el-button>
v-show="scope.row.showDelete" <el-button
@click="removeRow(scope.$index,scope.row)" type="danger"
></el-button> icon="el-icon-delete"
</template> size="mini"
</el-table-column> v-show="scope.row.result.showDelete"
</el-table> @click.native.prevent="deleteRowTask(scope.$index,form.jenkinsTask)"
</el-col> ></el-button>
</el-row> </template>
<el-row class="row"> </el-table-column>
<el-col :span="20"> </el-table>
<div class="grid-content bg-purple-dark">
<el-row>
<el-col :span="6"> </el-col>
<span style="font-weight:bold;">{{$t('organization.message.test_plan_task_notification')}}</span> </el-row>
</el-col> <el-row class="row">
<el-col :span="14"> <el-col :span="20">
<el-button type="text" icon="el-icon-plus" size="mini" @click="handleAddTestPlan('testPlanTask')"> <div class="grid-content bg-purple-dark">
{{$t('organization.message.create_new_notification')}} <el-row>
</el-button> <el-col :span="6">
</el-col> <span style="font-weight:bold;">{{ $t('organization.message.test_plan_task_notification') }}</span>
</el-row> </el-col>
</div> <el-col :span="14">
<el-table <el-button type="text" icon="el-icon-plus" size="mini" @click="handleAddTaskModel('testPlanTask')">
:data="testPlanTask" {{ $t('organization.message.create_new_notification') }}
class="tb-edit" </el-button>
border </el-col>
size="mini" </el-row>
:header-cell-style="{background:'#EDEDED'}" </div>
> <el-table
<el-table-column :label="$t('schedule.event')" min-width="20%" prop="event"> :data="form.testPlanTask"
<template slot-scope="scope"> class="tb-edit"
<el-select v-model="scope.row.event" multiple :placeholder="$t('organization.message.select_events')" prop="event"> border
<el-option size="mini"
v-for="item in testPlanEventOptions" :header-cell-style="{background:'#EDEDED'}"
:key="item.value" >
:label="item.label" <el-table-column :label="$t('schedule.event')" min-width="20%" prop="events">
:value="item.value"> <template slot-scope="scope">
</el-option> <el-select v-model="scope.row.events" multiple :placeholder="$t('organization.message.select_events')"
</el-select> prop="events">
</template> <el-option
</el-table-column> v-for="item in otherEventOptions"
<el-table-column :label="$t('schedule.receiver')" prop="receiver" min-width="20%"> :key="item.value"
<template v-slot:default="{row}"> :label="item.label"
<el-select v-model="row.userIds" filterable multiple :value="item.value">
:placeholder="$t('commons.please_select')" </el-option>
@click.native="userList()" style="width: 100%;"> </el-select>
<el-option </template>
v-for="item in testPlanReceiverOptions" </el-table-column>
:key="item.id" <el-table-column :label="$t('schedule.receiver')" prop="userIds" min-width="20%">
:label="item.name" <template v-slot:default="{row}">
:value="item.id"> <el-select v-model="row.userIds" filterable multiple
</el-option> :placeholder="$t('commons.please_select')"
</el-select> @click.native="defectAndTestPlanUserList()" style="width: 100%;">
</template> <el-option
</el-table-column> v-for="item in testPlanReceiverOptions"
<el-table-column :label="$t('schedule.receiving_mode')" min-width="20%" prop="type"> :key="item.id"
<template slot-scope="scope"> :label="item.name"
<el-select v-model="scope.row.type" :placeholder="$t('organization.message.select_receiving_method')"> :value="item.id">
<el-option </el-option>
v-for="item in receiveOptions" </el-select>
:key="item.value" </template>
:label="item.label" </el-table-column>
:value="item.value"> <el-table-column :label="$t('schedule.receiving_mode')" min-width="20%" prop="type">
</el-option> <template slot-scope="scope">
</el-select> <el-select v-model="scope.row.type" :placeholder="$t('organization.message.select_receiving_method')">
</template> <el-option
</el-table-column> v-for="item in receiveTypeOptions"
<el-table-column label="webhook" min-width="20%" prop="webhook"> :key="item.value"
<template v-slot:default="scope"> :label="item.label"
<el-input v-model="scope.row.webhook" placeholder="webhook地址"></el-input> :value="item.value">
</template> </el-option>
</el-table-column> </el-select>
<el-table-column :label="$t('commons.operating')" min-width="20%" prop="result"> </template>
<template v-slot:default="scope"> </el-table-column>
<el-button <el-table-column label="webhook" min-width="20%" prop="webhook">
type="primary" <template v-slot:default="scope">
size="mini" <el-input v-model="scope.row.webhook" placeholder="webhook地址"></el-input>
v-show="!scope.row.showAdd" </template>
@click="handleAddTask(scope.$index,scope.row)" </el-table-column>
>{{$t('commons.add')}} <el-table-column :label="$t('commons.operating')" min-width="20%" prop="result">
</el-button> <template v-slot:default="scope">
<el-button <el-button
size="mini" type="primary"
v-show="!scope.row.showCancel" size="mini"
@click="removeRowTestPlan(scope.$index,scope.row)" v-show="scope.row.result.showSave"
>{{$t('commons.cancel')}} @click="handleAddTask(scope.$index,scope.row)"
</el-button> >{{ $t('commons.add') }}
<el-button </el-button>
type="danger" <el-button
icon="el-icon-delete" size="mini"
size="mini" v-show="scope.row.result.showCancel"
v-show="scope.row.showDelete" @click.native.prevent="removeRowTask(scope.$index,form.testPlanTask)"
@click="removeRowTestPlan(scope.$index,scope.row)" >{{ $t('commons.cancel') }}
></el-button> </el-button>
</template> <el-button
</el-table-column> type="danger"
</el-table> icon="el-icon-delete"
</el-col> size="mini"
</el-row> v-show="scope.row.result.showDelete"
<el-row class="row"> @click.native.prevent="deleteRowTask(scope.$index,form.testPlanTask)"
<el-col :span="20"> ></el-button>
<div class="grid-content bg-purple-dark"> </template>
<el-row> </el-table-column>
<el-col :span="6"> </el-table>
<span style="font-weight:bold;">{{$t('organization.message.test_review_task_notice')}}</span> </el-col>
</el-col> </el-row>
<el-col :span="14"> <el-row class="row">
<el-button type="text" icon="el-icon-plus" size="mini" @click="handleAddReview('reviewTask')"> <el-col :span="20">
{{$t('organization.message.create_new_notification')}} <div class="grid-content bg-purple-dark">
</el-button> <el-row>
</el-col> <el-col :span="6">
</el-row> <span style="font-weight:bold;">{{ $t('organization.message.test_review_task_notice') }}</span>
</div> </el-col>
<el-table <el-col :span="14">
:data="reviewTask" <el-button type="text" icon="el-icon-plus" size="mini" @click="handleAddTaskModel('reviewTask')">
class="tb-edit" {{ $t('organization.message.create_new_notification') }}
border </el-button>
size="mini" </el-col>
:header-cell-style="{background:'#EDEDED'}" </el-row>
> </div>
<el-table-column :label="$t('schedule.event')" min-width="20%" prop="event"> <el-table
<template slot-scope="scope"> :data="form.reviewTask"
<el-select v-model="scope.row.event" multiple :placeholder="$t('organization.message.select_events')" prop="event"> class="tb-edit"
<el-option border
v-for="item in reviewEventOptions" size="mini"
:key="item.value" :header-cell-style="{background:'#EDEDED'}"
:label="item.label" >
:value="item.value"> <el-table-column :label="$t('schedule.event')" min-width="20%" prop="events">
</el-option> <template slot-scope="scope">
</el-select> <el-select v-model="scope.row.events" multiple :placeholder="$t('organization.message.select_events')"
</template> prop="event">
</el-table-column> <el-option
<el-table-column :label="$t('schedule.receiver')" prop="receiver" min-width="20%"> v-for="item in otherEventOptions"
<template v-slot:default="{row}"> :key="item.value"
<el-select v-model="row.userIds" filterable multiple :label="item.label"
:placeholder="$t('commons.please_select')" :value="item.value">
@click.native="userList()" style="width: 100%;"> </el-option>
<el-option </el-select>
v-for="item in reviewReceiverOptions" </template>
:key="item.id" </el-table-column>
:label="item.name" <el-table-column :label="$t('schedule.receiver')" prop="receiver" min-width="20%">
:value="item.id"> <template v-slot:default="{row}">
</el-option> <el-select v-model="row.userIds" filterable multiple
</el-select> :placeholder="$t('commons.please_select')"
</template> @click.native="reviewUerList()" style="width: 100%;">
</el-table-column> <el-option
<el-table-column :label="$t('schedule.receiving_mode')" min-width="20%" prop="type"> v-for="item in reviewReceiverOptions"
<template slot-scope="scope"> :key="item.id"
<el-select v-model="scope.row.type" :placeholder="$t('organization.message.select_receiving_method')"> :label="item.name"
<el-option :value="item.id">
v-for="item in receiveOptions" </el-option>
:key="item.value" </el-select>
:label="item.label" </template>
:value="item.value"> </el-table-column>
</el-option> <el-table-column :label="$t('schedule.receiving_mode')" min-width="20%" prop="type">
</el-select> <template slot-scope="scope">
</template> <el-select v-model="scope.row.type" :placeholder="$t('organization.message.select_receiving_method')">
</el-table-column> <el-option
<el-table-column label="webhook" min-width="20%" prop="webhook"> v-for="item in receiveTypeOptions"
<template v-slot:default="scope"> :key="item.value"
<el-input v-model="scope.row.webhook" placeholder="webhook地址"></el-input> :label="item.label"
</template> :value="item.value">
</el-table-column> </el-option>
<el-table-column :label="$t('commons.operating')" min-width="20%" prop="result"> </el-select>
<template v-slot:default="scope"> </template>
<el-button </el-table-column>
type="primary" <el-table-column label="webhook" min-width="20%" prop="webhook">
size="mini" <template v-slot:default="scope">
v-show="!scope.row.showAdd" <el-input v-model="scope.row.webhook" placeholder="webhook地址"></el-input>
@click="handleAddTask(scope.$index,scope.row)" </template>
>{{$t('commons.add')}} </el-table-column>
</el-button> <el-table-column :label="$t('commons.operating')" min-width="20%" prop="result">
<el-button <template v-slot:default="scope">
size="mini" <el-button
v-show="!scope.row.showCancel" type="primary"
@click="removeRowReview(scope.$index,scope.row)" size="mini"
>{{$t('commons.cancel')}} v-show="scope.row.result.showSave"
</el-button> @click="handleAddTask(scope.$index,scope.row)"
<el-button >{{ $t('commons.add') }}
type="danger" </el-button>
icon="el-icon-delete" <el-button
size="mini" size="mini"
v-show="scope.row.showDelete" v-show="scope.row.result.showCancel"
@click="removeRowReview(scope.$index,scope.row)" @click.native.prevent="removeRowTask(scope.$index,form.reviewTask)"
></el-button> >{{ $t('commons.cancel') }}
</template> </el-button>
</el-table-column> <el-button
</el-table> type="danger"
</el-col> icon="el-icon-delete"
</el-row> size="mini"
<el-row class="row"> v-show="scope.row.result.showDelete"
<el-col :span="20"> @click.native.prevent="deleteRowTask(scope.$index,form.reviewTask)"
<div class="grid-content bg-purple-dark"> ></el-button>
<el-row> </template>
<el-col :span="6"> </el-table-column>
<span style="font-weight:bold;">{{$t('organization.message.defect_task_notification')}}</span> </el-table>
</el-col> </el-col>
<el-col :span="14"> </el-row>
<el-button type="text" icon="el-icon-plus" size="mini" @click="handleAddDefect('defectTask')"> <el-row class="row">
{{$t('organization.message.create_new_notification')}} <el-col :span="20">
</el-button> <div class="grid-content bg-purple-dark">
</el-col> <el-row>
</el-row> <el-col :span="6">
</div> <span style="font-weight:bold;">{{ $t('organization.message.defect_task_notification') }}</span>
<el-table </el-col>
:data="defectTask" <el-col :span="14">
class="tb-edit" <el-button type="text" icon="el-icon-plus" size="mini" @click="handleAddTaskModel('defectTask')">
border {{ $t('organization.message.create_new_notification') }}
size="mini" </el-button>
:header-cell-style="{background:'#EDEDED'}" </el-col>
> </el-row>
<el-table-column :label="$t('schedule.event')" min-width="20%" prop="event"> </div>
<template slot-scope="scope"> <el-table
<el-select v-model="scope.row.event" multiple :placeholder="$t('organization.message.select_events')" prop="event"> :data="form.defectTask"
<el-option class="tb-edit"
v-for="item in defectEventOptions" border
:key="item.value" size="mini"
:label="item.label" :header-cell-style="{background:'#EDEDED'}"
:value="item.value"> >
</el-option> <el-table-column :label="$t('schedule.event')" min-width="20%" prop="events">
</el-select> <template slot-scope="scope">
</template> <el-select v-model="scope.row.events" multiple :placeholder="$t('organization.message.select_events')"
</el-table-column> prop="event">
<el-table-column :label="$t('schedule.receiver')" prop="receiver" min-width="20%"> <el-option
<template v-slot:default="{row}"> v-for="item in otherEventOptions"
<el-select v-model="row.userIds" filterable multiple :key="item.value"
:placeholder="$t('commons.please_select')" :label="item.label"
@click.native="userList()" style="width: 100%;"> :value="item.value">
<el-option </el-option>
v-for="item in defectReceiverOptions" </el-select>
:key="item.id" </template>
:label="item.name" </el-table-column>
:value="item.id"> <el-table-column :label="$t('schedule.receiver')" prop="receiver" min-width="20%">
</el-option> <template v-slot:default="{row}">
</el-select> <el-select v-model="row.userIds" filterable multiple
</template> :placeholder="$t('commons.please_select')"
</el-table-column> @click.native="defectAndTestPlanUserList()" style="width: 100%;">
<el-table-column :label="$t('schedule.receiving_mode')" min-width="20%" prop="type"> <el-option
<template slot-scope="scope"> v-for="item in defectReceiverOptions"
<el-select v-model="scope.row.type" :placeholder="$t('organization.message.select_receiving_method')"> :key="item.id"
<el-option :label="item.name"
v-for="item in defectOptions" :value="item.id">
:key="item.value" </el-option>
:label="item.label" </el-select>
:value="item.value"> </template>
</el-option> </el-table-column>
</el-select> <el-table-column :label="$t('schedule.receiving_mode')" min-width="20%" prop="type">
</template> <template slot-scope="scope">
</el-table-column> <el-select v-model="scope.row.type" :placeholder="$t('organization.message.select_receiving_method')">
<el-table-column label="webhook" min-width="20%" prop="webhook"> <el-option
<template v-slot:default="scope"> v-for="item in receiveTypeOptions"
<el-input v-model="scope.row.webhook" placeholder="webhook地址"></el-input> :key="item.value"
</template> :label="item.label"
</el-table-column> :value="item.value">
<el-table-column :label="$t('commons.operating')" min-width="20%" prop="result"> </el-option>
<template v-slot:default="scope"> </el-select>
<el-button </template>
type="primary" </el-table-column>
size="mini" <el-table-column label="webhook" min-width="20%" prop="webhook">
v-show="!scope.row.showAdd" <template v-slot:default="scope">
@click="handleAddTask(scope.$index,scope.row)" <el-input v-model="scope.row.webhook" placeholder="webhook地址"></el-input>
>{{$t('commons.add')}} </template>
</el-button> </el-table-column>
<el-button <el-table-column :label="$t('commons.operating')" min-width="20%" prop="result">
size="mini" <template v-slot:default="scope">
v-show="!scope.row.showCancel" <el-button
@click="removeRowDefect(scope.$index,scope.row)" type="primary"
>{{$t('commons.cancel')}} size="mini"
</el-button> v-show="scope.row.result.showSave"
<el-button @click="handleAddTask(scope.$index,scope.row)"
type="danger" >{{ $t('commons.add') }}
icon="el-icon-delete" </el-button>
size="mini" <el-button
v-show="scope.row.showDelete" size="mini"
@click="removeRowDefect(scope.$index,scope.row)" v-show="scope.row.result.showCancel"
></el-button> @click.native.prevent="removeRowTask(scope.$index,form.defectTask)"
</template> >{{ $t('commons.cancel') }}
</el-table-column> </el-button>
</el-table> <el-button
</el-col> type="danger"
</el-row> icon="el-icon-delete"
size="mini"
v-show="scope.row.result.showDelete"
@click.native.prevent="deleteRowTask(scope.$index,form.defectTask)"
></el-button>
</template>
</el-table-column>
</el-table>
</el-col>
</el-row>
</el-form>
</div> </div>
</template> </template>
@ -373,50 +383,77 @@ export default {
name: "TaskNotification", name: "TaskNotification",
data() { data() {
return { return {
jenkinsTask: [{}], form: {
jenkinsTask: [{
taskType: 'jenkins',
events: [],
userIds: [],
type: [],
webhook: "",
result: {
showSave: true,
showCancel: true,
showDelete: false
}
}],
testPlanTask: [{
taskType: 'testPlan',
events: [],
userIds: [],
type: [],
webhook: "",
result: {
showSave: true,
showCancel: true,
showDelete: false
}
}],
reviewTask: [{
taskType: 'review',
events: [],
userIds: [],
type: [],
webhook: "",
result: {
showSave: true,
showCancel: true,
showDelete: false
}
}],
defectTask: [{
taskType: 'defect',
events: [],
userIds: [],
type: [],
webhook: "",
result: {
showSave: true,
showCancel: true,
showDelete: false
}
}],
},
jenkinsEventOptions: [ jenkinsEventOptions: [
{value: 'EXECUTE_SUCCESSFUL', label: this.$t('schedule.event_success')}, {value: 'EXECUTE_SUCCESSFUL', label: this.$t('schedule.event_success')},
{value: 'EXECUTE_FAILED', label: this.$t('schedule.event_failed')} {value: 'EXECUTE_FAILED', label: this.$t('schedule.event_failed')}
], ],
jenkinsReceiverOptions: [], jenkinsReceiverOptions: [],
receiveTypeOptions: [
testPlanTask:[{}], {value: 'EMAIL', label: this.$t('organization.message.mail')},
testPlanEventOptions: [ {value: 'NAIL_ROBOT', label: this.$t('organization.message.nail_robot')},
{value: 'WECHAT_ROBOT', label: this.$t('organization.message.enterprise_wechat_robot')}
],
otherEventOptions: [
{value: 'CREATE', label: this.$t('commons.create')}, {value: 'CREATE', label: this.$t('commons.create')},
{value: 'UPDATE', label: this.$t('commons.update')}, {value: 'UPDATE', label: this.$t('commons.update')},
{value: 'DELETE', label: this.$t('commons.delete')} {value: 'DELETE', label: this.$t('commons.delete')}
], ],
testPlanReceiverOption:[], //
testPlanReceiverOptions:[], testPlanReceiverOptions: [],
receiveOptions: [ //
{value: 'email', label: this.$t('organization.message.mail')}, reviewReceiverOptions: [],
{value: 'nailRobot', label: this.$t('organization.message.nail_robot')}, //
{value: 'wechatRobot', label: this.$t('organization.message.enterprise_wechat_robot')} defectReceiverOptions: [],
],
reviewTask:[{}],
reviewEventOptions:[
{value: 'CREATE', label: this.$t('commons.create')},
{value: 'UPDATE', label: this.$t('commons.update')},
{value: 'DELETE', label: this.$t('commons.delete')}
],
reviewReceiverOptions:[],
defectTask:[{}],
defectEventOptions:[
{value: 'CREATE', label: this.$t('commons.create')},
{value: 'UPDATE', label: this.$t('commons.update')},
{value: 'DELETE', label: this.$t('commons.delete')}
],
defectOptions:[
{value: 'email', label: this.$t('organization.message.mail')},
{value: 'nailRobot', label: this.$t('organization.message.nail_robot')},
{value: 'wechatRobot', label: this.$t('organization.message.enterprise_wechat_robot')}
],
defectReceiverOptions:[{}],
webhook: "",
showAdd: true,
showDelete: false,
showCancel: true,
} }
}, },
methods: { methods: {
@ -425,53 +462,62 @@ export default {
this.jenkinsReceiverOptions = response.data this.jenkinsReceiverOptions = response.data
}) })
}, },
handleAddJenkins(index, data) { reviewUerList() {
this.showAdd = true; this.result = this.$get('user/list', response => {
this.showCancel = true; this.reviewReceiverOptions = response.data
this.showDelete = false; this.reviewReceiverOptions.unshift({id: 'Founder', name: this.$t('api_test.creator')},
let jenkinsTask = {}; {id: 'Executor', name: this.$t('test_track.plan_view.executor')},
this.jenkinsTask.unshift(jenkinsTask) {id: 'Maintainer', name: this.$t('test_track.case.maintainer')})
})
}, },
handleAddTestPlan(index, data) { defectAndTestPlanUserList() {
this.showAdd = true; this.result = this.$get('user/list', response => {
this.showCancel = true; this.testPlanReceiverOptions = response.data
this.showDelete = false; this.defectReceiverOptions = response.data
let testPlanTask = {}; this.testPlanReceiverOptions.unshift({id: 'Founder', name: this.$t('api_test.creator')}, {
this.testPlanTask.unshift(testPlanTask) id: 'Executor',
name: this.$t('test_track.plan_view.executor')
})
})
}, },
handleAddReview(index, data) { handleAddTaskModel(type) {
this.showAdd = true; let Task = {};
this.showCancel = true; Task.result = {
this.showDelete = false; showSave: true,
let reviewTask = {}; showCancel: true,
this.reviewTask.unshift(reviewTask) showDelete: false,
}
if (type === 'jenkinsTask') {
this.form.jenkinsTask.unshift(Task)
} else if (type === 'testPlanTask') {
this.form.testPlanTask.unshift(Task)
} else if (type === 'reviewTask') {
this.form.reviewTask.unshift(Task)
} else {
this.form.defectTask.unshift(Task)
}
}, },
handleAddDefect(index, data) {
this.showAdd = true; handleAddTask(index, data) {
this.showCancel = true; let list = []
this.showDelete = false; list.push(data)
let defectTask = {}; let param = {};
this.defectTask.unshift(defectTask) param.messageDetail = list
this.result = this.$post("/notice/save/message/task", param, () => {
data.result.showSave = false;
data.result.showCancel = false;
data.result.showDelete = true;
})
}, },
handleAddTask(index,row) { removeRowTask(index, data) { //
this.result = this.$post('/notice/save/message', this.jenkinsTask, () => { data.splice(index, 1)
},
deleteRowTask(index, data) { //
this.result = this.$get("/delete/message" + index, response => {
}) })
data.splice(index, 1)
}, },
removeRow(index, rows) { //
this.jenkinsTask.splice(index, 1)
},
removeRowTestPlan(index, rows) { //
this.testPlanTask.splice(index, 1)
},
removeRowReview(index, rows) { //
this.reviewTask.splice(index, 1)
},
removeRowDefect(index, rows) { //
this.defectTask.splice(index, 1)
}
} }
} }
</script> </script>