This commit is contained in:
lu7213 committed 2026-03-07 22:52:06 +08:00
1 parent 7883a39de8
commit 89987ee139
3 files changed
+13 -2

No files matched your search

@@ -35,6 +35,17 @@ public class EcDeviceApiController extends BaseController {
} }
return AjaxResult.success(ecDevice); return AjaxResult.success(ecDevice);
} }
@GetMapping("/mjpegSnapshop")
public AjaxResult mjpegSnapshop(@RequestParam(name = "deviceCode") String deviceCode) {
EcDevice ecDevice = new EcDevice();
try {
ecDevice.setLastScreenPic(ecDeviceService.mjpegSnapshop(deviceCode));
} catch (Exception e) {
logger.error(e.getMessage(),e);
return AjaxResult.error(e.getMessage());
}
return AjaxResult.success(ecDevice);
}
@PostMapping("/heartbeat") @PostMapping("/heartbeat")
public AjaxResult heartbeat(@RequestBody EcDeviceHeartbeatDto heartbeatDto) { public AjaxResult heartbeat(@RequestBody EcDeviceHeartbeatDto heartbeatDto) {
if (heartbeatDto.getDeviceCode() == null || heartbeatDto.getDeviceCode().isEmpty()) { if (heartbeatDto.getDeviceCode() == null || heartbeatDto.getDeviceCode().isEmpty()) {
@@ -74,7 +74,7 @@ public interface IEcDeviceService extends IService<EcDevicePlus> {
String snapshop(String deviceCode) throws Exception; String snapshop(String deviceCode) throws Exception;
String MjpegSnapshop(String deviceCode) throws Exception; String mjpegSnapshop(String deviceCode) throws Exception;
Map<Long, EcDevicePlus> getMapByIds(List<Long> ids, SFunction<EcDevicePlus, ?>... columns); Map<Long, EcDevicePlus> getMapByIds(List<Long> ids, SFunction<EcDevicePlus, ?>... columns);
@@ -73,7 +73,7 @@ public class EcDeviceServiceImpl extends ServiceImpl<EcDeviceMapper, EcDevicePlu
return ruoYiConfig.getReqUrl() + "/ec/" + deviceCode + "/" + fileName; return ruoYiConfig.getReqUrl() + "/ec/" + deviceCode + "/" + fileName;
} }
public String MjpegSnapshop(String deviceCode) throws Exception { public String mjpegSnapshop(String deviceCode) throws Exception {
EcDevicePlus device = selectEcDeviceByDeviceCode(deviceCode); EcDevicePlus device = selectEcDeviceByDeviceCode(deviceCode);
if (device == null || device.getStatus() == null || device.getStatus() == 0) { if (device == null || device.getStatus() == null || device.getStatus() == 0) {
return ruoYiConfig.getReqUrl() + "/ec/default/offline.png"; return ruoYiConfig.getReqUrl() + "/ec/default/offline.png";