fix: 修复创建定时任务保存workspaceId和projectId的问题

This commit is contained in:
Captain.B 2021-07-16 12:15:38 +08:00 committed by 刘瑞斌
parent cd6e53f96d
commit e26a60cc0c
4 changed files with 34 additions and 4 deletions

View File

@ -54,7 +54,6 @@ public class ScheduleService {
public void addSchedule(Schedule schedule) {
schedule.setId(UUID.randomUUID().toString());
schedule.setWorkspaceId(SessionUtils.getCurrentWorkspaceId());
schedule.setCreateTime(System.currentTimeMillis());
schedule.setUpdateTime(System.currentTimeMillis());
scheduleMapper.insert(schedule);
@ -149,6 +148,8 @@ public class ScheduleService {
schedule.setValue(request.getValue().trim());
schedule.setKey(request.getResourceId());
schedule.setUserId(SessionUtils.getUser().getId());
schedule.setProjectId(request.getProjectId());
schedule.setWorkspaceId(request.getWorkspaceId());
return schedule;
}

View File

@ -50,7 +50,13 @@
</template>
<script>
import {getCurrentOrganizationId, getCurrentUser, listenGoBack, removeGoBackListener} from "@/common/js/utils";
import {
getCurrentOrganizationId,
getCurrentProjectID,
getCurrentUser, getCurrentWorkspaceId,
listenGoBack,
removeGoBackListener
} from "@/common/js/utils";
import Crontab from "@/business/components/common/cron/Crontab";
import CrontabResult from "@/business/components/common/cron/CrontabResult";
import {cronValidate} from "@/common/js/cron";
@ -243,6 +249,13 @@ export default {
let param = {};
param = this.schedule;
param.resourceId = this.testId;
// projectId
if (!param.projectId) {
param.projectId = getCurrentProjectID();
}
if (!param.workspaceId) {
param.workspaceId = getCurrentWorkspaceId();
}
let url = '/api/automation/schedule/create';
if (this.scheduleTaskType === "TEST_PLAN_TEST") {
param.scheduleFrom = "testPlan";

View File

@ -73,7 +73,7 @@ import PerformancePressureConfig from "./components/PerformancePressureConfig";
import PerformanceAdvancedConfig from "./components/PerformanceAdvancedConfig";
import MsContainer from "../../common/components/MsContainer";
import MsMainContainer from "../../common/components/MsMainContainer";
import {getCurrentProjectID, hasPermission} from "@/common/js/utils";
import {getCurrentProjectID, getCurrentWorkspaceId, hasPermission} from "@/common/js/utils";
import MsScheduleConfig from "../../common/components/MsScheduleConfig";
import MsChangeHistory from "../../history/ChangeHistory";
import MsTableOperatorButton from "@/business/components/common/components/MsTableOperatorButton";
@ -343,6 +343,9 @@ export default {
if (!param.projectId) {
param.projectId = getCurrentProjectID();
}
if (!param.workspaceId) {
param.workspaceId = getCurrentWorkspaceId();
}
let url = '/performance/schedule/create';
if (param.id) {
url = '/performance/schedule/update';

View File

@ -95,7 +95,13 @@
</template>
<script>
import {getCurrentOrganizationId, getCurrentUser, listenGoBack, removeGoBackListener} from "@/common/js/utils";
import {
getCurrentOrganizationId,
getCurrentProjectID,
getCurrentUser, getCurrentWorkspaceId,
listenGoBack,
removeGoBackListener
} from "@/common/js/utils";
import Crontab from "@/business/components/common/cron/Crontab";
import CrontabResult from "@/business/components/common/cron/CrontabResult";
import {cronValidate} from "@/common/js/cron";
@ -301,6 +307,13 @@ export default {
let param = {};
param = this.schedule;
param.resourceId = this.testId;
// projectId
if (!param.projectId) {
param.projectId = getCurrentProjectID();
}
if (!param.workspaceId) {
param.workspaceId = getCurrentWorkspaceId();
}
param.config = JSON.stringify(this.runConfig);
let url = '/api/automation/schedule/create';
if (this.scheduleTaskType === "TEST_PLAN_TEST") {