package com.xhpc.test;

import java.io.File;
import java.util.Date;

public class TestQrUtil {

//    //上传图片全局变量
//    @Autowired
//    private Environment environment;
//    @Autowired
//    private IXhpcImgService iXhpcImgService;
//
//    @Test
//    public void test02() throws Exception {
//        QRCodeUtil.encode("https://xhpc.scxhua.com?pNum=6985214589654702","C:\\Users\\14554\\Desktop\\公司项目\\图片\\小华充电logo.png","C:\\Users\\14554\\Desktop\\公司项目\\图片\\小华充电二维码",false,"pNum=6985214589654702");
//    }
//
//    @Test
//    public void test03() throws Exception {
//
//        Date date = new Date();
//        String s = date.toString();
//        String fileName = DateUtil.format(date, "yyyyMMddHHmmssSSS")+"6985214589654702";
////        DateUtil.parse(s,"yyyyMMddHHmmssSSS");
//        System.out.println(fileName);
//        QRCodeUtil.encode("https://xhpc.scxhua.com?pNum=6985214589654702","C:\\Users\\14554\\Desktop\\公司项目\\图片\\小华充电logo.png","C:\\Users\\14554\\Desktop\\公司项目\\图片\\小华充电二维码",false,fileName);
//
//        //3.上传图片至服务器
//        // 创建OSSClient实例
//        OSSClient ossClient = new OSSClient(environment.getProperty("oss.endpoint"), environment.getProperty("oss.access-key"), environment.getProperty("oss.secret-key"));
//        // 上传文件流
//        ossClient.putObject(environment.getProperty("oss.bucket-name"), fileName, new File("C:\\Users\\14554\\Desktop\\公司项目\\图片\\小华充电二维码"+"/"+fileName+".png"));
//        ossClient.shutdown();
//
//        XhpcImg xhpcImg = new XhpcImg();
//        xhpcImg.setUrl(fileName);
//        iXhpcImgService.insert(xhpcImg);
//    }
}
