fix(测试跟踪): 分享测试计划报告后页面报错401
This commit is contained in:
parent
7c9388ee5a
commit
2d20362fee
|
@ -2,6 +2,7 @@ package io.metersphere.controller;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import io.metersphere.commons.utils.HttpHeaderUtils;
|
import io.metersphere.commons.utils.HttpHeaderUtils;
|
||||||
|
import io.metersphere.commons.utils.SessionUtils;
|
||||||
import io.metersphere.dto.TestPlanCaseDTO;
|
import io.metersphere.dto.TestPlanCaseDTO;
|
||||||
import io.metersphere.plan.dto.TestPlanExtReportDTO;
|
import io.metersphere.plan.dto.TestPlanExtReportDTO;
|
||||||
import io.metersphere.plan.dto.TestPlanSimpleReportDTO;
|
import io.metersphere.plan.dto.TestPlanSimpleReportDTO;
|
||||||
|
@ -68,7 +69,9 @@ public class ShareController {
|
||||||
@GetMapping("test/plan/ext/report/{shareId}/{reportId}")
|
@GetMapping("test/plan/ext/report/{shareId}/{reportId}")
|
||||||
public TestPlanExtReportDTO getExtReport(@PathVariable String shareId, @PathVariable String reportId) throws JsonProcessingException {
|
public TestPlanExtReportDTO getExtReport(@PathVariable String shareId, @PathVariable String reportId) throws JsonProcessingException {
|
||||||
shareInfoService.validate(shareId, reportId);
|
shareInfoService.validate(shareId, reportId);
|
||||||
HttpHeaderUtils.runAsUser("admin");
|
if (SessionUtils.getUser() == null) {
|
||||||
|
HttpHeaderUtils.runAsUser("admin");
|
||||||
|
}
|
||||||
TestPlanExtReportDTO reportExtInfo = testPlanService.getExtInfoByReportId(reportId);
|
TestPlanExtReportDTO reportExtInfo = testPlanService.getExtInfoByReportId(reportId);
|
||||||
HttpHeaderUtils.clearUser();
|
HttpHeaderUtils.clearUser();
|
||||||
return reportExtInfo;
|
return reportExtInfo;
|
||||||
|
@ -77,7 +80,9 @@ public class ShareController {
|
||||||
@GetMapping("test/plan/ext/plan/{shareId}/{planId}")
|
@GetMapping("test/plan/ext/plan/{shareId}/{planId}")
|
||||||
public TestPlanExtReportDTO getExtPlan(@PathVariable String shareId, @PathVariable String planId) throws JsonProcessingException {
|
public TestPlanExtReportDTO getExtPlan(@PathVariable String shareId, @PathVariable String planId) throws JsonProcessingException {
|
||||||
shareInfoService.validate(shareId, planId);
|
shareInfoService.validate(shareId, planId);
|
||||||
HttpHeaderUtils.runAsUser("admin");
|
if (SessionUtils.getUser() == null) {
|
||||||
|
HttpHeaderUtils.runAsUser("admin");
|
||||||
|
}
|
||||||
TestPlanExtReportDTO reportExtInfo = testPlanService.getExtInfoByPlanId(planId);
|
TestPlanExtReportDTO reportExtInfo = testPlanService.getExtInfoByPlanId(planId);
|
||||||
HttpHeaderUtils.clearUser();
|
HttpHeaderUtils.clearUser();
|
||||||
return reportExtInfo;
|
return reportExtInfo;
|
||||||
|
|
|
@ -742,7 +742,9 @@ public class TestPlanReportService {
|
||||||
runRequest.setReportId(testPlanExecutionQueue.getReportId());
|
runRequest.setReportId(testPlanExecutionQueue.getReportId());
|
||||||
runRequest.setTestPlanId(testPlan.getId());
|
runRequest.setTestPlanId(testPlan.getId());
|
||||||
try {
|
try {
|
||||||
HttpHeaderUtils.runAsUser("admin");
|
if (SessionUtils.getUser() == null) {
|
||||||
|
HttpHeaderUtils.runAsUser("admin");
|
||||||
|
}
|
||||||
//如果运行测试计划的过程中出现异常,则整个事务会回滚。 删除队列的事务也不会提交,也不会执行后面的测试计划
|
//如果运行测试计划的过程中出现异常,则整个事务会回滚。 删除队列的事务也不会提交,也不会执行后面的测试计划
|
||||||
testPlanService.runPlan(runRequest);
|
testPlanService.runPlan(runRequest);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -1125,7 +1127,9 @@ public class TestPlanReportService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public TestPlanSimpleReportDTO getShareDbReport(ShareInfo shareInfo, String reportId) {
|
public TestPlanSimpleReportDTO getShareDbReport(ShareInfo shareInfo, String reportId) {
|
||||||
HttpHeaderUtils.runAsUser(shareInfo.getCreateUserId());
|
if (SessionUtils.getUser() == null) {
|
||||||
|
HttpHeaderUtils.runAsUser(shareInfo.getCreateUserId());
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
return getReport(reportId);
|
return getReport(reportId);
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -1482,7 +1482,9 @@ public class TestPlanService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public TestPlanSimpleReportDTO getShareReport(ShareInfo shareInfo, String planId) {
|
public TestPlanSimpleReportDTO getShareReport(ShareInfo shareInfo, String planId) {
|
||||||
HttpHeaderUtils.runAsUser(shareInfo.getCreateUserId());
|
if (SessionUtils.getUser() == null) {
|
||||||
|
HttpHeaderUtils.runAsUser(shareInfo.getCreateUserId());
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
return getReport(planId, null);
|
return getReport(planId, null);
|
||||||
} finally {
|
} finally {
|
||||||
|
|
Loading…
Reference in New Issue