Package com.vsked.bean

Examples of com.vsked.bean.TbCommandlib


            rs = pt.executeQuery();
            while (rs.next()) {
                   if(tbCommandlibList==null){
                     tbCommandlibList=new ArrayList<TbCommandlib>();
                   }
                   TbCommandlib tbCommandlib=new TbCommandlib();
                   tbCommandlib.setCommandlibId(rs.getInt("commandlib_id"));
                   tbCommandlib.setCommandlibName(rs.getString("commandlib_name"));
                   tbCommandlib.setCommandlibSql(rs.getString("commandlib_sql"));
                   tbCommandlib.setCommandlibFormat(rs.getString("commandlib_format"));
                   tbCommandlib.setCommandlibSuccCount(rs.getInt("commandlib_succCount"));
                   tbCommandlib.setCommandlibFailCount(rs.getInt("commandlib_failCount"));
                   tbCommandlib.setCommandlibState(rs.getInt("commandlib_state"));
                   tbCommandlib.setCommandlibIsNew(rs.getInt("commandlib_isNew"));
                   tbCommandlib.setCommandlibLastTime(rs.getString("commandlib_lastTime"));
                   tbCommandlib.setCommandlibMobile(rs.getString("commandlib_mobile"));
                   tbCommandlib.setMsgErr(rs.getString("msg_err"));
                   tbCommandlib.setMsgNull(rs.getString("msg_null"));
                   tbCommandlibList.add(tbCommandlib);
            }

        } catch (Exception e) {
            e.printStackTrace();
View Full Code Here


            sql = "select * from tb_commandlib where commandlib_id=?";
            pt = conn.prepareStatement(sql);
            pt.setInt(1, inTbCommandlibId);
            rs = pt.executeQuery();
            if (rs.next()) {
                   tbCommandlib=new TbCommandlib();
                   tbCommandlib.setCommandlibId(rs.getInt("commandlib_id"));
                   tbCommandlib.setCommandlibName(rs.getString("commandlib_name"));
                   tbCommandlib.setCommandlibSql(rs.getString("commandlib_sql"));
                   tbCommandlib.setCommandlibFormat(rs.getString("commandlib_format"));
                   tbCommandlib.setCommandlibSuccCount(rs.getInt("commandlib_succCount"));
View Full Code Here

            sql = "select * from tb_commandlib where commandlib_name=?";
            pt = conn.prepareStatement(sql);
            pt.setString(1, inTbCommandlibName);
            rs = pt.executeQuery();
            if (rs.next()) {
                   tbCommandlib=new TbCommandlib();
                   tbCommandlib.setCommandlibId(rs.getInt("commandlib_id"));
                   tbCommandlib.setCommandlibName(rs.getString("commandlib_name"));
                   tbCommandlib.setCommandlibSql(rs.getString("commandlib_sql"));
                   tbCommandlib.setCommandlibFormat(rs.getString("commandlib_format"));
                   tbCommandlib.setCommandlibSuccCount(rs.getInt("commandlib_succCount"));
View Full Code Here

      String sql=request.getParameter("commandlib_sql");
      String format=request.getParameter("commandlib_format");
      String msgErr=request.getParameter("msg_err");
      String msgNull=request.getParameter("msg_null");
      int state=Integer.parseInt(request.getParameter("commandlib_state"))
      flag=new TbCommandlibDAO().add(new TbCommandlib(name,sql,format,state,msgErr,msgNull));
    }

    if ("edit".equals(method)) {
      int  id=Integer.parseInt(request.getParameter("commandlib_id"));
      String name=request.getParameter("commandlib_name");
      String sql=request.getParameter("commandlib_sql");
      String format=request.getParameter("commandlib_format");
      String msgErr=request.getParameter("msg_err");
      String msgNull=request.getParameter("msg_null");
      int state=Integer.parseInt(request.getParameter("commandlib_state"));
      flag=new TbCommandlibDAO().edit(new TbCommandlib(id,name,sql,format,state,msgErr,msgNull));
    }

    if (flag) {
      response.sendRedirect("zzmobile/commandlibList.jsp?ok=1");
    } else {
View Full Code Here

            boolean isNewComm=false;
            boolean isoldComm=false;
            isoldComm=new TbCommandlibDAO().isExistTbCommand(tr.getRecContent().trim());
            if(isoldComm==true)
            {
              TbCommandlib tc=new TbCommandlibDAO().getTbCommandlibByName(tr.getRecContent().trim());
              try{   
              System.out.println(tr.getRecContent()+""+tr.getRecTime());
                //更新最后执行手机号
                new TbCommandlibDAO().updateLastMobile(tc.getCommandlibId(), tr.getRecPhone().trim());
              String sql=tc.getCommandlibSql();
              String[] colArray=(sql.substring((sql.indexOf("select")+7),sql.indexOf("from"))).split(",");
              String[] tempArray=new String[colArray.length];
              Connection oracleConn=ConnectDB.getOracleConnection();
              Statement st=oracleConn.createStatement();
              tc.setCommandlibFormat(tc.getCommandlibFormat().replace("<num>", tr.getRecPhone().trim()));
              ResultSet rs=st.executeQuery(tc.getCommandlibSql().replace("<num>", tr.getRecPhone().trim()));
              //TODO 将删除
              System.out.println(tc.getCommandlibSql().replace("<num>", tr.getRecPhone()).trim());
              String tempDate=tc.getCommandlibFormat();
              int count=0;
              while(rs.next()){
                tc.setCommandlibFormat(tempDate);
                if(tc.getCommandlibFormat()!=null && !tc.getCommandlibFormat().equals(""))
                {
                for(int n=0;n<colArray.length;n++){
                  tempArray[n]=rs.getString(colArray[n].trim());
                  tc.setCommandlibFormat(tc.getCommandlibFormat().replace("<"+(n+1)+">", tempArray[n]));
                }
                sendSmsStr=tc.getCommandlibFormat();
                //TODO 将删除
                System.out.println(sendSmsStr);
                Connection conn=ConnectDB.getSqlServerConnection();
                Statement sta=conn.createStatement();
              
                sta=new TblSmsSendDAO().add(sta,new TblSmsSend(tr.getRecPhone(),sendSmsStr,2,tc.getCommandlibName()));
                sta.executeBatch();
                //执行成功+1
                new TbCommandlibDAO().updateSuccCount(tc.getCommandlibId());
                count++;
                sta.close();
                conn.close();
               
                }               
              }
              if(count==0){
                sendSmsStr=tc.getMsgNull();
                if(!"".equals(sendSmsStr.trim()))
                {
                Connection connn=ConnectDB.getSqlServerConnection();
                Statement stn=connn.createStatement();
                stn=new TblSmsSendDAO().add(stn,new TblSmsSend(tr.getRecPhone(),sendSmsStr,2,tc.getCommandlibName()));
                stn.executeBatch();
                 //执行成功+1
                new TbCommandlibDAO().updateSuccCount(tc.getCommandlibId());
                stn.close();
                connn.close();
                //TODO 将删除
                System.out.println(sendSmsStr);
                }
              }
              }catch(Exception e){
                e.printStackTrace();
                sendSmsStr=tc.getMsgErr();
                //TODO 将删除
                if(!"".equals(sendSmsStr.trim()))
                {
                System.out.println(sendSmsStr);
                Connection conne=ConnectDB.getSqlServerConnection();
                Statement ste=conne.createStatement();
                ste=new TblSmsSendDAO().add(ste,new TblSmsSend(tr.getRecPhone(),sendSmsStr,2,tc.getCommandlibName()));
                ste.executeBatch();
                //执行失败+1
                new TbCommandlibDAO().updateFailCount(tc.getCommandlibId());
                ste.close();
                conne.close();
                }
               
              }
View Full Code Here

TOP

Related Classes of com.vsked.bean.TbCommandlib

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.