| | |
| | | private static final ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor(); |
| | | |
| | | static { |
| | | threadPoolTaskExecutor.setCorePoolSize(5); |
| | | threadPoolTaskExecutor.setMaxPoolSize(10); |
| | | threadPoolTaskExecutor.setCorePoolSize(50); |
| | | threadPoolTaskExecutor.setMaxPoolSize(100); |
| | | threadPoolTaskExecutor.setQueueCapacity(20); |
| | | threadPoolTaskExecutor.setKeepAliveSeconds(60); |
| | | threadPoolTaskExecutor.setThreadNamePrefix("taskOrder-"); |
| | |
| | | count = fivePushTime / 3; |
| | | processPushOrder(quoteName, count, uid, split, orderNo, xpTradingStrategy, distance, duration, planRule); |
| | | |
| | | // 最终没找到车 |
| | | // redisService.popFirstElement(quoteName); |
| | | |
| | | // 取消订单 |
| | | R<XpOrder> xpOrderR = xpOrderClient.queryOrderById(Long.valueOf(orderId)); |
| | | if(xpOrderR.getCode()==200){ |
| | | if (xpOrderR.getData().getStatus()==1) { |
| | | if (xpOrderR.getCode() == 200) { |
| | | if (xpOrderR.getData().getStatus() == 1) { |
| | | xpOrderClient.cancelOrder(orderId); |
| | | |
| | | // 最终没找到车 |
| | | redisService.popFirstElement(quoteName); |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | @SneakyThrows |
| | | private void processPushOrder(String quoteName, int count, String uid, String[] split, String orderNo, XpTradingStrategy xpTradingStrategy, String distance, String duration, String planRule) { |
| | | // 卡住3秒 |
| | | Thread.sleep(3000); |
| | | System.out.println("进入推单环环节"); |
| | | if (count == 0) { |
| | | count = 1; |
| | |
| | | XpElectronicFence xpElectronicFence = xpElectronicFenceMapper.selectById(electronicId); |
| | | |
| | | for (int i = 0; i < count; i++) { |
| | | |
| | | System.out.println("进入找车环节"); |
| | | // 根据距离找车 |
| | | // 车多则根据配置找具体车数量 根据距离最近 |
| | | // 更改 暂不限制数量 |
| | | |
| | | List<VehiclePosition> positionList = vehiclePositionService.findAvailableVehiclesNearby(Double.parseDouble(split[0]), Double.parseDouble(split[1]), xpTradingStrategy.getOnePushDistance(), xpTradingStrategy.getSimultaneouslyOrderCount()); |
| | | log.info("根据距离找车 {}", positionList); |
| | | log.info("根据距离找车 距离 {}KM 经度 {} 维度 {} 查找结果 {}", xpTradingStrategy.getOnePushDistance(), split[0], split[1], positionList); |
| | | // 获取车辆的区域信息 |
| | | if (positionList.isEmpty()) { |
| | | continue; |