| | |
| | | import com.fgkj.dto.Page;
|
| | | import com.fgkj.dto.User_inf;
|
| | | import com.fgkj.dto.User_log;
|
| | | import com.fgkj.dto.ram.FBS9100;
|
| | | import com.fgkj.dto.ram.Fbs9100_state;
|
| | | import com.fgkj.services.User_logService;
|
| | |
|
| | | public class Battinf_applyImpl implements BaseDAO,CallBack{
|
| | |
| | | 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 num="+bapply.getNum();
|
| | | String sql_update_apply=" update db_battinf.tb_battinf_apply set confrim_uid="+bapply.getConfrim_uid()+",apply_en=1 where battgrouoid="+binf.getBattGroupId();
|
| | | sql_str.add(sql_update_apply);
|
| | | String sql_insert_binf="insert into db_battinf.tb_battinf(" +
|
| | | "StationId,StationName,StationName1,StationName2,StationName3,StationName4,StationName5,StationIp,FBSDeviceId,FbsDeviceIp,FbsDeviceIp_YM,FbsDeviceIp_WG,"
|
| | |
| | | if(list!=null&&list.size()>0){
|
| | | for (int i = 0; i < list.size(); i++) {
|
| | | Battinf_apply bapply=list.get(i);
|
| | | bapply.setConfrim_uid(((User_inf)ActionUtil.getUser()).getUId());
|
| | | bapply.setApply_uid(((User_inf)ActionUtil.getUser()).getUId());
|
| | | BattInf binf=bapply.getBinf();
|
| | | //System.out.println(binf);
|
| | | String sql_update_apply= "update db_battinf.tb_battinf_apply set StationName='"+binf.getStationName()+"',StationName1='"+binf.getStationName1()+"',StationName2='"+binf.getStationName2()+"',StationName3='"+binf.getStationName3()+"',StationName4='"+binf.getStationName4()+"',StationName5='"+binf.getStationName5()+"',StationIp='"+binf.getStationIp()+"',"
|
| | | /* String sql_update_apply= "update db_battinf.tb_battinf_apply set StationName='"+binf.getStationName()+"',StationName1='"+binf.getStationName1()+"',StationName2='"+binf.getStationName2()+"',StationName3='"+binf.getStationName3()+"',StationName4='"+binf.getStationName4()+"',StationName5='"+binf.getStationName5()+"',StationIp='"+binf.getStationIp()+"',"
|
| | | + "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 num="+bapply.getNum();
|
| | | sql_str.add(sql_update_apply);
|
| | | */
|
| | | String sql_update_apply = "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_update_apply);
|
| | | {
|
| | | String msg="修改申请的"+binf.getStationName()+"机房"+binf.getBattGroupId()+"电池组的信息";
|
| | | User_log ulog=UinfDaoFactory.CreateULog(UinfDaoFactory.Alter, msg);
|
| | |
| | | for (int i = 0; i < list.size(); i++) {
|
| | | Battinf_apply bapply=list.get(i);
|
| | | BattInf binf=bapply.getBinf();
|
| | | String sql_del_apply=" delete from db_battinf.tb_battinf_apply where num="+bapply.getNum();
|
| | | String sql_del_apply=" delete from db_battinf.tb_battinf_apply where battgroupid="+binf.getBattGroupId();
|
| | | sql_str.add(sql_del_apply);
|
| | | {
|
| | | String msg="取消"+binf.getStationName()+"机房"+binf.getBattGroupId()+"电池组的申请";
|
| | |
| | | });
|
| | | return list;
|
| | | }
|
| | | //判断新增的电池组是否存在
|
| | | public boolean judgeBattInOrNot(Object obj){
|
| | | BattInf binf=(BattInf) obj;
|
| | | String sql="select distinct stationid from db_battinf.tb_battinf_apply where stationname=? limit 1";
|
| | | List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{binf.getStationName()}, new CallBack() {
|
| | | |
| | | public List getResults(ResultSet rs) {
|
| | | List list=new ArrayList();
|
| | | try {
|
| | | while(rs.next()){
|
| | | String stationid=rs.getString("stationid");
|
| | | list.add(stationid);
|
| | | }
|
| | | } catch (SQLException e) {
|
| | | // TODO Auto-generated catch block
|
| | | e.printStackTrace();
|
| | | }
|
| | | return list;
|
| | | }
|
| | | });
|
| | | if(list!=null&&list.size()>0){
|
| | | return true;
|
| | | }else{
|
| | | return false;
|
| | | }
|
| | | }
|
| | | //申请表中已审批通过的设备连接数
|
| | | public List devCommNum() {
|
| | | String sql=" select distinct db_battinf.tb_battinf_apply.FbsDeviceId,dev_commcount " +
|
| | | " 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" ;
|
| | | List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), null, new CallBack() {
|
| | | |
| | | @Override
|
| | | public List getResults(ResultSet rs) {
|
| | | List list=new ArrayList();
|
| | | try {
|
| | | while(rs.next()) {
|
| | | Fbs9100_state fbs=new Fbs9100_state();
|
| | | fbs.setDev_id(rs.getInt("FbsDeviceId"));
|
| | | fbs.setDev_commcount(rs.getInt("dev_commcount"));
|
| | | list.add(fbs);
|
| | | }
|
| | | } catch (SQLException e) {
|
| | | // TODO Auto-generated catch block
|
| | | e.printStackTrace();
|
| | | }
|
| | | return list;
|
| | | }
|
| | | });
|
| | | return list;
|
| | | |
| | | }
|
| | | public static void main(String[] args) throws ParseException {
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
| | | Date date1 = sdf.parse("2000-01-01 00:00:00");
|
| | |
| | |
|
| | |
|
| | | BattInf binf=new BattInf();
|
| | | binf.setStationName("广西省-百色-GX百色乐业县立新小区WF-BTS设备");
|
| | | binf.setStationName1("湖北省");
|
| | | binf.setStationName2("荆门市");
|
| | | binf.setStationName3("测试设备机房2");
|
| | | binf.setStationName4("BTS设备");
|
| | | binf.setStationName5("沙洋县");
|
| | | |
| | | binf.setStationId("4011100");
|
| | | binf.setStationIp("");
|
| | | binf.setFBSDeviceId(910001000);
|
| | |
| | | bapply.setBinf(binf);
|
| | | /*List list=bimpl.serchByCondition(page);
|
| | | System.out.println(list.size());*/
|
| | | List list=new ArrayList();
|
| | | /*List list=new ArrayList();
|
| | | list.add(bapply);
|
| | | boolean bl=bimpl.add(list);
|
| | | System.err.println(bl);
|
| | | System.err.println(bl);*/
|
| | | /*int dev_id=BattinfGroupFactory.searchmaxdev_id();
|
| | | System.out.println(dev_id);
|
| | | int station_id=BattinfGroupFactory.searchStationId();
|
| | | System.out.println(station_id);
|
| | | int battgroup_id=BattinfGroupFactory.searchMaxBattgroupId();
|
| | | System.out.println(battgroup_id);*/
|
| | | /*boolean bl=bimpl.judgeBattInOrNot(binf);
|
| | | System.out.println(bl);*/
|
| | | /*List<Fbs9100_state> list=bimpl.devCommNum();
|
| | | for (Fbs9100_state f : list) {
|
| | | System.out.println(f.getDev_id()+" "+f.getDev_commcount());
|
| | | }*/
|
| | | }
|
| | | }
|