Merge remote-tracking branch 'origin/master'

This commit is contained in:
q4speed 2020-10-19 17:44:45 +08:00
commit b5b09842e7
22 changed files with 257 additions and 132 deletions

View File

@ -1,8 +1,7 @@
package io.metersphere.base.domain; package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import lombok.Data;
@Data @Data
public class MessageTask implements Serializable { public class MessageTask implements Serializable {
@ -18,5 +17,7 @@ public class MessageTask implements Serializable {
private String webhook; private String webhook;
private String identification;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }

View File

@ -523,6 +523,76 @@ public class MessageTaskExample {
addCriterion("webhook not between", value1, value2, "webhook"); addCriterion("webhook not between", value1, value2, "webhook");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIdentificationIsNull() {
addCriterion("identification is null");
return (Criteria) this;
}
public Criteria andIdentificationIsNotNull() {
addCriterion("identification is not null");
return (Criteria) this;
}
public Criteria andIdentificationEqualTo(String value) {
addCriterion("identification =", value, "identification");
return (Criteria) this;
}
public Criteria andIdentificationNotEqualTo(String value) {
addCriterion("identification <>", value, "identification");
return (Criteria) this;
}
public Criteria andIdentificationGreaterThan(String value) {
addCriterion("identification >", value, "identification");
return (Criteria) this;
}
public Criteria andIdentificationGreaterThanOrEqualTo(String value) {
addCriterion("identification >=", value, "identification");
return (Criteria) this;
}
public Criteria andIdentificationLessThan(String value) {
addCriterion("identification <", value, "identification");
return (Criteria) this;
}
public Criteria andIdentificationLessThanOrEqualTo(String value) {
addCriterion("identification <=", value, "identification");
return (Criteria) this;
}
public Criteria andIdentificationLike(String value) {
addCriterion("identification like", value, "identification");
return (Criteria) this;
}
public Criteria andIdentificationNotLike(String value) {
addCriterion("identification not like", value, "identification");
return (Criteria) this;
}
public Criteria andIdentificationIn(List<String> values) {
addCriterion("identification in", values, "identification");
return (Criteria) this;
}
public Criteria andIdentificationNotIn(List<String> values) {
addCriterion("identification not in", values, "identification");
return (Criteria) this;
}
public Criteria andIdentificationBetween(String value1, String value2) {
addCriterion("identification between", value1, value2, "identification");
return (Criteria) this;
}
public Criteria andIdentificationNotBetween(String value1, String value2) {
addCriterion("identification not between", value1, value2, "identification");
return (Criteria) this;
}
} }
public static class Criteria extends GeneratedCriteria { public static class Criteria extends GeneratedCriteria {

View File

@ -1,8 +1,7 @@
package io.metersphere.base.domain; package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import lombok.Data;
@Data @Data
public class Notice implements Serializable { public class Notice implements Serializable {

View File

@ -2,9 +2,8 @@ package io.metersphere.base.mapper;
import io.metersphere.base.domain.MessageTask; import io.metersphere.base.domain.MessageTask;
import io.metersphere.base.domain.MessageTaskExample; import io.metersphere.base.domain.MessageTaskExample;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface MessageTaskMapper { public interface MessageTaskMapper {
long countByExample(MessageTaskExample example); long countByExample(MessageTaskExample example);

View File

@ -8,6 +8,7 @@
<result column="user_id" jdbcType="VARCHAR" property="userId" /> <result column="user_id" jdbcType="VARCHAR" property="userId" />
<result column="task_type" jdbcType="VARCHAR" property="taskType" /> <result column="task_type" jdbcType="VARCHAR" property="taskType" />
<result column="webhook" jdbcType="VARCHAR" property="webhook" /> <result column="webhook" jdbcType="VARCHAR" property="webhook" />
<result column="identification" jdbcType="VARCHAR" property="identification" />
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<where> <where>
@ -20,13 +21,13 @@
and ${criterion.condition} and ${criterion.condition}
</when> </when>
<when test="criterion.singleValue"> <when test="criterion.singleValue">
AND ${criterion.condition} #{criterion.value} and ${criterion.condition} #{criterion.value}
</when> </when>
<when test="criterion.betweenValue"> <when test="criterion.betweenValue">
AND ${criterion.condition} #{criterion.value} AND #{criterion.secondValue} and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when> </when>
<when test="criterion.listValue"> <when test="criterion.listValue">
AND ${criterion.condition} and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem} #{listItem}
</foreach> </foreach>
@ -49,13 +50,13 @@
and ${criterion.condition} and ${criterion.condition}
</when> </when>
<when test="criterion.singleValue"> <when test="criterion.singleValue">
AND ${criterion.condition} #{criterion.value} and ${criterion.condition} #{criterion.value}
</when> </when>
<when test="criterion.betweenValue"> <when test="criterion.betweenValue">
AND ${criterion.condition} #{criterion.value} AND #{criterion.secondValue} and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when> </when>
<when test="criterion.listValue"> <when test="criterion.listValue">
AND ${criterion.condition} and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem} #{listItem}
</foreach> </foreach>
@ -68,48 +69,48 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, `type`, event, user_id, task_type, webhook id, `type`, event, user_id, task_type, webhook, identification
</sql> </sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.MessageTaskExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="io.metersphere.base.domain.MessageTaskExample" resultMap="BaseResultMap">
SELECT select
<if test="distinct"> <if test="distinct">
DISTINCT distinct
</if> </if>
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
FROM message_task from message_task
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause" /> <include refid="Example_Where_Clause" />
</if> </if>
<if test="orderByClause != null"> <if test="orderByClause != null">
ORDER BY ${orderByClause} order by ${orderByClause}
</if> </if>
</select> </select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap"> <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
SELECT select
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
FROM message_task from message_task
WHERE id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</select> </select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String"> <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
DELETE FROM message_task delete from message_task
WHERE id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</delete> </delete>
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.MessageTaskExample"> <delete id="deleteByExample" parameterType="io.metersphere.base.domain.MessageTaskExample">
DELETE FROM message_task delete from message_task
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause" /> <include refid="Example_Where_Clause" />
</if> </if>
</delete> </delete>
<insert id="insert" parameterType="io.metersphere.base.domain.MessageTask"> <insert id="insert" parameterType="io.metersphere.base.domain.MessageTask">
INSERT INTO message_task (id, `type`, event, insert into message_task (id, `type`, event,
user_id, task_type, webhook user_id, task_type, webhook,
) identification)
VALUES (#{id,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{event,jdbcType=VARCHAR}, values (#{id,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{event,jdbcType=VARCHAR},
#{userId,jdbcType=VARCHAR}, #{taskType,jdbcType=VARCHAR}, #{webhook,jdbcType=VARCHAR} #{userId,jdbcType=VARCHAR}, #{taskType,jdbcType=VARCHAR}, #{webhook,jdbcType=VARCHAR},
) #{identification,jdbcType=VARCHAR})
</insert> </insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.MessageTask"> <insert id="insertSelective" parameterType="io.metersphere.base.domain.MessageTask">
INSERT INTO message_task insert into message_task
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
id, id,
@ -129,6 +130,9 @@
<if test="webhook != null"> <if test="webhook != null">
webhook, webhook,
</if> </if>
<if test="identification != null">
identification,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
@ -149,16 +153,19 @@
<if test="webhook != null"> <if test="webhook != null">
#{webhook,jdbcType=VARCHAR}, #{webhook,jdbcType=VARCHAR},
</if> </if>
<if test="identification != null">
#{identification,jdbcType=VARCHAR},
</if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.MessageTaskExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="io.metersphere.base.domain.MessageTaskExample" resultType="java.lang.Long">
SELECT count(*) FROM message_task select count(*) from message_task
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause" /> <include refid="Example_Where_Clause" />
</if> </if>
</select> </select>
<update id="updateByExampleSelective" parameterType="map"> <update id="updateByExampleSelective" parameterType="map">
UPDATE message_task update message_task
<set> <set>
<if test="record.id != null"> <if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR}, id = #{record.id,jdbcType=VARCHAR},
@ -178,25 +185,29 @@
<if test="record.webhook != null"> <if test="record.webhook != null">
webhook = #{record.webhook,jdbcType=VARCHAR}, webhook = #{record.webhook,jdbcType=VARCHAR},
</if> </if>
<if test="record.identification != null">
identification = #{record.identification,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" />
</if> </if>
</update> </update>
<update id="updateByExample" parameterType="map"> <update id="updateByExample" parameterType="map">
UPDATE message_task update message_task
SET id = #{record.id,jdbcType=VARCHAR}, set id = #{record.id,jdbcType=VARCHAR},
`type` = #{record.type,jdbcType=VARCHAR}, `type` = #{record.type,jdbcType=VARCHAR},
event = #{record.event,jdbcType=VARCHAR}, event = #{record.event,jdbcType=VARCHAR},
user_id = #{record.userId,jdbcType=VARCHAR}, user_id = #{record.userId,jdbcType=VARCHAR},
task_type = #{record.taskType,jdbcType=VARCHAR}, task_type = #{record.taskType,jdbcType=VARCHAR},
webhook = #{record.webhook,jdbcType=VARCHAR} webhook = #{record.webhook,jdbcType=VARCHAR},
identification = #{record.identification,jdbcType=VARCHAR}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
</update> </update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.MessageTask"> <update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.MessageTask">
UPDATE message_task update message_task
<set> <set>
<if test="type != null"> <if test="type != null">
`type` = #{type,jdbcType=VARCHAR}, `type` = #{type,jdbcType=VARCHAR},
@ -213,16 +224,20 @@
<if test="webhook != null"> <if test="webhook != null">
webhook = #{webhook,jdbcType=VARCHAR}, webhook = #{webhook,jdbcType=VARCHAR},
</if> </if>
<if test="identification != null">
identification = #{identification,jdbcType=VARCHAR},
</if>
</set> </set>
WHERE id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</update> </update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.MessageTask"> <update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.MessageTask">
UPDATE message_task update message_task
SET `type` = #{type,jdbcType=VARCHAR}, set `type` = #{type,jdbcType=VARCHAR},
event = #{event,jdbcType=VARCHAR}, event = #{event,jdbcType=VARCHAR},
user_id = #{userId,jdbcType=VARCHAR}, user_id = #{userId,jdbcType=VARCHAR},
task_type = #{taskType,jdbcType=VARCHAR}, task_type = #{taskType,jdbcType=VARCHAR},
webhook = #{webhook,jdbcType=VARCHAR} webhook = #{webhook,jdbcType=VARCHAR},
WHERE id = #{id,jdbcType=VARCHAR} identification = #{identification,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update> </update>
</mapper> </mapper>

View File

@ -2,9 +2,8 @@ package io.metersphere.base.mapper;
import io.metersphere.base.domain.Notice; import io.metersphere.base.domain.Notice;
import io.metersphere.base.domain.NoticeExample; import io.metersphere.base.domain.NoticeExample;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface NoticeMapper { public interface NoticeMapper {
long countByExample(NoticeExample example); long countByExample(NoticeExample example);

View File

@ -91,8 +91,8 @@
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</select> </select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String"> <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
DELETE FROM notice delete from notice
WHERE id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</delete> </delete>
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.NoticeExample"> <delete id="deleteByExample" parameterType="io.metersphere.base.domain.NoticeExample">
delete from notice delete from notice
@ -101,10 +101,10 @@
</if> </if>
</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,
`ENABLE`, `type`, user_id `ENABLE`, `type`, user_id
) )
VALUES (#{id,jdbcType=VARCHAR}, #{event,jdbcType=VARCHAR}, #{testId,jdbcType=VARCHAR}, values (#{id,jdbcType=VARCHAR}, #{event,jdbcType=VARCHAR}, #{testId,jdbcType=VARCHAR},
#{enable,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR} #{enable,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}
) )
</insert> </insert>
@ -217,12 +217,12 @@
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</update> </update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.Notice"> <update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.Notice">
UPDATE notice update notice
SET EVENT = #{event,jdbcType=VARCHAR}, set EVENT = #{event,jdbcType=VARCHAR},
TEST_ID = #{testId,jdbcType=VARCHAR}, TEST_ID = #{testId,jdbcType=VARCHAR},
`ENABLE` = #{enable,jdbcType=VARCHAR}, `ENABLE` = #{enable,jdbcType=VARCHAR},
`type` = #{type,jdbcType=VARCHAR}, `type` = #{type,jdbcType=VARCHAR},
user_id = #{userId,jdbcType=VARCHAR} user_id = #{userId,jdbcType=VARCHAR}
WHERE id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</update> </update>
</mapper> </mapper>

View File

@ -1,7 +1,9 @@
package io.metersphere.commons.constants; package io.metersphere.commons.constants;
public enum FileType { public enum FileType {
JMX(".jmx"), CSV(".csv"), JSON(".json"), PDF(".pdf"), JPG(".jpg"), PNG(".png"); JMX(".jmx"), CSV(".csv"), JSON(".json"), PDF(".pdf"),
JPG(".jpg"), PNG(".png"), JPEG(".jpeg"), DOC(".doc"),
XLSX(".xlsx"), DOCX(".docx");
// 保存后缀 // 保存后缀
private String suffix; private String suffix;

View File

@ -86,6 +86,7 @@ public class NoticeService {
} }
public void saveMessageTask(MessageRequest messageRequest) { public void saveMessageTask(MessageRequest messageRequest) {
String identification=UUID.randomUUID().toString();
messageRequest.getMessageDetail().forEach(list -> { messageRequest.getMessageDetail().forEach(list -> {
list.getEvents().forEach(n -> { list.getEvents().forEach(n -> {
list.getUserIds().forEach(m -> { list.getUserIds().forEach(m -> {
@ -96,6 +97,7 @@ public class NoticeService {
message.setUserId(m); message.setUserId(m);
message.setType(list.getType()); message.setType(list.getType());
message.setWebhook(list.getWebhook()); message.setWebhook(list.getWebhook());
message.setIdentification(identification);
messageTaskMapper.insert(message); messageTaskMapper.insert(message);
}); });
}); });

View File

@ -286,6 +286,7 @@ public class TestCaseService {
testCaseNodeService.createNodes(xmindParser.getNodePaths(), projectId); testCaseNodeService.createNodes(xmindParser.getNodePaths(), projectId);
} }
if (!xmindParser.getTestCase().isEmpty()) { if (!xmindParser.getTestCase().isEmpty()) {
Collections.reverse(xmindParser.getTestCase());
this.saveImportData(xmindParser.getTestCase(), projectId); this.saveImportData(xmindParser.getTestCase(), projectId);
xmindParser.clear(); xmindParser.clear();
} }
@ -335,6 +336,9 @@ public class TestCaseService {
AtomicInteger num = new AtomicInteger(); AtomicInteger num = new AtomicInteger();
num.set(getNextNum(projectId) + testCases.size()); num.set(getNextNum(projectId) + testCases.size());
testCases.forEach(testcase -> { testCases.forEach(testcase -> {
testcase.setId(UUID.randomUUID().toString());
testcase.setCreateTime(System.currentTimeMillis());
testcase.setUpdateTime(System.currentTimeMillis());
testcase.setNodeId(nodePathMap.get(testcase.getNodePath())); testcase.setNodeId(nodePathMap.get(testcase.getNodePath()));
testcase.setSort(sort.getAndIncrement()); testcase.setSort(sort.getAndIncrement());
testcase.setNum(num.decrementAndGet()); testcase.setNum(num.decrementAndGet());

View File

@ -110,12 +110,6 @@ public class TestReviewTestCaseService {
MSException.throwException("非此用例的评审人员!"); MSException.throwException("非此用例的评审人员!");
} }
TestCaseReview testCaseReview = testCaseReviewMapper.selectByPrimaryKey(reviewId);
Long endTime = testCaseReview.getEndTime();
if (System.currentTimeMillis() > endTime) {
MSException.throwException("此用例评审已到截止时间!");
}
// 记录测试用例评审状态变更 // 记录测试用例评审状态变更
testCaseReviewTestCase.setStatus(testCaseReviewTestCase.getStatus()); testCaseReviewTestCase.setStatus(testCaseReviewTestCase.getStatus());
testCaseReviewTestCase.setReviewer(SessionUtils.getUser().getId()); testCaseReviewTestCase.setReviewer(SessionUtils.getUser().getId());

View File

@ -6,7 +6,6 @@ import com.google.common.collect.ImmutableMap;
import io.metersphere.base.domain.TestCaseWithBLOBs; import io.metersphere.base.domain.TestCaseWithBLOBs;
import io.metersphere.commons.constants.TestCaseConstants; import io.metersphere.commons.constants.TestCaseConstants;
import io.metersphere.commons.utils.BeanUtils; import io.metersphere.commons.utils.BeanUtils;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.excel.domain.TestCaseExcelData; import io.metersphere.excel.domain.TestCaseExcelData;
import io.metersphere.i18n.Translator; import io.metersphere.i18n.Translator;
import io.metersphere.track.service.TestCaseService; import io.metersphere.track.service.TestCaseService;
@ -82,6 +81,7 @@ public class XmindCaseParser {
} }
private final Map<String, String> caseTypeMap = ImmutableMap.of("功能测试", "functional", "性能测试", "performance", "接口测试", "api"); private final Map<String, String> caseTypeMap = ImmutableMap.of("功能测试", "functional", "性能测试", "performance", "接口测试", "api");
private final List<String> priorityList = Arrays.asList("P0", "P1", "P2", "P3");
/** /**
* 验证模块的合规性 * 验证模块的合规性
@ -111,6 +111,14 @@ public class XmindCaseParser {
*/ */
private boolean validate(TestCaseWithBLOBs data) { private boolean validate(TestCaseWithBLOBs data) {
String nodePath = data.getNodePath(); String nodePath = data.getNodePath();
if (!nodePath.startsWith("/")) {
nodePath = "/" + nodePath;
}
if (nodePath.endsWith("/")) {
nodePath = nodePath.substring(0, nodePath.length() - 1);
}
data.setNodePath(nodePath);
StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
if (data.getName().length() > 50) { if (data.getName().length() > 50) {
@ -141,17 +149,33 @@ public class XmindCaseParser {
if (testCaseNames.contains(data.getName())) { if (testCaseNames.contains(data.getName())) {
boolean dbExist = testCaseService.exist(data); boolean dbExist = testCaseService.exist(data);
if (dbExist) { if (dbExist) {
// db exist
stringBuilder.append(Translator.get("test_case_already_exists_excel") + "" + data.getName() + "; "); stringBuilder.append(Translator.get("test_case_already_exists_excel") + "" + data.getName() + "; ");
} }
} else { } else {
testCaseNames.add(data.getName()); testCaseNames.add(data.getName());
} }
// 用例等级和用例性质处理
if (!priorityList.contains(data.getPriority())) {
stringBuilder.append(data.getName() + "" + Translator.get("test_case_priority") + Translator.get("incorrect_format") + "; ");
}
if (data.getType() == null) {
stringBuilder.append(data.getName() + "" + Translator.get("test_case_type") + Translator.get("incorrect_format") + "; ");
}
// 重复用例校验
TestCaseExcelData compartData = new TestCaseExcelData();
BeanUtils.copyBean(compartData, data);
if (compartDatas.contains(compartData)) {
stringBuilder.append(Translator.get("test_case_already_exists_excel") + "" + compartData.getName() + "; ");
}
if (!StringUtils.isEmpty(stringBuilder.toString())) { if (!StringUtils.isEmpty(stringBuilder.toString())) {
process.append(stringBuilder.toString()); process.append(stringBuilder.toString());
return false; return false;
} }
compartDatas.add(compartData);
return true; return true;
} }
@ -162,7 +186,7 @@ public class XmindCaseParser {
for (Attached item : attacheds) { for (Attached item : attacheds) {
if (isAvailable(item.getTitle(), TC_REGEX)) { if (isAvailable(item.getTitle(), TC_REGEX)) {
item.setParent(parent); item.setParent(parent);
this.newTestCase(item.getTitle(), parent.getPath(), item.getChildren() != null ? item.getChildren().getAttached() : null); this.formatTestCase(item.getTitle(), parent.getPath(), item.getChildren() != null ? item.getChildren().getAttached() : null);
} else { } else {
String nodePath = parent.getPath() + "/" + item.getTitle(); String nodePath = parent.getPath() + "/" + item.getTitle();
item.setPath(nodePath); item.setPath(nodePath);
@ -207,27 +231,36 @@ public class XmindCaseParser {
*/ */
private String getSteps(List<Attached> attacheds) { private String getSteps(List<Attached> attacheds) {
JSONArray jsonArray = new JSONArray(); JSONArray jsonArray = new JSONArray();
for (int i = 0; i < attacheds.size(); i++) { if (!attacheds.isEmpty()) {
for (int i = 0; i < attacheds.size(); i++) {
// 保持插入顺序判断用例是否有相同的steps
JSONObject step = new JSONObject(true);
step.put("num", i + 1);
step.put("desc", attacheds.get(i).getTitle());
if (attacheds.get(i).getChildren() != null && !attacheds.get(i).getChildren().getAttached().isEmpty()) {
step.put("result", attacheds.get(i).getChildren().getAttached().get(0).getTitle());
}
jsonArray.add(step);
}
} else {
// 保持插入顺序判断用例是否有相同的steps // 保持插入顺序判断用例是否有相同的steps
JSONObject step = new JSONObject(true); JSONObject step = new JSONObject(true);
step.put("num", i + 1); step.put("num", 1);
step.put("desc", attacheds.get(i).getTitle()); step.put("desc", "");
if (attacheds.get(i).getChildren() != null && !attacheds.get(i).getChildren().getAttached().isEmpty()) { step.put("result", "");
step.put("result", attacheds.get(i).getChildren().getAttached().get(0).getTitle());
}
jsonArray.add(step); jsonArray.add(step);
} }
return jsonArray.toJSONString(); return jsonArray.toJSONString();
} }
/** /**
* 初始化一个用例 * 格式化一个用例
*/ */
private void newTestCase(String title, String nodePath, List<Attached> attacheds) { private void formatTestCase(String title, String nodePath, List<Attached> attacheds) {
TestCaseWithBLOBs testCase = new TestCaseWithBLOBs(); TestCaseWithBLOBs testCase = new TestCaseWithBLOBs();
testCase.setProjectId(projectId); testCase.setProjectId(projectId);
testCase.setMaintainer(maintainer); testCase.setMaintainer(maintainer);
testCase.setPriority("P0"); testCase.setPriority(priorityList.get(0));
testCase.setMethod("manual"); testCase.setMethod("manual");
testCase.setType("functional"); testCase.setType("functional");
@ -239,26 +272,21 @@ public class XmindCaseParser {
} }
// 用例名称 // 用例名称
testCase.setName(this.replace(tcArr[1], TC_REGEX)); testCase.setName(this.replace(tcArr[1], TC_REGEX));
if (!nodePath.startsWith("/")) {
nodePath = "/" + nodePath;
}
if (nodePath.endsWith("/")) {
nodePath = nodePath.substring(0, nodePath.length() - 1);
}
testCase.setNodePath(nodePath); testCase.setNodePath(nodePath);
// 用例等级和用例性质处理 // 用例等级和用例性质处理
if (tcArr[0].indexOf("-") != -1) { if (tcArr[0].indexOf("-") != -1) {
String[] otArr = tcArr[0].split("-"); for (String item : tcArr[0].split("-")) {
for (String item : otArr) { if (isAvailable(item, TC_REGEX)) {
if (item.toUpperCase().startsWith("P")) { continue;
} else if (item.toUpperCase().startsWith("P")) {
testCase.setPriority(item.toUpperCase()); testCase.setPriority(item.toUpperCase());
} else { } else {
Optional.ofNullable(caseTypeMap.get(item)).ifPresent(opt -> testCase.setType(opt)); testCase.setType(caseTypeMap.get(item));
} }
} }
} }
// 测试步骤处理 // 测试步骤处理
List<Attached> steps = new LinkedList<>(); List<Attached> steps = new LinkedList<>();
if (attacheds != null && !attacheds.isEmpty()) { if (attacheds != null && !attacheds.isEmpty()) {
@ -272,29 +300,12 @@ public class XmindCaseParser {
} }
}); });
} }
if (!steps.isEmpty()) { testCase.setSteps(this.getSteps(steps));
testCase.setSteps(this.getSteps(steps));
} else { // 校验合规性
JSONArray jsonArray = new JSONArray(); if (validate(testCase)) {
// 保持插入顺序判断用例是否有相同的steps
JSONObject step = new JSONObject(true);
step.put("num", 1);
step.put("desc", "");
step.put("result", "");
jsonArray.add(step);
testCase.setSteps(jsonArray.toJSONString());
}
TestCaseExcelData compartData = new TestCaseExcelData();
BeanUtils.copyBean(compartData, testCase);
if (compartDatas.contains(compartData)) {
process.append(Translator.get("test_case_already_exists_excel") + "" + testCase.getName() + "; ");
} else if (validate(testCase)) {
testCase.setId(UUID.randomUUID().toString());
testCase.setCreateTime(System.currentTimeMillis());
testCase.setUpdateTime(System.currentTimeMillis());
testCases.add(testCase); testCases.add(testCase);
} }
compartDatas.add(compartData);
} }
/** /**

View File

@ -0,0 +1,2 @@
alter table message_task
add identification varchar(255) not null;

View File

@ -66,6 +66,7 @@
<table tableName="schedule"/> <table tableName="schedule"/>
<table tableName="notice"/> <table tableName="notice"/>
<table tableName="message_task"/>
</context> </context>

View File

@ -201,6 +201,9 @@ export default {
case RPS_LIMIT: case RPS_LIMIT:
this.rpsLimit = d.value; this.rpsLimit = d.value;
break; break;
case RPS_LIMIT_ENABLE:
this.rpsLimitEnable = d.value;
break;
default: default:
break; break;
} }

View File

@ -126,7 +126,7 @@ export default {
{min: 2, max: 50, message: this.$t('commons.input_limit', [2, 50]), trigger: 'blur'} {min: 2, max: 50, message: this.$t('commons.input_limit', [2, 50]), trigger: 'blur'}
], ],
description: [ description: [
{max: 500, message: this.$t('commons.input_limit', [0, 500]), trigger: 'blur'} {max: 250, message: this.$t('commons.input_limit', [0, 250]), trigger: 'blur'}
], ],
}, },
} }

View File

@ -22,11 +22,12 @@
class="tb-edit" class="tb-edit"
border border
size="mini" size="mini"
:header-cell-style="{background:'#EDEDED'}" :header-cell-style="{background:'#ededed'}"
> >
<el-table-column :label="$t('schedule.event')" min-width="20%" prop="events"> <el-table-column :label="$t('schedule.event')" min-width="20%" prop="events">
<template slot-scope="scope"> <template slot-scope="scope">
<el-select v-model="scope.row.events" multiple :placeholder="$t('organization.message.select_events')" <el-select :disabled="isReadOnly" v-model="scope.row.events" multiple
:placeholder="$t('organization.message.select_events')"
prop="events"> prop="events">
<el-option <el-option
v-for="item in jenkinsEventOptions" v-for="item in jenkinsEventOptions"
@ -456,7 +457,15 @@ export default {
defectReceiverOptions: [], defectReceiverOptions: [],
} }
}, },
mounted: function () {
this.initForm()
},
methods: { methods: {
initForm() {
this.result = this.$get('/notice/search/message', response => {
})
},
userList() { userList() {
this.result = this.$get('user/list', response => { this.result = this.$get('user/list', response => {
this.jenkinsReceiverOptions = response.data this.jenkinsReceiverOptions = response.data
@ -488,12 +497,16 @@ export default {
showDelete: false, showDelete: false,
} }
if (type === 'jenkinsTask') { if (type === 'jenkinsTask') {
Task.taskType = 'jenkinsTask'
this.form.jenkinsTask.unshift(Task) this.form.jenkinsTask.unshift(Task)
} else if (type === 'testPlanTask') { } else if (type === 'testPlanTask') {
Task.taskType = 'testPlanTask'
this.form.testPlanTask.unshift(Task) this.form.testPlanTask.unshift(Task)
} else if (type === 'reviewTask') { } else if (type === 'reviewTask') {
Task.taskType = 'reviewTask'
this.form.reviewTask.unshift(Task) this.form.reviewTask.unshift(Task)
} else { } else {
Task.taskType = 'defect'
this.form.defectTask.unshift(Task) this.form.defectTask.unshift(Task)
} }
}, },

View File

@ -233,13 +233,7 @@ export default {
rule: { rule: {
name: [ name: [
{required: true, message: this.$t('organization.input_name'), trigger: 'blur'}, {required: true, message: this.$t('organization.input_name'), trigger: 'blur'},
{min: 2, max: 25, message: this.$t('commons.input_limit', [2, 25]), trigger: 'blur'}, {min: 2, max: 25, message: this.$t('commons.input_limit', [2, 25]), trigger: 'blur'}
{
required: true,
pattern: /^[\u4e00-\u9fa5_a-zA-Z0-9.·-]+$/,
message: this.$t('organization.special_characters_are_not_supported'),
trigger: 'blur'
}
], ],
description: [ description: [
{max: 50, message: this.$t('commons.input_limit', [0, 50]), trigger: 'blur'} {max: 50, message: this.$t('commons.input_limit', [0, 50]), trigger: 'blur'}

View File

@ -2,7 +2,7 @@
<el-form :model="form" ref="caseFrom" v-loading="result.loading"> <el-form :model="form" ref="caseFrom" v-loading="result.loading">
<el-row> <el-row>
<el-col :span="8" :offset="1"> <el-col :span="10" :offset="1">
<el-form-item <el-form-item
:placeholder="$t('test_track.case.input_name')" :placeholder="$t('test_track.case.input_name')"
:label="$t('test_track.case.name')" :label="$t('test_track.case.name')"
@ -12,7 +12,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="11" :offset="2"> <el-col :span="12">
<el-form-item :label="$t('test_track.case.module')" :label-width="formLabelWidth" prop="module"> <el-form-item :label="$t('test_track.case.module')" :label-width="formLabelWidth" prop="module">
<el-input class="case-name" :disabled="readOnly" v-model="testCase.nodePath"></el-input> <el-input class="case-name" :disabled="readOnly" v-model="testCase.nodePath"></el-input>
</el-form-item> </el-form-item>
@ -59,14 +59,14 @@
</el-row> </el-row>
<el-row v-if="testCase.method && testCase.method == 'auto'"> <el-row v-if="testCase.method && testCase.method == 'auto'">
<el-col :span="9" :offset="1"> <el-col :span="10" :offset="1">
<el-form-item :label="$t('test_track.case.relate_test')" :label-width="formLabelWidth" prop="testId"> <el-form-item :label="$t('test_track.case.relate_test')" :label-width="formLabelWidth" prop="testId">
<el-select filterable :disabled="readOnly" v-model="testCase.testId" <el-select filterable :disabled="readOnly" v-model="testCase.testId"
:placeholder="$t('test_track.case.input_type')"> :placeholder="$t('test_track.case.input_type')">
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="9" :offset="1" v-if="testCase.testId=='other'"> <el-col :span="12" v-if="testCase.testId=='other'">
<el-form-item :label="$t('test_track.case.test_name')" :label-width="formLabelWidth" prop="testId"> <el-form-item :label="$t('test_track.case.test_name')" :label-width="formLabelWidth" prop="testId">
<el-input v-model="testCase.otherTestName" :placeholder="$t('test_track.case.input_test_case')" <el-input v-model="testCase.otherTestName" :placeholder="$t('test_track.case.input_test_case')"
:disabled="readOnly"></el-input> :disabled="readOnly"></el-input>
@ -74,10 +74,10 @@
</el-col> </el-col>
</el-row> </el-row>
<el-row style="margin-top: 15px;"> <el-row style="margin-top: 15px;">
<el-col :offset="2">{{ $t('test_track.case.prerequisite') }}:</el-col> <el-col :offset="1">{{ $t('test_track.case.prerequisite') }}:</el-col>
</el-row> </el-row>
<el-row type="flex" justify="center" style="margin-top: 10px;"> <el-row type="flex" justify="center" style="margin-top: 10px;">
<el-col :span="20"> <el-col :span="22">
<el-form-item prop="prerequisite"> <el-form-item prop="prerequisite">
<el-input :disabled="readOnly" v-model="testCase.prerequisite" <el-input :disabled="readOnly" v-model="testCase.prerequisite"
type="textarea" type="textarea"
@ -89,11 +89,11 @@
</el-row> </el-row>
<el-row v-if="testCase.method && testCase.method != 'auto'" style="margin-bottom: 10px"> <el-row v-if="testCase.method && testCase.method != 'auto'" style="margin-bottom: 10px">
<el-col :offset="2">{{ $t('test_track.case.steps') }}:</el-col> <el-col :offset="1">{{ $t('test_track.case.steps') }}:</el-col>
</el-row> </el-row>
<el-row v-if="testCase.method && testCase.method != 'auto'" type="flex" justify="center"> <el-row v-if="testCase.method && testCase.method != 'auto'" type="flex" justify="center">
<el-col :span="20"> <el-col :span="22">
<el-table <el-table
v-if="isStepTableAlive" v-if="isStepTableAlive"
:data="JSON.parse(testCase.steps)" :data="JSON.parse(testCase.steps)"
@ -136,10 +136,10 @@
</el-row> </el-row>
<el-row style="margin-top: 15px;margin-bottom: 10px"> <el-row style="margin-top: 15px;margin-bottom: 10px">
<el-col :offset="2">{{ $t('commons.remark') }}:</el-col> <el-col :offset="1">{{ $t('commons.remark') }}:</el-col>
</el-row> </el-row>
<el-row type="flex" justify="center"> <el-row type="flex" justify="center">
<el-col :span="20"> <el-col :span="22">
<el-form-item prop="remark"> <el-form-item prop="remark">
<el-input v-model="testCase.remark" <el-input v-model="testCase.remark"
:autosize="{ minRows: 2, maxRows: 4}" :autosize="{ minRows: 2, maxRows: 4}"

View File

@ -213,16 +213,17 @@
<el-row style="margin-top: 15px;margin-bottom: 10px"> <el-row style="margin-top: 15px;margin-bottom: 10px">
<el-col :offset="2" :span="20">附件: <el-col :offset="2" :span="20">附件:
<el-upload <el-upload
accept=".jpg,.jpeg,.png,.xlsx,.doc,.pdf,.docx"
action="" action=""
:show-file-list="false" :show-file-list="false"
:before-upload="beforeUpload" :before-upload="beforeUpload"
:http-request="handleUpload" :http-request="handleUpload"
:on-exceed="handleExceed" :on-exceed="handleExceed"
multiple multiple
:limit="3" :limit="8"
:file-list="fileList"> :file-list="fileList">
<el-button icon="el-icon-plus" size="mini"></el-button> <el-button icon="el-icon-plus" size="mini"></el-button>
<!-- <span slot="tip" class="el-upload__tip"></span>--> <span slot="tip" class="el-upload__tip"> 只能上传jpgjpegpngdocxdocpdfxlsx文件 </span>
</el-upload> </el-upload>
</el-col> </el-col>
</el-row> </el-row>
@ -488,7 +489,9 @@ export default {
result: '' result: ''
}]; }];
this.form.remark = ''; this.form.remark = '';
this.form.uploadList = []; this.uploadList = [];
this.fileList = [];
this.tableData = [];
this.$emit("refresh"); this.$emit("refresh");
return; return;
} }
@ -628,6 +631,9 @@ export default {
desc: '', desc: '',
result: '' result: ''
}]; }];
this.uploadList = [];
this.fileList = [];
this.tableData = [];
return true; return true;
}); });
} }

View File

@ -173,8 +173,9 @@ export default {
this.$warning(this.$t('test_track.plan.input_plan_name')); this.$warning(this.$t('test_track.plan.input_plan_name'));
return; return;
} }
if (this.operationType === 'save') {
this.compareTime(new Date().getTime(), this.form.endTime); if (!this.compareTime(new Date().getTime(), this.form.endTime)) {
return false;
} }
if (this.operationType === 'edit') { if (this.operationType === 'edit') {
@ -254,14 +255,17 @@ export default {
} }
}, },
endTimeChange(value) { endTimeChange(value) {
this.form.endTime = this.form.endTime.getTime(); if (value) {
this.compareTime(new Date().getTime(), value.getTime()); this.form.endTime = this.form.endTime.getTime();
this.compareTime(new Date().getTime(), value.getTime());
}
}, },
compareTime(ts1, ts2) { compareTime(ts1, ts2) {
if (ts1 > ts2) { if (ts1 > ts2) {
this.form.endTime = '';
this.$warning("截止时间不能早于当前时间!"); this.$warning("截止时间不能早于当前时间!");
return false;
} }
return true;
} }
} }
} }

View File

@ -38,10 +38,12 @@
@click="handleNext()"/> @click="handleNext()"/>
<el-divider direction="vertical"></el-divider> <el-divider direction="vertical"></el-divider>
<el-button type="success" size="mini" :disabled="isReadOnly" plain @click="saveCase('Pass')"> <el-button type="success" size="mini"
:disabled="isReadOnly" :plain="testCase.reviewStatus !== 'Pass'" @click="saveCase('Pass')">
{{ $t('test_track.review.pass') }} {{ $t('test_track.review.pass') }}
</el-button> </el-button>
<el-button type="danger" size="mini" :disabled="isReadOnly" plain @click="saveCase('UnPass')"> <el-button type="danger" size="mini"
:disabled="isReadOnly" :plain="testCase.reviewStatus !== 'UnPass'" @click="saveCase('UnPass')">
{{ $t('test_track.review.un_pass') }} {{ $t('test_track.review.un_pass') }}
</el-button> </el-button>
</el-col> </el-col>
@ -290,6 +292,10 @@ export default {
this.$success(this.$t('commons.save_success')); this.$success(this.$t('commons.save_success'));
this.updateTestCases(param); this.updateTestCases(param);
this.setReviewStatus(this.testCase.reviewId); this.setReviewStatus(this.testCase.reviewId);
//
this.testCase.reviewStatus = status;
//
this.testCases[this.index].reviewStatus = status;
}); });
}, },
updateTestCases(param) { updateTestCases(param) {