| | |
| | | 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, |
| | | BigDecimal estimatedPrice,String cityCode,Integer carIndex) throws Exception { |
| | | |
| | | long timeMillis = System.currentTimeMillis(); |
| | | //如果出行时间大于当前10分钟则默认为预约单 |
| | | if(travelTime.getTime() > (System.currentTimeMillis() + 600000)){ |
| | | reservation = 2; |
| | |
| | | } |
| | | AssignOrder assignOrder = assignOrderService.selectOne(new EntityWrapper<AssignOrder>().eq("companyId", query.getId()).eq("type", 1)); |
| | | if(null != assignOrder){//配置了指派规则才处理 |
| | | boolean lock = redisUtil.lock("order_lock", 10); |
| | | boolean lock = redisUtil.lock("order_lock", 10, 30); |
| | | if(!lock){ |
| | | int num1 = 1; |
| | | while (num1 <= 10){ |
| | | Thread.sleep(3000);//等待3秒 |
| | | lock = redisUtil.lock("order_lock", 10); |
| | | if(lock){ |
| | | break; |
| | | }else{ |
| | | num1++; |
| | | } |
| | | } |
| | | return ResultUtil.error("系统繁忙,请稍后重试"); |
| | | } |
| | | try { |
| | | //获取空闲司机 |
| | |
| | | */ |
| | | @Override |
| | | public ResultUtil cancleOrderPrivateCar(Integer id, Integer payType, Integer cancleId, Integer type) throws Exception { |
| | | boolean lock = redisUtil.lock(id + "_cancleOrder", 10); |
| | | boolean lock = redisUtil.lock(id + "_cancleOrder", 10, 30); |
| | | if(!lock){ |
| | | int num1 = 1; |
| | | while (num1 <= 10){ |
| | | Thread.sleep(3000);//等待3秒 |
| | | lock = redisUtil.lock(id + "_cancleOrder", 10); |
| | | if(lock){ |
| | | break; |
| | | }else{ |
| | | num1++; |
| | | } |
| | | } |
| | | return ResultUtil.error("系统繁忙,请稍后重试"); |
| | | } |
| | | ResultUtil resultUtil = ResultUtil.success(""); |
| | | try { |
| | |
| | | |
| | | @Override |
| | | public ResultUtil payPrivateCarOrder(Integer payType, Integer orderId, Integer couponId, Integer type) throws Exception { |
| | | boolean lock = redisUtil.lock(orderId + "_payment", 10); |
| | | boolean lock = redisUtil.lock(orderId + "_payment", 10, 30); |
| | | if(!lock){ |
| | | int num1 = 1; |
| | | while (num1 <= 10){ |
| | | Thread.sleep(3000);//等待3秒 |
| | | lock = redisUtil.lock(orderId + "_payment", 10); |
| | | if(lock){ |
| | | break; |
| | | }else{ |
| | | num1++; |
| | | } |
| | | } |
| | | return ResultUtil.error("系统繁忙,请稍后重试"); |
| | | } |
| | | try { |
| | | OrderPrivateCar orderPrivateCar = this.selectById(orderId); |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public synchronized void payOrderPrivateCarCallback(Integer id, String order_id, Integer type) throws Exception { |
| | | boolean lock = redisUtil.lock(order_id + "_paymentCallback", 10); |
| | | boolean lock = redisUtil.lock(order_id + "_paymentCallback", 10, 30); |
| | | if(!lock){ |
| | | int num1 = 1; |
| | | while (num1 <= 10){ |
| | | Thread.sleep(3000);//等待3秒 |
| | | lock = redisUtil.lock(order_id + "_paymentCallback", 10); |
| | | if(lock){ |
| | | break; |
| | | }else{ |
| | | num1++; |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | try { |
| | | PaymentRecord query = paymentRecordService.query(1, null, null, Integer.valueOf(id), 1, type, null); |