2025-04-11 18:08:08 +08:00
|
|
|
package com.ruoyi.web.app;
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.web.bind.annotation.PutMapping;
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
import com.ruoyi.bst.device.domain.DeviceVO;
|
|
|
|
import com.ruoyi.bst.device.service.DeviceIotService;
|
|
|
|
import com.ruoyi.bst.device.service.DeviceService;
|
|
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
|
import com.ruoyi.common.utils.ServiceUtil;
|
|
|
|
import com.ruoyi.iot.constants.IotConstants;
|
|
|
|
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
|
|
|
@RestController
|
|
|
|
@RequestMapping("/app/device/iot")
|
|
|
|
public class AppDeviceIotController extends BaseController {
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
private DeviceIotService deviceIotService;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
private DeviceService deviceService;
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation("用户响铃寻车")
|
|
|
|
@PutMapping("/ring")
|
|
|
|
public AjaxResult ring(@RequestParam(required = false) Long id, @RequestParam(required = false) String sn) {
|
|
|
|
DeviceVO device = deviceService.selectAvaliableDevice(id, sn);
|
|
|
|
ServiceUtil.assertion(device == null, "当前车辆不可用,无法响铃寻车");
|
2025-04-14 18:07:16 +08:00
|
|
|
return toAjax(deviceIotService.play(device, IotConstants.PLAY_WARNING, "用户响铃寻车", true));
|
2025-04-11 18:08:08 +08:00
|
|
|
}
|
|
|
|
}
|