| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import me.chanjar.weixin.common.error.WxErrorException; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.xpath.operations.Bool; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | |
| | | gparam.setStatus(Constants.goodsorderStatus.pay); |
| | | gparam.setType(Constants.ZERO); |
| | | Goodsorder goodsorder = goodsorderService.findOne(gparam); |
| | | this.backBike(goodsorder); |
| | | this.backBike(goodsorder,false); |
| | | } |
| | | |
| | | /** |
| | | * 自动还车 |
| | | * 强制还车 |
| | | * @param id |
| | | */ |
| | | @Transactional |
| | | public void forceBack(String id){ |
| | | Goodsorder goodsorder = goodsorderService.findById(id); |
| | | this.backBike(goodsorder); |
| | | this.backBike(goodsorder,true); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 还车业务 |
| | | * @param goodsorder |
| | | * @param isForce 强制还车 不验证车辆地点 |
| | | */ |
| | | @Transactional(rollbackFor = {BusinessException.class}) |
| | | public void backBike(Goodsorder goodsorder){ |
| | | public void backBike(Goodsorder goodsorder, Boolean isForce){ |
| | | if(Objects.isNull(goodsorder)){ |
| | | throw new BusinessException(ResponseStatus.NO_UNCLOSEED_ORDER.getCode(),"无骑行订单记录"); |
| | | } |
| | |
| | | &&Constants.equalsInteger(rides.getType(),Constants.ONE)){ |
| | | //如果是电车并且是骑行中 进行关锁处理 |
| | | Bikes bike = getElecBikeByCode(rides.getBikeCode()); |
| | | //查询停车站点信息 |
| | | if(bike.getSiteId() ==null){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(), "对不起,请按要求前往停车点停车!"); |
| | | //非强制还车 需要限制地点 |
| | | if(!isForce){ |
| | | //查询停车站点信息 |
| | | if(bike.getSiteId() ==null){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(), "对不起,请按要求前往停车点停车!"); |
| | | } |
| | | } |
| | | |
| | | lockBikes(bike.getDeviceSn(),Constants.ONE);//发起关锁指令请求 |
| | | backIds.add(rides.getId()); |
| | | rides.setStatus(Constants.MEMBER_RIDES_STATUS.BACK_CYCLING.getKey());//已还车 |