diff --git a/src/main/java/com/glxp/mipsdl/client/ptxhyy/PtxhyyClient.java b/src/main/java/com/glxp/mipsdl/client/ptxhyy/PtxhyyClient.java index 775ccfc..01fffbe 100644 --- a/src/main/java/com/glxp/mipsdl/client/ptxhyy/PtxhyyClient.java +++ b/src/main/java/com/glxp/mipsdl/client/ptxhyy/PtxhyyClient.java @@ -225,15 +225,15 @@ public class PtxhyyClient extends CommonHttpClient { } String fphm = ""; String fprq = null; - if (CollectionUtil.isNotEmpty(ioOrderInvoiceEntities)) { - List invoiceList = ioOrderInvoiceEntities.stream().filter(s -> i.getBindRlFk().equals(s.getBindRlFk()) && i.getBatchNo().equals(s.getBatchNo())) - .sorted(Comparator.comparing(IoOrderInvoiceEntity::getInvoiceDate, Comparator.reverseOrder())).collect(Collectors.toList()); - if (CollectionUtil.isNotEmpty(invoiceList)) { - fphm = invoiceList.stream().map(IoOrderInvoiceEntity::getInvoiceEncode).collect(Collectors.joining(",")); - if (invoiceList.get(0).getInvoiceDate() != null) - fprq = DateUtil.formatDateTime(invoiceList.get(0).getInvoiceDate()); - ioOrderInvoiceEntities.removeAll(invoiceList); - } + List invoiceList = IoOrderInvoiceEntity.builder().build() + .selectList(Wrappers.lambdaQuery(IoOrderInvoiceEntity.class).eq(IoOrderInvoiceEntity::getOrderIdFk, orderEntity.getBillNo()) + .eq(IoOrderInvoiceEntity::getBindRlFk, i.getBindRlFk()) + .eq(StrUtil.isNotEmpty(i.getBatchNo()), IoOrderInvoiceEntity::getBatchNo, i.getBatchNo()). + groupBy(IoOrderInvoiceEntity::getInvoiceEncode)); + if (CollectionUtil.isNotEmpty(invoiceList)) { + fphm = invoiceList.stream().map(IoOrderInvoiceEntity::getInvoiceEncode).collect(Collectors.joining(",")); + if (invoiceList.get(0).getInvoiceDate() != null) + fprq = DateUtil.formatDateTime(invoiceList.get(0).getInvoiceDate()); } BigDecimal wzje = i.getPrice().multiply(BigDecimal.valueOf(i.getCount().intValue()));