暂降事件查询
This commit is contained in:
@@ -0,0 +1,45 @@
|
|||||||
|
package com.njcn.csharmonic.controller;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
|
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||||
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
|
import com.njcn.csharmonic.service.EventService;
|
||||||
|
import com.njcn.influx.pojo.dto.EventQueryDTO;
|
||||||
|
import com.njcn.influx.pojo.po.cs.EntData;
|
||||||
|
import com.njcn.web.controller.BaseController;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description:
|
||||||
|
* Date: 2023/8/29 20:03【需求编号】
|
||||||
|
*
|
||||||
|
* @author clam
|
||||||
|
* @version V1.0.0
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/event")
|
||||||
|
@Api(tags = "暂降事件")
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class EventController extends BaseController {
|
||||||
|
private final EventService eventService;
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/queryEvent")
|
||||||
|
@ApiOperation("暂降事件查询")
|
||||||
|
@ApiImplicitParam(name = "eventQueryDTO", value = "暂降事件查询参数", required = true)
|
||||||
|
public HttpResult<List<EntData>> queryEvent(@RequestBody EventQueryDTO eventQueryDTO) {
|
||||||
|
String methodDescribe = getMethodDescribe("queryEvent");
|
||||||
|
List<EntData> list = eventService.queryEvent(eventQueryDTO);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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