使用高德逆地理编码替换天地图逆地理编码
This commit is contained in:
parent
1af9c92788
commit
63be3041b1
@ -120,7 +120,6 @@ public class FirePointServiceImpl implements FirePointService {
|
||||
firePointEntity.setSatelliteTime(DateTimeUtil.timeMillisToString(firePointQo.getSatelliteTimeTs().longValue()));
|
||||
firePointEntity.setLongitude(firePointQo.getLongitude());
|
||||
firePointEntity.setLatitude(firePointQo.getLatitude());
|
||||
firePointEntity.setFirePointAddress(AddressUtils.getLocal(firePointQo.getLatitude().toString(), firePointQo.getLongitude().toString()));
|
||||
firePointEntity.setSatelliteType(firePointQo.getSatelliteType());
|
||||
firePointEntity.setLandType(firePointQo.getLandtype());
|
||||
firePointEntity.setConfidence(firePointQo.getConfidence());
|
||||
@ -130,7 +129,7 @@ public class FirePointServiceImpl implements FirePointService {
|
||||
firePointEntity.setSatelliteImage(firePointQo.getSatelliteImage());
|
||||
firePointEntity.setAuditFireType("0");//初始化火点为未审核状态
|
||||
try {
|
||||
bindStreetCodeName(firePointEntity);
|
||||
bindAddress(firePointEntity);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.out.println("添加火点信息 逆地理编码请求街道编号失败:" + e.getMessage());
|
||||
@ -171,7 +170,6 @@ public class FirePointServiceImpl implements FirePointService {
|
||||
shanDongFirePoint.setSatelliteTime(DateTimeUtil.timeMillisToString(firePointQo.getSatelliteTimeTs().longValue()));
|
||||
shanDongFirePoint.setLongitude(firePointQo.getLongitude());
|
||||
shanDongFirePoint.setLatitude(firePointQo.getLatitude());
|
||||
shanDongFirePoint.setFirePointAddress(AddressUtils.getLocal(firePointQo.getLatitude().toString(), firePointQo.getLongitude().toString()));
|
||||
shanDongFirePoint.setSatelliteType(firePointQo.getSatelliteType());
|
||||
shanDongFirePoint.setLandType(firePointQo.getLandtype());
|
||||
shanDongFirePoint.setConfidence(firePointQo.getConfidence());
|
||||
@ -181,7 +179,7 @@ public class FirePointServiceImpl implements FirePointService {
|
||||
shanDongFirePoint.setSatelliteImage(firePointQo.getSatelliteImage());
|
||||
shanDongFirePoint.setVerifyState("0");
|
||||
try {
|
||||
bindStreetCodeName(shanDongFirePoint);
|
||||
bindAddress(shanDongFirePoint);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.out.println("添加山东火点信息 逆地理编码请求街道编号失败:" + e.getMessage());
|
||||
@ -268,39 +266,39 @@ public class FirePointServiceImpl implements FirePointService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 为实体类设置街道编号和街道名称
|
||||
* 为实体类绑定地址、编号、名称
|
||||
*/
|
||||
private void bindStreetCodeName(FirePointEntity firePointEntity) throws Exception {
|
||||
private void bindAddress(FirePointEntity firePointEntity) throws Exception {
|
||||
List<String> locationList = new ArrayList<>();
|
||||
locationList.add(firePointEntity.getLongitude() + "," + firePointEntity.getLatitude());
|
||||
GaoDeIgGeocodeVo geocode = GaoDeApiUtil.geocode(locationList);
|
||||
String townCode = geocode.getRegeocodes().get(0).getAddressComponent().get(0).getTowncode();
|
||||
if (townCode.length() > 9) {
|
||||
townCode = townCode.substring(0, 9);
|
||||
}
|
||||
firePointEntity.setStreetCode(townCode);
|
||||
List<StreetEntity> byStreetCode = streetDao.findByStreetCode(townCode);
|
||||
if (byStreetCode != null && byStreetCode.size() > 0) {
|
||||
firePointEntity.setStreetName(byStreetCode.get(0).getStreetName());
|
||||
}
|
||||
GaoDeIgGeocodeVo.Regeocode reGeoCode = geocode.getRegeocodes().get(0);
|
||||
String formattedAddress = reGeoCode.getFormatted_address();
|
||||
firePointEntity.setFirePointAddress(formattedAddress);
|
||||
GaoDeIgGeocodeVo.AddressComponent addressComponent = reGeoCode.getAddressComponent().get(0);
|
||||
String townCode = addressComponent.getTowncode();
|
||||
String fixedTownCode = townCode.length() > 9 ? townCode.substring(0, 9) : townCode;
|
||||
firePointEntity.setStreetCode(fixedTownCode);
|
||||
String townShip = addressComponent.getTownship();
|
||||
firePointEntity.setStreetName(townShip);
|
||||
}
|
||||
|
||||
/**
|
||||
* 为实体类设置街道编号和街道名称
|
||||
* 为实体类绑定地址、编号、名称
|
||||
*/
|
||||
private void bindStreetCodeName(ShanDongFirePointEntity firePointEntity) throws Exception {
|
||||
private void bindAddress(ShanDongFirePointEntity firePointEntity) throws Exception {
|
||||
List<String> locationList = new ArrayList<>();
|
||||
locationList.add(firePointEntity.getLongitude() + "," + firePointEntity.getLatitude());
|
||||
GaoDeIgGeocodeVo geocode = GaoDeApiUtil.geocode(locationList);
|
||||
String townCode = geocode.getRegeocodes().get(0).getAddressComponent().get(0).getTowncode();
|
||||
if (townCode.length() > 9) {
|
||||
townCode = townCode.substring(0, 9);
|
||||
}
|
||||
firePointEntity.setStreetCode(townCode);
|
||||
List<StreetEntity> byStreetCode = streetDao.findByStreetCode(townCode);
|
||||
if (byStreetCode != null && byStreetCode.size() > 0) {
|
||||
firePointEntity.setStreetName(byStreetCode.get(0).getStreetName());
|
||||
}
|
||||
GaoDeIgGeocodeVo.Regeocode reGeoCode = geocode.getRegeocodes().get(0);
|
||||
String formattedAddress = reGeoCode.getFormatted_address();
|
||||
firePointEntity.setFirePointAddress(formattedAddress);
|
||||
GaoDeIgGeocodeVo.AddressComponent addressComponent = reGeoCode.getAddressComponent().get(0);
|
||||
String townCode = addressComponent.getTowncode();
|
||||
String fixedTownCode = townCode.length() > 9 ? townCode.substring(0, 9) : townCode;
|
||||
firePointEntity.setStreetCode(fixedTownCode);
|
||||
String townShip = addressComponent.getTownship();
|
||||
firePointEntity.setStreetName(townShip);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user