2025-12-23物资大屏消耗趋势对比bug修改

This commit is contained in:
2025-12-23 15:55:27 +08:00
parent 80aebda251
commit c6b80dd2af

View File

@ -315,11 +315,22 @@ public class MaterialsManagementServiceImpl implements IMaterialsManagementServi
MatMaterialsUseRecord::getInventoryId, MatMaterialsUseRecord::getInventoryId,
Collectors.reducing(BigDecimal.ZERO, MatMaterialsUseRecord::getUseNumber, BigDecimal::add) Collectors.reducing(BigDecimal.ZERO, MatMaterialsUseRecord::getUseNumber, BigDecimal::add)
)); ));
Map<Long, BigDecimal> map2 = new HashMap<>();
for (MatMaterialsInventory item : inventories) {
if (!map.containsKey(item.getId())) {
continue;
}
if (map2.containsKey(item.getMaterialsId())){
map2.put(item.getMaterialsId(), map2.get(item.getMaterialsId()).add(map.getOrDefault(item.getId(), BigDecimal.ZERO)));
}else {
map2.put(item.getMaterialsId(), map.getOrDefault(item.getId(), BigDecimal.ZERO));
}
}
inventoryHashMap.forEach((key, value) -> { inventoryHashMap.forEach((key, value) -> {
xhqsdbVo vo = new xhqsdbVo(); xhqsdbVo vo = new xhqsdbVo();
vo.setName(map1.get(key)); vo.setName(map1.get(key));
vo.setOutTotalPrices( value); vo.setOutTotalPrices( value);
vo.setUseTotalPrices(map.getOrDefault(key, BigDecimal.ZERO)); vo.setUseTotalPrices(map2.getOrDefault(key, BigDecimal.ZERO));
list.add(vo); list.add(vo);
}); });
return list; return list;