package com.tenwa.flow.fund.paymentplan; import java.util.HashMap; import java.util.Map; import jbo.app.tenwa.calc.LC_CALC_CONDITION_TEMP; import jbo.app.tenwa.calc.LC_CALC_PERIOD_TEMP; import jbo.app.tenwa.calc.LC_CALC_RULES_TEMP; import jbo.app.tenwa.calc.LC_CALC_SUBSECTION_TEMP; import jbo.app.tenwa.calc.LC_CASH_FLOW_TEMP; import jbo.app.tenwa.calc.LC_FUND_PLAN_TEMP; import jbo.app.tenwa.calc.LC_RENT_PLAN_TEMP; import jbo.com.tenwa.lease.comm.LB_CONTRACT_INFO_TEMP; import jbo.com.tenwa.lease.comm.LC_PAY_CONDTION; import jbo.com.tenwa.lease.comm.LC_PAY_CONDTION_TEMP; import com.amarsoft.are.jbo.BizObject; import com.amarsoft.are.jbo.BizObjectManager; import com.amarsoft.are.jbo.JBOException; import com.amarsoft.are.jbo.JBOFactory; import com.amarsoft.are.jbo.JBOTransaction; import com.tenwa.comm.exception.RecordNotFoundException; import com.tenwa.comm.util.jboutil.DataOperatorUtil; import com.tenwa.reckon.bean.TabCalBean; import com.tenwa.reckon.util.TbBeanTools; import com.tenwa.util.SerialNumberUtil; public class PaymentPlanAction { public String conditionid; public String calType; public String copyCondition(JBOTransaction tx) throws Exception{ BizObjectManager bm=JBOFactory.getBizObjectManager(LC_CALC_CONDITION_TEMP.CLASS_NAME); BizObject condition=JBOFactory.createBizObjectQuery(LC_CALC_CONDITION_TEMP.CLASS_NAME,"id=:id").setParameter("id", conditionid).getSingleResult(false); //String message=PaymentPlanCheck.paymentPlanCheck(condition); //if(message.length()>2){ // return message; //} String flowunid=condition.getAttribute("flowunid").getString(); BizObject paymentPlan=bm.createQuery("flowunid=:flowunid and PAYMENT_NUMBER is not null AND length(PAYMENT_NUMBER)>0 ").setParameter("flowunid", flowunid).getSingleResult(true); BizObject contract=JBOFactory.createBizObjectQuery(LB_CONTRACT_INFO_TEMP.CLASS_NAME,"flowunid=:flowunid").setParameter("flowunid", flowunid).getSingleResult(false); String payment_number=""; if(paymentPlan==null){ payment_number=SerialNumberUtil.getPlannumber(contract.getAttribute("contract_no").getString(), "pay_process", tx); }else{ payment_number=paymentPlan.getAttribute("payment_number").getString(); } Map fromCondition=new HashMap(); fromCondition.put("flowunid", flowunid); fromCondition.put("CONTRACT_PLAN_NUMBER", condition.getAttribute("CONTRACT_PLAN_NUMBER").getString()); fromCondition.put("payment_number",""); Map toCondition=new HashMap(); toCondition.put("payment_number", payment_number); Map other=new HashMap(); other.put("payment_number", payment_number); other.put("flowunid", flowunid); //商务条件 DataOperatorUtil.copyJBOSet(LC_CALC_CONDITION_TEMP.CLASS_NAME, fromCondition,LC_CALC_CONDITION_TEMP.CLASS_NAME, toCondition, other, null, tx); //测算租金规则 DataOperatorUtil.copyJBOSet(LC_CALC_RULES_TEMP.CLASS_NAME, fromCondition,LC_CALC_RULES_TEMP.CLASS_NAME, toCondition, other, null, tx); //租金计划 DataOperatorUtil.copyJBOSet(LC_RENT_PLAN_TEMP.CLASS_NAME, fromCondition,LC_RENT_PLAN_TEMP.CLASS_NAME, toCondition, other, null, tx); //资金计划 DataOperatorUtil.copyJBOSet(LC_FUND_PLAN_TEMP.CLASS_NAME, fromCondition,LC_FUND_PLAN_TEMP.CLASS_NAME, toCondition, other, null, tx); //现金流 DataOperatorUtil.copyJBOSet(LC_CASH_FLOW_TEMP.CLASS_NAME, fromCondition, LC_CASH_FLOW_TEMP.CLASS_NAME, toCondition, other, null, tx); //已知表 DataOperatorUtil.copyJBOSet(LC_CALC_PERIOD_TEMP.CLASS_NAME, fromCondition, LC_CALC_PERIOD_TEMP.CLASS_NAME, toCondition, other, null, tx); //分段测算 DataOperatorUtil.copyJBOSet(LC_CALC_SUBSECTION_TEMP.CLASS_NAME, fromCondition, LC_CALC_SUBSECTION_TEMP.CLASS_NAME, toCondition, other, null, tx); fromCondition.clear(); fromCondition.put("contract_id", condition.getAttribute("contract_id").getString()); fromCondition.put("PLAN_NUMBER", condition.getAttribute("CONTRACT_PLAN_NUMBER").getString()); //付款前提 DataOperatorUtil.copyJBOSet(LC_PAY_CONDTION.CLASS_NAME, fromCondition, LC_PAY_CONDTION_TEMP.CLASS_NAME, toCondition, other, null, tx); return ""; } public String copyTempCondition(JBOTransaction tx) throws JBOException, RecordNotFoundException, Exception{ BizObject condition=JBOFactory.createBizObjectQuery(LC_CALC_CONDITION_TEMP.CLASS_NAME,"id=:id").setParameter("id", conditionid).getSingleResult(false); String flowunid=condition.getAttribute("flowunid").getString(); TabCalBean tcb=TbBeanTools.getTabInfo(calType); Map fromCondition=new HashMap(); fromCondition.put("flowunid", flowunid); fromCondition.put(tcb.getPlanCName(), condition.getAttribute(tcb.getPlanCName()).getString()); String plannumber=""; String sSerialType=""; if("proj_process".equals(calType)){ BizObject proj=JBOFactory.createBizObjectQuery("jbo.com.tenwa.lease.comm.LB_PROJECT_INFO_TEMP","flowunid=:flowunid").setParameter("flowunid", flowunid).getSingleResult(false); sSerialType=proj.getAttribute("PROJECT_NO").getString(); }else{ BizObject contract=JBOFactory.createBizObjectQuery("jbo.com.tenwa.lease.comm.LB_CONTRACT_INFO_TEMP","flowunid=:flowunid").setParameter("flowunid", flowunid).getSingleResult(false); sSerialType=contract.getAttribute("CONTRACT_NO").getString(); } plannumber=SerialNumberUtil.getPlannumber(sSerialType,calType,tx); Map other=new HashMap(); other.put(tcb.getPlanCName(), plannumber); other.put("flowunid", flowunid); //商务条件 DataOperatorUtil.copyJBOSet(LC_CALC_CONDITION_TEMP.CLASS_NAME, fromCondition,LC_CALC_CONDITION_TEMP.CLASS_NAME, null, other, null, tx); //测算租金规则 DataOperatorUtil.copyJBOSet(LC_CALC_RULES_TEMP.CLASS_NAME, fromCondition,LC_CALC_RULES_TEMP.CLASS_NAME, null, other, null, tx); //租金计划 DataOperatorUtil.copyJBOSet(LC_RENT_PLAN_TEMP.CLASS_NAME, fromCondition,LC_RENT_PLAN_TEMP.CLASS_NAME, null, other, null, tx); //资金计划 DataOperatorUtil.copyJBOSet(LC_FUND_PLAN_TEMP.CLASS_NAME, fromCondition,LC_FUND_PLAN_TEMP.CLASS_NAME, null, other, null, tx); //现金流 DataOperatorUtil.copyJBOSet(LC_CASH_FLOW_TEMP.CLASS_NAME, fromCondition, LC_CASH_FLOW_TEMP.CLASS_NAME, null, other, null, tx); //已知表 DataOperatorUtil.copyJBOSet(LC_CALC_PERIOD_TEMP.CLASS_NAME, fromCondition, LC_CALC_PERIOD_TEMP.CLASS_NAME, null, other, null, tx); //分段测算 DataOperatorUtil.copyJBOSet(LC_CALC_SUBSECTION_TEMP.CLASS_NAME, fromCondition, LC_CALC_SUBSECTION_TEMP.CLASS_NAME, null, other, null, tx); return "操作成功!"; } public String getConditionid() { return conditionid; } public void setConditionid(String conditionid) { this.conditionid = conditionid; } public String getCalType() { return calType; } public void setCalType(String calType) { this.calType = calType; } }