大同分润更改
This commit is contained in:
parent
fc3635bbfd
commit
be498a8593
@ -525,6 +525,8 @@
|
||||
<attribute name="FAILURE_TIME" label="失败时间" type="STRING" length="200"/>
|
||||
<attribute name="FAILURE_REASON" label="失败原因" type="STRING" length="200"/>
|
||||
<attribute name="SPARE_BATCH_NO" label="备用金到账批次号" type="STRING" length="32"/>
|
||||
<attribute name="CORPUS_SP" label="分润成本" type="String" length="18" scale="2"/>
|
||||
<attribute name="INTEREST_sp" label="分润给SP" type="String" length="18" scale="2"/>
|
||||
</attributes>
|
||||
<manager>
|
||||
<managerProperties>
|
||||
@ -1502,6 +1504,8 @@
|
||||
<attribute name="FAILURE_TIME" label="失败时间" type="STRING" length="200"/>
|
||||
<attribute name="FAILURE_REASON" label="失败原因" type="STRING" length="200"/>
|
||||
<attribute name="SPARE_BATCH_NO" label="备用金到账批次号" type="STRING" length="32"/>
|
||||
<attribute name="CORPUS_SP" label="分润成本" type="String" length="18" scale="2"/>
|
||||
<attribute name="INTEREST_sp" label="分润给SP" type="String" length="18" scale="2"/>
|
||||
</attributes>
|
||||
<manager>
|
||||
<managerProperties>
|
||||
@ -2475,6 +2479,8 @@
|
||||
<attribute name="FAILURE_TIME" label="失败时间" type="STRING" length="200"/>
|
||||
<attribute name="FAILURE_REASON" label="失败原因" type="STRING" length="200"/>
|
||||
<attribute name="SPARE_BATCH_NO" label="备用金到账批次号" type="STRING" length="32"/>
|
||||
<attribute name="CORPUS_SP" label="分润成本" type="String" length="18" scale="2"/>
|
||||
<attribute name="INTEREST_sp" label="分润给SP" type="String" length="18" scale="2"/>
|
||||
</attributes>
|
||||
<manager>
|
||||
<managerProperties>
|
||||
|
||||
@ -126,7 +126,7 @@ public class CreateTransactionExecutor implements Transaction {
|
||||
irr = this.createCashFlow(bean,tx);
|
||||
|
||||
//额外生成分润的租金计划
|
||||
String splittingRatio = ProductParamUtil.getProductParameterValue(productId, "PRD0350", "product_rate", "splitting_ratio");
|
||||
/*String splittingRatio = ProductParamUtil.getProductParameterValue(productId, "PRD0350", "product_rate", "splitting_ratio");
|
||||
System.out.println("==========================分润利率:"+splittingRatio+"==========================");
|
||||
if("".equals(splittingRatio)||splittingRatio==null){}
|
||||
else{
|
||||
@ -136,7 +136,7 @@ public class CreateTransactionExecutor implements Transaction {
|
||||
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 +197,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 +301,70 @@ public class CreateTransactionExecutor implements Transaction {
|
||||
}
|
||||
return "success";
|
||||
}
|
||||
/**
|
||||
* 插入分润计划
|
||||
* @param planDateList,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_sum = new BigDecimal("0.00");
|
||||
BigDecimal corpus_all = new BigDecimal("0.00");
|
||||
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));
|
||||
corpus_all = corpus.add(allRemainCorpus);
|
||||
}else{
|
||||
day = String.valueOf((planDate-(BoLRP.get(i-1).getAttribute("PLAN_DATE").getDate().getTime()))/(24*60*60*1000));
|
||||
}
|
||||
//如果是最后一期,则倒减。
|
||||
if(i==(BoLRP.size()-1)){
|
||||
corpus_sp = corpus_all.multiply(ratio).subtract(corpus_sum);
|
||||
}else{
|
||||
corpus_sp = corpus.add(allRemainCorpus).multiply(ratio).divide(new BigDecimal("360"),2,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(day));
|
||||
}
|
||||
|
||||
BigDecimal interest_sp = interest.subtract(corpus_sp);
|
||||
corpus_sum = corpus_sum.add(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();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
private Double Double(String splittingRatio) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
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";
|
||||
|
||||
@ -70,30 +70,7 @@ public class FundIncomeEndRentPlanModify extends BaseBussiness{
|
||||
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();
|
||||
}
|
||||
cre.insertRentPlan_SP(splittingRatio, Sqlca);
|
||||
}
|
||||
/* Date fact_date=df.parse(bo.getAttribute("fact_date").toString());
|
||||
Date base_date=fact_date;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user