| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.xiaopeng.api.model.operation.XpPoint; |
| | | import com.xiaopeng.api.model.operation.XpSystemSetting; |
| | | import com.xiaopeng.operation.dto.NearestDto; |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | import com.xiaopeng.operation.mapper.XpPointMapper; |
| | | import com.xiaopeng.operation.mapper.XpSystemSettingMapper; |
| | | import com.xiaopeng.operation.query.PointMapQuery; |
| | | import com.xiaopeng.operation.service.XpPointService; |
| | | import com.xiaopeng.operation.utils.map.FastDistanceCalculator; |
| | |
| | | import com.xiaopeng.operation.vo.NearestVo; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | |
| | | @Service |
| | | public class XpPointServiceImpl extends ServiceImpl<XpPointMapper, XpPoint> implements XpPointService { |
| | | |
| | | @Resource |
| | | private XpSystemSettingMapper xpSystemSettingMapper; |
| | | |
| | | |
| | | |
| | | @Override |
| | |
| | | List<XpPoint> list = list(new LambdaQueryWrapper<XpPoint>().eq(XpPoint::getOperationStatus, 1)); |
| | | NearestVo nearestVo = new NearestVo(); |
| | | List<NearestNextVo> nearestNextVos = new ArrayList<>(); |
| | | |
| | | XpSystemSetting xpSystemSetting = xpSystemSettingMapper.selectOne(null); |
| | | Integer orderDistance = xpSystemSetting.getOrderDistance(); |
| | | for (XpPoint xpPoint : list) { |
| | | // 计算距离 小于1000m的站点 |
| | | // 计算距离 小于的站点 |
| | | double v = FastDistanceCalculator.distanceFast(dto.getLatitude(), dto.getLongitude(), xpPoint.getPointLat(), xpPoint.getPointLon()); |
| | | if (v < 1000) { |
| | | if (v < orderDistance) { |
| | | NearestNextVo nearestNextVo = new NearestNextVo(); |
| | | nearestNextVo.setId(xpPoint.getId()); |
| | | nearestNextVo.setName(xpPoint.getPointName()); |