Просмотр исходного кода

新增 获取天气信息公共工具

zhaiyifei 11 месяцев назад
Родитель
Сommit
da225759ec

+ 3 - 3
src/main/java/com/yunfeiyun/agmp/iots/device/serviceImp/IotBzyPestRecogService.java

@@ -8,7 +8,7 @@ import com.yunfeiyun.agmp.common.framework.manager.RedisCacheManager;
 import com.yunfeiyun.agmp.common.utils.DateUtils;
 import com.yunfeiyun.agmp.common.utils.StringUtils;
 import com.yunfeiyun.agmp.iot.common.domain.*;
-import com.yunfeiyun.agmp.iot.common.service.IotWeatherService;
+import com.yunfeiyun.agmp.common.service.WeatherService;
 import com.yunfeiyun.agmp.iot.common.service.MongoService;
 import com.yunfeiyun.agmp.iots.device.service.IIotSporeService;
 import lombok.Data;
@@ -33,7 +33,7 @@ public class IotBzyPestRecogService {
     private MongoService mongoService;
 
     @Autowired
-    private IotWeatherService iotWeatherService;
+    private WeatherService weatherService;
 
     @Autowired
     private RedisCacheManager redisCacheManager;
@@ -80,7 +80,7 @@ public class IotBzyPestRecogService {
         }
         // 25 和30 代表损坏
         if (StringUtils.isEmpty(atStr) || (Objects.equals(atStr, "25") && Objects.equals(ahStr, "30"))) {
-            JSONObject weatherInfo = iotWeatherService.getWeatherByAddress(
+            JSONObject weatherInfo = weatherService.getWeatherByAddress(
                     iotDevice.getDevProvince(), iotDevice.getDevCity(), iotDevice.getDevDistrict());
             if (weatherInfo != null) {
                 atStr = weatherInfo.getString("tem");

+ 3 - 3
src/main/java/com/yunfeiyun/agmp/iots/device/serviceImp/IotPestRecogService.java

@@ -8,7 +8,7 @@ import com.yunfeiyun.agmp.common.framework.manager.RedisCacheManager;
 import com.yunfeiyun.agmp.common.utils.StringUtils;
 import com.yunfeiyun.agmp.iot.common.domain.*;
 import com.yunfeiyun.agmp.iot.common.enums.EnumCbdMarkType;
-import com.yunfeiyun.agmp.iot.common.service.IotWeatherService;
+import com.yunfeiyun.agmp.common.service.WeatherService;
 import com.yunfeiyun.agmp.iot.common.service.MongoService;
 import com.yunfeiyun.agmp.iots.service.IIotPestService;
 import lombok.Data;
@@ -32,7 +32,7 @@ public class IotPestRecogService {
     private MongoService mongoService;
 
     @Autowired
-    private IotWeatherService iotWeatherService;
+    private WeatherService weatherService;
 
     @Autowired
     private RedisCacheManager redisCacheManager;
@@ -82,7 +82,7 @@ public class IotPestRecogService {
 
         }
         if (StringUtils.isEmpty(atStr) || (Objects.equals(atStr, "25") && Objects.equals(ahStr, "30"))) {
-            JSONObject weatherInfo = iotWeatherService.getWeatherByAddress(
+            JSONObject weatherInfo = weatherService.getWeatherByAddress(
                     iotDevice.getDevProvince(), iotDevice.getDevCity(), iotDevice.getDevDistrict());
             if (weatherInfo != null) {
                 atStr = weatherInfo.getString("tem");