修改投放起租刷新租金支付日
This commit is contained in:
parent
7308db48bd
commit
fcb367c986
@ -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<String> planDateList = getPlanDateList(incomeNumber, periodType, incomeIntervalMonth, startDate);
|
||||
List<String> 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<String> getPlanDateListFixed(int incomeNumber, String periodType, String incomeIntervalMonth, String startDate) throws ParseException {
|
||||
List<String> planDate = new ArrayList<String>();
|
||||
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<String> getPlanDateList(int incomeNumber, String periodType, String incomeIntervalMonth, String startDate) throws ParseException {
|
||||
List<String> planDate = new ArrayList<String>();
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user