From 3e3ef385174c3dc775ae7c8b7a2cfdd608d49310 Mon Sep 17 00:00:00 2001 From: ap007 Date: Thu, 26 Aug 2021 13:20:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=9E=E8=B4=AD=E4=BF=A1=E6=81=AF=E5=BD=95?= =?UTF-8?q?=E5=85=A5=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WebContent/WEB-INF/etc/jbo/jbo_oti.xml | 26 ++++- .../tenwa/apzl/settleLoan/FcBuyBackInfo.jsp | 59 ++++++++++ .../tenwa/apzl/settleLoan/FcBuyBackList.jsp | 73 ++++++++++++ src/com/ap/BuyBack.java | 106 ++++++++++++++++++ src_jbo/jbo/oti/FC_BUYBACK_INFO.java | 75 +++++++++++++ src_jbo/jbo/oti/FC_REQUEST_CHANNEL_LOG.java | 6 +- .../quartzmession/CorpusSourceFileCopy.java | 32 +++--- 7 files changed, 355 insertions(+), 22 deletions(-) create mode 100644 WebContent/com/tenwa/apzl/settleLoan/FcBuyBackInfo.jsp create mode 100644 WebContent/com/tenwa/apzl/settleLoan/FcBuyBackList.jsp create mode 100644 src/com/ap/BuyBack.java create mode 100644 src_jbo/jbo/oti/FC_BUYBACK_INFO.java diff --git a/WebContent/WEB-INF/etc/jbo/jbo_oti.xml b/WebContent/WEB-INF/etc/jbo/jbo_oti.xml index 483a6c531..fe917c2b1 100644 --- a/WebContent/WEB-INF/etc/jbo/jbo_oti.xml +++ b/WebContent/WEB-INF/etc/jbo/jbo_oti.xml @@ -496,7 +496,6 @@ - @@ -506,5 +505,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/WebContent/com/tenwa/apzl/settleLoan/FcBuyBackInfo.jsp b/WebContent/com/tenwa/apzl/settleLoan/FcBuyBackInfo.jsp new file mode 100644 index 000000000..0a9e5219d --- /dev/null +++ b/WebContent/com/tenwa/apzl/settleLoan/FcBuyBackInfo.jsp @@ -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"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/com/tenwa/apzl/settleLoan/FcBuyBackList.jsp b/WebContent/com/tenwa/apzl/settleLoan/FcBuyBackList.jsp new file mode 100644 index 000000000..40d1491d8 --- /dev/null +++ b/WebContent/com/tenwa/apzl/settleLoan/FcBuyBackList.jsp @@ -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"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/src/com/ap/BuyBack.java b/src/com/ap/BuyBack.java new file mode 100644 index 000000000..4a4e9583d --- /dev/null +++ b/src/com/ap/BuyBack.java @@ -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; + } +} diff --git a/src_jbo/jbo/oti/FC_BUYBACK_INFO.java b/src_jbo/jbo/oti/FC_BUYBACK_INFO.java new file mode 100644 index 000000000..48425d369 --- /dev/null +++ b/src_jbo/jbo/oti/FC_BUYBACK_INFO.java @@ -0,0 +1,75 @@ +package jbo.oti; + +/** +* 接口资料表 - JBO命名常量类

+* Note: This file is generated by ADE tools, dont modify it.
+ +*/ +public interface FC_BUYBACK_INFO { + /** + * 接口资料表

+ * 代表本类映射的BizObjectClass + */ + public static final String CLASS_NAME = "jbo.oti.FC_BUYBACK_INFO"; + /** + * 唯一标识 STRING(32)
+ */ + public static final String ID = "ID"; + /** + * 资方请求id STRING(32)
+ */ + public static final String FC_REQUEST_ID = "FC_REQUEST_ID"; + /** + * 逾期开始期次 STRING(32)
+ */ + public static final String OVERDUE_LIST = "OVERDUE_LIST"; + /** + * 逾期第一期本金 STRING(32)
+ */ + public static final String FIRST_OVERDUE_CORPUS = "FIRST_OVERDUE_CORPUS"; + /** + * 逾期第一期利息 STRING(32)
+ */ + public static final String FIRST_OVERDUE_INTEREST = "FIRST_OVERDUE_INTEREST"; + /** + * 逾期第一期罚息 STRING(32)
+ */ + public static final String FIRST_OVERDUE_PENALTY = "FIRST_OVERDUE_PENALTY"; + /** + * 逾期第二期本金 STRING(32)
+ */ + public static final String SECOND_OVERDUE_CORPUS = "SECOND_OVERDUE_CORPUS"; + /** + * 逾期第二期利息 STRING(32)
+ */ + public static final String SECOND_OVERDUE_INTEREST = "SECOND_OVERDUE_INTEREST"; + /** + * 逾期第二期罚息 STRING(32)
+ */ + public static final String SECOND_OVERDUE_PENALTY = "SECOND_OVERDUE_PENALTY"; + /** + * 实际回购总金额 STRING(32)
+ */ + public static final String BUYBACK_MONEY = "BUYBACK_MONEY"; + /** + * 凭证状态:0,未生成,1,已生成 STRING(32)
+ */ + public static final String VOUCHER_STATUS = "VOUCHER_STATUS"; + /** + * INPUTUSERID STRING(32)
+ */ + public static final String INPUTUSERID = "INPUTUSERID"; + /** + * INPUTTIME STRING(32)
+ */ + public static final String INPUTTIME = "INPUTTIME"; + /** + * UPDATEUSERID STRING(32)
+ */ + public static final String UPDATEUSERID = "UPDATEUSERID"; + /** + * UPDATETIME STRING(32)
+ */ + public static final String UPDATETIME = "UPDATETIME"; + +} \ No newline at end of file diff --git a/src_jbo/jbo/oti/FC_REQUEST_CHANNEL_LOG.java b/src_jbo/jbo/oti/FC_REQUEST_CHANNEL_LOG.java index 3ecc5c5a2..f764c5104 100644 --- a/src_jbo/jbo/oti/FC_REQUEST_CHANNEL_LOG.java +++ b/src_jbo/jbo/oti/FC_REQUEST_CHANNEL_LOG.java @@ -10,7 +10,7 @@ public interface FC_REQUEST_CHANNEL_LOG { * 接口资料表

* 代表本类映射的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)
*/ @@ -47,10 +47,6 @@ public interface FC_REQUEST_CHANNEL_LOG { * 变更类型 STRING(32)
*/ public static final String CHANGE_TYPE = "CHANGE_TYPE"; - /** - * 实际回购金额 STRING(32)
- */ - public static final String ACTUAL_PAYMENT_BACK_AMOUNT = "ACTUAL_PAYMENT_BACK_AMOUNT"; /** * 创建时间 STRING(32)
*/ diff --git a/src_tenwa/com/tenwa/lease/app/quartzmession/CorpusSourceFileCopy.java b/src_tenwa/com/tenwa/lease/app/quartzmession/CorpusSourceFileCopy.java index 81daf61bb..462c89472 100644 --- a/src_tenwa/com/tenwa/lease/app/quartzmession/CorpusSourceFileCopy.java +++ b/src_tenwa/com/tenwa/lease/app/quartzmession/CorpusSourceFileCopy.java @@ -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 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 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 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> cashes = DataOperatorUtil.getDataBySql(tx, cashSql, null); List netList = new ArrayList();