数据中心算法添加

This commit is contained in:
2023-12-06 10:59:02 +08:00
parent 921d1dc7fe
commit a9a7fa9719
5 changed files with 143 additions and 1 deletions

View File

@@ -61,7 +61,8 @@ public class MeasurementExecutor extends BaseExecutor {
private final IRMpBenchmarkLevelMService irMpBenchmarkLevelMService;
private final IRMpBenchmarkLevelQService irmBenchmarkLevelQService;
private final IRMpBenchmarkLevelYService irMpBenchmarkLevelYService;
private final HarmonicGeneralService harmonicGeneralService;
private final HarmonicMetricService harmonicMetricService;
/**
* 算法名: 3.3.1.1-----监测点评价
*
@@ -432,5 +433,40 @@ public class MeasurementExecutor extends BaseExecutor {
}
}
}
/**
* 数据中心算法
* 算法名: 暂无-----电能质量综合评估-日表
* r_stat_comasses_d
*
* @author xuyang
* @date 2023年12月06日 10:43
*/
@LiteflowMethod(value = LiteFlowMethodEnum.IS_ACCESS, nodeId = "rStatComasses", nodeType = NodeTypeEnum.COMMON)
public boolean rStatComassesAccess(NodeComponent bindCmp) {
return isAccess(bindCmp);
}
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "rStatComasses", nodeType = NodeTypeEnum.COMMON)
public void rStatComassesProcess(NodeComponent bindCmp) {
harmonicGeneralService.newGeneralData(bindCmp.getRequestData());
}
/**
* 数据中心算法
* 算法名: 暂无-----电能质量评估指标-日表
* r_stat_asses_d
*
* @author xuyang
* @date 2023年12月06日 10:49
*/
@LiteflowMethod(value = LiteFlowMethodEnum.IS_ACCESS, nodeId = "rStatAsses", nodeType = NodeTypeEnum.COMMON)
public boolean rStatAssesAccess(NodeComponent bindCmp) {
return isAccess(bindCmp);
}
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "rStatAsses", nodeType = NodeTypeEnum.COMMON)
public void rStatAssesProcess(NodeComponent bindCmp) {
harmonicMetricService.newMetricData(bindCmp.getRequestData());
}
/********************************************算法负责人:xy结束***********************************************************/
}

View File

@@ -10,6 +10,7 @@ import com.njcn.influx.pojo.po.DataFlicker;
import com.njcn.influx.pojo.po.DataV;
import com.njcn.influx.utils.InfluxDbUtils;
import com.njcn.prepare.harmonic.mapper.mysql.day.RStatComassesDMapper;
import com.njcn.prepare.harmonic.pojo.bo.CalculatedParam;
import com.njcn.prepare.harmonic.pojo.param.LineParam;
import com.njcn.prepare.harmonic.service.mysql.line.HarmonicGeneralService;
import lombok.AllArgsConstructor;
@@ -132,6 +133,66 @@ public class HarmonicGeneralServiceImpl extends MppServiceImpl<RStatComassesDMap
}
}
@Override
public void newGeneralData(CalculatedParam calculatedParam) {
List<RStatComassesDPO> list = new ArrayList<>();
List<String> lineIdOutList;
if (CollUtil.isEmpty(calculatedParam.getIdList())){
List<Overlimit> overLimitList = getAllLineOutData();
lineIdOutList = overLimitList.stream().map(Overlimit::getId).collect(Collectors.toList());
}else {
lineIdOutList = new ArrayList<>(calculatedParam.getIdList());
}
Date dateOut = DateUtil.parse(calculatedParam.getDataDate());
for (String lineId : lineIdOutList){
RStatComassesDPO rStatComassesDpo = new RStatComassesDPO();
rStatComassesDpo.setTime(dateOut);
rStatComassesDpo.setLineId(lineId);
Map<String, Object> fields = getGeneralData(lineId,calculatedParam.getDataDate());
if(CollUtil.isNotEmpty(fields)) {
rStatComassesDpo.setFreqDev1(Objects.isNull(fields.get("freq_dev1")) ? 0.0 : Double.parseDouble(fields.get("freq_dev1").toString()));
rStatComassesDpo.setFreqDev2(Objects.isNull(fields.get("freq_dev2")) ? 0.0 : Double.parseDouble(fields.get("freq_dev2").toString()));
rStatComassesDpo.setFreqDev3(Objects.isNull(fields.get("freq_dev3")) ? 0.0 : Double.parseDouble(fields.get("freq_dev3").toString()));
rStatComassesDpo.setFreqDev4(Objects.isNull(fields.get("freq_dev4")) ? 0.0 : Double.parseDouble(fields.get("freq_dev4").toString()));
rStatComassesDpo.setFreqDev5(Objects.isNull(fields.get("freq_dev5")) ? 0.0 : Double.parseDouble(fields.get("freq_dev5").toString()));
rStatComassesDpo.setVuDev1(Objects.isNull(fields.get("vu_dev1")) ? 0.0 : Double.parseDouble(fields.get("vu_dev1").toString()));
rStatComassesDpo.setVuDev2(Objects.isNull(fields.get("vu_dev2")) ? 0.0 : Double.parseDouble(fields.get("vu_dev2").toString()));
rStatComassesDpo.setVuDev3(Objects.isNull(fields.get("vu_dev3")) ? 0.0 : Double.parseDouble(fields.get("vu_dev3").toString()));
rStatComassesDpo.setVuDev4(Objects.isNull(fields.get("vu_dev4")) ? 0.0 : Double.parseDouble(fields.get("vu_dev4").toString()));
rStatComassesDpo.setVuDev5(Objects.isNull(fields.get("vu_dev5")) ? 0.0 : Double.parseDouble(fields.get("vu_dev5").toString()));
rStatComassesDpo.setDataPst1(Objects.isNull(fields.get("data_pst1")) ? 0.0 : Double.parseDouble(fields.get("data_pst1").toString()));
rStatComassesDpo.setDataPst2(Objects.isNull(fields.get("data_pst2")) ? 0.0 : Double.parseDouble(fields.get("data_pst2").toString()));
rStatComassesDpo.setDataPst3(Objects.isNull(fields.get("data_pst3")) ? 0.0 : Double.parseDouble(fields.get("data_pst3").toString()));
rStatComassesDpo.setDataPst4(Objects.isNull(fields.get("data_pst4")) ? 0.0 : Double.parseDouble(fields.get("data_pst4").toString()));
rStatComassesDpo.setDataPst5(Objects.isNull(fields.get("data_pst5")) ? 0.0 : Double.parseDouble(fields.get("data_pst5").toString()));
rStatComassesDpo.setVUnbalance1(Objects.isNull(fields.get("v_unbalance1")) ? 0.0 : Double.parseDouble(fields.get("v_unbalance1").toString()));
rStatComassesDpo.setVUnbalance2(Objects.isNull(fields.get("v_unbalance2")) ? 0.0 : Double.parseDouble(fields.get("v_unbalance2").toString()));
rStatComassesDpo.setVUnbalance3(Objects.isNull(fields.get("v_unbalance3")) ? 0.0 : Double.parseDouble(fields.get("v_unbalance3").toString()));
rStatComassesDpo.setVUnbalance4(Objects.isNull(fields.get("v_unbalance4")) ? 0.0 : Double.parseDouble(fields.get("v_unbalance4").toString()));
rStatComassesDpo.setVUnbalance5(Objects.isNull(fields.get("v_unbalance5")) ? 0.0 : Double.parseDouble(fields.get("v_unbalance5").toString()));
rStatComassesDpo.setVThd1(Objects.isNull(fields.get("v_thd1")) ? 0.0 : Double.parseDouble(fields.get("v_thd1").toString()));
rStatComassesDpo.setVThd2(Objects.isNull(fields.get("v_thd2")) ? 0.0 : Double.parseDouble(fields.get("v_thd2").toString()));
rStatComassesDpo.setVThd3(Objects.isNull(fields.get("v_thd3")) ? 0.0 : Double.parseDouble(fields.get("v_thd3").toString()));
rStatComassesDpo.setVThd4(Objects.isNull(fields.get("v_thd4")) ? 0.0 : Double.parseDouble(fields.get("v_thd4").toString()));
rStatComassesDpo.setVThd5(Objects.isNull(fields.get("v_thd5")) ? 0.0 : Double.parseDouble(fields.get("v_thd5").toString()));
rStatComassesDpo.setEvent1(Objects.isNull(fields.get("event1")) ? 0.0 : Double.parseDouble(fields.get("event1").toString()));
rStatComassesDpo.setEvent2(Objects.isNull(fields.get("event2")) ? 0.0 : Double.parseDouble(fields.get("event2").toString()));
rStatComassesDpo.setEvent3(Objects.isNull(fields.get("event3")) ? 0.0 : Double.parseDouble(fields.get("event3").toString()));
rStatComassesDpo.setEvent4(Objects.isNull(fields.get("event4")) ? 0.0 : Double.parseDouble(fields.get("event4").toString()));
rStatComassesDpo.setEvent5(Objects.isNull(fields.get("event5")) ? 0.0 : Double.parseDouble(fields.get("event5").toString()));
list.add(rStatComassesDpo);
}
}
if(CollUtil.isNotEmpty(list)){
this.saveOrUpdateBatchByMultiId(list,50);
}
}
private Map<String, Object> getGeneralData(String lineId, String date){
InfluxDBResultMapper mapper = new InfluxDBResultMapper();
BigDecimal hundred = BigDecimal.valueOf(100);

View File

@@ -10,6 +10,7 @@ import com.njcn.influx.pojo.po.DataPlt;
import com.njcn.influx.pojo.po.DataV;
import com.njcn.influx.utils.InfluxDbUtils;
import com.njcn.prepare.harmonic.mapper.mysql.day.RStatAssesDMapper;
import com.njcn.prepare.harmonic.pojo.bo.CalculatedParam;
import com.njcn.prepare.harmonic.pojo.param.LineParam;
import com.njcn.prepare.harmonic.service.mysql.line.HarmonicMetricService;
import lombok.AllArgsConstructor;
@@ -96,6 +97,36 @@ public class HarmonicMetricServiceImpl extends MppServiceImpl<RStatAssesDMapper,
}
}
@Override
public void newMetricData(CalculatedParam calculatedParam) {
List<RStatAssesDPO> list = new ArrayList<>();
List<String> lineIdList;
if (CollUtil.isEmpty(calculatedParam.getIdList())){
List<Overlimit> overLimitList = getAllLineData();
lineIdList = overLimitList.stream().map(Overlimit::getId).collect(Collectors.toList());
}else {
lineIdList = new ArrayList<>(calculatedParam.getIdList());
}
Date dateOut = DateUtil.parse(calculatedParam.getDataDate());
for (String lineId : lineIdList){
Map<String, Object> fields = getMetricData(lineId,calculatedParam.getDataDate());
if(CollUtil.isNotEmpty(fields)) {
RStatAssesDPO rStatAssesDpo = new RStatAssesDPO();
rStatAssesDpo.setTime(dateOut);
rStatAssesDpo.setLineId(lineId);
rStatAssesDpo.setVuDev(Double.parseDouble(fields.get("vu_dev").toString()));
rStatAssesDpo.setFreqDev(Double.parseDouble(fields.get("freq_dev").toString()));
rStatAssesDpo.setDataPlt(Double.parseDouble(fields.get("data_plt").toString()));
rStatAssesDpo.setVUnbalanceCp95(Double.parseDouble(fields.get("v_unbalance_cp95").toString()));
rStatAssesDpo.setVThdCp95(Double.parseDouble(fields.get("v_thd_cp95").toString()));
list.add(rStatAssesDpo);
}
}
if(CollUtil.isNotEmpty(list)){
this.saveOrUpdateBatchByMultiId(list,50);
}
}
private Map<String, Object> getMetricData(String lineId,String date){
String processParam = " and line_id = '"+lineId+"' and time >= '"+date+" 00:00:00' and time <= '"+date+" 23:59:59' tz('Asia/Shanghai')";
QueryResult vuDevResult = influxDbUtils.query("select abs(vu_dev) as vu_dev from data_v where phasic_type != 'T' and value_type = 'AVG'"+processParam);

View File

@@ -1,5 +1,6 @@
package com.njcn.prepare.harmonic.service.mysql.line;
import com.njcn.prepare.harmonic.pojo.bo.CalculatedParam;
import com.njcn.prepare.harmonic.pojo.param.LineParam;
/**
@@ -11,5 +12,11 @@ public interface HarmonicGeneralService {
void generalData(LineParam lineParam);
@Deprecated
void generalDataToMysql(LineParam lineParam,String time);
/**
* @Description: 电能质量综合评估-日表
*/
void newGeneralData(CalculatedParam calculatedParam);
}

View File

@@ -1,5 +1,6 @@
package com.njcn.prepare.harmonic.service.mysql.line;
import com.njcn.prepare.harmonic.pojo.bo.CalculatedParam;
import com.njcn.prepare.harmonic.pojo.param.LineParam;
/**
@@ -11,5 +12,11 @@ public interface HarmonicMetricService {
void metricData(LineParam lineParam);
@Deprecated
void metricDataToMysql(LineParam lineParam,String time);
/**
* @Description: 电能质量评估指标-日表
*/
void newMetricData(CalculatedParam calculatedParam);
}