523096025 hai 1 ano
pai
achega
e6d7fe4de8

+ 8 - 5
huimv-admin/src/main/java/com/huimv/admin/timer/EnvTimer.java

@@ -15,10 +15,7 @@ import com.huimv.admin.common.utils.NumberUtils;
 import com.huimv.admin.entity.*;
 import com.huimv.admin.entity.dto.WeatherDto;
 import com.huimv.admin.entity.dto.WeatherLives;
-import com.huimv.admin.entity.zengxindto.LoginOnlyDto;
-import com.huimv.admin.entity.zengxindto.LonginOnlyDtoToken;
-import com.huimv.admin.entity.zengxindto.ShackDatasDto;
-import com.huimv.admin.entity.zengxindto.ShackDatasSensor;
+import com.huimv.admin.entity.zengxindto.*;
 import com.huimv.admin.service.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Configuration;
@@ -68,6 +65,7 @@ public class EnvTimer {
     String baseurl = "https://yzwlw.loongk.com/";
 
     @Scheduled(cron = "0 0/11 * * * ? ")
+//    @Scheduled(cron = "0 * * * * ? ")
     @Transactional
     public void getHuanKong() throws Exception {
         //目前是这家
@@ -94,9 +92,14 @@ public class EnvTimer {
 
                 if (StringUtils.isBlank(shishiBody)) {
                     System.out.println(new Date() + "实时数据" + shishiBody);
-                    return;
+                    continue;
                 }
                 ShackDatasDto shackDatasDto = JSONUtil.toBean(shishiBody, ShackDatasDto.class);
+
+                ShackDatasDataDto data = shackDatasDto.getData();
+                if (ObjectUtil.isEmpty(data)){
+                    continue;
+                }
                 String onLine = shackDatasDto.getData().getOnLine();
                 if ("N".equals(onLine)) {
                     envDevice.setDeviceStatus(0);