临时停车与继续骑行

This commit is contained in:
yanglei 2026-02-27 13:51:10 +08:00
parent 88f28e6f6b
commit 05d06d1286
2 changed files with 23 additions and 12 deletions

View File

@ -166,4 +166,18 @@ public interface OperationsFeignClient {
*/ */
@GetMapping("/ebikeBikeInfo/api/getAllSiteByBikeCode") @GetMapping("/ebikeBikeInfo/api/getAllSiteByBikeCode")
JsonResult<List<FeignEbikeSiteVo>> getAllSiteByBikeCode(@RequestParam("bikeCode") String bikeCode); JsonResult<List<FeignEbikeSiteVo>> getAllSiteByBikeCode(@RequestParam("bikeCode") String bikeCode);
/**
* 临时停车
* @param bikeCode 车辆编号
*/
@GetMapping("/ebikeBikeInfo/api/tempLock")
JsonResult<?> tempLock(@RequestParam("bikeCode") String bikeCode);
/**
* 临时停车继续骑行
* @param bikeCode 车辆编号
*/
@GetMapping("/ebikeBikeInfo/api/tempLockResume")
JsonResult<?> tempLockResume(@RequestParam("bikeCode") String bikeCode);
} }

View File

@ -373,23 +373,20 @@ public class EbikeOrderServiceImpl extends ServiceImpl<EbikeOrderMapper, EbikeOr
.select(EBIKE_ORDER.ALL_COLUMNS) .select(EBIKE_ORDER.ALL_COLUMNS)
.where(EBIKE_ORDER.ORDER_ID.eq(tempLockDto.getOrderId())); .where(EBIKE_ORDER.ORDER_ID.eq(tempLockDto.getOrderId()));
EbikeOrder ebikeOrder = this.mapper.selectOneByQuery(queryWrapper); EbikeOrder ebikeOrder = this.mapper.selectOneByQuery(queryWrapper);
// 临时锁车 if (Objects.isNull(ebikeOrder)) {
throw new EbikeException("当前订单不存在!");
}
// 临时停车
if (tempLockDto.getLockStatus().equals(EbikeTempLockStatus.LOCK)) { if (tempLockDto.getLockStatus().equals(EbikeTempLockStatus.LOCK)) {
if (Objects.isNull(tempLockDto.getLocation())) { JsonResult<?> jsonResult = operationsFeignClient.tempLock(tempLockDto.getBikeCode());
throw new EbikeException("关锁时车辆位置不能为空");
}
EbikeLockVo ebikeLockVo = new EbikeLockVo();
ebikeLockVo.setBikeCode(tempLockDto.getBikeCode());
ebikeLockVo.setPoint(tempLockDto.getLocation());
JsonResult<FeignEbikeUserLockDto> jsonResult = operationsFeignClient.lock(ebikeLockVo);
if (jsonResult.getCode() != Code.SUCCESS) { if (jsonResult.getCode() != Code.SUCCESS) {
throw new EbikeException("临时关锁失败:" + jsonResult.getMessage()); throw new EbikeException("临时停车关锁失败:" + jsonResult.getMessage());
} }
} else if (tempLockDto.getLockStatus().equals(EbikeTempLockStatus.OPEN)) { } else if (tempLockDto.getLockStatus().equals(EbikeTempLockStatus.OPEN)) {
// 开锁 // 临时停车继续骑行
JsonResult<?> jsonResult = operationsFeignClient.openLock(tempLockDto.getBikeCode()); JsonResult<?> jsonResult = operationsFeignClient.tempLockResume(tempLockDto.getBikeCode());
if (jsonResult.getCode() != Code.SUCCESS) { if (jsonResult.getCode() != Code.SUCCESS) {
throw new EbikeException("开锁失败:" + jsonResult.getMessage()); throw new EbikeException("临时停车继续骑行开锁失败:" + jsonResult.getMessage());
} }
} }
ebikeOrder.setTempLock(tempLockDto.getLockStatus()); ebikeOrder.setTempLock(tempLockDto.getLockStatus());