935090232@qq.com
2022-02-24 8c6026959d3006bbf9dce3f3c9311e70a02b80c1
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,22 +45,29 @@
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;
    @Autowired
    private SysShopInfoDao shopInfoDao;
    @Value(value = "${qrcodeBackgroundImgPath}")
    private String qrcodeBackgroundImgPath;
    @Value(value = "${qrcodeFrontImgPath}")
    private String qrcodeFrontImgPath;
@@ -91,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;
@@ -157,6 +164,7 @@
    }
    /**
     * 秒杀分享图片参数
     * @param loginUser
@@ -169,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";
@@ -208,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";
@@ -240,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);