From b23b243473fc9ab20ca62eebf3668c143e2e7d23 Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期三, 24 七月 2024 15:30:53 +0800
Subject: [PATCH] Merge branch '2.0' of http://120.76.84.145:10101/gitblit/r/java/PlayPai into 2.0

---
 cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentServiceImpl.java |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentServiceImpl.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentServiceImpl.java
index 8789d3c..183f065 100644
--- a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentServiceImpl.java
+++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentServiceImpl.java
@@ -59,7 +59,7 @@
      * @return
      */
     @Override
-    public ResultUtil cancelMyWorldCup(String id) {
+    public ResultUtil cancelMyWorldCup(Long id) {
         WorldCupPaymentParticipant worldCupPaymentParticipant = worldCupPaymentParticipantService.getById(id);
         WorldCupPayment worldCupPayment = this.getById(worldCupPaymentParticipant.getWorldCupPaymentId());
         WorldCup worldCup = worldCupService.getById(worldCupPayment.getWorldCupId());
@@ -70,6 +70,7 @@
         //开始处理退款
         //免费
         if(worldCupPayment.getPayType() == 0){
+            worldCupPayment.setWorldCupId(null);
             worldCupPayment.setRefundOrderNo("");
             worldCupPayment.setRefundTime(new Date());
             worldCupPayment.setPayStatus(3);
@@ -78,6 +79,7 @@
         }
         List<WorldCupPaymentParticipant> list1 = worldCupPaymentParticipantService.list(new QueryWrapper<WorldCupPaymentParticipant>()
                 .eq("worldCupPaymentId", worldCupPayment.getId()).eq("alreadyEntered", 0));
+        //总排款金额(排除已经参加比赛的数据)
         BigDecimal multiply = worldCupPayment.getUnitPrice().multiply(new BigDecimal(list1.size()));
         //微信支付
         if(worldCupPayment.getPayType() == 1){
@@ -87,6 +89,10 @@
                 System.err.println("-------------微信退款失败---------");
                 System.err.println(map.get("return_msg"));
                 return ResultUtil.error("微信退款失败");
+            }else{
+                worldCupPayment.setRefundAmount(multiply);
+                worldCupPayment.setWorldCupId(null);
+                this.updateById(worldCupPayment);
             }
         }
         //支付宝支付
@@ -99,9 +105,11 @@
             }
             if("10000".equals(map.get("code"))){
                 String trade_no = map.get("trade_no");
+                worldCupPayment.setWorldCupId(null);
                 worldCupPayment.setRefundTime(new Date());
                 worldCupPayment.setRefundOrderNo(trade_no);
                 worldCupPayment.setPayStatus(3);
+                worldCupPayment.setRefundAmount(multiply);
                 this.updateById(worldCupPayment);
             }
         }
@@ -111,9 +119,11 @@
             AppUser appUser = appUserClient.getAppUser(appUserId);
             appUser.setPlayPaiCoins(appUser.getPlayPaiCoins() + multiply.intValue());
             appUserClient.updateAppUser(appUser);
+            worldCupPayment.setWorldCupId(null);
             worldCupPayment.setRefundTime(new Date());
             worldCupPayment.setRefundOrderNo("");
             worldCupPayment.setPayStatus(3);
+            worldCupPayment.setRefundAmount(multiply);
             this.updateById(worldCupPayment);
         }
         //课时支付
@@ -123,9 +133,11 @@
                 DeductionClassHourList deductionClassHourList = JSON.parseObject(content, DeductionClassHourList.class);
                 coursePackageOrderStudentClient.backspaceClassHour(deductionClassHourList);
             }
+            worldCupPayment.setWorldCupId(null);
             worldCupPayment.setRefundTime(new Date());
             worldCupPayment.setRefundOrderNo("");
             worldCupPayment.setPayStatus(3);
+            worldCupPayment.setRefundAmount(multiply);
             this.updateById(worldCupPayment);
         }
         return ResultUtil.success();

--
Gitblit v1.7.1