From 2742ccd93c17503aafcf4ab2cbc5b1790bcb76df Mon Sep 17 00:00:00 2001
From: hdw <496960745@qq.com>
Date: 星期一, 22 十月 2018 10:22:46 +0800
Subject: [PATCH] 后台输出

---
 gx_tieta/src/com/fgkj/dao/impl/ram/Bts_station_stateImpl.java |   64 ++++++++++++++++++++++---------
 1 files changed, 45 insertions(+), 19 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 0d191aa..008fde0 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
@@ -44,11 +44,11 @@
     //鏌ヨ鏈烘埧瀹炴椂鐘舵��
 	public List serchByCondition(Object obj) {
 		BattInf binf=(BattInf) obj;
-		Page p=new Page();
+		Page p=binf.getPage();
 		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" +
+		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 " +
 				   " from db_ram_db.tb_bts_station_state,db_battinf.tb_battinf  " +
 				   " where  tb_bts_station_state.dev_id=db_battinf.tb_battinf.FBSDeviceId  " +
@@ -66,28 +66,28 @@
 						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){
+						if(((b.getStation_stat()>>5)&1)==1){
 							b.setStation_stat_diaozhan(1);//鎺夌珯
 						}
-						if(((b.getStation_stat()>>1)&1)==1){
+						if(((b.getStation_stat()>>4)&1)==1){
+							b.setStation_stat_dooropen(1);//寮�闂�
+						}
+						if(((b.getStation_stat()>>3)&1)==1){
 							b.setStation_stat_fadian(1);  //鍙戠數
 						}
-						if((b.getStation_stat()&1)==1){
+						if(((b.getStation_stat()>>2)&1)==1){
+							b.setStation_stat_xuhang(1);//缁埅
+						}
+						if(((b.getStation_stat()>>1)&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.setStation_xuhang_start_time(rs.getTimestamp("station_xuhang_start_time"));
 						b.setStationName(rs.getString("stationName"));
 						b.setStationName1(rs.getString("stationName1"));
 						b.setStationName2(rs.getString("stationName2"));
@@ -111,12 +111,34 @@
 		}
 		return list;
 	}
-
+    //鏌ヨ褰撳墠鏈烘埧鍋滅數鏁�
+	public int serchByState() {
+		String sql=" select count(*) as nums from db_ram_db.tb_bts_station_state where station_stat&2>1  ";
+		List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), null, 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;
+	}
 	public List serchByInfo(Object obj) {
 		// TODO Auto-generated method stub
 		return null;
 	}
-
 	public static void main(String[] args) {
 		Bts_station_stateImpl bimpl=new Bts_station_stateImpl();
 		BattInf binf=new BattInf();
@@ -126,12 +148,16 @@
 		binf.setStationId("");
 		Page p=new Page();
 		p.setPageCurr(1);
-		p.setPageSize(10);
+		p.setPageSize(1);
 		binf.setPage(p);
-		List<Bts_station_state> list=bimpl.serchByCondition(binf);
+		/*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.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();
+		System.out.println(nums);
 	}
+
+	
 }

--
Gitblit v1.9.1