| | |
| | | import com.whyc.dto.AlmHis.PwrAlmPar; |
| | | import com.whyc.dto.AnalysisAlm.ResAnalysis; |
| | | import com.whyc.dto.Real.*; |
| | | import com.whyc.dto.RealDataStatic.ResRealDataAc; |
| | | import com.whyc.dto.Statistic.ComPareChangeCurve; |
| | | import com.whyc.dto.Statistic.ComPareChart; |
| | | import com.whyc.dto.Statistic.QuarterPwr7Res; |
| | | import com.whyc.mapper.CallBack; |
| | |
| | | }); |
| | | return list; |
| | | } |
| | | //取内阻测试指定单体的单体电压 |
| | | public ComPareChangeCurve getMonResChangeByBattgroupId(Integer battgroupId, Integer testRecordCount, Integer monNum) { |
| | | String sql="select distinct battgroup_id,mon_num,test_starttime,mon_res from db_batt_testdata.tb_battresdata_"+battgroupId |
| | | +" where test_record_count="+testRecordCount+" and monNum="+monNum; |
| | | List<ComPareChangeCurve> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | | @Override |
| | | public List getResults(ResultSet rs) throws SQLException { |
| | | List<ComPareChangeCurve> list=new ArrayList<>(); |
| | | while (rs.next()){ |
| | | ComPareChangeCurve data=new ComPareChangeCurve(); |
| | | data.setMonNum(rs.getInt("mon_num")); |
| | | data.setCurveValue(rs.getFloat("mon_res")); |
| | | data.setStartTime(rs.getTimestamp("test_starttime")); |
| | | data.setBattgroupId(rs.getInt("battgroup_id")); |
| | | list.add(data); |
| | | } |
| | | return list; |
| | | } |
| | | }); |
| | | if(list!=null&&list.size()>0){ |
| | | return list.get(0); |
| | | } |
| | | return null; |
| | | } |
| | | //找这次放电的指定一笔数据 |
| | | public List<BatttestdataId> getLastDataByBattgroupId(Integer battgroupId, Integer testRecordCount, Integer recordNum) { |
| | | String sql="select distinct * from db_batt_testdata.tb_batttestdata_"+battgroupId |
| | |
| | | data.setMonVol(rs.getFloat("mon_vol")); |
| | | data.setMonRes(rs.getFloat("mon_res")); |
| | | data.setMonTmp(rs.getFloat("mon_tmp")); |
| | | list.add(data); |
| | | } |
| | | return list; |
| | | } |
| | | }); |
| | | return list; |
| | | } |
| | | //系统概览获取半小时核容设备信息(组端信息取一个单体信息即可) |
| | | public List<BattHisRealDto> getHalfHourBattDevData(String tableName,Integer granularity,String halfHourAgoTime) { |
| | | String sql="select distinct mon_num,record_time,group_vol,online_vol,group_curr,group_tmp,load_curr " + |
| | | "from (select a.*, (@i:= @i+1) as number " + |
| | | " from (select * from "+tableName+" "+ |
| | | " where record_time>='"+halfHourAgoTime+"' 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 { |
| | | List<BattHisRealDto> list=new ArrayList<>(); |
| | | while (rs.next()){ |
| | | BattHisRealDto data=new BattHisRealDto(); |
| | | data.setRecordTime(rs.getTimestamp("record_time")); |
| | | data.setGroupVol(rs.getFloat("group_vol")); |
| | | data.setOnlineVol(rs.getFloat("online_vol")); |
| | | data.setGroupCurr(rs.getFloat("group_curr")); |
| | | data.setGroupTmp(rs.getFloat("group_tmp")); |
| | | data.setLoadCurr(rs.getFloat("load_curr")); |
| | | list.add(data); |
| | | } |
| | | return list; |
| | |
| | | }); |
| | | return list; |
| | | } |
| | | |
| | | //系统概览获取半小时交流输出统计 |
| | | public List<PwrHisRealDcoutInDto> getHalfHourPwrHisDcoutData(String tableName,Integer granularity,Date recordDatetime,Date recordDatetime1,Integer maxRecordNum,Integer minRecordNum) { |
| | | String sql="select distinct * " + |
| | | " from "+tableName+" where record_datetime>='"+ActionUtil.sdf.format(recordDatetime)+"'" + |
| | |
| | | data.setM14OutVol(rs.getFloat("m14_out_vol")); |
| | | data.setM15OutVol(rs.getFloat("m15_out_vol")); |
| | | data.setM16OutVol(rs.getFloat("m16_out_vol")); |
| | | list.add(data); |
| | | } |
| | | return list; |
| | | } |
| | | }); |
| | | return list; |
| | | } |
| | | //实时数据数据曲线统计-交流单元 |
| | | public List<ResRealDataAc> getSticRealAcData(String tableName, Integer granularity, Date recordDatetime, Date recordDatetime1 |
| | | , Integer maxRecordNum, Integer minRecordNum, Map<String, List<String>> propertyInfo) { |
| | | String propertyStr = propertyInfo.values().stream() |
| | | .flatMap(List::stream) |
| | | .collect(Collectors.joining(",")); |
| | | String sql=" select distinct record_datetime,"+propertyStr+" "+ |
| | | " from "+tableName+" where record_datetime>='"+ActionUtil.sdf.format(recordDatetime)+"'" + |
| | | " and record_datetime<='"+ActionUtil.sdf.format(recordDatetime1)+ |
| | | "' and (record_num-"+minRecordNum+")%"+granularity+"=0 or record_num="+minRecordNum+" or record_num="+maxRecordNum; |
| | | sql+=" order by record_datetime asc"; |
| | | List<ResRealDataAc> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | | @Override |
| | | public List getResults(ResultSet rs) throws SQLException { |
| | | List<ResRealDataAc> list=new ArrayList<>(); |
| | | while (rs.next()){ |
| | | ResRealDataAc data=new ResRealDataAc(); |
| | | data.setRecordDatetime(rs.getTimestamp("record_datetime")); |
| | | Map<String,Map<String,Float>>dataMap=new HashMap<>(); |
| | | for (Map.Entry<String, List<String>> entry : propertyInfo.entrySet()) { |
| | | String key = entry.getKey(); |
| | | List<String> valueList = entry.getValue(); |
| | | Map<String,Float> propertyMap=new HashMap<>(); |
| | | for (String value : valueList) { |
| | | Float propertyValue = rs.getFloat(value); |
| | | propertyMap.put(value,propertyValue); |
| | | } |
| | | dataMap.put(key,propertyMap); |
| | | } |
| | | data.setPropertyInfo(dataMap); |
| | | list.add(data); |
| | | } |
| | | return list; |
| | |
| | | } |
| | | //电池数据历史实时处理 |
| | | public List<RealDateDTO> getBattRealDataHis(BattRealdataId realdata, int granularity,Integer maxRecordNum,Integer minRecordNum) { |
| | | String sql=" select record_time, group_vol, online_vol,group_curr,load_curr, mon_vol, mon_tmp, mon_res, mon_num,record_num " + |
| | | String sql=" select distinct record_time, group_vol, online_vol,group_curr,load_curr, mon_vol, mon_tmp, mon_res, mon_num,record_num " + |
| | | " from db_data_history.tb_batt_realdata_"+realdata.getTableName()+" " + |
| | | " where record_time >= '"+ThreadLocalUtil.format(realdata.getRecordTime(),1)+"' " + |
| | | " and record_time <= '"+ThreadLocalUtil.format(realdata.getRecordTime1(),1)+"' "+ |
| | |
| | | }); |
| | | return list; |
| | | } |
| | | |
| | | //实时数据统计曲线--核容设备 |
| | | public List<ResRealDataAc> getSticRealHrData(BattRealdataId realdata, Integer granularity, Integer maxRecordNum, Integer minRecordNum, Map<String, List<String>> propertyInfo) { |
| | | String propertyStr = propertyInfo.values().stream() |
| | | .flatMap(List::stream) |
| | | .collect(Collectors.joining(",")); |
| | | String sql=" select distinct record_time, "+propertyStr+" "+ |
| | | " from db_data_history.tb_batt_realdata_"+realdata.getTableName()+" " + |
| | | " where record_time >= '"+ThreadLocalUtil.format(realdata.getRecordTime(),1)+"' " + |
| | | " and record_time <= '"+ThreadLocalUtil.format(realdata.getRecordTime1(),1)+"' "+ |
| | | " and (record_num-"+minRecordNum+")%"+granularity+"=0 or record_num="+maxRecordNum+" or record_num="+minRecordNum ; |
| | | List<ResRealDataAc> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | | @Override |
| | | public List getResults(ResultSet rs) throws SQLException { |
| | | List<ResRealDataAc> list=new ArrayList<>(); |
| | | while (rs.next()){ |
| | | ResRealDataAc data=new ResRealDataAc(); |
| | | data.setRecordDatetime(rs.getTimestamp("record_time")); |
| | | Map<String,Map<String,Float>>dataMap=new HashMap<>(); |
| | | for (Map.Entry<String, List<String>> entry : propertyInfo.entrySet()) { |
| | | String key = entry.getKey(); |
| | | List<String> valueList = entry.getValue(); |
| | | Map<String,Float> propertyMap=new HashMap<>(); |
| | | for (String value : valueList) { |
| | | Float propertyValue = rs.getFloat(value); |
| | | propertyMap.put(value,propertyValue); |
| | | } |
| | | dataMap.put(key,propertyMap); |
| | | } |
| | | data.setPropertyInfo(dataMap); |
| | | list.add(data); |
| | | } |
| | | return list; |
| | | } |
| | | }); |
| | | return list; |
| | | } |
| | | //系统概览获取前N笔核容设备信息 |
| | | public List<RealDateDTO> getBattDevData100(String tableName, Integer granularity, Date recordDatetime, Date recordDatetime1,Integer maxRecordNum,Integer minRecordNum) { |
| | | String sql=" select record_time, group_vol, online_vol,group_curr, load_curr,record_num " + |
| | |
| | | }); |
| | | return list; |
| | | } |
| | | |
| | | } |