From 3b41b6b3d3b581fb46ee06a8e3e9e54448dfa98f Mon Sep 17 00:00:00 2001 From: jiangpeng Date: Thu, 4 Jun 2026 13:54:57 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9AMCP=E6=95=B0=E6=8D=AE=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E4=BF=A1=E6=81=AF=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/ProjectOrderInfoToolProvider.java | 39 +++++++++++++------ 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/llm/tools/ProjectOrderInfoToolProvider.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/llm/tools/ProjectOrderInfoToolProvider.java index b675e038..69f4f7c7 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/llm/tools/ProjectOrderInfoToolProvider.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/llm/tools/ProjectOrderInfoToolProvider.java @@ -161,7 +161,7 @@ public class ProjectOrderInfoToolProvider extends AbstractMcpToolProvider { List productInfos = productMap.getOrDefault(orderInfo.getProjectId(), Collections.emptyList()); List softwareList = filterByType(productInfos, "1"); List hardwareList = filterByType(productInfos, "2"); - List serviceList = filterByType(productInfos, "3"); + List serviceList = filterByType(productInfos, "3", "22"); Map orderShipmentMap = shipmentSummaryMap.getOrDefault(orderInfo.getOrderCode(), Collections.emptyMap()); ReceivableSummary receivableSummary = receivableSummaryMap.getOrDefault(orderInfo.getOrderCode(), new ReceivableSummary()); @@ -305,7 +305,7 @@ public class ProjectOrderInfoToolProvider extends AbstractMcpToolProvider { } private Map> loadServiceCostMap(PurchaseTaxRateContext purchaseTaxRateContext) { - List inventoryInners = purchaseTaxRateContext.listInventoryInnersByProductType("3"); + List inventoryInners = purchaseTaxRateContext.listInventoryInnersByProductType("3", "22"); if (CollUtil.isEmpty(inventoryInners)) { return Collections.emptyMap(); } @@ -452,7 +452,7 @@ public class ProjectOrderInfoToolProvider extends AbstractMcpToolProvider { List serviceInventoryInners = omsInventoryInnerMapper.selectOmsInventoryInnerByOrderCodeList(orderCodes); if (CollUtil.isNotEmpty(serviceInventoryInners)) { serviceInventoryInners.stream() - .filter(item -> "3".equals(item.getProductType())) + .filter(item -> "3".equals(item.getProductType()) || "22".equals(item.getProductType())) .forEach(inventoryInners::add); } if (CollUtil.isEmpty(inventoryInners)) { @@ -543,8 +543,14 @@ public class ProjectOrderInfoToolProvider extends AbstractMcpToolProvider { item.put(prefix + "SalesAmount" + index, defaultValue(productInfo.getAllPrice())); item.put(prefix + "CostAmount" + index, costDisplay.displayValue); item.put(prefix + "TaxRate" + index, productInfo.getTaxRate()); - item.put(prefix + "GrossProfit" + index, bindAmountDto != null ? defaultValue(bindAmountDto.getGrossProfit()) : BigDecimal.ZERO); - item.put(prefix + "GrossProfitRate" + index, bindAmountDto != null ? defaultValue(bindAmountDto.getGrossProfitRate()) : BigDecimal.ZERO); + item.put(prefix + "GrossProfit" + index, + bindAmountDto != null && Boolean.TRUE.equals(bindAmountDto.getOrderStockingStatus()) + ? defaultValue(bindAmountDto.getGrossProfit()) + : NOT_DELIVERED_TEXT); + item.put(prefix + "GrossProfitRate" + index, + bindAmountDto != null && Boolean.TRUE.equals(bindAmountDto.getOrderStockingStatus()) + ? defaultValue(bindAmountDto.getGrossProfitRate()) + : NOT_DELIVERED_TEXT); item.put(prefix + "OrderStockingStatus" + index, bindAmountDto != null ? bindAmountDto.getOrderStockingStatus() : false); summary.salesWithTax = summary.salesWithTax.add(defaultValue(productInfo.getAllPrice())); @@ -593,12 +599,14 @@ public class ProjectOrderInfoToolProvider extends AbstractMcpToolProvider { return display; } - private List filterByType(List productInfos, String type) { - if (CollUtil.isEmpty(productInfos)) { + private List filterByType(List productInfos, String... types) { + if (CollUtil.isEmpty(productInfos) || types == null || types.length == 0) { return Collections.emptyList(); } + Set typeSet = new LinkedHashSet<>(); + Collections.addAll(typeSet, types); return productInfos.stream() - .filter(item -> type.equals(item.getType())) + .filter(item -> typeSet.contains(item.getType())) .collect(Collectors.toList()); } @@ -823,12 +831,21 @@ public class ProjectOrderInfoToolProvider extends AbstractMcpToolProvider { .getOrDefault(productCode, BigDecimal.ZERO); } - private List listInventoryInnersByProductType(String productType) { - if (isEmpty(productType)) { + private List listInventoryInnersByProductType(String... productTypes) { + if (productTypes == null || productTypes.length == 0) { + return Collections.emptyList(); + } + Set productTypeSet = new LinkedHashSet<>(); + for (String productType : productTypes) { + if (!isEmpty(productType)) { + productTypeSet.add(productType); + } + } + if (productTypeSet.isEmpty()) { return Collections.emptyList(); } return inventoryInners.stream() - .filter(item -> productType.equals(item.getProductType())) + .filter(item -> productTypeSet.contains(item.getProductType())) .collect(Collectors.toList()); }