diff --git a/20240922/weather/pom.xml b/20240922/weather/pom.xml
index 3b7c3c4..20065c6 100644
--- a/20240922/weather/pom.xml
+++ b/20240922/weather/pom.xml
@@ -5,7 +5,7 @@
org.springframework.boot
spring-boot-starter-parent
- 2.4.5
+ 2.5.3
com.rehome
@@ -109,7 +109,19 @@
11.2.0.jre8
-
+
+
+
+ repository
+ http://47.242.184.139:8081/repository/maven-public/
+
+ true
+
+
+ true
+
+
+
diff --git a/20240922/weather/src/main/java/com/rehome/weather/service/ScheduledService.java b/20240922/weather/src/main/java/com/rehome/weather/service/ScheduledService.java
index 43bed60..c63f873 100644
--- a/20240922/weather/src/main/java/com/rehome/weather/service/ScheduledService.java
+++ b/20240922/weather/src/main/java/com/rehome/weather/service/ScheduledService.java
@@ -36,9 +36,9 @@ public class ScheduledService {
* @description: 定时任务,每30分钟执行一次,从聚合数据平台查询天气数据并入库
* @Param: null
*/
- //@Scheduled(cron = "0 0 */1 * * *")//每个小时执行一次
+ @Scheduled(cron = "0 0 */1 * * *")//每个小时执行一次
//@Scheduled(cron = "0/10 * * * * *")//每10秒执行一次
- @Scheduled(cron = "0 */30 * * * *") //每30分钟执行一次
+ //@Scheduled(cron = "0 */30 * * * *") //每30分钟执行一次
public void scheduled(){
log.info("scheduled");
log.info("=====>>>>>使用cron:"+String.valueOf(System.currentTimeMillis()));
diff --git a/20240922/weather/src/main/java/com/rehome/weather/service/impl/StormServiceImpl.java b/20240922/weather/src/main/java/com/rehome/weather/service/impl/StormServiceImpl.java
index 2217838..0b26998 100644
--- a/20240922/weather/src/main/java/com/rehome/weather/service/impl/StormServiceImpl.java
+++ b/20240922/weather/src/main/java/com/rehome/weather/service/impl/StormServiceImpl.java
@@ -74,7 +74,6 @@ public class StormServiceImpl implements StormService {
* Created DateTime 2021-05-08 17:29
*/
@Override
- @CacheEvict(cacheNames = "com.rehome.weather.service.impl.StormServiceImpl",allEntries = true)
public Map getStormListByScheduled(String year) {
String url=stormListUrl+"?key="+heFengStormKey+"&basin=NP&year="+year;
@@ -207,7 +206,6 @@ public class StormServiceImpl implements StormService {
* Created DateTime 2021-05-10 14:18
*/
@Override
- @Cacheable(cacheNames="com.rehome.weather.service.impl.StormServiceImpl",key="#year+'-getLocalStormList'")
public Map getLocalStormList(String year) {
Map map = new HashMap();
Optional> storm=stormDataRepository.findByYear(year);
@@ -227,7 +225,6 @@ public class StormServiceImpl implements StormService {
* Created DateTime 2021-05-10 14:17
*/
@Override
- @Cacheable(cacheNames="com.rehome.weather.service.impl.StormServiceImpl",key="#stormid+'-getLocalStormForecastByStormId'")
public String getLocalStormForecastByStormId(String stormid) {
Optional stormForecast = stormForecastRepository.findByIdOne(stormid);
if(stormForecast.isPresent()){
@@ -246,7 +243,6 @@ public class StormServiceImpl implements StormService {
* Created DateTime 2021-05-10 14:18
*/
@Override
- @Cacheable(cacheNames="com.rehome.weather.service.impl.StormServiceImpl",key="#stormid+'-getLocalStormTrackByStormId'")
public String getLocalStormTrackByStormId(String stormid) {
Optional stormTrack = stormTrackJpaRepository.findByIdOne(stormid);
if (stormTrack.isPresent()){
diff --git a/20240922/weather/src/main/java/com/rehome/weather/service/impl/WeatherServiceImpl.java b/20240922/weather/src/main/java/com/rehome/weather/service/impl/WeatherServiceImpl.java
index 2487d3c..a150af6 100644
--- a/20240922/weather/src/main/java/com/rehome/weather/service/impl/WeatherServiceImpl.java
+++ b/20240922/weather/src/main/java/com/rehome/weather/service/impl/WeatherServiceImpl.java
@@ -129,7 +129,6 @@ public class WeatherServiceImpl implements WeatherService {
* @Param: cityInput 要查询天气的城市
*/
@Override
- @CacheEvict(cacheNames="com.rehome.weather.service.impl.WeatherServiceImpl",key="#cityInput+'-getLocalWeatherByCity'")
public Map getJuheWeatherByScheduled(String cityInput) {
String url=weatherQueryUrl+"?key="+weatherKey+"&city="+city;
String weatherJson = WeatherUtil.analysisUrl(url);
@@ -175,6 +174,8 @@ public class WeatherServiceImpl implements WeatherService {
weatherFutureRepository.save(weatherFuture);
}else{
weatherFuture.setUpdatetime(new Date());
+ weatherFuture.setCreatetime(weatherFutureDB.get().getCreatetime());
+ weatherFuture.setId(weatherFutureDB.get().getId());
weatherFutureRepository.save(weatherFuture);
}
}
@@ -195,7 +196,6 @@ public class WeatherServiceImpl implements WeatherService {
* @Param: city 要查询天气的城市
*/
@Override
- @Cacheable(cacheNames="com.rehome.weather.service.impl.WeatherServiceImpl",key="#city+'-getLocalWeatherByCity'")
public Map getLocalWeatherByCity(String cityParam) {
Map map = new HashMap();
if(city.equals(cityParam)){
diff --git a/20240922/weather/src/main/resources/application.yml b/20240922/weather/src/main/resources/application.yml
index 8f6d260..7e84fa3 100644
--- a/20240922/weather/src/main/resources/application.yml
+++ b/20240922/weather/src/main/resources/application.yml
@@ -25,9 +25,9 @@ spring:
# 文件写入磁盘的阈值
file-size-threshold: 2KB
# 最大文件大小
- max-file-size: 200MB
+ max-file-size: 20MB
# 最大请求大小
- max-request-size: 215MB
+ max-request-size: 20MB
rehome:
resourcesPath: /Users/wenfeihuang/storage # 外部资源文件存储路径 格式:/Users/edao/storage
weather: