From 1e1315f441b9fdceeb6c753a47f7122c6111dbec Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Thu, 10 Mar 2022 11:20:51 +0800
Subject: [PATCH] fix alpha config
---
zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShareProductAction.java | 57 +++++++++++++++++++++++++++++++++------------------------
1 files changed, 33 insertions(+), 24 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 db91c07..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,17 +1,15 @@
package com.matrix.system.shopXcx.api.action;
-import com.matrix.system.hive.bean.SysVipInfo;
-import com.matrix.system.hive.dao.SysVipInfoDao;
-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;
-import com.matrix.core.tools.DateUtil;
-import com.matrix.core.tools.LogUtil;
-import com.matrix.core.tools.PropertiesUtil;
-import com.matrix.core.tools.UUIDUtil;
+import com.matrix.core.tools.*;
import com.matrix.system.common.constance.AppConstance;
import com.matrix.system.common.dao.BusParameterSettingsDao;
+import com.matrix.system.hive.bean.SysVipInfo;
import com.matrix.system.hive.dao.SysShopInfoDao;
+import com.matrix.system.hive.dao.SysVipInfoDao;
import com.matrix.system.hive.plugin.util.CollectionUtils;
import com.matrix.system.shopXcx.api.WeChatApiTools;
import com.matrix.system.shopXcx.api.pojo.QrcodeImgParam;
@@ -47,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;
@@ -93,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;
@@ -159,6 +164,7 @@
}
+
/**
* 秒杀分享图片参数
* @param loginUser
@@ -171,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";
@@ -210,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";
@@ -242,16 +248,18 @@
- 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 productPath = baseSavePath + "wxacode" + File.separatorChar + MD5Util.strToMD5(loginUser.getOpenId()) + "poster.png";
+ ImageUtil.downloadPicture(productImg, productPath);
+// productImg = productImg.replace(baseSaveUrl, baseSavePath);
String targetImg = UUIDUtil.getRandomID() + ".png";
QrcodeImgParam qrcodeImgParam = new QrcodeImgParam();
@@ -259,7 +267,7 @@
qrcodeImgParam.qrcodeSavePath = qrcodeSavePath;
qrcodeImgParam.qrcodeBackgroundImgPath = qrcodeBackgroundImgPath;
qrcodeImgParam.qrcodeFrontImgPath = qrcodeFrontImgPath;
- qrcodeImgParam.productImgPath = productImg;
+ qrcodeImgParam.productImgPath = productPath;
qrcodeImgParam.urlPath = baseSaveUrl + "/" + "wxacode" + "/" + targetImg;
qrcodeImgParam.targetImg = baseSavePath + "/" + "wxacode" + "/" + targetImg;
qrcodeImgParam.title = shopProduct.getTitle();
@@ -337,10 +345,11 @@
public static void main(String[] args) throws Exception {
QrcodeImgParam qrcodeImgParam = new QrcodeImgParam();
- qrcodeImgParam.qrcodeSavePath = "C:\\Users\\Administrator\\Desktop\\dd\\ewm.png";
+ qrcodeImgParam.qrcodeSavePath = "C:\\Users\\Administrator\\Desktop\\ewm.png";
qrcodeImgParam.qrcodeBackgroundImgPath = "C:\\Users\\Administrator\\Desktop\\dd\\bj1.png";
qrcodeImgParam.qrcodeFrontImgPath = "C:\\Users\\Administrator\\Desktop\\dd\\qj2.png";
- qrcodeImgParam.productImgPath = "C:\\Users\\Administrator\\Desktop\\dd\\banner.jpg";
+// qrcodeImgParam.productImgPath = "C:\\Users\\Administrator\\Desktop\\dd\\banner.jpg";
+ qrcodeImgParam.productImgPath = "C:\\Users\\Administrator\\Desktop\\6cbfee5df0474fe0b864be142bc474ab.jpg";
qrcodeImgParam.targetImg = "C:\\Users\\Administrator\\Desktop\\dd\\banner111.jpg";
qrcodeImgParam.title = "盐酸米多君片";
qrcodeImgParam.price = "¥30";
--
Gitblit v1.9.1