59 lines
2.1 KiB
Java
59 lines
2.1 KiB
Java
package com.tenwa.lease.app.quartzmession;
|
|
|
|
import com.amarsoft.are.jbo.JBOException;
|
|
import com.amarsoft.are.jbo.JBOFactory;
|
|
import com.amarsoft.are.jbo.JBOTransaction;
|
|
import com.amarsoft.are.sql.Connection;
|
|
import com.amarsoft.are.util.StringFunction;
|
|
import com.amarsoft.awe.util.Transaction;
|
|
import com.base.util.QuartzUtil;
|
|
import org.quartz.Job;
|
|
import org.quartz.JobExecutionContext;
|
|
import org.quartz.JobExecutionException;
|
|
|
|
import java.sql.CallableStatement;
|
|
|
|
/**
|
|
* @program: apzl_leasing
|
|
* @description:
|
|
* @author: 李超杰
|
|
* @create: 2021-11-03 15:38
|
|
*/
|
|
public class GenerateVoucherSumJob implements Job {
|
|
|
|
@Override
|
|
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
|
JBOTransaction tx;
|
|
Transaction tran = null;
|
|
String startime = StringFunction.getTodayNow();
|
|
Object userId = jobExecutionContext.getTrigger().getJobDataMap().get("CurUserId");
|
|
String curUserId = userId == null? "system" : userId.toString();
|
|
try {
|
|
tx = JBOFactory.createJBOTransaction();
|
|
tran = Transaction.createTransaction(tx);
|
|
|
|
// 获取当前日期
|
|
// String todayDateStr = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy/MM/dd"));
|
|
|
|
Connection connection = tran.getConnection(tran);
|
|
CallableStatement callableStatement = connection.prepareCall("{call PROC_CALC_VOUCHER_SUM()}");
|
|
callableStatement.execute();
|
|
callableStatement.close();
|
|
|
|
tran.commit();
|
|
QuartzUtil.insertLog(startime,"com.tenwa.lease.app.quartzmession.CalcPenaltyJob", "success", "成功", curUserId);
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
QuartzUtil.insertLog(startime,"com.tenwa.lease.app.quartzmession.CalcPenaltyJob", "error", "失败", curUserId);
|
|
try {
|
|
if (tran != null) {
|
|
tran.rollback();
|
|
}
|
|
} catch (JBOException e1) {
|
|
e1.printStackTrace();
|
|
}
|
|
throw new JobExecutionException(e);
|
|
}
|
|
}
|
|
}
|