From 929449c99fbfeade6dbafae1c06c79cec22e7f61 Mon Sep 17 00:00:00 2001
From: 81041 <81041@192.168.10.30>
Date: 星期三, 14 十一月 2018 17:01:37 +0800
Subject: [PATCH] 电池组放电记录查询<-------跨域>

---
 gx_tieta/src/com/fgkj/services/Batttestdata_infService.java |   28 +++++++++----
 gx_tieta/src/com/fgkj/dao/impl/Batttestdata_infDAOImpl.java |   69 +++++++++++++++++++++++++++++++++-
 2 files changed, 86 insertions(+), 11 deletions(-)

diff --git a/gx_tieta/src/com/fgkj/dao/impl/Batttestdata_infDAOImpl.java b/gx_tieta/src/com/fgkj/dao/impl/Batttestdata_infDAOImpl.java
index 0371f9a..4403217 100644
--- a/gx_tieta/src/com/fgkj/dao/impl/Batttestdata_infDAOImpl.java
+++ b/gx_tieta/src/com/fgkj/dao/impl/Batttestdata_infDAOImpl.java
@@ -206,7 +206,63 @@
 			}
 		});
 	}
-
+	//鍘嗗彶鏁版嵁鏌ヨ<-------璺ㄥ煙----------->
+	public List serchByCondition_ky(Object obj) {
+	    final Batttestdata_inf bti=(Batttestdata_inf)obj;
+		String sql="select num,BattGroupId,test_record_count,test_record_count_ex,test_type,record_time_interval,data_new,data_available,record_num,test_starttime,test_starttime_ex,test_starttype,record_time,test_timelong,test_stoptype,group_vol,test_curr,test_cap,max_monnum,max_monvol,min_monnum,min_monvol,mon_num,mon_vol,upload_usr_id " +
+				" from db_batt_testdata.tb_batttestdata_inf where BattGroupId=?  " +
+				" and  db_batt_testdata.tb_batttestdata_inf.data_available=1 " +
+				" order by test_type asc,test_starttime desc ";
+		return DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{bti.getBattGroupId()}, new CallBack() {
+			
+			public List getResults(ResultSet rs) {
+				List list=new ArrayList();
+				try {
+					while(rs.next()){
+						Batttestdata_inf b=new Batttestdata_inf();
+						b.setNum(rs.getInt("num"));
+						b.setBattGroupId(rs.getInt("BattGroupId"));
+						b.setTest_record_count(rs.getInt("test_record_count"));
+						b.setTest_record_count_ex(rs.getInt("test_record_count_ex"));
+						b.setTest_type(rs.getInt("test_type"));
+						b.setRecord_time_interval(rs.getInt("record_time_interval"));
+						b.setData_new(rs.getInt("data_new"));
+						b.setData_available(rs.getInt("data_available"));						
+						b.setRecord_num(rs.getInt("record_num"));
+						b.setTest_starttime(rs.getTimestamp("test_starttime"));
+						b.setTest_starttime_ex(rs.getTimestamp("test_starttime_ex"));
+						b.setTest_starttype(rs.getInt("test_starttype"));
+						b.setRecord_time(rs.getTimestamp("record_time"));
+						b.setTest_timelong(rs.getInt("test_timelong"));
+						b.setTest_stoptype(rs.getInt("test_stoptype"));
+						//鏀剧數缁堟鍘熷洜
+						
+						if(bti.getNum()/100000==6185){
+							b.setTest_stoptype_reason(BattTestData.getStopType_6185(b.getTest_stoptype()));							
+						}else if(bti.getNum()/100000==4016){
+							b.setTest_stoptype_reason(BattTestData.getStopType_4016(b.getTest_stoptype()));
+						}else{
+							b.setTest_stoptype_reason(BattTestData.getStopType(b.getTest_starttype(), b.getTest_stoptype()));
+						}
+						b.setGroup_vol(rs.getFloat("group_vol"));
+						b.setTest_curr(rs.getFloat("test_curr"));
+						b.setTest_cap(rs.getFloat("test_cap"));
+						b.setMax_monnum(rs.getInt("max_monnum"));
+						b.setMax_monvol(rs.getFloat("max_monvol"));
+						b.setMin_monnum(rs.getInt("min_monnum"));
+						b.setMin_monvol(rs.getFloat("min_monvol"));
+						b.setMon_num(rs.getInt("mon_num"));
+						b.setMon_vol(rs.getFloat("mon_vol"));
+						b.setUpload_usr_id(rs.getInt("upload_usr_id"));
+						list.add(b);
+					}
+				} catch (SQLException e) {
+					e.printStackTrace();
+				} 
+				return list;
+			}
+		});
+	}
 	//6.2鏍规嵁battgroupi鍜宼est_starttime鏌est_record_count
 	public List serchTest_record_count(Object obj) {
 		Batttestdata_inf tdata=(Batttestdata_inf)obj;
@@ -1017,11 +1073,20 @@
 		Batt_Maint_Dealarm bmd=new Batt_Maint_Dealarm();
 		bmd.setTdata(tdata);
 		bmd.setBinf(binf);
-		List<Batt_Maint_Dealarm> list=bimpl.serchByInfo(bmd);
+		/*List<Batt_Maint_Dealarm> list=bimpl.serchByInfo(bmd);
 		for (Batt_Maint_Dealarm b : list) {
 			System.out.println(b);
 		}
 		System.out.println(list.size());
+        */
+		Batttestdata_inf tinf=new Batttestdata_inf();
+		tinf.setBattGroupId(1002095);
+		tinf.setNum(910000577);
+		List<Batttestdata_inf> list=bimpl.serchByCondition_ky(tinf);
+		for (Batttestdata_inf b : list) {
+			System.out.println(b);
+		}
+		System.out.println(list.size());
 
 	}
 
diff --git a/gx_tieta/src/com/fgkj/services/Batttestdata_infService.java b/gx_tieta/src/com/fgkj/services/Batttestdata_infService.java
index 0515fb6..d93eb39 100644
--- a/gx_tieta/src/com/fgkj/services/Batttestdata_infService.java
+++ b/gx_tieta/src/com/fgkj/services/Batttestdata_infService.java
@@ -30,10 +30,12 @@
 		model=new ServiceModel();
 		dao=BaseDAOFactory.getBaseDAO(BaseDAO.BATTTESTDATA_INF);
 		daoB=BaseDAOFactory.getBaseDAO(BaseDAO.BATTINF);
-	}
-	
-	public ServiceModel serchByCondition(Object obj){
 		model=new ServiceModel();
+	}
+	/**
+	 * 鏍规嵁鐢垫睜缁刬d鏌ヨ鐢垫睜缁勭殑inf琛ㄤ腑鐨勬斁鐢典俊鎭�
+	 */
+	public ServiceModel serchByCondition(Object obj){
 		List<Batttestdata_inf> list=dao.serchByCondition(obj);		
 		if(list!=null && list.size()>0){
 			model=judge(obj);			
@@ -42,16 +44,25 @@
 				model.setData(list);
 			}
 		}
-//		for (Batttestdata_inf u :list) {
-//			System.out.println(u);
-//		}
 		return model;
 	}
 
-	
+	/**
+	 * 鏍规嵁鐢垫睜缁刬d鏌ヨ鐢垫睜缁勭殑inf琛ㄤ腑鐨勬斁鐢典俊鎭�<-------璺ㄥ煙----------->
+	 */
+	public ServiceModel serchByCondition_ky(Object obj){
+		List<Batttestdata_inf> list=((Batttestdata_infDAOImpl)dao).serchByCondition_ky(obj);		
+		if(list!=null && list.size()>0){
+			model=judge(obj);			
+			if(model.getCode()!=0){
+				model.setCode(1);
+				model.setData(list);
+			}
+		}
+		return model;
+	}
    //娴嬭瘯battgroupid鍦╞atttestdata_inf涓槸鍚﹀瓨鍦�
 	public ServiceModel judge(Object obj){
-		model=new ServiceModel();
 		Batttestdata_inf bti=(Batttestdata_inf)obj;
 		if(bti.getBattGroupId()!=null){		
 			//System.out.println(bti.getBattGroupId());
@@ -69,7 +80,6 @@
 	//1.2/1.3鐢垫睜缁勭粺璁″垎鏋愭煡璇�
 	public ServiceModel serchByTestType1(Object obj){
 		Batttestdata_inf binf=(Batttestdata_inf) obj;
-		model=new ServiceModel();
 		if(binf.getTest_type()==2){
 			List<Batttestdata_inf> list2=((Batttestdata_infDAOImpl)dao).serchByTestType2(binf);
 			List<Batttestdata_inf> list3=((Batttestdata_infDAOImpl)dao).serchByTestType3(binf);

--
Gitblit v1.9.1