领取电池新增逻辑
This commit is contained in:
parent
8355ee14a2
commit
70e73dc6d1
@ -296,6 +296,12 @@ public class EbikeBikeOrderServiceImpl extends ServiceImpl<EbikeBikeOrderMapper,
|
||||
throw new EbikeException("当前用户存在领取电池尚未归还,归还后再试");
|
||||
}
|
||||
List<String> codes = batteryClaimVo.getCodes();
|
||||
List<String> ecuSns = codes.stream().map(code -> {
|
||||
if (!code.startsWith("B")) {
|
||||
return code;
|
||||
}
|
||||
return null;
|
||||
}).filter(Objects::nonNull).toList();
|
||||
EbikeBorrowBatteryRecord batteryRecord = EbikeBorrowBatteryRecord.builder()
|
||||
.borrowNum(codes.size())
|
||||
.createBy(StpUtil.getLoginIdAsLong())
|
||||
@ -314,7 +320,12 @@ public class EbikeBikeOrderServiceImpl extends ServiceImpl<EbikeBikeOrderMapper,
|
||||
if (!list.isEmpty()) {
|
||||
recordCodesMapper.insertBatch(list);
|
||||
}
|
||||
|
||||
if (!ecuSns.isEmpty()) {
|
||||
UpdateChain.of(EbikeEcuInfo.class)
|
||||
.set(EBIKE_ECU_INFO.IS_CLAIM, Boolean.TRUE)
|
||||
.where(EBIKE_ECU_INFO.ECU_SN.in(ecuSns))
|
||||
.update();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -819,7 +830,7 @@ public class EbikeBikeOrderServiceImpl extends ServiceImpl<EbikeBikeOrderMapper,
|
||||
.select(EBIKE_BIKE_INFO.OPERATOR_ID)
|
||||
.where(EBIKE_BIKE_INFO.BIKE_CODE.in(bikeCodes))
|
||||
.groupBy(EBIKE_BIKE_INFO.OPERATOR_ID);
|
||||
List<Long> countList = bikeInfoMapper.selectListByQueryAs(queryWrapper,Long.class);
|
||||
List<Long> countList = bikeInfoMapper.selectListByQueryAs(queryWrapper, Long.class);
|
||||
if (countList.size() > 1) {
|
||||
throw new EbikeException("该列表中同时存在不同运营商的车辆");
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user