|
@@ -11,10 +11,8 @@ import org.springframework.stereotype.Service;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.temporal.ChronoUnit;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.LinkedList;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
|
public class PaymentService {
|
|
@@ -246,7 +244,22 @@ public class PaymentService {
|
|
|
|
|
|
public List<PaymentOrdinary> getLimit(PaymentOrdinary paymentOrdinary, int currPage, int pageSize) {
|
|
|
int currIndex = (currPage - 1) * pageSize;
|
|
|
- return paymentOrdinaryDao.getLimit(paymentOrdinary, currIndex, pageSize);
|
|
|
+ List<PaymentOrdinary> list = paymentOrdinaryDao.getLimit(paymentOrdinary, currIndex, pageSize);
|
|
|
+ if (list.size() > 0) {
|
|
|
+ List<Long> ids = new ArrayList<>();
|
|
|
+ list.forEach(ls -> ids.add(ls.getId()));
|
|
|
+
|
|
|
+ List<PaymentInvoice> paymentInvoiceList = paymentInvoiceDao.getPaymentOrdinaryIds(ids);
|
|
|
+ Map<Long, List<PaymentInvoice>> groupedByPaymentInvoice = paymentInvoiceList.stream().collect(Collectors.groupingBy(PaymentInvoice::getPaymentOrdinaryId));
|
|
|
+ List<PaymentRecord> paymentRecordList = paymentRecordDao.getPaymentOrdinaryIds(ids);
|
|
|
+ Map<Long, List<PaymentRecord>> groupedByPaymentRecord = paymentRecordList.stream().collect(Collectors.groupingBy(PaymentRecord::getPaymentOrdinaryId));
|
|
|
+
|
|
|
+ for (PaymentOrdinary po : list) {
|
|
|
+ po.setPaymentInvoiceList(groupedByPaymentInvoice.get(po.getId()));
|
|
|
+ po.setPaymentRecordList(groupedByPaymentRecord.get(po.getId()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return list;
|
|
|
}
|
|
|
|
|
|
public PaymentOrdinary getPaymentOrdinary(long id) {
|