📄 persondutybean.java
字号:
boolean sfgl = false,sflr = false;
int id = 0;
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);}
String sql = "select id from zz_fbxwb where zgbh='" + personno + "' and bmbh='"+dutyOrgno+"' and lb='2' and sfgl='1'";
rs = selectRecord(sql);
if(rs.next()){
sfgl = true;
sflr = true;
id = rs.getInt(1);
}
else{
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);}
sql = "select id from zz_fbxwb where zgbh='" + personno + "' and bmbh='"+dutyOrgno+"' and lb='2' and sfgl<>'1'";
rs = selectRecord(sql);
if(rs.next()){
sflr = true;
id = rs.getInt(1);
}
}
if(dutyOrgno.equals("00000000000000000000")||!dutyOrgno.substring(4).equals("0000000000000000"))
return;
rb = new RightBean();
rb.setUID(personno);
rb.setOrgid(dutyOrgno);
boolean _sflr = rb.isRightModelbh("信息管理","信息发布"),
_sfgl = rb.isRightModelbh("信息管理","信息维护")||rb.isRightModelbh("信息管理","类别维护");
if(!sflr){//原先没有录入权限
if(_sfgl){//原先没有录入权限,则一定没有管理权限,此时分配给他管理权限
Hashtable hash = new Hashtable();
hash.put("ZGBH",personno);
hash.put("LB","2");
hash.put("BMBH",dutyOrgno);
hash.put("SFGL","1");
news = new MakeNews();
news.addNews(hash);
}
else if(_sflr&&!_sfgl){//原先没有录入权限,则一定没有管理权限,此时只分配给他录入权限,没有管理权限
Hashtable hash = new Hashtable();
hash.put("ZGBH",personno);
hash.put("LB","2");
hash.put("BMBH",dutyOrgno);
hash.put("SFGL","0");
news = new MakeNews();
news.addNews(hash);
}
}
else if(sfgl&&!_sfgl){//原先有管理权限,此时去掉他的管理权限
if(_sflr){//原先有管理权限,此时去掉他的管理权限,保留他的录入权限
Hashtable hash = new Hashtable();
hash.put("ZGBH",personno);
hash.put("LB","2");
hash.put("BMBH",dutyOrgno);
hash.put("SFGL","0");
news = new MakeNews();
news.setID(id);
news.modNews(hash);
}
else if(!_sflr){//原先有管理权限,此时去掉他的录入权限和管理权限,删除记录
news = new MakeNews();
news.setID(id);
news.delNews();
}
}
else if(sflr&&!sfgl){//原先有录入权限但没有管理权限
if(_sfgl){//原先有录入权限但没有管理权限,此时分配给他管理权限
Hashtable hash = new Hashtable();
hash.put("ZGBH",personno);
hash.put("LB","2");
hash.put("BMBH",dutyOrgno);
hash.put("SFGL","1");
news = new MakeNews();
news.setID(id);
news.modNews(hash);
}
else if(!_sflr){//原先有录入权限但没有管理权限,此时去掉他的录入权限,删除记录
news = new MakeNews();
news.setID(id);
news.delNews();
}
}
}
}catch(Exception e){System.out.println("运行时出错:"+e);}
finally{
if(rb!=null)rb.closeConn();
if(news!=null)news.closeConn();
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);}
}
}
//增加一条职工职务纪录
public void addRec(String personno,String dutyOrgno,String dutyno,String czqx,String lcqx)
{
addRec(personno,dutyOrgno,dutyno,czqx,lcqx,true);
}
//删除一条职工职务纪录
public void delRec(String personno,String dutyOrgno,String dutyno)
{
String sql="delete from ZZ_ZGZWB where ZGBH='"+personno+"' and BMBH='"+dutyOrgno+"' and ZWBH='"+dutyno+"'";
deleteRecord(sql);
sql = "select * from ZZ_ZGZWB where ZGBH='"+personno+"'";
ResultSet rs = selectRecord(sql);
Statement stmt = null;
RightBean rb = null;
MakeNews news = null;
DutyBean dutybn = null;
PersonBean psbn = null;
try{
if(!rs.next()){
dutybn = new DutyBean();
psbn = new PersonBean();
psbn.setPersonNO(personno);
String BMBH = psbn.getBMBH();
String zwNo = dutybn.getOrdinaryZWBH(BMBH,"一般员工");
if(zwNo.equals("")){
Hashtable dutyhash = new Hashtable();
dutyhash.put("BMBH",BMBH);
dutyhash.put("ZWMC","一般员工");
dutyhash.put("CZQX","");
dutyhash.put("LCQX","");
dutyhash.put("PZCS","");
dutyhash.put("JBXH","");
dutyhash.put("ZWZT","0");
dutybn.addDuty(dutyhash);
zwNo = dutybn.getOrdinaryZWBH(BMBH,"一般员工");
}
addRec(personno,BMBH,zwNo,"","");
}
}catch(Exception e){System.out.println("PersonDutyBean::delRec()运行时出错:"+e);}
finally{
if(psbn!=null)psbn.closeConn();
if(dutybn!=null)dutybn.closeConn();
if(rs!=null)try{ stmt = rs.getStatement(); rs.close();}catch(Exception e){System.out.println("PersonDutyBean::delRec()关闭记录集rs时出错"+e);}
if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("PersonDutyBean::delRec()关闭声明时statement出错"+e);}
}
PublicData.rebuildFlowVector();
PublicData.rebuildRightVector();
boolean sfgl = false,sflr = false;
int id = 0;
sql = "select id from zz_fbxwb where zgbh='" + personno + "' and bmbh='"+dutyOrgno+"' and lb='2' and sfgl='1'";
rs = selectRecord(sql);
try{
if(rs.next()){
sfgl = true;
sflr = true;
id = rs.getInt(1);
}
else{
sql = "select id from zz_fbxwb where zgbh='" + personno + "' and bmbh='"+dutyOrgno+"' and lb='2' and sfgl<>'1'";
stmt = rs.getStatement(); rs.close(); if(stmt!=null) stmt.close();
rs = selectRecord(sql);
if(rs.next()){
sflr = true;
id = rs.getInt(1);
}
}
if(dutyOrgno.equals("00000000000000000000")||!dutyOrgno.substring(4).equals("0000000000000000"))
return;
rb = new RightBean();
rb.setUID(personno);
rb.setOrgid(dutyOrgno);
boolean _sflr = rb.isRightModelbh("信息管理","信息发布"),
_sfgl = rb.isRightModelbh("信息管理","信息维护")||rb.isRightModelbh("信息管理","类别维护");
/* try{
String bmbh = dutyOrgno;
while(!bmbh.equals("00000000000000000000")){
rs = selectRecord("select bmfbh from zz_bmb where bmbh='"+bmbh+"'");
if(rs.next()){
dutyOrgno = bmbh;
bmbh = rs.getString("BMFBH");
}
rs.close(); Statement stmt = rs.getStatement(); if(stmt!=null) stmt.close();
}
}catch(SQLException e){System.out.println("异常:"+e);}*/
if(sfgl&&!_sfgl){//原先有管理权限,此时去掉他的管理权限
if(_sflr){//原先有管理权限,此时去掉他的管理权限,保留他的录入权限
Hashtable hash = new Hashtable();
hash.put("ZGBH",personno);
hash.put("LB","2");
hash.put("BMBH",dutyOrgno);
hash.put("SFGL","0");
news = new MakeNews();
news.setID(id);
news.modNews(hash);
}
else if(!_sflr){//原先有管理权限,此时去掉他的录入权限和管理权限,删除记录
news = new MakeNews();
news.setID(id);
news.delNews();
}
}
else if(sflr&&!sfgl){//原先有录入权限但没有管理权限
if(!_sflr){//原先有录入权限但没有管理权限,此时去掉他的录入权限,删除记录
news = new MakeNews();
news.setID(id);
news.delNews();
}
}
}catch(Exception e){System.out.println("PersonDutyBean::delRec()运行时出错:"+e);}
finally{
if(rb!=null)rb.closeConn();
if(news!=null)news.closeConn();
if(rs!=null)try{ stmt = rs.getStatement(); rs.close();}catch(Exception e){System.out.println("PersonDutyBean::delRec()关闭记录集rs时出错"+e);}
if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("PersonDutyBean::delRec()关闭声明时statement出错"+e);}
}
}
//修改职务表ZZ_ZWB的职务状态i:0:增加记录时设为正常;1:删除记录时可能为挂起可能为正常
public void modZZ_ZWB(String dutyOrgno,String dutyno,String personno,int i)
{
String sql="";
if(i==0)
{
sql="update ZZ_ZWB set ZWZT=0 where BMBH='"+dutyOrgno+"' and ZWBH='"+dutyno+"'";
db.ExecuteSQL(sql);
}
if(i==1)
{
sql="select ZGBH from ZZ_ZGZWB where BMBH='"+dutyOrgno+"' and ZWBH='"+dutyno+"' and ZGBH<>'"+personno+"'";
ResultSet rs=db.QuerySQL(sql);
Statement stmt = null;
try{
if(!rs.next())//没有别的职工任此职务
{
sql="update ZZ_ZWB set ZWZT=1 where BMBH='"+dutyOrgno+"' and ZWBH='"+dutyno+"'";
db.ExecuteSQL(sql);
}
}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);}
}
}
}
//修改职工表ZZ_ZGB的在职状态i:0:增加记录时设为正常;1:删除记录时可能为离职可能为正常
public void modZZ_ZGB(String personno,String dutyno,int i)
{
String sql="";
if(i==0)
{
sql="update ZZ_ZGB set ZZZT=0 where ZGBH='"+personno+"'";
db.ExecuteSQL(sql);
}
if(i==1)
{
sql="select ZWBH from ZZ_ZGZWB where ZGBH='"+personno+"' and ZWBH<>'"+dutyno+"'";
ResultSet rs=db.QuerySQL(sql);
Statement stmt = null;
try{
if(!rs.next())
{
sql="update ZZ_ZGB set ZZZT=1 where ZGBH='"+personno+"'";
db.ExecuteSQL(sql);
}
}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);}
}
}
}
//通过部门编号、职务编号得到ZZ_ZWB的职务操作权限,职务流程权限,职务配置参数
public Vector getPowerLimit(String dutyOrgno,String dutyno)
{
Vector vect=new Vector();
String sql="";
sql="select * from ZZ_ZWB where BMBH='"+dutyOrgno+"' and ZWBH='"+dutyno+"'";
ResultSet rs=selectRecord(sql);
Statement stmt = null;
try{
if (rs.next())
{
vect.add(ds.toString(rs.getString("CZQX")));
vect.add(ds.toString(rs.getString("LCQX")));
vect.add(ds.toString(rs.getString("PZCS")));
}
}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);}
}
return vect;
}
//通过职工编号修改ZZ_ZGB的操作权限,流程权限,配置参数i:0:增加职务时;1:删除职务时
public void setPowerLimit(String personno,Vector vect,int i)
{
String czqx="";
String lcqx="";
String pzcs="";
String czqx_t=(String)vect.get(0);
String lcqx_t=(String)vect.get(1);
String pzcs_t=(String)vect.get(2);
String sql="select CZQX,LCQX,PZCS from ZZ_ZGB where ZGBH='"+personno+"'";
ResultSet rs=db.QuerySQL(sql);
Statement stmt = null;
try{
if (rs.next())
{
czqx=ds.toString(rs.getString("CZQX"));
lcqx=ds.toString(rs.getString("LCQX"));
pzcs=ds.toString(rs.getString("PZCS"));
if (i==0)
{
czqx=czqx+","+czqx_t;
lcqx=lcqx+","+lcqx_t;
pzcs=pzcs+","+pzcs_t;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -