|
@@ -2,9 +2,11 @@ package com.zhongshu.iot.server.core.service.iot;
|
|
|
|
|
|
|
|
import cn.hutool.json.JSONObject;
|
|
import cn.hutool.json.JSONObject;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
import cn.hutool.json.JSONUtil;
|
|
|
|
|
+import com.github.microservice.models.iot.IotSendByIdParam;
|
|
|
import com.github.microservice.models.iot.IotSendGateWayParam;
|
|
import com.github.microservice.models.iot.IotSendGateWayParam;
|
|
|
import com.github.microservice.models.iot.IotSendParam;
|
|
import com.github.microservice.models.iot.IotSendParam;
|
|
|
import com.github.microservice.net.ResultContent;
|
|
import com.github.microservice.net.ResultContent;
|
|
|
|
|
+import com.github.microservice.net.ResultMessage;
|
|
|
import com.zhongshu.iot.client.model.iot.IotMainSearch;
|
|
import com.zhongshu.iot.client.model.iot.IotMainSearch;
|
|
|
import com.zhongshu.iot.client.type.IotDataType;
|
|
import com.zhongshu.iot.client.type.IotDataType;
|
|
|
import com.zhongshu.iot.client.type.OperationType;
|
|
import com.zhongshu.iot.client.type.OperationType;
|
|
@@ -67,6 +69,24 @@ public class IotSendMessageService extends SuperService {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private GateWayInfoDao gateWayInfoDao;
|
|
private GateWayInfoDao gateWayInfoDao;
|
|
|
|
|
|
|
|
|
|
+ public ResultContent sendIotMsgById(IotSendByIdParam param) {
|
|
|
|
|
+ if (StringUtils.isEmpty(param.getId())) {
|
|
|
|
|
+ return ResultContent.buildFail("id不能为空");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (param.getData() == null) {
|
|
|
|
|
+ return ResultContent.buildFail("data不能为空");
|
|
|
|
|
+ }
|
|
|
|
|
+ IotMain iotMain = iotMainDao.findTopById(param.getId());
|
|
|
|
|
+ if (ObjectUtils.isEmpty(iotMain)) {
|
|
|
|
|
+ return ResultContent.buildFail(String.format(ResultMessage.DATA_NOT_EXIST, param.getId()));
|
|
|
|
|
+ }
|
|
|
|
|
+ IotSendParam iotSendParam = new IotSendParam();
|
|
|
|
|
+ iotSendParam.setData(param.getData());
|
|
|
|
|
+ iotSendParam.setId(param.getId());
|
|
|
|
|
+ iotSendParam.setIsImitate(Boolean.TRUE);
|
|
|
|
|
+ return sendIotMessage(iotSendParam);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 发送信息
|
|
* 发送信息
|
|
|
*
|
|
*
|