Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
6c7b03bfa0
@ -45,30 +45,35 @@ public class QrImgUtils {
|
||||
chargingStationName,
|
||||
name,
|
||||
String.valueOf(letterMap.get(forIndex)),
|
||||
new File(environment.getProperty("fullImgDestPath")+finallyImgFileName)
|
||||
);
|
||||
new File(environment.getProperty("fullImgDestPath") + finallyImgFileName)
|
||||
);
|
||||
|
||||
System.out.println("===================》完整二维码图片生成成功");
|
||||
|
||||
//4.上传图片至服务器
|
||||
// 创建OSSClient实例
|
||||
OSSClient ossClient = new OSSClient(environment.getProperty("oss.endpoint"), environment.getProperty("oss.access-key"), environment.getProperty("oss.secret-key"));
|
||||
// 上传文件流
|
||||
ossClient.putObject(environment.getProperty("oss.bucket-name"), xhpcTerminal.getPileSerialNumber() + "/" + finallyImgFileName, new File(environment.getProperty("destPath") + "/" + finallyImgFileName));
|
||||
ossClient.putObject(environment.getProperty("oss.bucket-name"), xhpcTerminal.getPileSerialNumber() + "/" + finallyImgFileName, new File(environment.getProperty("destPath") + File.separatorChar + finallyImgFileName));
|
||||
ossClient.shutdown();
|
||||
|
||||
System.out.println("===================》将完整二维码上传至阿里云成功");
|
||||
|
||||
//5.将放在阿里云上的生成的图片的路径和图片所对应的终端的id放入数据库xhpc_img表中
|
||||
Long terminalId = xhpcTerminal.getTerminalId();
|
||||
xhpcImgMapper.insert(xhpcTerminal.getPileSerialNumber() + "/" + finallyImgFileName, terminalId);
|
||||
|
||||
System.out.println("===================》将阿里云上的图片地址放入数据库");
|
||||
//6.删除生成的二维码图片
|
||||
File QrImg = new File(environment.getProperty("destPath") + "\\" + qrFileName);
|
||||
File QrImg = new File(environment.getProperty("destPath") + File.separatorChar + qrFileName);
|
||||
QrImg.delete();
|
||||
//7.删除生成本地生成的完整图片
|
||||
//7.删除本地生成的完整图片
|
||||
File finallyImg = new File(environment.getProperty("fullImgDestPath") + finallyImgFileName);
|
||||
finallyImg.delete();
|
||||
|
||||
System.out.println("==================》已删除本地生成的完成二维码图片");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.out.println(e.getMessage());
|
||||
System.out.println("二维码生成图片失败,请检查生成二维码所需要的资源路径是否正确");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -26,10 +26,14 @@ spring:
|
||||
|
||||
|
||||
#二维码Logo图片获取位置:
|
||||
#imgPath: "D:\\Enterprise_Resources\\XiaoHuaMaterialImgs\\xhcd_logo.png"
|
||||
imgPath: "/www/wwwroot/xhpc.scxhua.com/xhpc-charging-stion/logo.png"
|
||||
#生成的二维码存放位置:
|
||||
#destPath: "D:\\Enterprise_Resources\\XiaoHuaFullImgs"
|
||||
destPath: "/www/wwwroot/xhpc.scxhua.com/xhpc-charging-stion/XiaoHuaFullImgs"
|
||||
#生成的最终完整图片的存放位置:
|
||||
#fullImgDestPath: "D:\\Enterprise_Resources\\XiaoHuaFullImgs\\"
|
||||
fullImgDestPath: "/www/wwwroot/xhpc.scxhua.com/xhpc-charging-stion/XiaoHuaFullImgs/"
|
||||
#底图图片存放位置:
|
||||
#bottomImg: "D:\\Enterprise_Resources\\XiaoHuaMaterialImgs\\BottomImg.png"
|
||||
bottomImg: "/www/wwwroot/xhpc.scxhua.com/xhpc-charging-stion/BottomImg.png"
|
||||
Loading…
x
Reference in New Issue
Block a user