From 1529842471c8c07a5181a10404b6dff2a0944500 Mon Sep 17 00:00:00 2001
From: luodangjia <luodangjia>
Date: 星期二, 06 八月 2024 09:00:22 +0800
Subject: [PATCH] 8.6

---
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/WithdrawServiceImpl.java |   27 ++++++++++++++++++---------
 1 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/WithdrawServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/WithdrawServiceImpl.java
index 0efa71c..3583bce 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/WithdrawServiceImpl.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/WithdrawServiceImpl.java
@@ -228,7 +228,8 @@
                 .eq(Withdraw::getOrderId, orderId).list();
         List<Integer> stateList = list.stream().map(Withdraw::getState).collect(Collectors.toList());
         if (stateList.contains(Constants.ZERO)) {
-            throw new GlobalException("当前订单已提交提现申请,请等待审核!");
+            return  false;
+//            throw new GlobalException("当前订单已提交提现申请,请等待审核!");
         } else if (stateList.contains(Constants.ONE)) {
             throw new GlobalException("当前订单已完成提现,请勿重复提现!");
         }
@@ -249,9 +250,9 @@
             withdraw.setState(Constants.ONE);
             // 商家微信打款至微信零钱
             boolean update = weChatPay(order.getOrderMoney(), openId,withdraw.getId());
-            if (!update) {
-                throw new GlobalException("交易提现失败,请检查是否绑定微信!");
-            }
+//            if (!update) {
+//                throw new GlobalException("交易提现失败,请检查是否绑定微信!");
+//            }
         } else {
             // 待审核
             withdraw.setState(Constants.ZERO);
@@ -321,20 +322,28 @@
                     "D:\\study\\JiaDianHuiShou\\ruoyi-service\\ruoyi-order\\src\\main\\java\\com\\ruoyi\\order\\vx\\apiclient_key.pem", WechatConstants.WE_CHAT_URL_SUF);
 
             JSONObject jsonObject = JSONObject.parseObject(result);
+
+            WithdrawDetail withdrawDetail = new WithdrawDetail();
+            withdrawDetail.setWithdrawId(withdrawId);
+            withdrawDetail.setMoney(transferAmount);
+            withdrawDetail.setOutBatchNo((String) postMap.get(WechatConstants.OUT_BATCH_NO));
+            withdrawDetailService.save(withdrawDetail);
+
             if (jsonObject.containsKey(WechatConstants.CREATE_TIME)) {
                 // 转账成功
                 //保存转账明细
-                WithdrawDetail withdrawDetail = new WithdrawDetail();
-                withdrawDetail.setWithdrawId(withdrawId);
-                withdrawDetail.setMoney(transferAmount);
-                withdrawDetail.setOutBatchNo((String) postMap.get(WechatConstants.OUT_BATCH_NO));
-                withdrawDetailService.save(withdrawDetail);
+//                WithdrawDetail withdrawDetail = new WithdrawDetail();
+//                withdrawDetail.setWithdrawId(withdrawId);
+//                withdrawDetail.setMoney(transferAmount);
+//                withdrawDetail.setOutBatchNo((String) postMap.get(WechatConstants.OUT_BATCH_NO));
+//                withdrawDetailService.save(withdrawDetail);
 
 
             } else {
                 allTransfersSuccessful = false;
                 break;
             }
+
         }
 
         return allTransfersSuccessful;

--
Gitblit v1.7.1