提交代码

dev-discount
胡锐 2 years ago
parent 6f07f5b2cb
commit b90d56ed1e
  1. 12
      hai-order/src/main/java/com/web/controller/OrderRefundController.java
  2. 6
      hai-service/src/main/java/com/hai/order/service/OrderRefundService.java
  3. 7
      hai-service/src/main/java/com/hai/order/service/OrderService.java
  4. 5
      hai-service/src/main/java/com/hai/order/service/impl/OrderRefundServiceImpl.java
  5. 8
      hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java
  6. 8
      hai-service/src/main/java/com/hai/order/type/OrderRefundOpUserType.java

@ -12,19 +12,13 @@ import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.HighChildOrder; import com.hai.entity.HighChildOrder;
import com.hai.entity.HighOrder; import com.hai.entity.HighOrder;
import com.hai.entity.HighOrderRefund; import com.hai.entity.HighOrderRefund;
import com.hai.enum_type.OrderStatusEnum;
import com.hai.model.HighUserModel; import com.hai.model.HighUserModel;
import com.hai.model.ResponseData; import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel; 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.model.ExportOrderRefundModel;
import com.hai.order.service.OrderPaySuccessService;
import com.hai.order.service.OrderRefundService; import com.hai.order.service.OrderRefundService;
import com.hai.order.service.OrderService; import com.hai.order.service.OrderService;
import com.hai.order.type.*; import com.hai.order.type.*;
import com.hai.order.utils.OrderUtil;
import com.web.config.SysConst; import com.web.config.SysConst;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -38,12 +32,10 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.File; import java.io.File;
import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
@Controller @Controller
@RequestMapping(value = "") @RequestMapping(value = "")
@ -87,7 +79,7 @@ public class OrderRefundController {
} }
orderService.refundOrder(order, orderService.refundOrder(order,
body.getString("remarks"), body.getString("remarks"),
OrderRefundOrderOpUserType.TYPE2, OrderRefundOpUserType.TYPE2,
userInfoModel.getSecUser().getId(), userInfoModel.getSecUser().getId(),
userInfoModel.getSecUser().getUserName() userInfoModel.getSecUser().getUserName()
); );
@ -132,7 +124,7 @@ public class OrderRefundController {
order, body.getString("childOrderNo"), order, body.getString("childOrderNo"),
body.getInteger("refundGoodsNum"), body.getInteger("refundGoodsNum"),
body.getString("remarks"), body.getString("remarks"),
OrderRefundOrderOpUserType.TYPE2, OrderRefundOpUserType.TYPE2,
userInfoModel.getSecUser().getId(), userInfoModel.getSecUser().getId(),
userInfoModel.getSecUser().getUserName() userInfoModel.getSecUser().getUserName()
); );

@ -5,7 +5,7 @@ import com.hai.entity.HighOrder;
import com.hai.entity.HighOrderRefund; import com.hai.entity.HighOrderRefund;
import com.hai.order.model.RefundPriceModel; import com.hai.order.model.RefundPriceModel;
import com.hai.order.type.OrderPayType; import com.hai.order.type.OrderPayType;
import com.hai.order.type.OrderRefundOrderOpUserType; import com.hai.order.type.OrderRefundOpUserType;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List; import java.util.List;
@ -30,7 +30,7 @@ public interface OrderRefundService {
* @param order 交易订单 * @param order 交易订单
* @param remarks 退款备注 * @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 refundGoodsCount 退款商品数量
* @param remarks 退款备注 * @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;
/** /**
* 交易退钱 * 交易退钱

@ -1,10 +1,9 @@
package com.hai.order.service; package com.hai.order.service;
import com.alicp.jetcache.anno.CacheUpdate;
import com.hai.entity.HighChildOrder; import com.hai.entity.HighChildOrder;
import com.hai.entity.HighOrder; import com.hai.entity.HighOrder;
import com.hai.order.model.CreateOrderModel; 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.List;
import java.util.Map; import java.util.Map;
@ -51,7 +50,7 @@ public interface OrderService {
* @param remarks * @param remarks
* @return * @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 * @param remarks
* @return * @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;
/** /**
* 根据订单号查询交易订单号详情 * 根据订单号查询交易订单号详情

@ -31,7 +31,6 @@ import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
* @className: OrderRefundServiceImpl * @className: OrderRefundServiceImpl
@ -62,7 +61,7 @@ public class OrderRefundServiceImpl implements OrderRefundService {
} }
@Override @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()) { for (HighChildOrder orderChild : order.getHighChildOrderList()) {
// 创建退款记录 // 创建退款记录
HighOrderRefund orderRefund = createOrderChildRefund(orderChild, refundOrderNo, orderChild.getSaleCount(), remarks, opUserType,opUserId,opUserName); HighOrderRefund orderRefund = createOrderChildRefund(orderChild, refundOrderNo, orderChild.getSaleCount(), remarks, opUserType,opUserId,opUserName);
@ -77,7 +76,7 @@ public class OrderRefundServiceImpl implements OrderRefundService {
} }
@Override @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()) if (!orderChild.getChildOrderStatus().equals(OrderChildStatus.STATUS2.getNumber())
&& !orderChild.getChildOrderStatus().equals(OrderChildStatus.STATUS3.getNumber())){ && !orderChild.getChildOrderStatus().equals(OrderChildStatus.STATUS3.getNumber())){
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "子订单状态错误"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "子订单状态错误");

@ -8,12 +8,10 @@ import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode; import com.hai.common.exception.SysCode;
import com.hai.common.security.AESEncodeUtil; import com.hai.common.security.AESEncodeUtil;
import com.hai.common.utils.DateUtil;
import com.hai.dao.HighChildOrderMapper; import com.hai.dao.HighChildOrderMapper;
import com.hai.dao.HighOrderMapper; import com.hai.dao.HighOrderMapper;
import com.hai.entity.*; import com.hai.entity.*;
import com.hai.enum_type.DiscountUseScope; import com.hai.enum_type.DiscountUseScope;
import com.hai.enum_type.OrderStatusEnum;
import com.hai.order.model.CreateOrderChildModel; import com.hai.order.model.CreateOrderChildModel;
import com.hai.order.model.CreateOrderModel; import com.hai.order.model.CreateOrderModel;
import com.hai.order.model.RefundPriceModel; import com.hai.order.model.RefundPriceModel;
@ -24,8 +22,6 @@ import com.hai.order.utils.OrderUtil;
import com.hai.service.*; import com.hai.service.*;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils; 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.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.integration.support.MessageBuilder; import org.springframework.integration.support.MessageBuilder;
import org.springframework.messaging.Message; import org.springframework.messaging.Message;
@ -506,7 +502,7 @@ public class OrderServiceImpl implements OrderService {
timeout = 10, timeout = 10,
rollbackFor = Exception.class) rollbackFor = Exception.class)
@CacheUpdate(name = "order:", key = "#order.orderNo", value = "#order") @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()) if (!order.getOrderStatus().equals(OrderStatus.STATUS2.getNumber())
&& !order.getOrderStatus().equals(OrderStatus.STATUS3.getNumber())) { && !order.getOrderStatus().equals(OrderStatus.STATUS3.getNumber())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单状态错误"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单状态错误");
@ -569,7 +565,7 @@ public class OrderServiceImpl implements OrderService {
timeout = 10, timeout = 10,
rollbackFor = Exception.class) rollbackFor = Exception.class)
@CacheUpdate(name = "order:", key = "#order.orderNo", value = "#order") @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<HighChildOrder> collect = order.getHighChildOrderList().stream().filter(o -> o.getChildOrderNo().equals(childOrderNo)).collect(Collectors.toList()); List<HighChildOrder> collect = order.getHighChildOrderList().stream().filter(o -> o.getChildOrderNo().equals(childOrderNo)).collect(Collectors.toList());
if (collect == null || collect.size() == 0) { if (collect == null || collect.size() == 0) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到订单"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到订单");

@ -7,7 +7,7 @@ import java.util.Objects;
* @author: HuRui * @author: HuRui
* @date: 2022/11/2 * @date: 2022/11/2
**/ **/
public enum OrderRefundOrderOpUserType { public enum OrderRefundOpUserType {
TYPE1(1, "系统"), TYPE1(1, "系统"),
TYPE2(2, "管理员"), TYPE2(2, "管理员"),
TYPE3(3, "用户"), TYPE3(3, "用户"),
@ -17,7 +17,7 @@ public enum OrderRefundOrderOpUserType {
private String name; private String name;
OrderRefundOrderOpUserType(int number, String name) { OrderRefundOpUserType(int number, String name) {
this.number = number; this.number = number;
this.name = name; this.name = name;
} }
@ -27,8 +27,8 @@ public enum OrderRefundOrderOpUserType {
* @param type * @param type
* @return * @return
*/ */
public static OrderRefundOrderOpUserType getDataByType(Integer type) { public static OrderRefundOpUserType getDataByType(Integer type) {
for (OrderRefundOrderOpUserType ele : values()) { for (OrderRefundOpUserType ele : values()) {
if(Objects.equals(type,ele.getNumber())) return ele; if(Objects.equals(type,ele.getNumber())) return ele;
} }
return null; return null;
Loading…
Cancel
Save