Commit 348dfc76 by zhengxj

finish 完善距离计算 on 20191118 by zhengxj

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@24913 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent 794ec86c
......@@ -3759,24 +3759,35 @@ public class OrderServiceImpl implements IOrderService {
mechanicLatitude = data.getString("latitude");
}
if (!StringUtils.isEmpty(mechanicLongitude) && null != district) {
if (!StringUtils.isEmpty(mechanicLongitude)) {
// 技工坐标
GlobalCoordinates target = new GlobalCoordinates(Double.parseDouble(mechanicLatitude),
Double.parseDouble(mechanicLongitude));
// 订单坐标
if (null == source) {
String orderAddress = areaService.getFullAreaByDistrictId(district) + order.getAddress();
Map<String, String> orderAddressMap = AMapUtils.parseAddress(orderAddress);
if (orderAddressMap.containsKey("latitude")) {
// 订单坐标
source = new GlobalCoordinates(Double.parseDouble(orderAddressMap.get("latitude")),
Double.parseDouble(orderAddressMap.get("longitude")));
}
String orderAddress = null;
Map<String, String> orderAddressMap = null;
if (null != district && district > 100000) {
orderAddress = areaService.getFullAreaByDistrictId(district) + order.getAddress();
} else {
orderAddress = order.getAddress();
}
if (null != orderAddress) {
orderAddressMap = AMapUtils.parseAddress(orderAddress);
}
if (null != orderAddressMap && orderAddressMap.containsKey("latitude")) {
// 订单坐标
source = new GlobalCoordinates(Double.parseDouble(orderAddressMap.get("latitude")),
Double.parseDouble(orderAddressMap.get("longitude")));
}
// 距离
mechanicBusiness.setDistance((int) AMapUtils.getDistanceMeter(source, target));
if (null != source) {
mechanicBusiness.setDistance((int) AMapUtils.getDistanceMeter(source, target));
}
}
// orderBy:c按单量排序降序,d按距离升序排序(默认),t按时效升序排序
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!