Browse Source

Changes

master
主管理员 2 weeks ago
parent
commit
f253ab2413
2 changed files with 17 additions and 6 deletions
  1. +8
    -0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/cityShop/entity/CityShop.java
  2. +9
    -6
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/service/impl/YaoDuShopServiceImpl.java

+ 8
- 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/cityShop/entity/CityShop.java View File

@ -131,4 +131,12 @@ public class CityShop implements Serializable {
@Excel(name = "二维码背景图片", width = 15)
@ApiModelProperty(value = "二维码背景图片")
private java.lang.String qrCodeBg;
/**二维码位置x*/
@Excel(name = "二维码位置x", width = 15)
@ApiModelProperty(value = "二维码位置x")
private java.lang.Integer qrCodeX;
/**二维码位置x*/
@Excel(name = "二维码位置x", width = 15)
@ApiModelProperty(value = "二维码位置x")
private java.lang.Integer qrCodeY;
}

+ 9
- 6
jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/service/impl/YaoDuShopServiceImpl.java View File

@ -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) {


Loading…
Cancel
Save