From bd9d3f0eea6ea0cd62ce7028c10819141ffc07d8 Mon Sep 17 00:00:00 2001 From: GYJ <1157756119@qq.com> Date: Mon, 29 Jul 2024 16:01:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=BF=E6=8D=A2logo=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/cashierservice/service/UserService.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/UserService.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/UserService.java index 4d8a20b..9182672 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/UserService.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/UserService.java @@ -20,6 +20,7 @@ import com.chaozhanggui.system.cashierservice.util.*; import com.chaozhanggui.system.cashierservice.wxUtil.WxAccountUtil; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Value; @@ -263,8 +264,10 @@ public class UserService { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); Resource resource = resourceLoader.getResource("classpath:/static/logo.jpg"); InputStream inputStream = resource.getInputStream(); - QrCodeUtil.generate(wxAccountUtil.getRadarQrCode(Integer.valueOf(shopId)), new QrConfig(250, 250).setImg(ImageIO.read(inputStream)), "png", outputStream); + QrCodeUtil.generate(wxAccountUtil.getRadarQrCode(Integer.valueOf(shopId)), new QrConfig(500, 500). + setImg(ImageIO.read(inputStream)).setErrorCorrection(ErrorCorrectionLevel.H).setRatio(4), "png", outputStream); - return fileService.uploadFileByInputStream(".png", new ByteArrayInputStream(outputStream.toByteArray())); + + return fileService.uploadFileByInputStream("png", new ByteArrayInputStream(outputStream.toByteArray())); } }