puzhibing
2024-03-07 228c40ba253e57a10abb435afb6889c8ed27ec55
cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupCompetitorServiceImpl.java
@@ -369,6 +369,8 @@
            Integer win = Integer.valueOf(map.get("win").toString());
            Integer lose = totalSession - win;
            map.put("lose", lose);
            map.put("participantType", participantType);
            map.put("participantId", participantId);
            AppUser appUser = appUserClient.getAppUser(appUserId);
            map.put("province", appUser.getProvince() + appUser.getCity());
            if(1 == participantType){
@@ -517,4 +519,49 @@
        }
        this.updateBatchById(blueList);
    }
    /**
     * 获取用户比赛记录详情
     * @param userGameRecordList
     * @return
     */
    @Override
    public Map<String, Object> userGameRecordList(UserGameRecordList userGameRecordList) {
        String name = userGameRecordList.getUserName();
        List<Map<String, Object>> list = this.baseMapper.userGameRecordList(userGameRecordList.getName());
        List<Map<String, Object>> mapList = new ArrayList<>();
        for (Map<String, Object> map : list) {
            Long participantType = Long.valueOf(map.get("participantType").toString());
            Integer participantId = Integer.valueOf(map.get("participantId").toString());
            Integer ourScore = Integer.valueOf(map.get("ourScore").toString());
            Integer opponentScore = Integer.valueOf(map.get("opponentScore").toString());
            Integer matchResult = Integer.valueOf(map.get("matchResult").toString());
            if(1 == participantType){
                TStudent tStudent = studentClient.queryById(participantId);
                if(ToolUtil.isNotEmpty(name) && tStudent.getName().indexOf(name) == -1){
                    continue;
                }
                map.put("userName", tStudent.getName());
            }else{
                Participant participant = participantClient.getParticipant(participantId);
                if(ToolUtil.isNotEmpty(name) && participant.getName().indexOf(name) == -1){
                    continue;
                }
                map.put("userName", participant.getName());
            }
            map.put("score", ourScore.compareTo(opponentScore) > 0 ?
                    ourScore + ":" + opponentScore :
                    opponentScore + ":" + ourScore);
            map.put("matchResult", matchResult == 1 ? "胜" : "负");
            mapList.add(map);
        }
        Map<String, Object> map = new HashMap<>();
        map.put("total", mapList.size());
        Integer offset = userGameRecordList.getOffset();
        Integer limit = userGameRecordList.getLimit();
        limit += offset;
        map.put("rows", mapList.subList(offset, mapList.size() >= limit ? limit : mapList.size()));
        return map;
    }
}