|
|
@@ -552,6 +552,8 @@ public class CheckinInfoService {
|
|
|
.collect(Collectors.toSet()));
|
|
|
List<Contract> contractList = contractRepo.findAllById(checkinInfoList.stream().map(CheckinInfo::getOrderId)
|
|
|
.filter(Objects::nonNull).collect(Collectors.toSet()));
|
|
|
+ List<PersonalFee> personalFees = personalFeeRepo
|
|
|
+ .findAllByStoreIdAndCycleStartDateNotNullOrderBySettleTimeDesc(storeId);
|
|
|
|
|
|
List<CheckinInfoReportDTO> checkinInfoReportDTOList = Collections.synchronizedList(new LinkedList<>());
|
|
|
;
|
|
|
@@ -575,22 +577,29 @@ public class CheckinInfoService {
|
|
|
}
|
|
|
String lastCycle = "";
|
|
|
String shouldPay = "待缴费";
|
|
|
+ BigDecimal total = BigDecimal.ZERO;
|
|
|
if (checkinInfo.getCheckout()) {
|
|
|
shouldPay = "已退宿";
|
|
|
} else {
|
|
|
- PersonalFee lastFee = personalFeeRepo
|
|
|
- .findFirstByCheckinIdAndCycleStartDateNotNullOrderBySettleTimeDesc(checkinInfo.getId());
|
|
|
- if (lastFee != null) {
|
|
|
- if (lastFee.getCycleEndDate() != null) {
|
|
|
- lastCycle = lastFee.getCycleStartDate() + "-" + lastFee.getCycleEndDate();
|
|
|
- LocalDate now = LocalDate.now();
|
|
|
- if (now.compareTo(lastFee.getCycleEndDate()) > 0) {
|
|
|
- shouldPay = "待缴费";
|
|
|
+ List<PersonalFee> lastFees = personalFees.stream()
|
|
|
+ .filter(personalFee -> personalFee.getCheckinId().equals(checkinInfo.getId()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (lastFees.size() > 0) {
|
|
|
+ PersonalFee lastFee = lastFees.get(0);
|
|
|
+ if (lastFee != null) {
|
|
|
+ total = lastFees.stream().map(PersonalFee::getMoney).reduce(BigDecimal::add)
|
|
|
+ .orElse(BigDecimal.ZERO);
|
|
|
+ if (lastFee.getCycleEndDate() != null) {
|
|
|
+ lastCycle = lastFee.getCycleStartDate() + "-" + lastFee.getCycleEndDate();
|
|
|
+ LocalDate now = LocalDate.now();
|
|
|
+ if (now.compareTo(lastFee.getCycleEndDate()) > 0) {
|
|
|
+ shouldPay = "待缴费";
|
|
|
+ } else {
|
|
|
+ shouldPay = "已缴费";
|
|
|
+ }
|
|
|
} else {
|
|
|
- shouldPay = "已缴费";
|
|
|
+ lastCycle = lastFee.getRemark();
|
|
|
}
|
|
|
- } else {
|
|
|
- lastCycle = lastFee.getRemark();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -618,7 +627,7 @@ public class CheckinInfoService {
|
|
|
.bedName(bedName)
|
|
|
.checkinType(checkinInfo.getCheckInType().getDescription())
|
|
|
.hasWx(hasWx)
|
|
|
- .total(personalFeeRepo.sumPersonalFee(PayMethod.WEIXIN, checkinInfo.getId()))
|
|
|
+ .total(total)
|
|
|
.build());
|
|
|
});
|
|
|
return checkinInfoReportDTOList;
|