高低电压穿越功能优化
This commit is contained in:
@@ -42,7 +42,8 @@ public class PowerStatisticsController extends BaseController {
|
||||
@ApiOperation("根据监测点ID及时间获取有功功率趋势")
|
||||
public HttpResult<PowerStatisticsVO> getDataByLineId(@RequestBody @Validated PowerStatisticsParam powerStatisticsParam) {
|
||||
String methodDescribe = getMethodDescribe("getDataByLineId");
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, powerStatisticsService.getDataByLineId(powerStatisticsParam), methodDescribe);
|
||||
PowerStatisticsVO dataByLineId = powerStatisticsService.getDataByLineId(powerStatisticsParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,dataByLineId , methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -53,7 +54,8 @@ public class PowerStatisticsController extends BaseController {
|
||||
@ApiOperation("根据监测点ID、有功功率趋势区间字段、时间获取该有功功率趋势下指标越限列表")
|
||||
public HttpResult<List<PowerStatisticsTargetVO>> getTargetLimitById(@RequestBody @Validated PowerStatisticsParam powerStatisticsParam) {
|
||||
String methodDescribe = getMethodDescribe("getTargetLimitById");
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, powerStatisticsService.getTargetLimitById(powerStatisticsParam), methodDescribe);
|
||||
List<PowerStatisticsTargetVO> targetLimitById = powerStatisticsService.getTargetLimitById(powerStatisticsParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,targetLimitById , methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -64,7 +66,8 @@ public class PowerStatisticsController extends BaseController {
|
||||
@ApiOperation("点击越限列表时间查询指标的详细数据")
|
||||
public HttpResult<List<ThdDataVO>> getTargetByTime(@RequestBody @Validated PowerStatisticsParam powerStatisticsParam) {
|
||||
String methodDescribe = getMethodDescribe("getTargetByTime");
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, powerStatisticsService.getTargetByTime(powerStatisticsParam), methodDescribe);
|
||||
List<ThdDataVO> targetByTime = powerStatisticsService.getTargetByTime(powerStatisticsParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, targetByTime, methodDescribe);
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
|
||||
@@ -30,6 +30,8 @@ import org.springframework.stereotype.Service;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -84,16 +86,17 @@ public class PowerStatisticsServiceImpl implements PowerStatisticsService {
|
||||
+ powerStatisticsVO.getMinsNum6() + powerStatisticsVO.getMinsNum7() + powerStatisticsVO.getMinsNum8()
|
||||
+ powerStatisticsVO.getMinsNum9();
|
||||
if(total != 0){
|
||||
powerStatisticsVO.setProportion0(Double.parseDouble(dftwo.format((double)powerStatisticsVO.getMinsNum0().intValue() / total * 100)));
|
||||
powerStatisticsVO.setProportion1(Double.parseDouble(dftwo.format((double)powerStatisticsVO.getMinsNum1().intValue() / total * 100)));
|
||||
powerStatisticsVO.setProportion2(Double.parseDouble(dftwo.format((double)powerStatisticsVO.getMinsNum2().intValue() / total * 100)));
|
||||
powerStatisticsVO.setProportion3(Double.parseDouble(dftwo.format((double)powerStatisticsVO.getMinsNum3().intValue() / total * 100)));
|
||||
powerStatisticsVO.setProportion4(Double.parseDouble(dftwo.format((double)powerStatisticsVO.getMinsNum4().intValue() / total * 100)));
|
||||
powerStatisticsVO.setProportion5(Double.parseDouble(dftwo.format((double)powerStatisticsVO.getMinsNum5().intValue() / total * 100)));
|
||||
powerStatisticsVO.setProportion6(Double.parseDouble(dftwo.format((double)powerStatisticsVO.getMinsNum6().intValue() / total * 100)));
|
||||
powerStatisticsVO.setProportion7(Double.parseDouble(dftwo.format((double)powerStatisticsVO.getMinsNum7().intValue() / total * 100)));
|
||||
powerStatisticsVO.setProportion8(Double.parseDouble(dftwo.format((double)powerStatisticsVO.getMinsNum8().intValue() / total * 100)));
|
||||
powerStatisticsVO.setProportion9(Double.parseDouble(dftwo.format((double)powerStatisticsVO.getMinsNum9().intValue() / total * 100)));
|
||||
BigDecimal totalData = BigDecimal.valueOf(total);
|
||||
powerStatisticsVO.setProportion0(BigDecimal.valueOf(powerStatisticsVO.getMinsNum0()* 100.0).divide(totalData, 4, RoundingMode.HALF_UP).doubleValue());
|
||||
powerStatisticsVO.setProportion1(BigDecimal.valueOf(powerStatisticsVO.getMinsNum1()* 100.0).divide(totalData, 4, RoundingMode.HALF_UP).doubleValue());
|
||||
powerStatisticsVO.setProportion2(BigDecimal.valueOf(powerStatisticsVO.getMinsNum2()* 100.0).divide(totalData, 4, RoundingMode.HALF_UP).doubleValue());
|
||||
powerStatisticsVO.setProportion3(BigDecimal.valueOf(powerStatisticsVO.getMinsNum3()* 100.0).divide(totalData, 4, RoundingMode.HALF_UP).doubleValue());
|
||||
powerStatisticsVO.setProportion4(BigDecimal.valueOf(powerStatisticsVO.getMinsNum4()* 100.0).divide(totalData, 4, RoundingMode.HALF_UP).doubleValue());
|
||||
powerStatisticsVO.setProportion5(BigDecimal.valueOf(powerStatisticsVO.getMinsNum5()* 100.0).divide(totalData, 4, RoundingMode.HALF_UP).doubleValue());
|
||||
powerStatisticsVO.setProportion6(BigDecimal.valueOf(powerStatisticsVO.getMinsNum6()* 100.0).divide(totalData, 4, RoundingMode.HALF_UP).doubleValue());
|
||||
powerStatisticsVO.setProportion7(BigDecimal.valueOf(powerStatisticsVO.getMinsNum7()* 100.0).divide(totalData, 4, RoundingMode.HALF_UP).doubleValue());
|
||||
powerStatisticsVO.setProportion8(BigDecimal.valueOf(powerStatisticsVO.getMinsNum8()* 100.0).divide(totalData, 4, RoundingMode.HALF_UP).doubleValue());
|
||||
powerStatisticsVO.setProportion9(BigDecimal.valueOf(powerStatisticsVO.getMinsNum9()* 100.0).divide(totalData, 4, RoundingMode.HALF_UP).doubleValue());
|
||||
}
|
||||
return powerStatisticsVO;
|
||||
}
|
||||
@@ -121,7 +124,14 @@ public class PowerStatisticsServiceImpl implements PowerStatisticsService {
|
||||
|
||||
}
|
||||
|
||||
//反射获取值
|
||||
/**
|
||||
* @Description: 反射获取值
|
||||
* @param obj
|
||||
* @param fieldName
|
||||
* @return: java.lang.Object
|
||||
* @Author: wr
|
||||
* @Date: 2025/3/26 19:24
|
||||
*/
|
||||
private Object reflexObjValue(Object obj, String fieldName) {
|
||||
try {
|
||||
Class clazz = obj.getClass();
|
||||
@@ -233,64 +243,88 @@ public class PowerStatisticsServiceImpl implements PowerStatisticsService {
|
||||
commonQueryParams.add(commonQueryParam);
|
||||
|
||||
List<StatisticalDataDTO> deviceRtData = commonService.getNewDeviceRtDataByTime(commonQueryParams);
|
||||
if(!deviceRtData.isEmpty()) thdDataVO.setAVGPhaseA(Double.valueOf(df.format(deviceRtData.get(0).getValue()))+"");
|
||||
if(!deviceRtData.isEmpty()) {
|
||||
thdDataVO.setAVGPhaseA(Double.valueOf(df.format(deviceRtData.get(0).getValue()))+"");
|
||||
}
|
||||
|
||||
commonQueryParam.setDataType(METHODS.get(0));
|
||||
commonQueryParam.setPhasic(PHASE.get(1));
|
||||
deviceRtData = commonService.getNewDeviceRtDataByTime(commonQueryParams);
|
||||
if(!deviceRtData.isEmpty()) thdDataVO.setAVGPhaseB(Double.valueOf(df.format(deviceRtData.get(0).getValue()))+"");
|
||||
if(!deviceRtData.isEmpty()) {
|
||||
thdDataVO.setAVGPhaseB(Double.valueOf(df.format(deviceRtData.get(0).getValue()))+"");
|
||||
}
|
||||
|
||||
commonQueryParam.setDataType(METHODS.get(0));
|
||||
commonQueryParam.setPhasic(PHASE.get(2));
|
||||
deviceRtData = commonService.getNewDeviceRtDataByTime(commonQueryParams);
|
||||
if(!deviceRtData.isEmpty()) thdDataVO.setAVGPhaseC(Double.valueOf(df.format(deviceRtData.get(0).getValue()))+"");
|
||||
if(!deviceRtData.isEmpty()) {
|
||||
thdDataVO.setAVGPhaseC(Double.valueOf(df.format(deviceRtData.get(0).getValue()))+"");
|
||||
}
|
||||
|
||||
commonQueryParam.setDataType(METHODS.get(1));
|
||||
commonQueryParam.setPhasic(PHASE.get(0));
|
||||
deviceRtData = commonService.getNewDeviceRtDataByTime(commonQueryParams);
|
||||
if(!deviceRtData.isEmpty()) thdDataVO.setCP95PhaseA(Double.valueOf(df.format(deviceRtData.get(0).getValue()))+"");
|
||||
if(!deviceRtData.isEmpty()) {
|
||||
thdDataVO.setCP95PhaseA(Double.valueOf(df.format(deviceRtData.get(0).getValue()))+"");
|
||||
}
|
||||
|
||||
commonQueryParam.setDataType(METHODS.get(1));
|
||||
commonQueryParam.setPhasic(PHASE.get(1));
|
||||
deviceRtData = commonService.getNewDeviceRtDataByTime(commonQueryParams);
|
||||
if(!deviceRtData.isEmpty()) thdDataVO.setCP95PhaseB(Double.valueOf(df.format(deviceRtData.get(0).getValue()))+"");
|
||||
if(!deviceRtData.isEmpty()) {
|
||||
thdDataVO.setCP95PhaseB(Double.valueOf(df.format(deviceRtData.get(0).getValue()))+"");
|
||||
}
|
||||
|
||||
commonQueryParam.setDataType(METHODS.get(1));
|
||||
commonQueryParam.setPhasic(PHASE.get(2));
|
||||
deviceRtData = commonService.getNewDeviceRtDataByTime(commonQueryParams);
|
||||
if(!deviceRtData.isEmpty()) thdDataVO.setCP95PhaseC(Double.valueOf(df.format(deviceRtData.get(0).getValue()))+"");
|
||||
if(!deviceRtData.isEmpty()) {
|
||||
thdDataVO.setCP95PhaseC(Double.valueOf(df.format(deviceRtData.get(0).getValue()))+"");
|
||||
}
|
||||
|
||||
|
||||
commonQueryParam.setDataType(METHODS.get(2));
|
||||
commonQueryParam.setPhasic(PHASE.get(0));
|
||||
deviceRtData = commonService.getNewDeviceRtDataByTime(commonQueryParams);
|
||||
if(!deviceRtData.isEmpty()) thdDataVO.setMINPhaseA(Double.valueOf(df.format(deviceRtData.get(0).getValue()))+"");
|
||||
if(!deviceRtData.isEmpty()) {
|
||||
thdDataVO.setMINPhaseA(Double.valueOf(df.format(deviceRtData.get(0).getValue()))+"");
|
||||
}
|
||||
|
||||
commonQueryParam.setDataType(METHODS.get(2));
|
||||
commonQueryParam.setPhasic(PHASE.get(1));
|
||||
deviceRtData = commonService.getNewDeviceRtDataByTime(commonQueryParams);
|
||||
if(!deviceRtData.isEmpty()) thdDataVO.setMINPhaseB(Double.valueOf(df.format(deviceRtData.get(0).getValue()))+"");
|
||||
if(!deviceRtData.isEmpty()) {
|
||||
thdDataVO.setMINPhaseB(Double.valueOf(df.format(deviceRtData.get(0).getValue()))+"");
|
||||
}
|
||||
|
||||
commonQueryParam.setDataType(METHODS.get(2));
|
||||
commonQueryParam.setPhasic(PHASE.get(2));
|
||||
deviceRtData = commonService.getNewDeviceRtDataByTime(commonQueryParams);
|
||||
if(!deviceRtData.isEmpty()) thdDataVO.setMINPhaseC(Double.valueOf(df.format(deviceRtData.get(0).getValue()))+"");
|
||||
if(!deviceRtData.isEmpty()) {
|
||||
thdDataVO.setMINPhaseC(Double.valueOf(df.format(deviceRtData.get(0).getValue()))+"");
|
||||
}
|
||||
|
||||
|
||||
commonQueryParam.setDataType(METHODS.get(3));
|
||||
commonQueryParam.setPhasic(PHASE.get(0));
|
||||
deviceRtData = commonService.getNewDeviceRtDataByTime(commonQueryParams);
|
||||
if(!deviceRtData.isEmpty()) thdDataVO.setMAXPhaseA(Double.valueOf(df.format(deviceRtData.get(0).getValue()))+"");
|
||||
if(!deviceRtData.isEmpty()) {
|
||||
thdDataVO.setMAXPhaseA(Double.valueOf(df.format(deviceRtData.get(0).getValue()))+"");
|
||||
}
|
||||
|
||||
commonQueryParam.setDataType(METHODS.get(3));
|
||||
commonQueryParam.setPhasic(PHASE.get(1));
|
||||
deviceRtData = commonService.getNewDeviceRtDataByTime(commonQueryParams);
|
||||
if(!deviceRtData.isEmpty()) thdDataVO.setMAXPhaseB(Double.valueOf(df.format(deviceRtData.get(0).getValue()))+"");
|
||||
if(!deviceRtData.isEmpty()) {
|
||||
thdDataVO.setMAXPhaseB(Double.valueOf(df.format(deviceRtData.get(0).getValue()))+"");
|
||||
}
|
||||
|
||||
commonQueryParam.setDataType(METHODS.get(3));
|
||||
commonQueryParam.setPhasic(PHASE.get(2));
|
||||
deviceRtData = commonService.getNewDeviceRtDataByTime(commonQueryParams);
|
||||
if(!deviceRtData.isEmpty()) thdDataVO.setMAXPhaseC(Double.valueOf(df.format(deviceRtData.get(0).getValue()))+"");
|
||||
if(!deviceRtData.isEmpty()) {
|
||||
thdDataVO.setMAXPhaseC(Double.valueOf(df.format(deviceRtData.get(0).getValue()))+"");
|
||||
}
|
||||
return thdDataVO;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user