移动代码

This commit is contained in:
huangzj
2023-05-25 15:08:25 +08:00
parent 9e0d40b6fa
commit bc9e54d56f
4 changed files with 34 additions and 10 deletions

View File

@@ -3,6 +3,7 @@ package com.njcn.harmonic.service.impl;
import com.alibaba.nacos.client.naming.utils.CollectionUtils;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.csdevice.api.CsLineFeignClient;
import com.njcn.csdevice.constant.DataParam;
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
import com.njcn.csdevice.pojo.po.CsLinePO;
@@ -14,7 +15,10 @@ import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import pojo.param.ThdDataQueryParm;
import pojo.vo.ThdDataVO;
import com.njcn.influx.pojo.po.HarmonicRatioData;
import com.njcn.influx.pojo.po.PowerQualityData;
import com.njcn.influx.service.HaronicRatioService;
import com.njcn.influx.service.PowerQualityService;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.List;
@@ -33,14 +37,14 @@ import java.util.stream.Collectors;
@RequiredArgsConstructor
public class StableDataServiceImpl implements StableDataService {
private final CsLinePOService csLinePOService;
private final CsLineFeignClient csLineFeignClient;
private final PowerQualityService powerQualityService;
private final HarmonicRatioService harmonicRatioService;
private final HaronicRatioService harmonicRatioService;
@Override
public List<ThdDataVO> queryThdData(String devId, String statisticalName) {
List<ThdDataVO> thdDataVOList = new ArrayList<>();
List<CsLinePO> csLinePOList = csLinePOService.queryByDevId(devId);
List<CsLinePO> csLinePOList = csLineFeignClient.queryLineByDevId(devId).getData();
Optional.ofNullable(csLinePOList).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.LINE_DATA_ERROR));
List<String> collect = csLinePOList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
List<PowerQualityData> firstPowerQuality = powerQualityService.getFirstPowerQuality(collect, statisticalName);
@@ -74,7 +78,7 @@ public class StableDataServiceImpl implements StableDataService {
@Override
public List<ThdDataVO> queryThdDataByTime(ThdDataQueryParm thdDataQueryParm) {
List<ThdDataVO> thdDataVOList = new ArrayList<>();
List<CsLinePO> csLinePOList = csLinePOService.queryByDevId(thdDataQueryParm.getDevId());
List<CsLinePO> csLinePOList = csLineFeignClient.queryLineByDevId(thdDataQueryParm.getDevId()).getData();
Optional.ofNullable(csLinePOList).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.LINE_DATA_ERROR));
List<String> collect = csLinePOList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
List<PowerQualityData> firstPowerQuality = powerQualityService.getPowerQuality(collect, thdDataQueryParm.getStatisticalName(), thdDataQueryParm.getStartTime(), thdDataQueryParm.getEndTime());
@@ -108,10 +112,10 @@ public class StableDataServiceImpl implements StableDataService {
@Override
public List<ThdDataVO> queryFisrtThdContent(String devId, String statisticalName) {
List<ThdDataVO> thdDataVOList = new ArrayList<>();
List<CsLinePO> csLinePOList = csLinePOService.queryByDevId(devId);
List<CsLinePO> csLinePOList = csLineFeignClient.queryLineByDevId(devId).getData();
Optional.ofNullable(csLinePOList).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.LINE_DATA_ERROR));
List<String> collect = csLinePOList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
List<HarmonicRatioData> harmonicRatioList = haronicRatioService.getFirstHaronicRatio(collect, statisticalName);
List<HarmonicRatioData> harmonicRatioList = harmonicRatioService.getFirstHaronicRatio(collect, statisticalName);
harmonicRatioList.forEach(temp->{
ThdDataVO thdDataVO = new ThdDataVO();
BeanUtils.copyProperties(temp,thdDataVO);
@@ -133,10 +137,10 @@ public class StableDataServiceImpl implements StableDataService {
@Override
public List<ThdDataVO> queryThdContentByTime(ThdDataQueryParm thdDataQueryParm) {
List<ThdDataVO> thdDataVOList = new ArrayList<>();
List<CsLinePO> csLinePOList = csLinePOService.queryByDevId(thdDataQueryParm.getDevId());
List<CsLinePO> csLinePOList = csLineFeignClient.queryLineByDevId(thdDataQueryParm.getDevId()).getData();
Optional.ofNullable(csLinePOList).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.LINE_DATA_ERROR));
List<String> collect = csLinePOList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
List<HarmonicRatioData> harmonicRatioList = haronicRatioService.getHaronicRatio(collect, thdDataQueryParm.getStatisticalName(),thdDataQueryParm.getStartTime(), thdDataQueryParm.getEndTime());
List<HarmonicRatioData> harmonicRatioList = harmonicRatioService.getHaronicRatio(collect, thdDataQueryParm.getStatisticalName(),thdDataQueryParm.getStartTime(), thdDataQueryParm.getEndTime());
harmonicRatioList.forEach(temp->{
ThdDataVO thdDataVO = new ThdDataVO();
BeanUtils.copyProperties(temp,thdDataVO);