📄 persondutybean.java
字号:
Statement stmt = null;
try{
while(rs.next())
dutyname = ds.toString(rs.getString("ZWMC"));
}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 dutyname;
}
//检查ZZ_ZGZWB中是否已经由此条记录
public boolean hasRect(String personno,String dutyOrgno,String dutyno)
{
boolean b = false;
String sql="select * from ZZ_ZGZWB where ZGBH='"+personno+"' and BMBH='"+dutyOrgno+"' and ZWBH='"+dutyno+"'";
ResultSet rs=db.QuerySQL(sql);
Statement stmt = null;
try{
if(rs.next()){
b = true;
}
}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 b;
}
//判断ZZ_ZGB中是否有输入的部门名称、职工编号、职工姓名的对应纪录
public int hasPerson(String orgName,String personno,String personname)
{
String sql="select * from ZZ_ZGB where BMBH='"+orgName+"' and ZGBH='"+personno+"' and XM='"+personname+"'";
ResultSet rs=db.QuerySQL(sql);
Statement stmt = null;
try{
if(rs.next())
return 0;
}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 1;
}
//判断ZZ_ZWB是否有输入的部门名称、职务名称的对应纪录
public int hasOrgDuty(String orgName,String dutyName)
{
String sql="select * from ZZ_ZWB where BMMC='"+orgName+"' and ZWMC='"+dutyName+"'";
ResultSet rs=selectRecord(sql);
Statement stmt = null;
try{
if(rs.next())
return 0;
}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 1;
}
public void addRec(String personno,String dutyOrgno,String dutyno,String czqx,String lcqx,boolean rebuild)
{
ResultSet rs = selectRecord(" select * from zz_zgzwb where zgbh='"+personno+"' and bmbh='"+dutyOrgno+"' and zwbh="+dutyno+" ");
//System.out.println("Enter Bean!!!!!!! "+rs);
Statement stmt = null;
RightBean rb = null;
MakeNews news = null;
try{
if(!rs.next())
{
Vector vect=new Vector();
vect.add("ZZ_ZGZWB");
vect.add(addVector("ZGBH",personno,"CHAR"));
vect.add(addVector("BMBH",dutyOrgno,"CHAR"));
vect.add(addVector("ZWBH",dutyno,"CHAR"));
vect.add(addVector("CZQX",czqx,"CHAR"));
vect.add(addVector("LCQX",lcqx,"CHAR"));
insertRecord(vect);
if(!rebuild)
return;
PublicData.rebuildFlowVector();
PublicData.rebuildRightVector();
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的职务操作权限,职务流程权限,职务配置参数
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -