From c60b41a154ce24c16e25f99f3adfb760812757cb Mon Sep 17 00:00:00 2001 From: ap007 Date: Mon, 1 Nov 2021 15:59:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9A=82=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessApplication/CustomerInfo.jsp | 4 +- WebContent/WEB-INF/etc/jbo/jbo_oti.xml | 29 ++++ .../serviceImp/FundIncomeVoucherJJCCB.java | 76 +++++++++ .../quartzmession/CorpusSourceFileCopy.java | 10 +- .../CorpusSourceRentPlanCopy.java | 1 + .../CorpusSourceRentPlanJJCCB.java | 146 ++++++++++++++++++ .../CorpusSourceRentResultCopy.java | 1 + 7 files changed, 265 insertions(+), 2 deletions(-) create mode 100644 src_core/com/tenwa/voucher/serviceImp/FundIncomeVoucherJJCCB.java create mode 100644 src_tenwa/com/tenwa/lease/app/quartzmession/CorpusSourceRentPlanJJCCB.java diff --git a/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/CustomerInfo.jsp b/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/CustomerInfo.jsp index 271182133..8f431cd14 100644 --- a/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/CustomerInfo.jsp +++ b/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/CustomerInfo.jsp @@ -755,10 +755,12 @@ } function setIdexpiry(){ + var curDate = new Date(); + ; var date = document.getElementById("IDEXPIRY"); var dateValue = ""; dateValue = date.value; - AsDialog.OpenCalender(date,"yyyy/MM/dd","1900/01/01","2100/12/31",function(dateValue){ + AsDialog.OpenCalender(date,"yyyy/MM/dd",curDate.toLocaleDateString(),"2099/12/31",function(dateValue){ var myNewValue = "",myValue=""; myValue = this.dayValue; if(typeof(myValue)!="undefined" && myValue!="undefined"){ diff --git a/WebContent/WEB-INF/etc/jbo/jbo_oti.xml b/WebContent/WEB-INF/etc/jbo/jbo_oti.xml index bc2262c33..1c4a634a6 100644 --- a/WebContent/WEB-INF/etc/jbo/jbo_oti.xml +++ b/WebContent/WEB-INF/etc/jbo/jbo_oti.xml @@ -410,6 +410,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src_core/com/tenwa/voucher/serviceImp/FundIncomeVoucherJJCCB.java b/src_core/com/tenwa/voucher/serviceImp/FundIncomeVoucherJJCCB.java new file mode 100644 index 000000000..be5914660 --- /dev/null +++ b/src_core/com/tenwa/voucher/serviceImp/FundIncomeVoucherJJCCB.java @@ -0,0 +1,76 @@ +package com.tenwa.voucher.serviceImp; + +import com.amarsoft.are.jbo.JBOException; +import com.amarsoft.awe.util.Transaction; +import com.amarsoft.dict.als.cache.CacheLoaderFactory; + +import java.util.Map; + +public class FundIncomeVoucherJJCCB extends FundIncomeVoucherInfoServiceImpl { + @Override + public void run() { + Transaction Sqlca =null; + try { + Sqlca = Transaction.createTransaction(CacheLoaderFactory.getDataSource()); + //todo 头上线将生产环境的编号放进来 + setVoucherConfigNo("PZ2021101200000035"); + setCorpusChannelNo("JJCCB"); + generateVoucher(Sqlca); + } catch (JBOException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + }finally { + try { + if(Sqlca!=null){ + Sqlca.disConnect(); + Sqlca = null; + } + } catch (JBOException e) { + e.printStackTrace(); + try { + Sqlca.rollback(); + } catch (JBOException jboException) { + jboException.printStackTrace(); + } + } + } + } + + /** + * 每条凭证各自差异数据放到参数List + * @param param + * @throws Exception + */ + @Override + public void addRespectiveParam(Map param) throws Exception { + String money = ""; + //100202为九江银行 + if("100202".equals(param.get("subjectsCode"))){ + money=param.get("TRANS_AMT"); + param.put("contractNo",""); + param.put("customerNo",""); + param.put("customerName",""); + //应财务要求九江银行填固定值(一般编码为银行的,都是11213,分内部外部) + param.put("cashFlow","11213"); + } + //长期应收款\回租\汽车\本金 + if("1531020101".equals(param.get("subjectsCode"))){ + money=param.get("TRANS_AMT"); + } + //未实现融资收益\回租\汽车 或 长期应收款\回租\汽车\利息 + if("15320201".equals(param.get("subjectsCode"))||"1531020102".equals(param.get("subjectsCode"))){ + money=this.getInterestTotalByContractId(param.get("contractId")); + } + //debit:借;credit:贷 + if("1".equals(param.get("entrydc"))) { + param.put("debitMoney",money); + param.put("creditMoney","0.00"); + }else{ + param.put("debitMoney","0.00"); + param.put("creditMoney",money); + } + } + + +} diff --git a/src_tenwa/com/tenwa/lease/app/quartzmession/CorpusSourceFileCopy.java b/src_tenwa/com/tenwa/lease/app/quartzmession/CorpusSourceFileCopy.java index 462c89472..38b72582b 100644 --- a/src_tenwa/com/tenwa/lease/app/quartzmession/CorpusSourceFileCopy.java +++ b/src_tenwa/com/tenwa/lease/app/quartzmession/CorpusSourceFileCopy.java @@ -36,12 +36,13 @@ public class CorpusSourceFileCopy { private String contractId; private String fileType; + private String channelNo; 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'"; + String fileSql = "select ID,FILE_STS from O where FILE_TYPE='"+fileType+"' and CHANNEL_NO ='"+channelNo+"' and FILE_STS='2'"; List ffpBoList = ffpBom.createQuery(fileSql).getResultList(true); if(ffpBoList.size()==0){ ARE.getLog().info("暂时没有需要拷表的资方文件"); @@ -685,5 +686,12 @@ public class CorpusSourceFileCopy { public String getFileType() { return fileType; } public void setFileType(String fileType) { this.fileType = fileType; } + public String getChannelNo() { + return channelNo; + } + + public void setChannelNo(String channelNo) { + this.channelNo = channelNo; + } } diff --git a/src_tenwa/com/tenwa/lease/app/quartzmession/CorpusSourceRentPlanCopy.java b/src_tenwa/com/tenwa/lease/app/quartzmession/CorpusSourceRentPlanCopy.java index 141fd9660..e7ed71048 100644 --- a/src_tenwa/com/tenwa/lease/app/quartzmession/CorpusSourceRentPlanCopy.java +++ b/src_tenwa/com/tenwa/lease/app/quartzmession/CorpusSourceRentPlanCopy.java @@ -28,6 +28,7 @@ public class CorpusSourceRentPlanCopy extends CorpusSourceFileCopy implements Jo try { tx = JBOFactory.createJBOTransaction(); setFileType("RepayPlan"); + setChannelNo("PSBC"); doCopy(tx); tx.commit(); QuartzUtil.insertLog(startime,"com.tenwa.lease.app.quartzmession.CorpusSourceRentPlanCopy", "success", "成功", curUserId); diff --git a/src_tenwa/com/tenwa/lease/app/quartzmession/CorpusSourceRentPlanJJCCB.java b/src_tenwa/com/tenwa/lease/app/quartzmession/CorpusSourceRentPlanJJCCB.java new file mode 100644 index 000000000..bd77ce110 --- /dev/null +++ b/src_tenwa/com/tenwa/lease/app/quartzmession/CorpusSourceRentPlanJJCCB.java @@ -0,0 +1,146 @@ +package com.tenwa.lease.app.quartzmession; + +import com.amarsoft.are.ARE; +import com.amarsoft.are.jbo.*; +import com.amarsoft.are.util.StringFunction; +import com.amarsoft.awe.util.Transaction; +import com.base.util.QuartzUtil; +import jbo.app.tenwa.calc.LC_RENT_PLAN; +import jbo.oti.FC_FILE_PUSH; +import jbo.oti.FC_YC_FILE_REPAY_PLAN; +import org.quartz.Job; +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; + +import java.math.BigDecimal; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + * 资方租金计划拷贝 + */ +public class CorpusSourceRentPlanJJCCB extends CorpusSourceFileCopy implements Job { + private String fileType; + private String channelNo; + public String getFileType() { return fileType; } + + public void setFileType(String fileType) { this.fileType = fileType; } + public String getChannelNo() { + return channelNo; + } + + public void setChannelNo(String channelNo) { + this.channelNo = channelNo; + } + @Override + public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { + String startime = StringFunction.getTodayNow(); + Object userId = jobExecutionContext.getTrigger().getJobDataMap().get("CurUserId"); + String curUserId = userId == null? "system" : userId.toString(); + + JBOTransaction tx = null; + try { + tx = JBOFactory.createJBOTransaction(); + setFileType("RepayPlan"); + setChannelNo("JJCCB"); + this.doCopy(tx); + tx.commit(); + QuartzUtil.insertLog(startime,"com.tenwa.lease.app.quartzmession.CorpusSourceRentPlanCopy", "success", "成功", curUserId); + } catch (Exception e) { + e.printStackTrace(); + QuartzUtil.insertLog(startime,"com.tenwa.lease.app.quartzmession.CorpusSourceRentPlanCopy", "error", "失败", curUserId); + try { + if (tx != null) { + tx.rollback(); + } + } catch (JBOException e1) { + e1.printStackTrace(); + } + throw new JobExecutionException(e); + } + } + /** + * 执行自己类所需的操作 + * @param fyfrpBoList + * @param tx + * @throws Exception + */ + public void respectiveDo(List fyfrpBoList , JBOTransaction tx) throws Exception { + //获取对应的合同 + Map contractMap = getContractIdMap(fyfrpBoList); + if(contractMap.size()==0){ + String fcFileId = fyfrpBoList.get(0).getAttribute("FC_REQUEST_ID").toString(); + ARE.getLog().error("未找到FC_REQUEST_ID: "+fcFileId+" 对应的合同ID"); + throw new Exception("未找到FC_REQUEST_ID: "+fcFileId+" 对应的合同ID"); + } + Transaction Sqlca = Transaction.createTransaction(tx); + //===顺序不能错=== + //0.将租金计划拷贝到历史表 + copyRentPlanFormatToHis(contractMap,"安鹏原正式租金计划",tx); + //1.更新租金计划表(直接文件每条信息更新,不需要遍历) + updateRentPlan(fyfrpBoList,tx); + for(Map.Entry entry : contractMap.entrySet()){ + String contractId = entry.getKey(); + Map param = getParamByContractId(contractId,tx); + //2.更新剩余本金 + updateAllRemainCorpus(contractId,Sqlca); + //3.更新SP分润计划 + updateSplitSP(param,Sqlca); + //4.插入分润计划 + insertProfitPlan(param,tx); + //5.拷贝现金流到历史表 + copyCashFlowFormatToHis(contractId,"安鹏原正式现金流",tx); + //6.生成新的现金流 + createCashFlowByContractId(contractId,Sqlca); + //7.测算IRR + calcIRR(param,tx); + } + + } + + /** + * 根据文件ID获取《租金计划》信息 + * @param fcFileId + * @return + * @throws Exception + */ + public List getFileInfoByFileId(String fcFileId) throws Exception { + String sql = "select fr.CONTRACT_ID,O.FC_REQUEST_ID,O.LEND_TERM,O.ANS_REPAYMENT_DATE,O.ANS_PRINCIPAL,O.ANS_INTEREST,ANS_REPAYMENT_MONEY from O left join jbo.oti.FC_REQUEST fr on O.FC_REQUEST_ID=fr.ID where fr.DEL_FLAG='0' and O.FC_FILE_ID=:fcFileId"; + BizObjectManager fyfrpBom = JBOFactory.getBizObjectManager("FC_JJ_REPAY_PLAN.CLASS_NAME"); + List fyfrpBoList = fyfrpBom.createQuery(sql).setParameter("fcFileId",fcFileId).getResultList(false); + if(fyfrpBoList.size()==0){ + ARE.getLog().error("未找到FC_REQUEST_ID: "+fcFileId+" 对应的资方还款计划"); + throw new Exception("未找到FC_REQUEST_ID: "+fcFileId+" 对应的资方还款计划"); + } + return fyfrpBoList; + } + public void updateRentPlan(List fyfrpBoList,JBOTransaction tx) throws JBOException, ParseException { + BizObjectManager lrpBom = null; + lrpBom = JBOFactory.getBizObjectManager(LC_RENT_PLAN.CLASS_NAME,tx); + //更新租金计划表 + for(BizObject bo : fyfrpBoList){ + //获取参数 + String contractId = bo.getAttribute("CONTRACT_ID").toString(); + String lendTerm = bo.getAttribute("CURR_TERM").toString(); + String principal = bo.getAttribute("LOAN_TERM_PRIN").toString(); + String interest = bo.getAttribute("LOAN_TERM_INTEREST").toString(); + String rent = bo.getAttribute("LOAN_TERM_FEE").toString(); + String repaymentDate = bo.getAttribute("PMT_DUE_DATE").toString(); + //转换日期格式 + Date date = new SimpleDateFormat("yyyyMMdd").parse(repaymentDate); + repaymentDate = new SimpleDateFormat("yyyy/MM/dd").format(date); + //更新租金计划表 + BizObject lrpBo = lrpBom.createQuery("CONTRACT_ID=:contractId and PLAN_LIST=:lendTerm").setParameter("contractId",contractId).setParameter("lendTerm",lendTerm).getSingleResult(true); + lrpBo.setAttributeValue("RENT",rent); + lrpBo.setAttributeValue("CORPUS",principal); + lrpBo.setAttributeValue("INTEREST",interest); + lrpBo.setAttributeValue("CORPUS_BUSINESS",principal); + lrpBo.setAttributeValue("INTEREST_BUSINESS",interest); + lrpBo.setAttributeValue("PLAN_DATE",repaymentDate); + lrpBom.saveObject(lrpBo); + } + } +} diff --git a/src_tenwa/com/tenwa/lease/app/quartzmession/CorpusSourceRentResultCopy.java b/src_tenwa/com/tenwa/lease/app/quartzmession/CorpusSourceRentResultCopy.java index 0737dcc52..b3a211884 100644 --- a/src_tenwa/com/tenwa/lease/app/quartzmession/CorpusSourceRentResultCopy.java +++ b/src_tenwa/com/tenwa/lease/app/quartzmession/CorpusSourceRentResultCopy.java @@ -31,6 +31,7 @@ public class CorpusSourceRentResultCopy extends CorpusSourceFileCopy implements try { tx = JBOFactory.createJBOTransaction(); setFileType("RepayResult"); + setChannelNo("PSBC"); doCopy(tx); tx.commit(); QuartzUtil.insertLog(startime,"com.tenwa.lease.app.quartzmession.CorpusSourceRentPlanCopy", "success", "成功", curUserId);