用户开锁逻辑优化
This commit is contained in:
parent
d577d2db06
commit
7917c3b69e
@ -38,7 +38,7 @@ public interface BikeUsageStatus {
|
||||
int UNDER_REPAIR = 5;
|
||||
|
||||
/**
|
||||
* 待投放
|
||||
* 待调度
|
||||
*/
|
||||
int DEPLOYED = 6;
|
||||
}
|
||||
|
||||
@ -288,10 +288,13 @@ public class EbikeBikeInfoServiceImpl extends ServiceImpl<EbikeBikeInfoMapper, E
|
||||
if (info.getStatus() != BikeStatus.LAUNCH) {
|
||||
throw new RuntimeException("车辆未上架,不可骑行");
|
||||
}
|
||||
if (info.getUsageStatus() != BikeUsageStatus.WAIT) {
|
||||
throw new RuntimeException("车辆已被占用或故障");
|
||||
if (info.getUsageStatus() == BikeUsageStatus.CYCLING) {
|
||||
throw new RuntimeException("车辆已被占用");
|
||||
}
|
||||
|
||||
if (info.getUsageStatus() == BikeUsageStatus.REPAIR || info.getUsageStatus() == BikeUsageStatus.UNDER_REPAIR) {
|
||||
throw new RuntimeException("车辆故障");
|
||||
}
|
||||
query.clear();
|
||||
query.where(EBIKE_REGION.REGION_ID.eq(info.getRegionId()));
|
||||
EbikeRegion region = regionMapper.selectOneByQuery(query);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user