From c1b14154ad9b588f25258df0b28139df59147bc2 Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Mon, 24 Oct 2022 11:37:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=9E=E6=BB=9A=20=E5=B1=B1=E4=B8=9C?= =?UTF-8?q?=E7=9C=81=E5=86=85=20=E6=9B=BF=E6=8D=A2=E8=A1=97=E9=81=93?= =?UTF-8?q?=E7=BA=A7=E5=8C=BA=E5=88=92=E7=BC=96=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/FirePointServiceImpl.java | 43 +++++++++++-------- 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java b/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java index 49fec36..5667552 100644 --- a/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java @@ -184,24 +184,24 @@ public class FirePointServiceImpl implements FirePointService { shanDongFirePoint.setCountyCode(firePointQo.getCountyCode().toString()); shanDongFirePoint.setCountyName(firePointQo.getCountyName()); - //设置乡镇街道区划编码和名称---Start - String townCode = firePointQo.getTowncode(); - shanDongFirePoint.setStreetCode(townCode); - shanDongFirePoint.setStreetName(""); - List streetList = streetService.findByStreetCode(townCode); - if (null != streetList && streetList.size() > 0) { - StreetEntity street = streetList.get(0); - shanDongFirePoint.setStreetName(street.getStreetName()); - if (!street.getCountyCode().equals(shanDongFirePoint.getCountyCode())) {//这三个错误日志可以监视接收的towncode有木有问题,日志里不出现"发生重大错误"就是没问题 - log.info("发生重大错误,接收的countyCode是" + shanDongFirePoint.getCountyCode() + ",本地表中根据streetCode(towncode)" + townCode + "找到的countyCode是" + street.getCountyCode() + ",firePointQo详情=" + firePointQo.toString()); - } - if (!street.getCountyName().equals(shanDongFirePoint.getCountyName())) { - log.info("发生重大错误,接收的countyName是" + shanDongFirePoint.getCountyName() + ",本地表中根据streetCode(towncode)" + townCode + "找到的countyName是" + street.getCountyName() + ",firePointQo详情=" + firePointQo.toString()); - } - } else { - log.info("发生重大错误,传过来的towncode(" + townCode + ")连找都找不到,firePointQo详情=" + firePointQo.toString()); - } - //设置乡镇街道区划编码和名称---End +// //设置乡镇街道区划编码和名称---Start +// String townCode = firePointQo.getTowncode(); +// shanDongFirePoint.setStreetCode(townCode); +// shanDongFirePoint.setStreetName(""); +// List streetList = streetService.findByStreetCode(townCode); +// if (null != streetList && streetList.size() > 0) { +// StreetEntity street = streetList.get(0); +// shanDongFirePoint.setStreetName(street.getStreetName()); +// if (!street.getCountyCode().equals(shanDongFirePoint.getCountyCode())) {//这三个错误日志可以监视接收的towncode有木有问题,日志里不出现"发生重大错误"就是没问题 +// log.info("发生重大错误,接收的countyCode是" + shanDongFirePoint.getCountyCode() + ",本地表中根据streetCode(towncode)" + townCode + "找到的countyCode是" + street.getCountyCode() + ",firePointQo详情=" + firePointQo.toString()); +// } +// if (!street.getCountyName().equals(shanDongFirePoint.getCountyName())) { +// log.info("发生重大错误,接收的countyName是" + shanDongFirePoint.getCountyName() + ",本地表中根据streetCode(towncode)" + townCode + "找到的countyName是" + street.getCountyName() + ",firePointQo详情=" + firePointQo.toString()); +// } +// } else { +// log.info("发生重大错误,传过来的towncode(" + townCode + ")连找都找不到,firePointQo详情=" + firePointQo.toString()); +// } +// //设置乡镇街道区划编码和名称---End shanDongFirePoint.setSatelliteTime(DateTimeUtil.timeMillisToString(firePointQo.getSatelliteTimeTs().longValue())); shanDongFirePoint.setLongitude(firePointQo.getLongitude()); @@ -321,6 +321,13 @@ public class FirePointServiceImpl implements FirePointService { GaoDeIgGeocodeVo.Regeocode reGeoCode = geocode.getRegeocodes().get(0); String formattedAddress = reGeoCode.getFormatted_address(); firePointEntity.setFirePointAddress(formattedAddress); + GaoDeIgGeocodeVo.AddressComponent addressComponent = reGeoCode.getAddressComponent().get(0); + firePointEntity.setCountyCode(addressComponent.getAdcode()); + firePointEntity.setCountyName(addressComponent.getDistrict()); + String townCode = addressComponent.getTowncode(); + String fixedTownCode = townCode.length() > 9 ? townCode.substring(0, 9) : townCode; + firePointEntity.setStreetCode(fixedTownCode); + firePointEntity.setStreetName(addressComponent.getTownship()); } /**