skyline пре 1 година
родитељ
комит
863869eebb

+ 15 - 27
admin-web/src/views/admin/finance/refund.vue

@@ -144,39 +144,27 @@ const state = reactive({
   importConfig: {},
   exportConfig: {},
   columns: [
-    {label: '微信支付退款单号', width: 180, prop: 'refundId', query: true, type: 'text', resizable: true},
-    {label: '商户退款单号', width: 180, prop: 'outRefundNo', query: true, type: 'text', resizable: true},
-    {label: '微信支付订单号', width: 180, prop: 'transactionId', query: true, type: 'text', resizable: true},
-    {label: '商户订单号', width: 180, prop: 'outTradeNo', query: true, type: 'text', resizable: true},
-    {label: '退款渠道', width: 180, prop: 'channel', query: true, type: 'text', resizable: true},
-    {label: '退款入账账户', width: 180, prop: 'userReceivedAccount', query: false, type: 'text', resizable: true},
-    {label: '退款成功时间', width: 180, prop: 'successTime', query: true, sortable: 'custom', type: 'datetime', resizable: true, conf: {format: (val: any) => u.fmt.fmtDateTime(val)}},
+    {label: '手机号', width: 120, prop: 'mobilePhone', query: true, type: 'text', resizable: true},
+    {label: '微信支付退款单号', width: 180, prop: 'refundLogId', type: 'text', resizable: true},
+    {label: '商户支付单号', width: 210, prop: 'outTradeNo', type: 'text', resizable: true},
+    {label: '商户退款单号', width: 210, prop: 'outRefundNo', type: 'text', resizable: true},
+    {label: '原充值金额', width: 110, prop: 'total', type: 'number', resizable: true},
+    {label: '退款金额', width: 120, prop: 'refund', type: 'datetime', resizable: true},
+    // {label: '不可退优惠金额', width: 180, prop: 'discountAmount', query: false, type: 'number', resizable: true},
+    // {label: '退款渠道', width: 100, prop: 'channel', query: true, type: 'text', resizable: true},
+    {label: '申请时间', width: 180, prop: 'createTime', type: 'datetime', resizable: true, conf: {format: (val: any) => u.fmt.fmtDateTime(val)}},
+    {label: '退款成功时间', width: 180, prop: 'successTime', type: 'datetime', resizable: true, conf: {format: (val: any) => u.fmt.fmtDateTime(val)}},
     {
       label: '退款状态',
-      width: 180,
+      width: 100,
       prop: 'status',
       query: true,
       type: 'dict',
       resizable: true,
       conf: {dict: 'RefundLog.status'}
     },
-    {
-      label: '资金账户',
-      width: 180,
-      prop: 'fundsAccount',
-      query: true,
-      type: 'dict',
-      resizable: true,
-      conf: {dict: 'RefundLog.fundsAccount'}
-    },
-    {label: '订单金额', width: 180, prop: 'total', query: false, type: 'number', resizable: true},
-    {label: '退款金额', width: 180, prop: 'refund', query: false, type: 'number', resizable: true},
-    {label: '不可退优惠金额', width: 180, prop: 'discountAmount', query: false, type: 'number', resizable: true},
-    {label: '用户支付币种', width: 180, prop: 'currency', query: false, type: 'text', resizable: true},
-    {label: '退款原因', width: 180, prop: 'reason', query: true, type: 'text', resizable: true},
-    {label: '退款人', width: 180, prop: 'adminUsername', query: true, type: 'text', resizable: true},
-    {label: '退款创建(受理)时间', width: 180, prop: 'createTime', query: true, sortable: 'custom', type: 'datetime', resizable: true, conf: {format: (val: any) => u.fmt.fmtDateTime(val)}},
-    {label: '更新时间', width: 180, prop: 'updateTime', query: false, sortable: 'custom', type: 'datetime', resizable: true, conf: {format: (val: any) => u.fmt.fmtDateTime(val)}},
+    {label: '退款原因', width: 180, prop: 'reason', type: 'text', resizable: true},
+    {label: '退款人', width: 180, prop: 'adminUsername', type: 'text', resizable: true},
     {
       label: '操作', prop: 'action', type: 'render', width: 180, align: 'center', fixed: 'right',
     }
@@ -233,7 +221,7 @@ const loadData = (refresh: boolean = false) => {
 // 退款处理
 const handleRefundDealClick = (row: any) => {
   Msg.showLoading("退款处理中")
-  $get(`finance/customWxRefund/${row.id}`).then(res => {
+  $get(`finance/customWxRefund/${row.refundLogId}`).then(res => {
     Msg.message('退款系统处理中,请稍后查看结果')
     loadData(true)
   }).catch(e => {
@@ -258,4 +246,4 @@ const handleRowDelete = (row: any) => {
 // defineExpose({
 //     loadData,
 // });
-</script>
+</script>

+ 15 - 11
car-wash-service/src/main/java/com/kym/service/wechat/impl/WxPayServiceImpl.java

@@ -19,6 +19,7 @@ import com.kym.service.*;
 import com.kym.service.wechat.WxPayService;
 import com.wechat.pay.java.core.Config;
 import com.wechat.pay.java.core.RSAAutoCertificateConfig;
+import com.wechat.pay.java.core.exception.ServiceException;
 import com.wechat.pay.java.core.exception.ValidationException;
 import com.wechat.pay.java.core.http.DefaultHttpClientBuilder;
 import com.wechat.pay.java.core.http.okhttp.OkHttpClientAdapter;
@@ -404,7 +405,7 @@ public class WxPayServiceImpl implements WxPayService {
      */
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public void applyWxRefund(Long userId,String reason) {
+    public void applyWxRefund(Long userId, String reason) {
 //        var userId = StpUtil.getLoginIdAsLong();
         var washOrder = washOrderService.getOrderInProgressByUserId(userId);
         // 洗车未完结订单校验
@@ -545,16 +546,19 @@ public class WxPayServiceImpl implements WxPayService {
         amount.setTotal((long) refundLog.getTotal());
         amount.setCurrency(refundLog.getCurrency());
         request.setAmount(amount);
-        var refund = refundService.create(request);
-
-        refundLog.setChannel(refund.getChannel().name());
-        refundLog.setFundsAccount(refund.getFundsAccount().name());
-        refundLog.setCurrency(refund.getAmount().getCurrency());
-        refundLog.setAdminUserId(StpUtil.getLoginIdAsLong());
-        refundLog.setAdminUsername(StpUtil.getSession().getString("username"));
-        refundLog.setStatus(RefundLog.STATUS_退款处理中);
-        refundLogService.updateById(refundLog);
-
+        try {
+            var refund = refundService.create(request);
+            refundLog.setChannel(refund.getChannel().name());
+            refundLog.setFundsAccount(refund.getFundsAccount().name());
+            refundLog.setCurrency(refund.getAmount().getCurrency());
+            refundLog.setAdminUserId(StpUtil.getLoginIdAsLong());
+            refundLog.setAdminUsername(StpUtil.getSession().getString("username"));
+            refundLog.setStatus(RefundLog.STATUS_退款处理中);
+            refundLogService.updateById(refundLog);
+        } catch (ServiceException e) {
+            LOGGER.error("微信退款异常:{}", e.getErrorMessage());
+            throw new BusinessException("微信退款异常:" + e.getErrorMessage());
+        }
     }
 
     /**