package com.tenwa.handler; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Map.Entry; import jbo.app.tenwa.calc.LC_FUND_INCOME_TEMP; import com.amarsoft.app.util.ProductParamUtil; import com.amarsoft.are.jbo.BizObject; import com.amarsoft.are.jbo.JBOFactory; import com.amarsoft.awe.dw.handler.impl.CommonHandler; import com.amarsoft.dict.als.cache.CodeCache; import com.amarsoft.dict.als.object.Item; public class LCFundPaymentTempInfoHandler extends CommonHandler { @Override protected void initDisplayForEdit(BizObject bo) throws Exception { String productId = this.asPage.getParameter("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; } } } //安鹏贴息不抵扣 /*if(fundList.length() > 0) { fundList += ","; } fundList += "'feetype27'";*/ String flowunid = this.asPage.getParameter("ObjectNo"); @SuppressWarnings("unchecked") List boLFITs = JBOFactory.createBizObjectQuery(LC_FUND_INCOME_TEMP.CLASS_NAME, "flowunid = '" + flowunid + "' and fee_type in (" + fundList + ") ").getResultList(false); BigDecimal cleanLeaseMoney = new BigDecimal("0"); cleanLeaseMoney = cleanLeaseMoney.add(new BigDecimal(bo.getAttribute("FACT_MONEY").getString())); for(BizObject boLFIT : boLFITs) { BigDecimal factMoney = new BigDecimal(boLFIT.getAttribute("FACT_MONEY").getString()); String feeType = boLFIT.getAttribute("FEE_TYPE").getString(); if(factMoney.compareTo(BigDecimal.ZERO) > 0) { switch(feeType) { case "feetype1": cleanLeaseMoney = cleanLeaseMoney.add(factMoney); bo.setAttributeValue("HANDLING_CHARGE_MONEY", factMoney); this.asDataObject.setVisible("HANDLING_CHARGE_MONEY", true); break; case "feetype2": cleanLeaseMoney = cleanLeaseMoney.add(factMoney); bo.setAttributeValue("CAUTION_MONEY", factMoney); this.asDataObject.setVisible("CAUTION_MONEY", true); break; /*case "feetype27": cleanLeaseMoney = cleanLeaseMoney.add(factMoney); bo.setAttributeValue("DEALER_DISCOUNT", factMoney); this.asDataObject.setVisible("DEALER_DISCOUNT", true); break;*/ } } } bo.setAttributeValue("CLEAN_LEASE_MONEY", cleanLeaseMoney); } }