From 9486766c806fe1d9e082b2fd02ea1cc558f1b443 Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期四, 08 五月 2025 09:21:57 +0800
Subject: [PATCH] bug修改

---
 cloud-server-account/src/main/java/com/dsh/account/service/impl/RechargeRecordsServiceImpl.java |  162 +++++++----------------------------------------------
 1 files changed, 23 insertions(+), 139 deletions(-)

diff --git a/cloud-server-account/src/main/java/com/dsh/account/service/impl/RechargeRecordsServiceImpl.java b/cloud-server-account/src/main/java/com/dsh/account/service/impl/RechargeRecordsServiceImpl.java
index 8989a5c..3113496 100644
--- a/cloud-server-account/src/main/java/com/dsh/account/service/impl/RechargeRecordsServiceImpl.java
+++ b/cloud-server-account/src/main/java/com/dsh/account/service/impl/RechargeRecordsServiceImpl.java
@@ -205,24 +205,33 @@
         //世界杯
         GetWorldCupPayment getWorldCupPayment = new GetWorldCupPayment();
         getWorldCupPayment.setAppUserId(appUserId);
-        getWorldCupPayment.setPayType(3);
+        getWorldCupPayment.setPayType("3");
         getWorldCupPayment.setStartTime(monthStart);
         getWorldCupPayment.setEndTime(monthEnd);
         List<WorldCupPayment> worldCupPayment = worldCupPaymentClinet.getWorldCupPayment(getWorldCupPayment);
         for (WorldCupPayment cupPayment : worldCupPayment) {
             RechargesDetail consumeDetail = new RechargesDetail();
             if(cupPayment.getPayStatus() != 3){
-                consumeDetail.setConsumeName(RechargeRecordEnum.WORLD_CIP_PAYMENT.getMsg() + ":¥" + cupPayment.getAmount());
-                consumeDetail.setConsumeTime(simpleDateFormat.format(cupPayment.getCreateTime()));
+                consumeDetail.setConsumeName(RechargeRecordEnum.WORLD_CIP_PAYMENT.getMsg());
+                consumeDetail.setConsumeTime(simpleDateFormat.format(cupPayment.getPayTime()));
                 consumeDetail.setConsumeAmount("-" + cupPayment.getAmount());
                 consumeDetail.setRecordId(2);
+                details.add(consumeDetail);
             }else{
-                consumeDetail.setConsumeName(RechargeRecordEnum.CANCEL_WORLD_CIP_PAYMENT.getMsg() + ":¥" + cupPayment.getAmount());
-                consumeDetail.setConsumeTime(simpleDateFormat.format(cupPayment.getCreateTime()));
-                consumeDetail.setConsumeAmount("+" + cupPayment.getAmount());
+                consumeDetail = new RechargesDetail();
+                consumeDetail.setConsumeName(RechargeRecordEnum.WORLD_CIP_PAYMENT.getMsg());
+                consumeDetail.setConsumeTime(simpleDateFormat.format(cupPayment.getPayTime()));
+                consumeDetail.setConsumeAmount("-" + cupPayment.getAmount());
+                consumeDetail.setRecordId(2);
+                details.add(consumeDetail);
+
+                consumeDetail = new RechargesDetail();
+                consumeDetail.setConsumeName(RechargeRecordEnum.CANCEL_WORLD_CIP_PAYMENT.getMsg());
+                consumeDetail.setConsumeTime(simpleDateFormat.format(cupPayment.getRefundTime()));
+                consumeDetail.setConsumeAmount("+" + cupPayment.getRefundAmount());
                 consumeDetail.setRecordId(1);
+                details.add(consumeDetail);
             }
-            details.add(consumeDetail);
         }
 
 
@@ -323,138 +332,12 @@
     private ResultUtil AlipayPayment(String code, BigDecimal amount) {
         ResultUtil alipay = payMoneyUtil.alipay(smid,"玩湃币充值", "玩湃币充值", "", code, amount.toString(),
                 "/base/recharge/alipayRechargeCallback");
-        if (alipay.getCode() == 200) {
-            new Thread(new Runnable() {
-                @Override
-                public void run() {
-                    try {
-                        int num = 1;
-                        int wait = 0;
-                        while (num <= 10) {
-                            int min = 5000;
-                            wait += (min * num);
-                            Thread.sleep(wait);
-
-                            RechargeRecords records = rereMapper.selectOne(new QueryWrapper<RechargeRecords>()
-                                    .eq("code", code));
-                            if (records.getPayStatus() == 2) {
-                                break;
-                            }
-                            AlipayTradeQueryResponse resultUtil = payMoneyUtil.queryALIOrder(code);
-
-                            if (resultUtil.getCode().equals("10000") && records.getPayStatus() == 1) {
-                                /**
-                                 * WAIT_BUYER_PAY(交易创建,等待买家付款)、
-                                 * TRADE_CLOSED(未付款交易超时关闭,或支付完成后全额退款)、
-                                 * TRADE_SUCCESS(交易支付成功)、
-                                 * TRADE_FINISHED(交易结束,不可退款)
-                                 */
-//                                Map<String, String> data1 = resultUtil.getData();
-//                                String s = data1.get("tradeStatus");
-//                                String tradeNo = data1.get("tradeNo");
-
-                                String tradeNo = resultUtil.getTradeNo();
-                                String tradeStatus = resultUtil.getTradeStatus();
-                                System.out.println("ssssss" + tradeStatus);
-                                if ("TRADE_CLOSED".equals(tradeStatus) || "TRADE_FINISHED".equals(tradeStatus) || num == 10) {
-                                    records.setState(3);
-                                    rereMapper.deleteById(records.getId());
-                                    if ("TRADE_FINISHED".equals(tradeStatus)) {
-                                        // todo 资金结算
-                                        payMoneyUtil.confirm(smid,code,tradeNo,amount.toString());
-                                        break;
-                                    }
-                                    break;
-                                }
-
-                                if ("TRADE_SUCCESS".equals(tradeStatus)) {
-                                    records.setAppUserId(null);
-                                    records.setPayStatus(2);
-                                    records.setPayTime(new Date());
-                                    records.setOrderNumber(tradeNo);
-                                    rereMapper.updateById(records);
-
-                                    RechargeRecords rechargeRecords = rereMapper.selectOne(new QueryWrapper<RechargeRecords>()
-                                            .eq("code", code));
-                                    if (rechargeRecords.getPayStatus() == 2) {
-                                        TAppUser tAppUser = tappMapper.selectById(rechargeRecords.getAppUserId());
-                                        tAppUser.setPlayPaiCoins(null == tAppUser.getPlayPaiCoins() ? rechargeRecords.getPlayPaiCoins() : tAppUser.getPlayPaiCoins() + rechargeRecords.getPlayPaiCoins());
-                                        tappMapper.updateById(tAppUser);
-                                        break;
-                                    }
-
-
-                                    break;
-                                }
-                                if ("WAIT_BUYER_PAY".equals(tradeStatus)) {
-                                    num++;
-                                }
-                            }
-                        }
-                    } catch (Exception e) {
-                        e.printStackTrace();
-                    }
-                }
-            }).start();
-        }
         return alipay;
     }
 
     private ResultUtil WeChatPayment(String code, BigDecimal amount) throws Exception {
         ResultUtil weixinpay = payMoneyUtil.weixinpay("玩湃币充值", "", code, amount.toString(),
                 "/base/recharge/wechatRechargeCallback", "APP", "");
-        if (weixinpay.getCode() == 200) {
-            new Thread(new Runnable() {
-                @Override
-                public void run() {
-                    try {
-                        int num = 1;
-                        int wait = 0;
-                        while (num <= 10) {
-                            int min = 5000;
-                            wait += (min * num);
-                            Thread.sleep(wait);
-                            RechargeRecords records = rereMapper.selectOne(new QueryWrapper<RechargeRecords>()
-                                    .eq("code", code));
-                            if (records.getPayStatus() == 2) {
-                                break;
-                            }
-                            ResultUtil<Map<String, String>> resultUtil = payMoneyUtil.queryWXOrder(code, "");
-                            if (resultUtil.getCode() == 200 && records.getPayStatus() == 1) {
-                                /**
-                                 * SUCCESS—支付成功,
-                                 * REFUND—转入退款,
-                                 * NOTPAY—未支付,
-                                 * CLOSED—已关闭,
-                                 * REVOKED—已撤销(刷卡支付),
-                                 * USERPAYING--用户支付中,
-                                 * PAYERROR--支付失败(其他原因,如银行返回失败)
-                                 */
-                                Map<String, String> data1 = resultUtil.getData();
-                                String s = data1.get("trade_state");
-                                String transaction_id = data1.get("transaction_id");
-                                if ("REFUND".equals(s) || "NOTPAY".equals(s) || "CLOSED".equals(s) || "REVOKED".equals(s) || "PAYERROR".equals(s) || num == 10) {
-                                    records.setState(3);
-                                    rereMapper.deleteById(records.getId());
-                                    break;
-                                }
-                                if ("SUCCESS".equals(s)) {
-                                    records.setPayStatus(2);
-                                    records.setOrderNumber(transaction_id);
-                                    rereMapper.updateById(records);
-                                    break;
-                                }
-                                if ("USERPAYING".equals(s)) {
-                                    num++;
-                                }
-                            }
-                        }
-                    } catch (Exception e) {
-                        e.printStackTrace();
-                    }
-                }
-            }).start();
-        }
         return weixinpay;
 
     }
@@ -463,19 +346,20 @@
     public ResultUtil addRechargeCallbackPay(String code, String orderNumber) {
         RechargeRecords rechargeRecords = this.baseMapper.selectOne(new QueryWrapper<RechargeRecords>()
                 .eq("code", code));
-        if (rechargeRecords.getPayStatus() == 2) {
+        if (null == rechargeRecords || rechargeRecords.getPayStatus() == 2) {
             return ResultUtil.success();
         }
+
+        TAppUser tAppUser = tappMapper.selectById(rechargeRecords.getAppUserId());
+        tAppUser.setPlayPaiCoins(null == tAppUser.getPlayPaiCoins() ? rechargeRecords.getPlayPaiCoins() : tAppUser.getPlayPaiCoins() + rechargeRecords.getPlayPaiCoins());
+        tappMapper.updateById(tAppUser);
+
         rechargeRecords.setAppUserId(null);
         rechargeRecords.setPayStatus(2);
         rechargeRecords.setPayTime(new Date());
         rechargeRecords.setOrderNumber(orderNumber);
         this.baseMapper.updateById(rechargeRecords);
-
-        TAppUser tAppUser = tappMapper.selectById(rechargeRecords.getAppUserId());
-        tAppUser.setPlayPaiCoins(null == tAppUser.getPlayPaiCoins() ? rechargeRecords.getPlayPaiCoins() : tAppUser.getPlayPaiCoins() + rechargeRecords.getPlayPaiCoins());
-        tappMapper.updateById(tAppUser);
-        return null;
+        return ResultUtil.success();
     }
 
     @Override

--
Gitblit v1.7.1