|
|
@@ -103,12 +103,12 @@ public class RoomInfoService {
|
|
|
long checkinCount = checkinInfoRepo.countAllByStoreIdAndCheckout(baseDto.getStoreId(), false);
|
|
|
|
|
|
List<CheckinInfoDTO> checkinInfoList = checkinInfoRepo.findRateAllByStoreId(baseDto.getStoreId());
|
|
|
- checkinInfoList = checkinInfoList.stream().filter(checkinInfo -> checkinInfo.getDayRate() != null).collect(Collectors.toList());
|
|
|
- BigDecimal totalPrice = checkinInfoList.stream().map(CheckinInfoDTO::getDayRate).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ checkinInfoList = checkinInfoList.stream().filter(checkinInfo -> checkinInfo.getMonthRate() != null).collect(Collectors.toList());
|
|
|
+ BigDecimal totalPrice = checkinInfoList.stream().map(CheckinInfoDTO::getMonthRate).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
|
|
BigDecimal averagePrice = checkinCount > 0 ? totalPrice.divide(BigDecimal.valueOf(checkinCount), 2, BigDecimal.ROUND_HALF_EVEN) : BigDecimal.ZERO;
|
|
|
|
|
|
- BigDecimal checkinRate = totalBedCount > 0 ? BigDecimal.valueOf(100 * checkinCount / totalBedCount) : BigDecimal.ZERO;
|
|
|
+ BigDecimal checkinRate = totalBedCount > 0 ? BigDecimal.valueOf(100.0 * checkinCount / totalBedCount).setScale(2, BigDecimal.ROUND_HALF_EVEN) : BigDecimal.ZERO;
|
|
|
|
|
|
return HomeRoomDTO.builder()
|
|
|
.totalRoomCount(totalRoomCount)
|
|
|
@@ -339,8 +339,12 @@ public class RoomInfoService {
|
|
|
}
|
|
|
|
|
|
private BedInfoDTO changeToBedInfoDTO(BedInfo bedInfo) {
|
|
|
+ CheckinInfo checkinInfo = checkinInfoRepo.findFirstByBedIdAndCheckoutIsFalse(bedInfo.getId());
|
|
|
|
|
|
-
|
|
|
+ boolean nobody = false;
|
|
|
+ if (checkinInfo != null && StringUtils.isNotBlank(checkinInfo.getIdNo())) {
|
|
|
+ nobody = true;
|
|
|
+ }
|
|
|
return BedInfoDTO.builder()
|
|
|
.id(bedInfo.getId())
|
|
|
.roomId(bedInfo.getRoomId())
|
|
|
@@ -353,6 +357,7 @@ public class RoomInfoService {
|
|
|
.repairStatus(bedInfo.getRepairStatus())
|
|
|
.lockStatus(bedInfo.getLockStatus())
|
|
|
.remark(bedInfo.getRemark())
|
|
|
+ .nobody(nobody)
|
|
|
.build();
|
|
|
}
|
|
|
|