From b78295e8da96c3e5e76befeef9582ce5273dbb74 Mon Sep 17 00:00:00 2001
From: yeg <1347747024@qq.com>
Date: 星期二, 29 九月 2026 13:10:23 +0800
Subject: [PATCH] 按代码规范检查整改实体注释、Service Javadoc 与分层边界
---
ruoyi-admin/src/main/java/com/battery/business/web/TTestWarningExceptionController.java | 22 ++++++----------------
1 files changed, 6 insertions(+), 16 deletions(-)
diff --git a/ruoyi-admin/src/main/java/com/battery/business/web/TTestWarningExceptionController.java b/ruoyi-admin/src/main/java/com/battery/business/web/TTestWarningExceptionController.java
index 54c4b98..4552fda 100644
--- a/ruoyi-admin/src/main/java/com/battery/business/web/TTestWarningExceptionController.java
+++ b/ruoyi-admin/src/main/java/com/battery/business/web/TTestWarningExceptionController.java
@@ -10,38 +10,28 @@
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.battery.business.domain.TTestWarningException;
-import com.battery.business.mapper.TTestMapper;
-import com.battery.business.service.ITTestService;
import com.battery.business.service.impl.TestWarningExceptionService;
-/** 测试预警异常查询与人工关闭接口。 */
+/** 测试预警异常查询与人工关闭接口;归属校验和关闭规则由服务层负责。 */
@RestController
@RequestMapping("/system/test-warning-exceptions")
public class TTestWarningExceptionController extends BaseController {
- @Autowired private TTestMapper mapper;
- @Autowired private ITTestService testService;
@Autowired private TestWarningExceptionService warningExceptionService;
/** 按测试和状态查询后端异常事实。 */
@PreAuthorize("@ss.hasPermi('system:exception:query')")
@GetMapping("/list")
public TableDataInfo list(@RequestParam(required=false) Long testId, @RequestParam(required=false) String status) {
startPage();
- List<TTestWarningException> rows = mapper.selectWarningExceptions(testId, status);
+ List<TTestWarningException> rows = warningExceptionService.list(testId, status);
return getDataTable(rows);
}
- /** 校验测试负责人身份并关闭异常,通过应用操作日志记录处理动作。 */
+ /** 关闭异常:处理结果必填且只有测试负责人可操作,通过应用操作日志记录处理动作。 */
@PreAuthorize("@ss.hasPermi('system:exception:handle')")
@Log(title = "测试预警异常", businessType = BusinessType.UPDATE)
@PutMapping("/{exceptionId}/close")
- public AjaxResult close(@PathVariable Long exceptionId, @RequestBody CloseRequest request) {
- if (request == null || request.handlingNote() == null || request.handlingNote().trim().isEmpty()) return error("处理结果不能为空");
- TTestWarningException exception = mapper.selectWarningExceptionById(exceptionId);
- if (exception == null) return error("异常不存在");
- var test = testService.selectTestById(exception.getTestId());
- if (test == null || !getUserId().equals(test.getPrincipalId()))
- return error("仅测试负责人可以关闭预警异常");
- int rows = warningExceptionService.close(exceptionId, getUserId(), getUsername(), request.handlingNote().trim());
- return rows == 1 ? success(mapper.selectWarningExceptionById(exceptionId)) : error("异常已关闭或不存在");
+ public AjaxResult close(@PathVariable Long exceptionId, @RequestBody(required=false) CloseRequest request) {
+ return success(warningExceptionService.closeByPrincipal(exceptionId, getUserId(), getUsername(),
+ request == null ? null : request.handlingNote()));
}
public record CloseRequest(String handlingNote) {}
}
--
Gitblit v1.7.1