Browse Source

预警时间修改

gao.qiang 9 months ago
parent
commit
2c1402fbb0

+ 6 - 1
vehicle-sdk/src/main/java/com/ozs/controller/upload/GeoHazardMonitorTokenController.java

@@ -95,6 +95,7 @@ import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Calendar;
 import java.util.Comparator;
 import java.util.Date;
 import java.util.HashMap;
@@ -1799,7 +1800,11 @@ public class GeoHazardMonitorTokenController {
             PreAlarm preAlarm = new PreAlarm();
             preAlarm.setTrainId(preAlarmResponse.getTrainId());
             preAlarm.setPreAlarmNum(preAlarmResponse.getPreAlarmNum());
-            preAlarm.setPreAlarmTime(new Date(preAlarmResponse.getPreAlarmTime()));
+            Calendar cal = Calendar.getInstance();
+            cal.setTime(new Date(preAlarmResponse.getPreAlarmTime()));
+            cal.set(Calendar.MILLISECOND, 0);
+            cal.set(Calendar.MILLISECOND, 0);
+            preAlarm.setPreAlarmTime(cal.getTime());
             preAlarm.setPreAlarmType(preAlarmResponse.getPreAlarmType());
             preAlarm.setPreAlarmList(JSON.toJSONString(preAlarmResponse.getPreAlarmList()));
             preAlarm.setCreatedTime(new Date());