From e9242aaa11e6e2168a72c68516263b2e3a8d764d Mon Sep 17 00:00:00 2001 From: wen <1455474577@qq.com> Date: Tue, 21 Dec 2021 15:56:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86=E7=94=9F=E6=88=90=E4=BA=8C=E7=BB=B4?= =?UTF-8?q?=E7=A0=81=E5=9B=BE=E7=89=87=E8=B5=84=E6=BA=90=E7=9A=84=E5=9C=B0?= =?UTF-8?q?=E5=9D=80=EF=BC=8C=E6=94=B9=E6=88=90=E4=BA=86=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=EF=BC=8C=E4=BF=AE=E5=A4=8D=E4=BA=86=E4=BA=8C?= =?UTF-8?q?=E7=BB=B4=E7=A0=81=E5=88=A0=E9=99=A4=E5=AE=9A=E6=97=B6=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=EF=BC=8C=E5=8F=91=E5=B8=83=E5=88=B0=E6=AD=A3=E5=BC=8F?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E6=97=B6=EF=BC=8C=E8=AE=B0=E5=BE=97=E6=94=B9?= =?UTF-8?q?bootStrap.yml=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xhpc/XhpcChargingStationApplication.java | 2 ++ .../station/utils/img/DownMaterialUtil.java | 17 +++++------------ .../src/main/resources/bootstrap.yml | 19 ++++++++++++------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/XhpcChargingStationApplication.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/XhpcChargingStationApplication.java index a3551b23..7dbc436e 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/XhpcChargingStationApplication.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/XhpcChargingStationApplication.java @@ -6,12 +6,14 @@ import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.openfeign.EnableFeignClients; +import org.springframework.scheduling.annotation.EnableScheduling; @EnableCustomConfig @EnableCustomSwagger2 @EnableFeignClients @SpringBootApplication @MapperScan("com.xhpc.charging.station.mapper") +@EnableScheduling public class XhpcChargingStationApplication { public static void main(String[] args) { diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/utils/img/DownMaterialUtil.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/utils/img/DownMaterialUtil.java index ef4f00c7..4bb0a2b2 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/utils/img/DownMaterialUtil.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/utils/img/DownMaterialUtil.java @@ -1,11 +1,11 @@ package com.xhpc.charging.station.utils.img; import cn.hutool.core.date.DateUtil; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; +import javax.annotation.Resource; import java.io.*; import java.net.HttpURLConnection; import java.net.URL; @@ -23,13 +23,13 @@ import java.util.zip.ZipOutputStream; @Component public class DownMaterialUtil { - @Autowired - Environment environment; + @Resource + private Environment environment; public static InputStream getInputStream(String urlImg) { InputStream inputStream = null; - HttpURLConnection httpURLConnection = null; + HttpURLConnection httpURLConnection; try { @@ -178,11 +178,10 @@ public class DownMaterialUtil { * @since version-1.0 */ @Scheduled(cron = "0 0 4 * * ?") - public static void deleteZips() { + public void deleteZips() { System.out.println(DateUtil.now() + " " + "二维码压缩包清理程序启动"); //遍历指定文件夹下的所有图片 dist - Environment environment = new DownMaterialUtil().environment; String zipLocation = environment.getProperty("zipLocation"); if (zipLocation == null) { throw new RuntimeException("bootstrap.yml文件中的zipLocation位置不对,请检查"); @@ -201,10 +200,4 @@ public class DownMaterialUtil { } System.out.println(DateUtil.now() + " " + "二维码压缩包清理程序结束"); } - - public static void main(String[] args) { - - deleteZips(); - } - } diff --git a/xhpc-modules/xhpc-charging-station/src/main/resources/bootstrap.yml b/xhpc-modules/xhpc-charging-station/src/main/resources/bootstrap.yml index df078115..079b2239 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/resources/bootstrap.yml +++ b/xhpc-modules/xhpc-charging-station/src/main/resources/bootstrap.yml @@ -14,10 +14,10 @@ spring: nacos: discovery: # 服务注册地址 - server-addr: 172.31.183.135:8848 + server-addr: 127.0.0.1:8848 config: # 配置中心地址 - server-addr: 172.31.183.135:8848 + server-addr: 127.0.0.1:8848 # 配置文件格式 file-extension: yml # 共享配置 @@ -27,16 +27,21 @@ spring: #二维码Logo图片获取位置: #imgPath: "D:\\Enterprise_Resources\\XiaoHuaMaterialImgs\\xhcd_logo.png" -imgPath: "/www/wwwroot/scxhua.cn/xhpc-charging-stion/logo.png" +#imgPath: "/www/wwwroot/scxhua.cn/xhpc-charging-stion/logo.png" +imgPath: "/www/wwwroot/xhpc.scxhua.com/xhpc-charging-stion/logo.png" #生成的二维码存放位置: #destPath: "D:\\Enterprise_Resources\\XiaoHuaFullImgs" -destPath: "/www/wwwroot/scxhua.cn/xhpc-charging-stion/XiaoHuaFullImgs" +#destPath: "/www/wwwroot/scxhua.cn/xhpc-charging-stion/XiaoHuaFullImgs" +destPath: "/www/wwwroot/xhpc.scxhua.com/xhpc-charging-stion/XiaoHuaFullImgs" #生成的最终完整图片的存放位置: #fullImgDestPath: "D:\\Enterprise_Resources\\XiaoHuaFullImgs\\" -fullImgDestPath: "/www/wwwroot/scxhua.cn/xhpc-charging-stion/XiaoHuaFullImgs/" +#fullImgDestPath: "/www/wwwroot/scxhua.cn/xhpc-charging-stion/XiaoHuaFullImgs/" +fullImgDestPath: "/www/wwwroot/xhpc.scxhua.com/xhpc-charging-stion/XiaoHuaFullImgs/" #底图图片存放位置: #bottomImg: "D:\\Enterprise_Resources\\XiaoHuaMaterialImgs\\BottomImg.png" -bottomImg: "/www/wwwroot/scxhua.cn/xhpc-charging-stion/BottomImg.png" +#bottomImg: "/www/wwwroot/scxhua.cn/xhpc-charging-stion/BottomImg.png" +bottomImg: "/www/wwwroot/xhpc.scxhua.com/xhpc-charging-stion/BottomImg.png" #生成的二维码zip包位置 #zipLocation: "D:\\Enterprise_Resources\\QrZip" -zipLocation: "/www/wwwroot/scxhua.cn/dist" +#zipLocation: "/www/wwwroot/scxhua.cn/dist" +zipLocation: "/www/wwwroot/xhpc.scxhua.com/dist" \ No newline at end of file