设备操作相关接口,以及用户充值卡相关接口修改

This commit is contained in:
mi9688
2024-12-18 14:55:56 +08:00
parent 788bfb100a
commit 593f3d3faa
11 changed files with 144 additions and 18 deletions

View File

@ -32,7 +32,7 @@ public class DeviceOtherMsgConsumer {
public void consume(DeviceReportBo bo){
try {
//处理emq订阅的非 property/post 属性上报的消息 ,因为其他消息量小,放在一起处理
String serialNumber=bo.getSerialNumber();//设备序列号
Long productId;//产品id
Long packetId;//包号
@ -40,8 +40,11 @@ public class DeviceOtherMsgConsumer {
String topic=bo.getTopicName();//主题
//从主题中解析出产品id
String[] split = topic.split("/");
productId=Long.valueOf(split[1]);
System.err.println("主题:"+topic+"产品id:"+productId+"设备序列号:"+serialNumber);
productId= Long.valueOf(split[1]);
//从主题中解析出设备序列号
String serialNumber= split[2];//设备序列号
System.err.println("主题:"+topic+"--产品id:"+productId+"--设备序列号:"+serialNumber);
//设备上报数据消息
if(topic.endsWith("/info/up")){
deviceDataReportHandler(new String(data));

View File

@ -42,11 +42,12 @@ public class DeviceOtherMsgHandler {
* @param bo
*/
public void messageHandler(DeviceReportBo bo) {
System.err.println("进入消息处理入口:"+bo);
String type = "";
String name = topicsUtils.parseTopicName(bo.getTopicName());
if (StringUtils.isEmpty(name) || name.endsWith(TopicType.FUNCTION_GET.getTopicSuffix())) return;
ReportDataBo data = this.buildReportData(bo);
System.err.println("进入消息处理入口:"+data);
TopicType topicType = TopicType.getType(name);
switch (topicType) {
case INFO_POST:
@ -77,7 +78,7 @@ public class DeviceOtherMsgHandler {
String message = new String(bo.getData());
// log.info("收到设备信息[{}]", message);
Long productId = topicsUtils.parseProductId(bo.getTopicName());
System.err.println("主题路径解析出产品id:"+productId);
// System.err.println("主题路径解析出产品id:"+productId);
String serialNumber = topicsUtils.parseSerialNumber(bo.getTopicName());
ReportDataBo dataBo = new ReportDataBo();
dataBo.setMessage(message);