From 23d6c5c76f8e2ceb54034a1cb2e099b917ce0c40 Mon Sep 17 00:00:00 2001 From: wayn <1669738430@qq.com> Date: Sat, 25 Dec 2021 13:08:31 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=95=86=E5=9F=8E):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- .../core/domain/vo/order/OrderDetailVO.java | 2 ++ .../com/wayn/common/core/util/OrderUtil.java | 17 ++++++++++++++--- .../java/com/wayn/common/enums/PayTypeEnum.java | 3 --- .../api/service/impl/OrderServiceImpl.java | 2 ++ 5 files changed, 19 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index 1274759..1a2b2ff 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.springframework.boot spring-boot-starter-parent - 2.5.7 + 2.5.8 waynboot-common diff --git a/waynboot-common/src/main/java/com/wayn/common/core/domain/vo/order/OrderDetailVO.java b/waynboot-common/src/main/java/com/wayn/common/core/domain/vo/order/OrderDetailVO.java index 2ce9578..be60bbe 100644 --- a/waynboot-common/src/main/java/com/wayn/common/core/domain/vo/order/OrderDetailVO.java +++ b/waynboot-common/src/main/java/com/wayn/common/core/domain/vo/order/OrderDetailVO.java @@ -40,6 +40,7 @@ public class OrderDetailVO implements Serializable { * 订单状态 */ private Short orderStatus; + private String orderStatusText; /** * 售后状态,0是可申请,1是用户已申请,2是管理员审核通过,3是管理员退款成功,4是管理员审核拒绝,5是用户已取消 @@ -110,6 +111,7 @@ public class OrderDetailVO implements Serializable { * 支付方式 1微信 2支付宝 */ private Integer payType; + private String payTypeText; /** * 付款时间 diff --git a/waynboot-common/src/main/java/com/wayn/common/core/util/OrderUtil.java b/waynboot-common/src/main/java/com/wayn/common/core/util/OrderUtil.java index 56be5b6..bfbb5da 100644 --- a/waynboot-common/src/main/java/com/wayn/common/core/util/OrderUtil.java +++ b/waynboot-common/src/main/java/com/wayn/common/core/util/OrderUtil.java @@ -79,6 +79,19 @@ public class OrderUtil { throw new IllegalStateException("orderStatus不支持"); } + public static String payTypeText(Order order) { + Integer payType = order.getPayType(); + if (payType == 1) { + return "微信"; + } else if (payType == 2) { + return "支付宝"; + } else if (payType == 3) { + return "TEST"; + } + throw new IllegalStateException("payType不支持"); + + } + public static OrderHandleOption build(Order order) { int status = order.getOrderStatus().intValue(); @@ -151,9 +164,7 @@ public class OrderUtil { } public static boolean hasPayed(Order order) { - return OrderUtil.STATUS_CREATE != order.getOrderStatus().shortValue() - && OrderUtil.STATUS_CANCEL != order.getOrderStatus().shortValue() - && OrderUtil.STATUS_AUTO_CANCEL != order.getOrderStatus().shortValue(); + return OrderUtil.STATUS_CREATE != order.getOrderStatus().shortValue() && OrderUtil.STATUS_CANCEL != order.getOrderStatus().shortValue() && OrderUtil.STATUS_AUTO_CANCEL != order.getOrderStatus().shortValue(); } public static boolean isPayStatus(Order order) { diff --git a/waynboot-common/src/main/java/com/wayn/common/enums/PayTypeEnum.java b/waynboot-common/src/main/java/com/wayn/common/enums/PayTypeEnum.java index 27cc3b1..fb46b6a 100644 --- a/waynboot-common/src/main/java/com/wayn/common/enums/PayTypeEnum.java +++ b/waynboot-common/src/main/java/com/wayn/common/enums/PayTypeEnum.java @@ -1,8 +1,5 @@ package com.wayn.common.enums; -import java.util.Arrays; -import java.util.stream.Collectors; - /** * 支付方式枚举 */ diff --git a/waynboot-mobile-api/src/main/java/com/wayn/mobile/api/service/impl/OrderServiceImpl.java b/waynboot-mobile-api/src/main/java/com/wayn/mobile/api/service/impl/OrderServiceImpl.java index 84b7de0..cf0b09e 100644 --- a/waynboot-mobile-api/src/main/java/com/wayn/mobile/api/service/impl/OrderServiceImpl.java +++ b/waynboot-mobile-api/src/main/java/com/wayn/mobile/api/service/impl/OrderServiceImpl.java @@ -175,6 +175,8 @@ public class OrderServiceImpl extends ServiceImpl implements Order order = getOne(queryWrapper); OrderDetailVO orderDetailVO = new OrderDetailVO(); MyBeanUtil.copyProperties(order, orderDetailVO); + orderDetailVO.setOrderStatusText(OrderUtil.orderStatusText(order)); + orderDetailVO.setPayTypeText(OrderUtil.payTypeText(order)); LambdaQueryWrapper queryWrapper1 = Wrappers.lambdaQuery(OrderGoods.class); queryWrapper1.eq(OrderGoods::getOrderId, order.getId()); List list = iOrderGoodsService.list(queryWrapper1);