package com.amarsoft.app.base.util; import java.util.List; import jbo.prd.BUSINESS_TYPE; import jbo.sys.ORG_INFO; import jbo.sys.USER_INFO; import com.amarsoft.are.jbo.BizObject; import com.amarsoft.are.jbo.BizObjectManager; import com.amarsoft.are.jbo.JBOFactory; import com.amarsoft.are.util.StringFunction; import com.amarsoft.dict.als.manage.NameManager; /** * Ãû³Æ×ª»¯ * @author Administrator * */ public class NameConvert { public static String getOrgNames(String orgs){ if(orgs==null||orgs.equals("")) return ""; String orgName=""; try{ BizObjectManager bm=JBOFactory.getBizObjectManager(ORG_INFO.CLASS_NAME); if(orgs.endsWith(",")) orgs=orgs.substring(0, orgs.length()-1); orgs=StringFunction.replace(orgs, ",", "','"); List lst=bm.createQuery("orgId in ('"+orgs+"')").getResultList(false); for(BizObject bo:lst){ orgName+=bo.getAttribute("OrgName").getString()+","; } }catch(Exception e){ e.printStackTrace(); } return orgName; } public static String getUserNames(String userid){ if(userid==null||userid.equals("")) return ""; String UserName=""; try{ BizObjectManager bm=JBOFactory.getBizObjectManager(USER_INFO.CLASS_NAME); if(userid.endsWith(",")) userid=userid.substring(0, userid.length()-1); userid=StringFunction.replace(userid, ",", "','"); List lst=bm.createQuery("USERID in ('"+userid+"')").getResultList(false); for(BizObject bo:lst){ UserName+=bo.getAttribute("USERNAME").getString()+","; } }catch(Exception e){ e.printStackTrace(); } return UserName; } public static String getBusinessNames(String typeNos){ if(typeNos==null||typeNos.equals("")) return ""; String typeName=""; try{ BizObjectManager bm=JBOFactory.getBizObjectManager(BUSINESS_TYPE.CLASS_NAME); if(typeNos.endsWith(",")) typeNos=typeNos.substring(0, typeNos.length()-1); typeNos=StringFunction.replace(typeNos, ",", "','"); List lst=bm.createQuery("TypeNo in ('"+typeNos+"')").getResultList(false); for(BizObject bo:lst){ typeName+=bo.getAttribute("TypeName").getString()+","; } }catch(Exception e){ e.printStackTrace(); } return typeName; } public static String getItemNames(String codeNo,String itemNos) throws Exception{ if(itemNos==null || itemNos.equals("")) return ""; String[] itemnoarray=itemNos.split(","); String itemName=""; for(String itemNo:itemnoarray){ itemName=NameManager.getItemName(codeNo, itemNo)+","+itemName; } return itemName; } }