fix:MCP数据订单信息调整

dev_1.0.2
jiangpeng 2026-06-04 13:54:57 +08:00
parent 015ba6da70
commit 3b41b6b3d3
1 changed files with 28 additions and 11 deletions

View File

@ -161,7 +161,7 @@ public class ProjectOrderInfoToolProvider extends AbstractMcpToolProvider {
List<ProjectProductInfo> productInfos = productMap.getOrDefault(orderInfo.getProjectId(), Collections.emptyList());
List<ProjectProductInfo> softwareList = filterByType(productInfos, "1");
List<ProjectProductInfo> hardwareList = filterByType(productInfos, "2");
List<ProjectProductInfo> serviceList = filterByType(productInfos, "3");
List<ProjectProductInfo> serviceList = filterByType(productInfos, "3", "22");
Map<String, ProductShipmentSummary> 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<String, Map<String, ProductCostSummary>> loadServiceCostMap(PurchaseTaxRateContext purchaseTaxRateContext) {
List<OmsInventoryInner> inventoryInners = purchaseTaxRateContext.listInventoryInnersByProductType("3");
List<OmsInventoryInner> inventoryInners = purchaseTaxRateContext.listInventoryInnersByProductType("3", "22");
if (CollUtil.isEmpty(inventoryInners)) {
return Collections.emptyMap();
}
@ -452,7 +452,7 @@ public class ProjectOrderInfoToolProvider extends AbstractMcpToolProvider {
List<OmsInventoryInner> 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<ProjectProductInfo> filterByType(List<ProjectProductInfo> productInfos, String type) {
if (CollUtil.isEmpty(productInfos)) {
private List<ProjectProductInfo> filterByType(List<ProjectProductInfo> productInfos, String... types) {
if (CollUtil.isEmpty(productInfos) || types == null || types.length == 0) {
return Collections.emptyList();
}
Set<String> 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<OmsInventoryInner> listInventoryInnersByProductType(String productType) {
if (isEmpty(productType)) {
private List<OmsInventoryInner> listInventoryInnersByProductType(String... productTypes) {
if (productTypes == null || productTypes.length == 0) {
return Collections.emptyList();
}
Set<String> 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());
}