From 62ed483e2b542c8088cd304468824b87482c828b Mon Sep 17 00:00:00 2001 From: 44323 <443237572@qq.com> Date: 星期五, 15 三月 2024 22:33:11 +0800 Subject: [PATCH] 部分bug修改 --- cloud-server-competition/src/main/java/com/dsh/competition/service/impl/CompetitionServiceImpl.java | 24 +++++++++--------------- 1 files changed, 9 insertions(+), 15 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..10ed3c8 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 @@ -232,7 +232,8 @@ JSONArray jsonArray = JSON.parseArray(paymentCompetitionVo.getIds()); Competition competition = this.getById(paymentCompetitionVo.getId()); - List<PaymentCompetition> list = paymentCompetitionService.list(new QueryWrapper<PaymentCompetition>().eq("competitionId", paymentCompetitionVo.getId()).ne("payStatus", 3)); + List<PaymentCompetition> list = paymentCompetitionService.list(new QueryWrapper<PaymentCompetition>() + .eq("competitionId", paymentCompetitionVo.getId()).ne("payStatus", 3)); List<Long> pays = new ArrayList<>(); for (PaymentCompetition paymentCompetition : list) { pays.add(paymentCompetition.getId()); @@ -259,18 +260,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 +319,6 @@ paymentCompetition.setPayOrderNo(""); paymentCompetitionService.updateById(paymentCompetition); -// competition.setApplicantsNumber(competition.getApplicantsNumber() + 1); this.updateById(competition); } if (paymentCompetitionVo.getPayType() == 4) {//课程 @@ -338,6 +329,7 @@ if(isStudent == 0){ continue; } + //扣减课时 PaymentDeductionClassHour paymentDeductionClassHour = new PaymentDeductionClassHour(); paymentDeductionClassHour.setId(id); paymentDeductionClassHour.setClassHour(competition.getClassPrice()); @@ -346,6 +338,7 @@ paymentDeductionClassHour.setUid(uid); coursePackagePaymentClient.paymentDeductionClassHour(paymentDeductionClassHour); } + paymentCompetition = paymentCompetitionService.getById(paymentCompetition.getId()); paymentCompetition.setAppUserId(null); paymentCompetition.setPayStatus(2); @@ -381,7 +374,8 @@ int min = 5000; wait += (min * num); Thread.sleep(wait); - PaymentCompetition paymentCompetition = paymentCompetitionService.getOne(new QueryWrapper<PaymentCompetition>().eq("code", code).eq("payType", 1)); + PaymentCompetition paymentCompetition = paymentCompetitionService.getOne(new QueryWrapper<PaymentCompetition>() + .eq("code", code).eq("payType", 1)); if (paymentCompetition.getPayStatus() == 2) { break; } -- Gitblit v1.7.1