From 21bb6fd1c4b78908c6a67fc49aac048fd3d44869 Mon Sep 17 00:00:00 2001 From: sin <2943460818@qq.com> Date: Fri, 5 Apr 2019 15:16:23 +0800 Subject: [PATCH] =?UTF-8?q?=20-=20=E6=B7=BB=E5=8A=A0=E5=90=8E=E5=8E=BB?= =?UTF-8?q?=E6=94=B6=E4=BB=B6=E4=BA=BA=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/admins/AdminsOrderController.java | 7 +++++++ .../java/cn/iocoder/mall/order/api/OrderService.java | 9 +++++++++ .../mall/order/biz/convert/OrderRecipientConvert.java | 3 +++ .../mall/order/biz/dao/OrderRecipientMapper.java | 11 +++++++++++ .../mall/order/biz/service/OrderServiceImpl.java | 11 +++++++++++ .../main/resources/mapper/OrderRecipientMapper.xml | 11 +++++++++++ 6 files changed, 52 insertions(+) diff --git a/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/admins/AdminsOrderController.java b/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/admins/AdminsOrderController.java index 99e0b7507..c59199a1e 100644 --- a/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/admins/AdminsOrderController.java +++ b/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/admins/AdminsOrderController.java @@ -4,6 +4,7 @@ import cn.iocoder.common.framework.vo.CommonResult; import cn.iocoder.mall.order.api.OrderService; import cn.iocoder.mall.order.api.bo.OrderItemBO; import cn.iocoder.mall.order.api.bo.OrderPageBO; +import cn.iocoder.mall.order.api.bo.OrderRecipientBO; import cn.iocoder.mall.order.api.dto.*; import cn.iocoder.mall.order.application.convert.OrderConvertAPP; import cn.iocoder.mall.order.application.vo.OrderItemUpdateVO; @@ -45,6 +46,12 @@ public class AdminsOrderController { return orderService.getOrderItems(orderId); } + @GetMapping("order_recipient_info") + @ApiOperation("订单收件人信息") + public CommonResult getOrderRecipientBO(@RequestParam("orderId") Integer orderId) { + return orderService.getOrderRecipientBO(orderId); + } + @PutMapping("update_remark") @ApiOperation("更新-更新订单备注") public CommonResult updateRemark(@RequestParam("orderId") Integer orderId, diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/OrderService.java b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/OrderService.java index 354fbe2af..07a11f3bb 100644 --- a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/OrderService.java +++ b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/OrderService.java @@ -4,6 +4,7 @@ import cn.iocoder.common.framework.vo.CommonResult; import cn.iocoder.mall.order.api.bo.OrderCreateBO; import cn.iocoder.mall.order.api.bo.OrderItemBO; import cn.iocoder.mall.order.api.bo.OrderPageBO; +import cn.iocoder.mall.order.api.bo.OrderRecipientBO; import cn.iocoder.mall.order.api.dto.*; import java.util.List; @@ -32,6 +33,14 @@ public interface OrderService { */ CommonResult> getOrderItems(Integer orderId); + /** + * 订单收件人信息 + * + * @param orderId + * @return + */ + CommonResult getOrderRecipientBO(Integer orderId); + /** * 订单 - 创建 * diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/convert/OrderRecipientConvert.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/convert/OrderRecipientConvert.java index 8a40c914a..aa1c12ebb 100644 --- a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/convert/OrderRecipientConvert.java +++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/convert/OrderRecipientConvert.java @@ -23,6 +23,9 @@ public interface OrderRecipientConvert { @Mappings({}) OrderRecipientDO convert(OrderCreateDTO orderCreateDTO); + @Mappings({}) + OrderRecipientBO convert(OrderRecipientDO orderRecipientDO); + @Mappings({}) List convert(List orderRecipientDOList); } diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dao/OrderRecipientMapper.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dao/OrderRecipientMapper.java index a529013ce..193f03bf0 100644 --- a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dao/OrderRecipientMapper.java +++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dao/OrderRecipientMapper.java @@ -24,6 +24,16 @@ public interface OrderRecipientMapper { */ int insert(OrderRecipientDO orderRecipient); + /** + * 查询 - 根据 orderId + * + * @param orderId + * @return + */ + OrderRecipientDO selectByOrderId( + @Param("orderId") Integer orderId + ); + /** * 查询 - 根据 orderIds * @@ -33,4 +43,5 @@ public interface OrderRecipientMapper { List selectByOrderIds( @Param("orderIds")Collection orderIds ); + } diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderServiceImpl.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderServiceImpl.java index 8fee739f9..76727b701 100644 --- a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderServiceImpl.java +++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderServiceImpl.java @@ -118,6 +118,17 @@ public class OrderServiceImpl implements OrderService { 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 @Transactional public CommonResult createOrder(Integer userId, OrderCreateDTO orderCreateDTO) { diff --git a/order/order-service-impl/src/main/resources/mapper/OrderRecipientMapper.xml b/order/order-service-impl/src/main/resources/mapper/OrderRecipientMapper.xml index b2d9f675b..0aa7571a6 100644 --- a/order/order-service-impl/src/main/resources/mapper/OrderRecipientMapper.xml +++ b/order/order-service-impl/src/main/resources/mapper/OrderRecipientMapper.xml @@ -20,6 +20,16 @@ ) + + + @@ -32,4 +42,5 @@ #{orderId} +