From 75fcd51dea9b0124f6cf00f501f4cd22190d234b Mon Sep 17 00:00:00 2001 From: liangdaliang Date: Wed, 28 May 2025 19:02:53 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=BC=82=E6=AD=A5=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E7=BA=BF=E7=A8=8B=E5=8D=A1=E4=BD=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/test/test/controller/TestCaseController.java | 2 ++ .../src/main/java/com/test/test/domain/TestPlanCase.java | 4 ++-- .../com/test/test/service/impl/TestCaseServiceImpl.java | 7 ++++--- test-ui/src/views/test/testplan/execute/caseExecute.vue | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/test-test/src/main/java/com/test/test/controller/TestCaseController.java b/test-test/src/main/java/com/test/test/controller/TestCaseController.java index 4e894e4..79f0a01 100644 --- a/test-test/src/main/java/com/test/test/controller/TestCaseController.java +++ b/test-test/src/main/java/com/test/test/controller/TestCaseController.java @@ -6,6 +6,7 @@ import com.test.common.core.domain.AjaxResult; import com.test.common.core.page.TableDataInfo; import com.test.common.enums.BusinessType; import com.test.common.utils.DateUtils; +import com.test.common.utils.SecurityUtils; import com.test.common.utils.uuid.IdUtils; import com.test.test.domain.TestCase; import com.test.test.domain.TestPlanCase; @@ -127,6 +128,7 @@ public class TestCaseController extends BaseController { @PostMapping("/runTestPlanCase") public AjaxResult runTestPlanCase(@RequestBody TestPlanCase testPlanCase) { String caseSid = IdUtils.simpleUUID(); + testPlanCase.setExecuteBy(SecurityUtils.getUsername()); // 异步执行任务 CompletableFuture.runAsync(() -> { testCaseService.executeTestCaseByPlanCase(testPlanCase, jmeterHomePath, caseSid); diff --git a/test-test/src/main/java/com/test/test/domain/TestPlanCase.java b/test-test/src/main/java/com/test/test/domain/TestPlanCase.java index 95e6e78..5779d16 100644 --- a/test-test/src/main/java/com/test/test/domain/TestPlanCase.java +++ b/test-test/src/main/java/com/test/test/domain/TestPlanCase.java @@ -40,8 +40,8 @@ public class TestPlanCase extends BaseEntity private String executeResult; /** 执行时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "执行时间", width = 30, dateFormat = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "执行时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") private Date executeTime; /** 执行人 */ diff --git a/test-test/src/main/java/com/test/test/service/impl/TestCaseServiceImpl.java b/test-test/src/main/java/com/test/test/service/impl/TestCaseServiceImpl.java index 6546220..0c778aa 100644 --- a/test-test/src/main/java/com/test/test/service/impl/TestCaseServiceImpl.java +++ b/test-test/src/main/java/com/test/test/service/impl/TestCaseServiceImpl.java @@ -229,7 +229,7 @@ public class TestCaseServiceImpl implements ITestCaseService for (TestPlanCase input : testPlanCaseList) { boolean isSuccess = true; input.setExecuteTime(DateUtils.getNowDate()); - input.setExecuteBy(SecurityUtils.getUsername()); + input.setExecuteBy(testPlanCase.getExecuteBy()); TestCase testCase = this.selectTestCaseById(input.getCaseId()); Long id = input.getCaseId(); Map contextResultMap = new HashMap<>(); @@ -290,13 +290,14 @@ public class TestCaseServiceImpl implements ITestCaseService } if (isSuccess) { testCaseLog.setOperDetail("成功"); - input.setExecuteResult("成功"); + input.setExecuteResult("1"); } else { testCaseLog.setOperDetail("失败"); - input.setExecuteResult("失败"); + input.setExecuteResult("2"); } testCaseLogMapper.insertTestCaseLog(testCaseLog); testPlanCaseMapper.updateTestPlanCase(input); + System.out.println("111111111111111111111111"); } testPlan.setUpdateTime(DateUtils.getNowDate()); testPlan.setStatus("2"); diff --git a/test-ui/src/views/test/testplan/execute/caseExecute.vue b/test-ui/src/views/test/testplan/execute/caseExecute.vue index 539fec1..af62195 100644 --- a/test-ui/src/views/test/testplan/execute/caseExecute.vue +++ b/test-ui/src/views/test/testplan/execute/caseExecute.vue @@ -39,7 +39,7 @@ - +