历史订单

订单列表
This commit is contained in:
2025-02-27 11:01:28 +08:00
parent 36b4467ba5
commit eda74e2609
4 changed files with 16 additions and 11 deletions

View File

@@ -1,6 +1,7 @@
package com.czg.account.dto; package com.czg.account.dto;
import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
@@ -11,9 +12,9 @@ import java.time.LocalDateTime;
*/ */
@Data @Data
public class QueryReceiveDto { public class QueryReceiveDto {
@NotBlank(message = "优惠券id 不可为空") @NotNull(message = "优惠券id 不可为空")
private Long couponId; private Long couponId;
@NotBlank(message = "店铺Id 不可为空") @NotNull(message = "店铺Id 不可为空")
private Long shopId; private Long shopId;
//用户昵称 手机号 模糊 //用户昵称 手机号 模糊
private String value; private String value;

View File

@@ -12,7 +12,7 @@ import java.util.Map;
* @description * @description
*/ */
@Data @Data
public class HistoryOrderVo { public class HistoryOrderVo extends OrderInfo {
private OrderInfo info; // private OrderInfo info;
private Map<Integer, List<OrderDetail>> detailMap; private Map<Integer, List<OrderDetail>> detailMap;
} }

View File

@@ -30,7 +30,11 @@ public class OrderDetailSmallVO implements Serializable {
private String skuName; private String skuName;
private BigDecimal num; private BigDecimal num;
private BigDecimal packNum; private BigDecimal packNum;
private BigDecimal returnNum;
private BigDecimal refundNum; private BigDecimal refundNum;
private BigDecimal price;
private BigDecimal payAmount;
private String remark;
} }

View File

@@ -135,19 +135,19 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
throw new ValidateException("订单id或台桌码不可为空"); throw new ValidateException("订单id或台桌码不可为空");
} }
HistoryOrderVo historyOrderVo = new HistoryOrderVo(); HistoryOrderVo historyOrderVo = new HistoryOrderVo();
OrderInfo orderInfo; // OrderInfo orderInfo;
if (orderId == null) { if (orderId == null) {
orderInfo = queryChain() historyOrderVo = queryChain()
.select() .select()
.eq(OrderInfo::getTableCode, tableCode) .eq(OrderInfo::getTableCode, tableCode)
.one(); .eq(OrderInfo::getStatus, OrderStatusEnums.UNPAID.getCode())
.gt(OrderInfo::getCreateTime, DateUtil.offsetDay(new Date(), -1))
.oneAs(HistoryOrderVo.class);
} else { } else {
orderInfo = getById(orderId); historyOrderVo = getOneAs(new QueryWrapper().eq(OrderInfo::getId, orderId), HistoryOrderVo.class);
} }
AssertUtil.isNull(orderInfo, "订单不存在");
historyOrderVo.setInfo(orderInfo);
List<OrderDetail> orderDetails = orderDetailService.queryChain().select() List<OrderDetail> orderDetails = orderDetailService.queryChain().select()
.eq(OrderDetail::getOrderId, orderInfo.getId()).list(); .eq(OrderDetail::getOrderId, historyOrderVo.getId()).list();
Map<Integer, List<OrderDetail>> resultMap = new HashMap<>(); Map<Integer, List<OrderDetail>> resultMap = new HashMap<>();
// 遍历订单详情列表 // 遍历订单详情列表
for (OrderDetail orderDetail : orderDetails) { for (OrderDetail orderDetail : orderDetails) {