|
|
@@ -416,19 +416,19 @@ public class CustomerAccountService {
|
|
|
contractBill.setStatus(BillStatus.CONFIRMED);
|
|
|
contractBill.setConfirmTime(LocalDateTime.now());
|
|
|
}
|
|
|
- if (compare2 >= 0) {
|
|
|
- Set<Long> roomIds = checkinInfoRepo.findAllRoomIdByOrderId(contractBill.getContractId());
|
|
|
- List<RoomInfo> roomInfos = roomInfoRepo.findAllById(roomIds);
|
|
|
- List<RoomInfo> saveRecords = new ArrayList<>();
|
|
|
- roomInfos.forEach(roomInfo -> {
|
|
|
- roomInfo.setPaymentStatus(false);
|
|
|
- saveRecords.add(roomInfo);
|
|
|
- });
|
|
|
- roomInfoRepo.saveAll(saveRecords);
|
|
|
- }
|
|
|
}
|
|
|
contractBill.setRecharged(contractBill.getRecharged().add(money));
|
|
|
contractBill.setRest(rest);
|
|
|
+ if (rest.compareTo(BigDecimal.ZERO) >= 0) {
|
|
|
+ Set<Long> roomIds = checkinInfoRepo.findAllRoomIdByOrderId(contractBill.getContractId());
|
|
|
+ List<RoomInfo> roomInfos = roomInfoRepo.findAllById(roomIds);
|
|
|
+ List<RoomInfo> saveRecords = new ArrayList<>();
|
|
|
+ roomInfos.forEach(roomInfo -> {
|
|
|
+ roomInfo.setPaymentStatus(false);
|
|
|
+ saveRecords.add(roomInfo);
|
|
|
+ });
|
|
|
+ roomInfoRepo.saveAll(saveRecords);
|
|
|
+ }
|
|
|
contractBillRepo.save(contractBill);
|
|
|
CustomerAccount customerAccount = customerAccountRepo.findFirstByCustomerId(contractBill.getCustomerId());
|
|
|
customerAccount.setMoney(customerAccount.getMoney().subtract(money));
|