Browse Source

fixed 我的卡券、商品搜索请求参数

fushengqian 5 months ago
parent
commit
a48677097c

+ 9 - 8
fuint-application/src/main/java/com/fuint/module/clientApi/controller/ClientGoodsController.java

@@ -15,6 +15,7 @@ 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.module.clientApi.request.GoodsSearchRequest;
 import com.fuint.repository.model.MtGoods;
 import com.fuint.repository.model.MtGoodsCate;
 import com.fuint.repository.model.MtGoodsSku;
@@ -125,19 +126,19 @@ public class ClientGoodsController extends BaseController {
 
     /**
      * 搜索商品
-     * */
+     */
     @ApiOperation(value = "搜索商品")
     @RequestMapping(value = "/search", method = RequestMethod.POST)
     @CrossOrigin
-    public ResponseObject search(HttpServletRequest request, @RequestBody Map<String, Object> params) throws BusinessCheckException {
+    public ResponseObject search(HttpServletRequest request, @RequestBody GoodsSearchRequest params) throws BusinessCheckException {
         Integer storeId = request.getHeader("storeId") == null ? 0 : Integer.parseInt(request.getHeader("storeId"));
         String merchantNo = request.getHeader("merchantNo") == null ? "" : request.getHeader("merchantNo");
-        Integer page = params.get("page") == null ? 1 : Integer.parseInt(params.get("page").toString());
-        Integer pageSize = params.get("pageSize") == null ? Constants.PAGE_SIZE : Integer.parseInt(params.get("pageSize").toString());
-        String name = params.get("name") == null ? "" : params.get("name").toString();
-        Integer cateId = params.get("cateId") == null ? 0 : Integer.parseInt(params.get("cateId").toString());
-        String sortType = params.get("sortType") == null ? "all" : params.get("sortType").toString();
-        String sortPrice = params.get("sortPrice") == null ? "0" : params.get("sortPrice").toString();
+        Integer page = params.getPage() == null ? 1 : params.getPage();
+        Integer pageSize = params.getPageSize() == null ? Constants.PAGE_SIZE : params.getPageSize();
+        String name = params.getName() == null ? "" : params.getName();
+        Integer cateId = params.getCateId() == null ? 0 : params.getCateId();
+        String sortType = params.getSortType() == null ? "all" : params.getSortType();
+        String sortPrice = params.getSortPrice() == null ? "0" : params.getSortPrice();
 
         PaginationRequest paginationRequest = new PaginationRequest();
         paginationRequest.setCurrentPage(page);

+ 9 - 6
fuint-application/src/main/java/com/fuint/module/clientApi/controller/ClientMyCouponController.java

@@ -8,6 +8,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.module.clientApi.request.MyCouponRequest;
 import com.fuint.repository.model.MtUserCoupon;
 import com.fuint.utils.StringUtil;
 import io.swagger.annotations.Api;
@@ -75,14 +76,15 @@ public class ClientMyCouponController extends BaseController {
     /**
      * 查询我的卡券是否已使用
      *
-     * @param param Request对象
+     * @param requestParam Request对象
+     * @return
      */
     @ApiOperation(value = "查询我的卡券是否已使用")
     @RequestMapping(value = "/isUsed", method = RequestMethod.GET)
     @CrossOrigin
-    public ResponseObject isUsed(HttpServletRequest request, @RequestParam Map<String, Object> param) throws BusinessCheckException {
+    public ResponseObject isUsed(HttpServletRequest request, @RequestBody MyCouponRequest requestParam) throws BusinessCheckException {
         String token = request.getHeader("Access-Token");
-        Integer userCouponId = param.get("id") == null ? 0 : Integer.parseInt(param.get("id").toString());
+        Integer userCouponId = requestParam.getId() == null ? 0 : requestParam.getId();
 
         if (StringUtil.isEmpty(token)) {
             return getFailureResult(1001);
@@ -105,14 +107,15 @@ public class ClientMyCouponController extends BaseController {
     /**
      * 删除我的卡券
      *
-     * @param param Request对象
+     * @param requestParam Request对象
+     * @return
      */
     @ApiOperation(value = "删除我的卡券")
     @RequestMapping(value = "/remove", method = RequestMethod.GET)
     @CrossOrigin
-    public ResponseObject remove(HttpServletRequest request, @RequestParam Map<String, Object> param) throws BusinessCheckException {
+    public ResponseObject remove(HttpServletRequest request, @RequestBody MyCouponRequest requestParam) throws BusinessCheckException {
         String token = request.getHeader("Access-Token");
-        Integer userCouponId = param.get("userCouponId") == null ? 0 : Integer.parseInt(param.get("userCouponId").toString());
+        Integer userCouponId = requestParam.getUserCouponId() == null ? 0 : requestParam.getUserCouponId();
 
         if (StringUtil.isEmpty(token)) {
             return getFailureResult(1001);

+ 34 - 0
fuint-application/src/main/java/com/fuint/module/clientApi/request/GoodsSearchRequest.java

@@ -0,0 +1,34 @@
+package com.fuint.module.clientApi.request;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import java.io.Serializable;
+
+/**
+ * 商品查询请求参数
+ *
+ * Created by FSQ
+ * CopyRight https://www.fuint.cn
+ */
+@Data
+public class GoodsSearchRequest implements Serializable {
+
+    @ApiModelProperty(value="当前页码", name="page")
+    private Integer page;
+
+    @ApiModelProperty(value="每页数量", name="pageSize")
+    private Integer pageSize;
+
+    @ApiModelProperty(value="商品名称", name="name")
+    private String name;
+
+    @ApiModelProperty(value="商品分类", name="cateId")
+    private Integer cateId;
+
+    @ApiModelProperty(value="排序类型", name="sortType")
+    private String sortType;
+
+    @ApiModelProperty(value="价格排序", name="sortPrice")
+    private String sortPrice;
+
+}

+ 22 - 0
fuint-application/src/main/java/com/fuint/module/clientApi/request/MyCouponRequest.java

@@ -0,0 +1,22 @@
+package com.fuint.module.clientApi.request;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import java.io.Serializable;
+
+/**
+ * 我的卡券请求参数
+ *
+ * Created by FSQ
+ * CopyRight https://www.fuint.cn
+ */
+@Data
+public class MyCouponRequest implements Serializable {
+
+    @ApiModelProperty(value="卡券ID", name="id")
+    private Integer id;
+
+    @ApiModelProperty(value="会员卡券ID", name="userCouponId")
+    private Integer userCouponId;
+
+}