Prechádzať zdrojové kódy

fixed 搜索排序接口优化、订单上传功能迭代

fushengqian 5 mesiacov pred
rodič
commit
37f6fcb59c

+ 1 - 0
fuint-application/src/main/java/com/fuint/common/enums/ExpressCompanyEnum.java

@@ -7,6 +7,7 @@ package com.fuint.common.enums;
  * CopyRight https://www.fuint.cn
  */
 public enum ExpressCompanyEnum {
+    SELF("SELF", "商家自送"),
     YTO("YTO", "圆通速递"),
     ZTO("ZTO", "中通快递"),
     BEST("BEST", "百世快递"),

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

@@ -9,7 +9,8 @@ package com.fuint.common.enums;
 public enum OrderSettingEnum {
     DELIVERY_FEE("deliveryFee", "订单配送费用"),
     DELIVERY_MIN_AMOUNT("deliveryMinAmount", "订单起送金额"),
-    IS_CLOSE("isClose", "关闭交易功能");
+    IS_CLOSE("isClose", "关闭交易功能"),
+    MP_UPLOAD_SHIPPING("mpUploadShipping", "微信小程序上传发货信息");
 
     private String key;
 

+ 17 - 1
fuint-application/src/main/java/com/fuint/common/service/impl/GoodsServiceImpl.java

@@ -131,7 +131,23 @@ public class GoodsServiceImpl extends ServiceImpl<MtGoodsMapper, MtGoods> implem
                 lambdaQueryWrapper.gt(MtGoods::getPrice, 0);
             }
         }
-        lambdaQueryWrapper.orderByAsc(MtGoods::getSort);
+        String sortType = paginationRequest.getSearchParams().get("sortType") == null ? "" : paginationRequest.getSearchParams().get("sortType").toString();
+        String sortPrice = paginationRequest.getSearchParams().get("sortPrice") == null ? "0" : paginationRequest.getSearchParams().get("sortPrice").toString();
+        if (StringUtil.isNotEmpty(sortType)) {
+            if (sortType.equals("price")) {
+                if (sortPrice.equals("0")) {
+                    lambdaQueryWrapper.orderByDesc(MtGoods::getPrice);
+                } else {
+                    lambdaQueryWrapper.orderByAsc(MtGoods::getPrice);
+                }
+            } else if (sortType.equals("sales")) {
+                lambdaQueryWrapper.orderByDesc(MtGoods::getInitSale);
+            } else {
+                lambdaQueryWrapper.orderByAsc(MtGoods::getSort);
+            }
+        } else {
+            lambdaQueryWrapper.orderByAsc(MtGoods::getSort);
+        }
         List<MtGoods> goodsList = mtGoodsMapper.selectList(lambdaQueryWrapper);
         List<GoodsDto> dataList = new ArrayList<>();
         String basePath = settingService.getUploadBasePath();

+ 4 - 0
fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendOrderController.java

@@ -471,6 +471,7 @@ public class BackendOrderController extends BaseController {
         String deliveryFee = "";
         String isClose = "";
         String deliveryMinAmount = "";
+        String mpUploadShipping = "";
 
         for (MtSetting setting : settingList) {
             if (setting.getName().equals(OrderSettingEnum.DELIVERY_FEE.getKey())) {
@@ -479,12 +480,15 @@ public class BackendOrderController extends BaseController {
                 isClose = setting.getValue();
             } else if (setting.getName().equals(OrderSettingEnum.DELIVERY_MIN_AMOUNT.getKey())) {
                 deliveryMinAmount = setting.getValue();
+            } else if (setting.getName().equals(OrderSettingEnum.MP_UPLOAD_SHIPPING.getKey())) {
+                mpUploadShipping = setting.getValue();
             }
         }
 
         result.put("deliveryFee", deliveryFee);
         result.put("isClose", isClose);
         result.put("deliveryMinAmount", deliveryMinAmount);
+        result.put("mpUploadShipping", mpUploadShipping);
 
         return getSuccessResult(result);
     }

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

@@ -136,6 +136,8 @@ public class ClientGoodsController extends BaseController {
         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();
 
         PaginationRequest paginationRequest = new PaginationRequest();
         paginationRequest.setCurrentPage(page);
@@ -157,6 +159,12 @@ public class ClientGoodsController extends BaseController {
         if (merchantId > 0 ) {
             searchParams.put("merchantId", merchantId);
         }
+        if (StringUtil.isNotEmpty(sortType)) {
+            searchParams.put("sortType", sortType);
+        }
+        if (StringUtil.isNotEmpty(sortPrice)) {
+            searchParams.put("sortPrice", sortPrice);
+        }
 
         paginationRequest.setSearchParams(searchParams);
         PaginationResponse<GoodsDto> paginationResponse = goodsService.queryGoodsListByPagination(paginationRequest);