From 2825a1123c989e8093d1ce533b806edb0248156c Mon Sep 17 00:00:00 2001 From: ap007 Date: Thu, 2 Sep 2021 15:59:46 +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=E6=94=B9=E4=B8=BA=E8=87=AA=E5=8A=A8=E7=94=9F=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WebContent/WEB-INF/etc/jbo/jbo_oti.xml | 12 +- .../tenwa/apzl/settleLoan/FcBuyBackInfo.jsp | 58 ---------- .../tenwa/apzl/settleLoan/FcBuyBackList.jsp | 76 +++++-------- src/com/ap/BuyBack.java | 106 +++++++++++++----- src_jbo/jbo/oti/FC_BUYBACK_INFO.java | 32 ++---- .../CorpusSourceRentResultCopy.java | 35 ++++-- 6 files changed, 142 insertions(+), 177 deletions(-) delete mode 100644 WebContent/com/tenwa/apzl/settleLoan/FcBuyBackInfo.jsp diff --git a/WebContent/WEB-INF/etc/jbo/jbo_oti.xml b/WebContent/WEB-INF/etc/jbo/jbo_oti.xml index 572077ce2..bc2262c33 100644 --- a/WebContent/WEB-INF/etc/jbo/jbo_oti.xml +++ b/WebContent/WEB-INF/etc/jbo/jbo_oti.xml @@ -509,15 +509,11 @@ - - - - - - - + + + - + diff --git a/WebContent/com/tenwa/apzl/settleLoan/FcBuyBackInfo.jsp b/WebContent/com/tenwa/apzl/settleLoan/FcBuyBackInfo.jsp deleted file mode 100644 index 7f87508e2..000000000 --- a/WebContent/com/tenwa/apzl/settleLoan/FcBuyBackInfo.jsp +++ /dev/null @@ -1,58 +0,0 @@ -<%@ 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 allRemainMoney = CurPage.getParameter("allRemainMoney"); - 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 index 1edbfd0f3..ec71a122d 100644 --- a/WebContent/com/tenwa/apzl/settleLoan/FcBuyBackList.jsp +++ b/WebContent/com/tenwa/apzl/settleLoan/FcBuyBackList.jsp @@ -5,8 +5,10 @@ Content: History Log: */ + String userID = CurUser.getUserID(); ASObjectModel doTemp = new ASObjectModel("FC_BUYBACK_LIST"); ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.MultiSelect = true; dwTemp.Style="1"; //--设置为Grid风格-- dwTemp.ReadOnly = "1"; //只读模式 dwTemp.setPageSize(20); @@ -14,61 +16,39 @@ //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","删除","删除","deleteRecord()","","","","btn_icon_delete",""}, + + {"true","","Button","确认","确认回购信息无误","confirmRecord()","","","","btn_icon_detail",""}, }; %><%@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 index ed9386e6d..c01ef3fb4 100644 --- a/src/com/ap/BuyBack.java +++ b/src/com/ap/BuyBack.java @@ -1,24 +1,29 @@ package com.ap; -import com.alibaba.fastjson.JSONObject; import com.amarsoft.are.jbo.*; +import com.amarsoft.are.util.StringFunction; import jbo.app.tenwa.calc.LC_RENT_INCOME; import jbo.app.tenwa.calc.LC_RENT_PLAN; import jbo.oti.FC_BUYBACK_INFO; +import jbo.oti.FC_REQUEST; + import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; public class BuyBack { private String contractId; private String fcRequestId; - + private String fcRequestIds; + private String userID; /** - * 获取开始逾期的两期的本金利息以及开始期次 - * @return JSON格式的字符串 + * 获取剩余本金利息 + * @return * @throws JBOException */ - public String getBuyBackInfoByContract() throws JBOException { - JSONObject jsonObject = new JSONObject(); + public Map getBuyBackInfoByContract(String contractId) throws JBOException { + Map map = new HashMap<>(); //获取实收表最后一期信息记录 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"; @@ -47,63 +52,102 @@ public class BuyBack { //不带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); - jsonObject.put("ALL_REMAIN_MONEY",new BigDecimal(allRemainCorpus).add(new BigDecimal(interest1)).add(new BigDecimal(interest2)).setScale(2,BigDecimal.ROUND_HALF_UP).toString()); + map.put("ALL_REMAIN_CORPUS",allRemainCorpus); + map.put("ALL_REMAIN_INTEREST",new BigDecimal(interest1).add(new BigDecimal(interest2)).setScale(2,BigDecimal.ROUND_HALF_UP).toString()); }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); - jsonObject.put("ALL_REMAIN_MONEY", new BigDecimal(allRemainCorpus).subtract(new BigDecimal(corpus)).add(new BigDecimal(buyBackInterest)).add(new BigDecimal(interest1)).setScale(2,BigDecimal.ROUND_HALF_UP).toString()); + map.put("ALL_REMAIN_CORPUS",new BigDecimal(allRemainCorpus).subtract(new BigDecimal(corpus)).setScale(2,BigDecimal.ROUND_HALF_UP).toString()); + map.put("ALL_REMAIN_INTEREST",new BigDecimal(buyBackInterest).add(new BigDecimal(interest1)).setScale(2,BigDecimal.ROUND_HALF_UP).toString()); } - return jsonObject.toString(); + return map; } /** - * 检验是否已经回购 + * 确认回购本金利息和系统计算出的是否相等 + * @param tx * @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 confirmBuyBack(JBOTransaction tx) throws JBOException { + String corpusResult = ""; + String interestResult = ""; + String[] idArray = fcRequestIds.split("@"); + for(String fcRequestId : idArray){ + BizObjectManager bomFBI = JBOFactory.getBizObjectManager(FC_BUYBACK_INFO.CLASS_NAME,tx); + BizObject boFR = JBOFactory.getBizObjectManager(FC_REQUEST.CLASS_NAME,tx).createQuery("ID=:fcRequestId") + .setParameter("fcRequestId",fcRequestId).getSingleResult(false); + if(boFR==null){ + continue; + } + String contractId = boFR.getAttribute("CONTRACT_ID").toString(); + String contractNo = boFR.getAttribute("CONTRACT_NO").toString(); + + BizObject boFBI = bomFBI.createQuery("FC_REQUEST_ID=:fcRequestId").setParameter("fcRequestId",fcRequestId).getSingleResult(false); + String allRemainCorpus = boFBI.getAttribute("ALL_REMAIN_CORPUS").toString(); + String allRemainInterest = boFBI.getAttribute("ALL_REMAIN_INTEREST").toString(); + Map buyBack= this.getBuyBackInfoByContract(contractId); + if(!allRemainCorpus.equals(buyBack.get("ALL_REMAIN_CORPUS"))){ + corpusResult = corpusResult + contractNo + ","; + } + if(!allRemainInterest.equals(buyBack.get("ALL_REMAIN_INTEREST"))){ + interestResult = interestResult + contractNo + ","; + } + } + corpusResult = corpusResult==""?"":"以下合同的回购本金与系统剩余应还本金不相等:"+corpusResult+"\n"; + interestResult = interestResult==""?"":"以下合同的回购利息与系统剩余应还利息不相等:"+interestResult+"\n"; + return corpusResult + interestResult ; + } + + /** + * 确认回购 + * @param tx + * @return + * @throws JBOException + */ + public String updateBuyBackConfirm(JBOTransaction tx) throws JBOException { + String[] idArray = fcRequestIds.split("@"); + BizObjectManager bomFBI = JBOFactory.getBizObjectManager(FC_BUYBACK_INFO.CLASS_NAME, tx); + BizObjectQuery boqFBI = bomFBI.createQuery("FC_REQUEST_ID=:fcRequestId"); + for(String fcRequestId : idArray) { + BizObject boFBI = boqFBI.setParameter("fcRequestId",fcRequestId).getSingleResult(true); + boFBI.setAttributeValue("IS_CONFIRM","1"); + boFBI.setAttributeValue("UPDATEUSERID",userID); + boFBI.setAttributeValue("UPDATETIME", StringFunction.getTodayNow()); + bomFBI.saveObject(boFBI); + } + return null; } 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; } + public String getFcRequestIds() { + return fcRequestIds; + } + public void setFcRequestIds(String fcRequestIds) { + this.fcRequestIds = fcRequestIds; + } + public String getUserID() {return userID;} + public void setUserID(String userID) {this.userID = userID;} } diff --git a/src_jbo/jbo/oti/FC_BUYBACK_INFO.java b/src_jbo/jbo/oti/FC_BUYBACK_INFO.java index 135c44a68..fb060dc67 100644 --- a/src_jbo/jbo/oti/FC_BUYBACK_INFO.java +++ b/src_jbo/jbo/oti/FC_BUYBACK_INFO.java @@ -20,41 +20,25 @@ public interface FC_BUYBACK_INFO { */ public static final String FC_REQUEST_ID = "FC_REQUEST_ID"; /** - * 逾期开始期次 STRING(32)
+ * 回购本金 STRING(32)
*/ - public static final String OVERDUE_LIST = "OVERDUE_LIST"; + public static final String ALL_REMAIN_CORPUS = "ALL_REMAIN_CORPUS"; /** - * 逾期第一期本金 STRING(32)
+ * 回购利息 STRING(32)
*/ - public static final String FIRST_OVERDUE_CORPUS = "FIRST_OVERDUE_CORPUS"; + public static final String ALL_REMAIN_INTEREST = "ALL_REMAIN_INTEREST"; /** - * 逾期第一期利息 STRING(32)
+ * 回购罚息 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"; + public static final String ALL_REMAIN_PENALTY = "ALL_REMAIN_PENALTY"; /** * 实际回购总金额 STRING(32)
*/ public static final String BUYBACK_MONEY = "BUYBACK_MONEY"; /** - * 回购金额(本金+利息),不包含罚息 STRING(32)
+ * 是否已确认 STRING(32)
*/ - public static final String ALL_REMAIN_MONEY = "ALL_REMAIN_MONEY"; + public static final String IS_CONFIRM = "IS_CONFIRM"; /** * 凭证状态:0,未生成,1,已生成 STRING(32)
*/ diff --git a/src_tenwa/com/tenwa/lease/app/quartzmession/CorpusSourceRentResultCopy.java b/src_tenwa/com/tenwa/lease/app/quartzmession/CorpusSourceRentResultCopy.java index be3fd9c7c..b45d9d383 100644 --- a/src_tenwa/com/tenwa/lease/app/quartzmession/CorpusSourceRentResultCopy.java +++ b/src_tenwa/com/tenwa/lease/app/quartzmession/CorpusSourceRentResultCopy.java @@ -5,6 +5,7 @@ import com.amarsoft.are.jbo.*; import com.amarsoft.are.util.StringFunction; import com.amarsoft.awe.util.Transaction; import com.base.util.QuartzUtil; +import jbo.oti.FC_BUYBACK_INFO; import jbo.oti.FC_YC_FILE_REPAY_RESULT; import org.quartz.Job; import org.quartz.JobExecutionContext; @@ -59,14 +60,16 @@ public class CorpusSourceRentResultCopy extends CorpusSourceFileCopy implements //0.获取所有参数(以文件信息为基础,将合同参数补充进去) List> allParam = this.getAllParam(fyfrpBoList,tx); for(Map param : allParam){ - //1.插入租金实收表 - this.insertRentIncome(param,tx); - // 2.0根据状态的不同,来进行不同的操作 - //2.1如果当期正常结清或者当期逾期结清, + + // 1.0根据状态的不同,来进行不同的操作 + //1.1如果当期正常结清或者当期逾期结清, if("0".equals(param.get("repaymentFlag"))){ + this.insertRentIncome(param,tx); updateRentPlanStatus(param,tx); - //2.2如果提前结清 并且 为借款人本人账户,则视为客户本人提前结清,直接变更租金计划表租金计划 - }else if("3".equals(param.get("repaymentFlag"))&&"0".equals(param.get("repaymentSource"))){ + //1.2如果提前结清 并且 为借款人本人账户,则视为客户本人提前结清,直接变更租金计划表租金计划 + } + if("3".equals(param.get("repaymentFlag"))&&"0".equals(param.get("repaymentSource"))){ + this.insertRentIncome(param,tx); //租金计划,现金流存历史表 //每个合同只有一次提前结清,只有提前结清才会走这里,所以按照合同id来执行 copyRentPlanFormatToHis(param.get("contractId"),param.get("fcRequestId"),"邮储提前结清前租金计划",tx); @@ -79,12 +82,14 @@ public class CorpusSourceRentResultCopy extends CorpusSourceFileCopy implements createCashFlowByContractId(param.get("contractId"),Sqlca); //重新Irr计算 calcIRR(param,tx); - //2.3如果提请结清 并且 为非借款人本人账户,则视为我方回购,需改变资方状态,我方能继续扣款 - }else if("3".equals(param.get("repaymentFlag"))&&"1".equals(param.get("repaymentSource"))){ + //1.3如果提请结清 并且 为非借款人本人账户,则视为我方回购,需改变资方状态,我方能继续扣款 + } + if("3".equals(param.get("repaymentFlag"))&&"1".equals(param.get("repaymentSource"))){ int result = 1; //变更资方资源(要有日志) try{ changeCorpusSource(param,tx); + createBuyBackInfo(param,tx); }catch (JBOException e){ result = 0; e.printStackTrace(); @@ -99,6 +104,20 @@ public class CorpusSourceRentResultCopy extends CorpusSourceFileCopy implements } } + public void createBuyBackInfo(Map param, JBOTransaction tx) throws JBOException { + BizObjectManager bomFBI = JBOFactory.getBizObjectManager(FC_BUYBACK_INFO.CLASS_NAME,tx); + BizObject boFBI = bomFBI.newObject(); + boFBI.setAttributeValue("FC_REQUEST_ID",param.get("fcRequestId")); + boFBI.setAttributeValue("ALL_REMAIN_CORPUS",param.get("principal")); + boFBI.setAttributeValue("ALL_REMAIN_INTEREST",param.get("interest")); + boFBI.setAttributeValue("ALL_REMAIN_PENALTY",param.get("penalty")); + boFBI.setAttributeValue("BUYBACK_MONEY",param.get("repaymentMoney")); + boFBI.setAttributeValue("IS_CONFIRM","0"); + boFBI.setAttributeValue("VOUCHER_STATUS","0"); + boFBI.setAttributeValue("INPUTUSERID","system"); + boFBI.setAttributeValue("INPUTTIME",StringFunction.getTodayNow()); + bomFBI.saveObject(boFBI); + } /** * 根据文件ID获取《租金实收》信息