| | |
| | | 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; |
| | | import com.whyc.pojo.db_alarm.BattalarmDataHistory; |
| | |
| | | } |
| | | //获取内阻数据 |
| | | public List<QuarterDto> getBattResInfData(Integer battgroupId,Integer testRecordCount) { |
| | | String sql="select distinct mon_num,test_starttime,mon_res, from db_batt_testdata.tb_battresdata_"+battgroupId |
| | | String sql="select distinct mon_num,test_starttime,mon_res from db_batt_testdata.tb_battresdata_"+battgroupId |
| | | +" where test_record_count="+testRecordCount+" order by mon_num asc"; |
| | | List<QuarterDto> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | | @Override |
| | |
| | | } |
| | | }); |
| | | return list; |
| | | } |
| | | //取内阻测试的最大内阻和单体编号 |
| | | public List<QuarterDto> getMaxResInInfData(Integer battgroupId, Integer testRecordCount) { |
| | | String sql="select distinct mon_num,test_starttime,mon_res from db_batt_testdata.tb_battresdata_"+battgroupId |
| | | +" where test_record_count="+testRecordCount+" order by mon_num asc"; |
| | | List<QuarterDto> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | | @Override |
| | | public List getResults(ResultSet rs) throws SQLException { |
| | | List<QuarterDto> list=new ArrayList<>(); |
| | | while (rs.next()){ |
| | | QuarterDto data=new QuarterDto(); |
| | | data.setMonNum(rs.getInt("mon_num")); |
| | | data.setNumValue(rs.getFloat("mon_res")); |
| | | data.setRecordTime(rs.getTimestamp("test_starttime")); |
| | | list.add(data); |
| | | } |
| | | return list; |
| | | } |
| | | }); |
| | | 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) { |
| | |
| | | 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)+"'" + |
| | | " 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<PwrHisRealDcoutInDto> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | | @Override |
| | | public List getResults(ResultSet rs) throws SQLException { |
| | | List<PwrHisRealDcoutInDto> list=new ArrayList<>(); |
| | | while (rs.next()){ |
| | | PwrHisRealDcoutInDto data=new PwrHisRealDcoutInDto(); |
| | | data.setRecordDatetime(rs.getTimestamp("record_datetime")); |
| | | data.setMOutputvol(rs.getFloat("m_outputvol")); |
| | | data.setM1Outcurr(rs.getFloat("m1_outcurr")); |
| | | data.setM2Outcurr(rs.getFloat("m2_outcurr")); |
| | | data.setM3Outcurr(rs.getFloat("m3_outcurr")); |
| | | data.setM4Outcurr(rs.getFloat("m4_outcurr")); |
| | | data.setM5Outcurr(rs.getFloat("m5_outcurr")); |
| | | data.setM6Outcurr(rs.getFloat("m6_outcurr")); |
| | | data.setM7Outcurr(rs.getFloat("m7_outcurr")); |
| | | data.setM8Outcurr(rs.getFloat("m8_outcurr")); |
| | | data.setM9Outcurr(rs.getFloat("m9_outcurr")); |
| | | data.setM10Outcurr(rs.getFloat("m10_outcurr")); |
| | | data.setM11Outcurr(rs.getFloat("m11_outcurr")); |
| | | data.setM12Outcurr(rs.getFloat("m12_outcurr")); |
| | | data.setM13Outcurr(rs.getFloat("m13_outcurr")); |
| | | data.setM14Outcurr(rs.getFloat("m14_outcurr")); |
| | | data.setM15Outcurr(rs.getFloat("m15_outcurr")); |
| | | data.setM16Outcurr(rs.getFloat("m16_outcurr")); |
| | | data.setM1OutVol(rs.getFloat("m1_out_vol")); |
| | | data.setM2OutVol(rs.getFloat("m2_out_vol")); |
| | | data.setM3OutVol(rs.getFloat("m3_out_vol")); |
| | | data.setM4OutVol(rs.getFloat("m4_out_vol")); |
| | | data.setM5OutVol(rs.getFloat("m5_out_vol")); |
| | | data.setM6OutVol(rs.getFloat("m6_out_vol")); |
| | | data.setM7OutVol(rs.getFloat("m7_out_vol")); |
| | | data.setM8OutVol(rs.getFloat("m8_out_vol")); |
| | | data.setM9OutVol(rs.getFloat("m9_out_vol")); |
| | | data.setM10OutVol(rs.getFloat("m10_out_vol")); |
| | | data.setM11OutVol(rs.getFloat("m11_out_vol")); |
| | | data.setM12OutVol(rs.getFloat("m12_out_vol")); |
| | | data.setM13OutVol(rs.getFloat("m13_out_vol")); |
| | | 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> getPwrHisAcData(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; |
| | | } |
| | | }); |
| | | return list; |
| | | } |
| | | //电源历史实时 |
| | | public List<PwrHisRealDcoutInDto> getPwrRealDataHis(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)+"'" + |
| | | " and record_datetime<='"+ActionUtil.sdf.format(recordDatetime1)+ |
| | |
| | | } |
| | | //电池数据历史实时处理 |
| | | public List<RealDateDTO> getBattRealDataHis(BattRealdataId realdata, int granularity,Integer maxRecordNum,Integer minRecordNum) { |
| | | String sql=" select record_time, group_vol, online_vol,group_curr, mon_vol, mon_tmp, mon_res, mon_num,record_num " + |
| | | String sql=" select 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)+"' "+ |
| | |
| | | |
| | | //系统概览获取前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, mon_vol, mon_tmp, mon_res, mon_num,record_num " + |
| | | String sql=" select record_time, group_vol, online_vol,group_curr, load_curr,record_num " + |
| | | " from "+tableName+" " + |
| | | " where record_time >= '"+ThreadLocalUtil.format(recordDatetime,1)+"' " + |
| | | " and record_time <= '"+ThreadLocalUtil.format(recordDatetime1,1)+"' "+ |
| | |
| | | ph.setGroupVol(rs.getFloat("group_vol")); |
| | | ph.setOnlineVol(rs.getFloat("online_vol")); |
| | | ph.setGroupCurr(rs.getFloat("group_curr")); |
| | | ph.setMonVol(rs.getFloat("mon_vol")); |
| | | ph.setMonTmp(rs.getFloat("mon_tmp")); |
| | | ph.setMonRes(rs.getFloat("mon_res")); |
| | | ph.setMonNum(rs.getInt("mon_num")); |
| | | ph.setLoadCurr(rs.getFloat("load_curr")); |
| | | ph.setRecordNum(rs.getInt("record_num")); |
| | | list.add(ph); |
| | | } |
| | |
| | | }); |
| | | return list; |
| | | } |
| | | |
| | | } |