维修管理优化 配件单价及费用合计

This commit is contained in:
syruan 2024-11-21 16:16:50 +08:00
parent 8aead27cfb
commit 8925b54d9c
2 changed files with 7 additions and 2 deletions

View File

@ -101,6 +101,7 @@ public class RepairServiceImpl implements RepairService {
return;
}
resultMap.computeIfAbsent(item.getTypeNameId(), origin -> item).getRepairDeviceList().add(repairDeviceVO);
resultMap.computeIfPresent(item.getTypeNameId(), (origin, novel) -> {
novel.setTotalCost(novel.getTotalCost().add(Optional.ofNullable(item.getTotalCost()).orElse(BigDecimal.ZERO)));
return novel;
@ -156,7 +157,11 @@ public class RepairServiceImpl implements RepairService {
return existing;
}, ConcurrentHashMap::new)
);
return new ArrayList<>(map.values());
List<RepairPart> list = new ArrayList<>(map.values());
list.forEach(item -> {
item.setPartCost(Optional.ofNullable(item.getPartPrice()).orElse(BigDecimal.ZERO).multiply(new BigDecimal(item.getPartNum())));
});
return list;
} catch (Exception e) {
throw new ServiceException("Error merging parts" + e.getMessage());
}

View File

@ -488,7 +488,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select
mpt.pa_name as partName,
rpd.part_num as partNum,
rpd.part_cost as partCost,
rpd.part_cost as partPrice,
rpd.part_type as partType,
rpd.type_id as typeId,
mt.type_name as typeName,