Merge branch 'v1.4'
This commit is contained in:
commit
e59926abee
|
@ -178,55 +178,45 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl
|
|||
List<NoticeDetail> noticeList = noticeService.queryNotice(testResult.getTestId());
|
||||
mailService.sendApiNotification(report, noticeList);
|
||||
}
|
||||
if (StringUtils.equals(NoticeConstants.API, report.getTriggerMode())) {
|
||||
if (StringUtils.equals(NoticeConstants.API, "API")) {
|
||||
List<String> userIds = new ArrayList<>();
|
||||
MessageSettingDetail messageSettingDetail = noticeService.searchMessage();
|
||||
List<MessageDetail> taskList = messageSettingDetail.getJenkinsTask();
|
||||
if (StringUtils.equals(report.getStatus(), "Success")) {
|
||||
|
||||
}
|
||||
String contextSuccess = report.getName() + "执行成功";
|
||||
;
|
||||
String contextFailed = report.getName() + "执行失败";
|
||||
String contextSuccess = "jenkins任务通知" + report.getName() + "执行成功";
|
||||
String contextFailed = "jenkins任务通知" + report.getName() + "执行失败";
|
||||
taskList.forEach(r -> {
|
||||
switch (r.getType()) {
|
||||
case NoticeConstants.NAIL_ROBOT:
|
||||
r.getEvents().forEach(e -> {
|
||||
if (StringUtils.equals(NoticeConstants.EXECUTE_SUCCESSFUL, e) && StringUtils.equals(report.getStatus(), "Success")) {
|
||||
dingTaskService.sendNailRobot(r, userIds, contextSuccess, NoticeConstants.EXECUTE_SUCCESSFUL);
|
||||
}
|
||||
if (StringUtils.equals(NoticeConstants.EXECUTE_FAILED, e) && StringUtils.equals(report.getStatus(), "Error")) {
|
||||
dingTaskService.sendNailRobot(r, userIds, contextFailed, NoticeConstants.EXECUTE_FAILED);
|
||||
}
|
||||
});
|
||||
if (StringUtils.equals(NoticeConstants.EXECUTE_SUCCESSFUL, r.getEvent()) && StringUtils.equals(report.getStatus(), "Success")) {
|
||||
dingTaskService.sendNailRobot(r, userIds, contextSuccess, NoticeConstants.EXECUTE_SUCCESSFUL);
|
||||
}
|
||||
if (StringUtils.equals(NoticeConstants.EXECUTE_FAILED, r.getEvent()) && StringUtils.equals(report.getStatus(), "Error")) {
|
||||
dingTaskService.sendNailRobot(r, userIds, contextFailed, NoticeConstants.EXECUTE_FAILED);
|
||||
}
|
||||
break;
|
||||
case NoticeConstants.WECHAT_ROBOT:
|
||||
r.getEvents().forEach(e -> {
|
||||
if (StringUtils.equals(NoticeConstants.EXECUTE_SUCCESSFUL, e) && StringUtils.equals(report.getStatus(), "Success")) {
|
||||
if (StringUtils.equals(NoticeConstants.EXECUTE_SUCCESSFUL, r.getEvent()) && StringUtils.equals(report.getStatus(), "Success")) {
|
||||
wxChatTaskService.sendWechatRobot(r, userIds, contextSuccess, NoticeConstants.EXECUTE_SUCCESSFUL);
|
||||
}
|
||||
if (StringUtils.equals(NoticeConstants.EXECUTE_FAILED, e) && StringUtils.equals(report.getStatus(), "Error")) {
|
||||
if (StringUtils.equals(NoticeConstants.EXECUTE_FAILED, r.getEvent()) && StringUtils.equals(report.getStatus(), "Error")) {
|
||||
wxChatTaskService.sendWechatRobot(r, userIds, contextFailed, NoticeConstants.EXECUTE_FAILED);
|
||||
}
|
||||
});
|
||||
break;
|
||||
case NoticeConstants.EMAIL:
|
||||
r.getEvents().forEach(e -> {
|
||||
if (StringUtils.equals(NoticeConstants.EXECUTE_SUCCESSFUL, e) && StringUtils.equals(report.getStatus(), "Success")) {
|
||||
if (StringUtils.equals(NoticeConstants.EXECUTE_SUCCESSFUL, r.getEvent()) && StringUtils.equals(report.getStatus(), "Success")) {
|
||||
try {
|
||||
mailService.sendApiJenkinsNotification(contextSuccess, r);
|
||||
} catch (MessagingException messagingException) {
|
||||
messagingException.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (StringUtils.equals(NoticeConstants.EXECUTE_FAILED, e) && StringUtils.equals(report.getStatus(), "Error")) {
|
||||
if (StringUtils.equals(NoticeConstants.EXECUTE_FAILED, r.getEvent()) && StringUtils.equals(report.getStatus(), "Error")) {
|
||||
try {
|
||||
mailService.sendApiJenkinsNotification(contextFailed, r);
|
||||
} catch (MessagingException messagingException) {
|
||||
messagingException.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -21,5 +21,7 @@ public class MessageTask implements Serializable {
|
|||
|
||||
private Boolean isSet;
|
||||
|
||||
private String organizationId;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -653,6 +653,76 @@ public class MessageTaskExample {
|
|||
addCriterion("is_set not between", value1, value2, "isSet");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrganizationIdIsNull() {
|
||||
addCriterion("organization_id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrganizationIdIsNotNull() {
|
||||
addCriterion("organization_id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrganizationIdEqualTo(String value) {
|
||||
addCriterion("organization_id =", value, "organizationId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrganizationIdNotEqualTo(String value) {
|
||||
addCriterion("organization_id <>", value, "organizationId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrganizationIdGreaterThan(String value) {
|
||||
addCriterion("organization_id >", value, "organizationId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrganizationIdGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("organization_id >=", value, "organizationId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrganizationIdLessThan(String value) {
|
||||
addCriterion("organization_id <", value, "organizationId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrganizationIdLessThanOrEqualTo(String value) {
|
||||
addCriterion("organization_id <=", value, "organizationId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrganizationIdLike(String value) {
|
||||
addCriterion("organization_id like", value, "organizationId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrganizationIdNotLike(String value) {
|
||||
addCriterion("organization_id not like", value, "organizationId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrganizationIdIn(List<String> values) {
|
||||
addCriterion("organization_id in", values, "organizationId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrganizationIdNotIn(List<String> values) {
|
||||
addCriterion("organization_id not in", values, "organizationId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrganizationIdBetween(String value1, String value2) {
|
||||
addCriterion("organization_id between", value1, value2, "organizationId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrganizationIdNotBetween(String value1, String value2) {
|
||||
addCriterion("organization_id not between", value1, value2, "organizationId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
package io.metersphere.base.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TestPlan implements Serializable {
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
<result column="task_type" jdbcType="VARCHAR" property="taskType" />
|
||||
<result column="webhook" jdbcType="VARCHAR" property="webhook" />
|
||||
<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" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<where>
|
||||
|
@ -70,7 +71,7 @@
|
|||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, `type`, event, user_id, task_type, webhook, identification, is_set
|
||||
id, `type`, event, user_id, task_type, webhook, identification, is_set, organization_id
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="io.metersphere.base.domain.MessageTaskExample" resultMap="BaseResultMap">
|
||||
select
|
||||
|
@ -103,12 +104,14 @@
|
|||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="io.metersphere.base.domain.MessageTask">
|
||||
insert into message_task (id, `type`, event,
|
||||
user_id, task_type, webhook,
|
||||
identification, is_set)
|
||||
values (#{id,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{event,jdbcType=VARCHAR},
|
||||
#{userId,jdbcType=VARCHAR}, #{taskType,jdbcType=VARCHAR}, #{webhook,jdbcType=VARCHAR},
|
||||
#{identification,jdbcType=VARCHAR}, #{isSet,jdbcType=BIT})
|
||||
insert into message_task (id, `type`, event,
|
||||
user_id, task_type, webhook,
|
||||
identification, is_set, organization_id
|
||||
)
|
||||
values (#{id,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{event,jdbcType=VARCHAR},
|
||||
#{userId,jdbcType=VARCHAR}, #{taskType,jdbcType=VARCHAR}, #{webhook,jdbcType=VARCHAR},
|
||||
#{identification,jdbcType=VARCHAR}, #{isSet,jdbcType=BIT}, #{organizationId,jdbcType=VARCHAR}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.MessageTask">
|
||||
insert into message_task
|
||||
|
@ -137,6 +140,9 @@
|
|||
<if test="isSet != null">
|
||||
is_set,
|
||||
</if>
|
||||
<if test="organizationId != null">
|
||||
organization_id,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
|
@ -163,6 +169,9 @@
|
|||
<if test="isSet != null">
|
||||
#{isSet,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="organizationId != null">
|
||||
#{organizationId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="io.metersphere.base.domain.MessageTaskExample" resultType="java.lang.Long">
|
||||
|
@ -198,6 +207,9 @@
|
|||
<if test="record.isSet != null">
|
||||
is_set = #{record.isSet,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="record.organizationId != null">
|
||||
organization_id = #{record.organizationId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
|
@ -206,13 +218,14 @@
|
|||
<update id="updateByExample" 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}
|
||||
`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}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
|
@ -241,18 +254,22 @@
|
|||
<if test="isSet != null">
|
||||
is_set = #{isSet,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="organizationId != null">
|
||||
organization_id = #{organizationId,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},
|
||||
user_id = #{userId,jdbcType=VARCHAR},
|
||||
task_type = #{taskType,jdbcType=VARCHAR},
|
||||
webhook = #{webhook,jdbcType=VARCHAR},
|
||||
identification = #{identification,jdbcType=VARCHAR},
|
||||
is_set = #{isSet,jdbcType=BIT}
|
||||
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}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
</mapper>
|
|
@ -2,23 +2,23 @@
|
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="io.metersphere.base.mapper.TestPlanMapper">
|
||||
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.TestPlan">
|
||||
<id column="id" jdbcType="VARCHAR" property="id"/>
|
||||
<result column="workspace_id" jdbcType="VARCHAR" property="workspaceId"/>
|
||||
<result column="report_id" jdbcType="VARCHAR" property="reportId"/>
|
||||
<result column="name" jdbcType="VARCHAR" property="name"/>
|
||||
<result column="description" jdbcType="VARCHAR" property="description"/>
|
||||
<result column="status" jdbcType="VARCHAR" property="status"/>
|
||||
<result column="stage" jdbcType="VARCHAR" property="stage"/>
|
||||
<result column="principal" jdbcType="VARCHAR" property="principal"/>
|
||||
<result column="test_case_match_rule" jdbcType="VARCHAR" property="testCaseMatchRule"/>
|
||||
<result column="executor_match_rule" jdbcType="VARCHAR" property="executorMatchRule"/>
|
||||
<result column="create_time" jdbcType="BIGINT" property="createTime"/>
|
||||
<result column="update_time" jdbcType="BIGINT" property="updateTime"/>
|
||||
<result column="actual_end_time" jdbcType="BIGINT" property="actualEndTime"/>
|
||||
<result column="planned_start_time" jdbcType="BIGINT" property="plannedStartTime"/>
|
||||
<result column="planned_end_time" jdbcType="BIGINT" property="plannedEndTime"/>
|
||||
<result column="actual_start_time" jdbcType="BIGINT" property="actualStartTime"/>
|
||||
<result column="creator" jdbcType="VARCHAR" property="creator"/>
|
||||
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||
<result column="workspace_id" jdbcType="VARCHAR" property="workspaceId" />
|
||||
<result column="report_id" jdbcType="VARCHAR" property="reportId" />
|
||||
<result column="name" jdbcType="VARCHAR" property="name" />
|
||||
<result column="description" jdbcType="VARCHAR" property="description" />
|
||||
<result column="status" jdbcType="VARCHAR" property="status" />
|
||||
<result column="stage" jdbcType="VARCHAR" property="stage" />
|
||||
<result column="principal" jdbcType="VARCHAR" property="principal" />
|
||||
<result column="test_case_match_rule" jdbcType="VARCHAR" property="testCaseMatchRule" />
|
||||
<result column="executor_match_rule" jdbcType="VARCHAR" property="executorMatchRule" />
|
||||
<result column="create_time" jdbcType="BIGINT" property="createTime" />
|
||||
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
|
||||
<result column="actual_end_time" jdbcType="BIGINT" property="actualEndTime" />
|
||||
<result column="planned_start_time" jdbcType="BIGINT" property="plannedStartTime" />
|
||||
<result column="planned_end_time" jdbcType="BIGINT" property="plannedEndTime" />
|
||||
<result column="actual_start_time" jdbcType="BIGINT" property="actualStartTime" />
|
||||
<result column="creator" jdbcType="VARCHAR" property="creator" />
|
||||
</resultMap>
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.TestPlan">
|
||||
<result column="tags" jdbcType="LONGVARCHAR" property="tags" />
|
||||
|
@ -82,7 +82,7 @@
|
|||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, workspace_id, report_id, `name`, description, `status`, stage, principal, test_case_match_rule,
|
||||
id, workspace_id, report_id, `name`, description, `status`, stage, principal, test_case_match_rule,
|
||||
executor_match_rule, create_time, update_time, actual_end_time, planned_start_time,
|
||||
planned_end_time, actual_start_time, creator
|
||||
</sql>
|
||||
|
@ -120,8 +120,8 @@
|
|||
</if>
|
||||
</select>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
,
|
||||
<include refid="Blob_Column_List" />
|
||||
from test_plan
|
||||
|
@ -138,18 +138,20 @@
|
|||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="io.metersphere.base.domain.TestPlan">
|
||||
insert into test_plan (id, workspace_id, report_id,
|
||||
`name`, description, `status`,
|
||||
stage, principal, test_case_match_rule,
|
||||
executor_match_rule, create_time, update_time,
|
||||
actual_end_time, planned_start_time, planned_end_time,
|
||||
actual_start_time, creator, tags)
|
||||
values (#{id,jdbcType=VARCHAR}, #{workspaceId,jdbcType=VARCHAR}, #{reportId,jdbcType=VARCHAR},
|
||||
#{name,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
|
||||
#{stage,jdbcType=VARCHAR}, #{principal,jdbcType=VARCHAR}, #{testCaseMatchRule,jdbcType=VARCHAR},
|
||||
#{executorMatchRule,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
|
||||
#{actualEndTime,jdbcType=BIGINT}, #{plannedStartTime,jdbcType=BIGINT}, #{plannedEndTime,jdbcType=BIGINT},
|
||||
#{actualStartTime,jdbcType=BIGINT}, #{creator,jdbcType=VARCHAR}, #{tags,jdbcType=LONGVARCHAR})
|
||||
insert into test_plan (id, workspace_id, report_id,
|
||||
`name`, description, `status`,
|
||||
stage, principal, test_case_match_rule,
|
||||
executor_match_rule, create_time, update_time,
|
||||
actual_end_time, planned_start_time, planned_end_time,
|
||||
actual_start_time, creator, tags
|
||||
)
|
||||
values (#{id,jdbcType=VARCHAR}, #{workspaceId,jdbcType=VARCHAR}, #{reportId,jdbcType=VARCHAR},
|
||||
#{name,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
|
||||
#{stage,jdbcType=VARCHAR}, #{principal,jdbcType=VARCHAR}, #{testCaseMatchRule,jdbcType=VARCHAR},
|
||||
#{executorMatchRule,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
|
||||
#{actualEndTime,jdbcType=BIGINT}, #{plannedStartTime,jdbcType=BIGINT}, #{plannedEndTime,jdbcType=BIGINT},
|
||||
#{actualStartTime,jdbcType=BIGINT}, #{creator,jdbcType=VARCHAR}, #{tags,jdbcType=LONGVARCHAR}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestPlan">
|
||||
insert into test_plan
|
||||
|
@ -173,41 +175,41 @@
|
|||
`status`,
|
||||
</if>
|
||||
<if test="stage != null">
|
||||
stage,
|
||||
stage,
|
||||
</if>
|
||||
<if test="principal != null">
|
||||
principal,
|
||||
</if>
|
||||
<if test="testCaseMatchRule != null">
|
||||
test_case_match_rule,
|
||||
</if>
|
||||
<if test="executorMatchRule != null">
|
||||
executor_match_rule,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="actualEndTime != null">
|
||||
actual_end_time,
|
||||
</if>
|
||||
<if test="plannedStartTime != null">
|
||||
planned_start_time,
|
||||
</if>
|
||||
<if test="plannedEndTime != null">
|
||||
planned_end_time,
|
||||
</if>
|
||||
<if test="actualStartTime != null">
|
||||
actual_start_time,
|
||||
</if>
|
||||
<if test="creator != null">
|
||||
creator,
|
||||
</if>
|
||||
<if test="tags != null">
|
||||
tags,
|
||||
</if>
|
||||
<if test="principal != null">
|
||||
principal,
|
||||
</if>
|
||||
<if test="testCaseMatchRule != null">
|
||||
test_case_match_rule,
|
||||
</if>
|
||||
<if test="executorMatchRule != null">
|
||||
executor_match_rule,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="actualEndTime != null">
|
||||
actual_end_time,
|
||||
</if>
|
||||
<if test="plannedStartTime != null">
|
||||
planned_start_time,
|
||||
</if>
|
||||
<if test="plannedEndTime != null">
|
||||
planned_end_time,
|
||||
</if>
|
||||
<if test="actualStartTime != null">
|
||||
actual_start_time,
|
||||
</if>
|
||||
<if test="creator != null">
|
||||
creator,
|
||||
</if>
|
||||
<if test="tags != null">
|
||||
tags,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
|
@ -229,41 +231,41 @@
|
|||
#{status,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="stage != null">
|
||||
#{stage,jdbcType=VARCHAR},
|
||||
#{stage,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="principal != null">
|
||||
#{principal,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="testCaseMatchRule != null">
|
||||
#{testCaseMatchRule,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="executorMatchRule != null">
|
||||
#{executorMatchRule,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
#{updateTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="actualEndTime != null">
|
||||
#{actualEndTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="plannedStartTime != null">
|
||||
#{plannedStartTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="plannedEndTime != null">
|
||||
#{plannedEndTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="actualStartTime != null">
|
||||
#{actualStartTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="creator != null">
|
||||
#{creator,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="tags != null">
|
||||
#{tags,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
<if test="principal != null">
|
||||
#{principal,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="testCaseMatchRule != null">
|
||||
#{testCaseMatchRule,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="executorMatchRule != null">
|
||||
#{executorMatchRule,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
#{updateTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="actualEndTime != null">
|
||||
#{actualEndTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="plannedStartTime != null">
|
||||
#{plannedStartTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="plannedEndTime != null">
|
||||
#{plannedEndTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="actualStartTime != null">
|
||||
#{actualStartTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="creator != null">
|
||||
#{creator,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="tags != null">
|
||||
#{tags,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="io.metersphere.base.domain.TestPlanExample" resultType="java.lang.Long">
|
||||
|
@ -296,47 +298,47 @@
|
|||
<if test="record.stage != null">
|
||||
stage = #{record.stage,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.principal != null">
|
||||
principal = #{record.principal,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.testCaseMatchRule != null">
|
||||
test_case_match_rule = #{record.testCaseMatchRule,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.executorMatchRule != null">
|
||||
executor_match_rule = #{record.executorMatchRule,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.createTime != null">
|
||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.updateTime != null">
|
||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.actualEndTime != null">
|
||||
actual_end_time = #{record.actualEndTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.plannedStartTime != null">
|
||||
planned_start_time = #{record.plannedStartTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.plannedEndTime != null">
|
||||
planned_end_time = #{record.plannedEndTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.actualStartTime != null">
|
||||
actual_start_time = #{record.actualStartTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.creator != null">
|
||||
creator = #{record.creator,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.tags != null">
|
||||
tags = #{record.tags,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
<if test="record.principal != null">
|
||||
principal = #{record.principal,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.testCaseMatchRule != null">
|
||||
test_case_match_rule = #{record.testCaseMatchRule,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.executorMatchRule != null">
|
||||
executor_match_rule = #{record.executorMatchRule,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.createTime != null">
|
||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.updateTime != null">
|
||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.actualEndTime != null">
|
||||
actual_end_time = #{record.actualEndTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.plannedStartTime != null">
|
||||
planned_start_time = #{record.plannedStartTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.plannedEndTime != null">
|
||||
planned_end_time = #{record.plannedEndTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.actualStartTime != null">
|
||||
actual_start_time = #{record.actualStartTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.creator != null">
|
||||
creator = #{record.creator,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.tags != null">
|
||||
tags = #{record.tags,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByExampleWithBLOBs" parameterType="map">
|
||||
update test_plan
|
||||
set id = #{record.id,jdbcType=VARCHAR},
|
||||
update test_plan
|
||||
set id = #{record.id,jdbcType=VARCHAR},
|
||||
workspace_id = #{record.workspaceId,jdbcType=VARCHAR},
|
||||
report_id = #{record.reportId,jdbcType=VARCHAR},
|
||||
`name` = #{record.name,jdbcType=VARCHAR},
|
||||
|
@ -354,13 +356,13 @@
|
|||
actual_start_time = #{record.actualStartTime,jdbcType=BIGINT},
|
||||
creator = #{record.creator,jdbcType=VARCHAR},
|
||||
tags = #{record.tags,jdbcType=LONGVARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByExample" parameterType="map">
|
||||
update test_plan
|
||||
set id = #{record.id,jdbcType=VARCHAR},
|
||||
update test_plan
|
||||
set id = #{record.id,jdbcType=VARCHAR},
|
||||
workspace_id = #{record.workspaceId,jdbcType=VARCHAR},
|
||||
report_id = #{record.reportId,jdbcType=VARCHAR},
|
||||
`name` = #{record.name,jdbcType=VARCHAR},
|
||||
|
@ -377,7 +379,7 @@
|
|||
planned_end_time = #{record.plannedEndTime,jdbcType=BIGINT},
|
||||
actual_start_time = #{record.actualStartTime,jdbcType=BIGINT},
|
||||
creator = #{record.creator,jdbcType=VARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
|
@ -400,83 +402,83 @@
|
|||
`status` = #{status,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="stage != null">
|
||||
stage = #{stage,jdbcType=VARCHAR},
|
||||
stage = #{stage,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="principal != null">
|
||||
principal = #{principal,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="testCaseMatchRule != null">
|
||||
test_case_match_rule = #{testCaseMatchRule,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="executorMatchRule != null">
|
||||
executor_match_rule = #{executorMatchRule,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="actualEndTime != null">
|
||||
actual_end_time = #{actualEndTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="plannedStartTime != null">
|
||||
planned_start_time = #{plannedStartTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="plannedEndTime != null">
|
||||
planned_end_time = #{plannedEndTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="actualStartTime != null">
|
||||
actual_start_time = #{actualStartTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="creator != null">
|
||||
creator = #{creator,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="tags != null">
|
||||
tags = #{tags,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
<if test="principal != null">
|
||||
principal = #{principal,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="testCaseMatchRule != null">
|
||||
test_case_match_rule = #{testCaseMatchRule,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="executorMatchRule != null">
|
||||
executor_match_rule = #{executorMatchRule,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="actualEndTime != null">
|
||||
actual_end_time = #{actualEndTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="plannedStartTime != null">
|
||||
planned_start_time = #{plannedStartTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="plannedEndTime != null">
|
||||
planned_end_time = #{plannedEndTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="actualStartTime != null">
|
||||
actual_start_time = #{actualStartTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="creator != null">
|
||||
creator = #{creator,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="tags != null">
|
||||
tags = #{tags,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.TestPlan">
|
||||
update test_plan
|
||||
set workspace_id = #{workspaceId,jdbcType=VARCHAR},
|
||||
report_id = #{reportId,jdbcType=VARCHAR},
|
||||
`name` = #{name,jdbcType=VARCHAR},
|
||||
description = #{description,jdbcType=VARCHAR},
|
||||
`status` = #{status,jdbcType=VARCHAR},
|
||||
stage = #{stage,jdbcType=VARCHAR},
|
||||
principal = #{principal,jdbcType=VARCHAR},
|
||||
test_case_match_rule = #{testCaseMatchRule,jdbcType=VARCHAR},
|
||||
executor_match_rule = #{executorMatchRule,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
update_time = #{updateTime,jdbcType=BIGINT},
|
||||
actual_end_time = #{actualEndTime,jdbcType=BIGINT},
|
||||
planned_start_time = #{plannedStartTime,jdbcType=BIGINT},
|
||||
planned_end_time = #{plannedEndTime,jdbcType=BIGINT},
|
||||
actual_start_time = #{actualStartTime,jdbcType=BIGINT},
|
||||
creator = #{creator,jdbcType=VARCHAR},
|
||||
tags = #{tags,jdbcType=LONGVARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
update test_plan
|
||||
set workspace_id = #{workspaceId,jdbcType=VARCHAR},
|
||||
report_id = #{reportId,jdbcType=VARCHAR},
|
||||
`name` = #{name,jdbcType=VARCHAR},
|
||||
description = #{description,jdbcType=VARCHAR},
|
||||
`status` = #{status,jdbcType=VARCHAR},
|
||||
stage = #{stage,jdbcType=VARCHAR},
|
||||
principal = #{principal,jdbcType=VARCHAR},
|
||||
test_case_match_rule = #{testCaseMatchRule,jdbcType=VARCHAR},
|
||||
executor_match_rule = #{executorMatchRule,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
update_time = #{updateTime,jdbcType=BIGINT},
|
||||
actual_end_time = #{actualEndTime,jdbcType=BIGINT},
|
||||
planned_start_time = #{plannedStartTime,jdbcType=BIGINT},
|
||||
planned_end_time = #{plannedEndTime,jdbcType=BIGINT},
|
||||
actual_start_time = #{actualStartTime,jdbcType=BIGINT},
|
||||
creator = #{creator,jdbcType=VARCHAR},
|
||||
tags = #{tags,jdbcType=LONGVARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.TestPlan">
|
||||
update test_plan
|
||||
set workspace_id = #{workspaceId,jdbcType=VARCHAR},
|
||||
report_id = #{reportId,jdbcType=VARCHAR},
|
||||
`name` = #{name,jdbcType=VARCHAR},
|
||||
description = #{description,jdbcType=VARCHAR},
|
||||
`status` = #{status,jdbcType=VARCHAR},
|
||||
stage = #{stage,jdbcType=VARCHAR},
|
||||
principal = #{principal,jdbcType=VARCHAR},
|
||||
test_case_match_rule = #{testCaseMatchRule,jdbcType=VARCHAR},
|
||||
executor_match_rule = #{executorMatchRule,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
update_time = #{updateTime,jdbcType=BIGINT},
|
||||
actual_end_time = #{actualEndTime,jdbcType=BIGINT},
|
||||
planned_start_time = #{plannedStartTime,jdbcType=BIGINT},
|
||||
planned_end_time = #{plannedEndTime,jdbcType=BIGINT},
|
||||
actual_start_time = #{actualStartTime,jdbcType=BIGINT},
|
||||
creator = #{creator,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
update test_plan
|
||||
set workspace_id = #{workspaceId,jdbcType=VARCHAR},
|
||||
report_id = #{reportId,jdbcType=VARCHAR},
|
||||
`name` = #{name,jdbcType=VARCHAR},
|
||||
description = #{description,jdbcType=VARCHAR},
|
||||
`status` = #{status,jdbcType=VARCHAR},
|
||||
stage = #{stage,jdbcType=VARCHAR},
|
||||
principal = #{principal,jdbcType=VARCHAR},
|
||||
test_case_match_rule = #{testCaseMatchRule,jdbcType=VARCHAR},
|
||||
executor_match_rule = #{executorMatchRule,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
update_time = #{updateTime,jdbcType=BIGINT},
|
||||
actual_end_time = #{actualEndTime,jdbcType=BIGINT},
|
||||
planned_start_time = #{plannedStartTime,jdbcType=BIGINT},
|
||||
planned_end_time = #{plannedEndTime,jdbcType=BIGINT},
|
||||
actual_start_time = #{actualStartTime,jdbcType=BIGINT},
|
||||
creator = #{creator,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
</mapper>
|
|
@ -9,14 +9,14 @@ public interface NoticeConstants {
|
|||
String CREATE = "CREATE";
|
||||
String UPDATE = "UPDATE";
|
||||
String DELETE = "DELETE";
|
||||
String COMMENT = "COMMENT";
|
||||
String JENKINS_TASK = "JENKINS_TASK";
|
||||
String TEST_PLAN_TASK = "TEST_PLAN_TASK";
|
||||
String REVIEW_TASK = "REVIEW_TASK";
|
||||
String DEFECT_TASK = "DEFECT_TASK";
|
||||
String FOUNDER = "FOUNDER";
|
||||
String EXECUTOR = "EXECUTOR";
|
||||
String MAINTAINER = "MAINTAINER";
|
||||
String COMMENT = "COMMENT";
|
||||
String FOUNDER = "FOUNDER";//创建人
|
||||
String EXECUTOR = "EXECUTOR";//负责人(评审人)
|
||||
String MAINTAINER = "MAINTAINER";//维护人
|
||||
String API = "API";
|
||||
String SCHEDULE = "SCHEDULE";
|
||||
|
||||
|
|
|
@ -133,7 +133,10 @@ public class UserController {
|
|||
public List<User> getUserList() {
|
||||
return userService.getUserList();
|
||||
}
|
||||
|
||||
@GetMapping("/list/orgId")
|
||||
public List<User> getUserListByOrgId() {
|
||||
return userService.getUserListByOrgId();
|
||||
}
|
||||
@PostMapping("/update/current")
|
||||
public UserDTO updateCurrentUser(@RequestBody User user) {
|
||||
userService.updateUser(user);
|
||||
|
|
|
@ -9,10 +9,11 @@ import java.util.List;
|
|||
@Data
|
||||
public class MessageDetail {
|
||||
private List<String> userIds = new ArrayList<>();
|
||||
private List<String> events = new ArrayList<>();
|
||||
private String event;
|
||||
private String taskType;
|
||||
private String webhook;
|
||||
private String type;
|
||||
private String identification;
|
||||
private String organizationId;
|
||||
private Boolean isSet;
|
||||
}
|
||||
|
|
|
@ -27,30 +27,17 @@ public class DingTaskService {
|
|||
|
||||
public void sendNailRobot(MessageDetail messageDetail, List<String> userIds, String context, String eventType) {
|
||||
List<String> addresseeIdList = new ArrayList<>();
|
||||
messageDetail.getEvents().forEach(e -> {
|
||||
if (StringUtils.equals(eventType, e)) {
|
||||
if (StringUtils.equals(eventType, messageDetail.getEvent())) {
|
||||
messageDetail.getUserIds().forEach(u -> {
|
||||
if (!StringUtils.equals(NoticeConstants.EXECUTOR, u) && !StringUtils.equals(NoticeConstants.EXECUTOR, u) && !StringUtils.equals(NoticeConstants.MAINTAINER, u)) {
|
||||
if (!StringUtils.equals(NoticeConstants.EXECUTOR, u) && !StringUtils.equals(NoticeConstants.FOUNDER, u) && !StringUtils.equals(NoticeConstants.MAINTAINER, u)) {
|
||||
addresseeIdList.add(u);
|
||||
}
|
||||
if (StringUtils.equals(NoticeConstants.CREATE, eventType) && StringUtils.equals(NoticeConstants.EXECUTOR, u)) {
|
||||
}else{
|
||||
addresseeIdList.addAll(userIds);
|
||||
}
|
||||
if (StringUtils.equals(NoticeConstants.UPDATE, eventType) && StringUtils.equals(NoticeConstants.FOUNDER, u)) {
|
||||
addresseeIdList.addAll(userIds);
|
||||
}
|
||||
if (StringUtils.equals(NoticeConstants.DELETE, eventType) && StringUtils.equals(NoticeConstants.FOUNDER, u)) {
|
||||
addresseeIdList.addAll(userIds);
|
||||
}
|
||||
if (StringUtils.equals(NoticeConstants.COMMENT, eventType) && StringUtils.equals(NoticeConstants.MAINTAINER, u)) {
|
||||
addresseeIdList.addAll(userIds);
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
sendDingTask(context, addresseeIdList, messageDetail.getWebhook());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void sendDingTask(String context, List<String> userIds, String Webhook) {
|
||||
|
|
|
@ -172,7 +172,7 @@ public class MailService {
|
|||
public void sendReviewerNotice(MessageDetail messageDetail, List<String> userIds, SaveTestCaseReviewRequest reviewRequest, String eventType) {
|
||||
Map<String, String> context = getReviewContext(reviewRequest);
|
||||
try {
|
||||
String reviewerTemplate = IOUtils.toString(this.getClass().getResource("/mail/reviewer.html"), StandardCharsets.UTF_8);
|
||||
String reviewerTemplate = IOUtils.toString(this.getClass().getResource("/mail/end.html"), StandardCharsets.UTF_8);
|
||||
sendReviewNotice(addresseeIdList(messageDetail, userIds, eventType), context, reviewerTemplate);
|
||||
} catch (Exception e) {
|
||||
LogUtil.error(e);
|
||||
|
@ -183,7 +183,7 @@ public class MailService {
|
|||
|
||||
public void sendTestPlanStartNotice(MessageDetail messageDetail, List<String> userIds, AddTestPlanRequest testPlan, String eventType) {
|
||||
Map<String, String> context = getTestPlanContext(testPlan);
|
||||
context.put("creator", userIds.toString());
|
||||
context.put("creator", testPlan.getCreator());
|
||||
try {
|
||||
String endTemplate = IOUtils.toString(this.getClass().getResource("/mail/testPlanStart.html"), StandardCharsets.UTF_8);
|
||||
sendTestPlanNotice(addresseeIdList(messageDetail, userIds, eventType), context, endTemplate);
|
||||
|
@ -424,8 +424,7 @@ public class MailService {
|
|||
|
||||
private List<String> addresseeIdList(MessageDetail messageDetail, List<String> userIds, String eventType) {
|
||||
List<String> addresseeIdList = new ArrayList<>();
|
||||
messageDetail.getEvents().forEach(e -> {
|
||||
if (StringUtils.equals(eventType, e)) {
|
||||
if (StringUtils.equals(eventType, messageDetail.getEvent())) {
|
||||
messageDetail.getUserIds().forEach(u -> {
|
||||
if (!StringUtils.equals(NoticeConstants.EXECUTOR, u) && !StringUtils.equals(NoticeConstants.EXECUTOR, u) && !StringUtils.equals(NoticeConstants.MAINTAINER, u)) {
|
||||
addresseeIdList.add(u);
|
||||
|
@ -446,7 +445,6 @@ public class MailService {
|
|||
|
||||
});
|
||||
}
|
||||
});
|
||||
return addresseeIdList;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,8 @@ import io.metersphere.base.domain.NoticeExample;
|
|||
import io.metersphere.base.mapper.MessageTaskMapper;
|
||||
import io.metersphere.base.mapper.NoticeMapper;
|
||||
import io.metersphere.commons.constants.NoticeConstants;
|
||||
import io.metersphere.commons.user.SessionUser;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.metersphere.notice.controller.request.MessageRequest;
|
||||
import io.metersphere.notice.controller.request.NoticeRequest;
|
||||
import io.metersphere.notice.domain.MessageDetail;
|
||||
|
@ -31,9 +33,6 @@ public class NoticeService {
|
|||
@Resource
|
||||
private MessageTaskMapper messageTaskMapper;
|
||||
|
||||
@Resource
|
||||
MailService mailService;
|
||||
|
||||
public void saveNotice(NoticeRequest noticeRequest) {
|
||||
NoticeExample example = new NoticeExample();
|
||||
example.createCriteria().andTestIdEqualTo(noticeRequest.getTestId());
|
||||
|
@ -93,29 +92,30 @@ public class NoticeService {
|
|||
|
||||
public void saveMessageTask(MessageRequest messageRequest) {
|
||||
String identification = UUID.randomUUID().toString();
|
||||
SessionUser user = SessionUtils.getUser();
|
||||
String orgId = user.getLastOrganizationId();
|
||||
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.setEvent(list.getEvent());
|
||||
message.setTaskType(list.getTaskType());
|
||||
message.setUserId(m);
|
||||
message.setType(list.getType());
|
||||
message.setWebhook(list.getWebhook());
|
||||
message.setIdentification(identification);
|
||||
message.setIsSet(list.getIsSet());
|
||||
message.setOrganizationId(orgId);
|
||||
messageTaskMapper.insert(message);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
public MessageSettingDetail searchMessage() {
|
||||
SessionUser user = SessionUtils.getUser();
|
||||
String orgId = user.getLastOrganizationId();
|
||||
MessageTaskExample messageTaskExample = new MessageTaskExample();
|
||||
messageTaskExample.createCriteria();
|
||||
messageTaskExample.createCriteria().andOrganizationIdEqualTo(orgId);
|
||||
List<MessageTask> messageTaskLists = new ArrayList<>();
|
||||
MessageSettingDetail messageSettingDetail = new MessageSettingDetail();
|
||||
List<MessageDetail> MessageDetailList = new ArrayList<>();
|
||||
|
@ -123,18 +123,16 @@ public class NoticeService {
|
|||
Map<String, List<MessageTask>> MessageTaskMap = messageTaskLists.stream().collect(Collectors.groupingBy(e -> fetchGroupKey(e)));
|
||||
MessageTaskMap.forEach((k, v) -> {
|
||||
Set userIds = new HashSet();
|
||||
Set events = new HashSet();
|
||||
MessageDetail messageDetail = new MessageDetail();
|
||||
for (MessageTask m : v) {
|
||||
userIds.add(m.getUserId());
|
||||
events.add(m.getEvent());
|
||||
messageDetail.setEvent(m.getEvent());
|
||||
messageDetail.setTaskType(m.getTaskType());
|
||||
messageDetail.setWebhook(m.getWebhook());
|
||||
messageDetail.setIdentification(m.getIdentification());
|
||||
messageDetail.setType(m.getType());
|
||||
messageDetail.setIsSet(m.getIsSet());
|
||||
}
|
||||
messageDetail.setEvents(new ArrayList(events));
|
||||
messageDetail.setUserIds(new ArrayList(userIds));
|
||||
MessageDetailList.add(messageDetail);
|
||||
});
|
||||
|
@ -158,86 +156,4 @@ public class NoticeService {
|
|||
example.createCriteria().andIdentificationEqualTo(identification);
|
||||
return messageTaskMapper.deleteByExample(example);
|
||||
}
|
||||
/*
|
||||
public void sendTask(List<String> userIds,String context,String taskType,String eventType){
|
||||
MessageSettingDetail messageSettingDetail = noticeService.searchMessage();
|
||||
List<MessageDetail> taskList=new ArrayList<>();
|
||||
switch (taskType) {
|
||||
case NoticeConstants.REVIEW_TASK:
|
||||
taskList=messageSettingDetail.getReviewTask();
|
||||
break;
|
||||
case NoticeConstants.JENKINS_TASK:
|
||||
taskList=messageSettingDetail.getJenkinsTask();
|
||||
break;
|
||||
case NoticeConstants.DEFECT_TASK:
|
||||
taskList=messageSettingDetail.getDefectTask();
|
||||
break;
|
||||
case NoticeConstants.TEST_PLAN_TASK:
|
||||
taskList=messageSettingDetail.getTestCasePlanTask();
|
||||
break;
|
||||
}
|
||||
|
||||
taskList.forEach(r->{
|
||||
switch (r.getType()) {
|
||||
case NoticeConstants.NAIL_ROBOT:
|
||||
sendNailRobot(r,userIds,context,eventType);
|
||||
break;
|
||||
case NoticeConstants.WECHAT_ROBOT:
|
||||
sendWechatRobot(r,userIds,context,eventType);
|
||||
break;
|
||||
case NoticeConstants.EMAIL:
|
||||
sendEmail(r,userIds,context,eventType);
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
*/
|
||||
/*private void sendNailRobot(MessageDetail messageDetail,List<String> userIds,String context,String eventType){
|
||||
List<String> addresseeIdList=new ArrayList<>();
|
||||
messageDetail.getEvents().forEach(e->{
|
||||
if(StringUtils.equals(eventType,e)){
|
||||
messageDetail.getUserIds().forEach(u->{
|
||||
if(StringUtils.equals(NoticeConstants.FOUNDER,u)){
|
||||
addresseeIdList.addAll(userIds);
|
||||
}else{
|
||||
addresseeIdList.add(u);
|
||||
}
|
||||
});
|
||||
dingTaskService.sendDingTask(context, addresseeIdList,messageDetail.getWebhook());
|
||||
}
|
||||
});
|
||||
}
|
||||
private void sendWechatRobot(MessageDetail messageDetail,List<String> userIds,String context,String eventType){
|
||||
List<String> addresseeIdList=new ArrayList<>();
|
||||
messageDetail.getEvents().forEach(e->{
|
||||
if(StringUtils.equals(eventType,e)){
|
||||
messageDetail.getUserIds().forEach(u->{
|
||||
if(StringUtils.equals(NoticeConstants.FOUNDER,u)){
|
||||
addresseeIdList.addAll(userIds);
|
||||
}else{
|
||||
addresseeIdList.add(u);
|
||||
}
|
||||
});
|
||||
wxChatTaskService.enterpriseWechatTask(context, addresseeIdList,messageDetail.getWebhook());
|
||||
}
|
||||
});
|
||||
}
|
||||
private void sendEmail(MessageDetail messageDetail,List<String> userIds,String context,String eventType){
|
||||
List<String> addresseeIdList=new ArrayList<>();
|
||||
if(StringUtils.equals(NoticeConstants.EMAIL,messageDetail.getType())){
|
||||
messageDetail.getEvents().forEach(e->{
|
||||
if(StringUtils.equals(eventType,e)){
|
||||
messageDetail.getUserIds().forEach(u->{
|
||||
if(StringUtils.equals(NoticeConstants.FOUNDER,u)){
|
||||
addresseeIdList.addAll(userIds);
|
||||
}else{
|
||||
addresseeIdList.add(u);
|
||||
}
|
||||
});
|
||||
mailService.sendReviewerNotice(addresseeIdList, context);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}*/
|
||||
}
|
|
@ -26,30 +26,16 @@ public class WxChatTaskService {
|
|||
|
||||
public void sendWechatRobot(MessageDetail messageDetail, List<String> userIds, String context, String eventType) {
|
||||
List<String> addresseeIdList = new ArrayList<>();
|
||||
messageDetail.getEvents().forEach(e -> {
|
||||
if (StringUtils.equals(eventType, e)) {
|
||||
if (StringUtils.equals(eventType, messageDetail.getEvent())) {
|
||||
messageDetail.getUserIds().forEach(u -> {
|
||||
if (!StringUtils.equals(NoticeConstants.EXECUTOR, u) && !StringUtils.equals(NoticeConstants.EXECUTOR, u) && !StringUtils.equals(NoticeConstants.MAINTAINER, u)) {
|
||||
if (!StringUtils.equals(NoticeConstants.EXECUTOR, u) && !StringUtils.equals(NoticeConstants.FOUNDER, u) && !StringUtils.equals(NoticeConstants.MAINTAINER, u)) {
|
||||
addresseeIdList.add(u);
|
||||
}
|
||||
if (StringUtils.equals(NoticeConstants.CREATE, eventType) && StringUtils.equals(NoticeConstants.EXECUTOR, u)) {
|
||||
}else{
|
||||
addresseeIdList.addAll(userIds);
|
||||
}
|
||||
if (StringUtils.equals(NoticeConstants.UPDATE, eventType) && StringUtils.equals(NoticeConstants.FOUNDER, u)) {
|
||||
addresseeIdList.addAll(userIds);
|
||||
}
|
||||
if (StringUtils.equals(NoticeConstants.DELETE, eventType) && StringUtils.equals(NoticeConstants.FOUNDER, u)) {
|
||||
addresseeIdList.addAll(userIds);
|
||||
}
|
||||
if (StringUtils.equals(NoticeConstants.COMMENT, eventType) && StringUtils.equals(NoticeConstants.MAINTAINER, u)) {
|
||||
addresseeIdList.addAll(userIds);
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
enterpriseWechatTask(context, addresseeIdList, messageDetail.getWebhook());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void enterpriseWechatTask(String context, List<String> userIds, String Webhook) {
|
||||
|
|
|
@ -266,6 +266,13 @@ public class UserService {
|
|||
example.setOrderByClause("update_time desc");
|
||||
return userMapper.selectByExample(example);
|
||||
}
|
||||
public List<User> getUserListByOrgId() {
|
||||
SessionUser user = SessionUtils.getUser();
|
||||
String orgId = user.getLastOrganizationId();
|
||||
UserExample example = new UserExample();
|
||||
example.createCriteria().andLastOrganizationIdEqualTo(orgId);
|
||||
return userMapper.selectByExample(example);
|
||||
}
|
||||
|
||||
public List<User> getUserListWithRequest(io.metersphere.controller.request.UserRequest request) {
|
||||
return extUserMapper.getUserList(request);
|
||||
|
|
|
@ -184,6 +184,8 @@ public class TestCaseReviewService {
|
|||
testCaseReview.setUpdateTime(System.currentTimeMillis());
|
||||
checkCaseReviewExist(testCaseReview);
|
||||
testCaseReviewMapper.updateByPrimaryKeySelective(testCaseReview);
|
||||
List<String> userIds=new ArrayList<>();
|
||||
userIds.addAll(testCaseReview.getUserIds());
|
||||
try {
|
||||
String context = getReviewContext(testCaseReview, NoticeConstants.CREATE);
|
||||
MessageSettingDetail messageSettingDetail = noticeService.searchMessage();
|
||||
|
@ -191,13 +193,13 @@ public class TestCaseReviewService {
|
|||
taskList.forEach(r -> {
|
||||
switch (r.getType()) {
|
||||
case NoticeConstants.NAIL_ROBOT:
|
||||
dingTaskService.sendNailRobot(r, testCaseReview.getUserIds(), context, NoticeConstants.CREATE);
|
||||
dingTaskService.sendNailRobot(r, userIds, context, NoticeConstants.CREATE);
|
||||
break;
|
||||
case NoticeConstants.WECHAT_ROBOT:
|
||||
wxChatTaskService.sendWechatRobot(r, testCaseReview.getUserIds(), context, NoticeConstants.CREATE);
|
||||
wxChatTaskService.sendWechatRobot(r, userIds, context, NoticeConstants.CREATE);
|
||||
break;
|
||||
case NoticeConstants.EMAIL:
|
||||
mailService.sendReviewerNotice(r, testCaseReview.getUserIds(), testCaseReview, NoticeConstants.CREATE);
|
||||
mailService.sendReviewerNotice(r, userIds, testCaseReview, NoticeConstants.CREATE);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -115,7 +115,6 @@ public class TestPlanService {
|
|||
testPlan.setUpdateTime(System.currentTimeMillis());
|
||||
testPlan.setCreator(SessionUtils.getUser().getId());
|
||||
testPlanMapper.insert(testPlan);
|
||||
|
||||
List<String> userIds = new ArrayList<>();
|
||||
userIds.add(testPlan.getPrincipal());
|
||||
try {
|
||||
|
@ -160,33 +159,34 @@ public class TestPlanService {
|
|||
testPlan.setActualStartTime(System.currentTimeMillis());
|
||||
|
||||
} else if (TestPlanStatus.Completed.name().equals(testPlan.getStatus())) {
|
||||
List<String> userIds = new ArrayList<>();
|
||||
userIds.add(testPlan.getPrincipal());
|
||||
AddTestPlanRequest testPlans = new AddTestPlanRequest();
|
||||
//已完成,写入实际完成时间
|
||||
testPlan.setActualEndTime(System.currentTimeMillis());
|
||||
try {
|
||||
BeanUtils.copyBean(testPlans, testPlan);
|
||||
String context = getTestPlanContext(testPlans, NoticeConstants.CREATE);
|
||||
MessageSettingDetail messageSettingDetail = noticeService.searchMessage();
|
||||
List<MessageDetail> taskList = messageSettingDetail.getReviewTask();
|
||||
taskList.forEach(r -> {
|
||||
switch (r.getType()) {
|
||||
case NoticeConstants.NAIL_ROBOT:
|
||||
dingTaskService.sendNailRobot(r, userIds, context, NoticeConstants.CREATE);
|
||||
break;
|
||||
case NoticeConstants.WECHAT_ROBOT:
|
||||
wxChatTaskService.sendWechatRobot(r, userIds, context, NoticeConstants.CREATE);
|
||||
break;
|
||||
case NoticeConstants.EMAIL:
|
||||
mailService.sendTestPlanStartNotice(r, userIds, testPlans, NoticeConstants.CREATE);
|
||||
break;
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
LogUtil.error(e);
|
||||
}
|
||||
}
|
||||
List<String> userIds = new ArrayList<>();
|
||||
userIds.add(testPlan.getPrincipal());
|
||||
AddTestPlanRequest testPlans = new AddTestPlanRequest();
|
||||
/* try {
|
||||
BeanUtils.copyBean(testPlans, testPlan);
|
||||
String context = getTestPlanContext(testPlans, NoticeConstants.CREATE);
|
||||
MessageSettingDetail messageSettingDetail = noticeService.searchMessage();
|
||||
List<MessageDetail> taskList = messageSettingDetail.getReviewTask();
|
||||
taskList.forEach(r -> {
|
||||
switch (r.getType()) {
|
||||
case NoticeConstants.NAIL_ROBOT:
|
||||
dingTaskService.sendNailRobot(r, userIds, context, NoticeConstants.CREATE);
|
||||
break;
|
||||
case NoticeConstants.WECHAT_ROBOT:
|
||||
wxChatTaskService.sendWechatRobot(r, userIds, context, NoticeConstants.CREATE);
|
||||
break;
|
||||
case NoticeConstants.EMAIL:
|
||||
mailService.sendTestPlanStartNotice(r, userIds, testPlans, NoticeConstants.CREATE);
|
||||
break;
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
LogUtil.error(e);
|
||||
}*/
|
||||
|
||||
return testPlanMapper.updateByPrimaryKeySelective(testPlan);
|
||||
}
|
||||
|
||||
|
@ -253,7 +253,7 @@ public class TestPlanService {
|
|||
BeanUtils.copyBean(testPlans, testPlan);
|
||||
String context = getTestPlanContext(testPlans, NoticeConstants.DELETE);
|
||||
MessageSettingDetail messageSettingDetail = noticeService.searchMessage();
|
||||
List<MessageDetail> taskList = messageSettingDetail.getReviewTask();
|
||||
List<MessageDetail> taskList = messageSettingDetail.getTestCasePlanTask();
|
||||
taskList.forEach(r -> {
|
||||
switch (r.getType()) {
|
||||
case NoticeConstants.NAIL_ROBOT:
|
||||
|
@ -493,7 +493,7 @@ public class TestPlanService {
|
|||
BeanUtils.copyBean(_testPlans, testPlans);
|
||||
String context = getTestPlanContext(_testPlans, NoticeConstants.UPDATE);
|
||||
MessageSettingDetail messageSettingDetail = noticeService.searchMessage();
|
||||
List<MessageDetail> taskList = messageSettingDetail.getReviewTask();
|
||||
List<MessageDetail> taskList = messageSettingDetail.getTestCasePlanTask();
|
||||
taskList.forEach(r -> {
|
||||
switch (r.getType()) {
|
||||
case NoticeConstants.NAIL_ROBOT:
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
alter table message_task
|
||||
add organization_id varchar(255) null;
|
|
@ -6,7 +6,7 @@
|
|||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<p style="text-align: left"> ${maintainer} 发起的<br/>
|
||||
<p style="text-align: left"> ${maintainer} 维护的<br/>
|
||||
${testCaseName}<br/>
|
||||
添加评论:${description}<br/>
|
||||
点击下面链接进入用例评审页面</p>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<p style="text-align: left">${creator} 发起的:<br>
|
||||
<p style="text-align: left">${creator} 发起的用例评审:<br>
|
||||
${reviewName}<br>
|
||||
计划开始时间是:${start}<br>
|
||||
计划结束时间为:${end}<br>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
计划结束时间为:${end}<br>
|
||||
请跟进!<br>
|
||||
点击下面链接进入测试计划页面</p>
|
||||
<a href="${url}/#/track/plan/view/${id}">${url}/#/track/plan/view</a>
|
||||
<a href="${url}/#/track/plan/all">${url}/#/track/plan/all</a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,8 +1,12 @@
|
|||
<template>
|
||||
<div style="margin-left: 40px">
|
||||
<el-alert
|
||||
:title="$t('organization.message.notes')"
|
||||
type="info">
|
||||
</el-alert>
|
||||
<el-form :model="form" ref="from">
|
||||
<el-row class="row">
|
||||
<el-col :span="20">
|
||||
<el-col :span="24">
|
||||
<div class="grid-content bg-purple-dark">
|
||||
<el-row>
|
||||
<el-col :span="10">
|
||||
|
@ -23,12 +27,10 @@
|
|||
border
|
||||
size="mini"
|
||||
:cell-style="rowClass"
|
||||
:header-cell-style="headClass"
|
||||
|
||||
>
|
||||
:header-cell-style="headClass">
|
||||
<el-table-column :label="$t('schedule.event')" min-width="20%" prop="events">
|
||||
<template slot-scope="scope">
|
||||
<el-select v-model="scope.row.events" multiple
|
||||
<el-select v-model="scope.row.event"
|
||||
:placeholder="$t('organization.message.select_events')"
|
||||
prop="events" :disabled="!scope.row.isSet">
|
||||
<el-option
|
||||
|
@ -56,7 +58,8 @@
|
|||
</el-table-column>
|
||||
<el-table-column :label="$t('schedule.receiving_mode')" min-width="20%" prop="type">
|
||||
<template slot-scope="scope">
|
||||
<el-select v-model="scope.row.type" :placeholder="$t('organization.message.select_receiving_method')" :disabled="!scope.row.isSet" @change="handleEdit(scope.$index, scope.row)"
|
||||
<el-select v-model="scope.row.type" :placeholder="$t('organization.message.select_receiving_method')"
|
||||
:disabled="!scope.row.isSet" @change="handleEdit(scope.$index, scope.row)"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in receiveTypeOptions"
|
||||
|
@ -69,7 +72,8 @@
|
|||
</el-table-column>
|
||||
<el-table-column label="webhook" min-width="20%" prop="webhook">
|
||||
<template v-slot:default="scope">
|
||||
<el-input v-model="scope.row.webhook" placeholder="webhook地址" :disabled="!scope.row.isSet||scope.row.events === 'EMAIL'"></el-input>
|
||||
<el-input v-model="scope.row.webhook" placeholder="webhook地址"
|
||||
:disabled="!scope.row.isSet||!scope.row.isReadOnly"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('commons.operating')" min-width="20%" prop="result">
|
||||
|
@ -102,7 +106,7 @@
|
|||
</el-col>
|
||||
</el-row>
|
||||
<el-row class="row">
|
||||
<el-col :span="20">
|
||||
<el-col :span="24">
|
||||
<div class="grid-content bg-purple-dark">
|
||||
<el-row>
|
||||
<el-col :span="10">
|
||||
|
@ -125,7 +129,8 @@
|
|||
>
|
||||
<el-table-column :label="$t('schedule.event')" min-width="20%" prop="events">
|
||||
<template slot-scope="scope">
|
||||
<el-select v-model="scope.row.events" multiple :placeholder="$t('organization.message.select_events')"
|
||||
<el-select v-model="scope.row.event" :placeholder="$t('organization.message.select_events')"
|
||||
@change="handleTestPlanReceivers(scope.row)"
|
||||
prop="events" :disabled="!scope.row.isSet">
|
||||
<el-option
|
||||
v-for="item in otherEventOptions"
|
||||
|
@ -142,7 +147,7 @@
|
|||
:placeholder="$t('commons.please_select')"
|
||||
@click.native="testPlanUserList()" style="width: 100%;" :disabled="!row.isSet">
|
||||
<el-option
|
||||
v-for="item in testPlanReceiverOptions"
|
||||
v-for="item in row.testPlanReceiverOptions"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
|
@ -152,7 +157,8 @@
|
|||
</el-table-column>
|
||||
<el-table-column :label="$t('schedule.receiving_mode')" min-width="20%" prop="type">
|
||||
<template slot-scope="scope">
|
||||
<el-select v-model="scope.row.type" :placeholder="$t('organization.message.select_receiving_method')" :disabled="!scope.row.isSet">
|
||||
<el-select v-model="scope.row.type" :placeholder="$t('organization.message.select_receiving_method')"
|
||||
:disabled="!scope.row.isSet" @change="handleEdit(scope.$index, scope.row)">
|
||||
<el-option
|
||||
v-for="item in receiveTypeOptions"
|
||||
:key="item.value"
|
||||
|
@ -164,7 +170,8 @@
|
|||
</el-table-column>
|
||||
<el-table-column label="webhook" min-width="20%" prop="webhook">
|
||||
<template v-slot:default="scope">
|
||||
<el-input v-model="scope.row.webhook" placeholder="webhook地址" :disabled="!scope.row.isSet"></el-input>
|
||||
<el-input v-model="scope.row.webhook" placeholder="webhook地址"
|
||||
:disabled="!scope.row.isSet||!scope.row.isReadOnly"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('commons.operating')" min-width="20%" prop="result">
|
||||
|
@ -195,7 +202,7 @@
|
|||
</el-col>
|
||||
</el-row>
|
||||
<el-row class="row">
|
||||
<el-col :span="20">
|
||||
<el-col :span="24">
|
||||
<div class="grid-content bg-purple-dark">
|
||||
<el-row>
|
||||
<el-col :span="10">
|
||||
|
@ -218,7 +225,8 @@
|
|||
>
|
||||
<el-table-column :label="$t('schedule.event')" min-width="20%" prop="events">
|
||||
<template slot-scope="scope">
|
||||
<el-select v-model="scope.row.events" multiple :placeholder="$t('organization.message.select_events')"
|
||||
<el-select v-model="scope.row.event" :placeholder="$t('organization.message.select_events')"
|
||||
@change="handleReviewReceivers(scope.row)"
|
||||
prop="event" :disabled="!scope.row.isSet">
|
||||
<el-option
|
||||
v-for="item in reviewTaskEventOptions"
|
||||
|
@ -235,7 +243,7 @@
|
|||
:placeholder="$t('commons.please_select')"
|
||||
@click.native="reviewUerList()" style="width: 100%;" :disabled="!row.isSet">
|
||||
<el-option
|
||||
v-for="item in reviewReceiverOptions"
|
||||
v-for="item in row.reviewReceiverOptions"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
|
@ -245,7 +253,8 @@
|
|||
</el-table-column>
|
||||
<el-table-column :label="$t('schedule.receiving_mode')" min-width="20%" prop="type">
|
||||
<template slot-scope="scope">
|
||||
<el-select v-model="scope.row.type" :placeholder="$t('organization.message.select_receiving_method')" :disabled="!scope.row.isSet">
|
||||
<el-select v-model="scope.row.type" :placeholder="$t('organization.message.select_receiving_method')"
|
||||
:disabled="!scope.row.isSet" @change="handleEdit(scope.$index, scope.row)">
|
||||
<el-option
|
||||
v-for="item in receiveTypeOptions"
|
||||
:key="item.value"
|
||||
|
@ -257,7 +266,8 @@
|
|||
</el-table-column>
|
||||
<el-table-column label="webhook" min-width="20%" prop="webhook">
|
||||
<template v-slot:default="scope">
|
||||
<el-input v-model="scope.row.webhook" placeholder="webhook地址" :disabled="!scope.row.isSet"></el-input>
|
||||
<el-input v-model="scope.row.webhook" placeholder="webhook地址"
|
||||
:disabled="!scope.row.isSet||!scope.row.isReadOnly"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('commons.operating')" min-width="20%" prop="result">
|
||||
|
@ -288,7 +298,7 @@
|
|||
</el-col>
|
||||
</el-row>
|
||||
<el-row class="row">
|
||||
<el-col :span="20">
|
||||
<el-col :span="24">
|
||||
<div class="grid-content bg-purple-dark">
|
||||
<el-row>
|
||||
<el-col :span="10">
|
||||
|
@ -311,7 +321,7 @@
|
|||
>
|
||||
<el-table-column :label="$t('schedule.event')" min-width="20%" prop="events">
|
||||
<template slot-scope="scope">
|
||||
<el-select v-model="scope.row.events" multiple :placeholder="$t('organization.message.select_events')"
|
||||
<el-select v-model="scope.row.event" :placeholder="$t('organization.message.select_events')"
|
||||
prop="event" :disabled="!scope.row.isSet">
|
||||
<el-option
|
||||
v-for="item in defectEventOptions"
|
||||
|
@ -338,7 +348,8 @@
|
|||
</el-table-column>
|
||||
<el-table-column :label="$t('schedule.receiving_mode')" min-width="20%" prop="type">
|
||||
<template slot-scope="scope">
|
||||
<el-select v-model="scope.row.type" :placeholder="$t('organization.message.select_receiving_method')" :disabled="!scope.row.isSet">
|
||||
<el-select v-model="scope.row.type" :placeholder="$t('organization.message.select_receiving_method')"
|
||||
:disabled="!scope.row.isSet" @change="handleEdit(scope.$index, scope.row)">
|
||||
<el-option
|
||||
v-for="item in receiveTypeOptions"
|
||||
:key="item.value"
|
||||
|
@ -350,7 +361,8 @@
|
|||
</el-table-column>
|
||||
<el-table-column label="webhook" min-width="20%" prop="webhook">
|
||||
<template v-slot:default="scope">
|
||||
<el-input v-model="scope.row.webhook" placeholder="webhook地址" :disabled="!scope.row.isSet"></el-input>
|
||||
<el-input v-model="scope.row.webhook" placeholder="webhook地址"
|
||||
:disabled="!scope.row.isSet||!scope.row.isReadOnly"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('commons.operating')" min-width="20%" prop="result">
|
||||
|
@ -385,47 +397,53 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import {getCurrentUser} from "../../../../common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "TaskNotification",
|
||||
data() {
|
||||
|
||||
return {
|
||||
form: {
|
||||
jenkinsTask: [{
|
||||
taskType: "jenkinsTask",
|
||||
events: [],
|
||||
event: "",
|
||||
userIds: [],
|
||||
type: [],
|
||||
webhook: "",
|
||||
isSet: true,
|
||||
identification: "",
|
||||
isReadOnly: false,
|
||||
}],
|
||||
testCasePlanTask: [{
|
||||
taskType: "testPlanTask",
|
||||
events: [],
|
||||
event: "",
|
||||
userIds: [],
|
||||
type: [],
|
||||
webhook: "",
|
||||
isSet: true,
|
||||
identification: "",
|
||||
isReadOnly: false,
|
||||
}],
|
||||
reviewTask: [{
|
||||
taskType: "reviewTask",
|
||||
events: [],
|
||||
event: "",
|
||||
userIds: [],
|
||||
type: [],
|
||||
webhook: "",
|
||||
isSet: true,
|
||||
identification: "",
|
||||
isReadOnly: false,
|
||||
}],
|
||||
defectTask: [{
|
||||
taskType: "defectTask",
|
||||
events: [],
|
||||
event: "",
|
||||
userIds: [],
|
||||
type: [],
|
||||
webhook: "",
|
||||
isSet: true,
|
||||
identification: "",
|
||||
isReadOnly: false,
|
||||
}],
|
||||
},
|
||||
jenkinsEventOptions: [
|
||||
|
@ -443,17 +461,14 @@ export default {
|
|||
{value: 'UPDATE', label: this.$t('commons.update')},
|
||||
{value: 'DELETE', label: this.$t('commons.delete')}
|
||||
],
|
||||
reviewTaskEventOptions:[
|
||||
reviewTaskEventOptions: [
|
||||
{value: 'CREATE', label: this.$t('commons.create')},
|
||||
{value: 'UPDATE', label: this.$t('commons.update')},
|
||||
{value: 'DELETE', label: this.$t('commons.delete')},
|
||||
{value: 'COMMENT', label: this.$t('commons.comment')}
|
||||
],
|
||||
defectEventOptions:[
|
||||
defectEventOptions: [
|
||||
{value: 'CREATE', label: this.$t('commons.create')},
|
||||
/*
|
||||
{value: 'UPDATE', label: this.$t('commons.update')},
|
||||
*/
|
||||
],
|
||||
//测试计划
|
||||
testPlanReceiverOptions: [],
|
||||
|
@ -461,19 +476,27 @@ export default {
|
|||
reviewReceiverOptions: [],
|
||||
//缺陷
|
||||
defectReceiverOptions: [],
|
||||
rules: {},
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
activated(){
|
||||
activated() {
|
||||
this.initForm()
|
||||
this. userList()
|
||||
this.userList()
|
||||
this.testPlanUserList()
|
||||
this.defectUserList()
|
||||
this.reviewUerList()
|
||||
},
|
||||
methods: {
|
||||
handleEdit(index, data){
|
||||
|
||||
handleEdit(index, data) {
|
||||
data.isReadOnly = true;
|
||||
if (data.type === 'EMAIL') {
|
||||
data.isReadOnly = !data.isReadOnly
|
||||
}
|
||||
},
|
||||
currentUser: () => {
|
||||
return getCurrentUser();
|
||||
},
|
||||
initForm() {
|
||||
this.result = this.$get('/notice/search/message', response => {
|
||||
|
@ -481,39 +504,32 @@ export default {
|
|||
})
|
||||
},
|
||||
userList() {
|
||||
this.result = this.$get('user/list', response => {
|
||||
this.result = this.$get('user/list/orgId', response => {
|
||||
this.jenkinsReceiverOptions = response.data
|
||||
})
|
||||
},
|
||||
reviewUerList() {
|
||||
this.result = this.$get('user/list', response => {
|
||||
this.result = this.$get('user/list/orgId', response => {
|
||||
this.reviewReceiverOptions = response.data
|
||||
this.reviewReceiverOptions.unshift({id: 'EXECUTOR', name: this.$t('test_track.review.reviewer')},
|
||||
{id: 'FOUNDER', name: this.$t('test_track.review.review_creator')},
|
||||
{id: 'MAINTAINER', name: this.$t('test_track.case.maintainer')})
|
||||
})
|
||||
},
|
||||
defectUserList() {
|
||||
this.result = this.$get('user/list', response => {
|
||||
this.result = this.$get('user/list/orgId', response => {
|
||||
this.defectReceiverOptions = response.data
|
||||
/* this.defectReceiverOptions.unshift({id: 'FOUNDER', name: this.$t('api_test.creator')}, {
|
||||
id: 'EXECUTOR',
|
||||
name: this.$t('test_track.plan_view.executor')
|
||||
})*/
|
||||
/* this.defectReceiverOptions.push({id: 'FOUNDER', name: this.$t('api_test.creator')}, {
|
||||
id: 'EXECUTOR',
|
||||
name: this.$t('test_track.plan_view.executor')
|
||||
})*/
|
||||
})
|
||||
},
|
||||
testPlanUserList() {
|
||||
this.result = this.$get('user/list', response => {
|
||||
this.result = this.$get('user/list/orgId', response => {
|
||||
this.testPlanReceiverOptions = response.data
|
||||
this.testPlanReceiverOptions.unshift({id: 'FOUNDER', name: this.$t('api_test.creator')}, {
|
||||
id: 'EXECUTOR',
|
||||
name: this.$t('test_track.plan_view.executor')
|
||||
})
|
||||
})
|
||||
},
|
||||
handleAddTaskModel(type) {
|
||||
let Task = {};
|
||||
Task.events = [];
|
||||
Task.event = [];
|
||||
Task.userIds = [];
|
||||
Task.type = "";
|
||||
Task.webhook = "";
|
||||
|
@ -521,25 +537,24 @@ export default {
|
|||
Task.identification = "";
|
||||
if (type === 'jenkinsTask') {
|
||||
Task.taskType = 'JENKINS_TASK'
|
||||
this.form.jenkinsTask.unshift(Task)
|
||||
this.form.jenkinsTask.push(Task)
|
||||
}
|
||||
if (type === 'testPlanTask') {
|
||||
Task.taskType = 'TEST_PLAN_TASK'
|
||||
this.form.testCasePlanTask.unshift(Task)
|
||||
this.form.testCasePlanTask.push(Task)
|
||||
}
|
||||
if (type === 'reviewTask') {
|
||||
Task.taskType = 'REVIEW_TASK'
|
||||
this.form.reviewTask.unshift(Task)
|
||||
this.form.reviewTask.push(Task)
|
||||
}
|
||||
if (type === 'defectTask') {
|
||||
Task.taskType = 'DEFECT_TASK'
|
||||
this.form.defectTask.unshift(Task)
|
||||
this.form.defectTask.push(Task)
|
||||
}
|
||||
},
|
||||
|
||||
handleAddTask(index, data) {
|
||||
let list = []
|
||||
if(data.events.length>0 && data.userIds.length>0 && data.type){
|
||||
if (data.event && data.userIds.length > 0 && data.type) {
|
||||
data.isSet = false
|
||||
list.push(data)
|
||||
let param = {};
|
||||
|
@ -548,6 +563,8 @@ export default {
|
|||
this.initForm()
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
})
|
||||
} else {
|
||||
this.$warning(this.$t('organization.message.message'));
|
||||
}
|
||||
},
|
||||
removeRowTask(index, data) { //移除
|
||||
|
@ -558,7 +575,6 @@ export default {
|
|||
this.$success(this.$t('commons.delete_success'));
|
||||
this.initForm()
|
||||
})
|
||||
/*data.splice(index, 1)*/
|
||||
},
|
||||
rowClass() {
|
||||
return "text-align:center"
|
||||
|
@ -566,16 +582,54 @@ export default {
|
|||
headClass() {
|
||||
return "text-align:center;background:'#ededed'"
|
||||
},
|
||||
handleTestPlanReceivers(row) {
|
||||
console.log(row);
|
||||
let testPlanReceivers = JSON.parse(JSON.stringify(this.testPlanReceiverOptions));
|
||||
switch (row.event) {
|
||||
case "CREATE":
|
||||
testPlanReceivers.unshift({id: 'EXECUTOR', name: this.$t('test_track.plan_view.executor')})
|
||||
break;
|
||||
case "UPDATE":
|
||||
case "DELETE":
|
||||
case "COMMENT":
|
||||
testPlanReceivers.unshift({id: 'FOUNDER', name: this.$t('api_test.creator')});
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
row.testPlanReceiverOptions = testPlanReceivers;
|
||||
},
|
||||
handleReviewReceivers(row) {
|
||||
console.log(row);
|
||||
let reviewReceiverOptions = JSON.parse(JSON.stringify(this.reviewReceiverOptions));
|
||||
|
||||
switch (row.event) {
|
||||
case "CREATE":
|
||||
reviewReceiverOptions.unshift({id: 'EXECUTOR', name: this.$t('test_track.review.reviewer')})
|
||||
break;
|
||||
case "UPDATE":
|
||||
reviewReceiverOptions.unshift({id: 'FOUNDER', name: this.$t('test_track.review.review_creator')})
|
||||
break;
|
||||
case "DELETE":
|
||||
reviewReceiverOptions.unshift({id: 'FOUNDER', name: this.$t('test_track.review.review_creator')})
|
||||
break;
|
||||
case "COMMENT":
|
||||
reviewReceiverOptions.unshift({id: 'MAINTAINER', name: this.$t('test_track.case.maintainer')})
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
row.reviewReceiverOptions = reviewReceiverOptions;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/deep/ .el-select__tags {
|
||||
/*/deep/ .el-select__tags {
|
||||
flex-wrap: unset;
|
||||
overflow: auto;
|
||||
}
|
||||
}*/
|
||||
|
||||
.row {
|
||||
margin-bottom: 30px;
|
||||
|
|
|
@ -218,17 +218,23 @@ export default {
|
|||
defect_manage: 'Defect management platform',
|
||||
message_settings:'Message settings',
|
||||
message:{
|
||||
jenkins_task_notification:'Jenkins task notification',
|
||||
test_plan_task_notification:'Test plan task notification',
|
||||
test_review_task_notice:'Test review task notice',
|
||||
defect_task_notification:'Defect task notification',
|
||||
create_new_notification:'Create a new notification',
|
||||
select_events:'Select event',
|
||||
select_receiving_method:'Select receiving method',
|
||||
mail:'mail',
|
||||
nail_robot:'Nail robot',
|
||||
enterprise_wechat_robot:'Enterprise wechat robot',
|
||||
|
||||
jenkins_task_notification: 'Jenkins task notification',
|
||||
test_plan_task_notification: 'Test plan task notification',
|
||||
test_review_task_notice: 'Test review task notice',
|
||||
defect_task_notification: 'Defect task notification',
|
||||
create_new_notification: 'Create a new notification',
|
||||
select_events: 'Select event',
|
||||
select_receiving_method: 'Select receiving method',
|
||||
mail: 'mail',
|
||||
nail_robot: 'Nail robot',
|
||||
enterprise_wechat_robot: 'Enterprise wechat robot',
|
||||
notes: 'Note: 1. Event, receiving method and receiver are required;\n' +
|
||||
'\n' +
|
||||
'2. Webhook is required except email;\n' +
|
||||
'\n' +
|
||||
'3. Robots are selected as swarm robots, and "custom keyword" is selected for security verification: "task notification"',
|
||||
message: 'Event, receiver and receiving method are required\n' +
|
||||
'\n'
|
||||
},
|
||||
integration: {
|
||||
select_defect_platform: 'Please select the defect management platform to be integrated:',
|
||||
|
|
|
@ -219,17 +219,20 @@ export default {
|
|||
defect_manage: '缺陷管理平台',
|
||||
message_settings:'消息设置',
|
||||
message:{
|
||||
jenkins_task_notification:'Jenkins接口调用任务通知',
|
||||
test_plan_task_notification:'测试计划任务通知',
|
||||
test_review_task_notice:'测试评审任务通知',
|
||||
create_new_notification:'创建新通知',
|
||||
select_events:'选择事件',
|
||||
defect_task_notification:'缺陷任务通知',
|
||||
select_receiving_method:'选择接收方式',
|
||||
mail:'邮件',
|
||||
nail_robot:'钉钉机器人',
|
||||
enterprise_wechat_robot:'企业微信机器人',
|
||||
|
||||
jenkins_task_notification: 'Jenkins接口调用任务通知',
|
||||
test_plan_task_notification: '测试计划任务通知',
|
||||
test_review_task_notice: '测试评审任务通知',
|
||||
create_new_notification: '创建新通知',
|
||||
select_events: '选择事件',
|
||||
defect_task_notification: '缺陷任务通知',
|
||||
select_receiving_method: '选择接收方式',
|
||||
mail: '邮件',
|
||||
nail_robot: '钉钉机器人',
|
||||
enterprise_wechat_robot: '企业微信机器人',
|
||||
notes: '注意: 1.事件,接收方式,接收人为必填项;\n' +
|
||||
' 2.接收方式除邮件外webhook为必填;\n' +
|
||||
' 3.机器人选择为群机器人,安全验证选择“自定义关键词” :"任务通知"',
|
||||
message: '事件,接收人,接收方式为必填项'
|
||||
|
||||
|
||||
},
|
||||
|
|
|
@ -253,9 +253,16 @@ export default {
|
|||
not_integrated: '未集成該平臺',
|
||||
choose_platform: '請選擇集成的平臺',
|
||||
verified: '驗證通過',
|
||||
mail:'郵件',
|
||||
nail_robot:'釘釘機器人',
|
||||
enterprise_wechat_robot:'企業微信機器人',
|
||||
mail: '郵件',
|
||||
nail_robot: '釘釘機器人',
|
||||
enterprise_wechat_robot: '企業微信機器人',
|
||||
notes: '注意:1.事件,接收管道,接收人為必填項;\n' +
|
||||
'\n' +
|
||||
'2.接收管道除郵件外webhook為必填;\n' +
|
||||
'\n' +
|
||||
'3.機器人選擇為群機器人,安全驗證選擇“自定義關鍵字”:“任務通知”',
|
||||
message: '事件,接收人,接收管道為必填項\n' +
|
||||
'\n'
|
||||
}
|
||||
},
|
||||
project: {
|
||||
|
|
Loading…
Reference in New Issue