|
@@ -1,17 +1,13 @@
|
|
|
package com.macro.mall.tiny.modules.business.service;
|
|
|
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
-import com.alibaba.fastjson.JSON;
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.apache.commons.lang3.StringEscapeUtils;
|
|
|
import org.springframework.data.redis.connection.Message;
|
|
|
import org.springframework.data.redis.connection.MessageListener;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import javax.websocket.Session;
|
|
|
import java.io.IOException;
|
|
|
-import java.nio.charset.StandardCharsets;
|
|
|
import java.util.Set;
|
|
|
|
|
|
/**
|
|
@@ -35,9 +31,9 @@ public class RedisSubscribeListener implements MessageListener {
|
|
|
*/
|
|
|
@Override
|
|
|
public void onMessage(Message message, byte[] bytes) {
|
|
|
- String msg = JSON.parseObject(message.getBody(), String.class);
|
|
|
+ String msg = new String(message.getBody());
|
|
|
log.debug("[{}]主题发布:{}", new String(bytes), msg);
|
|
|
- String deviceMac = JSON.parseObject(msg).getString("deviceMac");
|
|
|
+ String deviceMac = JSONUtil.parseObj(msg).getStr("deviceMac");
|
|
|
if (session != null && session.isOpen()) {
|
|
|
if (!sensorMacSet.contains(deviceMac)) {
|
|
|
return;
|