|
@@ -3,10 +3,12 @@ package com.xy.service.factory.cmd.impl;
|
|
|
import cn.hutool.json.JSONObject;
|
|
|
import com.xy.annotate.Factory;
|
|
|
import com.xy.device.EnumMqttCmdTempletSets;
|
|
|
+import com.xy.dto.DeviceEventMsgDto;
|
|
|
import com.xy.dto.DeviceTempSetDto;
|
|
|
import com.xy.dto.MqttCmdDto;
|
|
|
import com.xy.dto.PaterDto;
|
|
|
import com.xy.entity.DeviceTempSet;
|
|
|
+import com.xy.service.DeviceEventMsgService;
|
|
|
import com.xy.service.DeviceTempSetServiceImpl;
|
|
|
import com.xy.service.factory.cmd.CmdService;
|
|
|
import com.xy.utils.R;
|
|
@@ -23,12 +25,20 @@ public class SetsCmdServiceImpl implements CmdService {
|
|
|
|
|
|
private DeviceTempSetServiceImpl deviceTempSetService;
|
|
|
|
|
|
+ private DeviceEventMsgService deviceEventMsgService;
|
|
|
+
|
|
|
@Override
|
|
|
public R senCommand(List<MqttCmdDto> mqttDtos) {
|
|
|
for (MqttCmdDto mqttDto : mqttDtos) {
|
|
|
PaterDto pater = mqttDto.getPater();
|
|
|
JSONObject data = pater.getData();
|
|
|
String type = data.getStr("type");
|
|
|
+ //设备事件
|
|
|
+ DeviceEventMsgDto.Save deviceEventMsgInfo = new DeviceEventMsgDto.Save()
|
|
|
+ .setDeviceId(mqttDto.getDeviceId());
|
|
|
+ deviceEventMsgInfo.setCode("M011");
|
|
|
+ deviceEventMsgInfo.setMsg(String.format("发送设置指令,类型:%s,指令值:%s", type, mqttDto.getPater().getData().toString()));
|
|
|
+ deviceEventMsgService.save(deviceEventMsgInfo);
|
|
|
//温度设置指令
|
|
|
if (type.equals(EnumMqttCmdTempletSets.TEMPERATURE.getCode())) {
|
|
|
DeviceTempSetDto.Save save = new DeviceTempSetDto.Save()
|