Commit d08d1ead authored by chenzhao's avatar chenzhao

修改折线图代码

parent ff2e7415
......@@ -276,11 +276,11 @@ public class MonitorFanIdxController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "逆变器-功率曲线")
@GetMapping("/getDetailsWindSpeeds")
public ResponseModel<Map<String, Object>> getDetailsWindSpeeds(@RequestParam(value = "stationId")String stationId,String name) {
name = name + "风机";
public ResponseModel<Map<String, Object>> getDetailsWindSpeeds(@RequestParam(value = "stationId")String stationId,String equipNum) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
String gatewayId = stationBasic.getFanGatewayId();
Map<String, Object> detailsWindSpeed = monitorFanIndicator.getDetailsWindSpeeds(gatewayId, name);
Map<String, Object> detailsWindSpeed = monitorFanIndicator.getDetailsWindSpeeds(gatewayId,equipNum);
return ResponseHelper.buildResponse(detailsWindSpeed);
}
......
......@@ -582,7 +582,16 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
} catch (ParseException e) {
e.printStackTrace();
}
String sql1 = "SELECT DISTINCT value FROM iot_data_"+gatewayId+" WHERE equipmentIndexName = '有功功率' and equipmentSpecificName =~/"+name+"/ and time >='"+time+"'GROUP BY time(2m)";
String sql = "SELECT equipmentSpecificName FROM indicators_"+gatewayId+" WHERE equipmentNumber = '"+name+"' limit 1";
List<IndicatorsDto> indicatorsDtoList = influxDButils.getListDataAll(sql,IndicatorsDto.class);
name = indicatorsDtoList.get(0).getEquipmentSpecificName();
StringBuffer param = new StringBuffer();
String[] split = name.replace("#", "").split("/");
for (int i = 0; i < split.length; i++) {
param .append(" and equipmentSpecificName =~/"+split[i]+"/") ;
}
String sql1 = "SELECT DISTINCT value FROM iot_data_"+gatewayId+" WHERE equipmentIndexName = '有功功率'"+param+" and time >='"+time+"'GROUP BY time(2m)";
List<IndicatorsDto> indicatorsDtoLists = influxDButils.getListDataAll(sql1,IndicatorsDto.class);
LinkedHashMap<String, String> collects = indicatorsDtoLists.stream().collect(Collectors.toMap(IndicatorsDto::getTime, IndicatorsDto::getDistinct,(key1, ky2)-> (String) key1,LinkedHashMap::new));
Collection<String> valuess = collects.values();
......
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