fix(任务中心): 修复批量执行任务名称国际化问题
--bug=1047888 --user=王旭 【任务中心】-场景批量执行的任务名称建议汉化 https://www.tapd.cn/55049933/s/1596693
This commit is contained in:
parent
b5a8bd541f
commit
c747b28efa
|
@ -302,7 +302,6 @@ public class ApiTestCaseController {
|
|||
@RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_CASE_EXECUTE)
|
||||
@CheckOwner(resourceId = "#request.getSelectIds()", resourceType = "api_test_case")
|
||||
public void batchRun(@Validated @RequestBody ApiTestCaseBatchRunRequest request) {
|
||||
ApiBatchRunBaseService.setLocale(LocaleContextHolder.getLocale());
|
||||
apiTestCaseBatchRunService.asyncBatchRun(request, SessionUtils.getUserId());
|
||||
}
|
||||
|
||||
|
|
|
@ -101,7 +101,6 @@ public class ApiScenarioBatchOperationController {
|
|||
@RequiresPermissions(PermissionConstants.PROJECT_API_SCENARIO_EXECUTE)
|
||||
public void batchRun(@Validated @RequestBody ApiScenarioBatchRunRequest request) {
|
||||
apiValidateService.validateApiMenuInProject(request.getProjectId(), ApiResource.PROJECT.name());
|
||||
ApiBatchRunBaseService.setLocale(LocaleContextHolder.getLocale());
|
||||
apiScenarioBatchRunService.asyncBatchRun(request, SessionUtils.getUserId());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,10 +21,14 @@ import io.metersphere.system.service.BaseTaskHubService;
|
|||
import io.metersphere.system.uid.IDGenerator;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -70,7 +74,11 @@ public class ApiTestCaseBatchRunService {
|
|||
* @param userId
|
||||
*/
|
||||
public void asyncBatchRun(ApiTestCaseBatchRunRequest request, String userId) {
|
||||
Thread.startVirtualThread(() -> batchRun(request, userId));
|
||||
Locale locale = LocaleContextHolder.getLocale();
|
||||
Thread.startVirtualThread(() -> {
|
||||
ApiBatchRunBaseService.setLocale(locale);
|
||||
batchRun(request, userId);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -226,6 +234,7 @@ public class ApiTestCaseBatchRunService {
|
|||
|
||||
/**
|
||||
* 获取有序的用例
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
|
|
|
@ -26,11 +26,13 @@ import jakarta.annotation.Resource;
|
|||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.function.Function;
|
||||
|
@ -75,7 +77,11 @@ public class ApiScenarioBatchRunService {
|
|||
* @param userId
|
||||
*/
|
||||
public void asyncBatchRun(ApiScenarioBatchRunRequest request, String userId) {
|
||||
Thread.startVirtualThread(() -> batchRun(request, userId));
|
||||
Locale locale = LocaleContextHolder.getLocale();
|
||||
Thread.startVirtualThread(() -> {
|
||||
ApiBatchRunBaseService.setLocale(locale);
|
||||
batchRun(request, userId);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -208,6 +214,7 @@ public class ApiScenarioBatchRunService {
|
|||
|
||||
/**
|
||||
* 获取有序的用例
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
|
|
|
@ -150,7 +150,6 @@ public class TestPlanApiCaseController {
|
|||
@RequiresPermissions(PermissionConstants.TEST_PLAN_READ_EXECUTE)
|
||||
@CheckOwner(resourceId = "#request.getSelectIds()", resourceType = "test_plan", relationType = "test_plan_api_case")
|
||||
public void batchRun(@Validated @RequestBody TestPlanApiCaseBatchRunRequest request) {
|
||||
ApiBatchRunBaseService.setLocale(LocaleContextHolder.getLocale());
|
||||
testPlanApiCaseBatchRunService.asyncBatchRun(request, SessionUtils.getUserId());
|
||||
}
|
||||
|
||||
|
|
|
@ -100,7 +100,6 @@ public class TestPlanApiScenarioController {
|
|||
@RequiresPermissions(PermissionConstants.TEST_PLAN_READ_EXECUTE)
|
||||
@CheckOwner(resourceId = "#request.getSelectIds()", resourceType = "test_plan", relationType = "test_plan_api_scenario")
|
||||
public void batchRun(@Validated @RequestBody TestPlanApiScenarioBatchRunRequest request) {
|
||||
ApiBatchRunBaseService.setLocale(LocaleContextHolder.getLocale());
|
||||
testPlanApiScenarioBatchRunService.asyncBatchRun(request, SessionUtils.getUserId());
|
||||
}
|
||||
|
||||
|
|
|
@ -11,12 +11,18 @@ import io.metersphere.api.service.definition.ApiTestCaseBatchRunService;
|
|||
import io.metersphere.api.service.definition.ApiTestCaseService;
|
||||
import io.metersphere.api.service.queue.ApiExecutionQueueService;
|
||||
import io.metersphere.api.service.queue.ApiExecutionSetService;
|
||||
import io.metersphere.plan.domain.*;
|
||||
import io.metersphere.plan.domain.TestPlan;
|
||||
import io.metersphere.plan.domain.TestPlanApiCase;
|
||||
import io.metersphere.plan.domain.TestPlanCollection;
|
||||
import io.metersphere.plan.domain.TestPlanCollectionExample;
|
||||
import io.metersphere.plan.dto.TestPlanApiCaseBatchRunDTO;
|
||||
import io.metersphere.plan.dto.request.ApiExecutionMapService;
|
||||
import io.metersphere.plan.dto.request.TestPlanApiCaseBatchRequest;
|
||||
import io.metersphere.plan.dto.request.TestPlanApiCaseBatchRunRequest;
|
||||
import io.metersphere.plan.mapper.*;
|
||||
import io.metersphere.plan.mapper.ExtTestPlanApiCaseMapper;
|
||||
import io.metersphere.plan.mapper.TestPlanApiCaseMapper;
|
||||
import io.metersphere.plan.mapper.TestPlanCollectionMapper;
|
||||
import io.metersphere.plan.mapper.TestPlanMapper;
|
||||
import io.metersphere.project.domain.Project;
|
||||
import io.metersphere.project.mapper.ProjectMapper;
|
||||
import io.metersphere.sdk.constants.*;
|
||||
|
@ -32,6 +38,7 @@ import jakarta.annotation.Resource;
|
|||
import jodd.util.StringUtil;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
@ -90,7 +97,11 @@ public class TestPlanApiCaseBatchRunService {
|
|||
public void asyncBatchRun(TestPlanApiCaseBatchRunRequest request, String userId) {
|
||||
TestPlanService testPlanService = CommonBeanFactory.getBean(TestPlanService.class);
|
||||
testPlanService.setActualStartTime(request.getTestPlanId());
|
||||
Thread.startVirtualThread(() -> batchRun(request, userId));
|
||||
Locale locale = LocaleContextHolder.getLocale();
|
||||
Thread.startVirtualThread(() -> {
|
||||
ApiBatchRunBaseService.setLocale(locale);
|
||||
batchRun(request, userId);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -215,7 +226,6 @@ public class TestPlanApiCaseBatchRunService {
|
|||
|
||||
/**
|
||||
* 串行批量执行
|
||||
*
|
||||
*/
|
||||
public void serialExecute(String taskId,
|
||||
List<TestPlanApiCaseBatchRunDTO> testPlanApiCases,
|
||||
|
@ -245,7 +255,6 @@ public class TestPlanApiCaseBatchRunService {
|
|||
|
||||
/**
|
||||
* 并行批量执行
|
||||
*
|
||||
*/
|
||||
public void parallelExecute(String taskId,
|
||||
List<TestPlanApiCaseBatchRunDTO> testPlanApiCases,
|
||||
|
|
|
@ -21,7 +21,10 @@ import io.metersphere.plan.domain.TestPlanCollectionExample;
|
|||
import io.metersphere.plan.dto.TestPlanApiScenarioBatchRunDTO;
|
||||
import io.metersphere.plan.dto.request.ApiExecutionMapService;
|
||||
import io.metersphere.plan.dto.request.TestPlanApiScenarioBatchRunRequest;
|
||||
import io.metersphere.plan.mapper.*;
|
||||
import io.metersphere.plan.mapper.ExtTestPlanApiScenarioMapper;
|
||||
import io.metersphere.plan.mapper.TestPlanApiScenarioMapper;
|
||||
import io.metersphere.plan.mapper.TestPlanCollectionMapper;
|
||||
import io.metersphere.plan.mapper.TestPlanMapper;
|
||||
import io.metersphere.project.domain.Project;
|
||||
import io.metersphere.project.mapper.ProjectMapper;
|
||||
import io.metersphere.sdk.constants.*;
|
||||
|
@ -37,6 +40,7 @@ import io.metersphere.system.uid.IDGenerator;
|
|||
import jakarta.annotation.Resource;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
@ -96,7 +100,11 @@ public class TestPlanApiScenarioBatchRunService {
|
|||
public void asyncBatchRun(TestPlanApiScenarioBatchRunRequest request, String userId) {
|
||||
TestPlanService testPlanService = CommonBeanFactory.getBean(TestPlanService.class);
|
||||
testPlanService.setActualStartTime(request.getTestPlanId());
|
||||
Thread.startVirtualThread(() -> batchRun(request, userId));
|
||||
Locale locale = LocaleContextHolder.getLocale();
|
||||
Thread.startVirtualThread(() -> {
|
||||
ApiBatchRunBaseService.setLocale(locale);
|
||||
batchRun(request, userId);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -227,7 +235,6 @@ public class TestPlanApiScenarioBatchRunService {
|
|||
|
||||
/**
|
||||
* 串行批量执行
|
||||
*
|
||||
*/
|
||||
public void serialExecute(String taskId,
|
||||
List<TestPlanApiScenarioBatchRunDTO> testPlanApiScenarios,
|
||||
|
@ -255,7 +262,6 @@ public class TestPlanApiScenarioBatchRunService {
|
|||
|
||||
/**
|
||||
* 并行批量执行
|
||||
*
|
||||
*/
|
||||
public void parallelExecute(String taskId,
|
||||
List<TestPlanApiScenarioBatchRunDTO> testPlanApiScenarios,
|
||||
|
|
Loading…
Reference in New Issue