This commit is contained in:
starrySky
2024-08-23 17:23:43 +08:00
parent 9ce441bca1
commit 436972bed8
4 changed files with 55 additions and 17 deletions

View File

@@ -8,9 +8,11 @@ import com.starry.admin.modules.order.module.entity.PlayOrderRandomInfoEntity;
import com.starry.admin.modules.order.module.vo.*; import com.starry.admin.modules.order.module.vo.*;
import com.starry.admin.modules.order.service.IPlayOrderInfoService; import com.starry.admin.modules.order.service.IPlayOrderInfoService;
import com.starry.admin.modules.order.service.IPlayOrderRandomInfoService; import com.starry.admin.modules.order.service.IPlayOrderRandomInfoService;
import com.starry.admin.modules.order.service.IPlayOrderRefundInfoService;
import com.starry.admin.modules.shop.module.vo.PlayCommodityInfoVo; import com.starry.admin.modules.shop.module.vo.PlayCommodityInfoVo;
import com.starry.admin.modules.shop.service.IPlayCommodityInfoService; import com.starry.admin.modules.shop.service.IPlayCommodityInfoService;
import com.starry.admin.modules.weichat.service.WxCustomMpService; import com.starry.admin.modules.weichat.service.WxCustomMpService;
import com.starry.admin.utils.SecurityUtils;
import com.starry.common.annotation.Log; import com.starry.common.annotation.Log;
import com.starry.common.context.CustomSecurityContextHolder; import com.starry.common.context.CustomSecurityContextHolder;
import com.starry.common.enums.BusinessType; import com.starry.common.enums.BusinessType;
@@ -44,6 +46,9 @@ public class PlayOrderInfoController {
@Resource @Resource
private IPlayCommodityInfoService playCommodityInfoService; private IPlayCommodityInfoService playCommodityInfoService;
@Resource
private IPlayOrderRefundInfoService playOrderRefundInfoService;
/** /**
* 分页查询订单列表 * 分页查询订单列表
@@ -79,8 +84,13 @@ public class PlayOrderInfoController {
// 订单退款,订单状态变为已取消 // 订单退款,订单状态变为已取消
updateOrderInfo.setOrderStatus("4"); updateOrderInfo.setOrderStatus("4");
updateOrderInfo.setRefundAmount(vo.getRefundAmount()); updateOrderInfo.setRefundAmount(vo.getRefundAmount());
updateOrderInfo.setRefundReason(vo.getRefundReason()); // 修改订单状态
return R.ok(orderInfoService.update(updateOrderInfo)); orderInfoService.update(updateOrderInfo);
// 记录退款信息
String refundType = orderInfo.getFinalAmount().compareTo(vo.getRefundAmount()) == 0 ? "0" : "1";
playOrderRefundInfoService.add(orderInfo.getId(), orderInfo.getPurchaserBy(), orderInfo.getAcceptBy(), orderInfo.getPayMethod(), refundType, vo.getRefundAmount(), vo.getRefundReason(), "2", SecurityUtils.getUserId(), "0", "0");
return R.ok("退款成功");
} }

View File

@@ -6,6 +6,8 @@ import com.starry.admin.modules.order.module.entity.PlayOrderRefundInfoEntity;
import com.starry.admin.modules.order.module.vo.PlayOrderRefundQueryVo; import com.starry.admin.modules.order.module.vo.PlayOrderRefundQueryVo;
import com.starry.admin.modules.order.module.vo.PlayOrderRefundReturnVo; import com.starry.admin.modules.order.module.vo.PlayOrderRefundReturnVo;
import java.math.BigDecimal;
/** /**
* 订单退款信息Service接口 * 订单退款信息Service接口
* *
@@ -46,6 +48,26 @@ public interface IPlayOrderRefundInfoService extends IService<PlayOrderRefundInf
*/ */
IPage<PlayOrderRefundInfoEntity> selectPlayOrderRefundInfoByPage(PlayOrderRefundInfoEntity playOrderRefundInfo); IPage<PlayOrderRefundInfoEntity> selectPlayOrderRefundInfoByPage(PlayOrderRefundInfoEntity playOrderRefundInfo);
/**
* 新增退款信息
*
* @param orderId 订单ID
* @param customId 顾客ID
* @param clerkId 店员ID
* @param payMethod 支付方式,[0:余额支付;1:微信支付,2:支付宝支付]
* @param refundType 退款类型【0:部分退款;1:全部退款】
* @param refundAmount 退款金额
* @param refundReason 退款原因
* @param refundByType 退款人类型[0:顾客;1:店员;2:管理员]
* @param refundById 退款人ID
* @param refundState 退款状态[-1:异常;0:处理中;1:成功;2:关闭]
* @param reviewedRequired 是否需要审核0:不需要1:需要
* @author xuhq
* @since 2024/8/23 17:10
**/
void add(String orderId, String customId, String clerkId, String payMethod, String refundType, BigDecimal refundAmount, String refundReason, String refundByType, String refundById, String refundState, String reviewedRequired);
/** /**
* 新增订单退款信息 * 新增订单退款信息
* *

View File

@@ -747,21 +747,9 @@ public class PlayOrderInfoServiceImpl extends ServiceImpl<PlayOrderInfoMapper, P
PlayCustomUserInfoEntity customUserInfo = customUserInfoService.getById(orderInfo.getPurchaserBy()); PlayCustomUserInfoEntity customUserInfo = customUserInfoService.getById(orderInfo.getPurchaserBy());
customUserInfoService.updateAccountBalanceById(customUserInfo.getId(), customUserInfo.getAccountBalance(), customUserInfo.getAccountBalance().add(orderInfo.getOrderMoney()), "3", "订单退款", orderInfo.getOrderMoney(), BigDecimal.ZERO, orderId); customUserInfoService.updateAccountBalanceById(customUserInfo.getId(), customUserInfo.getAccountBalance(), customUserInfo.getAccountBalance().add(orderInfo.getOrderMoney()), "3", "订单退款", orderInfo.getOrderMoney(), BigDecimal.ZERO, orderId);
// 取消订单后,记录退款信息 // 取消订单后,记录退款信息
PlayOrderRefundInfoEntity orderRefundInfo = new PlayOrderRefundInfoEntity(); playOrderRefundInfoService.add(orderId,orderInfo.getPurchaserBy(),orderInfo.getAcceptBy(),orderInfo.getPayMethod(),
orderRefundInfo.setOrderId(orderId); "0",
orderRefundInfo.setCustomId(orderInfo.getPurchaserBy()); orderInfo.getFinalAmount(),refundReason,operatorByType,operatorBy,"0","0");
orderRefundInfo.setClerkId(orderInfo.getAcceptBy());
orderRefundInfo.setPayMethod(orderInfo.getPayMethod());
orderRefundInfo.setRefundType("0");
orderRefundInfo.setRefundAmount(orderInfo.getFinalAmount());
orderRefundInfo.setRefundReason(refundReason);
orderRefundInfo.setRefundByType(operatorByType);
orderRefundInfo.setRefundById(operatorBy);
orderRefundInfo.setRefundState("0");
orderRefundInfo.setReviewedRequired("0");
playOrderRefundInfoService.create(orderRefundInfo);
} }
@Override @Override

View File

@@ -15,6 +15,7 @@ import com.starry.common.utils.IdUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Arrays; import java.util.Arrays;
/** /**
@@ -65,6 +66,23 @@ public class PlayOrderRefundInfoServiceImpl extends ServiceImpl<PlayOrderRefundI
return this.baseMapper.selectPage(page, new LambdaQueryWrapper<PlayOrderRefundInfoEntity>()); return this.baseMapper.selectPage(page, new LambdaQueryWrapper<PlayOrderRefundInfoEntity>());
} }
@Override
public void add(String orderId, String customId, String clerkId, String payMethod, String refundType, BigDecimal refundAmount, String refundReason, String refundByType, String refundById, String refundState, String reviewedRequired) {
PlayOrderRefundInfoEntity orderRefundInfo = new PlayOrderRefundInfoEntity();
orderRefundInfo.setOrderId(orderId);
orderRefundInfo.setCustomId(customId);
orderRefundInfo.setClerkId(clerkId);
orderRefundInfo.setPayMethod(payMethod);
orderRefundInfo.setRefundType(refundType);
orderRefundInfo.setRefundAmount(refundAmount);
orderRefundInfo.setRefundReason(refundReason);
orderRefundInfo.setRefundByType(refundByType);
orderRefundInfo.setRefundById(refundById);
orderRefundInfo.setRefundState(refundState);
orderRefundInfo.setReviewedRequired(reviewedRequired);
this.save(orderRefundInfo);
}
/** /**
* 新增订单退款信息 * 新增订单退款信息
* *