提交代码:针对公共类的修改

This commit is contained in:
njcn_dhj
2022-07-07 16:18:23 +08:00
parent d734473038
commit 7bf883af73
3 changed files with 53 additions and 44 deletions

View File

@@ -15,6 +15,7 @@ import com.njcn.harmonic.pojo.vo.EventDetailVO;
import com.njcn.harmonic.pojo.vo.HistoryDataResultVO;
import com.njcn.harmonic.pojo.vo.QueryResultLimitVO;
import com.njcn.harmonic.service.HistoryResultService;
import com.njcn.influxdb.param.InfluxDBPublicParam;
import com.njcn.influxdb.utils.InfluxDbUtils;
import lombok.AllArgsConstructor;
import lombok.SneakyThrows;
@@ -192,9 +193,9 @@ public class HistoryResultServiceImpl implements HistoryResultService {
LineDetailDataVO lineDetailDataVO = lineFeignClient.getLineDetailData(lineList).getData();
//组装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.LINE_ID + "='").append(lineList).append("')");
stringBuilder.append(InfluxDBPublicParam.LINE_ID + "='").append(lineList).append("')");
String valueTypeName = "";
switch (valueType) {
case 1:
@@ -213,7 +214,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
break;
}
if (Integer.parseInt(contion) != 60 || Integer.parseInt(contion) != 61 || Integer.parseInt(contion) != 62) {
stringBuilder.append(" and ").append(Param.VALUETYPE + "='").append(valueTypeName).append("'");
stringBuilder.append(" and ").append(InfluxDBPublicParam.VALUETYPE + "='").append(valueTypeName).append("'");
}
String sql = "";
List<String> phasicType = new ArrayList<>();
@@ -223,7 +224,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
case 10:
//相电压有效值
sql = "SELECT time as time, rms as aValue FROM data_v WHERE " + stringBuilder.toString() +
" and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') group by phasic_type 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');";
phasicType.add("A相");
phasicType.add("B相");
phasicType.add("C相");
@@ -233,7 +234,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
case 11:
//线电压有效值
sql = "SELECT time as time, rms_lvr as aValue FROM data_v WHERE " + stringBuilder.toString() +
" and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') group by phasic_type 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');";
phasicType.add("AB相");
phasicType.add("BC相");
phasicType.add("CA相");
@@ -243,7 +244,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
case 12:
//电压偏差
sql = "SELECT time as time, vu_dev as aValue FROM data_v WHERE " + stringBuilder.toString() +
" and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') group by phasic_type 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 = overlimit.getVoltageDev();
lowerLimit = overlimit.getUvoltageDev();
if (ptType == 0) {
@@ -261,7 +262,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
case 13:
//三相电压不平衡度
sql = "SELECT time as time, v_unbalance 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 = overlimit.getUbalance();
phasicType.add("三相电压不平衡度");
unit.add("%");
@@ -270,7 +271,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
case 14:
//电压不平衡
sql = "SELECT time as time, v_zero as aValue FROM data_v WHERE " + stringBuilder.toString() +
" and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') group by phasic_type 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');";
phasicType.add("零序电压");
phasicType.add("正序电压");
phasicType.add("负序电压");
@@ -282,7 +283,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
case 15:
//电压总谐波畸变率
sql = "SELECT time as time, v_thd as aValue FROM data_v WHERE " + stringBuilder.toString() +
" and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') group by phasic_type 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 = overlimit.getUaberrance();
if (ptType == 0) {
phasicType.add("A相");
@@ -299,7 +300,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
case 20:
//电流有效值
sql = "SELECT time as time, rms as aValue FROM data_i WHERE " + stringBuilder.toString() +
" and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') group by phasic_type 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');";
phasicType.add("A相");
phasicType.add("B相");
phasicType.add("C相");
@@ -309,7 +310,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
case 21:
//电流总畸变率
sql = "SELECT time as time, i_thd as aValue FROM data_i WHERE " + stringBuilder.toString() +
" and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') group by phasic_type 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');";
phasicType.add("A相");
phasicType.add("B相");
phasicType.add("C相");
@@ -319,7 +320,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
case 22:
//负序电流
sql = "SELECT time as time, i_neg as aValue FROM data_i WHERE " + stringBuilder.toString() +
" and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') group by phasic_type 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 = overlimit.getINeg();
phasicType.add("负序电流");
unit.add("A");
@@ -328,7 +329,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();
phasicType.add("频率");
@@ -338,7 +339,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' or phasic_type ='B' or phasic_type ='C') group by phasic_type 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);
if (ptType == 0) {
phasicType.add("A相");
@@ -355,7 +356,7 @@ 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' or phasic_type ='B' or phasic_type ='C') group by phasic_type 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');";
phasicType.add("A相");
phasicType.add("B相");
phasicType.add("C相");
@@ -365,7 +366,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
case 42:
//谐波电压幅值
sql = "SELECT time as time, v_" + number + " as aValue FROM data_v WHERE " + stringBuilder.toString() +
" and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') group by phasic_type 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');";
if (ptType == 0) {
phasicType.add("A相");
phasicType.add("B相");
@@ -385,7 +386,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
case 43:
//谐波电流幅值
sql = "SELECT time as time, i_" + number + " as aValue FROM data_i WHERE " + stringBuilder.toString() +
" and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') group by phasic_type 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);
phasicType.add("A相");
phasicType.add("B相");
@@ -396,7 +397,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
case 44:
//谐波电压相角
sql = "SELECT time as time, v_" + number + " as aValue FROM data_harmphasic_v WHERE " + stringBuilder.toString() +
" and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') group by phasic_type 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');";
if (ptType == 0) {
phasicType.add("A相");
phasicType.add("B相");
@@ -412,7 +413,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
case 45:
//谐波电流相角
sql = "SELECT time as time, i_" + number + " as aValue FROM data_harmphasic_i WHERE " + stringBuilder.toString() +
" and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') group by phasic_type 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');";
phasicType.add("A相");
phasicType.add("B相");
phasicType.add("C相");
@@ -422,7 +423,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' or phasic_type ='B' or phasic_type ='C') group by phasic_type 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);
if (ptType == 0) {
phasicType.add("A相");
@@ -439,7 +440,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
case 47:
//间谐波电流含有率
sql = "SELECT time as time, i_" + number + " as aValue FROM data_inharmrate_i WHERE " + stringBuilder.toString() +
" and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') group by phasic_type 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');";
phasicType.add("A相");
phasicType.add("B相");
phasicType.add("C相");
@@ -449,7 +450,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
case 48:
//间谐波电压幅值
sql = "SELECT time as time, v_" + number + " as aValue FROM data_inharm_v WHERE " + stringBuilder.toString() +
" and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') group by phasic_type 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 = "间谐波电压幅值";
if (ptType == 0) {
phasicType.add("A相");
@@ -465,7 +466,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
case 49:
//间谐波电流幅值
sql = "SELECT time as time, i_" + number + " as aValue FROM data_inharm_i WHERE " + stringBuilder.toString() +
" and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') group by phasic_type 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');";
phasicType.add("A相");
phasicType.add("B相");
phasicType.add("C相");
@@ -475,7 +476,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
case 50:
//谐波有功功率
sql = "SELECT time as time, p_" + number + " as aValue FROM data_harmpower_p WHERE " + stringBuilder.toString() +
" and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') group by phasic_type 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');";
phasicType.add("A相");
phasicType.add("B相");
phasicType.add("C相");
@@ -489,7 +490,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
case 51:
//谐波无功功率
sql = "SELECT time as time, q_" + number + " as aValue FROM data_harmpower_q WHERE " + stringBuilder.toString() +
" and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') group by phasic_type 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');";
phasicType.add("A相");
phasicType.add("B相");
phasicType.add("C相");
@@ -503,7 +504,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
case 52:
//谐波视在功率
sql = "SELECT time as time, s_" + number + " as aValue FROM data_harmpower_s WHERE " + stringBuilder.toString() +
" and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') group by phasic_type 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');";
phasicType.add("A相");
phasicType.add("B相");
phasicType.add("C相");
@@ -517,7 +518,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
case 53:
//三相有功功率
sql = "SELECT time as time, p as aValue FROM data_harmpower_p WHERE " + stringBuilder.toString() +
" and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') group by phasic_type 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');";
phasicType.add("A相");
phasicType.add("B相");
phasicType.add("C相");
@@ -527,7 +528,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
case 54:
//三相无功功率
sql = "SELECT time as time, q as aValue FROM data_harmpower_q WHERE " + stringBuilder.toString() +
" and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') group by phasic_type 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');";
phasicType.add("A相");
phasicType.add("B相");
phasicType.add("C相");
@@ -537,7 +538,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
case 55:
//三相视在功率
sql = "SELECT time as time, s as aValue FROM data_harmpower_s WHERE " + stringBuilder.toString() +
" and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') group by phasic_type 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');";
phasicType.add("A相");
phasicType.add("B相");
phasicType.add("C相");
@@ -547,7 +548,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
case 56:
//三相总有功功率
sql = "SELECT time as time, p as aValue FROM data_harmpower_p WHERE " + stringBuilder.toString() +
" and phasic_type ='T' order by time asc;";
" and phasic_type ='T' order by time asc tz('Asia/Shanghai');";
phasicType.add("三相总有功功率");
unit.add("kW");
targetName = "三相总有功功率";
@@ -555,7 +556,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
case 57:
//三相总无功功率
sql = "SELECT time as time, q as aValue FROM data_harmpower_q WHERE " + stringBuilder.toString() +
" and phasic_type ='T' order by time asc;";
" and phasic_type ='T' order by time asc tz('Asia/Shanghai');";
phasicType.add("三相总无功功率");
unit.add("kVar");
targetName = "三相总无功功率";
@@ -563,7 +564,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
case 58:
//三相总视在功率
sql = "SELECT time as time, s as aValue FROM data_harmpower_s WHERE " + stringBuilder.toString() +
" and phasic_type ='T' order by time asc;";
" and phasic_type ='T' order by time asc tz('Asia/Shanghai');";
phasicType.add("三相总视在功率");
unit.add("kVA");
targetName = "三相总视在功率";
@@ -571,7 +572,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
case 59:
//视在功率因数
sql = "SELECT time as time, pf as aValue FROM data_harmpower_p WHERE " + stringBuilder.toString() +
" and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') group by phasic_type 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');";
phasicType.add("A相");
phasicType.add("B相");
phasicType.add("C相");
@@ -580,7 +581,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
case 591:
//位移功率因数
sql = "SELECT time as time, df as aValue FROM data_harmpower_p WHERE " + stringBuilder.toString() +
" and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') group by phasic_type 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');";
phasicType.add("A相");
phasicType.add("B相");
phasicType.add("C相");
@@ -589,21 +590,21 @@ public class HistoryResultServiceImpl implements HistoryResultService {
case 592:
//总视在功率因数
sql = "SELECT time as time, pf as aValue FROM data_harmpower_p WHERE " + stringBuilder.toString() +
" and phasic_type ='T' order by time asc;";
" and phasic_type ='T' order by time asc tz('Asia/Shanghai');";
phasicType.add("总视在功率因数");
targetName = "总视在功率因数";
break;
case 593:
//总位移功率因数
sql = "SELECT time as time, df as aValue FROM data_harmpower_p WHERE " + stringBuilder.toString() +
" and phasic_type ='T' order by time asc;";
" and phasic_type ='T' order by time asc tz('Asia/Shanghai');";
phasicType.add("总位移功率因数");
targetName = "总位移功率因数";
break;
case 61:
//长时闪变
sql = "SELECT time as time, plt as aValue FROM data_plt WHERE " + stringBuilder.toString() +
" and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') group by phasic_type 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');";
if (ptType == 0) {
phasicType.add("A相");
phasicType.add("B相");
@@ -619,7 +620,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
case 60:
//短时闪变
sql = "SELECT time as time, pst as aValue FROM data_flicker WHERE " + stringBuilder.toString() +
" and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') group by phasic_type 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 = overlimit.getFlicker();
if (ptType == 0) {
phasicType.add("A相");
@@ -635,7 +636,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
case 62:
//电压波动
sql = "SELECT time as time, fluc as aValue FROM data_fluc WHERE " + stringBuilder.toString() +
" and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') group by phasic_type 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');";
if (ptType == 0) {
phasicType.add("A相");
phasicType.add("B相");