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