| | |
| | | @Override |
| | | public void saveOrderPosition(DriverPositionWarpper driverPositionWarpper) throws Exception { |
| | | Integer orderId = driverPositionWarpper.getOrderId(); |
| | | Order order = orderService.selectById(orderId); |
| | | if(order.getState() != 105){ |
| | | return; |
| | | } |
| | | Integer orderType = driverPositionWarpper.getOrderType(); |
| | | File file = new File(filePath + orderId + ".json"); |
| | | if(!file.exists()){ |
| | |
| | | OrderPositionWarpper orderPositionWarpper = orderPositionWarppers.get(orderPositionWarppers.size() - 1); |
| | | saveOrderMileage(driverPositionWarpper, orderPositionWarpper); |
| | | } |
| | | //大于50米才存储有效定位数据 |
| | | //大于100米才存储有效定位数据 |
| | | if(orderPositionWarppers.size() > 0){ |
| | | OrderPositionWarpper orderPositionWarpper1 = orderPositionWarppers.get(orderPositionWarppers.size() - 1); |
| | | String fromLonLat = driverPositionWarpper.getLon() + "," + driverPositionWarpper.getLat(); |
| | | String toLonLat = orderPositionWarpper1.getLon() + "," + orderPositionWarpper1.getLat(); |
| | | Map<String, Double> distance = GeodesyUtil.getDistance(fromLonLat, toLonLat); |
| | | Double wgs84 = distance.get("WGS84"); |
| | | if(wgs84 >= 50){ |
| | | if(wgs84 >= 50){//5秒165米 |
| | | OrderPositionWarpper orderPositionWarpper = new OrderPositionWarpper(); |
| | | BeanUtils.copyProperties(driverPositionWarpper, orderPositionWarpper); |
| | | orderPositionWarpper.setInsertTime(new Date()); |
| | |
| | | Order order = orderService.selectById(driverPositionWarpper.getOrderId()); |
| | | Double wgs84 = distance.get("WGS84"); |
| | | Integer num = map.get(order.getId().toString()); |
| | | if(50 < wgs84){ |
| | | if(50 < wgs84){//5秒165米 |
| | | order.setActualMileage(order.getActualMileage() + wgs84.intValue()); |
| | | orderService.updateById(order); |
| | | map.put(order.getId().toString(), 0); |