20220909休眠流程增加延期逻辑
This commit is contained in:
parent
70528e70fa
commit
5652e825b8
@ -1,6 +1,7 @@
|
||||
<%@page import="com.amarsoft.awe.control.model.Parameter"%>
|
||||
<%@ page contentType="text/html; charset=GBK"%>
|
||||
<%@ page import="com.tenwa.reckon.product.ASObjectWindowCalc" %>
|
||||
<%@ page import="com.tenwa.jbo.manager.DataUtil" %>
|
||||
<%@ include file="/Frame/resources/include/include_begin_info.jspf"%>
|
||||
<style>
|
||||
#div_my0 > form {
|
||||
@ -53,6 +54,9 @@
|
||||
doTemp.setDefaultValue("flowunid", flowunid);
|
||||
doTemp.setDefaultValue("payment_number", paymentNumber);
|
||||
doTemp.setHtmlEvent("START_LIST","onchange","startListChange");
|
||||
doTemp.setHtmlEvent("DELAY_START_LIST", "onchange", "changeDelayStartList");
|
||||
doTemp.setHtmlEvent("DELAY_END_LIST", "onchange", "changeDelayEndList");
|
||||
doTemp.setHtmlEvent("CHANGE_TYPE", "onchange", "changeType");
|
||||
|
||||
doTemp.appendJboWhere(" and payment_number='"+paymentNumber+"'");
|
||||
|
||||
@ -67,6 +71,11 @@
|
||||
doTemp.setDefaultValue("DORMANT_YEAR_RATE",rents.get(rentLists-1).getAttribute("YEAR_RATE").getString());
|
||||
doTemp.setDefaultValue("IRR_OLD",irr);
|
||||
}
|
||||
List<Map<String, String>> dataList = DataUtil.query("select 1 from lc_calc_subsection_info where payment_number = ?", Sqlca, paymentNumber);
|
||||
String canChange = "yes";
|
||||
if (dataList.size() > 1) {
|
||||
canChange = "no";
|
||||
}
|
||||
ASObjectWindowCalc dwTemp = new ASObjectWindowCalc(CurPage, doTemp,request);
|
||||
/*Parameter p=new Parameter("NodeNo",nodeNo+"_1");
|
||||
Parameter p2=new Parameter("payment_number",paymentNumber);
|
||||
@ -96,6 +105,7 @@
|
||||
%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
changeType();
|
||||
var zcContractNum=getItemValue(0,0,"zc_contract_num");
|
||||
if(zcContractNum == undefined || zcContractNum == '' ){
|
||||
setItemValue(0,0,"zc_contract_num","<%=zcContractNum%>");
|
||||
@ -111,11 +121,15 @@ $(function(){
|
||||
if(Number(endList)<Number(startList)){
|
||||
alert("结束期次不可以小于开始期次!");
|
||||
setItemValue(0,0,"END_LIST","");
|
||||
setItemValue(0, 0, 'DELAY_START_LIST', '');
|
||||
setItemValue(0, 0, 'DELAY_END_LIST', '');
|
||||
return;
|
||||
}
|
||||
if(Number(endList)==<%=rentLists%>){
|
||||
alert("休眠结束期次不可以为最大期次");
|
||||
setItemValue(0,0,"END_LIST","");
|
||||
setItemValue(0, 0, 'DELAY_START_LIST', '');
|
||||
setItemValue(0, 0, 'DELAY_END_LIST', '');
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -123,17 +137,24 @@ $(function(){
|
||||
$("#END_LIST").change(function(){
|
||||
var endList = $("#END_LIST").val();
|
||||
var startList = $("#START_LIST").val();
|
||||
if(endList.indexOf("-")!=-1){
|
||||
alert("此处不能输入负数!");
|
||||
$("#END_LIST").val(endList.replace("-",""));
|
||||
}
|
||||
if(typeof(startList)!=undefined && startList !="" ){
|
||||
if(Number(endList)<Number(startList)){
|
||||
alert("结束期次不可以小于开始期次!");
|
||||
setItemValue(0,0,"END_LIST","");
|
||||
setItemValue(0, 0, 'DELAY_START_LIST', '');
|
||||
setItemValue(0, 0, 'DELAY_END_LIST', '');
|
||||
return;
|
||||
}
|
||||
}
|
||||
const changeType = getItemValue(0, 0, 'CHANGE_TYPE');
|
||||
if (changeType === 'dormancy_delay') {
|
||||
const delayStartList = getItemValue(0, 0, 'DELAY_START_LIST');
|
||||
if (delayStartList !== '' && Number(delayStartList) <= Number(endList)) {
|
||||
alert('延期开始期次必须大于休眠结束期次');
|
||||
setItemValue(0, 0, 'DELAY_START_LIST', '');
|
||||
setItemValue(0, 0, 'DELAY_END_LIST', '');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@ -144,6 +165,10 @@ function saveRecord(sPostEvents)
|
||||
AsDebug.alert("提示","只有尾款的的项十二条目并且大于还租次数才能展期变更!");
|
||||
return;
|
||||
} */
|
||||
if ('<%=canChange%>' === 'no') {
|
||||
alert('发现多条分段融数据,不允许进行变更');
|
||||
return;
|
||||
}
|
||||
var zcContractNum=getItemValue(0,0,"zc_contract_num");
|
||||
var contract_date=getItemValue(0,0,"contract_date");
|
||||
if(zcContractNum == undefined || zcContractNum == '' ){
|
||||
@ -154,6 +179,10 @@ function saveRecord(sPostEvents)
|
||||
alert("合同签署时间不能为空!");
|
||||
return;
|
||||
}
|
||||
const changeType = getItemValue(0, 0, 'CHANGE_TYPE');
|
||||
if (changeType === 'delay') {
|
||||
setItemValue(0, 0, 'START_LIST', '');
|
||||
}
|
||||
var result = AsControl.RunJavaMethodTrans("com.tenwa.channelportal.action.alpha.RentDormantAction","saveRentDormantAction","flowUnid=<%=flowunid%>,contractDate="+contract_date+",zcContractNum="+zcContractNum);
|
||||
// alert("休眠还款协议编号为:" + result);
|
||||
//检查是否进行过变更
|
||||
@ -193,6 +222,9 @@ function cancelChange(){
|
||||
function run()
|
||||
{
|
||||
var result = AsControl.RunJavaMethodTrans("com.tenwa.reckon.executor.CreateTransactionExecutor","runRentdormant","flowunid=<%=flowunid%>,plannumber=<%=paymentNumber%>,productId=<%=ProductId%>,calType=pay_process");
|
||||
if (result.result === 'false') {
|
||||
alert('测算失败: ' + result.msg);
|
||||
}
|
||||
window.location.href=window.location.href;
|
||||
}
|
||||
|
||||
@ -214,5 +246,120 @@ function startListChange(){
|
||||
}
|
||||
}
|
||||
|
||||
function changeType() {
|
||||
const changeType = getItemValue(0, 0, 'CHANGE_TYPE');
|
||||
if (changeType) {
|
||||
const startList = getItemValue(0, 0, 'START_LIST');
|
||||
const endList = getItemValue(0, 0, 'END_LIST');
|
||||
const dormantYearRate = getItemValue(0, 0, 'DORMANT_YEAR_RATE');
|
||||
const delayStartList = getItemValue(0, 0, 'DELAY_START_LIST');
|
||||
const delayEndList = getItemValue(0, 0, 'DELAY_END_LIST');
|
||||
switch (changeType) {
|
||||
case 'dormancy':
|
||||
hideItem(0, 'DELAY_START_LIST');
|
||||
setItemRequired(0, 'DELAY_START_LIST', false);
|
||||
if (delayStartList) {
|
||||
setItemValue(0, 0, 'DELAY_START_LIST', '');
|
||||
}
|
||||
hideItem(0, 'DELAY_END_LIST');
|
||||
setItemRequired(0, 'DELAY_END_LIST', false);
|
||||
if (delayEndList) {
|
||||
setItemValue(0, 0, 'DELAY_END_LIST', '');
|
||||
}
|
||||
showItem(0, 'START_LIST');
|
||||
setItemRequired(0, 'START_LIST', true);
|
||||
showItem(0, 'END_LIST');
|
||||
setItemRequired(0, 'END_LIST', true);
|
||||
showItem(0, 'DORMANT_YEAR_RATE');
|
||||
setItemRequired(0, 'DORMANT_YEAR_RATE', true);
|
||||
break;
|
||||
case "delay":
|
||||
hideItem(0, 'START_LIST');
|
||||
setItemRequired(0, 'START_LIST', false);
|
||||
if (startList) {
|
||||
setItemValue(0, 0, 'START_LIST', '');
|
||||
}
|
||||
hideItem(0, 'END_LIST');
|
||||
setItemRequired(0, 'END_LIST', false);
|
||||
if (endList) {
|
||||
setItemValue(0, 0, 'END_LIST', '');
|
||||
}
|
||||
hideItem(0, 'DORMANT_YEAR_RATE');
|
||||
setItemRequired(0, 'DORMANT_YEAR_RATE', false);
|
||||
if (dormantYearRate) {
|
||||
setItemValue(0, 0, 'DORMANT_YEAR_RATE', '');
|
||||
}
|
||||
showItem(0, 'DELAY_START_LIST');
|
||||
setItemRequired(0, 'DELAY_START_LIST', true);
|
||||
showItem(0, 'DELAY_END_LIST');
|
||||
setItemRequired(0, 'DELAY_END_LIST', true);
|
||||
break;
|
||||
case 'dormancy_delay':
|
||||
showItem(0, 'START_LIST');
|
||||
setItemRequired(0, 'START_LIST', true);
|
||||
showItem(0, 'END_LIST');
|
||||
setItemRequired(0, 'END_LIST', true);
|
||||
showItem(0, 'DORMANT_YEAR_RATE');
|
||||
setItemRequired(0, 'DORMANT_YEAR_RATE', true);
|
||||
showItem(0, 'DELAY_START_LIST');
|
||||
setItemRequired(0, 'DELAY_START_LIST', true);
|
||||
showItem(0, 'DELAY_END_LIST');
|
||||
setItemRequired(0, 'DELAY_END_LIST', true);
|
||||
setItemRequired(0, 'END_LIST', false);
|
||||
if (!endList) {
|
||||
setItemValue(0, 0, 'DELAY_START_LIST', '');
|
||||
setItemValue(0, 0, 'DELAY_END_LIST', '');
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function changeDelayStartList() {
|
||||
const changeType = getItemValue(0, 0, 'CHANGE_TYPE');
|
||||
const endList = getItemValue(0, 0, 'END_LIST');
|
||||
const delayStartList = getItemValue(0, 0, 'DELAY_START_LIST');
|
||||
if (changeType === 'dormancy_delay') {
|
||||
if (!endList) {
|
||||
alert('请先填写休眠结束期次');
|
||||
setItemValue(0, 0, 'DELAY_START_LIST', '');
|
||||
return;
|
||||
}
|
||||
if (Number(delayStartList) <= Number(endList)) {
|
||||
alert('延期开始期次必须大于休眠结束期次');
|
||||
setItemValue(0, 0, 'DELAY_START_LIST', '');
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (delayStartList !== '') {
|
||||
if (Number(delayStartList) <= 0) {
|
||||
alert('延期开始期次必须大于0');
|
||||
setItemValue(0, 0, 'DELAY_START_LIST', '');
|
||||
} else {
|
||||
const result = AsControl.RunJavaMethod("com.tenwa.reckon.executor.RentCalHelper", "findPlanDateByRentList", "paymentnumber=<%=paymentNumber%>,startList=" + delayStartList);
|
||||
if(result.result !== 'true') {
|
||||
alert(result.message);
|
||||
setItemValue(0 ,0, 'DELAY_START_LIST', '');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function changeDelayEndList() {
|
||||
const delayStartList = getItemValue(0, 0, 'DELAY_START_LIST');
|
||||
if (delayStartList === '') {
|
||||
alert('请先填写延期开始期次');
|
||||
setItemValue(0, 0, 'DELAY_END_LIST', '');
|
||||
return;
|
||||
}
|
||||
const delayEndList = getItemValue(0, 0, 'DELAY_END_LIST');
|
||||
if (delayEndList !== '') {
|
||||
if (Number(delayEndList) < Number(delayStartList)) {
|
||||
alert('延期后总期数必须大于或等于延期开始期次');
|
||||
setItemValue(0, 0, 'DELAY_END_LIST', '');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
<%@ include file="/Frame/resources/include/include_end.jspf"%>
|
||||
|
||||
@ -4688,6 +4688,10 @@
|
||||
<attribute name="UPDATEORGID" label="更新部门" type="STRING" length="32"/>
|
||||
<attribute name="UPDATETIME" label="更新时间" type="STRING" length="32"/>
|
||||
<attribute name="IRR_OLD" label="休眠变更前IRR" type="DOUBLE" length="22" scale="6"/>
|
||||
|
||||
<attribute name="CHANGE_TYPE" label="变更类型" type="STRING" length="32"/>
|
||||
<attribute name="DELAY_START_LIST" label="延期开始期次" type="STRING" length="20"/>
|
||||
<attribute name="DELAY_END_LIST" label="延期后总期数" type="STRING" length="20" />
|
||||
</attributes>
|
||||
<manager>
|
||||
<managerProperties>
|
||||
@ -4712,6 +4716,10 @@
|
||||
<attribute name="UPDATEORGID" label="更新部门" type="STRING" length="32"/>
|
||||
<attribute name="UPDATETIME" label="更新时间" type="STRING" length="32"/>
|
||||
<attribute name="IRR_OLD" label="休眠变更前IRR" type="DOUBLE" length="22" scale="6"/>
|
||||
|
||||
<attribute name="CHANGE_TYPE" label="变更类型" type="STRING" length="32"/>
|
||||
<attribute name="DELAY_START_LIST" label="延期开始期次" type="STRING" length="20"/>
|
||||
<attribute name="DELAY_END_LIST" label="延期后总期数" type="STRING" length="20" />
|
||||
</attributes>
|
||||
<manager>
|
||||
<managerProperties>
|
||||
|
||||
@ -8,6 +8,7 @@ import com.amarsoft.awe.util.ASResultSet;
|
||||
import com.amarsoft.awe.util.SqlObject;
|
||||
import com.tenwa.comm.exception.BusinessException;
|
||||
import com.tenwa.comm.util.jboutil.DataOperatorUtil;
|
||||
import com.tenwa.jbo.manager.DataUtil;
|
||||
import com.tenwa.lease.flow.comm.service.LeaseFlowBaseService;
|
||||
import com.tenwa.lease.flow.comm.service.ServiceOperatorEnum;
|
||||
import com.tenwa.lease.flow.comm.serviceImp.LeaseFlowBaseServiceImp;
|
||||
@ -37,7 +38,6 @@ import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author chuang 租金测算主入口
|
||||
*/
|
||||
public class CreateTransactionExecutor implements Transaction {
|
||||
@ -263,8 +263,6 @@ public class CreateTransactionExecutor implements Transaction {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 起租测算
|
||||
*/
|
||||
@ -306,6 +304,7 @@ public class CreateTransactionExecutor implements Transaction {
|
||||
|
||||
/**
|
||||
* 车贷起租测算
|
||||
*
|
||||
* @param Sqlca
|
||||
* @return
|
||||
* @throws Exception
|
||||
@ -375,13 +374,13 @@ public class CreateTransactionExecutor implements Transaction {
|
||||
this.setCashFlow(this.plannumber, this.productId, Sqlca);
|
||||
|
||||
|
||||
|
||||
}
|
||||
return "success";
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入分润计划
|
||||
*
|
||||
* @param splittingRatio,Sqlca
|
||||
* @return
|
||||
* @throws JBOException
|
||||
@ -486,6 +485,7 @@ public class CreateTransactionExecutor implements Transaction {
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void insertRentPlan_SP_Flexible(String ratio, Transaction Sqlca) {
|
||||
|
||||
}
|
||||
@ -534,6 +534,7 @@ public class CreateTransactionExecutor implements Transaction {
|
||||
sql += " )t group by t.plan_date ";
|
||||
Sqlca.executeSQL(new SqlObject(sql));
|
||||
}
|
||||
|
||||
//中车产品获取还款日
|
||||
public static List<String> getPlanDateListZC(int incomeNumber, String incomeIntervalMonth, String startDate) throws ParseException {
|
||||
List<String> planDate = new ArrayList<String>();
|
||||
@ -555,6 +556,7 @@ public class CreateTransactionExecutor implements Transaction {
|
||||
}
|
||||
return planDate;
|
||||
}
|
||||
|
||||
//固定还款日
|
||||
public static List<String> getPlanDateListFixed(int incomeNumber, String periodType, String incomeIntervalMonth, String startDate) throws ParseException {
|
||||
List<String> planDate = new ArrayList<String>();
|
||||
@ -660,6 +662,7 @@ public class CreateTransactionExecutor implements Transaction {
|
||||
|
||||
/**
|
||||
* 删除方案
|
||||
*
|
||||
* @param tx
|
||||
* @return
|
||||
*/
|
||||
@ -683,6 +686,7 @@ public class CreateTransactionExecutor implements Transaction {
|
||||
|
||||
/**
|
||||
* 删除付款前提
|
||||
*
|
||||
* @param flowunid
|
||||
* @param planCName
|
||||
* @param planCValue
|
||||
@ -749,6 +753,7 @@ public class CreateTransactionExecutor implements Transaction {
|
||||
FundFundPlanExecutor fundFundExecutor = new FundFundPlanExecutor();
|
||||
fundFundExecutor.run(bean.getCb(), bean, planBean, tx);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createFundPlanTerminate(FundRentPlanBean planBean, TabCalBean bean, JBOTransaction tx, BizObject bo)
|
||||
throws Exception {
|
||||
@ -770,6 +775,7 @@ public class CreateTransactionExecutor implements Transaction {
|
||||
CalYearRateFromRent calYearRate = CalYearRateFromRent.getInstance();
|
||||
calYearRate.calDo(cb, bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返写商务条件 租赁期限 IRR 项目粗利 还款次数 净授信额
|
||||
*/
|
||||
@ -787,8 +793,6 @@ public class CreateTransactionExecutor implements Transaction {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 删除已知规则
|
||||
*/
|
||||
@ -803,8 +807,10 @@ public class CreateTransactionExecutor implements Transaction {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@ -814,8 +820,10 @@ public class CreateTransactionExecutor implements Transaction {
|
||||
bm.createQuery("delete from O where flowunid=:flowunid and " + this.planCName + "=:plannumber").setParameter("flowunid", this.flowunid).setParameter("plannumber", this.plannumber).executeUpdate();
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 已知规则
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@ -887,24 +895,159 @@ public class CreateTransactionExecutor implements Transaction {
|
||||
cb = DictTools.getReversDict(cb);
|
||||
bean.setCb(cb);
|
||||
BizObject bo = JBOFactory.getFactory().getManager("jbo.app.tenwa.calc.LC_DORMANT_RENT_ADJUST_TEMP").createQuery("flowunid =:flowunid and payment_number=:payment_number").setParameter("flowunid", flowunid).setParameter("payment_number", plannumber).getSingleResult(false);
|
||||
String changeType = bo.getAttribute("CHANGE_TYPE").toString();
|
||||
int startList = bo.getAttribute("START_LIST").getInt();
|
||||
int endList = bo.getAttribute("END_LIST").getInt();
|
||||
int delayStartList = bo.getAttribute("DELAY_START_LIST").getInt();
|
||||
int delayEndList = bo.getAttribute("DELAY_END_LIST").getInt();
|
||||
if ("delay".equals(changeType)) {
|
||||
startList = delayStartList;
|
||||
endList = delayEndList;
|
||||
}
|
||||
if (changeType.contains("delay")) {
|
||||
DataUtil.executeUpdate("delete from lc_rent_plan_temp where flowunid = ? and payment_number = ? and plan_list > ?", tx, flowunid, plannumber, delayEndList);
|
||||
}
|
||||
String dormantYearRate = bo.getAttribute("DORMANT_YEAR_RATE").toString();
|
||||
BizObjectManager bomLRPT = JBOFactory.getFactory().getManager(LC_RENT_PLAN_TEMP.CLASS_NAME, tx);
|
||||
List<BizObject> bolLRPT = bomLRPT.createQuery("flowunid =:flowunid and payment_number=:payment_number order by plan_list").setParameter("flowunid", flowunid).setParameter("payment_number", plannumber).getResultList(true);
|
||||
if (changeType.contains("dormancy") && endList == bolLRPT.size()) {
|
||||
throw new Exception("休眠结束期次必须小于总期次");
|
||||
}
|
||||
String ALL_REMAIN_CORPUS = bolLRPT.get(startList - 1).getAttribute("ALL_REMAIN_CORPUS").toString();
|
||||
String CORPUS = bolLRPT.get(startList - 1).getAttribute("CORPUS").toString();
|
||||
BigDecimal allRemainCorpus = new BigDecimal(ALL_REMAIN_CORPUS).add(new BigDecimal(CORPUS));
|
||||
BigDecimal dormantInterest = allRemainCorpus.multiply(new BigDecimal(dormantYearRate)).divide(new BigDecimal("100")).divide(new BigDecimal("12"),2,BigDecimal.ROUND_HALF_UP);
|
||||
BigDecimal dormantInterest = "delay".equals(changeType) ? BigDecimal.ZERO : allRemainCorpus.multiply(new BigDecimal(dormantYearRate)).divide(new BigDecimal("100")).divide(new BigDecimal("12"), 2, BigDecimal.ROUND_HALF_UP);
|
||||
//尾款
|
||||
BigDecimal finalPayment = new BigDecimal(cb.getFinalPayment() == null ? "0" : cb.getFinalPayment());
|
||||
//期利率
|
||||
String preRate = RateTools.getPreRate(cb.getYearRate(), cb.getIncomeNumberYear(), cb.getRateAdjustType());
|
||||
int afreshSize = bolLRPT.size()-endList;
|
||||
int afreshSize;
|
||||
if ("delay".equals(changeType)) {
|
||||
afreshSize = endList - startList + 1;
|
||||
} else {
|
||||
afreshSize = bolLRPT.size() - endList;
|
||||
}
|
||||
|
||||
List<String> rentList = new ArrayList<>();
|
||||
List<String> corpusList = new ArrayList<>();
|
||||
List<String> interestList = new ArrayList<>();
|
||||
createPlanData(cb, allRemainCorpus, finalPayment, afreshSize, preRate, rentList, corpusList, interestList);
|
||||
|
||||
FundRentPlanBean frpb = new FundRentPlanBean();
|
||||
frpb.setRentList(rentList);
|
||||
frpb.setCorpusBusinessList(corpusList);
|
||||
frpb.setInterestBusinessList(interestList);
|
||||
|
||||
// 加载调整信息列表
|
||||
RentPlanServiceImpl rpsi = new RentPlanServiceImpl();
|
||||
rpsi.adjustLastRentPlan(frpb, allRemainCorpus.toString(), cb.getEquipEndValue());
|
||||
|
||||
// 加载本金余额列表
|
||||
List<String> corpusOverageBusinessList = TransRateHelper.getCorpusOvergeList(allRemainCorpus.toString(), frpb.getCorpusBusinessList());
|
||||
|
||||
if ("dormancy_delay".equals(changeType)) {
|
||||
List<String> otherRentList = new ArrayList<>();
|
||||
List<String> otherCorpusList = new ArrayList<>();
|
||||
List<String> otherInterestList = new ArrayList<>();
|
||||
afreshSize = delayEndList - delayStartList + 1;
|
||||
int startIndex = delayStartList - endList - 1;
|
||||
allRemainCorpus = new BigDecimal(corpusOverageBusinessList.get(startIndex)).add(new BigDecimal(corpusList.get(startIndex)));
|
||||
createPlanData(cb, allRemainCorpus, finalPayment, afreshSize, preRate, otherRentList, otherCorpusList, otherInterestList);
|
||||
|
||||
FundRentPlanBean otherFrpb = new FundRentPlanBean();
|
||||
otherFrpb.setRentList(otherRentList);
|
||||
otherFrpb.setCorpusBusinessList(otherCorpusList);
|
||||
otherFrpb.setInterestBusinessList(otherInterestList);
|
||||
|
||||
// 加载调整信息列表
|
||||
RentPlanServiceImpl otherRpsi = new RentPlanServiceImpl();
|
||||
otherRpsi.adjustLastRentPlan(otherFrpb, allRemainCorpus.toString(), cb.getEquipEndValue());
|
||||
|
||||
// 加载本金余额列表
|
||||
List<String> otherCorpusOverageBusinessList = TransRateHelper.getCorpusOvergeList(allRemainCorpus.toString(), otherFrpb.getCorpusBusinessList());
|
||||
|
||||
frpb.setRentList(frpb.getRentList().subList(0, startIndex));
|
||||
frpb.getRentList().addAll(otherFrpb.getRentList());
|
||||
frpb.setCorpusBusinessList(frpb.getCorpusBusinessList().subList(0, startIndex));
|
||||
frpb.getCorpusBusinessList().addAll(otherFrpb.getCorpusBusinessList());
|
||||
frpb.setInterestBusinessList(frpb.getInterestBusinessList().subList(0, startIndex));
|
||||
frpb.getInterestBusinessList().addAll(otherFrpb.getInterestBusinessList());
|
||||
corpusOverageBusinessList = corpusOverageBusinessList.subList(0, startIndex);
|
||||
corpusOverageBusinessList.addAll(otherCorpusOverageBusinessList);
|
||||
}
|
||||
|
||||
int n = 0;
|
||||
for (int i = 0; i < bolLRPT.size(); i++) {
|
||||
int planNo = bolLRPT.get(i).getAttribute("PLAN_LIST").getInt();
|
||||
if (changeType.contains("dormancy") && planNo >= startList && planNo <= endList) {
|
||||
String interest = dormantInterest.toString();
|
||||
String remainCorpus = allRemainCorpus.toString();
|
||||
bolLRPT.get(i).setAttributeValue("RENT", interest);
|
||||
bolLRPT.get(i).setAttributeValue("CORPUS", "0.00");
|
||||
bolLRPT.get(i).setAttributeValue("INTEREST", interest);
|
||||
bolLRPT.get(i).setAttributeValue("CORPUS_BUSINESS", "0.00");
|
||||
bolLRPT.get(i).setAttributeValue("INTEREST_BUSINESS", interest);
|
||||
bolLRPT.get(i).setAttributeValue("ALL_REMAIN_CORPUS", remainCorpus);
|
||||
} else if (changeType.contains("dormancy") && planNo > endList || changeType.contains("delay") && planNo >= delayStartList) {
|
||||
int j;
|
||||
if ("dormancy".equals(changeType)) {
|
||||
j = endList;
|
||||
} else if ("delay".equals(changeType)) {
|
||||
j = delayStartList - 1;
|
||||
} else {
|
||||
if (planNo > endList && planNo < delayStartList) {
|
||||
j = endList;
|
||||
} else {
|
||||
j = i - n;
|
||||
}
|
||||
}
|
||||
bolLRPT.get(i).setAttributeValue("RENT", frpb.getRentList().get(i - j));
|
||||
bolLRPT.get(i).setAttributeValue("CORPUS", frpb.getCorpusBusinessList().get(i - j));
|
||||
bolLRPT.get(i).setAttributeValue("INTEREST", frpb.getInterestBusinessList().get(i - j));
|
||||
bolLRPT.get(i).setAttributeValue("CORPUS_BUSINESS", frpb.getCorpusBusinessList().get(i - j));
|
||||
bolLRPT.get(i).setAttributeValue("INTEREST_BUSINESS", frpb.getInterestBusinessList().get(i - j));
|
||||
bolLRPT.get(i).setAttributeValue("ALL_REMAIN_CORPUS", corpusOverageBusinessList.get(i - j));
|
||||
n ++;
|
||||
}
|
||||
bomLRPT.saveObject(bolLRPT.get(i));
|
||||
}
|
||||
int oldPlanSize = bolLRPT.size();
|
||||
if (changeType.contains("delay") && delayEndList > oldPlanSize) {
|
||||
BizObject bizObject = bomLRPT.newObject();
|
||||
DataOperatorUtil.coptyJBOPropertyNoKey(bolLRPT.get(0), bizObject);
|
||||
for (int i = 0; i < delayEndList - oldPlanSize; i ++) {
|
||||
BizObject boR = (BizObject) bizObject.clone();
|
||||
boR.setAttributeValue("PLAN_LIST", oldPlanSize + i + 1);
|
||||
boR.setAttributeValue("RENT", frpb.getRentList().get(n + i));
|
||||
boR.setAttributeValue("CORPUS", frpb.getCorpusBusinessList().get(n + i));
|
||||
boR.setAttributeValue("INTEREST", frpb.getInterestBusinessList().get(n + i));
|
||||
boR.setAttributeValue("CORPUS_BUSINESS", frpb.getCorpusBusinessList().get(n + i));
|
||||
boR.setAttributeValue("INTEREST_BUSINESS", frpb.getInterestBusinessList().get(n + i));
|
||||
boR.setAttributeValue("ALL_REMAIN_CORPUS", corpusOverageBusinessList.get(n + i));
|
||||
bomLRPT.saveObject(boR);
|
||||
}
|
||||
}
|
||||
String irr = this.createCashFlow(bean, tx);
|
||||
BizObjectManager bomLCCT = JBOFactory.getFactory().getManager(LC_CALC_CONDITION_TEMP.CLASS_NAME, tx);
|
||||
BizObject boLCCT = bomLCCT.createQuery("flowunid =:flowunid and payment_number=:payment_number").setParameter("flowunid", flowunid).setParameter("payment_number", plannumber).getSingleResult(true);
|
||||
boLCCT.setAttributeValue("IRR", irr);
|
||||
bomLCCT.saveObject(boLCCT);
|
||||
|
||||
jsonObject.appendElement("result", "true");
|
||||
} catch (Exception e) {
|
||||
tx.rollback();
|
||||
e.printStackTrace();
|
||||
jsonObject.appendElement("result", "false");
|
||||
jsonObject.appendElement("msg", e.getMessage());
|
||||
} finally {
|
||||
if (tx != null) {
|
||||
tx.commit();
|
||||
}
|
||||
}
|
||||
return JSONEncoder.encode(jsonObject);
|
||||
}
|
||||
|
||||
public void createPlanData(ConditionBean cb, BigDecimal allRemainCorpus, BigDecimal finalPayment, int afreshSize, String preRate, List<String> rentList, List<String> corpusList, List<String> interestList) {
|
||||
// TODO 等额本金时的休眠(待测试)
|
||||
if ("even_corpus".equals(cb.getSettleMethod())) {
|
||||
BigDecimal corpus = allRemainCorpus.subtract(new BigDecimal(cb.getEquipEndValue())).subtract(finalPayment).divide(new BigDecimal(afreshSize), Scale.CORPUS_SCALE, BigDecimal.ROUND_HALF_EVEN);
|
||||
@ -926,65 +1069,14 @@ public class CreateTransactionExecutor implements Transaction {
|
||||
}
|
||||
// 加载利息列表
|
||||
InterestCalServiceImpl icsi = new InterestCalServiceImpl();
|
||||
interestList = icsi.getInterestList(rentList, allRemainCorpus.toString(), cb.getYearRate(), cb.getPeriodType(), cb.getGrace(), cb.getIncomeNumberYear(), cb.getEquipEndValue(),cb.getRateAdjustType());
|
||||
interestList.addAll(icsi.getInterestList(rentList, allRemainCorpus.toString(), cb.getYearRate(), cb.getPeriodType(), cb.getGrace(), cb.getIncomeNumberYear(), cb.getEquipEndValue(), cb.getRateAdjustType()));
|
||||
|
||||
// 加载本金列表
|
||||
CorpusServiceImpl csi = new CorpusServiceImpl();
|
||||
corpusList = csi.getCorpusList(rentList, interestList);
|
||||
}
|
||||
|
||||
FundRentPlanBean frpb = new FundRentPlanBean();
|
||||
frpb.setRentList(rentList);
|
||||
frpb.setCorpusBusinessList(corpusList);
|
||||
frpb.setInterestBusinessList(interestList);
|
||||
|
||||
// 加载调整信息列表
|
||||
RentPlanServiceImpl rpsi = new RentPlanServiceImpl();
|
||||
rpsi.adjustLastRentPlan(frpb, allRemainCorpus.toString(), cb.getEquipEndValue());
|
||||
|
||||
// 加载本金余额列表
|
||||
List<String> corpusOverageBusinessList = TransRateHelper.getCorpusOvergeList(allRemainCorpus.toString(), frpb.getCorpusBusinessList());
|
||||
|
||||
for(int i=0;i<bolLRPT.size();i++){
|
||||
int planNo = bolLRPT.get(i).getAttribute("PLAN_LIST").getInt();
|
||||
if(planNo>=startList&&planNo<=endList){
|
||||
String interest = dormantInterest.toString();
|
||||
String remainCorpus = allRemainCorpus.toString();
|
||||
bolLRPT.get(i).setAttributeValue("RENT",interest);
|
||||
bolLRPT.get(i).setAttributeValue("CORPUS","0.00");
|
||||
bolLRPT.get(i).setAttributeValue("INTEREST",interest);
|
||||
bolLRPT.get(i).setAttributeValue("CORPUS_BUSINESS","0.00");
|
||||
bolLRPT.get(i).setAttributeValue("INTEREST_BUSINESS",interest);
|
||||
bolLRPT.get(i).setAttributeValue("ALL_REMAIN_CORPUS",remainCorpus);
|
||||
}else if (planNo>endList){
|
||||
bolLRPT.get(i).setAttributeValue("RENT",frpb.getRentList().get(i-endList));
|
||||
bolLRPT.get(i).setAttributeValue("CORPUS",frpb.getCorpusBusinessList().get(i-endList));
|
||||
bolLRPT.get(i).setAttributeValue("INTEREST",frpb.getInterestBusinessList().get(i-endList));
|
||||
bolLRPT.get(i).setAttributeValue("CORPUS_BUSINESS",frpb.getCorpusBusinessList().get(i-endList));
|
||||
bolLRPT.get(i).setAttributeValue("INTEREST_BUSINESS",frpb.getInterestBusinessList().get(i-endList));
|
||||
bolLRPT.get(i).setAttributeValue("ALL_REMAIN_CORPUS",corpusOverageBusinessList.get(i-endList));
|
||||
|
||||
}
|
||||
bomLRPT.saveObject(bolLRPT.get(i));
|
||||
}
|
||||
String irr = this.createCashFlow(bean,tx);
|
||||
BizObjectManager bomLCCT = JBOFactory.getFactory().getManager(LC_CALC_CONDITION_TEMP.CLASS_NAME,tx);
|
||||
BizObject boLCCT = bomLCCT.createQuery("flowunid =:flowunid and payment_number=:payment_number").setParameter("flowunid", flowunid).setParameter("payment_number", plannumber).getSingleResult(true);
|
||||
boLCCT.setAttributeValue("IRR",irr);
|
||||
bomLCCT.saveObject(boLCCT);
|
||||
|
||||
jsonObject.appendElement("result", "true");
|
||||
} catch (Exception e) {
|
||||
tx.rollback();
|
||||
e.printStackTrace();
|
||||
jsonObject.appendElement("result", "false");
|
||||
}finally{
|
||||
if(tx!=null){
|
||||
tx.commit();
|
||||
corpusList.addAll(csi.getCorpusList(rentList, interestList));
|
||||
}
|
||||
}
|
||||
return JSONEncoder.encode(jsonObject);
|
||||
}
|
||||
|
||||
public void reloadConditon(JBOTransaction tx) throws Exception {
|
||||
//重新复制正式表租金计划到临时表
|
||||
Map<String, String> fromCondition = new HashMap<String, String>();
|
||||
@ -999,6 +1091,7 @@ public class CreateTransactionExecutor implements Transaction {
|
||||
DataOperatorUtil.copyJBOSet(LC_FUND_PLAN.CLASS_NAME, fromCondition, LC_FUND_PLAN_TEMP.CLASS_NAME, toCondition, otherProperty, null, tx);
|
||||
DataOperatorUtil.copyJBOSet(LC_CASH_FLOW.CLASS_NAME, fromCondition, LC_CASH_FLOW_TEMP.CLASS_NAME, toCondition, otherProperty, null, tx);
|
||||
}
|
||||
|
||||
/**
|
||||
* 租金计划变更
|
||||
*/
|
||||
@ -1038,6 +1131,7 @@ public class CreateTransactionExecutor implements Transaction {
|
||||
}
|
||||
return JSONEncoder.encode(jsonObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消变更
|
||||
*/
|
||||
@ -1068,6 +1162,7 @@ public class CreateTransactionExecutor implements Transaction {
|
||||
return "true";
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断租金变更信息是否存在
|
||||
*/
|
||||
@ -1102,6 +1197,7 @@ public class CreateTransactionExecutor implements Transaction {
|
||||
return "false";
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public String updateConditionFund() throws Exception {
|
||||
List<BizObject> funds = JBOFactory.createBizObjectQuery(LC_FUND_PLAN_TEMP.CLASS_NAME, "flowunid=:flowunid and payment_number=:paymentnumber").setParameter("flowunid", this.flowunid).setParameter("paymentnumber", this.plannumber).getResultList(false);
|
||||
@ -1153,8 +1249,10 @@ public class CreateTransactionExecutor implements Transaction {
|
||||
bm.saveObject(condition);
|
||||
return "true";
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新现金流
|
||||
*
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@ -1188,8 +1286,10 @@ public class CreateTransactionExecutor implements Transaction {
|
||||
}
|
||||
return JSONEncoder.encode(jsonObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入租金表 本金表
|
||||
*
|
||||
* @param fileName
|
||||
* @param sourceFile
|
||||
* @param sourceMap
|
||||
@ -1268,7 +1368,7 @@ public class CreateTransactionExecutor implements Transaction {
|
||||
|
||||
/**
|
||||
* 不规则测算 导入租金计划
|
||||
* */
|
||||
*/
|
||||
@Override
|
||||
public int importRentPlan(String fileName, InputStream sourceFile, Map<String, String> sourceMap) throws Exception {
|
||||
JBOTransaction tx = null;
|
||||
@ -1310,8 +1410,10 @@ public class CreateTransactionExecutor implements Transaction {
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 租金计划变更 更新现金流前先计算增值税
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
* @throws Exception
|
||||
@ -1354,8 +1456,10 @@ public class CreateTransactionExecutor implements Transaction {
|
||||
}
|
||||
return "true";
|
||||
}
|
||||
|
||||
/**
|
||||
* 提前结清网银考表操作
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String copyLCEbankTemp(JBOTransaction tx) throws Exception {
|
||||
@ -1381,8 +1485,10 @@ public class CreateTransactionExecutor implements Transaction {
|
||||
String sMessage = "true";
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除对应核销过程表
|
||||
*
|
||||
* @param tx
|
||||
* @return
|
||||
* @throws Exception
|
||||
@ -1394,6 +1500,7 @@ public class CreateTransactionExecutor implements Transaction {
|
||||
lepManage.createQuery("delete from O where flowunid=:flowunid and EBANK_NUMBER=:ebanknumber").setParameter("flowunid", flowunid).setParameter("ebanknumber", le.getAttribute("ID").getString()).executeUpdate();
|
||||
return "true";
|
||||
}
|
||||
|
||||
//提前结清更新LC_EBANK_TEMP表
|
||||
public String updateEbank(JBOTransaction tx) throws Exception {
|
||||
BizObjectManager letManage = JBOFactory.getBizObjectManager(LC_EBANK_TEMP.CLASS_NAME, tx);
|
||||
@ -1473,7 +1580,6 @@ public class CreateTransactionExecutor implements Transaction {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getCleanLeasemoney() {
|
||||
return cleanLeasemoney;
|
||||
}
|
||||
@ -1483,7 +1589,6 @@ public class CreateTransactionExecutor implements Transaction {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getEquipEndValue() {
|
||||
return equipEndValue;
|
||||
}
|
||||
@ -1571,9 +1676,11 @@ public class CreateTransactionExecutor implements Transaction {
|
||||
public void setProjectId(String projectId) {
|
||||
this.projectId = projectId;
|
||||
}
|
||||
|
||||
public String getDistributorId() {
|
||||
return distributorId;
|
||||
}
|
||||
|
||||
public void setDistributorId(String distributorId) {
|
||||
this.distributorId = distributorId;
|
||||
}
|
||||
|
||||
@ -78,6 +78,11 @@ public class RentCalHelper {
|
||||
BizObject rentplan=JBOFactory.createBizObjectQuery(LC_RENT_PLAN.CLASS_NAME,"PAYMENT_NUMBER=:paymentnumber and plan_list=:planlist")
|
||||
.setParameter("paymentnumber", paymentnumber).setParameter("planlist", startList).getSingleResult(false);
|
||||
|
||||
if (rentplan == null) {
|
||||
jsonObject.appendElement("result", "false");
|
||||
jsonObject.appendElement("message","填写的期次以超出租金计划期次,请重新填写");
|
||||
return JSONEncoder.encode(jsonObject);
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
List<BizObject> rentincome=JBOFactory.createBizObjectQuery(LC_RENT_INCOME.CLASS_NAME,"plan_id=:planid and ROLL_BACK='0'").setParameter("planid", rentplan.getAttribute("ID").getString()).getResultList(false);
|
||||
|
||||
@ -89,7 +94,7 @@ public class RentCalHelper {
|
||||
jsonObject.appendElement("result", "true");
|
||||
jsonObject.appendElement("message",rentplan.getAttribute("plan_date").getString());
|
||||
}
|
||||
} catch (JBOException e) {
|
||||
} catch (Exception e) {
|
||||
jsonObject.appendElement("result", "false");
|
||||
jsonObject.appendElement("message","服务器繁忙,请稍后再试!");
|
||||
e.printStackTrace();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user