临时停车与继续骑行
This commit is contained in:
parent
88f28e6f6b
commit
05d06d1286
@ -166,4 +166,18 @@ public interface OperationsFeignClient {
|
||||
*/
|
||||
@GetMapping("/ebikeBikeInfo/api/getAllSiteByBikeCode")
|
||||
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);
|
||||
}
|
||||
|
||||
@ -373,23 +373,20 @@ public class EbikeOrderServiceImpl extends ServiceImpl<EbikeOrderMapper, EbikeOr
|
||||
.select(EBIKE_ORDER.ALL_COLUMNS)
|
||||
.where(EBIKE_ORDER.ORDER_ID.eq(tempLockDto.getOrderId()));
|
||||
EbikeOrder ebikeOrder = this.mapper.selectOneByQuery(queryWrapper);
|
||||
// 临时锁车
|
||||
if (Objects.isNull(ebikeOrder)) {
|
||||
throw new EbikeException("当前订单不存在!");
|
||||
}
|
||||
// 临时停车
|
||||
if (tempLockDto.getLockStatus().equals(EbikeTempLockStatus.LOCK)) {
|
||||
if (Objects.isNull(tempLockDto.getLocation())) {
|
||||
throw new EbikeException("关锁时车辆位置不能为空");
|
||||
}
|
||||
EbikeLockVo ebikeLockVo = new EbikeLockVo();
|
||||
ebikeLockVo.setBikeCode(tempLockDto.getBikeCode());
|
||||
ebikeLockVo.setPoint(tempLockDto.getLocation());
|
||||
JsonResult<FeignEbikeUserLockDto> jsonResult = operationsFeignClient.lock(ebikeLockVo);
|
||||
JsonResult<?> jsonResult = operationsFeignClient.tempLock(tempLockDto.getBikeCode());
|
||||
if (jsonResult.getCode() != Code.SUCCESS) {
|
||||
throw new EbikeException("临时关锁失败:" + jsonResult.getMessage());
|
||||
throw new EbikeException("临时停车关锁失败:" + jsonResult.getMessage());
|
||||
}
|
||||
} else if (tempLockDto.getLockStatus().equals(EbikeTempLockStatus.OPEN)) {
|
||||
// 开锁
|
||||
JsonResult<?> jsonResult = operationsFeignClient.openLock(tempLockDto.getBikeCode());
|
||||
// 临时停车继续骑行
|
||||
JsonResult<?> jsonResult = operationsFeignClient.tempLockResume(tempLockDto.getBikeCode());
|
||||
if (jsonResult.getCode() != Code.SUCCESS) {
|
||||
throw new EbikeException("开锁失败:" + jsonResult.getMessage());
|
||||
throw new EbikeException("临时停车继续骑行开锁失败:" + jsonResult.getMessage());
|
||||
}
|
||||
}
|
||||
ebikeOrder.setTempLock(tempLockDto.getLockStatus());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user