| | |
| | | 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; |
| | |
| | | @Service("emergencySuppliesService") |
| | | public class EmergencySuppliesServiceImpl implements EmergencySuppliesService { |
| | | |
| | | private static final Logger log = LoggerFactory.getLogger(EmergencySuppliesServiceImpl.class); |
| | | @Autowired |
| | | private EmergencySuppliesInfoService emergencySuppliesInfoService; |
| | | |
| | |
| | | |
| | | public List<EmergencySuppliesInfoRespDTO> getEmergencySupplies(){ |
| | | List<EmergencySuppliesInfo> allEmergencySupplies = emergencySuppliesInfoService.getAllEmergencySupplies(); |
| | | List<EmergencySuppliesInfoRespDTO> collect = allEmergencySupplies.stream().map(es -> { |
| | | List<EmergencySuppliesInfoRespDTO> collect = new ArrayList<>(); |
| | | for (EmergencySuppliesInfo allEmergencySupply : allEmergencySupplies) { |
| | | EmergencySuppliesInfoRespDTO e = new EmergencySuppliesInfoRespDTO(); |
| | | BeanUtils.copyProperties(es,e); |
| | | e.setClassificationName(EmergencySuppliesClassificationEnum.getByCode(es.getClassification()).getValue()); |
| | | ResultVO<DepInfoRPCRespDTO> rpcResult = accountDepartmentService.getDepInfoByDepId(es.getDepartmentId()); |
| | | 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()); |
| | | } |
| | | } |
| | | return e; |
| | | }).collect(Collectors.toList()); |
| | | collect.add(e); |
| | | } |
| | | return collect; |
| | | |
| | | } |