多监测点趋势对比

This commit is contained in:
huangzj
2023-07-03 08:58:55 +08:00
parent e4f441fb85
commit 26a14a7c6b
5 changed files with 62 additions and 8 deletions

View File

@@ -103,4 +103,14 @@ public class StableDataController extends BaseController {
List<ThdDataVO> result = stableDataService.queryCommonStatisticalByTime(commonStatisticalQueryParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/queryLineCommonStatistical")
@ApiOperation("多监测点数据比较")
public HttpResult<List<ThdDataVO>> queryLineCommonStatistical(@RequestBody CommonStatisticalQueryParam commonStatisticalQueryParam) {
String methodDescribe = getMethodDescribe("queryFisrtCommonStatistical");
List<ThdDataVO> result = stableDataService.queryLineCommonStatistical(commonStatisticalQueryParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
}

View File

@@ -34,4 +34,6 @@ public interface StableDataService {
List<ThdDataVO> queryFisrtCommonStatistical(CommonStatisticalQueryParam commonStatisticalQueryParam);
List<ThdDataVO> queryCommonStatisticalByTime(CommonStatisticalQueryParam commonStatisticalQueryParam);
List<ThdDataVO> queryLineCommonStatistical(CommonStatisticalQueryParam commonStatisticalQueryParam);
}

View File

@@ -161,7 +161,7 @@ public class StableDataServiceImpl implements StableDataService {
EleEpdPqd data = epdFeignClient.selectById(commonStatisticalQueryParam.getStatisticalId()).getData();
Optional.ofNullable(csLinePOList).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.ELEEPDPQD_DATA_ERROR));
Optional.ofNullable(data).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.ELEEPDPQD_DATA_ERROR));
String frequency = Optional.ofNullable(commonStatisticalQueryParam.getFrequency()).orElse("");
List<StatisticalDataDTO> deviceRtData = commonService.getDeviceRtData(collect, data.getClassId(), data.getName()+frequency, data.getPhase(), commonStatisticalQueryParam.getValueType());
@@ -189,7 +189,35 @@ public class StableDataServiceImpl implements StableDataService {
EleEpdPqd data = epdFeignClient.selectById(commonStatisticalQueryParam.getStatisticalId()).getData();
List<CsLinePO> csLinePOList1 = Optional.ofNullable(csLinePOList).orElseThrow(() -> new BusinessException(AlgorithmResponseEnum.ELEEPDPQD_DATA_ERROR));
Optional.ofNullable(data).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.ELEEPDPQD_DATA_ERROR));
String frequency = Optional.ofNullable(commonStatisticalQueryParam.getFrequency()).orElse("");
List<StatisticalDataDTO> deviceRtData = commonService.getDeviceRtDataByTime(collect, data.getClassId(), data.getName()+frequency, data.getPhase(), commonStatisticalQueryParam.getValueType(),commonStatisticalQueryParam.getStartTime(),commonStatisticalQueryParam.getEndTime());
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
ThdDataVO vo = new ThdDataVO();
vo.setLineId(temp.getLineId());
vo.setPhase(temp.getPhaseType());
String position = csLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition();
vo.setPosition(position);
vo.setTime(temp.getTime().atZone(ZoneId.systemDefault()).toLocalDateTime());
vo.setStatMethod(temp.getValueType());
vo.setStatisticalData(BigDecimal.valueOf(temp.getValue()).setScale(4, RoundingMode.UP).doubleValue());
vo.setStatisticalIndex(data.getId());
return vo;
}).collect(Collectors.toList());
return collect1;
}
@Override
public List<ThdDataVO> queryLineCommonStatistical(CommonStatisticalQueryParam commonStatisticalQueryParam) {
List<CsLinePO> csLinePOList = csLineFeignClient.queryLineById(commonStatisticalQueryParam.getLineList()).getData();
Optional.ofNullable(csLinePOList).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.LINE_DATA_ERROR));
List<String> collect = csLinePOList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
EleEpdPqd data = epdFeignClient.selectById(commonStatisticalQueryParam.getStatisticalId()).getData();
Optional.ofNullable(data).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.ELEEPDPQD_DATA_ERROR));
String frequency = Optional.ofNullable(commonStatisticalQueryParam.getFrequency()).orElse("");
List<StatisticalDataDTO> deviceRtData = commonService.getDeviceRtDataByTime(collect, data.getClassId(), data.getName()+frequency, data.getPhase(), commonStatisticalQueryParam.getValueType(),commonStatisticalQueryParam.getStartTime(),commonStatisticalQueryParam.getEndTime());