| | |
| | | import com.fgkj.dao.UinfDaoFactory;
|
| | | import com.fgkj.db.DBUtil;
|
| | | import com.fgkj.dto.BattInf;
|
| | | import com.fgkj.dto.BattMap_information;
|
| | | import com.fgkj.dto.Page;
|
| | | import com.fgkj.dto.User_inf;
|
| | | import com.fgkj.dto.ram.Bts_station_state;
|
| | |
| | | String numberSql="SELECT FOUND_ROWS() number";//存放总数
|
| | | String sql="select SQL_CALC_FOUND_ROWS distinct station_id,dev_id,record_datetime,station_stat,station_poff_start_time,station_fadian_start_time" +
|
| | | " ,station_diaozhan_start_time,station_temp,station_damp,station_dooropen_start_time,station_xuhang_start_time" +
|
| | | " ,tb_battinf.stationname,tb_battinf.stationname1,tb_battinf.stationname2,tb_battinf.stationname3 " +
|
| | | " ,tb_battinf.stationname,tb_battinf.stationname1,tb_battinf.stationname2,tb_battinf.stationname3,tb_battinf.stationname5 " +
|
| | | " from db_ram_db.tb_bts_station_state,db_battinf.tb_battinf " +
|
| | | " where tb_bts_station_state.dev_id=db_battinf.tb_battinf.FBSDeviceId " +
|
| | | " and tb_bts_station_state.station_id in (" +
|
| | | " and tb_battinf.stationname1 like ? and tb_battinf.stationname2 like ? and tb_battinf.stationname3 like ? and tb_battinf.stationname5 like ? " +
|
| | | " and stationid like ? " ;
|
| | | /*" and tb_bts_station_state.station_id in (" +
|
| | | " select distinct db_battinf.tb_battinf.stationid " +
|
| | | " from db_battinf.tb_battinf " +
|
| | | " left outer join db_user.tb_user_battgroup_baojigroup_battgroup on db_user.tb_user_battgroup_baojigroup_battgroup.stationid=db_battinf.tb_battinf.stationid " +
|
| | | " left outer join db_user.tb_user_battgroup_baojigroup_usr on db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id=db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id " +
|
| | | " left outer join db_user.tb_user_inf on tb_user_inf.uid=db_user.tb_user_battgroup_baojigroup_usr.uid " +
|
| | | " where db_user.tb_user_inf.uid=? and tb_battinf.stationname1 like ? and tb_battinf.stationname2 like ? and tb_battinf.stationname3 like ? ) " +
|
| | | " and stationid like ? " ;
|
| | | " and stationid like ? " ;*/
|
| | | //用户管理
|
| | | String userSql=" and StationId in(" +
|
| | | " select distinct db_user.tb_user_battgroup_baojigroup_battgroup.StationId from db_user.tb_user_battgroup_baojigroup_battgroup,db_user.tb_user_battgroup_baojigroup_usr where db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id=db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id and db_user.tb_user_battgroup_baojigroup_usr.uId=?" +
|
| | | " ) ";
|
| | | sql+=userSql;
|
| | | if(binf.getBattGroupNum()>1){
|
| | | sql+=" and ( ";
|
| | | }
|
| | |
| | | sql+=" ) ";
|
| | | }
|
| | | if(binf.getBattGroupNum()==0){
|
| | | sql+=" and station_stat=0 ";
|
| | | sql+=" and station_stat<0 "; //当没有选择想要查看的机房异常状态是筛选
|
| | | }
|
| | | //分页
|
| | | String orderSql=" limit ? ,? ";
|
| | | sql+=orderSql;
|
| | | //System.out.println(sql);
|
| | | List<Bts_station_state> list=DAOHelper.executeQueryLimit(sql, conn, new Object[]{binf.getNum(),"%"+binf.getStationName1()+"%","%"+binf.getStationName2()+"%","%"+binf.getStationName3()+"%","%"+binf.getStationId()+"%",(p.getPageCurr()-1)*p.getPageSize(),p.getPageSize()},new CallBack() {
|
| | | List<Bts_station_state> list=DAOHelper.executeQueryLimit(sql, conn, new Object[]{"%"+binf.getStationName1()+"%","%"+binf.getStationName2()+"%","%"+binf.getStationName3()+"%","%"+binf.getStationName5()+"%","%"+binf.getStationId()+"%",binf.getNum(),(p.getPageCurr()-1)*p.getPageSize(),p.getPageSize()},new CallBack() {
|
| | |
|
| | | public List getResults(ResultSet rs) {
|
| | | List list=new ArrayList();
|
| | |
| | | b.setStationName1(rs.getString("stationName1"));
|
| | | b.setStationName2(rs.getString("stationName2"));
|
| | | b.setStationName3(rs.getString("stationName3"));
|
| | | b.setStationName5(rs.getString("stationName5"));
|
| | | Page page=new Page();
|
| | | b.setPage(page);
|
| | | list.add(b);
|
| | |
| | | }
|
| | | return nums;
|
| | | }
|
| | | //查询当前机房掉战数
|
| | | public int serchByState_diaozhan(Object obj) {
|
| | | User_inf uinf=(User_inf) obj;
|
| | | String sql=" select count(*) as nums from db_ram_db.tb_bts_station_state where station_stat&32>1 " +
|
| | | " and tb_bts_station_state.station_id in (" +
|
| | | " select distinct db_battinf.tb_battinf.stationid " +
|
| | | " from db_battinf.tb_battinf " +
|
| | | " left outer join db_user.tb_user_battgroup_baojigroup_battgroup on db_user.tb_user_battgroup_baojigroup_battgroup.stationid=db_battinf.tb_battinf.stationid " +
|
| | | " left outer join db_user.tb_user_battgroup_baojigroup_usr on db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id=db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id " +
|
| | | " left outer join db_user.tb_user_inf on tb_user_inf.uid=db_user.tb_user_battgroup_baojigroup_usr.uid " +
|
| | | " where db_user.tb_user_inf.uid=? ) " ;
|
| | | List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{uinf.getUId()}, new CallBack() {
|
| | | |
| | | public List getResults(ResultSet rs) {
|
| | | List list=new ArrayList();
|
| | | try {
|
| | | while(rs.next()){
|
| | | list.add(rs.getInt("nums"));
|
| | | }
|
| | | } catch (SQLException e) {
|
| | | // TODO Auto-generated catch block
|
| | | e.printStackTrace();
|
| | | }
|
| | | return list;
|
| | | }
|
| | | });
|
| | | int nums=0;//总数
|
| | | if(list!=null&&list.size()>0){
|
| | | nums=(Integer) list.get(list.size()-1);
|
| | | }
|
| | | return nums;
|
| | | }
|
| | | //查询当前机房停电数(根据station_id )
|
| | | public int serchByStationId(Object obj) {
|
| | | BattMap_information binformation=(BattMap_information) obj;
|
| | | String sql="select count(num) as nums from db_ram_db.tb_bts_station_state " +
|
| | | " where station_stat&2>1 " +
|
| | | " and station_id=? " +
|
| | | " limit 1 ";
|
| | | //System.out.println(sql);
|
| | | List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{binformation.getStationId()}, new CallBack() {
|
| | | |
| | | public List getResults(ResultSet rs) {
|
| | | List list=new ArrayList();
|
| | | try {
|
| | | while(rs.next()){
|
| | | int nums=rs.getInt("nums");
|
| | | list.add(nums);
|
| | | }
|
| | | } catch (SQLException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | return list;
|
| | | }
|
| | | });
|
| | | int nums=0;//最后的结果
|
| | | if(list!=null&&list.size()>0){
|
| | | nums=(Integer) list.get(list.size()-1);
|
| | | }
|
| | | return nums;
|
| | | }
|
| | | public List serchByInfo(Object obj) {
|
| | | // TODO Auto-generated method stub
|
| | | return null;
|
| | |
| | | //System.out.println(bs.getStation_stat_diaozhan()+" "+bs.getStation_stat_dooropen()+" "+bs.getStation_stat_fadian()+" "+bs.getStation_stat_xuhang()+" "+bs.getStation_stat_poff());
|
| | | System.out.println(bs);
|
| | | }
|
| | | /*int nums=bimpl.serchByState(uinf);
|
| | | System.out.println(nums);*/
|
| | | /*int nums=bimpl.serchByState(uinf);*/
|
| | | /*BattMap_information bm=new BattMap_information();
|
| | | bm.setStationId("42000570");
|
| | | int nums=bimpl.serchByStationId(bm);*/
|
| | | int nums=bimpl.serchByState_diaozhan(uinf);
|
| | | System.out.println(nums);
|
| | | }
|
| | |
|
| | |
|