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;