From 62a30a9754d51384fabe2806310ad748dfab60af Mon Sep 17 00:00:00 2001 From: Gauthier LO Date: Mon, 18 Mar 2024 12:27:42 +0100 Subject: [PATCH] fix : breakdown invoicing wrong erp status orders --- .../domain/shippingInvoice/ShippingInvoiceFactory.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/domain/shippingInvoice/ShippingInvoiceFactory.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/domain/shippingInvoice/ShippingInvoiceFactory.java index 3712fdb63..c600f6d3a 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/domain/shippingInvoice/ShippingInvoiceFactory.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/domain/shippingInvoice/ShippingInvoiceFactory.java @@ -486,7 +486,6 @@ public class ShippingInvoiceFactory { SUBJECT_FORMAT.format(begin), SUBJECT_FORMAT.format(end) ); - uninvoicedOrderToContent = platformOrderService.findUninvoicedOrders(shopIds, begin, end, warehouses); } else if (erpStatuses.toString().equals("[1, 2]") || erpStatuses.toString().equals("[1]")) { subject = String.format( @@ -494,7 +493,6 @@ public class ShippingInvoiceFactory { SUBJECT_FORMAT.format(begin), SUBJECT_FORMAT.format(end) ); - uninvoicedOrderToContent = platformOrderService.findUninvoicedOrderContentsForShopsAndStatus(shopIds, begin, end, erpStatuses, warehouses); } else { subject = String.format( @@ -502,8 +500,8 @@ public class ShippingInvoiceFactory { SUBJECT_FORMAT.format(begin), SUBJECT_FORMAT.format(end) ); - uninvoicedOrderToContent = platformOrderService.findUninvoicedOrderContentsForShopsAndStatus(shopIds, begin, end, erpStatuses, warehouses); } + uninvoicedOrderToContent = platformOrderService.findUninvoicedOrderContentsForShopsAndStatus(shopIds, begin, end, erpStatuses, warehouses); if(balance != null) { return createInvoiceWithBalance(customerId, balance, shopIds, uninvoicedOrderToContent, savRefunds, subject, false); } @@ -565,8 +563,11 @@ public class ShippingInvoiceFactory { shops.forEach(shop -> shopPackageMatFeeMap.put(shop.getId(), shop.getPackagingMaterialFee())); String invoiceCode = generateInvoiceCode(); log.info("New invoice code: {}", invoiceCode); - calculateFees(null, logisticChannelMap, orderAndContent, channelPriceMap, countryList, skuRealWeights, skuServiceFees, + Map> errorMsg = calculateFees(null, logisticChannelMap, orderAndContent, channelPriceMap, countryList, skuRealWeights, skuServiceFees, latestDeclaredValues, client, shopServiceFeeMap, shopPackageMatFeeMap, invoiceCode); + if(!errorMsg.isEmpty()) { + errorMsg.forEach((k, v) -> log.error("Couldn't invoice orders for reason : {} : {}", k, v)); + } BigDecimal eurToUsd = exchangeRatesMapper.getLatestExchangeRate("EUR", "USD"); if (savRefunds != null) { updateSavRefundsInDb(savRefunds, invoiceCode);