1.监测点表新增两个字段
2.无线bug提交
This commit is contained in:
@@ -1,11 +1,17 @@
|
||||
package com.njcn.csharmonic.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.csdevice.api.CsLedgerFeignClient;
|
||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||
import com.njcn.csdevice.api.DataSetFeignClient;
|
||||
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||
import com.njcn.csdevice.pojo.dto.LineParamDTO;
|
||||
import com.njcn.csdevice.pojo.po.CsDataSet;
|
||||
import com.njcn.csdevice.pojo.po.CsLedger;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csdevice.utils.DataChangeUtil;
|
||||
@@ -49,6 +55,8 @@ public class DeviceDataTrendServiceImpl implements DeviceDataTrendService {
|
||||
private final EquipmentFeignClient equipmentFeignClient;
|
||||
private final InfluxDbParamUtil influxDbParamUtil;
|
||||
private final EpdFeignClient epdFeignClient;
|
||||
private final DataSetFeignClient dataSetFeignClient;
|
||||
|
||||
@Override
|
||||
public List<List<ThdDataVO>> queryDataTrend(DevicDataTrendQueryParam devicDataTrendQueryParam) {
|
||||
List<List<ThdDataVO>> result = new ArrayList<>();
|
||||
@@ -62,7 +70,10 @@ public class DeviceDataTrendServiceImpl implements DeviceDataTrendService {
|
||||
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 linePo = csLineFeignClient.queryLineById(Collections.singletonList(devicDataTrendQueryParam.getLineId())).getData().get(0);
|
||||
|
||||
List<CsDataSet> csDataSetList = dataSetFeignClient.getDataSetBySetIds(Stream.of(linePo.getDataSetId()).collect(Collectors.toList())).getData();
|
||||
if(CollUtil.isEmpty(csDataSetList) || StrUtil.isBlank(csDataSetList.get(0).getDataLevel())){
|
||||
throw new BusinessException("当前测点数据集主要信息缺失,请联系管理员排查(测点表里面数据集id缺失)");
|
||||
}
|
||||
devicDataTrendQueryParam.getStatisticalParams().forEach(temp->{
|
||||
CommonQueryParam commonQueryParam = new CommonQueryParam();
|
||||
commonQueryParam.setLineId(devicDataTrendQueryParam.getLineId());
|
||||
@@ -83,19 +94,21 @@ public class DeviceDataTrendServiceImpl implements DeviceDataTrendService {
|
||||
vo.setTime(statisticalDataDTO.getTime());
|
||||
vo.setStatMethod(statisticalDataDTO.getValueType());
|
||||
//判断监测点类型 针对治理设备 模块数据是一次值、电能质量设备是二次值
|
||||
if (linePo.getClDid() != 0 && Objects.equals(devicDataTrendQueryParam.getDataLevel(),"Primary") && ObjectUtil.isNotNull(epdPqd.getPrimaryFormula())) {
|
||||
double secondaryData = DataChangeUtil.secondaryToPrimary(epdPqd.getPrimaryFormula(), statisticalDataDTO.getValue(), linePo.getPtRatio(), linePo.getCtRatio());
|
||||
if (changePower(epdPqd.getShowName())) {
|
||||
secondaryData = secondaryData/1000;
|
||||
double value;
|
||||
if (ObjectUtil.isNotNull(epdPqd.getPrimaryFormula()) && !Objects.equals(devicDataTrendQueryParam.getDataLevel(),csDataSetList.get(0).getDataLevel())) {
|
||||
if("Primary".equals(csDataSetList.get(0).getDataLevel())){
|
||||
value = DataChangeUtil.primaryToSecondary(epdPqd.getPrimaryFormula(), statisticalDataDTO.getValue(), linePo.getPtRatio(), linePo.getCtRatio());
|
||||
}else {
|
||||
value = DataChangeUtil.secondaryToPrimary(epdPqd.getPrimaryFormula(), statisticalDataDTO.getValue(), linePo.getPtRatio(), linePo.getCtRatio());
|
||||
}
|
||||
vo.setStatisticalData(BigDecimal.valueOf(secondaryData).setScale(4, RoundingMode.HALF_UP).doubleValue());
|
||||
} else {
|
||||
Double temVal = statisticalDataDTO.getValue();
|
||||
if (changePower(epdPqd.getShowName())) {
|
||||
temVal = temVal/1000;
|
||||
}
|
||||
vo.setStatisticalData(BigDecimal.valueOf(temVal).setScale(4, RoundingMode.HALF_UP).doubleValue());
|
||||
value= statisticalDataDTO.getValue();
|
||||
}
|
||||
if (changePower(epdPqd.getShowName())) {
|
||||
value = value/1000;
|
||||
}
|
||||
vo.setStatisticalData(BigDecimal.valueOf(value).setScale(4, RoundingMode.HALF_UP).doubleValue());
|
||||
|
||||
vo.setStatisticalIndex(temp.getDataId());
|
||||
vo.setStatisticalName(temp.getName());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user