feat(order): 添加订单数量统计功能
- 新增 OrderNumVO 类用于订单数量统计 - 在 OrderService 接口中添加 getOrderNumVO 方法 - 在 OrderServiceImpl 类中实现 getOrderNumVO 方法 - 在 OrderMapper 接口中添加 getOrderNumVO SQL 查询 - 在 OrderManagerController 和 OrderStoreController 中添加获取订单数量的 API 接口- 优化物流公司的获取方式,
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package cn.lili.modules.order.order.entity.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class OrderNumVO {
|
||||
|
||||
@ApiModelProperty(value = "未付款订单数量")
|
||||
private Integer waitPayNum;
|
||||
@ApiModelProperty(value = "已付款订单数量")
|
||||
private Integer waitDeliveryNum;
|
||||
@ApiModelProperty(value = "待发货订单数量")
|
||||
private Integer waitShipNum;
|
||||
@ApiModelProperty(value = "部分发货订单数量")
|
||||
private Integer partsDeliveredNumNum;
|
||||
@ApiModelProperty(value = "待收货订单数量")
|
||||
private Integer deliveredNum;
|
||||
@ApiModelProperty(value = "待核验订单数量")
|
||||
private Integer waitCheckNum;
|
||||
@ApiModelProperty(value = "待自提订单数量")
|
||||
private Integer waitSelfPickNum;
|
||||
@ApiModelProperty(value = "已完成订单数量")
|
||||
private Integer finishNum;
|
||||
@ApiModelProperty(value = "已关闭订单数量")
|
||||
private Integer closeNum;
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package cn.lili.modules.order.order.mapper;
|
||||
|
||||
import cn.lili.modules.order.order.entity.dos.Order;
|
||||
import cn.lili.modules.order.order.entity.dto.OrderExportDTO;
|
||||
import cn.lili.modules.order.order.entity.vo.OrderNumVO;
|
||||
import cn.lili.modules.order.order.entity.vo.OrderSimpleVO;
|
||||
import cn.lili.modules.order.order.entity.vo.PaymentLog;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
@@ -97,6 +98,17 @@ public interface OrderMapper extends BaseMapper<Order> {
|
||||
" FROM li_order o LEFT JOIN li_order_item AS oi on o.sn = oi.order_sn ${ew.customSqlSegment} ")
|
||||
IPage<OrderSimpleVO> queryByParams(IPage<OrderSimpleVO> page, @Param(Constants.WRAPPER) Wrapper<OrderSimpleVO> queryWrapper);
|
||||
|
||||
@Select("select COUNT(CASE WHEN order_status = 'UNPAID' THEN 1 END) as waitPayNum,"+
|
||||
"COUNT(CASE WHEN order_status = 'PAID' THEN 1 END) as waitDeliveryNum,"+
|
||||
"COUNT(CASE WHEN order_status = 'UNDELIVERED' THEN 1 END) as waitShipNum,"+
|
||||
"COUNT(CASE WHEN order_status = 'PARTS_DELIVERED' THEN 1 END) as partsDeliveredNumNum,"+
|
||||
"COUNT(CASE WHEN order_status = 'DELIVERED' THEN 1 END) as deliveredNum,"+
|
||||
"COUNT(CASE WHEN order_status = 'TAKE' THEN 1 END) as waitCheckNum,"+
|
||||
"COUNT(CASE WHEN order_status = 'STAY_PICKED_UP' THEN 1 END) as waitSelfPickNum,"+
|
||||
"COUNT(CASE WHEN order_status = 'COMPLETED' THEN 1 END) as finishNum,"+
|
||||
"COUNT(CASE WHEN order_status = 'CANCELLED' THEN 1 END) as closeNum "+
|
||||
" FROM li_order o LEFT JOIN li_order_item AS oi on o.sn = oi.order_sn ${ew.customSqlSegment} ")
|
||||
OrderNumVO getOrderNumVO(@Param(Constants.WRAPPER) Wrapper<OrderSimpleVO> queryWrapper);
|
||||
/**
|
||||
* 查询订单信息
|
||||
*
|
||||
|
||||
@@ -3,11 +3,11 @@ package cn.lili.modules.order.order.service;
|
||||
import cn.lili.modules.member.entity.dto.MemberAddressDTO;
|
||||
import cn.lili.modules.order.cart.entity.dto.TradeDTO;
|
||||
import cn.lili.modules.order.order.entity.dos.Order;
|
||||
import cn.lili.modules.order.order.entity.dto.OrderExportDTO;
|
||||
import cn.lili.modules.order.order.entity.dto.OrderMessage;
|
||||
import cn.lili.modules.order.order.entity.dto.OrderSearchParams;
|
||||
import cn.lili.modules.order.order.entity.dto.PartDeliveryParamsDTO;
|
||||
import cn.lili.modules.order.order.entity.vo.OrderDetailVO;
|
||||
import cn.lili.modules.order.order.entity.vo.OrderNumVO;
|
||||
import cn.lili.modules.order.order.entity.vo.OrderSimpleVO;
|
||||
import cn.lili.modules.order.order.entity.vo.PaymentLog;
|
||||
import cn.lili.modules.system.entity.vo.Traces;
|
||||
@@ -54,6 +54,14 @@ public interface OrderService extends IService<Order> {
|
||||
*/
|
||||
IPage<OrderSimpleVO> queryByParams(OrderSearchParams orderSearchParams);
|
||||
|
||||
/**
|
||||
* 获取订单数量
|
||||
*
|
||||
* @param orderSearchParams 查询参数
|
||||
* @return 订单数量
|
||||
*/
|
||||
OrderNumVO getOrderNumVO(OrderSearchParams orderSearchParams);
|
||||
|
||||
/**
|
||||
* 订单信息
|
||||
*
|
||||
|
||||
@@ -22,17 +22,13 @@ import cn.lili.common.utils.CurrencyUtil;
|
||||
import cn.lili.common.utils.SnowFlake;
|
||||
import cn.lili.modules.goods.entity.dto.GoodsCompleteMessage;
|
||||
import cn.lili.modules.member.entity.dto.MemberAddressDTO;
|
||||
import cn.lili.modules.order.aftersale.entity.enums.ComplaintStatusEnum;
|
||||
import cn.lili.modules.order.cart.entity.dto.TradeDTO;
|
||||
import cn.lili.modules.order.cart.entity.enums.DeliveryMethodEnum;
|
||||
import cn.lili.modules.order.order.aop.OrderLogPoint;
|
||||
import cn.lili.modules.order.order.entity.dos.*;
|
||||
import cn.lili.modules.order.order.entity.dto.*;
|
||||
import cn.lili.modules.order.order.entity.enums.*;
|
||||
import cn.lili.modules.order.order.entity.vo.OrderDetailVO;
|
||||
import cn.lili.modules.order.order.entity.vo.OrderSimpleVO;
|
||||
import cn.lili.modules.order.order.entity.vo.OrderVO;
|
||||
import cn.lili.modules.order.order.entity.vo.PaymentLog;
|
||||
import cn.lili.modules.order.order.entity.vo.*;
|
||||
import cn.lili.modules.order.order.mapper.OrderMapper;
|
||||
import cn.lili.modules.order.order.service.*;
|
||||
import cn.lili.modules.order.trade.entity.dos.OrderLog;
|
||||
@@ -225,6 +221,11 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
||||
return this.baseMapper.queryByParams(PageUtil.initPage(orderSearchParams), queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrderNumVO getOrderNumVO(OrderSearchParams orderSearchParams) {
|
||||
return this.baseMapper.getOrderNumVO(orderSearchParams.queryWrapper());
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单信息
|
||||
*
|
||||
@@ -785,7 +786,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
||||
*/
|
||||
private void checkBatchDeliver(List<OrderBatchDeliverDTO> list) {
|
||||
|
||||
List<Logistics> logistics = logisticsService.list();
|
||||
Map<String, String> logisticsMap = logisticsService.list().stream()
|
||||
.collect(Collectors.toMap(Logistics::getName, Logistics::getId));
|
||||
for (OrderBatchDeliverDTO orderBatchDeliverDTO : list) {
|
||||
//查看订单号是否存在-是否是当前店铺的订单
|
||||
Order order = this.getOne(new LambdaQueryWrapper<Order>()
|
||||
@@ -797,11 +799,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
||||
throw new ServiceException("订单编号:'" + orderBatchDeliverDTO.getOrderSn() + " '不能发货");
|
||||
}
|
||||
//获取物流公司
|
||||
logistics.forEach(item -> {
|
||||
if (item.getName().equals(orderBatchDeliverDTO.getLogisticsName())) {
|
||||
orderBatchDeliverDTO.setLogisticsId(item.getId());
|
||||
}
|
||||
});
|
||||
String logisticsId = logisticsMap.get(orderBatchDeliverDTO.getLogisticsName());
|
||||
if (logisticsId != null) {
|
||||
orderBatchDeliverDTO.setLogisticsId(logisticsId);
|
||||
}
|
||||
if (CharSequenceUtil.isEmpty(orderBatchDeliverDTO.getLogisticsId())) {
|
||||
throw new ServiceException("物流公司:'" + orderBatchDeliverDTO.getLogisticsName() + " '不存在");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user