调度功能bug修改
This commit is contained in:
@@ -87,44 +87,49 @@ public class HarmonicGeneralServiceImpl extends MppServiceImpl<RStatComassesDMap
|
||||
rStatComassesDpo.setTime(dateOut);
|
||||
rStatComassesDpo.setLineId(lineId);
|
||||
Map<String, Object> fields = getGeneralData(lineId,time);
|
||||
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()));
|
||||
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.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.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.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.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);
|
||||
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);
|
||||
}
|
||||
this.saveOrUpdateBatchByMultiId(list,50);
|
||||
}
|
||||
|
||||
private Map<String, Object> getGeneralData(String lineId, String date){
|
||||
@@ -152,12 +157,6 @@ public class HarmonicGeneralServiceImpl extends MppServiceImpl<RStatComassesDMap
|
||||
outMap.put("vu_dev3",vuDev3.multiply(hundred).divide(vuDevAll,3, RoundingMode.HALF_UP));
|
||||
outMap.put("vu_dev4",vuDev4.multiply(hundred).divide(vuDevAll,3, RoundingMode.HALF_UP));
|
||||
outMap.put("vu_dev5",vuDev5.multiply(hundred).divide(vuDevAll,3, RoundingMode.HALF_UP));
|
||||
}else {
|
||||
outMap.put("vu_dev1",0.0);
|
||||
outMap.put("vu_dev2",0.0);
|
||||
outMap.put("vu_dev3",0.0);
|
||||
outMap.put("vu_dev4",0.0);
|
||||
outMap.put("vu_dev5",0.0);
|
||||
}
|
||||
|
||||
String freqDevSql = "select count(freq_dev) from data_v where phasic_type != 'T' and quality_flag = '0' and value_type = 'AVG' and ";
|
||||
@@ -178,12 +177,6 @@ public class HarmonicGeneralServiceImpl extends MppServiceImpl<RStatComassesDMap
|
||||
outMap.put("freq_dev3",freqDev3.multiply(hundred).divide(freqDevAll,3, RoundingMode.HALF_UP));
|
||||
outMap.put("freq_dev4",freqDev4.multiply(hundred).divide(freqDevAll,3, RoundingMode.HALF_UP));
|
||||
outMap.put("freq_dev5",freqDev5.multiply(hundred).divide(freqDevAll,3, RoundingMode.HALF_UP));
|
||||
}else {
|
||||
outMap.put("freq_dev1",0.0);
|
||||
outMap.put("freq_dev2",0.0);
|
||||
outMap.put("freq_dev3",0.0);
|
||||
outMap.put("freq_dev4",0.0);
|
||||
outMap.put("freq_dev5",0.0);
|
||||
}
|
||||
|
||||
String vThdSql = "select count(v_thd) from data_v where phasic_type != 'T' and quality_flag = '0' and value_type = 'CP95' and ";
|
||||
@@ -204,12 +197,6 @@ public class HarmonicGeneralServiceImpl extends MppServiceImpl<RStatComassesDMap
|
||||
outMap.put("v_thd3",vThd3.multiply(hundred).divide(vThdAll,3, RoundingMode.HALF_UP));
|
||||
outMap.put("v_thd4",vThd4.multiply(hundred).divide(vThdAll,3, RoundingMode.HALF_UP));
|
||||
outMap.put("v_thd5",vThd5.multiply(hundred).divide(vThdAll,3, RoundingMode.HALF_UP));
|
||||
}else {
|
||||
outMap.put("v_thd1",0.0);
|
||||
outMap.put("v_thd2",0.0);
|
||||
outMap.put("v_thd3",0.0);
|
||||
outMap.put("v_thd4",0.0);
|
||||
outMap.put("v_thd5",0.0);
|
||||
}
|
||||
|
||||
String vUnbalanceSql="select count(v_unbalance) from data_v where phasic_type != 'T' and quality_flag = '0' and value_type = 'CP95' and ";
|
||||
@@ -230,12 +217,6 @@ public class HarmonicGeneralServiceImpl extends MppServiceImpl<RStatComassesDMap
|
||||
outMap.put("v_unbalance3",vUnbalance3.multiply(hundred).divide(vUnbalanceAll,3, RoundingMode.HALF_UP));
|
||||
outMap.put("v_unbalance4",vUnbalance4.multiply(hundred).divide(vUnbalanceAll,3, RoundingMode.HALF_UP));
|
||||
outMap.put("v_unbalance5",vUnbalance5.multiply(hundred).divide(vUnbalanceAll,3, RoundingMode.HALF_UP));
|
||||
}else {
|
||||
outMap.put("v_unbalance1",0.0);
|
||||
outMap.put("v_unbalance2",0.0);
|
||||
outMap.put("v_unbalance3",0.0);
|
||||
outMap.put("v_unbalance4",0.0);
|
||||
outMap.put("v_unbalance5",0.0);
|
||||
}
|
||||
|
||||
String pstSql="select count(pst) from data_flicker where phasic_type != 'T' and quality_flag = '0' and ";
|
||||
@@ -256,12 +237,6 @@ public class HarmonicGeneralServiceImpl extends MppServiceImpl<RStatComassesDMap
|
||||
outMap.put("data_plt3",pst3.multiply(hundred).divide(pstAll,3, RoundingMode.HALF_UP));
|
||||
outMap.put("data_plt4",pst4.multiply(hundred).divide(pstAll,3, RoundingMode.HALF_UP));
|
||||
outMap.put("data_plt5",pst5.multiply(hundred).divide(pstAll,3, RoundingMode.HALF_UP));
|
||||
}else {
|
||||
outMap.put("data_plt1",0.0);
|
||||
outMap.put("data_plt2",0.0);
|
||||
outMap.put("data_plt3",0.0);
|
||||
outMap.put("data_plt4",0.0);
|
||||
outMap.put("data_plt5",0.0);
|
||||
}
|
||||
|
||||
if (!CollUtil.isEmpty(outMap)){
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.njcn.prepare.harmonic.service.mysql.Impl.line;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.device.pq.api.LineFeignClient;
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
@@ -78,18 +79,22 @@ public class HarmonicMetricServiceImpl extends MppServiceImpl<RStatAssesDMapper,
|
||||
}
|
||||
Date dateOut = DateUtil.parse(time);
|
||||
for (String lineId : lineIdList){
|
||||
RStatAssesDPO rStatAssesDpo = new RStatAssesDPO();
|
||||
rStatAssesDpo.setTime(dateOut);
|
||||
rStatAssesDpo.setLineId(lineId);
|
||||
Map<String, Object> fields = getMetricData(lineId,time);
|
||||
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(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);
|
||||
}
|
||||
this.saveOrUpdateBatchByMultiId(list,50);
|
||||
}
|
||||
|
||||
private Map<String, Object> getMetricData(String lineId,String date){
|
||||
@@ -106,11 +111,13 @@ public class HarmonicMetricServiceImpl extends MppServiceImpl<RStatAssesDMapper,
|
||||
List<DataVPO> vUn = resultMapper.toPOJO(vUnResult, DataVPO.class);
|
||||
List<DataPltPO> plt = resultMapper.toPOJO(pltResult, DataPltPO.class);
|
||||
Map<String, Object> outMap = new HashMap<>();
|
||||
outMap.put("vu_dev",(vuDev.size()>0)?vuDev.stream().collect(Collectors.averagingDouble(DataVPO::getVuDev)):0.0);
|
||||
outMap.put("v_thd_cp95",(vThd.size()>0)?vThd.get(0).getMean():0.0);
|
||||
outMap.put("freq_dev",(freqDev.size()>0)?freqDev.stream().collect(Collectors.averagingDouble(DataVPO::getFreqDev)):0.0);
|
||||
outMap.put("v_unbalance_cp95",(vUn.size()>0)?vUn.get(0).getMean():0.0);
|
||||
outMap.put("data_plt",(plt.size()>0)?plt.get(0).getMean():0.0);
|
||||
if(CollUtil.isNotEmpty(vuDev) || CollUtil.isNotEmpty(vThd) || CollUtil.isNotEmpty(freqDev) || CollUtil.isNotEmpty(vUn) || CollUtil.isNotEmpty(plt)){
|
||||
outMap.put("vu_dev",(vuDev.size()>0)?vuDev.stream().collect(Collectors.averagingDouble(DataVPO::getVuDev)):0.0);
|
||||
outMap.put("v_thd_cp95",(vThd.size()>0)?vThd.get(0).getMean():0.0);
|
||||
outMap.put("freq_dev",(freqDev.size()>0)?freqDev.stream().collect(Collectors.averagingDouble(DataVPO::getFreqDev)):0.0);
|
||||
outMap.put("v_unbalance_cp95",(vUn.size()>0)?vUn.get(0).getMean():0.0);
|
||||
outMap.put("data_plt",(plt.size()>0)?plt.get(0).getMean():0.0);
|
||||
}
|
||||
return outMap;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user