| | |
| | | package com.project.common.utils.file; |
| | | |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.google.zxing.WriterException; |
| | | import com.project.common.config.ProjectConfig; |
| | | import com.project.common.constant.Constants; |
| | | import com.project.common.utils.StringUtils; |
| | | import com.project.common.utils.WeChatUtils; |
| | | import com.project.common.utils.qrcode.QRCodeUtil; |
| | | import org.apache.poi.util.IOUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | import javax.net.ssl.*; |
| | | import java.io.*; |
| | | import java.net.HttpURLConnection; |
| | | import java.net.URL; |
| | |
| | | import java.security.cert.CertificateException; |
| | | import java.security.cert.X509Certificate; |
| | | import java.util.Arrays; |
| | | |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.project.common.config.ProjectConfig; |
| | | import com.project.common.utils.WeChatUtils; |
| | | import com.project.common.utils.qrcode.QRCodeUtil; |
| | | import com.google.zxing.BarcodeFormat; |
| | | import com.google.zxing.WriterException; |
| | | import com.google.zxing.client.j2se.MatrixToImageWriter; |
| | | import com.google.zxing.common.BitMatrix; |
| | | import com.google.zxing.qrcode.QRCodeWriter; |
| | | import org.apache.poi.util.IOUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import com.project.common.constant.Constants; |
| | | import com.project.common.utils.StringUtils; |
| | | |
| | | import javax.net.ssl.*; |
| | | |
| | | import static com.project.common.utils.file.FileUploadUtils.getPathFileName; |
| | | |
| | |
| | | * @throws WriterException |
| | | * @throws IOException |
| | | */ |
| | | public static Object createQrcode(String content, String type) |
| | | public static String createQrcode(String content, String name, String type) |
| | | { |
| | | // 本地资源路径 |
| | | String localPath = ProjectConfig.getQrcodePath(); |
| | |
| | | } |
| | | } |
| | | else if ("2".equals(type)){ |
| | | try { |
| | | String destPath = localPath+"/logo.png"; |
| | | QRCodeUtil.encode(content, destPath, file.getPath(),true); |
| | | |
| | | } catch (IOException | WriterException e) { |
| | | throw new RuntimeException(e); |
| | | } catch (ClassNotFoundException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | QRCodeUtil.contextLoads2(content, name, file.getPath()); |
| | | } |
| | | |
| | | } |