zyw 11 mesi fa
parent
commit
22e7eae42a

+ 64 - 64
src/main/java/com/zhaoliangsz/grainsearch/basic/util/QRCodeUtil.java

@@ -1,64 +1,64 @@
-package com.zhaoliangsz.grainsearch.basic.util;
-
-import com.google.zxing.BarcodeFormat;
-import com.google.zxing.EncodeHintType;
-import com.google.zxing.client.j2se.MatrixToImageWriter;
-import com.google.zxing.common.BitMatrix;
-import com.google.zxing.qrcode.QRCodeWriter;
-import lombok.Getter;
-import org.springframework.beans.factory.InitializingBean;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Component;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.nio.charset.StandardCharsets;
-import java.nio.file.FileSystems;
-import java.nio.file.Path;
-import java.util.Hashtable;
-
-/**
- * @author : zyw
- * @date : 2023/8/18 9:10
- * @description: 二维码Util类
- */
-@Component
-public class QRCodeUtil implements InitializingBean {
-    @Getter
-    @Value("${file-location}")
-    private String endpoint;
-    /***
-     * 生成二维码图片并上传OSS
-     * @param text 二维码内容
-     * @param width 宽度
-     * @param height 高度
-     * @param type 类型
-     * @param name 图片名字
-     * @return
-     */
-    public  String generateQRCodeImage(String text, int width, int height,String type,String name){
-        try {
-            QRCodeWriter qrCodeWriter = new QRCodeWriter();
-            Hashtable<EncodeHintType, Object> hints = new Hashtable();
-            hints.put(EncodeHintType.CHARACTER_SET, "UTF-8");
-            BitMatrix bitMatrix = qrCodeWriter.encode(type+","+text, BarcodeFormat.QR_CODE, width, height,hints);
-            File file = new File( new String((endpoint + name+".png").getBytes(StandardCharsets.UTF_8), StandardCharsets.UTF_8));
-            if(!file.exists()){
-                file.mkdirs();
-            }
-            Path path = FileSystems.getDefault().getPath(file.getAbsoluteFile().getPath());
-            MatrixToImageWriter.writeToPath(bitMatrix, "PNG", path);
-            return file.getAbsoluteFile().getPath();
-        }
-        catch (Exception e){
-            System.out.println("二维码异常:"+e.toString());
-            return "error";
-        }
-    }
-
-    @Override
-    public void afterPropertiesSet() throws Exception {
-
-    }
-}
+//package com.zhaoliangsz.grainsearch.basic.util;
+//
+//import com.google.zxing.BarcodeFormat;
+//import com.google.zxing.EncodeHintType;
+//import com.google.zxing.client.j2se.MatrixToImageWriter;
+//import com.google.zxing.common.BitMatrix;
+//import com.google.zxing.qrcode.QRCodeWriter;
+//import lombok.Getter;
+//import org.springframework.beans.factory.InitializingBean;
+//import org.springframework.beans.factory.annotation.Value;
+//import org.springframework.stereotype.Component;
+//
+//import java.io.File;
+//import java.io.FileInputStream;
+//import java.io.IOException;
+//import java.nio.charset.StandardCharsets;
+//import java.nio.file.FileSystems;
+//import java.nio.file.Path;
+//import java.util.Hashtable;
+//
+///**
+// * @author : zyw
+// * @date : 2023/8/18 9:10
+// * @description: 二维码Util类
+// */
+//@Component
+//public class QRCodeUtil implements InitializingBean {
+//    @Getter
+//    @Value("${file-location}")
+//    private String endpoint;
+//    /***
+//     * 生成二维码图片并上传OSS
+//     * @param text 二维码内容
+//     * @param width 宽度
+//     * @param height 高度
+//     * @param type 类型
+//     * @param name 图片名字
+//     * @return
+//     */
+//    public  String generateQRCodeImage(String text, int width, int height,String type,String name){
+//        try {
+//            QRCodeWriter qrCodeWriter = new QRCodeWriter();
+//            Hashtable<EncodeHintType, Object> hints = new Hashtable();
+//            hints.put(EncodeHintType.CHARACTER_SET, "UTF-8");
+//            BitMatrix bitMatrix = qrCodeWriter.encode(type+","+text, BarcodeFormat.QR_CODE, width, height,hints);
+//            File file = new File( new String((endpoint + name+".png").getBytes(StandardCharsets.UTF_8), StandardCharsets.UTF_8));
+//            if(!file.exists()){
+//                file.mkdirs();
+//            }
+//            Path path = FileSystems.getDefault().getPath(file.getAbsoluteFile().getPath());
+//            MatrixToImageWriter.writeToPath(bitMatrix, "PNG", path);
+//            return file.getAbsoluteFile().getPath();
+//        }
+//        catch (Exception e){
+//            System.out.println("二维码异常:"+e.toString());
+//            return "error";
+//        }
+//    }
+//
+//    @Override
+//    public void afterPropertiesSet() throws Exception {
+//
+//    }
+//}

+ 3 - 3
src/main/resources/application-dev.yml

@@ -1,8 +1,8 @@
 spring:
  datasource:
-    url: jdbc:mysql://10.23.250.220:3306/h5?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=false&serverTimezone=Asia/Shanghai
-    username: root
-    password: Tang@123
+    url: jdbc:mysql://10.23.250.88:3306/dt?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=false&serverTimezone=Asia/Shanghai
+    username: admin
+    password: 14789632
     driver-class-name: com.mysql.cj.jdbc.Driver
  data:
    redis: