⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uptext.java

📁 jdo开发实例,一个功能全面的oa系统
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
                        dt.Kenizers(inte, id);
                    }
                }

            }

            sta.close();
            conn.close();
        }
        catch(Exception e)
        {
            System.out.println(e);
        }
    }

    public String getdate()
    {
        String dates = null;
       java.util.Date date = new java.util.Date();
        DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
        dates = df.format(date);
        return dates;
    }

    public ArrayList getpassword(String name)
    {
        ArrayList al = new ArrayList();
        upActionform uaf = new upActionform();
        try
        {
            Connection conn = util.getConnection();
            Statement sta = conn.createStatement();
            for(ResultSet rs = sta.executeQuery("select * from employ where yonghuname='" + name + "'"); rs.next(); al.add(uaf))
            {
                uaf.setName(rs.getString(2).trim());
                uaf.setId(rs.getString(5).trim());
                uaf.setPasswords(rs.getString(6).trim());
            }

        }
        catch(Exception e)
        {
            System.out.println(e);
        }
        return al;
    }

    public ArrayList getsendtitle(int id)
    {
        ArrayList al = new ArrayList();
        String name = null;
        try
        {
            util.connect();
            Connection conn = util.getConnection();
            Statement sta = conn.createStatement();
            ResultSet rs;
            LawInfoActionForm lf;
            for(rs = sta.executeQuery("select * from LawsInfos where sendname='" + id + "'"); rs.next(); al.add(lf))
            {
                lf = new LawInfoActionForm();
                lf.setId(rs.getInt(1));
                name = gettruename(rs.getString(2));
                lf.setRecieveid(name);
                lf.setTitle(rs.getString(3));
                lf.setPublishdate(rs.getString(4));
                lf.setDescription(rs.getString(6));
                lf.setUrl(rs.getString(7));
                lf.setSizes(rs.getInt(8));
            }

            rs.close();
            sta.close();
            conn.close();
        }
        catch(Exception e)
        {
            System.out.println(e);
        }
        return al;
    }

    public ArrayList getreceiv(ArrayList id)
    {
        ArrayList al = new ArrayList();
        String name = null;
        try
        {
            util.connect();
            Connection conn = util.getConnection();
            Statement sta = conn.createStatement();
            ResultSet rs;
            for(Iterator it = id.iterator(); it.hasNext(); rs.close())
            {
                Integer i = (Integer)it.next();
                int idd = i.intValue();
                LawInfoActionForm lf;
                for(rs = sta.executeQuery("select * from lawsInfos where Lid=" + idd); rs.next(); al.add(lf))
                {
                    lf = new LawInfoActionForm();
                    lf.setId(rs.getInt(1));
                    lf.setRecieveid(rs.getString(2));
                    lf.setTitle(rs.getString(3));
                    lf.setPublishdate(rs.getString(4));
                    lf.setDescription(rs.getString(6));
                    lf.setUrl(rs.getString(7));
                    lf.setSizes(rs.getInt(8));
                    name = gettruename(rs.getString(9));
                    lf.setSendid(name);
                }

            }

            sta.close();
            conn.close();
        }
        catch(Exception e)
        {
            System.out.print(e);
        }
        return al;
    }

    public int getidbyreceivname(String p_name)
    {
        int i = 0;
        try
        {
            util.connect();
            Connection conn = util.getConnection();
            Statement sta = conn.createStatement();
            ResultSet rs = sta.executeQuery("select UID as ids from usersTomcat where truename like '%" + p_name + "%'");
            if(rs.next())
                i = rs.getInt("ids");
            sta.close();
            conn.close();
            rs.close();
        }
        catch(Exception e)
        {
            System.out.println(e);
        }
        return i;
    }

    public String gettruename(String ids)
    {
        String name = null;
        StringBuffer sb = new StringBuffer();
        try
        {
            util.connect();
            Connection conn = util.getConnection();
            Statement sta = conn.createStatement();
            for(StringTokenizer st = new StringTokenizer(ids, ",", false); st.hasMoreTokens();)
            {
                String id = st.nextToken();
                for(ResultSet rs = sta.executeQuery("select trueName as name from userstomcat where UID =" + id); rs.next();)
                {
                    sb.append(rs.getString("name"));
                    if(st.hasMoreTokens())
                        sb.append(",");
                }

            }

            conn.close();
            name = sb.toString();
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
        return name;
    }

    public ArrayList getall(String p_name)
    {
        ArrayList al = new ArrayList();
        String name = null;
        String names = null;
        try
        {
            util.connect();
            Connection conn = util.getConnection();
            Statement sta = conn.createStatement();
            LawInfoActionForm lf;
            for(ResultSet rs = sta.executeQuery("select * from lawsInfos where decr like '%" + p_name + "%'"); rs.next(); al.add(lf))
            {
                lf = new LawInfoActionForm();
                lf.setId(rs.getInt(1));
                lf.setTitle(rs.getString(3));
                lf.setPublishdate(rs.getString(4));
                lf.setDescription(rs.getString(6));
                lf.setUrl(rs.getString(7));
                lf.setSizes(rs.getInt(8));
                name = gettruename(rs.getString(9));
                lf.setSendid(name);
                names = gettruename(rs.getString(10));
                lf.setRecieveid(names);
            }

        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
        return al;
    }

    public void dels(ArrayList id)
    {
        try
        {
            util.connect();
            Connection conn = util.getConnection();
            Statement sta = conn.createStatement();
            System.out.println("ID的值已经传过来哒。。。" + id);
            String i;
            for(Iterator it = id.iterator(); it.hasNext(); sta.executeUpdate("delete from LawsInfos where Lid=" + i))
                i = (String)it.next();

            sta.close();
            conn.close();
        }
        catch(Exception e)
        {
            System.out.print(e);
        }
    }

    public ArrayList allfilepage(String page)
    {
        ArrayList al = new ArrayList();
        ArrayList all = new ArrayList();
        all = getall("");
        MaxRowCount = all.size();
        CountMaxPage();
        System.out.println("一共有这么多条记录哈" + all.size());
        maxpages = Integer.toString(maxPage);
        int pages;
        if(page == null || page.equals(""))
            pages = 1;
        else
            pages = Integer.parseInt(page);
        curPage = pages;
        Iterator it = all.iterator();
        for(int i = 1; it.hasNext(); i++)
        {
            Object ob = it.next();
            if(i > (pages - 1) * rowsPerPage && i < pages * rowsPerPage + 1)
                al.add(ob);
        }

        return al;
    }

    public ArrayList allsendpage(String page, int id)
    {
        ArrayList al = new ArrayList();
        ArrayList all = new ArrayList();
        all = getsendtitle(id);
        MaxRowCount = all.size();
        CountMaxPage();
        maxpages = Integer.toString(maxPage);
        int pages;
        if(page == null || page.equals(""))
            pages = 1;
        else
            pages = Integer.parseInt(page);
        curPage = pages;
        Iterator it = all.iterator();
        for(int i = 1; it.hasNext(); i++)
        {
            Object ob = it.next();
            if(i > (pages - 1) * rowsPerPage && i < pages * rowsPerPage + 1)
                al.add(ob);
        }

        return al;
    }

    public ArrayList allreceivpage(String page, int id)
    {
        SeachStringToKenizers stk = new SeachStringToKenizers();
        ArrayList al = new ArrayList();
        ArrayList all = new ArrayList();
        ArrayList als = new ArrayList();
        String ids = Integer.toString(id);
        all = stk.ints(ids, "");
        als = getreceiv(all);
        MaxRowCount = als.size();
        System.out.println("共有这么多条记录" + MaxRowCount);
        CountMaxPage();
        maxpages = Integer.toString(maxPage);
        int pages;
        if(page == null || page.equals(""))
            pages = 1;
        else
            pages = Integer.parseInt(page);
        curPage = pages;
        Iterator it = als.iterator();
        for(int i = 1; it.hasNext(); i++)
        {
            Object ob = it.next();
            if(i > (pages - 1) * rowsPerPage && i < pages * rowsPerPage + 1)
                al.add(ob);
        }

        return al;
    }

    public void CountMaxPage()
    {
        if(MaxRowCount == rowsPerPage)
            maxPage = 1;
        else
        if(MaxRowCount % rowsPerPage == 0)
            maxPage = MaxRowCount / rowsPerPage;
        else
            maxPage = MaxRowCount / rowsPerPage + 1;
    }

    public static void main(String args[])
    {
        java.util.Date da = new java.util.Date();
        DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd : HH:mm:ss");
        String startime = sdf.format(da);
        System.out.println(startime);
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -