From 4915493db5013f4e0857ac7127616781732c2d6c Mon Sep 17 00:00:00 2001
From: zhangf <1603559716@qq.com>
Date: Thu, 09 May 2024 09:54:10 +0800
Subject: [PATCH] spi统计
---
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/impl/EmergencySuppliesServiceImpl.java | 43 +++++++++++++++++++++++++++++++++++++++++--
1 files changed, 41 insertions(+), 2 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 c33c62e..5caaf2c 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
@@ -25,6 +25,8 @@
import com.gkhy.safePlatform.emergency.service.EmergencySuppliesService;
import com.gkhy.safePlatform.emergency.service.baseService.*;
import org.apache.dubbo.config.annotation.DubboReference;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -36,6 +38,7 @@
@Service("emergencySuppliesService")
public class EmergencySuppliesServiceImpl implements EmergencySuppliesService {
+ private static final Logger log = LoggerFactory.getLogger(EmergencySuppliesServiceImpl.class);
@Autowired
private EmergencySuppliesInfoService emergencySuppliesInfoService;
@@ -202,7 +205,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,7 +227,20 @@
typeRespDTO.setList(respDTOList);
typeRespDTOList.add(typeRespDTO);
}
- return new ResultVO<>(ResultCodes.OK,typeRespDTOList);
+ return typeRespDTOList;
+ }
+
+ @Override
+ public List<EmergencySuppliesRespDTO> listCountByIds(ContextCacheUser currentUser, List<Long> ids) {
+ if(null == ids || ids.size() == 0 ){
+ 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 respDTOList;
}
private void deleteEmergencySupplies(Long id) {
@@ -243,6 +259,8 @@
}
}
+
+
/**
* 验证必填项
@@ -266,4 +284,25 @@
throw new EmergencyException(EmergencyResultCodes.SUPPLIES_ENUM_STATUS_NOT_EXIST);
}
}
+
+ public List<EmergencySuppliesInfoRespDTO> getEmergencySupplies(){
+ List<EmergencySuppliesInfo> allEmergencySupplies = emergencySuppliesInfoService.getAllEmergencySupplies();
+ List<EmergencySuppliesInfoRespDTO> collect = new ArrayList<>();
+ for (EmergencySuppliesInfo allEmergencySupply : allEmergencySupplies) {
+ EmergencySuppliesInfoRespDTO e = new EmergencySuppliesInfoRespDTO();
+ BeanUtils.copyProperties(allEmergencySupply,e);
+ String value = EmergencySuppliesClassificationEnum.getByCode(allEmergencySupply.getClassification()).getValue();
+ e.setClassificationName(StringUtils.isEmpty(value) ? "" : value);
+ ResultVO<DepInfoRPCRespDTO> rpcResult = accountDepartmentService.getDepInfoByDepId(allEmergencySupply.getDepartmentId());
+ if (rpcResult != null && rpcResult.getCode().equals(ResultCodes.OK.getCode())) {
+ if (rpcResult.getData() != null) {
+ DepInfoRPCRespDTO dep = (DepInfoRPCRespDTO) rpcResult.getData();
+ e.setDepartmentName(dep.getDepName());
+ }
+ }
+ collect.add(e);
+ }
+ return collect;
+
+ }
}
--
Gitblit v1.9.2