Commit 3649634f authored by caotao's avatar caotao

Merge branch 'developer' of http://39.98.45.134:8090/moa/amos-boot-biz into developer

parents 32b3b02a 767c45f2
...@@ -752,4 +752,18 @@ public class MonitorFanIdxController extends BaseController { ...@@ -752,4 +752,18 @@ public class MonitorFanIdxController extends BaseController {
return ResponseHelper.buildResponse(result); return ResponseHelper.buildResponse(result);
} }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "汇流箱 功率曲线")
@GetMapping("/hlWindSpeeds")
public ResponseModel<Map<String, Object>> hlWindSpeeds(@RequestParam(value = "stationId")String stationId,@RequestParam(value = "equipNum") String equipNum) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
String gatewayId = stationBasic.getFanGatewayId();
Map<String, Object> result = monitorFanIndicator.hlWindSpeeds(gatewayId,equipNum);
return ResponseHelper.buildResponse(result);
}
} }
...@@ -1621,5 +1621,33 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -1621,5 +1621,33 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
return result; return result;
} }
public Map<String, Object> hlWindSpeeds(String gatewayId, String equipNum) {
Date currentDayStartTime = DateUtils.getCurrentDayStartTime(new Date());
String time = "";
try {
time = DateUtils.dateFormat(currentDayStartTime, DateUtils.DATE_TIME_PATTERN);
} catch (ParseException e) {
e.printStackTrace();
}
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 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> timeList = influxDButils.getListDataAll(timeSql, IndicatorsDto.class);
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()));
List< Map<String,Object>> seriesData = new ArrayList<>();
for (String s : data.keySet()) {
Map<String,Object> map = new HashMap<>();
List<String> value = data.get(s).stream().map(IndicatorsDto::getValue).collect(Collectors.toList());
map.put("data",value);
seriesData.add(map);
}
Map<String,Object> map = new HashMap<>();
map.put("seriesData", seriesData);
map.put("axisData",timeMap.keySet());
return map;
}
} }
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