From 640ff18d2d7f4be02ddb7f8f75e899f05545eb98 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期一, 05 二月 2024 11:56:52 +0800
Subject: [PATCH] 更新bug修改

---
 cloud-server-competition/src/main/java/com/dsh/competition/service/impl/CompetitionServiceImpl.java |   18 +++++-------------
 1 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/cloud-server-competition/src/main/java/com/dsh/competition/service/impl/CompetitionServiceImpl.java b/cloud-server-competition/src/main/java/com/dsh/competition/service/impl/CompetitionServiceImpl.java
index 8e71751..42600b9 100644
--- a/cloud-server-competition/src/main/java/com/dsh/competition/service/impl/CompetitionServiceImpl.java
+++ b/cloud-server-competition/src/main/java/com/dsh/competition/service/impl/CompetitionServiceImpl.java
@@ -259,18 +259,9 @@
         }
         if (paymentCompetitionVo.getPayType() == 4) {//课程
             money = new BigDecimal(competition.getClassPrice()).multiply(new BigDecimal(jsonArray.size())).setScale(2, RoundingMode.HALF_EVEN);
-            for (int i = 0; i < jsonArray.size(); i++) {
-//                Participant participant = participantService.getById(s);
-//                Student student = studentClient.queryStudentByPhone(participant.getPhone());
-//                if(null == student){
-//                    return ResultUtil.error(participant.getName() + "不是学员,无法使用课时支付。");
-//                }
-                // 2.0
-                Integer integer = coursePackagePaymentClient.queryResidueClassHourById(paymentCompetitionVo.getCoursePaymentId());
-                if (new BigDecimal(integer).compareTo(new BigDecimal(competition.getClassPrice())) < 0) {
-                    return new ResultUtil(3, "剩余课时不足,无法完成支付。");
-
-                }
+            Integer integer = coursePackagePaymentClient.queryResidueClassHourById(paymentCompetitionVo.getCoursePaymentId());
+            if (new BigDecimal(integer).compareTo(money) < 0) {
+                return new ResultUtil(3, "剩余课时不足,无法完成支付。");
             }
         }
 
@@ -327,7 +318,6 @@
             paymentCompetition.setPayOrderNo("");
             paymentCompetitionService.updateById(paymentCompetition);
 
-//            competition.setApplicantsNumber(competition.getApplicantsNumber() + 1);
             this.updateById(competition);
         }
         if (paymentCompetitionVo.getPayType() == 4) {//课程
@@ -338,6 +328,7 @@
                 if(isStudent == 0){
                     continue;
                 }
+                //扣减课时
                 PaymentDeductionClassHour paymentDeductionClassHour = new PaymentDeductionClassHour();
                 paymentDeductionClassHour.setId(id);
                 paymentDeductionClassHour.setClassHour(competition.getClassPrice());
@@ -346,6 +337,7 @@
                 paymentDeductionClassHour.setUid(uid);
                 coursePackagePaymentClient.paymentDeductionClassHour(paymentDeductionClassHour);
             }
+
             paymentCompetition = paymentCompetitionService.getById(paymentCompetition.getId());
             paymentCompetition.setAppUserId(null);
             paymentCompetition.setPayStatus(2);

--
Gitblit v1.7.1