From b90d56ed1ed270f73fe1bc7a344fef52c1f5b07c Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Wed, 2 Nov 2022 15:16:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/web/controller/OrderRefundController.java | 12 ++---------- .../com/hai/order/service/OrderRefundService.java | 6 +++--- .../java/com/hai/order/service/OrderService.java | 7 +++---- .../order/service/impl/OrderRefundServiceImpl.java | 5 ++--- .../com/hai/order/service/impl/OrderServiceImpl.java | 8 ++------ ...derOpUserType.java => OrderRefundOpUserType.java} | 8 ++++---- 6 files changed, 16 insertions(+), 30 deletions(-) rename hai-service/src/main/java/com/hai/order/type/{OrderRefundOrderOpUserType.java => OrderRefundOpUserType.java} (77%) diff --git a/hai-order/src/main/java/com/web/controller/OrderRefundController.java b/hai-order/src/main/java/com/web/controller/OrderRefundController.java index a8424f52..2c5a43fd 100644 --- a/hai-order/src/main/java/com/web/controller/OrderRefundController.java +++ b/hai-order/src/main/java/com/web/controller/OrderRefundController.java @@ -12,19 +12,13 @@ import com.hai.common.utils.ResponseMsgUtil; import com.hai.entity.HighChildOrder; import com.hai.entity.HighOrder; import com.hai.entity.HighOrderRefund; -import com.hai.enum_type.OrderStatusEnum; import com.hai.model.HighUserModel; import com.hai.model.ResponseData; import com.hai.model.UserInfoModel; -import com.hai.order.model.CreateOrderChildModel; -import com.hai.order.model.CreateOrderModel; -import com.hai.order.model.ExportGasOrderModel; import com.hai.order.model.ExportOrderRefundModel; -import com.hai.order.service.OrderPaySuccessService; import com.hai.order.service.OrderRefundService; import com.hai.order.service.OrderService; import com.hai.order.type.*; -import com.hai.order.utils.OrderUtil; import com.web.config.SysConst; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -38,12 +32,10 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.io.File; -import java.math.BigDecimal; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.stream.Collectors; @Controller @RequestMapping(value = "") @@ -87,7 +79,7 @@ public class OrderRefundController { } orderService.refundOrder(order, body.getString("remarks"), - OrderRefundOrderOpUserType.TYPE2, + OrderRefundOpUserType.TYPE2, userInfoModel.getSecUser().getId(), userInfoModel.getSecUser().getUserName() ); @@ -132,7 +124,7 @@ public class OrderRefundController { order, body.getString("childOrderNo"), body.getInteger("refundGoodsNum"), body.getString("remarks"), - OrderRefundOrderOpUserType.TYPE2, + OrderRefundOpUserType.TYPE2, userInfoModel.getSecUser().getId(), userInfoModel.getSecUser().getUserName() ); diff --git a/hai-service/src/main/java/com/hai/order/service/OrderRefundService.java b/hai-service/src/main/java/com/hai/order/service/OrderRefundService.java index 4c3fbba8..0fd7fd86 100644 --- a/hai-service/src/main/java/com/hai/order/service/OrderRefundService.java +++ b/hai-service/src/main/java/com/hai/order/service/OrderRefundService.java @@ -5,7 +5,7 @@ import com.hai.entity.HighOrder; import com.hai.entity.HighOrderRefund; import com.hai.order.model.RefundPriceModel; import com.hai.order.type.OrderPayType; -import com.hai.order.type.OrderRefundOrderOpUserType; +import com.hai.order.type.OrderRefundOpUserType; import java.math.BigDecimal; import java.util.List; @@ -30,7 +30,7 @@ public interface OrderRefundService { * @param order 交易订单 * @param remarks 退款备注 */ - HighOrder createOrderRefund(String refundOrderNo, HighOrder order, String remarks, OrderRefundOrderOpUserType opUserType, Long opUserId, String opUserName) throws Exception; + HighOrder createOrderRefund(String refundOrderNo, HighOrder order, String remarks, OrderRefundOpUserType opUserType, Long opUserId, String opUserName) throws Exception; /** * 子订单退款 @@ -39,7 +39,7 @@ public interface OrderRefundService { * @param refundGoodsCount 退款商品数量 * @param remarks 退款备注 */ - HighOrderRefund createOrderChildRefund(HighChildOrder orderChild, String refundOrderNo, Integer refundGoodsCount, String remarks, OrderRefundOrderOpUserType opUserType, Long opUserId, String opUserName) throws Exception; + HighOrderRefund createOrderChildRefund(HighChildOrder orderChild, String refundOrderNo, Integer refundGoodsCount, String remarks, OrderRefundOpUserType opUserType, Long opUserId, String opUserName) throws Exception; /** * 交易退钱 diff --git a/hai-service/src/main/java/com/hai/order/service/OrderService.java b/hai-service/src/main/java/com/hai/order/service/OrderService.java index 0027f67f..439d9e7b 100644 --- a/hai-service/src/main/java/com/hai/order/service/OrderService.java +++ b/hai-service/src/main/java/com/hai/order/service/OrderService.java @@ -1,10 +1,9 @@ package com.hai.order.service; -import com.alicp.jetcache.anno.CacheUpdate; import com.hai.entity.HighChildOrder; import com.hai.entity.HighOrder; import com.hai.order.model.CreateOrderModel; -import com.hai.order.type.OrderRefundOrderOpUserType; +import com.hai.order.type.OrderRefundOpUserType; import java.util.List; import java.util.Map; @@ -51,7 +50,7 @@ public interface OrderService { * @param remarks * @return */ - HighOrder refundOrder(HighOrder order, String remarks, OrderRefundOrderOpUserType opUserType, Long opUserId, String opUserName) throws Exception; + HighOrder refundOrder(HighOrder order, String remarks, OrderRefundOpUserType opUserType, Long opUserId, String opUserName) throws Exception; /** * 子订单退款 @@ -61,7 +60,7 @@ public interface OrderService { * @param remarks * @return */ - HighOrder refundChildOrder(HighOrder order,String childOrderNo,Integer refundGoodsNum,String remarks, OrderRefundOrderOpUserType opUserType, Long opUserId, String opUserName) throws Exception; + HighOrder refundChildOrder(HighOrder order, String childOrderNo, Integer refundGoodsNum, String remarks, OrderRefundOpUserType opUserType, Long opUserId, String opUserName) throws Exception; /** * 根据订单号查询交易订单号详情 diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderRefundServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderRefundServiceImpl.java index a7388abc..1f5aaa55 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderRefundServiceImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderRefundServiceImpl.java @@ -31,7 +31,6 @@ import java.util.Calendar; import java.util.Date; import java.util.List; import java.util.Map; -import java.util.stream.Collectors; /** * @className: OrderRefundServiceImpl @@ -62,7 +61,7 @@ public class OrderRefundServiceImpl implements OrderRefundService { } @Override - public HighOrder createOrderRefund(String refundOrderNo, HighOrder order, String remarks, OrderRefundOrderOpUserType opUserType, Long opUserId, String opUserName) throws Exception { + public HighOrder createOrderRefund(String refundOrderNo, HighOrder order, String remarks, OrderRefundOpUserType opUserType, Long opUserId, String opUserName) throws Exception { for (HighChildOrder orderChild : order.getHighChildOrderList()) { // 创建退款记录 HighOrderRefund orderRefund = createOrderChildRefund(orderChild, refundOrderNo, orderChild.getSaleCount(), remarks, opUserType,opUserId,opUserName); @@ -77,7 +76,7 @@ public class OrderRefundServiceImpl implements OrderRefundService { } @Override - public HighOrderRefund createOrderChildRefund(HighChildOrder orderChild,String refundOrderNo,Integer refundGoodsCount, String remarks, OrderRefundOrderOpUserType opUserType, Long opUserId, String opUserName) throws Exception { + public HighOrderRefund createOrderChildRefund(HighChildOrder orderChild, String refundOrderNo, Integer refundGoodsCount, String remarks, OrderRefundOpUserType opUserType, Long opUserId, String opUserName) throws Exception { if (!orderChild.getChildOrderStatus().equals(OrderChildStatus.STATUS2.getNumber()) && !orderChild.getChildOrderStatus().equals(OrderChildStatus.STATUS3.getNumber())){ throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "子订单状态错误"); diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java index a9646fc5..af83de26 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java @@ -8,12 +8,10 @@ import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.security.AESEncodeUtil; -import com.hai.common.utils.DateUtil; import com.hai.dao.HighChildOrderMapper; import com.hai.dao.HighOrderMapper; import com.hai.entity.*; import com.hai.enum_type.DiscountUseScope; -import com.hai.enum_type.OrderStatusEnum; import com.hai.order.model.CreateOrderChildModel; import com.hai.order.model.CreateOrderModel; import com.hai.order.model.RefundPriceModel; @@ -24,8 +22,6 @@ import com.hai.order.utils.OrderUtil; import com.hai.service.*; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; -import org.apache.rocketmq.client.producer.SendCallback; -import org.apache.rocketmq.client.producer.SendResult; import org.apache.rocketmq.spring.core.RocketMQTemplate; import org.springframework.integration.support.MessageBuilder; import org.springframework.messaging.Message; @@ -506,7 +502,7 @@ public class OrderServiceImpl implements OrderService { timeout = 10, rollbackFor = Exception.class) @CacheUpdate(name = "order:", key = "#order.orderNo", value = "#order") - public HighOrder refundOrder(HighOrder order, String remarks, OrderRefundOrderOpUserType opUserType, Long opUserId, String opUserName) throws Exception { + public HighOrder refundOrder(HighOrder order, String remarks, OrderRefundOpUserType opUserType, Long opUserId, String opUserName) throws Exception { if (!order.getOrderStatus().equals(OrderStatus.STATUS2.getNumber()) && !order.getOrderStatus().equals(OrderStatus.STATUS3.getNumber())) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单状态错误"); @@ -569,7 +565,7 @@ public class OrderServiceImpl implements OrderService { timeout = 10, rollbackFor = Exception.class) @CacheUpdate(name = "order:", key = "#order.orderNo", value = "#order") - public HighOrder refundChildOrder(HighOrder order,String childOrderNo,Integer refundGoodsNum, String remarks, OrderRefundOrderOpUserType opUserType, Long opUserId, String opUserName) throws Exception { + public HighOrder refundChildOrder(HighOrder order, String childOrderNo, Integer refundGoodsNum, String remarks, OrderRefundOpUserType opUserType, Long opUserId, String opUserName) throws Exception { List collect = order.getHighChildOrderList().stream().filter(o -> o.getChildOrderNo().equals(childOrderNo)).collect(Collectors.toList()); if (collect == null || collect.size() == 0) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到订单"); diff --git a/hai-service/src/main/java/com/hai/order/type/OrderRefundOrderOpUserType.java b/hai-service/src/main/java/com/hai/order/type/OrderRefundOpUserType.java similarity index 77% rename from hai-service/src/main/java/com/hai/order/type/OrderRefundOrderOpUserType.java rename to hai-service/src/main/java/com/hai/order/type/OrderRefundOpUserType.java index d969f47e..7e644fd4 100644 --- a/hai-service/src/main/java/com/hai/order/type/OrderRefundOrderOpUserType.java +++ b/hai-service/src/main/java/com/hai/order/type/OrderRefundOpUserType.java @@ -7,7 +7,7 @@ import java.util.Objects; * @author: HuRui * @date: 2022/11/2 **/ -public enum OrderRefundOrderOpUserType { +public enum OrderRefundOpUserType { TYPE1(1, "系统"), TYPE2(2, "管理员"), TYPE3(3, "用户"), @@ -17,7 +17,7 @@ public enum OrderRefundOrderOpUserType { private String name; - OrderRefundOrderOpUserType(int number, String name) { + OrderRefundOpUserType(int number, String name) { this.number = number; this.name = name; } @@ -27,8 +27,8 @@ public enum OrderRefundOrderOpUserType { * @param type * @return */ - public static OrderRefundOrderOpUserType getDataByType(Integer type) { - for (OrderRefundOrderOpUserType ele : values()) { + public static OrderRefundOpUserType getDataByType(Integer type) { + for (OrderRefundOpUserType ele : values()) { if(Objects.equals(type,ele.getNumber())) return ele; } return null;