From db9cf3a73dea628d292c6d9fef922c6fded71a33 Mon Sep 17 00:00:00 2001 From: 81041 <81041@192.168.10.28> Date: 星期五, 12 十月 2018 14:03:06 +0800 Subject: [PATCH] 机房实时状态 --- gx_tieta/src/com/fgkj/dao/impl/ram/Bts_station_stateImpl.java | 98 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 92 insertions(+), 6 deletions(-) diff --git a/gx_tieta/src/com/fgkj/dao/impl/ram/Bts_station_stateImpl.java b/gx_tieta/src/com/fgkj/dao/impl/ram/Bts_station_stateImpl.java index c0dd585..0d191aa 100644 --- a/gx_tieta/src/com/fgkj/dao/impl/ram/Bts_station_stateImpl.java +++ b/gx_tieta/src/com/fgkj/dao/impl/ram/Bts_station_stateImpl.java @@ -1,10 +1,18 @@ package com.fgkj.dao.impl.ram; +import java.sql.Connection; import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; import java.util.List; import com.fgkj.dao.BaseDAO; import com.fgkj.dao.CallBack; +import com.fgkj.dao.DAOHelper; +import com.fgkj.dao.LimitNumberFactory; +import com.fgkj.db.DBUtil; +import com.fgkj.dto.BattInf; +import com.fgkj.dto.Page; import com.fgkj.dto.ram.Bts_station_state; public class Bts_station_stateImpl implements BaseDAO,CallBack{ @@ -35,12 +43,73 @@ } //鏌ヨ鏈烘埧瀹炴椂鐘舵�� public List serchByCondition(Object obj) { - Bts_station_state bs=(Bts_station_state) obj; - String sql="select distinct station_id,dev_id,record_datetime,station_stat,station_poff_start_time,station_poff_tlong,station_fadian_start_time,station_fadian_tlong" + - " ,station_diaozhan_start_time,station_diaozhan_tlong,station_temp,station_damp,station_dooropen_start_time,station_dooropen_tlong " + - " from db_ram_db.tb_bts_station_station_state " + - " where "; - return null; + BattInf binf=(BattInf) obj; + Page p=new Page(); + Connection conn=DBUtil.getConn(); + 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_poff_tlong,station_fadian_start_time,station_fadian_tlong" + + " ,station_diaozhan_start_time,station_diaozhan_tlong,station_temp,station_damp,station_dooropen_start_time,station_dooropen_tlong" + + " ,tb_battinf.stationname,tb_battinf.stationname1,tb_battinf.stationname2,tb_battinf.stationname3 " + + " 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=db_battinf.tb_battinf.StationId " + + " and tb_battinf.stationname1 like ? and tb_battinf.stationname2 like ? and tb_battinf.stationname3 like ? " + + " and stationid like ? limit ? ,? "; + List<Bts_station_state> list=DAOHelper.executeQueryLimit(sql, conn, new Object[]{"%"+binf.getStationName1()+"%","%"+binf.getStationName2()+"%","%"+binf.getStationName3()+"%","%"+binf.getStationId()+"%",(p.getPageCurr()-1)*p.getPageSize(),p.getPageSize()},new CallBack() { + + public List getResults(ResultSet rs) { + List list=new ArrayList(); + try { + while(rs.next()){ + Bts_station_state b=new Bts_station_state(); + b.setStation_id(rs.getString("station_id")); + b.setDev_id(rs.getInt("dev_id")); + b.setRecord_datetime(rs.getTimestamp("record_datetime")); + b.setStation_stat(rs.getInt("station_stat")); + if(((b.getStation_stat()>>3)&1)==1){ + b.setStation_stat_dooropen(1);//寮�闂� + } + if(((b.getStation_stat()>>2)&1)==1){ + b.setStation_stat_diaozhan(1);//鎺夌珯 + } + if(((b.getStation_stat()>>1)&1)==1){ + b.setStation_stat_fadian(1); //鍙戠數 + } + if((b.getStation_stat()&1)==1){ + b.setStation_stat_poff(1); //鍋滅數 + } + b.setStation_poff_start_time(rs.getTimestamp("station_poff_start_time")); + b.setStation_poff_tlong(rs.getInt("station_poff_tlong")); + b.setStation_fadian_start_time(rs.getTimestamp("station_fadian_start_time")); + b.setStation_fadian_tlong(rs.getInt("station_fadian_tlong")); + b.setStation_diaozhan_start_time(rs.getTimestamp("station_diaozhan_start_time")); + b.setStation_diaozhan_tlong(rs.getInt("station_diaozhan_tlong")); + b.setStation_temp(rs.getFloat("station_temp")); + b.setStation_damp(rs.getFloat("station_damp")); + b.setStation_dooropen_start_time(rs.getTimestamp("station_dooropen_start_time")); + b.setStation_dooropen_tlong(rs.getInt("station_dooropen_tlong")); + b.setStationName(rs.getString("stationName")); + b.setStationName1(rs.getString("stationName1")); + b.setStationName2(rs.getString("stationName2")); + b.setStationName3(rs.getString("stationName3")); + Page page=new Page(); + b.setPage(page); + list.add(b); + } + } catch (SQLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return list; + } + }); + //鍘绘帀limit鏉′欢鍚庣殑鎬绘暟 + int number=LimitNumberFactory.GetLimtitNumber(conn, numberSql); + //System.out.println("number: "+number); + if(list!=null&&list.size()>0){ + list.get(list.size()-1).getPage().setPageAll(number); + } + return list; } public List serchByInfo(Object obj) { @@ -48,4 +117,21 @@ return null; } + public static void main(String[] args) { + Bts_station_stateImpl bimpl=new Bts_station_stateImpl(); + BattInf binf=new BattInf(); + binf.setStationName1(""); + binf.setStationName2(""); + binf.setStationName3(""); + binf.setStationId(""); + Page p=new Page(); + p.setPageCurr(1); + p.setPageSize(10); + binf.setPage(p); + List<Bts_station_state> list=bimpl.serchByCondition(binf); + for (Bts_station_state bs : list) { + //System.out.println(bs.getStation_stat_dooropen()+" "+bs.getStation_stat_diaozhan()+" "+bs.getStation_stat_fadian()+" "+bs.getStation_stat_poff()); + System.out.println(bs); + } + } } -- Gitblit v1.9.1