diff --git a/src_tenwa/com/tenwa/lease/app/quartzmession/AutoBuckle.java b/src_tenwa/com/tenwa/lease/app/quartzmession/AutoBuckle.java index 569b95ac8..8ff77d371 100644 --- a/src_tenwa/com/tenwa/lease/app/quartzmession/AutoBuckle.java +++ b/src_tenwa/com/tenwa/lease/app/quartzmession/AutoBuckle.java @@ -16,16 +16,50 @@ import com.amarsoft.are.jbo.JBOException; import com.amarsoft.are.jbo.JBOFactory; import com.amarsoft.are.jbo.JBOTransaction; import com.amarsoft.awe.Configure; +import com.amarsoft.awe.util.SqlObject; +import com.amarsoft.awe.util.Transaction; import com.base.util.QuartzUtil; import com.tenwa.collectaudit.cache.CollectAuditInfoCache; import com.tenwa.collectaudit.cache.CollectAuditInfoCacheTj; import com.tenwa.comm.util.date.DateAssistant; import com.tenwa.lease.app.allinpay.service.impl.AllinpayPaymentDo; +import com.tenwa.reckon.util.DateUtil; +import com.tenwa.reckon.util.UUIDUtil; public class AutoBuckle implements Job { private JobInitUserName jboName; @Override public void execute(JobExecutionContext arg0) throws JobExecutionException { + //插入一条数据定时任务开始时间 + Transaction startTx =null; + String uuid = UUIDUtil.getUUID(); + try { + startTx = Transaction.createTransaction("als"); + String insertSql="insert into lb_card_buckle_status(id,status,starttime) values('"+uuid+"','Y',:starttime)"; + SqlObject asql = new SqlObject(insertSql); + asql.setParameter("starttime", DateUtil.getSystemTimeByFormat("yyyy/MM/dd HH:mm:ss")); + startTx.executeSQL(asql); + } catch (Exception e) { + if (startTx != null) { + try { + startTx.rollback(); + startTx=null; + } catch (JBOException e1) { + e1.printStackTrace(); + } + } + }finally{ + try { + if(startTx !=null){ + startTx.commit(); + startTx.disConnect(); + } + } catch (JBOException e) { + e.printStackTrace(); + } + } + System.out.println("自动卡扣定时任务开始"); + CollectAuditInfoCache ca = new CollectAuditInfoCache(); JBOTransaction tx = null; String plan_date = DateAssistant.getToday(); @@ -162,6 +196,36 @@ public class AutoBuckle implements Job { e.printStackTrace(); } } + System.out.println("自动卡扣定时任务结束"); + //更新定时任务计划表 + Transaction endTx =null; + try { + endTx = Transaction.createTransaction("als"); + String updateSql="update lb_card_buckle_status set status='N',endtime=:endtime where id='"+uuid+"' "; + SqlObject asql = new SqlObject(updateSql); + asql.setParameter("endtime", DateUtil.getSystemTimeByFormat("yyyy/MM/dd HH:mm:ss")); + endTx.executeSQL(asql); + } catch (Exception e) { + if (endTx != null) { + try { + endTx.rollback(); + endTx=null; + } catch (JBOException e1) { + e1.printStackTrace(); + } + } + }finally{ + try { + if(endTx !=null){ + endTx.commit(); + endTx.disConnect(); + } + } catch (JBOException e) { + e.printStackTrace(); + } + } } + + }