From 52fba818eb30006947ec326aa359d8a1a20ed660 Mon Sep 17 00:00:00 2001 From: Guoqs <123@jsowell.com> Date: Fri, 16 Aug 2024 14:32:02 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E5=90=8E=E7=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pile/service/impl/PileStationInfoServiceImpl.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileStationInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileStationInfoServiceImpl.java index bb0432d15..b7afebd79 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileStationInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileStationInfoServiceImpl.java @@ -188,8 +188,14 @@ public class PileStationInfoServiceImpl implements PileStationInfoService { if (StringUtils.isNotBlank(pileStationInfo.getMatchCars())) { vo.setSelectMatchCars(Lists.newArrayList(pileStationInfo.getMatchCars().split(","))); } - vo.setStationLat(pileStationInfo.getStationLat()); - vo.setStationLng(pileStationInfo.getStationLng()); + + // 数据库保存的是GCJ02坐标,需要转换成天地图使用的WGS84坐标 + if (StringUtils.isNotBlank(pileStationInfo.getStationLat()) && StringUtils.isNotBlank(pileStationInfo.getStationLng())) { + CoordinateUtil.Coordinate coordinate = CoordinateUtil.gcj02ToWgs84(Double.parseDouble(pileStationInfo.getStationLat()), Double.parseDouble(pileStationInfo.getStationLng())); + vo.setStationLat(String.valueOf(coordinate.getLat())); + vo.setStationLng(String.valueOf(coordinate.getLng())); + } + vo.setCountryCode(pileStationInfo.getCountryCode()); vo.setConstruction(pileStationInfo.getConstruction()); vo.setBusinessHours(pileStationInfo.getBusinessHours()); @@ -407,7 +413,6 @@ public class PileStationInfoServiceImpl implements PileStationInfoService { } } - pileStationInfo.setUpdateBy(SecurityUtils.getUsername()); pileStationInfo.setUpdateTime(DateUtils.getNowDate()); int i = pileStationInfoMapper.updatePileStationInfo(pileStationInfo);