apzl_leasing/src_tenwa/com/tenwa/lease/app/cache/ContractInfoCache.java
2018-06-03 22:26:41 +08:00

70 lines
1.9 KiB
Java

package com.tenwa.lease.app.cache;
import java.util.HashMap;
import java.util.Map;
import jbo.com.tenwa.lease.comm.LB_CONTRACT_INFO;
import jbo.sys.CODE_LIBRARY;
import com.amarsoft.app.als.sys.tools.JBOHelper;
import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.JBOFactory;
import com.amarsoft.are.jbo.JBOTransaction;
import com.tenwa.comm.util.jboutil.DataOperatorUtil;
public class ContractInfoCache {
public static String getContractID(String id) throws Exception
{
JBOTransaction tx=JBOFactory.getFactory().createTransaction();
Map<String,String> condtion=new HashMap<String, String>();
condtion.put("id", id);
BizObject contract=DataOperatorUtil.getSingleJBO(LB_CONTRACT_INFO.CLASS_NAME, condtion, tx);
tx.commit();
if(contract!=null)
return contract.getAttribute("contract_id").toString();
else
return "";
}
public static String getContractNumber(String id) throws Exception
{
JBOTransaction tx=JBOFactory.getFactory().createTransaction();
Map<String,String> condtion=new HashMap<String, String>();
condtion.put("id", id);
BizObject contract=DataOperatorUtil.getSingleJBO(LB_CONTRACT_INFO.CLASS_NAME, condtion, tx);
tx.commit();
if(contract!=null)
return contract.getAttribute("contract_number").toString();
else
return "";
}
/**
* »ñÈ¡¸ÇÕÂÀàÐÍÃû³Æ
* @param stampid
* @return
* @throws Exception
*/
public static String getStampType(String stampid) throws Exception{
String stamptype = "";
if(stampid!=""){
String[] types = stampid.split(",");
for (int i = 0; i<types.length ;i++) {
BizObject bo = JBOHelper.querySingle(CODE_LIBRARY.CLASS_NAME, "SELECT itemname FROM O WHERE codeno='stamp_type' AND itemno=:itemno", types[i]);
stamptype += bo.getAttribute("itemname").toString()+",";
}
stamptype = stamptype.substring(0,stamptype.length()-1);
}
return stamptype;
}
}