puzhibing
2024-02-05 640ff18d2d7f4be02ddb7f8f75e899f05545eb98
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) {
            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);