|
@@ -156,7 +156,22 @@ public class PaymentService {
|
|
|
|
|
|
public List<Payment> getLimit(Payment payment, int currPage, int pageSize) {
|
|
|
int currIndex = (currPage - 1) * pageSize;
|
|
|
- return paymentDao.getLimit(payment, currIndex, pageSize);
|
|
|
+ List<Payment> list = paymentDao.getLimit(payment, currIndex, pageSize);
|
|
|
+ if (list.size() > 0) {
|
|
|
+ List<Long> ids = new ArrayList<>();
|
|
|
+ list.forEach(ls -> ids.add(ls.getId()));
|
|
|
+
|
|
|
+ List<PaymentInvoice> paymentInvoiceList = paymentInvoiceDao.getPaymentIds(ids);
|
|
|
+ Map<Long, List<PaymentInvoice>> groupedByPaymentInvoice = paymentInvoiceList.stream().collect(Collectors.groupingBy(PaymentInvoice::getPaymentId));
|
|
|
+ List<PaymentRecord> paymentRecordList = paymentRecordDao.getPaymentIds(ids);
|
|
|
+ Map<Long, List<PaymentRecord>> groupedByPaymentRecord = paymentRecordList.stream().collect(Collectors.groupingBy(PaymentRecord::getPaymentId));
|
|
|
+
|
|
|
+ for (Payment po : list) {
|
|
|
+ po.setPaymentInvoiceList(groupedByPaymentInvoice.get(po.getId()));
|
|
|
+ po.setPaymentRecordList(groupedByPaymentRecord.get(po.getId()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return list;
|
|
|
}
|
|
|
|
|
|
public Payment get(long id) {
|