fix(测试跟踪): 修复批量执行测试计划报告创建人不对的问题

--bug=1037577 --user=宋天阳 【测试跟踪】github#29594,【测试跟踪】批量执行测试计划的报告创建人显示 不对 https://www.tapd.cn/55049933/s/1517612
This commit is contained in:
Jianguo-Genius 2024-05-21 15:13:48 +08:00 committed by 建国
parent 9d0926cd78
commit ca77cef4f7
3 changed files with 6 additions and 1 deletions

View File

@ -7,7 +7,7 @@ import java.util.List;
public class ExtTestPlanExecutionQueueProvider { public class ExtTestPlanExecutionQueueProvider {
public String insertListSql(List<TestPlanExecutionQueue> list) { public String insertListSql(List<TestPlanExecutionQueue> list) {
StringBuffer sqlList = new StringBuffer(); StringBuffer sqlList = new StringBuffer();
sqlList.append("insert into test_plan_execution_queue (id,report_id, run_mode, create_time, test_plan_id, resource_id, num) values "); sqlList.append("insert into test_plan_execution_queue (id,report_id, run_mode, create_time, test_plan_id, resource_id, num, execute_user) values ");
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
TestPlanExecutionQueue result = list.get(i); TestPlanExecutionQueue result = list.get(i);
sqlList.append(" (") sqlList.append(" (")
@ -25,6 +25,8 @@ public class ExtTestPlanExecutionQueueProvider {
.append(result.getResourceId()) .append(result.getResourceId())
.append("',") .append("',")
.append(result.getNum()) .append(result.getNum())
.append("',")
.append(result.getExecuteUser())
.append(")"); .append(")");
if (i < list.size() - 1) { if (i < list.size() - 1) {
sqlList.append(","); sqlList.append(",");

View File

@ -7,6 +7,7 @@ import io.metersphere.base.domain.*;
import io.metersphere.commons.constants.*; import io.metersphere.commons.constants.*;
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.dto.ScheduleDTO; import io.metersphere.dto.ScheduleDTO;
import io.metersphere.dto.TestPlanDTOWithMetric; import io.metersphere.dto.TestPlanDTOWithMetric;
import io.metersphere.dto.TestPlanRerunParametersDTO; import io.metersphere.dto.TestPlanRerunParametersDTO;
@ -311,6 +312,7 @@ public class TestPlanController {
@RequiresPermissions(PermissionConstants.PROJECT_TRACK_PLAN_READ_RUN) @RequiresPermissions(PermissionConstants.PROJECT_TRACK_PLAN_READ_RUN)
@MsAuditLog(module = OperLogModule.TRACK_TEST_PLAN, type = OperLogConstants.EXECUTE, content = "#msClass.getLogDetails(#request.testPlanIds)", msClass = TestPlanService.class) @MsAuditLog(module = OperLogModule.TRACK_TEST_PLAN, type = OperLogConstants.EXECUTE, content = "#msClass.getLogDetails(#request.testPlanIds)", msClass = TestPlanService.class)
public void runBatch(@RequestBody TestPlanRunRequest request) { public void runBatch(@RequestBody TestPlanRunRequest request) {
request.setUserId(SessionUtils.getUserId());
baseUserService.checkUserAndProject(request.getUserId(), request.getProjectId()); baseUserService.checkUserAndProject(request.getUserId(), request.getProjectId());
request.setTriggerMode(TriggerMode.BATCH.name()); request.setTriggerMode(TriggerMode.BATCH.name());
testPlanService.runBatch(request); testPlanService.runBatch(request);

View File

@ -2247,6 +2247,7 @@ public class TestPlanService {
TestPlanRunRequest runRequest = JSON.parseObject(JSON.toJSONString(jsonObject), TestPlanRunRequest.class); TestPlanRunRequest runRequest = JSON.parseObject(JSON.toJSONString(jsonObject), TestPlanRunRequest.class);
runRequest.setReportId(planExecutionQueue.getReportId()); runRequest.setReportId(planExecutionQueue.getReportId());
runRequest.setTriggerMode(request.getTriggerMode()); runRequest.setTriggerMode(request.getTriggerMode());
runRequest.setUserId(request.getUserId());
runPlan(runRequest); runPlan(runRequest);
} }
} }