邮储放款--凭证(优化)
This commit is contained in:
parent
8f654f396c
commit
bcf96ede27
@ -129,7 +129,7 @@ public class CorpusSourceCheck {
|
||||
String corpusSource = "AP";
|
||||
BizObjectManager bomLPI = JBOFactory.getBizObjectManager(LB_PROJECT_INFO.CLASS_NAME);
|
||||
BizObject boLPI = bomLPI.createQuery("id=:projectId").setParameter("projectId", projectId).getSingleResult(false);
|
||||
if (boLPI.getAttribute("CORPUS_SOURCE") != null) {
|
||||
if (boLPI.getAttribute("CORPUS_SOURCE") != null||!"".equals(boLPI.getAttribute("CORPUS_SOURCE").toString())) {
|
||||
corpusSource = boLPI.getAttribute("CORPUS_SOURCE").toString();
|
||||
}
|
||||
return corpusSource;
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
package com.tenwa.voucher.serviceImp;
|
||||
|
||||
import com.amarsoft.are.ARE;
|
||||
import com.amarsoft.are.jbo.*;
|
||||
import com.amarsoft.awe.util.SqlObject;
|
||||
import com.amarsoft.awe.util.Transaction;
|
||||
import com.amarsoft.dict.als.cache.CacheLoaderFactory;
|
||||
import com.amarsoft.dict.als.manage.NameManager;
|
||||
import com.tenwa.comm.util.jboutil.DataOperatorUtil;
|
||||
import com.tenwa.flow.util.FlowUtil;
|
||||
@ -21,26 +23,13 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class FundIncomeVoucherInfoServiceImpl implements VoucherInfoService {
|
||||
private final String voucherConfigNo = "PZ2021072600000003";
|
||||
public void run() throws JBOException {
|
||||
JBOTransaction tx = null;
|
||||
private String corpusChannelNo ;
|
||||
private String voucherConfigNo ;
|
||||
public void run() {
|
||||
Transaction Sqlca =null;
|
||||
try {
|
||||
tx = JBOFactory.createJBOTransaction();
|
||||
Sqlca = Transaction.createTransaction(tx);
|
||||
List<Map<String,String>> loanInfoList = this.getHasLoanContract("PSBC");
|
||||
for(Map<String,String> loanInfo : loanInfoList){
|
||||
String voucherNo ="k" + FlowUtil.getVoucher_Number(tx);
|
||||
loanInfo.put("voucherNo",voucherNo);
|
||||
String customerNo = this.getCustomerNoByContractId(loanInfo.get("contractId"),Sqlca);
|
||||
loanInfo.put("customerNo",customerNo);
|
||||
//获取最终参数
|
||||
List<Map<String,String>> paramList = this.getFinalParam(loanInfo,tx);
|
||||
//生成凭证
|
||||
this.createVoucher(paramList,tx);
|
||||
//更新凭证信息状态
|
||||
updateVoucherStatus(loanInfo.get("loan_no"),Sqlca);
|
||||
}
|
||||
Sqlca = Transaction.createTransaction(CacheLoaderFactory.getDataSource());
|
||||
generateVoucher(Sqlca);
|
||||
System.out.println("=============凭证生成完毕============");
|
||||
} catch (JBOException e) {
|
||||
e.printStackTrace();
|
||||
@ -48,14 +37,17 @@ public class FundIncomeVoucherInfoServiceImpl implements VoucherInfoService {
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
try {
|
||||
tx.commit();
|
||||
if(Sqlca!=null){
|
||||
Sqlca.disConnect();
|
||||
Sqlca = null;
|
||||
}
|
||||
} catch (JBOException e) {
|
||||
e.printStackTrace();
|
||||
tx.rollback();
|
||||
try {
|
||||
Sqlca.rollback();
|
||||
} catch (JBOException jboException) {
|
||||
jboException.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,7 +55,30 @@ public class FundIncomeVoucherInfoServiceImpl implements VoucherInfoService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成每个合同的凭证
|
||||
* 生成所有凭证
|
||||
* @param Sqlca
|
||||
* @throws Exception
|
||||
*/
|
||||
public void generateVoucher( Transaction Sqlca) throws Exception {
|
||||
Sqlca.getConnection();
|
||||
JBOTransaction tx = Sqlca.getTransaction();
|
||||
//获取所有需要生成凭证的合同
|
||||
List<Map<String,String>> loanInfoList = this.getHasLoanContract(corpusChannelNo);
|
||||
for(Map<String,String> loanInfo : loanInfoList){
|
||||
String voucherNo ="k" + FlowUtil.getVoucher_Number(tx);loanInfo.put("voucherNo",voucherNo);
|
||||
String customerNo = this.getCustomerNoByContractId(loanInfo.get("contractId"),Sqlca);
|
||||
loanInfo.put("customerNo",customerNo);
|
||||
//获取最终参数
|
||||
List<Map<String,String>> paramList = this.getFinalParam(loanInfo);
|
||||
//生成凭证
|
||||
this.createVoucher(paramList,tx);
|
||||
//更新凭证信息状态
|
||||
updateVoucherStatus(loanInfo.get("loan_no"),Sqlca);
|
||||
ARE.getLog().info("定时任务 ============="+corpusChannelNo+":合同编号为"+loanInfo.get("contractNo")+"的放款凭证生成完毕============");
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 创建凭证
|
||||
* @param paramList
|
||||
* @param tx
|
||||
* @throws Exception
|
||||
@ -80,45 +95,19 @@ public class FundIncomeVoucherInfoServiceImpl implements VoucherInfoService {
|
||||
/**
|
||||
* 获取最终的参数
|
||||
* @param loanInfo
|
||||
* @param tx
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<Map<String,String>> getFinalParam(Map<String,String> loanInfo ,JBOTransaction tx) throws Exception {
|
||||
List<Map<String,String>> paramList = getParamOfVoucher(voucherConfigNo);
|
||||
for(Map<String,String> param : paramList){
|
||||
//将公共参数放到凭证配置的每个凭证信息中
|
||||
param.putAll(this.getCommonParam(loanInfo));
|
||||
//将定制参数放入
|
||||
String money = "";
|
||||
//邮政储蓄银行
|
||||
if("100219".equals(param.get("subjectsCode"))){
|
||||
money=param.get("TRANS_AMT");
|
||||
param.put("contractNo","");
|
||||
param.put("customerNo","");
|
||||
param.put("customerName","");
|
||||
//应财务要求邮储放款填固定值
|
||||
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);
|
||||
}
|
||||
//转译的凭证信息
|
||||
param.putAll(this.getConvertParam(param));
|
||||
}
|
||||
public List<Map<String,String>> getFinalParam(Map<String,String> loanInfo) throws Exception {
|
||||
List<Map<String,String>> paramList = getParamOfVoucher(voucherConfigNo);
|
||||
for(Map<String,String> param : paramList){
|
||||
//将公共参数放到凭证配置参数里
|
||||
param.putAll(this.getCommonParam(loanInfo));
|
||||
//将差别参数放进去
|
||||
addRespectiveParam(param);
|
||||
//转译的凭证信息
|
||||
param.putAll(this.getConvertParam(param));
|
||||
}
|
||||
|
||||
return paramList;
|
||||
}
|
||||
@ -172,6 +161,59 @@ public class FundIncomeVoucherInfoServiceImpl implements VoucherInfoService {
|
||||
return loanInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据凭证配置编号获取对应的每条凭证参数
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<Map<String,String>> getParamOfVoucher(String voucherConfigNo) throws Exception {
|
||||
String sql = "select lvl.SORT_NUMBER as sortNumber,lvl.LOAN_SUBJECT as loanSubject,CASE WHEN lvl.loan_direction = '1' THEN '1' ELSE '-1' END as entrydc,lvl.VALUE_ABSTRACT as valueAbstract,lsc.SUBJECTS_CODE as subjectsCode,lsc.SUBJECTS_NAME as subjectsName,lvc.MODULAR_NUMBER as modularName " +
|
||||
"from lv_voucher_loan lvl " +
|
||||
"left join LV_STACTS_CONFIG lsc on lvl.LOAN_SUBJECT=lsc.id " +
|
||||
"left join lv_voucher_config lvc on lvl.VOUCHER_ID=lvc.id " +
|
||||
"where lvc.VOUCHER_NO='"+voucherConfigNo+"'";
|
||||
List<Map<String,String>> paramList = DataOperatorUtil.getDataBySql(sql);
|
||||
if(paramList.size()==0){
|
||||
ARE.getLog().warn("通过凭证配置编号未找到对应配置信息");
|
||||
throw new Exception("通过凭证配置编号未找到对应配置信息");
|
||||
}
|
||||
return paramList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 每条凭证各自差异数据放到参数List
|
||||
* @param param
|
||||
* @throws Exception
|
||||
*/
|
||||
public void addRespectiveParam(Map<String,String> param) throws Exception {
|
||||
String money = "";
|
||||
//邮政储蓄银行
|
||||
if("1002190".equals(param.get("subjectsCode"))){
|
||||
money=param.get("TRANS_AMT");
|
||||
param.put("contractNo","");
|
||||
param.put("customerNo","");
|
||||
param.put("customerName","");
|
||||
//应财务要求邮储放款填固定值
|
||||
param.put("cashFlow","11213");
|
||||
}
|
||||
//长期应收款\回租\汽车\本金
|
||||
if("15310201010".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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据contractId获取对应的利息总和。
|
||||
* (放款流程结束时生成的利息凭证计算逻辑用的是lc_pay_rent_plan表,邮储放款时生成利息凭证要和此相同)
|
||||
@ -206,20 +248,6 @@ public class FundIncomeVoucherInfoServiceImpl implements VoucherInfoService {
|
||||
return subject;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据凭证配置编号获取对应的每条凭证参数
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<Map<String,String>> getParamOfVoucher(String voucherConfigNo) throws Exception {
|
||||
String sql = "select lvl.SORT_NUMBER as sortNumber,lvl.LOAN_SUBJECT as loanSubject,CASE WHEN lvl.loan_direction = '1' THEN '1' ELSE '-1' END as entrydc,lvl.VALUE_ABSTRACT as valueAbstract,lsc.SUBJECTS_CODE as subjectsCode,lsc.SUBJECTS_NAME as subjectsName,lvc.MODULAR_NUMBER as modularName " +
|
||||
"from lv_voucher_loan lvl " +
|
||||
"left join LV_STACTS_CONFIG lsc on lvl.LOAN_SUBJECT=lsc.id " +
|
||||
"left join lv_voucher_config lvc on lvl.VOUCHER_ID=lvc.id " +
|
||||
"where lvc.VOUCHER_NO='"+voucherConfigNo+"'";
|
||||
return DataOperatorUtil.getDataBySql(sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将最终获取的参数转换为凭证表voucher_v8对应的字段
|
||||
* 注意:新增时注意param中字段不可修改
|
||||
@ -273,4 +301,21 @@ public class FundIncomeVoucherInfoServiceImpl implements VoucherInfoService {
|
||||
int custCount =JBOFactory.createBizObjectQuery(CUSTOMER_LIST.CLASS_NAME, "CUST_ID='"+custId+"'").getTotalCount();
|
||||
return custCount;
|
||||
}
|
||||
|
||||
public String getCorpusChannelNo() {
|
||||
return corpusChannelNo;
|
||||
}
|
||||
|
||||
public void setCorpusChannelNo(String corpusChannelNo) {
|
||||
this.corpusChannelNo = corpusChannelNo;
|
||||
}
|
||||
|
||||
public String getVoucherConfigNo() {
|
||||
return voucherConfigNo;
|
||||
}
|
||||
|
||||
public void setVoucherConfigNo(String voucherConfigNo) {
|
||||
this.voucherConfigNo = voucherConfigNo;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ package com.tenwa.voucher.serviceImp;
|
||||
import com.amarsoft.are.jbo.*;
|
||||
import com.amarsoft.awe.util.SqlObject;
|
||||
import com.amarsoft.awe.util.Transaction;
|
||||
import com.amarsoft.dict.als.cache.CacheLoaderFactory;
|
||||
import com.amarsoft.dict.als.manage.NameManager;
|
||||
import com.tenwa.comm.util.jboutil.DataOperatorUtil;
|
||||
import com.tenwa.flow.util.FlowUtil;
|
||||
@ -20,93 +21,68 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class FundIncomeVoucherPSBC extends FundIncomeVoucherInfoServiceImpl {
|
||||
private final String voucherConfigNo = "PZ2021072600000003";
|
||||
@Override
|
||||
public void run() throws JBOException {
|
||||
JBOTransaction tx = null;
|
||||
public void run() {
|
||||
Transaction Sqlca =null;
|
||||
try {
|
||||
tx = JBOFactory.createJBOTransaction();
|
||||
Sqlca = Transaction.createTransaction(tx);
|
||||
List<Map<String,String>> loanInfoList = getHasLoanContract("PSBC");
|
||||
for(Map<String,String> loanInfo : loanInfoList){
|
||||
String voucherNo ="k" + FlowUtil.getVoucher_Number(tx);
|
||||
loanInfo.put("voucherNo",voucherNo);
|
||||
String customerNo = getCustomerNoByContractId(loanInfo.get("contractId"),Sqlca);
|
||||
loanInfo.put("customerNo",customerNo);
|
||||
//获取最终参数
|
||||
List<Map<String,String>> paramList = getFinalParam(loanInfo,tx);
|
||||
//生成凭证
|
||||
createVoucher(paramList,tx);
|
||||
//更新凭证信息状态
|
||||
updateVoucherStatus(loanInfo.get("loan_no"),Sqlca);
|
||||
}
|
||||
System.out.println("=============邮储放款凭证生成完毕============");
|
||||
Sqlca = Transaction.createTransaction(CacheLoaderFactory.getDataSource());
|
||||
setVoucherConfigNo("PZ2021072600000003");
|
||||
setCorpusChannelNo("PSBC");
|
||||
generateVoucher(Sqlca);
|
||||
} catch (JBOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
try {
|
||||
tx.commit();
|
||||
if(Sqlca!=null){
|
||||
Sqlca.disConnect();
|
||||
Sqlca = null;
|
||||
}
|
||||
} catch (JBOException e) {
|
||||
e.printStackTrace();
|
||||
tx.rollback();
|
||||
try {
|
||||
Sqlca.rollback();
|
||||
} catch (JBOException jboException) {
|
||||
jboException.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取最终的参数
|
||||
* @param loanInfo
|
||||
* @param tx
|
||||
* @return
|
||||
* 每条凭证各自差异数据放到参数List
|
||||
* @param param
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String,String>> getFinalParam(Map<String,String> loanInfo ,JBOTransaction tx) throws Exception {
|
||||
List<Map<String,String>> paramList = getParamOfVoucher(this.voucherConfigNo);
|
||||
for(Map<String,String> param : paramList){
|
||||
//将公共参数放到凭证配置的每个凭证信息中
|
||||
param.putAll(this.getCommonParam(loanInfo));
|
||||
//将定制参数放入
|
||||
String money = "";
|
||||
//邮政储蓄银行
|
||||
if("100219".equals(param.get("subjectsCode"))){
|
||||
money=param.get("TRANS_AMT");
|
||||
param.put("contractNo","");
|
||||
param.put("customerNo","");
|
||||
param.put("customerName","");
|
||||
//应财务要求邮储放款填固定值
|
||||
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);
|
||||
}
|
||||
//转译的凭证信息
|
||||
param.putAll(getConvertParam(param));
|
||||
}
|
||||
|
||||
return paramList;
|
||||
public void addRespectiveParam(Map<String,String> param) throws Exception {
|
||||
String money = "";
|
||||
//邮政储蓄银行
|
||||
if("100219".equals(param.get("subjectsCode"))){
|
||||
money=param.get("TRANS_AMT");
|
||||
param.put("contractNo","");
|
||||
param.put("customerNo","");
|
||||
param.put("customerName","");
|
||||
//应财务要求邮储放款填固定值
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,13 +1,7 @@
|
||||
package com.tenwa.lease.app.quartzmession;
|
||||
|
||||
import com.amarsoft.are.jbo.JBOFactory;
|
||||
import com.amarsoft.are.jbo.JBOTransaction;
|
||||
import com.amarsoft.are.util.StringFunction;
|
||||
import com.base.util.QuartzUtil;
|
||||
import com.tenwa.voucher.CreateVoucherProcess.InsertVoucherRentCompensatory;
|
||||
import com.tenwa.voucher.CreateVoucherProcess.InsertVoucherRentIncome;
|
||||
import com.tenwa.voucher.service.VoucherInfoService;
|
||||
import com.tenwa.voucher.serviceImp.FundIncomeVoucherInfoServiceImpl;
|
||||
import com.tenwa.voucher.serviceImp.FundIncomeVoucherPSBC;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobExecutionContext;
|
||||
@ -22,13 +16,11 @@ public class CorpusSourceFundIncomeCreateVoucherJob implements Job {
|
||||
@Override
|
||||
public void execute(JobExecutionContext arg0) throws JobExecutionException {
|
||||
String startime = StringFunction.getTodayNow();
|
||||
|
||||
Object userId = arg0.getTrigger().getJobDataMap().get("CurUserId");
|
||||
String curUserId = userId == null? "system" : userId.toString();
|
||||
JBOTransaction tx = null;
|
||||
|
||||
try{
|
||||
tx = JBOFactory.createJBOTransaction();
|
||||
//
|
||||
|
||||
VoucherInfoService voucher = new FundIncomeVoucherPSBC();
|
||||
voucher.run();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user