From bc8eacc7f4412a274f64c79d79b702bca588ee8e Mon Sep 17 00:00:00 2001
From: 81041 <81041@192.168.10.30>
Date: 星期三, 14 十一月 2018 16:26:35 +0800
Subject: [PATCH] //11.1FBS9100设备通信状态查询<-------跨域----------->

---
 gx_tieta/src/com/fgkj/dao/impl/ram/Fbs9100_stateImpl.java |   76 +++++++++++++++++++++++++++++++++++++-
 1 files changed, 74 insertions(+), 2 deletions(-)

diff --git a/gx_tieta/src/com/fgkj/dao/impl/ram/Fbs9100_stateImpl.java b/gx_tieta/src/com/fgkj/dao/impl/ram/Fbs9100_stateImpl.java
index 4f890f9..72ca0a6 100644
--- a/gx_tieta/src/com/fgkj/dao/impl/ram/Fbs9100_stateImpl.java
+++ b/gx_tieta/src/com/fgkj/dao/impl/ram/Fbs9100_stateImpl.java
@@ -312,6 +312,73 @@
 		}
 		return list;
 	}
+	//11.1FBS9100璁惧閫氫俊鐘舵�佹煡璇�<-------璺ㄥ煙----------->
+	public List serchByCondition_ky() {
+		String sql="";
+		String baseSql="select  distinct tb_fbs9100_state.num,tb_fbs9100_state.dev_ip,tb_fbs9100_state.dev_version,record_datetime,tb_fbs9100_state.dev_id,op_cmd,dev_datetime,dev_testtype,dev_testgroupnum," +
+				"dev_workstate,dev_alarmstate,dev_res_test_state,dev_onlinevollow,dev_eachgroup_battsum,dev_captest_onlinevol,dev_captest_groupvol,dev_captest_curr," +
+				"dev_captest_cap,dev_captest_timelong,dev_restest_moncount,dev_restest_monindex,dev_commcount,dev_errcommcount,db_ram_db.tb_fbs9100_state.dev_61850alarms,dev_last_captest_stop_type, " +
+				"db_battinf.tb_battinf.StationName,db_battinf.tb_battinf.FbsDeviceName," +
+				"COUNT(DISTINCT db_battinf.tb_battinf.BattGroupId) as cnt," +
+				"group_CONCAT(db_ram_db.tb_batt_rtstate.online_vol ORDER BY db_ram_db.tb_batt_rtstate.BattGroupId separator '/') as online_vols,group_CONCAT(db_ram_db.tb_batt_rtstate.group_vol ORDER BY db_ram_db.tb_batt_rtstate.BattGroupId separator '/') as group_vols,group_CONCAT(db_ram_db.tb_batt_rtstate.group_curr ORDER BY db_ram_db.tb_batt_rtstate.BattGroupId separator '/') as group_currs  " +
+				"from db_ram_db.tb_Fbs9100_state " +
+				"left outer join db_battinf.tb_battinf ON tb_fbs9100_state.dev_id=db_battinf.tb_battinf.FBSDeviceId  " +
+				"LEFT OUTER JOIN db_ram_db.tb_batt_rtstate ON db_battinf.tb_battinf.battgroupid=db_ram_db.tb_batt_rtstate.battgroupid ";
+		//鍒嗙粍
+		String groupSql=" GROUP BY tb_fbs9100_state.dev_id ";
+		//鏈�鍚庣粨鏋�
+		sql=baseSql+groupSql;
+		//System.out.println(sql);
+		List<Fbs9100_state> list=DAOHelper.executeQueryLimit(sql, DBUtil.getConn(), null, new CallBack() {
+			List list=new ArrayList();
+			public List getResults(ResultSet rs) {
+				try {
+					while(rs.next()){
+						Fbs9100_state fstate=new Fbs9100_state();
+						fstate.setNum(rs.getInt("cnt"));//鍏宠仈鐢垫睜缁勪釜鏁�
+						fstate.setDev_ip(rs.getString("dev_ip"));
+						fstate.setDev_version(rs.getString("dev_version"));
+						fstate.setDev_id(rs.getInt("dev_id"));
+						fstate.setOp_cmd(rs.getInt("op_cmd"));
+						fstate.setRecord_datetime(rs.getString("record_datetime"));
+						fstate.setDev_datetime(rs.getString("dev_datetime"));
+						fstate.setDev_testtype(rs.getInt("dev_testtype"));
+						fstate.setDev_testgroupnum(rs.getInt("dev_testgroupnum"));
+						fstate.setDev_workstate(rs.getInt("dev_workstate"));
+						fstate.setDev_alarmstate(rs.getInt("dev_alarmstate"));
+						fstate.setDev_res_test_state(rs.getInt("dev_res_test_state"));
+						fstate.setDev_onlinevollow(rs.getInt("dev_onlinevollow"));
+						fstate.setDev_eachgroup_battsum(rs.getInt("dev_eachgroup_battsum"));
+						fstate.setDev_captest_onlinevol(rs.getFloat("dev_captest_onlinevol"));
+						fstate.setDev_captest_groupvol(rs.getFloat("dev_captest_groupvol"));
+						fstate.setDev_captest_curr(rs.getFloat("dev_captest_curr"));
+						fstate.setDev_captest_cap(rs.getFloat("dev_captest_cap"));
+						fstate.setDev_captest_timelong(rs.getInt("dev_captest_timelong"));
+						fstate.setDev_restest_moncount(rs.getInt("dev_restest_moncount"));
+						fstate.setDev_restest_monindex(rs.getInt("dev_restest_monindex"));
+						fstate.setDev_commcount(rs.getInt("dev_commcount"));
+						fstate.setDev_errcommcount(rs.getInt("dev_errcommcount"));
+						
+						fstate.setStationName(rs.getString("stationName"));
+						fstate.setDeviceName(rs.getString("FbsDeviceName"));
+						fstate.setOnline_vols(rs.getString("online_vols"));
+						fstate.setGroup_vols(rs.getString("group_vols"));
+						fstate.setGroup_currs(rs.getString("group_currs"));
+						fstate.setDev_61850alarms(rs.getString("dev_61850alarms"));
+						fstate.setDev_last_captest_stop_type(rs.getInt("dev_last_captest_stop_type"));
+						//System.out.println(fstate);
+						list.add(fstate);
+					}
+				} catch (SQLException e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+				}
+				return list;
+			}
+		});
+		return list;
+	}
+	
 	//鍒ゆ柇鏈烘埧瀹炴椂鏁版嵁涓鏈烘埧鏈夋病鏈夎繛鎺ュ埌鏈嶅姟鍣�
 	public int judgeSatationInState(int dev_id) {
 		String sql=" SELECT count(num) as nums from db_ram_db.tb_fbs9100_state where dev_id=? LIMIT 1 ";
@@ -839,6 +906,11 @@
 		for(Fbs9100_state f:list){
 			System.out.println(f);
 		}*/
+	    List<Fbs9100_state> list=fi.serchByCondition_ky();
+		System.out.println(list.size());
+		for(Fbs9100_state f:list){
+			System.out.println(f);
+		}
 	    /*BattInf binf=new BattInf();
 	    binf.setBattGroupId(1005069);
 	    List list=fi.serchByInfo(binf);
@@ -848,11 +920,11 @@
 	   //List<Fbs9100_state> list=fi.searchByUid(uinf);
 	   // List<Fbs9100_state> list=fi.searchDevWorkstate(fs);
 	   // List<Fbs9100_state> list=fi.seach6185Nuclear_cap(uinf);
-	    List<Fbs9100_state> list=fi.seachNuclear_cap(uinf);
+	   /* List<Fbs9100_state> list=fi.seachNuclear_cap(uinf);
 		System.out.println(list.size());
 		for(Fbs9100_state f:list){
 			System.out.println(f);
-		}
+		}*/
 	}
 
 }

--
Gitblit v1.9.1