| | |
| | | import com.xiaopeng.map.service.XpElectronicFenceService; |
| | | import com.xiaopeng.map.service.XpPointService; |
| | | import com.xiaopeng.map.service.XpStationService; |
| | | import com.xiaopeng.map.utils.GDMapGeocodingUtil; |
| | | import com.xiaopeng.map.utils.holiday.HolidayUtil; |
| | | import com.xiaopeng.map.utils.map.map.FastDistanceCalculator; |
| | | import com.xiaopeng.map.vo.*; |
| | |
| | | @Lazy |
| | | @Resource |
| | | private XpElectronicFenceService xpElectronicFenceService; |
| | | @Resource |
| | | private GDMapGeocodingUtil gdMapGeocodingUtil; |
| | | |
| | | |
| | | |
| | |
| | | xpPoint.setFpElectronicAreaId(pointAddDto.getElectronicAreaId()); |
| | | xpPoint.setPointNumber(pointNumber); |
| | | xpPoint.setStationSortNo(0); |
| | | Map<String, String> geocode = gdMapGeocodingUtil.geocode(xpPoint.getPointLon().toString(), xpPoint.getPointLat().toString()); |
| | | if(null == geocode){ |
| | | throw new ServiceException("点位定位解析失败"); |
| | | } |
| | | xpPoint.setCityCode(geocode.get("cityCode")); |
| | | xpPoint.setCityName(geocode.get("address")); |
| | | this.save(xpPoint); |
| | | |
| | | //场站点位排序 后添加的点位 排第一个。 |
| | |
| | | if (!locked) { |
| | | throw new ServiceException("点位编号生成繁忙,请稍后重试", I18nKeyConstant.POINT_NUMBER_LOCK_FAIL); |
| | | } |
| | | validateFencePointCountLimit(pointAddDto.getElectronicAreaId()); |
| | | // validateFencePointCountLimit(electronicAreaId); |
| | | String maxPointNumber = this.baseMapper.selectMaxPointNumber(cityPrefix, POINT_BIZ_TYPE); |
| | | int nextSerial = 1; |
| | | if (StringUtils.hasText(maxPointNumber)) { |
| | |
| | | if (!intime) { |
| | | continue; |
| | | } |
| | | Integer parkingTimeLimit = xpPoint.getParkingTimeLimit(); |
| | | //如果点位位于场站内,则使用场站的限停时间 |
| | | if(null != xpPoint.getStationId()){ |
| | | XpStation xpStation = xpStationService.getById(xpPoint.getStationId()); |
| | | parkingTimeLimit = xpStation.getParkingTimeLimit(); |
| | | } |
| | | // 计算距离 小于的站点 |
| | | double v = FastDistanceCalculator.distanceFast(dto.getLatitude(), dto.getLongitude(), xpPoint.getPointLat(), xpPoint.getPointLon()); |
| | | if (v < orderDistance) { |
| | |
| | | nearestNextVo.setLongitude(xpPoint.getPointLon()); |
| | | nearestNextVo.setDistance(v); |
| | | nearestNextVo.setAddress(xpPoint.getPointAddress()); |
| | | nearestNextVo.setTime(xpPoint.getParkingTimeLimit()); |
| | | nearestNextVo.setTime(parkingTimeLimit); |
| | | nearestNextVo.setElectronicAreaId(xpPoint.getElectronicAreaId()); |
| | | |
| | | |
| | |
| | | |
| | | @Override |
| | | public List<XpPoint> listAll(PointListQuery query) { |
| | | List<XpPoint> list = this.baseMapper.listAll(query); |
| | | for (XpPoint xpPoint : list) { |
| | | String pointPictures = xpPoint.getPointPictures(); |
| | | log.info("pointPictures:{}", pointPictures); |
| | | if (StringUtils.isNotBlank(pointPictures)) { |
| | | log.info("pointPictures进入处理:{}", pointPictures); |
| | | |
| | | JSONArray jsonArray = JSONArray.parseArray(pointPictures); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | if (Objects.isNull(jsonObject)) { |
| | | continue; |
| | | } |
| | | String downloadUrl =""; |
| | | // try { todo 20260422 yyy暂时注释 |
| | | // downloadUrl = aliOssService.getDownloadUrl(jsonObject.getString("id"), jsonObject.getString("name"), true); |
| | | // log.info("downloadUrl:{}", downloadUrl); |
| | | // } catch (UnsupportedEncodingException e) { |
| | | // log.error("获取图片下载地址失败", e); |
| | | // } |
| | | jsonObject.put("url", downloadUrl); |
| | | } |
| | | log.info("jsonArray:{}", jsonArray); |
| | | xpPoint.setPointPictures(JSONArray.toJSONString(jsonArray)); |
| | | log.info("xpPoint:{}", xpPoint.getPointPictures()); |
| | | } |
| | | |
| | | } |
| | | |
| | | return list; |
| | | return this.baseMapper.listAll(query); |
| | | } |
| | | |
| | | @Override |
| | |
| | | List<XpPoint> xpPoints = this.baseMapper.selectBatchIds(historyStartPointsDto.getPointIds()); |
| | | ArrayList<XpHistoryStartPointsVo> resultList = new ArrayList<>(10); |
| | | for (XpPoint xpPoint : xpPoints) { |
| | | Integer parkingTimeLimit = xpPoint.getParkingTimeLimit(); |
| | | //如果点位位于场站内,则使用场站的限停时间 |
| | | if(null != xpPoint.getStationId()){ |
| | | XpStation xpStation = xpStationService.getById(xpPoint.getStationId()); |
| | | parkingTimeLimit = xpStation.getParkingTimeLimit(); |
| | | } |
| | | XpHistoryStartPointsVo xpHistoryStartPointsVo = new XpHistoryStartPointsVo(); |
| | | xpHistoryStartPointsVo.setName(xpPoint.getPointName()); |
| | | xpHistoryStartPointsVo.setAddress(xpPoint.getPointAddress()); |
| | |
| | | xpHistoryStartPointsVo.setId(xpPoint.getId()); |
| | | double distanced = FastDistanceCalculator.distanceFastKm(historyStartPointsDto.getLat(), historyStartPointsDto.getLon(), xpPoint.getPointLat(), xpPoint.getPointLon()); |
| | | xpHistoryStartPointsVo.setDistance(distanced); |
| | | xpHistoryStartPointsVo.setTime(xpPoint.getParkingTimeLimit()); |
| | | xpHistoryStartPointsVo.setTime(parkingTimeLimit); |
| | | xpHistoryStartPointsVo.setElectronicAreaId(xpPoint.getElectronicAreaId()); |
| | | resultList.add(xpHistoryStartPointsVo); |
| | | |
| | |
| | | List<XpPoint> xpPoints = this.baseMapper.selectBatchIds(historyEndPointsDto.getPointIds()); |
| | | ArrayList<XpHistoryEndPointsVo> resultList = new ArrayList<>(10); |
| | | for (XpPoint xpPoint : xpPoints) { |
| | | Integer parkingTimeLimit = xpPoint.getParkingTimeLimit(); |
| | | //如果点位位于场站内,则使用场站的限停时间 |
| | | if(null != xpPoint.getStationId()){ |
| | | XpStation xpStation = xpStationService.getById(xpPoint.getStationId()); |
| | | parkingTimeLimit = xpStation.getParkingTimeLimit(); |
| | | } |
| | | XpHistoryEndPointsVo xpHistoryEndPointsVo = new XpHistoryEndPointsVo(); |
| | | xpHistoryEndPointsVo.setName(xpPoint.getPointName()); |
| | | xpHistoryEndPointsVo.setAddress(xpPoint.getPointAddress()); |
| | |
| | | xpHistoryEndPointsVo.setId(xpPoint.getId()); |
| | | double distanced = FastDistanceCalculator.distanceFastKm(historyEndPointsDto.getLat(), historyEndPointsDto.getLon(), xpPoint.getPointLat(), xpPoint.getPointLon()); |
| | | xpHistoryEndPointsVo.setDistance(distanced); |
| | | xpHistoryEndPointsVo.setTime(xpPoint.getParkingTimeLimit()); |
| | | xpHistoryEndPointsVo.setTime(parkingTimeLimit); |
| | | xpHistoryEndPointsVo.setElectronicAreaId(xpPoint.getElectronicAreaId()); |
| | | resultList.add(xpHistoryEndPointsVo); |
| | | } |
| | |
| | | query.setPointLonAndLat(null); |
| | | } |
| | | } |
| | | List<XpPoint> list = this.pageList(pageInfo,query); |
| | | List<XpPoint> list = this.baseMapper.pageList(pageInfo,query); |
| | | list.forEach(s->s.setStrId(s.getId().toString())); |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | |
| | | return Collections.emptySet(); |
| | | } |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<XpPoint> listByStationId(Long stationId) { |
| | | if (stationId == null) { |
| | |
| | | .eq(XpPoint::getStationId, stationId) |
| | | .list(); |
| | | } |
| | | |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public void clearStationInfoByStationId(Long stationId) { |