Преглед изворни кода

Merge branch 'dev/2024/0626/update-business-local-Y' of Harper/feifan-backend-zx-business into master

修改查询订单,多加一个状态
Yangzw пре 9 месеци
родитељ
комит
e9e4b71bbe

+ 1 - 1
feifan-module-mall/feifan-module-trade-api/src/main/java/cn/newfeifan/mall/module/trade/enums/order/TradeOrderStatusEnum.java

@@ -22,7 +22,7 @@ public enum TradeOrderStatusEnum implements IntArrayValuable {
     DELIVERED(20, "已发货"),
     DELIVERED(20, "已发货"),
     COMPLETED(30, "已完成"),
     COMPLETED(30, "已完成"),
     CANCELED(40, "已取消"),
     CANCELED(40, "已取消"),
-    AFTER_SALE(-2, "售后");
+    AFTER_SALE(-2, "退款成功");
 
 
     public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(TradeOrderStatusEnum::getStatus).toArray();
     public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(TradeOrderStatusEnum::getStatus).toArray();
 
 

+ 2 - 1
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/controller/admin/order/TradeOrderController.java

@@ -18,6 +18,7 @@ import cn.newfeifan.mall.module.trade.convert.order.TradeOrderConvert;
 import cn.newfeifan.mall.module.trade.dal.dataobject.order.TradeOrderDO;
 import cn.newfeifan.mall.module.trade.dal.dataobject.order.TradeOrderDO;
 import cn.newfeifan.mall.module.trade.dal.dataobject.order.TradeOrderItemDO;
 import cn.newfeifan.mall.module.trade.dal.dataobject.order.TradeOrderItemDO;
 import cn.newfeifan.mall.module.trade.dal.dataobject.order.TradeOrderLogDO;
 import cn.newfeifan.mall.module.trade.dal.dataobject.order.TradeOrderLogDO;
+import cn.newfeifan.mall.module.trade.enums.order.TradeOrderRefundStatusEnum;
 import cn.newfeifan.mall.module.trade.enums.order.TradeOrderStateEnum;
 import cn.newfeifan.mall.module.trade.enums.order.TradeOrderStateEnum;
 import cn.newfeifan.mall.module.trade.enums.order.TradeOrderStatusEnum;
 import cn.newfeifan.mall.module.trade.enums.order.TradeOrderStatusEnum;
 import cn.newfeifan.mall.module.trade.service.aftersale.AfterSaleService;
 import cn.newfeifan.mall.module.trade.service.aftersale.AfterSaleService;
@@ -274,7 +275,7 @@ public class TradeOrderController {
         Map<Integer, Long> orderCount = Maps.newLinkedHashMapWithExpectedSize(6);
         Map<Integer, Long> orderCount = Maps.newLinkedHashMapWithExpectedSize(6);
 
 
         orderCount.put(-1, tradeOrderQueryService.getOrderCount(null, reqVO));
         orderCount.put(-1, tradeOrderQueryService.getOrderCount(null, reqVO));
-        orderCount.put(TradeOrderStatusEnum.AFTER_SALE.getStatus(), afterSaleService.getApplyingAfterSaleCount(null, reqVO));
+        orderCount.put(TradeOrderStatusEnum.AFTER_SALE.getStatus(), tradeOrderQueryService.getOrderCountByRefundStatus(TradeOrderRefundStatusEnum.ALL.getStatus(), reqVO));
         orderCount.put(TradeOrderStatusEnum.UNPAID.getStatus(), tradeOrderQueryService.getOrderCount(TradeOrderStatusEnum.UNPAID.getStatus(), reqVO));
         orderCount.put(TradeOrderStatusEnum.UNPAID.getStatus(), tradeOrderQueryService.getOrderCount(TradeOrderStatusEnum.UNPAID.getStatus(), reqVO));
         orderCount.put(TradeOrderStatusEnum.UNDELIVERED.getStatus(), tradeOrderQueryService.getOrderCount(TradeOrderStatusEnum.UNDELIVERED.getStatus(), reqVO));
         orderCount.put(TradeOrderStatusEnum.UNDELIVERED.getStatus(), tradeOrderQueryService.getOrderCount(TradeOrderStatusEnum.UNDELIVERED.getStatus(), reqVO));
         orderCount.put(TradeOrderStatusEnum.DELIVERED.getStatus(), tradeOrderQueryService.getOrderCount(TradeOrderStatusEnum.DELIVERED.getStatus(), reqVO));
         orderCount.put(TradeOrderStatusEnum.DELIVERED.getStatus(), tradeOrderQueryService.getOrderCount(TradeOrderStatusEnum.DELIVERED.getStatus(), reqVO));

+ 26 - 4
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/dal/mysql/order/TradeOrderMapper.java

@@ -7,6 +7,8 @@ import cn.newfeifan.mall.framework.mybatis.core.query.MPJLambdaWrapperX;
 import cn.newfeifan.mall.module.trade.controller.admin.order.vo.TradeOrderPageReqVO;
 import cn.newfeifan.mall.module.trade.controller.admin.order.vo.TradeOrderPageReqVO;
 import cn.newfeifan.mall.module.trade.controller.app.order.vo.AppTradeOrderPageReqVO;
 import cn.newfeifan.mall.module.trade.controller.app.order.vo.AppTradeOrderPageReqVO;
 import cn.newfeifan.mall.module.trade.dal.dataobject.order.TradeOrderDO;
 import cn.newfeifan.mall.module.trade.dal.dataobject.order.TradeOrderDO;
+import cn.newfeifan.mall.module.trade.enums.order.TradeOrderRefundStatusEnum;
+import cn.newfeifan.mall.module.trade.enums.order.TradeOrderStatusEnum;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Param;
@@ -33,13 +35,12 @@ public interface TradeOrderMapper extends BaseMapperX<TradeOrderDO> {
     }
     }
 
 
     default PageResult<TradeOrderDO> selectPage(TradeOrderPageReqVO reqVO, Set<Long> userIds) {
     default PageResult<TradeOrderDO> selectPage(TradeOrderPageReqVO reqVO, Set<Long> userIds) {
-        return selectPage(reqVO, new LambdaQueryWrapperX<TradeOrderDO>()
+        LambdaQueryWrapperX<TradeOrderDO> queryWrapper = new LambdaQueryWrapperX<TradeOrderDO>()
                 .likeIfPresent(TradeOrderDO::getNo, reqVO.getNo())
                 .likeIfPresent(TradeOrderDO::getNo, reqVO.getNo())
                 .eqIfPresent(TradeOrderDO::getUserId, reqVO.getUserId())
                 .eqIfPresent(TradeOrderDO::getUserId, reqVO.getUserId())
                 .eqIfPresent(TradeOrderDO::getDeliveryType, reqVO.getDeliveryType())
                 .eqIfPresent(TradeOrderDO::getDeliveryType, reqVO.getDeliveryType())
                 .inIfPresent(TradeOrderDO::getUserId, userIds)
                 .inIfPresent(TradeOrderDO::getUserId, userIds)
                 .eqIfPresent(TradeOrderDO::getType, reqVO.getType())
                 .eqIfPresent(TradeOrderDO::getType, reqVO.getType())
-                .eqIfPresent(TradeOrderDO::getStatus, reqVO.getStatus())
                 .eqIfPresent(TradeOrderDO::getPayChannelCode, reqVO.getPayChannelCode())
                 .eqIfPresent(TradeOrderDO::getPayChannelCode, reqVO.getPayChannelCode())
                 .eqIfPresent(TradeOrderDO::getTerminal, reqVO.getTerminal())
                 .eqIfPresent(TradeOrderDO::getTerminal, reqVO.getTerminal())
                 .eqIfPresent(TradeOrderDO::getLogisticsId, reqVO.getLogisticsId())
                 .eqIfPresent(TradeOrderDO::getLogisticsId, reqVO.getLogisticsId())
@@ -49,7 +50,14 @@ public interface TradeOrderMapper extends BaseMapperX<TradeOrderDO> {
                 .inIfPresent(TradeOrderDO::getPickUpStoreId, reqVO.getPickUpStoreIds())
                 .inIfPresent(TradeOrderDO::getPickUpStoreId, reqVO.getPickUpStoreIds())
                 .likeIfPresent(TradeOrderDO::getPickUpVerifyCode, reqVO.getPickUpVerifyCode())
                 .likeIfPresent(TradeOrderDO::getPickUpVerifyCode, reqVO.getPickUpVerifyCode())
                 .betweenIfPresent(TradeOrderDO::getCreateTime, reqVO.getCreateTime())
                 .betweenIfPresent(TradeOrderDO::getCreateTime, reqVO.getCreateTime())
-                .orderByDesc(TradeOrderDO::getId));
+                .orderByDesc(TradeOrderDO::getId);
+        if (reqVO.getStatus().equals(TradeOrderStatusEnum.AFTER_SALE.getStatus())) {
+            queryWrapper.eq(TradeOrderDO::getRefundStatus, TradeOrderRefundStatusEnum.ALL.getStatus());
+        } else {
+            queryWrapper.eqIfPresent(TradeOrderDO::getStatus, reqVO.getStatus());
+            queryWrapper.ne(TradeOrderDO::getRefundStatus, TradeOrderRefundStatusEnum.ALL.getStatus());
+        }
+        return selectPage(reqVO, queryWrapper);
     }
     }
 
 
     // TODO @疯狂:如果用 map 返回,要不这里直接用 TradeOrderSummaryRespVO 返回?也算合理,就当  sql 查询出这么个玩意~~
     // TODO @疯狂:如果用 map 返回,要不这里直接用 TradeOrderSummaryRespVO 返回?也算合理,就当  sql 查询出这么个玩意~~
@@ -170,11 +178,25 @@ public interface TradeOrderMapper extends BaseMapperX<TradeOrderDO> {
         );
         );
     }
     }
 
 
-    default Long selectCountByStatus(Integer status, Long shopId, Long merId){
+    default Long selectCountByStatus(Integer status, Long shopId, Long merId) {
         return selectCount(new LambdaQueryWrapperX<TradeOrderDO>()
         return selectCount(new LambdaQueryWrapperX<TradeOrderDO>()
                 .eq(TradeOrderDO::getStatus, status)
                 .eq(TradeOrderDO::getStatus, status)
                 .eq(TradeOrderDO::getShopId, shopId)
                 .eq(TradeOrderDO::getShopId, shopId)
                 .eq(TradeOrderDO::getMerchantId, merId)
                 .eq(TradeOrderDO::getMerchantId, merId)
         );
         );
     }
     }
+
+    default Long selectCountByRefundStatus(Integer refundStatus, TradeOrderPageReqVO reqVO){
+        return selectCount(new LambdaQueryWrapperX<TradeOrderDO>()
+                .eqIfPresent(TradeOrderDO::getRefundStatus, refundStatus)
+                .likeIfPresent(TradeOrderDO::getNo, reqVO.getNo())
+                .eqIfPresent(TradeOrderDO::getDeliveryType, reqVO.getDeliveryType())
+                .eqIfPresent(TradeOrderDO::getType, reqVO.getType())
+                .eqIfPresent(TradeOrderDO::getPayChannelCode, reqVO.getPayChannelCode())
+                .eqIfPresent(TradeOrderDO::getTerminal, reqVO.getTerminal())
+                .eqIfPresent(TradeOrderDO::getMerchantId, reqVO.getMerchantId())
+                .eqIfPresent(TradeOrderDO::getShopId,reqVO.getShopId())
+                .betweenIfPresent(TradeOrderDO::getCreateTime, reqVO.getCreateTime())
+        );
+    }
 }
 }

+ 8 - 0
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/service/order/TradeOrderQueryService.java

@@ -216,4 +216,12 @@ public interface TradeOrderQueryService {
     Integer getSpuType(List<TradeOrderItemDO> orderItems);
     Integer getSpuType(List<TradeOrderItemDO> orderItems);
 
 
     Integer getSpuTypeByList(List<TradeOrderPageItemRespVO.Item> items);
     Integer getSpuTypeByList(List<TradeOrderPageItemRespVO.Item> items);
+
+    /**
+     * 获取状态为退款的订单
+     * @param refundStatus 订单状态
+     * @param reqVO 条件
+     * @return 数量
+     */
+    Long getOrderCountByRefundStatus(Integer refundStatus, TradeOrderPageReqVO reqVO);
 }
 }

+ 5 - 0
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/service/order/TradeOrderQueryServiceImpl.java

@@ -262,6 +262,11 @@ public class TradeOrderQueryServiceImpl implements TradeOrderQueryService {
         return null;
         return null;
     }
     }
 
 
+    @Override
+    public Long getOrderCountByRefundStatus(Integer refundStatus, TradeOrderPageReqVO reqVO) {
+        return tradeOrderMapper.selectCountByRefundStatus(refundStatus, reqVO);
+    }
+
     @Override
     @Override
     public List<ExpressTrackRespDTO> getExpressTrackList(Long id, Long userId) {
     public List<ExpressTrackRespDTO> getExpressTrackList(Long id, Long userId) {
         // 查询订单
         // 查询订单