| | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | competitionInfo.setAge(competition.getStartAge() + "-" + competition.getEndAge()); |
| | | competitionInfo.setProvince(competition.getEntryProvince()); |
| | | competitionInfo.setCity(competition.getEntryCity()); |
| | | competitionInfo.setAddress(competition.getEntryAddress()); |
| | | |
| | | String str = competition.getAddress(); |
| | | str = str.substring(str.indexOf("省") + 1); |
| | | |
| | | // 去掉第一个“市”及之前的字符串 |
| | | str = str.substring(str.indexOf("市") + 1); |
| | | |
| | | // 去掉第一个“区”及之前的字符串 |
| | | str = str.substring(str.indexOf("区") + 1); |
| | | |
| | | |
| | | competitionInfo.setAddress(str); |
| | | competitionInfo.setCashPrice(competition.getCashPrice()); |
| | | competitionInfo.setPlayPaiCoin(competition.getPlayPaiCoin()); |
| | | competitionInfo.setClassPrice(competition.getClassPrice()); |
| | | competitionInfo.setIntroduction(competition.getIntroduction()); |
| | | competitionInfo.setRegistrationNotes(competition.getRegistrationNotes()); |
| | | competitionInfo.setApply(1); |
| | | ArrayList<Map<String,Object>> objects = new ArrayList<>(); |
| | | |
| | | if(null != competition.getStoreId()){ |
| | | String storeId = competition.getStoreId(); |
| | | for (String s : storeId.split(",")) { |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | Store store1 = storeClient.queryStoreById(Integer.valueOf(s)); |
| | | map.put("name",store1.getName()); |
| | | |
| | | |
| | | String str1 = store1.getAddress(); |
| | | str1 = str1.substring(str1.indexOf("省") + 1); |
| | | |
| | | // 去掉第一个“市”及之前的字符串 |
| | | str1 = str1.substring(str1.indexOf("市") + 1); |
| | | |
| | | // 去掉第一个“区”及之前的字符串 |
| | | str1 = str1.substring(str1.indexOf("区") + 1); |
| | | |
| | | map.put("address",str1); |
| | | map.put("storeLon",store.getLon()); |
| | | map.put("storeLat",store.getLat()); |
| | | map.put("storeCoverDrawing",store.getCoverDrawing()); |
| | | // if(ToolUtil.isNotEmpty(lon) && ToolUtil.isNotEmpty(lat)){ |
| | | // Map<String, Double> distance = GeodesyUtil.getDistance(lon + "," + lat, store.getLon() + "," + store.getLat()); |
| | | // double wgs84 = new BigDecimal(distance.get("WGS84")).divide(new BigDecimal(1000)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | // map.put("distance",wgs84); |
| | | // } |
| | | objects.add(map); |
| | | } |
| | | |
| | | } |
| | | competitionInfo.setStoreInfos(objects); |
| | | |
| | | |
| | | |
| | | List<ParticipantVo> participant = new ArrayList<>(); |
| | | List<UserCompetition> list = userCompetitionService.list(new QueryWrapper<UserCompetition>().eq("paymentCompetitionId", paymentCompetition.getId())); |
| | | List<Integer> collect = list.stream().map(UserCompetition::getParticipantId).collect(Collectors.toList()); |
| | |
| | | participantVo.setIdcard(participant1.getIdcard()); |
| | | Integer age = Integer.valueOf(sdf_year.format(new Date())) - Integer.valueOf(sdf_year.format(participant1.getBirthday())); |
| | | participantVo.setAge(age); |
| | | participantVo.setPhone(participant1.getPhone()); |
| | | participant.add(participantVo); |
| | | } |
| | | competitionInfo.setParticipant(participant); |