|
|
@ -36,6 +36,7 @@ import com.shop.cereshop.app.param.product.ShareParam; |
|
|
|
import com.shop.cereshop.app.param.product.SkuParam; |
|
|
|
import com.shop.cereshop.app.redis.service.api.StringRedisService; |
|
|
|
import com.shop.cereshop.app.service.activity.CerePlatformActivityService; |
|
|
|
import com.shop.cereshop.app.service.balipay.CereBusinessAlipayService; |
|
|
|
import com.shop.cereshop.app.service.business.CereBusinessBuyerUserService; |
|
|
|
import com.shop.cereshop.app.service.buyer.CereBuyerCommentLikeService; |
|
|
|
import com.shop.cereshop.app.service.buyer.CereBuyerReceiveService; |
|
|
@ -71,6 +72,7 @@ import com.shop.cereshop.commons.cache.product.ProductBo; |
|
|
|
import com.shop.cereshop.commons.constant.CoReturnFormat; |
|
|
|
import com.shop.cereshop.commons.constant.IntegerEnum; |
|
|
|
import com.shop.cereshop.commons.constant.ParamEnum; |
|
|
|
import com.shop.cereshop.commons.domain.balipay.CereBusinessAlipay; |
|
|
|
import com.shop.cereshop.commons.domain.business.CereBusinessBuyerUser; |
|
|
|
import com.shop.cereshop.commons.domain.buyer.CereBuyerCommentLike; |
|
|
|
import com.shop.cereshop.commons.domain.buyer.CereBuyerUser; |
|
|
@ -244,6 +246,9 @@ public class CereShopProductServiceImpl implements CereShopProductService { |
|
|
|
@Autowired |
|
|
|
private CereProductClassifyLangInfoService cereProductClassifyLangInfoService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private CereBusinessAlipayService businessAlipayService; |
|
|
|
|
|
|
|
/** |
|
|
|
* 商品详情前缀 |
|
|
|
*/ |
|
|
@ -1181,7 +1186,8 @@ public class CereShopProductServiceImpl implements CereShopProductService { |
|
|
|
String itemUrlSuffix = "?shopId="+param.getShopId()+"&productId="+param.getProductId()+"&skuId="+param.getSkuId()+"&salesId="+distributorId; |
|
|
|
CereBusinessWxpay businessWxpay = businessWxpayService.getByBusinessId(Long.valueOf(user.getProject())); |
|
|
|
String accessToken = WechatUtil.getAccessToken(businessWxpay.getAppId(), businessWxpay.getSecret()); |
|
|
|
return genPoster(env,itemPicUrl,shareHeadUrl,shareName,itemName,itemPrice,itemUrlSuffix,accessToken); |
|
|
|
CereBusinessAlipay businessAlipay = businessAlipayService.getByBusinessId(Long.valueOf(ContextUtil.getProject())); |
|
|
|
return genPoster(env,itemPicUrl,shareHeadUrl,shareName,itemName,itemPrice,itemUrlSuffix,accessToken, businessWxpay.getAppId(), businessAlipay.getPrivateKey(), businessAlipay.getPublicKey()); |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
@ -1417,7 +1423,8 @@ public class CereShopProductServiceImpl implements CereShopProductService { |
|
|
|
CereBusinessWxpay businessWxpay = businessWxpayService.getByBusinessId(Long.valueOf(user.getProject())); |
|
|
|
accessToken = WechatUtil.getAccessToken(businessWxpay.getAppId(), businessWxpay.getSecret()); |
|
|
|
} |
|
|
|
String qrCodeBase64 = genPosterSimple(env,itemUrlSuffix,accessToken); |
|
|
|
CereBusinessAlipay businessAlipay = businessAlipayService.getByBusinessId(Long.valueOf(user.getProject())); |
|
|
|
String qrCodeBase64 = genPosterSimple(env,itemUrlSuffix,accessToken, businessAlipay.getAppId(), businessAlipay.getPrivateKey(),businessAlipay.getPublicKey()); |
|
|
|
ShareProduct result = new ShareProduct(); |
|
|
|
result.setHeadImage(shareHeadUrl); |
|
|
|
result.setName(shareName); |
|
|
@ -1597,7 +1604,7 @@ public class CereShopProductServiceImpl implements CereShopProductService { |
|
|
|
return parent; |
|
|
|
} |
|
|
|
|
|
|
|
private String genPosterSimple(int env, String itemUrlSuffix, String accessToken) throws Exception { |
|
|
|
private String genPosterSimple(int env, String itemUrlSuffix, String accessToken, String appId, String privateKey, String publicKey) throws Exception { |
|
|
|
BufferedImage qrCode = null; |
|
|
|
String result = null; |
|
|
|
if (env == 1 || env == 2) { |
|
|
@ -1605,7 +1612,7 @@ public class CereShopProductServiceImpl implements CereShopProductService { |
|
|
|
} else if (env == 3) { |
|
|
|
qrCode = QRCodeUtil.createImage(goodsUrl + itemUrlSuffix, null, true); |
|
|
|
} else if (env == 4) { |
|
|
|
String qrCodeUrl = AlipayUtil.generateQrCode("pages_category_page1/goodsModule/goodsDetails", itemUrlSuffix.substring(1)); |
|
|
|
String qrCodeUrl = AlipayUtil.generateQrCode("pages_category_page1/goodsModule/goodsDetails", appId, privateKey, publicKey, itemUrlSuffix.substring(1)); |
|
|
|
qrCode = ImageIO.read(new URL(qrCodeUrl)); |
|
|
|
qrCode = qrCode.getSubimage(102, 134, 1336, 1336); |
|
|
|
} |
|
|
@ -1632,7 +1639,7 @@ public class CereShopProductServiceImpl implements CereShopProductService { |
|
|
|
*/ |
|
|
|
private String genPoster(int env, String itemPicUrl, String shareHeadUrl, |
|
|
|
String shareName, String itemName, Double itemPrice, |
|
|
|
String itemUrlSuffix, String accessToken) throws Exception { |
|
|
|
String itemUrlSuffix, String accessToken, String appId, String privateKey, String publicKey) throws Exception { |
|
|
|
int width = 640; |
|
|
|
int height = 1052; |
|
|
|
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); |
|
|
@ -1697,7 +1704,7 @@ public class CereShopProductServiceImpl implements CereShopProductService { |
|
|
|
qrCode = QRCodeUtil.createImage(goodsUrl + itemUrlSuffix, null, true); |
|
|
|
} else if (env == 4) { |
|
|
|
g2d.drawString("长按识别小程序", 30, baseHeight + 336); |
|
|
|
String qrCodeUrl = AlipayUtil.generateQrCode("pages_category_page1/goodsModule/goodsDetails", itemUrlSuffix.substring(1)); |
|
|
|
String qrCodeUrl = AlipayUtil.generateQrCode("pages_category_page1/goodsModule/goodsDetails", appId, privateKey, publicKey, itemUrlSuffix.substring(1)); |
|
|
|
qrCode = ImageIO.read(new URL(qrCodeUrl)); |
|
|
|
qrCode = qrCode.getSubimage(102, 134, 1336, 1336); |
|
|
|
} |
|
|
|