📄 personbean.java
字号:
} catch (Exception e) {
System.out.println("关闭声明时statement出错" + e);
}
}
sql = "update news.ZZ_ZGB set JBXH=JBXH-1 where BMBH='" + getBMBH()
+ "' and ZZZT=0 and JBXH >" + yjbxh;
//System.out.println(sql);
deleteRecord(sql);
sql = "update news.ZZ_ZGB set ZZZT = 3 where ZGBH = '" + strPersonNO
+ "'";
deleteRecord(sql);
sql = "delete from news.ZZ_ZGZWB where ZGBH = '" + strPersonNO + "'";
deleteRecord(sql);
sql = "delete from news.ZZ_FBXWB where ZGBH = '" + strPersonNO + "'";
return deleteRecord(sql);
}
public void delDBPs()//从数据库中永久删除离退休等人员信息
{
String sql = "";
sql = "delete from news.ZZ_ZGB where ZGBH = '" + strPersonNO + "'";
deleteRecord(sql);
}
public void resumePs() //恢复挂起人员
{
String sql = "";
sql = "update news.ZZ_ZGB set ZZZT=0 where ZGBH = '" + strPersonNO
+ "'";
executeUpdate(sql);
}
//取得当前职工在当前部门的操作权限
public String getOper() {
String strOper = "";
String sql = "";
String strMRCZ = "1";
String strSYZT = "0";
String str1 = ",";
String str2 = "@";
String strBMBH = "";
String strZWBH = "";
String strMax = "";
int i, j;
sql = " select CZQX from news.ZZ_ZGZWB where ZGBH = '" + strPersonNO
+ "' ";
ResultSet rs = selectRecord(sql);
Statement stmt = null;
try {
while (rs.next())//在ZZ_ZGZWB表找此职工所有职务的权限
{
String strX = ds.toString(rs.getString(1));//取得某一职务的权限
if (!strX.equals("")) {
strMax += strX + str2;
}
}
} catch (Exception e) {
System.out.println("运行时出错:" + e);
} finally {
if (rs != null)
try {
stmt = rs.getStatement();
rs.close();
} catch (Exception e) {
System.out.println("关闭记录集rs时出错" + e);
}
if (stmt != null)
try {
stmt.close();
} catch (Exception e) {
System.out.println("关闭声明时statement出错" + e);
}
}
if (strMax.equals(""))//如果ZZ_ZGZWB中的操作权限为空,在ZZ_ZWB表找此职工所有职务的权限
{
sql = "select a.CZQX from news.ZZ_ZWB a,news.ZZ_ZGZWB b where ZGBH = '"
+ strPersonNO
+ "' and a.zwzt<>1 and a.BMBH = b.BMBH and a.ZWBH = b.ZWBH ";
rs = selectRecord(sql);
try {
while (rs.next())//把此职工的所有职务的权限用(@)分割存储
{
String strX = ds.toString(rs.getString(1));//取得某一职务的权限
if (!strX.equals("")) {
strMax += strX + str2;
}
}
} catch (Exception e) {
System.out.println("运行时出错:" + e);
} finally {
if (rs != null)
try {
stmt = rs.getStatement();
rs.close();
} catch (Exception e) {
System.out.println("关闭记录集rs时出错" + e);
}
if (stmt != null)
try {
stmt.close();
} catch (Exception e) {
System.out.println("关闭声明时statement出错" + e);
}
}
if (strMax.equals(""))//判断是否启用默认权限,空则用默认权限
{
sql = "select ID from news.CODE_ANCZQXB where MRCZ = "
+ strMRCZ + " and SYZT = " + strSYZT + "";
ResultSet r = selectRecord(sql);
try {
while (r.next()) {
strOper += ds.toString(r.getString("ID")) + str1;
}
} catch (Exception e) {
System.out.println("运行时出错:" + e);
} finally {
if (r != null)
try {
stmt = r.getStatement();
r.close();
} catch (Exception e) {
System.out.println("关闭记录集rs时出错" + e);
}
if (stmt != null)
try {
stmt.close();
} catch (Exception e) {
System.out.println("关闭声明时statement出错" + e);
}
}
if (strOper.length() != 0)
strOper = strOper.substring(0, strOper.length() - 1);
if (strOper.length() == 0)
strOper = "";
return strOper;
}
}
strMax = strMax.substring(0, strMax.length() - 1);
String strMaxOper[] = strMax.split("@");
strMax = ",";
for (i = 0; i < strMaxOper.length; i++)//取得此职工最大权限集合strMax
{
String strEp[] = strMaxOper[i].split(",");
for (j = 0; j < strEp.length; j++) {
strEp[j] = strEp[j];
/*
* String[] s = strMax.split(","); boolean f = true; for(int
* k=0;k <s.length;k++){ if(strEp[j].equals(s[k])){ f = false;
* break; } }
*/
if (strMax.indexOf("," + strEp[j] + ",") == -1) {
strMax += strEp[j] + str1;
}
}
}
strOper = strMax;
strOper = strOper.substring(1, strOper.length() - 1);
/*
* String strOpers[] = strOper.split(","); for(i=0;i
* <strOpers.length;i++)//根据分割后的编号取得模块名称 {
* strOper+=db.toName("CODE_ANCZQXB","MKBH","MKMC",strOpers[i])+str1; }
* strOper = strOper.substring(0,strOper.length()-1);
*/
return strOper;
}
//取得当前操作者能够分配的操作权限(即 在某部门能够'分配职务'才能够分配在此部门的操作权限)
public String getOper_lm() {
String strOper = "";
String sql = "";
String strMRCZ = "1";
String strSYZT = "0";
String str1 = ",";
String str2 = "@";
String strBMBH = "";
String strZWBH = "";
String strMax = "";
int i, j;
sql = " select x.CZQX from news.ZZ_ZGZWB x,news.zz_zwb y where x.ZGBH = '"
+ strPersonNO
+ "' and y.zwzt<>1 and x.bmbh=y.bmbh and x.zwbh=y.zwbh and x.BMBH in ( select distinct a.BMBH from ZZ_ZGZWB a,ZZ_ZWB b where a.ZGBH='"
+ strPersonNO
+ "' and (a.CZQX like '%,73%' or a.CZQX like '%,73%,' or a.CZQX like '%73%,' or b.CZQX like '%,73%' or b.CZQX like '%,73%,' or b.CZQX like '%73%,') and b.zwzt<>1 and a.BMBH=b.BMBH and a.ZWBH=b.ZWBH ) ";
ResultSet rs = selectRecord(sql);
Statement stmt = null;
try {
while (rs.next())//在ZZ_ZGZWB表找此职工所有职务的权限
{
String strX = ds.toString(rs.getString(1));//取得某一职务的权限
if (!strX.equals("")) {
strMax += strX + str2;
}
}
} catch (Exception e) {
System.out.println("运行时出错:" + e);
} finally {
if (rs != null)
try {
stmt = rs.getStatement();
rs.close();
} catch (Exception e) {
System.out.println("关闭记录集rs时出错" + e);
}
if (stmt != null)
try {
stmt.close();
} catch (Exception e) {
System.out.println("关闭声明时statement出错" + e);
}
}
if (strMax.equals(""))//如果ZZ_ZGZWB中的操作权限为空,在ZZ_ZWB表找此职工所有职务的权限
{
sql = "select a.CZQX from news.ZZ_ZWB a,news.ZZ_ZGZWB b where ZGBH = '"
+ strPersonNO
+ "' and a.zwzt<>1 and a.BMBH = b.BMBH and a.ZWBH = b.ZWBH and b.BMBH in ( select distinct a.BMBH from news.ZZ_ZGZWB a,news.ZZ_ZWB b where a.ZGBH='"
+ strPersonNO
+ "' and b.zwzt<>1 and (a.CZQX like '%,73%' or a.CZQX like '%,73%,' or a.CZQX like '%73%,' or b.CZQX like '%,73%' or b.CZQX like '%,73%,' or b.CZQX like '%73%,') and a.BMBH=b.BMBH and a.ZWBH=b.ZWBH ) ";
rs = selectRecord(sql);
try {
while (rs.next())//把此职工的所有职务的权限用(@)分割存储
{
String strX = ds.toString(rs.getString(1));//取得某一职务的权限
if (!strX.equals("")) {
strMax += strX + str2;
}
}
} catch (Exception e) {
System.out.println("运行时出错:" + e);
} finally {
if (rs != null)
try {
stmt = rs.getStatement();
rs.close();
} catch (Exception e) {
System.out.println("关闭记录集rs时出错" + e);
}
if (stmt != null)
try {
stmt.close();
} catch (Exception e) {
System.out.println("关闭声明时statement出错" + e);
}
}
if (strMax.equals(""))//判断是否启用默认权限,空则用默认权限
{
sql = "select ID from news.CODE_ANCZQXB where MRCZ = "
+ strMRCZ + " and SYZT = " + strSYZT + "";
ResultSet r = selectRecord(sql);
try {
while (r.next()) {
strOper += ds.toString(r.getString("ID")) + str1;
}
} catch (Exception e) {
System.out.println("运行时出错:" + e);
} finally {
if (r != null)
try {
stmt = r.getStatement();
r.close();
} catch (Exception e) {
System.out.println("关闭记录集rs时出错" + e);
}
if (stmt != null)
try {
stmt.close();
} catch (Exception e) {
System.out.println("关闭声明时statement出错" + e);
}
}
if (strOper.length() != 0)
strOper = strOper.substring(0, strOper.length() - 1);
if (strOper.length() == 0)
strOper = "";
return strOper;
}
}
strMax = strMax.substring(0, strMax.length() - 1);
String strMaxOper[] = strMax.split("@");
strMax = ",";
for (i = 0; i < strMaxOper.length; i++)//取得此职工最大权限集合strMax
{
String strEp[] = strMaxOper[i].split(",");
for (j = 0; j < strEp.length; j++) {
strEp[j] = strEp[j];
/*
* String[] s = strMax.split(","); boolean f = true; for(int
* k=0;k <s.length;k++){ if(strEp[j].equals(s[k])){ f = false;
* break; } }
*/
if (strMax.indexOf("," + strEp[j] + ",") == -1) {
strMax += strEp[j] + str1;
}
}
}
strOper = strMax;
strOper = strOper.substring(1, strOper.length() - 1);
/*
* String strOpers[] = strOper.split(","); for(i=0;i
* <strOpers.length;i++)//根据分割后的编号取得模块名称 {
* strOper+=db.toName("CODE_ANCZQXB","MKBH","MKMC",strOpers[i])+str1; }
* strOper = strOper.substring(0,strOper.length()-1);
*/
return strOper;
}
//将getOper返回的操作权限编号转为汉字 new 李伯华
public String toOperName(String strOperNo) {
String strOper = "";
String strOpers[] = strOperNo.split(",");
for (int i = 0; i < strOpers.length; i++)//根据分割后的编号取得模块名称
{
strOper += db.toName("CODE_ANCZQXB", "ID", "MKMC", strOpers[i])
+ ":"
+ db.toName("CODE_ANCZQXB", "ID", "ANMC", strOpers[i])
+ ",";
}
strOper = strOper.substring(0, strOper.length() - 1);
return strOper;
}
//将getFlow返回的流程权限编号转为汉字 new 李伯华
public String toFlowName(String strFlowNo) {
String strFlow = "";
String strFlows[] = strFlowNo.split(",");
for (int i = 0; i < strFlows.length; i++)//根据分割后的编号取得模块名称
{
strFlow += db.toName("CODE_LCQXB", "MKBH", "MKMC", strFlows[i])
+ ",";
}
strFlow = strFlow.substring(0, strFlow.length() - 1);
return strFlow;
}
//通过职工编号得到当前职务的流程权限,没转化为汉字
public String getFlow() {
String strFlow = "";
String sql = "";
String strMRCZ = "1";
String strSYZT = "0";
String str1 = ",";
String str2 = "@";
String strBMBH = "";
String strZWBH = "";
String strMax = "";
int i, j;
sql = "select LCQX from news.ZZ_ZGZWB where ZGBH = '" + strPersonNO
+ "'";
ResultSet rs = null;
Statement stmt = null;
try {
rs = selectRecord(sql);
while (rs.next())//在ZZ_ZGZWB表找此职工所有职务的权限
{
String strX = ds.toString(rs.getString("LCQX"));//取得某一职务的权限
if (!strX.equals("")) {
strMax += strX + str2;
}
}
} catch (Exception e) {
System.out.println("运行时出错:" + e);
} finally {
if (rs != null)
try {
stmt = rs.getStatement();
rs.close();
} catch (Exception e) {
System.out.println("关闭记录集rs时出错" + e);
}
if (stmt != null)
try {
stmt.close();
} catch (Exception e) {
System.out.println("关闭声明时statement出错" + e);
}
}
if (strMax.equals(""))//如果ZZ_ZGZWB中的操作权限为空
{
sql = "select a.LCQX from news.ZZ_ZWB a,news.ZZ_ZGZWB b where ZGBH = '"
+ strPersonNO
+ "' and a.zwzt<>1 and a.BMBH = b.BMBH and a.ZWBH = b.ZWBH ";
ResultSet rs1 = selectRecord(sql);
try {
while (rs1.next())//把此职工的所有职务的权限用(@)分割存储
{
String strX = ds.toString(rs1.getString("LCQX"));//取得某一职务的权限
//System.out.println("\r\nwwwwwwwwwwwwwwwww zgbh =
// "+strPersonNO+" lcqx="+strX);
if (!strX.equals("")) {
strMax += strX + str2;
}
}
} catch (Exception e) {
System.out.println("运行时出错:" + e);
} finally {
if (rs1 != null)
try {
stmt = rs1.getStatement();
rs1.close();
} catch (Exception e) {
System.out.println("关闭记录集rs时出错" + e);
}
if (stmt != null)
try {
stmt.close();
} catch (Exception e) {
System.out.println("关闭声明时statement出错" +
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -