nickchange
2023-11-09 c036557db88c6297b9a626a892dce35c14ab8ee5
cloud-server-competition/src/main/java/com/dsh/competition/service/impl/CompetitionServiceImpl.java
@@ -97,7 +97,10 @@
    public List<CompetitionListVo> queryCompetitionList(String cityCode, String content, Integer registerCondition, String heat) throws Exception {
        List<CompetitionListVo> competitionListVos = this.baseMapper.queryCompetitionList(cityCode, content, registerCondition, heat);
        for (CompetitionListVo competitionListVo : competitionListVos) {
            Integer counts =  this.baseMapper.counts(competitionListVo.getId());
            competitionListVo.setHeat(competitionListVo.getHeat()+counts);
        }
        return competitionListVos;
@@ -124,7 +127,6 @@
        // 2.0
        ArrayList<Map<String,Object>> objects = new ArrayList<>();
        if(null != competition.getStoreId()){
            String storeId = competition.getStoreId();
            for (String s : storeId.split(",")) {
                HashMap<String, Object> map = new HashMap<>();
@@ -159,10 +161,11 @@
        competitionInfo.setRegisterEndTime(sdf.format(competition.getRegisterEndTime()));
        competitionInfo.setStartTime(sdf.format(competition.getStartTime()));
        competitionInfo.setIsReal(competition.getRealName());
        competitionInfo.setEndTime(sdf.format(competition.getEndTime()));
        competitionInfo.setAge(competition.getStartAge() + "-" + competition.getEndAge());
        competitionInfo.setProvince(competition.getEntryProvince());
        competitionInfo.setCity(competition.getEntryCity());
        competitionInfo.setProvince(competition.getProvince());
        competitionInfo.setCity(competition.getCity());
        String str = competition.getAddress();
        str = str.substring(str.indexOf("省") + 1);
@@ -239,15 +242,15 @@
        if(paymentCompetitionVo.getPayType() == 4){//课程
            money = new BigDecimal(competition.getClassPrice()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN);
            for (String s : split) {
                Participant participant = participantService.getById(s);
                Student student = studentClient.queryStudentByPhone(participant.getPhone());
                if(null == student){
                    return ResultUtil.error(participant.getName() + "不是学员,无法使用课时支付。");
                }
//                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 ResultUtil.error(participant.getName() + "剩余课时不足,无法完成支付。");
                    return ResultUtil.error( "剩余课时不足,无法完成支付。");
                }
            }
        }
@@ -292,18 +295,19 @@
            paymentCompetition.setPayOrderNo("");
            paymentCompetitionService.updateById(paymentCompetition);
            competition.setApplicantsNumber(competition.getApplicantsNumber() + 1);
//            competition.setApplicantsNumber(competition.getApplicantsNumber() + 1);
            this.updateById(competition);
        }
        if(paymentCompetitionVo.getPayType() == 4){//课程
            for (String s : split) {
                Participant participant = participantService.getById(s);
                Student student = studentClient.queryStudentByPhone(participant.getPhone());
//                Participant participant = participantService.getById(s);
//                Student student = studentClient.queryStudentByPhone(participant.getPhone());
                PaymentDeductionClassHour paymentDeductionClassHour = new PaymentDeductionClassHour();
                paymentDeductionClassHour.setId(student.getId());
                paymentDeductionClassHour.setId(Integer.valueOf(s));
                paymentDeductionClassHour.setClassHour(competition.getClassPrice());
                paymentDeductionClassHour.setCode(code);
                paymentDeductionClassHour.setCourseId(paymentCompetitionVo.getCoursePaymentId());
                paymentDeductionClassHour.setUid(uid);
                coursePackagePaymentClient.paymentDeductionClassHour(paymentDeductionClassHour);
            }
            paymentCompetition = paymentCompetitionService.getById(paymentCompetition.getId());