20220909休眠流程增加延期逻辑

This commit is contained in:
zhulh 2022-09-09 15:51:34 +08:00
parent 70528e70fa
commit 5652e825b8
4 changed files with 1679 additions and 1412 deletions

View File

@ -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 {
@ -22,7 +23,7 @@
/*
Author: undefined 2017-06-29
Content: 示例详情页面
History Log:
History Log:
*/
String calType = CurPage.getParameter("calType");
String paymentNumber=CurPage.getParameter("payment_number");
@ -34,7 +35,7 @@
String taskno = CurPage.getParameter("TaskNo");
String flowNo = CurPage.getParameter("FlowNo");
String phaseNo = CurPage.getParameter("PhaseNo");
String settleMethod="";
String settleMethod="";
String rentOrRate="";
String zcContractNum="";
BizObject condition=JBOFactory.createBizObjectQuery("jbo.app.tenwa.calc.LC_CALC_CONDITION_TEMP","flowunid=:flowunid").setParameter("flowunid", flowunid).getSingleResult(false);
@ -53,9 +54,12 @@
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+"'");
// if(null!=ishistory&&ishistory.equals("true")){
// doTemp.setDataQueryClass("com.tenwa.lease.flow.flowarchive.onhirechange.RentPlanChangeShow");//如果是历史则新显示历史数据
// }
@ -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,27 +137,38 @@ $(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', '');
}
}
});
});
//保存数据
function saveRecord(sPostEvents)
{
/* if(!cheackFinalPayment()){
/* if(!cheackFinalPayment()){
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,14 +179,18 @@ 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);
//检查是否进行过变更
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()");
as_save("myiframe0","run()");
}else{
alert('请先撤销变更,再进行变更操作!!!');
} --%>
@ -183,16 +212,19 @@ function cancelChange(){
var message = AsControl.RunJavaMethodTrans("com.tenwa.reckon.executor.CreateTransactionExecutor","cancelRentChange","flowunid=<%=flowunid%>,plannumber=<%=paymentNumber%>");
if(message == 'true'){
resetDWDialog("变更撤销成功!!!",true);
window.location.href=window.location.href;
window.location.href=window.location.href;
}else{
resetDWDialog("未进行过租金计划变更的操作!请先进行租金计划变更!!!",true);
}
}
}, 500);
}
function run()
{
var result = AsControl.RunJavaMethodTrans("com.tenwa.reckon.executor.CreateTransactionExecutor","runRentdormant","flowunid=<%=flowunid%>,plannumber=<%=paymentNumber%>,productId=<%=ProductId%>,calType=pay_process");
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"%>

View File

@ -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>

File diff suppressed because it is too large Load Diff

View File

@ -24,7 +24,7 @@ import java.util.Map;
*
*/
public class RentCalHelper {
private String contractId;
private String startList;
private String paydayAdjust;
@ -77,10 +77,15 @@ public class RentCalHelper {
try {
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);
//先去判断当前期次是否已回笼
if(rentincome.size()>0){
jsonObject.appendElement("result", "false");
@ -89,14 +94,14 @@ 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();
}
return JSONEncoder.encode(jsonObject);
}
public String findConditionInfo() {
JSONObject jsonObject = JSONObject.createObject();
try {
@ -165,7 +170,7 @@ public class RentCalHelper {
}
return JSONEncoder.encode(jsonObject);
}
public String getLcCarDispose() throws Exception{
BizObjectManager lcdManage = JBOFactory.getBizObjectManager(LC_CAR_DISPOSE.CLASS_NAME);
BizObject lcd = lcdManage.createQuery("select * from O left join jbo.com.tenwa.lease.comm.LB_CONTRACT_INFO lci on lci.contract_no=O.contract_no where lci.id=:id ").setParameter("id", contractId).getSingleResult(false);
@ -187,7 +192,7 @@ public class RentCalHelper {
BizObjectManager bm = JBOFactory.getBizObjectManager(LC_CALC_CONDITION.CLASS_NAME);
Conn conn = new Conn(tx);
String sql = "select sum(case when DATE_FORMAT(t.plandate,'%Y/%m/%d') >= DATE_FORMAT('"+this.paydayAdjust+"','%Y/%m/%d') then t.remaincorpus else 0 end ) remaincorpus,"
+" sum(case when DATE_FORMAT(t.plandate,'%Y/%m/%d') >= DATE_FORMAT('"+this.paydayAdjust+"','%Y/%m/%d') and t.planlist >12 then t.remaincorpus else 0 end ) remaincorpusbreak," //一年以内的违约费用13期包括13的剩余本金计算 一年以外的用剩余本金计算
+" sum(case when DATE_FORMAT(t.plandate,'%Y/%m/%d') >= DATE_FORMAT('"+this.paydayAdjust+"','%Y/%m/%d') and t.planlist >12 then t.remaincorpus else 0 end ) remaincorpusbreak," //一年以内的违约费用13期包括13的剩余本金计算 一年以外的用剩余本金计算
+ " 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.penalty else 0 end ) remainfpenalty,"
@ -356,7 +361,7 @@ public class RentCalHelper {
}
return JSONEncoder.encode(jsonObject);
}
public String rentPlanDate(){
JBOTransaction tx = null;
try {
@ -384,7 +389,7 @@ public class RentCalHelper {
}
}
return "error";
}
//校验合同是否有保证金代偿
@ -477,5 +482,5 @@ public class RentCalHelper {
public void setPlanId(String planId) {
this.planId = planId;
}
}