调度功能bug修改
This commit is contained in:
@@ -59,52 +59,6 @@ public class AssesServiceImpl implements AssesService {
|
|||||||
|
|
||||||
float synData;
|
float synData;
|
||||||
if (!lineList.isEmpty()) {
|
if (!lineList.isEmpty()) {
|
||||||
// //组装sql语句
|
|
||||||
// StringBuilder stringBuilder = new StringBuilder();
|
|
||||||
// stringBuilder.append(InfluxDBPublicParam.TIME + " >= '").append(startTime).append(InfluxDBPublicParam.START_TIME).append("' and ").append(InfluxDBPublicParam.TIME).append(" <= '").append(endTime).append(InfluxDBPublicParam.END_TIME).append("' and (");
|
|
||||||
// //sql语句
|
|
||||||
// stringBuilder.append(InfluxDBPublicParam.LINE_ID + "='").append(lineList).append("')");
|
|
||||||
// stringBuilder.append(" group by " + InfluxDBPublicParam.LINE_ID).append(" ");
|
|
||||||
// stringBuilder.append(InfluxDBPublicParam.TIME_ZONE);
|
|
||||||
// String sql = "SELECT" +
|
|
||||||
// " MEAN(freq_dev1) AS freq_dev1," +
|
|
||||||
// " MEAN(freq_dev2) AS freq_dev2," +
|
|
||||||
// " MEAN(freq_dev3) AS freq_dev3," +
|
|
||||||
// " MEAN(freq_dev4) AS freq_dev4," +
|
|
||||||
// " MEAN(freq_dev5) AS freq_dev5," +
|
|
||||||
// " MEAN(vu_dev1) AS vu_dev1," +
|
|
||||||
// " MEAN(vu_dev2) AS vu_dev2," +
|
|
||||||
// " MEAN(vu_dev3) AS vu_dev3," +
|
|
||||||
// " MEAN(vu_dev4) AS vu_dev4," +
|
|
||||||
// " MEAN(vu_dev5) AS vu_dev5," +
|
|
||||||
// " MEAN(data_plt1) AS data_plt1," +
|
|
||||||
// " MEAN(data_plt2) AS data_plt2," +
|
|
||||||
// " MEAN(data_plt3) AS data_plt3," +
|
|
||||||
// " MEAN(data_plt4) AS data_plt4," +
|
|
||||||
// " MEAN(data_plt5) AS data_plt5," +
|
|
||||||
// " MEAN(v_unbalance1) AS v_unbalance1," +
|
|
||||||
// " MEAN(v_unbalance2) AS v_unbalance2," +
|
|
||||||
// " MEAN(v_unbalance3) AS v_unbalance3," +
|
|
||||||
// " MEAN(v_unbalance4) AS v_unbalance4," +
|
|
||||||
// " MEAN(v_unbalance5) AS v_unbalance5," +
|
|
||||||
// " MEAN(v_thd1) AS v_thd1," +
|
|
||||||
// " MEAN(v_thd2) AS v_thd2," +
|
|
||||||
// " MEAN(v_thd3) AS v_thd3," +
|
|
||||||
// " MEAN(v_thd4) AS v_thd4," +
|
|
||||||
// " MEAN(v_thd5) AS v_thd5," +
|
|
||||||
// " MEAN(event1) AS event1," +
|
|
||||||
// " MEAN(event2) AS event2," +
|
|
||||||
// " MEAN(event3) AS event3," +
|
|
||||||
// " MEAN(event4) AS event4," +
|
|
||||||
// " MEAN(event5) AS event5" +
|
|
||||||
// " FROM" +
|
|
||||||
// " pqs_comasses" +
|
|
||||||
// " where " + stringBuilder.toString();
|
|
||||||
// //结果集
|
|
||||||
// QueryResult result = influxDbUtils.query(sql);
|
|
||||||
// //处理结果集
|
|
||||||
// InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper();
|
|
||||||
// List<PqsComasses> communicateList = influxDBResultMapper.toPOJO(result, PqsComasses.class);
|
|
||||||
List<PQSComAssesPO> avgCount = rStatComassesDMapper.getAvgCount(Arrays.asList(lineList),
|
List<PQSComAssesPO> avgCount = rStatComassesDMapper.getAvgCount(Arrays.asList(lineList),
|
||||||
DateUtil.beginOfDay(DateUtil.parse(startTime)).toString(),
|
DateUtil.beginOfDay(DateUtil.parse(startTime)).toString(),
|
||||||
DateUtil.beginOfDay(DateUtil.parse(endTime)).toString());
|
DateUtil.beginOfDay(DateUtil.parse(endTime)).toString());
|
||||||
|
|||||||
@@ -18,6 +18,9 @@ public class LineParam {
|
|||||||
@ApiModelProperty(name = "lineIds",value = "监测点索引集合")
|
@ApiModelProperty(name = "lineIds",value = "监测点索引集合")
|
||||||
private List<String> lineIds;
|
private List<String> lineIds;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 区分配网I II III 类监测点
|
||||||
|
*/
|
||||||
@ApiModelProperty(name = "lineType",value = "监测点类型")
|
@ApiModelProperty(name = "lineType",value = "监测点类型")
|
||||||
private Integer lineType;
|
private Integer lineType;
|
||||||
|
|
||||||
@@ -29,6 +32,9 @@ public class LineParam {
|
|||||||
@NotBlank(message = "时间不可为空")
|
@NotBlank(message = "时间不可为空")
|
||||||
private String dataDate;
|
private String dataDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标识从那个库里查询数据
|
||||||
|
*/
|
||||||
@ApiModelProperty(name = "dataSource",value = "数据源(0:oracle,1:influxdb 2:mysql)")
|
@ApiModelProperty(name = "dataSource",value = "数据源(0:oracle,1:influxdb 2:mysql)")
|
||||||
private Integer dataSource;
|
private Integer dataSource;
|
||||||
|
|
||||||
|
|||||||
@@ -87,45 +87,50 @@ public class HarmonicGeneralServiceImpl extends MppServiceImpl<RStatComassesDMap
|
|||||||
rStatComassesDpo.setTime(dateOut);
|
rStatComassesDpo.setTime(dateOut);
|
||||||
rStatComassesDpo.setLineId(lineId);
|
rStatComassesDpo.setLineId(lineId);
|
||||||
Map<String, Object> fields = getGeneralData(lineId,time);
|
Map<String, Object> fields = getGeneralData(lineId,time);
|
||||||
rStatComassesDpo.setFreqDev1(Objects.isNull(fields.get("freq_dev1"))?0.0:Double.parseDouble(fields.get("freq_dev1").toString()));
|
if(CollUtil.isNotEmpty(fields)) {
|
||||||
rStatComassesDpo.setFreqDev2(Objects.isNull(fields.get("freq_dev2"))?0.0:Double.parseDouble(fields.get("freq_dev2").toString()));
|
rStatComassesDpo.setFreqDev1(Objects.isNull(fields.get("freq_dev1")) ? 0.0 : Double.parseDouble(fields.get("freq_dev1").toString()));
|
||||||
rStatComassesDpo.setFreqDev3(Objects.isNull(fields.get("freq_dev3"))?0.0:Double.parseDouble(fields.get("freq_dev3").toString()));
|
rStatComassesDpo.setFreqDev2(Objects.isNull(fields.get("freq_dev2")) ? 0.0 : Double.parseDouble(fields.get("freq_dev2").toString()));
|
||||||
rStatComassesDpo.setFreqDev4(Objects.isNull(fields.get("freq_dev4"))?0.0:Double.parseDouble(fields.get("freq_dev4").toString()));
|
rStatComassesDpo.setFreqDev3(Objects.isNull(fields.get("freq_dev3")) ? 0.0 : Double.parseDouble(fields.get("freq_dev3").toString()));
|
||||||
rStatComassesDpo.setFreqDev5(Objects.isNull(fields.get("freq_dev5"))?0.0:Double.parseDouble(fields.get("freq_dev5").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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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()));
|
rStatComassesDpo.setEvent5(Objects.isNull(fields.get("event5")) ? 0.0 : Double.parseDouble(fields.get("event5").toString()));
|
||||||
list.add(rStatComassesDpo);
|
list.add(rStatComassesDpo);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(CollUtil.isNotEmpty(list)){
|
||||||
this.saveOrUpdateBatchByMultiId(list,50);
|
this.saveOrUpdateBatchByMultiId(list,50);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private Map<String, Object> getGeneralData(String lineId, String date){
|
private Map<String, Object> getGeneralData(String lineId, String date){
|
||||||
InfluxDBResultMapper mapper = new InfluxDBResultMapper();
|
InfluxDBResultMapper mapper = new InfluxDBResultMapper();
|
||||||
@@ -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_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_dev4",vuDev4.multiply(hundred).divide(vuDevAll,3, RoundingMode.HALF_UP));
|
||||||
outMap.put("vu_dev5",vuDev5.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 ";
|
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_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_dev4",freqDev4.multiply(hundred).divide(freqDevAll,3, RoundingMode.HALF_UP));
|
||||||
outMap.put("freq_dev5",freqDev5.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 ";
|
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_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_thd4",vThd4.multiply(hundred).divide(vThdAll,3, RoundingMode.HALF_UP));
|
||||||
outMap.put("v_thd5",vThd5.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 ";
|
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_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_unbalance4",vUnbalance4.multiply(hundred).divide(vUnbalanceAll,3, RoundingMode.HALF_UP));
|
||||||
outMap.put("v_unbalance5",vUnbalance5.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 ";
|
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_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_plt4",pst4.multiply(hundred).divide(pstAll,3, RoundingMode.HALF_UP));
|
||||||
outMap.put("data_plt5",pst5.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)){
|
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.collection.CollUtil;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||||
import com.njcn.device.pq.api.LineFeignClient;
|
import com.njcn.device.pq.api.LineFeignClient;
|
||||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||||
@@ -78,10 +79,11 @@ public class HarmonicMetricServiceImpl extends MppServiceImpl<RStatAssesDMapper,
|
|||||||
}
|
}
|
||||||
Date dateOut = DateUtil.parse(time);
|
Date dateOut = DateUtil.parse(time);
|
||||||
for (String lineId : lineIdList){
|
for (String lineId : lineIdList){
|
||||||
|
Map<String, Object> fields = getMetricData(lineId,time);
|
||||||
|
if(CollUtil.isNotEmpty(fields)) {
|
||||||
RStatAssesDPO rStatAssesDpo = new RStatAssesDPO();
|
RStatAssesDPO rStatAssesDpo = new RStatAssesDPO();
|
||||||
rStatAssesDpo.setTime(dateOut);
|
rStatAssesDpo.setTime(dateOut);
|
||||||
rStatAssesDpo.setLineId(lineId);
|
rStatAssesDpo.setLineId(lineId);
|
||||||
Map<String, Object> fields = getMetricData(lineId,time);
|
|
||||||
rStatAssesDpo.setVuDev(Double.parseDouble(fields.get("vu_dev").toString()));
|
rStatAssesDpo.setVuDev(Double.parseDouble(fields.get("vu_dev").toString()));
|
||||||
rStatAssesDpo.setFreqDev(Double.parseDouble(fields.get("freq_dev").toString()));
|
rStatAssesDpo.setFreqDev(Double.parseDouble(fields.get("freq_dev").toString()));
|
||||||
rStatAssesDpo.setDataPlt(Double.parseDouble(fields.get("data_plt").toString()));
|
rStatAssesDpo.setDataPlt(Double.parseDouble(fields.get("data_plt").toString()));
|
||||||
@@ -89,8 +91,11 @@ public class HarmonicMetricServiceImpl extends MppServiceImpl<RStatAssesDMapper,
|
|||||||
rStatAssesDpo.setVThdCp95(Double.parseDouble(fields.get("v_thd_cp95").toString()));
|
rStatAssesDpo.setVThdCp95(Double.parseDouble(fields.get("v_thd_cp95").toString()));
|
||||||
list.add(rStatAssesDpo);
|
list.add(rStatAssesDpo);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if(CollUtil.isNotEmpty(list)){
|
||||||
this.saveOrUpdateBatchByMultiId(list,50);
|
this.saveOrUpdateBatchByMultiId(list,50);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private Map<String, Object> getMetricData(String lineId,String date){
|
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')";
|
String processParam = " and line_id = '"+lineId+"' and time >= '"+date+" 00:00:00' and time <= '"+date+" 23:59:59' tz('Asia/Shanghai')";
|
||||||
@@ -106,11 +111,13 @@ public class HarmonicMetricServiceImpl extends MppServiceImpl<RStatAssesDMapper,
|
|||||||
List<DataVPO> vUn = resultMapper.toPOJO(vUnResult, DataVPO.class);
|
List<DataVPO> vUn = resultMapper.toPOJO(vUnResult, DataVPO.class);
|
||||||
List<DataPltPO> plt = resultMapper.toPOJO(pltResult, DataPltPO.class);
|
List<DataPltPO> plt = resultMapper.toPOJO(pltResult, DataPltPO.class);
|
||||||
Map<String, Object> outMap = new HashMap<>();
|
Map<String, Object> outMap = new HashMap<>();
|
||||||
|
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("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("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("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("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);
|
outMap.put("data_plt",(plt.size()>0)?plt.get(0).getMean():0.0);
|
||||||
|
}
|
||||||
return outMap;
|
return outMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user