diff --git a/kas-service/src/main/java/com/unlcn/ils/kas/service/order/impl/SharesOrderServiceImpl.java b/kas-service/src/main/java/com/unlcn/ils/kas/service/order/impl/SharesOrderServiceImpl.java index 85c0aa393be265022ad81b6fe3669b520576b4f6..4b6f75cc4854e1b77eb71df1ef4b9d6247597235 100644 --- a/kas-service/src/main/java/com/unlcn/ils/kas/service/order/impl/SharesOrderServiceImpl.java +++ b/kas-service/src/main/java/com/unlcn/ils/kas/service/order/impl/SharesOrderServiceImpl.java @@ -358,7 +358,8 @@ public class SharesOrderServiceImpl implements SharesOrderService { executWay = "insert"; } - + // 添加计算预计运抵时间的模块 + updateNewestPositionRelInfo(orderOtd.getSysOrderNo()); return executWay; } @@ -442,7 +443,7 @@ public class SharesOrderServiceImpl implements SharesOrderService { Number distance = computationalDistance(orderOtd, orderOtdDetail); orderOtdDetail.setDistance(distance.floatValue()); - // 查看存不存在比手动维护的时间要晚,并且距离要远的数据 + // 查看是否存在比该在途数据定位时间更早,离目的地更近的手工维护轨迹点,有则该条在途数据视为不合法,跳过(扩展,如果该数据计算剩余距离时百度异常,剩余距离视为0,肯定能被视为合法) Wrapper wrapper = new EntityWrapper<>(); wrapper.eq("sys_order_no", orderOtdDetail.getSysOrderNo()); wrapper.eq("ismanual", OrderDetailIsmanualEnum.YES.getCode()); @@ -454,8 +455,6 @@ public class SharesOrderServiceImpl implements SharesOrderService { orderOtdDetailService.insert(orderOtdDetail); } - // 添加计算预计运抵时间的模块 - updateNewestPositionRelInfo(orderOtd.getSysOrderNo()); } /** @@ -495,19 +494,29 @@ public class SharesOrderServiceImpl implements SharesOrderService { // 根据详细地址获取距离 destination = orderOtd.getdAddress(); Map mapDestinations = BaiDuMapGeocodeUtil.addressToGPS(destination); - distance = BaiDuMapRouteUtil.getDistance(mapGeo, mapDestinations) / 1000; + if (null == mapDestinations || StringUtils.isEmpty(mapDestinations.get("lat")) + || StringUtils.isEmpty(mapDestinations.get("lng"))) { + distance = null; + } else { + distance = BaiDuMapRouteUtil.getDistance(mapGeo, mapDestinations) / 1000; + } // 如果详细地址无法获取距离,则根据省市区加详细地址 if (distance == null || 0 >= distance.doubleValue()) { destination = orderOtd.getdProvince() + orderOtd.getdCity() + orderOtd.getdAddress(); destination = destination.replaceAll("null", ""); mapDestinations = BaiDuMapGeocodeUtil.addressToGPS(destination); - distance = BaiDuMapRouteUtil.getDistance(mapGeo, mapDestinations) / 1000; + if (null == mapDestinations || StringUtils.isEmpty(mapDestinations.get("lat")) + || StringUtils.isEmpty(mapDestinations.get("lng"))) { + distance = 0.00; + } else { + distance = BaiDuMapRouteUtil.getDistance(mapGeo, mapDestinations) / 1000; + } } } } - return distance; + return null == distance ? 0.00 : distance; } /* @author:罗必量 */