|
|
|
@ -6,6 +6,7 @@ import com.google.zxing.MultiFormatWriter;
|
|
|
|
|
import com.google.zxing.WriterException; |
|
|
|
|
import com.google.zxing.common.BitMatrix; |
|
|
|
|
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.slf4j.Logger; |
|
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
|
import org.springblade.common.constant.CommonConstant; |
|
|
|
@ -29,6 +30,7 @@ import java.util.UUID;
|
|
|
|
|
* @Author:debug (SteadyJack) |
|
|
|
|
* @Link: weixin-> debug0868 qq-> 1948831260 |
|
|
|
|
* @Date: 2020/11/16 22:38 |
|
|
|
|
* |
|
|
|
|
**/ |
|
|
|
|
public class QRCodeUtil { |
|
|
|
|
private static final Logger log= LoggerFactory.getLogger(QRCodeUtil.class); |
|
|
|
@ -54,6 +56,7 @@ public class QRCodeUtil {
|
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
public static String getEmpAutograph(String filePath) { |
|
|
|
|
log.info("文件转换base64... {}",filePath); |
|
|
|
|
String img = null; |
|
|
|
|
if (StringUtils.isEmpty(filePath)) { |
|
|
|
|
InputStream in = null; |
|
|
|
@ -80,12 +83,13 @@ public class QRCodeUtil {
|
|
|
|
|
public static String createCodeToFile(String content) { |
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
log.info(">>>>>>>>>>>>>>>>>>>createCodeToFile",content); |
|
|
|
|
String imgPath = CommonUtil.SYSTEMFILEPATH+"qrCodeImg/"; |
|
|
|
|
File codeImgFileSaveDir = new File(imgPath); |
|
|
|
|
//1. 使用UUID重新生成文件名,防止文件名称重复造成文件覆盖
|
|
|
|
|
String fileName = UUID.randomUUID() + "." +FileFormat; |
|
|
|
|
content = content.trim(); |
|
|
|
|
if (codeImgFileSaveDir==null || codeImgFileSaveDir.isFile()) { |
|
|
|
|
if (codeImgFileSaveDir.isFile()) { |
|
|
|
|
//二维码图片存在目录为空,默认放在桌面...
|
|
|
|
|
codeImgFileSaveDir = FileSystemView.getFileSystemView().getHomeDirectory(); |
|
|
|
|
} |
|
|
|
|