fix(测试跟踪): 测试计划执行人校验中增加超级管理员的判断

--bug=1027435 --user=宋天阳 【测试跟踪】超级管理员-执行计划失败一直加载中
https://www.tapd.cn/55049933/s/1387665;--bug=1027416 --user=宋天阳
【测试跟踪】github#25213,测试计划执行过程中进入用例关联界面,导致测试计划列表数据显示错误
https://www.tapd.cn/55049933/s/1387667
This commit is contained in:
song-tianyang 2023-06-28 15:58:11 +08:00 committed by 刘瑞斌
parent b8d433d35d
commit 03af550b32
5 changed files with 28 additions and 13 deletions

View File

@ -798,7 +798,12 @@ public class BaseUserService {
UserGroupExample userGroupExample = new UserGroupExample();
userGroupExample.createCriteria().andUserIdEqualTo(userId).andSourceIdEqualTo(projectId);
if (userGroupMapper.countByExample(userGroupExample) == 0) {
MSException.throwException(Translator.get("user_not_exists") + userId);
//检查是否是超级管理员
userGroupExample.clear();
userGroupExample.createCriteria().andUserIdEqualTo(userId).andGroupIdEqualTo(UserGroupConstants.SUPER_GROUP);
if (userGroupMapper.countByExample(userGroupExample) == 0) {
MSException.throwException(Translator.get("user_not_exists") + userId);
}
}
}
}

View File

@ -56,4 +56,5 @@ public interface ExtTestPlanMapper {
void updateStatusAndActStartTimeAndSetActEndTimeNullById(@Param("testPlanId") String testPlanId, @Param("actStartTime") long actStartTime, @Param("status") String status);
long countExecutingReportCount(String testPlanId);
}

View File

@ -466,4 +466,10 @@
FROM test_plan
WHERE id = #{0}
</select>
<select id="countExecutingReportCount" resultType="java.lang.Long">
SELECT COUNT(*)
FROM test_plan_report
WHERE test_plan_id = #{0}
AND status = 'RUNNING'
</select>
</mapper>

View File

@ -571,6 +571,10 @@ public class TestPlanService {
}
public void checkTestPlanStatus(String testPlanId) { // 检查执行结果自动更新计划状态
//如果目前存在执行中的报告那么不更新计划状态
if (extTestPlanMapper.countExecutingReportCount(testPlanId) > 0) {
return;
}
List<String> statusList = extTestPlanTestCaseMapper.getExecResultByPlanId(testPlanId);
Set<String> serviceIdSet = DiscoveryUtil.getServiceIdSet();

View File

@ -472,7 +472,7 @@ import MsTableOperator from "metersphere-frontend/src/components/MsTableOperator
import PlanStatusTableItem from "../../common/tableItems/plan/PlanStatusTableItem";
import PlanStageTableItem from "../../common/tableItems/plan/PlanStageTableItem";
import MsDeleteConfirm from "metersphere-frontend/src/components/MsDeleteConfirm";
import { TEST_PLAN_CONFIGS } from "metersphere-frontend/src/components/search/search-components";
import {TEST_PLAN_CONFIGS} from "metersphere-frontend/src/components/search/search-components";
import {
_filter,
_sort,
@ -486,16 +486,9 @@ import HeaderCustom from "metersphere-frontend/src/components/head/HeaderCustom"
import HeaderLabelOperate from "metersphere-frontend/src/components/head/HeaderLabelOperate";
import MsTag from "metersphere-frontend/src/components/MsTag";
import MsTestPlanScheduleMaintain from "@/business/plan/components/ScheduleMaintain";
import {
getCurrentProjectID,
getCurrentUser,
getCurrentUserId,
} from "metersphere-frontend/src/utils/token";
import {
hasLicense,
hasPermission,
} from "metersphere-frontend/src/utils/permission";
import { operationConfirm } from "metersphere-frontend/src/utils";
import {getCurrentProjectID, getCurrentUser, getCurrentUserId,} from "metersphere-frontend/src/utils/token";
import {hasLicense, hasPermission,} from "metersphere-frontend/src/utils/permission";
import {operationConfirm} from "metersphere-frontend/src/utils";
import MsTestPlanRunModeWithEnv from "@/business/plan/common/TestPlanRunModeWithEnv";
import MsTaskCenter from "metersphere-frontend/src/components/task/TaskCenter";
import {
@ -520,7 +513,7 @@ import MsTableColumn from "metersphere-frontend/src/components/table/MsTableColu
import MsTable from "metersphere-frontend/src/components/table/MsTable";
import MsTestPlanScheduleBatchSwitch from "@/business/plan/components/ScheduleBatchSwitch";
import MsTagsColumn from "metersphere-frontend/src/components/table/MsTagsColumn";
import { getProjectMemberUserFilter } from "@/api/user";
import {getProjectMemberUserFilter} from "@/api/user";
import TestPlanReportReview from "@/business/report/components/TestPlanReportReview";
export default {
@ -1139,6 +1132,8 @@ export default {
this.cardLoading = false;
this.initTableData();
this.$success(this.$t("commons.run_success"));
}).catch(() => {
this.cardLoading = false;
});
} else if (config.executionWay === "save") {
param.executionWay = "SAVE";
@ -1147,6 +1142,8 @@ export default {
this.cardLoading = false;
this.initTableData();
this.$success(this.$t("commons.save_success"));
}).catch(() => {
this.cardLoading = false;
});
} else {
param.executionWay = "RUN";
@ -1155,6 +1152,8 @@ export default {
testPlanRun(param).then(() => {
this.cardLoading = false;
this.$success(this.$t("commons.run_success"));
}).catch(() => {
this.cardLoading = false;
});
}
},