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

📄 uploads.java.back

📁 jdo开发实例,一个功能全面的oa系统
💻 BACK
📖 第 1 页 / 共 2 页
字号:
// 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:   uploads.java

package com.gzrealmap.oa.action;

//import com.gzrealmap.oa.actions.UserMgr;
import com.gzrealmap.oa.actions.UserMgr;
import com.gzrealmap.lib.jdbc.JDBCUtil;
//import com.gzrealmap.oa.upload.LawinfoDtos;
import com.gzrealmap.oa.upload.LawinfoDtos;
import java.io.OutputStream;
import java.io.PrintStream;
import java.sql.*;
import java.util.*;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.upload.FormFile;

// Referenced classes of package com.gzrealmap.oa.action:
//            UploadWenjian, UploadForm

public class uploads
{

    JDBCUtil sql;

    public uploads()
    {
        sql = JDBCUtil.getInstance();
    }

    public void addpicture(ArrayList al, int id)
    {
        try
        {
            sql.connect();
            Connection conn = sql.getConnection();
            PreparedStatement stm = conn.prepareStatement("insert into newspicture(type,acc_picture,innerNewId,imageName,imageparam) values(?,?,?,?,?)");
            for(Iterator it = al.iterator(); it.hasNext();)
            {
                LawinfoDtos lf = (LawinfoDtos)it.next();
                if(lf.getContext().length > 0 && lf.getContext() != null)
                {
                    stm.setString(1, lf.getDecr());
                    stm.setBytes(2, lf.getContext());
                    stm.setInt(3, id);
                    stm.setString(4, lf.getLname());
                    stm.setString(5, lf.getPname());
                    stm.execute();
                }
            }

            conn.close();
            stm.close();
            sql.disconnect();
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
    }

    public String getSerialNo(UploadWenjian uw)
    {
        String No = "";
        try
        {
            sql.connect();
            String sqls = " SELECT * FROM AnJuanWenJian WHERE (FenLeiHao = '" + uw.getFenLeiHao() + "') AND (AnJuanHao = '" + uw.getAnJuanHao() + "') ORDER BY SerialNo DESC ";
            ResultSet rsa = sql.query(sqls);
            if(rsa.next())
                No = rsa.getString("SerialNo");
            else
                No = "0";
            sql.disconnect();
            int newSN = Integer.parseInt(No.trim());
            No = String.valueOf(newSN += 1000);
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
        return No;
    }

    public void addgwtowenjian(UploadWenjian uw, String No, int archiveID, byte filedata[])
    {
        try
        {
            sql.connect();
            Connection conn = sql.getConnection();
            PreparedStatement ps = conn.prepareStatement("insert into anjuanwenjian(SerialNo,FenLeiHao,AnJuanHao,GuanShiDaiHai,Suoweihao,TiMing,ZeRenZe,LaiWenDanWei,WenHao,WenBen,MiJi,BaoGuanQiXian,XingChengShiJian,ShuLiang,Danwei,YeHao,ZhuTiChi,ZaiYao,FuJianMing,FuJianLeiXing,FuJianDaXiao,FuJian,WenJianBeiZhu,viewhtml) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
            ps.setString(1, No);
            ps.setString(2, uw.getFenLeiHao());
            ps.setString(3, uw.getAnJuanHao());
            ps.setString(4, uw.getGuanShiDaiHai());
            ps.setString(5, uw.getSuoweihao());
            ps.setString(6, uw.getTiMing());
            ps.setString(7, uw.getZeRenZe());
            ps.setString(8, uw.getLaiWenDanWei());
            ps.setString(9, uw.getWenHao());
            ps.setString(10, uw.getWenBen());
            ps.setString(11, uw.getMiJi());
            ps.setString(12, uw.getBaoGuanQiXian());
            ps.setString(13, uw.getXingChengShiJian());
            ps.setString(14, uw.getShuLiang());
            ps.setString(15, uw.getDanwei());
            ps.setString(16, uw.getYeHao());
            ps.setString(17, uw.getZhuTiChi());
            ps.setString(18, uw.getZaiYao());
            ps.setString(19, null);
            ps.setString(20, null);
            ps.setInt(21, archiveID);
            ps.setBytes(22, null);
            ps.setString(23, uw.getWenJianBeiZhu());
            ps.setBytes(24, filedata);
            ps.execute();
            sql.disconnect();
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
    }

    public void add(String topic, String content, String send_from, String send_time, String end_time, String types, byte flashcontent[],
            String falshtype, String flashname, byte acc[])
    {
        try
        {
            String type = "innernews";
            sql.connect();
            Connection conn = sql.getConnection();
            PreparedStatement sta = conn.prepareStatement("insert into innernews(topic,content,send_from,send_time,end_time,acc,type,accfile,filename,filetype,flashname) values(?,?,?,?,?,?,?,?,?,?,?)");
            sta.setString(1, topic);
            sta.setString(2, content);
            sta.setString(3, send_from);
            sta.setString(4, send_time);
            sta.setString(5, end_time);
            sta.setBytes(6, acc);
            sta.setString(7, type);
            sta.setBytes(8, flashcontent);
            sta.setString(9, falshtype);
            sta.setString(10, types);
            sta.setString(11, flashname);
            sta.execute();
            conn.close();
            sta.close();
            sql.disconnect();
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
    }

    public int getlastid()
    {
        int id = 0;
        String ids = "";
        Statement stm = null;
        ResultSet rs = null;
        try
        {
            sql.connect();
            for(rs = sql.queryforUpdate("SELECT * FROM innernews order by id desc limit 1"); rs.next();)
                id = rs.getInt(1);

            sql.disconnect();
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
        return id;
    }

    public int getwenjianlastid()
    {
        int id = 0;
        Statement stm = null;
        ResultSet rs = null;
        try
        {
            sql.connect();
            for(rs = sql.queryforUpdate("SELECT * FROM anjuanwenjian order by WenJianID desc limit 1"); rs.next();)
            {
                id = rs.getInt(1);
                id++;
            }

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

    public void addzhengwen(int archiveid, int id)
    {
        try
        {
            sql.connect();
            String sqls = "INSERT into anjuanfile(filetype,filedate,WenJianID,FileName,filesize,usertype) SELECT fileType,content,'" + id + "',fileName,fileSize,usetype FROM archiveattachment where archiveID='" + archiveid + "' and usetype=1 limit 1";
            String sqls1 = "INSERT into anjuanfile(filetype,filedate,WenJianID,FileName,filesize,usertype) SELECT fileType,content,'" + id + "',fileName,fileSize,usetype FROM archiveattachment where archiveID='" + archiveid + "' and usetype=2";
            String sqls2 = "INSERT into anjuanfile(filetype,filedate,WenJianID,FileName,filesize,usertype) SELECT fileType,content,'" + id + "',fileName,fileSize,usetype FROM archiveattachment where archiveID='" + archiveid + "' and usetype=5 limit 1";
            String sqls3 = "insert into anjuankeyvalues(keyname,keyvalues,anjuanid) select elementKey,elementValue,'" + id + "' from archivekeyvaluepairs where archiveID='" + archiveid + "'";
            Connection conn = sql.getConnection();
            Statement sta = conn.createStatement();
            if(!sta.execute(sqls2))
                sta.execute(sqls);
            sta.execute(sqls1);
            sta.execute(sqls3);
            sql.disconnect();
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
    }

    public ArrayList getContent(String id)
    {
        ArrayList al = new ArrayList();
        try
        {
            sql.connect();
            Hashtable ha;
            for(ResultSet rs = sql.query("select * from newspicture where innerNewId=" + id); rs.next(); al.add(ha))
            {
                ha = new Hashtable();
                String ids = Integer.toString(rs.getInt("id"));
                String imageparam = rs.getString("imageparam");
                ha.put("id", ids);
                ha.put("image", imageparam);
            }

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

    public void getpicid(String id, HttpServletResponse response)
    {
        try
        {
            sql.connect();
            javax.servlet.ServletOutputStream out;
            for(ResultSet rs = sql.query("select * from newspicture where id=" + id); rs.next(); out.close())
            {
                out = response.getOutputStream();
                out.write(rs.getBytes("acc_picture"));
                out.flush();
            }

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

⌨️ 快捷键说明

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