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

📄 articlebean.java

📁 这是一个很好用的软件
💻 JAVA
📖 第 1 页 / 共 2 页
字号:

package oa.bean;

import java.util.*;
import java.util.Date;
import java.io.File;
import java.sql.*;
import oa.main.*;

public class ArticleBean extends ParentBean {
	int strID = -1; //文章编号

	public void setID(String o)//设置文章编号
	{
		strID = Integer.parseInt(o);
	}

	public Hashtable getorgqx(String uid)//获得个人可发表文章和可管理的部门
	{
		Hashtable hash = new Hashtable();
		String lr = "";//可发表到的部门
		String gl = "";//可管理的部门

		String sql = "";

		sql = "select news.zz_fbxwb.BMBH,news.zz_fbxwb.SFGL from news.zz_fbxwb,news.zz_bmb where zgbh='"
				+ uid
				+ "' and lb=2 and news.zz_fbxwb.BMBH=news.zz_bmb.BMBH order by news.zz_bmb.JBXH";

		ResultSet rs = selectRecord(sql);
		Statement stmt = null;
		try {
			while (rs.next()) {
				String bmbh = ds.toString(rs.getString(1));
				String sfgl = ds.toString(rs.getString(2));
				if (!lr.equals("")) {
					lr = lr + ",";
				}
				lr = lr + bmbh;
				if (sfgl.equals("1")) {
					if (!gl.equals("")) {
						gl = gl + ",";
					}
					gl = gl + bmbh;
				}
			}
		} catch (Exception e) {
			System.out.println("AticleBean.getorgqx(String)处理时出错了:" + e);
		} finally {
			if (rs != null)
				try {
					stmt = rs.getStatement();
					rs.close();
				} catch (Exception e) {
					System.out
							.println("AticleBean.getorgqx(String)试图释放记录集rs时出错:"
									+ e);
				}
			if (stmt != null)
				try {
					stmt.close();
				} catch (Exception e) {
					System.out
							.println("AticleBean.getorgqx(String)试图释放声明Statement时出错:"
									+ e);
				}
		}
		hash.put("LR", lr);
		hash.put("GL", gl);
		return hash;
	}

	public Hashtable getbmqx(String uid)//获得个人有管理员权限的所有版面
	{
		String showqx1 = "";//所有可审批的位于menu表中的版面
		String showqx2 = "";//所有可审批的位于menuchild表中的版面
		String imgqx1 = "";//所有可审批图片的位于menu表中的版面
		String imgqx2 = "";//所有可审批图片的位于menuchild表中的版面
		String headqx1 = "";//所有可审批首页的位于menu表中的版面
		String headqx2 = "";//所有可审批首页的位于menuchild表中的版面
		String goodqx1 = "";//所有可审批焦点的位于menu表中的版面
		String goodqx2 = "";//所有可审批焦点的位于menuchild表中的版面

		Hashtable ht = new Hashtable();
		ResultSet rs = null;
		MenuBean mb = null;
		Statement stmt = null;
		try {
			mb = new MenuBean();

			String sql = "select dxbh,cz,whichtable from news.zz_fbxwb where zgbh='"
					+ uid + "' and lb='1' and sf='2' ";

			rs = selectRecord(sql);
			while (rs.next()) {
				String dxbh = ds.toString(rs.getString(1));
				String cz = ds.toString(rs.getString(2));
				String whichtable = ds.toString(rs.getString(3));
				String str1 = "";//保存中间结果
				String str2 = "";//保存中间结果
				String sql_1 = "";
				ResultSet rs_1 = null;
				String id1 = "", id2 = "", id3 = "";
				if (whichtable.equals("1"))//在menu表中
				{
					sql_1 = "select id,id1,id2,id3 from news.menu where id = "
							+ dxbh;
					rs_1 = selectRecord(sql_1);
					try {
						if (!rs_1.next())
							return ht;
						id1 = ds.toString(rs_1.getString(2));
						id2 = ds.toString(rs_1.getString(3));
						id3 = ds.toString(rs_1.getString(4));
					} catch (Exception e) {
						System.out.println("ArticleBean.getbmqx(String)运行时出错:"
								+ e);
					} finally {
						if (rs_1 != null)
							try {
								stmt = rs_1.getStatement();
								rs_1.close();
							} catch (Exception e) {
								System.out
										.println("ArticleBean.getbmqx(String)关闭记录集rs时出错"
												+ e);
							}
						if (stmt != null)
							try {
								stmt.close();
							} catch (Exception e) {
								System.out
										.println("ArticleBean.getbmqx(String)关闭声明时statement出错"
												+ e);
							}
					}

					if (id2.equals("0"))//一级菜单
					{
						sql_1 = "select id from news.menu where id1='" + id1
								+ "'";
						rs_1 = selectRecord(sql_1);
						try {
							while (rs_1.next()) {
								if (!str1.equals("")) {
									str1 = str1 + ",";
								}
								str1 = str1 + ds.toString(rs_1.getString(1));
							}
						} catch (Exception e) {
							System.out
									.println("ArticleBean.getbmqx(String)运行时出错:"
											+ e);
						} finally {
							if (rs_1 != null)
								try {
									stmt = rs_1.getStatement();
									rs_1.close();
								} catch (Exception e) {
									System.out
											.println("ArticleBean.getbmqx(String)关闭记录集rs时出错"
													+ e);
								}
							if (stmt != null)
								try {
									stmt.close();
								} catch (Exception e) {
									System.out
											.println("ArticleBean.getbmqx(String)关闭声明时statement出错"
													+ e);
								}
						}

						sql_1 = "select id from news.menuchild where idparent in ("
								+ str1 + ") and isthis='0'";
						rs_1 = selectRecord(sql_1);
						try {
							while (rs_1.next()) {
								if (!str2.equals("")) {
									str2 = str2 + ",";
								}
								str2 = str2 + ds.toString(rs_1.getString(1));
							}
						} catch (Exception e) {
							System.out
									.println("ArticleBean.getbmqx(String)运行时出错:"
											+ e);
						} finally {
							if (rs_1 != null)
								try {
									stmt = rs_1.getStatement();
									rs_1.close();
								} catch (Exception e) {
									System.out
											.println("ArticleBean.getbmqx(String)关闭记录集rs时出错"
													+ e);
								}
							if (stmt != null)
								try {
									stmt.close();
								} catch (Exception e) {
									System.out
											.println("ArticleBean.getbmqx(String)关闭声明时statement出错"
													+ e);
								}
						}
					}
					if (id3.equals("0") && !id2.equals("0"))//二级菜单
					{
						sql_1 = "select id from news.menu where id1='" + id1
								+ "' and id2='" + id2 + "'";
						rs_1 = selectRecord(sql_1);
						try {
							while (rs_1.next()) {
								if (!str1.equals("")) {
									str1 = str1 + ",";
								}
								str1 = str1 + ds.toString(rs_1.getString(1));
							}
						} catch (Exception e) {
							System.out
									.println("ArticleBean.getbmqx(String)运行时出错:"
											+ e);
						} finally {
							if (rs_1 != null)
								try {
									stmt = rs_1.getStatement();
									rs_1.close();
								} catch (Exception e) {
									System.out
											.println("ArticleBean.getbmqx(String)关闭记录集rs时出错"
													+ e);
								}
							if (stmt != null)
								try {
									stmt.close();
								} catch (Exception e) {
									System.out
											.println("ArticleBean.getbmqx(String)关闭声明时statement出错"
													+ e);
								}
						}

						sql_1 = "select id from news.menuchild where idparent in ("
								+ str1 + ") and isthis='0'";
						rs_1 = selectRecord(sql_1);
						try {
							while (rs_1.next()) {
								if (!str2.equals("")) {
									str2 = str2 + ",";
								}
								str2 = str2 + ds.toString(rs_1.getString(1));
							}
						} catch (Exception e) {
							System.out
									.println("ArticleBean.getbmqx(String)运行时出错:"
											+ e);
						} finally {
							if (rs_1 != null)
								try {
									stmt = rs_1.getStatement();
									rs_1.close();
								} catch (Exception e) {
									System.out
											.println("ArticleBean.getbmqx(String)关闭记录集rs时出错"
													+ e);
								}
							if (stmt != null)
								try {
									stmt.close();
								} catch (Exception e) {
									System.out
											.println("ArticleBean.getbmqx(String)关闭声明时statement出错"
													+ e);
								}
						}
					}
					if (!id3.equals("0"))//三级菜单
					{
						if (!str1.equals("")) {
							str1 = str1 + ",";
						}
						str1 = str1 + dxbh;

						sql_1 = "select id from news.menuchild where idparent in ("
								+ str1 + ") and isthis='0'";
						rs_1 = selectRecord(sql_1);
						try {
							while (rs_1.next()) {
								if (!str2.equals("")) {
									str2 = str2 + ",";
								}
								str2 = str2 + ds.toString(rs_1.getString(1));
							}
						} catch (Exception e) {
							System.out
									.println("ArticleBean.getbmqx(String)运行时出错:"
											+ e);
						} finally {
							if (rs_1 != null)
								try {
									stmt = rs_1.getStatement();
									rs_1.close();
								} catch (Exception e) {
									System.out
											.println("ArticleBean.getbmqx(String)关闭记录集rs时出错"
													+ e);
								}
							if (stmt != null)
								try {
									stmt.close();
								} catch (Exception e) {
									System.out
											.println("ArticleBean.getbmqx(String)关闭声明时statement出错"
													+ e);
								}
						}
					}
					if (!str1.equals("")) {
						if (!showqx1.equals("")) {
							showqx1 = showqx1 + ",";
						}
						showqx1 = showqx1 + str1;

						if (cz.equals("1"))//审焦点
						{
							if (!goodqx1.equals("")) {
								goodqx1 = goodqx1 + ",";
							}
							goodqx1 = goodqx1 + str1;
						}

						if (cz.equals("2"))//审首页
						{
							if (!headqx1.equals("")) {
								headqx1 = headqx1 + ",";
							}
							headqx1 = headqx1 + str1;
						}

						if (cz.equals("3"))//审图片
						{
							if (!imgqx1.equals("")) {
								imgqx1 = imgqx1 + ",";
							}
							imgqx1 = imgqx1 + str1;

						}
					}
					if (!str2.equals("")) {
						if (!showqx2.equals("")) {
							showqx2 = showqx2 + ",";
						}
						showqx2 = showqx2 + str2;

						if (cz.equals("1"))//审焦点
						{
							if (!goodqx2.equals("")) {
								goodqx2 = goodqx2 + ",";
							}
							goodqx2 = goodqx2 + str2;
						}
						if (cz.equals("2"))//审首页
						{
							if (!headqx2.equals("")) {
								headqx2 = headqx2 + ",";
							}
							headqx2 = headqx2 + str2;
						}
						if (cz.equals("3"))//审图片
						{
							if (!imgqx2.equals("")) {
								imgqx2 = imgqx2 + ",";
							}
							imgqx2 = imgqx2 + str2;
						}
					}
				}
				if (whichtable.equals("2"))//menuchild表中
				{
					str2 = dxbh;

					if (!showqx2.equals("")) {
						showqx2 = showqx2 + ",";
					}
					showqx2 = showqx2 + str2;

					if (cz.equals("1"))//审焦点
					{
						if (!goodqx2.equals("")) {
							goodqx2 = goodqx2 + ",";
						}
						goodqx2 = goodqx2 + str2;
					}
					if (cz.equals("2"))//审首页
					{
						if (!headqx2.equals("")) {
							headqx2 = headqx2 + ",";
						}
						headqx2 = headqx2 + str2;
					}
					if (cz.equals("3"))//审图片
					{
						if (!imgqx2.equals("")) {
							imgqx2 = imgqx2 + ",";
						}
						imgqx2 = imgqx2 + str2;
					}
				}
			}
			ht.put("SHOW1", ds.strDistinct(showqx1));
			ht.put("SHOW2", ds.strDistinct(showqx2));
			ht.put("IMG1", ds.strDistinct(imgqx1));
			ht.put("IMG2", ds.strDistinct(imgqx2));
			ht.put("HEAD1", ds.strDistinct(headqx1));
			ht.put("HEAD2", ds.strDistinct(headqx2));
			ht.put("GOOD1", ds.strDistinct(goodqx1));
			ht.put("GOOD2", ds.strDistinct(goodqx2));
		} catch (Exception e) {
			System.out.println("ArticleBean.getbmqx(String)运行时出错:" + e);
		} finally {
			if (mb != null)
				this.closeConn();
			if (rs != null)
				try {
					stmt = rs.getStatement();
					rs.close();
				} catch (Exception e) {
					System.out
							.println("ArticleBean.getbmqx(String)试图释放记录集rs时出错:"
									+ e);
				}
			if (stmt != null)
				try {
					stmt.close();
				} catch (Exception e) {
					System.out
							.println("ArticleBean.getbmqx(String)试图释放声明Statement时出错:"
									+ e);
				}
		}
		return ht;
	}

	public Vector getkybm(String uid)//获得个人能发表文章的可用版面
	{
		Vector vt = new Vector();
		String sql = "select WZQX from news.zz_zgzwb where zgbh='" + uid + "'";

		ResultSet rs = selectRecord(sql);
		Statement stmt = null;
		try {
			//取得列数和列名
			ResultSetMetaData rsmd = rs.getMetaData();

			int num = 0;
			String[] str = new String[100];

			while (rs.next()) {
				String kybm = ds.toString(rs.getString(1));
				StringTokenizer st = new StringTokenizer(kybm, ";");
				while (st.hasMoreElements()) {
					String st1 = (String) st.nextElement();
					String cz = st1.substring(0, 1);
					String wt = st1.substring(2, 3);
					String no = st1.substring(st1.lastIndexOf(",") + 1, st1
							.length());

⌨️ 快捷键说明

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