influxdb查询修改
This commit is contained in:
@@ -104,14 +104,14 @@ public class StableDataController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
// @OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/queryLineCommonStatistical")
|
// @PostMapping("/queryLineCommonStatistical")
|
||||||
@ApiOperation("多监测点数据比较")
|
// @ApiOperation("多监测点数据比较")
|
||||||
public HttpResult<List<ThdDataVO>> queryLineCommonStatistical(@RequestBody CommonStatisticalQueryParam commonStatisticalQueryParam) {
|
// public HttpResult<List<ThdDataVO>> queryLineCommonStatistical(@RequestBody CommonStatisticalQueryParam commonStatisticalQueryParam) {
|
||||||
String methodDescribe = getMethodDescribe("queryFisrtCommonStatistical");
|
// String methodDescribe = getMethodDescribe("queryFisrtCommonStatistical");
|
||||||
List<ThdDataVO> result = stableDataService.queryLineCommonStatistical(commonStatisticalQueryParam);
|
// List<ThdDataVO> result = stableDataService.queryLineCommonStatistical(commonStatisticalQueryParam);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
}
|
// }
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/QuerySqlData")
|
@PostMapping("/QuerySqlData")
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public interface StableDataService {
|
|||||||
|
|
||||||
List<ThdDataVO> queryCommonStatisticalByTime(CommonStatisticalQueryParam commonStatisticalQueryParam);
|
List<ThdDataVO> queryCommonStatisticalByTime(CommonStatisticalQueryParam commonStatisticalQueryParam);
|
||||||
|
|
||||||
List<ThdDataVO> queryLineCommonStatistical(CommonStatisticalQueryParam commonStatisticalQueryParam);
|
// List<ThdDataVO> queryLineCommonStatistical(CommonStatisticalQueryParam commonStatisticalQueryParam);
|
||||||
|
|
||||||
public List<ThdDataVO> QuerySqlData(FrequencyStatisticalQueryParam frequencyStatisticalQueryParam);
|
public List<ThdDataVO> QuerySqlData(FrequencyStatisticalQueryParam frequencyStatisticalQueryParam);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,24 @@
|
|||||||
package com.njcn.csharmonic.service.impl;
|
package com.njcn.csharmonic.service.impl;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.csdevice.api.CsLedgerFeignClient;
|
import com.njcn.csdevice.api.CsLedgerFeignClient;
|
||||||
|
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||||
import com.njcn.csdevice.api.DataArrayFeignClient;
|
import com.njcn.csdevice.api.DataArrayFeignClient;
|
||||||
import com.njcn.csdevice.api.EquipmentFeignClient;
|
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||||
|
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||||
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||||
import com.njcn.csdevice.pojo.dto.LineParamDTO;
|
import com.njcn.csdevice.pojo.dto.LineParamDTO;
|
||||||
import com.njcn.csdevice.pojo.po.CsLedger;
|
import com.njcn.csdevice.pojo.po.CsLedger;
|
||||||
import com.njcn.csharmonic.param.DevicDataTrendQueryParam;
|
import com.njcn.csharmonic.param.DevicDataTrendQueryParam;
|
||||||
import com.njcn.csharmonic.pojo.vo.ThdDataVO;
|
import com.njcn.csharmonic.pojo.vo.ThdDataVO;
|
||||||
import com.njcn.csharmonic.service.DeviceDataTrendService;
|
import com.njcn.csharmonic.service.DeviceDataTrendService;
|
||||||
|
import com.njcn.influx.pojo.bo.CommonQueryParam;
|
||||||
import com.njcn.influx.pojo.dto.StatisticalDataDTO;
|
import com.njcn.influx.pojo.dto.StatisticalDataDTO;
|
||||||
import com.njcn.influx.service.CommonService;
|
import com.njcn.influx.service.CommonService;
|
||||||
|
import com.njcn.system.api.DicDataFeignClient;
|
||||||
import com.njcn.system.api.EpdFeignClient;
|
import com.njcn.system.api.EpdFeignClient;
|
||||||
|
import com.njcn.system.enums.DicDataEnum;
|
||||||
|
import com.njcn.system.pojo.po.DictData;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
@@ -21,6 +28,7 @@ import java.math.RoundingMode;
|
|||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
@@ -34,10 +42,10 @@ import java.util.stream.Stream;
|
|||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class DeviceDataTrendServiceImpl implements DeviceDataTrendService {
|
public class DeviceDataTrendServiceImpl implements DeviceDataTrendService {
|
||||||
private final EpdFeignClient epdFeignClient;
|
|
||||||
private final CommonService commonService;
|
private final CommonService commonService;
|
||||||
private final DataArrayFeignClient dataArrayFeignClient;
|
|
||||||
private final CsLedgerFeignClient csLedgerFeignClient;
|
private final CsLedgerFeignClient csLedgerFeignClient;
|
||||||
|
private final CsLineFeignClient csLineFeignClient;
|
||||||
|
private final DicDataFeignClient dicDataFeignClient;
|
||||||
private final EquipmentFeignClient equipmentFeignClient;
|
private final EquipmentFeignClient equipmentFeignClient;
|
||||||
@Override
|
@Override
|
||||||
public List<List<ThdDataVO>> queryDataTrend(DevicDataTrendQueryParam devicDataTrendQueryParam) {
|
public List<List<ThdDataVO>> queryDataTrend(DevicDataTrendQueryParam devicDataTrendQueryParam) {
|
||||||
@@ -51,14 +59,20 @@ public class DeviceDataTrendServiceImpl implements DeviceDataTrendService {
|
|||||||
List<CsLedger> data = csLedgerFeignClient.queryLine(lineParamDTO).getData();
|
List<CsLedger> data = csLedgerFeignClient.queryLine(lineParamDTO).getData();
|
||||||
List<CsEquipmentDeliveryDTO> data1 = equipmentFeignClient.queryDeviceById(Stream.of(data.get(0).getPid()).collect(Collectors.toList())).getData();
|
List<CsEquipmentDeliveryDTO> data1 = equipmentFeignClient.queryDeviceById(Stream.of(data.get(0).getPid()).collect(Collectors.toList())).getData();
|
||||||
devicDataTrendQueryParam.getStatisticalParams().forEach(temp->{
|
devicDataTrendQueryParam.getStatisticalParams().forEach(temp->{
|
||||||
|
CommonQueryParam commonQueryParam = new CommonQueryParam();
|
||||||
|
commonQueryParam.setLineId(devicDataTrendQueryParam.getLineId());
|
||||||
|
commonQueryParam.setTableName(getTableNameByClassId(temp.getClassId()));
|
||||||
|
commonQueryParam.setColumnName(temp.getName());
|
||||||
|
commonQueryParam.setPhasic(temp.getPhase());
|
||||||
|
commonQueryParam.setStartTime( devicDataTrendQueryParam.getStartTime());
|
||||||
|
commonQueryParam.setEndTime(devicDataTrendQueryParam.getEndTime());
|
||||||
|
commonQueryParam.setDataType( temp.getStatMethod());
|
||||||
|
commonQueryParam.setProcess(data1.get(0).getProcess()+"");
|
||||||
|
commonQueryParam.setClDid(getClDidByLineId(devicDataTrendQueryParam.getLineId()));
|
||||||
|
|
||||||
List<StatisticalDataDTO> deviceRtData = commonService.getDeviceRtDataByTime(Stream.of(devicDataTrendQueryParam.getLineId()).collect(Collectors.toList()),
|
|
||||||
temp.getClassId(),
|
|
||||||
temp.getName(), temp.getPhase(),
|
List<StatisticalDataDTO> deviceRtData = commonService.getDeviceRtDataByTime(Stream.of(commonQueryParam).collect(Collectors.toList()));
|
||||||
temp.getStatMethod(),
|
|
||||||
devicDataTrendQueryParam.getStartTime(),
|
|
||||||
devicDataTrendQueryParam.getEndTime(),
|
|
||||||
data1.get(0).getProcess()+"");
|
|
||||||
List<ThdDataVO> collect1 = deviceRtData.stream().map(statisticalDataDTO -> {
|
List<ThdDataVO> collect1 = deviceRtData.stream().map(statisticalDataDTO -> {
|
||||||
ThdDataVO vo = new ThdDataVO();
|
ThdDataVO vo = new ThdDataVO();
|
||||||
vo.setLineId(statisticalDataDTO.getLineId());
|
vo.setLineId(statisticalDataDTO.getLineId());
|
||||||
@@ -80,4 +94,30 @@ public class DeviceDataTrendServiceImpl implements DeviceDataTrendService {
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*表名换成了id本方法做转换*/
|
||||||
|
private String getTableNameByClassId(String classId){
|
||||||
|
DictData data = dicDataFeignClient.getDicDataById(classId).getData();
|
||||||
|
if(Objects.isNull(data)){
|
||||||
|
throw new BusinessException("数据缺失");
|
||||||
|
}
|
||||||
|
return data.getCode();
|
||||||
|
}
|
||||||
|
private String getClDidByLineId(String lineId){
|
||||||
|
String position = csLineFeignClient.getPositionById(lineId).getData();
|
||||||
|
if (Objects.isNull(position)){
|
||||||
|
throw new BusinessException(AlgorithmResponseEnum.POSITION_ERROR);
|
||||||
|
}
|
||||||
|
String clDid = null;
|
||||||
|
String areaCode = dicDataFeignClient.getDicDataById(position).getData().getCode();
|
||||||
|
if (Objects.equals(areaCode, DicDataEnum.OUTPUT_SIDE.getCode())){
|
||||||
|
clDid = "0";
|
||||||
|
} else if (Objects.equals(areaCode, DicDataEnum.GRID_SIDE.getCode())){
|
||||||
|
clDid = "1";
|
||||||
|
} else if (Objects.equals(areaCode, DicDataEnum.LOAD_SIDE.getCode())){
|
||||||
|
clDid = "2";
|
||||||
|
}
|
||||||
|
return clDid;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import com.njcn.csharmonic.param.ThdDataQueryParm;
|
|||||||
import com.njcn.csharmonic.pojo.vo.ThdDataVO;
|
import com.njcn.csharmonic.pojo.vo.ThdDataVO;
|
||||||
import com.njcn.csharmonic.service.StableDataService;
|
import com.njcn.csharmonic.service.StableDataService;
|
||||||
import com.njcn.influx.constant.InfluxDbSqlConstant;
|
import com.njcn.influx.constant.InfluxDbSqlConstant;
|
||||||
|
import com.njcn.influx.pojo.bo.CommonQueryParam;
|
||||||
import com.njcn.influx.pojo.dto.StatisticalDataDTO;
|
import com.njcn.influx.pojo.dto.StatisticalDataDTO;
|
||||||
import com.njcn.influx.pojo.po.HarmonicRatioData;
|
import com.njcn.influx.pojo.po.HarmonicRatioData;
|
||||||
import com.njcn.influx.pojo.po.PowerQualityData;
|
import com.njcn.influx.pojo.po.PowerQualityData;
|
||||||
@@ -28,6 +29,7 @@ import com.njcn.system.api.CsStatisticalSetFeignClient;
|
|||||||
import com.njcn.system.api.DicDataFeignClient;
|
import com.njcn.system.api.DicDataFeignClient;
|
||||||
import com.njcn.system.api.EpdFeignClient;
|
import com.njcn.system.api.EpdFeignClient;
|
||||||
import com.njcn.system.enums.DicDataEnum;
|
import com.njcn.system.enums.DicDataEnum;
|
||||||
|
import com.njcn.system.pojo.po.DictData;
|
||||||
import com.njcn.system.pojo.po.EleEpdPqd;
|
import com.njcn.system.pojo.po.EleEpdPqd;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.influxdb.dto.QueryResult;
|
import org.influxdb.dto.QueryResult;
|
||||||
@@ -191,8 +193,7 @@ public class StableDataServiceImpl implements StableDataService {
|
|||||||
String areaId = dicDataFeignClient.getDicDataByCode(DicDataEnum.OUTPUT_SIDE.getCode()).getData().getId();
|
String areaId = dicDataFeignClient.getDicDataByCode(DicDataEnum.OUTPUT_SIDE.getCode()).getData().getId();
|
||||||
|
|
||||||
Optional.ofNullable(csLinePOList).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.LINE_DATA_ERROR));
|
Optional.ofNullable(csLinePOList).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.LINE_DATA_ERROR));
|
||||||
collect = csLinePOList.stream().filter(temp->Objects.equals(areaId,temp.getPosition())).map(CsLinePO::getLineId).distinct().collect(Collectors.toList());
|
List<CsLinePO> csLinePOList1 = csLinePOList.stream().filter(temp -> Objects.equals(areaId, temp.getPosition())).distinct().collect(Collectors.toList());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
EleEpdPqd data = epdFeignClient.selectById(commonStatisticalQueryParam.getStatisticalId()).getData();
|
EleEpdPqd data = epdFeignClient.selectById(commonStatisticalQueryParam.getStatisticalId()).getData();
|
||||||
@@ -203,7 +204,22 @@ public class StableDataServiceImpl implements StableDataService {
|
|||||||
}else {
|
}else {
|
||||||
frequency = "_"+commonStatisticalQueryParam.getFrequency();
|
frequency = "_"+commonStatisticalQueryParam.getFrequency();
|
||||||
}
|
}
|
||||||
List<StatisticalDataDTO> deviceRtData = commonService.getDeviceRtData(collect, data.getClassId(), data.getName()+frequency, data.getPhase(), commonStatisticalQueryParam.getValueType(),data1.get(0).getProcess()+"");
|
String finalFrequency1 = frequency;
|
||||||
|
List<CommonQueryParam> commonQueryParams = csLinePOList1.stream().map(temp -> {
|
||||||
|
CommonQueryParam commonQueryParam = new CommonQueryParam();
|
||||||
|
commonQueryParam.setLineId(temp.getLineId());
|
||||||
|
commonQueryParam.setTableName(getTableNameByClassId(data.getClassId()));
|
||||||
|
commonQueryParam.setColumnName(data.getName()+ finalFrequency1);
|
||||||
|
commonQueryParam.setPhasic(data.getPhase());
|
||||||
|
// commonQueryParam.setStartTime();
|
||||||
|
// commonQueryParam.setEndTime();
|
||||||
|
commonQueryParam.setDataType(commonStatisticalQueryParam.getValueType());
|
||||||
|
commonQueryParam.setProcess(data1.get(0).getProcess()+"");
|
||||||
|
commonQueryParam.setClDid(getClDidByLineId(temp.getLineId()));
|
||||||
|
|
||||||
|
return commonQueryParam;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
List<StatisticalDataDTO> deviceRtData = commonService.getDeviceRtData(commonQueryParams);
|
||||||
List<CsLinePO> finalCsLinePOList = csLinePOList;
|
List<CsLinePO> finalCsLinePOList = csLinePOList;
|
||||||
String finalFrequency = frequency;
|
String finalFrequency = frequency;
|
||||||
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
||||||
@@ -246,24 +262,40 @@ public class StableDataServiceImpl implements StableDataService {
|
|||||||
List<String> collect = csLinePOList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
|
List<String> collect = csLinePOList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
|
||||||
String areaId = dicDataFeignClient.getDicDataByCode(DicDataEnum.OUTPUT_SIDE.getCode()).getData().getId();
|
String areaId = dicDataFeignClient.getDicDataByCode(DicDataEnum.OUTPUT_SIDE.getCode()).getData().getId();
|
||||||
Optional.ofNullable(csLinePOList).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.LINE_DATA_ERROR));
|
Optional.ofNullable(csLinePOList).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.LINE_DATA_ERROR));
|
||||||
collect = csLinePOList.stream().filter(temp->Objects.equals(areaId,temp.getPosition())).map(CsLinePO::getLineId).collect(Collectors.toList());
|
List<CsLinePO> csLinePOList1 = csLinePOList.stream().filter(temp -> Objects.equals(areaId, temp.getPosition())).collect(Collectors.toList());
|
||||||
|
|
||||||
List<EleEpdPqd> data = csStatisticalSetFeignClient.queryStatisticalSelect(commonStatisticalQueryParam.getStatisticalId()).getData();
|
List<EleEpdPqd> data = csStatisticalSetFeignClient.queryStatisticalSelect(commonStatisticalQueryParam.getStatisticalId()).getData();
|
||||||
|
|
||||||
// EleEpdPqd data = epdFeignClient.selectById(commonStatisticalQueryParam.getStatisticalId()).getData();
|
// EleEpdPqd data = epdFeignClient.selectById(commonStatisticalQueryParam.getStatisticalId()).getData();
|
||||||
// Optional.ofNullable(data).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.ELEEPDPQD_DATA_ERROR));
|
// Optional.ofNullable(data).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.ELEEPDPQD_DATA_ERROR));
|
||||||
if(CollectionUtil.isNotEmpty(data)){
|
if(CollectionUtil.isNotEmpty(data)){
|
||||||
List<String> finalCollect = collect;
|
List<CsLinePO> finalCsLinePOList = csLinePOList;
|
||||||
data.forEach(epdPqd->{
|
data.forEach(epdPqd->{
|
||||||
String frequency = Optional.ofNullable(commonStatisticalQueryParam.getFrequency()).orElse("");
|
String frequency = Optional.ofNullable(commonStatisticalQueryParam.getFrequency()).orElse("");
|
||||||
List<StatisticalDataDTO> deviceRtData = commonService.getDeviceRtDataByTime(finalCollect, epdPqd.getClassId(), epdPqd.getName()+frequency, epdPqd.getPhase(), commonStatisticalQueryParam.getValueType(),commonStatisticalQueryParam.getStartTime(),commonStatisticalQueryParam.getEndTime(),data1.get(0).getProcess()+"");
|
|
||||||
|
String finalFrequency1 = frequency;
|
||||||
|
List<CommonQueryParam> commonQueryParams = csLinePOList1.stream().map(temp -> {
|
||||||
|
CommonQueryParam commonQueryParam = new CommonQueryParam();
|
||||||
|
commonQueryParam.setLineId(temp.getLineId());
|
||||||
|
commonQueryParam.setTableName(getTableNameByClassId(epdPqd.getClassId()));
|
||||||
|
commonQueryParam.setColumnName(epdPqd.getName()+ finalFrequency1);
|
||||||
|
commonQueryParam.setPhasic(epdPqd.getPhase());
|
||||||
|
commonQueryParam.setStartTime(commonStatisticalQueryParam.getStartTime());
|
||||||
|
commonQueryParam.setEndTime(commonStatisticalQueryParam.getEndTime());
|
||||||
|
commonQueryParam.setDataType(commonStatisticalQueryParam.getValueType());
|
||||||
|
commonQueryParam.setProcess(data1.get(0).getProcess()+"");
|
||||||
|
commonQueryParam.setClDid(getClDidByLineId(temp.getLineId()));
|
||||||
|
|
||||||
|
return commonQueryParam;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
List<StatisticalDataDTO> deviceRtData = commonService.getDeviceRtDataByTime(commonQueryParams);
|
||||||
|
|
||||||
|
|
||||||
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
||||||
ThdDataVO vo = new ThdDataVO();
|
ThdDataVO vo = new ThdDataVO();
|
||||||
vo.setLineId(temp.getLineId());
|
vo.setLineId(temp.getLineId());
|
||||||
vo.setPhase(temp.getPhaseType());
|
vo.setPhase(temp.getPhaseType());
|
||||||
String position = csLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition();
|
String position = finalCsLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition();
|
||||||
vo.setPosition(position);
|
vo.setPosition(position);
|
||||||
vo.setTime(temp.getTime());
|
vo.setTime(temp.getTime());
|
||||||
vo.setStatMethod(temp.getValueType());
|
vo.setStatMethod(temp.getValueType());
|
||||||
@@ -282,65 +314,79 @@ public class StableDataServiceImpl implements StableDataService {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
public List<ThdDataVO> queryLineCommonStatistical(CommonStatisticalQueryParam commonStatisticalQueryParam) {
|
// public List<ThdDataVO> queryLineCommonStatistical(CommonStatisticalQueryParam commonStatisticalQueryParam) {
|
||||||
List<ThdDataVO> result = new ArrayList();
|
// List<ThdDataVO> result = new ArrayList();
|
||||||
if(CollectionUtil.isEmpty(commonStatisticalQueryParam.getLineList())){
|
// if(CollectionUtil.isEmpty(commonStatisticalQueryParam.getLineList())){
|
||||||
throw new BusinessException(AlgorithmResponseEnum.LINE_DATA_ERROR);
|
// throw new BusinessException(AlgorithmResponseEnum.LINE_DATA_ERROR);
|
||||||
}
|
// }
|
||||||
List<CsLinePO> csLinePOList = csLineFeignClient.queryLineById(commonStatisticalQueryParam.getLineList()).getData();
|
// List<CsLinePO> csLinePOList = csLineFeignClient.queryLineById(commonStatisticalQueryParam.getLineList()).getData();
|
||||||
if(CollectionUtil.isEmpty(csLinePOList)){
|
// if(CollectionUtil.isEmpty(csLinePOList)){
|
||||||
throw new BusinessException(AlgorithmResponseEnum.LINE_DATA_ERROR);
|
// throw new BusinessException(AlgorithmResponseEnum.LINE_DATA_ERROR);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
LineParamDTO lineParamDTO = new LineParamDTO();
|
// LineParamDTO lineParamDTO = new LineParamDTO();
|
||||||
lineParamDTO.setLineId(commonStatisticalQueryParam.getLineList().get(0));
|
// lineParamDTO.setLineId(commonStatisticalQueryParam.getLineList().get(0));
|
||||||
List<CsLedger> csLedgers = csLedgerFeignClient.queryLine(lineParamDTO).getData();
|
// List<CsLedger> csLedgers = csLedgerFeignClient.queryLine(lineParamDTO).getData();
|
||||||
List<CsEquipmentDeliveryDTO> data1 = equipmentFeignClient.queryDeviceById(Stream.of(csLedgers.get(0).getPid()).collect(Collectors.toList())).getData();
|
// List<CsEquipmentDeliveryDTO> data1 = equipmentFeignClient.queryDeviceById(Stream.of(csLedgers.get(0).getPid()).collect(Collectors.toList())).getData();
|
||||||
|
//
|
||||||
|
//
|
||||||
List<String> collect = csLinePOList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
|
// List<String> collect = csLinePOList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
|
||||||
String areaId = dicDataFeignClient.getDicDataByCode(DicDataEnum.OUTPUT_SIDE.getCode()).getData().getId();
|
// String areaId = dicDataFeignClient.getDicDataByCode(DicDataEnum.OUTPUT_SIDE.getCode()).getData().getId();
|
||||||
Optional.ofNullable(csLinePOList).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.LINE_DATA_ERROR));
|
// Optional.ofNullable(csLinePOList).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.LINE_DATA_ERROR));
|
||||||
// collect = csLinePOList.stream().filter(temp->Objects.equals(areaId,temp.getPosition())).map(CsLinePO::getLineId).collect(Collectors.toList());
|
//// collect = csLinePOList.stream().filter(temp->Objects.equals(areaId,temp.getPosition())).map(CsLinePO::getLineId).collect(Collectors.toList());
|
||||||
|
//
|
||||||
List<EleEpdPqd> data = csStatisticalSetFeignClient.queryStatisticalSelect(commonStatisticalQueryParam.getStatisticalId()).getData();
|
// List<EleEpdPqd> data = csStatisticalSetFeignClient.queryStatisticalSelect(commonStatisticalQueryParam.getStatisticalId()).getData();
|
||||||
|
//
|
||||||
// EleEpdPqd data = epdFeignClient.selectById(commonStatisticalQueryParam.getStatisticalId()).getData();
|
//// EleEpdPqd data = epdFeignClient.selectById(commonStatisticalQueryParam.getStatisticalId()).getData();
|
||||||
Optional.ofNullable(data).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.ELEEPDPQD_DATA_ERROR));
|
// Optional.ofNullable(data).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.ELEEPDPQD_DATA_ERROR));
|
||||||
|
//
|
||||||
String frequency = Optional.ofNullable(commonStatisticalQueryParam.getFrequency()).orElse("");
|
// String frequency = Optional.ofNullable(commonStatisticalQueryParam.getFrequency()).orElse("");
|
||||||
if(CollectionUtil.isNotEmpty(data)){
|
// if(CollectionUtil.isNotEmpty(data)){
|
||||||
List<String> finalCollect = collect;
|
// List<String> finalCollect = collect;
|
||||||
data.forEach(epdPqd->{
|
// data.forEach(epdPqd->{
|
||||||
List<StatisticalDataDTO> deviceRtData = commonService.getDeviceRtDataByTime(finalCollect, epdPqd.getClassId(), epdPqd.getName()+frequency, epdPqd.getPhase(), commonStatisticalQueryParam.getValueType(),commonStatisticalQueryParam.getStartTime(),commonStatisticalQueryParam.getEndTime(),data1.get(0).getProcess()+"");
|
// List<CommonQueryParam> commonQueryParams = finalCsLinePOList.stream().map(temp -> {
|
||||||
|
// CommonQueryParam commonQueryParam = new CommonQueryParam();
|
||||||
|
// commonQueryParam.setLineId(temp.getLineId());
|
||||||
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
// commonQueryParam.setTableName(getTableNameByClassId(epdPqd.getClassId()));
|
||||||
ThdDataVO vo = new ThdDataVO();
|
// commonQueryParam.setColumnName(epdPqd.getName()+ finalFrequency1);
|
||||||
vo.setLineId(temp.getLineId());
|
// commonQueryParam.setPhasic(epdPqd.getPhase());
|
||||||
vo.setPhase(temp.getPhaseType());
|
// commonQueryParam.setStartTime(commonStatisticalQueryParam.getStartTime());
|
||||||
String position = csLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition();
|
// commonQueryParam.setEndTime(commonStatisticalQueryParam.getEndTime());
|
||||||
String lineName = csLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getName();
|
// commonQueryParam.setDataType(commonStatisticalQueryParam.getValueType());
|
||||||
|
// commonQueryParam.setProcess(data1.get(0).getProcess()+"");
|
||||||
vo.setLineName(lineName);
|
// commonQueryParam.setClDid(getClDidByLineId(temp.getLineId()));
|
||||||
vo.setPosition(position);
|
//
|
||||||
vo.setTime(temp.getTime());
|
// return commonQueryParam;
|
||||||
vo.setStatMethod(temp.getValueType());
|
// }).collect(Collectors.toList());
|
||||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
// List<StatisticalDataDTO> deviceRtData = commonService.getDeviceRtDataByTime(finalCollect, epdPqd.getClassId(), epdPqd.getName()+frequency, epdPqd.getPhase(), commonStatisticalQueryParam.getValueType(),commonStatisticalQueryParam.getStartTime(),commonStatisticalQueryParam.getEndTime(),data1.get(0).getProcess()+"");
|
||||||
vo.setStatisticalIndex(epdPqd.getId());
|
//
|
||||||
vo.setUnit(epdPqd.getUnit());
|
//
|
||||||
vo.setStatisticalName(epdPqd.getName());
|
// List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
||||||
vo.setAnotherName(epdPqd.getShowName());
|
// ThdDataVO vo = new ThdDataVO();
|
||||||
return vo;
|
// vo.setLineId(temp.getLineId());
|
||||||
}).collect(Collectors.toList());
|
// vo.setPhase(temp.getPhaseType());
|
||||||
collect1 = collect1.stream().distinct().collect(Collectors.toList());
|
// String position = csLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition();
|
||||||
result.addAll(collect1);
|
// String lineName = csLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getName();
|
||||||
});
|
//
|
||||||
}
|
// vo.setLineName(lineName);
|
||||||
|
// vo.setPosition(position);
|
||||||
return result;
|
// vo.setTime(temp.getTime());
|
||||||
}
|
// vo.setStatMethod(temp.getValueType());
|
||||||
|
// vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||||
|
// vo.setStatisticalIndex(epdPqd.getId());
|
||||||
|
// vo.setUnit(epdPqd.getUnit());
|
||||||
|
// vo.setStatisticalName(epdPqd.getName());
|
||||||
|
// vo.setAnotherName(epdPqd.getShowName());
|
||||||
|
// return vo;
|
||||||
|
// }).collect(Collectors.toList());
|
||||||
|
// collect1 = collect1.stream().distinct().collect(Collectors.toList());
|
||||||
|
// result.addAll(collect1);
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return result;
|
||||||
|
// }
|
||||||
|
|
||||||
private String phaseReflection(String phase){
|
private String phaseReflection(String phase){
|
||||||
switch (phase) {
|
switch (phase) {
|
||||||
@@ -431,4 +477,29 @@ public class StableDataServiceImpl implements StableDataService {
|
|||||||
return thdDataVOList;
|
return thdDataVOList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*表名换成了id本方法做转换*/
|
||||||
|
private String getTableNameByClassId(String classId){
|
||||||
|
DictData data = dicDataFeignClient.getDicDataById(classId).getData();
|
||||||
|
if(Objects.isNull(data)){
|
||||||
|
throw new BusinessException("数据缺失");
|
||||||
|
}
|
||||||
|
return data.getCode();
|
||||||
|
}
|
||||||
|
private String getClDidByLineId(String lineId){
|
||||||
|
String position = csLineFeignClient.getPositionById(lineId).getData();
|
||||||
|
if (Objects.isNull(position)){
|
||||||
|
throw new BusinessException(AlgorithmResponseEnum.POSITION_ERROR);
|
||||||
|
}
|
||||||
|
String clDid = null;
|
||||||
|
String areaCode = dicDataFeignClient.getDicDataById(position).getData().getCode();
|
||||||
|
if (Objects.equals(areaCode, DicDataEnum.OUTPUT_SIDE.getCode())){
|
||||||
|
clDid = "0";
|
||||||
|
} else if (Objects.equals(areaCode, DicDataEnum.GRID_SIDE.getCode())){
|
||||||
|
clDid = "1";
|
||||||
|
} else if (Objects.equals(areaCode, DicDataEnum.LOAD_SIDE.getCode())){
|
||||||
|
clDid = "2";
|
||||||
|
}
|
||||||
|
return clDid;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user