|
|
@@ -19,6 +19,7 @@ import com.zhongshu.iot.server.core.dao.mqtt.DeviceInfoDao;
|
|
|
import com.zhongshu.iot.server.core.dao.mqtt.OperationMessageDao;
|
|
|
import com.zhongshu.iot.server.core.dao.mqtt.OperationMessageResultDao;
|
|
|
import com.zhongshu.iot.server.core.dao.other.ExecuteMethodInfoDao;
|
|
|
+import com.zhongshu.iot.server.core.dataConfig.MqttConfig;
|
|
|
import com.zhongshu.iot.server.core.domain.iot.IotMain;
|
|
|
import com.zhongshu.iot.server.core.domain.iot.mqtt.DeviceInfo;
|
|
|
import com.zhongshu.iot.server.core.domain.iot.mqtt.OperationMessage;
|
|
|
@@ -26,9 +27,9 @@ import com.zhongshu.iot.server.core.domain.iot.mqtt.OperationMessageResult;
|
|
|
import com.zhongshu.iot.server.core.domain.other.ExecuteMethodInfo;
|
|
|
import com.zhongshu.iot.server.core.httpRequest.ApiRequestService;
|
|
|
import com.zhongshu.iot.server.core.service.base.SuperService;
|
|
|
-import com.zhongshu.iot.server.core.service.iot.IotDataVerifyService;
|
|
|
import com.zhongshu.iot.server.core.service.device.DeviceInfoService;
|
|
|
import com.zhongshu.iot.server.core.service.device.GateWayInfoService;
|
|
|
+import com.zhongshu.iot.server.core.service.iot.IotDataVerifyService;
|
|
|
import com.zhongshu.iot.server.core.util.CommonUtil;
|
|
|
import com.zhongshu.iot.server.core.util.DateUtils;
|
|
|
import com.zhongshu.iot.server.core.util.TokenUtil;
|
|
|
@@ -358,8 +359,7 @@ public class OperationMessageService {
|
|
|
List<IotMain> events = iotMainDao.findByRealIotTopicAndFunctionTypeOrderByCreateTimeAsc(entity.getTopic(), FunctionType.Event);
|
|
|
if (ObjectUtils.isNotEmpty(events)) {
|
|
|
// 去重
|
|
|
- events = events.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(
|
|
|
- () -> new TreeSet<>(Comparator.comparing(IotMain::getRealIotTopic))), ArrayList::new));
|
|
|
+ events = events.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(IotMain::getRealIotTopic))), ArrayList::new));
|
|
|
for (IotMain iotMain : events) {
|
|
|
executeOperationMessage(entity, requestData, iotMain);
|
|
|
}
|
|
|
@@ -368,11 +368,10 @@ public class OperationMessageService {
|
|
|
handleMsg = "无对应物模型事件处理";
|
|
|
log.error("无对应物模型事件处理: {}", entity.getTopic());
|
|
|
}
|
|
|
- // 如果是ping,则平台也会处理
|
|
|
- if (event != null && event.equals("ping")) {
|
|
|
- pingHandler(entity, requestData);
|
|
|
- } else if (event != null && event.equals("ServerTime")) {
|
|
|
- pingHandler(entity, requestData);
|
|
|
+
|
|
|
+ // 本地处理的事件
|
|
|
+ if (event != null && MqttConfig.localHandelEvent.contains(event)) {
|
|
|
+ localHandler(entity, requestData);
|
|
|
} else {
|
|
|
// 业务处理失败
|
|
|
entity.setIsHandleSuccess(isHandleSuccess);
|
|
|
@@ -392,7 +391,7 @@ public class OperationMessageService {
|
|
|
* @param requestData
|
|
|
* @return
|
|
|
*/
|
|
|
- public ResultContent pingHandler(OperationMessage entity, JSONObject requestData) {
|
|
|
+ public ResultContent localHandler(OperationMessage entity, JSONObject requestData) {
|
|
|
String event = entity.getEvent();
|
|
|
Object result = null;
|
|
|
StopWatch stopWatch = new StopWatch();
|