From 1ceabefb451912daa5dda7768b7ef0b89a56c08a Mon Sep 17 00:00:00 2001 From: xiaoyong931011 <15274802129@163.com> Date: Fri, 25 Mar 2022 12:28:00 +0800 Subject: [PATCH] 1 --- zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShareProductAction.java | 34 ++++++++++++++++++++++------------ 1 files changed, 22 insertions(+), 12 deletions(-) diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShareProductAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShareProductAction.java index c0b642a..9f0c799 100644 --- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShareProductAction.java +++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShareProductAction.java @@ -1,6 +1,6 @@ package com.matrix.system.shopXcx.api.action; -import com.matrix.component.redis.RedisUserLoginUtils; +import com.matrix.system.common.init.UserCacheManager; import com.matrix.component.tools.ImageUtil; import com.matrix.component.tools.WxacodeUtil; import com.matrix.core.pojo.AjaxResult; @@ -45,12 +45,21 @@ public class WxShareProductAction { @Autowired + WxacodeUtil wxacodeUtil; + + @Value("${file_storage_path}") + private String fileStoragePath; + + @Value("${static_resource_url}") + private String staticResourceUrl; + + @Autowired WeChatApiTools weChatApiTools; @Autowired private ShopProductDao shopProductDao; @Autowired - private RedisUserLoginUtils redisUserLoginUtils; + private UserCacheManager userCacheManager; @Autowired private ShopShareQrcordDao shareQrcordDao; @@ -89,7 +98,7 @@ @RequestMapping(value = "/getProductShareQrcode") public @ResponseBody AjaxResult getwxacode1(@RequestBody QrcodeVo qrcodeVo) throws Exception { - SysVipInfo loginUser = redisUserLoginUtils.getLoginUser(SysVipInfo.class); + SysVipInfo loginUser = userCacheManager.getLoginUser(); loginUser = sysVipInfoDao.selectById(loginUser.getId()); //活动类型 ShopActivities activities=null; @@ -155,6 +164,7 @@ } + /** * 秒杀分享图片参数 * @param loginUser @@ -167,14 +177,14 @@ ShopProduct shopProduct = shopProductDao.selectById(seckillInfo.getGoodsId().intValue()); - String qrcodeSavePath = WxacodeUtil.getWxacode(qrcodeVo.getScene(), qrcodeVo.getPath(), UUIDUtil.getRandomID() + String qrcodeSavePath = wxacodeUtil.getWxacode(qrcodeVo.getScene(), qrcodeVo.getPath(), UUIDUtil.getRandomID() ,weChatApiTools.getAppid(loginUser.getCompanyId()),weChatApiTools.getSecret(loginUser.getCompanyId())); LogUtil.debug("qrcodeSavePath={}", qrcodeSavePath); // 图片保存目录路径 - String baseSavePath = PropertiesUtil.getString(AppConstance.FILES_TORAGE_PATH); + String baseSavePath = fileStoragePath; // 图片访问URL - String baseSaveUrl = PropertiesUtil.getString(AppConstance.NGINX_URL); + String baseSaveUrl = staticResourceUrl; String productImg = shopProduct.getImgMobile(); productImg = productImg.replace(baseSaveUrl, baseSavePath); String targetImg = UUIDUtil.getRandomID() + ".png"; @@ -206,14 +216,14 @@ ShopProduct shopProduct = shopProductDao.selectById(groupBuyVO.getGoodsId().intValue()); - String qrcodeSavePath = WxacodeUtil.getWxacode(qrcodeVo.getScene(), qrcodeVo.getPath(), UUIDUtil.getRandomID() + String qrcodeSavePath =wxacodeUtil.getWxacode(qrcodeVo.getScene(), qrcodeVo.getPath(), UUIDUtil.getRandomID() ,weChatApiTools.getAppid(loginUser.getCompanyId()),weChatApiTools.getSecret(loginUser.getCompanyId())); LogUtil.debug("qrcodeSavePath={}", qrcodeSavePath); // 图片保存目录路径 - String baseSavePath = PropertiesUtil.getString(AppConstance.FILES_TORAGE_PATH); + String baseSavePath =fileStoragePath; // 图片访问URL - String baseSaveUrl = PropertiesUtil.getString(AppConstance.NGINX_URL); + String baseSaveUrl =staticResourceUrl; String productImg = shopProduct.getImgMobile(); productImg = productImg.replace(baseSaveUrl, baseSavePath); String targetImg = UUIDUtil.getRandomID() + ".png"; @@ -238,14 +248,14 @@ - String qrcodeSavePath = WxacodeUtil.getWxacode(qrcodeVo.getScene(), qrcodeVo.getPath(), UUIDUtil.getRandomID() + String qrcodeSavePath = wxacodeUtil.getWxacode(qrcodeVo.getScene(), qrcodeVo.getPath(), UUIDUtil.getRandomID() ,weChatApiTools.getAppid(loginUser.getCompanyId()),weChatApiTools.getSecret(loginUser.getCompanyId())); LogUtil.debug("qrcodeSavePath={}", qrcodeSavePath); // 图片保存目录路径 - String baseSavePath = PropertiesUtil.getString(AppConstance.FILES_TORAGE_PATH); + String baseSavePath =fileStoragePath; // 图片访问URL - String baseSaveUrl = PropertiesUtil.getString(AppConstance.NGINX_URL); + String baseSaveUrl =staticResourceUrl; String productImg = shopProduct.getImgMobile(); String productPath = baseSavePath + "wxacode" + File.separatorChar + MD5Util.strToMD5(loginUser.getOpenId()) + "poster.png"; ImageUtil.downloadPicture(productImg, productPath); -- Gitblit v1.9.1