614 lines
20 KiB
Java
614 lines
20 KiB
Java
package com.amarsoft.app.base.util;
|
|
|
|
import java.io.BufferedReader;
|
|
import java.io.File;
|
|
import java.io.FileInputStream;
|
|
import java.io.InputStreamReader;
|
|
import java.util.List;
|
|
|
|
import jbo.awe.AWE_ROLE_INFO;
|
|
import jbo.sys.FLOW_CATALOG;
|
|
import jbo.sys.ORG_INFO;
|
|
//import jbo.sys.SADRE_DIMENSION;
|
|
import jbo.sys.USER_INFO;
|
|
|
|
import com.amarsoft.app.base.businessobject.BusinessObject;
|
|
import com.amarsoft.app.base.config.impl.BusinessComponentConfig;
|
|
import com.amarsoft.app.base.config.impl.SystemDBConfig;
|
|
import com.amarsoft.app.base.util.DateHelper;
|
|
import com.amarsoft.app.als.prd.config.loader.ProductConfig;
|
|
import com.amarsoft.are.jbo.BizObject;
|
|
import com.amarsoft.are.jbo.BizObjectManager;
|
|
import com.amarsoft.are.jbo.BizObjectQuery;
|
|
import com.amarsoft.are.jbo.JBOException;
|
|
import com.amarsoft.are.jbo.JBOFactory;
|
|
import com.amarsoft.are.lang.StringX;
|
|
import com.amarsoft.awe.Configure;
|
|
import com.amarsoft.dict.als.cache.CodeCache;
|
|
import com.amarsoft.dict.als.object.Item;
|
|
|
|
/**
|
|
* 名称转化
|
|
* @author qzhang1
|
|
*
|
|
*/
|
|
public class SYSNameManager{
|
|
|
|
//只能查询方案产品,基础产品返回空串
|
|
public static String getProductName(String productID) throws Exception{
|
|
if(StringX.isEmpty(productID)) return "";
|
|
BusinessObject prd = ProductConfig.getProduct(productID);
|
|
if(prd == null || "01".equals(prd.getString("Attribute1"))) return "";
|
|
return prd.getString("TypeName") ;
|
|
}
|
|
|
|
public static String getOrgNames(String orgIDs) throws Exception{
|
|
if(orgIDs == null || "".equals(orgIDs)) return "";
|
|
StringBuffer name = new StringBuffer();
|
|
String[] orgList = orgIDs.split(",");
|
|
for(int i = 0; i < orgList.length ; i ++)
|
|
{ if(i < orgList.length-1)
|
|
name.append(SystemDBConfig.getOrg(orgList[i]).getString("OrgName")+",");
|
|
else
|
|
name.append(SystemDBConfig.getOrg(orgList[i]).getString("OrgName"));
|
|
}
|
|
return name.toString();
|
|
}
|
|
|
|
public static String getTermName(String termID) throws Exception{
|
|
if(termID==null||termID.equals("")) return "";
|
|
|
|
String TermName = "";
|
|
try{
|
|
|
|
BusinessObject bo = BusinessComponentConfig.getComponent(termID);
|
|
if(bo==null)
|
|
TermName="";
|
|
else
|
|
TermName=bo.getAttribute("Name").getString();
|
|
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}
|
|
return TermName;
|
|
}
|
|
|
|
|
|
public static String getChangeFlag(String documentType,String documentNo,String parentTransSerialNo) throws Exception
|
|
{
|
|
String changeFlag = "原记录";
|
|
BizObjectManager bm=JBOFactory.getBizObjectManager("jbo.acct.ACCT_TRANSACTION");
|
|
//BizObjectQuery boq = bm.createQuery("DocumenType=:DocumentType and DocumentNo=:DocumentNo and ParentTransSerialNo= :ParentTransSerialNo");
|
|
BizObjectQuery boq = bm.createQuery("DocumentType=:DocumentType and DocumentNo=:DocumentNo");
|
|
boq.setParameter("DocumentType", documentType);
|
|
boq.setParameter("DocumentNo", documentNo);
|
|
//boq.setParameter("ParentTransSerialNo", parentTransSerialNo);
|
|
BizObject bo = boq.getSingleResult(false);
|
|
if(bo!=null)
|
|
{
|
|
changeFlag = bo.getAttribute("TransactionName").getString();
|
|
}
|
|
if("jbo.guaranty.GUARANTY_CONTRACT".equals(documentType)){
|
|
BizObjectManager bom=JBOFactory.getBizObjectManager("jbo.guaranty.GUARANTY_CONTRACT_CHANGE");
|
|
BizObjectQuery bq1 = bom.createQuery("GCSerialNo=:GCSerialNo ");
|
|
bq1.setParameter("GCSerialNo", documentNo);
|
|
BizObject bo1 = bq1.getSingleResult(false);
|
|
if(bo1 != null) {
|
|
BizObjectQuery bq2 = bm.createQuery("DocumentType=:DocumentType and DocumentNo=:DocumentNo");
|
|
bq2.setParameter("DocumentType", "jbo.guaranty.GUARANTY_CONTRACT_CHANGE");
|
|
bq2.setParameter("DocumentNo", bo1.getAttribute("SerialNo").toString());
|
|
BizObject bo2 = bq2.getSingleResult(false);
|
|
if(bo2 != null)
|
|
changeFlag = bo2.getAttribute("TransactionName").getString();
|
|
}
|
|
}
|
|
return changeFlag;
|
|
}
|
|
//查询是否合作方
|
|
public static String getIsPartner(String CertType,String CertID,String CustomerID) throws Exception
|
|
{
|
|
String changeFlag = "否";
|
|
BizObjectManager bm=JBOFactory.getBizObjectManager("jbo.customer.CUSTOMER_LIST");
|
|
BizObjectQuery boq = bm.createQuery("CertType=:CertType and CertID=:CertID and CustomerID=:CustomerID");
|
|
boq.setParameter("CertType", CertType);
|
|
boq.setParameter("CertID", CertID);
|
|
boq.setParameter("CustomerID", CustomerID);
|
|
BizObject bo = boq.getSingleResult(false);
|
|
if(bo!=null)
|
|
{
|
|
changeFlag = "是";
|
|
}
|
|
return changeFlag;
|
|
}
|
|
//截取行业类型,并拼出行业大类码值
|
|
public static String IndustryMain(String Industry) throws Exception
|
|
{
|
|
String IndustryFirst = substring(Industry, "0", "1");
|
|
if("".equals(IndustryFirst)){
|
|
return "";
|
|
}else{
|
|
return IndustryFirst ;
|
|
}
|
|
}
|
|
|
|
//十级分类转换为五级分类
|
|
public static String[] getFiveClassify(String classifyResult) throws Exception{
|
|
if (classifyResult.equals("01") ||classifyResult.equals("02") ||classifyResult.equals("03")||classifyResult.equals("04")||classifyResult.equals("05")){
|
|
return new String[]{"01","正常"};
|
|
}else if (classifyResult.equals("06") ||classifyResult.equals("07")){
|
|
return new String[]{"02","关注"};
|
|
}else if (classifyResult.equals("08")){
|
|
return new String[]{"03","次级"};
|
|
}else if (classifyResult.equals("09")){
|
|
return new String[]{"04","可疑"};
|
|
}else
|
|
return new String[]{"05","损失"};
|
|
}
|
|
|
|
//字符串截取
|
|
public static String substring(String str,String beginIndex, String endIndex)
|
|
{
|
|
if(str == null || "".equals(str)) return "";
|
|
//modified by jqliang 2015-03-09 防止字符串越界
|
|
if(str.length()<=Integer.parseInt(beginIndex)) return "";
|
|
if(str.length()>Integer.parseInt(beginIndex) && str.length()<Integer.parseInt(endIndex)){
|
|
return str.substring(Integer.parseInt(beginIndex),str.length());
|
|
}
|
|
return str.substring(Integer.parseInt(beginIndex), Integer.parseInt(endIndex));
|
|
}
|
|
|
|
|
|
|
|
//取得合同中方案产品编号
|
|
public static String getProductID(String ObjectNo) throws Exception
|
|
{
|
|
BizObjectManager bm=JBOFactory.getBizObjectManager("jbo.app.BUSINESS_CONTRACT");
|
|
BizObjectQuery boq = bm.createQuery("SerialNo=:SerialNo");
|
|
boq.setParameter("SerialNo", ObjectNo);
|
|
BizObject bo = boq.getSingleResult(false);
|
|
String productID="";
|
|
if(bo!=null)
|
|
{
|
|
productID = bo.getAttribute("ProductID").getString();
|
|
if(productID == null)
|
|
{
|
|
productID = bo.getAttribute("BusinessType").getString();
|
|
}
|
|
}
|
|
return productID;
|
|
}
|
|
|
|
//取得合同中方案产品编号
|
|
public static String getProductNames(String ObjectNo) throws Exception
|
|
{
|
|
BizObjectManager bm=JBOFactory.getBizObjectManager("jbo.app.BUSINESS_CONTRACT");
|
|
BizObjectQuery boq = bm.createQuery("SerialNo=:SerialNo");
|
|
boq.setParameter("SerialNo", ObjectNo);
|
|
BizObject bo = boq.getSingleResult(false);
|
|
String productID="";
|
|
if(bo!=null)
|
|
{
|
|
productID = bo.getAttribute("ProductID").getString();
|
|
if(productID == null)
|
|
{
|
|
productID = bo.getAttribute("BusinessType").getString();
|
|
}
|
|
}
|
|
return getProductName(productID);
|
|
}
|
|
/**
|
|
* 合作项目显示产品列表的名称
|
|
* */
|
|
public static String getProductListNames(String productList) throws Exception
|
|
{
|
|
String productListNames = "";
|
|
String[] products = productList.split(",");
|
|
for(int i=0;i<products.length;i++){
|
|
productListNames = productListNames+getProductName(products[i])+",";
|
|
}
|
|
return productListNames.substring(0, productListNames.length()-1);
|
|
}
|
|
|
|
//根据资料编号获取资料名称
|
|
public static String getFileName(String FileID) throws Exception
|
|
{
|
|
BizObjectManager bm=JBOFactory.getBizObjectManager("jbo.doc.DOC_FILE_CONFIG");
|
|
BizObjectQuery boq = bm.createQuery("FileID=:FileID and FileFormat = '03' and Status = '1' and ImageFileID is not null");
|
|
boq.setParameter("FileID", FileID);
|
|
BizObject bo = boq.getSingleResult(false);
|
|
String FileName="";
|
|
if(bo!=null)
|
|
{
|
|
FileName = bo.getAttribute("FileName").getString();
|
|
}
|
|
return FileName;
|
|
}
|
|
|
|
|
|
//获取档案业务资料客户名称
|
|
public static String getDocCustomerName(String objectType,String objectNo) throws Exception
|
|
{
|
|
if("jbo.app.BUSINESS_CONTRACT".equalsIgnoreCase(objectType))
|
|
{
|
|
BizObjectManager bm=JBOFactory.getBizObjectManager("jbo.app.BUSINESS_CONTRACT");
|
|
BizObjectQuery boq = bm.createQuery("SerialNo=:SerialNo");
|
|
boq.setParameter("SerialNo", objectNo);
|
|
BizObject bo = boq.getSingleResult(false);
|
|
if(bo!=null)
|
|
{
|
|
return bo.getAttribute("CustomerName").getString();
|
|
}
|
|
return "";
|
|
}
|
|
else if("jbo.prj.PRJ_BASIC_INFO".equalsIgnoreCase(objectType))
|
|
{
|
|
BizObjectManager bm=JBOFactory.getBizObjectManager("jbo.customer.CUSTOMER_INFO");
|
|
BizObjectQuery boq = bm.createQuery("CustomerID in (select PBI.CustomerID from jbo.prj.PRJ_BASIC_INFO PBI where PBI.SerialNo=:SerialNo)");
|
|
boq.setParameter("SerialNo", objectNo);
|
|
BizObject bo = boq.getSingleResult(false);
|
|
if(bo!=null)
|
|
{
|
|
return bo.getAttribute("CustomerName").getString();
|
|
}
|
|
return "";
|
|
}
|
|
return "";
|
|
}
|
|
|
|
|
|
//获取档案业务资料客户名称
|
|
public static String getDocOrgName(String objectType,String objectNo) throws Exception
|
|
{
|
|
if("jbo.app.BUSINESS_CONTRACT".equalsIgnoreCase(objectType))
|
|
{
|
|
BizObjectManager bm=JBOFactory.getBizObjectManager(objectType);
|
|
BizObjectQuery boq = bm.createQuery("SerialNo=:SerialNo");
|
|
boq.setParameter("SerialNo", objectNo);
|
|
BizObject bo = boq.getSingleResult(false);
|
|
if(bo!=null)
|
|
{
|
|
BusinessObject org = SystemDBConfig.getOrg(bo.getAttribute("EXECUTIVEORGID").getString());
|
|
if(org != null)
|
|
{
|
|
return org.getString("OrgName");
|
|
}
|
|
}
|
|
return "";
|
|
}
|
|
else if("jbo.prj.PRJ_BASIC_INFO".equalsIgnoreCase(objectType))
|
|
{
|
|
BizObjectManager bm=JBOFactory.getBizObjectManager(objectType);
|
|
BizObjectQuery boq = bm.createQuery("SerialNo=:SerialNo");
|
|
boq.setParameter("SerialNo", objectNo);
|
|
BizObject bo = boq.getSingleResult(false);
|
|
if(bo!=null)
|
|
{
|
|
if(bo.getAttribute("INPUTORGID") == null || "".equals(bo.getAttribute("INPUTORGID"))) return "";
|
|
BusinessObject org = SystemDBConfig.getOrg(bo.getAttribute("INPUTORGID").getString());
|
|
if(org != null)
|
|
{
|
|
return org.getString("OrgName");
|
|
}
|
|
}
|
|
return "";
|
|
}
|
|
return "";
|
|
}
|
|
//签署意见时间
|
|
public static String ApproveTime(String inputDate,String inputTime){
|
|
return String.valueOf(inputDate+" "+inputTime);
|
|
}
|
|
//月到年月转换(额度的用到期日减今天算)
|
|
public static String Month2YearMonth(String month,String day,String MaturityDate) throws Exception{
|
|
if(month == null || "".equals(month) || "null".equals(month) || "0.0".equals(month)) month = "0";//加上对0.0的判断
|
|
if(day == null || "".equals(day) || "0.0".equals(day)) day = "0";
|
|
if("0".equals(day) && "0".equals(month)){
|
|
if(MaturityDate == null || "".equals(MaturityDate)){
|
|
return "0年0月0天";
|
|
}else{
|
|
int months = (int) Math.floor(DateHelper.getMonths(DateHelper.getBusinessDate(),MaturityDate));
|
|
int days = DateHelper.getDays(DateHelper.getRelativeDate(DateHelper.getBusinessDate(), DateHelper.TERM_UNIT_MONTH, months), MaturityDate);
|
|
return months/12+"年"+months%12+"月"+days+"天";
|
|
}
|
|
}
|
|
return String.valueOf(((int)Double.parseDouble(month))/12+"年"+((int)Double.parseDouble(month))%12+"月"+((int)Double.parseDouble(day))+"天");
|
|
}
|
|
//月到年月转换
|
|
public static String Month2YearMonth(String month,String day) throws Exception{
|
|
return Month2YearMonth(month, day, "");
|
|
}
|
|
//月到年转换
|
|
public static String Month2Year(String month)
|
|
{
|
|
if(month == null || "".equals(month) || "null".equals(month)) return "0";
|
|
return String.valueOf(((int)Double.parseDouble(month))/12);
|
|
}
|
|
|
|
//月转换到年剩余
|
|
public static String Month2YearMod(String month)
|
|
{
|
|
if(month == null || "".equals(month) || "null".equals(month)) return "0";
|
|
return String.valueOf(((int)Double.parseDouble(month))%12);
|
|
}
|
|
|
|
//获取档案业务资料业务品种
|
|
public static String getBusinessType(String objectType,String objectNo) throws Exception
|
|
{
|
|
if("jbo.app.BUSINESS_CONTRACT".equalsIgnoreCase(objectType))
|
|
{
|
|
BizObjectManager bm=JBOFactory.getBizObjectManager("jbo.prd.BUSINESS_TYPE");
|
|
BizObjectQuery boq = bm.createQuery("O.TypeNo in(SELECT BC.BusinessType FROM jbo.app.BUSINESS_CONTRACT BC WHERE BC.SerialNo=:SerialNo)");
|
|
boq.setParameter("SerialNo", objectNo);
|
|
BizObject bo = boq.getSingleResult(false);
|
|
if(bo!=null)
|
|
{
|
|
return bo.getAttribute("TypeName").getString();
|
|
}
|
|
return "";
|
|
}
|
|
else if("jbo.prj.PRJ_BASIC_INFO".equalsIgnoreCase(objectType))
|
|
{
|
|
BizObjectManager bm=JBOFactory.getBizObjectManager("jbo.prj.PRJ_BASIC_INFO");
|
|
BizObjectQuery boq = bm.createQuery("SerialNo=:SerialNo");
|
|
boq.setParameter("SerialNo", objectNo);
|
|
BizObject bo = boq.getSingleResult(false);
|
|
if(bo!=null)
|
|
{
|
|
return bo.getAttribute("ProjectName").getString();
|
|
}
|
|
return "";
|
|
}
|
|
return "";
|
|
}
|
|
|
|
|
|
/**
|
|
* 对已经审批通过的业务,计算其申请状态
|
|
* @param applySerialNo
|
|
* @param approveStatus
|
|
* @return
|
|
* @throws Exception
|
|
*/
|
|
public static String getApplyPassStatusName(String applySerialNo,String approveStatus) throws Exception{
|
|
|
|
if("03".equals(approveStatus))
|
|
{
|
|
BizObjectManager bpm=JBOFactory.getBizObjectManager("jbo.app.BUSINESS_PUTOUT");
|
|
BizObjectQuery bpq = bpm.createQuery("select O.PutOutStatus from O where O.ApplySerialNo=:ApplySerialNo");
|
|
bpq.setParameter("ApplySerialNo", applySerialNo);
|
|
BizObject bp = bpq.getSingleResult(false);
|
|
if(bp!=null)
|
|
{
|
|
String putoutStatus = bp.getAttribute("PutOutStatus").getString();
|
|
if("02".equals(putoutStatus)) return "放款审核通过";
|
|
else if("03".equals(putoutStatus)) return "放款监督通过 ";
|
|
else if("05".equals(putoutStatus)) return "已入账";
|
|
else return "审批通过";
|
|
}
|
|
else
|
|
{
|
|
BizObjectManager bcm=JBOFactory.getBizObjectManager("jbo.app.BUSINESS_CONTRACT");
|
|
BizObjectQuery bcq = bcm.createQuery("select O.ContractStatus from O where O.ApplySerialNo=:ApplySerialNo");
|
|
bcq.setParameter("ApplySerialNo", applySerialNo);
|
|
BizObject bc = bcq.getSingleResult(false);
|
|
if(bc!=null)
|
|
{
|
|
String contractStatus = bc.getAttribute("ContractStatus").getString();
|
|
if("01".equals(contractStatus)) return "审批通过 ";
|
|
else if("02".equals(contractStatus)) return "放款监督通过 ";
|
|
else return "已入账";
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Item item = CodeCache.getItem("BusinessApproveStatus", approveStatus);
|
|
if(item != null)
|
|
{
|
|
return item.getItemName();
|
|
}
|
|
}
|
|
|
|
return "审批通过";
|
|
}
|
|
//当老数据中意见说明是文件路径时,把文件内容读出来
|
|
public static String getPhaseOpinionEdit(String PhaseOpinion) throws Exception
|
|
{
|
|
StringBuffer sb = new StringBuffer();
|
|
if(PhaseOpinion.indexOf("$@") > -1){
|
|
String aa = Configure.getInstance().getConfigure("FileSavePath");
|
|
String ss = aa + PhaseOpinion.substring(2);
|
|
File dFile = null;
|
|
dFile = new File(ss);
|
|
if((dFile.exists())){
|
|
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(ss)));
|
|
String sLine;
|
|
while((sLine = reader.readLine())!= null){
|
|
sb.append(sLine);
|
|
}
|
|
reader.close();
|
|
}else{
|
|
return "文件不存在!";
|
|
}
|
|
return sb.toString();
|
|
}
|
|
return PhaseOpinion;
|
|
}
|
|
public static String getLoanTypeAndName(String LoanType) throws Exception{
|
|
return LoanType+"-"+CodeCache.getItemName("BusinessType_Core", LoanType);
|
|
}
|
|
public static String getGuaranTorName(String AISerialNo) throws Exception{
|
|
BizObjectManager gc=JBOFactory.getBizObjectManager("jbo.guaranty.GUARANTY_CONTRACT");
|
|
BizObjectQuery gcq = gc.createQuery("select O.GuaranTorName from O where O.SerialNo=(select max(GR.GCSerialNo) from jbo.guaranty.GUARANTY_RELATIVE GR where GR.AssetSerialNo = :AssetSerialNo)");
|
|
gcq.setParameter("AssetSerialNo", AISerialNo);
|
|
String GuarantorName = "";
|
|
BizObject bp = gcq.getSingleResult(false);
|
|
if(bp!=null)
|
|
{
|
|
GuarantorName = bp.getAttribute("GuaranTorName").getString();
|
|
}
|
|
return GuarantorName;
|
|
}
|
|
|
|
|
|
public static String getFloorMonth(String beginDate,String endDate) throws Exception{
|
|
return String.valueOf((int)Math.floor(DateHelper.getMonths(beginDate,endDate)));
|
|
}
|
|
|
|
public static String getModDay(String beginDate,String endDate) throws Exception{
|
|
int month = (int)Math.floor(DateHelper.getMonths(beginDate, endDate));
|
|
int day = DateHelper.getDays(DateHelper.getRelativeDate(beginDate, DateHelper.TERM_UNIT_MONTH, month), endDate);
|
|
return String.valueOf(day);
|
|
}
|
|
/**根据传入的规则维度编号查询维度名称
|
|
* @param ids
|
|
* @return
|
|
* @throws JBOException
|
|
*/
|
|
public static String getSADREDimeItems(String ids) throws JBOException{
|
|
StringBuffer sb = new StringBuffer();
|
|
if(StringX.isEmpty(ids)){
|
|
sb.append("");
|
|
}else{
|
|
BizObjectManager bom = JBOFactory.getBizObjectManager("jbo.sys.SADRE_DIMENSION");
|
|
String [] idArray = ids.split(",");
|
|
BizObject bo = null;
|
|
for(int i=0;i<idArray.length;i++){
|
|
bo = bom.createQuery(" select DIMENSIONNAME from o where o.DIMENSIONID=:DIMENSIONID ")
|
|
.setParameter("DIMENSIONID", idArray[i]).getSingleResult(false);
|
|
if(bo!=null){
|
|
sb.append(bo.getAttribute("DIMENSIONNAME").getString()).append(",");
|
|
}
|
|
}
|
|
}
|
|
if(sb.toString().endsWith(",")){
|
|
return sb.toString().substring(0, sb.toString().length()-1);
|
|
}
|
|
|
|
return sb.toString();
|
|
}
|
|
|
|
/**根据传入的流程编号串编号查询流程名称串
|
|
* @param ids
|
|
* @return
|
|
* @throws JBOException
|
|
*/
|
|
public static String getSADREFlowItems(String ids) throws JBOException{
|
|
StringBuffer sb = new StringBuffer();
|
|
if(StringX.isEmpty(ids)){
|
|
sb.append("");
|
|
}else{
|
|
BizObjectManager bom = JBOFactory.getBizObjectManager(FLOW_CATALOG.CLASS_NAME);
|
|
String [] idArray = ids.split(",");
|
|
BizObject bo = null;
|
|
for(int i=0;i<idArray.length;i++){
|
|
bo = bom.createQuery(" select flowName from o where FLOWNO = :flowNo ")
|
|
.setParameter("flowNo", idArray[i]).getSingleResult(false);
|
|
if(bo!=null){
|
|
sb.append(bo.getAttribute("flowName").getString()).append(",");
|
|
}
|
|
}
|
|
}
|
|
if(sb.toString().endsWith(",")){
|
|
return sb.toString().substring(0, sb.toString().length()-1);
|
|
}
|
|
|
|
return sb.toString();
|
|
}
|
|
|
|
/**根据传入的机构编号串编号查询机构名称串
|
|
* @param ids
|
|
* @return
|
|
* @throws JBOException
|
|
*/
|
|
public static String getSADREOrgItems(String ids) throws JBOException{
|
|
StringBuffer sb = new StringBuffer();
|
|
if(StringX.isEmpty(ids)){
|
|
sb.append("");
|
|
}else{
|
|
BizObjectManager bom = JBOFactory.getBizObjectManager(ORG_INFO.CLASS_NAME);
|
|
String [] idArray = ids.split(",");
|
|
BizObject bo = null;
|
|
for(int i=0;i<idArray.length;i++){
|
|
bo = bom.createQuery(" select OrgName from o where OrgId = :OrgId ")
|
|
.setParameter("OrgId", idArray[i]).getSingleResult(false);
|
|
if(bo!=null){
|
|
sb.append(bo.getAttribute("OrgName").getString()).append(",");
|
|
}
|
|
}
|
|
}
|
|
if(sb.toString().endsWith(",")){
|
|
return sb.toString().substring(0, sb.toString().length()-1);
|
|
}
|
|
|
|
return sb.toString();
|
|
}
|
|
/**根据传入的 用户编号串编号查询用户名称串
|
|
* @param ids
|
|
* @return
|
|
* @throws JBOException
|
|
*/
|
|
public static String getSADREUserItems(String ids) throws JBOException{
|
|
StringBuffer sb = new StringBuffer();
|
|
StringBuffer sbIds = new StringBuffer();
|
|
if(StringX.isEmpty(ids)){
|
|
sb.append("");
|
|
}else{
|
|
BizObjectManager bom = JBOFactory.getBizObjectManager(USER_INFO.CLASS_NAME);
|
|
String [] idArray = ids.split(",");
|
|
BizObject bo = null;
|
|
for(int i=0;i<idArray.length;i++){
|
|
sbIds.append(":UserID"+i).append(",");
|
|
}
|
|
String strIds = "";
|
|
if(sbIds.toString().endsWith(",")){
|
|
strIds = sbIds.toString().substring(0, sbIds.toString().length()-1);
|
|
}else{
|
|
strIds = sbIds.toString();
|
|
}
|
|
|
|
BizObjectQuery query = bom.createQuery(" select UserName from o where UserId in ("+strIds+") ");
|
|
//循环设置参数
|
|
for(int i=0;i<idArray.length;i++){
|
|
query.setParameter("UserID"+i, idArray[i]);
|
|
}
|
|
List<BizObject> boList = query.getResultList(false);
|
|
for(BizObject biz : boList){
|
|
sb.append(biz.getAttribute("UserName").getString()).append(",");
|
|
}
|
|
}
|
|
if(sb.toString().endsWith(",")){
|
|
return sb.toString().substring(0, sb.toString().length()-1);
|
|
}
|
|
|
|
return sb.toString();
|
|
}
|
|
/**根据传入的 角色编号串编号查询角色名称串
|
|
* @param ids
|
|
* @return
|
|
* @throws JBOException
|
|
*/
|
|
public static String getSADRERoleItems(String ids) throws JBOException{
|
|
StringBuffer sb = new StringBuffer();
|
|
if(StringX.isEmpty(ids)){
|
|
sb.append("");
|
|
}else{
|
|
BizObjectManager bom = JBOFactory.getBizObjectManager(AWE_ROLE_INFO.CLASS_NAME);
|
|
String [] idArray = ids.split(",");
|
|
BizObject bo = null;
|
|
for(int i=0;i<idArray.length;i++){
|
|
bo = bom.createQuery(" select ROLENAME from o where ROLEID = :ROLEID ")
|
|
.setParameter("ROLEID", idArray[i]).getSingleResult(false);
|
|
if(bo!=null){
|
|
sb.append(bo.getAttribute("ROLENAME").getString()).append(",");
|
|
}
|
|
}
|
|
}
|
|
if(sb.toString().endsWith(",")){
|
|
return sb.toString().substring(0, sb.toString().length()-1);
|
|
}
|
|
|
|
return sb.toString();
|
|
}
|
|
}
|