更改二维码生成需求

This commit is contained in:
wen 2021-09-30 17:15:52 +08:00
parent d6f21c6d5a
commit 24f29c9a58
2 changed files with 6 additions and 4 deletions

View File

@ -123,9 +123,10 @@ public class XhpcChargingPileServiceImpl implements IXhpcChargingPileService {
xhpcTerminalMapper.addXhpcTerminal(xhpcTerminal);
//获取场站名称
String chargingStationName = xhpcChargingStationMapper.selectXhpcChargingStationById(xhpcTerminal.getChargingStationId()).getName();
//生成最终的完整图片并上传
QrImgUtils.uploadImg(xhpcTerminal, xhpcTerminal.getSerialNumber(),environment,xhpcImgMapper,chargingStationName,i,letterMap);
QrImgUtils.uploadImg(xhpcTerminal, xhpcTerminal.getSerialNumber(),environment,xhpcImgMapper,chargingStationName,i,letterMap,name);
}

View File

@ -3,6 +3,7 @@ package com.xhpc.charging.station.utils.img;
import cn.hutool.core.date.DateUtil;
import com.aliyun.oss.OSSClient;
import com.xhpc.charging.station.mapper.XhpcImgMapper;
import com.xhpc.common.domain.XhpcChargingPile;
import com.xhpc.common.domain.XhpcTerminal;
import org.springframework.core.env.Environment;
@ -20,11 +21,11 @@ public class QrImgUtils {
* @Return void
* @Since version-1.0
*/
public static void uploadImg(XhpcTerminal xhpcTerminal, String serialNumber, Environment environment, XhpcImgMapper xhpcImgMapper, String chargingStationName, int forIndex, Map<Integer,Character> letterMap) {
public static void uploadImg(XhpcTerminal xhpcTerminal, String serialNumber, Environment environment, XhpcImgMapper xhpcImgMapper, String chargingStationName, int forIndex, Map<Integer,Character> letterMap, String name) {
//生成桩的二维码图片
//1.生成二维码链接内容
StringBuilder prefix = new StringBuilder("https://xhpc.scxhua.com?pNum=");
StringBuilder prefix = new StringBuilder("https://xhpc.scxhua.cn?pNum=");
String QrContent = prefix.append(xhpcTerminal.getSerialNumber()).toString();
try {
@ -43,7 +44,7 @@ public class QrImgUtils {
QrCode,
serialNumber,
chargingStationName,
String.valueOf(xhpcTerminal.getNumber()),
name,
String.valueOf(letterMap.get(forIndex)),
new File(environment.getProperty("oss.fullImgDestPath")+finallyImgFileName)
);