shikeying
2024-01-11 3b67e947e36133e2a40eb2737b15ea375e157ea0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package com.walker.infrastructure;
 
import com.walker.location.GeoHashHelper;
 
import java.util.ArrayList;
import java.util.List;
 
public class MockUtils {
 
    public static final List<Address> searchAround(List<Address> data, List<String> aroundList9, int geoSize){
        List<Address> resultList = new ArrayList<>();
        for(Address address: data){
            for(String geoHash: aroundList9){
                if(geoHash.substring(0, geoSize).equals(address.getGeoHash().substring(0, geoSize))){
                    resultList.add(address);
                    // 只要一个匹配就退出二级循环,直接比较下一个。
                    break;
                }
            }
        }
        return resultList;
    }
 
    public static final List<Address> acquireTestAddressList(GeoHashHelper geoHashHelper){
        List<Address> data = new ArrayList<>();
        // 113.629615,34.874807
        data.add(new Address("菜鸟驿站", 113.629615, 34.874807, geoHashHelper));
        // 113.628542,34.874955
        data.add(new Address("青青果园", 113.628542, 34.874955, geoHashHelper));
        // 113.628209,34.873782
        data.add(new Address("日日鲜蛋糕", 113.628209, 34.873782, geoHashHelper));
        // 113.628546,34.876051
        data.add(new Address("福状元", 113.628546, 34.876051, geoHashHelper));
        // 113.623835,34.878191
        data.add(new Address("田园风光", 113.623835, 34.878191, geoHashHelper));
        // 113.61707,34.875844
        data.add(new Address("郑州三院(惠济院区)", 113.61707, 34.875844, geoHashHelper));
        // 113.620969,34.861406
        data.add(new Address("锦艺四季城", 113.620969, 34.861406, geoHashHelper));
        // 113.644325,34.874015
        data.add(new Address("惠济万达", 113.644325, 34.874015, geoHashHelper));
        // 113.633123,34.84301
        data.add(new Address("省体育中心", 113.633123, 34.84301, geoHashHelper));
        // 113.641136,34.830744
        data.add(new Address("普罗旺市", 113.641136, 34.830744, geoHashHelper));
        // 113.673246,34.805999
        data.add(new Address("赛博数码广场", 113.673246, 34.805999, geoHashHelper));
        // 113.736087,34.778367
        data.add(new Address("郑州会展中心", 113.736087, 34.778367, geoHashHelper));
        // 113.814118,34.800346
        data.add(new Address("智慧岛大厦", 113.814118, 34.800346, geoHashHelper));
        // 113.543742,34.823359
        data.add(new Address("郑州大学", 113.543742, 34.823359, geoHashHelper));
        // 113.654108,34.673294
        data.add(new Address("南环公园", 113.654108, 34.673294, geoHashHelper));
        // 113.858939,34.53253
        data.add(new Address("新郑机场", 113.858939, 34.53253, geoHashHelper));
        // 113.781074,34.388741
        data.add(new Address("新郑火车站", 113.781074, 34.388741, geoHashHelper));
        // 113.855364,34.071009
        data.add(new Address("许昌中央公园", 113.855364, 34.071009, geoHashHelper));
        return data;
    }
}