diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/category/ProductCategoryDO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/category/ProductCategoryDO.java index 427bf3136..6671e9b44 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/category/ProductCategoryDO.java +++ b/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 { * 父分类编号 */ private Long parentId; -// /** -// * 店铺编号 -// * -// * 关联 {@link ShopDO#getId()} TODO 芋艿:多店铺,暂不考虑 -// */ -// private Long shopId; /** * 分类名称 */ diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/group/ProductGroupBindDO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/group/ProductGroupBindDO.java index 209a7085c..2e3b63e59 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/group/ProductGroupBindDO.java +++ b/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 { */ @TableId private Long id; -// /** -// * 店铺编号 -// * -// * 关联 {@link ShopDO#getId()} TODO 芋艿:多店铺,暂不考虑 -// */ -// private Long shopId; /** * 商品分组编号 * diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/group/ProductGroupDO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/group/ProductGroupDO.java index e942b957c..605e8c38a 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/group/ProductGroupDO.java +++ b/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; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; -import cn.iocoder.yudao.module.product.dal.dataobject.shop.ShopDO; import cn.iocoder.yudao.module.product.enums.group.ProductGroupStyleEnum; import com.baomidou.mybatisplus.annotation.KeySequence; import com.baomidou.mybatisplus.annotation.TableId; @@ -29,12 +28,6 @@ public class ProductGroupDO extends BaseDO { */ @TableId private Long id; -// /** -// * 店铺编号 -// * -// * 关联 {@link ShopDO#getId()} TODO 芋艿:多店铺,暂不考虑 -// */ -// private Long shopId; /** * 分组名称 */ diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/property/ProductPropertyDO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/property/ProductPropertyDO.java index 94bfc808c..608b248fe 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/property/ProductPropertyDO.java +++ b/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 { */ @TableId private Long id; -// /** -// * 店铺编号 -// * -// * 关联 {@link ShopDO#getId()} TODO 芋艿:多店铺,暂不考虑 -// */ -// private Long shopId; /** * 规格名称 */ diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/search/ProductHotSearchDO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/search/ProductHotSearchDO.java index c53f01aca..3d5cf9101 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/search/ProductHotSearchDO.java +++ b/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 { * 内容 */ private String content; -// /** -// * 店铺编号 -// * -// * 关联 {@link ShopDO#getId()} TODO 芋艿:多店铺,暂不考虑 -// */ -// private Long shopId; } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/spu/ProductSpuDO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/spu/ProductSpuDO.java index 34f7a9d02..456b231b8 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/spu/ProductSpuDO.java +++ b/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 { @TableId private Long id; -// /** -// * 店铺编号 -// * -// * 关联 {@link ShopDO#getId()} TODO 芋艿:多店铺,暂不考虑 -// */ -// private Long shopId; - // ========== 基本信息 ========= /** @@ -215,4 +208,9 @@ public class ProductSpuDO extends BaseDO { // TODO poster:商品自定义海报 + // TODO ========== 待定字段:laoji ========= + // TODO productType 1 - 普通商品 2 - 预售商品;可能和 type 合并不错 + // TODO productUnit 商品单位 + // TODO extJson 扩展信息;例如说,预售商品的信息 + } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/sku/ProductSkuMapper.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/sku/ProductSkuMapper.java index 756636687..eff999be0 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/sku/ProductSkuMapper.java +++ b/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 { .eqIfPresent(ProductSkuDO::getSpuId, reqVO.getSpuId()) .eqIfPresent(ProductSkuDO::getProperties, reqVO.getProperties()) .eqIfPresent(ProductSkuDO::getPrice, reqVO.getPrice()) - .eqIfPresent(ProductSkuDO::getOriginalPrice, reqVO.getOriginalPrice()) +// .eqIfPresent(ProductSkuDO::getOriginalPrice, reqVO.getOriginalPrice()) // .eqIfPresent(ProductSkuDO::getCostPrice, reqVO.getCostPrice()) .eqIfPresent(ProductSkuDO::getBarCode, reqVO.getBarCode()) .eqIfPresent(ProductSkuDO::getPicUrl, reqVO.getPicUrl()) diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/spu/ProductSpuMapper.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/spu/ProductSpuMapper.java index 7487dd60c..a1d919ef2 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/spu/ProductSpuMapper.java +++ b/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 { .eqIfPresent(ProductSpuDO::getPicUrls, reqVO.getPicUrls()) .eqIfPresent(ProductSpuDO::getSort, reqVO.getSort()) // .eqIfPresent(ProductSpuDO::getLikeCount, reqVO.getLikeCount()) - .eqIfPresent(ProductSpuDO::getPrice, reqVO.getPrice()) +// .eqIfPresent(ProductSpuDO::getPrice, reqVO.getPrice()) // .eqIfPresent(ProductSpuDO::getQuantity, reqVO.getQuantity()) .eqIfPresent(ProductSpuDO::getStatus, reqVO.getStatus()) .betweenIfPresent(ProductSpuDO::getCreateTime, reqVO.getCreateTime()) diff --git a/yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/sku/SkuServiceImplTest.java b/yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/sku/SkuServiceImplTest.java index 8cd086e81..2902121e7 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/sku/SkuServiceImplTest.java +++ b/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 { o.setSpuId(null); o.setProperties(null); o.setPrice(null); - o.setOriginalPrice(null); +// o.setOriginalPrice(null); // o.setCostPrice(null); o.setBarCode(null); o.setPicUrl(null); @@ -120,7 +120,7 @@ public class SkuServiceImplTest extends BaseDbUnitTest { // 测试 price 不匹配 ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setPrice(null))); // 测试 originalPrice 不匹配 - ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setOriginalPrice(null))); +// ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setOriginalPrice(null))); // 测试 costPrice 不匹配 // ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setCostPrice(null))); // 测试 barCode 不匹配 diff --git a/yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImplTest.java b/yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImplTest.java index ef2372ac9..4aa0c0e68 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImplTest.java +++ b/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 { o.setPicUrls(null); o.setSort(null); // o.setLikeCount(null); - o.setPrice(null); +// o.setPrice(null); // o.setQuantity(null); o.setStatus(null); o.setCreateTime(null); @@ -131,7 +131,7 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest { // 测试 likeCount 不匹配 // ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setLikeCount(null))); // 测试 price 不匹配 - ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setPrice(null))); +// ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setPrice(null))); // 测试 quantity 不匹配 // ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setQuantity(null))); // 测试 status 不匹配 diff --git a/yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/order/TradeOrderCloseTypeEnum.java b/yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/order/TradeOrderCancelTypeEnum.java similarity index 93% rename from yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/order/TradeOrderCloseTypeEnum.java rename to yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/order/TradeOrderCancelTypeEnum.java index 4fdaf9298..670651d4e 100644 --- a/yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/order/TradeOrderCloseTypeEnum.java +++ b/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; */ @RequiredArgsConstructor @Getter -public enum TradeOrderCloseTypeEnum { +public enum TradeOrderCancelTypeEnum { PAY_TIMEOUT(10, "超时未支付"), REFUND_CLOSE(20, "退款关闭"), diff --git a/yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/order/TradeOrderStatusEnum.java b/yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/order/TradeOrderStatusEnum.java index 6510e26cb..fe0a85f3d 100644 --- a/yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/order/TradeOrderStatusEnum.java +++ b/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 { WAITING_PAYMENT(0, "待付款"), WAIT_SHIPMENT(1, "待发货"), ALREADY_SHIPMENT(2, "待收货"), - COMPLETED(3, "成功"), - CLOSED(4, "失败"); + COMPLETED(3, "已完成"), + CANCEL(4, "已关闭"); /** * 状态值 diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/cart/CartController.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/cart/CartController.java new file mode 100644 index 000000000..91e51dfd5 --- /dev/null +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/cart/CartController.java @@ -0,0 +1,71 @@ +package cn.iocoder.yudao.module.trade.controller.app.cart; + +import io.swagger.annotations.Api; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@Api(tags = "购物车 API") +@RestController +@RequestMapping("/cart") +@Validated +public class CartController { + +// @Autowired +// private CartManager cartManager; +// +// @PostMapping("add") +// @ApiOperation("添加商品到购物车") +// @ApiImplicitParams({ +// @ApiImplicitParam(name = "skuId", value = "商品 SKU 编号", required = true, example = "1"), +// @ApiImplicitParam(name = "quantity", value = "增加数量", required = true, example = "1024") +// }) +// @RequiresAuthenticate +// public CommonResult addCartItem(@RequestParam("skuId") Integer skuId, +// @RequestParam("quantity") Integer quantity) { +// cartManager.addCartItem(UserSecurityContextHolder.getUserId(), skuId, quantity); +// return success(true); +// } +// +// @GetMapping("sum-quantity") +// @ApiOperation("查询用户在购物车中的商品数量") +// @RequiresAuthenticate +// public CommonResult sumCartItemQuantity() { +// return success(cartManager.sumCartItemQuantity(UserSecurityContextHolder.getUserId())); +// } +// +// @GetMapping("/get-detail") +// @ApiOperation("查询用户的购物车的商品列表") +// @RequiresAuthenticate +// public CommonResult getCartDetail() { +// return success(cartManager.getCartDetail(UserSecurityContextHolder.getUserId())); +// } +// +// @PostMapping("update-quantity") +// @ApiOperation("更新购物车商品数量") +// @ApiImplicitParams({ +// @ApiImplicitParam(name = "skuId", value = "商品 SKU 编号", required = true, example = "1"), +// @ApiImplicitParam(name = "quantity", value = "增加数量", required = true, example = "1024") +// }) +// @RequiresAuthenticate +// public CommonResult updateCartItemQuantity(@RequestParam("skuId") Integer skuId, +// @RequestParam("quantity") Integer quantity) { +// cartManager.updateCartItemQuantity(UserSecurityContextHolder.getUserId(), skuId, quantity); +// return success(true); +// } +// +// @PostMapping("update-selected") +// @ApiOperation("更新购物车商品是否选中") +// @ApiImplicitParams({ +// @ApiImplicitParam(name = "skuIds", value = "商品 SKU 编号数组", required = true, example = "1,3"), +// @ApiImplicitParam(name = "selected", value = "是否选中", required = true, example = "true") +// }) +// @RequiresAuthenticate +// public CommonResult updateCartItemSelected(@RequestParam("skuIds") Set skuIds, +// @RequestParam("selected") Boolean selected) { +// cartManager.updateCartItemSelected(UserSecurityContextHolder.getUserId(), skuIds, selected); +// // 获得目前购物车明细 +// return success(true); +// } + +} diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/cart/vo/CartDetailVO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/cart/vo/CartDetailVO.java new file mode 100644 index 000000000..403efbebe --- /dev/null +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/cart/vo/CartDetailVO.java @@ -0,0 +1,211 @@ +package cn.iocoder.yudao.module.trade.controller.app.cart.vo; + +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.util.List; + +@ApiModel(value = "用户的购物车明细 Response VO") // TODO 芋艿:swagger 文档完善 +@Data +@Accessors(chain = true) +public class CartDetailVO { + + /** + * 商品分组数组 + */ + private List itemGroups; + /** + * 费用 + */ + private Fee fee; + + /** + * 商品分组 + * + * 多个商品,参加同一个活动,从而形成分组。 + */ + @Data + @Accessors(chain = true) + public static class ItemGroup { + +// /** +// * 优惠活动 +// */ +// private PromotionActivityRespDTO activity; // TODO 芋艿,偷懒 + /** + * 促销减少的金额 + * + * 1. 若未参与促销活动,或不满足促销条件,返回 null + * 2. 该金额,已经分摊到每个 Item 的 discountTotal ,需要注意。 + */ + private Integer activityDiscountTotal; + /** + * 商品数组 + */ + private List items; + + } + + @Data + @Accessors(chain = true) + public static class Sku { + + // SKU 自带信息 + /** + * sku 编号 + */ + private Integer id; + /** + * SPU 信息 + */ + private Spu spu; + /** + * 图片地址 + */ + private String picURL; +// /** +// * 规格值数组 +// */ +// private List attrs; // TODO 后面改下 + /** + * 价格,单位:分 + */ + private Integer price; + /** + * 库存数量 + */ + private Integer quantity; + + // 非 SKU 自带信息 + + /** + * 购买数量 + */ + private Integer buyQuantity; + /** + * 是否选中 + */ + private Boolean selected; +// /** +// * 优惠活动 +// */ +// private PromotionActivityRespDTO activity; // TODO 芋艿,偷懒 + /** + * 原始单价,单位:分。 + */ + private Integer originPrice; + /** + * 购买单价,单位:分 + */ + private Integer buyPrice; + /** + * 最终价格,单位:分。 + */ + private Integer presentPrice; + /** + * 购买总金额,单位:分 + * + * 用途类似 {@link #presentTotal} + */ + private Integer buyTotal; + /** + * 优惠总金额,单位:分。 + */ + private Integer discountTotal; + /** + * 最终总金额,单位:分。 + * + * 注意,presentPrice * quantity 不一定等于 presentTotal 。 + * 因为,存在无法整除的情况。 + * 举个例子,presentPrice = 8.33 ,quantity = 3 的情况,presentTotal 有可能是 24.99 ,也可能是 25 。 + * 所以,需要存储一个该字段。 + */ + private Integer presentTotal; + + } + + @Data + @Accessors(chain = true) + public static class Spu { + + /** + * SPU 编号 + */ + private Integer id; + + // ========== 基本信息 ========= + /** + * SPU 名字 + */ + private String name; + /** + * 分类编号 + */ + private Integer cid; + /** + * 商品主图地址 + * + * 数组,以逗号分隔 + * + * 建议尺寸:800*800像素,你可以拖拽图片调整顺序,最多上传15张 + */ + private List picUrls; + + } + + /** + * 费用(合计) + */ + @Data + @Accessors(chain = true) + public static class Fee { + + /** + * 购买总价 + */ + private Integer buyTotal; + /** + * 优惠总价 + * + * 注意,满多少元包邮,不算在优惠中。 + */ + private Integer discountTotal; + /** + * 邮费 + */ + private Integer postageTotal; + /** + * 最终价格 + * + * 计算公式 = 总价 - 优惠总价 + 邮费 + */ + private Integer presentTotal; + + public Fee() { + } + + public Fee(Integer buyTotal, Integer discountTotal, Integer postageTotal, Integer presentTotal) { + this.buyTotal = buyTotal; + this.discountTotal = discountTotal; + this.postageTotal = postageTotal; + this.presentTotal = presentTotal; + } + + } + + /** + * 邮费信息 TODO 芋艿,未完成 + */ + @Data + @Accessors(chain = true) + public static class Postage { + + /** + * 需要满足多少钱,可以包邮。单位:分 + */ + private Integer threshold; + + } + +} diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/AppTradeOrderController.http b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/AppTradeOrderController.http new file mode 100644 index 000000000..778e99029 --- /dev/null +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/AppTradeOrderController.http @@ -0,0 +1,31 @@ +### /trade-order/confirm-create-order-info 基于商品,确认创建订单 +GET {{appApi}}/trade/order/get-create-info?items[0].skuId=1&items[0].count=1 +Authorization: Bearer {{user-access-token}} +tenant-id: {{appTenentId}} + +### /trade-order/confirm-create-order-info-from-cart 基于购物车,确认创建订单 +GET {{shop-api-base-url}}/trade-order/confirm-create-order-info-from-cart +Content-Type: application/x-www-form-urlencoded +Authorization: Bearer {{user-access-token}} + +### /trade-order/confirm-create-order-info-from-cart 基于商品,创建订单 +POST {{shop-api-base-url}}/trade-order/create +Content-Type: application/json +Authorization: Bearer {{user-access-token}} + +{ + "userAddressId": 19, + "remark": "我是备注", + "orderItems": [ + { + "skuId": 3, + "quantity": 1 + } + ] +} + +### /trade-order/page 获得订单交易分页 +GET {{shop-api-base-url}}/trade-order/page?status=1&pageNo=1&pageSize=10 +Content-Type: application/x-www-form-urlencoded + +### diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/AppTradeOrderController.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/AppTradeOrderController.java new file mode 100644 index 000000000..da027e1fa --- /dev/null +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/AppTradeOrderController.java @@ -0,0 +1,61 @@ +package cn.iocoder.yudao.module.trade.controller.app.order; + +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated; +import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderCreateReqVO; +import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderGetCreateInfoRespVO; +import cn.iocoder.yudao.module.trade.controller.app.order.vo.TradeOrderPageReqVO; +import cn.iocoder.yudao.module.trade.controller.app.order.vo.TradeOrderRespVO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; + +@Api(tags = "用户 App - 交易订单") +@RestController +@RequestMapping("/trade/order") +@Validated +@Slf4j +public class AppTradeOrderController { + + // TODO 在思考下; + + @GetMapping("/get-create-info") + @ApiOperation("基于商品,确认创建订单") + @PreAuthenticated + public CommonResult getTradeOrderCreateInfo(AppTradeOrderCreateReqVO createReqVO) { +// return success(tradeOrderService.getOrderConfirmCreateInfo(UserSecurityContextHolder.getUserId(), skuId, quantity, couponCardId)); + return null; + } + + @PostMapping("/create") + @ApiOperation("创建订单") + @PreAuthenticated + public CommonResult createTradeOrder(@RequestBody AppTradeOrderCreateReqVO createReqVO, + HttpServletRequest servletRequest) { +// return success(tradeOrderService.createTradeOrder(UserSecurityContextHolder.getUserId(), +// HttpUtil.getIp(servletRequest), createReqVO)); + return null; + } + + @GetMapping("/get") + @ApiOperation("获得交易订单") + @ApiImplicitParam(name = "tradeOrderId", value = "交易订单编号", required = true) + public CommonResult getTradeOrder(@RequestParam("tradeOrderId") Integer tradeOrderId) { +// return success(tradeOrderService.getTradeOrder(tradeOrderId)); + return null; + } + + @GetMapping("/page") + @ApiOperation("获得订单交易分页") + public CommonResult> pageTradeOrder(TradeOrderPageReqVO pageVO) { +// return success(tradeOrderService.pageTradeOrder(UserSecurityContextHolder.getUserId(), pageVO)); + return null; + } + +} diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/AppTradeOrderCreateReqVO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/AppTradeOrderCreateReqVO.java new file mode 100644 index 000000000..85edde55d --- /dev/null +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/AppTradeOrderCreateReqVO.java @@ -0,0 +1,50 @@ +package cn.iocoder.yudao.module.trade.controller.app.order.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; +import java.util.List; + +@ApiModel(value = "用户 App - 交易订单创建 Request VO") +@Data +public class AppTradeOrderCreateReqVO { + + @ApiModelProperty(name = "收件地址编号", required = true, example = "1") + @NotNull(message = "收件地址不能为空") + private Integer addressId; + + @ApiModelProperty(name = "优惠劵编号", example = "1024") + private Integer couponId; + + @ApiModelProperty(name = "备注", example = "1024") + private String remark; + + @ApiModelProperty(name = "是否来自购物车", required = true, example = "true", notes = "true - 来自购物车;false - 立即购买") + @NotNull(message = "是否来自购物车不能为空") + private Boolean fromCart; + + /** + * 订单商品项列表 + */ + @NotNull(message = "必须选择购买的商品") + private List items; + + @ApiModel(value = "订单商品项") + @Data + public static class Item { + + @ApiModelProperty(name = "商品 SKU 编号", required = true, example = "111") + @NotNull(message = "商品 SKU 编号不能为空") + private Integer skuId; + + @ApiModelProperty(name = "商品 SKU 购买数量", required = true, example = "1024") + @NotNull(message = "商品 SKU 购买数量不能为空") + @Min(value = 1, message = "商品 SKU 购买数量必须大于 0") + private Integer count; + + } + +} diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/AppTradeOrderGetCreateInfoRespVO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/AppTradeOrderGetCreateInfoRespVO.java new file mode 100644 index 000000000..d0bf595f6 --- /dev/null +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/AppTradeOrderGetCreateInfoRespVO.java @@ -0,0 +1,169 @@ +package cn.iocoder.yudao.module.trade.controller.app.order.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; + +import java.util.List; + +@ApiModel(value = "用户 App - 订单获得创建信息 Response VO") +@Data +public class AppTradeOrderGetCreateInfoRespVO { + + /** + * 商品分组数组 + */ + private List itemGroups; + /** + * 费用 + */ + private Fee fee; + +// /** +// * 优惠劵列表 TODO 芋艿,后续改改 +// */ +// private List coupons; + + @ApiModel(value = "商品分组", description = "多个商品,参加同一个活动,从而形成分组") + @Data + public static class ItemGroup { + +// /** +// * 优惠活动 +// */ +// private PromotionActivityRespDTO activity; // TODO 芋艿,偷懒 + /** + * 商品 SKU 数组 + */ + private List items; + + } + + @ApiModel("商品 SKU") + @Data + public static class Sku { + + // SKU 自带信息 + @ApiModelProperty(value = "SKU 编号", required = true, example = "1024") + private Integer id; + /** + * SPU 信息 + */ + private Spu spu; + /** + * 图片地址 + */ + private String picURL; +// /** +// * 规格值数组 +// */ +// private List attrs; // TODO 后面改下 + /** + * 价格,单位:分 + */ + private Integer price; + /** + * 库存数量 + */ + private Integer stock; + + // 非 SKU 自带信息 + + /** + * 购买数量 + */ + private Integer buyQuantity; +// /** +// * 优惠活动 +// */ +// private PromotionActivityRespDTO activity; // TODO 芋艿,偷懒 + /** + * 原始单价,单位:分。 + */ + private Integer originPrice; + /** + * 购买单价,单位:分 + */ + private Integer buyPrice; + /** + * 最终价格,单位:分。 + */ + private Integer presentPrice; + /** + * 购买总金额,单位:分 + * + * 用途类似 {@link #presentTotal} + */ + private Integer buyTotal; + /** + * 优惠总金额,单位:分。 + */ + private Integer discountTotal; + /** + * 最终总金额,单位:分。 + * + * 注意,presentPrice * quantity 不一定等于 presentTotal 。 + * 因为,存在无法整除的情况。 + * 举个例子,presentPrice = 8.33 ,quantity = 3 的情况,presentTotal 有可能是 24.99 ,也可能是 25 。 + * 所以,需要存储一个该字段。 + */ + private Integer presentTotal; + + } + + @Data + public static class Spu { + + /** + * SPU 编号 + */ + private Integer id; + + // ========== 基本信息 ========= + /** + * SPU 名字 + */ + private String name; + /** + * 分类编号 + */ + private Integer cid; + /** + * 商品主图地址 + * + * 数组,以逗号分隔 + * + * 建议尺寸:800*800像素,你可以拖拽图片调整顺序,最多上传15张 + */ + private List picUrls; + + } + + @ApiModel("费用(合计)") + @Data + @AllArgsConstructor + public static class Fee { + + @ApiModelProperty(value = "购买总价", required = true, example = "1024") + private Integer buyPrice; + /** + * 优惠总价 + * + * 注意,满多少元包邮,不算在优惠中。 + */ + private Integer discountTotal; + /** + * 邮费 + */ + private Integer postageTotal; + /** + * 最终价格 + * + * 计算公式 = 总价 - 优惠总价 + 邮费 + */ + private Integer presentTotal; + + } + +} diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/TradeOrderItemRespVO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/TradeOrderItemRespVO.java new file mode 100644 index 000000000..195f7330f --- /dev/null +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/TradeOrderItemRespVO.java @@ -0,0 +1,53 @@ +package cn.iocoder.yudao.module.trade.controller.app.order.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + +@ApiModel("交易订单项 Response VO") +@Data +public class TradeOrderItemRespVO { + + @ApiModelProperty(value = "id自增长", required = true) + private Integer id; + @ApiModelProperty(value = "订单编号", required = true) + private Integer orderId; + @ApiModelProperty(value = "订单项状态", required = true) + private Integer status; + @ApiModelProperty(value = "商品 SKU 编号", required = true) + private Integer skuId; + @ApiModelProperty(value = "商品 SPU 编号", required = true) + private Integer spuId; + @ApiModelProperty(value = "商品名字", required = true) + private String skuName; + @ApiModelProperty(value = "图片名字", required = true) + private String skuImage; + @ApiModelProperty(value = "商品数量", required = true) + private Integer quantity; + @ApiModelProperty(value = "原始单价,单位:分", required = true) + private Integer originPrice; + @ApiModelProperty(value = "购买单价,单位:分", required = true) + private Integer buyPrice; + @ApiModelProperty(value = "最终价格,单位:分", required = true) + private Integer presentPrice; + @ApiModelProperty(value = "购买总金额,单位:分", required = true) + private Integer buyTotal; + @ApiModelProperty(value = "优惠总金额,单位:分", required = true) + private Integer discountTotal; + @ApiModelProperty(value = "最终总金额,单位:分", required = true) + private Integer presentTotal; + @ApiModelProperty(value = "退款总金额,单位:分", required = true) + private Integer refundTotal; + @ApiModelProperty(value = "物流id") + private Integer logisticsId; + @ApiModelProperty(value = "售后状态", required = true) + private Integer afterSaleStatus; + @ApiModelProperty(value = "售后订单编号") + private Integer afterSaleOrderId; + @ApiModelProperty(value = "创建时间", required = true) + private Date createTime; + + +} diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/TradeOrderPageReqVO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/TradeOrderPageReqVO.java new file mode 100644 index 000000000..5c8b6c872 --- /dev/null +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/TradeOrderPageReqVO.java @@ -0,0 +1,17 @@ +package cn.iocoder.yudao.module.trade.controller.app.order.vo; + +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@ApiModel("交易订单分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +public class TradeOrderPageReqVO extends PageParam { + + @ApiModelProperty(value = "订单状态", example = "1", notes = "参见 TradeOrderStatusEnum 枚举") + private Integer orderStatus; + +} diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/TradeOrderRespVO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/TradeOrderRespVO.java new file mode 100644 index 000000000..4b7ffa77c --- /dev/null +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/TradeOrderRespVO.java @@ -0,0 +1,70 @@ +package cn.iocoder.yudao.module.trade.controller.app.order.vo; + +import lombok.*; +import io.swagger.annotations.*; +import java.util.*; + +@ApiModel("订单交易 Response VO") +@Data +public class TradeOrderRespVO { + + @ApiModelProperty(value = "订单编号", required = true) + private Integer id; + @ApiModelProperty(value = "用户编号", required = true) + private Integer userId; + @ApiModelProperty(value = "订单单号", required = true) + private String orderNo; + @ApiModelProperty(value = "订单状态", required = true) + private Integer orderStatus; + @ApiModelProperty(value = "备注") + private String remark; + @ApiModelProperty(value = "订单结束时间") + private Date endTime; + @ApiModelProperty(value = "订单金额(总金额),单位:分", required = true) + private Integer buyPrice; + @ApiModelProperty(value = "优惠总金额,单位:分", required = true) + private Integer discountPrice; + @ApiModelProperty(value = "物流金额,单位:分", required = true) + private Integer logisticsPrice; + @ApiModelProperty(value = "最终金额,单位:分", required = true) + private Integer presentPrice; + @ApiModelProperty(value = "支付金额,单位:分", required = true) + private Integer payPrice; + @ApiModelProperty(value = "退款金额,单位:分", required = true) + private Integer refundPrice; + @ApiModelProperty(value = "付款时间") + private Date payTime; + @ApiModelProperty(value = "支付订单编号") + private Integer payTransactionId; + @ApiModelProperty(value = "支付渠道") + private Integer payChannel; + @ApiModelProperty(value = "配送类型", required = true) + private Integer deliveryType; + @ApiModelProperty(value = "发货时间") + private Date deliveryTime; + @ApiModelProperty(value = "收货时间") + private Date receiveTime; + @ApiModelProperty(value = "收件人名称", required = true) + private String receiverName; + @ApiModelProperty(value = "手机号", required = true) + private String receiverMobile; + @ApiModelProperty(value = "地区编码", required = true) + private Integer receiverAreaCode; + @ApiModelProperty(value = "收件详细地址", required = true) + private String receiverDetailAddress; + @ApiModelProperty(value = "售后状态", required = true) + private Integer afterSaleStatus; + @ApiModelProperty(value = "优惠劵编号") + private Integer couponCardId; + @ApiModelProperty(value = "创建时间", required = true) + private Date createTime; + + /** + * 订单项数组 + * + * // TODO 芋艿,后续考虑怎么优化下,目前是内嵌了别的 dto + */ + private List orderItems; + + +} diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/refund/TradeRefundController.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/refund/TradeRefundController.java new file mode 100644 index 000000000..aa419190e --- /dev/null +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/refund/TradeRefundController.java @@ -0,0 +1,4 @@ +package cn.iocoder.yudao.module.trade.controller.app.refund; + +public class TradeRefundController { +} diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/package-info.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/package-info.java new file mode 100644 index 000000000..aa2f99f35 --- /dev/null +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/package-info.java @@ -0,0 +1,6 @@ +/** + * 提供 RESTful API 给前端: + * 1. admin 包:提供给管理后台 yudao-ui-admin 前端项目 + * 2. app 包:提供给用户 APP yudao-ui-app 前端项目,它的 Controller 和 VO 都要添加 App 前缀,用于和管理后台进行区分 + */ +package cn.iocoder.yudao.module.trade.controller; diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/cart/CartItemDO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/cart/CartItemDO.java index 5722882ce..b92ca8b54 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/cart/CartItemDO.java +++ b/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 { // ========= 买家信息 BEGIN ========= -// /** -// * 店铺编号 -// * -// * 关联 {@link ShopDO#getId()} TODO 芋艿:多店铺,暂不考虑 -// */ -// private Long shopId; /** * 用户编号 * diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/order/TradeOrderDO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/order/TradeOrderDO.java index 175ebdc95..38cc67a48 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/order/TradeOrderDO.java +++ b/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; 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.DeliveryTypeEnum; -import cn.iocoder.yudao.module.trade.enums.order.TradeOrderCloseTypeEnum; +import cn.iocoder.yudao.module.trade.enums.order.TradeOrderCancelTypeEnum; +import cn.iocoder.yudao.module.trade.enums.order.TradeOrderRefundStatusEnum; import cn.iocoder.yudao.module.trade.enums.order.TradeOrderStatusEnum; 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.*; @@ -32,67 +32,68 @@ public class TradeOrderDO extends BaseDO { /** * 订单编号,主键自增 */ - private Integer id; + private Long id; /** * 订单流水号 * * 例如说,1146347329394184195 */ private String sn; - // TODO 芋艿:order_type 订单类型 /** * 订单类型 * * 枚举 {@link TradeOrderTypeEnum} */ - private Integer type; + private Integer type; // TODO order_promotion_type /** * 订单来源终端 * * 枚举 {@link TerminalEnum} */ private Integer terminal; -// /** -// * 店铺编号 -// * -// * 关联 {@link ShopDO#getId()} TODO 芋艿:多店铺,暂不考虑 -// */ -// private Long shopId; /** * 用户编号 * * 关联 MemberUserDO 的 id 编号 */ private Long userId; + /** + * 用户 IP + */ + private String userIp; + /** + * 用户备注 + */ + private String userRemark; /** * 订单状态 * * 枚举 {@link TradeOrderStatusEnum} */ private Integer status; - /** - * 关闭类型 - * - * 枚举 {@link TradeOrderCloseTypeEnum} - */ - private Integer closeType; // TODO 芋艿:要不要存储 prod_name 购买的商品名门? /** * 购买的商品数量 */ private Integer productCount; // total_num /** - * 备注 + * 订单完成时间 */ - private String remark; - /** - * 确认收获时间 - */ - private Date confirmTakeTime; + private Date finishTime; /** * 订单取消时间 */ private Date cancelTime; + /** + * 取消类型 + * + * 枚举 {@link TradeOrderCancelTypeEnum} + */ + private Integer cancelType; + /** + * 商家备注 + */ + private String remark; // ========== 价格 + 支付基本信息 ========== /** @@ -101,39 +102,33 @@ public class TradeOrderDO extends BaseDO { * true - 已经支付过 * false - 没有支付过 */ - private Boolean payed; // TODO payStatus 0 - 待付款;1 - 已付款;2 - 已退款 + private Boolean payed; /** * 付款时间 */ private Date payTime; - // TODO 芋艿:delete_status 用户订单删除状态;0 - 未删除;1 - 回收站;2 - 永久删除 - // ========== 价格 + 支付基本信息 ========== /** * 购买(商品)总金额,单位:分 */ - private Integer buyPrice; // total + private Integer buyPrice; // niu - goods_money; /** - * 优惠总金额,单位:分。 + * 运费金额,单位:分 */ - private Integer discountPrice; // reduce_amount - /** - * 物流金额 (分) - */ - private Integer logisticsPrice; // freight_amount; freight_price + private Integer deliveryPrice; // niu - delivery_money; /** * 最终金额,单位:分 * - * buyPrice + logisticsPrice - discountPrice = presentPrice + * presentPrice = buyPrice + deliveryPrice - couponPrice - integralPrice - marketPrice */ - private Integer presentPrice; // actual_total + private Integer presentPrice; // niu - order_money; /** * 实际已支付金额,单位:分 * * 初始时,金额为 0 。等到支付成功后,会进行更新。 */ - private Integer payPrice; + private Integer payPrice; // niu - pay_money; /** * 支付订单编号 * @@ -148,10 +143,19 @@ public class TradeOrderDO extends BaseDO { // ========== 收件 + 物流基本信息 ========== /** * 配送方式 + * 会员用户下单时,选择的配送方式 * * 枚举 {@link DeliveryTypeEnum} */ private Integer deliveryType; + /** + * 实际的配送方式 + * 管理后台发货时,选择的配送方式 + * + * 0 - 无需物流 + * 枚举 {@link DeliveryTypeEnum} + */ + private Integer actualDeliveryType; // like - shipping_status; /** * 配置模板的编号 * @@ -162,6 +166,13 @@ public class TradeOrderDO extends BaseDO { * 物流公司单号 */ private String expressNo; // dvy_flow_id + /** + * 发货状态 + * + * true - 已发货 + * false - 未发货 + */ + private Boolean deliveryStatus; /** * 发货时间 */ @@ -210,26 +221,35 @@ public class TradeOrderDO extends BaseDO { /** * 优惠劵编号 */ - private Integer couponId; - - // TODO 芋艿,这块还要结合营销和价格计算,在去优化下。 + private Long couponId; + /** + * 优惠劵减免金额,单位:分 + */ + private Integer couponPrice; // niu - coupon_money; + /** + * 营销减免金额,单位:分 + * + * 例如说:满减折扣 + */ + private Integer marketPrice; // niu - promotion_money; + /** + * 积分抵扣的金额,单位:分 + */ + private Integer integralPrice; + /** + * 使用的积分 + */ + private Integer useIntegral; // TODO ========== 待定字段:yv ========= // TODO cart_id:购物车 id - // TODO total_postage:邮费 - // TODO pay_postage:支付邮费 - // TODO coupon_price:优惠劵金额; - // TODO refund_status:0 未退款;1 申请中;2 已退款 // TODO refund_reason_wap_img:退款图片 // TODO refund_reason_wap_explain:退款用户说明 // TODO refund_reason_time:退款时间 // TODO refund_reason_wap:前台退款原因 // TODO refund_reason:不退款的理由 - // TODO refund_price:退款金额 // TODO gain_integral:消费赚取积分 - // TODO use_integral:使用积分 - // TODO pay_integral:实际支付积分 // TODO back_integral:给用户退了多少积分 // TODO combination_id:拼团产品id @@ -246,18 +266,19 @@ public class TradeOrderDO extends BaseDO { // TODO is_alter_price:是否改价 // 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格式 + // TODO ========== 待定字段:nf ========= + // TODO delivery_code:整体提货编码 + + // TODO ========== 待定字段:niu ========= + // TODO adjust_money '订单调整金额' + // TODO balance_money ''余额支付金额'' + } diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/order/TradeOrderItemDO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/order/TradeOrderItemDO.java index 6bdb7c6d4..81961928e 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/order/TradeOrderItemDO.java +++ b/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 { /** * 编号 */ - private Integer id; -// /** -// * 店铺编号 -// * -// * 关联 {@link ShopDO#getId()} TODO 芋艿:多店铺,暂不考虑 -// */ -// private Long shopId; + private Long id; /** * 用户编号 * @@ -47,12 +41,6 @@ public class TradeOrderItemDO extends BaseDO { private Long orderId; // ========== 商品基本信息 ========== - /** - * 商品 SPU 编号 - * - * 关联 ProductSpuDO 的 id 编号 - */ - private Long spuId; /** * 商品 SKU 编号 * @@ -75,7 +63,7 @@ public class TradeOrderItemDO extends BaseDO { /** * 购买数量 */ - private Integer stock; + private Integer count; /** * 是否评论 * @@ -85,37 +73,47 @@ public class TradeOrderItemDO extends BaseDO { private Boolean commented; // ========== 价格 + 支付基本信息 ========== - /** - * 原始单价,单位:分。 - */ - private Integer originPrice; // price /** * 购买单价,单位:分 + * + * 对应 ProductSkuDO 的 price 字段 */ - private Integer buyPrice; + private Integer buyPrice; // like - original_price;niu - costPrice /** * 最终单价,单位:分。 */ - private Integer presentPrice; + private Integer presentPrice; // like - goods_price;niu - price /** * 购买总金额,单位:分 - * - * 用途类似 {@link #presentTotal} */ - private Integer buyTotal; - /** - * 优惠总金额,单位:分。 - */ - private Integer discountTotal; + private Integer buyTotal; // like - total_price;niu - 暂无 /** * 最终总金额,单位:分。 * - * 注意,presentPrice * stock 不一定等于 presentTotal 。 + * 注意,presentPrice * count 不一定等于 presentTotal 。 * 因为,存在无法整除的情况。 * 举个例子,presentPrice = 8.33 ,stock = 3 的情况,presentTotal 有可能是 24.99 ,也可能是 25 。 * 所以,需要存储一个该字段。 */ - private Integer presentTotal; // product_total_amount + private Integer presentTotal; // like - total_pay_price;niu - goods_money + + // ========== 营销基本信息 ========== + /** + * 优惠劵满减金额,单位:分 + */ + private Integer couponTotal; // like - discount_price;niu - coupon_money + /** + * 营销减免金额,单位:分 + */ + private Integer marketTotal; // like - discount_price;niu - promotion_money + /** + * 积分抵扣的金额,单位:分 + */ + private Integer integralTotal; // like - integral_price;niu - point_money + /** + * 使用的积分 + */ + private Integer useIntegral; // niu - use_point // ========== 退款基本信息 ========== /** @@ -123,7 +121,7 @@ public class TradeOrderItemDO extends BaseDO { * * 枚举 {@link TradeOrderItemRefundStatusEnum} */ - private Integer refundStatus; + private Integer refundStatus; // TODO 芋艿:可以考虑去查 // 如上字段,举个例子: // 假设购买三个,即 stock = 3 。 // originPrice = 15 @@ -178,4 +176,22 @@ public class TradeOrderItemDO extends BaseDO { // TODO goods_info 商品信息 // TODO integral_price:积分抵扣的金额 + + // TODO 待确定:niu + // TODO is_virtual '是否是虚拟商品' + // TODO goods_class '商品种类(1.实物 2.虚拟3.卡券)' + // TODO adjust_money ''调整金额'' + + // TODO is_fenxiao 是否分销, + // TODO adjust_money 是否分销, + + // TODO delivery_status '配送状态' + // TODO delivery_no ''配送单号'' + // TODO gift_flag '赠品标识' + // TODO gift_flag '赠品标识' + + // TODO refund_status '退款状态' + // TODO refund_type '退款状态' + // TODO 一堆退款字段 } + diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/refund/TradeRefundDO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/refund/TradeRefundDO.java index 6c910df4c..cd246a297 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/refund/TradeRefundDO.java +++ b/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 { * 枚举 {@link TradeOrderRefundStatusEnum} */ private Integer status; -// /** -// * 店铺编号 -// * -// * 关联 {@link ShopDO#getId()} TODO 芋艿:多店铺,暂不考虑 -// */ -// private Long shopId; /** * 用户编号 * diff --git a/yudao-server/pom.xml b/yudao-server/pom.xml index 55c91e2f8..c7090aa6e 100644 --- a/yudao-server/pom.xml +++ b/yudao-server/pom.xml @@ -51,6 +51,11 @@ yudao-module-product-biz ${revision} + + cn.iocoder.boot + yudao-module-trade-biz + ${revision} +