|
|
@@ -62,8 +62,9 @@ public class RoomInfoService {
|
|
|
totalRoomCountDTO.setVirtual(false);
|
|
|
Long totalRoomCount = roomInfoRepo.count(getSpecificationForRoomInfoSearch(totalRoomCountDTO));
|
|
|
|
|
|
- Long singleBedRoomCount = roomInfoRepo.count(getSpecificationForRoomInfoSearch(totalRoomCountDTO).and((Specification<RoomInfo>) (root, criteriaQuery, criteriaBuilder) ->
|
|
|
- criteriaBuilder.and(criteriaBuilder.equal(root.join("roomTypeInfo").get("bedCount"), 1))));
|
|
|
+ Long singleBedRoomCount = roomInfoRepo.count(getSpecificationForRoomInfoSearch(totalRoomCountDTO)
|
|
|
+ .and((Specification<RoomInfo>) (root, criteriaQuery, criteriaBuilder) ->
|
|
|
+ criteriaBuilder.and(criteriaBuilder.equal(root.join("roomTypeInfo").get("bedCount"), 1))));
|
|
|
|
|
|
RoomInfoQueryDTO checkinRoomDTO = (RoomInfoQueryDTO) baseDto.clone();
|
|
|
checkinRoomDTO.setCheckInStatus(CheckInStatus.CHECK_IN);
|
|
|
@@ -141,22 +142,23 @@ public class RoomInfoService {
|
|
|
}
|
|
|
|
|
|
public Map<String, StoreStat> storeStat(Long storeId, Long buildingId, Long floorId, Long roomTypeId) {
|
|
|
- List<RoomInfo> allRoomInfos = roomInfoRepo.findAll((Specification<RoomInfo>) (root, criteriaQuery, criteriaBuilder) ->
|
|
|
- {
|
|
|
- List<Predicate> predicates = new ArrayList<>();
|
|
|
- predicates.add(criteriaBuilder.equal(root.get("storeId"), storeId));
|
|
|
- predicates.add(criteriaBuilder.equal(root.get("enabled"), true));
|
|
|
- if (buildingId != null) {
|
|
|
- predicates.add(criteriaBuilder.equal(root.get("buildingId"), buildingId));
|
|
|
- }
|
|
|
- if (floorId != null) {
|
|
|
- predicates.add(criteriaBuilder.equal(root.get("floorId"), floorId));
|
|
|
- }
|
|
|
- if (roomTypeId != null) {
|
|
|
- predicates.add(criteriaBuilder.equal(root.get("roomTypeId"), roomTypeId));
|
|
|
- }
|
|
|
- return criteriaBuilder.and(predicates.toArray(new Predicate[0]));
|
|
|
- });
|
|
|
+ List<RoomInfo> allRoomInfos = roomInfoRepo
|
|
|
+ .findAll((Specification<RoomInfo>) (root, criteriaQuery, criteriaBuilder) ->
|
|
|
+ {
|
|
|
+ List<Predicate> predicates = new ArrayList<>();
|
|
|
+ predicates.add(criteriaBuilder.equal(root.get("storeId"), storeId));
|
|
|
+ predicates.add(criteriaBuilder.equal(root.get("enabled"), true));
|
|
|
+ if (buildingId != null) {
|
|
|
+ predicates.add(criteriaBuilder.equal(root.get("buildingId"), buildingId));
|
|
|
+ }
|
|
|
+ if (floorId != null) {
|
|
|
+ predicates.add(criteriaBuilder.equal(root.get("floorId"), floorId));
|
|
|
+ }
|
|
|
+ if (roomTypeId != null) {
|
|
|
+ predicates.add(criteriaBuilder.equal(root.get("roomTypeId"), roomTypeId));
|
|
|
+ }
|
|
|
+ return criteriaBuilder.and(predicates.toArray(new Predicate[0]));
|
|
|
+ });
|
|
|
List<CheckinInfoDTO> checkinInfoList = checkinInfoRepo.storeCheckinDTO(storeId);
|
|
|
|
|
|
Map<String, StoreStat> map = new HashMap<>();
|
|
|
@@ -546,6 +548,17 @@ public class RoomInfoService {
|
|
|
.map(BedInfoDTO::getCheckinInfo).filter(Objects::nonNull)
|
|
|
.map(CheckinInfo::getOrderId).filter(Objects::nonNull).collect(Collectors.toSet()));
|
|
|
for (BedInfoDTO bedInfo : roomInfoDTO.getBedInfos()) {
|
|
|
+ CheckinInfo checkinInfo = bedInfo.getCheckinInfo();
|
|
|
+ if (!checkinInfo.getName().contains("空床入住")) {
|
|
|
+ if (checkinInfo.getDepositRest().compareTo(BigDecimal.ZERO) == 0) {
|
|
|
+ DepositRecord depositRecord = checkinInfo.getDepositRecord();
|
|
|
+ if (depositRecord != null) {
|
|
|
+ checkinInfo.setDepositRest(depositRecord.getRest());
|
|
|
+ checkinInfoRepo.save(checkinInfo);
|
|
|
+ bedInfo.setCheckinInfo(checkinInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
if (bedInfo.getCheckinInfo() != null && bedInfo.getCheckinInfo().getOrderId() != null) {
|
|
|
bedInfo.getCheckinInfo().setContractNumber(contractList.stream()
|
|
|
.filter(contract -> contract.getId().equals(bedInfo.getCheckinInfo().getOrderId()))
|