临时停车与继续骑行
This commit is contained in:
parent
88f28e6f6b
commit
05d06d1286
@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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)) {
|
||||||
if (tempLockDto.getLockStatus().equals(EbikeTempLockStatus.LOCK)) {
|
throw new EbikeException("当前订单不存在!");
|
||||||
if (Objects.isNull(tempLockDto.getLocation())) {
|
|
||||||
throw new EbikeException("关锁时车辆位置不能为空");
|
|
||||||
}
|
}
|
||||||
EbikeLockVo ebikeLockVo = new EbikeLockVo();
|
// 临时停车
|
||||||
ebikeLockVo.setBikeCode(tempLockDto.getBikeCode());
|
if (tempLockDto.getLockStatus().equals(EbikeTempLockStatus.LOCK)) {
|
||||||
ebikeLockVo.setPoint(tempLockDto.getLocation());
|
JsonResult<?> jsonResult = operationsFeignClient.tempLock(tempLockDto.getBikeCode());
|
||||||
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());
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user