Ver código fonte

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

修改查询订单,多加一个状态
Yangzw 9 meses atrás
pai
commit
effda8eaa2

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

@@ -51,9 +51,9 @@ public interface TradeOrderMapper extends BaseMapperX<TradeOrderDO> {
                 .likeIfPresent(TradeOrderDO::getPickUpVerifyCode, reqVO.getPickUpVerifyCode())
                 .betweenIfPresent(TradeOrderDO::getCreateTime, reqVO.getCreateTime())
                 .orderByDesc(TradeOrderDO::getId);
-        if (reqVO.getStatus().equals(TradeOrderStatusEnum.AFTER_SALE.getStatus())) {
+        if(reqVO.getStatus() != null && reqVO.getStatus().equals(TradeOrderStatusEnum.AFTER_SALE.getStatus())){
             queryWrapper.eq(TradeOrderDO::getRefundStatus, TradeOrderRefundStatusEnum.ALL.getStatus());
-        } else {
+        }else if(reqVO.getStatus() != null){
             queryWrapper.eqIfPresent(TradeOrderDO::getStatus, reqVO.getStatus());
             queryWrapper.ne(TradeOrderDO::getRefundStatus, TradeOrderRefundStatusEnum.ALL.getStatus());
         }

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

@@ -126,7 +126,13 @@ public class TradeOrderQueryServiceImpl implements TradeOrderQueryService {
         reqVO.setShopId(userShopDetails.getShopId());
 
         // 分页查询
-        return tradeOrderMapper.selectPage(reqVO, userIds);
+        PageResult<TradeOrderDO> tradeOrderDOPageResult = tradeOrderMapper.selectPage(reqVO, userIds);
+        if (reqVO.getStatus().equals(TradeOrderStatusEnum.AFTER_SALE.getStatus())) {
+            for (TradeOrderDO tradeOrderDO : tradeOrderDOPageResult.getList()) {
+                tradeOrderDO.setStatus(TradeOrderStatusEnum.AFTER_SALE.getStatus());
+            }
+        }
+        return tradeOrderDOPageResult;
     }
 
     private Set<Long> buildQueryConditionUserIds(TradeOrderPageReqVO reqVO) {
@@ -234,9 +240,9 @@ public class TradeOrderQueryServiceImpl implements TradeOrderQueryService {
         Long backlogShipmentsCount = tradeOrderMapper.selectCountByStatus(TradeOrderStatusEnum.UNDELIVERED.getStatus(), userShopDetails.getShopId(), userShopDetails.getMerId());
         Long backlogAfterSaleCount = afterSaleService.selectCountByStatus(userShopDetails.getShopId(), userShopDetails.getMerId());
 
-        Map<String,Long> backMap = new HashMap<>();
-        backMap.put(BacklogConstants.BACKLOG_SHIPMENTS,backlogShipmentsCount);
-        backMap.put(BacklogConstants.BACKLOG_AFTER_SALE,backlogAfterSaleCount);
+        Map<String, Long> backMap = new HashMap<>();
+        backMap.put(BacklogConstants.BACKLOG_SHIPMENTS, backlogShipmentsCount);
+        backMap.put(BacklogConstants.BACKLOG_AFTER_SALE, backlogAfterSaleCount);
         return backMap;
     }
 
@@ -244,7 +250,7 @@ public class TradeOrderQueryServiceImpl implements TradeOrderQueryService {
     public Integer getSpuType(List<TradeOrderItemDO> orderItems) {
         for (TradeOrderItemDO orderItem : orderItems) {
             ProductSpuDO spu = productSpuService.getSpu(orderItem.getSpuId());
-            if(spu.getSpuType() == 0){
+            if (spu.getSpuType() == 0) {
                 return 0;
             }
         }
@@ -255,7 +261,7 @@ public class TradeOrderQueryServiceImpl implements TradeOrderQueryService {
     public Integer getSpuTypeByList(List<TradeOrderPageItemRespVO.Item> items) {
         for (TradeOrderPageItemRespVO.Item orderItem : items) {
             ProductSpuDO spu = productSpuService.getSpu(orderItem.getSpuId());
-            if(spu.getSpuType() == 0){
+            if (spu.getSpuType() == 0) {
                 return 0;
             }
         }