用户开锁逻辑优化

This commit is contained in:
attiya 2025-11-25 11:26:48 +08:00
parent d577d2db06
commit 7917c3b69e
2 changed files with 6 additions and 3 deletions

View File

@ -38,7 +38,7 @@ public interface BikeUsageStatus {
int UNDER_REPAIR = 5; int UNDER_REPAIR = 5;
/** /**
* 投放 * 调度
*/ */
int DEPLOYED = 6; int DEPLOYED = 6;
} }

View File

@ -288,10 +288,13 @@ public class EbikeBikeInfoServiceImpl extends ServiceImpl<EbikeBikeInfoMapper, E
if (info.getStatus() != BikeStatus.LAUNCH) { if (info.getStatus() != BikeStatus.LAUNCH) {
throw new RuntimeException("车辆未上架,不可骑行"); throw new RuntimeException("车辆未上架,不可骑行");
} }
if (info.getUsageStatus() != BikeUsageStatus.WAIT) { if (info.getUsageStatus() == BikeUsageStatus.CYCLING) {
throw new RuntimeException("车辆已被占用或故障"); throw new RuntimeException("车辆已被占用");
} }
if (info.getUsageStatus() == BikeUsageStatus.REPAIR || info.getUsageStatus() == BikeUsageStatus.UNDER_REPAIR) {
throw new RuntimeException("车辆故障");
}
query.clear(); query.clear();
query.where(EBIKE_REGION.REGION_ID.eq(info.getRegionId())); query.where(EBIKE_REGION.REGION_ID.eq(info.getRegionId()));
EbikeRegion region = regionMapper.selectOneByQuery(query); EbikeRegion region = regionMapper.selectOneByQuery(query);