2018-06-03 22:26:41 +08:00

152 lines
6.8 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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<String,String> fromCondition=new HashMap<String, String>();
fromCondition.put("flowunid", flowunid);
fromCondition.put("CONTRACT_PLAN_NUMBER", condition.getAttribute("CONTRACT_PLAN_NUMBER").getString());
fromCondition.put("payment_number","");
Map<String,String> toCondition=new HashMap<String, String>();
toCondition.put("payment_number", payment_number);
Map<String,String> other=new HashMap<String, String>();
other.put("payment_number", payment_number);
other.put("flowunid", flowunid);
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
DataOperatorUtil.copyJBOSet(LC_CALC_CONDITION_TEMP.CLASS_NAME, fromCondition,LC_CALC_CONDITION_TEMP.CLASS_NAME, toCondition, other, null, tx);
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
DataOperatorUtil.copyJBOSet(LC_CALC_RULES_TEMP.CLASS_NAME, fromCondition,LC_CALC_RULES_TEMP.CLASS_NAME, toCondition, other, null, tx);
//<2F><><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD>
DataOperatorUtil.copyJBOSet(LC_RENT_PLAN_TEMP.CLASS_NAME, fromCondition,LC_RENT_PLAN_TEMP.CLASS_NAME, toCondition, other, null, tx);
//<2F>ʽ<EFBFBD><CABD>ƻ<EFBFBD>
DataOperatorUtil.copyJBOSet(LC_FUND_PLAN_TEMP.CLASS_NAME, fromCondition,LC_FUND_PLAN_TEMP.CLASS_NAME, toCondition, other, null, tx);
//<2F>ֽ<EFBFBD><D6BD><EFBFBD>
DataOperatorUtil.copyJBOSet(LC_CASH_FLOW_TEMP.CLASS_NAME, fromCondition, LC_CASH_FLOW_TEMP.CLASS_NAME, toCondition, other, null, tx);
//<2F><>֪<EFBFBD><D6AA>
DataOperatorUtil.copyJBOSet(LC_CALC_PERIOD_TEMP.CLASS_NAME, fromCondition, LC_CALC_PERIOD_TEMP.CLASS_NAME, toCondition, other, null, tx);
//<2F>ֶβ<D6B6><CEB2><EFBFBD>
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());
//<2F><><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0>
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<String,String> fromCondition=new HashMap<String, String>();
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<String,String> other=new HashMap<String, String>();
other.put(tcb.getPlanCName(), plannumber);
other.put("flowunid", flowunid);
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
DataOperatorUtil.copyJBOSet(LC_CALC_CONDITION_TEMP.CLASS_NAME, fromCondition,LC_CALC_CONDITION_TEMP.CLASS_NAME, null, other, null, tx);
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
DataOperatorUtil.copyJBOSet(LC_CALC_RULES_TEMP.CLASS_NAME, fromCondition,LC_CALC_RULES_TEMP.CLASS_NAME, null, other, null, tx);
//<2F><><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD>
DataOperatorUtil.copyJBOSet(LC_RENT_PLAN_TEMP.CLASS_NAME, fromCondition,LC_RENT_PLAN_TEMP.CLASS_NAME, null, other, null, tx);
//<2F>ʽ<EFBFBD><CABD>ƻ<EFBFBD>
DataOperatorUtil.copyJBOSet(LC_FUND_PLAN_TEMP.CLASS_NAME, fromCondition,LC_FUND_PLAN_TEMP.CLASS_NAME, null, other, null, tx);
//<2F>ֽ<EFBFBD><D6BD><EFBFBD>
DataOperatorUtil.copyJBOSet(LC_CASH_FLOW_TEMP.CLASS_NAME, fromCondition, LC_CASH_FLOW_TEMP.CLASS_NAME, null, other, null, tx);
//<2F><>֪<EFBFBD><D6AA>
DataOperatorUtil.copyJBOSet(LC_CALC_PERIOD_TEMP.CLASS_NAME, fromCondition, LC_CALC_PERIOD_TEMP.CLASS_NAME, null, other, null, tx);
//<2F>ֶβ<D6B6><CEB2><EFBFBD>
DataOperatorUtil.copyJBOSet(LC_CALC_SUBSECTION_TEMP.CLASS_NAME, fromCondition, LC_CALC_SUBSECTION_TEMP.CLASS_NAME, null, other, null, tx);
return "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD>";
}
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;
}
}