From fcb367c986f70703bc3b29c64c3d83259d1244c3 Mon Sep 17 00:00:00 2001 From: zhulianghua Date: Fri, 24 Aug 2018 10:01:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8A=95=E6=94=BE=E8=B5=B7?= =?UTF-8?q?=E7=A7=9F=E5=88=B7=E6=96=B0=E7=A7=9F=E9=87=91=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E6=97=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../executor/CreateTransactionExecutor.java | 75 +++++++++++++++++-- .../FundIncomeEndRentPlanModify.java | 3 - 2 files changed, 67 insertions(+), 11 deletions(-) diff --git a/calc/com/tenwa/reckon/executor/CreateTransactionExecutor.java b/calc/com/tenwa/reckon/executor/CreateTransactionExecutor.java index 6f7bf24fe..2f97a664c 100644 --- a/calc/com/tenwa/reckon/executor/CreateTransactionExecutor.java +++ b/calc/com/tenwa/reckon/executor/CreateTransactionExecutor.java @@ -191,22 +191,37 @@ public class CreateTransactionExecutor implements Transaction { BizObjectManager Bm=JBOFactory.getBizObjectManager(LC_CALC_CONDITION.CLASS_NAME, Sqlca); BizObject boLCC = Bm.createQuery("contract_id='" + contractId + "'").getSingleResult(true); //获取期次 - if(boLCC!=null){ + if(boLCC != null) { + String settleMethod = boLCC.getAttribute("SETTLE_METHOD").getString(); + String defaultDueDay = ProductParamUtil.getProductParameterValue(productId, "PRD0301", settleMethod, "DefaultDueDay"); int incomeNumber = boLCC.getAttribute("INCOME_NUMBER").getInt(); String periodType = boLCC.getAttribute("PERIOD_TYPE").getString(); String incomeIntervalMonth = boLCC.getAttribute("INCOME_INTERVAL_MONTH").getInt() + ""; - List planDateList = getPlanDateList(incomeNumber, periodType, incomeIntervalMonth, startDate); + List planDateList = null; + if("01".equals(defaultDueDay)) { + planDateList = getPlanDateListFixed(incomeNumber, periodType, incomeIntervalMonth, startDate); + } else { + planDateList = getPlanDateList(incomeNumber, periodType, incomeIntervalMonth, startDate); + } String insertSql="insert into lc_rent_plan(id,quot_id,cust_id, project_id, project_plan_number,contract_id,contract_plan_number,payment_number,plan_list,plan_date,plan_status,rent,corpus,interest,penalty,corpus_business,interest_business,rent_adjust,all_remain_corpus,settle_method,coin,year_rate,memo,flowunid,inputuserid,inputorgid,inputtime,updateuserid,updateorgid,updatetime,interest_date) select id,quot_id,cust_id, project_id, project_plan_number,contract_id,contract_plan_number,payment_number,plan_list,plan_date,plan_status,rent,corpus,interest,penalty,corpus_business,interest_business,rent_adjust,all_remain_corpus,settle_method,coin,year_rate,memo,flowunid,inputuserid,inputorgid,inputtime,updateuserid,updateorgid,updatetime,interest_date from lc_pay_rent_plan where payment_number = '" + this.plannumber + "'"; Sqlca.executeSQL(new SqlObject(insertSql)); Connection conn = Sqlca.getConnection(Sqlca); //实际租金计划日期(开始) - PreparedStatement ps = conn.prepareStatement("update lc_rent_plan set plan_date = ? where payment_number = '" + this.plannumber + "' and plan_list = ?"); - for(int i = 0; i < planDateList.size(); i ++) { - ps.setString(1, planDateList.get(i)); - ps.setString(2, (i + 1) + ""); - ps.addBatch(); + PreparedStatement ps = null; + try { + ps = conn.prepareStatement("update lc_rent_plan set plan_date = ? where payment_number = '" + this.plannumber + "' and plan_list = ?"); + for(int i = 0; i < planDateList.size(); i ++) { + ps.setString(1, planDateList.get(i)); + ps.setString(2, (i + 1) + ""); + ps.addBatch(); + } + ps.executeBatch(); + } catch(Exception e) { + e.printStackTrace(); + throw new RuntimeException("存储数据异常"); + } finally { + if(ps != null) ps.close(); } - ps.executeBatch(); boLCC.setAttributeValue("start_date", startDate); boLCC.setAttributeValue("lease_amt_date", startDate); if(planDateList.size()>0)boLCC.setAttributeValue("first_plan_date", planDateList.get(0)); @@ -265,6 +280,50 @@ public class CreateTransactionExecutor implements Transaction { Sqlca.executeSQL(new SqlObject(sql)); } + //固定还款日 + public static List getPlanDateListFixed(int incomeNumber, String periodType, String incomeIntervalMonth, String startDate) throws ParseException { + List planDate = new ArrayList(); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(com.amarsoft.app.als.sys.tools.DateUtil.parseStringToDate(startDate, "yyyy/MM/dd")); + int day = calendar.get(Calendar.DAY_OF_MONTH); + boolean flag = false; + if("period_type_0".equals(periodType)) { + if(day >= 1 && day <= 9) { + day = 5; + } else if(day >= 10 && day <= 19) { + day = 15; + } else { + day = 25; + } + } else { + if(day >= 6 && day <= 15) { + day = 15; + } else if(day >= 16 && day <= 25) { + day = 25; + } else { + day = 5; + flag = true; + } + } + int addMonth = Integer.parseInt(incomeIntervalMonth); + for(int i = 0; i < incomeNumber; i ++) { + if(!("period_type_1".equals(periodType) && i == 0 && !flag)) {//期末加上还款间隔 + calendar.add(Calendar.MONTH, addMonth); + if(day != calendar.get(Calendar.DAY_OF_MONTH)) { + if(day > calendar.getActualMaximum(Calendar.DAY_OF_MONTH)) { + calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH)); + } else { + calendar.set(Calendar.DAY_OF_MONTH, day); + } + } + } + planDate.add(com.amarsoft.app.als.sys.tools.DateUtil.formatDateToString(calendar.getTime(), "yyyy/MM/dd")); + } + return planDate; + } + + + //起租日即为还款日 public static List getPlanDateList(int incomeNumber, String periodType, String incomeIntervalMonth, String startDate) throws ParseException { List planDate = new ArrayList(); Calendar calendar = Calendar.getInstance(); diff --git a/src_tenwa/com/tenwa/flow/fund/actualpayment/FundIncomeEndRentPlanModify.java b/src_tenwa/com/tenwa/flow/fund/actualpayment/FundIncomeEndRentPlanModify.java index 825ffc68b..1a81ab353 100644 --- a/src_tenwa/com/tenwa/flow/fund/actualpayment/FundIncomeEndRentPlanModify.java +++ b/src_tenwa/com/tenwa/flow/fund/actualpayment/FundIncomeEndRentPlanModify.java @@ -1,16 +1,13 @@ package com.tenwa.flow.fund.actualpayment; -import java.text.SimpleDateFormat; 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_STATUS; import jbo.app.tenwa.calc.LC_CASH_FLOW; import jbo.app.tenwa.calc.LC_FUND_INCOME_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;