package com.tenwa.flow.fund.flowpayment; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Map.Entry; import com.amarsoft.app.util.ProductParamUtil; import com.amarsoft.awe.util.Transaction; import com.amarsoft.context.ASUser; import com.amarsoft.dict.als.cache.CodeCache; import com.amarsoft.dict.als.object.Item; import com.tenwa.flow.baseBussion.BaseBussiness; /** * 拷贝差额放款到临时表 * @author zhulh * */ public class CopyFundPaymentToTemp extends BaseBussiness{ public Object run(Transaction Sqlca) throws Exception{ this.initBussinessParam(Sqlca.getTransaction()); String contractId = (String)this.getAttribute("ContractId"); String flowunid = (String)this.getAttribute("ObjectNo"); String userId = (String)this.getAttribute("CurUserID"); String productId = (String)this.getAttribute("ProductId"); //获取坐扣项 Map> params = ProductParamUtil.getProductComponentType(productId, "PRD0315"); List deductFeeType = new ArrayList(); for(Entry> feeTypes : params.entrySet()) { if(!feeTypes.getValue().containsKey("isBalance")) { continue; } String isBalance = feeTypes.getValue().get("isBalance"); if("yes".equals(isBalance)) { deductFeeType.add(feeTypes.getKey()); } } Item[] items = CodeCache.getItems("FeeType"); String fundList = ""; for(Item item : items) { for(String feetype : deductFeeType) { if(feetype.equals(item.getRelativeCode())) { if(fundList.length() != 0) { fundList += ","; } fundList += "'" + item.getItemNo() + "'"; break; } } } //分段融 String settleMethod = Sqlca.getString("select SETTLE_METHOD from lc_calc_condition where CONTRACT_ID='"+contractId+"'"); if(settleMethod!=null && settleMethod.equals("segmented_financing")) { Map>> configs = ProductParamUtil.getProductComponentDecisionTable( productId, "PRD0301","IsBalanceLending"); if(configs!=null && configs.size()>0 ) { List> list = configs.get("segmented_financing"); if( list!=null && list.size()>0 ) { String IsBalanceLending = list.get(0).get("IsBalanceLending"); if(IsBalanceLending!=null && IsBalanceLending.equals("Y")) { fundList += ",'feetype27'"; } } } } //安鹏贴息不抵扣 //北汽的有的产品可以贴息差额放款 /*if(fundList.length() > 0) { fundList += ","; } fundList += "'feetype27'";*/ ASUser user = ASUser.getUser(userId, Sqlca); FundPaymentCar fp = new FundPaymentCar(); fp.setFlowunid(flowunid); fp.setContractId(contractId); fp.setUserId(user.getUserID()); fp.setOrgId(user.getOrgID()); fp.setFundList(fundList); fp.setDeductMoney(Sqlca.getTransaction()); String sMessage="true"; return sMessage; } }