调度功能bug修改
This commit is contained in:
@@ -59,52 +59,6 @@ public class AssesServiceImpl implements AssesService {
|
||||
|
||||
float synData;
|
||||
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),
|
||||
DateUtil.beginOfDay(DateUtil.parse(startTime)).toString(),
|
||||
DateUtil.beginOfDay(DateUtil.parse(endTime)).toString());
|
||||
|
||||
@@ -18,6 +18,9 @@ public class LineParam {
|
||||
@ApiModelProperty(name = "lineIds",value = "监测点索引集合")
|
||||
private List<String> lineIds;
|
||||
|
||||
/**
|
||||
* 区分配网I II III 类监测点
|
||||
*/
|
||||
@ApiModelProperty(name = "lineType",value = "监测点类型")
|
||||
private Integer lineType;
|
||||
|
||||
@@ -29,6 +32,9 @@ public class LineParam {
|
||||
@NotBlank(message = "时间不可为空")
|
||||
private String dataDate;
|
||||
|
||||
/**
|
||||
* 标识从那个库里查询数据
|
||||
*/
|
||||
@ApiModelProperty(name = "dataSource",value = "数据源(0:oracle,1:influxdb 2:mysql)")
|
||||
private Integer dataSource;
|
||||
|
||||
|
||||
@@ -87,6 +87,7 @@ public class HarmonicGeneralServiceImpl extends MppServiceImpl<RStatComassesDMap
|
||||
rStatComassesDpo.setTime(dateOut);
|
||||
rStatComassesDpo.setLineId(lineId);
|
||||
Map<String, Object> fields = getGeneralData(lineId,time);
|
||||
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()));
|
||||
@@ -124,8 +125,12 @@ public class HarmonicGeneralServiceImpl extends MppServiceImpl<RStatComassesDMap
|
||||
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();
|
||||
@@ -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,10 +79,11 @@ public class HarmonicMetricServiceImpl extends MppServiceImpl<RStatAssesDMapper,
|
||||
}
|
||||
Date dateOut = DateUtil.parse(time);
|
||||
for (String lineId : lineIdList){
|
||||
Map<String, Object> fields = getMetricData(lineId,time);
|
||||
if(CollUtil.isNotEmpty(fields)) {
|
||||
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()));
|
||||
@@ -89,8 +91,11 @@ public class HarmonicMetricServiceImpl extends MppServiceImpl<RStatAssesDMapper,
|
||||
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')";
|
||||
@@ -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<>();
|
||||
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