mall:优化订单表的设计

pull/2/head
YunaiV 2022-08-05 00:28:40 +08:00
parent 33a01e78bf
commit cfde3dcacb
11 changed files with 216 additions and 89 deletions

View File

@ -0,0 +1,38 @@
package cn.iocoder.yudao.framework.common.enums;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import java.util.Arrays;
/**
*
*
* @author
*/
@RequiredArgsConstructor
@Getter
public enum TerminalEnum implements IntArrayValuable {
MINI_PROGRAM(1, "小程序"),
H5(2, "H5"),
IOS(3, "iOS"),
ANDROID(3, "安卓"),;
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(TerminalEnum::getTerminal).toArray();
/**
*
*/
private final Integer terminal;
/**
*
*/
private final String name;
@Override
public int[] array() {
return ARRAYS;
}
}

View File

@ -13,12 +13,13 @@ import java.util.Arrays;
*/
@Getter
@AllArgsConstructor
public enum DeliveryModeEnum implements IntArrayValuable {
public enum DeliveryTypeEnum implements IntArrayValuable {
SHOP_DELIVERY(1, "商家配送"),
USER_PICK_UP(2, "用户自提");
// TODO 芋艿:英文单词,需要再想下;
EXPRESS(1, "快递发货"),
USER(2, "用户自提"),;
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(DeliveryModeEnum::getMode).toArray();
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(DeliveryTypeEnum::getMode).toArray();
/**
*

View File

@ -88,6 +88,9 @@ public class ProductSkuDO extends BaseDO {
*/
private Double volume;
/**
*
*/
@Data
public static class Property {

View File

@ -0,0 +1,29 @@
package cn.iocoder.yudao.module.trade.enums.order;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
/**
* - 退
*
* @author Sin
*/
@RequiredArgsConstructor
@Getter
public enum TradeOrderItemRefundStatusEnum {
NONE(0, "未申请退款"),
APPLY(1, "申请退款"),
WAIT(2, "等待退款"),
SUCCESS(3, "退款成功");
/**
*
*/
private final Integer status;
/**
*
*/
private final String name;
}

View File

@ -1,26 +1,25 @@
package cn.iocoder.yudao.module.trade.enums.refund;
package cn.iocoder.yudao.module.trade.enums.order;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
/**
* 退 -
* - 退
*
* @author Sin
*/
@RequiredArgsConstructor
@Getter
public enum TradeRefundStatusEnum {
public enum TradeOrderRefundStatusEnum {
NONE(0, "未退款"),
AUDIT(10, "审核中"),
APPROVE(30, "已通过"),
REJECT(40, "不通过"),;
PART(1, "部分退款"),
ALL(2, "全部退款");
/**
*
*/
private final Integer value;
private final Integer status;
/**
*
*/

View File

@ -12,12 +12,11 @@ import lombok.RequiredArgsConstructor;
@Getter
public enum TradeOrderStatusEnum {
WAITING_PAYMENT(10, "待付款"),
WAIT_SHIPMENT(20, "待发货"),
ALREADY_SHIPMENT(30, "待收货"),
WAITING_COMMENT(40, "待评价"),
COMPLETED(50, "成功"),
CLOSED(60, "失败");
WAITING_PAYMENT(0, "待付款"),
WAIT_SHIPMENT(1, "待发货"),
ALREADY_SHIPMENT(2, "待收货"),
COMPLETED(3, "成功"),
CLOSED(4, "失败");
/**
*

View File

@ -0,0 +1,29 @@
package cn.iocoder.yudao.module.trade.enums.order;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
/**
* -
*
* @author Sin
*/
@RequiredArgsConstructor
@Getter
public enum TradeOrderTypeEnum {
NORMAL(0, "普通订单"),
SECKILL(1, "秒杀订单"),
TEAM(2, "拼团订单"),
BARGAIN(3, "砍价订单");
/**
*
*/
private final Integer type;
/**
*
*/
private final String name;
}

View File

@ -1,49 +0,0 @@
package cn.iocoder.yudao.module.trade.dal.dataobject.order;
/**
*
*
* https://jos.jd.com/apilist?apiGroupId=55&apiId=16757&apiName=jingdong.pop.order.coupondetail
*/
// TODO 芋艿 后续在完善
@Deprecated
public class OrderPreferentialDO {
/**
*
*/
private Integer id;
/**
*
*
* 1 -
* 2 -
*/
private Integer type;
// TODO 芋艿 优惠劵编号 or 促销活动编号
/**
*
*/
private Integer orderId;
/**
* SPU
*/
private Integer spuId;
/**
* SKU
*/
private Integer skuId;
/**
*
*/
private Integer quantity;
/**
*
*/
private Integer originTotal;
/**
*
*/
private Integer discountTotal;
}

View File

@ -1,10 +1,12 @@
package cn.iocoder.yudao.module.trade.dal.dataobject.order;
import cn.iocoder.yudao.framework.common.enums.TerminalEnum;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.module.product.enums.delivery.DeliveryModeEnum;
import cn.iocoder.yudao.module.product.enums.delivery.DeliveryTypeEnum;
import cn.iocoder.yudao.module.trade.enums.order.TradeOrderCloseTypeEnum;
import cn.iocoder.yudao.module.trade.enums.order.TradeOrderStatusEnum;
import cn.iocoder.yudao.module.trade.enums.refund.TradeRefundStatusEnum;
import cn.iocoder.yudao.module.trade.enums.order.TradeOrderTypeEnum;
import cn.iocoder.yudao.module.trade.enums.order.TradeOrderRefundStatusEnum;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
@ -38,6 +40,18 @@ public class TradeOrderDO extends BaseDO {
*/
private String sn;
// TODO 芋艿order_type 订单类型
/**
*
*
* {@link TradeOrderTypeEnum}
*/
private Integer type;
/**
*
*
* {@link TerminalEnum}
*/
private Integer terminal;
// /**
// * 店铺编号
// *
@ -72,11 +86,13 @@ public class TradeOrderDO extends BaseDO {
*/
private String remark;
/**
*
*
* {@link TradeOrderStatusEnum#COMPLETED} {@link TradeOrderStatusEnum#CLOSED}
*
*/
private Date endTime;
private Date confirmTakeTime;
/**
*
*/
private Date cancelTime;
// ========== 价格 + 支付基本信息 ==========
/**
@ -85,7 +101,7 @@ public class TradeOrderDO extends BaseDO {
* true -
* false -
*/
private Boolean payed;
private Boolean payed; // TODO payStatus 0 - 待付款1 - 已付款2 - 已退款
/**
*
*/
@ -118,14 +134,6 @@ public class TradeOrderDO extends BaseDO {
* 0
*/
private Integer payPrice;
/**
* 退
*
* 退 {@link #payPrice}
* = payPrice - refundPrice
*/
@Deprecated
private Integer refundPrice;
/**
*
*
@ -141,9 +149,9 @@ public class TradeOrderDO extends BaseDO {
/**
*
*
* {@link DeliveryModeEnum}
* {@link DeliveryTypeEnum}
*/
private Integer deliveryMode;
private Integer deliveryType;
/**
*
*
@ -187,15 +195,22 @@ public class TradeOrderDO extends BaseDO {
/**
* 退
*
* {@link TradeRefundStatusEnum}
* {@link TradeOrderRefundStatusEnum}
*/
private Integer refundStatus;
/**
* 退
*
* 退 {@link #payPrice}
* = payPrice - refundPrice
*/
private Integer refundPrice;
// ========== 营销基本信息 ==========
/**
*
*/
private Integer couponCardId;
private Integer couponId;
// TODO 芋艿,这块还要结合营销和价格计算,在去优化下。
@ -229,6 +244,20 @@ public class TradeOrderDO extends BaseDO {
// TODO ========== 待定字段cf =========
// TODO before_pay_price改价前支付金额
// TODO is_alter_price是否改价
// TODO type订单类型:0-普通订单1-视频号订单
// TODO out_trade_no商户系统内部的订单号 String
// TODO ========== 待定字段lf =========
// TODO integral_amount积分抵扣金额
// TODO shipping_status发货状态
// TODO shipping_time最后新发货时间
// TODO ========== 待定字段lf =========
// TODO settle_id未结算
// TODO settle_amount结算金额
// TODO use_integral使用的积分
// TODO team_found_id: 拼团id
// TODO team_id: 拼团活动id
// TODO delivery_id: 发货单ID
// TODO attach_values: 附带的值(赠送时机,赠送积分成长值什么的)Json格式
}

View File

@ -1,11 +1,16 @@
package cn.iocoder.yudao.module.trade.dal.dataobject.order;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.module.trade.enums.order.TradeOrderItemRefundStatusEnum;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.List;
/**
* DO
*
@ -54,6 +59,11 @@ public class TradeOrderItemDO extends BaseDO {
* ProductSkuDO id
*/
private Integer skuId;
/**
* JSON
*/
@TableField(typeHandler = JacksonTypeHandler.class)
private List<Property> properties;
/**
*
*/
@ -106,6 +116,14 @@ public class TradeOrderItemDO extends BaseDO {
*
*/
private Integer presentTotal; // product_total_amount
// ========== 退款基本信息 ==========
/**
* 退
*
* {@link TradeOrderItemRefundStatusEnum}
*/
private Integer refundStatus;
// 如上字段,举个例子:
// 假设购买三个,即 stock = 3 。
// originPrice = 15
@ -120,6 +138,27 @@ public class TradeOrderItemDO extends BaseDO {
*/
private Integer refundTotal;
/**
*
*/
@Data
public static class Property {
/**
*
*
* ProductPropertyDO id
*/
private Long propertyId;
/**
*
*
* ProductPropertyValueDO id
*/
private Long valueId;
}
// TODO 芋艿basket_date 加入购物车时间;
// TODO 芋艿distribution_card_no 推广员使用的推销卡号
@ -129,4 +168,14 @@ public class TradeOrderItemDO extends BaseDO {
// TODO is_sub是否单独分佣,0-否1-是
// TODO vip_price会员价
// TODO product_type商品类型:0-普通1-秒杀2-砍价3-拼团4-视频号
// TODO 待确定lf
// TODO integral_price积分抵扣的金额
// TODO member_price会员价格
// TODO is_member是否为会员折扣;0-不是;1-是
// TODO member_discount会员折扣(百分比)
// TODO goods_info 商品信息
// TODO integral_price积分抵扣的金额
}

View File

@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.trade.dal.dataobject.refund;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO;
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderItemDO;
import cn.iocoder.yudao.module.trade.enums.refund.TradeRefundStatusEnum;
import cn.iocoder.yudao.module.trade.enums.order.TradeOrderRefundStatusEnum;
import cn.iocoder.yudao.module.trade.enums.refund.TradeRefundTypeEnum;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
@ -18,7 +18,7 @@ import java.util.List;
/**
* 退 {@link TradeOrderDO} 退
*/
// TODO 芋艿:需要调整下每个字段的命名
// TODO 芋艿:需要调整下每个字段的命名;未完全实现;
@TableName(value = "trade_refund")
@Data
@EqualsAndHashCode(callSuper = true)
@ -39,7 +39,7 @@ public class TradeRefundDO extends BaseDO {
/**
* 退
*
* {@link TradeRefundStatusEnum}
* {@link TradeOrderRefundStatusEnum}
*/
private Integer status;
// /**