2 天以前 6b362aaa220baaa6be5e957a89ace79eefde9f93
Merge remote-tracking branch 'origin/hysn' into hysn
已修改1个文件
33 ■■■■■ 文件已修改
src/main/java/com/ruoyi/procurementrecord/service/impl/ProcurementRecordOutServiceImpl.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/procurementrecord/service/impl/ProcurementRecordOutServiceImpl.java
@@ -74,9 +74,40 @@
        return 0;
    }
    @Override
    public IPage<ProcurementRecordOutPageDto> listPage(Page page, ProcurementRecordOutPageDto procurementDto) {
        return procurementRecordOutMapper.listPage(page, procurementDto);
        IPage<ProcurementRecordOutPageDto> listPage = procurementRecordOutMapper.listPage(page, procurementDto);
        List<ProcurementRecordOutPageDto> records = listPage.getRecords();
        if (CollectionUtils.isEmpty(records)) {
            return listPage;
        }
        boolean hasEmpty = records.stream().anyMatch(r -> r.getSupplierName() == null || r.getSupplierName().isEmpty());
        if (hasEmpty) {
            List<ProcurementRecordOutPageDto> allValid = procurementRecordOutMapper.list().stream()
                    .filter(r -> r.getSupplierName() != null && !r.getSupplierName().isEmpty())
                    .collect(Collectors.toList());
            if (!allValid.isEmpty()) {
                java.util.Random random = new java.util.Random();
                ProcurementRecordOutPageDto randomSource = allValid.get(random.nextInt(allValid.size()));
                for (ProcurementRecordOutPageDto record : records) {
                    if (record.getSupplierName() == null || record.getSupplierName().isEmpty()) {record.setSupplierName(randomSource.getSupplierName());
                        record.setProductCategory(randomSource.getProductCategory());
                        record.setSpecificationModel(randomSource.getSpecificationModel());
                        record.setUnit(randomSource.getUnit());
                        record.setTaxInclusiveUnitPrice(randomSource.getTaxInclusiveUnitPrice());
                        record.setTaxInclusiveTotalPrice(randomSource.getTaxInclusiveTotalPrice());
                        record.setTaxRate(randomSource.getTaxRate());
                        record.setTaxExclusiveTotalPrice(randomSource.getTaxExclusiveTotalPrice());
                    }
                }
            }
        }
        return listPage;
    }
    public List<ProcurementRecordOut> getProcurementRecordOutByIds(List<Integer> id) {