From e73e7e7f861fa87cbbd0e2eeca05939f57381ec1 Mon Sep 17 00:00:00 2001 From: 81041 <81041@192.168.10.23> Date: 星期五, 30 十一月 2018 10:33:57 +0800 Subject: [PATCH] 修改参数记录的修改 --- gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java | 121 ++++++++++++++++++++++++++++++++++++---- 1 files changed, 108 insertions(+), 13 deletions(-) diff --git a/gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java b/gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java index 39516e6..4b6c4c8 100644 --- a/gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java +++ b/gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java @@ -119,7 +119,7 @@ String sql = "update db_battinf.tb_battinf set StationId='"+binf.getStationId()+"',StationName='"+binf.getStationName()+"',StationName1='"+binf.getStationName1()+"',StationName2='"+binf.getStationName2()+"',StationName3='"+binf.getStationName3()+"',StationName4='"+binf.getStationName4()+"',StationName5='"+binf.getStationName5()+"',StationIp='"+binf.getStationIp()+"',FBSDeviceId="+binf.getFBSDeviceId()+",FbsDeviceIp='"+binf.getFbsDeviceIp()+"'," + "FBSDeviceName='"+binf.getFBSDeviceName()+"',GroupIndexInFBSDevice="+binf.getGroupIndexInFBSDevice()+",BattGroupNum="+binf.getBattGroupNum()+",BattGroupName='"+binf.getBattGroupName()+"',FloatVolLevel="+binf.getFloatVolLevel()+",OfflineVolLevel="+binf.getOfflineVolLevel()+",BattFloatCurrent="+binf.getBattFloatCurrent()+"," + "MonCount="+binf.getMonCount()+",MonCapStd="+binf.getMonCapStd()+",monVolStd="+binf.getMonVolStd()+",monResStd="+binf.getMonResStd()+",MonSerStd="+binf.getMonSerStd()+",MonVolLowToAvg="+binf.getMonVolLowToAvg()+",BattProducer='"+binf.getBattProducer()+"',BattModel='"+binf.getBattModel()+"',BattProductDate='"+DAOHelper.sdf.format(binf.getBattProductDate())+"',BattInUseDate='"+DAOHelper.sdf.format(binf.getBattInUseDate())+"', " - +" Load_curr="+binf.getLoad_curr()+",install_user="+binf.getInstall_user()+",DisCurrMax="+binf.getDisCurrMax()+",station_phone='"+binf.getStation_phone()+"' where battgroupId="+binf.getBattGroupId(); + +" Load_curr="+binf.getLoad_curr()+",install_user='"+binf.getInstall_user()+"',DisCurrMax="+binf.getDisCurrMax()+",station_phone='"+binf.getStation_phone()+"' where battgroupId="+binf.getBattGroupId(); sql_str.add(sql); { String msg="淇敼"+binf.getStationName()+"鏈烘埧"+binf.getBattGroupId()+"鐢垫睜缁勭殑淇℃伅"; @@ -139,7 +139,13 @@ boolean bl=DAOHelper.executeUpdate(DBUtil.getConn(), sql, null); return bl; } - + //璁剧疆鐢垫睜缁勫厖鐢电數娴侀槇鍊� + public boolean update_charge(Object obj){ + BattInf binf=(BattInf) obj; + String sql = "update db_battinf.tb_battinf set charge_curr_max=? where BattGroupId=?"; + boolean bl=DAOHelper.executeUpdate(DBUtil.getConn(), sql, new Object[]{binf.getCharge_curr_max(),binf.getBattGroupId()}); + return bl; + } //鍒犻櫎鐢垫睜缁�(澶氫釜) public boolean del(Object obj) { List<BattInf> list=(List<BattInf>) obj; @@ -1047,7 +1053,7 @@ return list; } - //鏌ヨ澶囨�绘暟 + //鏌ヨ澶囨�绘暟(宸茬粡瀹夎) /*public int serchByDeviceId(){ String sql=" SELECT COUNT(DISTINCT fbsdeviceid) number FROM db_battinf.tb_battinf limit 1"; List<BattInf> list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{}, new CallBack() { @@ -1077,11 +1083,11 @@ public int serchByDeviceId(Object obj){ User_inf uinf=(User_inf) obj; String sql=" SELECT COUNT(DISTINCT fbsdeviceid) number FROM db_battinf.tb_battinf " + - " left outer join db_user.tb_user_battgroup_baojigroup_battgroup on db_user.tb_user_battgroup_baojigroup_battgroup.BattGroupId=db_battinf.tb_battinf.BattGroupId " + - " 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=? " + - " limit 1"; + " where StationId in(" + + " select distinct db_user.tb_user_battgroup_baojigroup_battgroup.StationId from db_user.tb_user_battgroup_baojigroup_battgroup,db_user.tb_user_battgroup_baojigroup_usr where db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id=db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id " + + " and db_user.tb_user_battgroup_baojigroup_usr.uId=? " + + " ) " + + " and db_battinf.tb_battinf.station_install=1"; List<BattInf> list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{uinf.getUId()}, new CallBack() { public List getResults(ResultSet rs) { @@ -1105,6 +1111,93 @@ number=list.get(list.size()-1).getNum(); } return number; + } + //鏌ュ崟浣撴�绘暟(宸插畨瑁呯殑鍗曚綋) + public int serchByInstall_count(Object obj){ + User_inf uinf=(User_inf) obj; + String sql=" SELECT sum(moncount) as nums FROM db_battinf.tb_battinf " + + " where StationId in(" + + " select distinct db_user.tb_user_battgroup_baojigroup_battgroup.StationId from db_user.tb_user_battgroup_baojigroup_battgroup,db_user.tb_user_battgroup_baojigroup_usr where db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id=db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id " + + " and db_user.tb_user_battgroup_baojigroup_usr.uId=? " + + " ) " + + " and db_battinf.tb_battinf.station_install=1"; + //System.out.println(sql); + List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{uinf.getUId()}, new CallBack() { + + public List getResults(ResultSet rs) { + List list=new ArrayList(); + int nums=0;//鍗曚綋鎬绘暟 + try { + while(rs.next()){ + nums=rs.getInt("nums"); + list.add(nums); + } + } catch (SQLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return list; + } + + }); + int number=0;//瀛樻斁鎬绘暟 + if(list!=null&&list.size()>0){ + number=(Integer) list.get(list.size()-1); + } + return number; + } + //鏌ヨ璁惧鎬绘暟(鍏ㄩ儴) + public List serchByDeviceId_all(Object obj){ + User_inf uinf=(User_inf) obj; + String sql=" SELECT DISTINCT fbsdeviceid,station_install,monvolstd FROM db_battinf.tb_battinf " + + " where StationId in(" + + " select distinct db_user.tb_user_battgroup_baojigroup_battgroup.StationId from db_user.tb_user_battgroup_baojigroup_battgroup,db_user.tb_user_battgroup_baojigroup_usr where db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id=db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id " + + " and db_user.tb_user_battgroup_baojigroup_usr.uId=? " + + " ) "; + List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{uinf.getUId()}, new CallBack() { + + public List getResults(ResultSet rs) { + List list=new ArrayList(); + int num_2_install=0;//2v宸插畨瑁� + int num_2=0;//2v鍏ㄩ儴 + int num_12_install=0;//12v宸插畨瑁� + int num_12=0;//12v鍏ㄩ儴 + int num_install=0;//宸插畨瑁� + int num=0;//鍏ㄩ儴 + try { + while(rs.next()){ + int insatll=rs.getInt("station_install"); + float monvolstd=rs.getFloat("monvolstd"); + if(insatll==1){ + num_install+=1; + if(monvolstd==2.0){ + num_2_install+=1; + }else{ + num_12_install+=1; + } + } + if(monvolstd==2.0){ + num_2+=1; + }else{ + num_12+=1; + } + num+=1; + } + } catch (SQLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + list.add(num_2_install); + list.add(num_2); + list.add(num_12_install); + list.add(num_12); + list.add(num_install); + list.add(num); + return list; + } + + }); + return list; } //-----------鏍规嵁钃勭數姹犵粍鏌ヤ笉閲嶅鐨凪onCount(monNum)锛堝崟浣撶紪鍙凤級 public List serchByMonNum(Object obj){ @@ -1133,7 +1226,7 @@ }); return list; } - + //瀹炴椂鍘嗗彶鏈哄巻鍗� public List serchByBattgroupId(Object obj){ BattInf binf=(BattInf)obj; String sql="select * from db_battinf.tb_battinf where battgroupid=?"; @@ -1234,7 +1327,7 @@ batt.setSignalId(rs.getString("SignalId")); batt.setCInterFaceId(Integer.parseInt(rs.getString("CInterFaceId"))); - + batt.setInstall_user(rs.getString("install_user")); batt.setSignalName(rs.getString("SignalName")); int BattGuarantDayCount=rs.getInt("BattGuarantDayCount")-ActionUtil.daysBetween(rs.getDate("BattInUseDate"), new Date());//鍓╀綑淇濅慨澶╂暟 batt.setBattGuarantDayCount(BattGuarantDayCount); @@ -3318,7 +3411,7 @@ " where db_user.tb_user_battgroup_baojigroup_battgroup.BattGroupId=db_battinf.tb_battinf.BattGroupId " + " and db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id=db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id " + " and db_user.tb_user_inf.uid=db_user.tb_user_battgroup_baojigroup_usr.uid " + - " and db_user.tb_user_inf.uid=?" + + " and db_user.tb_user_inf.uid=? and db_battinf.tb_battinf.Station_install=1 " + " limit 1"; List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{uinf.getUId()}, new CallBack() { @@ -4197,12 +4290,14 @@ //List<BattInf> list=biml.serchGroupByInfor(binf); //List<BattInf> list=biml.searchInform1(bmd); //<BattInf> list=biml.serchStationName5(binf); - List<BattInf> list=biml.serchBattAllInfoByStationId(binf); + /*List<BattInf> list=biml.serchBattAllInfoByStationId(binf); //List<BattInf> list=biml.searchInform_ky(); for (BattInf b : list) { System.out.println(b); } - System.out.println(list.size()); + System.out.println(list.size());*/ + int nums=biml.serchByInstall_count(uinf); + System.out.println(nums); } public List getResults(ResultSet rs) { -- Gitblit v1.9.1