ソースを参照

天气台账BUG修复

qianxb 2 年 前
コミット
c420a03129

+ 5 - 2
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/WeatherInfoServiceImpl.java

@@ -117,7 +117,6 @@ public class WeatherInfoServiceImpl extends ServiceImpl<WeatherInfoMapper, Weath
                     log.info("今日的天气已经同步完成!contractAreaId:" + area.getId() + ",syncTime:" + DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
                     continue;
                 }
-
                 //获取天气信息(百度天气)
                 Map<String,String> weatherMap = BaiduApiUtil.getTodayWeather(area.getCity_code());
                 if(weatherMap != null){
@@ -177,7 +176,11 @@ public class WeatherInfoServiceImpl extends ServiceImpl<WeatherInfoMapper, Weath
                         .orderByAsc(WeatherInfo::getRecordTime)
                         .last("limit 1"));
                 if (weatherInfo == null){
-                    continue;
+                    weatherInfo = new WeatherInfo();
+                    GregorianCalendar calendar = new GregorianCalendar();
+                    calendar.setTime(new Date());
+                    calendar.add(Calendar.DATE,1);
+                    weatherInfo.setRecordTime(calendar.getTime());
                 }
                 Date recordTime = weatherInfo.getRecordTime();
                 if (new Date().compareTo(recordTime) == -1){