| | |
| | | import com.dsh.communityWorldCup.feignclient.account.AppUserClient; |
| | | import com.dsh.communityWorldCup.feignclient.account.StudentClient; |
| | | import com.dsh.communityWorldCup.feignclient.account.model.AppUser; |
| | | import com.dsh.communityWorldCup.feignclient.account.model.AppUserIdsByCityName; |
| | | import com.dsh.communityWorldCup.feignclient.account.model.TStudent; |
| | | import com.dsh.communityWorldCup.feignclient.competition.ParticipantClient; |
| | | import com.dsh.communityWorldCup.feignclient.competition.model.Participant; |
| | |
| | | import java.math.BigDecimal; |
| | | import java.math.MathContext; |
| | | import java.math.RoundingMode; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | |
| | | this.updateBatchById(worldCupCompetitors); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取比赛排行榜列表数据 |
| | | * @param worldCupRecords |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Map<String, Object> worldCupRecordsList(WorldCupRecords worldCupRecords) { |
| | | Map<String, Object> map1 = new HashMap<>(); |
| | | AppUserIdsByCityName appUserIdsByCityName = new AppUserIdsByCityName(); |
| | | appUserIdsByCityName.setProvince(worldCupRecords.getProvince()); |
| | | appUserIdsByCityName.setCity(worldCupRecords.getCity()); |
| | | List<Integer> appUserIds = appUserClient.getAppUserIdsByCityName(appUserIdsByCityName); |
| | | List<Map<String, Object>> mapList = this.baseMapper.worldCupRecordsList(worldCupRecords, appUserIds); |
| | | for (int i = 0; i < mapList.size(); i++) { |
| | | Map<String, Object> map = mapList.get(i); |
| | | Integer participantType = Integer.valueOf(map.get("participantType").toString()); |
| | | Integer participantId = Integer.valueOf(map.get("participantId").toString()); |
| | | Integer appUserId = Integer.valueOf(map.get("appUserId").toString()); |
| | | Integer totalSession = Integer.valueOf(map.get("totalSession").toString()); |
| | | Integer win = Integer.valueOf(map.get("win").toString()); |
| | | Integer lose = totalSession - win; |
| | | map.put("lose", lose); |
| | | AppUser appUser = appUserClient.getAppUser(appUserId); |
| | | map.put("province", appUser.getProvince() + appUser.getCity()); |
| | | if(1 == participantType){ |
| | | TStudent tStudent = studentClient.queryById(participantId); |
| | | map.put("name", tStudent.getName()); |
| | | map.put("phone", tStudent.getPhone()); |
| | | }else{ |
| | | Participant participant = participantClient.getParticipant(participantId); |
| | | map.put("name", participant.getName()); |
| | | map.put("phone", participant.getPhone()); |
| | | } |
| | | } |
| | | map1.put("rows", mapList); |
| | | int count = this.baseMapper.worldCupRecordsListCount(appUserIds); |
| | | map1.put("total", count); |
| | | return map1; |
| | | } |
| | | } |