triggerType=TriggerType.MANUAL;
}else if(type==2){
triggerType=TriggerType.MANUAL_RECOVER;
}
if(!permissionManager.hasJobPermission(LoginUser.getUser().getUid(), jobId)){
GwtException e=new GwtException("你没有权限执行该操作");
log.error(e);
throw e;
}
JobHistory history=new JobHistory();
history.setJobId(jobId);
history.setTriggerType(triggerType);
history.setOperator(LoginUser.getUser().getUid());
history.setIllustrate("触发人:"+LoginUser.getUser().getUid());
history.setStatus(Status.RUNNING);
jobHistoryManager.addJobHistory(history);
ExecuteKind kind=null;
if(triggerType==TriggerType.MANUAL){
kind=ExecuteKind.ManualKind;
}else if(triggerType==TriggerType.MANUAL_RECOVER){
kind=ExecuteKind.ScheduleKind;
}
try {
worker.executeJobFromWeb(kind, history.getId());
} catch (Exception e) {
log.error("error",e);
throw new GwtException(e.getMessage());
}
}