Commit face9cae76602ff4bfba88affc585199218e4163

Authored by YunaiV
1 parent 10caa6e8

mall:调整 trade 的接口

Showing 28 changed files with 881 additions and 141 deletions
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/category/ProductCategoryDO.java
@@ -38,12 +38,6 @@ public class ProductCategoryDO extends BaseDO { @@ -38,12 +38,6 @@ public class ProductCategoryDO extends BaseDO {
38 * 父分类编号 38 * 父分类编号
39 */ 39 */
40 private Long parentId; 40 private Long parentId;
41 -// /**  
42 -// * 店铺编号  
43 -// *  
44 -// * 关联 {@link ShopDO#getId()} TODO 芋艿:多店铺,暂不考虑  
45 -// */  
46 -// private Long shopId;  
47 /** 41 /**
48 * 分类名称 42 * 分类名称
49 */ 43 */
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/group/ProductGroupBindDO.java
@@ -27,12 +27,6 @@ public class ProductGroupBindDO extends BaseDO { @@ -27,12 +27,6 @@ public class ProductGroupBindDO extends BaseDO {
27 */ 27 */
28 @TableId 28 @TableId
29 private Long id; 29 private Long id;
30 -// /**  
31 -// * 店铺编号  
32 -// *  
33 -// * 关联 {@link ShopDO#getId()} TODO 芋艿:多店铺,暂不考虑  
34 -// */  
35 -// private Long shopId;  
36 /** 30 /**
37 * 商品分组编号 31 * 商品分组编号
38 * 32 *
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/group/ProductGroupDO.java
@@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.product.dal.dataobject.group; @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.product.dal.dataobject.group;
2 2
3 import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; 3 import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
4 import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; 4 import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
5 -import cn.iocoder.yudao.module.product.dal.dataobject.shop.ShopDO;  
6 import cn.iocoder.yudao.module.product.enums.group.ProductGroupStyleEnum; 5 import cn.iocoder.yudao.module.product.enums.group.ProductGroupStyleEnum;
7 import com.baomidou.mybatisplus.annotation.KeySequence; 6 import com.baomidou.mybatisplus.annotation.KeySequence;
8 import com.baomidou.mybatisplus.annotation.TableId; 7 import com.baomidou.mybatisplus.annotation.TableId;
@@ -29,12 +28,6 @@ public class ProductGroupDO extends BaseDO { @@ -29,12 +28,6 @@ public class ProductGroupDO extends BaseDO {
29 */ 28 */
30 @TableId 29 @TableId
31 private Long id; 30 private Long id;
32 -// /**  
33 -// * 店铺编号  
34 -// *  
35 -// * 关联 {@link ShopDO#getId()} TODO 芋艿:多店铺,暂不考虑  
36 -// */  
37 -// private Long shopId;  
38 /** 31 /**
39 * 分组名称 32 * 分组名称
40 */ 33 */
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/property/ProductPropertyDO.java
@@ -27,12 +27,6 @@ public class ProductPropertyDO extends BaseDO { @@ -27,12 +27,6 @@ public class ProductPropertyDO extends BaseDO {
27 */ 27 */
28 @TableId 28 @TableId
29 private Long id; 29 private Long id;
30 -// /**  
31 -// * 店铺编号  
32 -// *  
33 -// * 关联 {@link ShopDO#getId()} TODO 芋艿:多店铺,暂不考虑  
34 -// */  
35 -// private Long shopId;  
36 /** 30 /**
37 * 规格名称 31 * 规格名称
38 */ 32 */
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/search/ProductHotSearchDO.java
@@ -34,11 +34,5 @@ public class ProductHotSearchDO extends BaseDO { @@ -34,11 +34,5 @@ public class ProductHotSearchDO extends BaseDO {
34 * 内容 34 * 内容
35 */ 35 */
36 private String content; 36 private String content;
37 -// /**  
38 -// * 店铺编号  
39 -// *  
40 -// * 关联 {@link ShopDO#getId()} TODO 芋艿:多店铺,暂不考虑  
41 -// */  
42 -// private Long shopId;  
43 37
44 } 38 }
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/spu/ProductSpuDO.java
@@ -36,13 +36,6 @@ public class ProductSpuDO extends BaseDO { @@ -36,13 +36,6 @@ public class ProductSpuDO extends BaseDO {
36 @TableId 36 @TableId
37 private Long id; 37 private Long id;
38 38
39 -// /**  
40 -// * 店铺编号  
41 -// *  
42 -// * 关联 {@link ShopDO#getId()} TODO 芋艿:多店铺,暂不考虑  
43 -// */  
44 -// private Long shopId;  
45 -  
46 // ========== 基本信息 ========= 39 // ========== 基本信息 =========
47 40
48 /** 41 /**
@@ -215,4 +208,9 @@ public class ProductSpuDO extends BaseDO { @@ -215,4 +208,9 @@ public class ProductSpuDO extends BaseDO {
215 208
216 // TODO poster:商品自定义海报 209 // TODO poster:商品自定义海报
217 210
  211 + // TODO ========== 待定字段:laoji =========
  212 + // TODO productType 1 - 普通商品 2 - 预售商品;可能和 type 合并不错
  213 + // TODO productUnit 商品单位
  214 + // TODO extJson 扩展信息;例如说,预售商品的信息
  215 +
218 } 216 }
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/sku/ProductSkuMapper.java
@@ -22,7 +22,7 @@ public interface ProductSkuMapper extends BaseMapperX<ProductSkuDO> { @@ -22,7 +22,7 @@ public interface ProductSkuMapper extends BaseMapperX<ProductSkuDO> {
22 .eqIfPresent(ProductSkuDO::getSpuId, reqVO.getSpuId()) 22 .eqIfPresent(ProductSkuDO::getSpuId, reqVO.getSpuId())
23 .eqIfPresent(ProductSkuDO::getProperties, reqVO.getProperties()) 23 .eqIfPresent(ProductSkuDO::getProperties, reqVO.getProperties())
24 .eqIfPresent(ProductSkuDO::getPrice, reqVO.getPrice()) 24 .eqIfPresent(ProductSkuDO::getPrice, reqVO.getPrice())
25 - .eqIfPresent(ProductSkuDO::getOriginalPrice, reqVO.getOriginalPrice()) 25 +// .eqIfPresent(ProductSkuDO::getOriginalPrice, reqVO.getOriginalPrice())
26 // .eqIfPresent(ProductSkuDO::getCostPrice, reqVO.getCostPrice()) 26 // .eqIfPresent(ProductSkuDO::getCostPrice, reqVO.getCostPrice())
27 .eqIfPresent(ProductSkuDO::getBarCode, reqVO.getBarCode()) 27 .eqIfPresent(ProductSkuDO::getBarCode, reqVO.getBarCode())
28 .eqIfPresent(ProductSkuDO::getPicUrl, reqVO.getPicUrl()) 28 .eqIfPresent(ProductSkuDO::getPicUrl, reqVO.getPicUrl())
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/spu/ProductSpuMapper.java
@@ -24,7 +24,7 @@ public interface ProductSpuMapper extends BaseMapperX<ProductSpuDO> { @@ -24,7 +24,7 @@ public interface ProductSpuMapper extends BaseMapperX<ProductSpuDO> {
24 .eqIfPresent(ProductSpuDO::getPicUrls, reqVO.getPicUrls()) 24 .eqIfPresent(ProductSpuDO::getPicUrls, reqVO.getPicUrls())
25 .eqIfPresent(ProductSpuDO::getSort, reqVO.getSort()) 25 .eqIfPresent(ProductSpuDO::getSort, reqVO.getSort())
26 // .eqIfPresent(ProductSpuDO::getLikeCount, reqVO.getLikeCount()) 26 // .eqIfPresent(ProductSpuDO::getLikeCount, reqVO.getLikeCount())
27 - .eqIfPresent(ProductSpuDO::getPrice, reqVO.getPrice()) 27 +// .eqIfPresent(ProductSpuDO::getPrice, reqVO.getPrice())
28 // .eqIfPresent(ProductSpuDO::getQuantity, reqVO.getQuantity()) 28 // .eqIfPresent(ProductSpuDO::getQuantity, reqVO.getQuantity())
29 .eqIfPresent(ProductSpuDO::getStatus, reqVO.getStatus()) 29 .eqIfPresent(ProductSpuDO::getStatus, reqVO.getStatus())
30 .betweenIfPresent(ProductSpuDO::getCreateTime, reqVO.getCreateTime()) 30 .betweenIfPresent(ProductSpuDO::getCreateTime, reqVO.getCreateTime())
yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/sku/SkuServiceImplTest.java
@@ -105,7 +105,7 @@ public class SkuServiceImplTest extends BaseDbUnitTest { @@ -105,7 +105,7 @@ public class SkuServiceImplTest extends BaseDbUnitTest {
105 o.setSpuId(null); 105 o.setSpuId(null);
106 o.setProperties(null); 106 o.setProperties(null);
107 o.setPrice(null); 107 o.setPrice(null);
108 - o.setOriginalPrice(null); 108 +// o.setOriginalPrice(null);
109 // o.setCostPrice(null); 109 // o.setCostPrice(null);
110 o.setBarCode(null); 110 o.setBarCode(null);
111 o.setPicUrl(null); 111 o.setPicUrl(null);
@@ -120,7 +120,7 @@ public class SkuServiceImplTest extends BaseDbUnitTest { @@ -120,7 +120,7 @@ public class SkuServiceImplTest extends BaseDbUnitTest {
120 // 测试 price 不匹配 120 // 测试 price 不匹配
121 ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setPrice(null))); 121 ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setPrice(null)));
122 // 测试 originalPrice 不匹配 122 // 测试 originalPrice 不匹配
123 - ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setOriginalPrice(null))); 123 +// ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setOriginalPrice(null)));
124 // 测试 costPrice 不匹配 124 // 测试 costPrice 不匹配
125 // ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setCostPrice(null))); 125 // ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setCostPrice(null)));
126 // 测试 barCode 不匹配 126 // 测试 barCode 不匹配
yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImplTest.java
@@ -110,7 +110,7 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest { @@ -110,7 +110,7 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest {
110 o.setPicUrls(null); 110 o.setPicUrls(null);
111 o.setSort(null); 111 o.setSort(null);
112 // o.setLikeCount(null); 112 // o.setLikeCount(null);
113 - o.setPrice(null); 113 +// o.setPrice(null);
114 // o.setQuantity(null); 114 // o.setQuantity(null);
115 o.setStatus(null); 115 o.setStatus(null);
116 o.setCreateTime(null); 116 o.setCreateTime(null);
@@ -131,7 +131,7 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest { @@ -131,7 +131,7 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest {
131 // 测试 likeCount 不匹配 131 // 测试 likeCount 不匹配
132 // ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setLikeCount(null))); 132 // ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setLikeCount(null)));
133 // 测试 price 不匹配 133 // 测试 price 不匹配
134 - ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setPrice(null))); 134 +// ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setPrice(null)));
135 // 测试 quantity 不匹配 135 // 测试 quantity 不匹配
136 // ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setQuantity(null))); 136 // ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setQuantity(null)));
137 // 测试 status 不匹配 137 // 测试 status 不匹配
yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/order/TradeOrderCloseTypeEnum.java renamed to yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/order/TradeOrderCancelTypeEnum.java
@@ -10,7 +10,7 @@ import lombok.RequiredArgsConstructor; @@ -10,7 +10,7 @@ import lombok.RequiredArgsConstructor;
10 */ 10 */
11 @RequiredArgsConstructor 11 @RequiredArgsConstructor
12 @Getter 12 @Getter
13 -public enum TradeOrderCloseTypeEnum { 13 +public enum TradeOrderCancelTypeEnum {
14 14
15 PAY_TIMEOUT(10, "超时未支付"), 15 PAY_TIMEOUT(10, "超时未支付"),
16 REFUND_CLOSE(20, "退款关闭"), 16 REFUND_CLOSE(20, "退款关闭"),
yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/order/TradeOrderStatusEnum.java
@@ -15,8 +15,8 @@ public enum TradeOrderStatusEnum { @@ -15,8 +15,8 @@ public enum TradeOrderStatusEnum {
15 WAITING_PAYMENT(0, "待付款"), 15 WAITING_PAYMENT(0, "待付款"),
16 WAIT_SHIPMENT(1, "待发货"), 16 WAIT_SHIPMENT(1, "待发货"),
17 ALREADY_SHIPMENT(2, "待收货"), 17 ALREADY_SHIPMENT(2, "待收货"),
18 - COMPLETED(3, "成功"),  
19 - CLOSED(4, "失败"); 18 + COMPLETED(3, "已完成"),
  19 + CANCEL(4, "已关闭");
20 20
21 /** 21 /**
22 * 状态值 22 * 状态值
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/cart/CartController.java 0 → 100644
  1 +package cn.iocoder.yudao.module.trade.controller.app.cart;
  2 +
  3 +import io.swagger.annotations.Api;
  4 +import org.springframework.validation.annotation.Validated;
  5 +import org.springframework.web.bind.annotation.RequestMapping;
  6 +import org.springframework.web.bind.annotation.RestController;
  7 +
  8 +@Api(tags = "购物车 API")
  9 +@RestController
  10 +@RequestMapping("/cart")
  11 +@Validated
  12 +public class CartController {
  13 +
  14 +// @Autowired
  15 +// private CartManager cartManager;
  16 +//
  17 +// @PostMapping("add")
  18 +// @ApiOperation("添加商品到购物车")
  19 +// @ApiImplicitParams({
  20 +// @ApiImplicitParam(name = "skuId", value = "商品 SKU 编号", required = true, example = "1"),
  21 +// @ApiImplicitParam(name = "quantity", value = "增加数量", required = true, example = "1024")
  22 +// })
  23 +// @RequiresAuthenticate
  24 +// public CommonResult<Boolean> addCartItem(@RequestParam("skuId") Integer skuId,
  25 +// @RequestParam("quantity") Integer quantity) {
  26 +// cartManager.addCartItem(UserSecurityContextHolder.getUserId(), skuId, quantity);
  27 +// return success(true);
  28 +// }
  29 +//
  30 +// @GetMapping("sum-quantity")
  31 +// @ApiOperation("查询用户在购物车中的商品数量")
  32 +// @RequiresAuthenticate
  33 +// public CommonResult<Integer> sumCartItemQuantity() {
  34 +// return success(cartManager.sumCartItemQuantity(UserSecurityContextHolder.getUserId()));
  35 +// }
  36 +//
  37 +// @GetMapping("/get-detail")
  38 +// @ApiOperation("查询用户的购物车的商品列表")
  39 +// @RequiresAuthenticate
  40 +// public CommonResult<CartDetailVO> getCartDetail() {
  41 +// return success(cartManager.getCartDetail(UserSecurityContextHolder.getUserId()));
  42 +// }
  43 +//
  44 +// @PostMapping("update-quantity")
  45 +// @ApiOperation("更新购物车商品数量")
  46 +// @ApiImplicitParams({
  47 +// @ApiImplicitParam(name = "skuId", value = "商品 SKU 编号", required = true, example = "1"),
  48 +// @ApiImplicitParam(name = "quantity", value = "增加数量", required = true, example = "1024")
  49 +// })
  50 +// @RequiresAuthenticate
  51 +// public CommonResult<Boolean> updateCartItemQuantity(@RequestParam("skuId") Integer skuId,
  52 +// @RequestParam("quantity") Integer quantity) {
  53 +// cartManager.updateCartItemQuantity(UserSecurityContextHolder.getUserId(), skuId, quantity);
  54 +// return success(true);
  55 +// }
  56 +//
  57 +// @PostMapping("update-selected")
  58 +// @ApiOperation("更新购物车商品是否选中")
  59 +// @ApiImplicitParams({
  60 +// @ApiImplicitParam(name = "skuIds", value = "商品 SKU 编号数组", required = true, example = "1,3"),
  61 +// @ApiImplicitParam(name = "selected", value = "是否选中", required = true, example = "true")
  62 +// })
  63 +// @RequiresAuthenticate
  64 +// public CommonResult<Boolean> updateCartItemSelected(@RequestParam("skuIds") Set<Integer> skuIds,
  65 +// @RequestParam("selected") Boolean selected) {
  66 +// cartManager.updateCartItemSelected(UserSecurityContextHolder.getUserId(), skuIds, selected);
  67 +// // 获得目前购物车明细
  68 +// return success(true);
  69 +// }
  70 +
  71 +}
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/cart/vo/CartDetailVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.trade.controller.app.cart.vo;
  2 +
  3 +import io.swagger.annotations.ApiModel;
  4 +import lombok.Data;
  5 +import lombok.experimental.Accessors;
  6 +
  7 +import java.util.List;
  8 +
  9 +@ApiModel(value = "用户的购物车明细 Response VO") // TODO 芋艿:swagger 文档完善
  10 +@Data
  11 +@Accessors(chain = true)
  12 +public class CartDetailVO {
  13 +
  14 + /**
  15 + * 商品分组数组
  16 + */
  17 + private List<ItemGroup> itemGroups;
  18 + /**
  19 + * 费用
  20 + */
  21 + private Fee fee;
  22 +
  23 + /**
  24 + * 商品分组
  25 + *
  26 + * 多个商品,参加同一个活动,从而形成分组。
  27 + */
  28 + @Data
  29 + @Accessors(chain = true)
  30 + public static class ItemGroup {
  31 +
  32 +// /**
  33 +// * 优惠活动
  34 +// */
  35 +// private PromotionActivityRespDTO activity; // TODO 芋艿,偷懒
  36 + /**
  37 + * 促销减少的金额
  38 + *
  39 + * 1. 若未参与促销活动,或不满足促销条件,返回 null
  40 + * 2. 该金额,已经分摊到每个 Item 的 discountTotal ,需要注意。
  41 + */
  42 + private Integer activityDiscountTotal;
  43 + /**
  44 + * 商品数组
  45 + */
  46 + private List<Sku> items;
  47 +
  48 + }
  49 +
  50 + @Data
  51 + @Accessors(chain = true)
  52 + public static class Sku {
  53 +
  54 + // SKU 自带信息
  55 + /**
  56 + * sku 编号
  57 + */
  58 + private Integer id;
  59 + /**
  60 + * SPU 信息
  61 + */
  62 + private Spu spu;
  63 + /**
  64 + * 图片地址
  65 + */
  66 + private String picURL;
  67 +// /**
  68 +// * 规格值数组
  69 +// */
  70 +// private List<ProductAttrKeyValueRespVO> attrs; // TODO 后面改下
  71 + /**
  72 + * 价格,单位:分
  73 + */
  74 + private Integer price;
  75 + /**
  76 + * 库存数量
  77 + */
  78 + private Integer quantity;
  79 +
  80 + // 非 SKU 自带信息
  81 +
  82 + /**
  83 + * 购买数量
  84 + */
  85 + private Integer buyQuantity;
  86 + /**
  87 + * 是否选中
  88 + */
  89 + private Boolean selected;
  90 +// /**
  91 +// * 优惠活动
  92 +// */
  93 +// private PromotionActivityRespDTO activity; // TODO 芋艿,偷懒
  94 + /**
  95 + * 原始单价,单位:分。
  96 + */
  97 + private Integer originPrice;
  98 + /**
  99 + * 购买单价,单位:分
  100 + */
  101 + private Integer buyPrice;
  102 + /**
  103 + * 最终价格,单位:分。
  104 + */
  105 + private Integer presentPrice;
  106 + /**
  107 + * 购买总金额,单位:分
  108 + *
  109 + * 用途类似 {@link #presentTotal}
  110 + */
  111 + private Integer buyTotal;
  112 + /**
  113 + * 优惠总金额,单位:分。
  114 + */
  115 + private Integer discountTotal;
  116 + /**
  117 + * 最终总金额,单位:分。
  118 + *
  119 + * 注意,presentPrice * quantity 不一定等于 presentTotal 。
  120 + * 因为,存在无法整除的情况。
  121 + * 举个例子,presentPrice = 8.33 ,quantity = 3 的情况,presentTotal 有可能是 24.99 ,也可能是 25 。
  122 + * 所以,需要存储一个该字段。
  123 + */
  124 + private Integer presentTotal;
  125 +
  126 + }
  127 +
  128 + @Data
  129 + @Accessors(chain = true)
  130 + public static class Spu {
  131 +
  132 + /**
  133 + * SPU 编号
  134 + */
  135 + private Integer id;
  136 +
  137 + // ========== 基本信息 =========
  138 + /**
  139 + * SPU 名字
  140 + */
  141 + private String name;
  142 + /**
  143 + * 分类编号
  144 + */
  145 + private Integer cid;
  146 + /**
  147 + * 商品主图地址
  148 + *
  149 + * 数组,以逗号分隔
  150 + *
  151 + * 建议尺寸:800*800像素,你可以拖拽图片调整顺序,最多上传15张
  152 + */
  153 + private List<String> picUrls;
  154 +
  155 + }
  156 +
  157 + /**
  158 + * 费用(合计)
  159 + */
  160 + @Data
  161 + @Accessors(chain = true)
  162 + public static class Fee {
  163 +
  164 + /**
  165 + * 购买总价
  166 + */
  167 + private Integer buyTotal;
  168 + /**
  169 + * 优惠总价
  170 + *
  171 + * 注意,满多少元包邮,不算在优惠中。
  172 + */
  173 + private Integer discountTotal;
  174 + /**
  175 + * 邮费
  176 + */
  177 + private Integer postageTotal;
  178 + /**
  179 + * 最终价格
  180 + *
  181 + * 计算公式 = 总价 - 优惠总价 + 邮费
  182 + */
  183 + private Integer presentTotal;
  184 +
  185 + public Fee() {
  186 + }
  187 +
  188 + public Fee(Integer buyTotal, Integer discountTotal, Integer postageTotal, Integer presentTotal) {
  189 + this.buyTotal = buyTotal;
  190 + this.discountTotal = discountTotal;
  191 + this.postageTotal = postageTotal;
  192 + this.presentTotal = presentTotal;
  193 + }
  194 +
  195 + }
  196 +
  197 + /**
  198 + * 邮费信息 TODO 芋艿,未完成
  199 + */
  200 + @Data
  201 + @Accessors(chain = true)
  202 + public static class Postage {
  203 +
  204 + /**
  205 + * 需要满足多少钱,可以包邮。单位:分
  206 + */
  207 + private Integer threshold;
  208 +
  209 + }
  210 +
  211 +}
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/AppTradeOrderController.http 0 → 100644
  1 +### /trade-order/confirm-create-order-info 基于商品,确认创建订单
  2 +GET {{appApi}}/trade/order/get-create-info?items[0].skuId=1&items[0].count=1
  3 +Authorization: Bearer {{user-access-token}}
  4 +tenant-id: {{appTenentId}}
  5 +
  6 +### /trade-order/confirm-create-order-info-from-cart 基于购物车,确认创建订单
  7 +GET {{shop-api-base-url}}/trade-order/confirm-create-order-info-from-cart
  8 +Content-Type: application/x-www-form-urlencoded
  9 +Authorization: Bearer {{user-access-token}}
  10 +
  11 +### /trade-order/confirm-create-order-info-from-cart 基于商品,创建订单
  12 +POST {{shop-api-base-url}}/trade-order/create
  13 +Content-Type: application/json
  14 +Authorization: Bearer {{user-access-token}}
  15 +
  16 +{
  17 + "userAddressId": 19,
  18 + "remark": "我是备注",
  19 + "orderItems": [
  20 + {
  21 + "skuId": 3,
  22 + "quantity": 1
  23 + }
  24 + ]
  25 +}
  26 +
  27 +### /trade-order/page 获得订单交易分页
  28 +GET {{shop-api-base-url}}/trade-order/page?status=1&pageNo=1&pageSize=10
  29 +Content-Type: application/x-www-form-urlencoded
  30 +
  31 +###
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/AppTradeOrderController.java 0 → 100644
  1 +package cn.iocoder.yudao.module.trade.controller.app.order;
  2 +
  3 +import cn.iocoder.yudao.framework.common.pojo.CommonResult;
  4 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  5 +import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
  6 +import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderCreateReqVO;
  7 +import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderGetCreateInfoRespVO;
  8 +import cn.iocoder.yudao.module.trade.controller.app.order.vo.TradeOrderPageReqVO;
  9 +import cn.iocoder.yudao.module.trade.controller.app.order.vo.TradeOrderRespVO;
  10 +import io.swagger.annotations.Api;
  11 +import io.swagger.annotations.ApiImplicitParam;
  12 +import io.swagger.annotations.ApiOperation;
  13 +import lombok.extern.slf4j.Slf4j;
  14 +import org.springframework.validation.annotation.Validated;
  15 +import org.springframework.web.bind.annotation.*;
  16 +
  17 +import javax.servlet.http.HttpServletRequest;
  18 +
  19 +@Api(tags = "用户 App - 交易订单")
  20 +@RestController
  21 +@RequestMapping("/trade/order")
  22 +@Validated
  23 +@Slf4j
  24 +public class AppTradeOrderController {
  25 +
  26 + // TODO 在思考下;
  27 +
  28 + @GetMapping("/get-create-info")
  29 + @ApiOperation("基于商品,确认创建订单")
  30 + @PreAuthenticated
  31 + public CommonResult<AppTradeOrderGetCreateInfoRespVO> getTradeOrderCreateInfo(AppTradeOrderCreateReqVO createReqVO) {
  32 +// return success(tradeOrderService.getOrderConfirmCreateInfo(UserSecurityContextHolder.getUserId(), skuId, quantity, couponCardId));
  33 + return null;
  34 + }
  35 +
  36 + @PostMapping("/create")
  37 + @ApiOperation("创建订单")
  38 + @PreAuthenticated
  39 + public CommonResult<Integer> createTradeOrder(@RequestBody AppTradeOrderCreateReqVO createReqVO,
  40 + HttpServletRequest servletRequest) {
  41 +// return success(tradeOrderService.createTradeOrder(UserSecurityContextHolder.getUserId(),
  42 +// HttpUtil.getIp(servletRequest), createReqVO));
  43 + return null;
  44 + }
  45 +
  46 + @GetMapping("/get")
  47 + @ApiOperation("获得交易订单")
  48 + @ApiImplicitParam(name = "tradeOrderId", value = "交易订单编号", required = true)
  49 + public CommonResult<TradeOrderRespVO> getTradeOrder(@RequestParam("tradeOrderId") Integer tradeOrderId) {
  50 +// return success(tradeOrderService.getTradeOrder(tradeOrderId));
  51 + return null;
  52 + }
  53 +
  54 + @GetMapping("/page")
  55 + @ApiOperation("获得订单交易分页")
  56 + public CommonResult<PageResult<TradeOrderRespVO>> pageTradeOrder(TradeOrderPageReqVO pageVO) {
  57 +// return success(tradeOrderService.pageTradeOrder(UserSecurityContextHolder.getUserId(), pageVO));
  58 + return null;
  59 + }
  60 +
  61 +}
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/AppTradeOrderCreateReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.trade.controller.app.order.vo;
  2 +
  3 +import io.swagger.annotations.ApiModel;
  4 +import io.swagger.annotations.ApiModelProperty;
  5 +import lombok.Data;
  6 +
  7 +import javax.validation.constraints.Min;
  8 +import javax.validation.constraints.NotNull;
  9 +import java.util.List;
  10 +
  11 +@ApiModel(value = "用户 App - 交易订单创建 Request VO")
  12 +@Data
  13 +public class AppTradeOrderCreateReqVO {
  14 +
  15 + @ApiModelProperty(name = "收件地址编号", required = true, example = "1")
  16 + @NotNull(message = "收件地址不能为空")
  17 + private Integer addressId;
  18 +
  19 + @ApiModelProperty(name = "优惠劵编号", example = "1024")
  20 + private Integer couponId;
  21 +
  22 + @ApiModelProperty(name = "备注", example = "1024")
  23 + private String remark;
  24 +
  25 + @ApiModelProperty(name = "是否来自购物车", required = true, example = "true", notes = "true - 来自购物车;false - 立即购买")
  26 + @NotNull(message = "是否来自购物车不能为空")
  27 + private Boolean fromCart;
  28 +
  29 + /**
  30 + * 订单商品项列表
  31 + */
  32 + @NotNull(message = "必须选择购买的商品")
  33 + private List<Item> items;
  34 +
  35 + @ApiModel(value = "订单商品项")
  36 + @Data
  37 + public static class Item {
  38 +
  39 + @ApiModelProperty(name = "商品 SKU 编号", required = true, example = "111")
  40 + @NotNull(message = "商品 SKU 编号不能为空")
  41 + private Integer skuId;
  42 +
  43 + @ApiModelProperty(name = "商品 SKU 购买数量", required = true, example = "1024")
  44 + @NotNull(message = "商品 SKU 购买数量不能为空")
  45 + @Min(value = 1, message = "商品 SKU 购买数量必须大于 0")
  46 + private Integer count;
  47 +
  48 + }
  49 +
  50 +}
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/AppTradeOrderGetCreateInfoRespVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.trade.controller.app.order.vo;
  2 +
  3 +import io.swagger.annotations.ApiModel;
  4 +import io.swagger.annotations.ApiModelProperty;
  5 +import lombok.AllArgsConstructor;
  6 +import lombok.Data;
  7 +
  8 +import java.util.List;
  9 +
  10 +@ApiModel(value = "用户 App - 订单获得创建信息 Response VO")
  11 +@Data
  12 +public class AppTradeOrderGetCreateInfoRespVO {
  13 +
  14 + /**
  15 + * 商品分组数组
  16 + */
  17 + private List<ItemGroup> itemGroups;
  18 + /**
  19 + * 费用
  20 + */
  21 + private Fee fee;
  22 +
  23 +// /**
  24 +// * 优惠劵列表 TODO 芋艿,后续改改
  25 +// */
  26 +// private List<CouponCardAvailableRespDTO> coupons;
  27 +
  28 + @ApiModel(value = "商品分组", description = "多个商品,参加同一个活动,从而形成分组")
  29 + @Data
  30 + public static class ItemGroup {
  31 +
  32 +// /**
  33 +// * 优惠活动
  34 +// */
  35 +// private PromotionActivityRespDTO activity; // TODO 芋艿,偷懒
  36 + /**
  37 + * 商品 SKU 数组
  38 + */
  39 + private List<Sku> items;
  40 +
  41 + }
  42 +
  43 + @ApiModel("商品 SKU")
  44 + @Data
  45 + public static class Sku {
  46 +
  47 + // SKU 自带信息
  48 + @ApiModelProperty(value = "SKU 编号", required = true, example = "1024")
  49 + private Integer id;
  50 + /**
  51 + * SPU 信息
  52 + */
  53 + private Spu spu;
  54 + /**
  55 + * 图片地址
  56 + */
  57 + private String picURL;
  58 +// /**
  59 +// * 规格值数组
  60 +// */
  61 +// private List<ProductAttrKeyValueRespVO> attrs; // TODO 后面改下
  62 + /**
  63 + * 价格,单位:分
  64 + */
  65 + private Integer price;
  66 + /**
  67 + * 库存数量
  68 + */
  69 + private Integer stock;
  70 +
  71 + // 非 SKU 自带信息
  72 +
  73 + /**
  74 + * 购买数量
  75 + */
  76 + private Integer buyQuantity;
  77 +// /**
  78 +// * 优惠活动
  79 +// */
  80 +// private PromotionActivityRespDTO activity; // TODO 芋艿,偷懒
  81 + /**
  82 + * 原始单价,单位:分。
  83 + */
  84 + private Integer originPrice;
  85 + /**
  86 + * 购买单价,单位:分
  87 + */
  88 + private Integer buyPrice;
  89 + /**
  90 + * 最终价格,单位:分。
  91 + */
  92 + private Integer presentPrice;
  93 + /**
  94 + * 购买总金额,单位:分
  95 + *
  96 + * 用途类似 {@link #presentTotal}
  97 + */
  98 + private Integer buyTotal;
  99 + /**
  100 + * 优惠总金额,单位:分。
  101 + */
  102 + private Integer discountTotal;
  103 + /**
  104 + * 最终总金额,单位:分。
  105 + *
  106 + * 注意,presentPrice * quantity 不一定等于 presentTotal 。
  107 + * 因为,存在无法整除的情况。
  108 + * 举个例子,presentPrice = 8.33 ,quantity = 3 的情况,presentTotal 有可能是 24.99 ,也可能是 25 。
  109 + * 所以,需要存储一个该字段。
  110 + */
  111 + private Integer presentTotal;
  112 +
  113 + }
  114 +
  115 + @Data
  116 + public static class Spu {
  117 +
  118 + /**
  119 + * SPU 编号
  120 + */
  121 + private Integer id;
  122 +
  123 + // ========== 基本信息 =========
  124 + /**
  125 + * SPU 名字
  126 + */
  127 + private String name;
  128 + /**
  129 + * 分类编号
  130 + */
  131 + private Integer cid;
  132 + /**
  133 + * 商品主图地址
  134 + *
  135 + * 数组,以逗号分隔
  136 + *
  137 + * 建议尺寸:800*800像素,你可以拖拽图片调整顺序,最多上传15张
  138 + */
  139 + private List<String> picUrls;
  140 +
  141 + }
  142 +
  143 + @ApiModel("费用(合计)")
  144 + @Data
  145 + @AllArgsConstructor
  146 + public static class Fee {
  147 +
  148 + @ApiModelProperty(value = "购买总价", required = true, example = "1024")
  149 + private Integer buyPrice;
  150 + /**
  151 + * 优惠总价
  152 + *
  153 + * 注意,满多少元包邮,不算在优惠中。
  154 + */
  155 + private Integer discountTotal;
  156 + /**
  157 + * 邮费
  158 + */
  159 + private Integer postageTotal;
  160 + /**
  161 + * 最终价格
  162 + *
  163 + * 计算公式 = 总价 - 优惠总价 + 邮费
  164 + */
  165 + private Integer presentTotal;
  166 +
  167 + }
  168 +
  169 +}
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/TradeOrderItemRespVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.trade.controller.app.order.vo;
  2 +
  3 +import io.swagger.annotations.ApiModel;
  4 +import io.swagger.annotations.ApiModelProperty;
  5 +import lombok.Data;
  6 +
  7 +import java.util.Date;
  8 +
  9 +@ApiModel("交易订单项 Response VO")
  10 +@Data
  11 +public class TradeOrderItemRespVO {
  12 +
  13 + @ApiModelProperty(value = "id自增长", required = true)
  14 + private Integer id;
  15 + @ApiModelProperty(value = "订单编号", required = true)
  16 + private Integer orderId;
  17 + @ApiModelProperty(value = "订单项状态", required = true)
  18 + private Integer status;
  19 + @ApiModelProperty(value = "商品 SKU 编号", required = true)
  20 + private Integer skuId;
  21 + @ApiModelProperty(value = "商品 SPU 编号", required = true)
  22 + private Integer spuId;
  23 + @ApiModelProperty(value = "商品名字", required = true)
  24 + private String skuName;
  25 + @ApiModelProperty(value = "图片名字", required = true)
  26 + private String skuImage;
  27 + @ApiModelProperty(value = "商品数量", required = true)
  28 + private Integer quantity;
  29 + @ApiModelProperty(value = "原始单价,单位:分", required = true)
  30 + private Integer originPrice;
  31 + @ApiModelProperty(value = "购买单价,单位:分", required = true)
  32 + private Integer buyPrice;
  33 + @ApiModelProperty(value = "最终价格,单位:分", required = true)
  34 + private Integer presentPrice;
  35 + @ApiModelProperty(value = "购买总金额,单位:分", required = true)
  36 + private Integer buyTotal;
  37 + @ApiModelProperty(value = "优惠总金额,单位:分", required = true)
  38 + private Integer discountTotal;
  39 + @ApiModelProperty(value = "最终总金额,单位:分", required = true)
  40 + private Integer presentTotal;
  41 + @ApiModelProperty(value = "退款总金额,单位:分", required = true)
  42 + private Integer refundTotal;
  43 + @ApiModelProperty(value = "物流id")
  44 + private Integer logisticsId;
  45 + @ApiModelProperty(value = "售后状态", required = true)
  46 + private Integer afterSaleStatus;
  47 + @ApiModelProperty(value = "售后订单编号")
  48 + private Integer afterSaleOrderId;
  49 + @ApiModelProperty(value = "创建时间", required = true)
  50 + private Date createTime;
  51 +
  52 +
  53 +}
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/TradeOrderPageReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.trade.controller.app.order.vo;
  2 +
  3 +import cn.iocoder.yudao.framework.common.pojo.PageParam;
  4 +import io.swagger.annotations.ApiModel;
  5 +import io.swagger.annotations.ApiModelProperty;
  6 +import lombok.Data;
  7 +import lombok.EqualsAndHashCode;
  8 +
  9 +@ApiModel("交易订单分页 Request VO")
  10 +@Data
  11 +@EqualsAndHashCode(callSuper = true)
  12 +public class TradeOrderPageReqVO extends PageParam {
  13 +
  14 + @ApiModelProperty(value = "订单状态", example = "1", notes = "参见 TradeOrderStatusEnum 枚举")
  15 + private Integer orderStatus;
  16 +
  17 +}
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/TradeOrderRespVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.trade.controller.app.order.vo;
  2 +
  3 +import lombok.*;
  4 +import io.swagger.annotations.*;
  5 +import java.util.*;
  6 +
  7 +@ApiModel("订单交易 Response VO")
  8 +@Data
  9 +public class TradeOrderRespVO {
  10 +
  11 + @ApiModelProperty(value = "订单编号", required = true)
  12 + private Integer id;
  13 + @ApiModelProperty(value = "用户编号", required = true)
  14 + private Integer userId;
  15 + @ApiModelProperty(value = "订单单号", required = true)
  16 + private String orderNo;
  17 + @ApiModelProperty(value = "订单状态", required = true)
  18 + private Integer orderStatus;
  19 + @ApiModelProperty(value = "备注")
  20 + private String remark;
  21 + @ApiModelProperty(value = "订单结束时间")
  22 + private Date endTime;
  23 + @ApiModelProperty(value = "订单金额(总金额),单位:分", required = true)
  24 + private Integer buyPrice;
  25 + @ApiModelProperty(value = "优惠总金额,单位:分", required = true)
  26 + private Integer discountPrice;
  27 + @ApiModelProperty(value = "物流金额,单位:分", required = true)
  28 + private Integer logisticsPrice;
  29 + @ApiModelProperty(value = "最终金额,单位:分", required = true)
  30 + private Integer presentPrice;
  31 + @ApiModelProperty(value = "支付金额,单位:分", required = true)
  32 + private Integer payPrice;
  33 + @ApiModelProperty(value = "退款金额,单位:分", required = true)
  34 + private Integer refundPrice;
  35 + @ApiModelProperty(value = "付款时间")
  36 + private Date payTime;
  37 + @ApiModelProperty(value = "支付订单编号")
  38 + private Integer payTransactionId;
  39 + @ApiModelProperty(value = "支付渠道")
  40 + private Integer payChannel;
  41 + @ApiModelProperty(value = "配送类型", required = true)
  42 + private Integer deliveryType;
  43 + @ApiModelProperty(value = "发货时间")
  44 + private Date deliveryTime;
  45 + @ApiModelProperty(value = "收货时间")
  46 + private Date receiveTime;
  47 + @ApiModelProperty(value = "收件人名称", required = true)
  48 + private String receiverName;
  49 + @ApiModelProperty(value = "手机号", required = true)
  50 + private String receiverMobile;
  51 + @ApiModelProperty(value = "地区编码", required = true)
  52 + private Integer receiverAreaCode;
  53 + @ApiModelProperty(value = "收件详细地址", required = true)
  54 + private String receiverDetailAddress;
  55 + @ApiModelProperty(value = "售后状态", required = true)
  56 + private Integer afterSaleStatus;
  57 + @ApiModelProperty(value = "优惠劵编号")
  58 + private Integer couponCardId;
  59 + @ApiModelProperty(value = "创建时间", required = true)
  60 + private Date createTime;
  61 +
  62 + /**
  63 + * 订单项数组
  64 + *
  65 + * // TODO 芋艿,后续考虑怎么优化下,目前是内嵌了别的 dto
  66 + */
  67 + private List<TradeOrderItemRespVO> orderItems;
  68 +
  69 +
  70 +}
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/refund/TradeRefundController.java 0 → 100644
  1 +package cn.iocoder.yudao.module.trade.controller.app.refund;
  2 +
  3 +public class TradeRefundController {
  4 +}
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/package-info.java 0 → 100644
  1 +/**
  2 + * 提供 RESTful API 给前端:
  3 + * 1. admin 包:提供给管理后台 yudao-ui-admin 前端项目
  4 + * 2. app 包:提供给用户 APP yudao-ui-app 前端项目,它的 Controller 和 VO 都要添加 App 前缀,用于和管理后台进行区分
  5 + */
  6 +package cn.iocoder.yudao.module.trade.controller;
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/cart/CartItemDO.java
@@ -36,12 +36,6 @@ public class CartItemDO extends BaseDO { @@ -36,12 +36,6 @@ public class CartItemDO extends BaseDO {
36 36
37 // ========= 买家信息 BEGIN ========= 37 // ========= 买家信息 BEGIN =========
38 38
39 -// /**  
40 -// * 店铺编号  
41 -// *  
42 -// * 关联 {@link ShopDO#getId()} TODO 芋艿:多店铺,暂不考虑  
43 -// */  
44 -// private Long shopId;  
45 /** 39 /**
46 * 用户编号 40 * 用户编号
47 * 41 *
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/order/TradeOrderDO.java
@@ -3,10 +3,10 @@ package cn.iocoder.yudao.module.trade.dal.dataobject.order; @@ -3,10 +3,10 @@ package cn.iocoder.yudao.module.trade.dal.dataobject.order;
3 import cn.iocoder.yudao.framework.common.enums.TerminalEnum; 3 import cn.iocoder.yudao.framework.common.enums.TerminalEnum;
4 import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; 4 import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
5 import cn.iocoder.yudao.module.product.enums.delivery.DeliveryTypeEnum; 5 import cn.iocoder.yudao.module.product.enums.delivery.DeliveryTypeEnum;
6 -import cn.iocoder.yudao.module.trade.enums.order.TradeOrderCloseTypeEnum; 6 +import cn.iocoder.yudao.module.trade.enums.order.TradeOrderCancelTypeEnum;
  7 +import cn.iocoder.yudao.module.trade.enums.order.TradeOrderRefundStatusEnum;
7 import cn.iocoder.yudao.module.trade.enums.order.TradeOrderStatusEnum; 8 import cn.iocoder.yudao.module.trade.enums.order.TradeOrderStatusEnum;
8 import cn.iocoder.yudao.module.trade.enums.order.TradeOrderTypeEnum; 9 import cn.iocoder.yudao.module.trade.enums.order.TradeOrderTypeEnum;
9 -import cn.iocoder.yudao.module.trade.enums.order.TradeOrderRefundStatusEnum;  
10 import com.baomidou.mybatisplus.annotation.KeySequence; 10 import com.baomidou.mybatisplus.annotation.KeySequence;
11 import com.baomidou.mybatisplus.annotation.TableName; 11 import com.baomidou.mybatisplus.annotation.TableName;
12 import lombok.*; 12 import lombok.*;
@@ -32,32 +32,25 @@ public class TradeOrderDO extends BaseDO { @@ -32,32 +32,25 @@ public class TradeOrderDO extends BaseDO {
32 /** 32 /**
33 * 订单编号,主键自增 33 * 订单编号,主键自增
34 */ 34 */
35 - private Integer id; 35 + private Long id;
36 /** 36 /**
37 * 订单流水号 37 * 订单流水号
38 * 38 *
39 * 例如说,1146347329394184195 39 * 例如说,1146347329394184195
40 */ 40 */
41 private String sn; 41 private String sn;
42 - // TODO 芋艿:order_type 订单类型  
43 /** 42 /**
44 * 订单类型 43 * 订单类型
45 * 44 *
46 * 枚举 {@link TradeOrderTypeEnum} 45 * 枚举 {@link TradeOrderTypeEnum}
47 */ 46 */
48 - private Integer type; 47 + private Integer type; // TODO order_promotion_type
49 /** 48 /**
50 * 订单来源终端 49 * 订单来源终端
51 * 50 *
52 * 枚举 {@link TerminalEnum} 51 * 枚举 {@link TerminalEnum}
53 */ 52 */
54 private Integer terminal; 53 private Integer terminal;
55 -// /**  
56 -// * 店铺编号  
57 -// *  
58 -// * 关联 {@link ShopDO#getId()} TODO 芋艿:多店铺,暂不考虑  
59 -// */  
60 -// private Long shopId;  
61 /** 54 /**
62 * 用户编号 55 * 用户编号
63 * 56 *
@@ -65,34 +58,42 @@ public class TradeOrderDO extends BaseDO { @@ -65,34 +58,42 @@ public class TradeOrderDO extends BaseDO {
65 */ 58 */
66 private Long userId; 59 private Long userId;
67 /** 60 /**
  61 + * 用户 IP
  62 + */
  63 + private String userIp;
  64 + /**
  65 + * 用户备注
  66 + */
  67 + private String userRemark;
  68 + /**
68 * 订单状态 69 * 订单状态
69 * 70 *
70 * 枚举 {@link TradeOrderStatusEnum} 71 * 枚举 {@link TradeOrderStatusEnum}
71 */ 72 */
72 private Integer status; 73 private Integer status;
73 - /**  
74 - * 关闭类型  
75 - *  
76 - * 枚举 {@link TradeOrderCloseTypeEnum}  
77 - */  
78 - private Integer closeType;  
79 // TODO 芋艿:要不要存储 prod_name 购买的商品名门? 74 // TODO 芋艿:要不要存储 prod_name 购买的商品名门?
80 /** 75 /**
81 * 购买的商品数量 76 * 购买的商品数量
82 */ 77 */
83 private Integer productCount; // total_num 78 private Integer productCount; // total_num
84 /** 79 /**
85 - * 备注 80 + * 订单完成时间
86 */ 81 */
87 - private String remark;  
88 - /**  
89 - * 确认收获时间  
90 - */  
91 - private Date confirmTakeTime; 82 + private Date finishTime;
92 /** 83 /**
93 * 订单取消时间 84 * 订单取消时间
94 */ 85 */
95 private Date cancelTime; 86 private Date cancelTime;
  87 + /**
  88 + * 取消类型
  89 + *
  90 + * 枚举 {@link TradeOrderCancelTypeEnum}
  91 + */
  92 + private Integer cancelType;
  93 + /**
  94 + * 商家备注
  95 + */
  96 + private String remark;
96 97
97 // ========== 价格 + 支付基本信息 ========== 98 // ========== 价格 + 支付基本信息 ==========
98 /** 99 /**
@@ -101,39 +102,33 @@ public class TradeOrderDO extends BaseDO { @@ -101,39 +102,33 @@ public class TradeOrderDO extends BaseDO {
101 * true - 已经支付过 102 * true - 已经支付过
102 * false - 没有支付过 103 * false - 没有支付过
103 */ 104 */
104 - private Boolean payed; // TODO payStatus 0 - 待付款;1 - 已付款;2 - 已退款 105 + private Boolean payed;
105 /** 106 /**
106 * 付款时间 107 * 付款时间
107 */ 108 */
108 private Date payTime; 109 private Date payTime;
109 110
110 - // TODO 芋艿:delete_status 用户订单删除状态;0 - 未删除;1 - 回收站;2 - 永久删除  
111 -  
112 // ========== 价格 + 支付基本信息 ========== 111 // ========== 价格 + 支付基本信息 ==========
113 /** 112 /**
114 * 购买(商品)总金额,单位:分 113 * 购买(商品)总金额,单位:分
115 */ 114 */
116 - private Integer buyPrice; // total  
117 - /**  
118 - * 优惠总金额,单位:分。  
119 - */  
120 - private Integer discountPrice; // reduce_amount 115 + private Integer buyPrice; // niu - goods_money;
121 /** 116 /**
122 - * 物流金额 (分) 117 + * 运费金额,单位:分
123 */ 118 */
124 - private Integer logisticsPrice; // freight_amount; freight_price 119 + private Integer deliveryPrice; // niu - delivery_money;
125 /** 120 /**
126 * 最终金额,单位:分 121 * 最终金额,单位:分
127 * 122 *
128 - * buyPrice + logisticsPrice - discountPrice = presentPrice 123 + * presentPrice = buyPrice + deliveryPrice - couponPrice - integralPrice - marketPrice
129 */ 124 */
130 - private Integer presentPrice; // actual_total 125 + private Integer presentPrice; // niu - order_money;
131 /** 126 /**
132 * 实际已支付金额,单位:分 127 * 实际已支付金额,单位:分
133 * 128 *
134 * 初始时,金额为 0 。等到支付成功后,会进行更新。 129 * 初始时,金额为 0 。等到支付成功后,会进行更新。
135 */ 130 */
136 - private Integer payPrice; 131 + private Integer payPrice; // niu - pay_money;
137 /** 132 /**
138 * 支付订单编号 133 * 支付订单编号
139 * 134 *
@@ -148,11 +143,20 @@ public class TradeOrderDO extends BaseDO { @@ -148,11 +143,20 @@ public class TradeOrderDO extends BaseDO {
148 // ========== 收件 + 物流基本信息 ========== 143 // ========== 收件 + 物流基本信息 ==========
149 /** 144 /**
150 * 配送方式 145 * 配送方式
  146 + * 会员用户下单时,选择的配送方式
151 * 147 *
152 * 枚举 {@link DeliveryTypeEnum} 148 * 枚举 {@link DeliveryTypeEnum}
153 */ 149 */
154 private Integer deliveryType; 150 private Integer deliveryType;
155 /** 151 /**
  152 + * 实际的配送方式
  153 + * 管理后台发货时,选择的配送方式
  154 + *
  155 + * 0 - 无需物流
  156 + * 枚举 {@link DeliveryTypeEnum}
  157 + */
  158 + private Integer actualDeliveryType; // like - shipping_status;
  159 + /**
156 * 配置模板的编号 160 * 配置模板的编号
157 * 161 *
158 * 关联 DeliveryTemplateDO 的 id 编号 162 * 关联 DeliveryTemplateDO 的 id 编号
@@ -163,6 +167,13 @@ public class TradeOrderDO extends BaseDO { @@ -163,6 +167,13 @@ public class TradeOrderDO extends BaseDO {
163 */ 167 */
164 private String expressNo; // dvy_flow_id 168 private String expressNo; // dvy_flow_id
165 /** 169 /**
  170 + * 发货状态
  171 + *
  172 + * true - 已发货
  173 + * false - 未发货
  174 + */
  175 + private Boolean deliveryStatus;
  176 + /**
166 * 发货时间 177 * 发货时间
167 */ 178 */
168 private Date deliveryTime; 179 private Date deliveryTime;
@@ -210,26 +221,35 @@ public class TradeOrderDO extends BaseDO { @@ -210,26 +221,35 @@ public class TradeOrderDO extends BaseDO {
210 /** 221 /**
211 * 优惠劵编号 222 * 优惠劵编号
212 */ 223 */
213 - private Integer couponId;  
214 -  
215 - // TODO 芋艿,这块还要结合营销和价格计算,在去优化下。 224 + private Long couponId;
  225 + /**
  226 + * 优惠劵减免金额,单位:分
  227 + */
  228 + private Integer couponPrice; // niu - coupon_money;
  229 + /**
  230 + * 营销减免金额,单位:分
  231 + *
  232 + * 例如说:满减折扣
  233 + */
  234 + private Integer marketPrice; // niu - promotion_money;
  235 + /**
  236 + * 积分抵扣的金额,单位:分
  237 + */
  238 + private Integer integralPrice;
  239 + /**
  240 + * 使用的积分
  241 + */
  242 + private Integer useIntegral;
216 243
217 // TODO ========== 待定字段:yv ========= 244 // TODO ========== 待定字段:yv =========
218 // TODO cart_id:购物车 id 245 // TODO cart_id:购物车 id
219 - // TODO total_postage:邮费  
220 - // TODO pay_postage:支付邮费  
221 - // TODO coupon_price:优惠劵金额;  
222 - // TODO refund_status:0 未退款;1 申请中;2 已退款  
223 // TODO refund_reason_wap_img:退款图片 246 // TODO refund_reason_wap_img:退款图片
224 // TODO refund_reason_wap_explain:退款用户说明 247 // TODO refund_reason_wap_explain:退款用户说明
225 // TODO refund_reason_time:退款时间 248 // TODO refund_reason_time:退款时间
226 // TODO refund_reason_wap:前台退款原因 249 // TODO refund_reason_wap:前台退款原因
227 // TODO refund_reason:不退款的理由 250 // TODO refund_reason:不退款的理由
228 - // TODO refund_price:退款金额  
229 251
230 // TODO gain_integral:消费赚取积分 252 // TODO gain_integral:消费赚取积分
231 - // TODO use_integral:使用积分  
232 - // TODO pay_integral:实际支付积分  
233 // TODO back_integral:给用户退了多少积分 253 // TODO back_integral:给用户退了多少积分
234 254
235 // TODO combination_id:拼团产品id 255 // TODO combination_id:拼团产品id
@@ -247,17 +267,18 @@ public class TradeOrderDO extends BaseDO { @@ -247,17 +267,18 @@ public class TradeOrderDO extends BaseDO {
247 // TODO out_trade_no:商户系统内部的订单号 String 267 // TODO out_trade_no:商户系统内部的订单号 String
248 268
249 // TODO ========== 待定字段:lf ========= 269 // TODO ========== 待定字段:lf =========
250 - // TODO integral_amount:积分抵扣金额  
251 - // TODO shipping_status:发货状态  
252 - // TODO shipping_time:最后新发货时间  
253 -  
254 - // TODO ========== 待定字段:lf =========  
255 // TODO settle_id:未结算 270 // TODO settle_id:未结算
256 // TODO settle_amount:结算金额 271 // TODO settle_amount:结算金额
257 - // TODO use_integral:使用的积分  
258 // TODO team_found_id: 拼团id 272 // TODO team_found_id: 拼团id
259 // TODO team_id: 拼团活动id 273 // TODO team_id: 拼团活动id
260 // TODO delivery_id: 发货单ID 274 // TODO delivery_id: 发货单ID
261 // TODO attach_values: 附带的值(赠送时机,赠送积分成长值什么的)Json格式 275 // TODO attach_values: 附带的值(赠送时机,赠送积分成长值什么的)Json格式
262 276
  277 + // TODO ========== 待定字段:nf =========
  278 + // TODO delivery_code:整体提货编码
  279 +
  280 + // TODO ========== 待定字段:niu =========
  281 + // TODO adjust_money '订单调整金额'
  282 + // TODO balance_money ''余额支付金额''
  283 +
263 } 284 }
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/order/TradeOrderItemDO.java
@@ -26,13 +26,7 @@ public class TradeOrderItemDO extends BaseDO { @@ -26,13 +26,7 @@ public class TradeOrderItemDO extends BaseDO {
26 /** 26 /**
27 * 编号 27 * 编号
28 */ 28 */
29 - private Integer id;  
30 -// /**  
31 -// * 店铺编号  
32 -// *  
33 -// * 关联 {@link ShopDO#getId()} TODO 芋艿:多店铺,暂不考虑  
34 -// */  
35 -// private Long shopId; 29 + private Long id;
36 /** 30 /**
37 * 用户编号 31 * 用户编号
38 * 32 *
@@ -48,12 +42,6 @@ public class TradeOrderItemDO extends BaseDO { @@ -48,12 +42,6 @@ public class TradeOrderItemDO extends BaseDO {
48 42
49 // ========== 商品基本信息 ========== 43 // ========== 商品基本信息 ==========
50 /** 44 /**
51 - * 商品 SPU 编号  
52 - *  
53 - * 关联 ProductSpuDO 的 id 编号  
54 - */  
55 - private Long spuId;  
56 - /**  
57 * 商品 SKU 编号 45 * 商品 SKU 编号
58 * 46 *
59 * 关联 ProductSkuDO 的 id 编号 47 * 关联 ProductSkuDO 的 id 编号
@@ -75,7 +63,7 @@ public class TradeOrderItemDO extends BaseDO { @@ -75,7 +63,7 @@ public class TradeOrderItemDO extends BaseDO {
75 /** 63 /**
76 * 购买数量 64 * 购买数量
77 */ 65 */
78 - private Integer stock; 66 + private Integer count;
79 /** 67 /**
80 * 是否评论 68 * 是否评论
81 * 69 *
@@ -86,36 +74,46 @@ public class TradeOrderItemDO extends BaseDO { @@ -86,36 +74,46 @@ public class TradeOrderItemDO extends BaseDO {
86 74
87 // ========== 价格 + 支付基本信息 ========== 75 // ========== 价格 + 支付基本信息 ==========
88 /** 76 /**
89 - * 原始单价,单位:分。  
90 - */  
91 - private Integer originPrice; // price  
92 - /**  
93 * 购买单价,单位:分 77 * 购买单价,单位:分
  78 + *
  79 + * 对应 ProductSkuDO 的 price 字段
94 */ 80 */
95 - private Integer buyPrice; 81 + private Integer buyPrice; // like - original_price;niu - costPrice
96 /** 82 /**
97 * 最终单价,单位:分。 83 * 最终单价,单位:分。
98 */ 84 */
99 - private Integer presentPrice; 85 + private Integer presentPrice; // like - goods_price;niu - price
100 /** 86 /**
101 * 购买总金额,单位:分 87 * 购买总金额,单位:分
102 - *  
103 - * 用途类似 {@link #presentTotal}  
104 - */  
105 - private Integer buyTotal;  
106 - /**  
107 - * 优惠总金额,单位:分。  
108 */ 88 */
109 - private Integer discountTotal; 89 + private Integer buyTotal; // like - total_price;niu - 暂无
110 /** 90 /**
111 * 最终总金额,单位:分。 91 * 最终总金额,单位:分。
112 * 92 *
113 - * 注意,presentPrice * stock 不一定等于 presentTotal 。 93 + * 注意,presentPrice * count 不一定等于 presentTotal 。
114 * 因为,存在无法整除的情况。 94 * 因为,存在无法整除的情况。
115 * 举个例子,presentPrice = 8.33 ,stock = 3 的情况,presentTotal 有可能是 24.99 ,也可能是 25 。 95 * 举个例子,presentPrice = 8.33 ,stock = 3 的情况,presentTotal 有可能是 24.99 ,也可能是 25 。
116 * 所以,需要存储一个该字段。 96 * 所以,需要存储一个该字段。
117 */ 97 */
118 - private Integer presentTotal; // product_total_amount 98 + private Integer presentTotal; // like - total_pay_price;niu - goods_money
  99 +
  100 + // ========== 营销基本信息 ==========
  101 + /**
  102 + * 优惠劵满减金额,单位:分
  103 + */
  104 + private Integer couponTotal; // like - discount_price;niu - coupon_money
  105 + /**
  106 + * 营销减免金额,单位:分
  107 + */
  108 + private Integer marketTotal; // like - discount_price;niu - promotion_money
  109 + /**
  110 + * 积分抵扣的金额,单位:分
  111 + */
  112 + private Integer integralTotal; // like - integral_price;niu - point_money
  113 + /**
  114 + * 使用的积分
  115 + */
  116 + private Integer useIntegral; // niu - use_point
119 117
120 // ========== 退款基本信息 ========== 118 // ========== 退款基本信息 ==========
121 /** 119 /**
@@ -123,7 +121,7 @@ public class TradeOrderItemDO extends BaseDO { @@ -123,7 +121,7 @@ public class TradeOrderItemDO extends BaseDO {
123 * 121 *
124 * 枚举 {@link TradeOrderItemRefundStatusEnum} 122 * 枚举 {@link TradeOrderItemRefundStatusEnum}
125 */ 123 */
126 - private Integer refundStatus; 124 + private Integer refundStatus; // TODO 芋艿:可以考虑去查
127 // 如上字段,举个例子: 125 // 如上字段,举个例子:
128 // 假设购买三个,即 stock = 3 。 126 // 假设购买三个,即 stock = 3 。
129 // originPrice = 15 127 // originPrice = 15
@@ -178,4 +176,22 @@ public class TradeOrderItemDO extends BaseDO { @@ -178,4 +176,22 @@ public class TradeOrderItemDO extends BaseDO {
178 // TODO goods_info 商品信息 176 // TODO goods_info 商品信息
179 177
180 // TODO integral_price:积分抵扣的金额 178 // TODO integral_price:积分抵扣的金额
  179 +
  180 + // TODO 待确定:niu
  181 + // TODO is_virtual '是否是虚拟商品'
  182 + // TODO goods_class '商品种类(1.实物 2.虚拟3.卡券)'
  183 + // TODO adjust_money ''调整金额''
  184 +
  185 + // TODO is_fenxiao 是否分销,
  186 + // TODO adjust_money 是否分销,
  187 +
  188 + // TODO delivery_status '配送状态'
  189 + // TODO delivery_no ''配送单号''
  190 + // TODO gift_flag '赠品标识'
  191 + // TODO gift_flag '赠品标识'
  192 +
  193 + // TODO refund_status '退款状态'
  194 + // TODO refund_type '退款状态'
  195 + // TODO 一堆退款字段
181 } 196 }
  197 +
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/refund/TradeRefundDO.java
@@ -42,12 +42,6 @@ public class TradeRefundDO extends BaseDO { @@ -42,12 +42,6 @@ public class TradeRefundDO extends BaseDO {
42 * 枚举 {@link TradeOrderRefundStatusEnum} 42 * 枚举 {@link TradeOrderRefundStatusEnum}
43 */ 43 */
44 private Integer status; 44 private Integer status;
45 -// /**  
46 -// * 店铺编号  
47 -// *  
48 -// * 关联 {@link ShopDO#getId()} TODO 芋艿:多店铺,暂不考虑  
49 -// */  
50 -// private Long shopId;  
51 /** 45 /**
52 * 用户编号 46 * 用户编号
53 * 47 *
yudao-server/pom.xml
@@ -51,6 +51,11 @@ @@ -51,6 +51,11 @@
51 <artifactId>yudao-module-product-biz</artifactId> 51 <artifactId>yudao-module-product-biz</artifactId>
52 <version>${revision}</version> 52 <version>${revision}</version>
53 </dependency> 53 </dependency>
  54 + <dependency>
  55 + <groupId>cn.iocoder.boot</groupId>
  56 + <artifactId>yudao-module-trade-biz</artifactId>
  57 + <version>${revision}</version>
  58 + </dependency>
54 <!-- 数据报表 --> 59 <!-- 数据报表 -->
55 <!-- <dependency>--> 60 <!-- <dependency>-->
56 <!-- <groupId>cn.iocoder.boot</groupId>--> 61 <!-- <groupId>cn.iocoder.boot</groupId>-->