卡扣凭证定时任务异常处理

This commit is contained in:
xiezhiwen 2022-03-31 10:15:35 +08:00
parent 69e89acda9
commit 99ad21922a

View File

@ -3,6 +3,8 @@ package com.tenwa.voucher.CreateVoucherProcess;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import com.amarsoft.are.jbo.JBOException;
import com.amarsoft.awe.util.SqlObject;
import com.amarsoft.awe.util.Transaction;
import com.amarsoft.dict.als.cache.CacheLoaderFactory;
@ -31,8 +33,9 @@ public class InsertVoucherRentIncome {
* 查询租金实收表, 将需要生成凭证的数据存入中间表
* @throws Exception
*/
public void initLVRentIncome() throws Exception{
public void initLVRentIncome() {
Transaction Sqlca =null;
try {
Sqlca = Transaction.createTransaction(CacheLoaderFactory.getDataSource());
int a=0;
int b=0;
@ -137,9 +140,26 @@ public class InsertVoucherRentIncome {
System.out.println("**********************代偿反冲凭证收成**************************");
System.out.println("***********************************************************");
}
} catch (Exception e) {
try {
Sqlca.rollback();
} catch (JBOException e1) {
e1.printStackTrace();
}
e.printStackTrace();
}finally {
if(Sqlca!=null){
try {
Sqlca.commit();
} catch (JBOException e) {
e.printStackTrace();
}
try {
Sqlca.disConnect();
} catch (JBOException e) {
e.printStackTrace();
}
}
}
}
@ -148,8 +168,9 @@ public class InsertVoucherRentIncome {
* @param VOUCHERNO
* @throws Exception
*/
public void CreateVoucher() throws Exception{
public void CreateVoucher() {
Transaction Sqlca =null;
try {
Sqlca = Transaction.createTransaction(CacheLoaderFactory.getDataSource());
/**
* 查询中间表, 判断是否有数据需要执行
@ -319,13 +340,30 @@ public class InsertVoucherRentIncome {
SqlObject sqlsWYh3 = new SqlObject(sql_whereWYh3);
Sqlca.executeSQL(sqlsWYh3);
}
Sqlca.commit();
if(Sqlca!=null){
Sqlca.disConnect();
}
System.out.println("*******************merge20210906****************************************");
System.out.println("**********************租金回笼定时任务执行完成*********************");
System.out.println("***********************************************************");
} catch (Exception e) {
try {
Sqlca.rollback();
} catch (JBOException e1) {
e1.printStackTrace();
}
e.printStackTrace();
}finally {
if(Sqlca!=null){
try {
Sqlca.commit();
} catch (JBOException e) {
e.printStackTrace();
}
try {
Sqlca.disConnect();;
} catch (JBOException e) {
e.printStackTrace();
}
}
}
}
}