暂降事件查询
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
package com.njcn.csharmonic.service;
|
||||
|
||||
import com.njcn.influx.pojo.dto.EventQueryDTO;
|
||||
import com.njcn.influx.pojo.dto.StatisticalDataDTO;
|
||||
import com.njcn.influx.pojo.po.cs.EntData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2023/8/30 8:46【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface EventService {
|
||||
|
||||
List<EntData> queryEvent(EventQueryDTO eventQueryDTO);
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.njcn.csharmonic.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csharmonic.service.EventService;
|
||||
import com.njcn.influx.pojo.dto.EventQueryDTO;
|
||||
import com.njcn.influx.pojo.po.cs.EntData;
|
||||
import com.njcn.influx.service.EvtDataService;
|
||||
import com.njcn.system.api.EpdFeignClient;
|
||||
import com.njcn.system.pojo.po.EleEpdPqd;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2023/8/30 19:41【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class EventServiceImpl implements EventService {
|
||||
private final EvtDataService evtDataService;
|
||||
private final CsLineFeignClient csLineFeignClient;
|
||||
private final EpdFeignClient epdFeignClient;
|
||||
|
||||
|
||||
@Override
|
||||
public List<EntData> queryEvent(EventQueryDTO eventQueryDTO) {
|
||||
List<CsLinePO> csLinePOList = csLineFeignClient.queryLineByDevId(eventQueryDTO.getDevId()).getData();
|
||||
if(CollectionUtil.isEmpty(csLinePOList)){
|
||||
throw new BusinessException(AlgorithmResponseEnum.LINE_DATA_ERROR);
|
||||
}
|
||||
List<String> collect = csLinePOList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
|
||||
eventQueryDTO.setLineIds(collect);
|
||||
List<EleEpdPqd> data = epdFeignClient.selectByIds(eventQueryDTO.getTarget()).getData();
|
||||
if(CollectionUtil.isEmpty(data)){
|
||||
new BusinessException(AlgorithmResponseEnum.ELEEPDPQD_DATA_ERROR);
|
||||
}
|
||||
List<String> collect1 = data.stream().map(EleEpdPqd::getName).collect(Collectors.toList());
|
||||
eventQueryDTO.setTarget(collect1);
|
||||
List<EntData> eventData = evtDataService.getEventData(eventQueryDTO);
|
||||
return eventData;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user