|
@@ -5,13 +5,21 @@ import com.fs.common.annotation.Log;
|
|
|
import com.fs.common.core.controller.BaseController;
|
|
import com.fs.common.core.controller.BaseController;
|
|
|
import com.fs.common.core.domain.AjaxResult;
|
|
import com.fs.common.core.domain.AjaxResult;
|
|
|
import com.fs.common.core.domain.R;
|
|
import com.fs.common.core.domain.R;
|
|
|
|
|
+import com.fs.common.core.domain.entity.SysUser;
|
|
|
import com.fs.common.core.page.TableDataInfo;
|
|
import com.fs.common.core.page.TableDataInfo;
|
|
|
import com.fs.common.enums.BusinessType;
|
|
import com.fs.common.enums.BusinessType;
|
|
|
|
|
+import com.fs.common.utils.DateUtils;
|
|
|
|
|
+import com.fs.common.utils.SecurityUtils;
|
|
|
|
|
+import com.fs.common.utils.http.HttpUtils;
|
|
|
import com.fs.common.utils.poi.ExcelUtil;
|
|
import com.fs.common.utils.poi.ExcelUtil;
|
|
|
|
|
+import com.fs.company.domain.CompanyUser;
|
|
|
|
|
+import com.fs.hisStore.domain.StoreCompanyCode;
|
|
|
|
|
+import com.fs.hisStore.service.IFsStoreCompanyCodeService;
|
|
|
import com.fs.hisStore.vo.FsStoreProductAttrValueVO;
|
|
import com.fs.hisStore.vo.FsStoreProductAttrValueVO;
|
|
|
import com.fs.hisStore.vo.FsStoreProductExportVO;
|
|
import com.fs.hisStore.vo.FsStoreProductExportVO;
|
|
|
import com.fs.hisStore.vo.FsStoreProductListVO;
|
|
import com.fs.hisStore.vo.FsStoreProductListVO;
|
|
|
import com.fs.hisStore.vo.FsStoreTuiProductAttrValueVO;
|
|
import com.fs.hisStore.vo.FsStoreTuiProductAttrValueVO;
|
|
|
|
|
+import com.fs.live.domain.LiveCompanyCode;
|
|
|
import com.fs.statis.dto.ModifyMoreDTO;
|
|
import com.fs.statis.dto.ModifyMoreDTO;
|
|
|
import com.fs.hisStore.domain.FsStoreProductScrm;
|
|
import com.fs.hisStore.domain.FsStoreProductScrm;
|
|
|
import com.fs.hisStore.domain.FsStoreProductAttrScrm;
|
|
import com.fs.hisStore.domain.FsStoreProductAttrScrm;
|
|
@@ -22,6 +30,10 @@ import com.fs.hisStore.service.IFsStoreProductAttrScrmService;
|
|
|
import com.fs.hisStore.service.IFsStoreProductAttrValueScrmService;
|
|
import com.fs.hisStore.service.IFsStoreProductAttrValueScrmService;
|
|
|
import com.fs.hisStore.service.IFsStoreProductScrmService;
|
|
import com.fs.hisStore.service.IFsStoreProductScrmService;
|
|
|
import com.fs.statis.dto.ProductAuditDTO;
|
|
import com.fs.statis.dto.ProductAuditDTO;
|
|
|
|
|
+import com.fs.system.oss.OSSFactory;
|
|
|
|
|
+import com.fs.wx.miniapp.config.WxMaProperties;
|
|
|
|
|
+import com.google.common.reflect.TypeToken;
|
|
|
|
|
+import com.google.gson.Gson;
|
|
|
import com.mysql.cj.util.StringUtils;
|
|
import com.mysql.cj.util.StringUtils;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -33,8 +45,11 @@ import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
+import java.nio.charset.StandardCharsets;
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
+import java.util.Map;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 商品Controller
|
|
* 商品Controller
|
|
@@ -56,6 +71,9 @@ public class FsStoreProductScrmController extends BaseController
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private IFsStoreProductAttrValueScrmService attrValueService;
|
|
private IFsStoreProductAttrValueScrmService attrValueService;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IFsStoreCompanyCodeService fsStoreCompanyCodeService;
|
|
|
|
|
+
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 批量修改商品
|
|
* 批量修改商品
|
|
@@ -234,4 +252,54 @@ public class FsStoreProductScrmController extends BaseController
|
|
|
return R.ok().put("data",list);
|
|
return R.ok().put("data",list);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private WxMaProperties properties;
|
|
|
|
|
+ @ApiOperation("生成微信小程序码")
|
|
|
|
|
+ @GetMapping("/getWxaCodeUnLimit")
|
|
|
|
|
+ //@PreAuthorize("@ss.hasPermi('live:live:edit')")
|
|
|
|
|
+ public R getWxaCodeUnLimit(@RequestParam(value = "productId") Long productId) {
|
|
|
|
|
+ StoreCompanyCode companyCode = fsStoreCompanyCodeService.selectByproductIdAndUserId(productId);
|
|
|
|
|
+ if (companyCode == null) {
|
|
|
|
|
+ String url = "https://api.weixin.qq.com/cgi-bin/stable_token";
|
|
|
|
|
+ HashMap<String, String> map = new HashMap<>();
|
|
|
|
|
+ map.put("grant_type", "client_credential");
|
|
|
|
|
+
|
|
|
|
|
+ // 百域承品
|
|
|
|
|
+ map.put("appid", properties.getConfigs().get(0).getAppid());
|
|
|
|
|
+ map.put("secret", properties.getConfigs().get(0).getSecret());
|
|
|
|
|
+ String accessToken = HttpUtils.endApi(url, null, map);
|
|
|
|
|
+ // 创建Gson对象
|
|
|
|
|
+ Gson gson = new Gson();
|
|
|
|
|
+ // 将JSON字符串解析为Java对象
|
|
|
|
|
+ Map<String, String> accessTokenMap = gson.fromJson(accessToken, new TypeToken<Map<String, Object>>() {
|
|
|
|
|
+ }.getType());
|
|
|
|
|
+ String codeUrl = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=" + accessTokenMap.get("access_token");
|
|
|
|
|
+ HashMap<String, String> jsonMap = new HashMap<>();
|
|
|
|
|
+ jsonMap.put("page", "pages/shopping/productDetails");
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ String scene = "productId=" + productId + "&isShow=1";
|
|
|
|
|
+ jsonMap.put("scene", scene);
|
|
|
|
|
+ //正式版为 "release",体验版为 "trial",开发版为 "develop"
|
|
|
|
|
+ jsonMap.put("env_version", "release");
|
|
|
|
|
+ byte[] bytes = HttpUtils.getWechatQrcodeByHttpURL(codeUrl, jsonMap);
|
|
|
|
|
+ if (bytes.length == 0) return R.error("生成二维码失败");
|
|
|
|
|
+
|
|
|
|
|
+ if (bytes.length > 0 && bytes.length < 500) {
|
|
|
|
|
+ String errorCode = new String(bytes, StandardCharsets.UTF_8);
|
|
|
|
|
+ logger.error(errorCode);
|
|
|
|
|
+ return R.error("生成二维码失败");
|
|
|
|
|
+ }
|
|
|
|
|
+ // 保存
|
|
|
|
|
+ String saveUrl = OSSFactory.build().uploadSuffix(bytes, ".png");
|
|
|
|
|
+ Date nowDate = DateUtils.getNowDate();
|
|
|
|
|
+ companyCode = new StoreCompanyCode();
|
|
|
|
|
+ companyCode.setProductCodeUrl(saveUrl);
|
|
|
|
|
+ companyCode.setProductId(productId);
|
|
|
|
|
+ companyCode.setUpdateTime(nowDate);
|
|
|
|
|
+ companyCode.setCreateTime(nowDate);
|
|
|
|
|
+ fsStoreCompanyCodeService.insertLiveCompanyCode(companyCode);
|
|
|
|
|
+ }
|
|
|
|
|
+ return R.ok().put("data", companyCode);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|