| | |
| | | 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) { |