?? 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 + -