回购信息录入功能

This commit is contained in:
ap007 2021-08-26 13:20:10 +08:00
parent e26448a418
commit 3e3ef38517
7 changed files with 355 additions and 22 deletions

View File

@ -496,7 +496,6 @@
<attribute name="REMARK" label="描述" type="STRING" length="32"/>
<attribute name="CHANGE_RESULT" label="变更结果" type="STRING" length="32"/>
<attribute name="CHANGE_TYPE" label="变更类型1.资方审批拒绝变更2.逾期回购" type="STRING" length="32"/>
<attribute name="ACTUAL_PAYMENT_BACK_AMOUNT" label="实际回购金额" type="STRING" length="32"/>
<attribute name="CREATETIME" label="创建时间" type="STRING" length="32"/>
</attributes>
<manager>
@ -506,5 +505,30 @@
</managerProperties>
</manager>
</class>
<class name="FC_BUYBACK_INFO" label="回购金额信息" describe="回购金额信息" keyAttributes="ID">
<attributes>
<attribute name="ID" label="唯一标识" type="STRING" length="32" />
<attribute name="FC_REQUEST_ID" label="资方请求id" type="STRING" length="32"/>
<attribute name="OVERDUE_LIST" label="逾期开始期次" type="STRING" length="32"/>
<attribute name="FIRST_OVERDUE_CORPUS" label="逾期第一期本金" type="STRING" length="32"/>
<attribute name="FIRST_OVERDUE_INTEREST" label="逾期第一期利息" type="STRING" length="32"/>
<attribute name="FIRST_OVERDUE_PENALTY" label="逾期第一期罚息" type="STRING" length="32"/>
<attribute name="SECOND_OVERDUE_CORPUS" label="逾期第二期本金" type="STRING" length="32"/>
<attribute name="SECOND_OVERDUE_INTEREST" label="逾期第二期利息" type="STRING" length="32"/>
<attribute name="SECOND_OVERDUE_PENALTY" label="逾期第二期罚息" type="STRING" length="32"/>
<attribute name="BUYBACK_MONEY" label="实际回购总金额" type="STRING" length="32"/>
<attribute name="VOUCHER_STATUS" label="凭证状态0未生成1已生成" type="STRING" length="32"/>
<attribute name="INPUTUSERID" label="登记人" type="STRING" length="32"/>
<attribute name="INPUTTIME" label="登记时间" type="STRING" length="32"/>
<attribute name="UPDATEUSERID" label="更新人" type="STRING" length="32"/>
<attribute name="UPDATETIME" label="更新时间" type="STRING" length="32"/>
</attributes>
<manager>
<managerProperties>
<property name="table" value="fc_buyback_info"/>
<property name="createKey" value="true" />
</managerProperties>
</manager>
</class>
</package>
</jbo>

View File

@ -0,0 +1,59 @@
<%@ page contentType="text/html; charset=GBK"%><%@
include file="/Frame/resources/include/include_begin_info.jspf"%><%
String id = CurPage.getParameter("ID");
String fcRequestId = CurPage.getParameter("fcRequestId");
String firstOverdueCorpus = CurPage.getParameter("firstOverdueCorpus");
String firstOverdueInterest = CurPage.getParameter("firstOverdueInterest");
String secondOverdueCorpus = CurPage.getParameter("secondOverdueCorpus");
String secondOverdueInterest = CurPage.getParameter("secondOverdueInterest");
String overdueList = CurPage.getParameter("overdueList");
String voucherStatus = CurPage.getParameter("voucherStatus");
String readOnly = "0";
if("1".equals(voucherStatus)){
readOnly="1";
}
ASObjectModel doTemp = new ASObjectModel("FC_BUYBACK_INFO");
ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request);
dwTemp.Style="2"; //设置DW风格 1:Grid 2:Freeform
dwTemp.ReadOnly = readOnly; //设置是否只读 1:只读 0:可写
dwTemp.genHTMLObjectWindow(id);
String sButtons[][] = {
{"0".equals(readOnly)?"true":"false","All","Button","保存","保存所有修改","save()","","","",""},
{"true","","Button","返回","返回","returnList()","","","",""},
};
sButtonPosition = "south";
%><%@include file="/Frame/resources/include/ui/include_info.jspf"%>
<script type="text/javascript">
window.onload=function(){
var id = getItemValue(0,0,"ID");
if(typeof(id)=="undefined" || id.length==0){
setItemValue(0,0,"FC_REQUEST_ID","<%=fcRequestId%>");
setItemValue(0,0,"FIRST_OVERDUE_CORPUS","<%=firstOverdueCorpus%>");
setItemValue(0,0,"FIRST_OVERDUE_INTEREST","<%=firstOverdueInterest%>");
setItemValue(0,0,"SECOND_OVERDUE_CORPUS","<%=secondOverdueCorpus%>");
setItemValue(0,0,"SECOND_OVERDUE_INTEREST","<%=secondOverdueInterest%>");
setItemValue(0,0,"OVERDUE_LIST","<%=overdueList%>");
}
}
function returnList(){
AsControl.OpenComp("com/tenwa/apzl/settleLoan/FcBuyBackList.jsp","","_self","");
}
function save(){
var firstOverdueCorpus = getItemValue(0,0,"FIRST_OVERDUE_CORPUS");
var firstOverdueInterest = getItemValue(0,0,"FIRST_OVERDUE_INTEREST");
var secondOverdueCorpus = getItemValue(0,0,"SECOND_OVERDUE_CORPUS");
var secondOverdueInterest = getItemValue(0,0,"SECOND_OVERDUE_INTEREST");
var firstOverduePenalty = getItemValue(0,0,"FIRST_OVERDUE_PENALTY");
var secondOverduePenalty = getItemValue(0,0,"SECOND_OVERDUE_PENALTY");
var buybackMoney = getItemValue(0,0,"BUYBACK_MONEY");
var buybackMoneySum = eval(firstOverdueCorpus +"+"+ firstOverdueInterest +"+"+ secondOverdueCorpus +"+"+ secondOverdueInterest +"+"+ firstOverduePenalty +"+"+ secondOverduePenalty) ;
if(buybackMoney!=buybackMoneySum.toFixed(2)){
alert("本金利息罚息金额相加总额"+buybackMoneySum+"与所填‘回购总金额’不相等");
return;
}
as_save(0);
}
</script>
<%@ include file="/Frame/resources/include/include_end.jspf"%>

View File

@ -0,0 +1,73 @@
<%@ page contentType="text/html; charset=GBK"%>
<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><%
/*
Author: undefined 2021-08-04
Content:
History Log:
*/
ASObjectModel doTemp = new ASObjectModel("FC_BUYBACK_LIST");
ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request);
dwTemp.Style="1"; //--设置为Grid风格--
dwTemp.ReadOnly = "1"; //只读模式
dwTemp.setPageSize(20);
dwTemp.genHTMLObjectWindow("");
//0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标CSS层叠样式 10、风格
String sButtons[][] = {
{"true","","Button","新增","新增","newRecord()","","","","btn_icon_detail",""},
{"true","","Button","修改","修改","viewAndEdit()","","","","btn_icon_detail",""},
{"true","","Button","删除","删除","do_delete()","","","","btn_icon_delete",""},
};
%><%@include file="/Frame/resources/include/ui/include_list.jspf"%>
<script type="text/javascript">
function newRecord(){
var param = '';
AsDialog.OpenSelector("CorpusSourceContract",param,"dialogWidth=" + parseInt(window.screen.width * 0.8) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn) {
if (!sReturn || sReturn == "_CANCEL_" || sReturn == "_NONE_") {
//alert(getHtmlMessage('1'));//请选择一条信息!
return;
}
debugger;
sReturn = sReturn.split("@");
var fcRequestId=sReturn[0];
var contractId=sReturn[1];
var result = AsControl.RunJavaMethod("com.ap.BuyBack", "isHasCheck","fcRequestId="+fcRequestId);
if(result>0){
alert("该合同已经回购,请勿重复发起");
return;
}
var result = AsControl.RunJavaMethod("com.ap.BuyBack", "getBuyBackInfoByContract","contractId="+contractId);
var firstOverdueCorpus = result.FIRST_OVERDUE_CORPUS;
var firstOverdueInterest = result.FIRST_OVERDUE_INTEREST;
var secondOverdueCorpus = result.SECOND_OVERDUE_CORPUS;
var secondOverdueInterest = result.SECOND_OVERDUE_INTEREST;
var overdueList = result.OVERDUE_LIST;
var param = 'fcRequestId='+fcRequestId+'&firstOverdueCorpus='+firstOverdueCorpus+'&firstOverdueInterest='+firstOverdueInterest+'&secondOverdueCorpus='+secondOverdueCorpus+'&secondOverdueInterest='+secondOverdueInterest+'&overdueList='+overdueList;
var sUrl = "com/tenwa/apzl/settleLoan/FcBuyBackInfo.jsp";
AsControl.OpenView(sUrl,param,'_self','');
},'请选择对应的资方合同');
}
function viewAndEdit(){
var sUrl = "com/tenwa/apzl/settleLoan/FcBuyBackInfo.jsp";
var id = getItemValue(0,getRow(0),'ID');
if(typeof(id)=="undefined" || id.length==0){
alert("请先选择对应的数据");
return;
}
var voucherStatus = getItemValue(0,getRow(0),'VOUCHER_STATUS');
var sPara ='ID='+id+'&voucherStatus='+voucherStatus;
AsControl.OpenView(sUrl,sPara ,'_self','');
}
function deleteRecord(){
var sPara = getItemValue(0,getRow(0),'ID');
if(typeof(sPara)=="undefined" || sPara.length==0 ){
alert("请选择一条数据!");
return ;
}
if(confirm('确实要删除吗?'))
as_delete(0);
}
</script>
<%@ include file="/Frame/resources/include/include_end.jspf"%>

106
src/com/ap/BuyBack.java Normal file
View File

@ -0,0 +1,106 @@
package com.ap;
import com.alibaba.fastjson.JSONObject;
import com.amarsoft.are.jbo.*;
import jbo.app.tenwa.calc.LC_RENT_INCOME;
import jbo.app.tenwa.calc.LC_RENT_PLAN;
import jbo.oti.FC_BUYBACK_INFO;
import java.math.BigDecimal;
public class BuyBack {
private String contractId;
private String fcRequestId;
/**
* 获取开始逾期的两期的本金利息以及开始期次
* @return JSON格式的字符串
* @throws JBOException
*/
public String getBuyBackInfoByContract() throws JBOException {
JSONObject jsonObject = new JSONObject();
//获取实收表最后一期信息记录
String sql = "select sum(rent) as v.rent,sum(CORPUS) as v.corpus,sum(INTEREST) as v.interest,PLAN_LIST,PLAN_ID from O where CONTRACT_ID='"+contractId+"' "
+ "and plan_list=(select max(plan_list) from O where CONTRACT_ID='"+contractId+"') group by PLAN_LIST";
BizObject boLRI = JBOFactory.getBizObjectManager(LC_RENT_INCOME.CLASS_NAME).createQuery(sql).getSingleResult(false);
//给出默认值如果当查询结果为null时就默认第一期开始就没还过钱防止NPE
String rent_in = "0.00";
String corpus = "0.00";
String interest = "0.00";
int planList = 1;
if(boLRI!=null){
rent_in = boLRI.getAttribute("rent").getString();
corpus = boLRI.getAttribute("corpus").getString();
interest = boLRI.getAttribute("interest").getString();
planList = boLRI.getAttribute("PLAN_LIST").getInt();
}
//获取当期对应租金计划
BizObjectManager bomLRP = JBOFactory.getBizObjectManager(LC_RENT_PLAN.CLASS_NAME);
BizObjectQuery boqLRP = bomLRP.createQuery("contract_id=:contractId and plan_list=:planList").setParameter("contractId",contractId);
BizObject boLRP = boqLRP.setParameter("planList",planList).getSingleResult(false);
String rent_plan = boLRP.getAttribute("rent").getString();
//检验当期是否结清
boolean planListIsComplete = new BigDecimal(rent_in).compareTo(new BigDecimal(rent_plan))>=0;
//不带0为当期带1为下一期带2为下两期
//+1期为通用故挪到上面来
BizObject boLRP1 = boqLRP.setParameter("planList",planList+1).getSingleResult(false);
String corpus1 = "0.00";
String interest1 = "0.00";
if(boLRP1!=null){
corpus1 = boLRP1.getAttribute("corpus").toString();
interest1 = boLRP1.getAttribute("interest").toString();
}
if(planListIsComplete){
BizObject boLRP2 = boqLRP.setParameter("planList",planList+2).getSingleResult(false);
String corpus2 = "0.00";
String interest2 = "0.00";
if(boLRP2!=null){
corpus2 = boLRP2.getAttribute("corpus").toString();
interest2 = boLRP2.getAttribute("interest").toString();
}
jsonObject.put("FIRST_OVERDUE_CORPUS",corpus1);
jsonObject.put("FIRST_OVERDUE_INTEREST",interest1);
jsonObject.put("SECOND_OVERDUE_CORPUS",corpus2);
jsonObject.put("SECOND_OVERDUE_INTEREST",interest2);
jsonObject.put("OVERDUE_LIST",planList+1);
}else{
String buyBackCorpus = new BigDecimal(boLRP.getAttribute("corpus").toString()).subtract(new BigDecimal(corpus)).setScale(2,BigDecimal.ROUND_HALF_UP).toString();
String buyBackInterest = new BigDecimal(boLRP.getAttribute("interest").toString()).subtract(new BigDecimal(interest)).setScale(2,BigDecimal.ROUND_HALF_UP).toString();
jsonObject.put("FIRST_OVERDUE_CORPUS",buyBackCorpus);
jsonObject.put("FIRST_OVERDUE_INTEREST",buyBackInterest);
jsonObject.put("SECOND_OVERDUE_CORPUS",corpus1);
jsonObject.put("SECOND_OVERDUE_INTEREST",interest1);
jsonObject.put("OVERDUE_LIST",planList);
}
return jsonObject.toString();
}
/**
* 检验是否已经回购
* @return
* @throws JBOException
*/
public String isHasCheck() throws JBOException {
BizObjectManager bomFBI = JBOFactory.getBizObjectManager(FC_BUYBACK_INFO.CLASS_NAME);
int boFBI = bomFBI.createQuery("FC_REQUEST_ID=:fcRequestId").setParameter("fcRequestId",fcRequestId).getTotalCount();
return boFBI+"";
}
public String getContractId() {
return contractId;
}
public void setContractId(String contractId) {
this.contractId = contractId;
}
public String getFcRequestId() {
return fcRequestId;
}
public void setFcRequestId(String fcRequestId) {
this.fcRequestId = fcRequestId;
}
}

View File

@ -0,0 +1,75 @@
package jbo.oti;
/**
* 接口资料表 - JBO命名常量类<br><br>
* Note: This file is generated by ADE tools, <em>dont</em> modify it.<br>
*/
public interface FC_BUYBACK_INFO {
/**
* 接口资料表<br><br>
* 代表本类映射的BizObjectClass
*/
public static final String CLASS_NAME = "jbo.oti.FC_BUYBACK_INFO";
/**
* 唯一标识 STRING(32)<br>
*/
public static final String ID = "ID";
/**
* 资方请求id STRING(32)<br>
*/
public static final String FC_REQUEST_ID = "FC_REQUEST_ID";
/**
* 逾期开始期次 STRING(32)<br>
*/
public static final String OVERDUE_LIST = "OVERDUE_LIST";
/**
* 逾期第一期本金 STRING(32)<br>
*/
public static final String FIRST_OVERDUE_CORPUS = "FIRST_OVERDUE_CORPUS";
/**
* 逾期第一期利息 STRING(32)<br>
*/
public static final String FIRST_OVERDUE_INTEREST = "FIRST_OVERDUE_INTEREST";
/**
* 逾期第一期罚息 STRING(32)<br>
*/
public static final String FIRST_OVERDUE_PENALTY = "FIRST_OVERDUE_PENALTY";
/**
* 逾期第二期本金 STRING(32)<br>
*/
public static final String SECOND_OVERDUE_CORPUS = "SECOND_OVERDUE_CORPUS";
/**
* 逾期第二期利息 STRING(32)<br>
*/
public static final String SECOND_OVERDUE_INTEREST = "SECOND_OVERDUE_INTEREST";
/**
* 逾期第二期罚息 STRING(32)<br>
*/
public static final String SECOND_OVERDUE_PENALTY = "SECOND_OVERDUE_PENALTY";
/**
* 实际回购总金额 STRING(32)<br>
*/
public static final String BUYBACK_MONEY = "BUYBACK_MONEY";
/**
* 凭证状态0未生成1已生成 STRING(32)<br>
*/
public static final String VOUCHER_STATUS = "VOUCHER_STATUS";
/**
* INPUTUSERID STRING(32)<br>
*/
public static final String INPUTUSERID = "INPUTUSERID";
/**
* INPUTTIME STRING(32)<br>
*/
public static final String INPUTTIME = "INPUTTIME";
/**
* UPDATEUSERID STRING(32)<br>
*/
public static final String UPDATEUSERID = "UPDATEUSERID";
/**
* UPDATETIME STRING(32)<br>
*/
public static final String UPDATETIME = "UPDATETIME";
}

View File

@ -10,7 +10,7 @@ public interface FC_REQUEST_CHANNEL_LOG {
* 接口资料表<br><br>
* 代表本类映射的BizObjectClass
*/
public static final String CLASS_NAME = "jbo.oti.LC_PROFIT_PLAN";
public static final String CLASS_NAME = "jbo.oti.FC_REQUEST_CHANNEL_LOG";
/**
* 唯一标识 STRING(32)<br>
*/
@ -47,10 +47,6 @@ public interface FC_REQUEST_CHANNEL_LOG {
* 变更类型 STRING(32)<br>
*/
public static final String CHANGE_TYPE = "CHANGE_TYPE";
/**
* 实际回购金额 STRING(32)<br>
*/
public static final String ACTUAL_PAYMENT_BACK_AMOUNT = "ACTUAL_PAYMENT_BACK_AMOUNT";
/**
* 创建时间 STRING(32)<br>
*/

View File

@ -39,22 +39,22 @@ public class CorpusSourceFileCopy {
public void doCopy(JBOTransaction tx) throws Exception {
BizObjectManager ffpBom = null;
ffpBom = JBOFactory.getBizObjectManager(FC_FILE_PUSH.CLASS_NAME,tx);
//todo 添加渠道商的选择哪些需要拷表哪些不需要
String fileSql = "select ID,FILE_STS from O where FILE_TYPE='"+fileType+"' and FILE_STS='2'";
List<BizObject> ffpBoList = ffpBom.createQuery(fileSql).getResultList(true);
if(ffpBoList.size()==0){
ARE.getLog().info("暂时没有需要拷表的资方文件");
return;
}
//遍历解析每个文件
for(BizObject ffpBo : ffpBoList){
if(analyticalFile(ffpBo,tx)){
ffpBo.setAttributeValue("FILE_STS","3");
ffpBo.setAttributeValue("FILE_STS_DESC","拷贝成功");
ffpBom.saveObject(ffpBo);
}
ffpBom = JBOFactory.getBizObjectManager(FC_FILE_PUSH.CLASS_NAME,tx);
//todo 添加渠道商的选择哪些需要拷表哪些不需要
String fileSql = "select ID,FILE_STS from O where FILE_TYPE='"+fileType+"' and FILE_STS='2'";
List<BizObject> ffpBoList = ffpBom.createQuery(fileSql).getResultList(true);
if(ffpBoList.size()==0){
ARE.getLog().info("暂时没有需要拷表的资方文件");
return;
}
//遍历解析每个文件
for(BizObject ffpBo : ffpBoList){
if(analyticalFile(ffpBo,tx)){
ffpBo.setAttributeValue("FILE_STS","3");
ffpBo.setAttributeValue("FILE_STS_DESC","拷贝成功");
ffpBom.saveObject(ffpBo);
}
}
}
/**
@ -607,7 +607,7 @@ public class CorpusSourceFileCopy {
*/
public String getIRR(Map<String,String> param,JBOTransaction tx) throws Exception {
BizObjectManager lccBom = JBOFactory.getBizObjectManager(LC_CALC_CONDITION.CLASS_NAME,tx);
BizObject lccBo = lccBom.createQuery("contract_id=:contractId").setParameter("contractId",contractId).getSingleResult(false);
BizObject lccBo = lccBom.createQuery("contract_id=:contractId").setParameter("contractId",param.get("contractId")).getSingleResult(false);
String cashSql = "select NET_FLOW,PLAN_DATE from lc_cash_flow where contract_id='"+param.get("contractId")+"' order by plan_date";
List<Map<String, String>> cashes = DataOperatorUtil.getDataBySql(tx, cashSql, null);
List<String > netList = new ArrayList<String>();