From 3914b326378d7021aef92ef8ad68262cb89df181 Mon Sep 17 00:00:00 2001
From: YunaiV <>
Date: Thu, 6 Aug 2020 21:13:21 +0800
Subject: [PATCH] =?UTF-8?q?=E8=BF=81=E7=A7=BB=E8=B4=AD=E7=89=A9=E8=BD=A6?=
=?UTF-8?q?=E6=A8=A1=E5=9D=97?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../core/ErrorCodeAutoGenerator.java | 1 +
.../order-service-api/pom.xml | 31 +++++
.../enums/OrderErrorCodeConstants.java | 51 ++++++++
.../mall/orderservice/rpc/cart/CartRpc.java | 28 +++++
.../rpc/cart/dto/CartItemAddReqDTO.java | 34 +++++
.../dto/CartItemUpdateQuantityReqDTO.java | 34 +++++
.../order-service-app/pom.xml | 119 ++++++++++++++++++
.../orderservice/OrderServiceApplication.java | 13 ++
.../orderservice/config/AopConfiguration.java | 12 ++
.../config/DatabaseConfiguration.java | 28 +++++
.../convert/cart/CartConvert.java | 18 +++
.../mysql/dataobject/cart}/CartItemDO.java | 38 ++----
.../dal/mysql/mapper/cart/CartItemMapper.java | 32 +++++
.../manager/cart/CartManager.java | 65 ++++++++++
.../orderservice/manager/package-info.java | 1 +
.../orderservice/rpc/cart/CartRpcImpl.java | 28 +++++
.../service/cart/CartService.java | 111 ++++++++++++++++
.../service/cart/bo/CartItemAddBO.java | 38 ++++++
.../service/cart/bo/CartItemBO.java | 37 +-----
.../src/main/resources/application-dev.yaml | 21 ++++
.../src/main/resources/application-local.yaml | 24 ++++
.../src/main/resources/application.yaml | 60 +++++++++
order-service-project/pom.xml | 39 ++++++
.../mall/order/biz/dao/cart/CartMapper.java | 3 -
.../mall/order/biz/service/CartService.java | 49 +-------
.../OrderReturnNonExistentException.java | 10 --
.../pom.xml | 2 +-
.../iocoder/mall/order/api/CartService.java | 0
.../order/api/OrderCommentReplyService.java | 0
.../mall/order/api/OrderCommentService.java | 0
.../mall/order/api/OrderLogisticsService.java | 0
.../mall/order/api/OrderReturnService.java | 0
.../iocoder/mall/order/api/OrderService.java | 0
.../mall/order/api/bo/CalcOrderPriceBO.java | 0
.../mall/order/api/bo/CalcSkuPriceBO.java | 0
.../iocoder/mall/order/api/bo/CartItemBO.java | 0
.../cn/iocoder/mall/order/api/bo/OrderBO.java | 0
.../mall/order/api/bo/OrderCommentBO.java | 0
.../order/api/bo/OrderCommentCreateBO.java | 0
.../OrderCommentInfoAndMerchantReplyBO.java | 0
.../mall/order/api/bo/OrderCommentInfoBO.java | 0
.../api/bo/OrderCommentMerchantReplyBO.java | 0
.../mall/order/api/bo/OrderCommentPageBO.java | 0
.../api/bo/OrderCommentReplyCreateBO.java | 0
.../order/api/bo/OrderCommentReplyPageBO.java | 0
.../api/bo/OrderCommentStateInfoPageBO.java | 0
.../order/api/bo/OrderCommentTimeOutBO.java | 0
.../mall/order/api/bo/OrderCreateBO.java | 0
.../mall/order/api/bo/OrderInfoBO.java | 0
.../mall/order/api/bo/OrderItemBO.java | 0
.../api/bo/OrderLastLogisticsInfoBO.java | 0
.../mall/order/api/bo/OrderLogisticsBO.java | 0
.../order/api/bo/OrderLogisticsInfoBO.java | 0
.../api/bo/OrderLogisticsInfoWithOrderBO.java | 0
.../mall/order/api/bo/OrderPageBO.java | 0
.../iocoder/mall/order/api/bo/OrderPayBO.java | 0
.../mall/order/api/bo/OrderRecipientBO.java | 0
.../mall/order/api/bo/OrderReturnInfoBO.java | 0
.../mall/order/api/bo/OrderReturnListBO.java | 0
.../mall/order/api/bo/PostageDetailBO.java | 0
.../api/constant/CartItemStatusEnum.java | 0
.../order/api/constant/DictKeyConstants.java | 0
.../order/api/constant/ErrorCodeInterval.java | 0
.../order/api/constant/LogisticsEnum.java | 0
.../mall/order/api/constant/MQConstants.java | 0
.../api/constant/OrderCancelReasonsEnum.java | 0
.../constant/OrderCommentRelpyTypeEnum.java | 0
.../api/constant/OrderCommentStatusEnum.java | 0
.../api/constant/OrderErrorCodeEnum.java | 0
.../constant/OrderHasReturnExchangeEnum.java | 0
.../order/api/constant/OrderPayStatus.java | 0
.../api/constant/OrderReplyUserTypeEnum.java | 0
.../constant/OrderReturnServiceTypeEnum.java | 0
.../api/constant/OrderReturnStatusEnum.java | 0
.../api/constant/OrderReturnTypeEnum.java | 0
.../order/api/constant/OrderStatusEnum.java | 0
.../mall/order/api/constant/PayAppId.java | 0
.../mall/order/api/dto/CalcOrderPriceDTO.java | 0
.../order/api/dto/OrderCommentCreateDTO.java | 0
.../order/api/dto/OrderCommentPageDTO.java | 0
.../api/dto/OrderCommentReplyCreateDTO.java | 0
.../api/dto/OrderCommentReplyPageDTO.java | 0
.../api/dto/OrderCommentStateInfoPageDTO.java | 0
.../api/dto/OrderCommentTimeOutPageDTO.java | 0
.../mall/order/api/dto/OrderCreateDTO.java | 0
.../mall/order/api/dto/OrderDeliveryDTO.java | 0
.../order/api/dto/OrderItemDeletedDTO.java | 0
.../order/api/dto/OrderItemUpdateDTO.java | 0
.../api/dto/OrderLogisticsUpdateDTO.java | 0
.../mall/order/api/dto/OrderQueryDTO.java | 0
.../order/api/dto/OrderReturnApplyDTO.java | 0
.../order/api/dto/OrderReturnCreateDTO.java | 0
.../order/api/dto/OrderReturnQueryDTO.java | 0
.../mall/order/api/dto/OrderUserPageDTO.java | 0
.../mall/order/biz/dao/CartMapper.java | 46 -------
.../order/biz/service/CartServiceImpl.java | 89 -------------
order/pom.xml | 10 +-
pom.xml | 5 +-
.../service/sku/ProductSkuService.java | 2 +
99 files changed, 810 insertions(+), 269 deletions(-)
create mode 100644 order-service-project/order-service-api/pom.xml
create mode 100644 order-service-project/order-service-api/src/main/java/cn/iocoder/mall/orderservice/enums/OrderErrorCodeConstants.java
create mode 100644 order-service-project/order-service-api/src/main/java/cn/iocoder/mall/orderservice/rpc/cart/CartRpc.java
create mode 100644 order-service-project/order-service-api/src/main/java/cn/iocoder/mall/orderservice/rpc/cart/dto/CartItemAddReqDTO.java
create mode 100644 order-service-project/order-service-api/src/main/java/cn/iocoder/mall/orderservice/rpc/cart/dto/CartItemUpdateQuantityReqDTO.java
create mode 100644 order-service-project/order-service-app/pom.xml
create mode 100644 order-service-project/order-service-app/src/main/java/cn/iocoder/mall/orderservice/OrderServiceApplication.java
create mode 100644 order-service-project/order-service-app/src/main/java/cn/iocoder/mall/orderservice/config/AopConfiguration.java
create mode 100644 order-service-project/order-service-app/src/main/java/cn/iocoder/mall/orderservice/config/DatabaseConfiguration.java
create mode 100644 order-service-project/order-service-app/src/main/java/cn/iocoder/mall/orderservice/convert/cart/CartConvert.java
rename {order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject => order-service-project/order-service-app/src/main/java/cn/iocoder/mall/orderservice/dal/mysql/dataobject/cart}/CartItemDO.java (62%)
create mode 100644 order-service-project/order-service-app/src/main/java/cn/iocoder/mall/orderservice/dal/mysql/mapper/cart/CartItemMapper.java
create mode 100644 order-service-project/order-service-app/src/main/java/cn/iocoder/mall/orderservice/manager/cart/CartManager.java
create mode 100644 order-service-project/order-service-app/src/main/java/cn/iocoder/mall/orderservice/manager/package-info.java
create mode 100644 order-service-project/order-service-app/src/main/java/cn/iocoder/mall/orderservice/rpc/cart/CartRpcImpl.java
create mode 100644 order-service-project/order-service-app/src/main/java/cn/iocoder/mall/orderservice/service/cart/CartService.java
create mode 100644 order-service-project/order-service-app/src/main/java/cn/iocoder/mall/orderservice/service/cart/bo/CartItemAddBO.java
rename order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dataobject/CartItemDO.java => order-service-project/order-service-app/src/main/java/cn/iocoder/mall/orderservice/service/cart/bo/CartItemBO.java (61%)
create mode 100644 order-service-project/order-service-app/src/main/resources/application-dev.yaml
create mode 100644 order-service-project/order-service-app/src/main/resources/application-local.yaml
create mode 100644 order-service-project/order-service-app/src/main/resources/application.yaml
create mode 100644 order-service-project/pom.xml
delete mode 100644 order/order-service-api/src/main/java/cn/iocoder/mall/order/api/exception/OrderReturnNonExistentException.java
rename order/{order-service-api => order-service-api02}/pom.xml (97%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/CartService.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/OrderCommentReplyService.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/OrderCommentService.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/OrderLogisticsService.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/OrderReturnService.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/OrderService.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/bo/CalcOrderPriceBO.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/bo/CalcSkuPriceBO.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/bo/CartItemBO.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/bo/OrderBO.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentBO.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentCreateBO.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentInfoAndMerchantReplyBO.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentInfoBO.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentMerchantReplyBO.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentPageBO.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentReplyCreateBO.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentReplyPageBO.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentStateInfoPageBO.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentTimeOutBO.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/bo/OrderCreateBO.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/bo/OrderInfoBO.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/bo/OrderItemBO.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/bo/OrderLastLogisticsInfoBO.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/bo/OrderLogisticsBO.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/bo/OrderLogisticsInfoBO.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/bo/OrderLogisticsInfoWithOrderBO.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/bo/OrderPageBO.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/bo/OrderPayBO.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/bo/OrderRecipientBO.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/bo/OrderReturnInfoBO.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/bo/OrderReturnListBO.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/bo/PostageDetailBO.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/constant/CartItemStatusEnum.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/constant/DictKeyConstants.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/constant/ErrorCodeInterval.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/constant/LogisticsEnum.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/constant/MQConstants.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/constant/OrderCancelReasonsEnum.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/constant/OrderCommentRelpyTypeEnum.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/constant/OrderCommentStatusEnum.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/constant/OrderErrorCodeEnum.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/constant/OrderHasReturnExchangeEnum.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/constant/OrderPayStatus.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/constant/OrderReplyUserTypeEnum.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/constant/OrderReturnServiceTypeEnum.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/constant/OrderReturnStatusEnum.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/constant/OrderReturnTypeEnum.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/constant/OrderStatusEnum.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/constant/PayAppId.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/dto/CalcOrderPriceDTO.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/dto/OrderCommentCreateDTO.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/dto/OrderCommentPageDTO.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/dto/OrderCommentReplyCreateDTO.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/dto/OrderCommentReplyPageDTO.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/dto/OrderCommentStateInfoPageDTO.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/dto/OrderCommentTimeOutPageDTO.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/dto/OrderCreateDTO.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/dto/OrderDeliveryDTO.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/dto/OrderItemDeletedDTO.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/dto/OrderItemUpdateDTO.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/dto/OrderLogisticsUpdateDTO.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/dto/OrderQueryDTO.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/dto/OrderReturnApplyDTO.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/dto/OrderReturnCreateDTO.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/dto/OrderReturnQueryDTO.java (100%)
rename order/{order-service-api => order-service-api02}/src/main/java/cn/iocoder/mall/order/api/dto/OrderUserPageDTO.java (100%)
delete mode 100644 order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dao/CartMapper.java
diff --git a/common/mall-spring-boot-starter-system-error-code/src/main/java/cn/iocoder/mall/system/errorcode/core/ErrorCodeAutoGenerator.java b/common/mall-spring-boot-starter-system-error-code/src/main/java/cn/iocoder/mall/system/errorcode/core/ErrorCodeAutoGenerator.java
index 49a3bb6df..49adbef56 100644
--- a/common/mall-spring-boot-starter-system-error-code/src/main/java/cn/iocoder/mall/system/errorcode/core/ErrorCodeAutoGenerator.java
+++ b/common/mall-spring-boot-starter-system-error-code/src/main/java/cn/iocoder/mall/system/errorcode/core/ErrorCodeAutoGenerator.java
@@ -64,6 +64,7 @@ public class ErrorCodeAutoGenerator {
return;
}
try {
+ // TODO 芋艿:校验是否重复了;
ErrorCode errorCode = (ErrorCode) field.get(errorCodeConstantsClazz);
autoGenerateDTOs.add(new ErrorCodeAutoGenerateDTO().setGroup(group)
.setCode(errorCode.getCode()).setMessage(errorCode.getMessage()));
diff --git a/order-service-project/order-service-api/pom.xml b/order-service-project/order-service-api/pom.xml
new file mode 100644
index 000000000..976d0e740
--- /dev/null
+++ b/order-service-project/order-service-api/pom.xml
@@ -0,0 +1,31 @@
+
+
+
+ order-service-project
+ cn.iocoder.mall
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ order-service-api
+
+
+
+ cn.iocoder.mall
+ common-framework
+
+
+
+
+ javax.validation
+ validation-api
+
+
+ org.projectlombok
+ lombok
+
+
+
+
diff --git a/order-service-project/order-service-api/src/main/java/cn/iocoder/mall/orderservice/enums/OrderErrorCodeConstants.java b/order-service-project/order-service-api/src/main/java/cn/iocoder/mall/orderservice/enums/OrderErrorCodeConstants.java
new file mode 100644
index 000000000..18f3af756
--- /dev/null
+++ b/order-service-project/order-service-api/src/main/java/cn/iocoder/mall/orderservice/enums/OrderErrorCodeConstants.java
@@ -0,0 +1,51 @@
+package cn.iocoder.mall.orderservice.enums;
+
+import cn.iocoder.common.framework.exception.ErrorCode;
+
+/**
+ * 订单错误码
+ *
+ * 错误码区间 [1-008-000-000 ~ 1-008-000-000]
+ *
+ * @author Sin
+ * @time 2019-03-23 11:23
+ */
+public interface OrderErrorCodeConstants {
+
+ // order
+ ErrorCode ORDER_NOT_EXISTENT = new ErrorCode(1008000000, "获取订单不存在!");
+ ErrorCode ORDER_GET_SKU_FAIL = new ErrorCode(1008000001, "获取商品失败!)");
+ ErrorCode ORDER_GET_SKU_NOT_EXISTENT = new ErrorCode(1008000002, "获取的商品不存在!");
+ ErrorCode ORDER_PAY_AMOUNT_NOT_NEGATIVE = new ErrorCode(1008000003, "支付金额不能为负数!");
+ ErrorCode ORDER_STATUS_NOT_CANCEL = new ErrorCode(1008000004, "订单状态不能取消!)");
+ ErrorCode ORDER_DELIVERY_INCORRECT_DATA = new ErrorCode(1008000005, "订单发货数据不正确!");
+ ErrorCode ORDER_INSUFFICIENT_INVENTORY = new ErrorCode(1008000006, "库存不足!");
+ ErrorCode ORDER_GOODS_AMOUNT_INCORRECT = new ErrorCode(1008000007, "商品金额非法!");
+ ErrorCode ORDER_GET_GOODS_INFO_INCORRECT = new ErrorCode(1008000008, "获取额商品信息不正确!");
+ ErrorCode ORDER_GET_USER_ADDRESS_FAIL = new ErrorCode(1008000009, "获取用户地址失败!");
+ ErrorCode ORDER_GET_PAY_FAIL = new ErrorCode(1008000010, "调用pay失败!");
+ ErrorCode ORDER_NOT_USER_ORDER = new ErrorCode(1008000011, "不是该用户的订单!");
+ ErrorCode ORDER_UNABLE_CONFIRM_ORDER = new ErrorCode(1008000012, "状态不对不能确认订单!");
+ ErrorCode ORDER_CREATE_CART_IS_EMPTY = new ErrorCode(1008000013, "购物车无选中的商品,无法创建订单");
+ ErrorCode ORDER_STATUS_NOT_WAITING_PAYMENT = new ErrorCode(1008000014, "订单不处于等待支付状态");
+ ErrorCode ORDER_PAY_AMOUNT_ERROR = new ErrorCode(1008000015, "订单金额不正确");
+
+ // order item
+ ErrorCode ORDER_ITEM_ONLY_ONE = new ErrorCode(1008000200, "订单Item只有一个!");
+ ErrorCode ORDER_ITEM_SOME_NOT_EXISTS = new ErrorCode(1008000201, "有不存在的商品!");
+
+ // 订单退货
+ ErrorCode ORDER_RETURN_NO_RETURN_APPLY = new ErrorCode(1008000400, "未退货申请");
+ ErrorCode ORDER_RETURN_NOT_EXISTENT = new ErrorCode(1008000401, "退货订单不存在");
+ ErrorCode ORDER_RETURN_REFUND_FAILED = new ErrorCode(1008000402, "退款失败");
+
+ // ========== 购物车 ==========
+ ErrorCode CARD_ITEM_NOT_FOUND = new ErrorCode(1008003000, "购物车项不存在");
+ ErrorCode CARD_ITEM_SKU_NOT_FOUND = new ErrorCode(1008003001, "商品不存在");
+ ErrorCode CARD_ITEM_SKU_QUANTITY_NOT_ENOUGH = new ErrorCode(1008003002, "商品库存不足");
+
+ // 工具类服务 1008004000
+ ErrorCode DICT_SERVER_INVOKING_FAIL = new ErrorCode(1008004000, "字典服务调用失败!");
+ ErrorCode ORDER_LOGISTICS_INVOKING_FAIL = new ErrorCode(1008004001, "订单物流调用失败!");
+
+}
diff --git a/order-service-project/order-service-api/src/main/java/cn/iocoder/mall/orderservice/rpc/cart/CartRpc.java b/order-service-project/order-service-api/src/main/java/cn/iocoder/mall/orderservice/rpc/cart/CartRpc.java
new file mode 100644
index 000000000..c1a5272d1
--- /dev/null
+++ b/order-service-project/order-service-api/src/main/java/cn/iocoder/mall/orderservice/rpc/cart/CartRpc.java
@@ -0,0 +1,28 @@
+package cn.iocoder.mall.orderservice.rpc.cart;
+
+import cn.iocoder.common.framework.vo.CommonResult;
+import cn.iocoder.mall.orderservice.rpc.cart.dto.CartItemAddReqDTO;
+import cn.iocoder.mall.orderservice.rpc.cart.dto.CartItemUpdateQuantityReqDTO;
+
+/**
+ * 购物车 Rpc 接口
+ */
+public interface CartRpc {
+
+ /**
+ * 添加商品到购物车
+ *
+ * @param addReqDTO 添加商品信息
+ * @return 成功
+ */
+ CommonResult addCartItem(CartItemAddReqDTO addReqDTO);
+
+ /**
+ * 更新购物车商品数量
+ *
+ * @param updateQuantityReqDTO 更新商品数量
+ * @return 成功
+ */
+ CommonResult updateCartItemSelected(CartItemUpdateQuantityReqDTO updateQuantityReqDTO);
+
+}
diff --git a/order-service-project/order-service-api/src/main/java/cn/iocoder/mall/orderservice/rpc/cart/dto/CartItemAddReqDTO.java b/order-service-project/order-service-api/src/main/java/cn/iocoder/mall/orderservice/rpc/cart/dto/CartItemAddReqDTO.java
new file mode 100644
index 000000000..889be24e0
--- /dev/null
+++ b/order-service-project/order-service-api/src/main/java/cn/iocoder/mall/orderservice/rpc/cart/dto/CartItemAddReqDTO.java
@@ -0,0 +1,34 @@
+package cn.iocoder.mall.orderservice.rpc.cart.dto;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import javax.validation.constraints.Min;
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+
+/**
+ * 购物车添加购物项 Request DTO
+ */
+@Data
+@Accessors(chain = true)
+public class CartItemAddReqDTO implements Serializable {
+
+ /**
+ * 用户编号
+ */
+ @NotNull(message = "用户编号不能为空")
+ private Integer userId;
+ /**
+ * 商品 SKU 编号
+ */
+ @NotNull(message = "商品 SKU 编号不能为空")
+ private Integer skuId;
+ /**
+ * 数量
+ */
+ @NotNull(message = "数量不能为空")
+ @Min(message = "数量必须大于 0", value = 1L)
+ private Integer quantity;
+
+}
diff --git a/order-service-project/order-service-api/src/main/java/cn/iocoder/mall/orderservice/rpc/cart/dto/CartItemUpdateQuantityReqDTO.java b/order-service-project/order-service-api/src/main/java/cn/iocoder/mall/orderservice/rpc/cart/dto/CartItemUpdateQuantityReqDTO.java
new file mode 100644
index 000000000..1f6c5cbac
--- /dev/null
+++ b/order-service-project/order-service-api/src/main/java/cn/iocoder/mall/orderservice/rpc/cart/dto/CartItemUpdateQuantityReqDTO.java
@@ -0,0 +1,34 @@
+package cn.iocoder.mall.orderservice.rpc.cart.dto;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import javax.validation.constraints.Min;
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+
+/**
+ * 购物车更新数量 Request DTO
+ */
+@Data
+@Accessors(chain = true)
+public class CartItemUpdateQuantityReqDTO implements Serializable {
+
+ /**
+ * 用户编号
+ */
+ @NotNull(message = "用户编号不能为空")
+ private Integer userId;
+ /**
+ * 商品 SKU 编号
+ */
+ @NotNull(message = "商品 SKU 编号不能为空")
+ private Integer skuId;
+ /**
+ * 数量
+ */
+ @NotNull(message = "数量不能为空")
+ @Min(message = "数量必须大于 0", value = 1L)
+ private Integer quantity;
+
+}
diff --git a/order-service-project/order-service-app/pom.xml b/order-service-project/order-service-app/pom.xml
new file mode 100644
index 000000000..2d6efb0c0
--- /dev/null
+++ b/order-service-project/order-service-app/pom.xml
@@ -0,0 +1,119 @@
+
+
+
+ order-service-project
+ cn.iocoder.mall
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ order-service-app
+
+
+
+ cn.iocoder.mall
+ mall-spring-boot-starter-dubbo
+
+
+
+
+ cn.iocoder.mall
+ system-service-api
+ ${project.version}
+
+
+
+
+ cn.iocoder.mall
+ product-service-api
+ 1.0-SNAPSHOT
+
+
+
+
+ cn.iocoder.mall
+ order-service-api
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+
+ cn.iocoder.mall
+ mall-spring-boot-starter-rocketmq
+
+
+
+
+ com.alibaba.cloud
+ spring-cloud-starter-alibaba-nacos-discovery
+
+
+
+
+ mysql
+ mysql-connector-java
+
+
+
+ com.alibaba
+ druid-spring-boot-starter
+
+
+
+ cn.iocoder.mall
+ mall-spring-boot-starter-mybatis
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-actuator
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-validation
+
+
+
+ org.projectlombok
+ lombok
+
+
+
+ org.mapstruct
+ mapstruct
+
+
+ org.mapstruct
+ mapstruct-jdk8
+
+
+
+ org.aspectj
+ aspectjweaver
+ 1.9.6
+
+
+
+
+
+ ${project.artifactId}
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
+
diff --git a/order-service-project/order-service-app/src/main/java/cn/iocoder/mall/orderservice/OrderServiceApplication.java b/order-service-project/order-service-app/src/main/java/cn/iocoder/mall/orderservice/OrderServiceApplication.java
new file mode 100644
index 000000000..dd7635638
--- /dev/null
+++ b/order-service-project/order-service-app/src/main/java/cn/iocoder/mall/orderservice/OrderServiceApplication.java
@@ -0,0 +1,13 @@
+package cn.iocoder.mall.orderservice;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class OrderServiceApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(OrderServiceApplication.class, args);
+ }
+
+}
diff --git a/order-service-project/order-service-app/src/main/java/cn/iocoder/mall/orderservice/config/AopConfiguration.java b/order-service-project/order-service-app/src/main/java/cn/iocoder/mall/orderservice/config/AopConfiguration.java
new file mode 100644
index 000000000..ae4d9199a
--- /dev/null
+++ b/order-service-project/order-service-app/src/main/java/cn/iocoder/mall/orderservice/config/AopConfiguration.java
@@ -0,0 +1,12 @@
+package cn.iocoder.mall.orderservice.config;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.EnableAspectJAutoProxy;
+
+/**
+ * Spring Aop 配置类
+ */
+@Configuration
+@EnableAspectJAutoProxy(proxyTargetClass = true, exposeProxy = true)
+public class AopConfiguration {
+}
diff --git a/order-service-project/order-service-app/src/main/java/cn/iocoder/mall/orderservice/config/DatabaseConfiguration.java b/order-service-project/order-service-app/src/main/java/cn/iocoder/mall/orderservice/config/DatabaseConfiguration.java
new file mode 100644
index 000000000..4e91f4b69
--- /dev/null
+++ b/order-service-project/order-service-app/src/main/java/cn/iocoder/mall/orderservice/config/DatabaseConfiguration.java
@@ -0,0 +1,28 @@
+package cn.iocoder.mall.orderservice.config;
+
+import com.baomidou.mybatisplus.core.injector.DefaultSqlInjector;
+import com.baomidou.mybatisplus.core.injector.ISqlInjector;
+import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+@Configuration
+@MapperScan("cn.iocoder.mall.orderservice.dal.mysql.mapper") // 扫描对应的 Mapper 接口
+@EnableTransactionManagement(proxyTargetClass = true) // 启动事务管理。
+public class DatabaseConfiguration {
+
+ // 数据库连接池 Druid
+
+ @Bean
+ public ISqlInjector sqlInjector() {
+ return new DefaultSqlInjector(); // MyBatis Plus 逻辑删除
+ }
+
+ @Bean
+ public PaginationInterceptor paginationInterceptor() {
+ return new PaginationInterceptor(); // MyBatis Plus 分页插件
+ }
+
+}
diff --git a/order-service-project/order-service-app/src/main/java/cn/iocoder/mall/orderservice/convert/cart/CartConvert.java b/order-service-project/order-service-app/src/main/java/cn/iocoder/mall/orderservice/convert/cart/CartConvert.java
new file mode 100644
index 000000000..94803ea57
--- /dev/null
+++ b/order-service-project/order-service-app/src/main/java/cn/iocoder/mall/orderservice/convert/cart/CartConvert.java
@@ -0,0 +1,18 @@
+package cn.iocoder.mall.orderservice.convert.cart;
+
+import cn.iocoder.mall.orderservice.dal.mysql.dataobject.cart.CartItemDO;
+import cn.iocoder.mall.orderservice.rpc.cart.dto.CartItemAddReqDTO;
+import cn.iocoder.mall.orderservice.service.cart.bo.CartItemAddBO;
+import org.mapstruct.Mapper;
+import org.mapstruct.factory.Mappers;
+
+@Mapper
+public interface CartConvert {
+
+ CartConvert INSTANCE = Mappers.getMapper(CartConvert.class);
+
+ CartItemDO convert(CartItemAddBO bean);
+
+ CartItemAddBO convert(CartItemAddReqDTO bean);
+
+}
diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/CartItemDO.java b/order-service-project/order-service-app/src/main/java/cn/iocoder/mall/orderservice/dal/mysql/dataobject/cart/CartItemDO.java
similarity index 62%
rename from order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/CartItemDO.java
rename to order-service-project/order-service-app/src/main/java/cn/iocoder/mall/orderservice/dal/mysql/dataobject/cart/CartItemDO.java
index a7d679124..8b9f447cb 100644
--- a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/CartItemDO.java
+++ b/order-service-project/order-service-app/src/main/java/cn/iocoder/mall/orderservice/dal/mysql/dataobject/cart/CartItemDO.java
@@ -1,16 +1,19 @@
-package cn.iocoder.mall.order.biz.dataobject;
+package cn.iocoder.mall.orderservice.dal.mysql.dataobject.cart;
-import cn.iocoder.mall.mybatis.core.dataobject.BaseDO;
-import java.util.Date;
+import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO;
+import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
+import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
- * 购物车的商品信息
+ * 购物车的商品信息 DO
*/
+@TableName("cart_item")
@Data
+@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
-public class CartItemDO extends BaseDO {
+public class CartItemDO extends DeletableDO {
// ========= 基础字段 BEGIN =========
@@ -18,18 +21,6 @@ public class CartItemDO extends BaseDO {
* 编号,唯一自增。
*/
private Integer id;
- /**
- * 状态
- *
- * 1-正常
- * 2-主动删除
- * 3-下单删除
- */
- private Integer status;
- /**
- * 商品在购物车中的删除时间
- */
- private Date deleteTime;
/**
* 是否选中
*/
@@ -66,19 +57,6 @@ public class CartItemDO extends BaseDO {
// ========= 商品信息 END =========
- // ========= 交易信息 BEGIN =========
-
- /**
- * 订单编号
- */
- private Integer orderId;
- /**
- * 订单创建时间
- */
- private Date orderCreateTime;
-
- // ========= 交易信息 BEGIN =========
-
// ========= 优惠信息 BEGIN =========
// /**
diff --git a/order-service-project/order-service-app/src/main/java/cn/iocoder/mall/orderservice/dal/mysql/mapper/cart/CartItemMapper.java b/order-service-project/order-service-app/src/main/java/cn/iocoder/mall/orderservice/dal/mysql/mapper/cart/CartItemMapper.java
new file mode 100644
index 000000000..f7e051244
--- /dev/null
+++ b/order-service-project/order-service-app/src/main/java/cn/iocoder/mall/orderservice/dal/mysql/mapper/cart/CartItemMapper.java
@@ -0,0 +1,32 @@
+package cn.iocoder.mall.orderservice.dal.mysql.mapper.cart;
+
+import cn.iocoder.mall.mybatis.core.query.QueryWrapperX;
+import cn.iocoder.mall.orderservice.dal.mysql.dataobject.cart.CartItemDO;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+
+@Repository
+public interface CartItemMapper extends BaseMapper {
+
+ default CartItemDO selectByUserIdAndSkuId(Integer userId, Integer skuId) {
+ return selectOne(new QueryWrapper().eq("user_id", userId)
+ .eq("sku_id", skuId));
+ }
+
+ default List selectListByUserIdAndSkuIds(Integer userId, Collection skuIds) {
+ return selectList(new QueryWrapperX().eq("user_id", userId)
+ .inIfPresent("sku_id", skuIds));
+ }
+
+ default void updateByIds(@Param("ids") Set ids, @Param("updateObject") CartItemDO updateObject) {
+ // TODO 芋艿:batch update ,在 mybatis plus 做拓展,这里先临时处理
+ ids.forEach(id -> updateById(updateObject.setId(id)));
+ }
+
+}
diff --git a/order-service-project/order-service-app/src/main/java/cn/iocoder/mall/orderservice/manager/cart/CartManager.java b/order-service-project/order-service-app/src/main/java/cn/iocoder/mall/orderservice/manager/cart/CartManager.java
new file mode 100644
index 000000000..a355a8fb1
--- /dev/null
+++ b/order-service-project/order-service-app/src/main/java/cn/iocoder/mall/orderservice/manager/cart/CartManager.java
@@ -0,0 +1,65 @@
+package cn.iocoder.mall.orderservice.manager.cart;
+
+import cn.iocoder.common.framework.enums.CommonStatusEnum;
+import cn.iocoder.common.framework.exception.util.ServiceExceptionUtil;
+import cn.iocoder.common.framework.vo.CommonResult;
+import cn.iocoder.mall.orderservice.convert.cart.CartConvert;
+import cn.iocoder.mall.orderservice.rpc.cart.dto.CartItemAddReqDTO;
+import cn.iocoder.mall.orderservice.rpc.cart.dto.CartItemUpdateQuantityReqDTO;
+import cn.iocoder.mall.orderservice.service.cart.CartService;
+import cn.iocoder.mall.productservice.rpc.sku.ProductSkuRpc;
+import cn.iocoder.mall.productservice.rpc.sku.dto.ProductSkuRespDTO;
+import org.apache.dubbo.config.annotation.DubboReference;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import static cn.iocoder.mall.orderservice.enums.OrderErrorCodeConstants.CARD_ITEM_SKU_NOT_FOUND;
+
+/**
+ * 购物车 Manager
+ */
+@Service
+public class CartManager {
+
+ @DubboReference(version = "${dubbo.consumer.ProductSkuRpc.version}")
+ private ProductSkuRpc productSkuRpc;
+
+ @Autowired
+ private CartService cartService;
+
+ /**
+ * 添加商品到购物车
+ *
+ * @param addReqDTO 添加商品信息
+ */
+ public void addCartItem(CartItemAddReqDTO addReqDTO) {
+ // 校验商品 SKU 是否合法
+ ProductSkuRespDTO skuDTO = this.checkProductSku(addReqDTO.getSkuId());
+ // 添加购物车项
+ cartService.addCartItem(CartConvert.INSTANCE.convert(addReqDTO), skuDTO.getQuantity());
+ }
+
+ /**
+ * 更新购物车商品数量
+ *
+ * @param updateQuantityReqDTO 更新商品数量
+ */
+ public void updateCartItemSelected(CartItemUpdateQuantityReqDTO updateQuantityReqDTO) {
+ // 校验商品 SKU 是否合法
+ ProductSkuRespDTO skuDTO = this.checkProductSku(updateQuantityReqDTO.getSkuId());
+ // 更新购物车商品数量
+ cartService.updateCartItemQuantity(updateQuantityReqDTO.getUserId(), updateQuantityReqDTO.getSkuId(),
+ updateQuantityReqDTO.getQuantity(), skuDTO.getQuantity());
+ }
+
+ private ProductSkuRespDTO checkProductSku(Integer skuId) {
+ CommonResult getProductSkuResult = productSkuRpc.getProductSku(skuId);
+ getProductSkuResult.checkError();
+ ProductSkuRespDTO skuDTO = getProductSkuResult.getData();
+ if (skuDTO == null || CommonStatusEnum.DISABLE.getValue().equals(skuDTO.getStatus())) {
+ throw ServiceExceptionUtil.exception(CARD_ITEM_SKU_NOT_FOUND);
+ }
+ return skuDTO;
+ }
+
+}
diff --git a/order-service-project/order-service-app/src/main/java/cn/iocoder/mall/orderservice/manager/package-info.java b/order-service-project/order-service-app/src/main/java/cn/iocoder/mall/orderservice/manager/package-info.java
new file mode 100644
index 000000000..ddd8e624e
--- /dev/null
+++ b/order-service-project/order-service-app/src/main/java/cn/iocoder/mall/orderservice/manager/package-info.java
@@ -0,0 +1 @@
+package cn.iocoder.mall.orderservice.manager;
diff --git a/order-service-project/order-service-app/src/main/java/cn/iocoder/mall/orderservice/rpc/cart/CartRpcImpl.java b/order-service-project/order-service-app/src/main/java/cn/iocoder/mall/orderservice/rpc/cart/CartRpcImpl.java
new file mode 100644
index 000000000..260ae7638
--- /dev/null
+++ b/order-service-project/order-service-app/src/main/java/cn/iocoder/mall/orderservice/rpc/cart/CartRpcImpl.java
@@ -0,0 +1,28 @@
+package cn.iocoder.mall.orderservice.rpc.cart;
+
+import cn.iocoder.common.framework.vo.CommonResult;
+import cn.iocoder.mall.orderservice.manager.cart.CartManager;
+import cn.iocoder.mall.orderservice.rpc.cart.dto.CartItemAddReqDTO;
+import cn.iocoder.mall.orderservice.rpc.cart.dto.CartItemUpdateQuantityReqDTO;
+import org.apache.dubbo.config.annotation.DubboService;
+import org.springframework.beans.factory.annotation.Autowired;
+
+@DubboService
+public class CartRpcImpl implements CartRpc {
+
+ @Autowired
+ private CartManager cartManager;
+
+ @Override
+ public CommonResult addCartItem(CartItemAddReqDTO addItemReqDTO) {
+ cartManager.addCartItem(addItemReqDTO);
+ return CommonResult.success(true);
+ }
+
+ @Override
+ public CommonResult updateCartItemSelected(CartItemUpdateQuantityReqDTO updateQuantityReqDTO) {
+ cartManager.updateCartItemSelected(updateQuantityReqDTO);
+ return CommonResult.success(true);
+ }
+
+}
diff --git a/order-service-project/order-service-app/src/main/java/cn/iocoder/mall/orderservice/service/cart/CartService.java b/order-service-project/order-service-app/src/main/java/cn/iocoder/mall/orderservice/service/cart/CartService.java
new file mode 100644
index 000000000..c66e5ce6d
--- /dev/null
+++ b/order-service-project/order-service-app/src/main/java/cn/iocoder/mall/orderservice/service/cart/CartService.java
@@ -0,0 +1,111 @@
+package cn.iocoder.mall.orderservice.service.cart;
+
+import cn.iocoder.common.framework.exception.util.ServiceExceptionUtil;
+import cn.iocoder.common.framework.util.CollectionUtils;
+import cn.iocoder.mall.orderservice.convert.cart.CartConvert;
+import cn.iocoder.mall.orderservice.dal.mysql.dataobject.cart.CartItemDO;
+import cn.iocoder.mall.orderservice.dal.mysql.mapper.cart.CartItemMapper;
+import cn.iocoder.mall.orderservice.service.cart.bo.CartItemAddBO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.validation.annotation.Validated;
+
+import javax.validation.Valid;
+import java.util.List;
+
+import static cn.iocoder.mall.orderservice.enums.OrderErrorCodeConstants.CARD_ITEM_NOT_FOUND;
+import static cn.iocoder.mall.orderservice.enums.OrderErrorCodeConstants.CARD_ITEM_SKU_QUANTITY_NOT_ENOUGH;
+
+/**
+ * 购物车 Service
+ */
+@Service
+@Validated
+public class CartService {
+
+ @Autowired
+ private CartItemMapper cartItemMapper;
+
+ /**
+ * 添加商品到购物车
+ *
+ * @param addBO 添加商品信息
+ * @param skuQuantity 商品 SKU 的库存,主要用于库存校验
+ */
+ public void addCartItem(@Valid CartItemAddBO addBO, Integer skuQuantity) {
+ // 查询 CartItemDO
+ CartItemDO itemDO = cartItemMapper.selectByUserIdAndSkuId(addBO.getUserId(), addBO.getSkuId());
+ // 存在,则进行数量更新
+ if (itemDO != null) {
+ if (addBO.getQuantity() + itemDO.getQuantity() > skuQuantity) {
+ // 校验库存
+ throw ServiceExceptionUtil.exception(CARD_ITEM_SKU_QUANTITY_NOT_ENOUGH);
+ }
+ cartItemMapper.updateById(new CartItemDO().setId(itemDO.getId()).setSelected(true)
+ .setQuantity(addBO.getQuantity() + itemDO.getQuantity()));
+ return;
+ }
+ // 不存在,则进行插入
+ if (addBO.getQuantity() > skuQuantity) {
+ // 校验库存
+ throw ServiceExceptionUtil.exception(CARD_ITEM_SKU_QUANTITY_NOT_ENOUGH);
+ }
+ cartItemMapper.insert(CartConvert.INSTANCE.convert(addBO).setSelected(true));
+ }
+
+ /**
+ * 更新购物车商品数量
+ *
+ * @param userId 用户编号
+ * @param skuId 商品 SKU 编号
+ * @param quantity 数量
+ * @param skuQuantity 商品 SKU 的库存,主要用于库存校验
+ */
+ public void updateCartItemQuantity(Integer userId, Integer skuId, Integer quantity, Integer skuQuantity) {
+ if (quantity > skuQuantity) {
+ // 校验库存
+ throw ServiceExceptionUtil.exception(CARD_ITEM_SKU_QUANTITY_NOT_ENOUGH);
+ }
+ // 查询 CartItemDO
+ CartItemDO itemDO = cartItemMapper.selectByUserIdAndSkuId(userId, skuId);
+ if (itemDO == null) {
+ throw ServiceExceptionUtil.exception(CARD_ITEM_NOT_FOUND);
+ }
+ // 更新数量
+ cartItemMapper.updateById(new CartItemDO().setId(itemDO.getId()).setQuantity(quantity));
+ }
+
+ /**
+ * 更新购物车商品是否选中
+ *
+ * @param userId 用户编号
+ * @param skuIds 商品 SKU 编号数组
+ * @param selected 是否选中
+ */
+ public void updateCartItemSelected(Integer userId, List skuIds, Boolean selected) {
+ // 查询 CartItemDO 列表
+ List itemDOs = cartItemMapper.selectListByUserIdAndSkuIds(userId, skuIds);
+ if (skuIds.size() != itemDOs.size()) {
+ throw ServiceExceptionUtil.exception(CARD_ITEM_NOT_FOUND);
+ }
+ // 更新选中
+ cartItemMapper.updateByIds(CollectionUtils.convertSet(itemDOs, CartItemDO::getId),
+ new CartItemDO().setSelected(selected));
+ }
+
+ /**
+ * 购物车删除商品
+ *
+ * @param userId 用户编号
+ * @param skuIds 商品 SKU 编号的数组
+ */
+ public void deleteList(Integer userId, List skuIds) {
+ // 查询 CartItemDO 列表
+ List itemDOs = cartItemMapper.selectListByUserIdAndSkuIds(userId, skuIds);
+ // 批量标记删除
+ cartItemMapper.deleteBatchIds(CollectionUtils.convertSet(itemDOs, CartItemDO::getId));
+ }
+
+
+
+}
diff --git a/order-service-project/order-service-app/src/main/java/cn/iocoder/mall/orderservice/service/cart/bo/CartItemAddBO.java b/order-service-project/order-service-app/src/main/java/cn/iocoder/mall/orderservice/service/cart/bo/CartItemAddBO.java
new file mode 100644
index 000000000..596054a31
--- /dev/null
+++ b/order-service-project/order-service-app/src/main/java/cn/iocoder/mall/orderservice/service/cart/bo/CartItemAddBO.java
@@ -0,0 +1,38 @@
+package cn.iocoder.mall.orderservice.service.cart.bo;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import javax.validation.constraints.Min;
+import javax.validation.constraints.NotNull;
+
+/**
+ * 购物车添加购物项 Request DTO
+ */
+@Data
+@Accessors
+public class CartItemAddBO {
+
+ /**
+ * 用户编号
+ */
+ @NotNull(message = "用户编号不能为空")
+ private Integer userId;
+ /**
+ * 商品 SPU 编号
+ */
+ @NotNull(message = "商品 SPU 编号不能为空")
+ private Integer spuId;
+ /**
+ * 商品 SKU 编号
+ */
+ @NotNull(message = "商品 SKU 编号不能为空")
+ private Integer skuId;
+ /**
+ * 数量
+ */
+ @NotNull(message = "数量不能为空")
+ @Min(message = "数量必须大于 0", value = 1L)
+ private Integer quantity;
+
+}
diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dataobject/CartItemDO.java b/order-service-project/order-service-app/src/main/java/cn/iocoder/mall/orderservice/service/cart/bo/CartItemBO.java
similarity index 61%
rename from order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dataobject/CartItemDO.java
rename to order-service-project/order-service-app/src/main/java/cn/iocoder/mall/orderservice/service/cart/bo/CartItemBO.java
index 1d8c91f5a..df2061474 100644
--- a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dataobject/CartItemDO.java
+++ b/order-service-project/order-service-app/src/main/java/cn/iocoder/mall/orderservice/service/cart/bo/CartItemBO.java
@@ -1,17 +1,14 @@
-package cn.iocoder.mall.order.biz.dataobject;
+package cn.iocoder.mall.orderservice.service.cart.bo;
-import cn.iocoder.common.framework.dataobject.BaseDO;
import lombok.Data;
import lombok.experimental.Accessors;
-import java.util.Date;
-
/**
- * 购物车的商品信息
+ * 购物车的商品信息 BO
*/
@Data
@Accessors(chain = true)
-public class CartItemDO extends BaseDO {
+public class CartItemBO {
// ========= 基础字段 BEGIN =========
@@ -19,18 +16,6 @@ public class CartItemDO extends BaseDO {
* 编号,唯一自增。
*/
private Integer id;
- /**
- * 状态
- *
- * 1-正常
- * 2-主动删除
- * 3-下单删除
- */
- private Integer status;
- /**
- * 商品在购物车中的删除时间
- */
- private Date deleteTime;
/**
* 是否选中
*/
@@ -62,24 +47,8 @@ public class CartItemDO extends BaseDO {
*/
private Integer quantity;
- // TODO 冗余字段
-
-
// ========= 商品信息 END =========
- // ========= 交易信息 BEGIN =========
-
- /**
- * 订单编号
- */
- private Integer orderId;
- /**
- * 订单创建时间
- */
- private Date orderCreateTime;
-
- // ========= 交易信息 BEGIN =========
-
// ========= 优惠信息 BEGIN =========
// /**
diff --git a/order-service-project/order-service-app/src/main/resources/application-dev.yaml b/order-service-project/order-service-app/src/main/resources/application-dev.yaml
new file mode 100644
index 000000000..c571f0544
--- /dev/null
+++ b/order-service-project/order-service-app/src/main/resources/application-dev.yaml
@@ -0,0 +1,21 @@
+spring:
+ # 数据源配置项
+ datasource:
+ url: jdbc:mysql://400-infra.server.iocoder.cn:3306/mall_order?useSSL=false&useUnicode=true&characterEncoding=UTF-8
+ driver-class-name: com.mysql.jdbc.Driver
+ username: root
+ password: 3WLiVUBEwTbvAfsh
+ # Spring Cloud 配置项
+ cloud:
+ nacos:
+ # Spring Cloud Nacos Discovery 配置项
+ discovery:
+ server-addr: 400-infra.server.iocoder.cn:8848 # Nacos 服务器地址
+ namespace: dev # Nacos 命名空间
+
+# Dubbo 配置项
+dubbo:
+ # Dubbo 注册中心
+ registry:
+ # address: spring-cloud://400-infra.server.iocoder.cn:8848 # 指定 Dubbo 服务注册中心的地址
+ address: nacos://400-infra.server.iocoder.cn:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址
diff --git a/order-service-project/order-service-app/src/main/resources/application-local.yaml b/order-service-project/order-service-app/src/main/resources/application-local.yaml
new file mode 100644
index 000000000..6d315464f
--- /dev/null
+++ b/order-service-project/order-service-app/src/main/resources/application-local.yaml
@@ -0,0 +1,24 @@
+spring:
+ # 数据源配置项
+ datasource:
+ url: jdbc:mysql://400-infra.server.iocoder.cn:3306/mall_order?useSSL=false&useUnicode=true&characterEncoding=UTF-8
+ driver-class-name: com.mysql.jdbc.Driver
+ username: root
+ password: 3WLiVUBEwTbvAfsh
+ # Spring Cloud 配置项
+ cloud:
+ nacos:
+ # Spring Cloud Nacos Discovery 配置项
+ discovery:
+ server-addr: 400-infra.server.iocoder.cn:8848 # Nacos 服务器地址
+ namespace: dev # Nacos 命名空间
+
+# Dubbo 配置项
+dubbo:
+ # Dubbo 注册中心
+ registry:
+# address: spring-cloud://400-infra.server.iocoder.cn:8848 # 指定 Dubbo 服务注册中心的地址
+ address: nacos://400-infra.server.iocoder.cn:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址
+ # Dubbo 服务提供者的配置
+ provider:
+ tag: ${DUBBO_TAG} # Dubbo 路由分组
diff --git a/order-service-project/order-service-app/src/main/resources/application.yaml b/order-service-project/order-service-app/src/main/resources/application.yaml
new file mode 100644
index 000000000..e3f1adf9b
--- /dev/null
+++ b/order-service-project/order-service-app/src/main/resources/application.yaml
@@ -0,0 +1,60 @@
+spring:
+ # Application 的配置项
+ application:
+ name: order-service
+ # Profile 的配置项
+ profiles:
+ active: local
+
+# MyBatis Plus 配置项
+mybatis-plus:
+ configuration:
+ map-underscore-to-camel-case: true # 虽然默认为 true ,但是还是显示去指定下。
+ global-config:
+ db-config:
+ id-type: auto
+ logic-delete-value: 1 # 逻辑已删除值(默认为 1)
+ logic-not-delete-value: 0 # 逻辑未删除值(默认为 0)
+ mapper-locations: classpath*:mapper/*.xml
+ type-aliases-package: cn.iocoder.mall.orderservice.dal.mysql.dataobject
+
+# Dubbo 配置项
+dubbo:
+ # Spring Cloud Alibaba Dubbo 专属配置
+ cloud:
+ subscribed-services: '' # 设置订阅的应用列表,默认为 * 订阅所有应用
+ # Dubbo 提供者的协议
+ protocol:
+ name: dubbo
+ port: -1
+ # Dubbo 提供服务的扫描基础包
+ scan:
+ base-packages: cn.iocoder.mall.orderservice.rpc
+ # Dubbo 服务提供者的配置
+ provider:
+ filter: -exception
+ validation: true # 开启 Provider 参数校验
+ version: 1.0.0 # 服务的版本号
+ # Dubbo 服务消费者的配置
+ consumer:
+ ErrorCodeRpc:
+ version: 1.0.0
+
+# RocketMQ 配置项
+rocketmq:
+ name-server: 400-infra.server.iocoder.cn:9876
+ producer:
+ group: ${spring.application.name}-producer-group
+
+# Actuator 监控配置项
+management:
+ server.port: 38084 # 独立端口,避免被暴露出去
+ endpoints.web.exposure.include: '*' # 暴露所有监控端点
+server.port: ${management.server.port} # 设置使用 Actuator 的服务器端口,因为 RPC 服务不需要 Web 端口
+
+# Mall 配置项
+mall:
+ # 错误码配置项对应 ErrorCodeProperties 配置类
+ error-code:
+ group: ${spring.application.name}
+ constants-class: cn.iocoder.mall.orderservice.enums.OrderErrorCodeConstants
diff --git a/order-service-project/pom.xml b/order-service-project/pom.xml
new file mode 100644
index 000000000..1af86f9f3
--- /dev/null
+++ b/order-service-project/pom.xml
@@ -0,0 +1,39 @@
+
+
+
+ onemall
+ cn.iocoder.mall
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ order-service-project
+ pom
+
+ order-service-api
+ order-service-app
+
+
+
+
+
+
+ cn.iocoder.mall
+ mall-dependencies
+ 1.0-SNAPSHOT
+ pom
+ import
+
+
+
+
+ cn.iocoder.mall
+ order-service-api
+ 1.0-SNAPSHOT
+
+
+
+
+
diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dao/cart/CartMapper.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dao/cart/CartMapper.java
index a2dd5c536..e97ea9af2 100644
--- a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dao/cart/CartMapper.java
+++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dao/cart/CartMapper.java
@@ -4,9 +4,6 @@ import cn.iocoder.mall.order.biz.dataobject.CartItemDO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
-import java.util.Collection;
-import java.util.List;
-
@Repository
public interface CartMapper {
//
diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/service/CartService.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/service/CartService.java
index cfe0304c4..9982cc0d1 100644
--- a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/service/CartService.java
+++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/service/CartService.java
@@ -2,55 +2,10 @@ package cn.iocoder.mall.order.biz.service;
public interface CartService {
-// // ========== 购物车 Item 的逻辑 ==========
-//
-// /**
-// * 添加商品至购物车
-// *
-// * @param userId 用户编号
-// * @param skuId 商品 SKU 编号
-// * @param quantity 数量
-// * @return 是否成功
-// */
-// Boolean add(Integer userId, Integer skuId, Integer quantity);
-//
-// /**
-// * 购物车更新商品数量
-// *
-// * @param userId 用户编号
-// * @param skuId 商品 SKU 编号
-// * @param quantity 数量
-// * @return 是否成功
-// */
-// Boolean updateQuantity(Integer userId, Integer skuId, Integer quantity);
-//
-// /**
-// * 购物车更新商品是否选中
-// *
-// * @param userId 用户编号
-// * @param skuIds 商品 SKU 编号数组
-// * @param selected 是否选中
-// * @return 是否成功
-// */
-// Boolean updateSelected(Integer userId, Collection skuIds, Boolean selected);
-//
-// /**
-// * 购物车删除商品
-// *
-// * @param userId 用户编号
-// * @param skuIds 商品 SKU 编号的数组
-// *
-// * @return 是否成功
-// */
+
// Boolean deleteList(Integer userId, List skuIds);
//
-// /**
-// * 清空购物车
-// *
-// * @param userId 用户编号
-// * @return 是否成功
-// */
-// Boolean deleteAll(Integer userId);
+
//
// /**
// * 查询用户在购物车中的商品数量
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/exception/OrderReturnNonExistentException.java b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/exception/OrderReturnNonExistentException.java
deleted file mode 100644
index b07ff29e6..000000000
--- a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/exception/OrderReturnNonExistentException.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package cn.iocoder.mall.order.api.exception;
-
-/**
- * 订单退回 - 不存在
- *
- * @author Sin
- * @time 2019/5/8 6:17 PM
- */
-public class OrderReturnNonExistentException {
-}
diff --git a/order/order-service-api/pom.xml b/order/order-service-api02/pom.xml
similarity index 97%
rename from order/order-service-api/pom.xml
rename to order/order-service-api02/pom.xml
index c84e89f41..3d0b33294 100644
--- a/order/order-service-api/pom.xml
+++ b/order/order-service-api02/pom.xml
@@ -9,7 +9,7 @@
4.0.0
- order-service-api
+ order-service-api02
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/CartService.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/CartService.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/CartService.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/CartService.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/OrderCommentReplyService.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/OrderCommentReplyService.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/OrderCommentReplyService.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/OrderCommentReplyService.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/OrderCommentService.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/OrderCommentService.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/OrderCommentService.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/OrderCommentService.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/OrderLogisticsService.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/OrderLogisticsService.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/OrderLogisticsService.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/OrderLogisticsService.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/OrderReturnService.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/OrderReturnService.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/OrderReturnService.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/OrderReturnService.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/OrderService.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/OrderService.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/OrderService.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/OrderService.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/CalcOrderPriceBO.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/CalcOrderPriceBO.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/CalcOrderPriceBO.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/CalcOrderPriceBO.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/CalcSkuPriceBO.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/CalcSkuPriceBO.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/CalcSkuPriceBO.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/CalcSkuPriceBO.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/CartItemBO.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/CartItemBO.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/CartItemBO.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/CartItemBO.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderBO.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderBO.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderBO.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderBO.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentBO.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentBO.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentBO.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentBO.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentCreateBO.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentCreateBO.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentCreateBO.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentCreateBO.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentInfoAndMerchantReplyBO.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentInfoAndMerchantReplyBO.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentInfoAndMerchantReplyBO.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentInfoAndMerchantReplyBO.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentInfoBO.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentInfoBO.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentInfoBO.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentInfoBO.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentMerchantReplyBO.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentMerchantReplyBO.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentMerchantReplyBO.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentMerchantReplyBO.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentPageBO.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentPageBO.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentPageBO.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentPageBO.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentReplyCreateBO.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentReplyCreateBO.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentReplyCreateBO.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentReplyCreateBO.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentReplyPageBO.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentReplyPageBO.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentReplyPageBO.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentReplyPageBO.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentStateInfoPageBO.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentStateInfoPageBO.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentStateInfoPageBO.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentStateInfoPageBO.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentTimeOutBO.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentTimeOutBO.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentTimeOutBO.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentTimeOutBO.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCreateBO.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderCreateBO.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCreateBO.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderCreateBO.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderInfoBO.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderInfoBO.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderInfoBO.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderInfoBO.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderItemBO.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderItemBO.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderItemBO.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderItemBO.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderLastLogisticsInfoBO.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderLastLogisticsInfoBO.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderLastLogisticsInfoBO.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderLastLogisticsInfoBO.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderLogisticsBO.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderLogisticsBO.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderLogisticsBO.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderLogisticsBO.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderLogisticsInfoBO.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderLogisticsInfoBO.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderLogisticsInfoBO.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderLogisticsInfoBO.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderLogisticsInfoWithOrderBO.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderLogisticsInfoWithOrderBO.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderLogisticsInfoWithOrderBO.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderLogisticsInfoWithOrderBO.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderPageBO.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderPageBO.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderPageBO.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderPageBO.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderPayBO.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderPayBO.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderPayBO.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderPayBO.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderRecipientBO.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderRecipientBO.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderRecipientBO.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderRecipientBO.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderReturnInfoBO.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderReturnInfoBO.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderReturnInfoBO.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderReturnInfoBO.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderReturnListBO.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderReturnListBO.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderReturnListBO.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderReturnListBO.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/PostageDetailBO.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/PostageDetailBO.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/PostageDetailBO.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/PostageDetailBO.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/CartItemStatusEnum.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/constant/CartItemStatusEnum.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/CartItemStatusEnum.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/constant/CartItemStatusEnum.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/DictKeyConstants.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/constant/DictKeyConstants.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/DictKeyConstants.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/constant/DictKeyConstants.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/ErrorCodeInterval.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/constant/ErrorCodeInterval.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/ErrorCodeInterval.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/constant/ErrorCodeInterval.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/LogisticsEnum.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/constant/LogisticsEnum.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/LogisticsEnum.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/constant/LogisticsEnum.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/MQConstants.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/constant/MQConstants.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/MQConstants.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/constant/MQConstants.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/OrderCancelReasonsEnum.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/constant/OrderCancelReasonsEnum.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/OrderCancelReasonsEnum.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/constant/OrderCancelReasonsEnum.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/OrderCommentRelpyTypeEnum.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/constant/OrderCommentRelpyTypeEnum.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/OrderCommentRelpyTypeEnum.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/constant/OrderCommentRelpyTypeEnum.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/OrderCommentStatusEnum.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/constant/OrderCommentStatusEnum.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/OrderCommentStatusEnum.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/constant/OrderCommentStatusEnum.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/OrderErrorCodeEnum.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/constant/OrderErrorCodeEnum.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/OrderErrorCodeEnum.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/constant/OrderErrorCodeEnum.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/OrderHasReturnExchangeEnum.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/constant/OrderHasReturnExchangeEnum.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/OrderHasReturnExchangeEnum.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/constant/OrderHasReturnExchangeEnum.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/OrderPayStatus.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/constant/OrderPayStatus.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/OrderPayStatus.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/constant/OrderPayStatus.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/OrderReplyUserTypeEnum.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/constant/OrderReplyUserTypeEnum.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/OrderReplyUserTypeEnum.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/constant/OrderReplyUserTypeEnum.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/OrderReturnServiceTypeEnum.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/constant/OrderReturnServiceTypeEnum.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/OrderReturnServiceTypeEnum.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/constant/OrderReturnServiceTypeEnum.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/OrderReturnStatusEnum.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/constant/OrderReturnStatusEnum.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/OrderReturnStatusEnum.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/constant/OrderReturnStatusEnum.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/OrderReturnTypeEnum.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/constant/OrderReturnTypeEnum.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/OrderReturnTypeEnum.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/constant/OrderReturnTypeEnum.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/OrderStatusEnum.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/constant/OrderStatusEnum.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/OrderStatusEnum.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/constant/OrderStatusEnum.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/PayAppId.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/constant/PayAppId.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/PayAppId.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/constant/PayAppId.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/CalcOrderPriceDTO.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/dto/CalcOrderPriceDTO.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/CalcOrderPriceDTO.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/dto/CalcOrderPriceDTO.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderCommentCreateDTO.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/dto/OrderCommentCreateDTO.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderCommentCreateDTO.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/dto/OrderCommentCreateDTO.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderCommentPageDTO.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/dto/OrderCommentPageDTO.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderCommentPageDTO.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/dto/OrderCommentPageDTO.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderCommentReplyCreateDTO.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/dto/OrderCommentReplyCreateDTO.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderCommentReplyCreateDTO.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/dto/OrderCommentReplyCreateDTO.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderCommentReplyPageDTO.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/dto/OrderCommentReplyPageDTO.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderCommentReplyPageDTO.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/dto/OrderCommentReplyPageDTO.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderCommentStateInfoPageDTO.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/dto/OrderCommentStateInfoPageDTO.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderCommentStateInfoPageDTO.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/dto/OrderCommentStateInfoPageDTO.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderCommentTimeOutPageDTO.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/dto/OrderCommentTimeOutPageDTO.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderCommentTimeOutPageDTO.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/dto/OrderCommentTimeOutPageDTO.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderCreateDTO.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/dto/OrderCreateDTO.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderCreateDTO.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/dto/OrderCreateDTO.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderDeliveryDTO.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/dto/OrderDeliveryDTO.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderDeliveryDTO.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/dto/OrderDeliveryDTO.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderItemDeletedDTO.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/dto/OrderItemDeletedDTO.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderItemDeletedDTO.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/dto/OrderItemDeletedDTO.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderItemUpdateDTO.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/dto/OrderItemUpdateDTO.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderItemUpdateDTO.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/dto/OrderItemUpdateDTO.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderLogisticsUpdateDTO.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/dto/OrderLogisticsUpdateDTO.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderLogisticsUpdateDTO.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/dto/OrderLogisticsUpdateDTO.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderQueryDTO.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/dto/OrderQueryDTO.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderQueryDTO.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/dto/OrderQueryDTO.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderReturnApplyDTO.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/dto/OrderReturnApplyDTO.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderReturnApplyDTO.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/dto/OrderReturnApplyDTO.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderReturnCreateDTO.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/dto/OrderReturnCreateDTO.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderReturnCreateDTO.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/dto/OrderReturnCreateDTO.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderReturnQueryDTO.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/dto/OrderReturnQueryDTO.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderReturnQueryDTO.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/dto/OrderReturnQueryDTO.java
diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderUserPageDTO.java b/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/dto/OrderUserPageDTO.java
similarity index 100%
rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderUserPageDTO.java
rename to order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/dto/OrderUserPageDTO.java
diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dao/CartMapper.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dao/CartMapper.java
deleted file mode 100644
index d5b9bf4e7..000000000
--- a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dao/CartMapper.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package cn.iocoder.mall.order.biz.dao;
-
-import cn.iocoder.mall.order.biz.dataobject.CartItemDO;
-import org.apache.ibatis.annotations.Param;
-import org.springframework.stereotype.Repository;
-
-import java.util.Collection;
-import java.util.List;
-
-@Repository
-public interface CartMapper {
-
- CartItemDO selectById(@Param("id") Integer id);
-
- List selectByIds(@Param("ids") Collection ids);
-
- CartItemDO selectByUserIdAndSkuIdAndStatus(@Param("userId") Integer userId,
- @Param("skuId") Integer skuId,
- @Param("status") Integer status);
-
- Integer selectQuantitySumByUserIdAndStatus(@Param("userId") Integer userId,
- @Param("status") Integer status);
-
- List selectByUserIdAndStatusAndSelected(@Param("userId") Integer userId,
- @Param("status") Integer status,
- @Param("selected") Boolean selected);
-//
-// List selectListByTitleLike(@Param("title") String title,
-// @Param("offset") Integer offset,
-// @Param("limit") Integer limit);
-
-// Integer selectCountByTitleLike(@Param("title") String title);
-
- void insert(CartItemDO cartItemDO);
-
- int update(CartItemDO cartItemDO);
-
- int updateQuantity(@Param("id") Integer id,
- @Param("quantityIncr") Integer quantityIncr);
-
- int updateListByUserIdAndSkuId(@Param("userId") Integer userId,
- @Param("skuIds") Collection skuIds,
- @Param("selected") Boolean selected,
- @Param("status") Integer status);
-
-}
diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/CartServiceImpl.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/CartServiceImpl.java
index fda65fb97..9293ffd36 100644
--- a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/CartServiceImpl.java
+++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/CartServiceImpl.java
@@ -45,95 +45,6 @@ public class CartServiceImpl implements CartService {
@Autowired
private CartMapper cartMapper;
- @Override
- @SuppressWarnings("Duplicates")
- public Boolean add(Integer userId, Integer skuId, Integer quantity) {
- // 查询 SKU 是否合法
- ProductSkuBO sku = productSpuService.getProductSku(skuId);
- if (sku == null
- || CommonStatusEnum.DISABLE.getValue().equals(sku.getStatus())) { // sku 被禁用
- throw ServiceExceptionUtil.exception(OrderErrorCodeEnum.CARD_ITEM_SKU_NOT_FOUND.getCode());
- }
- // TODO 芋艿,后续基于商品是否上下架进一步完善。
- // 查询 CartItemDO
- CartItemDO item = cartMapper.selectByUserIdAndSkuIdAndStatus(userId, skuId, CartItemStatusEnum.ENABLE.getValue());
- // 存在,则进行数量更新
- if (item != null) {
- return updateQuantity0(item, sku, quantity);
- }
- // 不存在,则进行插入
- return add0(userId, sku, quantity);
- }
-
- private Boolean add0(Integer userId, ProductSkuBO sku, Integer quantity) {
- // 校验库存
- if (quantity > sku.getQuantity()) {
- throw ServiceExceptionUtil.exception(OrderErrorCodeEnum.CARD_ITEM_SKU_NOT_FOUND.getCode());
- }
- // 创建 CartItemDO 对象,并进行保存。
- CartItemDO item = new CartItemDO()
- // 基础字段
- .setStatus(CartItemStatusEnum.ENABLE.getValue()).setSelected(true)
- // 买家信息
- .setUserId(userId)
- // 商品信息
- .setSpuId(sku.getSpuId()).setSkuId(sku.getId()).setQuantity(quantity);
- item.setCreateTime(new Date());
- cartMapper.insert(item);
- // 返回成功
- return true;
- }
-
- @Override
- @SuppressWarnings("Duplicates")
- public Boolean updateQuantity(Integer userId, Integer skuId, Integer quantity) {
- // 查询 SKU 是否合法
- ProductSkuBO sku = productSpuService.getProductSku(skuId);
- if (sku == null
- || CommonStatusEnum.DISABLE.getValue().equals(sku.getStatus())) { // sku 被禁用
- throw ServiceExceptionUtil.exception(OrderErrorCodeEnum.CARD_ITEM_SKU_NOT_FOUND.getCode());
- }
- // 查询 CartItemDO
- CartItemDO item = cartMapper.selectByUserIdAndSkuIdAndStatus(userId, skuId, CartItemStatusEnum.ENABLE.getValue());
- if (item == null) {
- throw ServiceExceptionUtil.exception(OrderErrorCodeEnum.CARD_ITEM_NOT_FOUND.getCode());
- }
- // TODO 芋艿,后续基于商品是否上下架进一步完善。
- return updateQuantity0(item, sku, quantity);
- }
-
- private Boolean updateQuantity0(CartItemDO item, ProductSkuBO sku, Integer quantity) {
- // 校验库存
- if (item.getQuantity() + quantity > sku.getQuantity()) {
- throw ServiceExceptionUtil.exception(OrderErrorCodeEnum.CARD_ITEM_SKU_NOT_FOUND.getCode());
- }
- // 更新 CartItemDO
- cartMapper.updateQuantity(item.getId(), quantity);
- // 返回成功
- return true;
- }
-
- @Override
- public Boolean updateSelected(Integer userId, Collection skuIds, Boolean selected) {
- // 更新 CartItemDO 们
- cartMapper.updateListByUserIdAndSkuId(userId, skuIds, selected, null);
- // 返回成功
- return true;
- }
-
- @Override
- public Boolean deleteList(Integer userId, List skuIds) {
- // 更新 CartItemDO 们
- cartMapper.updateListByUserIdAndSkuId(userId, skuIds, null, CartItemStatusEnum.DELETE_BY_MANUAL.getValue());
- // 返回成功
- return true;
- }
-
- @Override
- public Boolean deleteAll(Integer userId) {
- return null;
- }
-
@Override
public Integer count(Integer userId) {
return cartMapper.selectQuantitySumByUserIdAndStatus(userId, CartItemStatusEnum.ENABLE.getValue());
diff --git a/order/pom.xml b/order/pom.xml
index f50df5613..168f43a32 100644
--- a/order/pom.xml
+++ b/order/pom.xml
@@ -12,13 +12,11 @@
order
pom
- order-application
- order-biz
- order-biz-api
+
+
order-rest
- order-rpc
- order-rpc-api
-
+ order-service-api02
+ order-service-impl
diff --git a/pom.xml b/pom.xml
index cdf958028..f484a1162 100644
--- a/pom.xml
+++ b/pom.xml
@@ -14,14 +14,12 @@
onemall
1.0-SNAPSHOT
-
-
+ order
common
-
mall-dependencies
user-service-project
user-web-app
@@ -32,6 +30,7 @@
product-service-project
search-service-project
+ order-service-project
pom
diff --git a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/sku/ProductSkuService.java b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/sku/ProductSkuService.java
index 36e08183d..a78a35b18 100644
--- a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/sku/ProductSkuService.java
+++ b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/sku/ProductSkuService.java
@@ -11,6 +11,7 @@ import cn.iocoder.mall.productservice.service.sku.bo.ProductSkuCreateOrUpdateBO;
import cn.iocoder.mall.productservice.service.sku.bo.ProductSkuListQueryBO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.stream.Collectors;
@@ -30,6 +31,7 @@ public class ProductSkuService {
productSkuMapper.insertList(skus);
}
+ @Transactional
public void updateProductSkus(Integer spuId, List skuUpdateBOs) {
List existsSkus = productSkuMapper.selectListBySpuIdAndStatus(spuId,
CommonStatusEnum.ENABLE.getValue());