From 26aaad24f8e627736b54bf3f0ec73307e660e441 Mon Sep 17 00:00:00 2001 From: sin <2943460818@qq.com> Date: Wed, 8 May 2019 20:00:48 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E6=B7=BB=E5=8A=A0=20=E6=8E=A5=E5=8F=97?= =?UTF-8?q?=E9=80=80=E8=B4=A7=20-=20=E6=B7=BB=E5=8A=A0=20=E6=8B=92?= =?UTF-8?q?=E7=BB=9D=E9=80=80=E8=B4=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admins/AdminOrderReturnController.java | 8 +++-- .../mall/order/api/OrderReturnService.java | 16 +++++++++ .../api/constant/OrderErrorCodeEnum.java | 1 + ...m.java => OrderReturnServiceTypeEnum.java} | 4 +-- .../api/constant/OrderReturnStatusEnum.java | 6 ++-- .../biz/service/OrderReturnServiceImpl.java | 33 +++++++++++++++++-- 6 files changed, 59 insertions(+), 9 deletions(-) rename order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/{OrderReturnReturnTypeEnum.java => OrderReturnServiceTypeEnum.java} (84%) diff --git a/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/admins/AdminOrderReturnController.java b/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/admins/AdminOrderReturnController.java index 625b341fe..080beb3d4 100644 --- a/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/admins/AdminOrderReturnController.java +++ b/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/admins/AdminOrderReturnController.java @@ -35,7 +35,11 @@ public class AdminOrderReturnController { @PostMapping("agree") public CommonResult agree(@RequestParam("id") Integer id) { - CommonResult commonResult = orderReturnService.agree(id); - return commonResult; + return orderReturnService.orderReturnAgree(id); + } + + @PostMapping("refuse") + public CommonResult refuse(@RequestParam("id") Integer id) { + return orderReturnService.orderReturnRefuse(id); } } diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/OrderReturnService.java b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/OrderReturnService.java index be847f257..c598d8fbe 100644 --- a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/OrderReturnService.java +++ b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/OrderReturnService.java @@ -50,4 +50,20 @@ public interface OrderReturnService { * @return */ CommonResult orderReturnList(OrderReturnQueryDTO queryDTO); + + /** + * 订单退货 - 接受 + * + * @param id + * @return + */ + CommonResult orderReturnAgree(Integer id); + + /** + * 订单退货 - 拒绝 + * + * @param id + * @return + */ + CommonResult orderReturnRefuse(Integer id); } diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/OrderErrorCodeEnum.java b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/OrderErrorCodeEnum.java index 15b616bd5..382e851fd 100644 --- a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/OrderErrorCodeEnum.java +++ b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/OrderErrorCodeEnum.java @@ -34,6 +34,7 @@ public enum OrderErrorCodeEnum { // 订单退货 ORDER_RETURN_NO_RETURN_APPLY(1008000400, "未退货申请"), + ORDER_RETURN_NOT_EXISTENT(1008000401, "退货订单不存在"), // ========== 购物车 ========== CARD_ITEM_NOT_FOUND(1008003000, "购物车项不存在"), diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/OrderReturnReturnTypeEnum.java b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/OrderReturnServiceTypeEnum.java similarity index 84% rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/OrderReturnReturnTypeEnum.java rename to order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/OrderReturnServiceTypeEnum.java index 08e595db9..0be9ebbbb 100644 --- a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/OrderReturnReturnTypeEnum.java +++ b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/OrderReturnServiceTypeEnum.java @@ -6,7 +6,7 @@ package cn.iocoder.mall.order.api.constant; * @author Sin * @time 2019-04-27 11:53 */ -public enum OrderReturnReturnTypeEnum { +public enum OrderReturnServiceTypeEnum { /** * 状态 @@ -21,7 +21,7 @@ public enum OrderReturnReturnTypeEnum { private final String name; - OrderReturnReturnTypeEnum(int value, String name) { + OrderReturnServiceTypeEnum(int value, String name) { this.value = value; this.name = name; } diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/OrderReturnStatusEnum.java b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/OrderReturnStatusEnum.java index ef59a92fa..8b37f22fe 100644 --- a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/OrderReturnStatusEnum.java +++ b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/OrderReturnStatusEnum.java @@ -18,8 +18,10 @@ public enum OrderReturnStatusEnum { * - 5、退货成功 */ RETURN_APPLICATION(1, "退货申请"), - APPLICATION_SUCCESSFUL(1, "申请成功"), - APPLICATION_FAIL(1, "申请失败"), + APPLICATION_SUCCESSFUL(2, "申请成功"), + APPLICATION_FAIL(3, "申请失败"), + RETURN(4, "退货中"), + RETURN_SUCCESS(5, "退货成功"), ; private final int value; diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderReturnServiceImpl.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderReturnServiceImpl.java index 4e354e14c..7dd3e1bac 100644 --- a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderReturnServiceImpl.java +++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderReturnServiceImpl.java @@ -9,6 +9,7 @@ import cn.iocoder.mall.order.api.bo.OrderLastLogisticsInfoBO; import cn.iocoder.mall.order.api.bo.OrderReturnInfoBO; import cn.iocoder.mall.order.api.bo.OrderReturnListBO; import cn.iocoder.mall.order.api.constant.OrderErrorCodeEnum; +import cn.iocoder.mall.order.api.constant.OrderReturnServiceTypeEnum; import cn.iocoder.mall.order.api.constant.OrderReturnStatusEnum; import cn.iocoder.mall.order.api.dto.OrderReturnApplyDTO; import cn.iocoder.mall.order.api.dto.OrderReturnQueryDTO; @@ -142,11 +143,37 @@ public class OrderReturnServiceImpl implements OrderReturnService { } @Override - public CommonResult agree(Integer id) { + public CommonResult orderReturnAgree(Integer id) { OrderReturnDO orderReturnDO = orderReturnMapper.selectById(id); if (orderReturnDO == null) { - + return ServiceExceptionUtil + .error(OrderErrorCodeEnum.ORDER_RETURN_NOT_EXISTENT.getCode()); } - return null; + + // TODO: 2019/5/8 sin, 发送 MQ 消息,申请退货成功! + // TODO: 2019/5/8 sin 退款:支付系统退款 + // TODO: 2019/5/8 sin 退货+退款:退回商品签收后,支付系统退款 + + orderReturnMapper.updateByOrderId( + new OrderReturnDO() + .setId(id) + .setStatus(OrderReturnStatusEnum.APPLICATION_SUCCESSFUL.getValue()) + ); + return CommonResult.success(null); + } + + @Override + public CommonResult orderReturnRefuse(Integer id) { + OrderReturnDO orderReturnDO = orderReturnMapper.selectById(id); + if (orderReturnDO == null) { + return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_RETURN_NOT_EXISTENT.getCode()); + } + + orderReturnMapper.updateByOrderId( + new OrderReturnDO() + .setId(id) + .setStatus(OrderReturnStatusEnum.APPLICATION_FAIL.getValue()) + ); + return CommonResult.success(null); } }