liding
2025-05-14 390b4243dff25a50f1d3302228e7dd16e9c2f18a
src/main/java/com/ruoyi/purchase/service/impl/PurchaseLedgerServiceImpl.java
@@ -28,6 +28,7 @@
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.math.BigDecimal;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
@@ -108,7 +109,6 @@
        List<SalesLedgerProduct> productList = purchaseLedgerDto.getProductData();
        if (productList != null && !productList.isEmpty()) {
            handleSalesLedgerProducts(purchaseLedger.getId(), productList, purchaseLedgerDto.getType());
        }
        // 5. 迁移临时文件到正式目录
@@ -141,6 +141,18 @@
                salesLedgerProduct.setType(type);
                salesLedgerProductMapper.insert(salesLedgerProduct);
            }
        }
        // 计算总含税金额
        BigDecimal totalTaxInclusiveAmount = products.stream()
                .map(SalesLedgerProduct::getTaxInclusiveTotalPrice)
                .filter(Objects::nonNull)
                .reduce(BigDecimal.ZERO, BigDecimal::add);
        // 更新主表的总金额字段
        if (salesLedgerId != null) {
            // 直接更新指定ID的记录的contractAmount字段为totalTaxInclusiveAmount
            purchaseLedgerMapper.updateContractAmountById(salesLedgerId, totalTaxInclusiveAmount);
        }
    }
@@ -256,9 +268,6 @@
        // 获取原始查询结果
        List<Map<String, Object>> result = purchaseLedgerMapper.selectMaps(queryWrapper);
        //查询销售合同号
        // 将下划线命名转换为驼峰命名
        return result.stream().map(map -> map.entrySet().stream()