diff --git a/WebContent/WEB-INF/etc/jbo/jbo_calc.xml b/WebContent/WEB-INF/etc/jbo/jbo_calc.xml
index 8d9b6ec21..5b497a11b 100644
--- a/WebContent/WEB-INF/etc/jbo/jbo_calc.xml
+++ b/WebContent/WEB-INF/etc/jbo/jbo_calc.xml
@@ -525,6 +525,8 @@
+
+
@@ -1502,6 +1504,8 @@
+
+
@@ -2475,6 +2479,8 @@
+
+
diff --git a/calc/com/tenwa/reckon/executor/CreateTransactionExecutor.java b/calc/com/tenwa/reckon/executor/CreateTransactionExecutor.java
index ae3a38de6..a83dc6a32 100644
--- a/calc/com/tenwa/reckon/executor/CreateTransactionExecutor.java
+++ b/calc/com/tenwa/reckon/executor/CreateTransactionExecutor.java
@@ -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 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";
diff --git a/src_tenwa/com/tenwa/flow/fund/actualpayment/FundIncomeEndRentPlanModify.java b/src_tenwa/com/tenwa/flow/fund/actualpayment/FundIncomeEndRentPlanModify.java
index ca0034ef2..1fbc0a6c1 100644
--- a/src_tenwa/com/tenwa/flow/fund/actualpayment/FundIncomeEndRentPlanModify.java
+++ b/src_tenwa/com/tenwa/flow/fund/actualpayment/FundIncomeEndRentPlanModify.java
@@ -70,30 +70,7 @@ public class FundIncomeEndRentPlanModify extends BaseBussiness{
if("".equals(splittingRatio)||splittingRatio==null){
}else{
- Map fromCondition=new HashMap();
- 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 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;