From fdc83d4550b02ccdd271090da057c75656fb8735 Mon Sep 17 00:00:00 2001 From: YunaiV <> Date: Fri, 27 Nov 2020 18:38:39 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E8=BF=81=E7=A7=BB=E4=BA=A4=E6=98=93?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E7=9A=84=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=202.=20=E6=94=AF=E4=BB=98=E6=9C=8D=E5=8A=A1=EF=BC=8C=E9=87=8D?= =?UTF-8?q?=E6=96=B0=E5=88=9D=E5=A7=8B=E5=8C=96=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../framework/util/CollectionUtils.java | 5 + .../common/framework/vo/PageParam.java | 6 +- .../common/framework/vo/SortingField.java | 9 + .../mall-spring-boot-starter-mybatis/pom.xml | 6 + .../mall/mybatis/core/util/PageUtil.java | 35 +++ .../mall/order/biz/convert/OrderConvert.java | 28 --- .../order/biz/service/OrderServiceImpl.java | 111 --------- .../main/resources/config/application.yaml | 93 ------- .../mall/order/biz/bo/CalcOrderPriceBO.java | 176 ------------- .../mall/order/biz/bo/CalcSkuPriceBO.java | 31 --- .../iocoder/mall/order/biz/bo/CartItemBO.java | 100 -------- .../cn/iocoder/mall/order/biz/bo/OrderBO.java | 115 --------- .../mall/order/biz/bo/OrderCreateBO.java | 30 --- .../mall/order/biz/bo/OrderInfoBO.java | 233 ------------------ .../mall/order/biz/bo/OrderItemBO.java | 143 ----------- .../mall/order/biz/bo/OrderPageBO.java | 28 --- .../iocoder/mall/order/biz/bo/OrderPayBO.java | 12 - .../mall/order/biz/bo/OrderRecipientBO.java | 45 ---- .../mall/order/biz/bo/PostageDetailBO.java | 14 -- .../order/biz/bo/order/CalcOrderPriceBO.java | 176 ------------- .../order/biz/bo/order/CalcSkuPriceBO.java | 31 --- .../mall/order/biz/bo/order/CartItemBO.java | 100 -------- .../mall/order/biz/bo/order/OrderBO.java | 115 --------- .../order/biz/bo/order/OrderCreateBO.java | 30 --- .../mall/order/biz/bo/order/OrderInfoBO.java | 233 ------------------ .../mall/order/biz/bo/order/OrderItemBO.java | 143 ----------- .../mall/order/biz/bo/order/OrderPageBO.java | 28 --- .../mall/order/biz/bo/order/OrderPayBO.java | 12 - .../order/biz/bo/order/OrderRecipientBO.java | 45 ---- .../order/biz/bo/order/PostageDetailBO.java | 14 -- .../mall/order/biz/convert/CartConvert.java | 15 -- .../mall/order/biz/convert/OrderConvert.java | 22 -- .../order/biz/convert/OrderItemConvert.java | 31 --- order/order-rest/pom.xml | 41 --- .../order/UsersOrderController.java | 49 +--- .../iocoder/mall/order/api/OrderService.java | 32 --- .../cn/iocoder/mall/order/api/bo/OrderBO.java | 115 --------- .../mall/order/api/bo/OrderCreateBO.java | 30 --- .../mall/order/api/bo/OrderInfoBO.java | 233 ------------------ .../mall/order/api/bo/OrderItemBO.java | 143 ----------- .../mall/order/api/bo/OrderPageBO.java | 28 --- .../iocoder/mall/order/api/bo/OrderPayBO.java | 12 - .../mall/order/api/bo/OrderRecipientBO.java | 45 ---- .../mall/order/api/bo/PostageDetailBO.java | 14 -- pay-service-project/pay-service-api/pom.xml | 12 +- .../payservice/enums}/PayChannelEnum.java | 2 +- .../mall/payservice/rpc/app/PayAppRpc.java | 7 + .../payservice/rpc/app/dto/PayAppRespDTO.java | 12 +- .../mall/payservice/rpc/package-info.java | 1 + .../rpc/transaction/PayTransactionRpc.java | 10 + .../dto/PayTransactionCreateReqDTO.java | 47 ++-- pay-service-project/pay-service-app/pom.xml | 56 ++++- .../payservice/PayServiceApplication.java | 9 + .../config/DatabaseConfiguration.java | 28 +++ .../transaction/TransactionConvert.java | 19 -- .../dal/mysql/dataobject/app/PayAppDO.java | 41 +++ ...ansactionDO.java => PayTransactionDO.java} | 18 +- .../transaction/PayTransactionMapper.java | 15 ++ .../mapper/transaction/TransactionMapper.java | 19 -- .../transaction/TransactionManager.java | 4 - ...pcImpl.java => PayTransactionRpcImpl.java} | 2 +- .../payservice/service/app/PayAppService.java | 10 + .../service/app/impl/PayAppServiceImpl.java | 25 ++ .../transaction/PayTransactionService.java | 10 + .../transaction/TransactionService.java | 107 -------- .../service/transaction/bo/TransactionBO.java | 96 -------- .../transaction/bo/TransactionCreateBO.java | 93 ------- .../transaction/bo/TransactionPageBO.java | 99 -------- .../transaction/bo/TransactionUpdateBO.java | 98 -------- .../impl/PayTransactionServiceImpl.java | 97 ++++++++ .../src/main/resources/application-dev.yaml | 21 ++ .../src/main/resources/application-local.yaml | 24 ++ .../src/main/resources/application.yaml | 64 +++++ pay-service-project/pom.xml | 8 +- .../mall/pay/application/PayApplication.java | 15 -- .../application/convert/PayRefundConvert.java | 19 -- .../mall/pay/api/PayTransactionService.java | 2 - .../pay/biz/config/DatabaseConfiguration.java | 12 - .../config/ServiceExceptionConfiguration.java | 19 -- .../mall/pay/biz/dao/PayAppMapper.java | 12 - .../pay/biz/service/PayAppServiceImpl.java | 30 --- .../client/trade/TradeOrderClient.java | 17 ++ .../trade/TradeOrderController.http | 17 +- .../trade/TradeOrderController.java | 20 +- .../trade/vo/order/TradeOrderItemRespVO.java | 53 ++++ .../trade/vo/order/TradeOrderPageReqVO.java | 17 ++ .../trade/vo/order/TradeOrderRespVO.java | 70 ++++++ .../convert/trade/TradeOrderConvert.java | 11 + .../service/trade/TradeOrderService.java | 46 +++- .../order/TradeOrderDetailFieldEnum.java | 30 +++ .../tradeservice/rpc/order/TradeOrderRpc.java | 24 ++ .../rpc/order/dto/TradeOrderItemRespDTO.java | 101 ++++++++ .../rpc/order/dto/TradeOrderPageReqDTO.java | 45 ++++ .../rpc/order/dto/TradeOrderRespDTO.java | 139 +++++++++++ .../convert/order/TradeOrderConvert.java | 29 +++ .../mapper/order/TradeOrderItemMapper.java | 6 + .../mysql/mapper/order/TradeOrderMapper.java | 11 + .../rpc/order/TradeOrderRpcImpl.java | 15 ++ .../service/order/TradeOrderService.java | 22 ++ .../order/impl/TradeOrderServiceImpl.java | 52 +++- 100 files changed, 1241 insertions(+), 3604 deletions(-) create mode 100644 common/mall-spring-boot-starter-mybatis/src/main/java/cn/iocoder/mall/mybatis/core/util/PageUtil.java delete mode 100644 moved/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/convert/OrderConvert.java delete mode 100644 moved/order/order-service-impl/src/main/resources/config/application.yaml delete mode 100644 order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/CalcOrderPriceBO.java delete mode 100644 order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/CalcSkuPriceBO.java delete mode 100644 order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/CartItemBO.java delete mode 100644 order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/OrderBO.java delete mode 100644 order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/OrderCreateBO.java delete mode 100644 order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/OrderInfoBO.java delete mode 100644 order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/OrderItemBO.java delete mode 100644 order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/OrderPageBO.java delete mode 100644 order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/OrderPayBO.java delete mode 100644 order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/OrderRecipientBO.java delete mode 100644 order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/PostageDetailBO.java delete mode 100644 order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/CalcOrderPriceBO.java delete mode 100644 order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/CalcSkuPriceBO.java delete mode 100644 order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/CartItemBO.java delete mode 100644 order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderBO.java delete mode 100644 order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderCreateBO.java delete mode 100644 order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderInfoBO.java delete mode 100644 order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderItemBO.java delete mode 100644 order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderPageBO.java delete mode 100644 order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderPayBO.java delete mode 100644 order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderRecipientBO.java delete mode 100644 order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/PostageDetailBO.java delete mode 100644 order/order-biz/src/main/java/cn/iocoder/mall/order/biz/convert/CartConvert.java delete mode 100644 order/order-biz/src/main/java/cn/iocoder/mall/order/biz/convert/OrderConvert.java delete mode 100644 order/order-biz/src/main/java/cn/iocoder/mall/order/biz/convert/OrderItemConvert.java delete mode 100644 order/order-rest/pom.xml delete mode 100644 order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderBO.java delete mode 100644 order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderCreateBO.java delete mode 100644 order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderInfoBO.java delete mode 100644 order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderItemBO.java delete mode 100644 order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderPageBO.java delete mode 100644 order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderPayBO.java delete mode 100644 order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderRecipientBO.java delete mode 100644 order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/PostageDetailBO.java rename {pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/constant => pay-service-project/pay-service-api/src/main/java/cn/iocoder/mall/payservice/enums}/PayChannelEnum.java (96%) create mode 100644 pay-service-project/pay-service-api/src/main/java/cn/iocoder/mall/payservice/rpc/app/PayAppRpc.java rename pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/dataobject/PayAppDO.java => pay-service-project/pay-service-api/src/main/java/cn/iocoder/mall/payservice/rpc/app/dto/PayAppRespDTO.java (61%) create mode 100644 pay-service-project/pay-service-api/src/main/java/cn/iocoder/mall/payservice/rpc/package-info.java create mode 100644 pay-service-project/pay-service-api/src/main/java/cn/iocoder/mall/payservice/rpc/transaction/PayTransactionRpc.java rename pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/dto/transaction/PayTransactionCreateDTO.java => pay-service-project/pay-service-api/src/main/java/cn/iocoder/mall/payservice/rpc/transaction/dto/PayTransactionCreateReqDTO.java (56%) create mode 100644 pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/config/DatabaseConfiguration.java create mode 100644 pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/dal/mysql/dataobject/app/PayAppDO.java rename pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/dal/mysql/dataobject/transaction/{TransactionDO.java => PayTransactionDO.java} (84%) create mode 100644 pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/dal/mysql/mapper/transaction/PayTransactionMapper.java delete mode 100644 pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/dal/mysql/mapper/transaction/TransactionMapper.java delete mode 100644 pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/manager/transaction/TransactionManager.java rename pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/rpc/transaction/{TransactionRpcImpl.java => PayTransactionRpcImpl.java} (59%) create mode 100644 pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/service/app/PayAppService.java create mode 100644 pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/service/app/impl/PayAppServiceImpl.java create mode 100644 pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/service/transaction/PayTransactionService.java delete mode 100644 pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/service/transaction/TransactionService.java delete mode 100644 pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/service/transaction/bo/TransactionBO.java delete mode 100644 pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/service/transaction/bo/TransactionCreateBO.java delete mode 100644 pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/service/transaction/bo/TransactionPageBO.java delete mode 100644 pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/service/transaction/bo/TransactionUpdateBO.java create mode 100644 pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/service/transaction/impl/PayTransactionServiceImpl.java create mode 100644 pay-service-project/pay-service-app/src/main/resources/application-dev.yaml create mode 100644 pay-service-project/pay-service-app/src/main/resources/application-local.yaml create mode 100644 pay-service-project/pay-service-app/src/main/resources/application.yaml delete mode 100644 pay/pay-application/src/main/java/cn/iocoder/mall/pay/application/PayApplication.java delete mode 100644 pay/pay-application/src/main/java/cn/iocoder/mall/pay/application/convert/PayRefundConvert.java delete mode 100644 pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/config/DatabaseConfiguration.java delete mode 100644 pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/config/ServiceExceptionConfiguration.java delete mode 100644 pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/dao/PayAppMapper.java delete mode 100644 pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/service/PayAppServiceImpl.java create mode 100644 shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/trade/vo/order/TradeOrderItemRespVO.java create mode 100644 shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/trade/vo/order/TradeOrderPageReqVO.java create mode 100644 shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/trade/vo/order/TradeOrderRespVO.java create mode 100644 trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/enums/order/TradeOrderDetailFieldEnum.java create mode 100644 trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/rpc/order/dto/TradeOrderItemRespDTO.java create mode 100644 trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/rpc/order/dto/TradeOrderPageReqDTO.java create mode 100644 trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/rpc/order/dto/TradeOrderRespDTO.java create mode 100644 trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/convert/order/TradeOrderConvert.java diff --git a/common/common-framework/src/main/java/cn/iocoder/common/framework/util/CollectionUtils.java b/common/common-framework/src/main/java/cn/iocoder/common/framework/util/CollectionUtils.java index caccab73a..865ad3fd4 100644 --- a/common/common-framework/src/main/java/cn/iocoder/common/framework/util/CollectionUtils.java +++ b/common/common-framework/src/main/java/cn/iocoder/common/framework/util/CollectionUtils.java @@ -34,6 +34,11 @@ public class CollectionUtils { return from.stream().collect(Collectors.toMap(keyFunc, valueFunc)); } + public static Map> convertMultiMap(List from, Function keyFunc) { + return from.stream().collect(Collectors.groupingBy(keyFunc, + Collectors.mapping(t -> t, Collectors.toList()))); + } + public static Map> convertMultiMap(List from, Function keyFunc, Function valueFunc) { return from.stream().collect(Collectors.groupingBy(keyFunc, Collectors.mapping(valueFunc, Collectors.toList()))); diff --git a/common/common-framework/src/main/java/cn/iocoder/common/framework/vo/PageParam.java b/common/common-framework/src/main/java/cn/iocoder/common/framework/vo/PageParam.java index 8b81dbfb2..6f371430f 100644 --- a/common/common-framework/src/main/java/cn/iocoder/common/framework/vo/PageParam.java +++ b/common/common-framework/src/main/java/cn/iocoder/common/framework/vo/PageParam.java @@ -39,8 +39,8 @@ public class PageParam implements Serializable { return this; } - public final int getOffset() { - return (pageNo - 1) * pageSize; - } +// public final int getOffset() { +// return (pageNo - 1) * pageSize; +// } } diff --git a/common/common-framework/src/main/java/cn/iocoder/common/framework/vo/SortingField.java b/common/common-framework/src/main/java/cn/iocoder/common/framework/vo/SortingField.java index 99273d2a4..e592c0470 100644 --- a/common/common-framework/src/main/java/cn/iocoder/common/framework/vo/SortingField.java +++ b/common/common-framework/src/main/java/cn/iocoder/common/framework/vo/SortingField.java @@ -9,6 +9,15 @@ import java.io.Serializable; */ public class SortingField implements Serializable { + /** + * 顺序 - 升序 + */ + public static final String ORDER_ASC = "asc"; + /** + * 顺序 - 降序 + */ + public static final String ORDER_DESC = "desc"; + /** * 字段 */ diff --git a/common/mall-spring-boot-starter-mybatis/pom.xml b/common/mall-spring-boot-starter-mybatis/pom.xml index 287f258ce..becc6ae11 100644 --- a/common/mall-spring-boot-starter-mybatis/pom.xml +++ b/common/mall-spring-boot-starter-mybatis/pom.xml @@ -12,6 +12,12 @@ mall-spring-boot-starter-mybatis + + + cn.iocoder.mall + common-framework + + org.mybatis diff --git a/common/mall-spring-boot-starter-mybatis/src/main/java/cn/iocoder/mall/mybatis/core/util/PageUtil.java b/common/mall-spring-boot-starter-mybatis/src/main/java/cn/iocoder/mall/mybatis/core/util/PageUtil.java new file mode 100644 index 000000000..8216c8224 --- /dev/null +++ b/common/mall-spring-boot-starter-mybatis/src/main/java/cn/iocoder/mall/mybatis/core/util/PageUtil.java @@ -0,0 +1,35 @@ +package cn.iocoder.mall.mybatis.core.util; + +import cn.iocoder.common.framework.util.CollectionUtils; +import cn.iocoder.common.framework.vo.PageParam; +import cn.iocoder.common.framework.vo.SortingField; +import com.baomidou.mybatisplus.core.metadata.OrderItem; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; + +import java.util.Collection; +import java.util.stream.Collectors; + +/** + * 分页工具里 + * + * 目前主要用于 {@link Page} 的构建 + */ +public class PageUtil { + + public static Page build(PageParam pageParam) { + return build(pageParam, null); + } + + public static Page build(PageParam pageParam, Collection sortingFields) { + // 页码 + 数量 + Page page = new Page<>(pageParam.getPageNo(), pageParam.getPageSize()); + // 排序字段 + if (!CollectionUtils.isEmpty(sortingFields)) { + page.addOrder(sortingFields.stream().map(sortingField -> SortingField.ORDER_ASC.equals(sortingField.getOrder()) ? + OrderItem.asc(sortingField.getField()) : OrderItem.desc(sortingField.getField())) + .collect(Collectors.toList())); + } + return page; + } + +} diff --git a/moved/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/convert/OrderConvert.java b/moved/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/convert/OrderConvert.java deleted file mode 100644 index 6917a8761..000000000 --- a/moved/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/convert/OrderConvert.java +++ /dev/null @@ -1,28 +0,0 @@ -package cn.iocoder.mall.order.biz.convert; - -import cn.iocoder.mall.order.api.bo.OrderBO; -import cn.iocoder.mall.order.api.bo.OrderInfoBO; -import cn.iocoder.mall.order.biz.dataobject.OrderDO; -import org.mapstruct.Mapper; -import org.mapstruct.Mappings; -import org.mapstruct.factory.Mappers; - -import java.util.List; - -/** - * 订单 convert - * - * @author Sin - * @time 2019-03-17 10:14 - */ -@Mapper -public interface OrderConvert { - - OrderConvert INSTANCE = Mappers.getMapper(OrderConvert.class); - - @Mappings({}) - List convertPageBO(List orderDOList); - - @Mappings({}) - OrderInfoBO convert(OrderDO orderDO); -} diff --git a/moved/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderServiceImpl.java b/moved/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderServiceImpl.java index 2f4f8d943..00f6b34ad 100644 --- a/moved/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderServiceImpl.java +++ b/moved/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderServiceImpl.java @@ -48,117 +48,6 @@ public class OrderServiceImpl implements OrderService { */ public static final int PAY_EXPIRE_TIME = 120; - @Autowired - private OrderMapper orderMapper; - @Autowired - private OrderItemMapper orderItemMapper; - @Autowired - private OrderLogisticsMapper orderLogisticsMapper; - @Autowired - private OrderLogisticsDetailMapper orderLogisticsDetailMapper; - @Autowired - private OrderRecipientMapper orderRecipientMapper; - @Autowired - private OrderCancelMapper orderCancelMapper; - @Autowired - private OrderReturnMapper orderReturnMapper; - - @Autowired - private CartServiceImpl cartService; - - @Reference(validation = "true", version = "${dubbo.consumer.PromotionActivityService.version}") - private ProductSpuService productSpuService; - @Reference(validation = "true", version = "${dubbo.consumer.UserAddressService.version}") - private UserAddressService userAddressService; - @Reference(validation = "true", version = "${dubbo.consumer.PayTransactionService.version}") - private PayTransactionService payTransactionService; - @Reference(validation = "true", version = "${dubbo.consumer.CouponService.version}") - private CouponService couponService; - - @Override - public CommonResult getOrderPage(OrderQueryDTO orderQueryDTO) { - - int totalCount = orderMapper.selectPageCount(orderQueryDTO); - if (totalCount == 0) { // TODO FROM 芋艿 TO 小范 Collections.EMPTY_LIST 改成 Collections.emptyList() - return CommonResult.success(new OrderPageBO().setOrders(Collections.EMPTY_LIST).setTotal(0)); - } - - // 获取订单数据 - List orderDOList = orderMapper.selectPage(orderQueryDTO); - - if (CollectionUtils.isEmpty(orderDOList)) { - return CommonResult.success(new OrderPageBO().setOrders(Collections.EMPTY_LIST).setTotal(totalCount)); - } - - // 获取订单 id - Set orderIds = orderDOList.stream() - .map(orderDO -> orderDO.getId()) // TODO FROM 芋艿 to 小范,记得用 Lambda - .collect(Collectors.toSet()); - - // 获取配送信息 - List orderRecipientDOList = orderRecipientMapper.selectByOrderIds(orderIds); - List orderRecipientBOList = OrderRecipientConvert.INSTANCE.convert(orderRecipientDOList); - Map orderRecipientBOMap - = orderRecipientBOList.stream().collect(Collectors.toMap(OrderRecipientBO::getOrderId, obj -> obj)); - - // 获取 订单的 items - List orderItemDOList = orderItemMapper - .selectByDeletedAndOrderIds(orderIds, DeletedStatusEnum.DELETED_NO.getValue()); - - List orderItemBOList = OrderItemConvert.INSTANCE.convertOrderItemDO(orderItemDOList); - Map> orderItemBOMultimap = orderItemBOList.stream().collect( - Collectors.toMap( - OrderItemBO::getOrderId, - item -> Lists.newArrayList(item), - (oldVal, newVal) -> { - oldVal.addAll(newVal); - return oldVal; - } - ) - ); - - // 转换 orderDO 为 OrderBO,并设置 item - List orderPageBOList = OrderConvert.INSTANCE.convertPageBO(orderDOList); - List result = orderPageBOList.stream().map(orderBO -> { - if (orderItemBOMultimap.containsKey(orderBO.getId())) { - orderBO.setOrderItems(orderItemBOMultimap.get(orderBO.getId())); - } - if (orderRecipientBOMap.containsKey(orderBO.getId())) { - orderBO.setOrderRecipient(orderRecipientBOMap.get(orderBO.getId())); - } - return orderBO; - }).collect(Collectors.toList()); - return CommonResult.success( - new OrderPageBO() - .setTotal(totalCount) - .setOrders(result) - ); - } - - @Override - public CommonResult> getOrderItems(Integer orderId) { - if (orderMapper.selectById(orderId) == null) { - return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_NOT_EXISTENT.getCode()); - } - - List orderItemDOList = orderItemMapper - .selectByDeletedAndOrderId(DeletedStatusEnum.DELETED_NO.getValue(), orderId); - - List orderItemBOList = OrderItemConvert.INSTANCE.convertOrderItemBO(orderItemDOList); - return CommonResult.success(orderItemBOList); - } - - @Override - public CommonResult getOrderRecipientBO(Integer orderId) { - if (orderMapper.selectById(orderId) == null) { - return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_NOT_EXISTENT.getCode()); - } - - OrderRecipientDO orderRecipientDO = orderRecipientMapper.selectByOrderId(orderId); - OrderRecipientBO orderRecipientBO = OrderRecipientConvert.INSTANCE.convert(orderRecipientDO); - return CommonResult.success(orderRecipientBO); - } - @Override public CommonResult info(Integer userId, Integer orderId) { OrderDO orderDO = orderMapper.selectById(orderId); diff --git a/moved/order/order-service-impl/src/main/resources/config/application.yaml b/moved/order/order-service-impl/src/main/resources/config/application.yaml deleted file mode 100644 index ef3e58c9d..000000000 --- a/moved/order/order-service-impl/src/main/resources/config/application.yaml +++ /dev/null @@ -1,93 +0,0 @@ -spring: - # datasource - datasource: - url: jdbc:mysql://s1.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: s1.iocoder.cn:8848 # Nacos 服务器地址 - -# mybatis-plus -mybatis-plus: - configuration: - map-underscore-to-camel-case: true # 虽然默认为 true ,但是还是显示去指定下。 - global-config: - db-config: - id-type: auto - mapper-locations: classpath*:mapper/*.xml - type-aliases-package: cn.iocoder.mall.order.biz.dataobject - -# Dubbo 配置项 -dubbo: - # Dubbo 注册中心 - registry: - address: spring-cloud://s1.iocoder.cn:8848 # 指定 Dubbo 服务注册中心的地址 - # Spring Cloud Alibaba Dubbo 专属配置 - cloud: - subscribed-services: admin-application, user-application, product-application, promotion-application, pay-application # 设置订阅的应用列表,默认为 * 订阅所有应用 - # Dubbo 提供者的协议 - protocol: - name: dubbo - port: -1 - # Dubbo 提供服务的扫描基础包 - scan: - base-packages: cn.iocoder.mall.order.biz.service - # Dubbo 服务提供者的配置 - provider: - filter: -exception - CartService: - version: 1.0.0 - OrderService: - version: 1.0.0 - OrderReturnService: - version: 1.0.0 - OrderLogisticsService: - version: 1.0.0 - OrderCommentService: - version: 1.0.0 - OrderCommentReplyService: - version: 1.0.0 - consumer: - timeout: 120000 # 设置长一点,方便调试代码 - ProductSpuService: - version: 1.0.0 - PromotionActivityService: - version: 1.0.0 - CouponService: - version: 1.0.0 - PayRefundService: - version: 1.0.0 - UserAddressService: - version: 1.0.0 - PayTransactionService: - version: 1.0.0 - DataDictService: - version: 1.0.0 - -# logging -logging: - level: - # dao 开启 debug 模式 mybatis 输入 sql - cn.iocoder.mall.order.biz.dao: debug - -# Seata 配置项 -seata: - tx-service-group: default # Seata 事务组编号,用于 TC 集群名 - # 服务配置项,对应 ServiceProperties 类 - service: - # 虚拟组和分组的映射 - vgroup-mapping: - default: default - # Seata 注册中心配置项 - registry: - type: nacos # 注册中心类型 - nacos: - serverAddr: ${spring.cloud.nacos.discovery.server-addr} # Nacos 服务地址 - namespace: # Nacos 命名空间 - cluster: default # 使用的 Seata 分组 diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/CalcOrderPriceBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/CalcOrderPriceBO.java deleted file mode 100644 index 8a05a52fd..000000000 --- a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/CalcOrderPriceBO.java +++ /dev/null @@ -1,176 +0,0 @@ -package cn.iocoder.mall.order.biz.bo; - -import lombok.Data; -import lombok.experimental.Accessors; - -/** - * 计算订单价格结果 BO - */ -@Data -@Accessors(chain = true) -public class CalcOrderPriceBO { - -// /** -// * 商品分组数组 -// */ -// private List itemGroups; -// /** -// * 优惠劵编号 -// */ -// private Integer couponCardId; -// /** -// * 优惠劵减少的金额 -// * -// * 1. 若未使用优惠劵,返回 null -// * 2. 该金额,已经分摊到每个 Item 的 discountTotal ,需要注意。 -// */ -// private Integer couponCardDiscountTotal; -// /** -// * 邮费信息 -// * -// * TODO 芋艿,暂时未弄 -// */ -// private Postage postage; -// /** -// * 费用 -// */ -// private Fee fee; -// -// /** -// * 商品分组 -// * -// * 多个商品,参加同一个活动,从而形成分组。 -// */ -// @Data -// @Accessors(chain = true) -// public static class ItemGroup { -// -// /** -// * 优惠活动 -// */ -// // TODO 芋艿,目前只会有【满减送】的情况,未来有新的促销方式,可能需要改成数组 -// private PromotionActivityBO activity; -// /** -// * 促销减少的金额 -// * -// * 1. 若未参与促销活动,或不满足促销条件,返回 null -// * 2. 该金额,已经分摊到每个 Item 的 discountTotal ,需要注意。 -// */ -// private Integer activityDiscountTotal; -// /** -// * 商品数组 -// */ -// private List items; -//// /** -//// * 费用 -//// * -//// * TODO 芋艿,这里先偷懒,postageTotal 字段用不到。 -//// */ -//// private Fee fee; // 注释原因,不用这里了 -// -// } -// -// @Data -// @Accessors(chain = true) -// public static class Item extends ProductSkuDetailBO { // TODO 芋艿,此处先偷懒继承 -// -// /** -// * 是否选中 -// */ -// private Boolean selected; -// /** -// * 购买数量 -// */ -// private Integer buyQuantity; -// /** -// * 优惠活动 -// */ -// private PromotionActivityBO activity; -// /** -// * 原始单价,单位:分。 -// */ -// 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 Fee { -// -// /** -// * 购买总价 -// */ -// private Integer buyTotal; -// /** -// * 优惠总价 -// * -// * 注意,满多少元包邮,不算在优惠中。 -// */ -// private Integer discountTotal; -// /** -// * 邮费 TODO 芋艿,将 postage 改成 logistics -// */ -// 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; -// } -// } -// -// /** -// * 邮费信息 -// */ -// @Data -// @Accessors(chain = true) -// public static class Postage { -// -// /** -// * 需要满足多少钱,可以包邮。单位:分 -// */ -// private Integer threshold; -// -// } - -} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/CalcSkuPriceBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/CalcSkuPriceBO.java deleted file mode 100644 index 2097f0559..000000000 --- a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/CalcSkuPriceBO.java +++ /dev/null @@ -1,31 +0,0 @@ -package cn.iocoder.mall.order.biz.bo; - -import java.io.Serializable; -import lombok.Data; -import lombok.experimental.Accessors; - -/** - * 计算商品 SKU 价格结果 BO - */ -@Data -@Accessors(chain = true) -public class CalcSkuPriceBO implements Serializable { - -// /** -// * 满减送促销活动 -// */ -// private PromotionActivityBO fullPrivilege; -// /** -// * 限时折扣促销活动 -// */ -// private PromotionActivityBO timeLimitedDiscount; -// /** -// * 原价格,单位:分。 -// */ -// private Integer originalPrice; -// /** -// * 购买价格,单位:分。 -// */ -// private Integer buyPrice; - -} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/CartItemBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/CartItemBO.java deleted file mode 100644 index 00a71d79e..000000000 --- a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/CartItemBO.java +++ /dev/null @@ -1,100 +0,0 @@ -package cn.iocoder.mall.order.biz.bo; - -import lombok.Data; -import lombok.experimental.Accessors; - -import java.util.Date; - -/** - * 购物车的商品信息 DO - */ -@Data -@Accessors(chain = true) -public class CartItemBO { - - // ========= 基础字段 BEGIN ========= - - /** - * 编号,唯一自增。 - */ - private Integer id; - /** - * 状态 - * - * 1-正常 - * 2-主动删除 - * 3-下单删除 - */ - private Integer status; - /** - * 是否选中 - */ - private Boolean selected; - - // ========= 基础字段 END ========= - - // ========= 买家信息 BEGIN ========= - - /** - * 用户编号 - */ - private Integer userId; -// /** -// * 会话 key -// */ -// private String nobody; - - // ========= 买家信息 END ========= - - // ========= 商品信息 BEGIN ========= - - /** - * 商品 SPU 编号 - */ - private Integer spuId; - /** - * 商品 SKU 编号 - */ - private Integer skuId; - /** - * 商品购买数量 - */ - private Integer quantity; - - // TODO 冗余字段 - - - // ========= 商品信息 END ========= - - // ========= 交易信息 BEGIN ========= - - /** - * 订单编号 - */ - private Integer orderId; - /** - * 订单创建时间 - */ - private Date orderCreateTime; - - // ========= 交易信息 BEGIN ========= - - // ========= 优惠信息 BEGIN ========= - -// /** -// * 商品营销活动编号 -// */ -// private Integer activityId; -// /** -// * 商品营销活动类型 -// */ -// private Integer activityType; - - // ========= 优惠信息 END ========= - - /** - * 创建时间 - */ - private Date createTime; - -} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/OrderBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/OrderBO.java deleted file mode 100644 index 3e7ccaccb..000000000 --- a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/OrderBO.java +++ /dev/null @@ -1,115 +0,0 @@ -package cn.iocoder.mall.order.biz.bo; - -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.util.Date; -import java.util.List; - -/** - * 订单 page - * - * @author Sin - * @time 2019-03-23 14:30 - */ -@Data -@Accessors(chain = true) -public class OrderBO implements Serializable { - - /** - * id - */ - private Integer id; - /** - * 用户编号 - */ - private Integer userId; - /** - * 订单编号 - */ - private String orderNo; - /** - * 购买(商品)总金额,单位:分 - */ - private Integer buyPrice; - /** - * 优惠总金额,单位:分。 - */ - private Integer discountPrice; - /** - * 物流金额 (分) - */ - private Integer logisticsPrice; - /** - * 最终金额,单位:分 - * - * buyPrice + logisticsPrice - discountPrice = presentPrice - */ - private Integer presentPrice; - /** - * 实际已支付金额,单位:分 - * - * 初始时,金额为 0 。等到支付成功后,会进行更新。 - */ - private Integer payAmount; - - /// - /// 时间信息 - - /** - * 付款时间(待发货) - */ - private Date paymentTime; - /** - * 发货时间(待收货) - */ - private Date deliveryTime; - /** - * 收货时间(已签收) - */ - private Date receiverTime; - /** - * 成交时间(用户确认收货 -> status = 已完成) - */ - private Date closingTime; - - /// - /// 其他 - - /** - * 是否退货 - * - * - 0、没有 - * - 1、换货 - * - 2、退货 - * - 3、换货 + 退货 - */ - private Integer hasReturnExchange; - /** - * 状态(如果有多个商品分开发货需要全部商品发完才会改变状态) - * - * - 0、待付款 - * - 1、待发货 - * - 2、待收获 - * - 3、已完成 - * - 4、已关闭 - */ - private Integer status; - /** - * 备注 - */ - private String remark; - - /// - /// 关联信息 - - /** - * orderItem - */ - private List orderItems; - /** - * 订单物流信息 - */ - private OrderRecipientBO orderRecipient; -} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/OrderCreateBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/OrderCreateBO.java deleted file mode 100644 index efba459c1..000000000 --- a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/OrderCreateBO.java +++ /dev/null @@ -1,30 +0,0 @@ -package cn.iocoder.mall.order.biz.bo; - -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; - -/** - * 订单创建 BO - * - * @author Sin - * @time 2019-03-16 14:38 - */ -@Data -@Accessors(chain = true) -public class OrderCreateBO implements Serializable { - - /** - * 编号 - */ - private Integer id; - /** - * 订单编号 - */ - private String orderNo; - /** - * 订单金额 - */ - private Integer payAmount; -} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/OrderInfoBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/OrderInfoBO.java deleted file mode 100644 index 1e69e7bcc..000000000 --- a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/OrderInfoBO.java +++ /dev/null @@ -1,233 +0,0 @@ -package cn.iocoder.mall.order.biz.bo; - -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.util.Date; -import java.util.List; - -/** - * 订单 info - * - * @author Sin - * @time 2019-04-14 15:36 - */ -@Data -@Accessors(chain = true) -public class OrderInfoBO implements Serializable { - - /** - * id - */ - private Integer id; - /** - * 订单编号 - */ - private String orderNo; - /** - * 购买(商品)总金额,单位:分 - */ - private Integer buyPrice; - /** - * 优惠总金额,单位:分。 - */ - private Integer discountPrice; - /** - * 物流金额 (分) - */ - private Integer logisticsPrice; - /** - * 最终金额,单位:分 - * - * buyPrice + logisticsPrice - discountPrice = presentPrice - */ - private Integer presentPrice; - /** - * 实际已支付金额,单位:分 - * - * 初始时,金额为 0 。等到支付成功后,会进行更新。 - */ - private Integer payAmount; - - /** - * 付款时间(待发货) - */ - private Date paymentTime; - /** - * 发货时间(待收货) - */ - private Date deliveryTime; - /** - * 收货时间(已签收) - */ - private Date receiverTime; - /** - * 成交时间(用户确认收货 -> status = 已完成) - */ - private Date closingTime; - /** - * 是否退货 - * - * - 1、没有 - * - 2、换货 - * - 3、退货 - * - 4、换货 + 退货 - */ - private Integer hasReturnExchange; - /** - * 状态(如果有多个商品分开发货需要全部商品发完才会改变状态) - * - * - 1、待付款 - * - 2、待发货 - * - 3、待收获 - * - 4、已完成 - * - 5、已关闭 - */ - private Integer status; - /** - * 转换的字典值 - */ - private String statusText; - /** - * 备注 - */ - private String remark; - - /// - /// 其他信息 - - /** - * 手机人信息 - */ - private Recipient recipient; - /** - * 最新物流信息 - */ - private LogisticsDetail latestLogisticsDetail; - /** - * 订单 item - */ - private List orderItems; - - - /// - /// 其他字段 - - /** - * 是否退货 - */ - private Integer hasOrderReturn; - - @Data - @Accessors(chain = true) - public static class OrderItem { - - /** - * 商品编号 - */ - private Integer skuId; - /** - * 商品名称 - */ - private String skuName; - /** - * 商品图片 - */ - private String skuImage; - /** - * 数量 - */ - private Integer quantity; - /** - * 原始单价,单位:分。 - */ - 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 Recipient { - - /** - * 编号 - */ - private Integer id; - /** - * 订单id - */ - private Integer orderId; - /** - * 收件区域编号 - */ - private String areaNo; - /** - * 收件人名称 - */ - private String name; - /** - * 收件手机号 - */ - private String mobile; - /** - * 配送类型 - * - * - 1 快递 - */ - private Integer type; - /** - * 收件详细地址 - */ - private String address; - } - - @Data - @Accessors(chain = true) - public static class LogisticsDetail { - - /** - * id - */ - private Integer id; - /** - * 物流id - */ - private Integer orderLogisticsId; - /** - * 物流时间 - */ - private Date logisticsTime; - /** - * 物流信息 - */ - private String logisticsInformation; - } -} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/OrderItemBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/OrderItemBO.java deleted file mode 100644 index d165da0eb..000000000 --- a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/OrderItemBO.java +++ /dev/null @@ -1,143 +0,0 @@ -package cn.iocoder.mall.order.biz.bo; - -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.util.Date; - -/** - * 订单 item - * - * @author Sin - * @time 2019-03-28 21:11 - */ -@Data -@Accessors(chain = true) -public class OrderItemBO implements Serializable { - - /** - * 编号 - */ - private Integer id; - /** - * 订单编号 - */ - private Integer orderId; - /** - * 订单号 - */ - private String orderNo; - /** - * 商品编号 - */ - private Integer skuId; - /** - * 商品名称 - */ - private String skuName; - /** - * 商品图片 - */ - private String skuImage; - /** - * 数量 - */ - private Integer quantity; - /** - * 原始单价,单位:分。 - */ - 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; - - /// - /// 时间信息 - - /** - * 付款时间 - */ - private Date paymentTime; - /** - * 发货时间 - */ - private Date deliveryTime; - /** - * 收货时间 - */ - private Date receiverTime; - /** - * 成交时间 - */ - private Date closingTime; - - /// - /// 其他 - - /** - * 是否退货 - * - * - 1、没有 - * - 2、换货 - * - 3、退货 - * - 4、换货 + 退货 - */ - private Integer hasReturnExchange; - /** - * 发货方式 - * - * - 1 未选择 - * - 2 在线下单 - * - 3 自己联系快递 - * - 4 无物流 - */ - private Integer deliveryType; - /** - * 状态 - * - * - 1、待付款 - * - 2、待发货 - * - 3、已发货 - * - 4、已完成 - * - 5、已关闭 - */ - private Integer status; - - /** - * 创建时间 - */ - private Date createTime; - /** - * 更新时间 - */ - private Date updateTime; - /** - * 删除状态 - */ - private Integer deleted; -} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/OrderPageBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/OrderPageBO.java deleted file mode 100644 index 4f73f92ee..000000000 --- a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/OrderPageBO.java +++ /dev/null @@ -1,28 +0,0 @@ -package cn.iocoder.mall.order.biz.bo; - -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.util.List; - -/** - * 订单分页 - * - * @author Sin - * @time 2019-03-27 21:27 - */ -@Data -@Accessors(chain = true) -public class OrderPageBO implements Serializable { - - /** - * 总条数 - */ - private Integer total; - /** - * 订单列表 - */ - private List orders; - -} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/OrderPayBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/OrderPayBO.java deleted file mode 100644 index 8e5d5120f..000000000 --- a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/OrderPayBO.java +++ /dev/null @@ -1,12 +0,0 @@ -package cn.iocoder.mall.order.biz.bo; - -import java.io.Serializable; - -/** - * 订单支付信息返回 - * - * @author Sin - * @time 2019-04-08 19:39 - */ -public class OrderPayBO implements Serializable { -} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/OrderRecipientBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/OrderRecipientBO.java deleted file mode 100644 index c1491d0e1..000000000 --- a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/OrderRecipientBO.java +++ /dev/null @@ -1,45 +0,0 @@ -package cn.iocoder.mall.order.biz.bo; - -import cn.iocoder.mall.mybatis.core.dataobject.BaseDO; -import lombok.Data; -import lombok.experimental.Accessors; - -/** - * 订单收件人信息 order_recipient - * - * @author Sin - * @time 2019-03-31 11:37 - */ -@Data -@Accessors(chain = true) -public class OrderRecipientBO extends BaseDO { // TODO FROM 芋艿 TO 小范,不要继承 BaseDO - - /** - * 编号 - */ - private Integer id; - /** - * 订单id - */ - private Integer orderId; - /** - * 收件区域编号 - */ - private String areaNo; - /** - * 收件人名称 - */ - private String name; - /** - * 收件手机号 - */ - private String mobile; - /** - * 手机方式 - */ - private Integer type; - /** - * 收件详细地址 - */ - private String address; -} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/PostageDetailBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/PostageDetailBO.java deleted file mode 100644 index cf8a664b4..000000000 --- a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/PostageDetailBO.java +++ /dev/null @@ -1,14 +0,0 @@ -package cn.iocoder.mall.order.biz.bo; - -public class PostageDetailBO { - -// "description": "有品甄选商品,即有品配送和第三方商家发货的商品,2018年1月1日起,单笔订单满99元免运费,不满99元收10元运费。", -// "leftTotal": "0.00", -// "merchantName": "有品配送", -// "postFee": "0.00", -// "postage": "10.00", -// "postageType": 0, -// "selCount": 14, -// "threshold": "99.00" - -} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/CalcOrderPriceBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/CalcOrderPriceBO.java deleted file mode 100644 index 386ff89d6..000000000 --- a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/CalcOrderPriceBO.java +++ /dev/null @@ -1,176 +0,0 @@ -package cn.iocoder.mall.order.biz.bo.order; - -import lombok.Data; -import lombok.experimental.Accessors; - -/** - * 计算订单价格结果 BO - */ -@Data -@Accessors(chain = true) -public class CalcOrderPriceBO { - -// /** -// * 商品分组数组 -// */ -// private List itemGroups; -// /** -// * 优惠劵编号 -// */ -// private Integer couponCardId; -// /** -// * 优惠劵减少的金额 -// * -// * 1. 若未使用优惠劵,返回 null -// * 2. 该金额,已经分摊到每个 Item 的 discountTotal ,需要注意。 -// */ -// private Integer couponCardDiscountTotal; -// /** -// * 邮费信息 -// * -// * TODO 芋艿,暂时未弄 -// */ -// private Postage postage; -// /** -// * 费用 -// */ -// private Fee fee; -// -// /** -// * 商品分组 -// * -// * 多个商品,参加同一个活动,从而形成分组。 -// */ -// @Data -// @Accessors(chain = true) -// public static class ItemGroup { -// -// /** -// * 优惠活动 -// */ -// // TODO 芋艿,目前只会有【满减送】的情况,未来有新的促销方式,可能需要改成数组 -// private PromotionActivityBO activity; -// /** -// * 促销减少的金额 -// * -// * 1. 若未参与促销活动,或不满足促销条件,返回 null -// * 2. 该金额,已经分摊到每个 Item 的 discountTotal ,需要注意。 -// */ -// private Integer activityDiscountTotal; -// /** -// * 商品数组 -// */ -// private List items; -//// /** -//// * 费用 -//// * -//// * TODO 芋艿,这里先偷懒,postageTotal 字段用不到。 -//// */ -//// private Fee fee; // 注释原因,不用这里了 -// -// } -// -// @Data -// @Accessors(chain = true) -// public static class Item extends ProductSkuDetailBO { // TODO 芋艿,此处先偷懒继承 -// -// /** -// * 是否选中 -// */ -// private Boolean selected; -// /** -// * 购买数量 -// */ -// private Integer buyQuantity; -// /** -// * 优惠活动 -// */ -// private PromotionActivityBO activity; -// /** -// * 原始单价,单位:分。 -// */ -// 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 Fee { -// -// /** -// * 购买总价 -// */ -// private Integer buyTotal; -// /** -// * 优惠总价 -// * -// * 注意,满多少元包邮,不算在优惠中。 -// */ -// private Integer discountTotal; -// /** -// * 邮费 TODO 芋艿,将 postage 改成 logistics -// */ -// 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; -// } -// } -// -// /** -// * 邮费信息 -// */ -// @Data -// @Accessors(chain = true) -// public static class Postage { -// -// /** -// * 需要满足多少钱,可以包邮。单位:分 -// */ -// private Integer threshold; -// -// } - -} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/CalcSkuPriceBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/CalcSkuPriceBO.java deleted file mode 100644 index fee1023dc..000000000 --- a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/CalcSkuPriceBO.java +++ /dev/null @@ -1,31 +0,0 @@ -package cn.iocoder.mall.order.biz.bo.order; - -import java.io.Serializable; -import lombok.Data; -import lombok.experimental.Accessors; - -/** - * 计算商品 SKU 价格结果 BO - */ -@Data -@Accessors(chain = true) -public class CalcSkuPriceBO implements Serializable { - -// /** -// * 满减送促销活动 -// */ -// private PromotionActivityBO fullPrivilege; -// /** -// * 限时折扣促销活动 -// */ -// private PromotionActivityBO timeLimitedDiscount; -// /** -// * 原价格,单位:分。 -// */ -// private Integer originalPrice; -// /** -// * 购买价格,单位:分。 -// */ -// private Integer buyPrice; - -} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/CartItemBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/CartItemBO.java deleted file mode 100644 index ad25c6df0..000000000 --- a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/CartItemBO.java +++ /dev/null @@ -1,100 +0,0 @@ -package cn.iocoder.mall.order.biz.bo.order; - -import lombok.Data; -import lombok.experimental.Accessors; - -import java.util.Date; - -/** - * 购物车的商品信息 DO - */ -@Data -@Accessors(chain = true) -public class CartItemBO { - - // ========= 基础字段 BEGIN ========= - - /** - * 编号,唯一自增。 - */ - private Integer id; - /** - * 状态 - * - * 1-正常 - * 2-主动删除 - * 3-下单删除 - */ - private Integer status; - /** - * 是否选中 - */ - private Boolean selected; - - // ========= 基础字段 END ========= - - // ========= 买家信息 BEGIN ========= - - /** - * 用户编号 - */ - private Integer userId; -// /** -// * 会话 key -// */ -// private String nobody; - - // ========= 买家信息 END ========= - - // ========= 商品信息 BEGIN ========= - - /** - * 商品 SPU 编号 - */ - private Integer spuId; - /** - * 商品 SKU 编号 - */ - private Integer skuId; - /** - * 商品购买数量 - */ - private Integer quantity; - - // TODO 冗余字段 - - - // ========= 商品信息 END ========= - - // ========= 交易信息 BEGIN ========= - - /** - * 订单编号 - */ - private Integer orderId; - /** - * 订单创建时间 - */ - private Date orderCreateTime; - - // ========= 交易信息 BEGIN ========= - - // ========= 优惠信息 BEGIN ========= - -// /** -// * 商品营销活动编号 -// */ -// private Integer activityId; -// /** -// * 商品营销活动类型 -// */ -// private Integer activityType; - - // ========= 优惠信息 END ========= - - /** - * 创建时间 - */ - private Date createTime; - -} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderBO.java deleted file mode 100644 index c4c06334e..000000000 --- a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderBO.java +++ /dev/null @@ -1,115 +0,0 @@ -package cn.iocoder.mall.order.biz.bo.order; - -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.util.Date; -import java.util.List; - -/** - * 订单 page - * - * @author Sin - * @time 2019-03-23 14:30 - */ -@Data -@Accessors(chain = true) -public class OrderBO implements Serializable { - - /** - * id - */ - private Integer id; - /** - * 用户编号 - */ - private Integer userId; - /** - * 订单编号 - */ - private String orderNo; - /** - * 购买(商品)总金额,单位:分 - */ - private Integer buyPrice; - /** - * 优惠总金额,单位:分。 - */ - private Integer discountPrice; - /** - * 物流金额 (分) - */ - private Integer logisticsPrice; - /** - * 最终金额,单位:分 - * - * buyPrice + logisticsPrice - discountPrice = presentPrice - */ - private Integer presentPrice; - /** - * 实际已支付金额,单位:分 - * - * 初始时,金额为 0 。等到支付成功后,会进行更新。 - */ - private Integer payAmount; - - /// - /// 时间信息 - - /** - * 付款时间(待发货) - */ - private Date paymentTime; - /** - * 发货时间(待收货) - */ - private Date deliveryTime; - /** - * 收货时间(已签收) - */ - private Date receiverTime; - /** - * 成交时间(用户确认收货 -> status = 已完成) - */ - private Date closingTime; - - /// - /// 其他 - - /** - * 是否退货 - * - * - 0、没有 - * - 1、换货 - * - 2、退货 - * - 3、换货 + 退货 - */ - private Integer hasReturnExchange; - /** - * 状态(如果有多个商品分开发货需要全部商品发完才会改变状态) - * - * - 0、待付款 - * - 1、待发货 - * - 2、待收获 - * - 3、已完成 - * - 4、已关闭 - */ - private Integer status; - /** - * 备注 - */ - private String remark; - - /// - /// 关联信息 - - /** - * orderItem - */ - private List orderItems; - /** - * 订单物流信息 - */ - private OrderRecipientBO orderRecipient; -} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderCreateBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderCreateBO.java deleted file mode 100644 index b20372e82..000000000 --- a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderCreateBO.java +++ /dev/null @@ -1,30 +0,0 @@ -package cn.iocoder.mall.order.biz.bo.order; - -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; - -/** - * 订单创建 BO - * - * @author Sin - * @time 2019-03-16 14:38 - */ -@Data -@Accessors(chain = true) -public class OrderCreateBO implements Serializable { - - /** - * 编号 - */ - private Integer id; - /** - * 订单编号 - */ - private String orderNo; - /** - * 订单金额 - */ - private Integer payAmount; -} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderInfoBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderInfoBO.java deleted file mode 100644 index bd59bb09c..000000000 --- a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderInfoBO.java +++ /dev/null @@ -1,233 +0,0 @@ -package cn.iocoder.mall.order.biz.bo.order; - -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.util.Date; -import java.util.List; - -/** - * 订单 info - * - * @author Sin - * @time 2019-04-14 15:36 - */ -@Data -@Accessors(chain = true) -public class OrderInfoBO implements Serializable { - - /** - * id - */ - private Integer id; - /** - * 订单编号 - */ - private String orderNo; - /** - * 购买(商品)总金额,单位:分 - */ - private Integer buyPrice; - /** - * 优惠总金额,单位:分。 - */ - private Integer discountPrice; - /** - * 物流金额 (分) - */ - private Integer logisticsPrice; - /** - * 最终金额,单位:分 - * - * buyPrice + logisticsPrice - discountPrice = presentPrice - */ - private Integer presentPrice; - /** - * 实际已支付金额,单位:分 - * - * 初始时,金额为 0 。等到支付成功后,会进行更新。 - */ - private Integer payAmount; - - /** - * 付款时间(待发货) - */ - private Date paymentTime; - /** - * 发货时间(待收货) - */ - private Date deliveryTime; - /** - * 收货时间(已签收) - */ - private Date receiverTime; - /** - * 成交时间(用户确认收货 -> status = 已完成) - */ - private Date closingTime; - /** - * 是否退货 - * - * - 1、没有 - * - 2、换货 - * - 3、退货 - * - 4、换货 + 退货 - */ - private Integer hasReturnExchange; - /** - * 状态(如果有多个商品分开发货需要全部商品发完才会改变状态) - * - * - 1、待付款 - * - 2、待发货 - * - 3、待收获 - * - 4、已完成 - * - 5、已关闭 - */ - private Integer status; - /** - * 转换的字典值 - */ - private String statusText; - /** - * 备注 - */ - private String remark; - - /// - /// 其他信息 - - /** - * 手机人信息 - */ - private Recipient recipient; - /** - * 最新物流信息 - */ - private LogisticsDetail latestLogisticsDetail; - /** - * 订单 item - */ - private List orderItems; - - - /// - /// 其他字段 - - /** - * 是否退货 - */ - private Integer hasOrderReturn; - - @Data - @Accessors(chain = true) - public static class OrderItem { - - /** - * 商品编号 - */ - private Integer skuId; - /** - * 商品名称 - */ - private String skuName; - /** - * 商品图片 - */ - private String skuImage; - /** - * 数量 - */ - private Integer quantity; - /** - * 原始单价,单位:分。 - */ - 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 Recipient { - - /** - * 编号 - */ - private Integer id; - /** - * 订单id - */ - private Integer orderId; - /** - * 收件区域编号 - */ - private String areaNo; - /** - * 收件人名称 - */ - private String name; - /** - * 收件手机号 - */ - private String mobile; - /** - * 配送类型 - * - * - 1 快递 - */ - private Integer type; - /** - * 收件详细地址 - */ - private String address; - } - - @Data - @Accessors(chain = true) - public static class LogisticsDetail { - - /** - * id - */ - private Integer id; - /** - * 物流id - */ - private Integer orderLogisticsId; - /** - * 物流时间 - */ - private Date logisticsTime; - /** - * 物流信息 - */ - private String logisticsInformation; - } -} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderItemBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderItemBO.java deleted file mode 100644 index 002dab929..000000000 --- a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderItemBO.java +++ /dev/null @@ -1,143 +0,0 @@ -package cn.iocoder.mall.order.biz.bo.order; - -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.util.Date; - -/** - * 订单 item - * - * @author Sin - * @time 2019-03-28 21:11 - */ -@Data -@Accessors(chain = true) -public class OrderItemBO implements Serializable { - - /** - * 编号 - */ - private Integer id; - /** - * 订单编号 - */ - private Integer orderId; - /** - * 订单号 - */ - private String orderNo; - /** - * 商品编号 - */ - private Integer skuId; - /** - * 商品名称 - */ - private String skuName; - /** - * 商品图片 - */ - private String skuImage; - /** - * 数量 - */ - private Integer quantity; - /** - * 原始单价,单位:分。 - */ - 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; - - /// - /// 时间信息 - - /** - * 付款时间 - */ - private Date paymentTime; - /** - * 发货时间 - */ - private Date deliveryTime; - /** - * 收货时间 - */ - private Date receiverTime; - /** - * 成交时间 - */ - private Date closingTime; - - /// - /// 其他 - - /** - * 是否退货 - * - * - 1、没有 - * - 2、换货 - * - 3、退货 - * - 4、换货 + 退货 - */ - private Integer hasReturnExchange; - /** - * 发货方式 - * - * - 1 未选择 - * - 2 在线下单 - * - 3 自己联系快递 - * - 4 无物流 - */ - private Integer deliveryType; - /** - * 状态 - * - * - 1、待付款 - * - 2、待发货 - * - 3、已发货 - * - 4、已完成 - * - 5、已关闭 - */ - private Integer status; - - /** - * 创建时间 - */ - private Date createTime; - /** - * 更新时间 - */ - private Date updateTime; - /** - * 删除状态 - */ - private Integer deleted; -} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderPageBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderPageBO.java deleted file mode 100644 index 59a6636ea..000000000 --- a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderPageBO.java +++ /dev/null @@ -1,28 +0,0 @@ -package cn.iocoder.mall.order.biz.bo.order; - -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.util.List; - -/** - * 订单分页 - * - * @author Sin - * @time 2019-03-27 21:27 - */ -@Data -@Accessors(chain = true) -public class OrderPageBO implements Serializable { - - /** - * 总条数 - */ - private Integer total; - /** - * 订单列表 - */ - private List orders; - -} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderPayBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderPayBO.java deleted file mode 100644 index 853f860ae..000000000 --- a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderPayBO.java +++ /dev/null @@ -1,12 +0,0 @@ -package cn.iocoder.mall.order.biz.bo.order; - -import java.io.Serializable; - -/** - * 订单支付信息返回 - * - * @author Sin - * @time 2019-04-08 19:39 - */ -public class OrderPayBO implements Serializable { -} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderRecipientBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderRecipientBO.java deleted file mode 100644 index e7a255455..000000000 --- a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderRecipientBO.java +++ /dev/null @@ -1,45 +0,0 @@ -package cn.iocoder.mall.order.biz.bo.order; - -import cn.iocoder.mall.mybatis.core.dataobject.BaseDO; -import lombok.Data; -import lombok.experimental.Accessors; - -/** - * 订单收件人信息 order_recipient - * - * @author Sin - * @time 2019-03-31 11:37 - */ -@Data -@Accessors(chain = true) -public class OrderRecipientBO extends BaseDO { // TODO FROM 芋艿 TO 小范,不要继承 BaseDO - - /** - * 编号 - */ - private Integer id; - /** - * 订单id - */ - private Integer orderId; - /** - * 收件区域编号 - */ - private String areaNo; - /** - * 收件人名称 - */ - private String name; - /** - * 收件手机号 - */ - private String mobile; - /** - * 手机方式 - */ - private Integer type; - /** - * 收件详细地址 - */ - private String address; -} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/PostageDetailBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/PostageDetailBO.java deleted file mode 100644 index 4fe42daee..000000000 --- a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/PostageDetailBO.java +++ /dev/null @@ -1,14 +0,0 @@ -package cn.iocoder.mall.order.biz.bo.order; - -public class PostageDetailBO { - -// "description": "有品甄选商品,即有品配送和第三方商家发货的商品,2018年1月1日起,单笔订单满99元免运费,不满99元收10元运费。", -// "leftTotal": "0.00", -// "merchantName": "有品配送", -// "postFee": "0.00", -// "postage": "10.00", -// "postageType": 0, -// "selCount": 14, -// "threshold": "99.00" - -} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/convert/CartConvert.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/convert/CartConvert.java deleted file mode 100644 index ed20bd083..000000000 --- a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/convert/CartConvert.java +++ /dev/null @@ -1,15 +0,0 @@ -package cn.iocoder.mall.order.biz.convert; - -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -@Mapper -public interface CartConvert { - - CartConvert INSTANCE = Mappers.getMapper(CartConvert.class); - -// CalcOrderPriceBO.Item convert(ProductSkuDetailBO sku); -// -// List convert(List items); - -} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/convert/OrderConvert.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/convert/OrderConvert.java deleted file mode 100644 index 423f77843..000000000 --- a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/convert/OrderConvert.java +++ /dev/null @@ -1,22 +0,0 @@ -package cn.iocoder.mall.order.biz.convert; - -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -/** - * 订单 convert - * - * @author Sin - * @time 2019-03-17 10:14 - */ -@Mapper -public interface OrderConvert { - - OrderConvert INSTANCE = Mappers.getMapper(OrderConvert.class); - -// @Mappings({}) -// List convertPageBO(List orderDOList); -// -// @Mappings({}) -// OrderInfoBO convert(OrderDO orderDO); -} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/convert/OrderItemConvert.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/convert/OrderItemConvert.java deleted file mode 100644 index f22b3cb67..000000000 --- a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/convert/OrderItemConvert.java +++ /dev/null @@ -1,31 +0,0 @@ -package cn.iocoder.mall.order.biz.convert; - -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -/** - * 订单 item convert - * - * @author Sin - * @time 2019-03-23 14:34 - */ -@Mapper -public interface OrderItemConvert { - - OrderItemConvert INSTANCE = Mappers.getMapper(OrderItemConvert.class); - -// @Mappings({}) -// OrderItemDO convert(OrderItemUpdateDTO orderItemUpdateDTO); -// -// @Mappings({}) -// List convertOrderItemBO(List orderItemDOList); -// -// @Mappings({}) -// List convert(List orderCreateItemDTOList); -// -// @Mappings({}) -// List convertOrderItemDO(List orderItemDOList); -// -// @Mappings({}) -// List convertOrderInfoWithOrderItem(List orderItemDOList); -} diff --git a/order/order-rest/pom.xml b/order/order-rest/pom.xml deleted file mode 100644 index 150c7d471..000000000 --- a/order/order-rest/pom.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - order - cn.iocoder.mall - 1.0-SNAPSHOT - - 4.0.0 - - order-rest - 提供 order 服务的 Rest 接口的实现,提供对外调用 - - - - - cn.iocoder.mall - order-biz - 1.0-SNAPSHOT - - - - cn.iocoder.mall - mall-spring-boot-starter-web - 1.0-SNAPSHOT - - - cn.iocoder.mall - mall-spring-boot-starter-security - 1.0-SNAPSHOT - - - cn.iocoder.mall - mall-spring-boot-starter-swagger - 1.0-SNAPSHOT - - - - - diff --git a/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/order/UsersOrderController.java b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/order/UsersOrderController.java index 3e0087f18..ca3ce2e17 100644 --- a/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/order/UsersOrderController.java +++ b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/order/UsersOrderController.java @@ -16,38 +16,7 @@ import org.springframework.web.bind.annotation.RestController; @Api(description = "用户订单") // TODO FROM 芋艿 to 小范,description 已经废弃啦 public class UsersOrderController { -// @Reference(validation = "true", version = "${dubbo.provider.OrderReturnService.version}") -// private OrderService orderService; -// -// @Reference(validation = "true", version = "${dubbo.provider.CartService.version}") -// private CartService cartService; -// -// @Reference(validation = "true", version = "${dubbo.consumer.DataDictService.version}") -// private DataDictService dataDictService; -// -// @Reference(validation = "true", version = "${dubbo.consumer.CouponService.version}") -// private CouponService couponService; -// -// @GetMapping("order_page") -// @RequiresLogin -// @ApiOperation("订单分页") -// public CommonResult getOrderPage(@Validated OrderQueryDTO orderQueryDTO) { -// Integer userId = UserSecurityContextHolder.getContext().getUserId(); -// orderQueryDTO.setUserId(userId); -// return orderService.getOrderPage(orderQueryDTO); -// } -// -// @PostMapping("create_order") -// @RequiresLogin -// @ApiOperation("创建订单") -// public CommonResult createOrder(@RequestBody @Validated OrderCreatePO orderCreatePO, -// HttpServletRequest request) { -// Integer userId = UserSecurityContextHolder.getContext().getUserId(); -// OrderCreateDTO orderCreateDTO = OrderConvertAPP.INSTANCE.convert(orderCreatePO); -// orderCreateDTO.setUserId(userId).setIp(HttpUtil.getIp(request)); -// return orderService.createOrder(orderCreateDTO); -// } -// + // @PostMapping("create_order_from_cart") // @RequiresLogin // @ApiOperation("创建订单购物车") @@ -85,21 +54,5 @@ public class UsersOrderController { // Integer userId = UserSecurityContextHolder.getContext().getUserId(); // return orderService.confirmReceiving(userId, orderId); // } -// -// @GetMapping("info") -// @RequiresLogin -// @ApiOperation("订单详情") -// public CommonResult orderInfo(@RequestParam("orderId") Integer orderId) { -// Integer userId = UserSecurityContextHolder.getContext().getUserId(); -// CommonResult commonResult = orderService.info(userId, orderId); -// -// OrderInfoBO orderInfoBO = commonResult.getData(); -// if (orderInfoBO != null) { -// CommonResult dictResult = dataDictService -// .getDataDict(DictKeyConstants.ORDER_STATUS, orderInfoBO.getStatus()); -// orderInfoBO.setStatusText(dictResult.getData().getDisplayName()); -// } -// return commonResult; -// } } diff --git a/order/order-service-api02/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 index 336917536..f53121bd2 100644 --- a/order/order-service-api02/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 @@ -14,30 +14,6 @@ import java.util.List; */ public interface OrderService { - /** - * 订单 page - * - * @param orderQueryDTO - * @return - */ - CommonResult getOrderPage(OrderQueryDTO orderQueryDTO); - - /** - * 获取订单items - * - * @param orderId - * @return - */ - CommonResult> getOrderItems(Integer orderId); - - /** - * 订单收件人信息 - * - * @param orderId - * @return - */ - CommonResult getOrderRecipientBO(Integer orderId); - /** * 订单info * @@ -47,14 +23,6 @@ public interface OrderService { */ CommonResult info(Integer userId, Integer orderId); - /** - * 订单 - 创建 - * - * @param orderCreateDTO - * @return - */ - CommonResult createOrder(OrderCreateDTO orderCreateDTO); - /** * 订单item - 更新 * diff --git a/order/order-service-api02/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 deleted file mode 100644 index aff731e3c..000000000 --- a/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderBO.java +++ /dev/null @@ -1,115 +0,0 @@ -package cn.iocoder.mall.order.api.bo; - -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.util.Date; -import java.util.List; - -/** - * 订单 page - * - * @author Sin - * @time 2019-03-23 14:30 - */ -@Data -@Accessors(chain = true) -public class OrderBO implements Serializable { - - /** - * id - */ - private Integer id; - /** - * 用户编号 - */ - private Integer userId; - /** - * 订单编号 - */ - private String orderNo; - /** - * 购买(商品)总金额,单位:分 - */ - private Integer buyPrice; - /** - * 优惠总金额,单位:分。 - */ - private Integer discountPrice; - /** - * 物流金额 (分) - */ - private Integer logisticsPrice; - /** - * 最终金额,单位:分 - * - * buyPrice + logisticsPrice - discountPrice = presentPrice - */ - private Integer presentPrice; - /** - * 实际已支付金额,单位:分 - * - * 初始时,金额为 0 。等到支付成功后,会进行更新。 - */ - private Integer payAmount; - - /// - /// 时间信息 - - /** - * 付款时间(待发货) - */ - private Date paymentTime; - /** - * 发货时间(待收货) - */ - private Date deliveryTime; - /** - * 收货时间(已签收) - */ - private Date receiverTime; - /** - * 成交时间(用户确认收货 -> status = 已完成) - */ - private Date closingTime; - - /// - /// 其他 - - /** - * 是否退货 - * - * - 0、没有 - * - 1、换货 - * - 2、退货 - * - 3、换货 + 退货 - */ - private Integer hasReturnExchange; - /** - * 状态(如果有多个商品分开发货需要全部商品发完才会改变状态) - * - * - 0、待付款 - * - 1、待发货 - * - 2、待收获 - * - 3、已完成 - * - 4、已关闭 - */ - private Integer status; - /** - * 备注 - */ - private String remark; - - /// - /// 关联信息 - - /** - * orderItem - */ - private List orderItems; - /** - * 订单物流信息 - */ - private OrderRecipientBO orderRecipient; -} diff --git a/order/order-service-api02/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 deleted file mode 100644 index 0bae929a5..000000000 --- a/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderCreateBO.java +++ /dev/null @@ -1,30 +0,0 @@ -package cn.iocoder.mall.order.api.bo; - -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; - -/** - * 订单创建 BO - * - * @author Sin - * @time 2019-03-16 14:38 - */ -@Data -@Accessors(chain = true) -public class OrderCreateBO implements Serializable { - - /** - * 编号 - */ - private Integer id; - /** - * 订单编号 - */ - private String orderNo; - /** - * 订单金额 - */ - private Integer payAmount; -} diff --git a/order/order-service-api02/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 deleted file mode 100644 index 61cbae25b..000000000 --- a/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderInfoBO.java +++ /dev/null @@ -1,233 +0,0 @@ -package cn.iocoder.mall.order.api.bo; - -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.util.Date; -import java.util.List; - -/** - * 订单 info - * - * @author Sin - * @time 2019-04-14 15:36 - */ -@Data -@Accessors(chain = true) -public class OrderInfoBO implements Serializable { - - /** - * id - */ - private Integer id; - /** - * 订单编号 - */ - private String orderNo; - /** - * 购买(商品)总金额,单位:分 - */ - private Integer buyPrice; - /** - * 优惠总金额,单位:分。 - */ - private Integer discountPrice; - /** - * 物流金额 (分) - */ - private Integer logisticsPrice; - /** - * 最终金额,单位:分 - * - * buyPrice + logisticsPrice - discountPrice = presentPrice - */ - private Integer presentPrice; - /** - * 实际已支付金额,单位:分 - * - * 初始时,金额为 0 。等到支付成功后,会进行更新。 - */ - private Integer payAmount; - - /** - * 付款时间(待发货) - */ - private Date paymentTime; - /** - * 发货时间(待收货) - */ - private Date deliveryTime; - /** - * 收货时间(已签收) - */ - private Date receiverTime; - /** - * 成交时间(用户确认收货 -> status = 已完成) - */ - private Date closingTime; - /** - * 是否退货 - * - * - 1、没有 - * - 2、换货 - * - 3、退货 - * - 4、换货 + 退货 - */ - private Integer hasReturnExchange; - /** - * 状态(如果有多个商品分开发货需要全部商品发完才会改变状态) - * - * - 1、待付款 - * - 2、待发货 - * - 3、待收获 - * - 4、已完成 - * - 5、已关闭 - */ - private Integer status; - /** - * 转换的字典值 - */ - private String statusText; - /** - * 备注 - */ - private String remark; - - /// - /// 其他信息 - - /** - * 手机人信息 - */ - private Recipient recipient; - /** - * 最新物流信息 - */ - private LogisticsDetail latestLogisticsDetail; - /** - * 订单 item - */ - private List orderItems; - - - /// - /// 其他字段 - - /** - * 是否退货 - */ - private Integer hasOrderReturn; - - @Data - @Accessors(chain = true) - public static class OrderItem { - - /** - * 商品编号 - */ - private Integer skuId; - /** - * 商品名称 - */ - private String skuName; - /** - * 商品图片 - */ - private String skuImage; - /** - * 数量 - */ - private Integer quantity; - /** - * 原始单价,单位:分。 - */ - 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 Recipient { - - /** - * 编号 - */ - private Integer id; - /** - * 订单id - */ - private Integer orderId; - /** - * 收件区域编号 - */ - private String areaNo; - /** - * 收件人名称 - */ - private String name; - /** - * 收件手机号 - */ - private String mobile; - /** - * 配送类型 - * - * - 1 快递 - */ - private Integer type; - /** - * 收件详细地址 - */ - private String address; - } - - @Data - @Accessors(chain = true) - public static class LogisticsDetail { - - /** - * id - */ - private Integer id; - /** - * 物流id - */ - private Integer orderLogisticsId; - /** - * 物流时间 - */ - private Date logisticsTime; - /** - * 物流信息 - */ - private String logisticsInformation; - } -} diff --git a/order/order-service-api02/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 deleted file mode 100644 index e7e61392c..000000000 --- a/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderItemBO.java +++ /dev/null @@ -1,143 +0,0 @@ -package cn.iocoder.mall.order.api.bo; - -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.util.Date; - -/** - * 订单 item - * - * @author Sin - * @time 2019-03-28 21:11 - */ -@Data -@Accessors(chain = true) -public class OrderItemBO implements Serializable { - - /** - * 编号 - */ - private Integer id; - /** - * 订单编号 - */ - private Integer orderId; - /** - * 订单号 - */ - private String orderNo; - /** - * 商品编号 - */ - private Integer skuId; - /** - * 商品名称 - */ - private String skuName; - /** - * 商品图片 - */ - private String skuImage; - /** - * 数量 - */ - private Integer quantity; - /** - * 原始单价,单位:分。 - */ - 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; - - /// - /// 时间信息 - - /** - * 付款时间 - */ - private Date paymentTime; - /** - * 发货时间 - */ - private Date deliveryTime; - /** - * 收货时间 - */ - private Date receiverTime; - /** - * 成交时间 - */ - private Date closingTime; - - /// - /// 其他 - - /** - * 是否退货 - * - * - 1、没有 - * - 2、换货 - * - 3、退货 - * - 4、换货 + 退货 - */ - private Integer hasReturnExchange; - /** - * 发货方式 - * - * - 1 未选择 - * - 2 在线下单 - * - 3 自己联系快递 - * - 4 无物流 - */ - private Integer deliveryType; - /** - * 状态 - * - * - 1、待付款 - * - 2、待发货 - * - 3、已发货 - * - 4、已完成 - * - 5、已关闭 - */ - private Integer status; - - /** - * 创建时间 - */ - private Date createTime; - /** - * 更新时间 - */ - private Date updateTime; - /** - * 删除状态 - */ - private Integer deleted; -} diff --git a/order/order-service-api02/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 deleted file mode 100644 index 685013c41..000000000 --- a/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderPageBO.java +++ /dev/null @@ -1,28 +0,0 @@ -package cn.iocoder.mall.order.api.bo; - -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.util.List; - -/** - * 订单分页 - * - * @author Sin - * @time 2019-03-27 21:27 - */ -@Data -@Accessors(chain = true) -public class OrderPageBO implements Serializable { - - /** - * 总条数 - */ - private Integer total; - /** - * 订单列表 - */ - private List orders; - -} diff --git a/order/order-service-api02/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 deleted file mode 100644 index 410ccc6a2..000000000 --- a/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderPayBO.java +++ /dev/null @@ -1,12 +0,0 @@ -package cn.iocoder.mall.order.api.bo; - -import java.io.Serializable; - -/** - * 订单支付信息返回 - * - * @author Sin - * @time 2019-04-08 19:39 - */ -public class OrderPayBO implements Serializable { -} diff --git a/order/order-service-api02/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 deleted file mode 100644 index af4206cc1..000000000 --- a/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/OrderRecipientBO.java +++ /dev/null @@ -1,45 +0,0 @@ -package cn.iocoder.mall.order.api.bo; - -import cn.iocoder.common.framework.dataobject.BaseDO; -import lombok.Data; -import lombok.experimental.Accessors; - -/** - * 订单收件人信息 order_recipient - * - * @author Sin - * @time 2019-03-31 11:37 - */ -@Data -@Accessors(chain = true) -public class OrderRecipientBO extends BaseDO { // TODO FROM 芋艿 TO 小范,不要继承 BaseDO - - /** - * 编号 - */ - private Integer id; - /** - * 订单id - */ - private Integer orderId; - /** - * 收件区域编号 - */ - private String areaNo; - /** - * 收件人名称 - */ - private String name; - /** - * 收件手机号 - */ - private String mobile; - /** - * 手机方式 - */ - private Integer type; - /** - * 收件详细地址 - */ - private String address; -} diff --git a/order/order-service-api02/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 deleted file mode 100644 index c9eaed233..000000000 --- a/order/order-service-api02/src/main/java/cn/iocoder/mall/order/api/bo/PostageDetailBO.java +++ /dev/null @@ -1,14 +0,0 @@ -package cn.iocoder.mall.order.api.bo; - -public class PostageDetailBO { - -// "description": "有品甄选商品,即有品配送和第三方商家发货的商品,2018年1月1日起,单笔订单满99元免运费,不满99元收10元运费。", -// "leftTotal": "0.00", -// "merchantName": "有品配送", -// "postFee": "0.00", -// "postage": "10.00", -// "postageType": 0, -// "selCount": 14, -// "threshold": "99.00" - -} diff --git a/pay-service-project/pay-service-api/pom.xml b/pay-service-project/pay-service-api/pom.xml index 58086b2a5..a5a5213a0 100644 --- a/pay-service-project/pay-service-api/pom.xml +++ b/pay-service-project/pay-service-api/pom.xml @@ -12,14 +12,24 @@ pay-service-api + + cn.iocoder.mall + common-framework + + javax.validation validation-api + + org.hibernate + hibernate-validator + true + org.projectlombok lombok - \ No newline at end of file + diff --git a/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/constant/PayChannelEnum.java b/pay-service-project/pay-service-api/src/main/java/cn/iocoder/mall/payservice/enums/PayChannelEnum.java similarity index 96% rename from pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/constant/PayChannelEnum.java rename to pay-service-project/pay-service-api/src/main/java/cn/iocoder/mall/payservice/enums/PayChannelEnum.java index aca410623..b75d88e4f 100644 --- a/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/constant/PayChannelEnum.java +++ b/pay-service-project/pay-service-api/src/main/java/cn/iocoder/mall/payservice/enums/PayChannelEnum.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.pay.api.constant; +package cn.iocoder.mall.payservice.enums; import cn.iocoder.common.framework.core.IntArrayValuable; diff --git a/pay-service-project/pay-service-api/src/main/java/cn/iocoder/mall/payservice/rpc/app/PayAppRpc.java b/pay-service-project/pay-service-api/src/main/java/cn/iocoder/mall/payservice/rpc/app/PayAppRpc.java new file mode 100644 index 000000000..6a97ffdfa --- /dev/null +++ b/pay-service-project/pay-service-api/src/main/java/cn/iocoder/mall/payservice/rpc/app/PayAppRpc.java @@ -0,0 +1,7 @@ +package cn.iocoder.mall.payservice.rpc.app; + +/** + * 支付应用 RPC 接口 + */ +public interface PayAppRpc { +} diff --git a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/dataobject/PayAppDO.java b/pay-service-project/pay-service-api/src/main/java/cn/iocoder/mall/payservice/rpc/app/dto/PayAppRespDTO.java similarity index 61% rename from pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/dataobject/PayAppDO.java rename to pay-service-project/pay-service-api/src/main/java/cn/iocoder/mall/payservice/rpc/app/dto/PayAppRespDTO.java index 2ef43c72f..3289fc740 100644 --- a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/dataobject/PayAppDO.java +++ b/pay-service-project/pay-service-api/src/main/java/cn/iocoder/mall/payservice/rpc/app/dto/PayAppRespDTO.java @@ -1,15 +1,16 @@ -package cn.iocoder.mall.pay.biz.dataobject; +package cn.iocoder.mall.payservice.rpc.app.dto; -import cn.iocoder.common.framework.dataobject.DeletableDO; import lombok.Data; import lombok.experimental.Accessors; +import java.io.Serializable; + /** - * 支付应用(业务线)DO + * 支付应用 Response DTO */ @Data @Accessors(chain = true) -public class PayAppDO extends DeletableDO { +public class PayAppRespDTO implements Serializable { /** * 应用编号 @@ -21,9 +22,8 @@ public class PayAppDO extends DeletableDO { private String name; /** * 异步通知地址 - * TODO 芋艿,修改成 payNotifyUrl */ - private String notifyUrl; + private String payNotifyUrl; /** * 退款异步通知地址 */ diff --git a/pay-service-project/pay-service-api/src/main/java/cn/iocoder/mall/payservice/rpc/package-info.java b/pay-service-project/pay-service-api/src/main/java/cn/iocoder/mall/payservice/rpc/package-info.java new file mode 100644 index 000000000..df8cac927 --- /dev/null +++ b/pay-service-project/pay-service-api/src/main/java/cn/iocoder/mall/payservice/rpc/package-info.java @@ -0,0 +1 @@ +package cn.iocoder.mall.payservice.rpc; diff --git a/pay-service-project/pay-service-api/src/main/java/cn/iocoder/mall/payservice/rpc/transaction/PayTransactionRpc.java b/pay-service-project/pay-service-api/src/main/java/cn/iocoder/mall/payservice/rpc/transaction/PayTransactionRpc.java new file mode 100644 index 000000000..d7cf25456 --- /dev/null +++ b/pay-service-project/pay-service-api/src/main/java/cn/iocoder/mall/payservice/rpc/transaction/PayTransactionRpc.java @@ -0,0 +1,10 @@ +package cn.iocoder.mall.payservice.rpc.transaction; + +/** + * 支付交易单 RPC 接口 + */ +public interface PayTransactionRpc { + + + +} diff --git a/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/dto/transaction/PayTransactionCreateDTO.java b/pay-service-project/pay-service-api/src/main/java/cn/iocoder/mall/payservice/rpc/transaction/dto/PayTransactionCreateReqDTO.java similarity index 56% rename from pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/dto/transaction/PayTransactionCreateDTO.java rename to pay-service-project/pay-service-api/src/main/java/cn/iocoder/mall/payservice/rpc/transaction/dto/PayTransactionCreateReqDTO.java index b854ed840..79ebcaa84 100644 --- a/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/dto/transaction/PayTransactionCreateDTO.java +++ b/pay-service-project/pay-service-api/src/main/java/cn/iocoder/mall/payservice/rpc/transaction/dto/PayTransactionCreateReqDTO.java @@ -1,7 +1,5 @@ -package cn.iocoder.mall.pay.api.dto.transaction; +package cn.iocoder.mall.payservice.rpc.transaction.dto; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.experimental.Accessors; import org.hibernate.validator.constraints.Length; @@ -12,43 +10,56 @@ import javax.validation.constraints.NotNull; import java.io.Serializable; import java.util.Date; -@ApiModel("支付交易创建 DTO") +/** + * 支付交易单创建 DTO + */ @Data @Accessors(chain = true) -public class PayTransactionCreateDTO implements Serializable { +public class PayTransactionCreateReqDTO implements Serializable { - @ApiModelProperty(value = "应用编号", required = true, example = "POd4RC6a") + /** + * 应用编号 + */ @NotEmpty(message = "应用编号不能为空") private String appId; - - @ApiModelProperty(value = "发起交易的 IP", required = true, example = "192.168.10.1") + /** + * 发起交易的 IP + */ @NotEmpty(message = "IP 不能为空") private String createIp; - @ApiModelProperty(value = "订单号不能为空", required = true, example = "1024") + /** + * 订单号 + */ @NotEmpty(message = "订单号不能为空") private String orderId; - - @ApiModelProperty(value = "商品名", required = true, example = "芋道源码") + /** + * 商品名 + */ @NotEmpty(message = "商品名不能为空") @Length(max = 32, message = "商品名不能超过32") private String orderSubject; - - @ApiModelProperty(value = "订单商品描述", required = true, example = "绵啾啾的") + /** + * 订单商品描述 + */ @NotEmpty(message = "商品描述不能为空") @Length(max = 128, message = "商品描述长度不能超过128") private String orderDescription; - - @ApiModelProperty(value = "订单商品备注", example = "绵啾啾的") + /** + * 订单商品备注 + */ @Length(max = 256, message = "商品备注长度不能超过256") private String orderMemo; - - @ApiModelProperty(value = "支付金额,单位:分。", required = true, example = "10") + /** + * 支付金额,单位:分 + */ @NotNull(message = "金额不能为空") @DecimalMin(value = "0", inclusive = false, message = "金额必须大于零") private Integer price; - @ApiModelProperty(value = "交易过期时间", required = true) + /** + * 交易过期时间 + */ @NotNull(message = "交易过期时间不能为空") private Date expireTime; diff --git a/pay-service-project/pay-service-app/pom.xml b/pay-service-project/pay-service-app/pom.xml index 76f058bfe..0d3573617 100644 --- a/pay-service-project/pay-service-app/pom.xml +++ b/pay-service-project/pay-service-app/pom.xml @@ -11,13 +11,26 @@ pay-service-app - cn.iocoder.mall mall-spring-boot-starter-dubbo + + + + cn.iocoder.mall + product-service-api + 1.0-SNAPSHOT + + + + + org.springframework.boot + spring-boot-starter-web + + com.alibaba.cloud @@ -30,14 +43,6 @@ mysql-connector-java - - org.springframework - spring-tx - - - org.springframework - spring-jdbc - com.alibaba druid-spring-boot-starter @@ -48,6 +53,19 @@ mall-spring-boot-starter-mybatis + + + org.springframework.boot + spring-boot-starter-actuator + + + + + org.springframework.boot + spring-boot-starter-test + test + + org.springframework.boot @@ -68,5 +86,23 @@ mapstruct-jdk8 + + org.aspectj + aspectjweaver + 1.9.6 + - \ No newline at end of file + + + + ${project.artifactId} + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/PayServiceApplication.java b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/PayServiceApplication.java index 50cbfb19d..35ff693b5 100644 --- a/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/PayServiceApplication.java +++ b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/PayServiceApplication.java @@ -1,4 +1,13 @@ package cn.iocoder.mall.payservice; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication public class PayServiceApplication { + + public static void main(String[] args) { + SpringApplication.run(PayServiceApplication.class, args); + } + } diff --git a/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/config/DatabaseConfiguration.java b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/config/DatabaseConfiguration.java new file mode 100644 index 000000000..6a0707fc8 --- /dev/null +++ b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/config/DatabaseConfiguration.java @@ -0,0 +1,28 @@ +package cn.iocoder.mall.payservice.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.payservice.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/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/convert/transaction/TransactionConvert.java b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/convert/transaction/TransactionConvert.java index c81576510..fdd7a3594 100644 --- a/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/convert/transaction/TransactionConvert.java +++ b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/convert/transaction/TransactionConvert.java @@ -1,31 +1,12 @@ package cn.iocoder.mall.payservice.convert.transaction; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.payservice.dal.mysql.dataobject.transaction.TransactionDO; -import cn.iocoder.mall.payservice.service.transaction.bo.TransactionBO; -import cn.iocoder.mall.payservice.service.transaction.bo.TransactionCreateBO; -import cn.iocoder.mall.payservice.service.transaction.bo.TransactionUpdateBO; -import com.baomidou.mybatisplus.core.metadata.IPage; import org.mapstruct.Mapper; -import org.mapstruct.Mappings; import org.mapstruct.factory.Mappers; -import java.util.List; - @Mapper public interface TransactionConvert { TransactionConvert INSTANCE = Mappers.getMapper(TransactionConvert.class); - - TransactionDO convert(TransactionUpdateBO updateBO); - - List convertList(List transactionDOs); - - PageResult convertPage(IPage transactionDOPage); - - TransactionDO convert(TransactionCreateBO createBO); - - TransactionBO convert(TransactionDO transactionDO); } diff --git a/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/dal/mysql/dataobject/app/PayAppDO.java b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/dal/mysql/dataobject/app/PayAppDO.java new file mode 100644 index 000000000..cafe6f2f6 --- /dev/null +++ b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/dal/mysql/dataobject/app/PayAppDO.java @@ -0,0 +1,41 @@ +package cn.iocoder.mall.payservice.dal.mysql.dataobject.app; + +import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + * 支付应用 + * + * 每个接入的业务都是一个应用,进行个性化的配置 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@Accessors(chain = true) +public class PayAppDO extends DeletableDO { + + /** + * 应用编号 + */ + private String id; + /** + * 应用名 + */ + private String name; + /** + * 异步通知地址 + */ + private String payNotifyUrl; + /** + * 退款异步通知地址 + */ + private String refundNotifyUrl; + /** + * 状态 + * + * 枚举 {@link cn.iocoder.common.framework.enums.CommonStatusEnum} + */ + private Integer status; + +} diff --git a/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/dal/mysql/dataobject/transaction/TransactionDO.java b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/dal/mysql/dataobject/transaction/PayTransactionDO.java similarity index 84% rename from pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/dal/mysql/dataobject/transaction/TransactionDO.java rename to pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/dal/mysql/dataobject/transaction/PayTransactionDO.java index 38eff9930..031e5ef4f 100644 --- a/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/dal/mysql/dataobject/transaction/TransactionDO.java +++ b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/dal/mysql/dataobject/transaction/PayTransactionDO.java @@ -1,20 +1,22 @@ package cn.iocoder.mall.payservice.dal.mysql.dataobject.transaction; -import cn.iocoder.mall.mybatis.core.dataobject.BaseDO; import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; -import com.baomidou.mybatisplus.annotation.*; -import lombok.*; -import lombok.experimental.*; -import java.util.*; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.util.Date; /** -* pay_transaction +* 支付交易表 */ -@TableName("transaction") +@TableName("pay_transaction") @Data @EqualsAndHashCode(callSuper = true) @Accessors(chain = true) -public class TransactionDO extends DeletableDO { +public class PayTransactionDO extends DeletableDO { /** * 编号,自增 diff --git a/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/dal/mysql/mapper/transaction/PayTransactionMapper.java b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/dal/mysql/mapper/transaction/PayTransactionMapper.java new file mode 100644 index 000000000..b3709ddb2 --- /dev/null +++ b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/dal/mysql/mapper/transaction/PayTransactionMapper.java @@ -0,0 +1,15 @@ +package cn.iocoder.mall.payservice.dal.mysql.mapper.transaction; + +import cn.iocoder.mall.payservice.dal.mysql.dataobject.transaction.PayTransactionDO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.springframework.stereotype.Repository; + +@Repository +public interface PayTransactionMapper extends BaseMapper { + +// default IPage selectPage(TransactionPageBO pageBO) { +// return selectPage(new Page<>(pageBO.getPageNo(), pageBO.getPageSize()), +// new QueryWrapperX()); +// } + +} diff --git a/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/dal/mysql/mapper/transaction/TransactionMapper.java b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/dal/mysql/mapper/transaction/TransactionMapper.java deleted file mode 100644 index 7e472d993..000000000 --- a/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/dal/mysql/mapper/transaction/TransactionMapper.java +++ /dev/null @@ -1,19 +0,0 @@ -package cn.iocoder.mall.payservice.dal.mysql.mapper.transaction; - -import cn.iocoder.mall.mybatis.core.query.QueryWrapperX; -import cn.iocoder.mall.payservice.dal.mysql.dataobject.transaction.TransactionDO; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; - -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import org.springframework.stereotype.Repository; - -@Repository -public interface TransactionMapper extends BaseMapper { - - default IPage selectPage(TransactionPageBO pageBO) { - return selectPage(new Page<>(pageBO.getPageNo(), pageBO.getPageSize()), - new QueryWrapperX()); - } - -} \ No newline at end of file diff --git a/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/manager/transaction/TransactionManager.java b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/manager/transaction/TransactionManager.java deleted file mode 100644 index 92ebaf9c1..000000000 --- a/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/manager/transaction/TransactionManager.java +++ /dev/null @@ -1,4 +0,0 @@ -package cn.iocoder.mall.payservice.manager.transaction; - -public class TransactionManager { -} diff --git a/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/rpc/transaction/TransactionRpcImpl.java b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/rpc/transaction/PayTransactionRpcImpl.java similarity index 59% rename from pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/rpc/transaction/TransactionRpcImpl.java rename to pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/rpc/transaction/PayTransactionRpcImpl.java index 604bd8f59..6e3fd8611 100644 --- a/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/rpc/transaction/TransactionRpcImpl.java +++ b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/rpc/transaction/PayTransactionRpcImpl.java @@ -1,4 +1,4 @@ package cn.iocoder.mall.payservice.rpc.transaction; -public class TransactionRpcImpl { +public class PayTransactionRpcImpl { } diff --git a/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/service/app/PayAppService.java b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/service/app/PayAppService.java new file mode 100644 index 000000000..b61a12bd5 --- /dev/null +++ b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/service/app/PayAppService.java @@ -0,0 +1,10 @@ +package cn.iocoder.mall.payservice.service.app; + +/** + * 支付应用 Service 接口 + */ +public interface PayAppService { + + + +} diff --git a/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/service/app/impl/PayAppServiceImpl.java b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/service/app/impl/PayAppServiceImpl.java new file mode 100644 index 000000000..8db585e63 --- /dev/null +++ b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/service/app/impl/PayAppServiceImpl.java @@ -0,0 +1,25 @@ +package cn.iocoder.mall.payservice.service.app.impl; + +import cn.iocoder.mall.payservice.service.app.PayAppService; + +/** + * 支付应用 Service 实现类 + */ +public class PayAppServiceImpl implements PayAppService { + + + +// public PayAppDO validPayApp(String appId) { +// PayAppDO payAppDO = payAppMapper.selectById(appId); +// // 校验是否存在 +// if (payAppDO == null) { +// throw ServiceExceptionUtil.exception(PayErrorCodeEnum.PAY_APP_NOT_FOUND.getCode()); +// } +// // 校验是否禁用 +// if (CommonStatusEnum.DISABLE.getValue().equals(payAppDO.getStatus())) { +// throw ServiceExceptionUtil.exception(PayErrorCodeEnum.PAY_APP_IS_DISABLE.getCode()); +// } +// return payAppDO; +// } + +} diff --git a/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/service/transaction/PayTransactionService.java b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/service/transaction/PayTransactionService.java new file mode 100644 index 000000000..e45571ada --- /dev/null +++ b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/service/transaction/PayTransactionService.java @@ -0,0 +1,10 @@ +package cn.iocoder.mall.payservice.service.transaction; + +/** + * 支付交易单 Service 接口 + */ +public interface PayTransactionService { + + + +} diff --git a/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/service/transaction/TransactionService.java b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/service/transaction/TransactionService.java deleted file mode 100644 index e92996dc0..000000000 --- a/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/service/transaction/TransactionService.java +++ /dev/null @@ -1,107 +0,0 @@ -package cn.iocoder.mall.payservice.service.transaction; - -import cn.iocoder.common.framework.exception.util.ServiceExceptionUtil; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.payservice.convert.transaction.TransactionConvert; -import cn.iocoder.mall.payservice.dal.mysql.dataobject.transaction.TransactionDO; -import cn.iocoder.mall.payservice.dal.mysql.mapper.transaction.TransactionMapper; -import cn.iocoder.mall.payservice.service.transaction.bo.TransactionBO; -import cn.iocoder.mall.payservice.service.transaction.bo.TransactionCreateBO; -import cn.iocoder.mall.payservice.service.transaction.bo.TransactionPageBO; -import cn.iocoder.mall.payservice.service.transaction.bo.TransactionUpdateBO; -import com.baomidou.mybatisplus.core.metadata.IPage; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.validation.annotation.Validated; - -import javax.validation.*; - -import java.util.*; - -/** -* pay_transaction Service -*/ -@Service -@Validated -public class TransactionService { - - @Autowired - private TransactionMapper transactionMapper; - - /** - * 创建pay_transaction - * - * @param createBO 创建pay_transaction BO - * @return pay_transaction - */ - public TransactionBO createTransaction(@Valid TransactionCreateBO createBO) { - // 插入到数据库 - TransactionDO transactionDO = TransactionConvert.INSTANCE.convert(createBO); - transactionMapper.insert(transactionDO); - // 返回 - return TransactionConvert.INSTANCE.convert(transactionDO); - } - - /** - * 更新pay_transaction - * - * @param updateBO 更新pay_transaction BO - */ - public void updateTransaction(@Valid TransactionUpdateBO updateBO) { - // 校验更新的pay_transaction是否存在 - if (transactionMapper.selectById(updateBO.getId()) == null) { - throw ServiceExceptionUtil.exception(AuthErrorCodeConstants.TRANSACTION_NOT_FOUND); - } - // 更新到数据库 - TransactionDO updateObject = TransactionConvert.INSTANCE.convert(updateBO); - transactionMapper.updateById(updateObject); - } - - /** - * 删除pay_transaction - * - * @param transactionId pay_transaction编号 - */ - public void deleteTransaction(Integer transactionId) { - // 校验删除的pay_transaction是否存在 - if (transactionMapper.selectById(transactionId) == null) { - throw ServiceExceptionHelper.exception(AuthErrorCodeConstants.TRANSACTION_NOT_FOUND); - } - // 标记删除 - transactionMapper.deleteById(transactionId); - } - - /** - * 获得pay_transaction - * - * @param transactionId pay_transaction编号 - * @return pay_transaction - */ - public TransactionBO getTransaction(Integer transactionId) { - TransactionDO transactionDO = transactionMapper.selectById(transactionId); - return TransactionConvert.INSTANCE.convert(transactionDO); - } - - /** - * 获得pay_transaction列表 - * - * @param transactionIds pay_transaction编号列表 - * @return pay_transaction列表 - */ - public List listTransactions(List transactionIds) { - List transactionDOs = transactionMapper.selectBatchIds(transactionIds); - return TransactionConvert.INSTANCE.convertList(transactionDOs); - } - - /** - * 获得pay_transaction分页 - * - * @param pageBO pay_transaction分页查询 - * @return pay_transaction分页结果 - */ - public PageResult pageTransaction(TransactionPageBO pageBO) { - IPage transactionDOPage = transactionMapper.selectPage(pageBO); - return TransactionConvert.INSTANCE.convertPage(transactionDOPage); - } - -} \ No newline at end of file diff --git a/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/service/transaction/bo/TransactionBO.java b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/service/transaction/bo/TransactionBO.java deleted file mode 100644 index 5ed79e167..000000000 --- a/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/service/transaction/bo/TransactionBO.java +++ /dev/null @@ -1,96 +0,0 @@ -package cn.iocoder.mall.payservice.service.transaction.bo; - -import lombok.*; -import lombok.experimental.*; -import io.swagger.annotations.*; -import java.util.*; - -/** -* pay_transaction BO -*/ -@Data -@Accessors(chain = true) -public class TransactionBO { - - /** - * 编号,自增 - */ - private Integer id; - /** - * 应用编号 - */ - private String appId; - /** - * 发起交易的 IP - */ - private String createIp; - /** - * 业务线的订单编号 - */ - private String orderId; - /** - * 订单商品名 - */ - private String orderSubject; - /** - * 订单商品描述 - */ - private String orderDescription; - /** - * 订单备注 - */ - private String orderMemo; - /** - * 支付金额,单位:分。 - */ - private Integer price; - /** - * 订单状态 - */ - private Integer status; - /** - * 交易过期时间 - */ - private Date expireTime; - /** - * 回调业务线完成时间 - */ - private Date finishTime; - /** - * 异步通知地址 - */ - private String notifyUrl; - /** - * 成功支付的交易拓展编号 - */ - private Integer extensionId; - /** - * 支付成功的支付渠道 - */ - private Integer payChannel; - /** - * 第三方支付成功的时间 - */ - private Date paymentTime; - /** - * 收到第三方系统通知的时间 - */ - private Date notifyTime; - /** - * 第三方的流水号 - */ - private String tradeNo; - /** - * 退款总金额 - */ - private Integer refundTotal; - /** - * 创建时间 - */ - private Date createTime; - /** - * 最后更新时间 - */ - private Date updateTime; - -} \ No newline at end of file diff --git a/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/service/transaction/bo/TransactionCreateBO.java b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/service/transaction/bo/TransactionCreateBO.java deleted file mode 100644 index 0940fdea7..000000000 --- a/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/service/transaction/bo/TransactionCreateBO.java +++ /dev/null @@ -1,93 +0,0 @@ -package cn.iocoder.mall.payservice.service.transaction.bo; - -import lombok.*; -import lombok.experimental.*; -import io.swagger.annotations.*; -import java.util.*; -import javax.validation.constraints.*; - -/** -* pay_transaction创建 BO -*/ -@Data -@Accessors(chain = true) -public class TransactionCreateBO { - - /** - * 应用编号 - */ - @NotEmpty(message = "应用编号不能为空") - private String appId; - /** - * 发起交易的 IP - */ - @NotEmpty(message = "发起交易的 IP不能为空") - private String createIp; - /** - * 业务线的订单编号 - */ - @NotEmpty(message = "业务线的订单编号不能为空") - private String orderId; - /** - * 订单商品名 - */ - @NotEmpty(message = "订单商品名不能为空") - private String orderSubject; - /** - * 订单商品描述 - */ - @NotEmpty(message = "订单商品描述不能为空") - private String orderDescription; - /** - * 订单备注 - */ - private String orderMemo; - /** - * 支付金额,单位:分。 - */ - @NotNull(message = "支付金额,单位:分。不能为空") - private Integer price; - /** - * 订单状态 - */ - @NotNull(message = "订单状态不能为空") - private Integer status; - /** - * 交易过期时间 - */ - private Date expireTime; - /** - * 回调业务线完成时间 - */ - private Date finishTime; - /** - * 异步通知地址 - */ - @NotEmpty(message = "异步通知地址不能为空") - private String notifyUrl; - /** - * 成功支付的交易拓展编号 - */ - private Integer extensionId; - /** - * 支付成功的支付渠道 - */ - private Integer payChannel; - /** - * 第三方支付成功的时间 - */ - private Date paymentTime; - /** - * 收到第三方系统通知的时间 - */ - private Date notifyTime; - /** - * 第三方的流水号 - */ - private String tradeNo; - /** - * 退款总金额 - */ - private Integer refundTotal; - -} \ No newline at end of file diff --git a/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/service/transaction/bo/TransactionPageBO.java b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/service/transaction/bo/TransactionPageBO.java deleted file mode 100644 index c9f0c4bae..000000000 --- a/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/service/transaction/bo/TransactionPageBO.java +++ /dev/null @@ -1,99 +0,0 @@ -package cn.iocoder.mall.payservice.service.transaction.bo; - -import cn.iocoder.common.framework.vo.PageParam; -import lombok.*; -import lombok.experimental.*; -import io.swagger.annotations.*; -import java.util.*; -import javax.validation.constraints.*; - -/** -* pay_transaction分页 BO -*/ -@Data -@EqualsAndHashCode(callSuper = true) -@Accessors(chain = true) -public class TransactionPageBO extends PageParam { - - /** - * 编号,自增 - */ - private Integer id; - /** - * 应用编号 - */ - private String appId; - /** - * 发起交易的 IP - */ - private String createIp; - /** - * 业务线的订单编号 - */ - private String orderId; - /** - * 订单商品名 - */ - private String orderSubject; - /** - * 订单商品描述 - */ - private String orderDescription; - /** - * 订单备注 - */ - private String orderMemo; - /** - * 支付金额,单位:分。 - */ - private Integer price; - /** - * 订单状态 - */ - private Integer status; - /** - * 交易过期时间 - */ - private Date expireTime; - /** - * 回调业务线完成时间 - */ - private Date finishTime; - /** - * 异步通知地址 - */ - private String notifyUrl; - /** - * 成功支付的交易拓展编号 - */ - private Integer extensionId; - /** - * 支付成功的支付渠道 - */ - private Integer payChannel; - /** - * 第三方支付成功的时间 - */ - private Date paymentTime; - /** - * 收到第三方系统通知的时间 - */ - private Date notifyTime; - /** - * 第三方的流水号 - */ - private String tradeNo; - /** - * 退款总金额 - */ - private Integer refundTotal; - /** - * 创建时间 - */ - private Date createTime; - /** - * 最后更新时间 - */ - private Date updateTime; - -} \ No newline at end of file diff --git a/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/service/transaction/bo/TransactionUpdateBO.java b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/service/transaction/bo/TransactionUpdateBO.java deleted file mode 100644 index b4fc5fb3d..000000000 --- a/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/service/transaction/bo/TransactionUpdateBO.java +++ /dev/null @@ -1,98 +0,0 @@ -package cn.iocoder.mall.payservice.service.transaction.bo; - -import lombok.*; -import lombok.experimental.*; -import io.swagger.annotations.*; -import java.util.*; -import javax.validation.constraints.*; - -/** -* pay_transaction更新 BO -*/ -@Data -@Accessors(chain = true) -public class TransactionUpdateBO { - - /** - * 编号,自增 - */ - @NotNull(message = "编号,自增不能为空") - private Integer id; - /** - * 应用编号 - */ - @NotEmpty(message = "应用编号不能为空") - private String appId; - /** - * 发起交易的 IP - */ - @NotEmpty(message = "发起交易的 IP不能为空") - private String createIp; - /** - * 业务线的订单编号 - */ - @NotEmpty(message = "业务线的订单编号不能为空") - private String orderId; - /** - * 订单商品名 - */ - @NotEmpty(message = "订单商品名不能为空") - private String orderSubject; - /** - * 订单商品描述 - */ - @NotEmpty(message = "订单商品描述不能为空") - private String orderDescription; - /** - * 订单备注 - */ - private String orderMemo; - /** - * 支付金额,单位:分。 - */ - @NotNull(message = "支付金额,单位:分。不能为空") - private Integer price; - /** - * 订单状态 - */ - @NotNull(message = "订单状态不能为空") - private Integer status; - /** - * 交易过期时间 - */ - private Date expireTime; - /** - * 回调业务线完成时间 - */ - private Date finishTime; - /** - * 异步通知地址 - */ - @NotEmpty(message = "异步通知地址不能为空") - private String notifyUrl; - /** - * 成功支付的交易拓展编号 - */ - private Integer extensionId; - /** - * 支付成功的支付渠道 - */ - private Integer payChannel; - /** - * 第三方支付成功的时间 - */ - private Date paymentTime; - /** - * 收到第三方系统通知的时间 - */ - private Date notifyTime; - /** - * 第三方的流水号 - */ - private String tradeNo; - /** - * 退款总金额 - */ - private Integer refundTotal; - -} \ No newline at end of file diff --git a/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/service/transaction/impl/PayTransactionServiceImpl.java b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/service/transaction/impl/PayTransactionServiceImpl.java new file mode 100644 index 000000000..931726b5b --- /dev/null +++ b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/service/transaction/impl/PayTransactionServiceImpl.java @@ -0,0 +1,97 @@ +package cn.iocoder.mall.payservice.service.transaction.impl; + +import cn.iocoder.mall.payservice.dal.mysql.mapper.transaction.PayTransactionMapper; +import cn.iocoder.mall.payservice.service.transaction.PayTransactionService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +/** +* 支付交易单 Service 实现类 +*/ +@Service +@Validated +public class PayTransactionServiceImpl implements PayTransactionService { + + @Autowired + private PayTransactionMapper transactionMapper; + + + +// /** +// * 创建pay_transaction +// * +// * @param createBO 创建pay_transaction BO +// * @return pay_transaction +// */ +// public TransactionBO createTransaction(@Valid TransactionCreateBO createBO) { +// // 插入到数据库 +// PayTransactionDO transactionDO = TransactionConvert.INSTANCE.convert(createBO); +// transactionMapper.insert(transactionDO); +// // 返回 +// return TransactionConvert.INSTANCE.convert(transactionDO); +// } +// +// /** +// * 更新pay_transaction +// * +// * @param updateBO 更新pay_transaction BO +// */ +// public void updateTransaction(@Valid TransactionUpdateBO updateBO) { +// // 校验更新的pay_transaction是否存在 +// if (transactionMapper.selectById(updateBO.getId()) == null) { +// throw ServiceExceptionUtil.exception(AuthErrorCodeConstants.TRANSACTION_NOT_FOUND); +// } +// // 更新到数据库 +// PayTransactionDO updateObject = TransactionConvert.INSTANCE.convert(updateBO); +// transactionMapper.updateById(updateObject); +// } +// +// /** +// * 删除pay_transaction +// * +// * @param transactionId pay_transaction编号 +// */ +// public void deleteTransaction(Integer transactionId) { +// // 校验删除的pay_transaction是否存在 +// if (transactionMapper.selectById(transactionId) == null) { +// throw ServiceExceptionHelper.exception(AuthErrorCodeConstants.TRANSACTION_NOT_FOUND); +// } +// // 标记删除 +// transactionMapper.deleteById(transactionId); +// } +// +// /** +// * 获得pay_transaction +// * +// * @param transactionId pay_transaction编号 +// * @return pay_transaction +// */ +// public TransactionBO getTransaction(Integer transactionId) { +// PayTransactionDO transactionDO = transactionMapper.selectById(transactionId); +// return TransactionConvert.INSTANCE.convert(transactionDO); +// } +// +// /** +// * 获得pay_transaction列表 +// * +// * @param transactionIds pay_transaction编号列表 +// * @return pay_transaction列表 +// */ +// public List listTransactions(List transactionIds) { +// List transactionDOs = transactionMapper.selectBatchIds(transactionIds); +// return TransactionConvert.INSTANCE.convertList(transactionDOs); +// } +// +// /** +// * 获得pay_transaction分页 +// * +// * @param pageBO pay_transaction分页查询 +// * @return pay_transaction分页结果 +// */ +// public PageResult pageTransaction(TransactionPageBO pageBO) { +// IPage transactionDOPage = transactionMapper.selectPage(pageBO); +// return TransactionConvert.INSTANCE.convertPage(transactionDOPage); +// } + +} diff --git a/pay-service-project/pay-service-app/src/main/resources/application-dev.yaml b/pay-service-project/pay-service-app/src/main/resources/application-dev.yaml new file mode 100644 index 000000000..c9c18fe8e --- /dev/null +++ b/pay-service-project/pay-service-app/src/main/resources/application-dev.yaml @@ -0,0 +1,21 @@ +spring: + # 数据源配置项 + datasource: + url: jdbc:mysql://400-infra.server.iocoder.cn:3306/mall_pay?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/pay-service-project/pay-service-app/src/main/resources/application-local.yaml b/pay-service-project/pay-service-app/src/main/resources/application-local.yaml new file mode 100644 index 000000000..d287986cb --- /dev/null +++ b/pay-service-project/pay-service-app/src/main/resources/application-local.yaml @@ -0,0 +1,24 @@ +spring: + # 数据源配置项 + datasource: + url: jdbc:mysql://400-infra.server.iocoder.cn:3306/mall_pay?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/pay-service-project/pay-service-app/src/main/resources/application.yaml b/pay-service-project/pay-service-app/src/main/resources/application.yaml new file mode 100644 index 000000000..57ba7cf4b --- /dev/null +++ b/pay-service-project/pay-service-app/src/main/resources/application.yaml @@ -0,0 +1,64 @@ +spring: + # Application 的配置项 + application: + name: pay-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.payservice.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.payservice.rpc + # Dubbo 服务提供者的配置 + provider: + filter: -exception + validation: true # 开启 Provider 参数校验 + version: 1.0.0 # 服务的版本号 + # Dubbo 服务消费者的配置 + consumer: + ErrorCodeRpc: + version: 1.0.0 + ProductSkuRpc: + version: 1.0.0 + ProductSpuRpc: + 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: 38089 # 独立端口,避免被暴露出去 + 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.payservice.enums.PayErrorCodeConstants diff --git a/pay-service-project/pom.xml b/pay-service-project/pom.xml index f0c35da4b..801f60be8 100644 --- a/pay-service-project/pom.xml +++ b/pay-service-project/pom.xml @@ -35,7 +35,13 @@ 1.0-SNAPSHOT + + + cn.iocoder.mall + pay-service-api + 1.0-SNAPSHOT + - \ No newline at end of file + diff --git a/pay/pay-application/src/main/java/cn/iocoder/mall/pay/application/PayApplication.java b/pay/pay-application/src/main/java/cn/iocoder/mall/pay/application/PayApplication.java deleted file mode 100644 index fe85def26..000000000 --- a/pay/pay-application/src/main/java/cn/iocoder/mall/pay/application/PayApplication.java +++ /dev/null @@ -1,15 +0,0 @@ -package cn.iocoder.mall.pay.application; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.scheduling.annotation.EnableAsync; - -@SpringBootApplication(scanBasePackages = {"cn.iocoder.mall.pay"}) -@EnableAsync(proxyTargetClass = true) -public class PayApplication { - - public static void main(String[] args) { - SpringApplication.run(PayApplication.class, args); - } - -} diff --git a/pay/pay-application/src/main/java/cn/iocoder/mall/pay/application/convert/PayRefundConvert.java b/pay/pay-application/src/main/java/cn/iocoder/mall/pay/application/convert/PayRefundConvert.java deleted file mode 100644 index 5f2c50e66..000000000 --- a/pay/pay-application/src/main/java/cn/iocoder/mall/pay/application/convert/PayRefundConvert.java +++ /dev/null @@ -1,19 +0,0 @@ -package cn.iocoder.mall.pay.application.convert; - -import cn.iocoder.mall.pay.api.bo.refund.PayRefundBO; -import cn.iocoder.mall.pay.application.vo.admins.AdminsPayRefundDetailVO; -import org.mapstruct.Mapper; -import org.mapstruct.Mappings; -import org.mapstruct.factory.Mappers; - -import java.util.List; - -@Mapper -public interface PayRefundConvert { - - PayRefundConvert INSTANCE = Mappers.getMapper(PayRefundConvert.class); - - @Mappings({}) - List convertList(List refunds); - -} diff --git a/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/PayTransactionService.java b/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/PayTransactionService.java index 49869c61a..5422f4221 100644 --- a/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/PayTransactionService.java +++ b/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/PayTransactionService.java @@ -16,8 +16,6 @@ public interface PayTransactionService { PayTransactionBO getTransaction(PayTransactionGetDTO payTransactionGetDTO); - PayTransactionBO createTransaction(PayTransactionCreateDTO payTransactionCreateDTO); - PayTransactionSubmitBO submitTransaction(PayTransactionSubmitDTO payTransactionSubmitDTO); /** diff --git a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/config/DatabaseConfiguration.java b/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/config/DatabaseConfiguration.java deleted file mode 100644 index 73abd7faa..000000000 --- a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/config/DatabaseConfiguration.java +++ /dev/null @@ -1,12 +0,0 @@ -package cn.iocoder.mall.pay.biz.config; - -import org.mybatis.spring.annotation.MapperScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.transaction.annotation.EnableTransactionManagement; - -@Configuration -@MapperScan("cn.iocoder.mall.pay.biz.dao") // 扫描对应的 Mapper 接口 -@EnableTransactionManagement(proxyTargetClass = true) // 启动事务管理。为什么使用 proxyTargetClass 参数,参见 https://blog.csdn.net/huang_550/article/details/76492600 -public class DatabaseConfiguration { - -} diff --git a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/config/ServiceExceptionConfiguration.java b/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/config/ServiceExceptionConfiguration.java deleted file mode 100644 index d72c7073d..000000000 --- a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/config/ServiceExceptionConfiguration.java +++ /dev/null @@ -1,19 +0,0 @@ -package cn.iocoder.mall.pay.biz.config; - -import cn.iocoder.common.framework.util.ServiceExceptionUtil; -import cn.iocoder.mall.pay.api.constant.PayErrorCodeEnum; -import org.springframework.boot.context.event.ApplicationReadyEvent; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.event.EventListener; - -@Configuration -public class ServiceExceptionConfiguration { - - @EventListener(ApplicationReadyEvent.class) // 可参考 https://www.cnblogs.com/ssslinppp/p/7607509.html - public void initMessages() { - for (PayErrorCodeEnum item : PayErrorCodeEnum.values()) { - ServiceExceptionUtil.put(item.getCode(), item.getMessage()); - } - } - -} diff --git a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/dao/PayAppMapper.java b/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/dao/PayAppMapper.java deleted file mode 100644 index aa9030ad6..000000000 --- a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/dao/PayAppMapper.java +++ /dev/null @@ -1,12 +0,0 @@ -package cn.iocoder.mall.pay.biz.dao; - -import cn.iocoder.mall.pay.biz.dataobject.PayAppDO; -import org.apache.ibatis.annotations.Param; -import org.springframework.stereotype.Repository; - -@Repository -public interface PayAppMapper { - - PayAppDO selectById(@Param("id") String id); - -} \ No newline at end of file diff --git a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/service/PayAppServiceImpl.java b/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/service/PayAppServiceImpl.java deleted file mode 100644 index 16e9ed4dc..000000000 --- a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/biz/service/PayAppServiceImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -package cn.iocoder.mall.pay.biz.service; - -import cn.iocoder.common.framework.enums.CommonStatusEnum; -import cn.iocoder.common.framework.util.ServiceExceptionUtil; -import cn.iocoder.mall.pay.api.constant.PayErrorCodeEnum; -import cn.iocoder.mall.pay.biz.dao.PayAppMapper; -import cn.iocoder.mall.pay.biz.dataobject.PayAppDO; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class PayAppServiceImpl { - - @Autowired - private PayAppMapper payAppMapper; - - public PayAppDO validPayApp(String appId) { - PayAppDO payAppDO = payAppMapper.selectById(appId); - // 校验是否存在 - if (payAppDO == null) { - throw ServiceExceptionUtil.exception(PayErrorCodeEnum.PAY_APP_NOT_FOUND.getCode()); - } - // 校验是否禁用 - if (CommonStatusEnum.DISABLE.getValue().equals(payAppDO.getStatus())) { - throw ServiceExceptionUtil.exception(PayErrorCodeEnum.PAY_APP_IS_DISABLE.getCode()); - } - return payAppDO; - } - -} diff --git a/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/client/trade/TradeOrderClient.java b/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/client/trade/TradeOrderClient.java index f051c4ede..445a3035b 100644 --- a/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/client/trade/TradeOrderClient.java +++ b/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/client/trade/TradeOrderClient.java @@ -1,11 +1,16 @@ package cn.iocoder.mall.shopweb.client.trade; import cn.iocoder.common.framework.vo.CommonResult; +import cn.iocoder.common.framework.vo.PageResult; import cn.iocoder.mall.tradeservice.rpc.order.TradeOrderRpc; import cn.iocoder.mall.tradeservice.rpc.order.dto.TradeOrderCreateReqDTO; +import cn.iocoder.mall.tradeservice.rpc.order.dto.TradeOrderPageReqDTO; +import cn.iocoder.mall.tradeservice.rpc.order.dto.TradeOrderRespDTO; import org.apache.dubbo.config.annotation.DubboReference; import org.springframework.stereotype.Service; +import java.util.Arrays; + @Service public class TradeOrderClient { @@ -18,4 +23,16 @@ public class TradeOrderClient { return createTradeOrderResult.getData(); } + public PageResult pageTradeOrder(TradeOrderPageReqDTO pageReqDTO) { + CommonResult> pageTradeOrderResult = tradeOrderRpc.pageTradeOrder(pageReqDTO); + pageTradeOrderResult.checkError(); + return pageTradeOrderResult.getData(); + } + + public TradeOrderRespDTO getTradeOrder(Integer tradeOrderId, String... fields) { + CommonResult getTradeOrderResult = tradeOrderRpc.getTradeOrder(tradeOrderId, Arrays.asList(fields)); + getTradeOrderResult.checkError(); + return getTradeOrderResult.getData(); + } + } diff --git a/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/trade/TradeOrderController.http b/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/trade/TradeOrderController.http index 76a565d52..2a6622ef9 100644 --- a/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/trade/TradeOrderController.http +++ b/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/trade/TradeOrderController.http @@ -10,9 +10,22 @@ Authorization: Bearer {{user-access-token}} ### /trade-order/confirm-create-order-info-from-cart 基于商品,创建订单 POST {{shop-api-base-url}}/trade-order/create -Content-Type: application/x-www-form-urlencoded +Content-Type: application/json Authorization: Bearer {{user-access-token}} -userAddressId=19&remark=我是备注&orderItems[0].skuId=3&orderItems[0].quantity=1 +{ + "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/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/trade/TradeOrderController.java b/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/trade/TradeOrderController.java index 1a1e758de..7eb17a848 100644 --- a/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/trade/TradeOrderController.java +++ b/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/trade/TradeOrderController.java @@ -2,10 +2,9 @@ package cn.iocoder.mall.shopweb.controller.trade; import cn.iocoder.common.framework.util.HttpUtil; import cn.iocoder.common.framework.vo.CommonResult; +import cn.iocoder.common.framework.vo.PageResult; import cn.iocoder.mall.security.user.core.context.UserSecurityContextHolder; -import cn.iocoder.mall.shopweb.controller.trade.vo.order.TradeOrderConfirmCreateInfoRespVO; -import cn.iocoder.mall.shopweb.controller.trade.vo.order.TradeOrderCreateFromCartReqVO; -import cn.iocoder.mall.shopweb.controller.trade.vo.order.TradeOrderCreateReqVO; +import cn.iocoder.mall.shopweb.controller.trade.vo.order.*; import cn.iocoder.mall.shopweb.service.trade.TradeOrderService; import cn.iocoder.security.annotations.RequiresAuthenticate; import io.swagger.annotations.Api; @@ -56,7 +55,7 @@ public class TradeOrderController { @PostMapping("create") @ApiOperation("基于商品,创建订单") @RequiresAuthenticate - public CommonResult createTradeOrder(TradeOrderCreateReqVO createReqVO, + public CommonResult createTradeOrder(@RequestBody TradeOrderCreateReqVO createReqVO, HttpServletRequest servletRequest) { return success(tradeOrderService.createTradeOrder(UserSecurityContextHolder.getUserId(), HttpUtil.getIp(servletRequest), createReqVO)); @@ -69,4 +68,17 @@ public class TradeOrderController { return null; } + @GetMapping("/get") + @ApiOperation("获得交易订单") + @ApiImplicitParam(name = "tradeOrderId", value = "交易订单编号", required = true) + public CommonResult getTradeOrder(@RequestParam("tradeOrderId") Integer tradeOrderId) { + return success(tradeOrderService.getTradeOrder(tradeOrderId)); + } + + @GetMapping("/page") + @ApiOperation("获得订单交易分页") + public CommonResult> pageTradeOrder(TradeOrderPageReqVO pageVO) { + return success(tradeOrderService.pageTradeOrder(UserSecurityContextHolder.getUserId(), pageVO)); + } + } diff --git a/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/trade/vo/order/TradeOrderItemRespVO.java b/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/trade/vo/order/TradeOrderItemRespVO.java new file mode 100644 index 000000000..2dd9de216 --- /dev/null +++ b/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/trade/vo/order/TradeOrderItemRespVO.java @@ -0,0 +1,53 @@ +package cn.iocoder.mall.shopweb.controller.trade.vo.order; + +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/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/trade/vo/order/TradeOrderPageReqVO.java b/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/trade/vo/order/TradeOrderPageReqVO.java new file mode 100644 index 000000000..cacc25cd9 --- /dev/null +++ b/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/trade/vo/order/TradeOrderPageReqVO.java @@ -0,0 +1,17 @@ +package cn.iocoder.mall.shopweb.controller.trade.vo.order; + +import cn.iocoder.common.framework.vo.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/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/trade/vo/order/TradeOrderRespVO.java b/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/trade/vo/order/TradeOrderRespVO.java new file mode 100644 index 000000000..427fe9aa9 --- /dev/null +++ b/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/trade/vo/order/TradeOrderRespVO.java @@ -0,0 +1,70 @@ +package cn.iocoder.mall.shopweb.controller.trade.vo.order; + +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/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/convert/trade/TradeOrderConvert.java b/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/convert/trade/TradeOrderConvert.java index a26d310ae..69576da8d 100644 --- a/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/convert/trade/TradeOrderConvert.java +++ b/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/convert/trade/TradeOrderConvert.java @@ -1,10 +1,15 @@ package cn.iocoder.mall.shopweb.convert.trade; +import cn.iocoder.common.framework.vo.PageResult; import cn.iocoder.mall.promotion.api.rpc.coupon.dto.card.CouponCardAvailableListReqDTO; import cn.iocoder.mall.promotion.api.rpc.price.dto.PriceProductCalcRespDTO; import cn.iocoder.mall.shopweb.controller.trade.vo.order.TradeOrderConfirmCreateInfoRespVO; import cn.iocoder.mall.shopweb.controller.trade.vo.order.TradeOrderCreateReqVO; +import cn.iocoder.mall.shopweb.controller.trade.vo.order.TradeOrderPageReqVO; +import cn.iocoder.mall.shopweb.controller.trade.vo.order.TradeOrderRespVO; import cn.iocoder.mall.tradeservice.rpc.order.dto.TradeOrderCreateReqDTO; +import cn.iocoder.mall.tradeservice.rpc.order.dto.TradeOrderPageReqDTO; +import cn.iocoder.mall.tradeservice.rpc.order.dto.TradeOrderRespDTO; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; @@ -34,4 +39,10 @@ public interface TradeOrderConvert { TradeOrderCreateReqDTO convert(TradeOrderCreateReqVO bean); + TradeOrderPageReqDTO convert(TradeOrderPageReqVO bean); + + PageResult convertPage(PageResult page); + + TradeOrderRespVO convert(TradeOrderRespDTO bean); + } diff --git a/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/service/trade/TradeOrderService.java b/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/service/trade/TradeOrderService.java index b87f49be1..e0c6d2fe5 100644 --- a/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/service/trade/TradeOrderService.java +++ b/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/service/trade/TradeOrderService.java @@ -4,13 +4,7 @@ import cn.iocoder.common.framework.enums.CommonStatusEnum; import cn.iocoder.common.framework.exception.util.ServiceExceptionUtil; import cn.iocoder.common.framework.util.CollectionUtils; import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.shopweb.client.trade.TradeOrderClient; -import cn.iocoder.mall.shopweb.controller.trade.vo.order.TradeOrderConfirmCreateInfoRespVO; -import cn.iocoder.mall.shopweb.controller.trade.vo.order.TradeOrderCreateReqVO; -import cn.iocoder.mall.shopweb.convert.trade.TradeOrderConvert; -import cn.iocoder.mall.tradeservice.rpc.cart.CartRpc; -import cn.iocoder.mall.tradeservice.rpc.cart.dto.CartItemListReqDTO; -import cn.iocoder.mall.tradeservice.rpc.cart.dto.CartItemRespDTO; +import cn.iocoder.common.framework.vo.PageResult; import cn.iocoder.mall.productservice.enums.sku.ProductSkuDetailFieldEnum; import cn.iocoder.mall.productservice.rpc.sku.ProductSkuRpc; import cn.iocoder.mall.productservice.rpc.sku.dto.ProductSkuListQueryReqDTO; @@ -24,7 +18,19 @@ import cn.iocoder.mall.promotion.api.rpc.coupon.dto.card.CouponCardAvailableResp import cn.iocoder.mall.promotion.api.rpc.price.PriceRpc; import cn.iocoder.mall.promotion.api.rpc.price.dto.PriceProductCalcReqDTO; import cn.iocoder.mall.promotion.api.rpc.price.dto.PriceProductCalcRespDTO; +import cn.iocoder.mall.shopweb.client.trade.TradeOrderClient; +import cn.iocoder.mall.shopweb.controller.trade.vo.order.TradeOrderConfirmCreateInfoRespVO; +import cn.iocoder.mall.shopweb.controller.trade.vo.order.TradeOrderCreateReqVO; +import cn.iocoder.mall.shopweb.controller.trade.vo.order.TradeOrderPageReqVO; +import cn.iocoder.mall.shopweb.controller.trade.vo.order.TradeOrderRespVO; import cn.iocoder.mall.shopweb.convert.trade.CartConvert; +import cn.iocoder.mall.shopweb.convert.trade.TradeOrderConvert; +import cn.iocoder.mall.tradeservice.enums.order.TradeOrderDetailFieldEnum; +import cn.iocoder.mall.tradeservice.rpc.cart.CartRpc; +import cn.iocoder.mall.tradeservice.rpc.cart.dto.CartItemListReqDTO; +import cn.iocoder.mall.tradeservice.rpc.cart.dto.CartItemRespDTO; +import cn.iocoder.mall.tradeservice.rpc.order.dto.TradeOrderPageReqDTO; +import cn.iocoder.mall.tradeservice.rpc.order.dto.TradeOrderRespDTO; import org.apache.dubbo.config.annotation.DubboReference; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -168,4 +174,30 @@ public class TradeOrderService { .setUserId(userId).setIp(ip)); } + /** + * 获得交易订单 + * + * @param tradeOrderId 交易订单编号 + * @return 交易订单 + */ + public TradeOrderRespVO getTradeOrder(Integer tradeOrderId) { + return TradeOrderConvert.INSTANCE.convert(tradeOrderClient.getTradeOrder(tradeOrderId, + TradeOrderDetailFieldEnum.ITEM.getField())); + } + + + /** + * 获得交易订单分页 + * + * @param pageVO 订单交易分页查询 + * @return 订单交易分页结果 + */ + public PageResult pageTradeOrder(Integer userId, TradeOrderPageReqVO pageVO) { + PageResult pageTradeOrderResult = tradeOrderClient.pageTradeOrder( + TradeOrderConvert.INSTANCE.convert(pageVO).setUserId(userId) + .setFields(Collections.singleton(TradeOrderDetailFieldEnum.ITEM.getField())) + .setSorts(Collections.singletonList(TradeOrderPageReqDTO.ID_DESC))); + return TradeOrderConvert.INSTANCE.convertPage(pageTradeOrderResult); + } + } diff --git a/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/enums/order/TradeOrderDetailFieldEnum.java b/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/enums/order/TradeOrderDetailFieldEnum.java new file mode 100644 index 000000000..58cb7f621 --- /dev/null +++ b/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/enums/order/TradeOrderDetailFieldEnum.java @@ -0,0 +1,30 @@ +package cn.iocoder.mall.tradeservice.enums.order; + +import cn.iocoder.mall.tradeservice.rpc.order.dto.TradeOrderRespDTO; + +/** + * 交易订单的明细的字段枚举 + * + * @see TradeOrderRespDTO + */ +public enum TradeOrderDetailFieldEnum { + + /** + * 交易订单项 + */ + ITEM("item"); + + /** + * 字段 + */ + private final String field; + + TradeOrderDetailFieldEnum(String field) { + this.field = field; + } + + public String getField() { + return field; + } + +} diff --git a/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/rpc/order/TradeOrderRpc.java b/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/rpc/order/TradeOrderRpc.java index 518ac08e7..14358aef1 100644 --- a/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/rpc/order/TradeOrderRpc.java +++ b/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/rpc/order/TradeOrderRpc.java @@ -1,7 +1,12 @@ package cn.iocoder.mall.tradeservice.rpc.order; import cn.iocoder.common.framework.vo.CommonResult; +import cn.iocoder.common.framework.vo.PageResult; import cn.iocoder.mall.tradeservice.rpc.order.dto.TradeOrderCreateReqDTO; +import cn.iocoder.mall.tradeservice.rpc.order.dto.TradeOrderPageReqDTO; +import cn.iocoder.mall.tradeservice.rpc.order.dto.TradeOrderRespDTO; + +import java.util.Collection; /** * 交易订单 Rpc 接口 @@ -16,4 +21,23 @@ public interface TradeOrderRpc { */ CommonResult createTradeOrder(TradeOrderCreateReqDTO createReqDTO); + /** + * 获得订单交易 + * + * @param tradeOrderId 订单交易编号 + * @param fields 额外返回字段,可见 {@link cn.iocoder.mall.tradeservice.enums.order.TradeOrderDetailFieldEnum} + * @return 订单交易 + */ + CommonResult getTradeOrder(Integer tradeOrderId, Collection fields); + + /** + * 获得交易订单分页 + * + * @param pageDTO 订单交易分页查询 + * @return 订单交易分页结果 + */ + CommonResult> pageTradeOrder(TradeOrderPageReqDTO pageDTO); + + + } diff --git a/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/rpc/order/dto/TradeOrderItemRespDTO.java b/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/rpc/order/dto/TradeOrderItemRespDTO.java new file mode 100644 index 000000000..7bff3a3b3 --- /dev/null +++ b/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/rpc/order/dto/TradeOrderItemRespDTO.java @@ -0,0 +1,101 @@ +package cn.iocoder.mall.tradeservice.rpc.order.dto; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + * 交易订单项 Response DTO + */ +@Data +@Accessors(chain = true) +public class TradeOrderItemRespDTO implements Serializable { + + /** + * id自增长 + */ + private Integer id; + /** + * 订单编号 + */ + private Integer orderId; + /** + * 订单项状态 + */ + private Integer status; + /** + * 商品 SKU 编号 + */ + private Integer skuId; + /** + * 商品 SPU 编号 + */ + private Integer spuId; + /** + * 商品名字 + */ + private String skuName; + /** + * 图片名字 + */ + private String skuImage; + /** + * 商品数量 + */ + private Integer quantity; + /** + * 原始单价,单位:分 + */ + private Integer originPrice; + /** + * 购买单价,单位:分 + */ + private Integer buyPrice; + /** + * 最终价格,单位:分 + */ + private Integer presentPrice; + /** + * 购买总金额,单位:分 + */ + private Integer buyTotal; + /** + * 优惠总金额,单位:分 + */ + private Integer discountTotal; + /** + * 最终总金额,单位:分 + */ + private Integer presentTotal; + /** + * 退款总金额,单位:分 + */ + private Integer refundTotal; + /** + * 物流id + */ + private Integer logisticsId; + /** + * 售后状态 + */ + private Integer afterSaleStatus; + /** + * 售后订单编号 + */ + private Integer afterSaleOrderId; + /** + * 创建时间 + */ + private Date createTime; + /** + * 更新时间 + */ + private Date updateTime; + /** + * 删除状态 + */ + private Integer deleted; + +} diff --git a/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/rpc/order/dto/TradeOrderPageReqDTO.java b/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/rpc/order/dto/TradeOrderPageReqDTO.java new file mode 100644 index 000000000..cfac7be60 --- /dev/null +++ b/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/rpc/order/dto/TradeOrderPageReqDTO.java @@ -0,0 +1,45 @@ +package cn.iocoder.mall.tradeservice.rpc.order.dto; + +import cn.iocoder.common.framework.vo.PageParam; +import cn.iocoder.common.framework.vo.SortingField; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +/** + * 交易订单分页 Request DTO + */ +@Data +@EqualsAndHashCode(callSuper = true) +@Accessors(chain = true) +public class TradeOrderPageReqDTO extends PageParam { + + public static final SortingField ID_ASC = new SortingField("id", "asc"); + public static final SortingField ID_DESC = new SortingField("id", "desc"); + + /** + * 用户编号 + */ + private Integer userId; + /** + * 订单状态 + */ + private Integer orderStatus; + + /** + * 排序字段数组 + */ + private List sorts; + + /** + * 额外返回字段 + * + * @see cn.iocoder.mall.tradeservice.enums.order.TradeOrderDetailFieldEnum + */ + private Collection fields = Collections.emptySet(); + +} diff --git a/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/rpc/order/dto/TradeOrderRespDTO.java b/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/rpc/order/dto/TradeOrderRespDTO.java new file mode 100644 index 000000000..a2167ceac --- /dev/null +++ b/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/rpc/order/dto/TradeOrderRespDTO.java @@ -0,0 +1,139 @@ +package cn.iocoder.mall.tradeservice.rpc.order.dto; + +import cn.iocoder.mall.tradeservice.enums.order.TradeOrderDetailFieldEnum; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * 交易订单 Response DTO + */ +@Data +@Accessors(chain = true) +public class TradeOrderRespDTO implements Serializable { + + // ========== 订单基本信息 ========== + /** + * 订单编号 + */ + private Integer id; + /** + * 用户编号 + */ + private Integer userId; + /** + * 订单单号 + */ + private String orderNo; + /** + * 订单状态 + */ + private Integer orderStatus; + /** + * 备注 + */ + private String remark; + /** + * 创建时间 + */ + private Date createTime; + + // ========== 价格 + 支付基本信息 ========== + /** + * 订单结束时间 + */ + private Date endTime; + /** + * 订单金额(总金额),单位:分 + */ + private Integer buyPrice; + /** + * 优惠总金额,单位:分 + */ + private Integer discountPrice; + /** + * 物流金额,单位:分 + */ + private Integer logisticsPrice; + /** + * 最终金额,单位:分 + */ + private Integer presentPrice; + /** + * 支付金额,单位:分 + */ + private Integer payPrice; + /** + * 退款金额,单位:分 + */ + private Integer refundPrice; + /** + * 付款时间 + */ + private Date payTime; + /** + * 支付订单编号 + */ + private Integer payTransactionId; + /** + * 支付渠道 + */ + private Integer payChannel; + + // ========== 收件 + 物流基本信息 ========== + /** + * 配送类型 + */ + private Integer deliveryType; + /** + * 发货时间 + */ + private Date deliveryTime; + /** + * 收货时间 + */ + private Date receiveTime; + /** + * 收件人名称 + */ + private String receiverName; + /** + * 手机号 + */ + private String receiverMobile; + /** + * 地区编码 + */ + private Integer receiverAreaCode; + /** + * 收件详细地址 + */ + private String receiverDetailAddress; + + // ========== 售后基本信息 ========== + /** + * 售后状态 + */ + private Integer afterSaleStatus; + + // ========== 营销基本信息 ========== + /** + * 优惠劵编号 + */ + private Integer couponCardId; + + // ========== 商品基本信息 ========== + + /** + * 订单项数组 + * + * 需要设置 {@link TradeOrderDetailFieldEnum#ITEM} 才返回 + * + * // TODO 芋艿,后续考虑怎么优化下,目前是内嵌了别的 dto + */ + private List orderItems; + +} diff --git a/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/convert/order/TradeOrderConvert.java b/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/convert/order/TradeOrderConvert.java new file mode 100644 index 000000000..4e60bf115 --- /dev/null +++ b/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/convert/order/TradeOrderConvert.java @@ -0,0 +1,29 @@ +package cn.iocoder.mall.tradeservice.convert.order; + +import cn.iocoder.common.framework.vo.PageResult; +import cn.iocoder.mall.tradeservice.dal.mysql.dataobject.order.TradeOrderDO; +import cn.iocoder.mall.tradeservice.dal.mysql.dataobject.order.TradeOrderItemDO; +import cn.iocoder.mall.tradeservice.rpc.order.dto.TradeOrderItemRespDTO; +import cn.iocoder.mall.tradeservice.rpc.order.dto.TradeOrderRespDTO; +import com.baomidou.mybatisplus.core.metadata.IPage; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +@Mapper +public interface TradeOrderConvert { + + TradeOrderConvert INSTANCE = Mappers.getMapper(TradeOrderConvert.class); + + TradeOrderRespDTO convert(TradeOrderDO bean); + + @Mapping(source = "records", target = "list") + PageResult convertPage(IPage page); + + List convertList(List list); + + TradeOrderItemRespDTO convert(TradeOrderItemDO bean); + +} diff --git a/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/dal/mysql/mapper/order/TradeOrderItemMapper.java b/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/dal/mysql/mapper/order/TradeOrderItemMapper.java index 8a351b4d3..3784500d1 100644 --- a/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/dal/mysql/mapper/order/TradeOrderItemMapper.java +++ b/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/dal/mysql/mapper/order/TradeOrderItemMapper.java @@ -1,9 +1,11 @@ package cn.iocoder.mall.tradeservice.dal.mysql.mapper.order; import cn.iocoder.mall.tradeservice.dal.mysql.dataobject.order.TradeOrderItemDO; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.springframework.stereotype.Repository; +import java.util.Collection; import java.util.List; @Repository @@ -14,4 +16,8 @@ public interface TradeOrderItemMapper extends BaseMapper { entities.forEach(this::insert); } + default List selectListByOrderIds(Collection orderIds) { + return selectList(new QueryWrapper().in("order_id", orderIds)); + } + } diff --git a/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/dal/mysql/mapper/order/TradeOrderMapper.java b/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/dal/mysql/mapper/order/TradeOrderMapper.java index 36918f457..a0423cf24 100644 --- a/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/dal/mysql/mapper/order/TradeOrderMapper.java +++ b/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/dal/mysql/mapper/order/TradeOrderMapper.java @@ -1,9 +1,20 @@ package cn.iocoder.mall.tradeservice.dal.mysql.mapper.order; +import cn.iocoder.mall.mybatis.core.query.QueryWrapperX; +import cn.iocoder.mall.mybatis.core.util.PageUtil; import cn.iocoder.mall.tradeservice.dal.mysql.dataobject.order.TradeOrderDO; +import cn.iocoder.mall.tradeservice.rpc.order.dto.TradeOrderPageReqDTO; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; import org.springframework.stereotype.Repository; @Repository public interface TradeOrderMapper extends BaseMapper { + + default IPage selectPage(TradeOrderPageReqDTO pageReqDTO) { + return selectPage(PageUtil.build(pageReqDTO, pageReqDTO.getSorts()), + new QueryWrapperX().eqIfPresent("user_id", pageReqDTO.getUserId()) + .eqIfPresent("status", pageReqDTO.getOrderStatus())); + } + } diff --git a/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/rpc/order/TradeOrderRpcImpl.java b/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/rpc/order/TradeOrderRpcImpl.java index 0e0f00bc4..49958df05 100644 --- a/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/rpc/order/TradeOrderRpcImpl.java +++ b/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/rpc/order/TradeOrderRpcImpl.java @@ -1,11 +1,16 @@ package cn.iocoder.mall.tradeservice.rpc.order; import cn.iocoder.common.framework.vo.CommonResult; +import cn.iocoder.common.framework.vo.PageResult; import cn.iocoder.mall.tradeservice.rpc.order.dto.TradeOrderCreateReqDTO; +import cn.iocoder.mall.tradeservice.rpc.order.dto.TradeOrderPageReqDTO; +import cn.iocoder.mall.tradeservice.rpc.order.dto.TradeOrderRespDTO; import cn.iocoder.mall.tradeservice.service.order.TradeOrderService; import org.apache.dubbo.config.annotation.DubboService; import org.springframework.beans.factory.annotation.Autowired; +import java.util.Collection; + import static cn.iocoder.common.framework.vo.CommonResult.success; /** @@ -22,4 +27,14 @@ public class TradeOrderRpcImpl implements TradeOrderRpc { return success(tradeOrderService.createTradeOrder(createReqDTO)); } + @Override + public CommonResult getTradeOrder(Integer tradeOrderId, Collection fields) { + return success(tradeOrderService.getTradeOrder(tradeOrderId, fields)); + } + + @Override + public CommonResult> pageTradeOrder(TradeOrderPageReqDTO pageDTO) { + return success(tradeOrderService.pageTradeOrder(pageDTO)); + } + } diff --git a/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/service/order/TradeOrderService.java b/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/service/order/TradeOrderService.java index ce3aee009..587c1a3ce 100644 --- a/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/service/order/TradeOrderService.java +++ b/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/service/order/TradeOrderService.java @@ -1,6 +1,11 @@ package cn.iocoder.mall.tradeservice.service.order; +import cn.iocoder.common.framework.vo.PageResult; import cn.iocoder.mall.tradeservice.rpc.order.dto.TradeOrderCreateReqDTO; +import cn.iocoder.mall.tradeservice.rpc.order.dto.TradeOrderPageReqDTO; +import cn.iocoder.mall.tradeservice.rpc.order.dto.TradeOrderRespDTO; + +import java.util.Collection; /** * 交易订单 Service 接口 @@ -15,4 +20,21 @@ public interface TradeOrderService { */ Integer createTradeOrder(TradeOrderCreateReqDTO createReqDTO); + /** + * 获得订单交易 + * + * @param tradeOrderId 订单交易编号 + * @param fields 额外返回字段,可见 {@link cn.iocoder.mall.tradeservice.enums.order.TradeOrderDetailFieldEnum} + * @return 订单交易 + */ + TradeOrderRespDTO getTradeOrder(Integer tradeOrderId, Collection fields); + + /** + * 获得订单交易分页 + * + * @param pageReqDTO 订单交易分页查询 + * @return 订单交易分页结果 + */ + PageResult pageTradeOrder(TradeOrderPageReqDTO pageReqDTO); + } diff --git a/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/service/order/impl/TradeOrderServiceImpl.java b/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/service/order/impl/TradeOrderServiceImpl.java index 2df46bd7c..6bc73c094 100644 --- a/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/service/order/impl/TradeOrderServiceImpl.java +++ b/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/service/order/impl/TradeOrderServiceImpl.java @@ -4,6 +4,7 @@ import cn.iocoder.common.framework.exception.util.ServiceExceptionUtil; import cn.iocoder.common.framework.util.CollectionUtils; import cn.iocoder.common.framework.util.DateUtil; import cn.iocoder.common.framework.util.MathUtil; +import cn.iocoder.common.framework.vo.PageResult; import cn.iocoder.mall.productservice.enums.sku.ProductSkuDetailFieldEnum; import cn.iocoder.mall.productservice.rpc.sku.dto.ProductSkuRespDTO; import cn.iocoder.mall.promotion.api.rpc.price.dto.PriceProductCalcReqDTO; @@ -12,16 +13,21 @@ import cn.iocoder.mall.tradeservice.client.product.ProductSkuClient; import cn.iocoder.mall.tradeservice.client.promotion.CouponCardClient; import cn.iocoder.mall.tradeservice.client.promotion.PriceClient; import cn.iocoder.mall.tradeservice.client.user.UserAddressClient; +import cn.iocoder.mall.tradeservice.convert.order.TradeOrderConvert; import cn.iocoder.mall.tradeservice.dal.mysql.dataobject.order.TradeOrderDO; import cn.iocoder.mall.tradeservice.dal.mysql.dataobject.order.TradeOrderItemDO; import cn.iocoder.mall.tradeservice.dal.mysql.mapper.order.TradeOrderItemMapper; import cn.iocoder.mall.tradeservice.dal.mysql.mapper.order.TradeOrderMapper; import cn.iocoder.mall.tradeservice.enums.logistics.LogisticsDeliveryTypeEnum; import cn.iocoder.mall.tradeservice.enums.order.TradeOrderAfterSaleStatusEnum; +import cn.iocoder.mall.tradeservice.enums.order.TradeOrderDetailFieldEnum; import cn.iocoder.mall.tradeservice.enums.order.TradeOrderStatusEnum; import cn.iocoder.mall.tradeservice.rpc.order.dto.TradeOrderCreateReqDTO; +import cn.iocoder.mall.tradeservice.rpc.order.dto.TradeOrderPageReqDTO; +import cn.iocoder.mall.tradeservice.rpc.order.dto.TradeOrderRespDTO; import cn.iocoder.mall.tradeservice.service.order.TradeOrderService; import cn.iocoder.mall.userservice.rpc.address.dto.UserAddressRespDTO; +import com.baomidou.mybatisplus.core.metadata.IPage; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -29,8 +35,9 @@ import org.springframework.transaction.annotation.Transactional; import java.util.*; import java.util.stream.Collectors; -import static cn.iocoder.mall.tradeservice.enums.OrderErrorCodeConstants.*; -import static cn.iocoder.mall.userservice.enums.UserErrorCodeConstants.*; +import static cn.iocoder.common.framework.util.CollectionUtils.convertSet; +import static cn.iocoder.mall.tradeservice.enums.OrderErrorCodeConstants.ORDER_GET_GOODS_INFO_INCORRECT; +import static cn.iocoder.mall.userservice.enums.UserErrorCodeConstants.USER_ADDRESS_NOT_FOUND; /** * 交易订单 Service 实现 @@ -66,7 +73,7 @@ public class TradeOrderServiceImpl implements TradeOrderService { } // 获得商品信息 List listProductSkus = productSkuClient.listProductSkus( - CollectionUtils.convertSet(createReqDTO.getOrderItems(), TradeOrderCreateReqDTO.OrderItem::getSkuId), + convertSet(createReqDTO.getOrderItems(), TradeOrderCreateReqDTO.OrderItem::getSkuId), ProductSkuDetailFieldEnum.SPU.getField()); if (listProductSkus.size() != createReqDTO.getOrderItems().size()) { // 校验获得的数量,是否匹配 throw ServiceExceptionUtil.exception(ORDER_GET_GOODS_INFO_INCORRECT); @@ -172,4 +179,43 @@ public class TradeOrderServiceImpl implements TradeOrderService { ; } + @Override + public TradeOrderRespDTO getTradeOrder(Integer tradeOrderId, Collection fields) { + // 查询交易订单 + TradeOrderDO tradeOrderDO = tradeOrderMapper.selectById(tradeOrderId); + if (tradeOrderDO == null) { + return null; + } + TradeOrderRespDTO tradeOrderRespDTO = TradeOrderConvert.INSTANCE.convert(tradeOrderDO); + // 查询交易订单项 + if (fields.contains(TradeOrderDetailFieldEnum.ITEM.getField())) { + List tradeOrderItemDOs = tradeOrderItemMapper.selectListByOrderIds( + Collections.singleton(tradeOrderDO.getId())); + tradeOrderRespDTO.setOrderItems(TradeOrderConvert.INSTANCE.convertList(tradeOrderItemDOs)); + } + // 返回 + return tradeOrderRespDTO; + } + + @Override + public PageResult pageTradeOrder(TradeOrderPageReqDTO pageReqDTO) { + // 查询交易订单分页 + IPage tradeOrderDOPage = tradeOrderMapper.selectPage(pageReqDTO); + PageResult pageResult = TradeOrderConvert.INSTANCE.convertPage(tradeOrderDOPage); + if (CollectionUtils.isEmpty(pageResult.getList())) { + return pageResult; + } + // 查询交易订单项们 + if (pageReqDTO.getFields().contains(TradeOrderDetailFieldEnum.ITEM.getField())) { + List tradeOrderItemDOs = tradeOrderItemMapper.selectListByOrderIds( + convertSet(tradeOrderDOPage.getRecords(), TradeOrderDO::getId)); + Map> tradeOrderItemDOMultiMap = CollectionUtils.convertMultiMap( + tradeOrderItemDOs, TradeOrderItemDO::getOrderId); + pageResult.getList().forEach(tradeOrderRespDTO -> tradeOrderRespDTO.setOrderItems( + TradeOrderConvert.INSTANCE.convertList(tradeOrderItemDOMultiMap.get(tradeOrderRespDTO.getId())))); + } + // 返回 + return pageResult; + } + }