订单下单

This commit is contained in:
2025-02-21 18:37:58 +08:00
parent 16ef1edc6b
commit 03217ee2ab
21 changed files with 466 additions and 228 deletions

View File

@@ -1,151 +0,0 @@
package com.czg.order.dto;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import com.alibaba.fastjson2.annotation.JSONField;
import java.io.Serial;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 订单详情 实体类。
*
* @author ww
* @since 2025-02-14
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class OrderDetailDTO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
private Long id;
private Long orderId;
private Long shopId;
private Long productId;
private String productImg;
private String productName;
/**
* 商品类型:单规格商品 single 多规格商品 sku 套餐商品 package 称重商品 weigh 团购券 coupon
*/
private String productType;
private Long skuId;
private String skuName;
/**
* 用餐模式 堂食 dine-in 外带 take-out 外卖 take-away
*/
private String dineMode;
/**
* 单价:原价/会员价/临时改价
*/
private BigDecimal price;
/**
* 折扣金额
*/
private BigDecimal discountAmount;
/**
* 打包费
*/
private BigDecimal packAmount;
/**
* 总金额/实付金额,包含打包费 不包括优惠金额
*/
private BigDecimal payAmount;
/**
* 已退款金额
*/
private BigDecimal returnAmount;
/**
* 数量
*/
private BigDecimal num;
/**
* 退菜数量(不管价格)
*/
private BigDecimal returnNum;
/**
* 退单数量
*/
private BigDecimal refundNum;
/**
* 退款单号
*/
private String refundNo;
/**
* 临时改价备注
*/
private String discountSaleNote;
/**
* 状态: in-production 制作中;wait-out 待取餐;refunding 退款中; part-refund 部分退单; refund-退单; done 完成;
*/
private String status;
/**
* 当前下单次数
*/
private Integer placeNum;
/**
* 是否是临时菜品
*/
private Integer isTemporary;
/**
* 是否打票
*/
private Integer isPrint;
/**
* 是否等叫
*/
private Integer isWaitCall;
/**
* 套餐商品选择信息
*/
private String proGroupInfo;
/**
* 备注
*/
private String remark;
/**
* 退款备注
*/
private String refundRemark;
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime updateTime;
}

View File

@@ -3,10 +3,14 @@ package com.czg.order.dto;
import cn.hutool.core.util.StrUtil;
import jakarta.validation.constraints.NotBlank;
import lombok.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
/**
* 订单表 实体类。
@@ -27,6 +31,8 @@ public class OrderInfoAddDTO implements Serializable {
private Long shopId;
private Long userId;
private Long staffId;
/**
* 用餐人数
*/
@@ -61,12 +67,16 @@ public class OrderInfoAddDTO implements Serializable {
/**
* 用户使用的卡券
*/
private String couponInfoList;
private List<Long> couponList;
/**
* 订单金额
*/
private BigDecimal orderAmount;
/**
* 抹零金额 减免多少钱
*/
private BigDecimal roundAmount;
/**
* 积分抵扣金额(tb_points_basic_setting表)
@@ -76,7 +86,7 @@ public class OrderInfoAddDTO implements Serializable {
/**
* 使用的积分数量 (扣除各类折扣 enable_deduction后使用)
*/
private BigDecimal pointsNum;
private Integer pointsNum;
/**
* 台桌Id
@@ -91,7 +101,12 @@ public class OrderInfoAddDTO implements Serializable {
private String orderType;
/**
* 平台类型 pc 收银机客户端 wechat 微信小程序 alipay 支付宝小程序 admin-pc PC管理端 admin-app APP管理端
* 平台类型
* PC 收银机客户端
* WX 微信小程序
* ALI 支付宝小程序
* WEB PC管理端
* APP APP管理端
*/
private String platformType;
@@ -99,10 +114,10 @@ public class OrderInfoAddDTO implements Serializable {
* 用餐模式 堂食 dine-in 外带 take-out 外卖 take-away
*/
@NotBlank(message = "用餐模式不能为空")
private String eatModel;
private String dineMode;
/**
* 支付模式: afterPay 后付费 normal 正常模式
* 支付模式: afterPay 后付费 normal 正常模式 buyer 挂账模式
*/
@NotBlank(message = "付款模式不能为空")
private String payMode;
@@ -116,6 +131,10 @@ public class OrderInfoAddDTO implements Serializable {
* 当前订单下单次数
*/
private Integer placeNum;
/**
* 挂账人
*/
private Long creditBuyerId;
/**
* 是否等叫 0 否 1 等叫
@@ -130,11 +149,11 @@ public class OrderInfoAddDTO implements Serializable {
return seatNum == null ? 0 : seatNum;
}
public String getEatModel() {
return StrUtil.isBlank(eatModel) ? "dine-in" : eatModel;
public String getDineMode() {
return StrUtil.isBlank(dineMode) ? "dine-in" : dineMode;
}
public BigDecimal getPointsNum() {
return pointsNum == null ? BigDecimal.ZERO : pointsNum;
public Integer getPointsNum() {
return pointsNum == null ? 0 : pointsNum;
}
}

View File

@@ -60,6 +60,10 @@ public class OrderInfoDTO implements Serializable {
* 订单原金额 不含折扣价格
*/
private BigDecimal originAmount;
/**
* 抹零金额 减免多少钱
*/
private BigDecimal roundAmount;
/**
* 订单金额 (扣除各类折扣)
@@ -79,7 +83,7 @@ public class OrderInfoDTO implements Serializable {
/**
* 使用的积分数量
*/
private BigDecimal pointsNum;
private Integer pointsNum;
/**
* 商品优惠券抵扣金额
@@ -104,7 +108,7 @@ public class OrderInfoDTO implements Serializable {
/**
* 折扣比例
*/
private BigDecimal discountRatio;
private String discountRatio;
/**
* 打包费
@@ -139,7 +143,7 @@ public class OrderInfoDTO implements Serializable {
private String dineMode;
/**
* 支付模式: afterPay 后付费 normal 正常模式
* 支付模式: afterPay 后付费 normal 正常模式 buyer 挂账模式
*/
private String payMode;

View File

@@ -65,6 +65,10 @@ public class CashierCart implements Serializable {
* 数量
*/
private BigDecimal number;
/**
* 打包数量
*/
private BigDecimal packNumber;
/**
* 台桌桌码
@@ -77,11 +81,6 @@ public class CashierCart implements Serializable {
*/
private String tableCode;
/**
* 是否打包
*/
private Integer isPack;
/**
* 是否赠送
*/

View File

@@ -4,6 +4,7 @@ import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@@ -53,28 +54,23 @@ public class OrderDetail implements Serializable {
private String skuName;
/**
* 用餐模式 堂食 dine-in 外带 take-out 外卖 take-away
*/
private String dineMode;
/**
* 单价:原价/会员价/临时改价
*/
private BigDecimal price;
/**
* 折扣金额
* 折扣金额(商品优惠券抵扣金额)
*/
private BigDecimal discountAmount;
/**
* 打包费
* 打包费(单价)
*/
private BigDecimal packAmount;
/**
* 总金额/实付金额,包含打包费 不包括优惠金额
* 支付金额,去除优惠券优惠金额的商品金额 不包含打包费
*/
private BigDecimal payAmount;
@@ -87,6 +83,14 @@ public class OrderDetail implements Serializable {
* 数量
*/
private BigDecimal num;
/**
* 打包数量
*/
private BigDecimal packNumber;
/**
* 优惠券抵扣数量
*/
private BigDecimal couponNum;
/**
* 退菜数量(不管价格)
@@ -109,7 +113,7 @@ public class OrderDetail implements Serializable {
private String discountSaleNote;
/**
* 状态: in-production 制作中;wait-out 待取餐;refunding 退款中; part-refund 部分退单; refund-退单; done 完成;
* 状态: in-production 制作中;wait-out 待取餐;refunding 退款中; part-refund 部分退单; refund-退单; done 完成;
*/
private String status;
@@ -117,7 +121,6 @@ public class OrderDetail implements Serializable {
* 当前下单次数
*/
private Integer placeNum;
/**
* 是否是临时菜品
*/

View File

@@ -1,5 +1,6 @@
package com.czg.order.entity;
import cn.hutool.core.util.StrUtil;
import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
@@ -64,6 +65,10 @@ public class OrderInfo implements Serializable {
* 订单原金额 不含折扣价格
*/
private BigDecimal originAmount;
/**
* 抹零金额 减免多少钱
*/
private BigDecimal roundAmount;
/**
* 订单金额 (扣除各类折扣)
@@ -83,7 +88,7 @@ public class OrderInfo implements Serializable {
/**
* 使用的积分数量
*/
private BigDecimal pointsNum;
private Integer pointsNum;
/**
* 商品优惠券抵扣金额
@@ -108,7 +113,7 @@ public class OrderInfo implements Serializable {
/**
* 折扣比例
*/
private BigDecimal discountRatio;
private String discountRatio;
/**
* 打包费
@@ -143,7 +148,7 @@ public class OrderInfo implements Serializable {
private String dineMode;
/**
* 支付模式: afterPay 后付费 normal 正常模式
* 支付模式: afterPay 后付费 normal 正常模式 buyer 挂账模式
*/
private String payMode;
@@ -253,4 +258,47 @@ public class OrderInfo implements Serializable {
*/
private Integer isDel;
public BigDecimal getOriginAmount() {
return originAmount == null ? BigDecimal.ZERO : originAmount;
}
public BigDecimal getRoundAmount() {
return roundAmount == null ? BigDecimal.ZERO : roundAmount;
}
public BigDecimal getOrderAmount() {
return orderAmount == null ? BigDecimal.ZERO : orderAmount;
}
public BigDecimal getPointsDiscountAmount() {
return pointsDiscountAmount == null ? BigDecimal.ZERO : pointsDiscountAmount;
}
public Integer getPointsNum() {
return pointsNum == null ? 0 : pointsNum;
}
public BigDecimal getProductCouponDiscountAmount() {
return productCouponDiscountAmount == null ? BigDecimal.ZERO : productCouponDiscountAmount;
}
public String getCouponInfoList() {
return StrUtil.isBlank(couponInfoList) ? "" : couponInfoList;
}
public BigDecimal getFullCouponDiscountAmount() {
return fullCouponDiscountAmount == null ? BigDecimal.ZERO : fullCouponDiscountAmount;
}
public BigDecimal getDiscountAmount() {
return discountAmount == null ? BigDecimal.ZERO : discountAmount;
}
public String getDiscountRatio() {
return discountRatio == null ? "" : discountRatio + ",";
}
public BigDecimal getPackFee() {
return packFee == null ? BigDecimal.ZERO : packFee;
}
}

View File

@@ -1,9 +1,10 @@
package com.czg.order.service;
import com.czg.order.entity.CashierCart;
import com.czg.order.entity.OrderDetail;
import com.mybatisflex.core.service.IService;
import com.czg.order.entity.CashierCart;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import java.util.List;
@@ -17,7 +18,10 @@ public interface CashierCartService extends IService<CashierCart> {
/**
* 获取到的结果 是针对tb_order_detail的
*
* @param tableCode 桌码
* @param isUseVip 是否使用会员价
* @param placeNum 第几次下单
*/
List<OrderDetail> getCartByTableCode(@NotBlank String tableCode);
List<OrderDetail> getCartByTableCode(@NotBlank String tableCode, @NotNull Integer isUseVip,@NotNull Integer placeNum);
}

View File

@@ -3,6 +3,8 @@ package com.czg.order.service;
import com.mybatisflex.core.service.IService;
import com.czg.order.entity.OrderDetail;
import java.util.List;
/**
* 订单详情 服务层。
*
@@ -11,4 +13,6 @@ import com.czg.order.entity.OrderDetail;
*/
public interface OrderDetailService extends IService<OrderDetail> {
void createOrderDetails(Long orderId, List<OrderDetail> orderDetails);
}

View File

@@ -5,7 +5,6 @@ import com.czg.order.dto.OrderInfoAddDTO;
import com.czg.order.dto.OrderInfoQueryDTO;
import com.czg.order.entity.OrderInfo;
import com.czg.order.enums.PayEnums;
import com.czg.order.vo.OrderInfoCreateVo;
import com.czg.order.vo.OrderInfoVo;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.service.IService;
@@ -24,7 +23,7 @@ import java.time.LocalDateTime;
public interface OrderInfoService extends IService<OrderInfo> {
Page<OrderInfoVo> getOrderByPage(OrderInfoQueryDTO param);
OrderInfoCreateVo createOrder(OrderInfoAddDTO param);
OrderInfo createOrder(OrderInfoAddDTO param);
void payCallBackOrder(@NotBlank String orderNo, @NotNull JSONObject resultJson);

View File

@@ -29,6 +29,7 @@ public class OrderDetailSmallVO implements Serializable {
private String productName;
private String skuName;
private BigDecimal num;
private BigDecimal packNum;
private BigDecimal refundNum;
}

View File

@@ -1,11 +0,0 @@
package com.czg.order.vo;
import lombok.Data;
/**
* @author ww
* @description
*/
@Data
public class OrderInfoCreateVo {
}