|
|
|
@ -65,9 +65,12 @@ public class YaoDuShopServiceImpl implements YaoDuShopService { |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
int x = byId.getQrCodeX() != null ? byId.getQrCodeX() : 0; |
|
|
|
int y = byId.getQrCodeY() != null ? byId.getQrCodeY() : 0; |
|
|
|
|
|
|
|
if (StringUtil.isNotEmpty(byId.getQrCodeBg())){ |
|
|
|
String finalPath = String.format("gourmet/gourmetDetail/final/%s_%s.jpg", |
|
|
|
id, byId.getQrCodeBg().hashCode()); |
|
|
|
String finalPath = String.format("gourmet/gourmetDetail/final/%s_%s_%s_%s.jpg", |
|
|
|
id, byId.getQrCodeBg().hashCode(), x, y); |
|
|
|
try { |
|
|
|
InputStream ossFile = OssBootUtil.getOssFile(finalPath, null); |
|
|
|
if (ossFile != null) { |
|
|
|
@ -97,16 +100,16 @@ public class YaoDuShopServiceImpl implements YaoDuShopService { |
|
|
|
try { |
|
|
|
byte[] qrCodeBytes = generateWxQrCode("1", "pages_order/gourmet/gourmetDetail?id=" + id, "release"); |
|
|
|
|
|
|
|
if (StringUtil.isNotEmpty(byId.getQrCodeBg())){ |
|
|
|
if (StringUtil.isEmpty(byId.getQrCodeBg())){ |
|
|
|
return qrCodeBytes; |
|
|
|
} |
|
|
|
|
|
|
|
// 生成最终合成图片,传递已获取的配置参数避免重复调用 |
|
|
|
byte[] finalImage = this.generateAndCombineImagesFromUrl2(qrCodeBytes, byId.getQrCodeBg(), 0, 0); |
|
|
|
byte[] finalImage = this.generateAndCombineImagesFromUrl2(qrCodeBytes, byId.getQrCodeBg(), x, y); |
|
|
|
|
|
|
|
// 异步上传到OSS(移除Redis缓存) |
|
|
|
uploadToOssAsync(finalImage, String.format("gourmet/gourmetDetail/final/%s_%s.jpg", |
|
|
|
id, byId.getQrCodeBg().hashCode())); |
|
|
|
uploadToOssAsync(finalImage, String.format("gourmet/gourmetDetail/final/%s_%s_%s_%s.jpg", |
|
|
|
id, byId.getQrCodeBg().hashCode(), x, y)); |
|
|
|
|
|
|
|
return finalImage; |
|
|
|
} catch (Exception e) { |
|
|
|
|