| | |
| | | continue; |
| | | } |
| | | Driver driver1 = driverService.selectById(youTuiDriver.getDriverId()); |
| | | if(driver1.getServerStatus() == 2 || driver1.getOpenOrderQRCode() == 1){ |
| | | int count = this.selectCount(new EntityWrapper<Order>().eq("driverId", youTuiDriver.getDriverId()).eq("status", 1).in("state", Arrays.asList(102, 103, 104, 105, 201, 401))); |
| | | if(driver1.getServerStatus() == 2 || driver1.getOpenOrderQRCode() == 1 || count > 0){ |
| | | continue; |
| | | } |
| | | DriverWork driverWork = driverWorkService.selectOne(new EntityWrapper<DriverWork>().eq("driverId", driver1.getId()).eq("status", 1)); |
| | |
| | | if(null == driverWork){ |
| | | continue; |
| | | } |
| | | |
| | | int count = this.selectCount(new EntityWrapper<Order>().eq("driverId", driver1.getId()).eq("status", 1).in("state", Arrays.asList(102, 103, 104, 105, 201, 401))); |
| | | if(count > 0){ |
| | | continue; |
| | | } |
| | | if(integral == null || integral.compareTo(driver1.getIntegral()) < 0){//积分大 |
| | | integral = driver1.getIntegral(); |
| | | score = driver1.getScore(); |
| | |
| | | @Override |
| | | public ResultUtil setOrderStatus(Integer uid, Long orderId, Integer payType, Integer state) throws Exception { |
| | | if(108 == state){ |
| | | String value = redisUtil.getValue("repeat_" + orderId.toString()); |
| | | String value = redisUtil.getValue("repeat_" + orderId); |
| | | if(ToolUtil.isEmpty(value)){ |
| | | redisUtil.setStrValue("repeat_" + orderId, System.currentTimeMillis() + "", 10 * 60); |
| | | redisUtil.setStrValue("repeat_" + orderId, System.currentTimeMillis() + "", 600);//10分钟 |
| | | }else{ |
| | | Long s = System.currentTimeMillis() - Long.valueOf(value); |
| | | if(s < 60000){//1分钟 |
| | | if(s.compareTo(60000L) < 0){//1分钟 |
| | | return ResultUtil.error("数据处理中"); |
| | | } |
| | | redisUtil.setStrValue("repeat_" + orderId, System.currentTimeMillis() + "", 600);//10分钟 |
| | | } |
| | | } |
| | | |
| | |
| | | return ResultUtil.error("操作失败,请刷新订单"); |
| | | } |
| | | Order order = this.selectById(orderId); |
| | | if(order.getState().compareTo(state) == 0){ |
| | | return ResultUtil.error("不能重复操作"); |
| | | } |
| | | order.setState(state); |
| | | |
| | | if(payType == 2 && state == 107){ |
| | |
| | | if(null != order.getUserId()){ |
| | | pushUtil.pushOrderStatus(order.getUserId(), 1, order.getId(), order.getState()); |
| | | } |
| | | if(108 == state){ |
| | | redisUtil.remove("repeat_" + orderId.toString()); |
| | | |
| | | if(payType == 2 && state == 107){ |
| | | new Timer().schedule(new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | Order order1 = OrderServiceImpl.this.selectById(orderId); |
| | | if(order1.getState() == 107){ |
| | | completeCollection_(order1); |
| | | } |
| | | } |
| | | }, 60000); |
| | | } |
| | | |
| | | |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | |
| | | List<Order> orders = this.selectList(new EntityWrapper<Order>().eq("state", 107).eq("status", 1) |
| | | .eq("payType", 3).last(" and UNIX_TIMESTAMP(getoffTime) + 600 <= UNIX_TIMESTAMP(now())")); |
| | | for (Order order : orders) { |
| | | completeCollection_(order); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | public void completeCollection_(Order order) { |
| | | order.setState(108); |
| | | order.setPayTime(new Date()); |
| | | if(null != order.getCouponId()){ |
| | |
| | | saveRevenue(order); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | } |