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);