增加定时处理人

This commit is contained in:
luojian 2018-08-04 19:11:53 +08:00
parent 9c33b0bf70
commit 1db4289361
4 changed files with 19 additions and 6 deletions

View File

@ -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();

View File

@ -1717,6 +1717,7 @@
<attribute name="CALENDAR_NAME" label="CALENDAR_NAME" type="STRING" length="200"/>
<attribute name="MISFIRE_INSTR" label="MISFIRE_INSTR" type="LONG" length="19"/>
<attribute name="JOB_DATA" label="JOB_DATA" type="STRING" length="65535"/>
<attribute name="USERID" label="USERID" type="STRING" length="100"/>
</attributes>
<manager>
<managerProperties>

View File

@ -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";

View File

@ -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);
}