From 30df21c8751c3d0d1639727a0e9352882dca4c1b Mon Sep 17 00:00:00 2001
From: 81041 <81041@192.168.10.25>
Date: 星期一, 22 十月 2018 09:33:00 +0800
Subject: [PATCH] 基站实时状态和基站统计添加用户管理

---
 gx_tieta/src/com/fgkj/dao/impl/Bts_station_eventImpl.java        |   29 +++++++++++---
 gx_tieta/src/com/fgkj/actions/Bts_station_eventAction.java       |    5 ++
 gx_tieta/src/com/fgkj/services/ram/Bts_station_stateService.java |    7 +++
 gx_tieta/src/com/fgkj/dao/impl/ram/Bts_station_stateImpl.java    |   37 ++++++++++++++----
 gx_tieta/src/com/fgkj/actions/ram/Bts_station_stateAction.java   |   10 +++++
 5 files changed, 72 insertions(+), 16 deletions(-)

diff --git a/gx_tieta/src/com/fgkj/actions/Bts_station_eventAction.java b/gx_tieta/src/com/fgkj/actions/Bts_station_eventAction.java
index b65ea75..cc71771 100644
--- a/gx_tieta/src/com/fgkj/actions/Bts_station_eventAction.java
+++ b/gx_tieta/src/com/fgkj/actions/Bts_station_eventAction.java
@@ -5,6 +5,7 @@
 import com.fgkj.dto.BattInf;
 import com.fgkj.dto.Bts_station_event;
 import com.fgkj.dto.ServiceModel;
+import com.fgkj.dto.User_inf;
 import com.fgkj.services.Batt_devalarm_data_historyService;
 import com.fgkj.services.Bts_station_eventService;
 
@@ -17,6 +18,8 @@
 	//鏈烘埧浜嬩欢缁熻
 	public String serchByCondition(){
 		BattInf binf=getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, BattInf.class);
+		User_inf uinf=(User_inf) getUser();
+		binf.setNum(uinf.getUId());
 		ServiceModel model=service.serchByCondition(binf);
 		result=tojson(model);
 		return SUCCESS;
@@ -24,6 +27,8 @@
 	//鏈烘埧浜嬩欢缁熻
 	public String serchByInfo(){
 		Bts_station_event bevent=getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, Bts_station_event.class);
+		User_inf uinf=(User_inf) getUser();
+		bevent.setNum(uinf.getUId());
 		ServiceModel model=service.serchByInfo(bevent);
 		result=tojson(model);
 		return SUCCESS;
diff --git a/gx_tieta/src/com/fgkj/actions/ram/Bts_station_stateAction.java b/gx_tieta/src/com/fgkj/actions/ram/Bts_station_stateAction.java
index d9b5ec5..a3acfa2 100644
--- a/gx_tieta/src/com/fgkj/actions/ram/Bts_station_stateAction.java
+++ b/gx_tieta/src/com/fgkj/actions/ram/Bts_station_stateAction.java
@@ -3,6 +3,7 @@
 import com.fgkj.actions.ActionUtil;
 import com.fgkj.dto.BattInf;
 import com.fgkj.dto.ServiceModel;
+import com.fgkj.dto.User_inf;
 import com.fgkj.services.ram.Bts_station_stateService;
 
 public class Bts_station_stateAction extends ActionUtil{
@@ -12,10 +13,19 @@
     //鏌ヨ鏈烘埧瀹炴椂鐘舵��
     public String serchByCondition(){
     	BattInf binf=getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, BattInf.class);
+    	User_inf uinf=(User_inf) getUser();
+    	binf.setNum(uinf.getUId());
     	ServiceModel model=service.serchByCondition(binf);
     	result=tojson(model);
     	return SUCCESS;
     }
+  //鏌ヨ褰撳墠鏈烘埧鍋滅數鏁�
+    public String serchByState(){
+    	User_inf uinf=(User_inf) getUser();
+    	ServiceModel model=service.serchByState(uinf);
+    	result=tojson(model);
+    	return SUCCESS;
+    }
     
     
     
diff --git a/gx_tieta/src/com/fgkj/dao/impl/Bts_station_eventImpl.java b/gx_tieta/src/com/fgkj/dao/impl/Bts_station_eventImpl.java
index cb3f729..288bc51 100644
--- a/gx_tieta/src/com/fgkj/dao/impl/Bts_station_eventImpl.java
+++ b/gx_tieta/src/com/fgkj/dao/impl/Bts_station_eventImpl.java
@@ -57,6 +57,13 @@
 		String sql="select station_id,dev_id,station_event_type,record_datetime,station_event_trig ,tb_battinf.StationName,tb_battinf.StationName1,tb_battinf.StationName2,tb_battinf.StationName3 " +
 				" from db_alarm.tb_bts_station_event,db_battinf.tb_battinf " +
 				" where  tb_bts_station_event.dev_id=tb_battinf.FBSDeviceId " +
+				"  and tb_bts_station_event.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  record_datetime>=?  and  record_datetime<=?  " +
 				" and stationname1 like ? and stationname2 like  ? and stationname3 like ? and stationid like ? " ;
 		/*//浜嬩欢绛涢��
@@ -74,7 +81,7 @@
 		String orderSql="  order by station_id,record_datetime,station_event_type asc  ";
 		sql+=orderSql;
 		//System.err.println(sql);
-		List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{binf.getBattInUseDate(),binf.getBattInUseDate1(),"%"+binf.getStationName1()+"%","%"+binf.getStationName2()+"%","%"+binf.getStationName3()+"%","%"+binf.getStationId()+"%"}, new CallBack() {
+		List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{binf.getNum(),binf.getBattInUseDate(),binf.getBattInUseDate1(),"%"+binf.getStationName1()+"%","%"+binf.getStationName2()+"%","%"+binf.getStationName3()+"%","%"+binf.getStationId()+"%"}, new CallBack() {
 			
 			public List getResults(ResultSet rs) {
 				List list=new ArrayList();
@@ -300,6 +307,13 @@
 		String sql="select  distinct station_id,dev_id,station_event_type,record_datetime,station_event_trig ,tb_battinf.StationName,tb_battinf.StationName1,tb_battinf.StationName2,tb_battinf.StationName3 " +
 				" from db_alarm.tb_bts_station_event,db_battinf.tb_battinf " +
 				" where  tb_bts_station_event.dev_id=tb_battinf.FBSDeviceId " +
+				"  and tb_bts_station_event.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 dev_id=?  " +
 				" and  record_datetime>=?  and  record_datetime<=? ";
 		//鍩虹珯鐘舵��
@@ -318,7 +332,7 @@
 		//sql+=limitSql;
 		//,(p.getPageCurr()-1)*p.getPageSize(),p.getPageSize()
 		//executeQueryLimit
-		List<Bts_station_event> list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{bevent.getDev_id(),bevent.getRecord_datetime(),bevent.getRecord_datetime_end(),bevent.getStation_event_type()}, new CallBack() {
+		List<Bts_station_event> list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{bevent.getNum(),bevent.getDev_id(),bevent.getRecord_datetime(),bevent.getRecord_datetime_end(),bevent.getStation_event_type()}, new CallBack() {
 			
 			public List getResults(ResultSet rs) {
 				List list=new ArrayList();
@@ -371,7 +385,7 @@
 		
 		
 		BattInf binf = new BattInf();
-		binf.setNum(0);
+		binf.setNum(1002);
 	    binf.setStationName("");
 		binf.setStationName1("");
 		binf.setStationName2("");
@@ -387,12 +401,13 @@
 		bmd.setPage(p);
 		bmd.setBinf(binf);
         bmd.setUinf(uinf);
-       /* List<Bts_station_event> list=bimpl.serchByCondition(binf);
+        List<Bts_station_event> list=bimpl.serchByCondition(binf);
         System.out.println(list.size());
         for (Bts_station_event b : list) {
 			System.out.println(b.getNote()+" "+b.getDev_id()+" "+b.getStation_event_type_poff()+" "+b.getStation_event_type_xuhang()+" "+b.getStation_event_type_fadian()+" "+b.getStation_event_type_diaozhan()+" "+b.getStation_event_type_dooropen()+" "+b.getStation_event_type_tempup()+" "+b.getStation_event_type_templow()+" "+b.getStation_event_type_dampup()+" "+b.getStation_event_type_damplow()+" "+b.getStationName());
-		}*/
+		}
         Bts_station_event b=new Bts_station_event();
+        b.setNum(1002);
         b.setDev_id(910000001);
         b.setRecord_datetime(ActionUtil.getSimpDate(date1));
         b.setRecord_datetime_end(ActionUtil.getSimpDate(date2));
@@ -401,8 +416,8 @@
         page.setPageCurr(1);
         page.setPageSize(10);
         b.setPage(page);
-        List list=bimpl.serchByInfo(b);
-        System.out.println(list.size());
+        /*List list=bimpl.serchByInfo(b);
+        System.out.println(list.size());*/
 	}
 
 }
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 008fde0..d1bd387 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
@@ -10,9 +10,11 @@
 import com.fgkj.dao.CallBack;
 import com.fgkj.dao.DAOHelper;
 import com.fgkj.dao.LimitNumberFactory;
+import com.fgkj.dao.UinfDaoFactory;
 import com.fgkj.db.DBUtil;
 import com.fgkj.dto.BattInf;
 import com.fgkj.dto.Page;
+import com.fgkj.dto.User_inf;
 import com.fgkj.dto.ram.Bts_station_state;
 
 public class Bts_station_stateImpl implements BaseDAO,CallBack{
@@ -52,10 +54,16 @@
 				   " ,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_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 ?  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() {
+		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() {
 			
 			public List getResults(ResultSet rs) {
 				List list=new ArrayList();
@@ -112,9 +120,17 @@
 		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 int serchByState(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&2>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();
@@ -142,21 +158,24 @@
 	public static void main(String[] args) {
 		Bts_station_stateImpl bimpl=new Bts_station_stateImpl();
 		BattInf binf=new BattInf();
+		binf.setNum(1002);
 		binf.setStationName1("");
 		binf.setStationName2("");
 		binf.setStationName3("");
 		binf.setStationId("");
+		User_inf uinf=new User_inf();
+		uinf.setUId(1002);
 		Page p=new Page();
 		p.setPageCurr(1);
 		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_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);
+		}
+		/*int nums=bimpl.serchByState(uinf);
+		System.out.println(nums);*/
 	}
 
 	
diff --git a/gx_tieta/src/com/fgkj/services/ram/Bts_station_stateService.java b/gx_tieta/src/com/fgkj/services/ram/Bts_station_stateService.java
index 31ed580..10eec0b 100644
--- a/gx_tieta/src/com/fgkj/services/ram/Bts_station_stateService.java
+++ b/gx_tieta/src/com/fgkj/services/ram/Bts_station_stateService.java
@@ -4,6 +4,7 @@
 
 import com.fgkj.dao.BaseDAO;
 import com.fgkj.dao.BaseDAOFactory;
+import com.fgkj.dao.impl.ram.Bts_station_stateImpl;
 import com.fgkj.dto.ServiceModel;
 
 public class Bts_station_stateService {
@@ -28,5 +29,11 @@
 		}
 		return model;	
 	}
+	//鏌ヨ褰撳墠鏈烘埧鍋滅數鏁�
+	public ServiceModel serchByState(Object obj) {
+		int nums=((Bts_station_stateImpl)dao).serchByState(obj);
+		model.setNewsum(nums);
+		return model;	
+	}
 
 }

--
Gitblit v1.9.1