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 {
String EXECUTE_SUCCESSFUL = "EXECUTE_SUCCESSFUL";
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;
import io.metersphere.notice.controller.request.MessageRequest;
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.service.NoticeService;
import org.springframework.web.bind.annotation.*;
@ -25,9 +26,19 @@ public class NoticeController {
return noticeService.queryNotice(testId);
}
@PostMapping("save/message")
public void saveMessage(@RequestBody MessageDetail messageDetail) {
noticeService.saveMessageTask(messageDetail);
@PostMapping("save/message/task")
public void saveMessage(@RequestBody MessageRequest messageRequest) {
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;
import io.metersphere.base.domain.MessageTask;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@Data
public class MessageDetail {
public class MessageDetail extends MessageTask {
private List<String> userIds = new ArrayList<>();
private List<String> userNames = new ArrayList<>();
private List<String> events = new ArrayList<>();
private String id;
private String type;
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 java.util.Arrays;
import java.util.List;
@Service
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");
OapiRobotSendRequest request = new OapiRobotSendRequest();
request.setMsgtype("text");
OapiRobotSendRequest.Text text = new OapiRobotSendRequest.Text();
text.setContent("测试计划任务通知:‘创建人’发起的‘测试计划名称‘ 的’计划开始时间‘,’计划结束时间‘请跟进!");
text.setContent(context);
request.setText(text);
OapiRobotSendRequest.At at = new OapiRobotSendRequest.At();
at.setAtMobiles(Arrays.asList("15135125273"));

View File

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

View File

@ -1,10 +1,14 @@
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.NoticeExample;
import io.metersphere.base.mapper.MessageTaskMapper;
import io.metersphere.base.mapper.NoticeMapper;
import io.metersphere.notice.controller.request.MessageRequest;
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 org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
@ -21,6 +25,8 @@ import static io.metersphere.commons.constants.NoticeConstants.EXECUTE_SUCCESSFU
public class NoticeService {
@Resource
private NoticeMapper noticeMapper;
@Resource
private MessageTaskMapper messageTaskMapper;
public void saveNotice(NoticeRequest noticeRequest) {
NoticeExample example = new NoticeExample();
@ -79,7 +85,32 @@ public class NoticeService {
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.TestCaseReviewMapper;
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.notice.service.DingTaskService;
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.SaveTestCaseReviewRequest;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -34,6 +39,10 @@ public class TestCaseCommentService {
MailService mailService;
@Resource
TestCaseMapper testCaseMapper;
@Resource
DingTaskService dingTaskService;
@Resource
WxChatTaskService wxChatTaskService;
public void saveComment(SaveCommentRequest request) {
TestCaseComment testCaseComment = new TestCaseComment();
@ -49,7 +58,18 @@ public class TestCaseCommentService {
SaveTestCaseReviewRequest caseReviewRequest = new SaveTestCaseReviewRequest();
List<String> userIds = new ArrayList<>();
userIds.add(testCaseWithBLOBs.getMaintainer());
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);
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.ExtTestCaseReviewMapper;
import io.metersphere.base.mapper.ext.ExtTestReviewCaseMapper;
import io.metersphere.commons.constants.NoticeConstants;
import io.metersphere.commons.constants.TestCaseReviewStatus;
import io.metersphere.commons.constants.TestReviewCaseStatus;
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.SessionUtils;
import io.metersphere.controller.request.member.QueryMemberRequest;
import io.metersphere.notice.service.DingTaskService;
import io.metersphere.notice.service.MailService;
import io.metersphere.notice.service.WxChatTaskService;
import io.metersphere.service.UserService;
import io.metersphere.track.dto.TestCaseReviewDTO;
import io.metersphere.track.dto.TestReviewCaseDTO;
@ -34,6 +37,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@ -69,6 +73,10 @@ public class TestCaseReviewService {
MailService mailService;
@Resource
ExtTestCaseMapper extTestCaseMapper;
@Resource
DingTaskService dingTaskService;
@Resource
WxChatTaskService wxChatTaskService;
public void saveTestCaseReview(SaveTestCaseReviewRequest reviewRequest) {
checkCaseReviewExist(reviewRequest);
@ -96,9 +104,15 @@ public class TestCaseReviewService {
reviewRequest.setCreator(SessionUtils.getUser().getId());
reviewRequest.setStatus(TestCaseReviewStatus.Prepare.name());
testCaseReviewMapper.insert(reviewRequest);
String context = getReviewContext(reviewRequest, "create");
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.sendReviewerNotice(userIds, reviewRequest);
}
} catch (Exception e) {
LogUtil.error(e);
}
@ -372,7 +386,14 @@ public class TestCaseReviewService {
testCaseReviewMapper.updateByPrimaryKeySelective(testCaseReview);
try {
BeanUtils.copyProperties(testCaseReviewRequest, _testCaseReview);
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) {
LogUtil.error(e);
}
@ -463,4 +484,28 @@ public class TestCaseReviewService {
request.setProjectIds(projectIds);
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,29 +1,33 @@
<template>
<div style="margin-left: 40px">
<el-form :model="form" ref="from">
<el-row class="row">
<el-col :span="20">
<div class="grid-content bg-purple-dark">
<el-row>
<el-col :span="6">
<span style="font-weight:bold;">{{$t('organization.message.jenkins_task_notification')}}</span>
<span style="font-weight:bold;">{{ $t('organization.message.jenkins_task_notification') }}</span>
</el-col>
<el-col :span="14">
<el-button type="text" icon="el-icon-plus" size="mini" @click="handleAddJenkins('jenkinsTask')">
{{$t('organization.message.create_new_notification')}}
<el-button type="text" icon="el-icon-plus" size="mini"
@click="handleAddTaskModel('jenkinsTask')">
{{ $t('organization.message.create_new_notification') }}
</el-button>
</el-col>
</el-row>
</div>
<el-table
:data="jenkinsTask"
:data="form.jenkinsTask"
class="tb-edit"
border
size="mini"
:header-cell-style="{background:'#EDEDED'}"
>
<el-table-column :label="$t('schedule.event')" min-width="20%" prop="event">
<el-table-column :label="$t('schedule.event')" min-width="20%" prop="events">
<template slot-scope="scope">
<el-select v-model="scope.row.event" multiple :placeholder="$t('organization.message.select_events')" prop="event">
<el-select v-model="scope.row.events" multiple :placeholder="$t('organization.message.select_events')"
prop="events">
<el-option
v-for="item in jenkinsEventOptions"
:key="item.value"
@ -33,7 +37,7 @@
</el-select>
</template>
</el-table-column>
<el-table-column :label="$t('schedule.receiver')" prop="receiver" min-width="20%">
<el-table-column :label="$t('schedule.receiver')" prop="userIds" min-width="20%">
<template v-slot:default="{row}">
<el-select v-model="row.userIds" filterable multiple
:placeholder="$t('commons.please_select')"
@ -51,7 +55,7 @@
<template slot-scope="scope">
<el-select v-model="scope.row.type" :placeholder="$t('organization.message.select_receiving_method')">
<el-option
v-for="item in receiveOptions"
v-for="item in receiveTypeOptions"
:key="item.value"
:label="item.label"
:value="item.value">
@ -69,26 +73,28 @@
<el-button
type="primary"
size="mini"
v-show="!scope.row.showAdd"
v-show="scope.row.result.showSave"
@click="handleAddTask(scope.$index,scope.row)"
>{{$t('commons.add')}}
>{{ $t('commons.add') }}
</el-button>
<el-button
size="mini"
v-show="!scope.row.showCancel"
@click="removeRow(scope.$index,scope.row)"
>{{$t('commons.cancel')}}
v-show="scope.row.result.showCancel"
@click.native.prevent="removeRowTask(scope.$index,form.jenkinsTask)"
>{{ $t('commons.cancel') }}
</el-button>
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
v-show="scope.row.showDelete"
@click="removeRow(scope.$index,scope.row)"
v-show="scope.row.result.showDelete"
@click.native.prevent="deleteRowTask(scope.$index,form.jenkinsTask)"
></el-button>
</template>
</el-table-column>
</el-table>
</el-col>
</el-row>
<el-row class="row">
@ -96,27 +102,28 @@
<div class="grid-content bg-purple-dark">
<el-row>
<el-col :span="6">
<span style="font-weight:bold;">{{$t('organization.message.test_plan_task_notification')}}</span>
<span style="font-weight:bold;">{{ $t('organization.message.test_plan_task_notification') }}</span>
</el-col>
<el-col :span="14">
<el-button type="text" icon="el-icon-plus" size="mini" @click="handleAddTestPlan('testPlanTask')">
{{$t('organization.message.create_new_notification')}}
<el-button type="text" icon="el-icon-plus" size="mini" @click="handleAddTaskModel('testPlanTask')">
{{ $t('organization.message.create_new_notification') }}
</el-button>
</el-col>
</el-row>
</div>
<el-table
:data="testPlanTask"
:data="form.testPlanTask"
class="tb-edit"
border
size="mini"
:header-cell-style="{background:'#EDEDED'}"
>
<el-table-column :label="$t('schedule.event')" min-width="20%" prop="event">
<el-table-column :label="$t('schedule.event')" min-width="20%" prop="events">
<template slot-scope="scope">
<el-select v-model="scope.row.event" multiple :placeholder="$t('organization.message.select_events')" prop="event">
<el-select v-model="scope.row.events" multiple :placeholder="$t('organization.message.select_events')"
prop="events">
<el-option
v-for="item in testPlanEventOptions"
v-for="item in otherEventOptions"
:key="item.value"
:label="item.label"
:value="item.value">
@ -124,11 +131,11 @@
</el-select>
</template>
</el-table-column>
<el-table-column :label="$t('schedule.receiver')" prop="receiver" min-width="20%">
<el-table-column :label="$t('schedule.receiver')" prop="userIds" min-width="20%">
<template v-slot:default="{row}">
<el-select v-model="row.userIds" filterable multiple
:placeholder="$t('commons.please_select')"
@click.native="userList()" style="width: 100%;">
@click.native="defectAndTestPlanUserList()" style="width: 100%;">
<el-option
v-for="item in testPlanReceiverOptions"
:key="item.id"
@ -142,7 +149,7 @@
<template slot-scope="scope">
<el-select v-model="scope.row.type" :placeholder="$t('organization.message.select_receiving_method')">
<el-option
v-for="item in receiveOptions"
v-for="item in receiveTypeOptions"
:key="item.value"
:label="item.label"
:value="item.value">
@ -160,22 +167,22 @@
<el-button
type="primary"
size="mini"
v-show="!scope.row.showAdd"
v-show="scope.row.result.showSave"
@click="handleAddTask(scope.$index,scope.row)"
>{{$t('commons.add')}}
>{{ $t('commons.add') }}
</el-button>
<el-button
size="mini"
v-show="!scope.row.showCancel"
@click="removeRowTestPlan(scope.$index,scope.row)"
>{{$t('commons.cancel')}}
v-show="scope.row.result.showCancel"
@click.native.prevent="removeRowTask(scope.$index,form.testPlanTask)"
>{{ $t('commons.cancel') }}
</el-button>
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
v-show="scope.row.showDelete"
@click="removeRowTestPlan(scope.$index,scope.row)"
v-show="scope.row.result.showDelete"
@click.native.prevent="deleteRowTask(scope.$index,form.testPlanTask)"
></el-button>
</template>
</el-table-column>
@ -187,27 +194,28 @@
<div class="grid-content bg-purple-dark">
<el-row>
<el-col :span="6">
<span style="font-weight:bold;">{{$t('organization.message.test_review_task_notice')}}</span>
<span style="font-weight:bold;">{{ $t('organization.message.test_review_task_notice') }}</span>
</el-col>
<el-col :span="14">
<el-button type="text" icon="el-icon-plus" size="mini" @click="handleAddReview('reviewTask')">
{{$t('organization.message.create_new_notification')}}
<el-button type="text" icon="el-icon-plus" size="mini" @click="handleAddTaskModel('reviewTask')">
{{ $t('organization.message.create_new_notification') }}
</el-button>
</el-col>
</el-row>
</div>
<el-table
:data="reviewTask"
:data="form.reviewTask"
class="tb-edit"
border
size="mini"
:header-cell-style="{background:'#EDEDED'}"
>
<el-table-column :label="$t('schedule.event')" min-width="20%" prop="event">
<el-table-column :label="$t('schedule.event')" min-width="20%" prop="events">
<template slot-scope="scope">
<el-select v-model="scope.row.event" multiple :placeholder="$t('organization.message.select_events')" prop="event">
<el-select v-model="scope.row.events" multiple :placeholder="$t('organization.message.select_events')"
prop="event">
<el-option
v-for="item in reviewEventOptions"
v-for="item in otherEventOptions"
:key="item.value"
:label="item.label"
:value="item.value">
@ -219,7 +227,7 @@
<template v-slot:default="{row}">
<el-select v-model="row.userIds" filterable multiple
:placeholder="$t('commons.please_select')"
@click.native="userList()" style="width: 100%;">
@click.native="reviewUerList()" style="width: 100%;">
<el-option
v-for="item in reviewReceiverOptions"
:key="item.id"
@ -233,7 +241,7 @@
<template slot-scope="scope">
<el-select v-model="scope.row.type" :placeholder="$t('organization.message.select_receiving_method')">
<el-option
v-for="item in receiveOptions"
v-for="item in receiveTypeOptions"
:key="item.value"
:label="item.label"
:value="item.value">
@ -251,22 +259,22 @@
<el-button
type="primary"
size="mini"
v-show="!scope.row.showAdd"
v-show="scope.row.result.showSave"
@click="handleAddTask(scope.$index,scope.row)"
>{{$t('commons.add')}}
>{{ $t('commons.add') }}
</el-button>
<el-button
size="mini"
v-show="!scope.row.showCancel"
@click="removeRowReview(scope.$index,scope.row)"
>{{$t('commons.cancel')}}
v-show="scope.row.result.showCancel"
@click.native.prevent="removeRowTask(scope.$index,form.reviewTask)"
>{{ $t('commons.cancel') }}
</el-button>
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
v-show="scope.row.showDelete"
@click="removeRowReview(scope.$index,scope.row)"
v-show="scope.row.result.showDelete"
@click.native.prevent="deleteRowTask(scope.$index,form.reviewTask)"
></el-button>
</template>
</el-table-column>
@ -278,27 +286,28 @@
<div class="grid-content bg-purple-dark">
<el-row>
<el-col :span="6">
<span style="font-weight:bold;">{{$t('organization.message.defect_task_notification')}}</span>
<span style="font-weight:bold;">{{ $t('organization.message.defect_task_notification') }}</span>
</el-col>
<el-col :span="14">
<el-button type="text" icon="el-icon-plus" size="mini" @click="handleAddDefect('defectTask')">
{{$t('organization.message.create_new_notification')}}
<el-button type="text" icon="el-icon-plus" size="mini" @click="handleAddTaskModel('defectTask')">
{{ $t('organization.message.create_new_notification') }}
</el-button>
</el-col>
</el-row>
</div>
<el-table
:data="defectTask"
:data="form.defectTask"
class="tb-edit"
border
size="mini"
:header-cell-style="{background:'#EDEDED'}"
>
<el-table-column :label="$t('schedule.event')" min-width="20%" prop="event">
<el-table-column :label="$t('schedule.event')" min-width="20%" prop="events">
<template slot-scope="scope">
<el-select v-model="scope.row.event" multiple :placeholder="$t('organization.message.select_events')" prop="event">
<el-select v-model="scope.row.events" multiple :placeholder="$t('organization.message.select_events')"
prop="event">
<el-option
v-for="item in defectEventOptions"
v-for="item in otherEventOptions"
:key="item.value"
:label="item.label"
:value="item.value">
@ -310,7 +319,7 @@
<template v-slot:default="{row}">
<el-select v-model="row.userIds" filterable multiple
:placeholder="$t('commons.please_select')"
@click.native="userList()" style="width: 100%;">
@click.native="defectAndTestPlanUserList()" style="width: 100%;">
<el-option
v-for="item in defectReceiverOptions"
:key="item.id"
@ -324,7 +333,7 @@
<template slot-scope="scope">
<el-select v-model="scope.row.type" :placeholder="$t('organization.message.select_receiving_method')">
<el-option
v-for="item in defectOptions"
v-for="item in receiveTypeOptions"
:key="item.value"
:label="item.label"
:value="item.value">
@ -342,28 +351,29 @@
<el-button
type="primary"
size="mini"
v-show="!scope.row.showAdd"
v-show="scope.row.result.showSave"
@click="handleAddTask(scope.$index,scope.row)"
>{{$t('commons.add')}}
>{{ $t('commons.add') }}
</el-button>
<el-button
size="mini"
v-show="!scope.row.showCancel"
@click="removeRowDefect(scope.$index,scope.row)"
>{{$t('commons.cancel')}}
v-show="scope.row.result.showCancel"
@click.native.prevent="removeRowTask(scope.$index,form.defectTask)"
>{{ $t('commons.cancel') }}
</el-button>
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
v-show="scope.row.showDelete"
@click="removeRowDefect(scope.$index,scope.row)"
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>
</template>
@ -373,50 +383,77 @@ export default {
name: "TaskNotification",
data() {
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: [
{value: 'EXECUTE_SUCCESSFUL', label: this.$t('schedule.event_success')},
{value: 'EXECUTE_FAILED', label: this.$t('schedule.event_failed')}
],
jenkinsReceiverOptions: [],
testPlanTask:[{}],
testPlanEventOptions: [
receiveTypeOptions: [
{value: 'EMAIL', label: this.$t('organization.message.mail')},
{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: 'UPDATE', label: this.$t('commons.update')},
{value: 'DELETE', label: this.$t('commons.delete')}
],
testPlanReceiverOption:[],
testPlanReceiverOptions:[],
receiveOptions: [
{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')}
],
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,
//
testPlanReceiverOptions: [],
//
reviewReceiverOptions: [],
//
defectReceiverOptions: [],
}
},
methods: {
@ -425,53 +462,62 @@ export default {
this.jenkinsReceiverOptions = response.data
})
},
handleAddJenkins(index, data) {
this.showAdd = true;
this.showCancel = true;
this.showDelete = false;
let jenkinsTask = {};
this.jenkinsTask.unshift(jenkinsTask)
reviewUerList() {
this.result = this.$get('user/list', response => {
this.reviewReceiverOptions = response.data
this.reviewReceiverOptions.unshift({id: 'Founder', name: this.$t('api_test.creator')},
{id: 'Executor', name: this.$t('test_track.plan_view.executor')},
{id: 'Maintainer', name: this.$t('test_track.case.maintainer')})
})
},
handleAddTestPlan(index, data) {
this.showAdd = true;
this.showCancel = true;
this.showDelete = false;
let testPlanTask = {};
this.testPlanTask.unshift(testPlanTask)
defectAndTestPlanUserList() {
this.result = this.$get('user/list', response => {
this.testPlanReceiverOptions = response.data
this.defectReceiverOptions = response.data
this.testPlanReceiverOptions.unshift({id: 'Founder', name: this.$t('api_test.creator')}, {
id: 'Executor',
name: this.$t('test_track.plan_view.executor')
})
})
},
handleAddReview(index, data) {
this.showAdd = true;
this.showCancel = true;
this.showDelete = false;
let reviewTask = {};
this.reviewTask.unshift(reviewTask)
handleAddTaskModel(type) {
let Task = {};
Task.result = {
showSave: true,
showCancel: true,
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;
this.showCancel = true;
this.showDelete = false;
let defectTask = {};
this.defectTask.unshift(defectTask)
handleAddTask(index, data) {
let list = []
list.push(data)
let param = {};
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) {
this.result = this.$post('/notice/save/message', this.jenkinsTask, () => {
removeRowTask(index, data) { //
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>