xucaiqin il y a 1 an
Parent
commit
9ff0a4ade6

+ 1 - 1
iot-module/iot-module-data/iot-module-data-biz/src/main/java/com/middle/platform/data/biz/pojo/data/RawData.java

@@ -23,7 +23,7 @@ public class RawData implements Serializable {
     private String deviceSn;
     private Object data;
     /**
-     * 数据上报方式
+     * 数据上报方式 1-mqtt 2-http 3-kafka
      */
     private Integer reportProtocol;
 }

+ 1 - 1
iot-module/iot-module-data/iot-module-data-biz/src/main/java/com/middle/platform/data/biz/service/kafka/KafkaService.java

@@ -35,7 +35,7 @@ public class KafkaService {
                 return;
             }
             amqpTemplate.convertAndSend(RabbitConstant.TOPIC_EXCHANGE_DATA, RabbitConstant.ROUTING_POINT_DATA_PREFIX + RabbitConstant.RAW_QUEUE,
-                    new RawData(kafkaData.getProductKey(), kafkaData.getDeviceSn(), kafkaData.getData(), 1));
+                    new RawData(kafkaData.getProductKey(), kafkaData.getDeviceSn(), kafkaData.getData(), 4));
         }
     }
 }

+ 1 - 1
iot-module/iot-module-manage/iot-module-manage-api/src/main/java/com/middle/platform/manage/api/pojo/ProductVo.java

@@ -32,7 +32,7 @@ public class ProductVo implements Serializable {
      */
     private Integer dataFormat;
     /**
-     * 上报协议 1-mqtt 2-http 3-coap 4-tcp 5-udp
+     * 上报协议 1-mqtt 2-http 3-kafka
      */
     private Integer reportProtocol;
 }

+ 7 - 1
iot-module/iot-module-manage/iot-module-manage-biz/src/main/java/com/middle/platform/manage/biz/service/IotDeviceService.java

@@ -61,6 +61,12 @@ public class IotDeviceService {
     private final UserApi userApi;
     private final TdApi tdApi;
 
+    public static void main(String[] args) {
+        LocalDateTime now = LocalDateTime.now();
+        LocalDateTime parse = LocalDateTimeUtil.parse("2024-03-06T15:44:02.597862986");
+        System.out.println(LocalDateTimeUtil.between(parse, now, ChronoUnit.MINUTES));
+    }
+
     /**
      * 设备分页查询
      *
@@ -77,7 +83,7 @@ public class IotDeviceService {
                 LocalDateTime parse = LocalDateTimeUtil.parse((String) t);
                 if (Objects.nonNull(parse)) {
                     a.setOnlineTime(LocalDateTimeUtil.parse((String) t));
-                    a.setStatus(LocalDateTimeUtil.between(parse, now, ChronoUnit.MINUTES) > 10L ? 0 : 1);
+                    a.setStatus(Math.abs(LocalDateTimeUtil.between(parse, now, ChronoUnit.MINUTES)) > 10L ? 0 : 1);
                 }
             });
             Optional.ofNullable(userApi.queryUser(a.getCreateBy())).ifPresent(userCache -> a.setCreateByLabel(userCache.getName()));