Browse Source

fixed 店铺切换、积分转赠等接口优化

fushengqian 3 tháng trước cách đây
mục cha
commit
491312ccca

+ 1 - 0
fuint-application/src/main/java/com/fuint/common/config/WebConfig.java

@@ -84,6 +84,7 @@ public class WebConfig extends WebMvcConfigurationSupport {
                 .excludePathPatterns("/clientApi/cart/**")
                 .excludePathPatterns("/clientApi/user/**")
                 .excludePathPatterns("/clientApi/settlement/submit")
+                .excludePathPatterns("/clientApi/pay/doPay")
                 .excludePathPatterns("/clientApi/pay/weixinCallback")
                 .excludePathPatterns("/clientApi/pay/weixinRefundNotify")
                 .excludePathPatterns("/clientApi/pay/aliPayCallback")

+ 3 - 0
fuint-application/src/main/java/com/fuint/common/dto/StoreInfo.java

@@ -32,6 +32,9 @@ public class StoreInfo implements Serializable {
     @ApiModelProperty("店铺名称")
     private String name;
 
+    @ApiModelProperty("是否单店铺")
+    private String single;
+
     @ApiModelProperty("店铺二维码")
     private String qrCode;
 

+ 25 - 0
fuint-application/src/main/java/com/fuint/common/param/GivePointParam.java

@@ -0,0 +1,25 @@
+package com.fuint.common.param;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import java.io.Serializable;
+
+/**
+ * 积分转赠请求参数
+ *
+ * Created by FSQ
+ * CopyRight https://www.fuint.cn
+ */
+@Data
+public class GivePointParam implements Serializable {
+
+    @ApiModelProperty(value="手机号", name="mobile")
+    private String mobile;
+
+    @ApiModelProperty(value="转赠数量", name="amount")
+    private Integer amount;
+
+    @ApiModelProperty(value="转赠备注", name="remark")
+    private String remark;
+
+}

+ 10 - 36
fuint-application/src/main/java/com/fuint/module/clientApi/controller/ClientPointsController.java

@@ -4,6 +4,7 @@ import com.fuint.common.Constants;
 import com.fuint.common.dto.PointDto;
 import com.fuint.common.dto.UserInfo;
 import com.fuint.common.enums.StatusEnum;
+import com.fuint.common.param.GivePointParam;
 import com.fuint.common.service.PointService;
 import com.fuint.common.util.TokenUtil;
 import com.fuint.framework.exception.BusinessCheckException;
@@ -11,7 +12,6 @@ import com.fuint.framework.pagination.PaginationRequest;
 import com.fuint.framework.pagination.PaginationResponse;
 import com.fuint.framework.web.BaseController;
 import com.fuint.framework.web.ResponseObject;
-import com.fuint.utils.StringUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
@@ -39,8 +39,6 @@ public class ClientPointsController extends BaseController {
 
     /**
      * 查询我的积分明细
-     *
-     * @param request Request对象
      */
     @ApiOperation(value = "查询我的积分明细")
     @RequestMapping(value = "/list", method = RequestMethod.GET)
@@ -50,15 +48,7 @@ public class ClientPointsController extends BaseController {
         Integer page = request.getParameter("page") == null ? Constants.PAGE_NUMBER : Integer.parseInt(request.getParameter("page"));
         Integer pageSize = request.getParameter("pageSize") == null ? Constants.PAGE_SIZE : Integer.parseInt(request.getParameter("pageSize"));
 
-        if (StringUtil.isEmpty(token)) {
-            return getFailureResult(1001);
-        }
-
         UserInfo mtUser = TokenUtil.getUserInfoByToken(token);
-        if (null == mtUser) {
-            return getFailureResult(1001);
-        }
-
         Map<String, Object> param = new HashMap<>();
 
         param.put("userId", mtUser.getId());
@@ -75,37 +65,21 @@ public class ClientPointsController extends BaseController {
 
     /**
      * 转赠积分
-     *
-     * @param param Request对象
      */
     @ApiOperation(value = "转赠积分")
     @RequestMapping(value = "/doGive", method = RequestMethod.POST)
     @CrossOrigin
-    public ResponseObject doGive(HttpServletRequest request, @RequestBody Map<String, Object> param) {
-        String token = request.getHeader("Access-Token");
-
-        if (StringUtil.isEmpty(token)) {
-            return getFailureResult(1001);
-        }
-
-        UserInfo mtUser = TokenUtil.getUserInfoByToken(token);
-
-        if (null == mtUser) {
-            return getFailureResult(1001);
-        }
+    public ResponseObject doGive(HttpServletRequest request, @RequestBody GivePointParam param) throws BusinessCheckException {
+        UserInfo mtUser = TokenUtil.getUserInfoByToken(request.getHeader("Access-Token"));
 
-        String mobile = param.get("mobile") == null ? "" : param.get("mobile").toString();
-        String remark = param.get("remark") == null ? "" : param.get("remark").toString();
-        Integer amount = param.get("amount") == null ? 0 : Integer.parseInt(param.get("amount").toString());
+        String mobile = param.getMobile();
+        String remark = param.getRemark();
+        Integer amount = param.getAmount();
 
-        try {
-            boolean result = pointService.doGift(mtUser.getId(), mobile, amount, remark);
-            if (result) {
-                return getSuccessResult(true);
-            } else {
-                return getFailureResult(3008);
-            }
-        } catch (BusinessCheckException e) {
+        boolean result = pointService.doGift(mtUser.getId(), mobile, amount, remark);
+        if (result) {
+            return getSuccessResult(true);
+        } else {
             return getFailureResult(3008);
         }
     }

+ 11 - 1
fuint-application/src/main/java/com/fuint/module/clientApi/controller/ClientSystemController.java

@@ -4,6 +4,7 @@ import com.fuint.common.dto.ParamDto;
 import com.fuint.common.dto.StoreInfo;
 import com.fuint.common.dto.UserInfo;
 import com.fuint.common.enums.StatusEnum;
+import com.fuint.common.enums.YesOrNoEnum;
 import com.fuint.common.service.MemberService;
 import com.fuint.common.service.MerchantService;
 import com.fuint.common.service.SettingService;
@@ -139,8 +140,17 @@ public class ClientSystemController extends BaseController {
             storeInfo = null;
         }
 
+        // 是否单店铺
+        storeInfo.setSingle(YesOrNoEnum.YES.getKey());
+        if (storeInfo != null) {
+            List<MtStore> stores = storeService.getMyStoreList(storeInfo.getMerchantId(), 0, StatusEnum.ENABLED.getKey());
+            if (stores != null && stores.size() > 1) {
+                storeInfo.setSingle(YesOrNoEnum.NO.getKey());
+            }
+        }
+
         // 支付方式列表
-        List<ParamDto> payTypeList = settingService.getPayTypeList(merchantId, storeInfo.getId(), platform);
+        List<ParamDto> payTypeList = settingService.getPayTypeList(merchantId, (storeInfo == null) ? 0 :storeInfo.getId(), platform);
 
         Map<String, Object> result = new HashMap<>();
         result.put("storeInfo", storeInfo);