/// <summary> /// 调度日志 /// </summary> /// <returns></returns> public ActionResult GetQuartzLog() { var jobName = Server.UrlDecode(Request["jobName"].ObjToStr()); var jobGroup = Server.UrlDecode(Request["jobGroup"].ObjToStr()); if (string.IsNullOrEmpty(jobName) || string.IsNullOrEmpty(jobGroup)) { return(Json(null)); } string errMsg = string.Empty; string connString = WebConfigHelper.GetConnectionString("QuartzConnString"); DateTime dtBefore = DateTime.Now.AddDays(-7); dtBefore = DateTime.SpecifyKind(dtBefore, DateTimeKind.Utc); DateTimeOffset dtOffSet = dtBefore; long ticks = dtOffSet.UtcTicks; string sql = string.Format("SELECT * FROM QRTZ_FIRED_TRIGGERS WHERE FIRED_TIME>{0} AND JOB_NAME='{1}' AND JOB_GROUP='{2}' ORDER BY FIRED_TIME DESC", ticks, jobName, jobGroup); DataTable dt = CommonOperate.ExecuteQuery(out errMsg, sql, null, connString); if (dt != null && dt.Rows.Count > 0) { var list = dt.AsEnumerable().Cast <DataRow>().Select(x => new { jobName = x["JOB_NAME"].ObjToStr(), jobGroup = x["JOB_GROUP"].ObjToStr(), planName = x["TRIGGER_NAME"].ObjToStr(), planGroupName = x["TRIGGER_GROUP"].ObjToStr(), planExecTime = new DateTimeOffset(x["FIRED_TIME"].ObjToLong(), TimeSpan.Zero).LocalDateTime.ToString("yyyy-MM-dd HH:mm:ss") }); return(Json(list)); } return(Json(null)); }