📄 uptext.java
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi
// Source File Name: uptext.java
package com.gzrealmap.oa.upload;
import com.gzrealmap.lib.jdbc.JDBCUtil;
import com.gzrealmap.oa.action.UploadWenjian;
import com.gzrealmap.oa.action.upActionform;
import java.io.PrintStream;
import java.sql.*;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.apache.struts.upload.FormFile;
// Referenced classes of package com.gzrealmap.oa.upload:
// LawInfoActionForm, LawinfoDtos, DelStringToKenizers, SeachStringToKenizers
public class uptext
{
private JDBCUtil util;
public int curPage;
public int maxPage;
public int MaxRowCount;
public int rowsPerPage;
public String maxpages;
ArrayList array;
public uptext()
{
util = JDBCUtil.getInstance();
array = new ArrayList();
rowsPerPage = 13;
}
public ArrayList addfile(Object ob, HttpServletRequest request)
{
array.add(ob);
HttpSession session = request.getSession();
session.setAttribute("anjuanfile", array);
return array;
}
public int getWenJianID()
{
int i = 0;
try
{
util.connect();
String sql = "select WenJianID as id from anjuanwenjian order by WenJianID desc limit 1";
ResultSet rs;
for(rs = util.query(sql); rs.next();)
i = rs.getInt("id");
rs.close();
}
catch(Exception e)
{
System.out.println(e.toString());
}
return i;
}
public void addwenjianfile(UploadWenjian uw)
{
try
{
util.connect();
int id = getWenJianID();
String sql = "insert into anjuanfile(filetype,filedate,WenJianID,FileName,filesize)values(?,?,?,?,?)";
Connection conn = util.getConnection();
PreparedStatement pstm = conn.prepareStatement(sql);
pstm.setString(1, uw.getUpfiles().getContentType());
pstm.setBytes(2, uw.getUpfiles().getFileData());
pstm.setInt(3, id);
pstm.setString(4, uw.getUpfiles().getFileName());
pstm.setString(5, Integer.toString(uw.getUpfiles().getFileSize()));
pstm.execute();
pstm.close();
}
catch(Exception e)
{
e.printStackTrace();
}
}
public boolean add(upActionform form, int operatorid)
{
boolean boo = true;
try
{
FormFile formfile = form.getUploadpath();
formfile.getFileName();
util.connect();
Connection conn = util.getConnection();
String SQL = "insert into LawsInfos(Lname,Pname,Ptime,Lcontext,decr, url,sizes,sendname,copyLname,Filename) values(?,?,?,?,?,?,?,?,?,?)";
PreparedStatement pstm = conn.prepareStatement(SQL);
int recieveid = getidbyreceivname(form.getReceivman());
String rid = form.getReceivid();
System.out.println(rid);
pstm.setString(1, rid);
pstm.setString(2, form.getTitle());
pstm.setString(3, form.getType());
pstm.setBytes(4, formfile.getFileData());
pstm.setString(5, form.getContext());
pstm.setString(6, formfile.getFileName());
pstm.setInt(7, formfile.getFileSize());
pstm.setInt(8, operatorid);
pstm.setString(9, rid);
pstm.setString(10, formfile.getContentType());
pstm.execute();
conn.close();
}
catch(Exception e)
{
e.printStackTrace();
System.out.println(e);
boo = false;
}
return boo;
}
public ArrayList getUserExceptSelf(String selfname)
{
ArrayList al = new ArrayList();
try
{
util.connect();
Connection conn = util.getConnection();
Statement sta = conn.createStatement();
ResultSet rs;
upActionform uaf;
for(rs = sta.executeQuery("select * from userstomcat where truename not like '" + selfname + "'"); rs.next(); al.add(uaf))
{
uaf = new upActionform();
uaf.setId(rs.getString("user_name"));
uaf.setName(rs.getString("truename"));
}
rs.close();
sta.close();
conn.close();
}
catch(Exception e)
{
System.out.print(e);
}
return al;
}
public int addsize(int id)
{
try
{
util.connect();
Connection conn = util.getConnection();
Statement sta = conn.createStatement();
ResultSet rs = sta.executeQuery("Select sum(sizes) as totals from LawsInfos where sendname='" + id + "'");
if(rs.next())
return rs.getInt("totals");
rs.close();
sta.close();
conn.close();
}
catch(Exception e)
{
System.out.println(e);
}
return 0;
}
public int getidbyname(String p_name)
{
int i = 0;
try
{
Connection conn = util.getConnection();
Statement sta = conn.createStatement();
String names = new String(p_name.getBytes("iso8859-1"));
ResultSet rs = sta.executeQuery("select id as ids from employ where name like '%" + names + "%'");
if(rs.next())
i = rs.getInt("ids");
sta.close();
conn.close();
rs.close();
}
catch(Exception e)
{
System.out.println(e);
}
return i;
}
public ArrayList getallbyname(int id)
{
ArrayList al = new ArrayList();
try
{
Connection conn = util.getConnection();
Statement sta = conn.createStatement();
Hashtable hs;
for(ResultSet rs = sta.executeQuery("select * from LawsInfo where sendname='" + id + "'"); rs.next(); al.add(hs))
{
hs = new Hashtable();
hs.put("id", new Integer(rs.getInt(1)));
hs.put("nameid", new Integer(rs.getInt(2)));
hs.put("title", rs.getString(3));
hs.put("time", rs.getString(4));
hs.put("filename", rs.getString(7));
hs.put("size", rs.getString(8));
}
}
catch(Exception e)
{
System.out.println(e);
}
return al;
}
public String getnamebyid(int p_id)
{
String rt = "";
try
{
Connection conn = util.getConnection();
Statement sta = conn.createStatement();
ResultSet rs;
for(rs = sta.executeQuery("select name as names from employ where id='" + p_id + "'"); rs.next();)
rt = rs.getString("names");
rs.close();
sta.close();
conn.close();
}
catch(Exception e)
{
System.out.println(e);
}
return rt;
}
public LawInfoActionForm getallbyid(int p_id)
{
String name = null;
String names = null;
LawInfoActionForm lf = null;
try
{
util.connect();
Connection conn = util.getConnection();
Statement sta = conn.createStatement();
ResultSet rs = sta.executeQuery("select * from LawsInfos where Lid='" + p_id + "'");
if(rs.next())
{
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.setContext(rs.getBytes(5));
lf.setDescription(rs.getString(6));
lf.setUrl(rs.getString(7));
lf.setSizes(rs.getInt(8));
names = gettruename(rs.getString(9));
lf.setSendid(names);
lf.setFilename(rs.getString(10));
}
}
catch(Exception ex)
{
ex.printStackTrace();
}
return lf;
}
public ArrayList getallbyids(int p_id)
{
ArrayList al = new ArrayList();
LawinfoDtos lf = new LawinfoDtos();
try
{
Connection conn = util.getConnection();
Statement sta = conn.createStatement();
ResultSet rs;
Hashtable hs;
for(rs = sta.executeQuery("select * from LawsInfos where Lid='" + p_id + "'"); rs.next(); al.add(hs))
{
hs = new Hashtable();
hs.put("name", rs.getString(3));
hs.put("context", rs.getBytes(5));
hs.put("filename", new String(rs.getString(7).getBytes("gb2312")));
}
rs.close();
sta.close();
conn.close();
}
catch(Exception e)
{
System.out.println(e);
}
return al;
}
public void del(ArrayList p_id, int b_id)
{
DelStringToKenizers dt = new DelStringToKenizers();
try
{
util.connect();
Connection conn = util.getConnection();
Statement sta = conn.createStatement();
ResultSet rs;
for(Iterator it = p_id.iterator(); it.hasNext(); rs.close())
{
String inte = (String)it.next();
for(rs = sta.executeQuery("select sendname as nameid from LawsInfos where Lid=" + inte); rs.next();)
{
int send = rs.getInt("nameid");
if(b_id == send)
{
sta.executeUpdate("delete from LawsInfos where Lid=" + inte);
} else
{
String id = Integer.toString(b_id);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -