| | |
| | | */ |
| | | @Override |
| | | public synchronized ResultUtil<BaseWarpper> saveOrderPrivateCar(Integer serverCarModelId, Date travelTime, Integer reservation, Integer instead, String placementLon, String placementLat, String startLon, String startLat, |
| | | String startAddress, String endLon, String endLat, String endAddress, String name, String phone, Integer orderSource, Integer driverId, Integer type, Integer uid) throws Exception { |
| | | String startAddress, String endLon, String endLat, String endAddress, String name, String phone, Integer orderSource, Integer driverId, Integer type, Integer uid,BigDecimal estimatedPrice) throws Exception { |
| | | |
| | | //如果出行时间大于当前10分钟则默认为预约单 |
| | | if(travelTime.getTime() > (System.currentTimeMillis() + 600000)){ |
| | |
| | | orderPrivateCar.setTravelTime(travelTime); |
| | | orderPrivateCar.setOrderType(reservation); |
| | | orderPrivateCar.setOrderSource(orderSource); |
| | | orderPrivateCar.setEstimatedPrice(estimatedPrice); |
| | | if(orderSource == 2){//扫码下单 |
| | | Driver driver = driverService.selectById(driverId); |
| | | if(null == driver){ |
| | |
| | | } |
| | | // 判断该司机是否有30分钟内预约单 |
| | | long count = orderPrivateCarss.stream().filter(s -> s.getDriverId().equals(driver1.getId()) && |
| | | DateUtil.dateToLocalDateTime(s.getTravelTime()).minusMinutes(30).isBefore(LocalDateTime.now())).count(); |
| | | DateUtil.dateToLocalDateTime(s.getTravelTime()).minusMinutes(query.getLimitationTime()).isBefore(LocalDateTime.now())).count(); |
| | | if (count > 0) { |
| | | continue; |
| | | } |
| | |
| | | for(Driver driver : list){//开始进行推送 |
| | | // 判断该司机是否有30分钟内预约单 |
| | | long count = orderPrivateCars.stream().filter(orderPrivateCar1 -> driver.getId().equals(orderPrivateCar1.getDriverId()) |
| | | && DateUtil.dateToLocalDateTime(orderPrivateCar1.getTravelTime()).minusMinutes(31).isBefore(LocalDateTime.now()) |
| | | && DateUtil.dateToLocalDateTime(orderPrivateCar1.getTravelTime()).minusMinutes(query.getLimitationTime()).isBefore(LocalDateTime.now()) |
| | | && DateUtil.dateToLocalDateTime(orderPrivateCar1.getTravelTime()).isAfter(LocalDateTime.now())).count(); |
| | | if(orderPrivateCar.getOrderType() == 2 && orderPrivateCarDriverIds.contains(driver.getId())){ |
| | | continue; |
| | |
| | | if(i == querys.size() && state == 1){ |
| | | pushUtil.pushEndPush(1, orderPrivateCar.getUserId(), orderPrivateCar.getId(), 1); |
| | | orderIds.remove(orderPrivateCar.getId()); |
| | | |
| | | // 第三轮取消订单 |
| | | orderPrivateCar.setState(10); |
| | | orderPrivateCarMapper.updateById(orderPrivateCar); |
| | | // 添加站内信 |
| | | systemNoticeService.addSystemNotice(1, "当前区域未能及时为您匹配到合适车辆。为避免耽误您的行程,系统已自动取消订单,建议您稍后重新尝试。", orderPrivateCar.getUserId(), 1); |
| | | // TODO 0731 添加短信发送 |
| | | |
| | | } |
| | | } |
| | | } catch (Exception e) { |