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())); } }