From 2c592928efe30b98538befb7f12471a2f95741b5 Mon Sep 17 00:00:00 2001
From: 星伟 <星伟@192.168.10.34>
Date: 星期三, 10 十月 2018 10:35:23 +0800
Subject: [PATCH] 电池配组

---
 gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java |   52 ++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 44 insertions(+), 8 deletions(-)

diff --git a/gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java b/gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java
index 472b2ad..a3e889b 100644
--- a/gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java
+++ b/gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java
@@ -25,6 +25,7 @@
 import com.fgkj.db.DBUtil;
 import com.fgkj.db.IDatabaseName;
 import com.fgkj.dto.BattInf;
+import com.fgkj.dto.BattInf_Rebuild;
 import com.fgkj.dto.BattMap_information;
 import com.fgkj.dto.Batt_Maint_Dealarm;
 import com.fgkj.dto.Batt_maint_inf;
@@ -3618,10 +3619,15 @@
 	//鐢垫睜閰嶇粍绠$悊(閲嶈)
 	public List serchMakeGroup(Object obj){
 		BattInf binf=(BattInf) obj;
-		String sql="SELECT distinct BattGroupId,battgroupname,stationid,stationname1,stationname2,stationname,stationname3,BattProducer,MonVolStd,MonCapStd,monCount from db_battinf.tb_battinf where stationname2 like ? ";
+		String sql="SELECT distinct BattGroupId,battgroupname,stationid,stationname1,stationname2,stationname,stationname3,BattProducer,MonVolStd,MonCapStd,monCount " +
+				" ,battinf_re.old_stationname,old_battgroupname,old_battproducer,old_stationid,old_battgroupid,old_monum,new_stationname,new_battgroupname,new_battproducer,new_stationid,new_battgroupid,new_monum,rebuild_time,rebuild_uid,rebuild_address,rebuild_clear_type " +
+				" from db_battinf.tb_battinf " +
+				" left outer join (select * from db_battinf.tb_battinf_rebuild where tb_battinf_rebuild.rebuild_clear_type=1 ) as battinf_re " +
+				" on BattGroupId=battinf_re.new_battgroupid or BattGroupId=battinf_re.old_battgroupid " +
+				" where stationname2 like ? ";
 		//閫変腑鍝佺墝涓�鑷�
-		String producerSqlT=" order by BattProducer,MonCapStd,MonVolStd ";//涓�鑷�
-		String producerSqlF=" order by MonCapStd,MonVolStd ";//涓嶄竴鑷�
+		String producerSqlT=" order by BattProducer,MonCapStd,MonVolStd,BattGroupId ";//涓�鑷�
+		String producerSqlF=" order by MonCapStd,MonVolStd,BattGroupId ";//涓嶄竴鑷�
 		if(binf.getBattProducer().equals("1")){
 			sql+=producerSqlT;
 		}else{
@@ -3630,7 +3636,8 @@
 		List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{"%"+binf.getStationName2()+"%"}, new CallBack() {
 			
 			public List getResults(ResultSet rs) {
-				List list=new ArrayList();
+				List<BattInf> list=new ArrayList();
+				int battgroupid=0;
 				try {
 					while(rs.next()){
 						BattInf binf=new BattInf();
@@ -3645,6 +3652,34 @@
 						binf.setMonVolStd(rs.getFloat("monVolStd"));
 						binf.setMonCapStd(rs.getFloat("monCapStd"));
 						binf.setMonCount(rs.getInt("monCount"));
+						
+						BattInf_Rebuild brinf=new BattInf_Rebuild();
+						brinf.setNew_battgroupid(rs.getInt("new_battgroupid"));
+						brinf.setNew_battgroupname(rs.getString("new_battgroupname"));
+						brinf.setNew_battproducer(rs.getString("new_battproducer"));
+						brinf.setNew_monum(rs.getInt("new_monum"));
+						brinf.setNew_stationid(rs.getString("new_stationid"));
+						brinf.setNew_stationname(rs.getString("new_stationname"));
+						brinf.setOld_battgroupid(rs.getInt("old_battgroupid"));
+						brinf.setOld_battgroupname(rs.getString("old_battgroupname"));
+						brinf.setOld_battproducer(rs.getString("old_battproducer"));
+						brinf.setOld_monum(rs.getInt("old_monum"));
+						brinf.setOld_stationid(rs.getString("old_stationid"));
+						brinf.setOld_stationname(rs.getString("old_stationname"));
+						brinf.setRebuild_address(rs.getString("rebuild_address"));
+						brinf.setRebuild_clear_type(rs.getInt("rebuild_clear_type"));
+						brinf.setRebuild_time(rs.getTimestamp("rebuild_time"));
+						brinf.setRebuild_uid(rs.getInt("rebuild_uid"));
+						
+                        if(binf.getBattGroupId()==battgroupid){
+							((ArrayList)list.get(list.size()-1).getObj()).add(brinf);
+							continue;
+						}
+						List listr=new ArrayList();
+						listr.add(brinf);
+						binf.setObj(listr);
+						battgroupid=binf.getBattGroupId();
+						
 						list.add(binf);
 					}
 				} catch (SQLException e) {
@@ -3662,9 +3697,10 @@
 		BattInfImpl biml = new BattInfImpl();
 		BattInf binf = new BattInf();
 		binf.setBattGroupId(1000967);
-		binf.setStationName("鍐呰挋鍙�");
-		binf.setStationName1("鍐呰挋鍙�");
-		
+		binf.setStationName("");
+		binf.setStationName1("");
+		binf.setStationName2("");
+		binf.setBattProducer("1");
 		User_inf uinf=new User_inf();
 		uinf.setUId(1002);
 		
@@ -3689,7 +3725,7 @@
 		//List<BattInf> list = biml.serchByConditionNew(bmd);
 		//List<BattInf> list=biml.serchByTestType(bmd);
 		//List<BattInf> list=biml.serchGroupAssess(bmd);
-		List<BattInf> list=biml.serchByMonNum(binf);
+		List<BattInf> list=biml.serchMakeGroup(binf);
 		for (BattInf b : list) {
 			System.out.println(b);
 		}

--
Gitblit v1.9.1