|
|
@@ -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()));
|