退单
This commit is contained in:
@@ -26,6 +26,10 @@ public class Constants {
|
||||
* 订单状态 - 交易失败
|
||||
*/
|
||||
public static final String ORDER_STATUS_FAIL = "4";
|
||||
/**
|
||||
* 订单状态 - 交易超时
|
||||
*/
|
||||
public static final String ORDER_STATUS_TIMEOUT = "5";
|
||||
/**
|
||||
* 订单状态 - 退款
|
||||
*/
|
||||
|
||||
@@ -34,6 +34,7 @@ import com.peanut.modules.common.dao.UserCourseBuyDao;
|
||||
import com.peanut.modules.common.entity.*;
|
||||
import com.peanut.modules.common.service.*;
|
||||
import com.peanut.modules.master.service.CourseCatalogueService;
|
||||
import com.peanut.modules.pay.alipay.dto.ReFundDTO;
|
||||
import com.peanut.modules.pay.alipay.service.AliPayService;
|
||||
import com.peanut.modules.pay.weChatPay.dto.WeChatRefundInfo;
|
||||
import com.peanut.modules.pay.weChatPay.dto.WechatPaymentInfo;
|
||||
@@ -672,9 +673,6 @@ public class BuyOrderController {
|
||||
|| Constants.ORDER_STATUS_OUT_OF_TIME.equals(buyOrder.getOrderStatus())) {
|
||||
return R.error("当前订单状态不支持退单");
|
||||
}
|
||||
if(Constants.PAYMENT_METHOD_ALI_PAY.equals(buyOrder.getPaymentMethod())){
|
||||
return R.error("当前订单支付方式暂不支持退单");
|
||||
}
|
||||
//设置状态为退款中
|
||||
buyOrder.setOrderStatus(Constants.ORDER_STATUS_REFUNDING);
|
||||
buyOrderService.updateById(buyOrder);
|
||||
@@ -747,9 +745,14 @@ public class BuyOrderController {
|
||||
try {
|
||||
wxpayService.refund(weChatRefundInfo);
|
||||
} catch (Exception e) {
|
||||
System.out.println("msg=" + e.getMessage()); // 👈 关键
|
||||
System.out.println("msg=" + e.getMessage());
|
||||
}
|
||||
}
|
||||
}else if (Constants.PAYMENT_METHOD_ALI_PAY.equals(buyOrder.getPaymentMethod())) {
|
||||
buyOrderRefundLogService.insertRefundLog(refundId,2,0);
|
||||
if (refundFee.compareTo(BigDecimal.ZERO) > 0) {
|
||||
aliPayService.refund(buyOrder,user,buyOrderRefund);
|
||||
}
|
||||
}
|
||||
// else if (Constants.PAYMENT_METHOD_ALI_PAY.equals(buyOrder.getPaymentMethod())) {
|
||||
// buyOrderRefundLogService.insertRefundLog(refundId,2,0);
|
||||
|
||||
@@ -35,7 +35,8 @@ public interface MyUserService extends IService<MyUserEntity> {
|
||||
|
||||
boolean checkUserTelOrEmail(MyUserEntity user);
|
||||
|
||||
void rollbackUserPowers(BuyOrder order, List<BuyOrderProduct> orderProducts);
|
||||
//void rollbackUserPowers(BuyOrder order, List<BuyOrderProduct> orderProducts);
|
||||
|
||||
void rollbackUserPowers(BuyOrder order, MyUserEntity user, List<BuyOrderProduct> orderProducts);
|
||||
}
|
||||
|
||||
|
||||
@@ -480,7 +480,7 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
|
||||
BuyOrderRefund refundInfo = buyOrderRefundService.getRefundInfoByOrderId(b.getOrderId());
|
||||
b.setRefundRemark(refundInfo.getRemark());
|
||||
}
|
||||
b.setRefundableStatus(b.getOrderStatus().equals("6")|| b.getOrderStatus().equals("7")||Constants.PAYMENT_METHOD_ALI_PAY.equals(b.getPaymentMethod())?false:refundableStatus);
|
||||
b.setRefundableStatus(b.getOrderStatus().equals("6")|| b.getOrderStatus().equals("7")?false:refundableStatus);
|
||||
b.setProductList(buyOrderProducts);
|
||||
//设置快递信息传递给前端
|
||||
ConsigneeVo consigneeVo = new ConsigneeVo();
|
||||
@@ -585,7 +585,7 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
|
||||
}
|
||||
}
|
||||
}
|
||||
b.setRefundableStatus(b.getOrderStatus().equals("6") || b.getOrderStatus().equals("7") || Constants.PAYMENT_METHOD_ALI_PAY.equals(b.getPaymentMethod())?false:refundableStatus);
|
||||
b.setRefundableStatus(b.getOrderStatus().equals("6") || b.getOrderStatus().equals("7")?false:refundableStatus);
|
||||
b.setProductList(buyOrderProducts);
|
||||
b.setTimestamp(b.getCreateTime().getTime()/1000);
|
||||
//充值订单填充充值商品信息
|
||||
@@ -1084,8 +1084,8 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
|
||||
}else{
|
||||
//撤回本订单购买赠送的优惠券
|
||||
couponService.refundZSCouponHistoryByOrder(buyOrder);
|
||||
/*//恢复用户权益(点穴/时辰取穴/五运六气/肿瘤古方)
|
||||
myUserService.rollbackUserPowers(buyOrder, orderProducts);*/
|
||||
//恢复用户权益(点穴/时辰取穴/五运六气/肿瘤古方)
|
||||
myUserService.rollbackUserPowers(buyOrder,user, orderProducts);
|
||||
//撤回电子书权限
|
||||
userEbookBuyService.rollbackUserEbooks(buyOrder, orderProducts);
|
||||
//撤回课程权限
|
||||
|
||||
@@ -102,9 +102,8 @@ public class MyUserServiceImpl extends ServiceImpl<MyUserDao, MyUserEntity> impl
|
||||
MyUserEntity one = getOne(wrapper);
|
||||
return one == null;
|
||||
}
|
||||
|
||||
public void rollbackUserPowers(BuyOrder order, List<BuyOrderProduct> orderProducts) {
|
||||
MyUserEntity user = getById(order.getUserId());
|
||||
@Override
|
||||
public void rollbackUserPowers(BuyOrder order, MyUserEntity user, List<BuyOrderProduct> orderProducts) {
|
||||
if(user == null){
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
|
||||
b.setExpressList(expressOrders);
|
||||
}
|
||||
}
|
||||
b.setRefundableStatus(b.getOrderStatus().equals("6") || b.getOrderStatus().equals("7")|| Constants.PAYMENT_METHOD_ALI_PAY.equals(b.getPaymentMethod())?false:refundableStatus);
|
||||
b.setRefundableStatus(b.getOrderStatus().equals("6") || b.getOrderStatus().equals("7")?false:refundableStatus);
|
||||
}
|
||||
}
|
||||
return page;
|
||||
|
||||
@@ -1,17 +1,7 @@
|
||||
package com.peanut.modules.pay.alipay.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.config.Constants;
|
||||
import com.peanut.modules.book.service.BuyOrderService;
|
||||
import com.peanut.modules.book.service.MyUserService;
|
||||
import com.peanut.modules.common.entity.BuyOrder;
|
||||
import com.peanut.modules.common.entity.BuyOrderRefund;
|
||||
import com.peanut.modules.common.entity.BuyOrderRefundLog;
|
||||
import com.peanut.modules.common.entity.MyUserEntity;
|
||||
import com.peanut.modules.common.service.BuyOrderRefundLogService;
|
||||
import com.peanut.modules.common.service.BuyOrderRefundService;
|
||||
import com.peanut.modules.pay.alipay.dto.AlipayDTO;
|
||||
import com.peanut.modules.pay.alipay.dto.ReFundDTO;
|
||||
import com.peanut.modules.pay.alipay.service.AliPayService;
|
||||
@@ -21,8 +11,6 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@@ -36,14 +24,6 @@ public class AliPayController {
|
||||
|
||||
@Autowired
|
||||
private AliPayService aliPayService;
|
||||
@Autowired
|
||||
private BuyOrderService buyOrderService;
|
||||
@Autowired
|
||||
private MyUserService myUserService;
|
||||
@Autowired
|
||||
private BuyOrderRefundService buyOrderRefundService;
|
||||
@Autowired
|
||||
private BuyOrderRefundLogService buyOrderRefundLogService;
|
||||
|
||||
/**
|
||||
* 请求支付宝接口支付
|
||||
@@ -70,65 +50,7 @@ public class AliPayController {
|
||||
*/
|
||||
@RequestMapping("/refund")
|
||||
public R refund(@RequestBody Map<String,Object> params) {
|
||||
Object orderIdObject = params.get("orderId");
|
||||
if(orderIdObject == null || orderIdObject.toString().trim().equals("")){
|
||||
return R.error("orderId不能为空");
|
||||
}
|
||||
int orderId = Integer.parseInt(orderIdObject.toString());
|
||||
QueryWrapper<BuyOrder> queryWapper = new QueryWrapper<>();
|
||||
queryWapper.eq("order_id",orderId);
|
||||
BuyOrder buyOrder = buyOrderService.getOne(queryWapper);
|
||||
if(buyOrder==null){
|
||||
return R.error("订单不存在");
|
||||
}
|
||||
MyUserEntity user = myUserService.getById(buyOrder.getUserId());
|
||||
if (user == null) {
|
||||
return R.error("订单对应用户不存在");
|
||||
}
|
||||
|
||||
if(Constants.ORDER_STATUS_REFUND.equals(buyOrder.getOrderStatus())
|
||||
|| Constants.ORDER_STATUS_REFUNDING.equals(buyOrder.getOrderStatus())){
|
||||
return R.error("请勿重复提交退款");
|
||||
}else if (Constants.ORDER_STATUS_TO_BE_PAID.equals(buyOrder.getOrderStatus())
|
||||
|| Constants.ORDER_STATUS_FAIL.equals(buyOrder.getOrderStatus())
|
||||
|| Constants.ORDER_STATUS_OUT_OF_TIME.equals(buyOrder.getOrderStatus())) {
|
||||
return R.error("当前订单状态不支持退单");
|
||||
}
|
||||
|
||||
buyOrder.setOrderStatus(Constants.ORDER_STATUS_REFUNDING);
|
||||
buyOrderService.updateById(buyOrder);
|
||||
|
||||
BigDecimal refundFee = buyOrder.getRealMoney();
|
||||
BigDecimal shippingMoney = buyOrder.getShippingMoney()==null?BigDecimal.ZERO:buyOrder.getShippingMoney();
|
||||
int deductShipping = params.containsKey("deductShipping") && params.get("deductShipping")!=null?Integer.parseInt(params.get("deductShipping").toString()):0;
|
||||
if(refundFee.compareTo(BigDecimal.ZERO)>0 && shippingMoney.compareTo(BigDecimal.ZERO)>0 && deductShipping==1){
|
||||
refundFee = refundFee.subtract(shippingMoney);
|
||||
refundFee = refundFee.compareTo(BigDecimal.ZERO)>0?refundFee:BigDecimal.ZERO;
|
||||
}
|
||||
String remark = params.containsKey("remark") && params.get("remark").toString()!=null?params.get("remark").toString():"";
|
||||
|
||||
BuyOrderRefund buyOrderRefund = new BuyOrderRefund();
|
||||
String refundNo = buyOrderRefundService.genRefundNo();
|
||||
buyOrderRefund.setRefundNo(refundNo);
|
||||
buyOrderRefund.setOrderId(buyOrder.getOrderId());
|
||||
buyOrderRefund.setOrderSn(buyOrder.getOrderSn());
|
||||
buyOrderRefund.setUserId(buyOrder.getUserId());
|
||||
buyOrderRefund.setType(params.containsKey("deductShipping")?"后台":"线上"); //id
|
||||
buyOrderRefund.setPayType(buyOrder.getPaymentMethod());
|
||||
buyOrderRefund.setFee(refundFee);
|
||||
buyOrderRefund.setJfDeduction(buyOrder.getJfDeduction());
|
||||
buyOrderRefund.setShippingMoney(deductShipping==1?buyOrder.getShippingMoney():BigDecimal.ZERO);
|
||||
buyOrderRefund.setDeductShipping(deductShipping);
|
||||
buyOrderRefund.setRemark(remark);
|
||||
buyOrderRefundService.save(buyOrderRefund);
|
||||
|
||||
buyOrderRefundLogService.insertRefundLog(buyOrderRefund.getId(),0,1);
|
||||
|
||||
int refundId = buyOrderRefund.getId();
|
||||
buyOrderRefundLogService.insertRefundLog(refundId,1,0);
|
||||
|
||||
|
||||
|
||||
log.info("in=====refund=========");
|
||||
String refund = aliPayService.refund(params);
|
||||
return R.ok().put("msg",refund);
|
||||
}
|
||||
|
||||
@@ -2,8 +2,13 @@ package com.peanut.modules.pay.alipay.service;
|
||||
|
||||
|
||||
|
||||
import com.peanut.modules.common.entity.BuyOrder;
|
||||
import com.peanut.modules.common.entity.BuyOrderRefund;
|
||||
import com.peanut.modules.common.entity.MyUserEntity;
|
||||
import com.peanut.modules.pay.alipay.dto.AlipayDTO;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@@ -30,4 +35,5 @@ public interface AliPayService {
|
||||
String refund(Map<String,Object> params);
|
||||
|
||||
|
||||
String refund(BuyOrder buyOrder, MyUserEntity user, BuyOrderRefund buyOrderRefund);
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@ import com.alipay.api.internal.util.AlipaySignature;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.peanut.common.utils.CopyUtils;
|
||||
import com.peanut.common.utils.OrderUtils;
|
||||
import com.peanut.config.Constants;
|
||||
import com.peanut.modules.book.service.BookBuyConfigService;
|
||||
import com.peanut.modules.book.service.BuyOrderService;
|
||||
@@ -26,6 +26,7 @@ import com.peanut.modules.pay.alipay.dto.ReFundDTO;
|
||||
import com.peanut.modules.pay.alipay.service.AliPayService;
|
||||
import com.peanut.modules.pay.refund.entity.PayRefundOrder;
|
||||
import com.peanut.modules.pay.refund.service.PayRefundOrderService;
|
||||
import com.qiniu.util.Json;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -34,6 +35,7 @@ import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -148,6 +150,7 @@ public class AliPayServiceImpl implements AliPayService {
|
||||
}
|
||||
log.info(">>>>>>>>>>支付宝回调 sign = {}, trade_status = {}, out_trade_no = {}, 参数 = {}", params.get("sign"),
|
||||
params.get("trade_status"), params.get("out_trade_no"), params.toString());
|
||||
log.info(params.get("out_trade_no"), params.toString());
|
||||
//调用SDK验证签名,验证是阿里回调,而不是其他恶意回调
|
||||
BuyOrder buyOrder = buyOrderService.getOne(new LambdaQueryWrapper<BuyOrder>()
|
||||
.eq(BuyOrder::getOrderSn,params.get("out_trade_no")));
|
||||
@@ -159,19 +162,33 @@ public class AliPayServiceImpl implements AliPayService {
|
||||
// log.error(">>>>>>>>>>验签结果 flag = {}", flag);
|
||||
if (flag) {
|
||||
log.info(">>>>>>>>>>验签通过");
|
||||
String refundStatus = params.get("refund_status");
|
||||
if(refundStatus!=null){
|
||||
String outTradeNo = params.get("out_trade_no");
|
||||
if ("REFUND_SUCCESS".equals(refundStatus)) {
|
||||
String outBizNo = params.get("out_biz_no"); // 退款单号
|
||||
String refundAmount = params.get("refund_amount");// 退款金额
|
||||
// 业务:更新退款流水、订单退款状态、幂等判断
|
||||
log.info("退款回调:订单=" + outTradeNo + ",退款单号=" + outBizNo);
|
||||
}
|
||||
}
|
||||
|
||||
//验签通过 获取交易状态
|
||||
String tradeStatus = params.get("trade_status");
|
||||
if(params.containsKey("out_biz_no") && params.containsKey("gmt_refund") && params.containsKey("refund_fee")){
|
||||
|
||||
PayRefundOrder refund = new PayRefundOrder();
|
||||
refund.setPayType("2");
|
||||
refund.setRefundId(params.get("out_biz_no").toString());
|
||||
refund.setTradeNo(params.get("trade_no").toString());
|
||||
refund.setOrderSn(params.get("out_trade_no").toString());
|
||||
refund.setRefundFee(params.get("refund_fee").toString());
|
||||
refundOrderService.save(refund);
|
||||
|
||||
String toJSON = JSONObject.toJSONString(params);
|
||||
PayZfbOrderEntity aliNotifyDto = JSONObject.toJavaObject(JSON.parseObject(toJSON), PayZfbOrderEntity.class);
|
||||
|
||||
PayZfbOrderEntity payZfbOrderEntity = payZfbOrderService.getOne(new QueryWrapper<PayZfbOrderEntity>().eq("trade_no", aliNotifyDto.getTradeNo()));
|
||||
payZfbOrderEntity.setOutBizNo(refund.getRefundId());
|
||||
payZfbOrderEntity.setTradeStatus(tradeStatus);
|
||||
payZfbOrderEntity.setRefundFee(refund.getRefundFee());
|
||||
String PATTERN = "yyyy-MM-dd HH:mm:ss";
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(PATTERN);
|
||||
payZfbOrderEntity.setGmtCreate(sdf.parse(params.get("gmt_create").toString()));
|
||||
payZfbOrderEntity.setGmtRefund(sdf.parse(params.get("gmt_refund").toString()));
|
||||
payZfbOrderEntity.setGmtClose(sdf.parse(params.get("gmt_close").toString()));
|
||||
payZfbOrderService.updateById(payZfbOrderEntity);
|
||||
return "success";
|
||||
}
|
||||
//只处理支付成功的订单: 修改交易表状态,支付成功
|
||||
//只有交易通知状态为TRADE_SUCCESS或TRADE_FINISHED时,支付宝才会认定为买家付款成功。
|
||||
if (tradeStatus.equals("TRADE_SUCCESS") || tradeStatus.equals("TRADE_FINISHED")) {
|
||||
@@ -339,7 +356,6 @@ public class AliPayServiceImpl implements AliPayService {
|
||||
return "fail";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public String refund(Map<String,Object> params) {
|
||||
@@ -377,6 +393,7 @@ public class AliPayServiceImpl implements AliPayService {
|
||||
MPJLambdaWrapper<BuyOrder> w = new MPJLambdaWrapper();
|
||||
w.leftJoin(PayZfbOrderEntity.class,PayZfbOrderEntity::getRelevanceoid, BuyOrder::getOrderSn);
|
||||
w.eq("trade_no",((Map)res.get("alipay_trade_refund_response")).get("trade_no"));
|
||||
|
||||
BuyOrder order = buyOrderService.getOne(w);
|
||||
PayRefundOrder refund = new PayRefundOrder();
|
||||
refund.setPayType("2");
|
||||
@@ -400,6 +417,66 @@ public class AliPayServiceImpl implements AliPayService {
|
||||
return resJson;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public String refund(BuyOrder buyOrder, MyUserEntity user, BuyOrderRefund buyOrderRefund){
|
||||
|
||||
LambdaQueryWrapper<PayZfbOrderEntity> wrapper = new LambdaQueryWrapper();
|
||||
wrapper.eq(PayZfbOrderEntity::getRelevanceoid,buyOrder.getOrderSn());
|
||||
PayZfbOrderEntity payZfbOrder = payZfbOrderService.getOne(wrapper);
|
||||
//组装退款参数
|
||||
ReFundDTO reFundDTO = new ReFundDTO();
|
||||
reFundDTO.setOutTrandeNo(buyOrder.getOrderSn());
|
||||
reFundDTO.setTradeNo(payZfbOrder.getTradeNo());
|
||||
reFundDTO.setCustomerId(user.getId().toString());
|
||||
reFundDTO.setRefundReason("用户申请退款");
|
||||
reFundDTO.setRefundAmount(buyOrderRefund.getFee());
|
||||
reFundDTO.setOutRequestNo(buyOrderRefund.getRefundNo());
|
||||
|
||||
|
||||
|
||||
String mchName = "";
|
||||
if (("trainingClass".equals(buyOrder.getOrderType())||"lsorder".equals(buyOrder.getOrderType()))) {
|
||||
mchName = "LS";
|
||||
}
|
||||
reFundDTO.setMchName(mchName);
|
||||
log.info("========refundDto", JSON.toJSONString(reFundDTO));
|
||||
|
||||
//请求支付宝退款
|
||||
Map<String, Object> map = aliPayUtil.aliPayRefund(reFundDTO);
|
||||
|
||||
buyOrderRefundLogService.insertRefundLog(buyOrderRefund.getId(),2,2);
|
||||
|
||||
Object obj = map.get("msg");
|
||||
String resJson = obj.toString();
|
||||
log.info(">>>>>>>>>>>支付宝返回的信息是 resJson = {}", resJson);
|
||||
Map<String,Object> res = JSONObject.parseObject(resJson);
|
||||
//10000表示接口请求成功,Y表示资金变动成功
|
||||
if ("10000".equals(((Map)res.get("alipay_trade_refund_response")).get("code"))&&
|
||||
"Y".equals(((Map)res.get("alipay_trade_refund_response")).get("fund_change"))) {
|
||||
log.info(">>>>>>>>>>>支付宝退款成功!<<<<<<<<<<<<<");
|
||||
|
||||
/* PayRefundOrder refund = new PayRefundOrder();
|
||||
refund.setPayType("2");
|
||||
// refund.setRefundId(((Map)res.get("alipay_trade_refund_response")).get("out_request_no").toString());
|
||||
refund.setTradeNo(((Map)res.get("alipay_trade_refund_response")).get("trade_no").toString());
|
||||
refund.setOrderSn(((Map)res.get("alipay_trade_refund_response")).get("out_trade_no").toString());
|
||||
refund.setRefundFee(((Map)res.get("alipay_trade_refund_response")).get("refund_fee").toString());
|
||||
refundOrderService.save(refund);*/
|
||||
|
||||
BuyOrderRefund refundInfo = buyOrderRefundService.getOne(new QueryWrapper<BuyOrderRefund>().eq("order_id",buyOrder.getOrderId()));
|
||||
refundInfo.setStatus(1);
|
||||
refundInfo.setWxRefundNo(refundInfo.getRefundNo());
|
||||
buyOrderRefundService.updateById(refundInfo);
|
||||
|
||||
buyOrderService.refundOrder(buyOrder,user,refundInfo.getId());
|
||||
|
||||
buyOrderRefundLogService.insertRefundLog(refundInfo.getId(),2,1);
|
||||
|
||||
buyOrderService.updateOrderStatus(buyOrder.getUserId(),buyOrder.getOrderSn(),"6");
|
||||
}
|
||||
return resJson;
|
||||
}
|
||||
private void userCoinJf(BuyOrder order){
|
||||
MyUserEntity userEntity = userService.getById(order.getUserId());
|
||||
userEntity.setJf(userEntity.getJf().subtract(order.getJfDeduction()));
|
||||
|
||||
@@ -470,6 +470,8 @@ public class WxpayServiceImpl extends ServiceImpl<PayWechatOrderDao, PayWechatOr
|
||||
refund.setRefundId(resourceMap.get("refund_id").toString());
|
||||
refund.setTradeNo(resourceMap.get("transaction_id").toString());
|
||||
refund.setOrderSn(resourceMap.get("out_trade_no").toString());
|
||||
String refundFeeStr = ((Map)resourceMap.get("amount")).get("refund").toString();
|
||||
BigDecimal refundFee = new BigDecimal(refundFeeStr).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP);
|
||||
refund.setRefundFee(((Map)resourceMap.get("amount")).get("refund").toString());
|
||||
refundOrderService.save(refund);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user