优化二维码下载,在表格中添加了二维码内容

This commit is contained in:
wen 2021-11-30 16:46:50 +08:00
parent 37653fefd2
commit 5d6bf27d5a
3 changed files with 20 additions and 15 deletions

View File

@ -70,7 +70,7 @@ public class XhpcDownCodeServiceImpl implements IXhpcDownCodeService {
//3创建头部第一行 //3创建头部第一行
HSSFRow headRow = sheet.createRow(0); HSSFRow headRow = sheet.createRow(0);
HSSFCell cell; HSSFCell cell;
String[] header = new String[] {"终端名称","归属电站","终端编码","电桩编码","终端类型(1直流 2交流慢)","电桩功率(KM)"}; String[] header = new String[]{"终端名称", "归属电站", "终端编码", "电桩编码", "终端类型(1直流 2交流慢)", "电桩功率(KM)", "二维码内容"};
for (int i = 0; i < header.length; i++) { for (int i = 0; i < header.length; i++) {
cell = headRow.createCell(i); cell = headRow.createCell(i);
cell.setCellValue(header[i]); cell.setCellValue(header[i]);
@ -78,7 +78,7 @@ public class XhpcDownCodeServiceImpl implements IXhpcDownCodeService {
//4填写数据 //4填写数据
HSSFRow dataRow; HSSFRow dataRow;
HSSFCell dataCell; HSSFCell dataCell;
String[] values = {"tName", "sName", "tSN", "psn", "type", "power"}; String[] values = {"tName", "sName", "tSN", "psn", "type", "power", "qrContent"};
int valuesLength = values.length; int valuesLength = values.length;
for(int i = 1; i <= list.size(); i ++){ for(int i = 1; i <= list.size(); i ++){
Map<String,Object> map = list.get(i - 1); Map<String,Object> map = list.get(i - 1);
@ -145,7 +145,7 @@ public class XhpcDownCodeServiceImpl implements IXhpcDownCodeService {
//3创建头部第一行 //3创建头部第一行
HSSFRow headRow = sheet.createRow(0); HSSFRow headRow = sheet.createRow(0);
HSSFCell cell; HSSFCell cell;
String[] header = new String[]{"终端名称", "归属电站", "终端编码", "电桩编码", "终端类型(1直流 2交流慢)", "电桩功率(KM)"}; String[] header = new String[]{"终端名称", "归属电站", "终端编码", "电桩编码", "终端类型(1直流 2交流慢)", "电桩功率(KM)", "二维码内容"};
for (int i = 0; i < header.length; i++) { for (int i = 0; i < header.length; i++) {
cell = headRow.createCell(i); cell = headRow.createCell(i);
cell.setCellValue(header[i]); cell.setCellValue(header[i]);
@ -153,7 +153,7 @@ public class XhpcDownCodeServiceImpl implements IXhpcDownCodeService {
//4填写数据 //4填写数据
HSSFRow dataRow; HSSFRow dataRow;
HSSFCell dataCell; HSSFCell dataCell;
String[] values = {"tName", "sName", "tSN", "psn", "type", "power"}; String[] values = {"tName", "sName", "tSN", "psn", "type", "power", "qrContent"};
int valuesLength = values.length; int valuesLength = values.length;
for (int i = 1; i <= list.size(); i++) { for (int i = 1; i <= list.size(); i++) {
Map<String, Object> map = list.get(i - 1); Map<String, Object> map = list.get(i - 1);

View File

@ -27,16 +27,16 @@ spring:
#二维码Logo图片获取位置 #二维码Logo图片获取位置
#imgPath: "D:\\Enterprise_Resources\\XiaoHuaMaterialImgs\\xhcd_logo.png" #imgPath: "D:\\Enterprise_Resources\\XiaoHuaMaterialImgs\\xhcd_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: "D:\\Enterprise_Resources\\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: "D:\\Enterprise_Resources\\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: "D:\\Enterprise_Resources\\XiaoHuaMaterialImgs\\BottomImg.png"
bottomImg: "/www/wwwroot/scxhua.cn/xhpc-charging-stion/BottomImg.png" bottomImg: "/www/wwwroot/xhpc.scxhua.com/xhpc-charging-stion/BottomImg.png"
#生成的二维码zip包位置 #生成的二维码zip包位置
#zipLocation: "D:\\Enterprise_Resources\\QrZip" #zipLocation: "D:\\Enterprise_Resources\\QrZip"
zipLocation: "/www/wwwroot/scxhua.cn/dist" zipLocation: "/www/wwwroot/xhpc.scxhua.com/dist"

View File

@ -29,12 +29,13 @@
<select id="selectExcelDataByPileId" resultType="map"> <select id="selectExcelDataByPileId" resultType="map">
SELECT t.NAME AS tName, SELECT t.NAME AS tName,
s.NAME AS sName, s.NAME AS sName,
t.serial_number AS tSN, t.serial_number AS tSN,
p.serial_number AS psn, p.serial_number AS psn,
p.type, p.type,
p.power p.power,
concat('https://www.scxhua.cn?pNum=', t.serial_number) AS qrContent
FROM xhpc_terminal AS t FROM xhpc_terminal AS t
LEFT JOIN xhpc_charging_station AS s ON t.charging_station_id = s.charging_station_id LEFT JOIN xhpc_charging_station AS s ON t.charging_station_id = s.charging_station_id
LEFT JOIN xhpc_charging_pile AS p ON p.charging_pile_id = t.charging_pile_id LEFT JOIN xhpc_charging_pile AS p ON p.charging_pile_id = t.charging_pile_id
@ -51,7 +52,11 @@
terminal.serial_number AS tSN, terminal.serial_number AS tSN,
pile.serial_number AS psn, pile.serial_number AS psn,
pile.type, pile.type,
pile.power pile.power,
concat(
'https://www.scxhua.cn?pNum=',
terminal.serial_number
) AS qrContent
FROM xhpc_img AS img FROM xhpc_img AS img
INNER JOIN xhpc_terminal AS terminal ON img.terminal_id = terminal.terminal_id INNER JOIN xhpc_terminal AS terminal ON img.terminal_id = terminal.terminal_id
INNER JOIN xhpc_charging_pile AS pile ON pile.charging_pile_id = terminal.charging_pile_id INNER JOIN xhpc_charging_pile AS pile ON pile.charging_pile_id = terminal.charging_pile_id