增加起租后展期测算和变更提前结清算法

This commit is contained in:
luojian 2018-08-02 17:05:05 +08:00
parent 5d09795473
commit 83c9f13b8a
11 changed files with 68 additions and 27 deletions

View File

@ -17,13 +17,14 @@
String taskno = CurPage.getParameter("TaskNo");
String settleMethod="";
String rentOrRate="";
BizObject condition=null;
if(plannumber==null){
BizObject condition=JBOFactory.createBizObjectQuery("jbo.app.tenwa.calc.LC_CALC_CONDITION_TEMP","flowunid=:flowunid").setParameter("flowunid", flowunid).getSingleResult(false);
condition=JBOFactory.createBizObjectQuery("jbo.app.tenwa.calc.LC_CALC_CONDITION_TEMP","flowunid=:flowunid").setParameter("flowunid", flowunid).getSingleResult(false);
plannumber=condition.getAttribute("payment_number").getString();
settleMethod=condition.getAttribute("SETTLE_METHOD").getString();
rentOrRate=condition.getAttribute("RENT_OR_RATE").getString();
}else{
BizObject condition=JBOFactory.createBizObjectQuery("jbo.app.tenwa.calc.LC_CALC_CONDITION_TEMP","flowunid=:flowunid and payment_number=:plannumber").setParameter("flowunid", flowunid).setParameter("plannumber", plannumber).getSingleResult(false);
condition=JBOFactory.createBizObjectQuery("jbo.app.tenwa.calc.LC_CALC_CONDITION_TEMP","flowunid=:flowunid and payment_number=:plannumber").setParameter("flowunid", flowunid).setParameter("plannumber", plannumber).getSingleResult(false);
settleMethod=condition.getAttribute("SETTLE_METHOD").getString();
rentOrRate=condition.getAttribute("RENT_OR_RATE").getString();
}
@ -120,12 +121,14 @@ $(function(){
function saveRecord(sPostEvents)
{
//检查是否进行过变更
var result = AsControl.RunJavaMethod("com.tenwa.reckon.executor.CreateTransactionExecutor","checkIsRentChange","flowunid=<%=flowunid%>,plannumber=<%=plannumber%>");
as_save("myiframe0","run()");
<%-- var result = AsControl.RunJavaMethod("com.tenwa.reckon.executor.CreateTransactionExecutor","checkIsRentChange","flowunid=<%=flowunid%>,plannumber=<%=plannumber%>");
if(result == 'true'){
as_save("myiframe0","run()");
}else{
alert('请先撤销变更,再进行变更操作!!!');
}
} --%>
}
function cancelChange(){

View File

@ -14,6 +14,7 @@
String plannumber=CurPage.getParameter("plannumber");
String ishistory=CurPage.getParameter("IsHistory");
String nodeNo=CurPage.getParameter("NodeNo");
String FlowNo=CurPage.getParameter("FlowNo");//流程名称
String taskno = CurPage.getParameter("TaskNo");
if(null!=ishistory&&ishistory.equals("true")){
doTemp.setDataQueryClass("com.tenwa.lease.flow.flowarchive.calcarchive.CalcCondtionInfoArachiveShow");//如果是历史则新显示历史数据
@ -63,14 +64,18 @@
dwTemp.replaceColumn("knowing_config", "<iframe type='iframe' id='frame_list_knowing' name=\"frame_list_knowing\" width=\"100%\" height=\"200px\" frameborder=\"0\" src=\""+sWebRootPath+"/Accounting/LoanSimulation/KnowConfigList.jsp?CompClientID="+compClientID+"&flowunid="+flowunid+"&plannumber="+plannumber+"&planCName="+planCName+"&IsHistory="+ishistory+"&NodeNo="+nodeNo+"&RightType="+RightType+"&calType="+calType+"\"></iframe>", CurPage.getObjectWindowOutput());
String sButtons[][] = {
{"true","","Button","保存","保存所有修改","as_save(0)","","","",""},
{"ContractOnhireCarChangeFlow".equals(FlowNo)?"false":"true","","Button","保存","保存所有修改","as_save(0)","","","",""},
};
%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%>
<script type="text/javascript">
var calcRules=eval("(<%=calcRules%>)");
$(function(){
document.getElementById('div_my0').innerHTML = '<div style="width:1160px;overflow: scroll;">'+document.getElementById('div_my0').innerHTML+'</div>';
changeSettleMethod();
try {
changeSettleMethod();
} catch (e) {
// TODO: handle exception
}
initYearRate();
});

View File

@ -28,12 +28,12 @@
String sButtons[][] =null;
sButtons=new String[][] {
{"true","","Button","新增","新增","newRecord()","","","","btn_icon_add",""},
{"true","","Button","修改","修改","viewAndEdit()","","","","btn_icon_detail",""},
{"true","","Button","删除","删除","deleteRecord()","","","","btn_icon_delete",""},
{"true","","Button","更新现金流","更新现金流","updateFlow()","","","","btn_icon_detail",""},
{"true","","Button","导入租金计划","导入租金计划","importRentPlan()","","","","btn_icon_detail",""},
{"true","","Button","模板下载","模板下载","downloadTemplate()","","","","btn_icon_set",""},
{"false","","Button","新增","新增","newRecord()","","","","btn_icon_add",""},
{"false","","Button","修改","修改","viewAndEdit()","","","","btn_icon_detail",""},
{"false","","Button","删除","删除","deleteRecord()","","","","btn_icon_delete",""},
{"false","","Button","更新现金流","更新现金流","updateFlow()","","","","btn_icon_detail",""},
{"false","","Button","导入租金计划","导入租金计划","importRentPlan()","","","","btn_icon_detail",""},
{"false","","Button","模板下载","模板下载","downloadTemplate()","","","","btn_icon_set",""},
};
%><%@include file="/Frame/resources/include/ui/include_list.jspf"%>
<script type="text/javascript">

View File

@ -50,9 +50,15 @@
dwTemp.replaceColumn("BaseInfo", "<iframe type='iframe' id='frame_list' name=\"frame_list\" width=\"100%\" height=\"630px\" frameborder=\"0\" src=\""+sWebRootPath+userll+compClientID+"\"></iframe>", CurPage.getObjectWindowOutput());
String sButtons[][] = null;
sButtons = new String[][]{
{"true","","Button","保存","保存所有修改","saveRend()","","","",""},
};
if(!"ContractOnhireCarChangeFlow".equals(FlowNo)){
sButtons = new String[][]{
{"true","","Button","保存","保存所有修改","saveRend()","","","",""},
};
}else{
sButtons = new String[][]{
{"false","","Button","保存","保存所有修改","saveRend()","","","",""},
};
}
sButtonPosition = "north";
%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%>
<script type="text/javascript">

View File

@ -80,7 +80,11 @@
setItemValue(0,getRow(),"FIST_RENT",terminateInfo.fist_rent);
setItemValue(0,getRow(),"FIST_CORPUS",terminateInfo.fist_corpus);
setItemValue(0,getRow(),"HANDLING_CHARGE",Number(terminateInfo.fist_corpus*0.05).toFixed(2));
setItemValue(0,getRow(),"REPAYMENT_INTEREST",terminateInfo.REPAYMENT_INTEREST);
if(terminateInfo.fist_rent>0){
setItemValue(0,getRow(),"REPAYMENT_INTEREST","0");
}else{
setItemValue(0,getRow(),"REPAYMENT_INTEREST",terminateInfo.REPAYMENT_INTEREST);
}
setItemValue(0,getRow(),"SDNOMINAL_PRICE","0");
setItemValue(0,getRow(),"SDHANDLING_CHARGE","0");
@ -166,7 +170,8 @@
setItemValue(0,getRow(),p,result[p]);
}
}
setItemValue(0,getRow(),"OTHER_IN","0");
setItemValue(0,getRow(),"OTHER_OUT","0");
});
</script>
<%@ include file="/Frame/resources/include/include_end.jspf"%>

View File

@ -31,6 +31,8 @@ public class ConditionBean implements Cloneable{
private String custId;//客户编号
private String plannumber;//方案编号
private int oldIncomeNumber;//原还款总期次
private Boolean deferStr=false;//是否展期
//*********************************************************************************授信条件开始
private String equipAmt;//设备款
@ -1716,4 +1718,17 @@ public class ConditionBean implements Cloneable{
public void setFinalPaymentMethod(String finalPaymentMethod) {
this.finalPaymentMethod = finalPaymentMethod;
}
public int getOldIncomeNumber() {
return oldIncomeNumber;
}
public void setOldIncomeNumber(int oldIncomeNumber) {
this.oldIncomeNumber = oldIncomeNumber;
}
public Boolean getDeferStr() {
return deferStr;
}
public void setDeferStr(Boolean deferStr) {
this.deferStr = deferStr;
}
}

View File

@ -532,6 +532,7 @@ public class CreateTransactionExecutor implements Transaction {
AdjustBean ab = ObjectConvertUtils.converBizObjectToBean(AdjustBean.class, bo);
RentChangeExe exe = new RentChangeExe(tx);
ConditionBean csOld=bean.getCb().clone();
csOld.setOldIncomeNumber(csOld.getIncomeNumber());
FundRentPlanBean rentPlan = exe.create(bean.getCb(), ab, bean);
//设置新的
csOld.setIncomeNumber(ab.getAdjustList());

View File

@ -159,7 +159,6 @@ public abstract class FundRentPlanExecutor {
bm.createQuery(sql).executeUpdate();
}
public abstract FundRentPlanBean create(TabCalBean tcb,Integer startList) throws Exception ;
public FundRentPlanBean createOnhire(TabCalBean tcb ) throws Exception {
ConditionBean cb = tcb.getCb();
// 查询他的租金计划
@ -212,6 +211,6 @@ public abstract class FundRentPlanExecutor {
retainage = retainage.add(new BigDecimal(cb.getFactoryAccessories()));
}
cb.setShare(share);
cb.setRetainage(retainage);
//cb.setRetainage(retainage);
}
}

View File

@ -145,7 +145,7 @@ public class RentCalHelper {
+ " sum(case when DATE_FORMAT(t.plandate,'%Y/%m/%d') > DATE_FORMAT('"+this.paydayAdjust+"','%Y/%m/%d') then t.remaininterest else 0 end ) remaininterest, "
+" sum(case when DATE_FORMAT(t.plandate,'%Y/%m/%d') > DATE_FORMAT('"+this.paydayAdjust+"','%Y/%m/%d') then t.corpus else 0 end ) remainfincorpus,"
+" sum(case when DATE_FORMAT( t.plandate,'%Y/%m/%d') > DATE_FORMAT('"+this.paydayAdjust+"','%Y/%m/%d') then t.interest else 0 end ) remainfininterest,"
+" sum(case when DATE_FORMAT( t.plandate,'%Y/%m/%d') <= DATE_FORMAT('"+this.paydayAdjust+"','%Y/%m/%d') then t.overduerent else 0 end ) overduerent,sum(case when t.cou< t.planlist and t.planlist-t.cou<=12-t.cou then t.rent else 0 end) fist_rent,"
+" sum(case when DATE_FORMAT( t.plandate,'%Y/%m/%d') < DATE_FORMAT('"+this.paydayAdjust+"','%Y/%m/%d') then t.overduerent else 0 end ) overduerent,sum(case when t.cou< t.planlist and t.planlist-t.cou<=12-t.cou then t.rent else 0 end) fist_rent,"
+ " sum(case when t.cou< t.planlist and t.planlist-t.cou>12-t.cou then t.corpus else 0 end) fist_corpus,"
+ " max( case when DATE_FORMAT(t.plandate, '%Y/%m/%d') < DATE_FORMAT('"+this.paydayAdjust+"','%Y/%m/%d') then t.plandate else '0' end) plandate"
+ " from ("
@ -156,7 +156,7 @@ public class RentCalHelper {
+ " t1.corpus,"
+ " t1.interest,"
+ " t1.plandate,"
+ " t1.planlist,IFNULL(t2.cou,0) cou"
+ " t1.planlist,IFNULL(t2.planlist,0) cou"
+ " from ("
+ " select cfrp.plan_date plandate,"
+ " cfrp.plan_list planlist,"
@ -174,7 +174,7 @@ public class RentCalHelper {
+ " ,sum(cfri.interest ) sumincomeinterest,"
+ " sum( cfri.rent ) sumincomerent,"
+ " min(cfri.contract_id) contractid,"
+ " cfri.plan_list planlist,count(1) cou"
+ " cfri.plan_list planlist "
+ " from LC_RENT_INCOME cfri "
+ " where cfri.contract_id = ? and payment_number=?"
+ " group by cfri.plan_list"

View File

@ -72,9 +72,12 @@ public class RentChangeExe {
FundRentPlanBean frpb = this.before(cb, ab, tcb);
FundRentPlanExecutor executor = this.getPmtExe(cb);
// 得到正常pmt租金测算后的租金计划
frpb = executor.create(tcb,startList);
if(ab.getAdjustList()>cb.getOldIncomeNumber()){
cb.setDeferStr(true);
frpb = executor.create(tcb,startList);
}else{
frpb = executor.createOnhire(tcb);
}
//重置起租日
String start_date="";
if(ab.getPaydayAdjust()==null||ab.getPaydayAdjust().equals("")){
@ -85,7 +88,7 @@ public class RentChangeExe {
if(ab.getStartList()==1){
start_date=cb.getStartDate();
}else{
start_date=frpb.getPlanDateList().get(ab.getStartList()-2).toString();
start_date=ab.getPaydayAdjust();
}
}
cb.setStartDate(start_date);

View File

@ -73,7 +73,11 @@ public class RentalServiceImpl {
}else{
BigDecimal finalPayment = new BigDecimal(cb.getFinalPayment());
if(finalPayment.compareTo(BigDecimal.ZERO) != 0) {
rent = new BigDecimal(RentTools.getPMT(preRate, cb.getIncomeNumber() + "", cleanLeaseMoney, finalPayment.toString(), cb.getPeriodType())).toString();
if(cb.getDeferStr()){
rent = new BigDecimal(RentTools.getPMT(preRate, cb.getIncomeNumber() + "", cleanLeaseMoney, "0", cb.getPeriodType())).toString();
}else{
rent = new BigDecimal(RentTools.getPMT(preRate, cb.getIncomeNumber() + "", cleanLeaseMoney, finalPayment.toString(), cb.getPeriodType())).toString();
}
} else {
rent = new BigDecimal(RentTools.getPMT(preRate, cb.getIncomeNumber() + "", cleanLeaseMoney, cb.getEquipEndValue(), cb.getPeriodType())).toString();
}