Commit 89d22e01 by YG8999

退款成功删除订单redis缓存

parent 60fa1790
......@@ -10,5 +10,5 @@ import share.system.request.OrderRefundRequest;
*/
public interface OrderRefundService extends IService<SOrder> {
void refund(OrderRefundRequest request, SOrder storeOrder);
boolean refund(OrderRefundRequest request, SOrder storeOrder);
}
......@@ -57,10 +57,10 @@ public class OrderRefundServiceImpl extends ServiceImpl<SOrderMapper, SOrder> im
* @since 2020-06-03
*/
@Override
public void refund(OrderRefundRequest request, SOrder sOrder) {
public boolean refund(OrderRefundRequest request, SOrder sOrder) {
// refundWx(request, sOrder);
// 扫呗-微信退款
refundSaobei(request, sOrder);
return refundSaobei(request, sOrder);
}
/**
......@@ -98,7 +98,7 @@ public class OrderRefundServiceImpl extends ServiceImpl<SOrderMapper, SOrder> im
* @param request
* @param sOrder
*/
private void refundSaobei(OrderRefundRequest request, SOrder sOrder) {
private boolean refundSaobei(OrderRefundRequest request, SOrder sOrder) {
WechatPayInfo wechatPayInfo = wechatPayInfoService.getByNo(sOrder.getOutTradeNo());
if (ObjectUtil.isNull(wechatPayInfo)) {
throw new BaseException("微信订单不存在!");
......@@ -133,6 +133,7 @@ public class OrderRefundServiceImpl extends ServiceImpl<SOrderMapper, SOrder> im
if (update) {
// 退款task,定时任务退优惠券
redisUtil.lPush(Constants.ORDER_TASK_REDIS_KEY_AFTER_REFUND_BY_USER, order.getId());
return update;
} else {
throw new BaseException("退款失败");
}
......
......@@ -764,7 +764,12 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
//退款
if (sOrder.getPayType().equals(PayTypeEnum.WECHAT.getCode()) && request.getAmount().compareTo(BigDecimal.ZERO) > 0) {
try {
orderRefundService.refund(request, sOrder);
boolean isRefund = orderRefundService.refund(request, sOrder);
// 退款成功
if (isRefund) {
// 删除redis 缓存信息,防止退款订单自动开始及给用户发送提示短信
redisUtils.delete(ReceiptRdeisEnum.ORDER_NO.getValue() + sOrder.getOrderNo());
}
} catch (Exception e) {
e.printStackTrace();
throw new BaseException("微信申请退款失败!");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment