From 56afd228bbc5cd78d8e8e1804a187a2da918a5aa Mon Sep 17 00:00:00 2001 From: panbaolin Date: Fri, 7 Aug 2026 11:52:11 +0800 Subject: [PATCH] =?UTF-8?q?fix:1.=E5=86=8D=E6=AC=A1=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=A4=A9=E6=B0=94=E9=A2=84=E6=8A=A5=E6=92=AD=E6=94=BE=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=EF=BC=8C=E6=8A=8A=E7=BC=93=E5=AD=98=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=AD=98=E5=85=A5=E7=A3=81=E7=9B=98=EF=BC=8C=E9=80=9A=E8=BF=87?= =?UTF-8?q?=E7=9B=B4=E6=8E=A5=E7=9B=B4=E6=8E=A5=E6=9F=A5=E6=89=BE=EF=BC=8C?= =?UTF-8?q?=E6=80=A7=E8=83=BD=E4=B8=8D=E5=88=B070=E6=AF=AB=E7=A7=92?= =?UTF-8?q?=E5=8D=B3=E8=BF=94=E5=9B=9E2.=E6=B7=BB=E5=8A=A0=E5=AE=9A?= =?UTF-8?q?=E6=97=B6=E6=B8=85=E9=99=A4=E7=BC=93=E5=AD=98=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/jeecg/job/CleanWeatherCacheData.java | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 jeecg-module-weather/src/main/java/org/jeecg/job/CleanWeatherCacheData.java diff --git a/jeecg-module-weather/src/main/java/org/jeecg/job/CleanWeatherCacheData.java b/jeecg-module-weather/src/main/java/org/jeecg/job/CleanWeatherCacheData.java new file mode 100644 index 0000000..689f060 --- /dev/null +++ b/jeecg-module-weather/src/main/java/org/jeecg/job/CleanWeatherCacheData.java @@ -0,0 +1,36 @@ +package org.jeecg.job; + +import lombok.RequiredArgsConstructor; +import org.apache.commons.io.FileUtils; +import org.jeecg.common.properties.SystemStorageProperties; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; + +/** + * 每周六凌晨2点清除天气预报缓存数据 + */ +@Component +@RequiredArgsConstructor +public class CleanWeatherCacheData { + + private final SystemStorageProperties systemStorageProperties; + + @Scheduled(cron = "0 0 2 ? * SAT") + public void cleanCacheData(){ + + Path path = Paths.get(systemStorageProperties.getGribDataVariableCachePath()); + if(Files.exists(path)){ + try{ + FileUtils.cleanDirectory(path.toFile()); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + } +}