| | |
| | | //package com.dsh; |
| | | // |
| | | //import com.alibaba.fastjson.JSONObject; |
| | | //import com.dsh.communityWorldCup.feignclient.account.model.AppUser; |
| | | //import com.dsh.communityWorldCup.feignclient.account.model.TStudent; |
| | | //import com.dsh.communityWorldCup.feignclient.competition.model.Participant; |
| | | //import com.dsh.communityWorldCup.mapper.WorldCupCompetitorMapper; |
| | | //import com.dsh.communityWorldCup.model.WorldCupRank; |
| | | //import com.dsh.communityWorldCup.model.WorldCupRankVo; |
| | | //import com.dsh.communityWorldCup.service.IWorldCupCompetitorService; |
| | | //import com.dsh.communityWorldCup.service.impl.WorldCupCompetitorServiceImpl; |
| | | //import org.junit.Test; |
| | | //import org.junit.runner.RunWith; |
| | | //import org.springframework.beans.factory.annotation.Autowired; |
| | | //import org.springframework.boot.test.context.SpringBootTest; |
| | | //import org.springframework.test.context.junit4.SpringRunner; |
| | | // |
| | | //import javax.annotation.Resource; |
| | | //import java.math.BigDecimal; |
| | | //import java.math.MathContext; |
| | | //import java.math.RoundingMode; |
| | | //import java.util.ArrayList; |
| | | //import java.util.HashMap; |
| | | //import java.util.List; |
| | | //import java.util.Map; |
| | | // |
| | | ///** |
| | | // * @author zhibing.pu |
| | |
| | | //@SpringBootTest |
| | | //public class CommunityWorldCupApplicationTest { |
| | | // |
| | | // @Autowired |
| | | // private IWorldCupCompetitorService worldCupCompetitorService; |
| | | // |
| | | // @Resource |
| | | // private WorldCupCompetitorMapper worldCupCompetitorMapper; |
| | | // |
| | | // |
| | | // @Test |
| | | // public void test(){ |
| | | // WorldCupRank worldCupRank = new WorldCupRank(); |
| | | // worldCupRank.setAppUserId(129); |
| | | // worldCupRank.setSort(2); |
| | | // worldCupRank.setIsStudent(0); |
| | | // worldCupRank.setRadius(1); |
| | | // List<WorldCupRankVo> worldCupRank1 = worldCupCompetitorService.getWorldCupRank(worldCupRank); |
| | | // WorldCupRank worldCupRank = new WorldCupRank(); |
| | | // worldCupRank.setYear(2024); |
| | | // //总场次 |
| | | // List<Map<String, Object>> lists = worldCupCompetitorMapper.getWorldCupRank(worldCupRank, null); |
| | | // //未负的数据 |
| | | // List<Map<String, Object>> lists1 = worldCupCompetitorMapper.getWorldCupRank1(worldCupRank, null); |
| | | // List<Map<String, Object>> mapList = new ArrayList<>(); |
| | | // for (int i = 0; i < lists.size(); i++) { |
| | | // Map<String, Object> map = lists.get(i); |
| | | // Integer participantType = Integer.valueOf(map.get("participantType").toString()); |
| | | // Long participantId = Long.valueOf(map.get("participantId").toString()); |
| | | // Integer appUserId = Integer.valueOf(map.get("appUserId").toString()); |
| | | // Integer num = Integer.valueOf(null == map.get("num") ? "0" : map.get("num").toString()); |
| | | // map.put("totalSession", num); |
| | | // map.put("winRate", "0"); |
| | | // for (Map<String, Object> objectMap : lists1) { |
| | | // Integer participantType1 = Integer.valueOf(objectMap.get("participantType").toString()); |
| | | // Long participantId1 = Long.valueOf(objectMap.get("participantId").toString()); |
| | | // Integer appUserId1 = Integer.valueOf(objectMap.get("appUserId").toString()); |
| | | // Integer num1 = Integer.valueOf(null == objectMap.get("num") ? "0" : objectMap.get("num").toString()); |
| | | // if(participantType.compareTo(participantType1) == 0 && participantId.compareTo(participantId1) == 0 && appUserId.compareTo(appUserId1) == 0){ |
| | | // map.put("winRate", new BigDecimal(num1).divide(new BigDecimal(num), new MathContext(2, RoundingMode.HALF_EVEN)).multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | // break; |
| | | // } |
| | | // } |
| | | // mapList.add(map); |
| | | // } |
| | | // } |
| | | // |
| | | //} |