package com.tenwa.reckon.help; import java.util.ArrayList; import java.util.List; import com.tenwa.reckon.bean.ConditionBean; import com.tenwa.reckon.bean.FundPlanBean; import com.tenwa.reckon.bean.TabCalBean; import com.tenwa.reckon.util.Conn; import com.tenwa.reckon.util.UUIDUtil; public class FundFundChargeDAOImpl { /** * * @param cb * @return * @throws Exception */ public boolean deleteFundFundCharge( ConditionBean cb,TabCalBean tcb) throws Exception { Conn conn = null; String sql = " delete from "+tcb.getFundFundPlan_tb()+" where flow_unid=? and "+tcb.getContOrProjCName()+"=?"; List paramValue=new ArrayList(); paramValue.add(tcb.getDocId() ); paramValue.add(tcb.getContOrProjCValue() ); conn.executeUpdate (sql,paramValue); return true; } /** * * @param cb * @param fp * @return */ public boolean addFundFundCharge(ConditionBean cb, List fp,TabCalBean tcb) throws Exception { for(FundPlanBean fund : fp){ Conn conn = null; StringBuffer sb = new StringBuffer(); sb.append(" INSERT INTO "+tcb.getFundFundPlan_tb()). append("(ID,flow_unid"). append(",FEE_TYPE,"). append(tcb.getContOrProjCName()+","). append("PLAN_DATE,PLAN_MONEY,PAY_OBJ,PAY_CUST,PAY_CUST_NAME,"). append("SETTLE_METHOD,PAY_TYPE "). append(") VALUES(").//sys_guid() '" + UUIDUtil.getUUID() + "' append("'"+UUIDUtil.getUUID()+"','" + cb.getDocId()). append("','" + fund.getFeeType()). append("','" + tcb.getContOrProjCValue()). append("','" + fund.getPlanDate()). append("','" + fund.getPlanMoney()). append("','" + fund.getPayObj()). append("','" + fund.getPayCust()). append("','" + fund.getPayCustName()). append("','" + fund.getSettleMethod()). append("','" + fund.getPayType()). append("')"); String replaceStr = sb.toString().replace("'null'", "null"); sb = sb.replace(0, sb.length(), replaceStr); conn.executeUpdate(sb.toString()); } return true; } /** * * * @param cb * @return * @throws Exception */ public boolean deleteFundFundCharge( String docId) throws Exception { Conn conn =null; String sql = " delete from FUND_FUND_PLAN_TEMP where flow_unid='" + docId + "'"; List paramValue=new ArrayList(); paramValue.add(docId ); conn.executeUpdate(sql,paramValue); return true; } /** * * @param cb * @param fp * @return */ public boolean addFundFundCharge(String docId, List fp,String markId,String markValue) throws Exception { for(FundPlanBean fund : fp){ Conn conn =null; StringBuffer sb = new StringBuffer(); sb.append(" INSERT INTO FUND_FUND_PLAN_TEMP"). append("(ID,flow_unid"). append(",FEE_TYPE,"). append("PLAN_DATE,PLAN_MONEY,PAY_OBJ,"). append("SETTLE_METHOD,PAY_TYPE ,"+markId). append(") VALUES(").//sys_guid() '" + UUIDUtil.getUUID() + "' append(" ?,?"). append(",?"). append(",?"). append(",?"). append(",?"). append(",?"). append(",?"). append(",?"). append(")"); String replaceStr = sb.toString().replace("'null'", "null"); sb = sb.replace(0, sb.length(), replaceStr); List param=new ArrayList(); param.add(UUIDUtil.getUUID()); param.add(docId); param.add(fund.getFeeType()); param.add(fund.getPlanDate()); param.add(fund.getPlanMoney()); param.add(fund.getPayObj()); param.add(fund.getSettleMethod()); param.add(fund.getPayType()); param.add(markValue); conn.executeUpdate(sb.toString(),param); } return true; } }