This commit is contained in:
zhangbb 2019-07-24 15:05:01 +08:00
parent 5acd72b2af
commit 4127bd6416
2 changed files with 65 additions and 1 deletions

View File

@ -110,6 +110,7 @@ public class CreateTransactionExecutor implements Transaction {
TabCalBean bean = TbBeanTools.getTabInfo(calType, flowunid,plannumber,productId);
this.deletePayCondition(this.getFlowunid(),bean.getPlanCName(), bean.getPlanCValue(), tx);
DictTools.setYearRate(bean);
String yearRate = bean.getCb().getYearRate();
this.preHandle(bean.getCb(),bean);
if(bean.getCb().getRentOrRate().equals("rent")&&new BigDecimal(bean.getCb().getIncomeNumber()).multiply(new BigDecimal(bean.getCb().getRentValue())).compareTo(new BigDecimal(bean.getCb().getCleanLeaseMoney()))<0){
throw new BusinessException("按租金算年利率租金总和必须大于融资额");
@ -119,10 +120,24 @@ public class CreateTransactionExecutor implements Transaction {
String productType = Sqlca.getString(new SqlObject("select attribute2 from business_type where typeno='"+productId+"'"));
bean.setProductType(productType);
bean.getCb().setProductType(productType);
jsonObject.appendElement("year_rate", bean.getCb().getYearRate());
jsonObject.appendElement("year_rate", yearRate);
FundRentPlanBean rentPlan = this.createRentPlan(bean,tx);
this.createFundPlan(rentPlan, bean,tx);
irr = this.createCashFlow(bean,tx);
//额外生成分润的租金计划
String splittingRatio = ProductParamUtil.getProductParameterValue(productId, "PRD0350", "product_rate", "splitting_ratio");
System.out.println("==========================分润利率:"+splittingRatio+"==========================");
if("".equals(splittingRatio)||splittingRatio==null){}
else{
TabCalBean bean_sp = TbBeanTools.getTabInfo(calType, flowunid,plannumber,productId);
bean_sp.setProductType(productType);
bean_sp.getCb().setProductType(productType);
bean_sp.setRentPlan_tb("jbo.app.tenwa.calc.LC_RENT_PLAN_SP_TEMP");
bean_sp.getCb().setYearRate(splittingRatio);
FundRentPlanBean rentPlan_sp = this.createRentPlan(bean_sp,tx);
}
jsonObject.appendElement("result", "true");
this.callBack(jsonObject, bean.getCb(), bean,rentPlan,false,tx);
// 返回参数上做处理
@ -204,6 +219,7 @@ public class CreateTransactionExecutor implements Transaction {
* @throws Exception
*/
public String carRunOnhire(com.amarsoft.awe.util.Transaction Sqlca) throws Exception {
JBOTransaction tx=null;
BizObjectManager Bm=JBOFactory.getBizObjectManager(LC_CALC_CONDITION.CLASS_NAME, Sqlca);
BizObject boLCC = Bm.createQuery("contract_id='" + contractId + "'").getSingleResult(true);
//获取期次
@ -248,6 +264,9 @@ public class CreateTransactionExecutor implements Transaction {
Sqlca.executeSQL(new SqlObject("update lc_fund_plan set plan_date = '" + startDate + "' where payment_number = '" + this.plannumber + "' and pay_type = 'pay_type_in' and fee_type != 'feetype4' and fee_type != 'feetype12'"));
Sqlca.executeSQL(new SqlObject("update lc_fund_plan set plan_date = '" + startDate + "' where payment_number = '" + this.plannumber + "' and fee_type = 'feetype10'"));
this.setCashFlow(this.plannumber, this.productId, Sqlca);
}
return "success";
}

View File

@ -1,13 +1,23 @@
package com.tenwa.flow.fund.actualpayment;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import jbo.app.tenwa.calc.LC_CALC_CONDITION;
import jbo.app.tenwa.calc.LC_CALC_CONDITION_STATUS;
import jbo.app.tenwa.calc.LC_CALC_CONDITION_TEMP;
import jbo.app.tenwa.calc.LC_CASH_FLOW;
import jbo.app.tenwa.calc.LC_FUND_INCOME_TEMP;
import jbo.app.tenwa.calc.LC_RENT_PLAN;
import jbo.app.tenwa.calc.LC_RENT_PLAN_SP;
import jbo.app.tenwa.calc.LC_RENT_PLAN_SP_TEMP;
import jbo.com.tenwa.lease.comm.LB_CONTRACT_INFO;
import com.amarsoft.app.awe.config.InitDBType;
import com.amarsoft.app.util.ProductParamUtil;
import com.amarsoft.are.jbo.BizObject;
@ -16,6 +26,7 @@ import com.amarsoft.are.jbo.JBOFactory;
import com.amarsoft.are.jbo.JBOTransaction;
import com.amarsoft.awe.util.SqlObject;
import com.amarsoft.awe.util.Transaction;
import com.tenwa.comm.util.jboutil.DataOperatorUtil;
import com.tenwa.flow.baseBussion.BaseBussiness;
import com.tenwa.reckon.executor.CreateTransactionExecutor;
/**
@ -27,6 +38,8 @@ import com.tenwa.reckon.executor.CreateTransactionExecutor;
public class FundIncomeEndRentPlanModify extends BaseBussiness{
public Object run(Transaction Sqlca) throws Exception{
this.initBussinessParam(Sqlca.getTransaction());
JBOTransaction tx=null;
tx = Sqlca.getTransaction();
String sFlowUnid = (String)this.getAttribute("ObjectNo");
BizObjectManager bomLFIT = JBOFactory.getBizObjectManager(LC_FUND_INCOME_TEMP.CLASS_NAME);
Sqlca.join(bomLFIT);
@ -42,6 +55,7 @@ public class FundIncomeEndRentPlanModify extends BaseBussiness{
String contractId=bo.getAttribute("contract_id").toString();
String productId = Sqlca.getString("select product_id from lb_contract_info where id='"+contractId+"'");
String calType = "onHire_process";
String projectPlanNumber = bo.getAttribute("project_plan_number").toString();
CreateTransactionExecutor cre = new CreateTransactionExecutor();
cre.setCalType(calType);
cre.setContractId(contractId);
@ -50,6 +64,37 @@ public class FundIncomeEndRentPlanModify extends BaseBussiness{
cre.setFlowunid(contractId);
cre.setStartDate(bo.getAttribute("fact_date").toString());
cre.carRunOnhire(Sqlca);
//额外生成分润的租金计划
String splittingRatio = ProductParamUtil.getProductParameterValue(productId, "PRD0350", "product_rate", "splitting_ratio");
if("".equals(splittingRatio)||splittingRatio==null){
}else{
Map<String,String> fromCondition=new HashMap<String, String>();
fromCondition.put("CONTRACT_ID", contractId);
DataOperatorUtil.copyJBOSet(LC_RENT_PLAN.CLASS_NAME, fromCondition,LC_RENT_PLAN_SP.CLASS_NAME, null, null, null, tx);
BizObjectManager bomLRPST = JBOFactory.getBizObjectManager(LC_RENT_PLAN_SP_TEMP.CLASS_NAME);
List<BizObject> boLRPST = bomLRPST.createQuery("project_plan_number=:project_plan_number and flowunid =(SELECT MAX(flowunid) FROM O) order by plan_list").setParameter("project_plan_number", projectPlanNumber).getResultList(false);
Connection conn = Sqlca.getConnection(Sqlca);
PreparedStatement ps = null;
try {
ps = conn.prepareStatement("update lc_rent_plan_sp set rent = ? ,corpus = ? ,interest = ? where project_plan_number = '" + projectPlanNumber + "' and plan_list = ?");
for(int i = 0; i < boLRPST.size(); i ++) {
ps.setString(1, boLRPST.get(i).getAttribute("rent").toString());
ps.setString(2, boLRPST.get(i).getAttribute("corpus").toString());
ps.setString(3, boLRPST.get(i).getAttribute("interest").toString());
ps.setString(4, (i + 1) + "");
ps.addBatch();
}
ps.executeBatch();
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("存储数据异常");
}finally {
if(ps != null) ps.close();
}
}
/* Date fact_date=df.parse(bo.getAttribute("fact_date").toString());
Date base_date=fact_date;
Calendar calendar = new GregorianCalendar();