1.重新添上被覆盖代码。

This commit is contained in:
zhangbb 2019-08-21 14:11:06 +08:00
parent cc0e29fd3d
commit c32f6726c6

View File

@ -125,19 +125,6 @@ public class CreateTransactionExecutor implements Transaction {
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);
// ·µ»Ø²ÎÊýÉÏ×ö´¦Àí
@ -197,19 +184,6 @@ public class CreateTransactionExecutor implements Transaction {
this.createFundPlan(rentPlan, bean,tx);
String 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);
}
@ -314,6 +288,57 @@ public class CreateTransactionExecutor implements Transaction {
}
return "success";
}
/**
* 插入分润计划
* @param splittingRatio,Sqlca
* @return
* @throws JBOException
* @throws Exception
*/
public void insertRentPlan_SP (String splittingRatio,com.amarsoft.awe.util.Transaction Sqlca) throws Exception{
BizObjectManager BmLRP=JBOFactory.getBizObjectManager(LC_RENT_PLAN.CLASS_NAME, Sqlca);
java.text.SimpleDateFormat format = new java.text.SimpleDateFormat("yyyy/MM/dd");
String day ="0";
Long start = format.parse(startDate).getTime();
List<BizObject> BoLRP = BmLRP.createQuery("payment_number=:payment_number order by plan_list").setParameter("payment_number", this.plannumber).getResultList(false);
Connection conn = Sqlca.getConnection(Sqlca);
PreparedStatement ps = null;
BigDecimal corpus_sp = new BigDecimal("0.00");
try{
ps = conn.prepareStatement("update lc_rent_plan set CORPUS_SP = ?,INTEREST_SP = ? where payment_number = '" + this.plannumber + "' and plan_list = ?");
for(int i = 0; i < BoLRP.size(); i ++){
BigDecimal corpus = new BigDecimal(BoLRP.get(i).getAttribute("CORPUS").toString());
BigDecimal allRemainCorpus =new BigDecimal(BoLRP.get(i).getAttribute("ALL_REMAIN_CORPUS").toString());
BigDecimal interest =new BigDecimal(BoLRP.get(i).getAttribute("INTEREST").toString());
BigDecimal ratio = new BigDecimal(splittingRatio).divide(new BigDecimal("100"));
Long planDate = BoLRP.get(i).getAttribute("PLAN_DATE").getDate().getTime();
//第一期的话用计划日期减去起租日第一期本金加剩余总本金等于总本金
if(i==0){
day = String.valueOf((planDate-start)/(24*60*60*1000));
}else{
day = String.valueOf((planDate-(BoLRP.get(i-1).getAttribute("PLAN_DATE").getDate().getTime()))/(24*60*60*1000));
}
corpus_sp = corpus.add(allRemainCorpus).multiply(ratio).multiply(new BigDecimal(day)).divide(new BigDecimal("360"),2,BigDecimal.ROUND_HALF_UP);
BigDecimal interest_sp = interest.subtract(corpus_sp);
ps.setString(1, corpus_sp.toString());
ps.setString(2, interest_sp.toString());
ps.setString(3, (i + 1) + "");
ps.addBatch();
}
ps.executeBatch();
}catch(Exception e){
e.printStackTrace();
throw new RuntimeException("存储数据异常");
} finally {
if(ps != null) ps.close();
}
}
public void setCashFlow(String paymentNumber, String productId, com.amarsoft.awe.util.Transaction Sqlca) throws Exception {
String sql = "";
sql += "INSERT INTO LC_CASH_FLOW (id,project_id,project_plan_number,contract_id,contract_plan_number,payment_number";