From 7f953d9aa0e7d4fcbe3c366c7f9f0b3f847f12bd Mon Sep 17 00:00:00 2001 From: hdw <hdw@192.168.137.1> Date: 星期六, 19 一月 2019 09:16:08 +0800 Subject: [PATCH] Merge branch 'dev_lxw' of https://gitlab.com/whyclxw1/gx_tieta.git into dev_lxw --- gx_tieta/src/com/fgkj/dao/impl/Battinf_applyImpl.java | 220 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 200 insertions(+), 20 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..82f8c89 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 = "replace 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,15 @@ ","+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_main="REPLACE into db_user.tb_user_battgroup_baojigroup_battgroup(baoji_group_id,StationId,BattGroupId) values('100011','"+binf.getStationId()+"',"+binf.getBattGroupId()+")"; + sql_str.add(baoji_sql_main); + //System.out.println(baoji_sql_main); + //缁欐坊鍔犵殑鏈烘埧鍔犲叆鍖呮満缁勶紙璇ョ敤鎴风殑锛� + 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_usr where uid="+bapply.getApply_uid(); + sql_str.add(baoji_sql); + { String msg="纭娣诲姞"+binf.getStationName()+"鏈烘埧"+binf.getBattGroupId()+"鐢垫睜缁勭殑淇℃伅"; User_log ulog=UinfDaoFactory.CreateULog(UinfDaoFactory.Alter, msg); @@ -120,10 +162,11 @@ return false; } (new User_logService()).addPro(listU);//灏嗙敤鎴风殑鎿嶄綔璁板綍涓嬫潵 + BattTestData.run_cmd(); return bl; } - //楠屾敹鐢宠(澶氭潯) + //楠屾敹(澶氭潯) public boolean check(Object obj) { List<Battinf_apply> list=(List<Battinf_apply>) obj; List<User_log> listU=new ArrayList<User_log>();//瀛樻斁user_log @@ -133,10 +176,34 @@ 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 sql_replace_map=" replace into web_site.tb_battmap_information(StationId,StationName,address,longitude,latitude) values('"+binf.getStationId()+"','"+binf.getStationName()+"','"+bapply.getAddress()+"',"+bapply.getLongitude()+","+bapply.getLatitude()+")"; + sql_str.add(sql_replace_map); { String msg="楠屾敹"+binf.getStationName()+"鏈烘埧"; + User_log ulog=UinfDaoFactory.CreateULog(UinfDaoFactory.Alter, msg); + listU.add(ulog); + } + } + } + Boolean bl=DAOHelper.makeManualCommit(DBUtil.getConn(), sql_str); + (new User_logService()).addPro(listU);//灏嗙敤鎴风殑鎿嶄綔璁板綍涓嬫潵 + return bl; + } + //鐢宠楠屾敹(澶氭潯) + public boolean checkPro(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); + BattInf binf=bapply.getBinf(); + String sql_update_apply=" update db_battinf.tb_battinf_apply set check_en=2,longitude="+bapply.getLongitude()+",latitude="+bapply.getLatitude()+",address='"+bapply.getAddress()+"' where battgroupid="+binf.getBattGroupId(); + sql_str.add(sql_update_apply); + { + String msg="鐢宠楠屾敹"+binf.getStationName()+"鏈烘埧"; User_log ulog=UinfDaoFactory.CreateULog(UinfDaoFactory.Alter, msg); listU.add(ulog); } @@ -214,16 +281,30 @@ } //鏌ヨ鍑烘墍鏈夐渶瑕佺‘璁ょ殑鐢宠 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 " + + ",MonCount,MonCapStd,monVolStd,monResStd,MonSerStd,MonVolLowToAvg,BattProducer,BattModel,BattProductDate,BattInUseDate,Load_curr,install_user,DisCurrMax,station_phone " + + ",longitude,latitude,address " + " from db_battinf.tb_battinf_apply " + - " where apply_en=0 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() { + " where "; + //鏈鎵� + if(bapply.getApply_en()==0) { + sql+=" apply_en=? and check_en!=? "; + }else { + if(bapply.getCheck_en()==1) { + sql+=" apply_en=? and check_en=? "; + }else { + sql+=" apply_en=? and check_en!=? and check_en!=1 "; + } + + } + sql+=" order by apply_date desc limit ?,?"; + List<Battinf_apply> list=DAOHelper.executeQueryLimit(sql, conn, new Object[]{bapply.getApply_en(),bapply.getCheck_en(),(page.getPageCurr()-1)*page.getPageSize(),page.getPageSize()}, new CallBack() { public List getResults(ResultSet rs) { List list=new ArrayList(); @@ -238,9 +319,12 @@ 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")); + apply.setLongitude(rs.getDouble("longitude")); + apply.setLatitude(rs.getDouble("latitude")); + apply.setAddress(rs.getString("address")); BattInf binf=new BattInf(); binf.setStationId(rs.getString("stationId")); @@ -384,6 +468,81 @@ return battgroupid; } + //鏍规嵁鏈烘埧id鏌ヨ鍑虹敵璇蜂汉宸插鎵归�氳繃鐨勭數姹犵粍淇℃伅 + public List serchById(Object obj){ + Battinf_apply bapply=(Battinf_apply) obj; + BattInf binf=bapply.getBinf(); + String sql="select * from db_battinf.tb_battinf_apply where stationid=? and apply_uid=? "; + List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[] {binf.getStationId(),bapply.getApply_uid()}, new CallBack() { + + @Override + public List getResults(ResultSet rs) { + List list=new ArrayList(); + try { + while(rs.next()) { + Battinf_apply apply=new Battinf_apply(); + apply.setNum(rs.getInt("num")); + apply.setApply_uid(rs.getInt("apply_uid")); + apply.setApply_name((new User_infImpl()).changeUidToUname(apply.getApply_uid())); + 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")); + + BattInf binf=new BattInf(); + binf.setStationId(rs.getString("stationId")); + binf.setStationName(rs.getString("stationName")); + binf.setStationName1(rs.getString("stationName1")); + binf.setStationName2(rs.getString("stationName2")); + binf.setStationName3(rs.getString("stationName3")); + binf.setStationName4(rs.getString("stationName4")); + binf.setStationName5(rs.getString("stationName5")); + binf.setStationIp(rs.getString("stationIp")); + binf.setFBSDeviceId(rs.getInt("fBSDeviceId")); + + binf.setFbsDeviceIp(rs.getString("fbsDeviceIp")); + binf.setFbsDeviceIp_YM(rs.getString("fbsDeviceIp_YM")); + binf.setFbsDeviceIp_WG(rs.getString("fbsDeviceIp_WG")); + binf.setFBSDeviceName(rs.getString("fBSDeviceName")); + binf.setGroupIndexInFBSDevice(rs.getInt("groupIndexInFBSDevice")); + binf.setBattGroupId(rs.getInt("battGroupId")); + binf.setBattGroupNum(rs.getInt("battGroupNum")); + binf.setBattGroupName(rs.getString("battGroupName")); + binf.setFloatVolLevel(rs.getFloat("floatVolLevel")); + binf.setOfflineVolLevel(rs.getFloat("offlineVolLevel")); + binf.setBattFloatCurrent(rs.getFloat("battFloatCurrent")); + binf.setMonCount(rs.getInt("monCount")); + binf.setMonCapStd(rs.getFloat("monCapStd")); + binf.setMonVolStd(rs.getFloat("monVolStd")); + binf.setMonResStd(rs.getFloat("monResStd")); + binf.setMonSerStd(rs.getFloat("monSerStd")); + binf.setMonVolLowToAvg(rs.getFloat("monVolLowToAvg")); + binf.setBattProducer(rs.getString("battProducer")); + binf.setBattModel(rs.getString("battModel")); + binf.setBattProductDate(rs.getDate("battProductDate")); + binf.setBattInUseDate(rs.getDate("battInUseDate")); + binf.setLoad_curr(rs.getFloat("load_curr")); + binf.setInstall_user(rs.getString("install_user")); + binf.setDisCurrMax(rs.getFloat("disCurrMax")); + binf.setStation_phone(rs.getString("station_phone")); + + apply.setBinf(binf); + list.add(apply); + } + } catch (SQLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return list; + } + }); + return list; + } + //鏌ヨ鍑哄鏍稿畬鐨勭敵璇峰拰寰呭鏍哥殑鐢宠 public List serchByInfo(Object obj) { Battinf_apply bapply=(Battinf_apply) obj; @@ -391,12 +550,24 @@ 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 " + - " where apply_en=? and apply_uid=? order by apply_date desc " + - " limit ?,? "; + " where apply_en=? and check_en=0 ";//(鏈鎵瑰拰宸插鎵圭殑鏁版嵁涓嶈兘琚獙鏀�) + //鐢ㄦ埛 + String userSqlF=" and apply_uid=? " ; + String userSqlT=" and apply_uid!=? " ; + if(bapply.getApply_uid()==1002) { + bapply.setNum(0); + sql+=userSqlT; + }else { + sql+=userSqlF; + } + + String endSql=" order by apply_date desc limit ?,?"; + sql+=endSql; + //System.out.println(sql); List<Battinf_apply> list=DAOHelper.executeQueryLimit(sql, conn, new Object[]{bapply.getApply_en(),bapply.getNum(),(page.getPageCurr()-1)*page.getPageSize(),page.getPageSize()}, new CallBack() { public List getResults(ResultSet rs) { @@ -410,6 +581,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")); @@ -572,7 +746,7 @@ } //鐢宠琛ㄤ腑宸插鎵归�氳繃鐨勮澶囪繛鎺ユ暟 public List devCommNum() { - String sql=" select distinct db_battinf.tb_battinf_apply.FbsDeviceId,dev_commcount " + + String sql=" select distinct db_battinf.tb_battinf_apply.FbsDeviceId,dev_commcount,dev_errcommcount " + " from db_battinf.tb_battinf_apply,db_ram_db.tb_fbs9100_state " + " where apply_en=1 and db_battinf.tb_battinf_apply.FbsDeviceId=db_ram_db.tb_fbs9100_state.dev_id " + " order by apply_date desc" ; @@ -586,6 +760,7 @@ Fbs9100_state fbs=new Fbs9100_state(); fbs.setDev_id(rs.getInt("FbsDeviceId")); fbs.setDev_commcount(rs.getInt("dev_commcount")); + fbs.setDev_errcommcount(rs.getInt("dev_errcommcount")); list.add(fbs); } } catch (SQLException e) { @@ -606,8 +781,9 @@ Battinf_apply bapply=new Battinf_apply(); bapply.setApply_date(ActionUtil.getSimpDate(date2)); bapply.setApply_uid(1002); - - + bapply.setApply_en(1); + bapply.setCheck_en(1); + bapply.setNum(1002);; BattInf binf=new BattInf(); binf.setStationName("骞胯タ鐪�-鐧捐壊-GX鐧捐壊涔愪笟鍘跨珛鏂板皬鍖篧F-BTS璁惧"); binf.setStationName1("婀栧寳鐪�"); @@ -616,7 +792,7 @@ binf.setStationName4("BTS璁惧"); binf.setStationName5("娌欐磱鍘�"); - binf.setStationId("4011100"); + binf.setStationId("42000626"); binf.setStationIp(""); binf.setFBSDeviceId(910001000); binf.setFbsDeviceIp("127.0.0.1"); @@ -647,10 +823,12 @@ Page page=new Page(); page.setPageCurr(1); - page.setPageSize(10); + page.setPageSize(20); binf.setPage(page); bapply.setBinf(binf); - /*List list=bimpl.serchByCondition(page); + List list=bimpl.serchByInfo(bapply); + System.out.println(list.size()); + /*List list=bimpl.serchByCondition(bapply); System.out.println(list.size());*/ /*List list=new ArrayList(); list.add(bapply); @@ -668,5 +846,7 @@ for (Fbs9100_state f : list) { System.out.println(f.getDev_id()+" "+f.getDev_commcount()); }*/ + /*List list=bimpl.serchById(bapply); + System.err.println(list.size());*/ } } -- Gitblit v1.9.1