将生成二维码图片资源的地址,改成了测试环境,修复了二维码删除定时任务,发布到正式环境时,记得改bootStrap.yml文件

This commit is contained in:
wen 2021-12-21 15:56:05 +08:00
parent 441faa10a5
commit e9242aaa11
3 changed files with 19 additions and 19 deletions

View File

@ -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) {

View File

@ -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();
}
}

View File

@ -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"