This commit is contained in:
lu7213 committed 2026-03-05 22:42:55 +08:00
1 parent 7cd697187c
commit 6c73388fdd
25 files changed
+454 -33

No files matched your search

@@ -0,0 +1,38 @@
package com.luqj.ec.controller;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.luqj.ec.domain.dto.EcDeviceHeartbeatDto;
import com.luqj.ec.domain.dto.EcDeviceReportDto;
import com.luqj.ec.service.IEcDeviceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/ec/device-api")
public class EcDeviceApiController extends BaseController {
@Autowired
private IEcDeviceService ecDeviceService;
@PostMapping("/report")
public AjaxResult report(@RequestBody EcDeviceReportDto reportDto) {
if (reportDto.getDeviceCode() == null || reportDto.getDeviceCode().isEmpty()) {
return AjaxResult.error("deviceCode不能为空");
}
ecDeviceService.reportDevice(reportDto);
return AjaxResult.success("设备上报成功");
}
@PostMapping("/heartbeat")
public AjaxResult heartbeat(@RequestBody EcDeviceHeartbeatDto heartbeatDto) {
if (heartbeatDto.getDeviceCode() == null || heartbeatDto.getDeviceCode().isEmpty()) {
return AjaxResult.error("deviceCode不能为空");
}
ecDeviceService.heartbeat(heartbeatDto);
return AjaxResult.success("心跳成功");
}
}