fix(测试跟踪): 修复首页用例评审数据未显示
This commit is contained in:
parent
e10984dbbe
commit
ff6abd740d
|
@ -7,7 +7,6 @@ import io.metersphere.base.domain.TestCaseReview;
|
||||||
import io.metersphere.base.domain.User;
|
import io.metersphere.base.domain.User;
|
||||||
import io.metersphere.commons.constants.OperLogConstants;
|
import io.metersphere.commons.constants.OperLogConstants;
|
||||||
import io.metersphere.commons.constants.PermissionConstants;
|
import io.metersphere.commons.constants.PermissionConstants;
|
||||||
import io.metersphere.commons.constants.RoleConstants;
|
|
||||||
import io.metersphere.commons.utils.PageUtils;
|
import io.metersphere.commons.utils.PageUtils;
|
||||||
import io.metersphere.commons.utils.Pager;
|
import io.metersphere.commons.utils.Pager;
|
||||||
import io.metersphere.commons.utils.SessionUtils;
|
import io.metersphere.commons.utils.SessionUtils;
|
||||||
|
@ -15,15 +14,10 @@ import io.metersphere.log.annotation.MsAuditLog;
|
||||||
import io.metersphere.service.CheckPermissionService;
|
import io.metersphere.service.CheckPermissionService;
|
||||||
import io.metersphere.track.dto.TestCaseReviewDTO;
|
import io.metersphere.track.dto.TestCaseReviewDTO;
|
||||||
import io.metersphere.track.dto.TestReviewDTOWithMetric;
|
import io.metersphere.track.dto.TestReviewDTOWithMetric;
|
||||||
import io.metersphere.track.request.testreview.QueryCaseReviewRequest;
|
import io.metersphere.track.request.testreview.*;
|
||||||
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.service.TestCaseReviewService;
|
import io.metersphere.track.service.TestCaseReviewService;
|
||||||
import io.metersphere.track.service.TestReviewProjectService;
|
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.RequiresPermissions;
|
||||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
@ -128,8 +122,8 @@ public class TestCaseReviewController {
|
||||||
testCaseReviewService.editTestReviewStatus(reviewId);
|
testCaseReviewService.editTestReviewStatus(reviewId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/list/all/relate/{type}")
|
@PostMapping("/list/all/relate")
|
||||||
public List<TestReviewDTOWithMetric> listRelateAll(@PathVariable String type) {
|
public List<TestReviewDTOWithMetric> listRelateAll(@RequestBody ReviewRelateRequest request) {
|
||||||
return testCaseReviewService.listRelateAll(type);
|
return testCaseReviewService.listRelateAll(request);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
|
@ -30,10 +30,7 @@ import io.metersphere.service.UserService;
|
||||||
import io.metersphere.track.dto.TestCaseReviewDTO;
|
import io.metersphere.track.dto.TestCaseReviewDTO;
|
||||||
import io.metersphere.track.dto.TestReviewCaseDTO;
|
import io.metersphere.track.dto.TestReviewCaseDTO;
|
||||||
import io.metersphere.track.dto.TestReviewDTOWithMetric;
|
import io.metersphere.track.dto.TestReviewDTOWithMetric;
|
||||||
import io.metersphere.track.request.testreview.QueryCaseReviewRequest;
|
import io.metersphere.track.request.testreview.*;
|
||||||
import io.metersphere.track.request.testreview.QueryTestReviewRequest;
|
|
||||||
import io.metersphere.track.request.testreview.ReviewRelevanceRequest;
|
|
||||||
import io.metersphere.track.request.testreview.SaveTestCaseReviewRequest;
|
|
||||||
import org.apache.commons.beanutils.BeanUtils;
|
import org.apache.commons.beanutils.BeanUtils;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
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();
|
SessionUser user = SessionUtils.getUser();
|
||||||
QueryTestReviewRequest request = new QueryTestReviewRequest();
|
QueryTestReviewRequest request = new QueryTestReviewRequest();
|
||||||
if (StringUtils.equals("creator", type)) {
|
if (StringUtils.equals("creator", type)) {
|
||||||
|
@ -502,10 +502,12 @@ public class TestCaseReviewService {
|
||||||
} else {
|
} else {
|
||||||
request.setReviewerId(user.getId());
|
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);
|
List<TestReviewDTOWithMetric> testReviews = extTestCaseReviewMapper.listRelate(request);
|
||||||
|
|
||||||
|
@ -529,7 +531,7 @@ public class TestCaseReviewService {
|
||||||
testCaseReviewUsersExample.createCriteria().andReviewIdEqualTo(testReview.getId());
|
testCaseReviewUsersExample.createCriteria().andReviewIdEqualTo(testReview.getId());
|
||||||
List<String> userIds = testCaseReviewUsersMapper.selectByExample(testCaseReviewUsersExample)
|
List<String> userIds = testCaseReviewUsersMapper.selectByExample(testCaseReviewUsersExample)
|
||||||
.stream().map(TestCaseReviewUsers::getUserId).collect(Collectors.toList());
|
.stream().map(TestCaseReviewUsers::getUserId).collect(Collectors.toList());
|
||||||
String reviewName = getReviewName(userIds);
|
String reviewName = getReviewName(userIds, projectId);
|
||||||
testReview.setReviewerName(reviewName);
|
testReview.setReviewerName(reviewName);
|
||||||
|
|
||||||
User u = userMapper.selectByPrimaryKey(testReview.getCreator());
|
User u = userMapper.selectByPrimaryKey(testReview.getCreator());
|
||||||
|
@ -557,10 +559,10 @@ public class TestCaseReviewService {
|
||||||
return testReviews;
|
return testReviews;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getReviewName(List<String> userIds) {
|
private String getReviewName(List<String> userIds, String projectId) {
|
||||||
QueryMemberRequest queryMemberRequest = new QueryMemberRequest();
|
QueryMemberRequest queryMemberRequest = new QueryMemberRequest();
|
||||||
queryMemberRequest.setWorkspaceId(SessionUtils.getCurrentWorkspaceId());
|
queryMemberRequest.setProjectId(projectId);
|
||||||
Map<String, String> userMap = userService.getMemberList(queryMemberRequest)
|
Map<String, String> userMap = userService.getProjectMember(queryMemberRequest)
|
||||||
.stream().collect(Collectors.toMap(User::getId, User::getName));
|
.stream().collect(Collectors.toMap(User::getId, User::getName));
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
String name = "";
|
String name = "";
|
||||||
|
|
|
@ -69,7 +69,7 @@ import PlanStageTableItem from "../../common/tableItems/plan/PlanStageTableItem"
|
||||||
import PlanStatusTableItem from "../../common/tableItems/plan/PlanStatusTableItem";
|
import PlanStatusTableItem from "../../common/tableItems/plan/PlanStatusTableItem";
|
||||||
import HomeBaseComponent from "./HomeBaseComponent";
|
import HomeBaseComponent from "./HomeBaseComponent";
|
||||||
import MsTableButton from "../../../common/components/MsTableButton";
|
import MsTableButton from "../../../common/components/MsTableButton";
|
||||||
import {getCurrentProjectID} from "../../../../../common/js/utils";
|
import {getCurrentProjectID, getCurrentWorkspaceId} from "../../../../../common/js/utils";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ReviewList",
|
name: "ReviewList",
|
||||||
|
@ -94,10 +94,13 @@ export default {
|
||||||
if (!type) {
|
if (!type) {
|
||||||
type = 'reviewer'
|
type = 'reviewer'
|
||||||
}
|
}
|
||||||
if (!getCurrentProjectID()) {
|
let projectId = getCurrentProjectID();
|
||||||
|
let workspaceId = getCurrentWorkspaceId();
|
||||||
|
if (!projectId) {
|
||||||
return;
|
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;
|
this.tableData = response.data;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue