From 1db4289361d179436314458aa69f362b8c60a0fe Mon Sep 17 00:00:00 2001 From: luojian Date: Sat, 4 Aug 2018 19:11:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AE=9A=E6=97=B6=E5=A4=84?= =?UTF-8?q?=E7=90=86=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WebContent/Tenwa/Core/quartz/QrtzTriggersList.jsp | 2 +- WebContent/WEB-INF/etc/jbo/jbo_sys.xml | 1 + src_core/com/tenwa/quartz/QuartzServerImpl.java | 12 ++++++++++-- .../tenwa/lease/app/quartzmession/AutoBuckle.java | 10 +++++++--- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/WebContent/Tenwa/Core/quartz/QrtzTriggersList.jsp b/WebContent/Tenwa/Core/quartz/QrtzTriggersList.jsp index d9498161a..5a6c100d9 100644 --- a/WebContent/Tenwa/Core/quartz/QrtzTriggersList.jsp +++ b/WebContent/Tenwa/Core/quartz/QrtzTriggersList.jsp @@ -107,7 +107,7 @@ } var jobName = getItemValue(0,getRow(),"JOB_NAME"); var triggerName = getItemValue(0,getRow(),"TRIGGER_NAME"); - var result = RunJavaMethodTrans("com.tenwa.quartz.QuartzServerImpl","triggerJob","jobName="+jobName+",triggerName="+triggerName); + var result = RunJavaMethodTrans("com.tenwa.quartz.QuartzServerImpl","triggerJob","jobName="+jobName+",triggerName="+triggerName+",userId=<%=CurUser.getUserID()%>"); if(result == "SUCCESS"){ alert("成功执行!"); reloadSelf(); diff --git a/WebContent/WEB-INF/etc/jbo/jbo_sys.xml b/WebContent/WEB-INF/etc/jbo/jbo_sys.xml index fad548052..3426118c4 100644 --- a/WebContent/WEB-INF/etc/jbo/jbo_sys.xml +++ b/WebContent/WEB-INF/etc/jbo/jbo_sys.xml @@ -1717,6 +1717,7 @@ + diff --git a/src_core/com/tenwa/quartz/QuartzServerImpl.java b/src_core/com/tenwa/quartz/QuartzServerImpl.java index 4da2a11dc..a3f16374e 100644 --- a/src_core/com/tenwa/quartz/QuartzServerImpl.java +++ b/src_core/com/tenwa/quartz/QuartzServerImpl.java @@ -41,6 +41,7 @@ public class QuartzServerImpl { private String misfire; private String startTime; private String endTime; + private String userId; public String getMisfire() { return misfire; @@ -114,6 +115,13 @@ public class QuartzServerImpl { public void setTriggerState(String triggerState) { this.triggerState = triggerState; } + + public String getUserId() { + return userId; + } + public void setUserId(String userId) { + this.userId = userId; + } public QuartzServerImpl(){ try { this.scheduler = StdSchedulerFactory.getDefaultScheduler(); @@ -257,8 +265,8 @@ public class QuartzServerImpl { public String triggerJob(JBOTransaction tx){ try { scheduler.triggerJob(JobKey.jobKey(jobName, DEFAULT_GROUP_NAME)); - JBOFactory.getBizObjectManager(QRTZ_TRIGGERS.CLASS_NAME).createQuery("UPDATE O SET PREV_FIRE_TIME = :Date,NEXT_FIRE_TIME = null WHERE TRIGGER_NAME = :triggerName AND TRIGGER_GROUP = :triggerGroup AND JOB_NAME = :jobName AND JOB_GROUP = :jobGroup") - .setParameter("Date", new Date().getTime()).setParameter("triggerName", triggerName).setParameter("triggerGroup", DEFAULT_GROUP_NAME).setParameter("jobName", jobName).setParameter("jobGroup", DEFAULT_GROUP_NAME).executeUpdate(); + JBOFactory.getBizObjectManager(QRTZ_TRIGGERS.CLASS_NAME).createQuery("UPDATE O SET PREV_FIRE_TIME = :Date,NEXT_FIRE_TIME = null ,USERID = :USERID WHERE TRIGGER_NAME = :triggerName AND TRIGGER_GROUP = :triggerGroup AND JOB_NAME = :jobName AND JOB_GROUP = :jobGroup") + .setParameter("Date", new Date().getTime()).setParameter("triggerName", triggerName).setParameter("triggerGroup", DEFAULT_GROUP_NAME).setParameter("jobName", jobName).setParameter("jobGroup", DEFAULT_GROUP_NAME).setParameter("USERID", this.getUserId()).executeUpdate(); } catch (Exception e) { e.printStackTrace(); return "ERROR"; diff --git a/src_tenwa/com/tenwa/lease/app/quartzmession/AutoBuckle.java b/src_tenwa/com/tenwa/lease/app/quartzmession/AutoBuckle.java index 590b96cf6..59a90a842 100644 --- a/src_tenwa/com/tenwa/lease/app/quartzmession/AutoBuckle.java +++ b/src_tenwa/com/tenwa/lease/app/quartzmession/AutoBuckle.java @@ -5,8 +5,11 @@ import java.util.List; import jbo.com.tenwa.lease.comm.VI_LC_AUDIT_RENT_PLAN; import org.quartz.Job; +import org.quartz.JobDataMap; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; +import org.quartz.JobKey; +import org.quartz.Trigger; import com.amarsoft.are.jbo.BizObject; import com.amarsoft.are.jbo.JBOException; @@ -17,13 +20,14 @@ import com.base.util.QuartzUtil; import com.tenwa.collectaudit.cache.CollectAuditInfoCache; import com.tenwa.comm.util.date.DateAssistant; -public class AutoBuckle implements Job{ - +public class AutoBuckle implements Job { + private JobInitUserName jboName; @Override public void execute(JobExecutionContext arg0) throws JobExecutionException { CollectAuditInfoCache ca = new CollectAuditInfoCache(); JBOTransaction tx = null; String plan_date = DateAssistant.getToday(); + // 获取传递过来的参数 try { // tx = JBOFactory.createJBOTransaction(); @@ -37,7 +41,7 @@ public class AutoBuckle implements Job{ ca.setId(ids.toString().substring(0, ids.toString().length()-1)); Configure CurConfig = Configure.getInstance(); ca.setFileSavePath(CurConfig.getConfigure("InterfaceFileSavePath")); - ca.setInputuserid("system"); + ca.setInputuserid(jboName.getUserId(arg0, tx)); ca.setInputorgid("system"); ca.batchCollectManage(tx); }