| | |
| | | public ResultUtil setOrderStatus(Integer uid, Long orderId, Integer payType, Integer state) throws Exception { |
| | | try { |
| | | boolean lock = redisUtil.lock(orderId + "",5); |
| | | if(!lock){ |
| | | int num1 = 1; |
| | | while (num1 <= 10){ |
| | | Thread.sleep(3000);//等待3秒 |
| | | lock = redisUtil.lock(orderId + "",5); |
| | | if(lock){ |
| | | break; |
| | | }else{ |
| | | num1++; |
| | | } |
| | | } |
| | | } |
| | | if(!lock){ |
| | | redisUtil.unlock(orderId + ""); |
| | | return ResultUtil.error("请稍后重试"); |
| | | } |
| | | // if(!lock){ |
| | | // int num1 = 1; |
| | | // while (num1 <= 10){ |
| | | // Thread.sleep(3000);//等待3秒 |
| | | // lock = redisUtil.lock(orderId + "",5); |
| | | // if(lock){ |
| | | // break; |
| | | // }else{ |
| | | // num1++; |
| | | // } |
| | | // } |
| | | // } |
| | | // if(!lock){ |
| | | // redisUtil.unlock(orderId + ""); |
| | | // return ResultUtil.error("请稍后重试"); |
| | | // } |
| | | |
| | | Order order = this.selectById(orderId); |
| | | if(state == 107 && order.getState() != 106){ |
| | |
| | | } |
| | | if(state == 108 && order.getState() != 107){ |
| | | redisUtil.unlock(orderId + ""); |
| | | return ResultUtil.error("操作失败,请刷新数据"); |
| | | // return ResultUtil.error("操作失败,请刷新数据"); |
| | | } |
| | | |
| | | order.setState(state); |