42 lines
1.2 KiB
Java
42 lines
1.2 KiB
Java
![]() |
package com.ruoyi.iot.service;
|
|||
|
import com.ruoyi.iot.constants.ReceiveConstants;
|
|||
|
import com.ruoyi.iot.domain.ReceiveMsg;
|
|||
|
import com.ruoyi.iot.enums.ReceiveType;
|
|||
|
import com.ruoyi.ss.device.domain.SmDevice;
|
|||
|
import com.ruoyi.ss.device.service.ISmDeviceService;
|
|||
|
import lombok.extern.slf4j.Slf4j;
|
|||
|
import org.springframework.beans.factory.annotation.Autowired;
|
|||
|
import org.springframework.stereotype.Service;
|
|||
|
|
|||
|
/**
|
|||
|
* @author wjh
|
|||
|
* 2024/5/6
|
|||
|
*/
|
|||
|
@Service
|
|||
|
@Slf4j
|
|||
|
public class IotReceiveServiceImpl implements IotReceiveService{
|
|||
|
|
|||
|
@Autowired
|
|||
|
private ISmDeviceService deviceService;
|
|||
|
|
|||
|
@Override
|
|||
|
public void handleReceive(ReceiveMsg msg) {
|
|||
|
log.info("handleReceive {}", msg.toString());
|
|||
|
if (ReceiveType.DATA_POINT.getType().equals(msg.getType())
|
|||
|
&& ReceiveConstants.DS_SSID.equals(msg.getDsId())
|
|||
|
&& ReceiveConstants.DSV_SSID_CT.equals((String) msg.getValue())
|
|||
|
) {
|
|||
|
// 当数据点推送ssid的值为ChangteA时,录入设备
|
|||
|
deviceService.addInitDevice(this.parseToDevice(msg));
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private SmDevice parseToDevice(ReceiveMsg msg) {
|
|||
|
SmDevice device = new SmDevice();
|
|||
|
device.setMac(msg.getDevName());
|
|||
|
return device;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
}
|