puzhibing
2024-03-06 603fbdb1bd13acf72fc94b95d96d32403c0889c2
cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java
@@ -744,4 +744,36 @@
            this.updateBatchById(worldCups);
        }
    }
    /**
     * 获取比赛统计列表数据
     * @param worldCupGameStatistics
     * @return
     */
    @Override
    public Map<String, Object> worldCupGameStatistics(WorldCupGameStatistics worldCupGameStatistics) {
        Map<String, Object> map = new HashMap<>();
        List<Map<String, Object>> mapList = this.baseMapper.worldCupGameStatistics(worldCupGameStatistics);
        for (Map<String, Object> stringObjectMap : mapList) {
            Integer id = Integer.valueOf(stringObjectMap.get("id").toString());
            int count = worldCupCompetitorService.count(new QueryWrapper<WorldCupCompetitor>().eq("worldCupId", id));
            stringObjectMap.put("matchTime", count);
            List<WorldCupPayment> list = worldCupPaymentService.list(new QueryWrapper<WorldCupPayment>().eq("worldCupId", id)
                    .eq("payStatus", 2).eq("state", 1));
            List<Long> collect = list.stream().map(WorldCupPayment::getId).collect(Collectors.toList());
            if(collect.size() == 0){
                stringObjectMap.put("applicants", 0);
            }else{
                int count1 = worldCupPaymentParticipantService.count(new QueryWrapper<WorldCupPaymentParticipant>()
                        .eq("worldCupId", id).in("worldCupPaymentId", collect)
                        .groupBy("worldCupPaymentId, participantType"));
                stringObjectMap.put("applicants", count1);
            }
        }
        int count = this.baseMapper.worldCupGameStatisticsCount(worldCupGameStatistics);
        map.put("total", count);
        return map;
    }
}