From 8925b54d9cf8a0fcb718c6c921e7d1d5b742e0bd Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Thu, 21 Nov 2024 16:16:50 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=B4=E4=BF=AE=E7=AE=A1=E7=90=86=E4=BC=98?= =?UTF-8?q?=E5=8C=96=20=E9=85=8D=E4=BB=B6=E5=8D=95=E4=BB=B7=E5=8F=8A?= =?UTF-8?q?=E8=B4=B9=E7=94=A8=E5=90=88=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../material/repair/service/impl/RepairServiceImpl.java | 7 ++++++- .../mapper/material/repair/RepairAuditDetailsMapper.xml | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairServiceImpl.java index 8a6693a8..6bf9c0b9 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairServiceImpl.java @@ -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 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()); } diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairAuditDetailsMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairAuditDetailsMapper.xml index f2ca1ac6..5983a386 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairAuditDetailsMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairAuditDetailsMapper.xml @@ -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,