Browse Source

fixed 增加卡券二维码功能

fushengqian 11 tháng trước cách đây
mục cha
commit
00d278f1a5

+ 2 - 1
fuint-application/src/main/java/com/fuint/common/enums/QrCodeEnum.java

@@ -8,7 +8,8 @@ package com.fuint.common.enums;
  */
 public enum QrCodeEnum {
     TABLE("table", "桌码二维码", "pages/category/index"),
-    STORE("store", "店铺二维码", "pages/index/index");
+    STORE("store", "店铺二维码", "pages/index/index"),
+    COUPON("coupon", "卡券二维码", "pages/coupon/detail");
 
     private String key;
 

+ 18 - 2
fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendCommonController.java

@@ -2,6 +2,7 @@ package com.fuint.module.backendApi.controller;
 
 import com.fuint.common.dto.AccountInfo;
 import com.fuint.common.enums.QrCodeEnum;
+import com.fuint.common.service.CouponService;
 import com.fuint.common.service.SettingService;
 import com.fuint.common.service.StoreService;
 import com.fuint.common.service.WeixinService;
@@ -11,6 +12,7 @@ import com.fuint.common.util.TokenUtil;
 import com.fuint.framework.exception.BusinessCheckException;
 import com.fuint.framework.web.BaseController;
 import com.fuint.framework.web.ResponseObject;
+import com.fuint.repository.model.MtCoupon;
 import com.fuint.repository.model.MtStore;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -56,11 +58,16 @@ public class BackendCommonController extends BaseController {
     private StoreService storeService;
 
     /**
-     * 获取二维码
+     * 卡券服务接口
+     */
+    private CouponService couponService;
+
+    /**
+     * 生成二维码
      *
      * @return
      */
-    @ApiOperation(value = "获取二维码")
+    @ApiOperation(value = "生成二维码")
     @RequestMapping(value = "/createQrCode", method = RequestMethod.POST)
     @CrossOrigin
     public ResponseObject createQrCode(HttpServletRequest request, @RequestBody Map<String, Object> params) throws BusinessCheckException {
@@ -77,12 +84,21 @@ public class BackendCommonController extends BaseController {
         if (type.equals(QrCodeEnum.TABLE.getKey())) {
             page = QrCodeEnum.TABLE.getPage() + "?" + QrCodeEnum.TABLE.getKey() + "Id=" + id;
         }
+        if (type.equals(QrCodeEnum.COUPON.getKey())) {
+            page = QrCodeEnum.COUPON.getPage() + "?" + QrCodeEnum.COUPON.getKey() + "Id=" + id;
+        }
         if (type.equals(QrCodeEnum.STORE.getKey())) {
             MtStore mtStore = storeService.queryStoreById(id);
             if (mtStore != null) {
                 merchantId = mtStore.getMerchantId();
             }
         }
+        if (type.equals(QrCodeEnum.COUPON.getKey())) {
+            MtCoupon mtCoupon = couponService.queryCouponById(id);
+            if (mtCoupon != null) {
+                merchantId = mtCoupon.getMerchantId();
+            }
+        }
         String h5QrCode = "";
         try {
             String h5Page = env.getProperty("website.url") + "#" + page;