因修改influxDB数据库的部分表结构,谐波模块修改了部分代码
This commit is contained in:
@@ -1,15 +1,18 @@
|
||||
package com.njcn.harmonic.service.impl;
|
||||
|
||||
import com.njcn.device.pojo.po.Communicate;
|
||||
import com.njcn.harmonic.constant.Param;
|
||||
import com.njcn.harmonic.pojo.param.PulicTimeStatisParam;
|
||||
import com.njcn.harmonic.pojo.vo.AssesVO;
|
||||
import com.njcn.harmonic.service.AssesService;
|
||||
import com.njcn.influxdb.param.InfluxDBPublicParam;
|
||||
import com.njcn.influxdb.utils.InfluxDbUtils;
|
||||
import com.njcn.web.utils.ComAssesUtil;
|
||||
import com.njcn.web.utils.PqsComasses;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.influxdb.dto.QueryResult;
|
||||
import org.influxdb.impl.InfluxDBResultMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
@@ -48,88 +51,56 @@ public class AssesServiceImpl implements AssesService {
|
||||
* 查询监测点的数据完整性
|
||||
*/
|
||||
private Float getCondition(String lineList, String startTime, String endTime) {
|
||||
List<PqsComasses> pqsComasses = new ArrayList<>();
|
||||
float synData;
|
||||
if (!lineList.isEmpty()) {
|
||||
//组装sql语句
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.append(Param.TIME + " >= '").append(startTime).append(Param.START_TIME).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append(Param.END_TIME).append("' and (");
|
||||
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(Param.LINEID + "='").append(lineList).append("')");
|
||||
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 freDev1," +
|
||||
" MEAN(Freq_Dev2) AS freDev2," +
|
||||
" MEAN(Freq_Dev3) AS freDev3," +
|
||||
" MEAN(Freq_Dev4) AS freDev4," +
|
||||
" MEAN(Freq_Dev5) AS freDev5," +
|
||||
" MEAN(VU_Dev1) AS vuDev1," +
|
||||
" MEAN(VU_Dev2) AS vuDev2," +
|
||||
" MEAN(VU_Dev3) AS vuDev3," +
|
||||
" MEAN(VU_Dev4) AS vuDev4," +
|
||||
" MEAN(VU_Dev5) AS vuDev5," +
|
||||
" MEAN(Data_PLT1) AS dataPlt1," +
|
||||
" MEAN(Data_PLT2) AS dataPlt2," +
|
||||
" MEAN(Data_PLT3) AS dataPlt3," +
|
||||
" MEAN(Data_PLT4) AS dataPlt4," +
|
||||
" MEAN(Data_PLT5) AS dataPlt5," +
|
||||
" MEAN(V_Unbalance1) AS vUnbalance1," +
|
||||
" MEAN(V_Unbalance2) AS vUnbalance2," +
|
||||
" MEAN(V_Unbalance3) AS vUnbalance3," +
|
||||
" MEAN(V_Unbalance4) AS vUnbalance4," +
|
||||
" MEAN(V_Unbalance5) AS vUnbalance5," +
|
||||
" MEAN(V_THD1) AS vThd1," +
|
||||
" MEAN(V_THD2) AS vThd2," +
|
||||
" MEAN(V_THD3) AS vThd3," +
|
||||
" MEAN(V_THD4) AS vThd4," +
|
||||
" MEAN(V_THD5) AS vThd5," +
|
||||
" MEAN(Event1) AS event1," +
|
||||
" MEAN(Event2) AS event2," +
|
||||
" MEAN(Event3) AS event3," +
|
||||
" MEAN(Event4) AS event4," +
|
||||
" MEAN(Event5) AS event5" +
|
||||
" 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() +
|
||||
" group by " + Param.LINEID;
|
||||
" pqs_comasses" +
|
||||
" where " + stringBuilder.toString();
|
||||
//结果集
|
||||
QueryResult result = influxDbUtils.query(sql);
|
||||
//处理结果集
|
||||
List<QueryResult.Series> list = result.getResults().get(0).getSeries();
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
List<List<Object>> valueList = list.get(0).getValues();
|
||||
PqsComasses pqsComassesData = new PqsComasses();
|
||||
List<Object> value = valueList.get(0);
|
||||
pqsComassesData.setFreqDev1(BigDecimal.valueOf(Float.parseFloat(value.get(1).toString())).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue());
|
||||
pqsComassesData.setFreqDev2(BigDecimal.valueOf(Float.parseFloat(value.get(2).toString())).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue());
|
||||
pqsComassesData.setFreqDev3(BigDecimal.valueOf(Float.parseFloat(value.get(3).toString())).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue());
|
||||
pqsComassesData.setFreqDev4(BigDecimal.valueOf(Float.parseFloat(value.get(4).toString())).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue());
|
||||
pqsComassesData.setFreqDev5(BigDecimal.valueOf(Float.parseFloat(value.get(5).toString())).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue());
|
||||
pqsComassesData.setVuDev1(BigDecimal.valueOf(Float.parseFloat(value.get(6).toString())).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue());
|
||||
pqsComassesData.setVuDev2(BigDecimal.valueOf(Float.parseFloat(value.get(7).toString())).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue());
|
||||
pqsComassesData.setVuDev3(BigDecimal.valueOf(Float.parseFloat(value.get(8).toString())).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue());
|
||||
pqsComassesData.setVuDev4(BigDecimal.valueOf(Float.parseFloat(value.get(9).toString())).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue());
|
||||
pqsComassesData.setVuDev5(BigDecimal.valueOf(Float.parseFloat(value.get(10).toString())).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue());
|
||||
pqsComassesData.setDataPst1(BigDecimal.valueOf(Float.parseFloat(value.get(11).toString())).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue());
|
||||
pqsComassesData.setDataPst2(BigDecimal.valueOf(Float.parseFloat(value.get(12).toString())).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue());
|
||||
pqsComassesData.setDataPst3(BigDecimal.valueOf(Float.parseFloat(value.get(13).toString())).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue());
|
||||
pqsComassesData.setDataPst4(BigDecimal.valueOf(Float.parseFloat(value.get(14).toString())).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue());
|
||||
pqsComassesData.setDataPst5(BigDecimal.valueOf(Float.parseFloat(value.get(15).toString())).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue());
|
||||
pqsComassesData.setVUnbalance1(BigDecimal.valueOf(Float.parseFloat(value.get(16).toString())).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue());
|
||||
pqsComassesData.setVUnbalance2(BigDecimal.valueOf(Float.parseFloat(value.get(17).toString())).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue());
|
||||
pqsComassesData.setVUnbalance3(BigDecimal.valueOf(Float.parseFloat(value.get(18).toString())).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue());
|
||||
pqsComassesData.setVUnbalance4(BigDecimal.valueOf(Float.parseFloat(value.get(19).toString())).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue());
|
||||
pqsComassesData.setVUnbalance5(BigDecimal.valueOf(Float.parseFloat(value.get(20).toString())).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue());
|
||||
pqsComassesData.setVThd1(BigDecimal.valueOf(Float.parseFloat(value.get(21).toString())).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue());
|
||||
pqsComassesData.setVThd2(BigDecimal.valueOf(Float.parseFloat(value.get(22).toString())).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue());
|
||||
pqsComassesData.setVThd3(BigDecimal.valueOf(Float.parseFloat(value.get(23).toString())).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue());
|
||||
pqsComassesData.setVThd4(BigDecimal.valueOf(Float.parseFloat(value.get(24).toString())).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue());
|
||||
pqsComassesData.setVThd5(BigDecimal.valueOf(Float.parseFloat(value.get(25).toString())).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue());
|
||||
pqsComassesData.setEvent1(BigDecimal.valueOf(Float.parseFloat(value.get(26).toString())).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue());
|
||||
pqsComassesData.setEvent2(BigDecimal.valueOf(Float.parseFloat(value.get(27).toString())).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue());
|
||||
pqsComassesData.setEvent3(BigDecimal.valueOf(Float.parseFloat(value.get(28).toString())).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue());
|
||||
pqsComassesData.setEvent4(BigDecimal.valueOf(Float.parseFloat(value.get(29).toString())).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue());
|
||||
pqsComassesData.setEvent5(BigDecimal.valueOf(Float.parseFloat(value.get(30).toString())).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue());
|
||||
pqsComasses.add(pqsComassesData);
|
||||
InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper();
|
||||
List<PqsComasses> communicateList = influxDBResultMapper.toPOJO(result, PqsComasses.class);
|
||||
if (!CollectionUtils.isEmpty(communicateList)) {
|
||||
synData = comAssesUtil.getAllComAss(communicateList);
|
||||
} else {
|
||||
//有监测点,但是无数据的处理
|
||||
return 3.14159f;
|
||||
@@ -138,7 +109,6 @@ public class AssesServiceImpl implements AssesService {
|
||||
//无监测点前台统一替换为“/”
|
||||
return 3.1415f;
|
||||
}
|
||||
synData = comAssesUtil.getAllComAss(pqsComasses);
|
||||
return synData;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.njcn.harmonic.pojo.param.PulicTimeParam;
|
||||
import com.njcn.harmonic.pojo.param.PulicTimeStatisParam;
|
||||
import com.njcn.harmonic.pojo.vo.CommunicateStatisticsVO;
|
||||
import com.njcn.harmonic.service.CommunicateService;
|
||||
import com.njcn.influxdb.param.InfluxDBPublicParam;
|
||||
import com.njcn.influxdb.utils.InfluxDbUtils;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
@@ -63,16 +64,17 @@ public class CommunicateServiceImpl implements CommunicateService {
|
||||
final Float[] resultList = {0.0f};
|
||||
//组装sql语句
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.append(Param.TIME + " >= '").append(startTime).append(Param.START_TIME).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append(Param.END_TIME).append("' and (");
|
||||
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语句
|
||||
String sql = "";
|
||||
if (state == 0) {
|
||||
stringBuilder.append(Param.LINE_INDEX + "='").append(lineList).append("')");
|
||||
sql = "SELECT SUM(" + Param.REAL + ")/SUM(" + Param.DUE + ") AS integrity FROM PQS_INTEGRITY WHERE " + stringBuilder.toString() + " group by " + Param.LINE_INDEX;
|
||||
stringBuilder.append(InfluxDBPublicParam.LINE_ID + "='").append(lineList).append("')");
|
||||
sql = "SELECT SUM(" + InfluxDBPublicParam.REAL+ ")/SUM(" + InfluxDBPublicParam.DUE + ") AS integrity FROM pqs_integrity WHERE " + stringBuilder.toString() + " group by " + InfluxDBPublicParam.LINE_ID;
|
||||
} else {
|
||||
stringBuilder.append(Param.DEV_INDEX + "='").append(lineList).append("')");
|
||||
sql = "SELECT SUM(" + Param.ONLINEMIN + ")/(SUM(" + Param.OFFLINEMIN + ")+SUM(" + Param.ONLINEMIN + ")) AS onlineRate FROM PQS_ONLINERATE WHERE " + stringBuilder.toString() + " group by " + Param.DEV_INDEX;
|
||||
stringBuilder.append(InfluxDBPublicParam.DEV_INDEX + "='").append(lineList).append("')");
|
||||
sql = "SELECT SUM(" + InfluxDBPublicParam.ONLINEMIN + ")/(SUM(" + InfluxDBPublicParam.OFFLINEMIN + ")+SUM(" + InfluxDBPublicParam.ONLINEMIN + ")) AS onlineRate FROM pqs_onlinerate WHERE " + stringBuilder.toString() + " group by " + InfluxDBPublicParam.DEV_INDEX;
|
||||
}
|
||||
stringBuilder.append(InfluxDBPublicParam.TIME_ZONE);
|
||||
//结果集
|
||||
QueryResult result = influxDbUtils.query(sql);
|
||||
//处理结果集
|
||||
|
||||
@@ -25,8 +25,10 @@ import org.springframework.util.CollectionUtils;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Instant;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* @author denghuajun
|
||||
@@ -45,19 +47,22 @@ public class HistoryResultServiceImpl implements HistoryResultService {
|
||||
@Override
|
||||
public List<HistoryDataResultVO> getHistoryResult(HistoryParam historyParam) {
|
||||
List<HistoryDataResultVO> historyDataResultVOList = new ArrayList<>();
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
//获取监测点
|
||||
String[] points = historyParam.getLineId();
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
||||
Integer number = 0;
|
||||
for (int i = 0; i < points.length; i++) {
|
||||
HistoryDataResultVO historyDataResultVO;
|
||||
List<EventDetail> eventDetailList = eventDetailFeignClient.getEventDetailData(points[i],historyParam.getSearchBeginTime(),historyParam.getSearchEndTime()).getData();
|
||||
List<EventDetail> eventDetailList = eventDetailFeignClient.getEventDetailData(points[i], historyParam.getSearchBeginTime(), historyParam.getSearchEndTime()).getData();
|
||||
List<EventDetailVO> eventDetailVOList = new ArrayList<>();
|
||||
if (!eventDetailList.isEmpty()) {
|
||||
for (EventDetail eventdetail : eventDetailList) {
|
||||
Instant now = eventdetail.getTimeId().plusMillis(TimeUnit.HOURS.toMillis(8));
|
||||
Long time = now.toEpochMilli();
|
||||
String timeText = format.format(time);
|
||||
EventDetailVO eventDetailVO = new EventDetailVO();
|
||||
eventDetailVO.setId(eventdetail.getId());
|
||||
eventDetailVO.setTime(formatter.format(eventdetail.getTimeId()));
|
||||
eventDetailVO.setId(eventdetail.getLineId());
|
||||
eventDetailVO.setTime(timeText);
|
||||
eventDetailVOList.add(eventDetailVO);
|
||||
}
|
||||
}
|
||||
@@ -110,12 +115,12 @@ public class HistoryResultServiceImpl implements HistoryResultService {
|
||||
List<Float> fValue = new ArrayList<>();
|
||||
List<List<Object>> objectListData = new ArrayList<>();
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
if (queryResult.getResults().size() == 1) {
|
||||
if (list.size() == 1) {
|
||||
List<List<Object>> listData = queryResult.getResults().get(0).getSeries().get(0).getValues();
|
||||
for (int i = 0; i < listData.size(); i++) {
|
||||
List<Object> objectList = listData.get(i);
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX");
|
||||
TimeZone tx = TimeZone.getTimeZone("Asia/Kolkata");
|
||||
TimeZone tx = TimeZone.getTimeZone("Asia/Shanghai");
|
||||
formatter.setTimeZone(tx);
|
||||
Date d = formatter.parse(objectList.get(0).toString());
|
||||
time.add(d);
|
||||
@@ -133,14 +138,13 @@ public class HistoryResultServiceImpl implements HistoryResultService {
|
||||
historyDataResultVO.setValue(objectListData);
|
||||
|
||||
} else {
|
||||
for (int i = 0; i < queryResult.getResults().size(); i++) {
|
||||
List<QueryResult.Series> listData = queryResult.getResults().get(i).getSeries();
|
||||
List<List<Object>> values = listData.get(0).getValues();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
List<List<Object>> values = list.get(i).getValues();
|
||||
for (int j = 0; j < values.size(); j++) {
|
||||
List<Object> objectList = values.get(j);
|
||||
if (i == 0) {
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX");
|
||||
TimeZone tx = TimeZone.getTimeZone("Asia/Kolkata");
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX");
|
||||
TimeZone tx = TimeZone.getTimeZone("Asia/Shanghai");
|
||||
formatter.setTimeZone(tx);
|
||||
Date d = formatter.parse(objectList.get(0).toString());
|
||||
time.add(d);
|
||||
@@ -208,7 +212,9 @@ public class HistoryResultServiceImpl implements HistoryResultService {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
stringBuilder.append(" and ").append(Param.VALUETYPE + "='").append(valueTypeName).append("'");
|
||||
if (Integer.parseInt(contion) != 60 || Integer.parseInt(contion) != 61 || Integer.parseInt(contion) != 62) {
|
||||
stringBuilder.append(" and ").append(Param.VALUETYPE + "='").append(valueTypeName).append("'");
|
||||
}
|
||||
String sql = "";
|
||||
List<String> phasicType = new ArrayList<>();
|
||||
List<String> unit = new ArrayList<>();
|
||||
@@ -705,7 +711,9 @@ public class HistoryResultServiceImpl implements HistoryResultService {
|
||||
} else if ("C".equals(normHistoryParam.getPhaseType()) || "CA".equals(normHistoryParam.getPhaseType())) {
|
||||
phasicType = "C";
|
||||
}
|
||||
stringBuilder.append(" and ").append(Param.VALUETYPE + "='").append(valueTypeName).append("'");
|
||||
if (Integer.parseInt(normHistoryParam.getTargetCode()) != 60 || Integer.parseInt(normHistoryParam.getTargetCode()) != 61 || Integer.parseInt(normHistoryParam.getTargetCode()) != 62) {
|
||||
stringBuilder.append(" and ").append(Param.VALUETYPE + "='").append(valueTypeName).append("'");
|
||||
}
|
||||
stringBuilder.append(" and ").append("phasic_type ='").append(phasicType).append("'");
|
||||
String sql = "";
|
||||
List<String> unit = new ArrayList<>();
|
||||
@@ -715,7 +723,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
|
||||
case 12:
|
||||
//电压偏差
|
||||
sql = "SELECT time as time, vu_dev as aValue FROM data_v WHERE " + stringBuilder.toString() +
|
||||
" order by time asc;";
|
||||
" order by time asc tz('Asia/Shanghai');";
|
||||
topLimit = overlimit.getVoltageDev();
|
||||
lowerLimit = overlimit.getUvoltageDev();
|
||||
unit.add("%");
|
||||
@@ -724,7 +732,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
|
||||
case 13:
|
||||
//三相电压不平衡度
|
||||
sql = "SELECT time as time, v_unbalance as aValue FROM data_v WHERE " + stringBuilder.toString() +
|
||||
" order by time asc;";
|
||||
" order by time asc tz('Asia/Shanghai');";
|
||||
topLimit = overlimit.getUbalance();
|
||||
unit.add("%");
|
||||
targetName = "三相电压不平衡度";
|
||||
@@ -732,7 +740,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
|
||||
case 15:
|
||||
//电压总谐波畸变率
|
||||
sql = "SELECT time as time, v_thd as aValue FROM data_v WHERE " + stringBuilder.toString() +
|
||||
" order by time asc;";
|
||||
" order by time asc tz('Asia/Shanghai');";
|
||||
topLimit = overlimit.getUaberrance();
|
||||
unit.add("%");
|
||||
targetName = "电压总谐波畸变率";
|
||||
@@ -740,7 +748,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
|
||||
case 22:
|
||||
//负序电流
|
||||
sql = "SELECT time as time, i_neg as aValue FROM data_i WHERE " + stringBuilder.toString() +
|
||||
" order by time asc;";
|
||||
" order by time asc tz('Asia/Shanghai');";
|
||||
topLimit = overlimit.getINeg();
|
||||
unit.add("A");
|
||||
targetName = "负序电流";
|
||||
@@ -748,7 +756,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
|
||||
case 30:
|
||||
//频率 V9暂时代表Freq
|
||||
sql = "SELECT time as time, freq as aValue FROM data_v WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='T' order by time asc;";
|
||||
" and phasic_type ='T' order by time asc tz('Asia/Shanghai');";
|
||||
topLimit = 50 + overlimit.getFreqDev();
|
||||
lowerLimit = 50 - overlimit.getFreqDev();
|
||||
unit.add("Hz");
|
||||
@@ -757,11 +765,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
|
||||
case 40:
|
||||
//谐波电压含有率
|
||||
sql = "SELECT time as time, v_" + number + " as aValue FROM data_harmrate_v WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='A' order by time asc;" +
|
||||
"SELECT time as time, v_" + number + " as bValue FROM data_harmrate_v WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='B' order by time asc;" +
|
||||
"SELECT time as time, v_" + number + " as cValue FROM data_harmrate_v WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='C' order by time asc;";
|
||||
" and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') group by phasic_type order by time asc tz('Asia/Shanghai');";
|
||||
topLimit = PubUtils.getValueByMethod(overlimit, "getUharm", number);
|
||||
unit.add("%");
|
||||
targetName = "谐波电压含有率";
|
||||
@@ -769,22 +773,14 @@ public class HistoryResultServiceImpl implements HistoryResultService {
|
||||
case 41:
|
||||
//谐波电流含有率
|
||||
sql = "SELECT time as time, i_" + number + " as aValue FROM data_harmrate_i WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='A' order by time asc;" +
|
||||
"SELECT time as time, i_" + number + " as bValue FROM data_harmrate_i WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='B' order by time asc;" +
|
||||
"SELECT time as time, i_" + number + " as cValue FROM data_harmrate_i WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='C' order by time asc;";
|
||||
" and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') group by phasic_type order by time asc tz('Asia/Shanghai');";
|
||||
unit.add("%");
|
||||
targetName = "谐波电流含有率";
|
||||
break;
|
||||
case 43:
|
||||
//谐波电流幅值
|
||||
sql = "SELECT time as time, i_" + number + " as aValue FROM data_i WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='A' order by time asc;" +
|
||||
"SELECT time as time, i_" + number + " as bValue FROM data_i WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='B' order by time asc;" +
|
||||
"SELECT time as time, i_" + number + " as cValue FROM data_i WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='C' order by time asc;";
|
||||
" and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') group by phasic_type order by time asc tz('Asia/Shanghai');";
|
||||
topLimit = PubUtils.getValueByMethod(overlimit, "getIharm", number);
|
||||
unit.add("A");
|
||||
targetName = "谐波电流幅值";
|
||||
@@ -793,11 +789,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
|
||||
case 46:
|
||||
//间谐波电压含有率
|
||||
sql = "SELECT time as time, v_" + number + " as aValue FROM data_inharmrate_v WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='A' order by time asc;" +
|
||||
"SELECT time as time, v_" + number + " as bValue FROM data_inharmrate_v WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='B' order by time asc;" +
|
||||
"SELECT time as time, v_" + number + " as cValue FROM data_inharmrate_v WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='C' order by time asc;";
|
||||
" and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') group by phasic_type order by time asc tz('Asia/Shanghai');";
|
||||
topLimit = PubUtils.getValueByMethod(overlimit, "getInuharm", number);
|
||||
unit.add("%");
|
||||
targetName = "间谐波电压含有率";
|
||||
@@ -805,11 +797,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
|
||||
case 61:
|
||||
//长时闪变
|
||||
sql = "SELECT time as time, plt as aValue FROM data_plt WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='A' order by time asc;" +
|
||||
"SELECT time as time, plt as bValue FROM data_plt WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='B' order by time asc;" +
|
||||
"SELECT time as time, plt as cValue FROM data_plt WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='C' order by time asc;";
|
||||
" and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') group by phasic_type order by time asc tz('Asia/Shanghai');";
|
||||
targetName = "长时闪变";
|
||||
topLimit = overlimit.getFlicker();
|
||||
break;
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.njcn.harmonic.constant.Param;
|
||||
import com.njcn.harmonic.pojo.param.HistoryHarmOverLimitParam;
|
||||
import com.njcn.harmonic.pojo.vo.HistoryHarmOverLimitVO;
|
||||
import com.njcn.harmonic.service.NormLimitService;
|
||||
import com.njcn.influxdb.param.InfluxDBPublicParam;
|
||||
import com.njcn.influxdb.utils.InfluxDbUtils;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
@@ -13,10 +14,17 @@ import org.influxdb.dto.QueryResult;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.TimeZone;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 类介绍
|
||||
@@ -94,105 +102,48 @@ public class NormLimitServiceImpl implements NormLimitService {
|
||||
if (!lineList.isEmpty()) {
|
||||
//组装sql语句
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.append(Param.TIME + " >= '").append(startTime).append(Param.START_TIME).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append(Param.END_TIME).append("' and (");
|
||||
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("lineid='").append(lineList).append("')");
|
||||
stringBuilder.append(InfluxDBPublicParam.LINE_ID).append("='").append(lineList).append("')");
|
||||
String sql;
|
||||
switch (Integer.parseInt(contion)) {
|
||||
case 12:
|
||||
//电压偏差
|
||||
sql = "SELECT time as time, Voltage_Dev as aValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='A' and value_type = 'MAX' order by time asc;" +
|
||||
"SELECT time as time, Voltage_Dev as aValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='A' and value_type = 'MIN' order by time asc;" +
|
||||
"SELECT time as time, Voltage_Dev as aValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='A' and value_type = 'AVG' order by time asc;" +
|
||||
"SELECT time as time, Voltage_Dev as aValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='A' and value_type = 'CP95' order by time asc;" +
|
||||
"SELECT time as time, Voltage_Dev as aValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='B' and value_type = 'MAX' order by time asc;" +
|
||||
"SELECT time as time, Voltage_Dev as aValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='B' and value_type = 'MIN' order by time asc;" +
|
||||
"SELECT time as time, Voltage_Dev as aValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='B' and value_type = 'AVG' order by time asc;" +
|
||||
"SELECT time as time, Voltage_Dev as aValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='B' and value_type = 'CP95' order by time asc;" +
|
||||
"SELECT time as time, Voltage_Dev as aValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='B' and value_type = 'MAX' order by time asc;" +
|
||||
"SELECT time as time, Voltage_Dev as aValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='C' and value_type = 'MIN' order by time asc;" +
|
||||
"SELECT time as time, Voltage_Dev as aValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='C' and value_type = 'AVG' order by time asc;" +
|
||||
"SELECT time as time, Voltage_Dev as aValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='C' and value_type = 'CP95' order by time asc;";
|
||||
sql = "SELECT time as time, voltage_dev as aValue,phasic_type , value_type FROM pqs_abnormaldata WHERE " + stringBuilder.toString() +
|
||||
" and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') " +
|
||||
" and (value_type = 'MAX' or value_type = 'MIN' or value_type = 'AVG' or value_type = 'CP95') group by phasic_type order by time asc tz('Asia/Shanghai');";
|
||||
queryResult = influxDbUtils.query(sql);
|
||||
historyHarmOverLimitVOList = getNormData(queryResult, contion, lineList, "电压偏差", "%");
|
||||
break;
|
||||
case 13:
|
||||
//三相电压不平衡度
|
||||
sql = "SELECT time as time, UBalance as aValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='T' and value_type = 'MAX' order by time asc;" +
|
||||
"SELECT time as time, UBalance as aValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='T' and value_type = 'MIN' order by time asc;" +
|
||||
"SELECT time as time, UBalance as aValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='T' and value_type = 'AVG' order by time asc;" +
|
||||
"SELECT time as time, UBalance as aValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='T' and value_type = 'CP95' order by time asc;";
|
||||
sql = "SELECT time as time, ubalance as aValue,phasic_type , value_type FROM pqs_abnormaldata WHERE " + stringBuilder.toString() +
|
||||
" and (phasic_type ='T') " +
|
||||
" and (value_type = 'MAX' or value_type = 'MIN' or value_type = 'AVG' or value_type = 'CP95') group by phasic_type order by time asc tz('Asia/Shanghai');";
|
||||
queryResult = influxDbUtils.query(sql);
|
||||
historyHarmOverLimitVOList = getNormData(queryResult, contion, lineList, "三相电压不平衡度", "/");
|
||||
break;
|
||||
case 15:
|
||||
//电压总谐波畸变率
|
||||
sql = "SELECT time as time, UAberrance as aValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='A' and value_type = 'MAX' order by time asc;" +
|
||||
"SELECT time as time, UAberrance as bValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='A'and value_type = 'MIN' order by time asc;" +
|
||||
"SELECT time as time, UAberrance as cValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='A' and value_type = 'AVG' order by time asc;" +
|
||||
"SELECT time as time, UAberrance as cValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='A' and value_type = 'CP95' and value_type = 'AVG' order by time asc;" +
|
||||
" SELECT time as time, UAberrance as aValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='B' and value_type = 'MAX' order by time asc;" +
|
||||
"SELECT time as time, UAberrance as bValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='B' and value_type = 'MIN' order by time asc;" +
|
||||
"SELECT time as time, UAberrance as cValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='B' and value_type = 'AVG' and value_type = 'MIN' order by time asc;" +
|
||||
"SELECT time as time, UAberrance as cValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='B' and value_type = 'CP95' order by time asc;" +
|
||||
"SELECT time as time, UAberrance as aValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='C' and value_type = 'MAX' order by time asc;" +
|
||||
"SELECT time as time, UAberrance as bValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='C' and value_type = 'MIN' order by time asc;" +
|
||||
"SELECT time as time, UAberrance as cValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='C' and value_type = 'AVG' order by time asc;" +
|
||||
"SELECT time as time, UAberrance as cValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='C' and value_type = 'CP95' order by time asc;";
|
||||
sql = "SELECT time as time, uaberrance as aValue,phasic_type , value_type FROM pqs_abnormaldata WHERE " + stringBuilder.toString() +
|
||||
" and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') " +
|
||||
" and (value_type = 'MAX' or value_type = 'MIN' or value_type = 'AVG' or value_type = 'CP95') group by phasic_type order by time asc tz('Asia/Shanghai');";
|
||||
queryResult = influxDbUtils.query(sql);
|
||||
historyHarmOverLimitVOList = getNormData(queryResult, contion, lineList, "电压总谐波畸变率", "%");
|
||||
break;
|
||||
case 22:
|
||||
//负序电流
|
||||
sql = "SELECT time as time, I_Neg as aValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='T' and value_type = 'MAX' order by time asc;" +
|
||||
"SELECT time as time, I_Neg as bValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='T' and value_type = 'MIN' order by time asc;" +
|
||||
"SELECT time as time, I_Neg as cValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='T' and value_type = 'AVG' order by time asc;" +
|
||||
"SELECT time as time, I_Neg as aValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='T' and value_type = 'CP95' order by time asc;";
|
||||
sql = "SELECT time as time, i_neg as aValue ,phasic_type , value_type FROM pqs_abnormaldata WHERE " + stringBuilder.toString() +
|
||||
" and (phasic_type ='T') " +
|
||||
" and (value_type = 'MAX' or value_type = 'MIN' or value_type = 'AVG' or value_type = 'CP95') group by phasic_type order by time asc tz('Asia/Shanghai');";
|
||||
queryResult = influxDbUtils.query(sql);
|
||||
historyHarmOverLimitVOList = getNormData(queryResult, contion, lineList, "负序电流", "/");
|
||||
break;
|
||||
case 30:
|
||||
//频率 V9暂时代表Freq
|
||||
sql = "SELECT time as time, Freq_Dev as aValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='T' and value_type = 'MAX' order by time asc;" +
|
||||
"SELECT time as time, Freq_Dev as aValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='T' and value_type = 'MIN' order by time asc;" +
|
||||
"SELECT time as time, Freq_Dev as aValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='T' and value_type = 'AVG' order by time asc;" +
|
||||
"SELECT time as time, Freq_Dev as aValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='T' and value_type = 'CP95' order by time asc;";
|
||||
sql = "SELECT time as time, freq_dev as aValue ,phasic_type , value_type FROM pqs_abnormaldata WHERE " + stringBuilder.toString() +
|
||||
" and (phasic_type ='T') " +
|
||||
" and (value_type = 'MAX' or value_type = 'MIN' or value_type = 'AVG' or value_type = 'CP95') group by phasic_type order by time asc tz('Asia/Shanghai');";
|
||||
queryResult = influxDbUtils.query(sql);
|
||||
historyHarmOverLimitVOList = getNormData(queryResult, contion, lineList, "频率", "Hz");
|
||||
break;
|
||||
@@ -200,30 +151,9 @@ public class NormLimitServiceImpl implements NormLimitService {
|
||||
for (int i = 0; i < number.length; i++) {
|
||||
List<HistoryHarmOverLimitVO> harmOverLimitVOList;
|
||||
//谐波电压含有率
|
||||
sql = "SELECT time as time, UHarm_" + number[i] + " as aValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='A' and value_type = 'MAX' order by time asc;" +
|
||||
"SELECT time as time, UHarm_" + number[i] + " as bValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='A' and value_type = 'MIN' order by time asc;" +
|
||||
"SELECT time as time, UHarm_" + number[i] + " as cValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='A' and value_type = 'AVG' order by time asc;" +
|
||||
"SELECT time as time, UHarm_" + number[i] + " as aValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='A' and value_type = 'CP95' order by time asc;" +
|
||||
"SELECT time as time, UHarm_" + number[i] + " as aValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='B' and value_type = 'MAX' order by time asc;" +
|
||||
"SELECT time as time, UHarm_" + number[i] + " as bValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='B' and value_type = 'MIN' order by time asc;" +
|
||||
"SELECT time as time, UHarm_" + number[i] + " as cValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='B' and value_type = 'AVG' order by time asc;" +
|
||||
"SELECT time as time, UHarm_" + number[i] + " as aValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='B' and value_type = 'CP95' order by time asc;" +
|
||||
"SELECT time as time, UHarm_" + number[i] + " as aValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='C' and value_type = 'MAX' order by time asc;" +
|
||||
"SELECT time as time, UHarm_" + number[i] + " as bValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='C' and value_type = 'MIN' order by time asc;" +
|
||||
"SELECT time as time, UHarm_" + number[i] + " as cValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='C' and value_type = 'AVG' order by time asc;" +
|
||||
"SELECT time as time, UHarm_" + number[i] + " as aValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='C' and value_type = 'CP95' order by time asc;";
|
||||
sql = "SELECT time as time, uharm_" + number[i] + " as aValue ,phasic_type , value_type FROM pqs_abnormaldata WHERE " + stringBuilder.toString() +
|
||||
" and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') " +
|
||||
" and (value_type = 'MAX' or value_type = 'MIN' or value_type = 'AVG' or value_type = 'CP95') group by phasic_type order by time asc tz('Asia/Shanghai');";
|
||||
queryResult = influxDbUtils.query(sql);
|
||||
harmOverLimitVOList = getNormData(queryResult, contion, lineList, "谐波电压含有率", "%", number[i]);
|
||||
historyHarmOverLimitVOList.addAll(harmOverLimitVOList);
|
||||
@@ -233,30 +163,9 @@ public class NormLimitServiceImpl implements NormLimitService {
|
||||
for (int i = 0; i < number.length; i++) {
|
||||
List<HistoryHarmOverLimitVO> harmOverLimitVOList;
|
||||
//谐波电流幅值
|
||||
sql = "SELECT time as time, IHarm_" + number[i] + " as aValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='A' and value_type = 'MAX' order by time asc;" +
|
||||
"SELECT time as time, IHarm_" + number[i] + " as bValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='A' and value_type = 'MIN' order by time asc;" +
|
||||
"SELECT time as time, IHarm_" + number[i] + " as cValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='A' and value_type = 'AVG' order by time asc;" +
|
||||
"SELECT time as time, IHarm_" + number[i] + " as aValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='A' and value_type = 'CP95' order by time asc;" +
|
||||
"SELECT time as time, IHarm_" + number[i] + " as bValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='B' and value_type = 'MAX' order by time asc;" +
|
||||
"SELECT time as time, IHarm_" + number[i] + " as cValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='B' and value_type = 'MIN' order by time asc;" +
|
||||
"SELECT time as time, IHarm_" + number[i] + " as aValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='B' and value_type = 'AVG' order by time asc;" +
|
||||
"SELECT time as time, IHarm_" + number[i] + " as bValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='B' and value_type = 'CP95' order by time asc;" +
|
||||
"SELECT time as time, IHarm_" + number[i] + " as cValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='C' and value_type = 'MAX' order by time asc;" +
|
||||
"SELECT time as time, IHarm_" + number[i] + " as aValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='C' and value_type = 'MIN' order by time asc;" +
|
||||
"SELECT time as time, IHarm_" + number[i] + " as bValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='C' and value_type = 'AVG' order by time asc;" +
|
||||
"SELECT time as time, IHarm_" + number[i] + " as cValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='C' and value_type = 'CP95' order by time asc;";
|
||||
sql = "SELECT time as time, iharm_" + number[i] + " as aValue ,phasic_type , value_type FROM pqs_abnormaldata WHERE " + stringBuilder.toString() +
|
||||
" and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') " +
|
||||
" and (value_type = 'MAX' or value_type = 'MIN' or value_type = 'AVG' or value_type = 'CP95') group by phasic_type order by time asc tz('Asia/Shanghai');";
|
||||
queryResult = influxDbUtils.query(sql);
|
||||
harmOverLimitVOList = getNormData(queryResult, contion, lineList, "谐波电流幅值", "A", number[i]);
|
||||
historyHarmOverLimitVOList.addAll(harmOverLimitVOList);
|
||||
@@ -266,30 +175,9 @@ public class NormLimitServiceImpl implements NormLimitService {
|
||||
for (int i = 0; i < inHarmNum.length; i++) {
|
||||
List<HistoryHarmOverLimitVO> harmOverLimitVOList;
|
||||
//间谐波电压含有率
|
||||
sql = "SELECT time as time, InUHARM_" + inHarmNum[i] + " as aValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='A' and value_type = 'MAX' order by time asc;" +
|
||||
"SELECT time as time, InUHARM_" + inHarmNum[i] + " as bValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='A' and value_type = 'MIN' order by time asc;" +
|
||||
"SELECT time as time, InUHARM_" + inHarmNum[i] + " as cValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='A' and value_type = 'AVG' order by time asc;" +
|
||||
"SELECT time as time, InUHARM_" + inHarmNum[i] + " as aValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='A' and value_type = 'CP95' order by time asc;" +
|
||||
"SELECT time as time, InUHARM_" + inHarmNum[i] + " as bValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='B' and value_type = 'MAX' order by time asc;" +
|
||||
"SELECT time as time, InUHARM_" + inHarmNum[i] + " as cValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='B' and value_type = 'AVG' order by time asc;" +
|
||||
"SELECT time as time, InUHARM_" + inHarmNum[i] + " as aValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='B' and value_type = 'MIN' order by time asc;" +
|
||||
"SELECT time as time, InUHARM_" + inHarmNum[i] + " as bValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='B' and value_type = 'CP95' order by time asc;" +
|
||||
"SELECT time as time, InUHARM_" + inHarmNum[i] + " as cValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='C' and value_type = 'MAX' order by time asc;" +
|
||||
"SELECT time as time, InUHARM_" + inHarmNum[i] + " as aValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='C' and value_type = 'MIN' order by time asc;" +
|
||||
"SELECT time as time, InUHARM_" + inHarmNum[i] + " as bValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='C' and value_type = 'AVG' order by time asc;" +
|
||||
"SELECT time as time, InUHARM_" + inHarmNum[i] + " as cValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='C' and value_type = 'CP95' order by time asc;";
|
||||
sql = "SELECT time as time, inuharm_" + inHarmNum[i] + " as aValue ,phasic_type , value_type FROM pqs_abnormaldata WHERE " + stringBuilder.toString() +
|
||||
" and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') " +
|
||||
" and (value_type = 'MAX' or value_type = 'MIN' or value_type = 'AVG' or value_type = 'CP95') group by phasic_type order by time asc tz('Asia/Shanghai');";
|
||||
queryResult = influxDbUtils.query(sql);
|
||||
harmOverLimitVOList = getNormData(queryResult, contion, lineList, "间谐波电压含有率", "%", inHarmNum[i]);
|
||||
historyHarmOverLimitVOList.addAll(harmOverLimitVOList);
|
||||
@@ -297,30 +185,9 @@ public class NormLimitServiceImpl implements NormLimitService {
|
||||
break;
|
||||
case 61:
|
||||
//长时闪变
|
||||
sql = "SELECT time as time, Flicker as aValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='A' and value_type = 'MAX' order by time asc;" +
|
||||
"SELECT time as time, Flicker as bValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='A' and value_type = 'MIN' order by time asc;" +
|
||||
"SELECT time as time, Flicker as cValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='A' and value_type = 'AVG' order by time asc;" +
|
||||
"SELECT time as time, Flicker as aValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='A' and value_type = 'CP95' order by time asc;" +
|
||||
"SELECT time as time, Flicker as bValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='B' and value_type = 'MAX' order by time asc;" +
|
||||
"SELECT time as time, Flicker as cValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='B' and value_type = 'MIN' order by time asc;" +
|
||||
"SELECT time as time, Flicker as aValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='B' and value_type = 'AVG' order by time asc;" +
|
||||
"SELECT time as time, Flicker as bValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='B' and value_type = 'CP95' order by time asc;" +
|
||||
"SELECT time as time, Flicker as cValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='C' and value_type = 'MAX' order by time asc;" +
|
||||
"SELECT time as time, Flicker as aValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='C' and value_type = 'MIN' order by time asc;" +
|
||||
"SELECT time as time, Flicker as bValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='C' and value_type = 'AVG' order by time asc;" +
|
||||
"SELECT time as time, Flicker as cValue FROM PQS_AbnormalData WHERE " + stringBuilder.toString() +
|
||||
" and phasic_type ='C' and value_type = 'CP95' order by time asc;";
|
||||
sql = "SELECT time as time, flicker as aValue ,phasic_type , value_type FROM pqs_abnormaldata WHERE " + stringBuilder.toString() +
|
||||
" and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') " +
|
||||
" and (value_type = 'AVG') group by phasic_type order by time asc tz('Asia/Shanghai');";
|
||||
queryResult = influxDbUtils.query(sql);
|
||||
historyHarmOverLimitVOList = getNormData(queryResult, contion, lineList, "长时闪变", "/");
|
||||
break;
|
||||
@@ -342,143 +209,170 @@ public class NormLimitServiceImpl implements NormLimitService {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SS'Z'");
|
||||
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
//获取监测点详情
|
||||
LineDetailDataVO lineDetailDataVO = lineFeignClient.getLineDetailData(lineList).getData();
|
||||
if (!CollectionUtils.isEmpty(qusery.get(0).getSeries())) {
|
||||
String time = "";
|
||||
Float aMax = 0.0f, aMin = 0.0f, aAvg = 0.0f, aCp95 = 0.0f, bMax = 0.0f, bMin = 0.0f, bAvg = 0.0f, bCp95 = 0.0f, cMax = 0.0f, cMin = 0.0f, cAvg = 0.0f, cCp95 = 0.0f;
|
||||
for (int i = 0; i < qusery.get(0).getSeries().get(0).getValues().size(); i++) {
|
||||
HistoryHarmOverLimitVO historyDataResultVO = new HistoryHarmOverLimitVO();
|
||||
//A相的最大值
|
||||
if (!CollectionUtils.isEmpty(qusery.get(0).getSeries())) {
|
||||
aMax = Float.parseFloat(qusery.get(0).getSeries().get(0).getValues().get(i).get(1).toString());
|
||||
historyDataResultVO.setMaxValue(aMax);
|
||||
for (int i = 0; i < qusery.get(0).getSeries().size(); i++) {
|
||||
List<String> columns = qusery.get(0).getSeries().get(i).getColumns();
|
||||
if (qusery.get(0).getSeries().get(i).getTags().get("phasic_type").equals("A")) {
|
||||
HistoryHarmOverLimitVO historyDataResultVO = new HistoryHarmOverLimitVO();
|
||||
if (!CollectionUtils.isEmpty(qusery.get(0).getSeries().get(i).getValues())) {
|
||||
for (int j = 0; j < qusery.get(0).getSeries().get(i).getValues().size(); j++) {
|
||||
List<Object> objectList = qusery.get(0).getSeries().get(i).getValues().get(j);
|
||||
String aa = String.valueOf(objectList.get(0));
|
||||
Date sd = dateFormat.parse(aa);
|
||||
time = dateFormat.format(sd);
|
||||
if (Integer.parseInt(contion) == 61) {
|
||||
historyDataResultVO.setMaxValue((float) 3.14159);
|
||||
historyDataResultVO.setMinValue((float) 3.14159);
|
||||
historyDataResultVO.setCp95Value((float) 3.14159);
|
||||
aAvg = Float.parseFloat(String.valueOf(objectList.get(1)));
|
||||
historyDataResultVO.setAvgValue(aAvg);
|
||||
} else {
|
||||
if (objectList.get(3).equals("MAX")) {
|
||||
aMax = Float.parseFloat(String.valueOf(objectList.get(1)));
|
||||
historyDataResultVO.setMaxValue(aMax);
|
||||
} else if (objectList.get(3).equals("MIN")) {
|
||||
aMin = Float.parseFloat(String.valueOf(objectList.get(1)));
|
||||
historyDataResultVO.setMinValue(aMin);
|
||||
} else if (objectList.get(3).equals("AVG")) {
|
||||
aAvg = Float.parseFloat(String.valueOf(objectList.get(1)));
|
||||
historyDataResultVO.setAvgValue(aAvg);
|
||||
} else if (objectList.get(3).equals("CP95")) {
|
||||
aCp95 = Float.parseFloat(String.valueOf(objectList.get(1)));
|
||||
historyDataResultVO.setCp95Value(aCp95);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
historyDataResultVO.setTime(time);
|
||||
historyDataResultVO.setLineName(lineDetailDataVO.getLineName());
|
||||
historyDataResultVO.setLineId(lineList);
|
||||
historyDataResultVO.setNumber(0);
|
||||
historyDataResultVO.setSubName(lineDetailDataVO.getBdName());
|
||||
historyDataResultVO.setTargetCode(contion);
|
||||
historyDataResultVO.setTargetName(phaseName);
|
||||
if (Integer.parseInt(contion) == 12 || Integer.parseInt(contion) == 15) {
|
||||
historyDataResultVO.setPhaseType("A");
|
||||
historyDataResultVO.setStatisticalType(Math.abs(aMax) > Math.abs(aMin) ? 3 : 2);
|
||||
} else if (Integer.parseInt(contion) == 13 || Integer.parseInt(contion) == 22) {
|
||||
historyDataResultVO.setPhaseType("/");
|
||||
historyDataResultVO.setStatisticalType(Math.abs(aMax) > Math.abs(aCp95) ? 3 : 4);
|
||||
} else {
|
||||
historyDataResultVO.setPhaseType("A");
|
||||
historyDataResultVO.setStatisticalType(3);
|
||||
}
|
||||
historyDataResultVO.setScale(lineDetailDataVO.getScale());
|
||||
historyDataResultVO.setUnit(unit);
|
||||
historyHarmOverLimitVOList.add(historyDataResultVO);
|
||||
}
|
||||
//A相的最小值
|
||||
if (!CollectionUtils.isEmpty(qusery.get(1).getSeries())) {
|
||||
aMin = Float.parseFloat(qusery.get(1).getSeries().get(0).getValues().get(i).get(1).toString());
|
||||
historyDataResultVO.setMinValue(aMin);
|
||||
}
|
||||
//A相的评价值
|
||||
if (!CollectionUtils.isEmpty(qusery.get(2).getSeries())) {
|
||||
aAvg = Float.parseFloat(qusery.get(2).getSeries().get(0).getValues().get(i).get(1).toString());
|
||||
historyDataResultVO.setAvgValue(aAvg);
|
||||
}
|
||||
//A相的CP95
|
||||
if (!CollectionUtils.isEmpty(qusery.get(3).getSeries())) {
|
||||
time = String.valueOf(qusery.get(3).getSeries().get(0).getValues().get(i).get(0));
|
||||
aCp95 = Float.parseFloat(qusery.get(3).getSeries().get(0).getValues().get(i).get(1).toString());
|
||||
historyDataResultVO.setTime(dateFormat.format(sdf.parse(time)));
|
||||
historyDataResultVO.setCp95Value(aCp95);
|
||||
}
|
||||
historyDataResultVO.setLineName(lineDetailDataVO.getLineName());
|
||||
historyDataResultVO.setLineId(lineList);
|
||||
historyDataResultVO.setNumber(0);
|
||||
historyDataResultVO.setSubName(lineDetailDataVO.getBdName());
|
||||
historyDataResultVO.setTargetCode(contion);
|
||||
historyDataResultVO.setTargetName(phaseName);
|
||||
if (Integer.parseInt(contion)==12 || Integer.parseInt(contion)==15){
|
||||
historyDataResultVO.setPhaseType("A");
|
||||
historyDataResultVO.setStatisticalType(Math.abs(aMax) > Math.abs(aMin) ? 3 : 2);
|
||||
}else if(Integer.parseInt(contion)==13 || Integer.parseInt(contion)==22){
|
||||
historyDataResultVO.setPhaseType("/");
|
||||
historyDataResultVO.setStatisticalType(Math.abs(aMax) > Math.abs(aCp95) ? 3 : 4);
|
||||
}else {
|
||||
historyDataResultVO.setPhaseType("A");
|
||||
historyDataResultVO.setStatisticalType(3);
|
||||
}
|
||||
historyDataResultVO.setScale(lineDetailDataVO.getScale());
|
||||
historyDataResultVO.setUnit(unit);
|
||||
historyHarmOverLimitVOList.add(historyDataResultVO);
|
||||
}
|
||||
if ("12".equals(contion) || "15".equals(contion) || "40".equals(contion) || "61".equals(contion)) {
|
||||
for (int i = 0; i < qusery.get(4).getSeries().get(0).getValues().size(); i++) {
|
||||
HistoryHarmOverLimitVO historyDataResultVOB = new HistoryHarmOverLimitVO();
|
||||
//B相的最大值
|
||||
if (!CollectionUtils.isEmpty(qusery.get(4).getSeries())) {
|
||||
bMax = Float.parseFloat(qusery.get(4).getSeries().get(0).getValues().get(i).get(1).toString());
|
||||
historyDataResultVOB.setMaxValue(bMax);
|
||||
if ("12".equals(contion) || "15".equals(contion) || "40".equals(contion) || "61".equals(contion)) {
|
||||
if (qusery.get(0).getSeries().get(i).getTags().get("phasic_type").equals("B")) {
|
||||
HistoryHarmOverLimitVO historyDataResultVO = new HistoryHarmOverLimitVO();
|
||||
if (!CollectionUtils.isEmpty(qusery.get(0).getSeries().get(i).getValues())) {
|
||||
for (int j = 0; j < qusery.get(0).getSeries().get(i).getValues().size(); j++) {
|
||||
List<Object> objectList = qusery.get(0).getSeries().get(i).getValues().get(j);
|
||||
String aa = String.valueOf(objectList.get(0));
|
||||
Date sd = dateFormat.parse(aa);
|
||||
time = dateFormat.format(sd);
|
||||
if (Integer.parseInt(contion) == 61) {
|
||||
historyDataResultVO.setMaxValue((float) 3.14159);
|
||||
historyDataResultVO.setMinValue((float) 3.14159);
|
||||
historyDataResultVO.setCp95Value((float) 3.14159);
|
||||
aAvg = Float.parseFloat(String.valueOf(objectList.get(1)));
|
||||
historyDataResultVO.setAvgValue(aAvg);
|
||||
} else {
|
||||
if (objectList.get(3).equals("MAX")) {
|
||||
bMax = Float.parseFloat(String.valueOf(objectList.get(1)));
|
||||
historyDataResultVO.setMaxValue(bMax);
|
||||
} else if (objectList.get(3).equals("MIN")) {
|
||||
bMin = Float.parseFloat(String.valueOf(objectList.get(1)));
|
||||
historyDataResultVO.setMinValue(bMin);
|
||||
} else if (objectList.get(3).equals("AVG")) {
|
||||
bAvg = Float.parseFloat(String.valueOf(objectList.get(1)));
|
||||
historyDataResultVO.setAvgValue(bAvg);
|
||||
} else if (objectList.get(3).equals("CP95")) {
|
||||
bCp95 = Float.parseFloat(String.valueOf(objectList.get(1)));
|
||||
historyDataResultVO.setCp95Value(bCp95);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
historyDataResultVO.setTime(time);
|
||||
historyDataResultVO.setLineName(lineDetailDataVO.getLineName());
|
||||
historyDataResultVO.setLineId(lineList);
|
||||
historyDataResultVO.setNumber(0);
|
||||
historyDataResultVO.setSubName(lineDetailDataVO.getBdName());
|
||||
historyDataResultVO.setTargetCode(contion);
|
||||
historyDataResultVO.setTargetName(phaseName);
|
||||
if (Integer.parseInt(contion) == 12 || Integer.parseInt(contion) == 15) {
|
||||
historyDataResultVO.setPhaseType("B");
|
||||
historyDataResultVO.setStatisticalType(Math.abs(aMax) > Math.abs(aMin) ? 3 : 2);
|
||||
} else if (Integer.parseInt(contion) == 13 || Integer.parseInt(contion) == 22) {
|
||||
historyDataResultVO.setPhaseType("/");
|
||||
historyDataResultVO.setStatisticalType(Math.abs(aMax) > Math.abs(aCp95) ? 3 : 4);
|
||||
} else {
|
||||
historyDataResultVO.setPhaseType("B");
|
||||
historyDataResultVO.setStatisticalType(3);
|
||||
}
|
||||
historyDataResultVO.setScale(lineDetailDataVO.getScale());
|
||||
historyDataResultVO.setUnit(unit);
|
||||
historyHarmOverLimitVOList.add(historyDataResultVO);
|
||||
} else if (qusery.get(0).getSeries().get(i).getTags().get("phasic_type").equals("C")) {
|
||||
if (!CollectionUtils.isEmpty(qusery.get(0).getSeries().get(i).getValues())) {
|
||||
HistoryHarmOverLimitVO historyDataResultVO = new HistoryHarmOverLimitVO();
|
||||
for (int j = 0; j < qusery.get(0).getSeries().get(i).getValues().size(); j++) {
|
||||
List<Object> objectList = qusery.get(0).getSeries().get(i).getValues().get(j);
|
||||
String aa = String.valueOf(objectList.get(0));
|
||||
Date sd = dateFormat.parse(aa);
|
||||
time = dateFormat.format(sd);
|
||||
if (Integer.parseInt(contion) == 61) {
|
||||
historyDataResultVO.setMaxValue((float) 3.14159);
|
||||
historyDataResultVO.setMinValue((float) 3.14159);
|
||||
historyDataResultVO.setCp95Value((float) 3.14159);
|
||||
aAvg = Float.parseFloat(String.valueOf(objectList.get(1)));
|
||||
historyDataResultVO.setAvgValue(aAvg);
|
||||
} else {
|
||||
if (objectList.get(3).equals("MAX")) {
|
||||
cMax = Float.parseFloat(String.valueOf(objectList.get(1)));
|
||||
historyDataResultVO.setMaxValue(cMax);
|
||||
} else if (objectList.get(3).equals("MIN")) {
|
||||
cMin = Float.parseFloat(String.valueOf(objectList.get(1)));
|
||||
historyDataResultVO.setMinValue(cMin);
|
||||
} else if (objectList.get(3).equals("AVG")) {
|
||||
cAvg = Float.parseFloat(String.valueOf(objectList.get(1)));
|
||||
historyDataResultVO.setAvgValue(cAvg);
|
||||
} else if (objectList.get(3).equals("CP95")) {
|
||||
cCp95 = Float.parseFloat(String.valueOf(objectList.get(1)));
|
||||
historyDataResultVO.setCp95Value(cCp95);
|
||||
}
|
||||
}
|
||||
}
|
||||
historyDataResultVO.setTime(time);
|
||||
historyDataResultVO.setLineName(lineDetailDataVO.getLineName());
|
||||
historyDataResultVO.setLineId(lineList);
|
||||
historyDataResultVO.setNumber(0);
|
||||
historyDataResultVO.setSubName(lineDetailDataVO.getBdName());
|
||||
historyDataResultVO.setTargetCode(contion);
|
||||
historyDataResultVO.setTargetName(phaseName);
|
||||
if (Integer.parseInt(contion) == 12 || Integer.parseInt(contion) == 15) {
|
||||
historyDataResultVO.setPhaseType("C");
|
||||
historyDataResultVO.setStatisticalType(Math.abs(cMax) > Math.abs(cMin) ? 3 : 2);
|
||||
} else if (Integer.parseInt(contion) == 13 || Integer.parseInt(contion) == 22) {
|
||||
historyDataResultVO.setPhaseType("/");
|
||||
historyDataResultVO.setStatisticalType(Math.abs(cMax) > Math.abs(cCp95) ? 3 : 4);
|
||||
} else {
|
||||
historyDataResultVO.setPhaseType("C");
|
||||
historyDataResultVO.setStatisticalType(3);
|
||||
}
|
||||
historyDataResultVO.setScale(lineDetailDataVO.getScale());
|
||||
historyDataResultVO.setUnit(unit);
|
||||
historyHarmOverLimitVOList.add(historyDataResultVO);
|
||||
}
|
||||
}
|
||||
//B相的最小值
|
||||
if (!CollectionUtils.isEmpty(qusery.get(5).getSeries())) {
|
||||
bMin = Float.parseFloat(qusery.get(5).getSeries().get(0).getValues().get(i).get(1).toString());
|
||||
historyDataResultVOB.setMinValue(bMin);
|
||||
}
|
||||
//B相的平均值
|
||||
if (!CollectionUtils.isEmpty(qusery.get(6).getSeries())) {
|
||||
bAvg = Float.parseFloat(qusery.get(6).getSeries().get(0).getValues().get(i).get(1).toString());
|
||||
historyDataResultVOB.setAvgValue(bAvg);
|
||||
}
|
||||
//B相的CP95
|
||||
if (!CollectionUtils.isEmpty(qusery.get(7).getSeries())) {
|
||||
time = String.valueOf(qusery.get(7).getSeries().get(0).getValues().get(i).get(0));
|
||||
bCp95 = Float.parseFloat(qusery.get(7).getSeries().get(0).getValues().get(i).get(1).toString());
|
||||
historyDataResultVOB.setTime(dateFormat.format(sdf.parse(time)));
|
||||
historyDataResultVOB.setCp95Value(bCp95);
|
||||
}
|
||||
historyDataResultVOB.setLineName(lineDetailDataVO.getLineName());
|
||||
historyDataResultVOB.setLineId(lineList);
|
||||
historyDataResultVOB.setNumber(0);
|
||||
historyDataResultVOB.setSubName(lineDetailDataVO.getBdName());
|
||||
historyDataResultVOB.setTargetCode(contion);
|
||||
historyDataResultVOB.setTargetName(phaseName);
|
||||
if (Integer.parseInt(contion)==12 || Integer.parseInt(contion)==15){
|
||||
historyDataResultVOB.setPhaseType("B");
|
||||
historyDataResultVOB.setStatisticalType(Math.abs(aMax) > Math.abs(aMin) ? 3 : 2);
|
||||
}else if(Integer.parseInt(contion)==13 || Integer.parseInt(contion)==22){
|
||||
historyDataResultVOB.setPhaseType("/");
|
||||
historyDataResultVOB.setStatisticalType(Math.abs(aMax) > Math.abs(aCp95) ? 3 : 4);
|
||||
}else {
|
||||
historyDataResultVOB.setPhaseType("B");
|
||||
historyDataResultVOB.setStatisticalType(3);
|
||||
}
|
||||
historyDataResultVOB.setScale(lineDetailDataVO.getScale());
|
||||
historyDataResultVOB.setUnit(unit);
|
||||
historyHarmOverLimitVOList.add(historyDataResultVOB);
|
||||
}
|
||||
for (int i = 0; i < qusery.get(8).getSeries().get(0).getValues().size(); i++) {
|
||||
HistoryHarmOverLimitVO historyDataResultVOC = new HistoryHarmOverLimitVO();
|
||||
//C相的最大值
|
||||
if (!CollectionUtils.isEmpty(qusery.get(8).getSeries())) {
|
||||
cMax = Float.parseFloat(qusery.get(8).getSeries().get(0).getValues().get(i).get(1).toString());
|
||||
historyDataResultVOC.setMaxValue(cMax);
|
||||
}
|
||||
//C相的最小值
|
||||
if (!CollectionUtils.isEmpty(qusery.get(9).getSeries())) {
|
||||
cMin = Float.parseFloat(qusery.get(9).getSeries().get(0).getValues().get(i).get(1).toString());
|
||||
historyDataResultVOC.setMinValue(cMin);
|
||||
}
|
||||
//C相的平均值
|
||||
if (!CollectionUtils.isEmpty(qusery.get(10).getSeries())) {
|
||||
cAvg = Float.parseFloat(qusery.get(10).getSeries().get(0).getValues().get(i).get(1).toString());
|
||||
historyDataResultVOC.setAvgValue(cAvg);
|
||||
}
|
||||
//C相的CP95
|
||||
if (!CollectionUtils.isEmpty(qusery.get(11).getSeries())) {
|
||||
time = String.valueOf(qusery.get(11).getSeries().get(0).getValues().get(i).get(0));
|
||||
cCp95 = Float.parseFloat(qusery.get(11).getSeries().get(0).getValues().get(i).get(1).toString());
|
||||
historyDataResultVOC.setTime(dateFormat.format(sdf.parse(time)));
|
||||
historyDataResultVOC.setCp95Value(cCp95);
|
||||
}
|
||||
historyDataResultVOC.setLineName(lineDetailDataVO.getLineName());
|
||||
historyDataResultVOC.setLineId(lineList);
|
||||
historyDataResultVOC.setNumber(0);
|
||||
historyDataResultVOC.setSubName(lineDetailDataVO.getBdName());
|
||||
historyDataResultVOC.setTargetCode(contion);
|
||||
historyDataResultVOC.setTargetName(phaseName);
|
||||
if (Integer.parseInt(contion)==12 || Integer.parseInt(contion)==15){
|
||||
historyDataResultVOC.setPhaseType("C");
|
||||
historyDataResultVOC.setStatisticalType(Math.abs(aMax) > Math.abs(aMin) ? 3 : 2);
|
||||
}else if(Integer.parseInt(contion)==13 || Integer.parseInt(contion)==22){
|
||||
historyDataResultVOC.setPhaseType("/");
|
||||
historyDataResultVOC.setStatisticalType(Math.abs(aMax) > Math.abs(aCp95) ? 3 : 4);
|
||||
}else {
|
||||
historyDataResultVOC.setPhaseType("C");
|
||||
historyDataResultVOC.setStatisticalType(3);
|
||||
}
|
||||
historyDataResultVOC.setScale(lineDetailDataVO.getScale());
|
||||
historyDataResultVOC.setUnit(unit);
|
||||
historyHarmOverLimitVOList.add(historyDataResultVOC);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.njcn.harmonic.constant.Param;
|
||||
import com.njcn.harmonic.pojo.param.PulicTimeStatisParam;
|
||||
import com.njcn.harmonic.pojo.vo.SteadyInfoData;
|
||||
import com.njcn.harmonic.service.SteadyDataService;
|
||||
import com.njcn.influxdb.param.InfluxDBPublicParam;
|
||||
import com.njcn.influxdb.utils.InfluxDbUtils;
|
||||
import com.njcn.web.pojo.vo.SteadyDataVO;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -49,24 +50,25 @@ public class SteadyDataServiceImpl implements SteadyDataService {
|
||||
if (!lineList.isEmpty() || StringUtils.isNotBlank(lineList)) {
|
||||
//组装sql语句
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.append(Param.TIME + " >= '").append(startTime).append(Param.START_TIME).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append(Param.END_TIME).append("' and (");
|
||||
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(Param.MYINDEX + "='").append(lineList).append("')");
|
||||
stringBuilder.append(InfluxDBPublicParam.LINE_ID + "='").append(lineList).append("') ");
|
||||
stringBuilder.append(InfluxDBPublicParam.TIME_ZONE);
|
||||
String sql = "SELECT" +
|
||||
" SUM( AllTime ) AS allTime," +
|
||||
" SUM( Flicket_AllTime ) AS frequency," +
|
||||
" SUM( Freq_Dev_OverTime ) AS uBalance," +
|
||||
" SUM( I_Neg_OverTime ) AS iNeg," +
|
||||
" SUM( IHarm_13_OverTime) AS harmElec," +
|
||||
" SUM( UHarm_4_OverTime) AS harmVoltage," +
|
||||
" SUM( Flicker_OverTime ) AS flicker," +
|
||||
" SUM( Flicket_AllTime ) AS allFlicker," +
|
||||
" SUM( Voltage_Dev_OverTime ) AS voltageDeviation," +
|
||||
" SUM( InUHARM_9_OverTime ) AS inUharm" +
|
||||
" SUM( alltime ) AS alltime," +
|
||||
" SUM( freq_dev_overtime ) AS frequency," +
|
||||
" SUM( ubalance_overtime ) AS uBalance," +
|
||||
" SUM( i_neg_overtime ) AS iNeg," +
|
||||
" SUM( iharm_13_overtime) AS harmElec," +
|
||||
" SUM( uharm_4_overtime) AS harmVoltage," +
|
||||
" SUM( flicker_overtime ) AS flicker," +
|
||||
" SUM( flicker_alltime ) AS allFlicker," +
|
||||
" SUM( voltage_dev_overtime ) AS voltageDeviation," +
|
||||
" SUM( inuharm_9_overtime ) AS inUharm" +
|
||||
" FROM" +
|
||||
" LIMIT_RATE" +
|
||||
" limit_rate" +
|
||||
" WHERE" +
|
||||
" Phasic_Type = 'T'" +
|
||||
" phasic_type = 'T'" +
|
||||
" AND " + stringBuilder.toString();
|
||||
//结果集
|
||||
QueryResult result = influxDbUtils.query(sql);
|
||||
|
||||
Reference in New Issue
Block a user