Commit ae624c7a by YG8999

设备网关代码

parent eab4e680
......@@ -20,6 +20,7 @@ import share.system.domain.DeviceGateway;
import share.system.service.DeviceGatewayService;
import share.common.utils.poi.ExcelUtil;
import share.common.core.page.TableDataInfo;
import share.system.service.DeviceOpService;
/**
* 设备网关信息Controller
......@@ -33,6 +34,8 @@ public class DeviceGatewayController extends BaseController
{
@Autowired
private DeviceGatewayService deviceGatewayService;
@Autowired
private DeviceOpService deviceOpService;
/**
* 查询设备网关信息列表
......@@ -102,5 +105,28 @@ public class DeviceGatewayController extends BaseController
return toAjax(deviceGatewayService.deleteDeviceGatewayByIds(ids));
}
/**
* 清除网关设备列表
*/
@PreAuthorize("@ss.hasPermi('system:gateway:edit')")
@Log(title = "设备网关信息", businessType = BusinessType.UPDATE)
@PostMapping(value = "/clearGatewayDevice")
public AjaxResult clearGatewayDevice(@RequestBody DeviceGateway deviceGateway)
{
deviceOpService.clearGatewayDevice(deviceGateway.getDevId());
return toAjax(true);
}
/**
* 绑定网关设备列表
*/
@PreAuthorize("@ss.hasPermi('system:gateway:edit')")
@Log(title = "设备网关信息", businessType = BusinessType.UPDATE)
@PostMapping(value = "/addGatewayDevice")
public AjaxResult addGatewayDevice(@RequestBody DeviceGateway deviceGateway)
{
deviceOpService.addGatewayDevice(deviceGateway.getDevId());
return toAjax(true);
}
}
......@@ -22,4 +22,19 @@ public interface DeviceOpService {
* @param phone 操作用户
*/
void openDoor(Long roomId, String phone);
/**
* 清除网关锁id列表
* @param devId 网关设备dev_id
* @return
*/
void clearGatewayDevice(String devId);
/**
* 下发组号、锁id/取电开关id列表
* @param devId 网关设备dev_id
* @return
*/
void addGatewayDevice(String devId);
}
......@@ -94,4 +94,36 @@ public class DeviceOpServiceImpl implements DeviceOpService {
deviceLogService.addDeviceLog(mqttxVo);
}
/**
* 清除网关锁id列表
* @param devId 网关设备dev_id
* @return
*/
@Override
public void clearGatewayDevice(String devId) {
// 获取mqtt的topic、payload
MqttxVo mqttxVo = mqttxService.clearGatewayDevice(devId);
// 发送mqtt消息
mqttGatewayComponent.sendToMqtt(mqttxVo.getTopic(), 0, mqttxVo.getPayload());
// 写日志记录
deviceLogService.addDeviceLog(mqttxVo);
}
/**
* 下发组号、锁id/取电开关id列表
* @param devId 网关设备dev_id
* @return
*/
@Override
public void addGatewayDevice(String devId) {
// 获取mqtt的topic、payload
MqttxVo mqttxVo = mqttxService.addGatewayDevice(devId);
// 发送mqtt消息
mqttGatewayComponent.sendToMqtt(mqttxVo.getTopic(), 0, mqttxVo.getPayload());
// 写日志记录
deviceLogService.addDeviceLog(mqttxVo);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment