fix(测试跟踪): 修复首页用例评审数据未显示

This commit is contained in:
shiziyuan9527 2021-07-06 15:00:52 +08:00 committed by 刘瑞斌
parent e10984dbbe
commit ff6abd740d
4 changed files with 36 additions and 25 deletions

View File

@ -7,7 +7,6 @@ import io.metersphere.base.domain.TestCaseReview;
import io.metersphere.base.domain.User;
import io.metersphere.commons.constants.OperLogConstants;
import io.metersphere.commons.constants.PermissionConstants;
import io.metersphere.commons.constants.RoleConstants;
import io.metersphere.commons.utils.PageUtils;
import io.metersphere.commons.utils.Pager;
import io.metersphere.commons.utils.SessionUtils;
@ -15,15 +14,10 @@ import io.metersphere.log.annotation.MsAuditLog;
import io.metersphere.service.CheckPermissionService;
import io.metersphere.track.dto.TestCaseReviewDTO;
import io.metersphere.track.dto.TestReviewDTOWithMetric;
import io.metersphere.track.request.testreview.QueryCaseReviewRequest;
import io.metersphere.track.request.testreview.ReviewRelevanceRequest;
import io.metersphere.track.request.testreview.SaveTestCaseReviewRequest;
import io.metersphere.track.request.testreview.TestReviewRelevanceRequest;
import io.metersphere.track.request.testreview.*;
import io.metersphere.track.service.TestCaseReviewService;
import io.metersphere.track.service.TestReviewProjectService;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@ -128,8 +122,8 @@ public class TestCaseReviewController {
testCaseReviewService.editTestReviewStatus(reviewId);
}
@GetMapping("/list/all/relate/{type}")
public List<TestReviewDTOWithMetric> listRelateAll(@PathVariable String type) {
return testCaseReviewService.listRelateAll(type);
@PostMapping("/list/all/relate")
public List<TestReviewDTOWithMetric> listRelateAll(@RequestBody ReviewRelateRequest request) {
return testCaseReviewService.listRelateAll(request);
}
}

View File

@ -0,0 +1,12 @@
package io.metersphere.track.request.testreview;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class ReviewRelateRequest {
private String type;
private String projectId;
private String workspaceId;
}

View File

@ -30,10 +30,7 @@ import io.metersphere.service.UserService;
import io.metersphere.track.dto.TestCaseReviewDTO;
import io.metersphere.track.dto.TestReviewCaseDTO;
import io.metersphere.track.dto.TestReviewDTOWithMetric;
import io.metersphere.track.request.testreview.QueryCaseReviewRequest;
import io.metersphere.track.request.testreview.QueryTestReviewRequest;
import io.metersphere.track.request.testreview.ReviewRelevanceRequest;
import io.metersphere.track.request.testreview.SaveTestCaseReviewRequest;
import io.metersphere.track.request.testreview.*;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
@ -494,7 +491,10 @@ public class TestCaseReviewService {
}
}
public List<TestReviewDTOWithMetric> listRelateAll(String type) {
public List<TestReviewDTOWithMetric> listRelateAll(ReviewRelateRequest relateRequest) {
String type = relateRequest.getType();
String projectId = relateRequest.getProjectId();
String workspaceId = relateRequest.getWorkspaceId();
SessionUser user = SessionUtils.getUser();
QueryTestReviewRequest request = new QueryTestReviewRequest();
if (StringUtils.equals("creator", type)) {
@ -502,10 +502,12 @@ public class TestCaseReviewService {
} else {
request.setReviewerId(user.getId());
}
request.setProjectId(SessionUtils.getCurrentProjectId());
request.setReviewIds(extTestReviewCaseMapper.findRelateTestReviewId(user.getId(), SessionUtils.getCurrentWorkspaceId(), user.getLastProjectId()));
List<String> projectIds = extProjectMapper.getProjectIdByWorkspaceId(SessionUtils.getCurrentWorkspaceId());
request.setWorkspaceId(workspaceId);
request.setProjectId(projectId);
request.setReviewIds(extTestReviewCaseMapper.findRelateTestReviewId(user.getId(), workspaceId, projectId));
List<String> projectIds = extProjectMapper.getProjectIdByWorkspaceId(workspaceId);
List<TestReviewDTOWithMetric> testReviews = extTestCaseReviewMapper.listRelate(request);
@ -529,7 +531,7 @@ public class TestCaseReviewService {
testCaseReviewUsersExample.createCriteria().andReviewIdEqualTo(testReview.getId());
List<String> userIds = testCaseReviewUsersMapper.selectByExample(testCaseReviewUsersExample)
.stream().map(TestCaseReviewUsers::getUserId).collect(Collectors.toList());
String reviewName = getReviewName(userIds);
String reviewName = getReviewName(userIds, projectId);
testReview.setReviewerName(reviewName);
User u = userMapper.selectByPrimaryKey(testReview.getCreator());
@ -557,10 +559,10 @@ public class TestCaseReviewService {
return testReviews;
}
private String getReviewName(List<String> userIds) {
private String getReviewName(List<String> userIds, String projectId) {
QueryMemberRequest queryMemberRequest = new QueryMemberRequest();
queryMemberRequest.setWorkspaceId(SessionUtils.getCurrentWorkspaceId());
Map<String, String> userMap = userService.getMemberList(queryMemberRequest)
queryMemberRequest.setProjectId(projectId);
Map<String, String> userMap = userService.getProjectMember(queryMemberRequest)
.stream().collect(Collectors.toMap(User::getId, User::getName));
StringBuilder stringBuilder = new StringBuilder();
String name = "";

View File

@ -69,7 +69,7 @@ import PlanStageTableItem from "../../common/tableItems/plan/PlanStageTableItem"
import PlanStatusTableItem from "../../common/tableItems/plan/PlanStatusTableItem";
import HomeBaseComponent from "./HomeBaseComponent";
import MsTableButton from "../../../common/components/MsTableButton";
import {getCurrentProjectID} from "../../../../../common/js/utils";
import {getCurrentProjectID, getCurrentWorkspaceId} from "../../../../../common/js/utils";
export default {
name: "ReviewList",
@ -94,10 +94,13 @@ export default {
if (!type) {
type = 'reviewer'
}
if (!getCurrentProjectID()) {
let projectId = getCurrentProjectID();
let workspaceId = getCurrentWorkspaceId();
if (!projectId) {
return;
}
this.result = this.$get('/test/case/review/list/all/relate/' + type, response => {
let param = {type, projectId, workspaceId};
this.result = this.$post('/test/case/review/list/all/relate', param , response => {
this.tableData = response.data;
});
},