|
|
@@ -80,6 +80,7 @@ public class ContractService {
|
|
|
private final PersonalFeeTypeRepo personalFeeTypeRepo;
|
|
|
private final ContractEntryAccountRepo contractEntryAccountRepo;
|
|
|
private final BookInfoRepo bookInfoRepo;
|
|
|
+ private final RoomInfoRepo roomInfoRepo;
|
|
|
|
|
|
public static List<ContractBill> calcBills(Contract contract) {
|
|
|
fixContractProperties(contract);
|
|
|
@@ -1041,4 +1042,19 @@ public class ContractService {
|
|
|
contract.setStatus(ContractStatus.STAY_IN);
|
|
|
contractRepo.save(contract);
|
|
|
}
|
|
|
+
|
|
|
+ @Scheduled(cron = "0 0 4 * * ?")
|
|
|
+ public void checkContractRoom() {
|
|
|
+ List<ContractBill> contractBills = contractBillRepo.findByRestLessThan(BigDecimal.ZERO);
|
|
|
+ contractBills.forEach(contractBill -> {
|
|
|
+ Set<Long> roomIds = checkinInfoRepo.findAllRoomIdByOrderId(contractBill.getContractId());
|
|
|
+ List<RoomInfo> roomInfos = roomInfoRepo.findAllById(roomIds);
|
|
|
+ List<RoomInfo> saveRecords = new ArrayList<>();
|
|
|
+ roomInfos.forEach(roomInfo -> {
|
|
|
+ roomInfo.setPaymentStatus(true);
|
|
|
+ saveRecords.add(roomInfo);
|
|
|
+ });
|
|
|
+ roomInfoRepo.saveAll(saveRecords);
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|