资方拷表前,先将原租金计划拷入历史表
This commit is contained in:
parent
0363925a9f
commit
b023791628
@ -1,5 +1,6 @@
|
||||
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;
|
||||
@ -8,6 +9,7 @@ import com.tenwa.comm.util.jboutil.DataOperatorUtil;
|
||||
import com.tenwa.reckon.executor.CreateTransactionExecutor;
|
||||
import jbo.app.tenwa.calc.LC_CALC_CONDITION;
|
||||
import jbo.app.tenwa.calc.LC_RENT_PLAN;
|
||||
import jbo.app.tenwa.calc.LC_RENT_PLAN_HIS;
|
||||
import jbo.oti.FC_FILE_PUSH;
|
||||
import jbo.oti.FC_YC_FILE_REPAY_PLAN;
|
||||
import jbo.oti.LC_PROFIT_PLAN;
|
||||
@ -49,14 +51,41 @@ public class CorpusSourceRentPlanCopy implements Job {
|
||||
fyfrpBom = JBOFactory.getBizObjectManager(FC_YC_FILE_REPAY_PLAN.CLASS_NAME,tx);
|
||||
//todo 添加渠道商的选择,哪些需要拷表哪些不需要
|
||||
List<BizObject> ffpBoList = ffpBom.createQuery("select ID,FILE_STS from O where FILE_STS='2'").getResultList(true);
|
||||
if(ffpBoList.size()==0){
|
||||
ARE.getLog().info("暂时没有需要拷表的资方文件");
|
||||
return;
|
||||
}
|
||||
//遍历每个文件
|
||||
for(BizObject ffpBo : ffpBoList){
|
||||
String fcFileId = ffpBo.getAttribute("ID").toString();
|
||||
//1.更新租金计划租金信息,并获取每个文件的contract_id
|
||||
String sql = "select fr.CONTRACT_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";
|
||||
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";
|
||||
List<BizObject> 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+" 对应的资方还款计划");
|
||||
}
|
||||
//获取对应的合同
|
||||
Map<String,String> contractMap = this.getContractIdMap(fyfrpBoList);
|
||||
if(contractMap.size()==0){
|
||||
ARE.getLog().error("未找到FC_REQUEST_ID: "+fcFileId+" 对应的合同ID");
|
||||
throw new Exception("未找到FC_REQUEST_ID: "+fcFileId+" 对应的合同ID");
|
||||
}
|
||||
//0.租金计划正式表考入历史表
|
||||
for(Map.Entry<String,String> entry: contractMap.entrySet()){
|
||||
Map<String,String> fromCondtion=new HashMap<String,String>();
|
||||
fromCondtion.put("CONTRACT_ID",entry.getKey());
|
||||
|
||||
Set<String> contractSet = this.updateRentPlan(fyfrpBoList,tx);
|
||||
for(String contractId : contractSet){
|
||||
Map<String,String> otherProperty=new HashMap<String,String>();
|
||||
otherProperty.put("MEMO", "安鹏原正式租金计划");
|
||||
otherProperty.put("FLOWUNID", entry.getValue());
|
||||
|
||||
DataOperatorUtil.copyJBOSet(LC_RENT_PLAN.CLASS_NAME, fromCondtion, LC_RENT_PLAN_HIS.CLASS_NAME,null, otherProperty, null, Sqlca);
|
||||
}
|
||||
//1.更新租金计划(直接文件每条信息更新,不需要遍历)
|
||||
this.updateRentPlan(fyfrpBoList,tx);
|
||||
|
||||
for(Map.Entry<String,String> entry: contractMap.entrySet()){
|
||||
String contractId = entry.getKey();
|
||||
Map<String,String> param= this.getParamByContractId(contractId,tx);
|
||||
//2.更新租金计划剩余本金
|
||||
this.updateAllRemainCorpus(contractId,tx);
|
||||
@ -86,6 +115,21 @@ public class CorpusSourceRentPlanCopy implements Job {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取对应的合同ID
|
||||
* @param fyfrpBoList
|
||||
* @return
|
||||
* @throws JBOException
|
||||
*/
|
||||
public Map<String,String> getContractIdMap(List<BizObject> fyfrpBoList) throws JBOException {
|
||||
Map<String,String> contractMap = new HashMap<>();
|
||||
for(BizObject bo : fyfrpBoList){
|
||||
String contractId = bo.getAttribute("CONTRACT_ID").toString();
|
||||
String fcRequestId = bo.getAttribute("FC_REQUEST_ID").toString();
|
||||
contractMap.put(contractId,fcRequestId);
|
||||
}
|
||||
return contractMap;
|
||||
}
|
||||
/**
|
||||
* 租金计划拷贝
|
||||
* @param fyfrpBoList 每个回执文件包含的租金计划信息
|
||||
@ -93,10 +137,9 @@ public class CorpusSourceRentPlanCopy implements Job {
|
||||
* @throws JBOException
|
||||
* @throws ParseException
|
||||
*/
|
||||
public Set<String> updateRentPlan(List<BizObject> fyfrpBoList,JBOTransaction tx) throws JBOException, ParseException {
|
||||
public void updateRentPlan(List<BizObject> fyfrpBoList,JBOTransaction tx) throws JBOException, ParseException {
|
||||
BizObjectManager lrpBom = null;
|
||||
lrpBom = JBOFactory.getBizObjectManager(LC_RENT_PLAN.CLASS_NAME,tx);
|
||||
Set<String> contractSet = new HashSet<>();
|
||||
//更新租金计划表
|
||||
for(BizObject bo : fyfrpBoList){
|
||||
//获取参数
|
||||
@ -119,10 +162,7 @@ public class CorpusSourceRentPlanCopy implements Job {
|
||||
lrpBo.setAttributeValue("PLAN_DATE",repaymentDate);
|
||||
lrpBo.setAttributeValue("RENT",repaymentMoney);
|
||||
lrpBom.saveObject(lrpBo);
|
||||
//放进set去重
|
||||
contractSet.add(contractId);
|
||||
}
|
||||
return contractSet;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user