| | |
| | | |
| | | @ApiOperation(value = "系统概览获取半小时交流输入统计") |
| | | @GetMapping("getHalfHourPwrHisAcinData") |
| | | public Response getHalfHourPwrHisAcinData(@RequestParam Integer powerId){ |
| | | return pwrdevHistorydataIdService.getHalfHourPwrHisAcinData(powerId); |
| | | public Response getHalfHourPwrHisAcinData(@RequestParam Integer powerId,@RequestParam Integer granularity){ |
| | | return pwrdevHistorydataIdService.getHalfHourPwrHisAcinData(powerId,granularity); |
| | | } |
| | | |
| | | @ApiOperation(value = "系统概览获取半小时直流输出统计") |
| | | @GetMapping("getHalfHourPwrHisDcoutData") |
| | | public Response getHalfHourPwrHisDcoutData(@RequestParam Integer powerId){ |
| | | return pwrdevHistorydataIdService.getHalfHourPwrHisDcoutData(powerId); |
| | | public Response getHalfHourPwrHisDcoutData(@RequestParam Integer powerId,@RequestParam Integer granularity){ |
| | | return pwrdevHistorydataIdService.getHalfHourPwrHisDcoutData(powerId,granularity); |
| | | } |
| | | |
| | | @ApiOperation(value = "系统概览获取半小时核容设备信息") |
| | | @GetMapping("getHalfHourBattDevData") |
| | | public Response getHalfHourBattDevData(@RequestParam Integer battgroupId){ |
| | | return battRealdataIdService.getHalfHourBattDevData(battgroupId); |
| | | public Response getHalfHourBattDevData(@RequestParam Integer battgroupId,@RequestParam Integer granularity){ |
| | | return battRealdataIdService.getHalfHourBattDevData(battgroupId,granularity); |
| | | } |
| | | } |
| | |
| | | return new Response().setII(1,map.size()>0,map,"获取电池组最近一季度的温度数据"); |
| | | } |
| | | //系统概览获取半小时核容设备信息 |
| | | public Response getHalfHourBattDevData(Integer battgroupId) { |
| | | public Response getHalfHourBattDevData(Integer battgroupId,Integer granularity) { |
| | | String dateTime = ActionUtil.sdfwithOutday.format(new Date()); |
| | | String tableName ="db_data_history.tb_batt_realdata_"+battgroupId+"_"+dateTime; |
| | | String existTableName = commonMapper.existTable("db_data_history", "tb_batt_realdata_"+battgroupId+"_"+dateTime); |
| | | if(existTableName == null){ |
| | | return new Response().set(1,false,"当前电池组不存在前面小时数据"); |
| | | } |
| | | List<BattHisRealDto> datalist=subTablePageInfoService.getHalfHourBattDevData(tableName); |
| | | List<BattHisRealDto> datalist=subTablePageInfoService.getHalfHourBattDevData(tableName,granularity); |
| | | return new Response().setII(1,datalist.size()>0,datalist,"获取半小时内核容设备信息"); |
| | | } |
| | | } |
| | |
| | | private CommonMapper commonMapper; |
| | | |
| | | //系统概览获取半小时交流输入统计 |
| | | public Response getHalfHourPwrHisAcinData(Integer powerId) { |
| | | public Response getHalfHourPwrHisAcinData(Integer powerId,Integer granularity) { |
| | | String dateTime = ActionUtil.sdfwithOutday.format(new Date()); |
| | | String tableName ="db_data_history.tb_pwrdev_historydata_"+powerId+"_"+dateTime; |
| | | String existTableName = commonMapper.existTable("db_data_history", "tb_pwrdev_historydata_"+powerId+"_"+dateTime); |
| | | if(existTableName == null){ |
| | | return new Response().set(1,false,"当前电池组不存在前面小时数据"); |
| | | } |
| | | List<PwrHisRealAcInDto> datalist=subTablePageInfoService.getHalfHourPwrHisAcinData(tableName); |
| | | List<PwrHisRealAcInDto> datalist=subTablePageInfoService.getHalfHourPwrHisAcinData(tableName,granularity); |
| | | return new Response().setII(1,datalist.size()>0,datalist,"获取半小时内交流输入统计"); |
| | | |
| | | } |
| | | //系统概览获取半小时直流输出统计 |
| | | public Response getHalfHourPwrHisDcoutData(Integer powerId) { |
| | | public Response getHalfHourPwrHisDcoutData(Integer powerId,Integer granularity) { |
| | | String dateTime = ActionUtil.sdfwithOutday.format(new Date()); |
| | | String tableName ="db_data_history.tb_pwrdev_historydata_"+powerId+"_"+dateTime; |
| | | String existTableName = commonMapper.existTable("db_data_history", "tb_pwrdev_historydata_"+powerId+"_"+dateTime); |
| | | if(existTableName == null){ |
| | | return new Response().set(1,false,"当前电源不存在前面小时数据"); |
| | | } |
| | | List<PwrHisRealDcoutInDto> datalist=subTablePageInfoService.getHalfHourPwrHisDcoutData(tableName); |
| | | List<PwrHisRealDcoutInDto> datalist=subTablePageInfoService.getHalfHourPwrHisDcoutData(tableName,granularity); |
| | | return new Response().setII(1,datalist.size()>0,datalist,"获取半小时内直流输出统计"); |
| | | } |
| | | } |
| | |
| | | }); |
| | | return list; |
| | | } |
| | | //系统概览获取半小时核容设备信息 |
| | | public List<BattHisRealDto> getHalfHourBattDevData(String tableName) { |
| | | String sql="select distinct mon_num,record_time,group_vol,online_vol,group_curr,group_tmp from "+tableName+" "; |
| | | sql+="where record_time>date_sub(now(),interval 0.5 hour)"; |
| | | sql+="order by record_time asc"; |
| | | //系统概览获取半小时核容设备信息(组端信息取一个单体信息即可) |
| | | public List<BattHisRealDto> getHalfHourBattDevData(String tableName,Integer granularity) { |
| | | String sql="select distinct mon_num,record_time,group_vol,online_vol,group_curr,group_tmp " + |
| | | "from (select a.*, (@i:= @i+1) as number " + |
| | | " from (select * from "+tableName+" "+ |
| | | " where record_time>date_sub(now(),interval 0.5 hour) and mon_num=1) a, " + |
| | | " (select @i:=0) b) c "+ |
| | | " where c.number%"+granularity+"=0 or c.number=1 "; |
| | | sql+=" order by record_time asc"; |
| | | List<BattHisRealDto> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | | @Override |
| | | public List getResults(ResultSet rs) throws SQLException { |
| | |
| | | return list; |
| | | } |
| | | //系统概览获取半小时交流输入统计 |
| | | public List<PwrHisRealAcInDto> getHalfHourPwrHisAcinData(String tableName) { |
| | | public List<PwrHisRealAcInDto> getHalfHourPwrHisAcinData(String tableName,Integer granularity) { |
| | | String sql="select distinct record_datetime,acin1_vola,acin1_volb,acin1_volc,acin2_vola,acin2_volb,acin2_volc " + |
| | | ",acin1_curra,acin1_currb,acin1_currc,acin2_curra,acin2_currb,acin2_currc from "+tableName+" "; |
| | | sql+="where record_datetime>date_sub(now(),interval 0.5 hour)"; |
| | | sql+="order by record_datetime asc"; |
| | | ",acin1_curra,acin1_currb,acin1_currc,acin2_curra,acin2_currb,acin2_currc " + |
| | | "from (select a.*, (@i:= @i+1) as number " + |
| | | " from (select * from "+tableName+" "+ |
| | | " where record_datetime>date_sub(now(),interval 0.5 hour)) a, " + |
| | | " (select @i:=0) b) c "+ |
| | | " where c.number%"+granularity+"=0 or c.number=1 "; |
| | | sql+=" order by record_datetime asc"; |
| | | List<PwrHisRealAcInDto> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | | @Override |
| | | public List getResults(ResultSet rs) throws SQLException { |
| | |
| | | return list; |
| | | } |
| | | |
| | | public List<PwrHisRealDcoutInDto> getHalfHourPwrHisDcoutData(String tableName) { |
| | | String sql="select distinct record_datetime,dcout_vol,dcout_curr,battgroup1_vol,battgroup1_curr,battgroup2_vol,battgroup2_curr from "+tableName+" "; |
| | | sql+="where record_datetime>date_sub(now(),interval 0.5 hour)"; |
| | | sql+="order by record_datetime asc"; |
| | | public List<PwrHisRealDcoutInDto> getHalfHourPwrHisDcoutData(String tableName,Integer granularity) { |
| | | String sql="select distinct record_datetime,dcout_vol,dcout_curr,battgroup1_vol,battgroup1_curr,battgroup2_vol,battgroup2_curr " + |
| | | "from (select a.*, (@i:= @i+1) as number " + |
| | | " from (select * from "+tableName+" "+ |
| | | " where record_datetime>date_sub(now(),interval 0.5 hour)) a, " + |
| | | " (select @i:=0) b) c "+ |
| | | " where c.number%"+granularity+"=0 or c.number=1 "; |
| | | sql+=" order by record_datetime asc"; |
| | | List<PwrHisRealDcoutInDto> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | | @Override |
| | | public List getResults(ResultSet rs) throws SQLException { |