From f55c99f2cb7a8c928c52fb8f8f68273c56f659cc Mon Sep 17 00:00:00 2001
From: 81041 <81041@DESKTOP-025NVD9>
Date: 星期五, 21 十二月 2018 14:42:36 +0800
Subject: [PATCH] 审核添加和修改

---
 gx_tieta/src/com/fgkj/dao/impl/Battinf_applyImpl.java |   60 +++++++++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 51 insertions(+), 9 deletions(-)

diff --git a/gx_tieta/src/com/fgkj/dao/impl/Battinf_applyImpl.java b/gx_tieta/src/com/fgkj/dao/impl/Battinf_applyImpl.java
index 10aee51..c55a44a 100644
--- a/gx_tieta/src/com/fgkj/dao/impl/Battinf_applyImpl.java
+++ b/gx_tieta/src/com/fgkj/dao/impl/Battinf_applyImpl.java
@@ -11,6 +11,7 @@
 
 import com.fgkj.actions.ActionUtil;
 import com.fgkj.dao.BaseDAO;
+import com.fgkj.dao.BattTestData;
 import com.fgkj.dao.BattinfGroupFactory;
 import com.fgkj.dao.CallBack;
 import com.fgkj.dao.DAOHelper;
@@ -32,7 +33,7 @@
 		// TODO Auto-generated method stub
 		return null;
 	}
-    //娣诲姞鐢宠
+    //娣诲姞鐢宠(鏂板缓)
 	public boolean add(Object obj) {
 		List<Battinf_apply> list=(List<Battinf_apply>) obj;
 		List<User_log> listU=new ArrayList<User_log>();//瀛樻斁user_log
@@ -82,6 +83,38 @@
 		
 		return bl;
 	}
+	//娣诲姞鐢宠(淇敼鏃х殑)
+	public boolean addPro(Object obj) {
+		List<Battinf_apply> list=(List<Battinf_apply>) obj;
+		List<User_log> listU=new ArrayList<User_log>();//瀛樻斁user_log
+		ArrayList<String> sql_str=new ArrayList();
+		if(list!=null && list.size()>0){
+			for (int i = 0; i < list.size(); i++) {
+				Battinf_apply bapply=list.get(i);
+				int uid=((User_inf)ActionUtil.getUser()).getUId();
+			    bapply.setApply_uid(uid);
+				BattInf binf=bapply.getBinf();
+				String sql = "insert into db_battinf.tb_battinf_apply(" +
+						"apply_uid,apply_date,StationId,StationName,StationName1,StationName2,StationName3,StationName4,StationName5,StationIp,FBSDeviceId,FbsDeviceIp,FbsDeviceIp_YM,FbsDeviceIp_WG,"
+						+ "FBSDeviceName,GroupIndexInFBSDevice,battgroupId,BattGroupNum,BattGroupName,FloatVolLevel,OfflineVolLevel,BattFloatCurrent" +
+						",MonCount,MonCapStd,monVolStd,monResStd,MonSerStd,MonVolLowToAvg,BattProducer,BattModel,BattProductDate,BattInUseDate,Load_curr,install_user,DisCurrMax,station_phone" +
+						") values("+bapply.getApply_uid()+",'"+DAOHelper.sdf.format(bapply.getApply_date())+"','"+binf.getStationId()+"','"+binf.getStationName()+"','"+binf.getStationName1()+"','"+binf.getStationName2()+"','"+binf.getStationName3()+"','"+binf.getStationName4()+"','"+binf.getStationName5()+
+						"','"+binf.getStationIp()+"',"+binf.getFBSDeviceId()+",'"+binf.getFbsDeviceIp()+"','"+binf.getFbsDeviceIp_YM()+"','"+binf.getFbsDeviceIp_WG()+"','"+binf.getFBSDeviceName()+"',"+binf.getGroupIndexInFBSDevice()+
+						","+binf.getBattGroupId()+","+binf.getBattGroupNum()+",'"+binf.getBattGroupName()+"',"+binf.getFloatVolLevel()+","+binf.getOfflineVolLevel()+","+binf.getBattFloatCurrent()+
+						","+binf.getMonCount()+","+binf.getMonCapStd()+","+binf.getMonVolStd()+","+binf.getMonResStd()+","+binf.getMonSerStd()+","+binf.getMonVolLowToAvg()+
+						",'"+binf.getBattProducer()+"','"+binf.getBattModel()+"','"+DAOHelper.sdf.format(binf.getBattProductDate())+"','"+DAOHelper.sdf.format(binf.getBattInUseDate())+"',"+binf.getLoad_curr()+",'"+binf.getInstall_user()+"',"+binf.getDisCurrMax()+",'"+binf.getStation_phone()+"')";
+				sql_str.add(sql);
+				{
+					String msg=((User_inf)ActionUtil.getUser()).getUId()+"鐢宠娣诲姞"+binf.getStationName()+"鏈烘埧"+binf.getBattGroupId()+"鐢垫睜缁勭殑淇℃伅";
+					User_log ulog=UinfDaoFactory.CreateULog(UinfDaoFactory.Increase, msg);
+					listU.add(ulog);
+				 }
+			}
+		}
+		Boolean bl=DAOHelper.makeManualCommit(DBUtil.getConn(), sql_str);
+		(new User_logService()).addPro(listU);//灏嗙敤鎴风殑鎿嶄綔璁板綍涓嬫潵
+		return bl;
+	}
     //纭鐢宠(澶氭潯)
 	public boolean update(Object obj) {
 		List<Battinf_apply> list=(List<Battinf_apply>) obj;
@@ -93,9 +126,9 @@
 				bapply.setConfrim_uid(((User_inf)ActionUtil.getUser()).getUId());
 				BattInf binf=bapply.getBinf();
 				binf.setStation_install(1);
-				String sql_update_apply=" update db_battinf.tb_battinf_apply set confrim_uid="+bapply.getConfrim_uid()+",apply_en=1 where battgrouoid="+binf.getBattGroupId();
+				String sql_update_apply=" update db_battinf.tb_battinf_apply set confrim_uid="+bapply.getConfrim_uid()+",apply_en=1 where battgroupid="+binf.getBattGroupId();
 			    sql_str.add(sql_update_apply);
-			    String sql_insert_binf="insert into db_battinf.tb_battinf(" +
+			    String sql_insert_binf="replace into db_battinf.tb_battinf(" +
 						"StationId,StationName,StationName1,StationName2,StationName3,StationName4,StationName5,StationIp,FBSDeviceId,FbsDeviceIp,FbsDeviceIp_YM,FbsDeviceIp_WG,"
 						+ "FBSDeviceName,GroupIndexInFBSDevice,battgroupId,BattGroupNum,BattGroupName,FloatVolLevel,OfflineVolLevel,BattFloatCurrent" +
 						",MonCount,MonCapStd,monVolStd,monResStd,MonSerStd,MonVolLowToAvg,BattProducer,BattModel,BattProductDate,BattInUseDate,Load_curr,install_user,DisCurrMax,station_phone,Station_install" +
@@ -105,6 +138,9 @@
 						","+binf.getMonCount()+","+binf.getMonCapStd()+","+binf.getMonVolStd()+","+binf.getMonResStd()+","+binf.getMonSerStd()+","+binf.getMonVolLowToAvg()+
 						",'"+binf.getBattProducer()+"','"+binf.getBattModel()+"','"+DAOHelper.sdf.format(binf.getBattProductDate())+"','"+DAOHelper.sdf.format(binf.getBattInUseDate())+"',"+binf.getLoad_curr()+",'"+binf.getInstall_user()+"',"+binf.getDisCurrMax()+",'"+binf.getStation_phone()+"',"+binf.getStation_install()+")";
 			    sql_str.add(sql_insert_binf);
+			    String baoji_sql="REPLACE into db_user.tb_user_battgroup_baojigroup_battgroup(baoji_group_id,StationId,BattGroupId) " + 
+			    		         " SELECT baoji_group_id,'"+binf.getStationId()+"',"+binf.getBattGroupId()+" from  db_user.tb_user_battgroup_baojigroup ";
+			    sql_str.add(baoji_sql);
 			    {
 					String msg="纭娣诲姞"+binf.getStationName()+"鏈烘埧"+binf.getBattGroupId()+"鐢垫睜缁勭殑淇℃伅";
 					User_log ulog=UinfDaoFactory.CreateULog(UinfDaoFactory.Alter, msg);
@@ -120,6 +156,7 @@
 			return false;
 		}
 		(new User_logService()).addPro(listU);//灏嗙敤鎴风殑鎿嶄綔璁板綍涓嬫潵
+		BattTestData.run_cmd();
 		return bl;
 		
 	}
@@ -133,7 +170,7 @@
 				Battinf_apply bapply=list.get(i);
 				BattInf binf=bapply.getBinf();
 				bapply.setCheck_uid(((User_inf)ActionUtil.getUser()).getUId());
-				String sql_update_apply=" update db_battinf.tb_battinf_apply set check_uid="+bapply.getCheck_uid()+",check_en=1 where battgrouoid="+binf.getBattGroupId();
+				String sql_update_apply=" update db_battinf.tb_battinf_apply set check_uid="+bapply.getCheck_uid()+",check_en=1 where battgroupid="+binf.getBattGroupId();
 			    sql_str.add(sql_update_apply);
 			    {
 					String msg="楠屾敹"+binf.getStationName()+"鏈烘埧";
@@ -214,16 +251,18 @@
 	}
 	//鏌ヨ鍑烘墍鏈夐渶瑕佺‘璁ょ殑鐢宠
 	public List serchByCondition(Object obj) {
-		Page page=(Page) obj;
+		Battinf_apply bapply=(Battinf_apply) obj;
+		BattInf binf=bapply.getBinf();
+		Page page=binf.getPage();
 		Connection conn=DBUtil.getConn();
 		String numberSql=" SELECT FOUND_ROWS() number";
 		String sql=" select SQL_CALC_FOUND_ROWS distinct num,apply_uid,confrim_uid,check_uid,check_en,apply_date,apply_en,apply_note,StationId,StationName,StationName1,StationName2,StationName3,StationName4,StationName5,StationIp,FbsDeviceId,FbsDeviceIp_YM,FbsDeviceIp_WG,FbsDeviceIp"+
 			     ",FBSDeviceName,GroupIndexInFBSDevice,battgroupId,BattGroupNum,BattGroupName,FloatVolLevel,OfflineVolLevel,BattFloatCurrent" +
 				 ",MonCount,MonCapStd,monVolStd,monResStd,MonSerStd,MonVolLowToAvg,BattProducer,BattModel,BattProductDate,BattInUseDate,Load_curr,install_user,DisCurrMax,station_phone " +
 				" from db_battinf.tb_battinf_apply " +
-				" where apply_en=0  order by apply_date desc" +
+				" where apply_en=?  order by apply_date desc" +
 				" limit ?,? ";
-		List<Battinf_apply> list=DAOHelper.executeQueryLimit(sql, conn, new Object[]{(page.getPageCurr()-1)*page.getPageSize(),page.getPageSize()}, new CallBack() {
+		List<Battinf_apply> list=DAOHelper.executeQueryLimit(sql, conn, new Object[]{bapply.getApply_en(),(page.getPageCurr()-1)*page.getPageSize(),page.getPageSize()}, new CallBack() {
 			
 			public List getResults(ResultSet rs) {
 				List list=new ArrayList();
@@ -238,7 +277,7 @@
 						apply.setApply_en(rs.getInt("apply_en"));
 						apply.setCheck_uid(rs.getInt("check_uid"));
 						apply.setCheck_en(rs.getInt("check_en"));
-						apply.setCheck_uname((new User_infImpl()).changeUidToUname(apply.getCheck_en()));
+						apply.setCheck_uname((new User_infImpl()).changeUidToUname(apply.getCheck_uid()));
 						apply.setApply_date(rs.getTimestamp("apply_date"));
 						apply.setApply_note(rs.getString("apply_note"));
 						
@@ -391,7 +430,7 @@
 		Page page=b.getPage();
 		Connection conn=DBUtil.getConn();
 		String numberSql=" SELECT FOUND_ROWS() number";
-		String sql=" select SQL_CALC_FOUND_ROWS distinct num,apply_uid,confrim_uid,apply_date,apply_en,apply_note,StationId,StationName,StationName1,StationName2,StationName3,StationName4,StationName5,StationIp,FbsDeviceId,FbsDeviceIp_YM,FbsDeviceIp_WG,FbsDeviceIp"+
+		String sql=" select SQL_CALC_FOUND_ROWS distinct num,apply_uid,confrim_uid,check_uid,check_en,apply_date,apply_en,apply_note,StationId,StationName,StationName1,StationName2,StationName3,StationName4,StationName5,StationIp,FbsDeviceId,FbsDeviceIp_YM,FbsDeviceIp_WG,FbsDeviceIp"+
 			     ",FBSDeviceName,GroupIndexInFBSDevice,battgroupId,BattGroupNum,BattGroupName,FloatVolLevel,OfflineVolLevel,BattFloatCurrent" +
 				 ",MonCount,MonCapStd,monVolStd,monResStd,MonSerStd,MonVolLowToAvg,BattProducer,BattModel,BattProductDate,BattInUseDate,Load_curr,install_user,DisCurrMax,station_phone " +
 				" from db_battinf.tb_battinf_apply " +
@@ -410,6 +449,9 @@
 						apply.setConfrim_uid(rs.getInt("confrim_uid"));
 						apply.setConfirm_name((new User_infImpl()).changeUidToUname(apply.getConfrim_uid()));
 						apply.setApply_en(rs.getInt("apply_en"));
+						apply.setCheck_uid(rs.getInt("check_uid"));
+						apply.setCheck_en(rs.getInt("check_en"));
+						apply.setCheck_uname((new User_infImpl()).changeUidToUname(apply.getCheck_en()));
 						apply.setApply_date(rs.getTimestamp("apply_date"));
 						apply.setApply_note(rs.getString("apply_note"));
 						

--
Gitblit v1.9.1