using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Data; using System.Text; using System.Collections; using System.Reflection; using System.Web.Script.Serialization; using FangYar.Model; using FangYar.BLL; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Spire.Doc; using Spire.Doc.Documents; using Spire.Doc.Fields; using System.IO; using System.Drawing; using FangYar.Common; namespace FangYar.WebUI.ashx { /// /// CameraAlarm 的摘要说明 /// public class CameraAlarm : IHttpHandler { private FangYar.BLL.OA.TBL_CameraAlarm bll = new FangYar.BLL.OA.TBL_CameraAlarm(); public void ProcessRequest(HttpContext context) { // 记录操作日志 BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Other, "摄像头报警操作请求", ""); context.Response.ContentType = "text/plain"; string action = context.Request.Params["Action"]; string returnstr = ""; switch (action) { case "getList": returnstr = getList(context); break; } context.Response.Write(returnstr); } //查询 private string getList(HttpContext context) { string returnstr = ""; try { string searchTime = context.Request.Params["searchTime"]; string OrgId = context.Request.Params["orgId"]; string keyword = context.Request.Params["keywords"]; string type = context.Request.Params["type"]; string page = context.Request.Params["page"]; string limit = context.Request.Params["limit"]; string bclass = context.Request.Params["class"]; string is_content = context.Request.Params["is_content"]; string is_work = context.Request.Params["is_work"]; //string treeId = context.Request.Params["treeId"]; int pageIndex = 1; int pageSize = 10;// if (!string.IsNullOrEmpty(page)) { pageIndex = int.Parse(page); } if (!string.IsNullOrEmpty(limit)) { pageSize = int.Parse(limit); } string where = " 1=1 "; string pOrgID = ""; pOrgID = OrgId; if (!string.IsNullOrEmpty(page)) { pageIndex = int.Parse(page); } if (!string.IsNullOrEmpty(limit)) { pageSize = int.Parse(limit); } if (is_content == "1") { where += " and find_in_set(org_id, cids) "; } else { where += " and org_id = '" + OrgId + "'"; } if (!string.IsNullOrEmpty(searchTime)) { where += " and (date_format(CREATETIME, '%Y-%m-%d') >= date_format('" + searchTime.Substring(0, 10) + "', '%Y-%m-%d')"; where += " and date_format(CREATETIME, '%Y-%m-%d') <= date_format('" + searchTime.Substring(13, 10) + "', '%Y-%m-%d'))"; } if (is_work != "0") { where += " and alarmType='" + is_work + " '"; } //where += limit returnstr = "{\"code\":0,\"msg\":\"\","; int count = bll.GetRecordCount(where, pOrgID); returnstr += "\"count\":" + count + ",\"data\":"; if (count == 0) { returnstr += "[]"; } else { List list = bll.QueryList(pageIndex, pageSize, where, " createtime desc", pOrgID); returnstr += FangYar.Common.JsonHelper.ToJson(list); } returnstr += "}"; } catch (Exception ex) { returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]"; // 记录操作日志 BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "摄像头报警操作请求", "查询异常:" + ex); } // 记录操作日志 BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "摄像头报警操作请求", "查询"); return returnstr; } public bool IsReusable { get { return false; } } } }