Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
c30e933463
|
@ -1,8 +1,9 @@
|
||||||
package io.metersphere.base.domain;
|
package io.metersphere.base.domain;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class MessageTask implements Serializable {
|
public class MessageTask implements Serializable {
|
||||||
private String id;
|
private String id;
|
||||||
|
@ -27,5 +28,7 @@ public class MessageTask implements Serializable {
|
||||||
|
|
||||||
private Long createTime;
|
private Long createTime;
|
||||||
|
|
||||||
|
private String template;
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
}
|
}
|
|
@ -2,9 +2,10 @@ package io.metersphere.base.mapper;
|
||||||
|
|
||||||
import io.metersphere.base.domain.MessageTask;
|
import io.metersphere.base.domain.MessageTask;
|
||||||
import io.metersphere.base.domain.MessageTaskExample;
|
import io.metersphere.base.domain.MessageTaskExample;
|
||||||
import java.util.List;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface MessageTaskMapper {
|
public interface MessageTaskMapper {
|
||||||
long countByExample(MessageTaskExample example);
|
long countByExample(MessageTaskExample example);
|
||||||
|
|
||||||
|
@ -16,15 +17,21 @@ public interface MessageTaskMapper {
|
||||||
|
|
||||||
int insertSelective(MessageTask record);
|
int insertSelective(MessageTask record);
|
||||||
|
|
||||||
|
List<MessageTask> selectByExampleWithBLOBs(MessageTaskExample example);
|
||||||
|
|
||||||
List<MessageTask> selectByExample(MessageTaskExample example);
|
List<MessageTask> selectByExample(MessageTaskExample example);
|
||||||
|
|
||||||
MessageTask selectByPrimaryKey(String id);
|
MessageTask selectByPrimaryKey(String id);
|
||||||
|
|
||||||
int updateByExampleSelective(@Param("record") MessageTask record, @Param("example") MessageTaskExample example);
|
int updateByExampleSelective(@Param("record") MessageTask record, @Param("example") MessageTaskExample example);
|
||||||
|
|
||||||
|
int updateByExampleWithBLOBs(@Param("record") MessageTask record, @Param("example") MessageTaskExample example);
|
||||||
|
|
||||||
int updateByExample(@Param("record") MessageTask record, @Param("example") MessageTaskExample example);
|
int updateByExample(@Param("record") MessageTask record, @Param("example") MessageTaskExample example);
|
||||||
|
|
||||||
int updateByPrimaryKeySelective(MessageTask record);
|
int updateByPrimaryKeySelective(MessageTask record);
|
||||||
|
|
||||||
|
int updateByPrimaryKeyWithBLOBs(MessageTask record);
|
||||||
|
|
||||||
int updateByPrimaryKey(MessageTask record);
|
int updateByPrimaryKey(MessageTask record);
|
||||||
}
|
}
|
|
@ -2,17 +2,20 @@
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!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">
|
<mapper namespace="io.metersphere.base.mapper.MessageTaskMapper">
|
||||||
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.MessageTask">
|
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.MessageTask">
|
||||||
<id column="id" jdbcType="VARCHAR" property="id"/>
|
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||||
<result column="type" jdbcType="VARCHAR" property="type"/>
|
<result column="type" jdbcType="VARCHAR" property="type" />
|
||||||
<result column="event" jdbcType="VARCHAR" property="event"/>
|
<result column="event" jdbcType="VARCHAR" property="event" />
|
||||||
<result column="user_id" jdbcType="VARCHAR" property="userId"/>
|
<result column="user_id" jdbcType="VARCHAR" property="userId" />
|
||||||
<result column="task_type" jdbcType="VARCHAR" property="taskType"/>
|
<result column="task_type" jdbcType="VARCHAR" property="taskType" />
|
||||||
<result column="webhook" jdbcType="VARCHAR" property="webhook"/>
|
<result column="webhook" jdbcType="VARCHAR" property="webhook" />
|
||||||
<result column="identification" jdbcType="VARCHAR" property="identification"/>
|
<result column="identification" jdbcType="VARCHAR" property="identification" />
|
||||||
<result column="is_set" jdbcType="BIT" property="isSet"/>
|
<result column="is_set" jdbcType="BIT" property="isSet" />
|
||||||
<result column="organization_id" jdbcType="VARCHAR" property="organizationId"/>
|
<result column="organization_id" jdbcType="VARCHAR" property="organizationId" />
|
||||||
<result column="test_id" jdbcType="VARCHAR" property="testId"/>
|
<result column="test_id" jdbcType="VARCHAR" property="testId" />
|
||||||
<result column="create_time" jdbcType="BIGINT" property="createTime"/>
|
<result column="create_time" jdbcType="BIGINT" property="createTime" />
|
||||||
|
</resultMap>
|
||||||
|
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.MessageTask">
|
||||||
|
<result column="template" jdbcType="LONGVARCHAR" property="template" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<sql id="Example_Where_Clause">
|
<sql id="Example_Where_Clause">
|
||||||
<where>
|
<where>
|
||||||
|
@ -25,13 +28,13 @@
|
||||||
and ${criterion.condition}
|
and ${criterion.condition}
|
||||||
</when>
|
</when>
|
||||||
<when test="criterion.singleValue">
|
<when test="criterion.singleValue">
|
||||||
and ${criterion.condition} #{criterion.value}
|
AND ${criterion.condition} #{criterion.value}
|
||||||
</when>
|
</when>
|
||||||
<when test="criterion.betweenValue">
|
<when test="criterion.betweenValue">
|
||||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
AND ${criterion.condition} #{criterion.value} AND #{criterion.secondValue}
|
||||||
</when>
|
</when>
|
||||||
<when test="criterion.listValue">
|
<when test="criterion.listValue">
|
||||||
and ${criterion.condition}
|
AND ${criterion.condition}
|
||||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||||
#{listItem}
|
#{listItem}
|
||||||
</foreach>
|
</foreach>
|
||||||
|
@ -76,6 +79,25 @@
|
||||||
id, `type`, event, user_id, task_type, webhook, identification, is_set, organization_id,
|
id, `type`, event, user_id, task_type, webhook, identification, is_set, organization_id,
|
||||||
test_id, create_time
|
test_id, create_time
|
||||||
</sql>
|
</sql>
|
||||||
|
<sql id="Blob_Column_List">
|
||||||
|
`template`
|
||||||
|
</sql>
|
||||||
|
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.MessageTaskExample" resultMap="ResultMapWithBLOBs">
|
||||||
|
SELECT
|
||||||
|
<if test="distinct">
|
||||||
|
DISTINCT
|
||||||
|
</if>
|
||||||
|
<include refid="Base_Column_List" />
|
||||||
|
,
|
||||||
|
<include refid="Blob_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="selectByExample" parameterType="io.metersphere.base.domain.MessageTaskExample" resultMap="BaseResultMap">
|
<select id="selectByExample" parameterType="io.metersphere.base.domain.MessageTaskExample" resultMap="BaseResultMap">
|
||||||
select
|
select
|
||||||
<if test="distinct">
|
<if test="distinct">
|
||||||
|
@ -90,9 +112,11 @@
|
||||||
order by ${orderByClause}
|
order by ${orderByClause}
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
|
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
|
||||||
select
|
select
|
||||||
<include refid="Base_Column_List" />
|
<include refid="Base_Column_List" />
|
||||||
|
,
|
||||||
|
<include refid="Blob_Column_List" />
|
||||||
from message_task
|
from message_task
|
||||||
where id = #{id,jdbcType=VARCHAR}
|
where id = #{id,jdbcType=VARCHAR}
|
||||||
</select>
|
</select>
|
||||||
|
@ -107,14 +131,16 @@
|
||||||
</if>
|
</if>
|
||||||
</delete>
|
</delete>
|
||||||
<insert id="insert" parameterType="io.metersphere.base.domain.MessageTask">
|
<insert id="insert" parameterType="io.metersphere.base.domain.MessageTask">
|
||||||
insert into message_task (id, `type`, event,
|
INSERT INTO message_task (id, `type`, event,
|
||||||
user_id, task_type, webhook,
|
user_id, task_type, webhook,
|
||||||
identification, is_set, organization_id,
|
identification, is_set, organization_id,
|
||||||
test_id, create_time)
|
test_id, create_time, `template`
|
||||||
values (#{id,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{event,jdbcType=VARCHAR},
|
)
|
||||||
#{userId,jdbcType=VARCHAR}, #{taskType,jdbcType=VARCHAR}, #{webhook,jdbcType=VARCHAR},
|
VALUES (#{id,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{event,jdbcType=VARCHAR},
|
||||||
#{identification,jdbcType=VARCHAR}, #{isSet,jdbcType=BIT}, #{organizationId,jdbcType=VARCHAR},
|
#{userId,jdbcType=VARCHAR}, #{taskType,jdbcType=VARCHAR}, #{webhook,jdbcType=VARCHAR},
|
||||||
#{testId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT})
|
#{identification,jdbcType=VARCHAR}, #{isSet,jdbcType=BIT}, #{organizationId,jdbcType=VARCHAR},
|
||||||
|
#{testId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{template,jdbcType=LONGVARCHAR}
|
||||||
|
)
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.MessageTask">
|
<insert id="insertSelective" parameterType="io.metersphere.base.domain.MessageTask">
|
||||||
insert into message_task
|
insert into message_task
|
||||||
|
@ -152,6 +178,9 @@
|
||||||
<if test="createTime != null">
|
<if test="createTime != null">
|
||||||
create_time,
|
create_time,
|
||||||
</if>
|
</if>
|
||||||
|
<if test="template != null">
|
||||||
|
`template`,
|
||||||
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="id != null">
|
<if test="id != null">
|
||||||
|
@ -187,6 +216,9 @@
|
||||||
<if test="createTime != null">
|
<if test="createTime != null">
|
||||||
#{createTime,jdbcType=BIGINT},
|
#{createTime,jdbcType=BIGINT},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="template != null">
|
||||||
|
#{template,jdbcType=LONGVARCHAR},
|
||||||
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
<select id="countByExample" parameterType="io.metersphere.base.domain.MessageTaskExample" resultType="java.lang.Long">
|
<select id="countByExample" parameterType="io.metersphere.base.domain.MessageTaskExample" resultType="java.lang.Long">
|
||||||
|
@ -231,24 +263,45 @@
|
||||||
<if test="record.createTime != null">
|
<if test="record.createTime != null">
|
||||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="record.template != null">
|
||||||
|
`template` = #{record.template,jdbcType=LONGVARCHAR},
|
||||||
|
</if>
|
||||||
</set>
|
</set>
|
||||||
<if test="_parameter != null">
|
<if test="_parameter != null">
|
||||||
<include refid="Update_By_Example_Where_Clause" />
|
<include refid="Update_By_Example_Where_Clause" />
|
||||||
</if>
|
</if>
|
||||||
</update>
|
</update>
|
||||||
|
<update id="updateByExampleWithBLOBs" parameterType="map">
|
||||||
|
UPDATE message_task
|
||||||
|
SET id = #{record.id,jdbcType=VARCHAR},
|
||||||
|
`type` = #{record.type,jdbcType=VARCHAR},
|
||||||
|
event = #{record.event,jdbcType=VARCHAR},
|
||||||
|
user_id = #{record.userId,jdbcType=VARCHAR},
|
||||||
|
task_type = #{record.taskType,jdbcType=VARCHAR},
|
||||||
|
webhook = #{record.webhook,jdbcType=VARCHAR},
|
||||||
|
identification = #{record.identification,jdbcType=VARCHAR},
|
||||||
|
is_set = #{record.isSet,jdbcType=BIT},
|
||||||
|
organization_id = #{record.organizationId,jdbcType=VARCHAR},
|
||||||
|
test_id = #{record.testId,jdbcType=VARCHAR},
|
||||||
|
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||||
|
`template` = #{record.template,jdbcType=LONGVARCHAR}
|
||||||
|
<if test="_parameter != null">
|
||||||
|
<include refid="Update_By_Example_Where_Clause" />
|
||||||
|
</if>
|
||||||
|
</update>
|
||||||
<update id="updateByExample" parameterType="map">
|
<update id="updateByExample" parameterType="map">
|
||||||
update message_task
|
update message_task
|
||||||
set id = #{record.id,jdbcType=VARCHAR},
|
set id = #{record.id,jdbcType=VARCHAR},
|
||||||
`type` = #{record.type,jdbcType=VARCHAR},
|
`type` = #{record.type,jdbcType=VARCHAR},
|
||||||
event = #{record.event,jdbcType=VARCHAR},
|
event = #{record.event,jdbcType=VARCHAR},
|
||||||
user_id = #{record.userId,jdbcType=VARCHAR},
|
user_id = #{record.userId,jdbcType=VARCHAR},
|
||||||
task_type = #{record.taskType,jdbcType=VARCHAR},
|
task_type = #{record.taskType,jdbcType=VARCHAR},
|
||||||
webhook = #{record.webhook,jdbcType=VARCHAR},
|
webhook = #{record.webhook,jdbcType=VARCHAR},
|
||||||
identification = #{record.identification,jdbcType=VARCHAR},
|
identification = #{record.identification,jdbcType=VARCHAR},
|
||||||
is_set = #{record.isSet,jdbcType=BIT},
|
is_set = #{record.isSet,jdbcType=BIT},
|
||||||
organization_id = #{record.organizationId,jdbcType=VARCHAR},
|
organization_id = #{record.organizationId,jdbcType=VARCHAR},
|
||||||
test_id = #{record.testId,jdbcType=VARCHAR},
|
test_id = #{record.testId,jdbcType=VARCHAR},
|
||||||
create_time = #{record.createTime,jdbcType=BIGINT}
|
create_time = #{record.createTime,jdbcType=BIGINT}
|
||||||
<if test="_parameter != null">
|
<if test="_parameter != null">
|
||||||
<include refid="Update_By_Example_Where_Clause" />
|
<include refid="Update_By_Example_Where_Clause" />
|
||||||
</if>
|
</if>
|
||||||
|
@ -286,21 +339,39 @@
|
||||||
<if test="createTime != null">
|
<if test="createTime != null">
|
||||||
create_time = #{createTime,jdbcType=BIGINT},
|
create_time = #{createTime,jdbcType=BIGINT},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="template != null">
|
||||||
|
`template` = #{template,jdbcType=LONGVARCHAR},
|
||||||
|
</if>
|
||||||
</set>
|
</set>
|
||||||
where id = #{id,jdbcType=VARCHAR}
|
where id = #{id,jdbcType=VARCHAR}
|
||||||
</update>
|
</update>
|
||||||
|
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.MessageTask">
|
||||||
|
UPDATE message_task
|
||||||
|
SET `type` = #{type,jdbcType=VARCHAR},
|
||||||
|
event = #{event,jdbcType=VARCHAR},
|
||||||
|
user_id = #{userId,jdbcType=VARCHAR},
|
||||||
|
task_type = #{taskType,jdbcType=VARCHAR},
|
||||||
|
webhook = #{webhook,jdbcType=VARCHAR},
|
||||||
|
identification = #{identification,jdbcType=VARCHAR},
|
||||||
|
is_set = #{isSet,jdbcType=BIT},
|
||||||
|
organization_id = #{organizationId,jdbcType=VARCHAR},
|
||||||
|
test_id = #{testId,jdbcType=VARCHAR},
|
||||||
|
create_time = #{createTime,jdbcType=BIGINT},
|
||||||
|
`template` = #{template,jdbcType=LONGVARCHAR}
|
||||||
|
WHERE id = #{id,jdbcType=VARCHAR}
|
||||||
|
</update>
|
||||||
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.MessageTask">
|
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.MessageTask">
|
||||||
update message_task
|
UPDATE message_task
|
||||||
set `type` = #{type,jdbcType=VARCHAR},
|
SET `type` = #{type,jdbcType=VARCHAR},
|
||||||
event = #{event,jdbcType=VARCHAR},
|
event = #{event,jdbcType=VARCHAR},
|
||||||
user_id = #{userId,jdbcType=VARCHAR},
|
user_id = #{userId,jdbcType=VARCHAR},
|
||||||
task_type = #{taskType,jdbcType=VARCHAR},
|
task_type = #{taskType,jdbcType=VARCHAR},
|
||||||
webhook = #{webhook,jdbcType=VARCHAR},
|
webhook = #{webhook,jdbcType=VARCHAR},
|
||||||
identification = #{identification,jdbcType=VARCHAR},
|
identification = #{identification,jdbcType=VARCHAR},
|
||||||
is_set = #{isSet,jdbcType=BIT},
|
is_set = #{isSet,jdbcType=BIT},
|
||||||
organization_id = #{organizationId,jdbcType=VARCHAR},
|
organization_id = #{organizationId,jdbcType=VARCHAR},
|
||||||
test_id = #{testId,jdbcType=VARCHAR},
|
test_id = #{testId,jdbcType=VARCHAR},
|
||||||
create_time = #{createTime,jdbcType=BIGINT}
|
create_time = #{createTime,jdbcType=BIGINT}
|
||||||
where id = #{id,jdbcType=VARCHAR}
|
WHERE id = #{id,jdbcType=VARCHAR}
|
||||||
</update>
|
</update>
|
||||||
</mapper>
|
</mapper>
|
|
@ -17,4 +17,5 @@ public class MessageDetail {
|
||||||
private Boolean isSet;
|
private Boolean isSet;
|
||||||
private String testId;
|
private String testId;
|
||||||
private Long createTime;
|
private Long createTime;
|
||||||
|
private String template;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,9 @@ import io.metersphere.commons.utils.LogUtil;
|
||||||
import io.metersphere.notice.domain.MessageDetail;
|
import io.metersphere.notice.domain.MessageDetail;
|
||||||
import io.metersphere.notice.domain.UserDetail;
|
import io.metersphere.notice.domain.UserDetail;
|
||||||
import io.metersphere.service.UserService;
|
import io.metersphere.service.UserService;
|
||||||
|
import org.apache.commons.collections4.MapUtils;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
|
import org.apache.commons.lang3.RegExUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
@ -14,6 +16,7 @@ import java.net.URL;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public abstract class AbstractNoticeSender implements NoticeSender {
|
public abstract class AbstractNoticeSender implements NoticeSender {
|
||||||
|
@ -21,13 +24,16 @@ public abstract class AbstractNoticeSender implements NoticeSender {
|
||||||
private UserService userService;
|
private UserService userService;
|
||||||
|
|
||||||
protected String getContext(MessageDetail messageDetail, NoticeModel noticeModel) {
|
protected String getContext(MessageDetail messageDetail, NoticeModel noticeModel) {
|
||||||
|
// 如果配置了模版就直接使用模版
|
||||||
|
if (StringUtils.isNotBlank(messageDetail.getTemplate())) {
|
||||||
|
return getContent(messageDetail.getTemplate(), noticeModel.getParamMap());
|
||||||
|
}
|
||||||
// 处理 userIds 中包含的特殊值
|
// 处理 userIds 中包含的特殊值
|
||||||
List<String> realUserIds = getRealUserIds(messageDetail.getUserIds(), noticeModel.getRelatedUsers(), messageDetail.getEvent());
|
List<String> realUserIds = getRealUserIds(messageDetail.getUserIds(), noticeModel.getRelatedUsers(), messageDetail.getEvent());
|
||||||
messageDetail.setUserIds(realUserIds);
|
messageDetail.setUserIds(realUserIds);
|
||||||
|
|
||||||
// 处理 WeCom Ding context
|
// 处理 WeCom Ding context
|
||||||
String context = "";
|
String context = "";
|
||||||
String status = noticeModel.getStatus();
|
|
||||||
switch (messageDetail.getEvent()) {
|
switch (messageDetail.getEvent()) {
|
||||||
case NoticeConstants.Event.CREATE:
|
case NoticeConstants.Event.CREATE:
|
||||||
case NoticeConstants.Event.UPDATE:
|
case NoticeConstants.Event.UPDATE:
|
||||||
|
@ -48,6 +54,10 @@ public abstract class AbstractNoticeSender implements NoticeSender {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getHtmlContext(MessageDetail messageDetail, NoticeModel noticeModel) {
|
protected String getHtmlContext(MessageDetail messageDetail, NoticeModel noticeModel) {
|
||||||
|
// 如果配置了模版就直接使用模版
|
||||||
|
if (StringUtils.isNotBlank(messageDetail.getTemplate())) {
|
||||||
|
return getContent(messageDetail.getTemplate(), noticeModel.getParamMap());
|
||||||
|
}
|
||||||
// 处理 userIds 中包含的特殊值
|
// 处理 userIds 中包含的特殊值
|
||||||
List<String> realUserIds = getRealUserIds(messageDetail.getUserIds(), noticeModel.getRelatedUsers(), messageDetail.getEvent());
|
List<String> realUserIds = getRealUserIds(messageDetail.getUserIds(), noticeModel.getRelatedUsers(), messageDetail.getEvent());
|
||||||
messageDetail.setUserIds(realUserIds);
|
messageDetail.setUserIds(realUserIds);
|
||||||
|
@ -77,7 +87,20 @@ public abstract class AbstractNoticeSender implements NoticeSender {
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
LogUtil.error(e);
|
LogUtil.error(e);
|
||||||
}
|
}
|
||||||
return context;
|
return getContent(context, noticeModel.getParamMap());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String getContent(String template, Map<String, Object> context) {
|
||||||
|
if (MapUtils.isNotEmpty(context)) {
|
||||||
|
for (String k : context.keySet()) {
|
||||||
|
if (context.get(k) != null) {
|
||||||
|
template = RegExUtils.replaceAll(template, "\\$\\{" + k + "}", context.get(k).toString());
|
||||||
|
} else {
|
||||||
|
template = RegExUtils.replaceAll(template, "\\$\\{" + k + "}", "未设置");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return template;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List<String> getUserPhones(List<String> userIds) {
|
protected List<String> getUserPhones(List<String> userIds) {
|
||||||
|
|
|
@ -5,8 +5,6 @@ import io.metersphere.notice.domain.MessageDetail;
|
||||||
import io.metersphere.notice.sender.AbstractNoticeSender;
|
import io.metersphere.notice.sender.AbstractNoticeSender;
|
||||||
import io.metersphere.notice.sender.NoticeModel;
|
import io.metersphere.notice.sender.NoticeModel;
|
||||||
import io.metersphere.notice.service.MailService;
|
import io.metersphere.notice.service.MailService;
|
||||||
import org.apache.commons.collections4.MapUtils;
|
|
||||||
import org.apache.commons.lang3.RegExUtils;
|
|
||||||
import org.springframework.mail.javamail.JavaMailSenderImpl;
|
import org.springframework.mail.javamail.JavaMailSenderImpl;
|
||||||
import org.springframework.mail.javamail.MimeMessageHelper;
|
import org.springframework.mail.javamail.MimeMessageHelper;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -15,14 +13,13 @@ import javax.annotation.Resource;
|
||||||
import javax.mail.MessagingException;
|
import javax.mail.MessagingException;
|
||||||
import javax.mail.internet.MimeMessage;
|
import javax.mail.internet.MimeMessage;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class MailNoticeSender extends AbstractNoticeSender {
|
public class MailNoticeSender extends AbstractNoticeSender {
|
||||||
@Resource
|
@Resource
|
||||||
private MailService mailService;
|
private MailService mailService;
|
||||||
|
|
||||||
private void sendMail(MessageDetail messageDetail, String template, NoticeModel noticeModel) throws MessagingException {
|
private void sendMail(MessageDetail messageDetail, String context, NoticeModel noticeModel) throws MessagingException {
|
||||||
JavaMailSenderImpl javaMailSender = mailService.getMailSender();
|
JavaMailSenderImpl javaMailSender = mailService.getMailSender();
|
||||||
MimeMessage mimeMessage = javaMailSender.createMimeMessage();
|
MimeMessage mimeMessage = javaMailSender.createMimeMessage();
|
||||||
MimeMessageHelper helper = new MimeMessageHelper(mimeMessage, true);
|
MimeMessageHelper helper = new MimeMessageHelper(mimeMessage, true);
|
||||||
|
@ -31,25 +28,11 @@ public class MailNoticeSender extends AbstractNoticeSender {
|
||||||
List<String> emails = super.getUserEmails(messageDetail.getUserIds());
|
List<String> emails = super.getUserEmails(messageDetail.getUserIds());
|
||||||
String[] users = emails.toArray(new String[0]);
|
String[] users = emails.toArray(new String[0]);
|
||||||
LogUtil.info("收件人地址: " + emails);
|
LogUtil.info("收件人地址: " + emails);
|
||||||
helper.setText(this.getContent(template, noticeModel.getParamMap()), true);
|
helper.setText(context, true);
|
||||||
helper.setTo(users);
|
helper.setTo(users);
|
||||||
javaMailSender.send(mimeMessage);
|
javaMailSender.send(mimeMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getContent(String template, Map<String, Object> context) {
|
|
||||||
if (MapUtils.isNotEmpty(context)) {
|
|
||||||
for (String k : context.keySet()) {
|
|
||||||
if (context.get(k) != null) {
|
|
||||||
template = RegExUtils.replaceAll(template, "\\$\\{" + k + "}", context.get(k).toString());
|
|
||||||
} else {
|
|
||||||
template = RegExUtils.replaceAll(template, "\\$\\{" + k + "}", "未设置");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return template;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void send(MessageDetail messageDetail, NoticeModel noticeModel) {
|
public void send(MessageDetail messageDetail, NoticeModel noticeModel) {
|
||||||
String context = super.getHtmlContext(messageDetail, noticeModel);
|
String context = super.getHtmlContext(messageDetail, noticeModel);
|
||||||
|
|
|
@ -2,7 +2,6 @@ package io.metersphere.notice.service;
|
||||||
|
|
||||||
import com.alibaba.nacos.client.utils.StringUtils;
|
import com.alibaba.nacos.client.utils.StringUtils;
|
||||||
import io.metersphere.commons.constants.NoticeConstants;
|
import io.metersphere.commons.constants.NoticeConstants;
|
||||||
import io.metersphere.commons.utils.CommonBeanFactory;
|
|
||||||
import io.metersphere.notice.domain.MessageDetail;
|
import io.metersphere.notice.domain.MessageDetail;
|
||||||
import io.metersphere.notice.sender.NoticeModel;
|
import io.metersphere.notice.sender.NoticeModel;
|
||||||
import io.metersphere.notice.sender.NoticeSender;
|
import io.metersphere.notice.sender.NoticeSender;
|
||||||
|
@ -22,10 +21,8 @@ public class NoticeSendService {
|
||||||
private WeComNoticeSender weComNoticeSender;
|
private WeComNoticeSender weComNoticeSender;
|
||||||
@Resource
|
@Resource
|
||||||
private DingNoticeSender dingNoticeSender;
|
private DingNoticeSender dingNoticeSender;
|
||||||
|
@Resource
|
||||||
private void event(String event) {
|
private NoticeService noticeService;
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private NoticeSender getNoticeSender(MessageDetail messageDetail) {
|
private NoticeSender getNoticeSender(MessageDetail messageDetail) {
|
||||||
NoticeSender noticeSender = null;
|
NoticeSender noticeSender = null;
|
||||||
|
@ -47,8 +44,6 @@ public class NoticeSendService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void send(String taskType, NoticeModel noticeModel) {
|
public void send(String taskType, NoticeModel noticeModel) {
|
||||||
NoticeService noticeService = CommonBeanFactory.getBean(NoticeService.class);
|
|
||||||
assert noticeService != null;
|
|
||||||
List<MessageDetail> messageDetails;
|
List<MessageDetail> messageDetails;
|
||||||
switch (taskType) {
|
switch (taskType) {
|
||||||
case NoticeConstants.Mode.API:
|
case NoticeConstants.Mode.API:
|
||||||
|
|
|
@ -33,14 +33,17 @@ public class NoticeService {
|
||||||
SessionUser user = SessionUtils.getUser();
|
SessionUser user = SessionUtils.getUser();
|
||||||
String orgId = user.getLastOrganizationId();
|
String orgId = user.getLastOrganizationId();
|
||||||
long time = System.currentTimeMillis();
|
long time = System.currentTimeMillis();
|
||||||
String identification = UUID.randomUUID().toString();
|
String identification = messageDetail.getIdentification();
|
||||||
messageDetail.getUserIds().forEach(m -> {
|
if (StringUtils.isBlank(identification)) {
|
||||||
checkUserIdExist(m, messageDetail, orgId);
|
identification = UUID.randomUUID().toString();
|
||||||
|
}
|
||||||
|
for (String userId : messageDetail.getUserIds()) {
|
||||||
|
checkUserIdExist(userId, messageDetail, orgId);
|
||||||
MessageTask messageTask = new MessageTask();
|
MessageTask messageTask = new MessageTask();
|
||||||
messageTask.setId(UUID.randomUUID().toString());
|
messageTask.setId(UUID.randomUUID().toString());
|
||||||
messageTask.setEvent(messageDetail.getEvent());
|
messageTask.setEvent(messageDetail.getEvent());
|
||||||
messageTask.setTaskType(messageDetail.getTaskType());
|
messageTask.setTaskType(messageDetail.getTaskType());
|
||||||
messageTask.setUserId(m);
|
messageTask.setUserId(userId);
|
||||||
messageTask.setType(messageDetail.getType());
|
messageTask.setType(messageDetail.getType());
|
||||||
messageTask.setWebhook(messageDetail.getWebhook());
|
messageTask.setWebhook(messageDetail.getWebhook());
|
||||||
messageTask.setIdentification(identification);
|
messageTask.setIdentification(identification);
|
||||||
|
@ -48,8 +51,15 @@ public class NoticeService {
|
||||||
messageTask.setOrganizationId(orgId);
|
messageTask.setOrganizationId(orgId);
|
||||||
messageTask.setTestId(messageDetail.getTestId());
|
messageTask.setTestId(messageDetail.getTestId());
|
||||||
messageTask.setCreateTime(time);
|
messageTask.setCreateTime(time);
|
||||||
|
setTemplate(messageDetail, messageTask);
|
||||||
messageTaskMapper.insert(messageTask);
|
messageTaskMapper.insert(messageTask);
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setTemplate(MessageDetail messageDetail, MessageTask messageTask) {
|
||||||
|
if (StringUtils.isNotBlank(messageDetail.getTemplate())) {
|
||||||
|
messageTask.setTemplate(messageDetail.getTemplate());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkUserIdExist(String userId, MessageDetail list, String orgId) {
|
private void checkUserIdExist(String userId, MessageDetail list, String orgId) {
|
||||||
|
@ -80,7 +90,7 @@ public class NoticeService {
|
||||||
public List<MessageDetail> searchMessageByTestId(String testId) {
|
public List<MessageDetail> searchMessageByTestId(String testId) {
|
||||||
MessageTaskExample example = new MessageTaskExample();
|
MessageTaskExample example = new MessageTaskExample();
|
||||||
example.createCriteria().andTestIdEqualTo(testId);
|
example.createCriteria().andTestIdEqualTo(testId);
|
||||||
List<MessageTask> messageTaskLists = messageTaskMapper.selectByExample(example);
|
List<MessageTask> messageTaskLists = messageTaskMapper.selectByExampleWithBLOBs(example);
|
||||||
List<MessageDetail> scheduleMessageTask = new ArrayList<>();
|
List<MessageDetail> scheduleMessageTask = new ArrayList<>();
|
||||||
Map<String, List<MessageTask>> MessageTaskMap = messageTaskLists.stream().collect(Collectors.groupingBy(MessageTask::getIdentification));
|
Map<String, List<MessageTask>> MessageTaskMap = messageTaskLists.stream().collect(Collectors.groupingBy(MessageTask::getIdentification));
|
||||||
MessageTaskMap.forEach((k, v) -> {
|
MessageTaskMap.forEach((k, v) -> {
|
||||||
|
@ -100,7 +110,7 @@ public class NoticeService {
|
||||||
example.createCriteria()
|
example.createCriteria()
|
||||||
.andTaskTypeEqualTo(type)
|
.andTaskTypeEqualTo(type)
|
||||||
.andOrganizationIdEqualTo(orgId);
|
.andOrganizationIdEqualTo(orgId);
|
||||||
List<MessageTask> messageTaskLists = messageTaskMapper.selectByExample(example);
|
List<MessageTask> messageTaskLists = messageTaskMapper.selectByExampleWithBLOBs(example);
|
||||||
|
|
||||||
Map<String, List<MessageTask>> messageTaskMap = messageTaskLists.stream()
|
Map<String, List<MessageTask>> messageTaskMap = messageTaskLists.stream()
|
||||||
.collect(Collectors.groupingBy(NoticeService::fetchGroupKey));
|
.collect(Collectors.groupingBy(NoticeService::fetchGroupKey));
|
||||||
|
@ -130,6 +140,7 @@ public class NoticeService {
|
||||||
messageDetail.setType(m.getType());
|
messageDetail.setType(m.getType());
|
||||||
messageDetail.setIsSet(m.getIsSet());
|
messageDetail.setIsSet(m.getIsSet());
|
||||||
messageDetail.setCreateTime(m.getCreateTime());
|
messageDetail.setCreateTime(m.getCreateTime());
|
||||||
|
messageDetail.setTemplate(m.getTemplate());
|
||||||
}
|
}
|
||||||
if (CollectionUtils.isNotEmpty(userIds)) {
|
if (CollectionUtils.isNotEmpty(userIds)) {
|
||||||
messageDetail.setUserIds(new ArrayList<>(userIds));
|
messageDetail.setUserIds(new ArrayList<>(userIds));
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit bb494fc68a2367359c9048fa7250c7618de4afb6
|
Subproject commit 905ca8af61ce966d26109e9c5c8c0aee3ca1324e
|
|
@ -0,0 +1,13 @@
|
||||||
|
ALTER TABLE message_task
|
||||||
|
MODIFY identification varchar(50) NOT NULL;
|
||||||
|
|
||||||
|
ALTER TABLE message_task
|
||||||
|
MODIFY organization_id varchar(50) NULL;
|
||||||
|
|
||||||
|
ALTER TABLE message_task
|
||||||
|
MODIFY test_id varchar(50) NULL;
|
||||||
|
|
||||||
|
ALTER TABLE message_task
|
||||||
|
ADD template TEXT NULL;
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS notice;
|
|
@ -213,10 +213,4 @@ export default {
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/deep/ .el-select__tags {
|
|
||||||
flex-wrap: unset;
|
|
||||||
overflow: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
:cell-style="rowClass"
|
:cell-style="rowClass"
|
||||||
:header-cell-style="headClass"
|
:header-cell-style="headClass"
|
||||||
>
|
>
|
||||||
<el-table-column :label="$t('schedule.event')" min-width="20%" prop="events">
|
<el-table-column :label="$t('schedule.event')" min-width="15%" prop="events">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-select v-model="scope.row.event" :placeholder="$t('organization.message.select_events')" size="mini"
|
<el-select v-model="scope.row.event" :placeholder="$t('organization.message.select_events')" size="mini"
|
||||||
prop="event" :disabled="!scope.row.isSet">
|
prop="event" :disabled="!scope.row.isSet">
|
||||||
|
@ -64,8 +64,16 @@
|
||||||
:disabled="!scope.row.isSet||!scope.row.isReadOnly"></el-input>
|
:disabled="!scope.row.isSet||!scope.row.isReadOnly"></el-input>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="$t('commons.operating')" min-width="20%" prop="result">
|
<el-table-column :label="$t('commons.operating')" min-width="25%" prop="result">
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
size="mini"
|
||||||
|
v-if="scope.row.isSet"
|
||||||
|
v-xpack
|
||||||
|
@click="handleTemplate(scope.$index,scope.row)"
|
||||||
|
>{{ $t('organization.message.template') }}
|
||||||
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
size="mini"
|
size="mini"
|
||||||
|
@ -98,14 +106,22 @@
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
<notice-template v-xpack ref="noticeTemplate"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import {hasLicense} from "@/common/js/utils";
|
||||||
|
|
||||||
const TASK_TYPE = 'DEFECT_TASK';
|
const TASK_TYPE = 'DEFECT_TASK';
|
||||||
|
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
|
||||||
|
const noticeTemplate = requireComponent.keys().length > 0 ? requireComponent("./notice/NoticeTemplate.vue") : {};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "DefectTaskNotification",
|
name: "DefectTaskNotification",
|
||||||
|
components: {
|
||||||
|
"NoticeTemplate": noticeTemplate.default
|
||||||
|
},
|
||||||
props: {
|
props: {
|
||||||
defectReceiverOptions: {
|
defectReceiverOptions: {
|
||||||
type: Array
|
type: Array
|
||||||
|
@ -211,6 +227,11 @@ export default {
|
||||||
},
|
},
|
||||||
headClass() {
|
headClass() {
|
||||||
return "text-align:center;background:'#ededed'"
|
return "text-align:center;background:'#ededed'"
|
||||||
|
},
|
||||||
|
handleTemplate(index, row) {
|
||||||
|
if (hasLicense()) {
|
||||||
|
this.$refs.noticeTemplate.open(row);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,22 +11,22 @@
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-table
|
<el-table
|
||||||
:data="jenkinsTask"
|
:data="jenkinsTask"
|
||||||
class="tb-edit"
|
class="tb-edit"
|
||||||
border
|
border
|
||||||
:cell-style="rowClass"
|
:cell-style="rowClass"
|
||||||
:header-cell-style="headClass">
|
:header-cell-style="headClass">
|
||||||
<el-table-column :label="$t('schedule.event')" min-width="20%" prop="events">
|
<el-table-column :label="$t('schedule.event')" min-width="15%" prop="events">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-select v-model="scope.row.event"
|
<el-select v-model="scope.row.event"
|
||||||
:placeholder="$t('organization.message.select_events')"
|
:placeholder="$t('organization.message.select_events')"
|
||||||
size="mini"
|
size="mini"
|
||||||
prop="events" :disabled="!scope.row.isSet">
|
prop="events" :disabled="!scope.row.isSet">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in jenkinsEventOptions"
|
v-for="item in jenkinsEventOptions"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
:label="item.label"
|
:label="item.label"
|
||||||
:value="item.value">
|
:value="item.value">
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</template>
|
</template>
|
||||||
|
@ -36,10 +36,10 @@
|
||||||
<el-select v-model="row.userIds" filterable multiple size="mini"
|
<el-select v-model="row.userIds" filterable multiple size="mini"
|
||||||
:placeholder="$t('commons.please_select')" style="width: 100%;" :disabled="!row.isSet">
|
:placeholder="$t('commons.please_select')" style="width: 100%;" :disabled="!row.isSet">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in jenkinsReceiverOptions"
|
v-for="item in jenkinsReceiverOptions"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.name"
|
:label="item.name"
|
||||||
:value="item.id">
|
:value="item.id">
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</template>
|
</template>
|
||||||
|
@ -51,10 +51,10 @@
|
||||||
:disabled="!scope.row.isSet" @change="handleEdit(scope.$index, scope.row)"
|
:disabled="!scope.row.isSet" @change="handleEdit(scope.$index, scope.row)"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in receiveTypeOptions"
|
v-for="item in receiveTypeOptions"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
:label="item.label"
|
:label="item.label"
|
||||||
:value="item.value">
|
:value="item.value">
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</template>
|
</template>
|
||||||
|
@ -66,48 +66,65 @@
|
||||||
:disabled="!scope.row.isSet||!scope.row.isReadOnly"></el-input>
|
:disabled="!scope.row.isSet||!scope.row.isReadOnly"></el-input>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="$t('commons.operating')" min-width="20%" prop="result">
|
<el-table-column :label="$t('commons.operating')" min-width="25%" prop="result">
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="success"
|
||||||
size="mini"
|
size="mini"
|
||||||
v-show="scope.row.isSet"
|
v-if="scope.row.isSet"
|
||||||
@click="handleAddTask(scope.$index,scope.row)"
|
v-xpack
|
||||||
|
@click="handleTemplate(scope.$index,scope.row)"
|
||||||
|
>{{ $t('organization.message.template') }}
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
size="mini"
|
||||||
|
v-if="scope.row.isSet"
|
||||||
|
@click="handleAddTask(scope.$index,scope.row)"
|
||||||
>{{ $t('commons.add') }}
|
>{{ $t('commons.add') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
v-show="scope.row.isSet"
|
v-if="scope.row.isSet"
|
||||||
@click.native.prevent="removeRowTask(scope.$index,jenkinsTask)"
|
@click.native.prevent="removeRowTask(scope.$index,jenkinsTask)"
|
||||||
>{{ $t('commons.cancel') }}
|
>{{ $t('commons.cancel') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
size="mini"
|
size="mini"
|
||||||
v-show="!scope.row.isSet"
|
v-if="!scope.row.isSet"
|
||||||
@click="handleEditTask(scope.$index,scope.row)"
|
@click="handleEditTask(scope.$index,scope.row)"
|
||||||
>{{ $t('commons.edit') }}
|
>{{ $t('commons.edit') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
type="danger"
|
type="danger"
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
size="mini"
|
size="mini"
|
||||||
v-show="!scope.row.isSet"
|
v-show="!scope.row.isSet"
|
||||||
@click.native.prevent="deleteRowTask(scope.$index,scope.row)"
|
@click.native.prevent="deleteRowTask(scope.$index,scope.row)"
|
||||||
></el-button>
|
></el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
<notice-template v-xpack ref="noticeTemplate"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import {hasLicense} from "@/common/js/utils";
|
||||||
|
|
||||||
const TASK_TYPE = 'JENKINS_TASK';
|
const TASK_TYPE = 'JENKINS_TASK';
|
||||||
|
|
||||||
|
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
|
||||||
|
const noticeTemplate = requireComponent.keys().length > 0 ? requireComponent("./notice/NoticeTemplate.vue") : {};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "JenkinsNotification",
|
name: "JenkinsNotification",
|
||||||
|
components: {
|
||||||
|
"NoticeTemplate": noticeTemplate.default
|
||||||
|
},
|
||||||
props: {
|
props: {
|
||||||
jenkinsReceiverOptions: {
|
jenkinsReceiverOptions: {
|
||||||
type: Array
|
type: Array
|
||||||
|
@ -187,7 +204,6 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
data.isReadOnly = true;
|
data.isReadOnly = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
addTask(data) {
|
addTask(data) {
|
||||||
this.result = this.$post("/notice/save/message/task", data, () => {
|
this.result = this.$post("/notice/save/message/task", data, () => {
|
||||||
|
@ -215,6 +231,11 @@ export default {
|
||||||
headClass() {
|
headClass() {
|
||||||
return "text-align:center;background:'#ededed'"
|
return "text-align:center;background:'#ededed'"
|
||||||
},
|
},
|
||||||
|
handleTemplate(index, row) {
|
||||||
|
if (hasLicense()) {
|
||||||
|
this.$refs.noticeTemplate.open(row);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -14,12 +14,11 @@
|
||||||
:data="scheduleTask"
|
:data="scheduleTask"
|
||||||
class="tb-edit"
|
class="tb-edit"
|
||||||
border
|
border
|
||||||
size="mini"
|
|
||||||
:cell-style="rowClass"
|
:cell-style="rowClass"
|
||||||
:header-cell-style="headClass">
|
:header-cell-style="headClass">
|
||||||
<el-table-column :label="$t('schedule.event')" min-width="20%" prop="events">
|
<el-table-column :label="$t('schedule.event')" prop="events" min-width="15%">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-select v-model="scope.row.event"
|
<el-select v-model="scope.row.event" size="mini"
|
||||||
:placeholder="$t('organization.message.select_events')"
|
:placeholder="$t('organization.message.select_events')"
|
||||||
prop="events" :disabled="!scope.row.isSet">
|
prop="events" :disabled="!scope.row.isSet">
|
||||||
<el-option
|
<el-option
|
||||||
|
@ -33,7 +32,7 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="$t('schedule.receiver')" prop="userIds" min-width="20%">
|
<el-table-column :label="$t('schedule.receiver')" prop="userIds" min-width="20%">
|
||||||
<template v-slot:default="{row}">
|
<template v-slot:default="{row}">
|
||||||
<el-select v-model="row.userIds" filterable multiple
|
<el-select v-model="row.userIds" filterable multiple size="mini"
|
||||||
:placeholder="$t('commons.please_select')" style="width: 100%;" :disabled="!row.isSet">
|
:placeholder="$t('commons.please_select')" style="width: 100%;" :disabled="!row.isSet">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in scheduleReceiverOptions"
|
v-for="item in scheduleReceiverOptions"
|
||||||
|
@ -44,9 +43,10 @@
|
||||||
</el-select>
|
</el-select>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="$t('schedule.receiving_mode')" min-width="20%" prop="type">
|
<el-table-column :label="$t('schedule.receiving_mode')" prop="type" min-width="15%">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-select v-model="scope.row.type" :placeholder="$t('organization.message.select_receiving_method')"
|
<el-select v-model="scope.row.type" :placeholder="$t('organization.message.select_receiving_method')"
|
||||||
|
size="mini"
|
||||||
:disabled="!scope.row.isSet" @change="handleEdit(scope.$index, scope.row)"
|
:disabled="!scope.row.isSet" @change="handleEdit(scope.$index, scope.row)"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
|
@ -60,12 +60,20 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="webhook" min-width="20%" prop="webhook">
|
<el-table-column label="webhook" min-width="20%" prop="webhook">
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
<el-input v-model="scope.row.webhook" placeholder="webhook地址"
|
<el-input v-model="scope.row.webhook" placeholder="webhook地址" size="mini"
|
||||||
:disabled="!scope.row.isSet||!scope.row.isReadOnly"></el-input>
|
:disabled="!scope.row.isSet||!scope.row.isReadOnly"></el-input>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="$t('commons.operating')" min-width="20%" prop="result">
|
<el-table-column :label="$t('commons.operating')" prop="result" min-width="20%">
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
size="mini"
|
||||||
|
v-if="scope.row.isSet"
|
||||||
|
v-xpack
|
||||||
|
@click="handleTemplate(scope.$index,scope.row)"
|
||||||
|
>{{ $t('organization.message.template') }}
|
||||||
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
size="mini"
|
size="mini"
|
||||||
|
@ -102,13 +110,21 @@
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
<notice-template v-xpack ref="noticeTemplate"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import {hasLicense} from "@/common/js/utils";
|
||||||
|
|
||||||
|
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
|
||||||
|
const noticeTemplate = requireComponent.keys().length > 0 ? requireComponent("./notice/NoticeTemplate.vue") : {};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ScheduleTaskNotification",
|
name: "ScheduleTaskNotification",
|
||||||
|
components: {
|
||||||
|
"NoticeTemplate": noticeTemplate.default
|
||||||
|
},
|
||||||
props: {
|
props: {
|
||||||
testId: String,
|
testId: String,
|
||||||
scheduleReceiverOptions: Array,
|
scheduleReceiverOptions: Array,
|
||||||
|
@ -226,6 +242,11 @@ export default {
|
||||||
headClass() {
|
headClass() {
|
||||||
return "text-align:center;background:'#ededed'"
|
return "text-align:center;background:'#ededed'"
|
||||||
},
|
},
|
||||||
|
handleTemplate(index, row) {
|
||||||
|
if (hasLicense()) {
|
||||||
|
this.$refs.noticeTemplate.open(row);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
:cell-style="rowClass"
|
:cell-style="rowClass"
|
||||||
:header-cell-style="headClass"
|
:header-cell-style="headClass"
|
||||||
>
|
>
|
||||||
<el-table-column :label="$t('schedule.event')" min-width="20%" prop="events">
|
<el-table-column :label="$t('schedule.event')" min-width="15%" prop="events">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-select v-model="scope.row.event" :placeholder="$t('organization.message.select_events')"
|
<el-select v-model="scope.row.event" :placeholder="$t('organization.message.select_events')"
|
||||||
@change="handleTestPlanReceivers(scope.row)" size="mini"
|
@change="handleTestPlanReceivers(scope.row)" size="mini"
|
||||||
|
@ -64,8 +64,16 @@
|
||||||
:disabled="!scope.row.isSet||!scope.row.isReadOnly"></el-input>
|
:disabled="!scope.row.isSet||!scope.row.isReadOnly"></el-input>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="$t('commons.operating')" min-width="20%" prop="result">
|
<el-table-column :label="$t('commons.operating')" min-width="25%" prop="result">
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
size="mini"
|
||||||
|
v-if="scope.row.isSet"
|
||||||
|
v-xpack
|
||||||
|
@click="handleTemplate(scope.$index,scope.row)"
|
||||||
|
>{{ $t('organization.message.template') }}
|
||||||
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
size="mini"
|
size="mini"
|
||||||
|
@ -98,15 +106,23 @@
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
<notice-template v-xpack ref="noticeTemplate"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import {hasLicense} from "@/common/js/utils";
|
||||||
|
|
||||||
const TASK_TYPE = 'TEST_PLAN_TASK';
|
const TASK_TYPE = 'TEST_PLAN_TASK';
|
||||||
|
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
|
||||||
|
const noticeTemplate = requireComponent.keys().length > 0 ? requireComponent("./notice/NoticeTemplate.vue") : {};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "TestPlanTaskNotification",
|
name: "TestPlanTaskNotification",
|
||||||
|
components: {
|
||||||
|
"NoticeTemplate": noticeTemplate.default
|
||||||
|
},
|
||||||
props: {
|
props: {
|
||||||
testPlanReceiverOptions: {
|
testPlanReceiverOptions: {
|
||||||
type: Array
|
type: Array
|
||||||
|
@ -231,6 +247,11 @@ export default {
|
||||||
}
|
}
|
||||||
row.testPlanReceiverOptions = testPlanReceivers;
|
row.testPlanReceiverOptions = testPlanReceivers;
|
||||||
},
|
},
|
||||||
|
handleTemplate(index, row) {
|
||||||
|
if (hasLicense()) {
|
||||||
|
this.$refs.noticeTemplate.open(row);
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
testPlanReceiverOptions(value) {
|
testPlanReceiverOptions(value) {
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
:cell-style="rowClass"
|
:cell-style="rowClass"
|
||||||
:header-cell-style="headClass"
|
:header-cell-style="headClass"
|
||||||
>
|
>
|
||||||
<el-table-column :label="$t('schedule.event')" min-width="20%" prop="events">
|
<el-table-column :label="$t('schedule.event')" min-width="15%" prop="events">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-select v-model="scope.row.event" :placeholder="$t('organization.message.select_events')" size="mini"
|
<el-select v-model="scope.row.event" :placeholder="$t('organization.message.select_events')" size="mini"
|
||||||
@change="handleReviewReceivers(scope.row)"
|
@change="handleReviewReceivers(scope.row)"
|
||||||
|
@ -65,8 +65,16 @@
|
||||||
:disabled="!scope.row.isSet||!scope.row.isReadOnly"></el-input>
|
:disabled="!scope.row.isSet||!scope.row.isReadOnly"></el-input>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="$t('commons.operating')" min-width="20%" prop="result">
|
<el-table-column :label="$t('commons.operating')" min-width="25%" prop="result">
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
size="mini"
|
||||||
|
v-if="scope.row.isSet"
|
||||||
|
v-xpack
|
||||||
|
@click="handleTemplate(scope.$index,scope.row)"
|
||||||
|
>{{ $t('organization.message.template') }}
|
||||||
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
size="mini"
|
size="mini"
|
||||||
|
@ -99,14 +107,22 @@
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
<notice-template v-xpack ref="noticeTemplate"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import {hasLicense} from "@/common/js/utils";
|
||||||
|
|
||||||
const TASK_TYPE = 'REVIEW_TASK';
|
const TASK_TYPE = 'REVIEW_TASK';
|
||||||
|
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
|
||||||
|
const noticeTemplate = requireComponent.keys().length > 0 ? requireComponent("./notice/NoticeTemplate.vue") : {};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "TestReviewNotification",
|
name: "TestReviewNotification",
|
||||||
|
components: {
|
||||||
|
"NoticeTemplate": noticeTemplate.default
|
||||||
|
},
|
||||||
props: {
|
props: {
|
||||||
reviewReceiverOptions: {
|
reviewReceiverOptions: {
|
||||||
type: Array
|
type: Array
|
||||||
|
@ -236,6 +252,11 @@ export default {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
row.reviewReceiverOptions = reviewReceiverOptions;
|
row.reviewReceiverOptions = reviewReceiverOptions;
|
||||||
|
},
|
||||||
|
handleTemplate(index, row) {
|
||||||
|
if (hasLicense()) {
|
||||||
|
this.$refs.noticeTemplate.open(row);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit a22a3005d9bd254793fcf634d72539cbdf31be3a
|
Subproject commit 29a8fc09602fde5708af06582ac972d98eb69836
|
|
@ -244,7 +244,8 @@ export default {
|
||||||
'3. When selecting the receiver, it must be the person included in the group you created. The mobile phone number of the receiver is required and it is the mobile phone number used by the nailing enterprise,',
|
'3. When selecting the receiver, it must be the person included in the group you created. The mobile phone number of the receiver is required and it is the mobile phone number used by the nailing enterprise,',
|
||||||
message: 'Event, receiver and receiving method are required\n' +
|
message: 'Event, receiver and receiving method are required\n' +
|
||||||
'\n',
|
'\n',
|
||||||
message_webhook: 'Webhook is required when the receiving mode is nail or enterprise robot'
|
message_webhook: 'Webhook is required when the receiving mode is nail or enterprise robot',
|
||||||
|
template: "Template"
|
||||||
},
|
},
|
||||||
integration: {
|
integration: {
|
||||||
select_defect_platform: 'Please select the defect management platform to be integrated:',
|
select_defect_platform: 'Please select the defect management platform to be integrated:',
|
||||||
|
|
|
@ -242,9 +242,8 @@ export default {
|
||||||
' 2.机器人选择为群机器人,安全验证选择“自定义关键词” :"任务通知";\n' +
|
' 2.机器人选择为群机器人,安全验证选择“自定义关键词” :"任务通知";\n' +
|
||||||
' 3.选择接收人时必须是你所建的群里包含的人,接收人手机号为必填项且为钉钉企业所使用的手机号,',
|
' 3.选择接收人时必须是你所建的群里包含的人,接收人手机号为必填项且为钉钉企业所使用的手机号,',
|
||||||
message: '事件,接收人,接收方式为必填项',
|
message: '事件,接收人,接收方式为必填项',
|
||||||
message_webhook: '接收方式为钉钉和企业机器人时,webhook为必填项'
|
message_webhook: '接收方式为钉钉和企业机器人时,webhook为必填项',
|
||||||
|
template: "模版"
|
||||||
|
|
||||||
},
|
},
|
||||||
integration: {
|
integration: {
|
||||||
select_defect_platform: '请选择要集成的缺陷管理平台:',
|
select_defect_platform: '请选择要集成的缺陷管理平台:',
|
||||||
|
|
|
@ -242,9 +242,8 @@ export default {
|
||||||
' 2.接收方式除郵件外webhook為必填;\n' +
|
' 2.接收方式除郵件外webhook為必填;\n' +
|
||||||
' 3.機器人選擇為群機器人,安全驗證選擇“自定義關鍵詞” :"任務通知"',
|
' 3.機器人選擇為群機器人,安全驗證選擇“自定義關鍵詞” :"任務通知"',
|
||||||
message: '事件,接收人,接收方式為必填項',
|
message: '事件,接收人,接收方式為必填項',
|
||||||
message_webhook: '接收方式為釘釘和企業機器人時,webhook為必填項'
|
message_webhook: '接收方式為釘釘和企業機器人時,webhook為必填項',
|
||||||
|
template: "模版"
|
||||||
|
|
||||||
},
|
},
|
||||||
integration: {
|
integration: {
|
||||||
select_defect_platform: '請選擇要集成的缺陷管理平臺:',
|
select_defect_platform: '請選擇要集成的缺陷管理平臺:',
|
||||||
|
|
Loading…
Reference in New Issue