puzhibing
2024-03-12 b28d69f6cba1a7aed03fd9c07a14693281f9a9a0
cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java
@@ -165,6 +165,9 @@
//            worldCupPaymentParticipant.setAlreadyEntered(1);
//            worldCupPaymentParticipantService.updateById(worldCupPaymentParticipant);
        }
        worldCup.setMatchNumber(worldCup.getMatchNumber() + 1);
        this.updateById(worldCup);
        //2、调起开启游戏的接口。
        HashMap<String, String> map = new HashMap<>();
        map.put("sign", "0DB011836143EEE2C2E072967C9F4E4B");
@@ -249,7 +252,7 @@
            Collections.sort(worldCupList1, new Comparator<WorldCupListVo>() {
                @Override
                public int compare(WorldCupListVo o1, WorldCupListVo o2) {
                    return o1.getDistance().compareTo(o2.getDistance()) * -1;
                    return o1.getDistance().compareTo(o2.getDistance());
                }
            });
        }
@@ -391,13 +394,16 @@
        String cupIds = paymentWorldCup.getIds();
        JSONArray jsonArray = JSON.parseArray(cupIds);
        if(jsonArray.size() != 6){
            return ResultUtil.error("参赛人数只能是6人");
        }
        List<WorldCupPayment> payments = worldCupPaymentService.list(new QueryWrapper<WorldCupPayment>().eq("worldCupId", worldCup.getId())
                .eq("payStatus", 2).eq("state", 1));
        List<Long> ids = payments.stream().map(WorldCupPayment::getId).collect(Collectors.toList());
        if(ids.size() > 0){
            int count = worldCupPaymentParticipantService.count(new QueryWrapper<WorldCupPaymentParticipant>().eq("worldCupId", worldCup.getId())
                    .eq("worldCupPaymentId", ids));
            if((count + jsonArray.size()) >= worldCup.getMatchNumber()){
            if((count + jsonArray.size()) >= worldCup.getMaxPeople()){
                return ResultUtil.error("已超出最大报名人数");
            }
        }