网银核销凭证生成改为定时任务

This commit is contained in:
tangfutang 2022-06-30 14:28:15 +08:00
parent f6c401bbda
commit 5e7e502afb

View File

@ -1,13 +1,28 @@
package com.tenwa.lease.app.quartzmession;
import java.util.List;
import java.util.Map;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.amarsoft.are.jbo.JBOException;
import com.amarsoft.are.util.StringFunction;
import com.amarsoft.awe.util.SqlObject;
import com.amarsoft.awe.util.Transaction;
import com.base.util.QuartzUtil;
import com.tenwa.jbo.manager.DataUtil;
import com.tenwa.voucher.CreateVoucherProcess.CreateVoucherCustCautionMoneyIncome;
import com.tenwa.voucher.CreateVoucherProcess.CreateVoucherEbankMoney;
import com.tenwa.voucher.CreateVoucherProcess.CreateVoucherRedCompensatory;
import com.tenwa.voucher.CreateVoucherProcess.CreateVoucherRentIncome;
import com.tenwa.voucher.CreateVoucherProcess.InsertVoucherRentCompensatory;
import com.tenwa.voucher.CreateVoucherProcess.InsertVoucherRentIncome;
import com.tenwa.voucher.serviceImp.OverdueRepayPlanVoucherPSBC;
/**
* 生成卡扣凭证明细-定时任务
* @author xiezhiwen
@ -15,6 +30,7 @@ import com.tenwa.voucher.CreateVoucherProcess.InsertVoucherRentIncome;
@DisallowConcurrentExecution
public class CreateVoucherRentIncomeMission implements Job {
private static final Logger logger = LoggerFactory.getLogger(CreateVoucherRentIncomeMission.class);
@Override
public void execute(JobExecutionContext arg0) throws JobExecutionException {
String startime = StringFunction.getTodayNow();
@ -31,10 +47,116 @@ public class CreateVoucherRentIncomeMission implements Job {
InsertVoucherRentIncome ivri=new InsertVoucherRentIncome();
ivri.execute();
//生成网银凭证
this.recordBank();
QuartzUtil.insertLog(startime,"com.tenwa.lease.app.quartzmession.CreateVoucherRentIncomeMission", "success", "成功", curUserId);
} catch (Exception e) {
QuartzUtil.insertLog(startime,"com.tenwa.lease.app.quartzmession.CreateVoucherRentIncomeMission", "error", "失败", curUserId);
}
}
public void recordBank() throws Exception {
Transaction Sqlca =null;
String querySql="SELECT ID,FLOWUNID,USERID FROM t_wyhx_middle WHERE STATUS='Y' ";
List<Map<String, String>> recordBankList = DataUtil.query(querySql);
if(recordBankList!=null && recordBankList.size() > 0 ) {
for (Map<String, String> recordBank : recordBankList) {
try {
Sqlca = Transaction.createTransaction("als");
String FlowUnid=recordBank.get("FLOWUNID");
logger.info("IncomeVoucher 20210906 新增判断代码【开始】");
OverdueRepayPlanVoucherPSBC overdueRepayPlanVoucherPSBC = new OverdueRepayPlanVoucherPSBC();
if(overdueRepayPlanVoucherPSBC.findFcPSBCOverduce(FlowUnid)){
logger.info("IncomeVoucher 网银收款流程结束后生成相应的凭证,当前是邮储相关订单凭证不执行以下操作。【结束】,未通过。");
continue;
}
logger.info("IncomeVoucher 20210906 新增判断代码【结束】,通过。");
String userid = recordBank.get("USERID");
/**
* 汽车网银回款-资金部分
*/
CreateVoucherCustCautionMoneyIncome cvci=new CreateVoucherCustCautionMoneyIncome();
// 汽车回租
String sql="SELECT FEE_TYPE FROM LC_FUND_INCOME_TEMP WHERE FLOWUNID='"+FlowUnid+"' GROUP BY FEE_TYPE";
List<Map<String, String>> queryList = DataUtil.query(sql);
for (Map<String, String> map : queryList) {
String FEE_TYPE = map.get("FEE_TYPE");
if("feetype30".equals(FEE_TYPE)) {
cvci.CreateVoucher(Sqlca,FlowUnid, "PZ2018072100000026", "feetype30",userid);//收到的违约金/罚款 --回租
cvci.CreateVoucher(Sqlca,FlowUnid, "PZ2019070100000015", "feetype30",userid);//收到的违约金/罚款 --直租
}else if("feetype4".equals(FEE_TYPE)) {
cvci.CreateVoucher(Sqlca,FlowUnid, "PZ2018072100000031", "feetype4",userid); //收到名义货价 --回租
cvci.CreateVoucher(Sqlca,FlowUnid, "PZ2019070100000019", "feetype4",userid); //收到名义货价--直租
}else if("feetype2".equals(FEE_TYPE)) {
cvci.CreateVoucher(Sqlca,FlowUnid, "PZ2019121600000162", "feetype2",userid); //回款-收到客户保证金 --回租
cvci.CreateVoucher(Sqlca,FlowUnid, "PZ2020041000000003", "feetype2",userid); //直租-收到客户保证金-直租
}else if("feetype1".equals(FEE_TYPE)) {
cvci.CreateVoucher(Sqlca,FlowUnid, "PZ2019121600000163", "feetype1",userid); //回款-收到客户手续费(一次性)--回租
cvci.CreateVoucher(Sqlca,FlowUnid, "PZ2019121700000164", "feetype1",userid); //回款-收到客户手续费(按月) --回租
}else if("feetype32".equals(FEE_TYPE)) {
cvci.CreateVoucher(Sqlca,FlowUnid, "PZ2021032400000006", "feetype32",userid); //回款-收到个人意外险(网银来款)--回租
cvci.CreateVoucher(Sqlca,FlowUnid, "PZ2021032400000005", "feetype33",userid); //回款-收到客户贴息 --回租
}
}
cvci.CreateVoucher(Sqlca,FlowUnid, "PZ2020080400000003", "feetype5",userid); //直租-收到客户首付款
/**
* 汽车网银回款-租金部分
*/
CreateVoucherRentIncome cvri=new CreateVoucherRentIncome();
sql="SELECT LCI.LEAS_FORM FROM LC_RENT_INCOME_TEMP LFIT LEFT JOIN LB_CONTRACT_INFO LCI ON LCI.ID=LFIT.CONTRACT_ID WHERE LFIT.FLOWUNID='"+FlowUnid+"' GROUP BY LCI.LEAS_FORM";
List<Map<String, String>> queryList2 = DataUtil.query(sql);
for (Map<String, String> map : queryList2) {
// 汽车回租
if("02".equals(map.get("LEAS_FORM"))) {
cvri.CreateVoucher(Sqlca,FlowUnid,"PZ2018072100000024",userid);//回款-收到的租金(网银)--当月(回租)
cvri.CreateVoucher(Sqlca,FlowUnid,"PZ2018080400000081",userid);//回款-收到的租金(网银)--跨月(回租)
cvri.CreateVoucher(Sqlca,FlowUnid,"PZ2018072100000025",userid);//回款-收到的逾期利息(网银)--(回租)
// 汽车直租
}else {
cvri.CreateVoucher(Sqlca,FlowUnid,"PZ2019070100000016",userid);//回款-收到的租金(网银)--当月(直租)
cvri.CreateVoucher(Sqlca,FlowUnid,"PZ2019070100000017",userid);//回款-收到的租金(网银)--跨月(直租)
cvri.CreateVoucher(Sqlca,FlowUnid,"PZ2019070100000014",userid);//回款-收到的逾期利息(网银)--(直租)
}
}
/**
* 代偿反冲
*/
CreateVoucherRedCompensatory cvrcs = new CreateVoucherRedCompensatory();
cvrcs.CreateVoucher(FlowUnid,"PZ2019071500000030",userid,Sqlca);//代偿租金
cvrcs.CreateVoucher(FlowUnid,"PZ2019071500000031",userid,Sqlca);//代偿逾期利息
CreateVoucherEbankMoney cvem = new CreateVoucherEbankMoney();
sql="SELECT LE.ID FROM LC_EBANK_TEMP LE LEFT JOIN (SELECT MAX(F57) AS F57 FROM VOUCHER_V8 WHERE MODULE_NAME = '回款-多余回款分解' GROUP BY F3)V8 ON V8.F57=LE.EBANK_SN WHERE LE.FLOWUNID='"+FlowUnid+"' AND V8.F57 IS NULL";
List<Map<String, String>> queryList3 = DataUtil.query(sql);
if(queryList3.size()>0) {
cvem.CreateVoucher(FlowUnid, "PZ2019070100000018", userid,Sqlca);// 回款-多余回款分解
}
Sqlca.executeSQL(new SqlObject("UPDATE t_wyhx_middle SET STATUS='N' WHERE id='"+recordBank.get("ID")+"'"));
} catch (Exception e) {
try {
Sqlca.rollback();
} catch (JBOException e1) {
e1.printStackTrace();
}
}finally {
try {
Sqlca.commit();
Sqlca.disConnect();
} catch (JBOException e) {
e.printStackTrace();
}
}
}
}
}
}