| | |
| | | |
| | | import cn.hutool.extra.qrcode.QrCodeUtil; |
| | | import cn.hutool.extra.qrcode.QrConfig; |
| | | import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.config.RuoYiConfig; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | |
| | | QrConfig config = new QrConfig(300, 300); |
| | | config.setMargin(3); |
| | | // config.setErrorCorrection(ErrorCorrectionLevel.H); |
| | | config.setErrorCorrection(ErrorCorrectionLevel.H); |
| | | |
| | | // 设置前景色,既二维码颜色(青色) |
| | | // config.setForeColor(new Color(0,60,130).getRGB()); |
| | |
| | | config |
| | | ); |
| | | String url = ""; |
| | | System.out.println(76768999); |
| | | |
| | | // 转换流信息写出 |
| | | FastByteArrayOutputStream os = new FastByteArrayOutputStream(); |
| | |
| | | InputStream input = new ByteArrayInputStream(os.toByteArray()); |
| | | //InputStream转成MultipartFile |
| | | MultipartFile multipartFile =new MockMultipartFile("file", "file.jpg", "text/plain", input); |
| | | System.out.println(76768999); |
| | | System.out.println(filePath); |
| | | |
| | | String fileName = FileUploadUtils.upload(multipartFile,filePath); |
| | | url = serverConfig.getUrl() + fileName; |
| | |
| | | } |
| | | catch (IOException e) |
| | | { |
| | | System.out.println(e.getMessage()); |
| | | return AjaxResult.error(e.getMessage()); |
| | | } |
| | | |