From 0414ddb0b2b3a7199ae6181a770f97ac140dbd73 Mon Sep 17 00:00:00 2001 From: zhangf <1603559716@qq.com> Date: 星期三, 08 五月 2024 16:46:22 +0800 Subject: [PATCH] spi统计 --- emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/impl/EmergencySuppliesServiceImpl.java | 29 ++++++++++++++++++++++++----- 1 files changed, 24 insertions(+), 5 deletions(-) diff --git a/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/impl/EmergencySuppliesServiceImpl.java b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/impl/EmergencySuppliesServiceImpl.java index 044c8bc..b05a09b 100644 --- a/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/impl/EmergencySuppliesServiceImpl.java +++ b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/impl/EmergencySuppliesServiceImpl.java @@ -202,7 +202,7 @@ * @return */ @Override - public ResultVO<List<EmergencySuppliesTypeRespDTO>> emergencySuppliesList(ContextCacheUser currentUser) { + public List<EmergencySuppliesTypeRespDTO> emergencySuppliesList(ContextCacheUser currentUser) { List<EmergencySuppliesInfo> emergencySuppliesInfoList = emergencySuppliesInfoService.listByNoConditions(); List<EmergencySuppliesTypeRespDTO> typeRespDTOList = new ArrayList<>(); @@ -224,20 +224,20 @@ typeRespDTO.setList(respDTOList); typeRespDTOList.add(typeRespDTO); } - return new ResultVO<>(ResultCodes.OK,typeRespDTOList); + return typeRespDTOList; } @Override - public ResultVO<List<EmergencySuppliesRespDTO>> listCountByIds(ContextCacheUser currentUser, List<Long> ids) { + public List<EmergencySuppliesRespDTO> listCountByIds(ContextCacheUser currentUser, List<Long> ids) { if(null == ids || ids.size() == 0 ){ - throw new EmergencyException(EmergencyResultCodes.SUPPLIES_PRAM_NULL); + throw new EmergencyException(EmergencyResultCodes.SUPPLIES_PARAM_NULL); } List<EmergencySuppliesInfo> emergencySuppliesInfos = emergencySuppliesInfoService.listCountByIds(ids); List<EmergencySuppliesRespDTO> respDTOList = new ArrayList<>(); if(!CollectionUtils.isEmpty(emergencySuppliesInfos)){ respDTOList = BeanCopyUtils.copyBeanList(emergencySuppliesInfos,EmergencySuppliesRespDTO.class); } - return new ResultVO<>(ResultCodes.OK,respDTOList); + return respDTOList; } private void deleteEmergencySupplies(Long id) { @@ -281,4 +281,23 @@ throw new EmergencyException(EmergencyResultCodes.SUPPLIES_ENUM_STATUS_NOT_EXIST); } } + + public List<EmergencySuppliesInfoRespDTO> getEmergencySupplies(){ + List<EmergencySuppliesInfo> allEmergencySupplies = emergencySuppliesInfoService.getAllEmergencySupplies(); + List<EmergencySuppliesInfoRespDTO> collect = allEmergencySupplies.stream().map(es -> { + EmergencySuppliesInfoRespDTO e = new EmergencySuppliesInfoRespDTO(); + BeanUtils.copyProperties(es,e); + e.setClassificationName(EmergencySuppliesClassificationEnum.getByCode(es.getClassification()).getValue()); + ResultVO<DepInfoRPCRespDTO> rpcResult = accountDepartmentService.getDepInfoByDepId(es.getDepartmentId()); + if (rpcResult != null && rpcResult.getCode().equals(ResultCodes.OK.getCode())) { + if (rpcResult.getData() != null) { + DepInfoRPCRespDTO dep = (DepInfoRPCRespDTO) rpcResult.getData(); + e.setDepartmentName(dep.getDepName()); + } + } + return e; + }).collect(Collectors.toList()); + return collect; + + } } -- Gitblit v1.9.2