935090232@qq.com
2022-02-24 ceea128c48d5b21ebd1bb46943d656446aa974ec
zq-erp/src/main/java/com/matrix/system/hiveErp/action/ErpShopInfoController.java
@@ -7,7 +7,6 @@
import com.matrix.core.pojo.PaginationVO;
import com.matrix.core.tools.LogUtil;
import com.matrix.core.tools.MD5Util;
import com.matrix.core.tools.PropertiesUtil;
import com.matrix.system.common.bean.SysUsers;
import com.matrix.system.common.constance.AppConstance;
import com.matrix.system.constance.Dictionary;
@@ -17,6 +16,7 @@
import com.matrix.system.hive.service.SysShopInfoService;
import com.matrix.system.shopXcx.api.WeChatApiTools;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PathVariable;
@@ -37,9 +37,18 @@
@Controller
@RequestMapping("hiveErp/shopInfo")
public class ErpShopInfoController extends BaseController {
    @Autowired
    WxacodeUtil wxacodeUtil;
    @Resource
    private SysShopInfoService shopInfoService; // 店铺Service
    @Value("${file_storage_path}")
    private String fileStoragePath;
    @Value("${static_resource_url}")
    private String staticResourceUrl;
    @Autowired
    WeChatApiTools weChatApiTools;
@@ -86,6 +95,7 @@
        return "admin/hive-erp/shop/shopInfo-form";
    }
    /**
     * 生成门店二维码
     */
@@ -95,13 +105,13 @@
    AjaxResult creteSohopQrcode(@PathVariable("shopId") Long shopId) {
        SysShopInfo shopInfo = shopInfoService.findById(shopId);
        try {
            String qrcodeSavePath = WxacodeUtil.getWxacode(shopId + "", "pages/index/index", MD5Util.strToMD5(shopId + "")
            String qrcodeSavePath = wxacodeUtil.getWxacode(shopId + "", "pages/index/index", MD5Util.strToMD5(shopId + "")
                    ,weChatApiTools.getAppid(shopInfo.getCompanyId()),weChatApiTools.getSecret(shopInfo.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 qrcodeImgUrl = qrcodeSavePath.replace(baseSavePath, baseSaveUrl);
            shopInfo.setQrcode(qrcodeImgUrl);
            shopInfoService.modify(shopInfo);