package com.tenwa.reckon.executor; import com.amarsoft.are.jbo.JBOException; import com.amarsoft.are.jbo.JBOFactory; import com.amarsoft.are.jbo.JBOTransaction; import com.tenwa.reckon.util.Conn; import java.util.List; import java.util.Map; public class RentTerminateHelper { private String contractId; /** * 获取提期结清的 其他应退 * @return * @throws Exception */ public String getCautionMoney() throws Exception { String fundSql ="select ifnull(round( sum(case lfi.FEE_TYPE when 'feetype2' then FACT_MONEY else 0 end)- sum(case lfi.FEE_TYPE when 'feetype2' then 0 else FACT_MONEY end ),2),0) as over_caution_monry" + " from lc_fund_income lfi where lfi.CONTRACT_ID = ? and lfi.FEE_TYPE in ('feetype2', 'feetype16', 'feetype17')"; JBOTransaction tx=null; try { tx= JBOFactory.createJBOTransaction(); Conn conn = new Conn(tx); List> list = conn.executeQuery(fundSql, this.contractId); if(null != list && list.size() > 0 ){ Map fundMap = list.get(0); return fundMap.get("over_caution_monry"); }else{ return "0"; } } catch (JBOException e) { tx.rollback(); // TODO Auto-generated catch block e.printStackTrace(); }finally{ if(tx!=null){ tx.commit(); } } return "-1"; } public String getContractId() { return contractId; } public void setContractId(String contractId) { this.contractId = contractId; } }