Merge branch 'v1.3'
This commit is contained in:
commit
28b33ff0b8
|
@ -62,7 +62,7 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-jetty</artifactId>
|
<artifactId>spring-boot-starter-undertow</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
|
|
@ -7,9 +7,11 @@ import io.metersphere.api.dto.scenario.request.HttpRequest;
|
||||||
import io.metersphere.commons.exception.MSException;
|
import io.metersphere.commons.exception.MSException;
|
||||||
import io.metersphere.commons.utils.LogUtil;
|
import io.metersphere.commons.utils.LogUtil;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.eclipse.jetty.http.HttpHeader;
|
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
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;
|
||||||
|
@ -46,21 +48,21 @@ public abstract class ApiImportAbstractParser implements ApiImportParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addContentType(HttpRequest request, String contentType) {
|
protected void addContentType(HttpRequest request, String contentType) {
|
||||||
addHeader(request, HttpHeader.CONTENT_TYPE.toString(), contentType);
|
addHeader(request, "Content-Type", contentType);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addCookie(HttpRequest request, String key, String value) {
|
protected void addCookie(HttpRequest request, String key, String value) {
|
||||||
List<KeyValue> headers = Optional.ofNullable(request.getHeaders()).orElse(new ArrayList<>());
|
List<KeyValue> headers = Optional.ofNullable(request.getHeaders()).orElse(new ArrayList<>());
|
||||||
boolean hasCookie = false;
|
boolean hasCookie = false;
|
||||||
for (KeyValue header : headers) {
|
for (KeyValue header : headers) {
|
||||||
if (StringUtils.equalsIgnoreCase(HttpHeader.COOKIE.name(), header.getName())) {
|
if (StringUtils.equalsIgnoreCase("Cookie", header.getName())) {
|
||||||
hasCookie = true;
|
hasCookie = true;
|
||||||
String cookies = Optional.ofNullable(header.getValue()).orElse("");
|
String cookies = Optional.ofNullable(header.getValue()).orElse("");
|
||||||
header.setValue(cookies + key + "=" + value + ";");
|
header.setValue(cookies + key + "=" + value + ";");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!hasCookie) {
|
if (!hasCookie) {
|
||||||
addHeader(request, HttpHeader.COOKIE.name(), key + "=" + value + ";");
|
addHeader(request, "Cookie", key + "=" + value + ";");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@ import io.metersphere.api.dto.parse.ApiImport;
|
||||||
import io.metersphere.api.dto.scenario.request.RequestType;
|
import io.metersphere.api.dto.scenario.request.RequestType;
|
||||||
import io.metersphere.commons.constants.MsRequestBodyType;
|
import io.metersphere.commons.constants.MsRequestBodyType;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.eclipse.jetty.http.HttpMethod;
|
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
@ -62,7 +61,7 @@ public class MsParser extends ApiImportAbstractParser {
|
||||||
Object body = requestObject.get("body");
|
Object body = requestObject.get("body");
|
||||||
if (body instanceof JSONArray) {
|
if (body instanceof JSONArray) {
|
||||||
JSONArray bodies = requestObject.getJSONArray("body");
|
JSONArray bodies = requestObject.getJSONArray("body");
|
||||||
if (StringUtils.equalsIgnoreCase(requestObject.getString("method"), HttpMethod.POST.name()) && bodies != null) {
|
if (StringUtils.equalsIgnoreCase(requestObject.getString("method"), "POST") && bodies != null) {
|
||||||
StringBuilder bodyStr = new StringBuilder();
|
StringBuilder bodyStr = new StringBuilder();
|
||||||
for (int i = 0; i < bodies.size(); i++) {
|
for (int i = 0; i < bodies.size(); i++) {
|
||||||
String tmp = bodies.getString(i);
|
String tmp = bodies.getString(i);
|
||||||
|
@ -75,7 +74,7 @@ public class MsParser extends ApiImportAbstractParser {
|
||||||
}
|
}
|
||||||
} else if (body instanceof JSONObject) {
|
} else if (body instanceof JSONObject) {
|
||||||
JSONObject bodyObj = requestObject.getJSONObject("body");
|
JSONObject bodyObj = requestObject.getJSONObject("body");
|
||||||
if (StringUtils.equalsIgnoreCase(requestObject.getString("method"), HttpMethod.POST.name()) && bodyObj != null) {
|
if (StringUtils.equalsIgnoreCase(requestObject.getString("method"), "POST") && bodyObj != null) {
|
||||||
JSONArray kvs = new JSONArray();
|
JSONArray kvs = new JSONArray();
|
||||||
bodyObj.keySet().forEach(key -> {
|
bodyObj.keySet().forEach(key -> {
|
||||||
JSONObject kv = new JSONObject();
|
JSONObject kv = new JSONObject();
|
||||||
|
|
|
@ -12,11 +12,11 @@ public class Notice implements Serializable {
|
||||||
|
|
||||||
private String testId;
|
private String testId;
|
||||||
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
private String enable;
|
private String enable;
|
||||||
|
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
|
private String userId;
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
}
|
}
|
|
@ -314,76 +314,6 @@ public class NoticeExample {
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andNameIsNull() {
|
|
||||||
addCriterion("`NAME` is null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andNameIsNotNull() {
|
|
||||||
addCriterion("`NAME` is not null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andNameEqualTo(String value) {
|
|
||||||
addCriterion("`NAME` =", value, "name");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andNameNotEqualTo(String value) {
|
|
||||||
addCriterion("`NAME` <>", value, "name");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andNameGreaterThan(String value) {
|
|
||||||
addCriterion("`NAME` >", value, "name");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andNameGreaterThanOrEqualTo(String value) {
|
|
||||||
addCriterion("`NAME` >=", value, "name");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andNameLessThan(String value) {
|
|
||||||
addCriterion("`NAME` <", value, "name");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andNameLessThanOrEqualTo(String value) {
|
|
||||||
addCriterion("`NAME` <=", value, "name");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andNameLike(String value) {
|
|
||||||
addCriterion("`NAME` like", value, "name");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andNameNotLike(String value) {
|
|
||||||
addCriterion("`NAME` not like", value, "name");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andNameIn(List<String> values) {
|
|
||||||
addCriterion("`NAME` in", values, "name");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andNameNotIn(List<String> values) {
|
|
||||||
addCriterion("`NAME` not in", values, "name");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andNameBetween(String value1, String value2) {
|
|
||||||
addCriterion("`NAME` between", value1, value2, "name");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andNameNotBetween(String value1, String value2) {
|
|
||||||
addCriterion("`NAME` not between", value1, value2, "name");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andEnableIsNull() {
|
public Criteria andEnableIsNull() {
|
||||||
addCriterion("`ENABLE` is null");
|
addCriterion("`ENABLE` is null");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
|
@ -523,6 +453,76 @@ public class NoticeExample {
|
||||||
addCriterion("`type` not between", value1, value2, "type");
|
addCriterion("`type` not between", value1, value2, "type");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Criteria andUserIdIsNull() {
|
||||||
|
addCriterion("user_id is null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andUserIdIsNotNull() {
|
||||||
|
addCriterion("user_id is not null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andUserIdEqualTo(String value) {
|
||||||
|
addCriterion("user_id =", value, "userId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andUserIdNotEqualTo(String value) {
|
||||||
|
addCriterion("user_id <>", value, "userId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andUserIdGreaterThan(String value) {
|
||||||
|
addCriterion("user_id >", value, "userId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andUserIdGreaterThanOrEqualTo(String value) {
|
||||||
|
addCriterion("user_id >=", value, "userId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andUserIdLessThan(String value) {
|
||||||
|
addCriterion("user_id <", value, "userId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andUserIdLessThanOrEqualTo(String value) {
|
||||||
|
addCriterion("user_id <=", value, "userId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andUserIdLike(String value) {
|
||||||
|
addCriterion("user_id like", value, "userId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andUserIdNotLike(String value) {
|
||||||
|
addCriterion("user_id not like", value, "userId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andUserIdIn(List<String> values) {
|
||||||
|
addCriterion("user_id in", values, "userId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andUserIdNotIn(List<String> values) {
|
||||||
|
addCriterion("user_id not in", values, "userId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andUserIdBetween(String value1, String value2) {
|
||||||
|
addCriterion("user_id between", value1, value2, "userId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andUserIdNotBetween(String value1, String value2) {
|
||||||
|
addCriterion("user_id not between", value1, value2, "userId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Criteria extends GeneratedCriteria {
|
public static class Criteria extends GeneratedCriteria {
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
<id column="id" jdbcType="VARCHAR" property="id" />
|
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||||
<result column="EVENT" jdbcType="VARCHAR" property="event" />
|
<result column="EVENT" jdbcType="VARCHAR" property="event" />
|
||||||
<result column="TEST_ID" jdbcType="VARCHAR" property="testId" />
|
<result column="TEST_ID" jdbcType="VARCHAR" property="testId" />
|
||||||
<result column="NAME" jdbcType="VARCHAR" property="name" />
|
|
||||||
<result column="ENABLE" jdbcType="VARCHAR" property="enable" />
|
<result column="ENABLE" jdbcType="VARCHAR" property="enable" />
|
||||||
<result column="type" jdbcType="VARCHAR" property="type" />
|
<result column="type" jdbcType="VARCHAR" property="type" />
|
||||||
|
<result column="user_id" jdbcType="VARCHAR" property="userId" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<sql id="Example_Where_Clause">
|
<sql id="Example_Where_Clause">
|
||||||
<where>
|
<where>
|
||||||
|
@ -68,7 +68,7 @@
|
||||||
</where>
|
</where>
|
||||||
</sql>
|
</sql>
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id, EVENT, TEST_ID, `NAME`, `ENABLE`, `type`
|
id, EVENT, TEST_ID, `ENABLE`, `type`, user_id
|
||||||
</sql>
|
</sql>
|
||||||
<select id="selectByExample" parameterType="io.metersphere.base.domain.NoticeExample" resultMap="BaseResultMap">
|
<select id="selectByExample" parameterType="io.metersphere.base.domain.NoticeExample" resultMap="BaseResultMap">
|
||||||
select
|
select
|
||||||
|
@ -102,9 +102,11 @@
|
||||||
</delete>
|
</delete>
|
||||||
<insert id="insert" parameterType="io.metersphere.base.domain.Notice">
|
<insert id="insert" parameterType="io.metersphere.base.domain.Notice">
|
||||||
INSERT INTO notice (id, EVENT, TEST_ID,
|
INSERT INTO notice (id, EVENT, TEST_ID,
|
||||||
`NAME`, `ENABLE`, `type`)
|
`ENABLE`, `type`, user_id
|
||||||
|
)
|
||||||
VALUES (#{id,jdbcType=VARCHAR}, #{event,jdbcType=VARCHAR}, #{testId,jdbcType=VARCHAR},
|
VALUES (#{id,jdbcType=VARCHAR}, #{event,jdbcType=VARCHAR}, #{testId,jdbcType=VARCHAR},
|
||||||
#{name,jdbcType=VARCHAR}, #{enable,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR})
|
#{enable,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}
|
||||||
|
)
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.Notice">
|
<insert id="insertSelective" parameterType="io.metersphere.base.domain.Notice">
|
||||||
insert into notice
|
insert into notice
|
||||||
|
@ -118,15 +120,15 @@
|
||||||
<if test="testId != null">
|
<if test="testId != null">
|
||||||
TEST_ID,
|
TEST_ID,
|
||||||
</if>
|
</if>
|
||||||
<if test="name != null">
|
|
||||||
`NAME`,
|
|
||||||
</if>
|
|
||||||
<if test="enable != null">
|
<if test="enable != null">
|
||||||
`ENABLE`,
|
`ENABLE`,
|
||||||
</if>
|
</if>
|
||||||
<if test="type != null">
|
<if test="type != null">
|
||||||
`type`,
|
`type`,
|
||||||
</if>
|
</if>
|
||||||
|
<if test="userId != null">
|
||||||
|
user_id,
|
||||||
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="id != null">
|
<if test="id != null">
|
||||||
|
@ -138,15 +140,15 @@
|
||||||
<if test="testId != null">
|
<if test="testId != null">
|
||||||
#{testId,jdbcType=VARCHAR},
|
#{testId,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="name != null">
|
|
||||||
#{name,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="enable != null">
|
<if test="enable != null">
|
||||||
#{enable,jdbcType=VARCHAR},
|
#{enable,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="type != null">
|
<if test="type != null">
|
||||||
#{type,jdbcType=VARCHAR},
|
#{type,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="userId != null">
|
||||||
|
#{userId,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
<select id="countByExample" parameterType="io.metersphere.base.domain.NoticeExample" resultType="java.lang.Long">
|
<select id="countByExample" parameterType="io.metersphere.base.domain.NoticeExample" resultType="java.lang.Long">
|
||||||
|
@ -167,15 +169,15 @@
|
||||||
<if test="record.testId != null">
|
<if test="record.testId != null">
|
||||||
TEST_ID = #{record.testId,jdbcType=VARCHAR},
|
TEST_ID = #{record.testId,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="record.name != null">
|
|
||||||
`NAME` = #{record.name,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="record.enable != null">
|
<if test="record.enable != null">
|
||||||
`ENABLE` = #{record.enable,jdbcType=VARCHAR},
|
`ENABLE` = #{record.enable,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="record.type != null">
|
<if test="record.type != null">
|
||||||
`type` = #{record.type,jdbcType=VARCHAR},
|
`type` = #{record.type,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="record.userId != null">
|
||||||
|
user_id = #{record.userId,jdbcType=VARCHAR},
|
||||||
|
</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" />
|
||||||
|
@ -186,9 +188,9 @@
|
||||||
set id = #{record.id,jdbcType=VARCHAR},
|
set id = #{record.id,jdbcType=VARCHAR},
|
||||||
EVENT = #{record.event,jdbcType=VARCHAR},
|
EVENT = #{record.event,jdbcType=VARCHAR},
|
||||||
TEST_ID = #{record.testId,jdbcType=VARCHAR},
|
TEST_ID = #{record.testId,jdbcType=VARCHAR},
|
||||||
`NAME` = #{record.name,jdbcType=VARCHAR},
|
|
||||||
`ENABLE` = #{record.enable,jdbcType=VARCHAR},
|
`ENABLE` = #{record.enable,jdbcType=VARCHAR},
|
||||||
`type` = #{record.type,jdbcType=VARCHAR}
|
`type` = #{record.type,jdbcType=VARCHAR},
|
||||||
|
user_id = #{record.userId,jdbcType=VARCHAR}
|
||||||
<if test="_parameter != null">
|
<if test="_parameter != null">
|
||||||
<include refid="Update_By_Example_Where_Clause" />
|
<include refid="Update_By_Example_Where_Clause" />
|
||||||
</if>
|
</if>
|
||||||
|
@ -202,15 +204,15 @@
|
||||||
<if test="testId != null">
|
<if test="testId != null">
|
||||||
TEST_ID = #{testId,jdbcType=VARCHAR},
|
TEST_ID = #{testId,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="name != null">
|
|
||||||
`NAME` = #{name,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="enable != null">
|
<if test="enable != null">
|
||||||
`ENABLE` = #{enable,jdbcType=VARCHAR},
|
`ENABLE` = #{enable,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="type != null">
|
<if test="type != null">
|
||||||
`type` = #{type,jdbcType=VARCHAR},
|
`type` = #{type,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="userId != null">
|
||||||
|
user_id = #{userId,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
</set>
|
</set>
|
||||||
where id = #{id,jdbcType=VARCHAR}
|
where id = #{id,jdbcType=VARCHAR}
|
||||||
</update>
|
</update>
|
||||||
|
@ -218,9 +220,9 @@
|
||||||
UPDATE notice
|
UPDATE notice
|
||||||
SET EVENT = #{event,jdbcType=VARCHAR},
|
SET EVENT = #{event,jdbcType=VARCHAR},
|
||||||
TEST_ID = #{testId,jdbcType=VARCHAR},
|
TEST_ID = #{testId,jdbcType=VARCHAR},
|
||||||
`NAME` = #{name,jdbcType=VARCHAR},
|
|
||||||
`ENABLE` = #{enable,jdbcType=VARCHAR},
|
`ENABLE` = #{enable,jdbcType=VARCHAR},
|
||||||
`type` = #{type,jdbcType=VARCHAR}
|
`type` = #{type,jdbcType=VARCHAR},
|
||||||
|
user_id = #{userId,jdbcType=VARCHAR}
|
||||||
WHERE id = #{id,jdbcType=VARCHAR}
|
WHERE id = #{id,jdbcType=VARCHAR}
|
||||||
</update>
|
</update>
|
||||||
</mapper>
|
</mapper>
|
|
@ -16,8 +16,6 @@ public interface ExtUserMapper {
|
||||||
|
|
||||||
List<User> searchUser(String condition);
|
List<User> searchUser(String condition);
|
||||||
|
|
||||||
List<String> queryEmails(String[] names);
|
|
||||||
|
|
||||||
List<String> queryEmailByIds(List<String> userIds);
|
List<String> queryEmailByIds(List<String> userIds);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,18 +33,6 @@
|
||||||
</where>
|
</where>
|
||||||
order by u.update_time desc
|
order by u.update_time desc
|
||||||
</select>
|
</select>
|
||||||
<!--查询邮箱-->
|
|
||||||
<select id="queryEmails" parameterType="java.lang.String" resultType="java.lang.String">
|
|
||||||
SELECT
|
|
||||||
email
|
|
||||||
from user
|
|
||||||
WHERE name IN
|
|
||||||
<foreach collection="array" item="id" index="index"
|
|
||||||
open="(" close=")" separator=",">
|
|
||||||
#{id}
|
|
||||||
</foreach>
|
|
||||||
|
|
||||||
</select>
|
|
||||||
<select id="queryEmailByIds" parameterType="java.lang.String" resultType="java.lang.String">
|
<select id="queryEmailByIds" parameterType="java.lang.String" resultType="java.lang.String">
|
||||||
SELECT
|
SELECT
|
||||||
email
|
email
|
||||||
|
|
|
@ -3,7 +3,10 @@ package io.metersphere.notice.domain;
|
||||||
import io.metersphere.base.domain.Notice;
|
import io.metersphere.base.domain.Notice;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class NoticeDetail extends Notice {
|
public class NoticeDetail extends Notice {
|
||||||
private String[] names;
|
private List<String> userIds = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -231,10 +231,10 @@ public class MailService {
|
||||||
if (noticeList.size() > 0) {
|
if (noticeList.size() > 0) {
|
||||||
for (NoticeDetail n : noticeList) {
|
for (NoticeDetail n : noticeList) {
|
||||||
if (StringUtils.equals(n.getEnable(), "true") && StringUtils.equals(n.getEvent(), NoticeConstants.EXECUTE_SUCCESSFUL)) {
|
if (StringUtils.equals(n.getEnable(), "true") && StringUtils.equals(n.getEvent(), NoticeConstants.EXECUTE_SUCCESSFUL)) {
|
||||||
successEmailList = userService.queryEmail(n.getNames());
|
successEmailList = userService.queryEmail(n.getUserIds());
|
||||||
}
|
}
|
||||||
if (StringUtils.equals(n.getEnable(), "true") && StringUtils.equals(n.getEvent(), NoticeConstants.EXECUTE_FAILED)) {
|
if (StringUtils.equals(n.getEnable(), "true") && StringUtils.equals(n.getEvent(), NoticeConstants.EXECUTE_FAILED)) {
|
||||||
failEmailList = userService.queryEmail(n.getNames());
|
failEmailList = userService.queryEmail(n.getUserIds());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -5,6 +5,7 @@ import io.metersphere.base.domain.NoticeExample;
|
||||||
import io.metersphere.base.mapper.NoticeMapper;
|
import io.metersphere.base.mapper.NoticeMapper;
|
||||||
import io.metersphere.notice.controller.request.NoticeRequest;
|
import io.metersphere.notice.controller.request.NoticeRequest;
|
||||||
import io.metersphere.notice.domain.NoticeDetail;
|
import io.metersphere.notice.domain.NoticeDetail;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
@ -28,14 +29,14 @@ public class NoticeService {
|
||||||
noticeMapper.deleteByExample(example);
|
noticeMapper.deleteByExample(example);
|
||||||
}
|
}
|
||||||
noticeRequest.getNotices().forEach(n -> {
|
noticeRequest.getNotices().forEach(n -> {
|
||||||
if (n.getNames().length > 0) {
|
if (CollectionUtils.isNotEmpty(n.getUserIds())) {
|
||||||
for (String x : n.getNames()) {
|
for (String x : n.getUserIds()) {
|
||||||
Notice notice = new Notice();
|
Notice notice = new Notice();
|
||||||
notice.setId(UUID.randomUUID().toString());
|
notice.setId(UUID.randomUUID().toString());
|
||||||
notice.setEvent(n.getEvent());
|
notice.setEvent(n.getEvent());
|
||||||
notice.setEnable(n.getEnable());
|
notice.setEnable(n.getEnable());
|
||||||
notice.setTestId(noticeRequest.getTestId());
|
notice.setTestId(noticeRequest.getTestId());
|
||||||
notice.setName(x);
|
notice.setUserId(x);
|
||||||
notice.setType(n.getType());
|
notice.setType(n.getType());
|
||||||
noticeMapper.insert(notice);
|
noticeMapper.insert(notice);
|
||||||
}
|
}
|
||||||
|
@ -48,33 +49,29 @@ public class NoticeService {
|
||||||
example.createCriteria().andTestIdEqualTo(id);
|
example.createCriteria().andTestIdEqualTo(id);
|
||||||
List<Notice> notices = noticeMapper.selectByExample(example);
|
List<Notice> notices = noticeMapper.selectByExample(example);
|
||||||
List<NoticeDetail> result = new ArrayList<>();
|
List<NoticeDetail> result = new ArrayList<>();
|
||||||
List<String> success = new ArrayList<>();
|
List<String> successList = new ArrayList<>();
|
||||||
List<String> fail = new ArrayList<>();
|
List<String> failList = new ArrayList<>();
|
||||||
String[] successArray;
|
|
||||||
String[] failArray;
|
|
||||||
NoticeDetail notice1 = new NoticeDetail();
|
NoticeDetail notice1 = new NoticeDetail();
|
||||||
NoticeDetail notice2 = new NoticeDetail();
|
NoticeDetail notice2 = new NoticeDetail();
|
||||||
if (notices.size() > 0) {
|
if (notices.size() > 0) {
|
||||||
for (Notice n : notices) {
|
for (Notice n : notices) {
|
||||||
if (n.getEvent().equals(EXECUTE_SUCCESSFUL)) {
|
if (n.getEvent().equals(EXECUTE_SUCCESSFUL)) {
|
||||||
success.add(n.getName());
|
successList.add(n.getUserId());
|
||||||
notice1.setEnable(n.getEnable());
|
notice1.setEnable(n.getEnable());
|
||||||
notice1.setTestId(id);
|
notice1.setTestId(id);
|
||||||
notice1.setType(n.getType());
|
notice1.setType(n.getType());
|
||||||
notice1.setEvent(n.getEvent());
|
notice1.setEvent(n.getEvent());
|
||||||
}
|
}
|
||||||
if (n.getEvent().equals(EXECUTE_FAILED)) {
|
if (n.getEvent().equals(EXECUTE_FAILED)) {
|
||||||
fail.add(n.getName());
|
failList.add(n.getUserId());
|
||||||
notice2.setEnable(n.getEnable());
|
notice2.setEnable(n.getEnable());
|
||||||
notice2.setTestId(id);
|
notice2.setTestId(id);
|
||||||
notice2.setType(n.getType());
|
notice2.setType(n.getType());
|
||||||
notice2.setEvent(n.getEvent());
|
notice2.setEvent(n.getEvent());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
successArray = success.toArray(new String[0]);
|
notice1.setUserIds(successList);
|
||||||
failArray = fail.toArray(new String[0]);
|
notice2.setUserIds(failList);
|
||||||
notice1.setNames(successArray);
|
|
||||||
notice2.setNames(failArray);
|
|
||||||
result.add(notice1);
|
result.add(notice1);
|
||||||
result.add(notice2);
|
result.add(notice2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@ -62,8 +61,8 @@ public class UserService {
|
||||||
@Resource
|
@Resource
|
||||||
private WorkspaceService workspaceService;
|
private WorkspaceService workspaceService;
|
||||||
|
|
||||||
public List<String> queryEmail(String[] names) {
|
public List<String> queryEmail(List<String> userIds) {
|
||||||
return extUserMapper.queryEmails(names);
|
return extUserMapper.queryEmailByIds(userIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> queryEmailByIds(List<String> userIds) {
|
public List<String> queryEmailByIds(List<String> userIds) {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit c2dacf960cdb1ed35664bdd3432120b1203b73d8
|
Subproject commit cf6b06526324326a563d933e07118fac014a63b4
|
|
@ -0,0 +1,10 @@
|
||||||
|
ALTER TABLE notice
|
||||||
|
ADD user_id VARCHAR(50) NULL;
|
||||||
|
UPDATE notice
|
||||||
|
SET notice.user_id = (
|
||||||
|
SELECT id
|
||||||
|
FROM user
|
||||||
|
WHERE notice.NAME = user.name
|
||||||
|
);
|
||||||
|
ALTER TABLE notice
|
||||||
|
DROP COLUMN name;
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
<el-tab-pane v-if="activeName == 'body'" :disabled="true" name="mode" class="pane assertions">
|
<el-tab-pane v-if="activeName == 'body'" :disabled="true" name="mode" class="pane assertions">
|
||||||
<template v-slot:label>
|
<template v-slot:label>
|
||||||
<ms-dropdown :commands="modes" @command="modeChange"/>
|
<ms-dropdown :commands="modes" :default-command="mode" @command="modeChange"/>
|
||||||
</template>
|
</template>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
|
|
||||||
|
@ -64,8 +64,11 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
created() {
|
mounted() {
|
||||||
console.log(this.response.headers);
|
console.log(this.response.headers);
|
||||||
|
if (!this.response.headers) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (this.response.headers.indexOf("Content-Type: application/json") > 0) {
|
if (this.response.headers.indexOf("Content-Type: application/json") > 0) {
|
||||||
this.mode = BODY_FORMAT.JSON;
|
this.mode = BODY_FORMAT.JSON;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,14 +50,14 @@
|
||||||
width="240"
|
width="240"
|
||||||
>
|
>
|
||||||
<template v-slot:default="{row}">
|
<template v-slot:default="{row}">
|
||||||
<el-select v-model="row.names" filterable multiple
|
<el-select v-model="row.userIds" filterable multiple
|
||||||
:placeholder="$t('commons.please_select')"
|
:placeholder="$t('commons.please_select')"
|
||||||
@click.native="userList()" style="width: 100%;">
|
@click.native="userList()" style="width: 100%;">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in options"
|
v-for="item in options"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.name"
|
:label="item.name"
|
||||||
:value="item.name">
|
:value="item.id">
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</template>
|
</template>
|
||||||
|
@ -154,13 +154,13 @@ export default {
|
||||||
{
|
{
|
||||||
event: "EXECUTE_SUCCESSFUL",
|
event: "EXECUTE_SUCCESSFUL",
|
||||||
type: "EMAIL",
|
type: "EMAIL",
|
||||||
names: [],
|
userIds: [],
|
||||||
enable: false
|
enable: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
event: "EXECUTE_FAILED",
|
event: "EXECUTE_FAILED",
|
||||||
type: "EMAIL",
|
type: "EMAIL",
|
||||||
names: [],
|
userIds: [],
|
||||||
enable: false
|
enable: false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -190,8 +190,8 @@ export default {
|
||||||
this.tableData[1].event = "EXECUTE_FAILED"
|
this.tableData[1].event = "EXECUTE_FAILED"
|
||||||
this.tableData[1].type = "EMAIL"
|
this.tableData[1].type = "EMAIL"
|
||||||
} else {
|
} else {
|
||||||
this.tableData[0].names = []
|
this.tableData[0].userIds = []
|
||||||
this.tableData[1].names = []
|
this.tableData[1].userIds = []
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit cc38137a69a0f20fadece9c0f9f50a9468c4ace9
|
Subproject commit 06d935cd1d22ab36f09763745c2aff8ad3fb08c1
|
Loading…
Reference in New Issue