| | |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.DistancematrixVo; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.FleetEngineUtil; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.GoogleMapUtil; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.ReverseGeocodeVo; |
| | | import com.stylefeng.guns.modular.system.util.Tingg.TinggPayUtil; |
| | |
| | | |
| | | @Resource |
| | | private IBalanceUsageRecordService balanceUsageRecordService; |
| | | |
| | | @Resource |
| | | private FleetEngineUtil fleetEngineUtil; |
| | | |
| | | @Autowired |
| | | private IOrderPositionService orderPositionService; |
| | | |
| | | |
| | | |
| | |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void getDriverNowPosition() { |
| | | for (OrderPrivateCar orderPrivateCar : orderPrivateCarService.selectList(new EntityWrapper<OrderPrivateCar>().eq("state", 5))) { |
| | | String trackId = orderPrivateCar.getTrackId(); |
| | | if(ToolUtil.isNotEmpty(trackId)){ |
| | | String trip = fleetEngineUtil.getTrip(trackId); |
| | | JSONObject lastLocation = JSON.parseObject(trip).getJSONObject("lastLocation"); |
| | | JSONObject location = lastLocation.getJSONObject("location"); |
| | | Double latitude = location.getDouble("latitude"); |
| | | Double longitude = location.getDouble("longitude"); |
| | | OrderPosition orderPosition = new OrderPosition(); |
| | | orderPosition.setOrderId(orderPrivateCar.getId()); |
| | | orderPosition.setOrderType(1); |
| | | orderPosition.setDriverId(orderPrivateCar.getDriverId()); |
| | | orderPosition.setLat(latitude.toString()); |
| | | orderPosition.setLon(longitude.toString()); |
| | | orderPosition.setInsertTime(new Date()); |
| | | try { |
| | | orderPositionService.saveData(orderPosition); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | } |
| | | |
| | | List<OrderLogistics> orderLogisticsList = orderLogisticsService.selectList(new EntityWrapper<OrderLogistics>().eq("state", 5)); |
| | | for (OrderLogistics orderLogistics : orderLogisticsList) { |
| | | String trackId = orderLogistics.getTrackId(); |
| | | if(ToolUtil.isNotEmpty(trackId)){ |
| | | String trip = fleetEngineUtil.getTrip(trackId); |
| | | JSONObject lastLocation = JSON.parseObject(trip).getJSONObject("lastLocation"); |
| | | JSONObject location = lastLocation.getJSONObject("location"); |
| | | Double latitude = location.getDouble("latitude"); |
| | | Double longitude = location.getDouble("longitude"); |
| | | OrderPosition orderPosition = new OrderPosition(); |
| | | orderPosition.setOrderId(orderLogistics.getId()); |
| | | orderPosition.setOrderType(1); |
| | | orderPosition.setDriverId(orderLogistics.getDriverId()); |
| | | orderPosition.setLat(latitude.toString()); |
| | | orderPosition.setLon(longitude.toString()); |
| | | orderPosition.setInsertTime(new Date()); |
| | | try { |
| | | orderPositionService.saveData(orderPosition); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |