Browse Source

优化定时同步设备告警数据方法中获取时间值的判空

james 1 month ago
parent
commit
2ee36619a3

+ 1 - 2
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/impl/BaseAlarmServiceImpl.java

@@ -655,9 +655,8 @@ public class BaseAlarmServiceImpl extends AbstractCrudService<BaseAlarmMapper, B
 
             if(CollectionUtils.isNotEmpty(devInfoList)){
                 for(int i=0;i<list.size();i++){
-                    String date =  list.get(i).getTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
                     String currentDate = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
-                    if(date.equals(currentDate)){
+                    if(Objects.nonNull(list.get(i).getTime()) && currentDate.equals(list.get(i).getTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))){
                         //设备离线告警恢复在线自动默认处理
                         if(CollectionUtils.isNotEmpty(baseUnAlarmList)){
                             for(int j=0;j<baseUnAlarmList.size();j++){