Commit a938cd3b authored by tangwei's avatar tangwei

解决冲突

parents a9fc3b65 399ebcab
...@@ -26,6 +26,7 @@ public class IndicatorsDto { ...@@ -26,6 +26,7 @@ public class IndicatorsDto {
private String valueLabel; private String valueLabel;
private String distinct; private String distinct;
private String time; private String time;
private String timeValue;
private String displayName; private String displayName;
private String pictureName; private String pictureName;
private String title; private String title;
...@@ -42,4 +43,14 @@ public class IndicatorsDto { ...@@ -42,4 +43,14 @@ public class IndicatorsDto {
public void setTime(String time) { public void setTime(String time) {
this.time = time; this.time = time;
} }
public void setTimeValue(String time) {
this.timeValue = time;
}
public String getTimeValue() {
if (null != timeValue) {
return timeValue.substring(0,5);
}
return null;
}
} }
...@@ -636,7 +636,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -636,7 +636,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
} }
@Scheduled(cron = "0 */5 * * * ?") @Scheduled(cron = "${windSpeed.Scheduled.cron}")
private void schedTaskData() { private void schedTaskData() {
LambdaQueryWrapper<StationBasic> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<StationBasic> wrapper = new LambdaQueryWrapper<>();
...@@ -1677,10 +1677,12 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -1677,10 +1677,12 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
map.put("efficiency", keepTwoDecimalPlaces(e.getValue())); map.put("efficiency", keepTwoDecimalPlaces(e.getValue()));
break; break;
case "日发电量": case "日发电量":
map.put("dayNum", keepTwoDecimalPlaces(e.getValue())); double v = Double.parseDouble(e.getValue()) * CommonConstans.pvGenPoweActor;
map.put("dayNum", keepTwoDecimalPlaces(String.valueOf(v)));
break; break;
case "总发电量": case "总发电量":
map.put("yearNum", keepTwoDecimalPlaces(e.getValue())); double a = Double.parseDouble(e.getValue()) * CommonConstans.pvGenPoweActor;
map.put("yearNum", keepTwoDecimalPlaces(String.valueOf(a)));
break; break;
} }
}); });
...@@ -1700,22 +1702,34 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -1700,22 +1702,34 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
String[] equipNumber = equipNum.split("-"); String[] equipNumber = equipNum.split("-");
String sql = "SELECT time ,equipmentIndexName ,value FROM iot_data_" + gatewayId + " WHERE time >'" + time + "' and equipmentSpecificName =~/" + equipNumber[0] + "子阵/ and equipmentSpecificName =~/逆变器" + equipNumber[1] + "/ and equipmentSpecificName =~/" + Integer.parseInt(equipNumber[2]) + "汇流箱/ and equipmentIndexName =~/路电流/"; String sql = "SELECT time ,equipmentIndexName ,value FROM iot_data_" + gatewayId + " WHERE time >'" + time + "' and equipmentSpecificName =~/" + equipNumber[0] + "子阵/ and equipmentSpecificName =~/逆变器" + equipNumber[1] + "/ and equipmentSpecificName =~/" + Integer.parseInt(equipNumber[2]) + "汇流箱/ and equipmentIndexName =~/路电流/";
String timeSql = "SELECT DISTINCT value FROM iot_data_" + gatewayId + " WHERE time >'" + time + "' and equipmentSpecificName =~/" + equipNumber[0] + "子阵/ and equipmentSpecificName =~/逆变器" + equipNumber[1] + "/ and equipmentSpecificName =~/" + Integer.parseInt(equipNumber[2]) + "汇流箱/ and equipmentIndexName =~/路电流/ group by time(2m)"; String timeSql = "SELECT DISTINCT value FROM iot_data_" + gatewayId + " WHERE time >'" + time + "' and equipmentSpecificName =~/" + equipNumber[0] + "子阵/ and equipmentSpecificName =~/逆变器" + equipNumber[1] + "/ and equipmentSpecificName =~/" + Integer.parseInt(equipNumber[2]) + "汇流箱/ and equipmentIndexName =~/路电流/ group by time(2m)";
List<IndicatorsDto> dataList = influxDButils.getListData(sql, IndicatorsDto.class); List<IndicatorsDto> dataList = influxDButils.getListDataAll(sql, IndicatorsDto.class);
List<IndicatorsDto> timeList = influxDButils.getListDataAll(timeSql, IndicatorsDto.class); // List<IndicatorsDto> timeList = influxDButils.getListDataAll(timeSql, IndicatorsDto.class);
Map<String, List<IndicatorsDto>> timeMap = timeList.stream().collect(Collectors.groupingBy(IndicatorsDto::getTime, LinkedHashMap::new, Collectors.toList())); Map<String, Object> resultMap = new HashMap<>();
// Map<String, List<IndicatorsDto>> timeMap = timeList.stream().collect(Collectors.groupingBy(IndicatorsDto::getTime, LinkedHashMap::new, Collectors.toList()));
Map<String, List<IndicatorsDto>> data = dataList.stream().collect(Collectors.groupingBy(IndicatorsDto::getEquipmentIndexName, LinkedHashMap::new, Collectors.toList())); Map<String, List<IndicatorsDto>> data = dataList.stream().collect(Collectors.groupingBy(IndicatorsDto::getEquipmentIndexName, LinkedHashMap::new, Collectors.toList()));
int num = 0;
List<Map<String, Object>> seriesData = new ArrayList<>(); List<Map<String, Object>> seriesData = new ArrayList<>();
for (String s : data.keySet()) { for (String s : data.keySet()) {
data.get(s).stream().forEach(e->{
e.setTimeValue(e.getTime());
});
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
List<String> value = data.get(s).stream().map(IndicatorsDto::getValue).collect(Collectors.toList()); List<String> value = data.get(s).stream().map(IndicatorsDto::getValue).collect(Collectors.toList());
map.put("data", value); map.put("data", value);
// map.put("name","pv"+s.substring(4,6));
seriesData.add(map); seriesData.add(map);
if (value.size()>num){
Map<String, List<IndicatorsDto>> timeMap = data.get(s).stream().collect(Collectors.groupingBy(IndicatorsDto::getTimeValue , LinkedHashMap::new, Collectors.toList()));
resultMap.put("axisData", timeMap.keySet());
}
num = value.size()>num ? value.size():num;
} }
Map<String, Object> map = new HashMap<>();
map.put("seriesData", seriesData); resultMap.put("seriesData", seriesData);
map.put("axisData", timeMap.keySet()); return resultMap;
return map;
} }
......
...@@ -79,7 +79,8 @@ gl.avg.column=有功功率,日利用小时,瞬时风速 ...@@ -79,7 +79,8 @@ gl.avg.column=有功功率,日利用小时,瞬时风速
#ES 曲线图定时 0 57 23 * * ? #ES 曲线图定时 0 57 23 * * ?
windSpeed.cron = 0 25 9 * * ? windSpeed.cron = 0 25 9 * * ?
#本地使用 0 0 5 29 2 ? ? 线上使用 0 */5 * * * ?
windSpeed.Scheduled.cron = 0 0 5 29 2 ?
spring.elasticsearch.rest.uris=http://39.98.224.23:9200 spring.elasticsearch.rest.uris=http://39.98.224.23:9200
spring.elasticsearch.rest.connection-timeout=30000 spring.elasticsearch.rest.connection-timeout=30000
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment