fs-danaus
2024-03-25 1c2701eef267f3d131f4bb8baffea7404204dc51
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
package com.yc.sdk.gaodemap.api;
 
import com.yc.entity.AttachmentConfig;
import com.yc.sdk.gaodemap.action.GdMapServiceInit;
import com.yc.sdk.gaodemap.entity.RegeoCodeEntity;
import com.yc.sdk.map.entity.LocationEntity;
import com.yc.sdk.map.entity.SearchEntity;
import com.yc.sdk.map.service.AbstractMapService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import javax.servlet.http.HttpServletRequest;
 
@Service
public class GaoDeMapService implements AbstractMapService {
    @Autowired
    GdMapService gdMapService;
    private static String KEY = AttachmentConfig.get("GaoDeWebServiceKey");
 
    public GaoDeMapService() {
        this.gdMapService = GdMapServiceInit.getGdMapService(KEY);
    }
 
    @Override
    public LocationEntity getIPLocation(String ip, HttpServletRequest request) throws Exception {
        return null;
    }
    @Override
    public Object searchByText(SearchEntity searchEntity, HttpServletRequest request) throws Exception {
        return null;
    }
 
    @Override
    public Object nearbySearch(SearchEntity searchEntity, HttpServletRequest request) throws Exception {
        return null;
    }
 
    @Override
    public LocationEntity reverseGeocode(String longitude, String latitude, String ip,HttpServletRequest request) throws Exception {
        RegeoCodeEntity regeoV2 = gdMapService.getRegeoV2(longitude, latitude, ip);
        LocationEntity location = new LocationEntity();
        location.setCountryName(regeoV2.getCountry());
        location.setProvinceName(regeoV2.getProvince());
        location.setCityName(regeoV2.getCity());
        location.setSubLocality(regeoV2.getDistrict());
        location.setThoroughfare(regeoV2.getTownship());
        return location;
    }
}