Merge remote-tracking branch 'origin/master'

# Conflicts:
#	backend/src/main/java/io/metersphere/track/service/TestCaseReviewService.java
This commit is contained in:
wenyann 2020-10-19 12:28:55 +08:00
commit eccbaa639d
9 changed files with 33 additions and 22 deletions

View File

@ -12,12 +12,13 @@ public interface ExtTestCaseReviewMapper {
List<TestCaseReviewDTO> list(@Param("request") QueryCaseReviewRequest params); List<TestCaseReviewDTO> list(@Param("request") QueryCaseReviewRequest params);
List<TestCaseReviewDTO> listByWorkspaceId(@Param("workspaceId") String workspaceId); List<TestCaseReviewDTO> listByWorkspaceId(@Param("workspaceId") String workspaceId, @Param("userId") String userId);
List<TestReviewDTOWithMetric> listRelate(@Param("request") QueryTestReviewRequest request); List<TestReviewDTOWithMetric> listRelate(@Param("request") QueryTestReviewRequest request);
/** /**
* 检查某工作空间下是否有某测试评审 * 检查某工作空间下是否有某测试评审
*
* @param reviewId * @param reviewId
* @param workspaceId * @param workspaceId
* @return Review ID * @return Review ID

View File

@ -27,10 +27,17 @@
<select id="listByWorkspaceId" resultType="io.metersphere.track.dto.TestCaseReviewDTO" <select id="listByWorkspaceId" resultType="io.metersphere.track.dto.TestCaseReviewDTO"
parameterType="io.metersphere.track.request.testreview.QueryCaseReviewRequest"> parameterType="io.metersphere.track.request.testreview.QueryCaseReviewRequest">
select distinct test_case_review.* select distinct test_case_review.*
from test_case_review, project, test_case_review_project from test_case_review, project, test_case_review_project, test_case_review_users
where test_case_review.id = test_case_review_project.review_id <where>
test_case_review.id = test_case_review_project.review_id
and test_case_review_project.project_id = project.id and test_case_review_project.project_id = project.id
and project.workspace_id = #{workspaceId} and project.workspace_id = #{workspaceId}
and (
(test_case_review_users.review_id = test_case_review.id
and test_case_review_users.user_id = #{userId} )
or test_case_review.creator = #{userId}
)
</where>
order by test_case_review.update_time desc order by test_case_review.update_time desc
</select> </select>

View File

@ -13,6 +13,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -132,7 +133,7 @@ public class FileService {
final List<TestCaseFile> testCaseFiles = testCaseFileMapper.selectByExample(testCaseFileExample); final List<TestCaseFile> testCaseFiles = testCaseFileMapper.selectByExample(testCaseFileExample);
if (CollectionUtils.isEmpty(testCaseFiles)) { if (CollectionUtils.isEmpty(testCaseFiles)) {
return null; return new ArrayList<>();
} }
List<String> fileIds = testCaseFiles.stream().map(TestCaseFile::getFileId).collect(Collectors.toList()); List<String> fileIds = testCaseFiles.stream().map(TestCaseFile::getFileId).collect(Collectors.toList());

View File

@ -37,7 +37,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.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -163,7 +162,7 @@ public class TestCaseReviewService {
} }
public List<TestCaseReviewDTO> recent(String currentWorkspaceId) { public List<TestCaseReviewDTO> recent(String currentWorkspaceId) {
return extTestCaseReviewMapper.listByWorkspaceId(currentWorkspaceId); return extTestCaseReviewMapper.listByWorkspaceId(currentWorkspaceId, SessionUtils.getUserId());
} }
public void editCaseReview(SaveTestCaseReviewRequest testCaseReview) { public void editCaseReview(SaveTestCaseReviewRequest testCaseReview) {

View File

@ -15,10 +15,12 @@ import io.metersphere.track.dto.TestReviewCaseDTO;
import io.metersphere.track.request.testplancase.TestReviewCaseBatchRequest; import io.metersphere.track.request.testplancase.TestReviewCaseBatchRequest;
import io.metersphere.track.request.testreview.DeleteRelevanceRequest; import io.metersphere.track.request.testreview.DeleteRelevanceRequest;
import io.metersphere.track.request.testreview.QueryCaseReviewRequest; import io.metersphere.track.request.testreview.QueryCaseReviewRequest;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -64,17 +66,17 @@ public class TestReviewTestCaseService {
return testCaseReviewUsers.stream().map(TestCaseReviewUsers::getUserId).collect(Collectors.toList()); return testCaseReviewUsers.stream().map(TestCaseReviewUsers::getUserId).collect(Collectors.toList());
} }
private String getReviewName(List<String> userIds, Map userMap) { private String getReviewName(List<String> userIds, Map<String, String> userMap) {
StringBuilder stringBuilder = new StringBuilder(); List<String> userNames = new ArrayList<>();
String name = "";
if (userIds.size() > 0) { if (userIds.size() > 0) {
for (String id : userIds) { for (String id : userIds) {
stringBuilder.append(userMap.get(id)).append(""); String n = userMap.get(id);
if (StringUtils.isNotBlank(n)) {
userNames.add(n);
} }
name = stringBuilder.toString().substring(0, stringBuilder.length() - 1);
} }
return name; }
return StringUtils.join(userNames, "");
} }
public int deleteTestCase(DeleteRelevanceRequest request) { public int deleteTestCase(DeleteRelevanceRequest request) {

View File

@ -95,11 +95,12 @@ public class XmindCaseParser {
} }
String path = ""; String path = "";
for (int i = 0; i < nodes.length; i++) { for (int i = 0; i < nodes.length; i++) {
path += nodes[i].trim() + "/";
if (i != 0 && StringUtils.equals(nodes[i].trim(), "")) { if (i != 0 && StringUtils.equals(nodes[i].trim(), "")) {
process.append(path + "" + Translator.get("module_not_null") + "; "); process.append(Translator.get("module") + ":【" + path + "" + Translator.get("module_not_null") + "; ");
} else if (nodes[i].trim().length() > 30) { } else if (nodes[i].trim().length() > 30) {
process.append(nodes[i].trim() + "" + Translator.get("test_track.length_less_than") + "30 ;"); process.append(nodes[i].trim() + "" + Translator.get("test_track.length_less_than") + "30 ;");
} else {
path += nodes[i].trim() + "/";
} }
} }
}); });
@ -124,7 +125,7 @@ public class XmindCaseParser {
} }
for (int i = 0; i < nodes.length; i++) { for (int i = 0; i < nodes.length; i++) {
if (i != 0 && StringUtils.equals(nodes[i].trim(), "")) { if (i != 0 && StringUtils.equals(nodes[i].trim(), "")) {
stringBuilder.append(Translator.get("test_case") + "" + data.getName() + Translator.get("module_not_null") + "; "); stringBuilder.append(Translator.get("test_case") + ":【" + data.getName() + "" + Translator.get("module_not_null") + "; ");
break; break;
} else if (nodes[i].trim().length() > 30) { } else if (nodes[i].trim().length() > 30) {
stringBuilder.append(nodes[i].trim() + "" + Translator.get("module") + Translator.get("test_track.length_less_than") + "30 ;"); stringBuilder.append(nodes[i].trim() + "" + Translator.get("module") + Translator.get("test_track.length_less_than") + "30 ;");

View File

@ -668,7 +668,7 @@ export default {
length_less_than: "The length less than", length_less_than: "The length less than",
recent_plan: "My recent plan", recent_plan: "My recent plan",
recent_case: "My recent case", recent_case: "My recent case",
recent_review: "Recent review", recent_review: "My recent review",
pass_rate: "Pass rate", pass_rate: "Pass rate",
execution_result: ": Please select the execution result", execution_result: ": Please select the execution result",
actual_result: ": The actual result is empty", actual_result: ": The actual result is empty",

View File

@ -672,7 +672,7 @@ export default {
length_less_than: "长度必须小于", length_less_than: "长度必须小于",
recent_plan: "我最近的计划", recent_plan: "我最近的计划",
recent_case: "我最近的用例", recent_case: "我最近的用例",
recent_review: "最近的评审", recent_review: "最近的评审",
pass_rate: "通过率", pass_rate: "通过率",
execution_result: ": 请选择执行结果", execution_result: ": 请选择执行结果",
actual_result: ": 实际结果为空", actual_result: ": 实际结果为空",

View File

@ -672,7 +672,7 @@ export default {
length_less_than: "長度必須小於", length_less_than: "長度必須小於",
recent_plan: "我最近的計劃", recent_plan: "我最近的計劃",
recent_case: "我最近的用例", recent_case: "我最近的用例",
recent_review: "最近的評審", recent_review: "最近的評審",
pass_rate: "通過率", pass_rate: "通過率",
execution_result: ": 請選擇執行結果", execution_result: ": 請選擇執行結果",
actual_result: ": 實際結果為空", actual_result: ": 實際結果為空",