puzhibing
2024-03-05 6c6d51775200fc1c17b0cd5fc9464016aed13327
cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java
@@ -315,7 +315,7 @@
        if(null == worldCup){
            return ResultUtil.error("报名数据异常");
        }
        if(System.currentTimeMillis() > worldCup.getRegistrationClosingTime().getTime()){
        if(null != worldCup.getRegistrationClosingTime() && System.currentTimeMillis() > worldCup.getRegistrationClosingTime().getTime()){
            return ResultUtil.error("报名时间已结束,无法完成报名");
        }
        if(System.currentTimeMillis() > worldCup.getEndTime().getTime()){
@@ -331,18 +331,18 @@
            Integer isStudent = jsonObject.getInteger("isStudent");
            if(isStudent == 1){
                TStudent tStudent = studentClient.queryById(id);
                if(worldCup.getStartAge() > Integer.valueOf(sdf.format(tStudent.getBirthday()))){
                if(worldCup.getStartAge() > (Integer.valueOf(sdf.format(new Date())) - Integer.valueOf(sdf.format(tStudent.getBirthday())))){
                    return ResultUtil.error("【" + tStudent.getName() + "】年龄不符合要求");
                }
                if(worldCup.getEndAge() < Integer.valueOf(sdf.format(tStudent.getBirthday()))){
                if(worldCup.getEndAge() < (Integer.valueOf(sdf.format(new Date())) - Integer.valueOf(sdf.format(tStudent.getBirthday())))){
                    return ResultUtil.error("【" + tStudent.getName() + "】年龄不符合要求");
                }
            }else{
                Participant participant = participantClient.getParticipant(id);
                if(worldCup.getStartAge() > Integer.valueOf(sdf.format(participant.getBirthday()))){
                if(worldCup.getStartAge() > (Integer.valueOf(sdf.format(new Date())) - Integer.valueOf(sdf.format(participant.getBirthday())))){
                    return ResultUtil.error("【" + participant.getName() + "】年龄不符合要求");
                }
                if(worldCup.getEndAge() < Integer.valueOf(sdf.format(participant.getBirthday()))){
                if(worldCup.getEndAge() < (Integer.valueOf(sdf.format(new Date())) - Integer.valueOf(sdf.format(participant.getBirthday())))){
                    return ResultUtil.error("【" + participant.getName() + "】年龄不符合要求");
                }
            }
@@ -425,6 +425,7 @@
                    worldCupPaymentParticipant.setAppUserId(paymentWorldCup.getUid());
                    worldCupPaymentParticipant.setParticipantType(isStudent == 0 ? 2 : 1);
                    worldCupPaymentParticipant.setParticipantId(id);
                    worldCupPaymentParticipant.setAlreadyEntered(0);
                    worldCupPaymentParticipantService.save(worldCupPaymentParticipant);
                }
                return ResultUtil.success();
@@ -484,6 +485,24 @@
                worldCupPayment.setPayStatus(2);
                worldCupPayment.setPayTime(new Date());
                worldCupPaymentService.save(worldCupPayment);
                //添加报名明细
                for (int i = 0; i < jsonArray.size(); i++) {
                    JSONObject jsonObject = jsonArray.getJSONObject(i);
                    Integer id = jsonObject.getInteger("id");
                    //是否是学员(0=否,1=是)
                    Integer isStudent = jsonObject.getInteger("isStudent");
                    WorldCupPaymentParticipant worldCupPaymentParticipant = new WorldCupPaymentParticipant();
                    worldCupPaymentParticipant.setWorldCupId(paymentWorldCup.getId());
                    worldCupPaymentParticipant.setWorldCupPaymentId(worldCupPayment.getId());
                    worldCupPaymentParticipant.setAppUserId(paymentWorldCup.getUid());
                    worldCupPaymentParticipant.setParticipantType(isStudent == 0 ? 2 : 1);
                    worldCupPaymentParticipant.setParticipantId(id);
                    worldCupPaymentParticipant.setAlreadyEntered(0);
                    worldCupPaymentParticipantService.save(worldCupPaymentParticipant);
                }
                return ResultUtil.success();
            }
        }else{
@@ -508,6 +527,7 @@
                worldCupPaymentParticipant.setAppUserId(paymentWorldCup.getUid());
                worldCupPaymentParticipant.setParticipantType(isStudent == 0 ? 2 : 1);
                worldCupPaymentParticipant.setParticipantId(id);
                worldCupPaymentParticipant.setAlreadyEntered(0);
                worldCupPaymentParticipantService.save(worldCupPaymentParticipant);
            }
            return ResultUtil.success();
@@ -544,6 +564,7 @@
            worldCupPaymentParticipant.setAppUserId(worldCupPayment.getAppUserId());
            worldCupPaymentParticipant.setParticipantType(isStudent == 0 ? 2 : 1);
            worldCupPaymentParticipant.setParticipantId(id);
            worldCupPaymentParticipant.setAlreadyEntered(0);
            worldCupPaymentParticipantService.save(worldCupPaymentParticipant);
        }
        return ResultUtil.success();