数据添加单位显示

This commit is contained in:
xy
2024-08-16 18:19:49 +08:00
parent e6e3ae958b
commit 2f1252fbce
3 changed files with 68 additions and 48 deletions

View File

@@ -8,6 +8,7 @@ import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
import com.njcn.csdevice.pojo.dto.LineParamDTO;
import com.njcn.csdevice.pojo.po.CsLedger;
import com.njcn.csdevice.pojo.po.CsLinePO;
import com.njcn.csdevice.utils.DataChangeUtil;
import com.njcn.csharmonic.param.DevicDataTrendQueryParam;
import com.njcn.csharmonic.pojo.vo.ThdDataVO;
import com.njcn.csharmonic.service.DeviceDataTrendService;
@@ -81,7 +82,7 @@ public class DeviceDataTrendServiceImpl implements DeviceDataTrendService {
vo.setStatMethod(statisticalDataDTO.getValueType());
//判断监测点类型 针对治理设备 模块数据是一次值、电能质量设备是二次值
if (linePo.getClDid() != 0 && Objects.equals(devicDataTrendQueryParam.getDataLevel(),"Primary") && ObjectUtil.isNotNull(epdPqd.getPrimaryFormula())) {
double secondaryData = secondaryToPrimary(epdPqd.getPrimaryFormula(), statisticalDataDTO.getValue(), linePo.getPtRatio(), linePo.getCtRatio());
double secondaryData = DataChangeUtil.secondaryToPrimary(epdPqd.getPrimaryFormula(), statisticalDataDTO.getValue(), linePo.getPtRatio(), linePo.getCtRatio());
vo.setStatisticalData(BigDecimal.valueOf(secondaryData).setScale(4, RoundingMode.HALF_UP).doubleValue());
} else {
vo.setStatisticalData(BigDecimal.valueOf(statisticalDataDTO.getValue()).setScale(4, RoundingMode.HALF_UP).doubleValue());
@@ -96,27 +97,4 @@ public class DeviceDataTrendServiceImpl implements DeviceDataTrendService {
});
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;
}
}