zbj//1.暂降事件点图返回对象调整

This commit is contained in:
zhangbaojian
2023-05-04 15:49:36 +08:00
parent 886bec3def
commit 5e9afdc942
3 changed files with 35 additions and 5 deletions

View File

@@ -174,9 +174,9 @@ public class MonitorPointController extends BaseController {
@PostMapping("/getPlot") @PostMapping("/getPlot")
@ApiOperation("暂降事件点图") @ApiOperation("暂降事件点图")
@ApiImplicitParam(name = "statisticsParam", value = "暂降事件点图参数", required = true) @ApiImplicitParam(name = "statisticsParam", value = "暂降事件点图参数", required = true)
public HttpResult<List<EventDetail>> getPlot(@RequestBody @Validated StatisticsParam statisticsParam){ public HttpResult<VoltageToleranceCurveVO> getPlot(@RequestBody @Validated StatisticsParam statisticsParam){
String methodDescribe = getMethodDescribe("getPlot"); String methodDescribe = getMethodDescribe("getPlot");
List<EventDetail> page = eventAnalysisService.getPlot(statisticsParam); VoltageToleranceCurveVO page = eventAnalysisService.getPlot(statisticsParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,page,methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,page,methodDescribe);
} }

View File

@@ -73,7 +73,7 @@ public interface EventAnalysisService {
* @param statisticsParam * @param statisticsParam
* @return * @return
*/ */
List<EventDetail> getPlot(StatisticsParam statisticsParam); VoltageToleranceCurveVO getPlot(StatisticsParam statisticsParam);
/** /**
*监测点暂降事件分析查询 *监测点暂降事件分析查询

View File

@@ -1,6 +1,7 @@
package com.njcn.event.service.majornetwork.Impl; package com.njcn.event.service.majornetwork.Impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
@@ -1417,7 +1418,7 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
* @author xxy * @author xxy
*/ */
@Override @Override
public List<EventDetail> getPlot(StatisticsParam statisticsParam) { public VoltageToleranceCurveVO getPlot(StatisticsParam statisticsParam) {
List<EventDetail> result = new ArrayList<>(); List<EventDetail> result = new ArrayList<>();
// QueryResult query = MonitorQuery(statisticsParam); // QueryResult query = MonitorQuery(statisticsParam);
// InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); // InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper();
@@ -1476,8 +1477,37 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
result.add(eventDetailNew); result.add(eventDetailNew);
} }
if (CollUtil.isEmpty(result)) {
return VoltageToleranceCurveVO.empty();
}
ArrayList<String> lineIds = new ArrayList<>();
lineIds.add(statisticsParam.getLineIndex());
List<AreaLineInfoVO> getBaseLineAreaInfo = lineFeignClient.getBaseLineAreaInfo(lineIds).getData();
if (CollUtil.isEmpty(getBaseLineAreaInfo)) {
return VoltageToleranceCurveVO.empty();
}
return result; Map<String, AreaLineInfoVO> areaLineInfoVOMap =
getBaseLineAreaInfo.parallelStream().collect(Collectors.toConcurrentMap(AreaLineInfoVO::getLineId,
Function.identity()));
List<VoltageToleranceCurveVO.VoltageToleranceCurveDataList> curveDataList = result.parallelStream()
.map(dto -> {
AreaLineInfoVO info = areaLineInfoVOMap.get(dto.getLineId());
VoltageToleranceCurveVO.VoltageToleranceCurveDataList voltageToleranceCurve = new VoltageToleranceCurveVO.VoltageToleranceCurveDataList();
voltageToleranceCurve.setLineId(dto.getLineId());
voltageToleranceCurve.setPersistTime(dto.getDuration());
voltageToleranceCurve.setEventValue(dto.getFeatureAmplitude());
voltageToleranceCurve.setTime(dto.getStartTime());
voltageToleranceCurve.setGdName(info.getGdName());
voltageToleranceCurve.setSubName(info.getSubName());
return voltageToleranceCurve;
})
//.sorted(VoltageToleranceCurveDataList.sortAscTime())
.collect(Collectors.toCollection(() -> Collections.synchronizedList(new ArrayList<>())));
return VoltageToleranceCurveVO.buildVO(result.size(), curveDataList);
} }
/** /**