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