二次值转换为一次值
This commit is contained in:
@@ -39,6 +39,9 @@ public class DeviceManagerVO {
|
|||||||
@ApiModelProperty(value = "装置数据集集合")
|
@ApiModelProperty(value = "装置数据集集合")
|
||||||
private List<DataSetVO> dataSetList;
|
private List<DataSetVO> dataSetList;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "装置数据标识")
|
||||||
|
private String dataLevel;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public static class DataSetVO {
|
public static class DataSetVO {
|
||||||
@ApiModelProperty(value = "数据集Id")
|
@ApiModelProperty(value = "数据集Id")
|
||||||
|
|||||||
@@ -61,10 +61,11 @@ public class CsGroupController extends BaseController {
|
|||||||
@ApiImplicitParam(name = "pageSize", value = "页面尺寸", required = true),
|
@ApiImplicitParam(name = "pageSize", value = "页面尺寸", required = true),
|
||||||
@ApiImplicitParam(name = "lineId", value = "监测点id", required = true),
|
@ApiImplicitParam(name = "lineId", value = "监测点id", required = true),
|
||||||
@ApiImplicitParam(name = "searchValue", value = "搜索值", required = true),
|
@ApiImplicitParam(name = "searchValue", value = "搜索值", required = true),
|
||||||
|
@ApiImplicitParam(name = "dataLevel", value = "数据标志", required = true)
|
||||||
})
|
})
|
||||||
public HttpResult<IPage<DataGroupTemplateVO>> getDeviceRtData(@RequestParam("id") String id, @RequestParam("pageNum") Integer pageNum, @RequestParam("pageSize") Integer pageSize, @RequestParam(value = "lineId")String lineId, @RequestParam(value = "searchValue") String searchValue){
|
public HttpResult<IPage<DataGroupTemplateVO>> getDeviceRtData(@RequestParam("id") String id, @RequestParam("pageNum") Integer pageNum, @RequestParam("pageSize") Integer pageSize, @RequestParam(value = "lineId")String lineId, @RequestParam(value = "searchValue") String searchValue, @RequestParam(value = "dataLevel",required = false) String dataLevel){
|
||||||
String methodDescribe = getMethodDescribe("getDeviceRtData");
|
String methodDescribe = getMethodDescribe("getDeviceRtData");
|
||||||
IPage<DataGroupTemplateVO> list = csGroupService.getDeviceRtData(id, pageNum, pageSize,lineId,searchValue);
|
IPage<DataGroupTemplateVO> list = csGroupService.getDeviceRtData(id, pageNum, pageSize,lineId,searchValue,dataLevel);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public interface ICsGroupService extends IService<CsGroup> {
|
|||||||
* 获取装置分组后的实时数据
|
* 获取装置分组后的实时数据
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
IPage<DataGroupTemplateVO> getDeviceRtData(String id, Integer pageNum, Integer pageSize, String lineId, String searchValue);
|
IPage<DataGroupTemplateVO> getDeviceRtData(String id, Integer pageNum, Integer pageSize, String lineId, String searchValue, String dataLevel);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取装置时间范围内的历史数据
|
* 获取装置时间范围内的历史数据
|
||||||
|
|||||||
@@ -349,6 +349,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
dataSetVO.setName(item.getAnotherName());
|
dataSetVO.setName(item.getAnotherName());
|
||||||
dataSetVO.setType("rt");
|
dataSetVO.setType("rt");
|
||||||
dataSetList.add(dataSetVO);
|
dataSetList.add(dataSetVO);
|
||||||
|
deviceManagerVo.setDataLevel(item.getDataLevel());
|
||||||
if (Objects.equals(type, "history")) {
|
if (Objects.equals(type, "history")) {
|
||||||
//历史数据tab
|
//历史数据tab
|
||||||
DeviceManagerVO.DataSetVO dataSetVo2 = new DeviceManagerVO.DataSetVO();
|
DeviceManagerVO.DataSetVO dataSetVo2 = new DeviceManagerVO.DataSetVO();
|
||||||
@@ -356,6 +357,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
dataSetVo2.setName("历史" + item.getAnotherName());
|
dataSetVo2.setName("历史" + item.getAnotherName());
|
||||||
dataSetVo2.setType("history");
|
dataSetVo2.setType("history");
|
||||||
dataSetList.add(dataSetVo2);
|
dataSetList.add(dataSetVo2);
|
||||||
|
deviceManagerVo.setDataLevel(item.getDataLevel());
|
||||||
//下面这些tab仅仅只限于设备监控的便携式设备才会有
|
//下面这些tab仅仅只限于设备监控的便携式设备才会有
|
||||||
if(DataParam.portableDevType.equals(csEquipmentDeliveryPo.getDevType())){
|
if(DataParam.portableDevType.equals(csEquipmentDeliveryPo.getDevType())){
|
||||||
//趋势数据tab
|
//趋势数据tab
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.njcn.csdevice.service.impl;
|
|||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
@@ -67,6 +68,7 @@ import java.text.DecimalFormat;
|
|||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
@@ -134,7 +136,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPage<DataGroupTemplateVO> getDeviceRtData(String id, Integer pageNum, Integer pageSize, String lineId, String searchValue) {
|
public IPage<DataGroupTemplateVO> getDeviceRtData(String id, Integer pageNum, Integer pageSize, String lineId, String searchValue, String dataLevel) {
|
||||||
IPage<DataGroupTemplateVO> pageTurn = new Page<>();
|
IPage<DataGroupTemplateVO> pageTurn = new Page<>();
|
||||||
List<EnergyTemplateVO> arrayList = new ArrayList<>();
|
List<EnergyTemplateVO> arrayList = new ArrayList<>();
|
||||||
IPage<DataGroupTemplateVO> pageRes = csGroupMapper.getGroupDataList(new Page<>(pageNum, pageSize),id,searchValue);
|
IPage<DataGroupTemplateVO> pageRes = csGroupMapper.getGroupDataList(new Page<>(pageNum, pageSize),id,searchValue);
|
||||||
@@ -143,19 +145,76 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
List<String> group = groupList.stream().map(DataGroupTemplateVO::getId).collect(Collectors.toList());
|
List<String> group = groupList.stream().map(DataGroupTemplateVO::getId).collect(Collectors.toList());
|
||||||
//获取当前组的所有指标项
|
//获取当前组的所有指标项
|
||||||
List<EnergyTemplateVO> list = csDataArrayMapper.getArrayByGroup(group);
|
List<EnergyTemplateVO> list = csDataArrayMapper.getArrayByGroup(group);
|
||||||
|
//获取所有字典指标
|
||||||
|
List<EleEpdPqd> epdPqdList = epdFeignClient.selectByIds(list.stream().map(EnergyTemplateVO::getDataId).distinct().collect(Collectors.toList())).getData();
|
||||||
|
Map<String, EleEpdPqd> eventTypeMap = epdPqdList.stream().collect(Collectors.toMap(EleEpdPqd::getId, Function.identity()));
|
||||||
|
//根据lineId获取监测点pt、ct变比
|
||||||
|
CsLinePO csLinePO = csLineFeignClient.queryLineById(Collections.singletonList(lineId)).getData().get(0);
|
||||||
for (EnergyTemplateVO item : list) {
|
for (EnergyTemplateVO item : list) {
|
||||||
EnergyTemplateVO vo = new EnergyTemplateVO();
|
EnergyTemplateVO vo = new EnergyTemplateVO();
|
||||||
BeanUtils.copyProperties(item,vo);
|
BeanUtils.copyProperties(item,vo);
|
||||||
EleEpdPqd eleEpdPqd = epdFeignClient.selectById(item.getDataId()).getData();
|
EleEpdPqd eleEpdPqd = eventTypeMap.get(item.getDataId());
|
||||||
vo.setClassId(eleEpdPqd.getClassId());
|
vo.setClassId(eleEpdPqd.getClassId());
|
||||||
vo.setUnit(eleEpdPqd.getUnit());
|
vo.setUnit(eleEpdPqd.getUnit());
|
||||||
StatisticalDataDTO statisticalDataDTO = commonService.getLineRtData(lineId,influxDbParamUtil.getTableNameByClassId(eleEpdPqd.getClassId()),item.getName(),item.getPhase(),item.getStatMethod(),influxDbParamUtil.getClDidByLineId(lineId));
|
StatisticalDataDTO statisticalDataDTO = commonService.getLineRtData(lineId,influxDbParamUtil.getTableNameByClassId(eleEpdPqd.getClassId()),item.getName(),item.getPhase(),item.getStatMethod(),influxDbParamUtil.getClDidByLineId(lineId));
|
||||||
if (!Objects.isNull(statisticalDataDTO)){
|
if (Objects.nonNull(statisticalDataDTO)) {
|
||||||
vo.setTime(statisticalDataDTO.getTime());
|
vo.setTime(statisticalDataDTO.getTime());
|
||||||
vo.setDataValue(BigDecimal.valueOf(statisticalDataDTO.getValue()).setScale(4, RoundingMode.UP).doubleValue());
|
|
||||||
} else {
|
|
||||||
vo.setDataValue(3.1415926);
|
|
||||||
}
|
}
|
||||||
|
if (Objects.isNull(dataLevel)) {
|
||||||
|
if (Objects.nonNull(statisticalDataDTO)) {
|
||||||
|
vo.setDataValue(BigDecimal.valueOf(statisticalDataDTO.getValue()).setScale(4, RoundingMode.UP).doubleValue());
|
||||||
|
} else {
|
||||||
|
vo.setDataValue(3.1415926);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ("Primary".equals(dataLevel)) {
|
||||||
|
if (Objects.nonNull(statisticalDataDTO)) {
|
||||||
|
vo.setDataValue(BigDecimal.valueOf(statisticalDataDTO.getValue()).setScale(4, RoundingMode.UP).doubleValue());
|
||||||
|
} else {
|
||||||
|
vo.setDataValue(3.1415926);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (Objects.nonNull(statisticalDataDTO)) {
|
||||||
|
if (ObjectUtil.isNotNull(eleEpdPqd.getPrimaryFormula())) {
|
||||||
|
double secondaryData = secondaryToPrimary(eleEpdPqd.getPrimaryFormula(), statisticalDataDTO.getValue(), csLinePO.getPtRatio(), csLinePO.getCtRatio());
|
||||||
|
vo.setDataValue(BigDecimal.valueOf(secondaryData).setScale(4, RoundingMode.UP).doubleValue());
|
||||||
|
} else {
|
||||||
|
vo.setDataValue(BigDecimal.valueOf(statisticalDataDTO.getValue()).setScale(4, RoundingMode.UP).doubleValue());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
vo.setDataValue(3.1415926);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// if (Objects.isNull(dataLevel)){
|
||||||
|
// if (!Objects.isNull(statisticalDataDTO)){
|
||||||
|
// vo.setTime(statisticalDataDTO.getTime());
|
||||||
|
// vo.setDataValue(BigDecimal.valueOf(statisticalDataDTO.getValue()).setScale(4, RoundingMode.UP).doubleValue());
|
||||||
|
// } else {
|
||||||
|
// vo.setDataValue(3.1415926);
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// if (Objects.equals(dataLevel,"Primary")) {
|
||||||
|
// if (!Objects.isNull(statisticalDataDTO)){
|
||||||
|
// vo.setTime(statisticalDataDTO.getTime());
|
||||||
|
// vo.setDataValue(BigDecimal.valueOf(statisticalDataDTO.getValue()).setScale(4, RoundingMode.UP).doubleValue());
|
||||||
|
// } else {
|
||||||
|
// vo.setDataValue(3.1415926);
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// if (!Objects.isNull(statisticalDataDTO)){
|
||||||
|
// vo.setTime(statisticalDataDTO.getTime());
|
||||||
|
// if (ObjectUtil.isNotNull(eleEpdPqd.getPrimaryFormula())) {
|
||||||
|
// double secondaryData = secondaryToPrimary(eleEpdPqd.getPrimaryFormula(),statisticalDataDTO.getValue(),csLinePO.getPtRatio(),csLinePO.getCtRatio());
|
||||||
|
// vo.setDataValue(BigDecimal.valueOf(secondaryData).setScale(4, RoundingMode.UP).doubleValue());
|
||||||
|
// } else {
|
||||||
|
// vo.setDataValue(BigDecimal.valueOf(statisticalDataDTO.getValue()).setScale(4, RoundingMode.UP).doubleValue());
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// vo.setDataValue(3.1415926);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
arrayList.add(vo);
|
arrayList.add(vo);
|
||||||
}
|
}
|
||||||
if (CollectionUtil.isNotEmpty(arrayList)){
|
if (CollectionUtil.isNotEmpty(arrayList)){
|
||||||
@@ -663,6 +722,27 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 二次值换算成一次值
|
||||||
|
*/
|
||||||
|
public double secondaryToPrimary(String formula, Double data,Double pt, Double ct) {
|
||||||
|
switch (formula) {
|
||||||
|
case "*PT":
|
||||||
|
data = data * pt;
|
||||||
|
break;
|
||||||
|
case "*CT":
|
||||||
|
data = data * ct;
|
||||||
|
break;
|
||||||
|
case "*PT*CT/1000":
|
||||||
|
data = data * pt * ct / 1000;
|
||||||
|
break;
|
||||||
|
case "*PT/1000":
|
||||||
|
data = data * pt / 1000;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,9 @@ public class DevicDataTrendQueryParam {
|
|||||||
@NotNull(message="结束时间不能为空!")
|
@NotNull(message="结束时间不能为空!")
|
||||||
private String endTime;
|
private String endTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "数据类型")
|
||||||
|
private String dataLevel;
|
||||||
|
|
||||||
private String devId;
|
private String devId;
|
||||||
@Data
|
@Data
|
||||||
public static class StatisticalParam{
|
public static class StatisticalParam{
|
||||||
|
|||||||
@@ -390,6 +390,14 @@ public class MqttMessageHandler {
|
|||||||
return "APF模块 5";
|
return "APF模块 5";
|
||||||
case "6":
|
case "6":
|
||||||
return "APF模块 6";
|
return "APF模块 6";
|
||||||
|
case "7":
|
||||||
|
return "APF模块 7";
|
||||||
|
case "8":
|
||||||
|
return "APF模块 8";
|
||||||
|
case "9":
|
||||||
|
return "APF模块 9";
|
||||||
|
case "10":
|
||||||
|
return "APF模块 10";
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ 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.csdevice.pojo.po.CsLinePO;
|
||||||
|
import com.njcn.csdevice.pojo.vo.EnergyTemplateVO;
|
||||||
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;
|
||||||
@@ -20,6 +22,7 @@ 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.DictData;
|
||||||
|
import com.njcn.system.pojo.po.EleEpdPqd;
|
||||||
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;
|
||||||
@@ -27,9 +30,7 @@ import org.springframework.util.CollectionUtils;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
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;
|
||||||
|
|
||||||
@@ -49,6 +50,7 @@ public class DeviceDataTrendServiceImpl implements DeviceDataTrendService {
|
|||||||
private final DicDataFeignClient dicDataFeignClient;
|
private final DicDataFeignClient dicDataFeignClient;
|
||||||
private final EquipmentFeignClient equipmentFeignClient;
|
private final EquipmentFeignClient equipmentFeignClient;
|
||||||
private final InfluxDbParamUtil influxDbParamUtil;
|
private final InfluxDbParamUtil influxDbParamUtil;
|
||||||
|
private final EpdFeignClient epdFeignClient;
|
||||||
@Override
|
@Override
|
||||||
public List<List<ThdDataVO>> queryDataTrend(DevicDataTrendQueryParam devicDataTrendQueryParam) {
|
public List<List<ThdDataVO>> queryDataTrend(DevicDataTrendQueryParam devicDataTrendQueryParam) {
|
||||||
List<List<ThdDataVO>> result = new ArrayList<>();
|
List<List<ThdDataVO>> result = new ArrayList<>();
|
||||||
@@ -60,29 +62,41 @@ public class DeviceDataTrendServiceImpl implements DeviceDataTrendService {
|
|||||||
lineParamDTO.setLineId(devicDataTrendQueryParam.getLineId());
|
lineParamDTO.setLineId(devicDataTrendQueryParam.getLineId());
|
||||||
List<CsLedger> data = csLedgerFeignClient.queryLine(lineParamDTO).getData();
|
List<CsLedger> data = csLedgerFeignClient.queryLine(lineParamDTO).getData();
|
||||||
List<CsEquipmentDeliveryDTO> data1 = equipmentFeignClient.queryDeviceById(Stream.of((data == null || data.isEmpty()) ? devicDataTrendQueryParam.getDevId() : data.get(0).getPid()).collect(Collectors.toList())).getData();
|
List<CsEquipmentDeliveryDTO> data1 = equipmentFeignClient.queryDeviceById(Stream.of((data == null || data.isEmpty()) ? devicDataTrendQueryParam.getDevId() : data.get(0).getPid()).collect(Collectors.toList())).getData();
|
||||||
|
//根据lineId获取监测点pt、ct变比
|
||||||
|
CsLinePO csLinePO = csLineFeignClient.queryLineById(Collections.singletonList(devicDataTrendQueryParam.getLineId())).getData().get(0);
|
||||||
|
|
||||||
devicDataTrendQueryParam.getStatisticalParams().forEach(temp->{
|
devicDataTrendQueryParam.getStatisticalParams().forEach(temp->{
|
||||||
CommonQueryParam commonQueryParam = new CommonQueryParam();
|
CommonQueryParam commonQueryParam = new CommonQueryParam();
|
||||||
commonQueryParam.setLineId(devicDataTrendQueryParam.getLineId());
|
commonQueryParam.setLineId(devicDataTrendQueryParam.getLineId());
|
||||||
commonQueryParam.setTableName(influxDbParamUtil.getTableNameByClassId(temp.getClassId()));
|
commonQueryParam.setTableName(influxDbParamUtil.getTableNameByClassId(temp.getClassId()));
|
||||||
commonQueryParam.setColumnName(temp.getName());
|
commonQueryParam.setColumnName(temp.getName());
|
||||||
commonQueryParam.setPhasic(temp.getPhase());
|
commonQueryParam.setPhasic(temp.getPhase());
|
||||||
commonQueryParam.setStartTime( devicDataTrendQueryParam.getStartTime());
|
commonQueryParam.setStartTime( devicDataTrendQueryParam.getStartTime() + " 00:00:00");
|
||||||
commonQueryParam.setEndTime(devicDataTrendQueryParam.getEndTime());
|
commonQueryParam.setEndTime(devicDataTrendQueryParam.getEndTime() + " 23:59:59");
|
||||||
commonQueryParam.setDataType( temp.getStatMethod());
|
commonQueryParam.setDataType( temp.getStatMethod());
|
||||||
commonQueryParam.setProcess(data1.get(0).getProcess()+"");
|
commonQueryParam.setProcess(data1.get(0).getProcess()+"");
|
||||||
commonQueryParam.setClDid(influxDbParamUtil.getClDidByLineId(devicDataTrendQueryParam.getLineId()));
|
commonQueryParam.setClDid(influxDbParamUtil.getClDidByLineId(devicDataTrendQueryParam.getLineId()));
|
||||||
|
|
||||||
|
EleEpdPqd epdPqd = epdFeignClient.selectByIds(Collections.singletonList(temp.getDataId())).getData().get(0);
|
||||||
|
|
||||||
List<StatisticalDataDTO> deviceRtData = commonService.getDeviceRtDataByTime(Stream.of(commonQueryParam).collect(Collectors.toList()));
|
List<StatisticalDataDTO> deviceRtData = commonService.getDeviceRtDataByTime(Stream.of(commonQueryParam).collect(Collectors.toList()));
|
||||||
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());
|
||||||
vo.setPhase(statisticalDataDTO.getPhaseType());
|
vo.setPhase(statisticalDataDTO.getPhaseType());
|
||||||
|
|
||||||
vo.setTime(statisticalDataDTO.getTime());
|
vo.setTime(statisticalDataDTO.getTime());
|
||||||
vo.setStatMethod(statisticalDataDTO.getValueType());
|
vo.setStatMethod(statisticalDataDTO.getValueType());
|
||||||
vo.setStatisticalData(BigDecimal.valueOf(statisticalDataDTO.getValue()).setScale(4, RoundingMode.UP).doubleValue());
|
//对二次值做转换
|
||||||
|
if (Objects.equals(devicDataTrendQueryParam.getDataLevel(),"Secondary")) {
|
||||||
|
if (!Objects.isNull(epdPqd.getPrimaryFormula())) {
|
||||||
|
double secondaryData = secondaryToPrimary(epdPqd.getPrimaryFormula(), statisticalDataDTO.getValue(), csLinePO.getPtRatio(), csLinePO.getCtRatio());
|
||||||
|
vo.setStatisticalData(BigDecimal.valueOf(secondaryData).setScale(4, RoundingMode.UP).doubleValue());
|
||||||
|
} else {
|
||||||
|
vo.setStatisticalData(BigDecimal.valueOf(statisticalDataDTO.getValue()).setScale(4, RoundingMode.UP).doubleValue());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
vo.setStatisticalData(BigDecimal.valueOf(statisticalDataDTO.getValue()).setScale(4, RoundingMode.UP).doubleValue());
|
||||||
|
}
|
||||||
vo.setStatisticalIndex(temp.getDataId());
|
vo.setStatisticalIndex(temp.getDataId());
|
||||||
vo.setStatisticalName(temp.getName());
|
vo.setStatisticalName(temp.getName());
|
||||||
vo.setUnit(temp.getUnit());
|
vo.setUnit(temp.getUnit());
|
||||||
@@ -91,9 +105,29 @@ public class DeviceDataTrendServiceImpl implements DeviceDataTrendService {
|
|||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
result.add(collect1);
|
result.add(collect1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 二次值换算成一次值
|
||||||
|
*/
|
||||||
|
public double secondaryToPrimary(String formula, Double data,Double pt, Double ct) {
|
||||||
|
switch (formula) {
|
||||||
|
case "*PT":
|
||||||
|
data = data * pt;
|
||||||
|
break;
|
||||||
|
case "*CT":
|
||||||
|
data = data * ct;
|
||||||
|
break;
|
||||||
|
case "*PT*CT/1000":
|
||||||
|
data = data * pt * ct / 1000;
|
||||||
|
break;
|
||||||
|
case "*PT/1000":
|
||||||
|
data = data * pt / 1000;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user