代码调整——data表处理成day表

This commit is contained in:
2022-06-24 14:55:53 +08:00
parent e794083fd6
commit 7327d661ac
4 changed files with 130 additions and 49 deletions

View File

@@ -1,6 +1,7 @@
package com.njcn.executor.handler; package com.njcn.executor.handler;
import com.njcn.common.pojo.constant.PatternRegex; import com.njcn.common.pojo.constant.PatternRegex;
import com.njcn.device.api.LineFeignClient;
import com.njcn.executor.pojo.vo.*; import com.njcn.executor.pojo.vo.*;
import com.njcn.harmonic.constant.Param; import com.njcn.harmonic.constant.Param;
import com.njcn.influxdb.utils.InfluxDbUtils; import com.njcn.influxdb.utils.InfluxDbUtils;
@@ -39,6 +40,8 @@ public class DayJob {
private final InfluxDbUtils influxDbUtils; private final InfluxDbUtils influxDbUtils;
private final LineFeignClient lineFeignClient;
@XxlJob("dayJobHandler") @XxlJob("dayJobHandler")
public void getDayData() throws ParseException { public void getDayData() throws ParseException {
List<String> paramList = new ArrayList<>(); List<String> paramList = new ArrayList<>();
@@ -59,7 +62,8 @@ public class DayJob {
endTime = paramList.get(1); endTime = paramList.get(1);
lineList = paramList.subList(2,paramList.size()); lineList = paramList.subList(2,paramList.size());
if (CollectionUtils.isEmpty(lineList)){ if (CollectionUtils.isEmpty(lineList)){
log.info("补招传入的参数有误未传监测点id"); log.info("补招传入的参数未传监测点id");
lineList = lineFeignClient.getLineList().getData();
} }
boolean s1 = Pattern.matches(PatternRegex.TIME_FORMAT,startTime); boolean s1 = Pattern.matches(PatternRegex.TIME_FORMAT,startTime);
boolean e1 = Pattern.matches(PatternRegex.TIME_FORMAT,endTime); boolean e1 = Pattern.matches(PatternRegex.TIME_FORMAT,endTime);
@@ -70,6 +74,8 @@ public class DayJob {
startTime = startTime + " 00:00:00"; startTime = startTime + " 00:00:00";
endTime = endTime + " 23:59:59"; endTime = endTime + " 23:59:59";
} }
} else {
lineList = lineFeignClient.getLineList().getData();
} }
long diff,diffDays,a,b = 0; long diff,diffDays,a,b = 0;
Date d1 = format.parse(startTime); Date d1 = format.parse(startTime);
@@ -236,11 +242,14 @@ public class DayJob {
stringBuilder7.append("percentile(v_").append(i).append(",95) AS v_").append(i).append(","); stringBuilder7.append("percentile(v_").append(i).append(",95) AS v_").append(i).append(",");
} }
} }
stringBuilder8.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and value_type = 'CP95' group by line_id,phasic_type,value_type,quality_flag tz('Asia/Shanghai')"); stringBuilder8.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and value_type = 'AVG' group by line_id,phasic_type,value_type,quality_flag tz('Asia/Shanghai')");
String sql4 = "select "+stringBuilder7+" from data_v where "+stringBuilder+stringBuilder8; String sql4 = "select "+stringBuilder7+" from data_v where "+stringBuilder+stringBuilder8;
QueryResult sqlResult4 = influxDbUtils.query(sql4); QueryResult sqlResult4 = influxDbUtils.query(sql4);
InfluxDBResultMapper resultMapper4 = new InfluxDBResultMapper(); InfluxDBResultMapper resultMapper4 = new InfluxDBResultMapper();
List<DataV> list4 = resultMapper4.toPOJO(sqlResult4, DataV.class); List<DataV> list4 = resultMapper4.toPOJO(sqlResult4, DataV.class);
list4.forEach(item->{
item.setValueType("CP95");
});
result.addAll(list1); result.addAll(list1);
result.addAll(list2); result.addAll(list2);
result.addAll(list3); result.addAll(list3);
@@ -405,11 +414,14 @@ public class DayJob {
stringBuilder7.append("percentile(i_").append(i).append(",95) AS i_").append(i).append(","); stringBuilder7.append("percentile(i_").append(i).append(",95) AS i_").append(i).append(",");
} }
} }
stringBuilder8.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and value_type = 'CP95' group by line_id,phasic_type,value_type,quality_flag tz('Asia/Shanghai')"); stringBuilder8.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and value_type = 'AVG' group by line_id,phasic_type,value_type,quality_flag tz('Asia/Shanghai')");
String sql4 = "select "+stringBuilder7+" from data_i where "+stringBuilder+stringBuilder8; String sql4 = "select "+stringBuilder7+" from data_i where "+stringBuilder+stringBuilder8;
QueryResult sqlResult4 = influxDbUtils.query(sql4); QueryResult sqlResult4 = influxDbUtils.query(sql4);
InfluxDBResultMapper resultMapper4 = new InfluxDBResultMapper(); InfluxDBResultMapper resultMapper4 = new InfluxDBResultMapper();
List<DataI> list4 = resultMapper4.toPOJO(sqlResult4, DataI.class); List<DataI> list4 = resultMapper4.toPOJO(sqlResult4, DataI.class);
list4.forEach(item->{
item.setValueType("CP95");
});
result.addAll(list1); result.addAll(list1);
result.addAll(list2); result.addAll(list2);
result.addAll(list3); result.addAll(list3);
@@ -510,25 +522,37 @@ public class DayJob {
List<DataFlicker> result = new ArrayList<>(); List<DataFlicker> result = new ArrayList<>();
StringBuilder stringBuilder = lineStringBuilder(lineList); StringBuilder stringBuilder = lineStringBuilder(lineList);
//最小值 //最小值
String sql1 = "select min(fluc) AS fluc,min(plt) AS plt,min(pst) AS pst from data_flicker where "+stringBuilder+" time >= '" + startTime + "' and time <= '" + endTime + "' and value_type = 'MIN' group by line_id,phasic_type,value_type,quality_flag tz('Asia/Shanghai')"; String sql1 = "select min(fluc) AS fluc,min(plt) AS plt,min(pst) AS pst from data_flicker where "+stringBuilder+" time >= '" + startTime + "' and time <= '" + endTime + "' group by line_id,phasic_type,quality_flag tz('Asia/Shanghai')";
QueryResult sqlResult1 = influxDbUtils.query(sql1); QueryResult sqlResult1 = influxDbUtils.query(sql1);
InfluxDBResultMapper resultMapper1 = new InfluxDBResultMapper(); InfluxDBResultMapper resultMapper1 = new InfluxDBResultMapper();
List<DataFlicker> list1 = resultMapper1.toPOJO(sqlResult1, DataFlicker.class); List<DataFlicker> list1 = resultMapper1.toPOJO(sqlResult1, DataFlicker.class);
list1.forEach(item->{
item.setValueType("MIN");
});
//最大值 //最大值
String sql2 = "select max(fluc) AS fluc,max(plt) AS plt,max(pst) AS pst from data_flicker where "+stringBuilder+" time >= '" + startTime + "' and time <= '" + endTime + "' and value_type = 'MAX' group by line_id,phasic_type,value_type,quality_flag tz('Asia/Shanghai')"; String sql2 = "select max(fluc) AS fluc,max(plt) AS plt,max(pst) AS pst from data_flicker where "+stringBuilder+" time >= '" + startTime + "' and time <= '" + endTime + "' group by line_id,phasic_type,quality_flag tz('Asia/Shanghai')";
QueryResult sqlResult2 = influxDbUtils.query(sql2); QueryResult sqlResult2 = influxDbUtils.query(sql2);
InfluxDBResultMapper resultMapper2 = new InfluxDBResultMapper(); InfluxDBResultMapper resultMapper2 = new InfluxDBResultMapper();
List<DataFlicker> list2 = resultMapper2.toPOJO(sqlResult2, DataFlicker.class); List<DataFlicker> list2 = resultMapper2.toPOJO(sqlResult2, DataFlicker.class);
list2.forEach(item->{
item.setValueType("MAX");
});
//平均值 //平均值
String sql3 = "select mean(fluc) AS fluc,mean(plt) AS plt,mean(pst) AS pst from data_flicker where "+stringBuilder+" time >= '" + startTime + "' and time <= '" + endTime + "' and value_type = 'AVG' group by line_id,phasic_type,value_type,quality_flag tz('Asia/Shanghai')"; String sql3 = "select mean(fluc) AS fluc,mean(plt) AS plt,mean(pst) AS pst from data_flicker where "+stringBuilder+" time >= '" + startTime + "' and time <= '" + endTime + "' group by line_id,phasic_type,quality_flag tz('Asia/Shanghai')";
QueryResult sqlResult3 = influxDbUtils.query(sql3); QueryResult sqlResult3 = influxDbUtils.query(sql3);
InfluxDBResultMapper resultMapper3= new InfluxDBResultMapper(); InfluxDBResultMapper resultMapper3= new InfluxDBResultMapper();
List<DataFlicker> list3 = resultMapper3.toPOJO(sqlResult3, DataFlicker.class); List<DataFlicker> list3 = resultMapper3.toPOJO(sqlResult3, DataFlicker.class);
list3.forEach(item->{
item.setValueType("AVG");
});
//CP95值 //CP95值
String sql4 = "select percentile(fluc,95) AS fluc,percentile(plt,95) AS plt,percentile(pst,95) AS pst from data_flicker where "+stringBuilder+" time >= '" + startTime + "' and time <= '" + endTime + "' and value_type = 'CP95' group by line_id,phasic_type,value_type,quality_flag tz('Asia/Shanghai')"; String sql4 = "select percentile(fluc,95) AS fluc,percentile(plt,95) AS plt,percentile(pst,95) AS pst from data_flicker where "+stringBuilder+" time >= '" + startTime + "' and time <= '" + endTime + "' group by line_id,phasic_type,quality_flag tz('Asia/Shanghai')";
QueryResult sqlResult4 = influxDbUtils.query(sql4); QueryResult sqlResult4 = influxDbUtils.query(sql4);
InfluxDBResultMapper resultMapper4= new InfluxDBResultMapper(); InfluxDBResultMapper resultMapper4= new InfluxDBResultMapper();
List<DataFlicker> list4 = resultMapper4.toPOJO(sqlResult4, DataFlicker.class); List<DataFlicker> list4 = resultMapper4.toPOJO(sqlResult4, DataFlicker.class);
list4.forEach(item->{
item.setValueType("CP95");
});
result.addAll(list1); result.addAll(list1);
result.addAll(list2); result.addAll(list2);
result.addAll(list3); result.addAll(list3);
@@ -576,25 +600,37 @@ public class DayJob {
List<DataFluc> result = new ArrayList<>(); List<DataFluc> result = new ArrayList<>();
StringBuilder stringBuilder = lineStringBuilder(lineList); StringBuilder stringBuilder = lineStringBuilder(lineList);
//最小值 //最小值
String sql1 = "select min(fluc) AS fluc,min(fluccf) AS fluccf from data_fluc where "+stringBuilder+" time >= '" + startTime + "' and time <= '" + endTime + "' and value_type = 'MIN' group by line_id,phasic_type,value_type,quality_flag tz('Asia/Shanghai')"; String sql1 = "select min(fluc) AS fluc,min(fluccf) AS fluccf from data_fluc where "+stringBuilder+" time >= '" + startTime + "' and time <= '" + endTime + "' group by line_id,phasic_type,quality_flag tz('Asia/Shanghai')";
QueryResult sqlResult1 = influxDbUtils.query(sql1); QueryResult sqlResult1 = influxDbUtils.query(sql1);
InfluxDBResultMapper resultMapper1 = new InfluxDBResultMapper(); InfluxDBResultMapper resultMapper1 = new InfluxDBResultMapper();
List<DataFluc> list1 = resultMapper1.toPOJO(sqlResult1, DataFluc.class); List<DataFluc> list1 = resultMapper1.toPOJO(sqlResult1, DataFluc.class);
list1.forEach(item->{
item.setValueType("MIN");
});
//最大值 //最大值
String sql2 = "select max(fluc) AS fluc,max(fluccf) AS fluccf from data_fluc where "+stringBuilder+" time >= '" + startTime + "' and time <= '" + endTime + "' and value_type = 'MAX' group by line_id,phasic_type,value_type,quality_flag tz('Asia/Shanghai')"; String sql2 = "select max(fluc) AS fluc,max(fluccf) AS fluccf from data_fluc where "+stringBuilder+" time >= '" + startTime + "' and time <= '" + endTime + "' group by line_id,phasic_type,quality_flag tz('Asia/Shanghai')";
QueryResult sqlResult2 = influxDbUtils.query(sql2); QueryResult sqlResult2 = influxDbUtils.query(sql2);
InfluxDBResultMapper resultMapper2 = new InfluxDBResultMapper(); InfluxDBResultMapper resultMapper2 = new InfluxDBResultMapper();
List<DataFluc> list2 = resultMapper2.toPOJO(sqlResult2, DataFluc.class); List<DataFluc> list2 = resultMapper2.toPOJO(sqlResult2, DataFluc.class);
list2.forEach(item->{
item.setValueType("MAX");
});
//平均值 //平均值
String sql3 = "select mean(fluc) AS fluc,mean(fluccf) AS fluccf from data_fluc where "+stringBuilder+" time >= '" + startTime + "' and time <= '" + endTime + "' and value_type = 'AVG' group by line_id,phasic_type,value_type,quality_flag tz('Asia/Shanghai')"; String sql3 = "select mean(fluc) AS fluc,mean(fluccf) AS fluccf from data_fluc where "+stringBuilder+" time >= '" + startTime + "' and time <= '" + endTime + "' group by line_id,phasic_type,quality_flag tz('Asia/Shanghai')";
QueryResult sqlResult3 = influxDbUtils.query(sql3); QueryResult sqlResult3 = influxDbUtils.query(sql3);
InfluxDBResultMapper resultMapper3= new InfluxDBResultMapper(); InfluxDBResultMapper resultMapper3= new InfluxDBResultMapper();
List<DataFluc> list3 = resultMapper3.toPOJO(sqlResult3, DataFluc.class); List<DataFluc> list3 = resultMapper3.toPOJO(sqlResult3, DataFluc.class);
list3.forEach(item->{
item.setValueType("AVG");
});
//CP95值 //CP95值
String sql4 = "select percentile(fluc,95) AS fluc,percentile(fluccf,95) AS fluccf from data_fluc where "+stringBuilder+" time >= '" + startTime + "' and time <= '" + endTime + "' and value_type = 'CP95' group by line_id,phasic_type,value_type,quality_flag tz('Asia/Shanghai')"; String sql4 = "select percentile(fluc,95) AS fluc,percentile(fluccf,95) AS fluccf from data_fluc where "+stringBuilder+" time >= '" + startTime + "' and time <= '" + endTime + "' group by line_id,phasic_type,quality_flag tz('Asia/Shanghai')";
QueryResult sqlResult4 = influxDbUtils.query(sql4); QueryResult sqlResult4 = influxDbUtils.query(sql4);
InfluxDBResultMapper resultMapper4= new InfluxDBResultMapper(); InfluxDBResultMapper resultMapper4= new InfluxDBResultMapper();
List<DataFluc> list4 = resultMapper4.toPOJO(sqlResult4, DataFluc.class); List<DataFluc> list4 = resultMapper4.toPOJO(sqlResult4, DataFluc.class);
list4.forEach(item->{
item.setValueType("CP95");
});
result.addAll(list1); result.addAll(list1);
result.addAll(list2); result.addAll(list2);
result.addAll(list3); result.addAll(list3);
@@ -695,11 +731,14 @@ public class DayJob {
stringBuilder7.append("percentile(i_").append(i).append(",95) AS i_").append(i).append(","); stringBuilder7.append("percentile(i_").append(i).append(",95) AS i_").append(i).append(",");
} }
} }
stringBuilder8.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and value_type = 'CP95' group by line_id,phasic_type,value_type,quality_flag tz('Asia/Shanghai')"); stringBuilder8.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and value_type = 'AVG' group by line_id,phasic_type,value_type,quality_flag tz('Asia/Shanghai')");
String sql4 = "select "+stringBuilder7+" from data_harmphasic_i where "+stringBuilder+stringBuilder8; String sql4 = "select "+stringBuilder7+" from data_harmphasic_i where "+stringBuilder+stringBuilder8;
QueryResult sqlResult4 = influxDbUtils.query(sql4); QueryResult sqlResult4 = influxDbUtils.query(sql4);
InfluxDBResultMapper resultMapper4 = new InfluxDBResultMapper(); InfluxDBResultMapper resultMapper4 = new InfluxDBResultMapper();
List<DataHarmPhasicI> list4 = resultMapper4.toPOJO(sqlResult4, DataHarmPhasicI.class); List<DataHarmPhasicI> list4 = resultMapper4.toPOJO(sqlResult4, DataHarmPhasicI.class);
list4.forEach(item->{
item.setValueType("CP95");
});
result.addAll(list1); result.addAll(list1);
result.addAll(list2); result.addAll(list2);
result.addAll(list3); result.addAll(list3);
@@ -847,11 +886,14 @@ public class DayJob {
stringBuilder7.append("percentile(v_").append(i).append(",95) AS v_").append(i).append(","); stringBuilder7.append("percentile(v_").append(i).append(",95) AS v_").append(i).append(",");
} }
} }
stringBuilder8.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and value_type = 'CP95' group by line_id,phasic_type,value_type,quality_flag tz('Asia/Shanghai')"); stringBuilder8.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and value_type = 'AVG' group by line_id,phasic_type,value_type,quality_flag tz('Asia/Shanghai')");
String sql4 = "select "+stringBuilder7+" from data_harmphasic_v where "+stringBuilder+stringBuilder8; String sql4 = "select "+stringBuilder7+" from data_harmphasic_v where "+stringBuilder+stringBuilder8;
QueryResult sqlResult4 = influxDbUtils.query(sql4); QueryResult sqlResult4 = influxDbUtils.query(sql4);
InfluxDBResultMapper resultMapper4 = new InfluxDBResultMapper(); InfluxDBResultMapper resultMapper4 = new InfluxDBResultMapper();
List<DataHarmPhasicV> list4 = resultMapper4.toPOJO(sqlResult4, DataHarmPhasicV.class); List<DataHarmPhasicV> list4 = resultMapper4.toPOJO(sqlResult4, DataHarmPhasicV.class);
list4.forEach(item->{
item.setValueType("CP95");
});
result.addAll(list1); result.addAll(list1);
result.addAll(list2); result.addAll(list2);
result.addAll(list3); result.addAll(list3);
@@ -1003,11 +1045,14 @@ public class DayJob {
stringBuilder7.append("percentile(p_").append(i).append(",95) AS p_").append(i).append(","); stringBuilder7.append("percentile(p_").append(i).append(",95) AS p_").append(i).append(",");
} }
} }
stringBuilder8.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and value_type = 'CP95' group by line_id,phasic_type,value_type,quality_flag tz('Asia/Shanghai')"); stringBuilder8.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and value_type = 'AVG' group by line_id,phasic_type,value_type,quality_flag tz('Asia/Shanghai')");
String sql4 = "select "+stringBuilder7+" from data_harmpower_p where "+stringBuilder+stringBuilder8; String sql4 = "select "+stringBuilder7+" from data_harmpower_p where "+stringBuilder+stringBuilder8;
QueryResult sqlResult4 = influxDbUtils.query(sql4); QueryResult sqlResult4 = influxDbUtils.query(sql4);
InfluxDBResultMapper resultMapper4 = new InfluxDBResultMapper(); InfluxDBResultMapper resultMapper4 = new InfluxDBResultMapper();
List<DataHarmPowerP> list4 = resultMapper4.toPOJO(sqlResult4, DataHarmPowerP.class); List<DataHarmPowerP> list4 = resultMapper4.toPOJO(sqlResult4, DataHarmPowerP.class);
list4.forEach(item->{
item.setValueType("CP95");
});
result.addAll(list1); result.addAll(list1);
result.addAll(list2); result.addAll(list2);
result.addAll(list3); result.addAll(list3);
@@ -1163,11 +1208,14 @@ public class DayJob {
stringBuilder7.append("percentile(q_").append(i).append(",95) AS q_").append(i).append(","); stringBuilder7.append("percentile(q_").append(i).append(",95) AS q_").append(i).append(",");
} }
} }
stringBuilder8.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and value_type = 'CP95' group by line_id,phasic_type,value_type,quality_flag tz('Asia/Shanghai')"); stringBuilder8.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and value_type = 'AVG' group by line_id,phasic_type,value_type,quality_flag tz('Asia/Shanghai')");
String sql4 = "select "+stringBuilder7+" from data_harmpower_q where "+stringBuilder+stringBuilder8; String sql4 = "select "+stringBuilder7+" from data_harmpower_q where "+stringBuilder+stringBuilder8;
QueryResult sqlResult4 = influxDbUtils.query(sql4); QueryResult sqlResult4 = influxDbUtils.query(sql4);
InfluxDBResultMapper resultMapper4 = new InfluxDBResultMapper(); InfluxDBResultMapper resultMapper4 = new InfluxDBResultMapper();
List<DataHarmPowerQ> list4 = resultMapper4.toPOJO(sqlResult4, DataHarmPowerQ.class); List<DataHarmPowerQ> list4 = resultMapper4.toPOJO(sqlResult4, DataHarmPowerQ.class);
list4.forEach(item->{
item.setValueType("CP95");
});
result.addAll(list1); result.addAll(list1);
result.addAll(list2); result.addAll(list2);
result.addAll(list3); result.addAll(list3);
@@ -1320,11 +1368,14 @@ public class DayJob {
stringBuilder7.append("percentile(s_").append(i).append(",95) AS s_").append(i).append(","); stringBuilder7.append("percentile(s_").append(i).append(",95) AS s_").append(i).append(",");
} }
} }
stringBuilder8.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and value_type = 'CP95' group by line_id,phasic_type,value_type,quality_flag tz('Asia/Shanghai')"); stringBuilder8.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and value_type = 'AVG' group by line_id,phasic_type,value_type,quality_flag tz('Asia/Shanghai')");
String sql4 = "select "+stringBuilder7+" from data_harmpower_s where "+stringBuilder+stringBuilder8; String sql4 = "select "+stringBuilder7+" from data_harmpower_s where "+stringBuilder+stringBuilder8;
QueryResult sqlResult4 = influxDbUtils.query(sql4); QueryResult sqlResult4 = influxDbUtils.query(sql4);
InfluxDBResultMapper resultMapper4 = new InfluxDBResultMapper(); InfluxDBResultMapper resultMapper4 = new InfluxDBResultMapper();
List<DataHarmPowerS> list4 = resultMapper4.toPOJO(sqlResult4, DataHarmPowerS.class); List<DataHarmPowerS> list4 = resultMapper4.toPOJO(sqlResult4, DataHarmPowerS.class);
list4.forEach(item->{
item.setValueType("CP95");
});
result.addAll(list1); result.addAll(list1);
result.addAll(list2); result.addAll(list2);
result.addAll(list3); result.addAll(list3);
@@ -1473,11 +1524,14 @@ public class DayJob {
stringBuilder7.append("percentile(i_").append(i).append(",95) AS i_").append(i).append(","); stringBuilder7.append("percentile(i_").append(i).append(",95) AS i_").append(i).append(",");
} }
} }
stringBuilder8.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and value_type = 'CP95' group by line_id,phasic_type,value_type,quality_flag tz('Asia/Shanghai')"); stringBuilder8.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and value_type = 'AVG' group by line_id,phasic_type,value_type,quality_flag tz('Asia/Shanghai')");
String sql4 = "select "+stringBuilder7+" from data_harmrate_i where "+stringBuilder+stringBuilder8; String sql4 = "select "+stringBuilder7+" from data_harmrate_i where "+stringBuilder+stringBuilder8;
QueryResult sqlResult4 = influxDbUtils.query(sql4); QueryResult sqlResult4 = influxDbUtils.query(sql4);
InfluxDBResultMapper resultMapper4 = new InfluxDBResultMapper(); InfluxDBResultMapper resultMapper4 = new InfluxDBResultMapper();
List<DataHarmRateI> list4 = resultMapper4.toPOJO(sqlResult4, DataHarmRateI.class); List<DataHarmRateI> list4 = resultMapper4.toPOJO(sqlResult4, DataHarmRateI.class);
list4.forEach(item->{
item.setValueType("CP95");
});
result.addAll(list1); result.addAll(list1);
result.addAll(list2); result.addAll(list2);
result.addAll(list3); result.addAll(list3);
@@ -1625,11 +1679,14 @@ public class DayJob {
stringBuilder7.append("percentile(v_").append(i).append(",95) AS v_").append(i).append(","); stringBuilder7.append("percentile(v_").append(i).append(",95) AS v_").append(i).append(",");
} }
} }
stringBuilder8.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and value_type = 'CP95' group by line_id,phasic_type,value_type,quality_flag tz('Asia/Shanghai')"); stringBuilder8.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and value_type = 'AVG' group by line_id,phasic_type,value_type,quality_flag tz('Asia/Shanghai')");
String sql4 = "select "+stringBuilder7+" from data_harmrate_v where "+stringBuilder+stringBuilder8; String sql4 = "select "+stringBuilder7+" from data_harmrate_v where "+stringBuilder+stringBuilder8;
QueryResult sqlResult4 = influxDbUtils.query(sql4); QueryResult sqlResult4 = influxDbUtils.query(sql4);
InfluxDBResultMapper resultMapper4 = new InfluxDBResultMapper(); InfluxDBResultMapper resultMapper4 = new InfluxDBResultMapper();
List<DataHarmRateV> list4 = resultMapper4.toPOJO(sqlResult4, DataHarmRateV.class); List<DataHarmRateV> list4 = resultMapper4.toPOJO(sqlResult4, DataHarmRateV.class);
list4.forEach(item->{
item.setValueType("CP95");
});
result.addAll(list1); result.addAll(list1);
result.addAll(list2); result.addAll(list2);
result.addAll(list3); result.addAll(list3);
@@ -1777,11 +1834,14 @@ public class DayJob {
stringBuilder7.append("percentile(i_").append(i).append(",95) AS i_").append(i).append(","); stringBuilder7.append("percentile(i_").append(i).append(",95) AS i_").append(i).append(",");
} }
} }
stringBuilder8.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and value_type = 'CP95' group by line_id,phasic_type,value_type,quality_flag tz('Asia/Shanghai')"); stringBuilder8.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and value_type = 'AVG' group by line_id,phasic_type,value_type,quality_flag tz('Asia/Shanghai')");
String sql4 = "select "+stringBuilder7+" from data_inharm_i where "+stringBuilder+stringBuilder8; String sql4 = "select "+stringBuilder7+" from data_inharm_i where "+stringBuilder+stringBuilder8;
QueryResult sqlResult4 = influxDbUtils.query(sql4); QueryResult sqlResult4 = influxDbUtils.query(sql4);
InfluxDBResultMapper resultMapper4 = new InfluxDBResultMapper(); InfluxDBResultMapper resultMapper4 = new InfluxDBResultMapper();
List<DataInHarmI> list4 = resultMapper4.toPOJO(sqlResult4, DataInHarmI.class); List<DataInHarmI> list4 = resultMapper4.toPOJO(sqlResult4, DataInHarmI.class);
list4.forEach(item->{
item.setValueType("CP95");
});
result.addAll(list1); result.addAll(list1);
result.addAll(list2); result.addAll(list2);
result.addAll(list3); result.addAll(list3);
@@ -1929,11 +1989,14 @@ public class DayJob {
stringBuilder7.append("percentile(v_").append(i).append(",95) AS v_").append(i).append(","); stringBuilder7.append("percentile(v_").append(i).append(",95) AS v_").append(i).append(",");
} }
} }
stringBuilder8.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and value_type = 'CP95' group by line_id,phasic_type,value_type,quality_flag tz('Asia/Shanghai')"); stringBuilder8.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and value_type = 'AVG' group by line_id,phasic_type,value_type,quality_flag tz('Asia/Shanghai')");
String sql4 = "select "+stringBuilder7+" from data_inharm_v where "+stringBuilder+stringBuilder8; String sql4 = "select "+stringBuilder7+" from data_inharm_v where "+stringBuilder+stringBuilder8;
QueryResult sqlResult4 = influxDbUtils.query(sql4); QueryResult sqlResult4 = influxDbUtils.query(sql4);
InfluxDBResultMapper resultMapper4 = new InfluxDBResultMapper(); InfluxDBResultMapper resultMapper4 = new InfluxDBResultMapper();
List<DataInHarmV> list4 = resultMapper4.toPOJO(sqlResult4, DataInHarmV.class); List<DataInHarmV> list4 = resultMapper4.toPOJO(sqlResult4, DataInHarmV.class);
list4.forEach(item->{
item.setValueType("CP95");
});
result.addAll(list1); result.addAll(list1);
result.addAll(list2); result.addAll(list2);
result.addAll(list3); result.addAll(list3);
@@ -2082,11 +2145,14 @@ public class DayJob {
stringBuilder7.append("percentile(i_").append(i).append(",95) AS i_").append(i).append(","); stringBuilder7.append("percentile(i_").append(i).append(",95) AS i_").append(i).append(",");
} }
} }
stringBuilder8.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and value_type = 'CP95' group by line_id,phasic_type,value_type,quality_flag tz('Asia/Shanghai')"); stringBuilder8.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and value_type = 'AVG' group by line_id,phasic_type,value_type,quality_flag tz('Asia/Shanghai')");
String sql4 = "select "+stringBuilder7+" from data_inharmrate_i where "+stringBuilder+stringBuilder8; String sql4 = "select "+stringBuilder7+" from data_inharmrate_i where "+stringBuilder+stringBuilder8;
QueryResult sqlResult4 = influxDbUtils.query(sql4); QueryResult sqlResult4 = influxDbUtils.query(sql4);
InfluxDBResultMapper resultMapper4 = new InfluxDBResultMapper(); InfluxDBResultMapper resultMapper4 = new InfluxDBResultMapper();
List<DataInHarmRateI> list4 = resultMapper4.toPOJO(sqlResult4, DataInHarmRateI.class); List<DataInHarmRateI> list4 = resultMapper4.toPOJO(sqlResult4, DataInHarmRateI.class);
list4.forEach(item->{
item.setValueType("CP95");
});
result.addAll(list1); result.addAll(list1);
result.addAll(list2); result.addAll(list2);
result.addAll(list3); result.addAll(list3);
@@ -2234,11 +2300,14 @@ public class DayJob {
stringBuilder7.append("percentile(v_").append(i).append(",95) AS v_").append(i).append(","); stringBuilder7.append("percentile(v_").append(i).append(",95) AS v_").append(i).append(",");
} }
} }
stringBuilder8.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and value_type = 'CP95' group by line_id,phasic_type,value_type,quality_flag tz('Asia/Shanghai')"); stringBuilder8.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and value_type = 'AVG' group by line_id,phasic_type,value_type,quality_flag tz('Asia/Shanghai')");
String sql4 = "select "+stringBuilder7+" from data_inharmrate_v where "+stringBuilder+stringBuilder8; String sql4 = "select "+stringBuilder7+" from data_inharmrate_v where "+stringBuilder+stringBuilder8;
QueryResult sqlResult4 = influxDbUtils.query(sql4); QueryResult sqlResult4 = influxDbUtils.query(sql4);
InfluxDBResultMapper resultMapper4 = new InfluxDBResultMapper(); InfluxDBResultMapper resultMapper4 = new InfluxDBResultMapper();
List<DataInHarmRateV> list4 = resultMapper4.toPOJO(sqlResult4, DataInHarmRateV.class); List<DataInHarmRateV> list4 = resultMapper4.toPOJO(sqlResult4, DataInHarmRateV.class);
list4.forEach(item->{
item.setValueType("CP95");
});
result.addAll(list1); result.addAll(list1);
result.addAll(list2); result.addAll(list2);
result.addAll(list3); result.addAll(list3);
@@ -2332,25 +2401,37 @@ public class DayJob {
List<DataPlt> result = new ArrayList<>(); List<DataPlt> result = new ArrayList<>();
StringBuilder stringBuilder = lineStringBuilder(lineList); StringBuilder stringBuilder = lineStringBuilder(lineList);
//最小值 //最小值
String sql1 = "select min(plt) AS plt from data_plt where "+stringBuilder+" time >= '" + startTime + "' and time <= '" + endTime + "' and value_type = 'MIN' group by line_id,phasic_type,value_type,quality_flag tz('Asia/Shanghai')"; String sql1 = "select min(plt) AS plt from data_plt where "+stringBuilder+" time >= '" + startTime + "' and time <= '" + endTime + "' group by line_id,phasic_type,quality_flag tz('Asia/Shanghai')";
QueryResult sqlResult1 = influxDbUtils.query(sql1); QueryResult sqlResult1 = influxDbUtils.query(sql1);
InfluxDBResultMapper resultMapper1 = new InfluxDBResultMapper(); InfluxDBResultMapper resultMapper1 = new InfluxDBResultMapper();
List<DataPlt> list1 = resultMapper1.toPOJO(sqlResult1, DataPlt.class); List<DataPlt> list1 = resultMapper1.toPOJO(sqlResult1, DataPlt.class);
list1.forEach(item->{
item.setValueType("MIN");
});
//最大值 //最大值
String sql2 = "select max(plt) AS plt from data_plt where "+stringBuilder+" time >= '" + startTime + "' and time <= '" + endTime + "' and value_type = 'MAX' group by line_id,phasic_type,value_type,quality_flag tz('Asia/Shanghai')"; String sql2 = "select max(plt) AS plt from data_plt where "+stringBuilder+" time >= '" + startTime + "' and time <= '" + endTime + "' group by line_id,phasic_type,quality_flag tz('Asia/Shanghai')";
QueryResult sqlResult2 = influxDbUtils.query(sql2); QueryResult sqlResult2 = influxDbUtils.query(sql2);
InfluxDBResultMapper resultMapper2 = new InfluxDBResultMapper(); InfluxDBResultMapper resultMapper2 = new InfluxDBResultMapper();
List<DataPlt> list2 = resultMapper2.toPOJO(sqlResult2, DataPlt.class); List<DataPlt> list2 = resultMapper2.toPOJO(sqlResult2, DataPlt.class);
list2.forEach(item->{
item.setValueType("MAX");
});
//平均值 //平均值
String sql3 = "select mean(plt) AS plt from data_plt where "+stringBuilder+" time >= '" + startTime + "' and time <= '" + endTime + "' and value_type = 'AVG' group by line_id,phasic_type,value_type,quality_flag tz('Asia/Shanghai')"; String sql3 = "select mean(plt) AS plt from data_plt where "+stringBuilder+" time >= '" + startTime + "' and time <= '" + endTime + "' group by line_id,phasic_type,quality_flag tz('Asia/Shanghai')";
QueryResult sqlResult3 = influxDbUtils.query(sql3); QueryResult sqlResult3 = influxDbUtils.query(sql3);
InfluxDBResultMapper resultMapper3= new InfluxDBResultMapper(); InfluxDBResultMapper resultMapper3= new InfluxDBResultMapper();
List<DataPlt> list3 = resultMapper3.toPOJO(sqlResult3, DataPlt.class); List<DataPlt> list3 = resultMapper3.toPOJO(sqlResult3, DataPlt.class);
list3.forEach(item->{
item.setValueType("AVG");
});
//CP95值 //CP95值
String sql4 = "select percentile(plt,95) AS plt from data_plt where "+stringBuilder+" time >= '" + startTime + "' and time <= '" + endTime + "' and value_type = 'CP95' group by line_id,phasic_type,value_type,quality_flag tz('Asia/Shanghai')"; String sql4 = "select percentile(plt,95) AS plt from data_plt where "+stringBuilder+" time >= '" + startTime + "' and time <= '" + endTime + "' group by line_id,phasic_type,quality_flag tz('Asia/Shanghai')";
QueryResult sqlResult4 = influxDbUtils.query(sql4); QueryResult sqlResult4 = influxDbUtils.query(sql4);
InfluxDBResultMapper resultMapper4= new InfluxDBResultMapper(); InfluxDBResultMapper resultMapper4= new InfluxDBResultMapper();
List<DataPlt> list4 = resultMapper4.toPOJO(sqlResult4, DataPlt.class); List<DataPlt> list4 = resultMapper4.toPOJO(sqlResult4, DataPlt.class);
list4.forEach(item->{
item.setValueType("CP95");
});
result.addAll(list1); result.addAll(list1);
result.addAll(list2); result.addAll(list2);
result.addAll(list3); result.addAll(list3);

View File

@@ -956,7 +956,7 @@ public class LimitRateJob {
stringBuilder.append("line_id='").append(line.get(i)).append("') and "); stringBuilder.append("line_id='").append(line.get(i)).append("') and ");
} }
} }
stringBuilder.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and phasic_type = 'A' and value_type = 'AVG' and quality_flag = '1' group by line_id tz('Asia/Shanghai')"); stringBuilder.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and phasic_type = 'A' and value_type = 'AVG' and quality_flag = '0' group by line_id tz('Asia/Shanghai')");
String sql = "SELECT count(freq) AS all_time FROM data_v where " + stringBuilder; String sql = "SELECT count(freq) AS all_time FROM data_v where " + stringBuilder;
QueryResult sqlResult = influxDbUtils.query(sql); QueryResult sqlResult = influxDbUtils.query(sql);
InfluxDBResultMapper resultMapper = new InfluxDBResultMapper(); InfluxDBResultMapper resultMapper = new InfluxDBResultMapper();
@@ -987,7 +987,7 @@ public class LimitRateJob {
stringBuilder.append("line_id='").append(line.get(i)).append("') and "); stringBuilder.append("line_id='").append(line.get(i)).append("') and ");
} }
} }
stringBuilder.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and phasic_type = 'A' and value_type = 'AVG' and quality_flag = '1' group by line_id tz('Asia/Shanghai')"); stringBuilder.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and phasic_type = 'A' and quality_flag = '0' group by line_id tz('Asia/Shanghai')");
String sql = "SELECT count(plt) AS flicker_all_time FROM data_plt where " + stringBuilder; String sql = "SELECT count(plt) AS flicker_all_time FROM data_plt where " + stringBuilder;
QueryResult sqlResult = influxDbUtils.query(sql); QueryResult sqlResult = influxDbUtils.query(sql);
InfluxDBResultMapper resultMapper = new InfluxDBResultMapper(); InfluxDBResultMapper resultMapper = new InfluxDBResultMapper();
@@ -1018,7 +1018,7 @@ public class LimitRateJob {
stringBuilder.append("line_id='").append(line.get(i)).append("') and "); stringBuilder.append("line_id='").append(line.get(i)).append("') and ");
} }
} }
stringBuilder.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and (phasic_type = 'A' or phasic_type = 'B' or phasic_type = 'C') and value_type = 'CP95' and quality_flag = '1' tz('Asia/Shanghai')"); stringBuilder.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and (phasic_type = 'A' or phasic_type = 'B' or phasic_type = 'C') and value_type = 'CP95' and quality_flag = '0' tz('Asia/Shanghai')");
String sql = "SELECT * FROM data_harmrate_v WHERE " + stringBuilder; String sql = "SELECT * FROM data_harmrate_v WHERE " + stringBuilder;
QueryResult sqlResult = influxDbUtils.query(sql); QueryResult sqlResult = influxDbUtils.query(sql);
InfluxDBResultMapper resultMapper = new InfluxDBResultMapper(); InfluxDBResultMapper resultMapper = new InfluxDBResultMapper();
@@ -1049,7 +1049,7 @@ public class LimitRateJob {
stringBuilder.append("line_id='").append(line.get(i)).append("') and "); stringBuilder.append("line_id='").append(line.get(i)).append("') and ");
} }
} }
stringBuilder.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and (phasic_type = 'A' or phasic_type = 'B' or phasic_type = 'C') and value_type = 'CP95' and quality_flag = '1' tz('Asia/Shanghai')"); stringBuilder.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and (phasic_type = 'A' or phasic_type = 'B' or phasic_type = 'C') and value_type = 'CP95' and quality_flag = '0' tz('Asia/Shanghai')");
String sql = "SELECT * FROM data_i WHERE " + stringBuilder; String sql = "SELECT * FROM data_i WHERE " + stringBuilder;
QueryResult sqlResult = influxDbUtils.query(sql); QueryResult sqlResult = influxDbUtils.query(sql);
InfluxDBResultMapper resultMapper = new InfluxDBResultMapper(); InfluxDBResultMapper resultMapper = new InfluxDBResultMapper();
@@ -1080,7 +1080,7 @@ public class LimitRateJob {
stringBuilder.append("line_id='").append(line.get(i)).append("') and "); stringBuilder.append("line_id='").append(line.get(i)).append("') and ");
} }
} }
stringBuilder.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and (phasic_type = 'A' or phasic_type = 'B' or phasic_type = 'C') and value_type = 'CP95' and quality_flag = '1' tz('Asia/Shanghai')"); stringBuilder.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and (phasic_type = 'A' or phasic_type = 'B' or phasic_type = 'C') and value_type = 'CP95' and quality_flag = '0' tz('Asia/Shanghai')");
String sql = "SELECT * FROM data_inharm_v WHERE " + stringBuilder; String sql = "SELECT * FROM data_inharm_v WHERE " + stringBuilder;
QueryResult sqlResult = influxDbUtils.query(sql); QueryResult sqlResult = influxDbUtils.query(sql);
InfluxDBResultMapper resultMapper = new InfluxDBResultMapper(); InfluxDBResultMapper resultMapper = new InfluxDBResultMapper();
@@ -1111,7 +1111,7 @@ public class LimitRateJob {
stringBuilder.append("line_id='").append(line.get(i)).append("') and "); stringBuilder.append("line_id='").append(line.get(i)).append("') and ");
} }
} }
stringBuilder.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and (phasic_type = 'A' or phasic_type = 'B' or phasic_type = 'C') and value_type = 'CP95' and quality_flag = '1' tz('Asia/Shanghai')"); stringBuilder.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and (phasic_type = 'A' or phasic_type = 'B' or phasic_type = 'C') and value_type = 'CP95' and quality_flag = '0' tz('Asia/Shanghai')");
String sql = "SELECT * FROM data_v WHERE " + stringBuilder; String sql = "SELECT * FROM data_v WHERE " + stringBuilder;
QueryResult sqlResult = influxDbUtils.query(sql); QueryResult sqlResult = influxDbUtils.query(sql);
InfluxDBResultMapper resultMapper = new InfluxDBResultMapper(); InfluxDBResultMapper resultMapper = new InfluxDBResultMapper();
@@ -1143,7 +1143,7 @@ public class LimitRateJob {
stringBuilder.append("line_id='").append(line.get(i)).append("') and "); stringBuilder.append("line_id='").append(line.get(i)).append("') and ");
} }
} }
stringBuilder.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and phasic_type = 'T' and (value_type = 'CP95' or value_type = 'MAX') and quality_flag = '1' tz('Asia/Shanghai')"); stringBuilder.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and phasic_type = 'T' and (value_type = 'CP95' or value_type = 'MAX') and quality_flag = '0' tz('Asia/Shanghai')");
String sql = "SELECT * FROM data_v WHERE " + stringBuilder; String sql = "SELECT * FROM data_v WHERE " + stringBuilder;
QueryResult sqlResult = influxDbUtils.query(sql); QueryResult sqlResult = influxDbUtils.query(sql);
InfluxDBResultMapper resultMapper = new InfluxDBResultMapper(); InfluxDBResultMapper resultMapper = new InfluxDBResultMapper();
@@ -1174,7 +1174,7 @@ public class LimitRateJob {
stringBuilder.append("line_id='").append(line.get(i)).append("') and "); stringBuilder.append("line_id='").append(line.get(i)).append("') and ");
} }
} }
stringBuilder.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and phasic_type = 'T' and (value_type = 'CP95' or value_type = 'MAX') and quality_flag = '1' tz('Asia/Shanghai')"); stringBuilder.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and phasic_type = 'T' and (value_type = 'CP95' or value_type = 'MAX') and quality_flag = '0' tz('Asia/Shanghai')");
String sql = "SELECT * FROM data_i WHERE " + stringBuilder; String sql = "SELECT * FROM data_i WHERE " + stringBuilder;
QueryResult sqlResult = influxDbUtils.query(sql); QueryResult sqlResult = influxDbUtils.query(sql);
InfluxDBResultMapper resultMapper = new InfluxDBResultMapper(); InfluxDBResultMapper resultMapper = new InfluxDBResultMapper();
@@ -1205,7 +1205,7 @@ public class LimitRateJob {
stringBuilder.append("line_id='").append(line.get(i)).append("') and "); stringBuilder.append("line_id='").append(line.get(i)).append("') and ");
} }
} }
stringBuilder.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and phasic_type = 'T' and (value_type = 'MIN' or value_type = 'MAX') and quality_flag = '1' tz('Asia/Shanghai')"); stringBuilder.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and phasic_type = 'T' and (value_type = 'MIN' or value_type = 'MAX') and quality_flag = '0' tz('Asia/Shanghai')");
String sql = "SELECT * FROM data_v WHERE " + stringBuilder; String sql = "SELECT * FROM data_v WHERE " + stringBuilder;
QueryResult sqlResult = influxDbUtils.query(sql); QueryResult sqlResult = influxDbUtils.query(sql);
InfluxDBResultMapper resultMapper = new InfluxDBResultMapper(); InfluxDBResultMapper resultMapper = new InfluxDBResultMapper();
@@ -1236,7 +1236,7 @@ public class LimitRateJob {
stringBuilder.append("line_id='").append(line.get(i)).append("') and "); stringBuilder.append("line_id='").append(line.get(i)).append("') and ");
} }
} }
stringBuilder.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and (phasic_type = 'A' or phasic_type = 'B' or phasic_type = 'C') and (value_type = 'MIN' or value_type = 'MAX') and quality_flag = '1' tz('Asia/Shanghai')"); stringBuilder.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and (phasic_type = 'A' or phasic_type = 'B' or phasic_type = 'C') and (value_type = 'MIN' or value_type = 'MAX') and quality_flag = '0' tz('Asia/Shanghai')");
String sql = "SELECT * FROM data_v WHERE " + stringBuilder; String sql = "SELECT * FROM data_v WHERE " + stringBuilder;
QueryResult sqlResult = influxDbUtils.query(sql); QueryResult sqlResult = influxDbUtils.query(sql);
InfluxDBResultMapper resultMapper = new InfluxDBResultMapper(); InfluxDBResultMapper resultMapper = new InfluxDBResultMapper();
@@ -1267,7 +1267,7 @@ public class LimitRateJob {
stringBuilder.append("line_id='").append(line.get(i)).append("') and "); stringBuilder.append("line_id='").append(line.get(i)).append("') and ");
} }
} }
stringBuilder.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and (phasic_type = 'A' or phasic_type = 'B' or phasic_type = 'C') and value_type = 'MAX' and quality_flag = '1' tz('Asia/Shanghai')"); stringBuilder.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and (phasic_type = 'A' or phasic_type = 'B' or phasic_type = 'C') and quality_flag = '0' tz('Asia/Shanghai')");
String sql = "SELECT * FROM data_plt WHERE " + stringBuilder; String sql = "SELECT * FROM data_plt WHERE " + stringBuilder;
QueryResult sqlResult = influxDbUtils.query(sql); QueryResult sqlResult = influxDbUtils.query(sql);
InfluxDBResultMapper resultMapper = new InfluxDBResultMapper(); InfluxDBResultMapper resultMapper = new InfluxDBResultMapper();

View File

@@ -573,7 +573,7 @@ public class LimitTargetJob {
stringBuilder.append("line_id='").append(line.get(i)).append("') and "); stringBuilder.append("line_id='").append(line.get(i)).append("') and ");
} }
} }
stringBuilder.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and phasic_type = 'A' and value_type = 'AVG' and quality_flag = '1' group by line_id tz('Asia/Shanghai')"); stringBuilder.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and phasic_type = 'A' and value_type = 'AVG' and quality_flag = '0' group by line_id tz('Asia/Shanghai')");
String sql = "SELECT count(freq) AS all_time FROM day_v where " + stringBuilder; String sql = "SELECT count(freq) AS all_time FROM day_v where " + stringBuilder;
QueryResult sqlResult = influxDbUtils.query(sql); QueryResult sqlResult = influxDbUtils.query(sql);
InfluxDBResultMapper resultMapper = new InfluxDBResultMapper(); InfluxDBResultMapper resultMapper = new InfluxDBResultMapper();
@@ -604,7 +604,7 @@ public class LimitTargetJob {
stringBuilder.append("line_id='").append(line.get(i)).append("') and "); stringBuilder.append("line_id='").append(line.get(i)).append("') and ");
} }
} }
stringBuilder.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and phasic_type = 'A' and value_type = 'AVG' and quality_flag = '1' group by line_id tz('Asia/Shanghai')"); stringBuilder.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and phasic_type = 'A' and quality_flag = '0' group by line_id tz('Asia/Shanghai')");
String sql = "SELECT count(plt) AS flicker_all_time FROM day_plt where " + stringBuilder; String sql = "SELECT count(plt) AS flicker_all_time FROM day_plt where " + stringBuilder;
QueryResult sqlResult = influxDbUtils.query(sql); QueryResult sqlResult = influxDbUtils.query(sql);
InfluxDBResultMapper resultMapper = new InfluxDBResultMapper(); InfluxDBResultMapper resultMapper = new InfluxDBResultMapper();
@@ -635,7 +635,7 @@ public class LimitTargetJob {
stringBuilder.append("line_id='").append(line.get(i)).append("') and "); stringBuilder.append("line_id='").append(line.get(i)).append("') and ");
} }
} }
stringBuilder.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and (phasic_type = 'A' or phasic_type = 'B' or phasic_type = 'C') and value_type = 'CP95' and quality_flag = '1' tz('Asia/Shanghai')"); stringBuilder.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and (phasic_type = 'A' or phasic_type = 'B' or phasic_type = 'C') and value_type = 'CP95' and quality_flag = '0' tz('Asia/Shanghai')");
String sql = "SELECT * FROM day_harmrate_v WHERE " + stringBuilder; String sql = "SELECT * FROM day_harmrate_v WHERE " + stringBuilder;
QueryResult sqlResult = influxDbUtils.query(sql); QueryResult sqlResult = influxDbUtils.query(sql);
InfluxDBResultMapper resultMapper = new InfluxDBResultMapper(); InfluxDBResultMapper resultMapper = new InfluxDBResultMapper();
@@ -666,7 +666,7 @@ public class LimitTargetJob {
stringBuilder.append("line_id='").append(line.get(i)).append("') and "); stringBuilder.append("line_id='").append(line.get(i)).append("') and ");
} }
} }
stringBuilder.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and (phasic_type = 'A' or phasic_type = 'B' or phasic_type = 'C') and value_type = 'CP95' and quality_flag = '1' tz('Asia/Shanghai')"); stringBuilder.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and (phasic_type = 'A' or phasic_type = 'B' or phasic_type = 'C') and value_type = 'CP95' and quality_flag = '0' tz('Asia/Shanghai')");
String sql = "SELECT * FROM day_i WHERE " + stringBuilder; String sql = "SELECT * FROM day_i WHERE " + stringBuilder;
QueryResult sqlResult = influxDbUtils.query(sql); QueryResult sqlResult = influxDbUtils.query(sql);
InfluxDBResultMapper resultMapper = new InfluxDBResultMapper(); InfluxDBResultMapper resultMapper = new InfluxDBResultMapper();
@@ -697,7 +697,7 @@ public class LimitTargetJob {
stringBuilder.append("line_id='").append(line.get(i)).append("') and "); stringBuilder.append("line_id='").append(line.get(i)).append("') and ");
} }
} }
stringBuilder.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and (phasic_type = 'A' or phasic_type = 'B' or phasic_type = 'C') and value_type = 'CP95' and quality_flag = '1' tz('Asia/Shanghai')"); stringBuilder.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and (phasic_type = 'A' or phasic_type = 'B' or phasic_type = 'C') and value_type = 'CP95' and quality_flag = '0' tz('Asia/Shanghai')");
String sql = "SELECT * FROM day_inharm_v WHERE " + stringBuilder; String sql = "SELECT * FROM day_inharm_v WHERE " + stringBuilder;
QueryResult sqlResult = influxDbUtils.query(sql); QueryResult sqlResult = influxDbUtils.query(sql);
InfluxDBResultMapper resultMapper = new InfluxDBResultMapper(); InfluxDBResultMapper resultMapper = new InfluxDBResultMapper();
@@ -728,7 +728,7 @@ public class LimitTargetJob {
stringBuilder.append("line_id='").append(line.get(i)).append("') and "); stringBuilder.append("line_id='").append(line.get(i)).append("') and ");
} }
} }
stringBuilder.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and (phasic_type = 'A' or phasic_type = 'B' or phasic_type = 'C') and value_type = 'CP95' and quality_flag = '1' tz('Asia/Shanghai')"); stringBuilder.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and (phasic_type = 'A' or phasic_type = 'B' or phasic_type = 'C') and value_type = 'CP95' and quality_flag = '0' tz('Asia/Shanghai')");
String sql = "SELECT * FROM day_v WHERE " + stringBuilder; String sql = "SELECT * FROM day_v WHERE " + stringBuilder;
QueryResult sqlResult = influxDbUtils.query(sql); QueryResult sqlResult = influxDbUtils.query(sql);
InfluxDBResultMapper resultMapper = new InfluxDBResultMapper(); InfluxDBResultMapper resultMapper = new InfluxDBResultMapper();
@@ -760,7 +760,7 @@ public class LimitTargetJob {
stringBuilder.append("line_id='").append(line.get(i)).append("') and "); stringBuilder.append("line_id='").append(line.get(i)).append("') and ");
} }
} }
stringBuilder.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and phasic_type = 'T' and (value_type = 'CP95' or value_type = 'MAX') and quality_flag = '1' tz('Asia/Shanghai')"); stringBuilder.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and phasic_type = 'T' and (value_type = 'CP95' or value_type = 'MAX') and quality_flag = '0' tz('Asia/Shanghai')");
String sql = "SELECT * FROM day_v WHERE " + stringBuilder; String sql = "SELECT * FROM day_v WHERE " + stringBuilder;
QueryResult sqlResult = influxDbUtils.query(sql); QueryResult sqlResult = influxDbUtils.query(sql);
InfluxDBResultMapper resultMapper = new InfluxDBResultMapper(); InfluxDBResultMapper resultMapper = new InfluxDBResultMapper();
@@ -791,7 +791,7 @@ public class LimitTargetJob {
stringBuilder.append("line_id='").append(line.get(i)).append("') and "); stringBuilder.append("line_id='").append(line.get(i)).append("') and ");
} }
} }
stringBuilder.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and phasic_type = 'T' and (value_type = 'CP95' or value_type = 'MAX') and quality_flag = '1' tz('Asia/Shanghai')"); stringBuilder.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and phasic_type = 'T' and (value_type = 'CP95' or value_type = 'MAX') and quality_flag = '0' tz('Asia/Shanghai')");
String sql = "SELECT * FROM day_i WHERE " + stringBuilder; String sql = "SELECT * FROM day_i WHERE " + stringBuilder;
QueryResult sqlResult = influxDbUtils.query(sql); QueryResult sqlResult = influxDbUtils.query(sql);
InfluxDBResultMapper resultMapper = new InfluxDBResultMapper(); InfluxDBResultMapper resultMapper = new InfluxDBResultMapper();
@@ -822,7 +822,7 @@ public class LimitTargetJob {
stringBuilder.append("line_id='").append(line.get(i)).append("') and "); stringBuilder.append("line_id='").append(line.get(i)).append("') and ");
} }
} }
stringBuilder.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and phasic_type = 'T' and (value_type = 'MIN' or value_type = 'MAX') and quality_flag = '1' tz('Asia/Shanghai')"); stringBuilder.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and phasic_type = 'T' and (value_type = 'MIN' or value_type = 'MAX') and quality_flag = '0' tz('Asia/Shanghai')");
String sql = "SELECT * FROM day_v WHERE " + stringBuilder; String sql = "SELECT * FROM day_v WHERE " + stringBuilder;
QueryResult sqlResult = influxDbUtils.query(sql); QueryResult sqlResult = influxDbUtils.query(sql);
InfluxDBResultMapper resultMapper = new InfluxDBResultMapper(); InfluxDBResultMapper resultMapper = new InfluxDBResultMapper();
@@ -853,7 +853,7 @@ public class LimitTargetJob {
stringBuilder.append("line_id='").append(line.get(i)).append("') and "); stringBuilder.append("line_id='").append(line.get(i)).append("') and ");
} }
} }
stringBuilder.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and (phasic_type = 'A' or phasic_type = 'B' or phasic_type = 'C') and (value_type = 'MIN' or value_type = 'MAX') and quality_flag = '1' tz('Asia/Shanghai')"); stringBuilder.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and (phasic_type = 'A' or phasic_type = 'B' or phasic_type = 'C') and (value_type = 'MIN' or value_type = 'MAX') and quality_flag = '0' tz('Asia/Shanghai')");
String sql = "SELECT * FROM day_v WHERE " + stringBuilder; String sql = "SELECT * FROM day_v WHERE " + stringBuilder;
QueryResult sqlResult = influxDbUtils.query(sql); QueryResult sqlResult = influxDbUtils.query(sql);
InfluxDBResultMapper resultMapper = new InfluxDBResultMapper(); InfluxDBResultMapper resultMapper = new InfluxDBResultMapper();
@@ -884,7 +884,7 @@ public class LimitTargetJob {
stringBuilder.append("line_id='").append(line.get(i)).append("') and "); stringBuilder.append("line_id='").append(line.get(i)).append("') and ");
} }
} }
stringBuilder.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and (phasic_type = 'A' or phasic_type = 'B' or phasic_type = 'C') and value_type = 'MAX' and quality_flag = '1' tz('Asia/Shanghai')"); stringBuilder.append(Param.TIME + " >= '").append(startTime).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append("' and (phasic_type = 'A' or phasic_type = 'B' or phasic_type = 'C') and quality_flag = '0' tz('Asia/Shanghai')");
String sql = "SELECT * FROM day_plt WHERE " + stringBuilder; String sql = "SELECT * FROM day_plt WHERE " + stringBuilder;
QueryResult sqlResult = influxDbUtils.query(sql); QueryResult sqlResult = influxDbUtils.query(sql);
InfluxDBResultMapper resultMapper = new InfluxDBResultMapper(); InfluxDBResultMapper resultMapper = new InfluxDBResultMapper();

View File

@@ -116,7 +116,7 @@ public class PollutionJob {
//长时电压闪变 //长时电压闪变
Map<String, Optional<PublicDTO>> map9 = getFlicker(); Map<String, Optional<PublicDTO>> map9 = getFlicker();
for (String key : map9.keySet()) { for (String key : map9.keySet()) {
flickerList.add(map8.get(key).get()); flickerList.add(map9.get(key).get());
} }
//组装数据 //组装数据
for (PollutionDTO item1 : pollutionList) { for (PollutionDTO item1 : pollutionList) {