| | |
| | | public int getBattAlmHisCount(BattAlmPar param){ |
| | | String sql="select count(distinct history.num) as number " + |
| | | " from db_alarm."+param.getRecordYear()+" history,db_station.tb_station_inf,db_station.tb_batt_inf " + |
| | | " where history.battgroup_id=tb_battinf.battgroup_id " + |
| | | " where history.battgroup_id=tb_batt_inf.battgroup_id " + |
| | | " and tb_batt_inf.station_id=tb_station_inf.station_id " + |
| | | " and alm_start_time>='"+ThreadLocalUtil.format(param.getAlmStartTime(),1)+"' and alm_start_time <='"+ThreadLocalUtil.format(param.getAlmEndTime(),1)+"' " ; |
| | | if(param.getProvice()!=null){ |
| | | sql+=" and tb_station_inf.province='"+param.getProvice()+"' "; |
| | | sql+=" and tb_station_inf.provice='"+param.getProvice()+"' "; |
| | | } |
| | | if(param.getCity()!=null){ |
| | | sql+=" and tb_station_inf.city='"+param.getCity()+"' "; |
| | |
| | | String sql="select history.battgroup_id,history.num,alm_signal_id,history.mon_num,alm_value,alm_level,alm_is_confirmed,alm_confirmed_time,alm_start_time,alm_end_time,alm_severity " + |
| | | " ,tb_station_inf.station_name,tb_station_inf.provice,tb_station_inf.city,tb_station_inf.country,tb_batt_inf.battgroup_name " + |
| | | " from db_alarm."+param.getRecordYear()+" history,db_station.tb_station_inf,db_station.tb_batt_inf " + |
| | | " where history.battgroup_id=tb_battinf.battgroup_id " + |
| | | " where history.battgroup_id=tb_batt_inf.battgroup_id " + |
| | | " and tb_batt_inf.station_id=tb_station_inf.station_id " + |
| | | " and alm_start_time>='"+ThreadLocalUtil.format(param.getAlmStartTime(),1)+"' and alm_start_time <='"+ThreadLocalUtil.format(param.getAlmEndTime(),1)+"' " ; |
| | | if(param.getProvice()!=null){ |
| | | sql+=" and tb_station_inf.province='"+param.getProvice()+"' "; |
| | | sql+=" and tb_station_inf.provice='"+param.getProvice()+"' "; |
| | | } |
| | | if(param.getCity()!=null){ |
| | | sql+=" and tb_station_inf.city='"+param.getCity()+"' "; |
| | |
| | | " and tb_batt_inf.station_id=tb_station_inf.station_id "+ |
| | | " and alm_start_time>='"+ThreadLocalUtil.format(param.getAlmStartTime(),1)+"' and alm_start_time <='"+ThreadLocalUtil.format(param.getAlmEndTime(),1)+"' " ; |
| | | if(param.getProvice()!=null){ |
| | | sql+=" and tb_station_inf.province='"+param.getProvice()+"' "; |
| | | sql+=" and tb_station_inf.provice='"+param.getProvice()+"' "; |
| | | } |
| | | if(param.getCity()!=null){ |
| | | sql+=" and tb_station_inf.city='"+param.getCity()+"' "; |
| | |
| | | } |
| | | //获取设备历史告警集合 |
| | | public List getDevAlmHisList(DevAlmPar param){ |
| | | String sql="SELECT history.num,dev_id,dev_ip,alm_level,alm_start_time,alm_end_time,alm_is_confirmed,alm_confirmed_time,alm_cleared_type,alm_severity, " + |
| | | String sql="SELECT history.*, " + |
| | | " tb_station_inf.station_name,tb_station_inf.provice,tb_station_inf.city,tb_station_inf.country,tb_batt_inf.dev_name " + |
| | | " FROM db_alarm."+param.getRecordYear()+" history,db_station.tb_batt_inf,db_station.tb_station_inf " + |
| | | " where history.dev_id=tb_batt_inf.dev_id "+ |
| | | " and tb_batt_inf.station_id=tb_station_inf.station_id "+ |
| | | " and alm_start_time>='"+ThreadLocalUtil.format(param.getAlmStartTime(),1)+"' and alm_start_time <='"+ThreadLocalUtil.format(param.getAlmEndTime(),1)+"' " ; |
| | | if(param.getProvice()!=null){ |
| | | sql+=" and tb_station_inf.province='"+param.getProvice()+"' "; |
| | | sql+=" and tb_station_inf.provice='"+param.getProvice()+"' "; |
| | | } |
| | | if(param.getCity()!=null){ |
| | | sql+=" and tb_station_inf.city='"+param.getCity()+"' "; |
| | |
| | | " and tb_power_inf.station_id=tb_station_inf.station_id "+ |
| | | " and alm_start_time>='"+ThreadLocalUtil.format(param.getAlmStartTime(),1)+"' and alm_start_time <='"+ThreadLocalUtil.format(param.getAlmEndTime(),1)+"' " ; |
| | | if(param.getProvice()!=null){ |
| | | sql+=" and tb_station_inf.province='"+param.getProvice()+"' "; |
| | | sql+=" and tb_station_inf.provice='"+param.getProvice()+"' "; |
| | | } |
| | | if(param.getCity()!=null){ |
| | | sql+=" and tb_station_inf.city='"+param.getCity()+"' "; |
| | |
| | | sql+=" and tb_station_inf.station_name like '%"+param.getStationName()+"%' "; |
| | | } |
| | | if(param.getAlmLevel()!=null){ |
| | | sql+=" and history.alm_level="+param.getAlmLevel()+" "; |
| | | sql+=" and alarm.alm_level="+param.getAlmLevel()+" "; |
| | | } |
| | | List<Integer> almIds=param.getAlmIds(); |
| | | if(almIds!=null&&almIds.size()>0){ |
| | | sql+=" and history.alm_id in ( "; |
| | | sql+=" and alarm.alm_id in ( "; |
| | | for (int i=0;i<almIds.size();i++) { |
| | | sql+=almIds.get(i); |
| | | if(i!=(almIds.size()-1)){ |
| | |
| | | " and tb_power_inf.station_id=tb_station_inf.station_id "+ |
| | | " and alm_start_time>='"+ThreadLocalUtil.format(param.getAlmStartTime(),1)+"' and alm_start_time <='"+ThreadLocalUtil.format(param.getAlmEndTime(),1)+"' " ; |
| | | if(param.getProvice()!=null){ |
| | | sql+=" and tb_station_inf.province='"+param.getProvice()+"' "; |
| | | sql+=" and tb_station_inf.provice='"+param.getProvice()+"' "; |
| | | } |
| | | if(param.getCity()!=null){ |
| | | sql+=" and tb_station_inf.city='"+param.getCity()+"' "; |
| | |
| | | sql+=" and tb_station_inf.station_name like '%"+param.getStationName()+"%' "; |
| | | } |
| | | if(param.getAlmLevel()!=null){ |
| | | sql+=" and history.alm_level="+param.getAlmLevel()+" "; |
| | | sql+=" and alarm.alm_level="+param.getAlmLevel()+" "; |
| | | } |
| | | List<Integer> almIds=param.getAlmIds(); |
| | | if(almIds!=null&&almIds.size()>0){ |
| | | sql+=" and history.alm_id in ( "; |
| | | sql+=" and alarm.alm_id in ( "; |
| | | for (int i=0;i<almIds.size();i++) { |
| | | sql+=almIds.get(i); |
| | | if(i!=(almIds.size()-1)){ |
| | |
| | | PwrdevAlarmHistory ph=new PwrdevAlarmHistory(); |
| | | ph.setNum(rs.getLong("num")); |
| | | ph.setPowerId(rs.getInt("power_id")); |
| | | ph.setAlmId(rs.getInt("alm_id")); |
| | | ph.setPowerName(rs.getString("power_name")); |
| | | ph.setAlmLevel(rs.getInt("alm_level")); |
| | | ph.setAlmStartTime(rs.getTimestamp("alm_start_time")); |