| | |
| | | @Autowired |
| | | private MemberRidesMapper memberRidesMapper; |
| | | @Autowired |
| | | private HolidaysMapper holidaysMapper; |
| | | @Autowired |
| | | private PricingParamMapper pricingParamMapper; |
| | | @Autowired |
| | | private PricingDetailMapper pricingDetailMapper; |
| | | @Autowired |
| | | private ActionLogMapper actionLogMapper; |
| | | |
| | | @Autowired |
| | |
| | | } |
| | | ; |
| | | Locks locks = locksMapper.selectOne(new QueryWrapper<Locks>().eq("code", code).eq("isdeleted", Constants.ZERO).last("limit 1")); |
| | | if (Objects.isNull(locks)) { |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(), "扫码无效,未查询到锁头信息"); |
| | | } |
| | | //查询锁头是否存在车辆 以及是否正常 |
| | | if (!locks.getStatus().equals(Constants.ZERO)) { |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(), "当前扫码锁头状态错误,无法进行开锁"); |
| | | } |
| | | if (StringUtils.isBlank(locks.getBikeCode())) { |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "当前扫码锁头无车辆信息,无法进行开锁"); |
| | | } |
| | | MqttLog flag = deviceService.openLock(locks); |
| | | MemberRidesDetailResponse memberRidesDetailResponse = new MemberRidesDetailResponse(); |
| | | if (flag.getResult() == 0) { |
| | | |
| | | if (Objects.isNull(locks)) { |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(), "扫码无效,未查询到锁头信息"); |
| | | } |
| | | //查询锁头是否存在车辆 以及是否正常 |
| | | if (!locks.getStatus().equals(Constants.ZERO)) { |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(), "当前扫码锁头状态错误,无法进行开锁"); |
| | | } |
| | | if (StringUtils.isBlank(locks.getBikeCode())) { |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "当前扫码锁头无车辆信息,无法进行开锁"); |
| | | } |
| | | //存储骑行记录 |
| | | MemberRides memberRides = new MemberRides(); |
| | | memberRides.setId(Constants.getUUID()); |
| | |
| | | memberRides.setStatus(Constants.MEMBER_RIDES_STATUS.LOCKING.getKey()); |
| | | memberRides.setRentLockId(model.getId()); |
| | | memberRides.setIsdeleted(Constants.ZERO); |
| | | memberRides = findOne(memberRides); |
| | | if(memberRides == null){ |
| | | return 0; |
| | | } |
| | | |
| | | //(更新请求开锁中的锁头关联的骑行记录) |
| | | memberRidesMapper.update(null,new UpdateWrapper<>(memberRides)); |
| | | memberRidesMapper.updateById( memberRides); |
| | | } |
| | | return 0; |
| | | } |