Commit cbb74352 authored by 赵啸非's avatar 赵啸非

添加设备消息接收下发功能

parent 5167988d
...@@ -7,6 +7,7 @@ import com.mortals.xhx.common.code.MessageProtocolEnum; ...@@ -7,6 +7,7 @@ import com.mortals.xhx.common.code.MessageProtocolEnum;
import com.mortals.xhx.queue.TbQueueMsgHeaders; import com.mortals.xhx.queue.TbQueueMsgHeaders;
import lombok.Setter; import lombok.Setter;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
...@@ -22,7 +23,7 @@ public class DefaultTbQueueMsgHeaders implements TbQueueMsgHeaders { ...@@ -22,7 +23,7 @@ public class DefaultTbQueueMsgHeaders implements TbQueueMsgHeaders {
protected Map<String, String> data = new HashMap<>(); protected Map<String, String> data = new HashMap<>();
public DefaultTbQueueMsgHeaders() { public DefaultTbQueueMsgHeaders() {
data.put(MessageHeader.TIMESTAMP, DateUtils.getCurrStrDateTime()); data.put(MessageHeader.TIMESTAMP, String.valueOf(new Date().getTime()));
// data.put(MessageHeader.MESSAGESIGN, new String(SecureUtil.sign(SignAlgorithm.SHA256withRSA).sign(data.get(MessageHeader.TIMESTAMP).getBytes()))); // data.put(MessageHeader.MESSAGESIGN, new String(SecureUtil.sign(SignAlgorithm.SHA256withRSA).sign(data.get(MessageHeader.TIMESTAMP).getBytes())));
// TODO: 2022/4/15 // TODO: 2022/4/15
data.put(MessageHeader.MESSAGESIGN, "abcd1234"); data.put(MessageHeader.MESSAGESIGN, "abcd1234");
......
...@@ -65,6 +65,7 @@ public class DownMsgTask implements Runnable { ...@@ -65,6 +65,7 @@ public class DownMsgTask implements Runnable {
TopicPartitionInfo info = TopicPartitionInfo.builder().exchangeName(exchangeName).topic(Constant.UPLOAD_TOPIC + deviceEntity.getDeviceMac()).build(); TopicPartitionInfo info = TopicPartitionInfo.builder().exchangeName(exchangeName).topic(Constant.UPLOAD_TOPIC + deviceEntity.getDeviceMac()).build();
TbQueueMsgHeaders header = new DefaultTbQueueMsgHeaders(); TbQueueMsgHeaders header = new DefaultTbQueueMsgHeaders();
header.put(MessageHeader.MESSAGETYPE, Constant.MESSAGETYPE_HEARTBEAT); header.put(MessageHeader.MESSAGETYPE, Constant.MESSAGETYPE_HEARTBEAT);
header.put(MessageHeader.TIMESTAMP, item.getTimestamp().toString());
deviceService.sendDeviceMessage(deviceEntity, info, header, JSON.toJSONString(item.getData()), null); deviceService.sendDeviceMessage(deviceEntity, info, header, JSON.toJSONString(item.getData()), null);
} }
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment