mall:初始化 trade 表结构

pull/2/head
YunaiV 2022-08-01 00:53:16 +08:00
parent 2b71a1588c
commit 96e2a27d07
14 changed files with 777 additions and 7 deletions

View File

@ -29,10 +29,6 @@
<groupId>cn.iocoder.boot</groupId> <groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-biz-operatelog</artifactId> <artifactId>yudao-spring-boot-starter-biz-operatelog</artifactId>
</dependency> </dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-biz-weixin</artifactId>
</dependency>
<dependency> <dependency>
<groupId>cn.iocoder.boot</groupId> <groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-biz-tenant</artifactId> <artifactId>yudao-spring-boot-starter-biz-tenant</artifactId>

View File

@ -41,11 +41,11 @@ public class ProductCommentDO extends BaseDO {
*/ */
private Long spuId; private Long spuId;
/** /**
* *
* *
* OrderItemDO id * OrderItemDO id
*/ */
private Long orderItemId; private Long tradeOrderItemId;
/** /**
* *

View File

@ -5,6 +5,7 @@ import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.module.product.dal.dataobject.brand.ProductBrandDO; import cn.iocoder.yudao.module.product.dal.dataobject.brand.ProductBrandDO;
import cn.iocoder.yudao.module.product.dal.dataobject.category.ProductCategoryDO; import cn.iocoder.yudao.module.product.dal.dataobject.category.ProductCategoryDO;
import cn.iocoder.yudao.module.product.dal.dataobject.delivery.DeliveryTemplateDO; import cn.iocoder.yudao.module.product.dal.dataobject.delivery.DeliveryTemplateDO;
import cn.iocoder.yudao.module.product.dal.dataobject.shop.ShopDO;
import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO;
import cn.iocoder.yudao.module.product.enums.delivery.DeliveryModeEnum; import cn.iocoder.yudao.module.product.enums.delivery.DeliveryModeEnum;
import com.baomidou.mybatisplus.annotation.KeySequence; import com.baomidou.mybatisplus.annotation.KeySequence;

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 TradeOrderCloseTypeEnum {
PAY_TIMEOUT(10, "超时未支付"),
REFUND_CLOSE(20, "退款关闭"),
MEMBER_CANCEL(30, "买家取消"),
PAY_ON_DELIVERY(40, "已通过货到付款交易"),;
/**
*
*/
private final Integer type;
/**
*
*/
private final String name;
}

View File

@ -0,0 +1,31 @@
package cn.iocoder.yudao.module.trade.enums.order;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
/**
* -
*
* @author Sin
*/
@RequiredArgsConstructor
@Getter
public enum TradeOrderStatusEnum {
WAITING_PAYMENT(10, "待付款"),
WAIT_SHIPMENT(20, "待发货"),
ALREADY_SHIPMENT(30, "待收货"),
WAITING_COMMENT(40, "待评价"),
COMPLETED(50, "成功"),
CLOSED(60, "失败");
/**
*
*/
private final Integer status;
/**
*
*/
private final String name;
}

View File

@ -0,0 +1,29 @@
package cn.iocoder.yudao.module.trade.enums.refund;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
/**
* 退 -
*
* @author Sin
*/
@RequiredArgsConstructor
@Getter
public enum TradeRefundStatusEnum {
NONE(0, "未退款"),
AUDIT(10, "审核中"),
APPROVE(30, "已通过"),
REJECT(40, "不通过"),;
/**
*
*/
private final Integer value;
/**
*
*/
private final String name;
}

View File

@ -0,0 +1,27 @@
package cn.iocoder.yudao.module.trade.enums.refund;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
/**
* 退 -
*
* @author Sin
*/
@RequiredArgsConstructor
@Getter
public enum TradeRefundTypeEnum {
REFUND(10, "退款"),
RETURN_AND_REFUND(20, "退货退款");
/**
*
*/
private final Integer type;
/**
*
*/
private final String name;
}

View File

@ -23,6 +23,43 @@
<artifactId>yudao-module-trade-api</artifactId> <artifactId>yudao-module-trade-api</artifactId>
<version>${revision}</version> <version>${revision}</version>
</dependency> </dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-product-api</artifactId>
<version>${revision}</version>
</dependency>
<!-- 业务组件 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-biz-operatelog</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-biz-tenant</artifactId>
</dependency>
<!-- Web 相关 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-excel</artifactId>
</dependency>
<!-- DB 相关 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-mybatis</artifactId>
</dependency>
<!-- Test 测试相关 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-test</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -0,0 +1,90 @@
package cn.iocoder.yudao.module.trade.dal.dataobject.cart;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* DO
*/
@TableName("trade_cart_item")
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
public class CartItemDO extends BaseDO {
// ========= 基础字段 BEGIN =========
/**
*
*/
private Long id;
/**
*
*/
private Boolean selected;
/**
*
*/
private Date buyTime; // basket_date
// ========= 基础字段 END =========
// ========= 买家信息 BEGIN =========
// /**
// * 店铺编号
// *
// * 关联 {@link ShopDO#getId()} TODO 芋艿:多店铺,暂不考虑
// */
// private Long shopId;
/**
*
*
* MemberUserDO id
*/
private Long userId;
// ========= 买家信息 END =========
// ========= 商品信息 BEGIN =========
/**
* SPU
*
* ProductSpuDO id
*/
private Long spuId;
/**
* SKU
*
* ProductSkuDO id
*/
private Long skuId;
/**
*
*/
private Integer stock;
// ========= 商品信息 END =========
// ========= 优惠信息 BEGIN =========
// /**
// * 商品营销活动编号
// */
// private Long activityId; // discount_id
// /**
// * 商品营销活动类型
// */
// private Integer activityType;
// ========= 优惠信息 END =========
// TODO 芋艿distribution_card_no
}

View File

@ -0,0 +1,49 @@
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

@ -0,0 +1,202 @@
package cn.iocoder.yudao.module.trade.dal.dataobject.order;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.module.product.enums.delivery.DeliveryModeEnum;
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 com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import java.util.Date;
/**
* DO
*
* @author
*/
@TableName("trade_order")
@KeySequence("trade_order_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class TradeOrderDO extends BaseDO {
// ========== 订单基本信息 ==========
/**
*
*/
private Integer id;
/**
*
*
* 1146347329394184195
*/
private String sn;
// TODO 芋艿order_type 订单类型
// /**
// * 店铺编号
// *
// * 关联 {@link ShopDO#getId()} TODO 芋艿:多店铺,暂不考虑
// */
// private Long shopId;
/**
*
*
* MemberUserDO id
*/
private Long userId;
/**
*
*
* {@link TradeOrderStatusEnum}
*/
private Integer status;
/**
*
*
* {@link TradeOrderCloseTypeEnum}
*/
private Integer closeType;
// TODO 芋艿:要不要存储 prod_name 购买的商品名门?
/**
*
*/
private Integer productCount;
/**
*
*/
private String remark;
/**
*
*
* {@link TradeOrderStatusEnum#COMPLETED} {@link TradeOrderStatusEnum#CLOSED}
*/
private Date endTime;
// ========== 价格 + 支付基本信息 ==========
/**
*
*
* true -
* false -
*/
private Boolean payed;
/**
*
*/
private Date payTime;
// TODO 芋艿delete_status 用户订单删除状态0 - 未删除1 - 回收站2 - 永久删除
// ========== 价格 + 支付基本信息 ==========
/**
*
*/
private Integer buyPrice; // total
/**
*
*/
private Integer discountPrice; // reduce_amount
/**
* ()
*/
private Integer logisticsPrice; // freight_amount
/**
*
*
* buyPrice + logisticsPrice - discountPrice = presentPrice
*/
private Integer presentPrice; // actual_total
/**
*
*
* 0
*/
private Integer payPrice;
/**
* 退
*
* 退 {@link #payPrice}
* = payPrice - refundPrice
*/
@Deprecated
private Integer refundPrice;
/**
*
*
* pay-module-biz PayOrderDO id
*/
private Long payOrderId;
/**
*
*/
private Integer payType;
// ========== 收件 + 物流基本信息 ==========
/**
*
*
* {@link DeliveryModeEnum}
*/
private Integer deliveryMode;
/**
*
*
* DeliveryTemplateDO id
*/
private Long deliveryTemplateId; // dvy_id
/**
*
*/
private String expressNo; // dvy_flow_id
/**
*
*/
private Date deliveryTime;
/**
*
*/
private Date receiveTime;
/**
*
*/
private String receiverName;
/**
*
*/
private String receiverMobile;
/**
*
*/
private Integer receiverAreaId;
/**
*
*/
private Integer receiverPostCode;
/**
*
*/
private String receiverDetailAddress;
// ========== 退款基本信息 ==========
/**
* 退
*
* {@link TradeRefundStatusEnum}
*/
private Integer refundStatus;
// ========== 营销基本信息 ==========
/**
*
*/
private Integer couponCardId;
// TODO 芋艿,这块还要结合营销和价格计算,在去优化下。
}

View File

@ -0,0 +1,125 @@
package cn.iocoder.yudao.module.trade.dal.dataobject.order;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* DO
*
* @author
*/
@TableName(value = "trade_order_item")
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
public class TradeOrderItemDO extends BaseDO {
// ========== 订单项基本信息 ==========
/**
*
*/
private Integer id;
// /**
// * 店铺编号
// *
// * 关联 {@link ShopDO#getId()} TODO 芋艿:多店铺,暂不考虑
// */
// private Long shopId;
/**
*
*
* MemberUserDO id
*/
private Long userId;
/**
*
*
* {@link TradeOrderDO#getId()}
*/
private Long orderId;
// ========== 商品基本信息 ==========
/**
* SPU
*
* ProductSpuDO id
*/
private Long spuId;
/**
* SKU
*
* ProductSkuDO id
*/
private Integer skuId;
/**
*
*/
private String name;
/**
*
*/
private String picUrl;
/**
*
*/
private Integer stock;
/**
*
*
* false -
* true -
*/
private Boolean commented;
// ========== 价格 + 支付基本信息 ==========
/**
*
*/
private Integer originPrice; // price
/**
*
*/
private Integer buyPrice;
/**
*
*/
private Integer presentPrice;
/**
*
*
* {@link #presentTotal}
*/
private Integer buyTotal;
/**
*
*/
private Integer discountTotal;
/**
*
*
* presentPrice * stock presentTotal
*
* presentPrice = 8.33 stock = 3 presentTotal 24.99 25
*
*/
private Integer presentTotal; // product_total_amount
// 如上字段,举个例子:
// 假设购买三个,即 stock = 3 。
// originPrice = 15
// 使用限时折扣单品优惠8 折buyPrice = 12
// 开始算总的价格
// buyTotal = buyPrice * stock = 12 * 3 = 36
// discountTotal ,假设有满减送(分组优惠)满 20 减 10 ,并且使用优惠劵满 1.01 减 1 ,则 discountTotal = 10 + 1 = 11
// presentTotal = buyTotal - discountTotal = 24 - 11 = 13
// 最终 presentPrice = presentTotal / stock = 13 / 3 = 4.33
/**
* 退
*/
private Integer refundTotal;
// TODO 芋艿basket_date 加入购物车时间;
// TODO 芋艿distribution_card_no 推广员使用的推销卡号
}

View File

@ -0,0 +1,154 @@
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.refund.TradeRefundTypeEnum;
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.Date;
import java.util.List;
/**
* 退 {@link TradeOrderDO} 退
*/
// TODO 芋艿:需要调整下每个字段的命名
@TableName(value = "trade_refund")
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
public class TradeRefundDO extends BaseDO {
/**
* 退
*/
@Deprecated
private Long id;
/**
* 退
*
* 1146347329394184195
*/
private String sn;
/**
* 退
*
* {@link TradeRefundStatusEnum}
*/
private Integer status;
// /**
// * 店铺编号
// *
// * 关联 {@link ShopDO#getId()} TODO 芋艿:多店铺,暂不考虑
// */
// private Long shopId;
/**
*
*
* MemberUserDO id
*/
private Long userId;
/**
*
*/
private String userMobile;
/**
*
*
* {@link TradeRefundTypeEnum}
*/
private Integer type;
/**
*
*/
private String reasonMemo; // buyer_msg
/**
*
*
*
*/
@TableField(typeHandler = JacksonTypeHandler.class)
private List<String> reasonPicUrls; // photo_files
// ========== 商家相关 ==========
/**
*
*/
private Date handleTime; // handel_time
/**
*
*/
private String rejectReasonMemo; // seller_msg
// ========== 交易订单相关 ==========
/**
*
*
* {@link TradeOrderDO#getId()}
*/
private Long tradeOrderId;
/**
*
*
* {@link TradeOrderItemDO#getId()}
* 退 0
*/
private Long tradeOrderItemId;
/**
* SKU
*/
@Deprecated
private Integer skuId;
/**
* 退
*/
private Integer stock; // goods_num
// ========== 退款相关 ==========
/**
* 退
*/
private Integer refundPrice; // refund_amount
/**
* 退
*
* pay-module-biz 退 PayRefundDO id
*/
private Long payRefundId;
// TODO 芋艿看看是否有必要冗余order_number、order_amount、flow_trade_no、out_refund_no、pay_type、return_money_sts、refund_time
// ========== 退货相关 ==========
/**
* 退
*
* ExpressDO id
*/
private Long returnExpressId; // express_name
/**
* 退
*/
private String returnExpressNo; // express_no
/**
* 退
*/
private Date returnDate; // ship_time
// ========== 收获相关 ==========
/**
*
*/
private String receiveMemo; // receive_message
/**
*
*/
private Date receiveDate; // receive_time
}

View File

@ -31,7 +31,7 @@ public class AddressDO extends BaseDO {
/** /**
* *
*/ */
private String receiver; private String name;
/** /**
* *
*/ */