📄 persondutybean.java
字号:
sql="update ZZ_ZGB set CZQX='"+czqx+"',LCQX='"+lcqx+"',PZCS='"+pzcs+"'";
db.ExecuteSQL(sql);
}
if (i==1)
{//检索czqx_t在czqx中的位置 //仍需调试indexOf的用法
int index1=czqx.indexOf(czqx_t,0);
String str1=czqx.substring(0,index1);
str1=str1.concat(czqx.substring(index1+czqx_t.length()));
int index2=lcqx.indexOf(lcqx_t,0);
String str2=lcqx.substring(0,index2);
str2=str2.concat(lcqx.substring(index2+lcqx_t.length()));
int index3=pzcs.indexOf(pzcs_t,0);
String str3=pzcs.substring(0,index3);
str3=str3.concat(pzcs.substring(index3+pzcs_t.length()));
sql="update ZZ_ZGB set CZQX='"+str1+"',LCQX='"+str2+"',PZCS='"+str3+"'";
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);}
}
}
public Vector getDutyRight(String PersonNo,String DutyOrgNo,String DutyNo)
{
Vector vect=new Vector();
ResultSet rs=selectRecord("select * from zz_zgzwb where zgbh='"
+ PersonNo + "' and bmbh='" + DutyOrgNo + "' and zwbh='" + DutyNo + "'"
);
Statement stmt = null;
try{
if(rs.next()){
vect.add(rs.getString("CZQX"));
vect.add(rs.getString("LCQX"));
}
}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;
}
public void modRec(String personno,String dutyOrgno,String dutyno,String czqx,String lcqx)//修改一条职工职务纪录
{
Vector vect=new Vector();
vect.add("ZZ_ZGZWB");
vect.add(addVector("CZQX",czqx,"CHAR"));
vect.add(addVector("LCQX",lcqx,"CHAR"));
vect.add(" ZGBH='"+personno+"' and BMBH = '"+dutyOrgno+"' and ZWBH='"+dutyno+"'");
updateRecord(vect);
PublicData.rebuildFlowVector();
PublicData.rebuildRightVector();
boolean sfgl = false,sflr = false;
int id = 0;
String sql = "select id from zz_fbxwb where zgbh='" + personno + "' and bmbh='"+dutyOrgno+"' and lb='2' and sfgl='1'";
ResultSet rs = selectRecord(sql);
Statement stmt = null;
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);
}
}
}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(dutyOrgno.equals("00000000000000000000")||!dutyOrgno.substring(4).equals("0000000000000000"))
return;
RightBean rb = null;
MakeNews news = null;
boolean _sflr=false,_sfgl=false;
try{
rb =new RightBean();
rb.setUID(personno);
rb.setOrgid(dutyOrgno);
_sflr = rb.isRightModelbh("信息管理","信息发布");
_sfgl = rb.isRightModelbh("信息管理","信息维护")||rb.isRightModelbh("信息管理","类别维护");
/* 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();
}
*/ 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();
}
}
//返回父部门的名称串
public String getFatherName(String bmno)
{
String signsql = "select XMMC from code_zdb where ZDMC='部门显示分隔符'";
ResultSet rs = selectRecord(signsql);
String sign = "-";
Statement stmt = null;
String sql = "";
String father = "";
String fatherName = "";
Statement stm = null;
try{
if (rs.next())
sign = ds.toString(rs.getString("XMMC"));
}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);}
}
int i = 0;
while(i<5)
{
sql = "select BMFBH from ZZ_BMB where BMBH='" + bmno + "'";
rs = selectRecord(sql);
try{
if (rs.next())
{
father = ds.toString(rs.getString("BMFBH"));
bmno = father;
if(father.equals("") || father.equals("00000000000000000000")){break;}
if(fatherName.equals(""))
{
fatherName = getApartName(father) + sign;
}
else
fatherName = getApartName(father) + sign + fatherName;
}
else{break;}
}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);}
}
i++;
}
return fatherName;
}
public String getApartName(String bmno)//取得某部门的部门名称
{
String sql = "";
String name = "";
sql = " select BMMC from ZZ_BMB where BMBH = '"+bmno+"'";
ResultSet rs = selectRecord(sql);
Statement stmt = null;
try{
if(rs.next())
name = ds.toString(rs.getString("BMMC"));
}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 name;
}
public String getName(String bmbh)
{
return getFatherName(bmbh)+getApartName(bmbh);
}
public Vector srchPersons(String bmbh,String zwbh)//取得当前职务的使用人:bmmc\xm
{
Vector vect = new Vector();
String zgbh = "";
String personName = "";
String sql = " select distinct a.ZGBH,b.XM from ZZ_ZGZWB a,ZZ_ZGB b where a.ZGBH=b.ZGBH a.BMBH="+ ds.toString(bmbh) +" and a.ZWBH="+ ds.toString(zwbh);
ResultSet rs = selectRecord(sql);
Statement stmt = null;
PersonBean psbean = null;
try{
psbean = new PersonBean();
while(rs.next())
{
zgbh = ds.toString(rs.getString(1));
personName = ds.toString(rs.getString(2));
psbean.setPersonNO(zgbh);
String perbmbh = psbean.getBMBH();
String perbmmc = psbean.getFatherName(perbmbh);//strOrgNO
perbmmc += psbean.getOrgName(perbmbh);
personName = perbmmc +":"+ personName;
vect.add(personName);
}
}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(psbean!=null) psbean.closeConn();
}
return vect;
}
public String srchPersons1(String bmbh,String zwbh)//取得当前职务的使用人:bmmc\xm
{
String persons = "";
String zgbh = "";
String personName = "";
String sql = " select distinct ZZ_ZGZWB.ZGBH,XM from ZZ_ZGZWB,ZZ_ZGB where ZZ_ZGZWB.ZGBH=ZZ_ZGB.ZGBH and ZZ_ZGZWB.BMBH="+ ds.toString(bmbh) +" and ZZ_ZGZWB.ZWBH="+ ds.toString(zwbh);
ResultSet rs = selectRecord(sql);
PersonBean psbean = null;
Statement stmt = null;
try{
psbean = new PersonBean();
while(rs.next())
{
zgbh = ds.toString(rs.getString(1));
personName = ds.toString(rs.getString(2));
psbean.setPersonNO(zgbh);
String perbmbh = psbean.getBMBH();
String perbmmc = psbean.getFatherName(perbmbh);//strOrgNO
perbmmc += psbean.getOrgName(perbmbh);
personName = perbmmc +":"+ personName;
persons = persons + personName + "\n";
}
}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(psbean!=null)psbean.closeConn();
}
return persons;
}
public static void main(String args[])
{
PersonDutyBean mb = new PersonDutyBean();
System.out.println("begin\r\n\r\n");
System.out.println("Please input string to be translated");
Vector vt = new Vector();
//vt = mb.getData("14");
System.out.print(mb.getBMMC_ZWMC("9"));
//System.out.print("vt-----"+vt);
System.out.println("\rend ");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -