From d61840f8cf23015f9d2012d7231e21cdf062cd54 Mon Sep 17 00:00:00 2001
From: mitao <2763622819@qq.com>
Date: 星期四, 27 十一月 2025 15:01:55 +0800
Subject: [PATCH] 用户端退款修改
---
UserJYXTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java | 40 +++++++++++++++++++++++++++++++---------
1 files changed, 31 insertions(+), 9 deletions(-)
diff --git a/UserJYXTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java b/UserJYXTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java
index 426c175..5a54529 100644
--- a/UserJYXTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java
+++ b/UserJYXTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java
@@ -5,11 +5,13 @@
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
+import com.stylefeng.guns.core.util.RequestSeqUtil;
import com.stylefeng.guns.core.util.ToolUtil;
import com.stylefeng.guns.modular.account.controller.AppOrderController;
import com.stylefeng.guns.modular.crossCity.dao.OrderCrossCityMapper;
import com.stylefeng.guns.modular.crossCity.model.OrderCrossCity;
import com.stylefeng.guns.modular.huifu.biz.DouGongPayUtil;
+import com.stylefeng.guns.modular.huifu.biz.DouGongRefundBiz;
import com.stylefeng.guns.modular.smallLogistics.dao.OrderLogisticsMapper;
import com.stylefeng.guns.modular.smallLogistics.model.OrderLogistics;
import com.stylefeng.guns.modular.smallLogistics.model.OrderLogisticsSpread;
@@ -147,6 +149,8 @@
@Value("${callbackPath}")
private String callbackPath;
+ @Autowired
+ private DouGongRefundBiz douGongRefundBiz;
private static List<Integer> orderIds = new ArrayList<>();
@@ -1188,13 +1192,22 @@
boolean b = false;
System.out.println("支付方式:"+query.getPayType());
if(query.getPayType() == 1){//微信
- Map<String, String> map = payMoneyUtil.wxRefund(query.getCode(), orderLogistics.getId() + "_" + orderLogistics.getType(), query.getAmount().toString(), query.getAmount().toString(), "/base/cancleOrderWXPay");
- System.out.println("map:"+map);
- if(!"SUCCESS".equals(map.get("return_code"))){
- return ResultUtil.error(map.get("return_msg"));
+ //Map<String, String> map = payMoneyUtil.wxRefund(query.getCode(), orderLogistics.getId() + "_" + orderLogistics.getType(), query.getAmount().toString(), query.getAmount().toString(), "/base/cancleOrderWXPay");
+ //System.out.println("map:"+map);
+ //if(!"SUCCESS".equals(map.get("return_code"))){
+ // return ResultUtil.error(map.get("return_msg"));
+ //}
+ String refundReqSeqId = RequestSeqUtil.generate("TK");
+ Map<String, Object> refund = douGongRefundBiz.refund(refundReqSeqId, BigDecimal.valueOf(query.getAmount()), com.stylefeng.guns.core.util.DateUtil.format(query.getInsertTime(), "yyyyMMdd"), orderLogistics.getOutTradeNo(), 1);
+ orderLogistics.setRefundReqSeqId(refundReqSeqId);
+ if ("00000000".equals(refund.get("resp_code")) && "S".equals(refund.get("trans_stat"))) {
+ orderLogistics.setState(10);
+ }else if (!"00000000".equals(refund.get("resp_code"))) {
+ return ResultUtil.error("订单取消失败:" + refund.get("resp_desc").toString());
}
+ orderLogisticsMapper.updateById(orderLogistics);
}
- if(query.getPayType()==4){
+ /* if(query.getPayType()==4){
UserInfo userInfo = userInfoService.selectById(orderLogistics.getUserId());
userInfo.setBalance(userInfo.getBalance() + orderLogistics.getPayMoney());
userInfoService.updateById(userInfo);
@@ -1207,15 +1220,24 @@
orderLogistics.setCouponMoney(0.00);
// TODO 设置优惠券id回滚
// orderLogistics.setCouponId(null);
- }else if(query.getPayType()==2){//支付宝
- Map<String, String> map = payMoneyUtil.aliRefund(query.getCode(), query.getAmount().toString());
+ }else */if(query.getPayType()==2){//支付宝
+ //Map<String, String> map = payMoneyUtil.aliRefund(query.getCode(), query.getAmount().toString());
UserCouponRecord userCouponRecord = userCouponRecordService.selectById(couponId);
userCouponRecord.setState(1);
userCouponRecordService.updateById(userCouponRecord);
orderLogistics.setCouponMoney(0.00);
- if(!"10000".equals(map.get("code"))){
- return ResultUtil.error(map.get("msg"));
+ //if(!"10000".equals(map.get("code"))){
+ // return ResultUtil.error(map.get("msg"));
+ //}
+ String refundReqSeqId = RequestSeqUtil.generate("TK");
+ Map<String, Object> refund = douGongRefundBiz.refund(refundReqSeqId, BigDecimal.valueOf(query.getAmount()), com.stylefeng.guns.core.util.DateUtil.format(query.getInsertTime(), "yyyyMMdd"), orderLogistics.getOutTradeNo(), 1);
+ orderLogistics.setRefundReqSeqId(refundReqSeqId);
+ if ("00000000".equals(refund.get("resp_code")) && "S".equals(refund.get("trans_stat"))) {
+ orderLogistics.setState(10);
+ }else if (!"00000000".equals(refund.get("resp_code"))) {
+ return ResultUtil.error("订单取消失败:" + refund.get("resp_desc").toString());
}
+ orderLogisticsMapper.updateById(orderLogistics);
}
--
Gitblit v1.7.1