@ -529,4 +529,43 @@ public class TdEngineController {
return R . fail ( message ) ;
}
}
/ * *
* @param tdGroupSelectDto
* @return R < ? >
* @MethodDescription 按 日 期 分 组 获 取 数 据 ( 1 s , 1 m , 1d , 1 w , 30 d ) 返 回 格 式 , 时 间 , 数 值 列
* 历 史 数 据 SELECT _WSTART as time , _WEND , max ( value1 ) as maxValue , min ( value1 ) as minValue , avg ( value1 ) as avgValue , sum ( value1 ) as sumValue from db_hwsaas . t_device_260
* where ts > = now - 10 d and ts < now interval ( 1d ) order by time
* /
@InnerAuth
@PostMapping ( "/getGroupDeviceData" )
public R < ? > getGroupDeviceData ( @Validated @RequestBody TdGroupSelectDto tdGroupSelectDto ) {
try {
// if (selectVisualDto.getType() == 0) {//查询历史
// return R.ok(this.tdEngineService.getHistoryData(selectVisualDto));
// }else if(selectVisualDto.getType() == 1) {//查询实时
// return R.ok(this.tdEngineService.getRealtimeData(selectVisualDto));
// }else {//查询聚合
// return R.ok(this.tdEngineService.getAggregateData(selectVisualDto));
// }
TdReturnDataVo returnDataVo = new TdReturnDataVo ( ) ;
returnDataVo . setDataList ( this . tdEngineService . getGroupDeviceData ( tdGroupSelectDto ) ) ;
return R . ok ( returnDataVo ) ;
} catch ( UncategorizedSQLException e ) {
String message = e . getCause ( ) . getMessage ( ) ;
try {
message = message . substring ( message . lastIndexOf ( "invalid operation" ) ) ;
} catch ( Exception ex ) {
}
log . error ( message ) ;
return R . fail ( message ) ;
} catch ( Exception e ) {
log . error ( e . getMessage ( ) ) ;
return R . fail ( e . getMessage ( ) ) ;
}
}
}