puzhibing
2024-02-29 418f825179da69573a8a4e6adc5af6b4a0efc857
cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java
@@ -159,11 +159,40 @@
     */
    @Override
    public List<WorldCupListVo> getWorldCupList(WorldCupList worldCupList) {
        if(null == worldCupList.getSort()){
            worldCupList.setSort(1);
        }
        //没有筛选门店,默认使用当前门店
        if(null == worldCupList.getStoreId()){
            worldCupList.setStoreId(worldCupList.getStoreId());
        }
        return this.baseMapper.getWorldCupList(worldCupList);
        List<WorldCupListVo> worldCupList1 = this.baseMapper.getWorldCupList(worldCupList);
        for (WorldCupListVo worldCupListVo : worldCupList1) {
            Integer id = Integer.valueOf(worldCupListVo.getId());
            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());
            Integer heat = worldCupListVo.getHeat();
            if(collect.size() > 0){
                int count = worldCupPaymentParticipantService.count(new QueryWrapper<WorldCupPaymentParticipant>().in("worldCupPaymentId", collect));
                heat += count;
            }
            worldCupListVo.setHeat(heat);
        }
        Collections.sort(worldCupList1, new Comparator<WorldCupListVo>() {
            @Override
            public int compare(WorldCupListVo o1, WorldCupListVo o2) {
                if(worldCupList.getSort() == 1){
                    return o1.getHeat().compareTo(o2.getHeat());
                }
                if(worldCupList.getSort() == 2){
                    return o1.getHeat().compareTo(o2.getHeat()) * -1;
                }
                return 0;
            }
        });
        return worldCupList1;
    }
@@ -182,6 +211,15 @@
            jsonArray.add(store.getName());
        }
        worldCupInfo.setStores(jsonArray.toJSONString());
        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());
        Integer heat = worldCupInfo.getHeat();
        if(collect.size() > 0){
            int count = worldCupPaymentParticipantService.count(new QueryWrapper<WorldCupPaymentParticipant>().in("worldCupPaymentId", collect));
            heat += count;
        }
        worldCupInfo.setHeat(heat);
        return worldCupInfo;
    }