| File was renamed from ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TTestLiveController.java |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | package com.battery.business.web; |
| | | |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | |
| | | import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.system.service.ITestLiveService; |
| | | import com.battery.business.service.ITestLiveService; |
| | | |
| | | /** 测试控制台实时 REST/SSE 入口,仅负责鉴权和协议转发。 */ |
| | | @RestController |
| | |
| | | public class TTestLiveController extends BaseController |
| | | { |
| | | private final ITestLiveService liveService; |
| | | public TTestLiveController(ITestLiveService liveService) |
| | | { this.liveService = liveService; } |
| | | private final TestLiveStream stream; |
| | | public TTestLiveController(ITestLiveService liveService, TestLiveStream stream) |
| | | { this.liveService = liveService; this.stream = stream; } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('system:test:query')") |
| | | @GetMapping("/{testId}/live-state") |
| | |
| | | /** 推送实时快照、设备状态和可追溯的异常事实。 */ |
| | | @PreAuthorize("@ss.hasPermi('system:test:query')") |
| | | @GetMapping(value = "/{testId}/live", produces = MediaType.TEXT_EVENT_STREAM_VALUE) |
| | | public SseEmitter live(@PathVariable Long testId) { return liveService.stream(testId); } |
| | | public SseEmitter live(@PathVariable Long testId) { return stream.stream(testId); } |
| | | } |