From fe9a623b42b02e7fcd112f6a85d55b3beeb58d2e Mon Sep 17 00:00:00 2001 From: luoyisheng <yangdongji@argo-ai.cn> Date: 星期四, 27 三月 2025 17:51:45 +0800 Subject: [PATCH] bug --- medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwMicroEquipmentRecordServiceImpl.java | 53 ++++++++++++++++++++++++++++------------------------- 1 files changed, 28 insertions(+), 25 deletions(-) diff --git a/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwMicroEquipmentRecordServiceImpl.java b/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwMicroEquipmentRecordServiceImpl.java index bd656d2..2383c4d 100644 --- a/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwMicroEquipmentRecordServiceImpl.java +++ b/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwMicroEquipmentRecordServiceImpl.java @@ -89,6 +89,11 @@ public MwMicroEquipmentRecordVO detail(Long id) { MwMicroEquipmentRecordVO mwMicroEquipmentRecordVO = BeanUtils.copyBean(this.getById(id), MwMicroEquipmentRecordVO.class); if (Objects.nonNull(mwMicroEquipmentRecordVO)) { + MwMicroEquipment equipment = mwMicroEquipmentService.getById( + mwMicroEquipmentRecordVO.getEquipmentId()); + if (Objects.nonNull(equipment)) { + mwMicroEquipmentRecordVO.setEquipmentName(equipment.getEquipmentName()); + } mwMicroEquipmentRecordVO.setMedicalWasteList(mwStagingRoomService.queryMedicalWasteList(mwMicroEquipmentRecordVO.getId())); } return mwMicroEquipmentRecordVO; @@ -209,7 +214,7 @@ vo.setLegend(wasteTypeList.stream().map(SysDictDataVO::getDictLabel).collect(Collectors.toList())); vo.getLegend().add("小计"); String treeCode = sysDepartmentService.getTreeCodeByDepartmentId(query.getDepartmentId()); - List<SysDictData> medicalWasteTypeList = sysDictDataService.lambdaQuery().eq(SysDictData::getDictType, "medical_waste_type").list(); + List<SysDictData> medicalWasteTypeList = sysDictDataService.lambdaQuery().eq(SysDictData::getDictType, "medical_waste_type").orderByDesc(SysDictData::getDictCode).list(); List<MwMicroEquipmentStaticsVO> staticsData = baseMapper.getStaticsData(query, treeCode); SimpleDateFormat sdf = new SimpleDateFormat(DateUtils.YYYY_MM_DD_HH_MM_SS); @@ -225,32 +230,30 @@ break; } List<String> dateList = DateUtils.getDayBetween(query.getStartTime(), query.getEndTime(), query.getDateType()); - if (CollUtils.isNotEmpty(staticsData)) { - List<DepartmentReportItemVO> result = new ArrayList<>(); - for (String date : dateList) { - DepartmentReportItemVO departmentReportItemVO = new DepartmentReportItemVO(); - departmentReportItemVO.setName(date); - departmentReportItemVO.setData(new ArrayList<>()); - SimpleDateFormat finalSdf = sdf; - BigDecimal totalWeight = BigDecimal.ZERO; - BigDecimal totalCount = BigDecimal.ZERO; - for (SysDictData sysDictData : medicalWasteTypeList) { - BigDecimal weight = staticsData.stream().filter(e -> e.getWasteType().equals(sysDictData.getDictCode()) - && finalSdf.format(e.getUseTime()).equals(date) - ).map(MwMicroEquipmentStaticsVO::getWeight).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, RoundingMode.HALF_UP); - long count = staticsData.stream().filter(e -> e.getWasteType().equals(sysDictData.getDictCode()) - && finalSdf.format(e.getUseTime()).equals(date)).count(); - departmentReportItemVO.getData().add(weight); - departmentReportItemVO.getData().add(BigDecimal.valueOf(count)); - totalWeight = totalWeight.add(weight); - totalCount = totalCount.add(BigDecimal.valueOf(count)); - } - departmentReportItemVO.getData().add(totalWeight); - departmentReportItemVO.getData().add(totalCount); - result.add(departmentReportItemVO); + List<DepartmentReportItemVO> result = new ArrayList<>(); + for (String date : dateList) { + DepartmentReportItemVO departmentReportItemVO = new DepartmentReportItemVO(); + departmentReportItemVO.setName(date); + departmentReportItemVO.setData(new ArrayList<>()); + SimpleDateFormat finalSdf = sdf; + BigDecimal totalWeight = BigDecimal.ZERO; + BigDecimal totalCount = BigDecimal.ZERO; + for (SysDictData sysDictData : medicalWasteTypeList) { + BigDecimal weight = staticsData.stream().filter(e -> e.getWasteType().equals(sysDictData.getDictCode()) + && finalSdf.format(e.getUseTime()).equals(date) + ).map(MwMicroEquipmentStaticsVO::getWeight).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, RoundingMode.HALF_UP); + long count = staticsData.stream().filter(e -> e.getWasteType().equals(sysDictData.getDictCode()) + && finalSdf.format(e.getUseTime()).equals(date)).count(); + departmentReportItemVO.getData().add(weight); + departmentReportItemVO.getData().add(BigDecimal.valueOf(count)); + totalWeight = totalWeight.add(weight); + totalCount = totalCount.add(BigDecimal.valueOf(count)); } - vo.setList(result); + departmentReportItemVO.getData().add(totalWeight); + departmentReportItemVO.getData().add(totalCount); + result.add(departmentReportItemVO); } + vo.setList(result); return vo; } -- Gitblit v1.7.1