|
@@ -15,11 +15,8 @@ import com.benyun.core.entity.vo.TypeByBody;
|
|
|
import com.benyun.core.entity.vo.WdInfoVo;
|
|
|
import com.benyun.core.service.CategoryService;
|
|
|
import com.benyun.core.service.WdInfoService;
|
|
|
-import com.benyun.core.utils.DistanceUtil;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
-import org.gavaghan.geodesy.Ellipsoid;
|
|
|
-import org.gavaghan.geodesy.GlobalCoordinates;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -220,45 +217,4 @@ public class WdInfoServiceImpl implements WdInfoService {
|
|
|
// return list;
|
|
|
// }
|
|
|
|
|
|
- @Override
|
|
|
- public List<WdInfo> map(String wdId,int r,int size,String wd_type_code) {
|
|
|
- QueryWrapper<WdInfo> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.eq("wd_id", wdId);
|
|
|
- WdInfo wdInfo = wdInfoMapper.selectOne(queryWrapper);
|
|
|
-
|
|
|
- QueryWrapper<WdInfo> queryWrapper1 = new QueryWrapper<>();
|
|
|
- queryWrapper1.select("wd_id","wd_name","addr_info","type_name_by","wd_type_code","lat","lng","geo_hash");
|
|
|
- queryWrapper1.eq("wd_type_code",wd_type_code);
|
|
|
- queryWrapper1.and(wdInfoQueryWrapper -> {
|
|
|
- wdInfoQueryWrapper.likeRight("geo_hash", wdInfo.getGeoHash().substring(0, 5));
|
|
|
- });
|
|
|
- List<WdInfo> wdInfos = wdInfoMapper.selectList(queryWrapper1);
|
|
|
-
|
|
|
- System.out.println(wdInfos.size());
|
|
|
-
|
|
|
- List<WdInfo> map = new ArrayList<>();
|
|
|
- for (WdInfo info : wdInfos) {
|
|
|
- if(map.size() == size)
|
|
|
- break;
|
|
|
-
|
|
|
- //网点等于自己不要
|
|
|
- if (info.getWdId().equals(wdInfo.getWdId()))
|
|
|
- continue;
|
|
|
-
|
|
|
- //计算距离
|
|
|
- GlobalCoordinates source = new GlobalCoordinates(wdInfo.getLat().doubleValue(), wdInfo.getLng().doubleValue());
|
|
|
- GlobalCoordinates target = new GlobalCoordinates(info.getLat().doubleValue(), info.getLng().doubleValue());
|
|
|
- double meter2 = DistanceUtil.getDistanceMeter(source, target, Ellipsoid.WGS84);
|
|
|
-
|
|
|
- //大于4.89Km不要
|
|
|
- if (meter2 > r)
|
|
|
- continue;
|
|
|
-
|
|
|
- map.add(info);
|
|
|
- }
|
|
|
- System.out.println(map.size());
|
|
|
- return map;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
}
|