From cf66bbb7429730128560dd65ebf0807a35cf3107 Mon Sep 17 00:00:00 2001 From: wenjy Date: Sun, 29 May 2022 13:35:22 +0800 Subject: [PATCH] =?UTF-8?q?change=20-=20=E4=BC=A0=E6=84=9F=E5=99=A8?= =?UTF-8?q?=E7=9B=91=E6=8E=A7=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/controller/timedTask/SensorStateConroller.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/timedTask/SensorStateConroller.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/timedTask/SensorStateConroller.java index 5ceb500..9a89418 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/timedTask/SensorStateConroller.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/timedTask/SensorStateConroller.java @@ -19,6 +19,7 @@ import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.List; +import java.util.concurrent.TimeUnit; /** * 传感器状态统计 @@ -52,7 +53,10 @@ public class SensorStateConroller extends BaseController { Date collectTime = dateFormat.parse(param); Date nowTime = new Date(); long diff = nowTime.getTime() - collectTime.getTime(); - long diffMinutes = diff / (60 * 1000) % 60; + + long diffMinutes = TimeUnit.MILLISECONDS.toMinutes(diff); + + //long diffMinutes = diff / (60 * 1000) % 60; long sensorState = 0L;