| | |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | | |
| | | import static com.sun.xml.internal.ws.api.model.wsdl.WSDLBoundOperation.ANONYMOUS.optional; |
| | | import static sun.plugin.util.ProgressMonitor.get; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | code += Double.valueOf(Math.random() * 10).intValue(); |
| | | } |
| | | SMSUtil.sendSms("[\"" + code + "\"]", smsCode.getPhone(), "8824121211029", "39533d100b2b4aee8ed198aa49fe99dd"); |
| | | redisService.setCacheObject(smsCode.getPhone(), code, 300L, TimeUnit.SECONDS); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | Region region = regionClient.getRegionBiCode(citycode).getData(); |
| | | appUser.setDistrict(region.getName()); |
| | | appUser.setDistrictCode(citycode); |
| | | region = regionClient.getRegionBiCode(citycode.substring(0, 3) + "00").getData(); |
| | | region = regionClient.getRegionBiCode(citycode.substring(0, 4) + "00").getData(); |
| | | appUser.setCity(region.getName()); |
| | | appUser.setCityCode(region.getCode()); |
| | | region = regionClient.getRegionBiCode(citycode.substring(0, 2) + "0000").getData(); |
| | |
| | | } |
| | | |
| | | public AppUser getTopAppUser(List<AppUser> list, Long id){ |
| | | AppUser appUser = list.stream().filter(s -> s.getId().equals(id)).findFirst().get(); |
| | | if(null == appUser.getInviteUserId()){ |
| | | Optional<AppUser> first = list.stream().filter(s -> s.getId().equals(id)).findFirst(); |
| | | AppUser appUser = null; |
| | | if(first.isPresent()){ |
| | | appUser = first.get(); |
| | | }else{ |
| | | return this.getById(1); |
| | | } |
| | | if( null == appUser.getInviteUserId()){ |
| | | return appUser; |
| | | } |
| | | return getTopAppUser(list, appUser.getInviteUserId()); |
| | |
| | | public List<AppUser> getSubordinate(List<AppUser> list, List<Long> ids, List<AppUser> result){ |
| | | List<Long> idss = new ArrayList<>(); |
| | | for (Long id : ids) { |
| | | List<AppUser> collect = list.stream().filter(s -> s.getInviteUserId().equals(id)).collect(Collectors.toList()); |
| | | List<AppUser> collect = list.stream().filter(s -> null != s.getInviteUserId() && s.getInviteUserId().equals(id)).collect(Collectors.toList()); |
| | | if(collect.size() == 0){ |
| | | return result; |
| | | }else{ |
| | |
| | | //使用地图获取省市区数据 |
| | | String citycode = TencentMapUtil.inverseGeographicalAnalysis(nearbyReferrer.getLongitude(), nearbyReferrer.getLatitude(), false); |
| | | if(null != citycode){ |
| | | String cityCode = citycode.substring(0, 3) + "00"; |
| | | String cityCode = citycode.substring(0, 4) + "00"; |
| | | List<NearbyReferrerVo> list = this.baseMapper.getNearbyReferrer(cityCode, nearbyReferrer); |
| | | return list; |
| | | } |