| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date;import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.concurrent.LinkedBlockingQueue; |
| | | import java.util.concurrent.ThreadPoolExecutor; |
| | | import java.util.concurrent.TimeUnit; |
| | |
| | | if (!dto.getOrderId().contains("XU") && mqttPublishDto.getCode()== 200) { |
| | | // 修改车子为接单状态 |
| | | xpVehicleClient.updateVehicleStatus(new UpdateVehicleStateDto(dto.getVin(),1)); |
| | | |
| | | return R.ok(true); |
| | | } |
| | | return R.ok(false); |
| | |
| | | SnowFlake snowFlake = new SnowFlake(0, 0); |
| | | snowFlake.withStartTimestamp(1420041600000L); |
| | | long sequence = snowFlake.nextId(); |
| | | xpuUtil.cloudOrderOperation(operationBuilder.build(), dto.getVin(), sequence); |
| | | MqttPublishDto mqttPublishDto = xpuUtil.cloudOrderOperation(operationBuilder.build(), dto.getVin(), sequence); |
| | | |
| | | if (mqttPublishDto.getCode() == 200) { |
| | | if(!dto.getOrderId().contains("XU")){ |
| | | // 正常订单处理 |
| | | redisService.setCacheObject(String.valueOf(sequence), "cancelOrder_" + dto.getOrderId() + "_" + dto.getVin(), 30l, TimeUnit.MINUTES); |
| | | } |
| | | return R.ok(true); |
| | | } |
| | | |
| | | return R.ok(false); |
| | | |
| | | |
| | | } |
| | |
| | | vehicleId = 11L;//默认使用造的测试车辆 |
| | | } |
| | | if(null == startLat || null == startLon){ |
| | | startLat = 23.157155D; |
| | | startLon = 113.382373D; |
| | | startLat = 30.583407D; |
| | | startLon = 104.040251D; |
| | | } |
| | | XpVehicle xpVehicle = xpVehicleClient.queryById(vehicleId).getData(); |
| | | XpOrder xpOrder = null; |
| | |
| | | orderId = xpOrder.getId(); |
| | | String vin = xpVehicle.getVehicleVin(); |
| | | Long appUserId = xpOrder.getAppUserId(); |
| | | Object cacheObject = redisService.getCacheObject("ORDER_NAVIGATION_START_DATA:" + xpOrder.getAppUserId()); |
| | | RouteVo routeVo = JSON.parseObject(cacheObject.toString(), RouteVo.class); |
| | | // Object cacheObject = redisService.getCacheObject("ORDER_NAVIGATION_START_DATA:" + xpOrder.getAppUserId()); |
| | | // RouteVo routeVo = JSON.parseObject(cacheObject.toString(), RouteVo.class); |
| | | RouteVo routeVo =new RouteVo(); |
| | | ArrayList<LonLatDto> lonLatDtos = new ArrayList<>(); |
| | | LonLatDto lonLatDto1 = new LonLatDto(); |
| | | lonLatDto1.setLatitude(30.575685); |
| | | lonLatDto1.setLongitude(104.001118); |
| | | lonLatDtos.add(lonLatDto1); |
| | | routeVo.setPolyline(lonLatDtos); |
| | | |
| | | |
| | | ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(1000)); |
| | | Long finalOrderId = orderId; |
| | |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | |
| | | List<LonLatDto> polyline = routeVo.getPolyline(); |
| | | for (LonLatDto lonLatDto : polyline) { |
| | | Double latitude = lonLatDto.getLatitude(); |