定时器:添加定时器任务执行日志的任务开始执行时间

This commit is contained in:
jianghongdong 2018-08-06 11:45:58 +08:00
parent 98ba8a505c
commit 545aa07014
12 changed files with 46 additions and 26 deletions

View File

@ -14,6 +14,7 @@ import com.amarsoft.are.jbo.JBOException;
import com.amarsoft.are.jbo.JBOFactory;
import com.amarsoft.are.jbo.JBOTransaction;
import com.amarsoft.are.log.Log;
import com.amarsoft.are.util.StringFunction;
import com.base.util.QuartzUtil;
import com.tenwa.comm.util.jboutil.DataOperatorUtil;
import com.tenwa.reckon.util.DateUtil;
@ -24,6 +25,7 @@ public class AdjustStartDateYear implements Job {
@Override
public void execute(JobExecutionContext arg0) throws JobExecutionException{
JBOTransaction tx=null;
String startime = StringFunction.getTodayNow();
try {
tx=JBOFactory.createJBOTransaction();
AdjustInterestController aic=new AdjustInterestController();
@ -61,9 +63,9 @@ public class AdjustStartDateYear implements Job {
logger.info("Æð×âÈÕÄêµ÷Ï¢Íê³É");
tx.commit();
QuartzUtil.insertLog("com.tenwa.reckon.adjustInterest.AdjustStartDateYear", "success", "成功");
QuartzUtil.insertLog(startime,"com.tenwa.reckon.adjustInterest.AdjustStartDateYear", "success", "成功");
} catch (Exception e) {
QuartzUtil.insertLog("com.tenwa.reckon.adjustInterest.AdjustStartDateYear", "success", "失败");
QuartzUtil.insertLog(startime,"com.tenwa.reckon.adjustInterest.AdjustStartDateYear", "success", "失败");
try {
if(tx!=null){
tx.rollback();

View File

@ -9,6 +9,7 @@ import org.quartz.JobExecutionException;
import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.BizObjectManager;
import com.amarsoft.are.jbo.JBOFactory;
import com.amarsoft.are.util.StringFunction;
import com.base.util.QuartzUtil;
public class HelloJob implements Job {
@ -16,15 +17,16 @@ public class HelloJob implements Job {
@Override
public void execute(JobExecutionContext arg0) throws JobExecutionException {
//System.out.println(DateUtil.getSystemDateTime());
String startime = StringFunction.getTodayNow();
try {
//System.out.println(ProductParamUtil.getProductComponentType("001", "PRD0314"));
BizObjectManager bom = JBOFactory.getBizObjectManager(MSG_SEND_RELATIVE.CLASS_NAME);
BizObject bo = bom.newObject();
bom.saveObject(bo);
//SendMessageUtil.sendMessageByHttpClient("13764771906", "²âÊÔ¶ÌÐÅ£¡");
QuartzUtil.insertLog("com.amarsoft.app.util.HelloJob", "success", "成功");
QuartzUtil.insertLog(startime,"com.amarsoft.app.util.HelloJob", "success", "成功");
} catch (Exception e) {
QuartzUtil.insertLog("com.amarsoft.app.util.HelloJob", "success", "失败");
QuartzUtil.insertLog(startime,"com.amarsoft.app.util.HelloJob", "success", "失败");
e.printStackTrace();
}
}

View File

@ -12,15 +12,16 @@ public class QuartzUtil {
private static Log logger=ARE.getLog();
/**
* 新增串行任务日志
* @param startime开始执行时间
* @param method 执行的方法类的全路径 取数据字典{MissionName}
* @param status 执行状态 success,notexecute,error
* @param Message 异常信息 成功,不执行或方法不存在,失败
*/
public static void insertLog(String method, String status, String Message) {
public static void insertLog(String startime,String method, String status, String Message) {
Transaction tran = Transaction.createTransaction("als");
try {
String sql = "insert into qrtz_serial_log(id,method_name,status,close_date,inputtime,message) select '"+UUIDUtil.getUUID()+"','"
+ method + "','" + status + "','"+StringFunction.getTodayNow().replaceAll(":", "¡÷")+"','"
+ method + "','" + status + "','"+startime.replaceAll(":", "")+"','"
+ StringFunction.getTodayNow().replaceAll(":", "") + "','" + Message
+ "' from dual";
SqlObject so = new SqlObject(sql);

View File

@ -15,6 +15,7 @@ import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.JBOException;
import com.amarsoft.are.jbo.JBOFactory;
import com.amarsoft.are.jbo.JBOTransaction;
import com.amarsoft.are.util.StringFunction;
import com.base.util.QuartzUtil;
public class BaseMessageJob implements Job {
@ -22,13 +23,14 @@ public class BaseMessageJob implements Job {
@Override
public void execute(JobExecutionContext arg0) throws JobExecutionException {
JBOTransaction tx=null;
String startime = StringFunction.getTodayNow();
try {
tx= JBOFactory.createJBOTransaction();
this.executeMessage(tx);
tx.commit();
QuartzUtil.insertLog("com.tenwa.comm.message.controller.BaseMessageJob", "success", "成功");
QuartzUtil.insertLog(startime,"com.tenwa.comm.message.controller.BaseMessageJob", "success", "成功");
} catch (Exception e) {
QuartzUtil.insertLog("com.tenwa.comm.message.controller.BaseMessageJob", "success", "失败");
QuartzUtil.insertLog(startime,"com.tenwa.comm.message.controller.BaseMessageJob", "success", "失败");
try {
if(tx!=null){
tx.rollback();

View File

@ -35,14 +35,14 @@ public class BusinessCancelJob implements Job {
@Override
public void execute(JobExecutionContext arg0) throws JobExecutionException {
JBOTransaction tx=null;
String startime = StringFunction.getTodayNow();
try {
tx= JBOFactory.createJBOTransaction();
this.executeMessage(tx);
tx.commit();
QuartzUtil.insertLog("com.tenwa.comm.message.controller.BusinessCancelJob", "success", "成功");
QuartzUtil.insertLog(startime,"com.tenwa.comm.message.controller.BusinessCancelJob", "success", "成功");
} catch (Exception e) {
QuartzUtil.insertLog("com.tenwa.comm.message.controller.BusinessCancelJob", "error", "失败");
QuartzUtil.insertLog(startime,"com.tenwa.comm.message.controller.BusinessCancelJob", "error", "失败");
try {
if(tx!=null){
tx.rollback();

View File

@ -15,6 +15,7 @@ import com.amarsoft.are.jbo.BizObjectManager;
import com.amarsoft.are.jbo.JBOException;
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.comm.util.date.DateAssistant;
import com.tenwa.flow.comm.handler.flowmanage.OverdueProjectCache;
@ -24,6 +25,7 @@ public class AutoFiveGradeClassification implements Job {
@Override
public void execute(JobExecutionContext arg0) throws JobExecutionException{
JBOTransaction tx=null;
String startime = StringFunction.getTodayNow();
try {
tx= JBOFactory.createJBOTransaction();
BizObjectManager lccsManager = JBOFactory.getBizObjectManager(LC_CALC_CONDITION_STATUS.CLASS_NAME);
@ -56,9 +58,9 @@ public class AutoFiveGradeClassification implements Job {
}
}
tx.commit();
QuartzUtil.insertLog("com.tenwa.lease.app.quartzmession.AutoFiveGradeClassification", "success", "成功");
QuartzUtil.insertLog(startime,"com.tenwa.lease.app.quartzmession.AutoFiveGradeClassification", "success", "成功");
} catch (Exception e) {
QuartzUtil.insertLog("com.tenwa.lease.app.quartzmession.AutoFiveGradeClassification", "success", "失败");
QuartzUtil.insertLog(startime,"com.tenwa.lease.app.quartzmession.AutoFiveGradeClassification", "success", "失败");
try {
if(tx!=null){
tx.rollback();

View File

@ -19,6 +19,7 @@ import com.amarsoft.are.jbo.BizObjectManager;
import com.amarsoft.are.jbo.JBOException;
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.ibm.sslight.tools.mainExit;
import com.tenwa.comm.util.date.DateAssistant;
@ -28,11 +29,12 @@ import com.tenwa.comm.util.jboutil.DataOperatorUtil;
public class CreateSendMessageListAction implements Job{
@Override
public void execute(JobExecutionContext arg0) throws JobExecutionException{
String startime = StringFunction.getTodayNow();
try {
this.getDebitTipsList();
QuartzUtil.insertLog("com.tenwa.lease.app.quartzmession.CreateSendMessageListAction", "success", "成功");
QuartzUtil.insertLog(startime,"com.tenwa.lease.app.quartzmession.CreateSendMessageListAction", "success", "成功");
} catch (Exception e) {
QuartzUtil.insertLog("com.tenwa.lease.app.quartzmession.CreateSendMessageListAction", "error", "失败");
QuartzUtil.insertLog(startime,"com.tenwa.lease.app.quartzmession.CreateSendMessageListAction", "error", "失败");
e.printStackTrace();
}

View File

@ -4,6 +4,7 @@ import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import com.amarsoft.are.util.StringFunction;
import com.base.util.QuartzUtil;
import com.tenwa.voucher.CreateVoucherProcess.CreateVoucherMonthSettlement;
@ -11,6 +12,7 @@ public class CreateVoucherMonthSettlementMission implements Job {
@Override
public void execute(JobExecutionContext arg0) throws JobExecutionException {
String startime = StringFunction.getTodayNow();
try{
CreateVoucherMonthSettlement vouchermanage=new CreateVoucherMonthSettlement();
vouchermanage.CreateVoucher("PZ2018071200000017");//月结手续费--回租
@ -21,9 +23,9 @@ public class CreateVoucherMonthSettlementMission implements Job {
vouchermanage.CreateVoucher("PZ2018072100000055");//日结税金--回租
vouchermanage.CreateVoucher("PZ2018080200000063");//日结税金--直租
QuartzUtil.insertLog("com.tenwa.lease.app.quartzmession.CreateVoucherMonthSettlementMission", "success", "成功");
QuartzUtil.insertLog(startime,"com.tenwa.lease.app.quartzmession.CreateVoucherMonthSettlementMission", "success", "³É¹¦");
} catch (Exception e) {
QuartzUtil.insertLog("com.tenwa.lease.app.quartzmession.CreateVoucherMonthSettlementMission", "error", "失败");
QuartzUtil.insertLog(startime,"com.tenwa.lease.app.quartzmession.CreateVoucherMonthSettlementMission", "error", "ʧ°Ü");
}
}
}

View File

@ -4,6 +4,7 @@ import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import com.amarsoft.are.util.StringFunction;
import com.base.util.QuartzUtil;
import com.tenwa.voucher.CreateVoucherProcess.CreateVoucherInsuranceSettlement;
import com.tenwa.voucher.CreateVoucherProcess.CreateVoucherMonthSettlement;
@ -13,6 +14,7 @@ public class CreateVoucherRentIncomeMission implements Job {
@Override
public void execute(JobExecutionContext arg0) throws JobExecutionException {
String startime = StringFunction.getTodayNow();
try{
CreateVoucherRentIncome cvri=new CreateVoucherRentIncome();
cvri.CreateVoucher("PZ2018072100000024");//收到租金--回租
@ -28,9 +30,9 @@ public class CreateVoucherRentIncomeMission implements Job {
cvis.CreateVoucher("PZ2018072100000054");//保险理赔 -记录理赔保险费--回租
cvis.CreateVoucher("PZ2018080200000064");//保险理赔 -记录理赔保险费--直租
QuartzUtil.insertLog("com.tenwa.comm.message.controller.BusinessCancelJob", "success", "成功");
QuartzUtil.insertLog(startime,"com.tenwa.comm.message.controller.BusinessCancelJob", "success", "成功");
} catch (Exception e) {
QuartzUtil.insertLog("com.tenwa.comm.message.controller.BusinessCancelJob", "error", "失败");
QuartzUtil.insertLog(startime,"com.tenwa.comm.message.controller.BusinessCancelJob", "error", "失败");
}
}

View File

@ -22,6 +22,7 @@ import com.amarsoft.are.jbo.BizObjectManager;
import com.amarsoft.are.jbo.JBOException;
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.lease.util.VehicleAppraisementUtil;
@ -30,6 +31,7 @@ public class QueryCommercialVehicleModeListAction implements Job{
@Override
public void execute(JobExecutionContext arg0) throws JobExecutionException {
JBOTransaction tx = null;
String startime = StringFunction.getTodayNow();
try {
tx = JBOFactory.createJBOTransaction();
BizObjectManager bm1 = JBOFactory.getBizObjectManager(LB_CARDATA_COMMERCIAL_BRAND.CLASS_NAME, tx);
@ -182,9 +184,9 @@ public class QueryCommercialVehicleModeListAction implements Job{
.setParameter("MODELVERSIONTIME",StringUtil.nullToString(versionListObject.get("model_version_time"),""))
.setParameter("INITIALVERSION",StringUtil.nullToString(versionListObject.get("from_version"),"")).executeUpdate();
}
QuartzUtil.insertLog("com.tenwa.lease.app.quartzmession.QueryCommercialVehicleModeListAction", "success", "成功");
QuartzUtil.insertLog(startime,"com.tenwa.lease.app.quartzmession.QueryCommercialVehicleModeListAction", "success", "³É¹¦");
} catch (Exception e) {
QuartzUtil.insertLog("com.tenwa.lease.app.quartzmession.QueryCommercialVehicleModeListAction", "error", "失败");
QuartzUtil.insertLog(startime,"com.tenwa.lease.app.quartzmession.QueryCommercialVehicleModeListAction", "error", "ʧ°Ü");
try {
if(null != tx){

View File

@ -23,6 +23,7 @@ import com.amarsoft.are.jbo.BizObjectManager;
import com.amarsoft.are.jbo.JBOException;
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.lease.util.VehicleAppraisementUtil;
@ -31,6 +32,7 @@ public class QueryPassengerVehicleModeListAction implements Job{
@Override
public void execute(JobExecutionContext arg0) throws JobExecutionException {
JBOTransaction tx = null;
String startime = StringFunction.getTodayNow();
try {
tx = JBOFactory.createJBOTransaction();
BizObjectManager bm1 = JBOFactory.getBizObjectManager(LB_CARDATA_BRAND.CLASS_NAME, tx);
@ -215,9 +217,9 @@ public class QueryPassengerVehicleModeListAction implements Job{
.setParameter("INITIALVERSION",StringUtil.nullToString(map.get("InitialVersion"),"")).executeUpdate();
}
System.out.println("³ËÓóµ³µÐÍ¿â¸üÐÂÍê±Ï!");
QuartzUtil.insertLog("com.tenwa.lease.app.quartzmession.QueryPassengerVehicleModeListAction", "success", "成功");
QuartzUtil.insertLog(startime,"com.tenwa.lease.app.quartzmession.QueryPassengerVehicleModeListAction", "success", "³É¹¦");
} catch (Exception e) {
QuartzUtil.insertLog("com.tenwa.lease.app.quartzmession.QueryPassengerVehicleModeListAction", "error", "失败");
QuartzUtil.insertLog(startime,"com.tenwa.lease.app.quartzmession.QueryPassengerVehicleModeListAction", "error", "ʧ°Ü");
try {
if(null != tx){
tx.rollback();

View File

@ -20,6 +20,7 @@ import com.amarsoft.are.ARE;
import com.amarsoft.are.jbo.JBOException;
import com.amarsoft.are.jbo.JBOFactory;
import com.amarsoft.are.log.Log;
import com.amarsoft.are.util.StringFunction;
import com.amarsoft.awe.util.ASResultSet;
import com.amarsoft.awe.util.SqlObject;
import com.amarsoft.awe.util.Transaction;
@ -44,7 +45,7 @@ public class SplitInts implements Job{
public void execute(JobExecutionContext arg0) throws JobExecutionException {
Transaction Sqlca =null;
String startime = StringFunction.getTodayNow();
// 未计提或发生变更的合同重新计提
try {
Sqlca = Transaction.createTransaction(CacheLoaderFactory.getDataSource());
@ -102,9 +103,9 @@ public class SplitInts implements Job{
}
rs.close();
Sqlca.commit();
QuartzUtil.insertLog("com.tenwa.lease.app.quartzmession.SplitInts", "success", "成功");
QuartzUtil.insertLog(startime,"com.tenwa.lease.app.quartzmession.SplitInts", "success", "成功");
} catch (Exception e) {
QuartzUtil.insertLog("com.tenwa.lease.app.quartzmession.SplitInts", "success", "失败");
QuartzUtil.insertLog(startime,"com.tenwa.lease.app.quartzmession.SplitInts", "success", "失败");
logger.error(e.getMessage());
e.printStackTrace();
}finally{