You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1194 lines
52 KiB
1194 lines
52 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text.RegularExpressions;
|
|
using System.Web;
|
|
|
|
namespace FangYar.WebUI.ashx
|
|
{
|
|
/// <summary>
|
|
/// AlarmDataHandler1 的摘要说明
|
|
/// </summary>
|
|
public class AlarmDataHandler : IHttpHandler
|
|
{
|
|
private FangYar.BLL.TBL_ALARMDATA bll = new FangYar.BLL.TBL_ALARMDATA();
|
|
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 "List":
|
|
returnstr = alarmList(context);
|
|
break;
|
|
case "ListCancel":
|
|
returnstr = ListCancel(context);
|
|
break;
|
|
case "List2":
|
|
returnstr = alarmList2(context);
|
|
break;
|
|
case "Del":
|
|
returnstr = Del(context);
|
|
break;
|
|
case "Cancel":
|
|
returnstr = Cancel(context);
|
|
break;
|
|
case "expListCar":
|
|
expListCar(context);
|
|
break;
|
|
case "expListPerson":
|
|
expListPerson(context);
|
|
break;
|
|
case "expListPersonZDJG":
|
|
expListPersonZDJG(context);
|
|
break;
|
|
case "alarmSta":
|
|
returnstr = alarmSta(context);
|
|
break;
|
|
case "getAlarmInfo":
|
|
returnstr = getAlarmInfo(context);
|
|
break;
|
|
case "homeAlarmSta":
|
|
returnstr = homeAlarmSta(context);
|
|
break;
|
|
case "homeAlarmStaAll":
|
|
returnstr = homeAlarmStaAll(context);
|
|
break;
|
|
case "addCameraAlarm":
|
|
returnstr = addCameraAlarm(context);
|
|
break;
|
|
case "alarmListZDJG":
|
|
returnstr = alarmListZDJG(context);
|
|
break;
|
|
case "alarmListZDJG2":
|
|
returnstr = alarmListZDJG2(context);
|
|
break;
|
|
}
|
|
context.Response.Write(returnstr);
|
|
}
|
|
|
|
|
|
//查询
|
|
private string alarmList(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string OrgId = context.Request.Params["OrgId"];
|
|
string is_content = context.Request.Params["is_content"];
|
|
string alarmType = context.Request.Params["ALARM_TYPE"];
|
|
string searchCarNum = context.Request.Params["searchCarNum"];
|
|
string searchName = context.Request.Params["searchName"];
|
|
string searchTime = context.Request.Params["searchTime"];
|
|
string searchType = context.Request.Params["searchType"];
|
|
string ALARMTYPE = context.Request.Params["ALARMTYPE"];
|
|
string treeID = context.Request.Params["treeID"];
|
|
|
|
string selDeptId = context.Request.Params["selDeptId"];
|
|
//登录账号所属部门
|
|
string DeptID = context.Request.Params["DeptID"] + "";
|
|
//是否管理员账号
|
|
string IsAdmin = context.Request.Params["IsAdmin"] + "";
|
|
|
|
string page = context.Request.Params["page"];
|
|
string limit = context.Request.Params["limit"];
|
|
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 ";
|
|
if (!string.IsNullOrEmpty(treeID))
|
|
{
|
|
OrgId = treeID;
|
|
}
|
|
if (!string.IsNullOrEmpty(OrgId))
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(is_content) && is_content == "1")
|
|
{
|
|
where += " and ORG_ID in ( select o.org_id from fire_org o,(select get_Org_child_list('" + OrgId + "') cids ) s where find_in_set(org_id,cids) ) ";
|
|
}
|
|
else
|
|
{
|
|
where += " and ORG_ID ='" + OrgId + "' ";
|
|
}
|
|
|
|
}
|
|
|
|
if (!string.IsNullOrWhiteSpace(selDeptId))
|
|
{
|
|
where += " and CAR_NUM in (SELECT CAR_NUM from tbl_sys_car WHERE ORG_ID='" + OrgId + "' and DEPT_ID='" + selDeptId + "' ) ";
|
|
}
|
|
|
|
//判断是否管理员账号,如果不是管理员则只查询本部门数据
|
|
if (IsAdmin != "1")
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(DeptID))
|
|
{
|
|
where += " and CAR_NUM in (SELECT CAR_NUM from tbl_sys_car WHERE ORG_ID='" + OrgId + "' and DEPT_ID='" + DeptID + "' ) ";
|
|
}
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(searchCarNum))
|
|
{
|
|
where += " and CAR_NUM like '%" + searchCarNum + "%'";
|
|
}
|
|
if (!string.IsNullOrEmpty(alarmType))
|
|
{
|
|
where += " and ALARM_TYPE='" + alarmType + "'";
|
|
}
|
|
if (!string.IsNullOrEmpty(searchName))
|
|
{
|
|
where += " and ALARM_DES like '%" + searchName + "%' ";
|
|
}
|
|
if (!string.IsNullOrEmpty(searchTime))
|
|
{
|
|
string startTime = "", endTime = "";
|
|
if (searchTime.IndexOf(" - ") != -1)
|
|
{
|
|
startTime = Regex.Split(searchTime, " - ", RegexOptions.IgnoreCase)[0];
|
|
endTime = Regex.Split(searchTime, " - ", RegexOptions.IgnoreCase)[1];
|
|
}
|
|
where += " and date_format(TIME,'%Y-%m-%d') between date_format('" + startTime + "','%Y-%m-%d') and date_format('" + endTime + "','%Y-%m-%d')";
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(searchType))
|
|
{
|
|
where += " and EXTENDCODE1='" + searchType + "'";
|
|
}
|
|
if (!string.IsNullOrEmpty(ALARMTYPE))
|
|
{
|
|
where += " and ALARMTYPE= '" + ALARMTYPE + "'";
|
|
}
|
|
|
|
returnstr = "{\"code\":0,\"msg\":\"\",";
|
|
int count = bll.GetRecordCount(where);
|
|
returnstr += "\"count\":" + count + ",\"data\":";
|
|
if (count == 0)
|
|
{
|
|
returnstr += "[]";
|
|
}
|
|
else
|
|
{
|
|
DataTable dt = bll.GetListByPage(where, " CREATETIME desc ", (pageIndex - 1) * pageSize, pageSize).Tables[0];
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(dt);
|
|
}
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]}";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "报警操作请求:", "查询报警信息异常:" + e);
|
|
}
|
|
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "报警操作请求", "查询报警信息");
|
|
return returnstr;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 查询取消
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
private string ListCancel(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string OrgId = context.Request.Params["OrgId"];
|
|
string is_content = context.Request.Params["is_content"];
|
|
string alarmType = context.Request.Params["ALARM_TYPE"];
|
|
string searchCarNum = context.Request.Params["searchCarNum"];
|
|
string searchName = context.Request.Params["searchName"];
|
|
string searchTime = context.Request.Params["searchTime"];
|
|
string searchType = context.Request.Params["searchType"];
|
|
string ALARMTYPE = context.Request.Params["ALARMTYPE"];
|
|
string treeID = context.Request.Params["treeID"];
|
|
|
|
string selDeptId = context.Request.Params["selDeptId"];
|
|
//登录账号所属部门
|
|
string DeptID = context.Request.Params["DeptID"] + "";
|
|
//是否管理员账号
|
|
string IsAdmin = context.Request.Params["IsAdmin"] + "";
|
|
|
|
string page = context.Request.Params["page"];
|
|
string limit = context.Request.Params["limit"];
|
|
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 ";
|
|
if (!string.IsNullOrEmpty(treeID))
|
|
{
|
|
OrgId = treeID;
|
|
}
|
|
if (!string.IsNullOrEmpty(OrgId))
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(is_content) && is_content == "1")
|
|
{
|
|
where += " and ORG_ID in ( select o.org_id from fire_org o,(select get_Org_child_list('" + OrgId + "') cids ) s where find_in_set(org_id,cids) ) ";
|
|
}
|
|
else
|
|
{
|
|
where += " and ORG_ID ='" + OrgId + "' ";
|
|
}
|
|
|
|
}
|
|
|
|
if (!string.IsNullOrWhiteSpace(selDeptId))
|
|
{
|
|
where += " and CAR_NUM in (SELECT CAR_NUM from tbl_sys_car WHERE ORG_ID='" + OrgId + "' and DEPT_ID='" + selDeptId + "' ) ";
|
|
}
|
|
|
|
//判断是否管理员账号,如果不是管理员则只查询本部门数据
|
|
if (IsAdmin != "1")
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(DeptID))
|
|
{
|
|
where += " and CAR_NUM in (SELECT CAR_NUM from tbl_sys_car WHERE ORG_ID='" + OrgId + "' and DEPT_ID='" + DeptID + "' ) ";
|
|
}
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(searchCarNum))
|
|
{
|
|
where += " and CAR_NUM like '%" + searchCarNum + "%'";
|
|
}
|
|
if (!string.IsNullOrEmpty(alarmType))
|
|
{
|
|
where += " and ALARM_TYPE='" + alarmType + "'";
|
|
}
|
|
if (!string.IsNullOrEmpty(searchName))
|
|
{
|
|
where += " and ALARM_DES like '%" + searchName + "%' ";
|
|
}
|
|
if (!string.IsNullOrEmpty(searchTime))
|
|
{
|
|
string startTime = "", endTime = "";
|
|
if (searchTime.IndexOf(" - ") != -1)
|
|
{
|
|
startTime = Regex.Split(searchTime, " - ", RegexOptions.IgnoreCase)[0];
|
|
endTime = Regex.Split(searchTime, " - ", RegexOptions.IgnoreCase)[1];
|
|
}
|
|
where += " and date_format(TIME,'%Y-%m-%d') between date_format('" + startTime + "','%Y-%m-%d') and date_format('" + endTime + "','%Y-%m-%d')";
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(searchType))
|
|
{
|
|
where += " and EXTENDCODE1='" + searchType + "'";
|
|
}
|
|
if (!string.IsNullOrEmpty(ALARMTYPE))
|
|
{
|
|
where += " and ALARMTYPE= '" + ALARMTYPE + "'";
|
|
}
|
|
|
|
returnstr = "{\"code\":0,\"msg\":\"\",";
|
|
//int count = bll.GetRecordCount(where);
|
|
|
|
|
|
string sql1 = "select count(1) FROM tbl_alarmdata_del where " + where;
|
|
int.TryParse(FangYar.Common.MySqlHelper.GetSingle(sql1) + "", out int count);
|
|
|
|
|
|
returnstr += "\"count\":" + count + ",\"data\":";
|
|
if (count == 0)
|
|
{
|
|
returnstr += "[]";
|
|
}
|
|
else
|
|
{
|
|
//DataTable dt = bll.GetListByPage(where, " CREATETIME desc ", (pageIndex - 1) * pageSize, pageSize).Tables[0];
|
|
|
|
var pindex = (pageIndex - 1) * pageSize;
|
|
pindex = pindex < 0 ? 0 : pindex;
|
|
|
|
string sql2 = "SELECT ID,DVC_ID,ORG_ID,TYPE,TIME,ADDR,PICSRC,VALUE,ALARM_TYPE,replace(ALARM_DES,'非法外出','违规外出') ALARM_DES" +
|
|
",EMP_ID,USERS_UID,CAR_ID,CAR_NUM,LEAVE_ID,CARAPPLY_ID,EXTENDCODE1,EXTENDCODE2,EXTENDCODE3,EXTENDCODE4,EXTENDCODE5,EXTENDCODE6,Cancel_Remark" +
|
|
",CHANNEL,CHANNELTYPE,CUSTOMINFO,DEVSERIAL,ALARMID,ALARMTYPE,CHANNELNAME,org_name,emp_name from (select j.*, k.org_name,m.emp_name " +
|
|
" from tbl_alarmdata_del j left join fire_org k on j.org_id = k.org_id left join TBL_SYS_EMP m on m.IS_ADMIN='0' and j.EMP_ID = m.id) T " +
|
|
" WHERE " + where + " order by " + " CREATETIME desc limit " + pindex + " , " + pageSize;
|
|
var dt = FangYar.Common.MySqlHelper.QueryTable(sql2);
|
|
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(dt);
|
|
}
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]}";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "报警操作请求:", "查询报警撤销信息异常:" + e);
|
|
}
|
|
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "报警操作请求", "查询报警撤销信息");
|
|
return returnstr;
|
|
}
|
|
|
|
|
|
//查询(时间段)
|
|
private string alarmList2(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string OrgId = context.Request.Params["OrgId"];
|
|
string is_content = context.Request.Params["is_content"];
|
|
string alarmType = context.Request.Params["ALARM_TYPE"];
|
|
string searchName = context.Request.Params["searchName"];
|
|
string searchTime = context.Request.Params["searchTime"];
|
|
string searchType = context.Request.Params["searchType"];
|
|
string ALARMTYPE = context.Request.Params["ALARMTYPE"];
|
|
string treeID = context.Request.Params["treeID"];
|
|
|
|
string selDeptId = context.Request.Params["selDeptId"];
|
|
//登录账号所属部门
|
|
string DeptID = context.Request.Params["DeptID"] + "";
|
|
//是否管理员账号
|
|
string IsAdmin = context.Request.Params["IsAdmin"] + "";
|
|
|
|
string page = context.Request.Params["page"];
|
|
string limit = context.Request.Params["limit"];
|
|
int pageIndex = 1;
|
|
int pageSize = 10;
|
|
if (!string.IsNullOrEmpty(page)) { pageIndex = int.Parse(page); }
|
|
if (!string.IsNullOrEmpty(limit)) { pageSize = int.Parse(limit); }
|
|
string where = null;
|
|
string pOrgId = null;
|
|
if (!string.IsNullOrEmpty(treeID))
|
|
{
|
|
OrgId = treeID;
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(OrgId))
|
|
{
|
|
//<<<<<<< HEAD
|
|
// if (!string.IsNullOrWhiteSpace(is_content)&& is_content=="1")
|
|
// {
|
|
// where += " and ORG_ID in ( select o.org_id from fire_org o,(select get_Org_child_list('" + OrgId + "') cids ) s where find_in_set(org_id,cids) ) ";
|
|
// }
|
|
// else
|
|
// {
|
|
// where += " and ORG_ID ='" + OrgId + "' ";
|
|
// }
|
|
|
|
if (is_content == "1")
|
|
{
|
|
where = " find_in_set(org_id, cids) ";
|
|
}
|
|
else
|
|
{
|
|
where = " ORG_ID = '" + OrgId + "' ";
|
|
}
|
|
pOrgId = OrgId;
|
|
}
|
|
|
|
if (!string.IsNullOrWhiteSpace(selDeptId))
|
|
{
|
|
where += " and CAR_NUM in (SELECT CAR_NUM from tbl_sys_car WHERE ORG_ID='" + OrgId + "' and DEPT_ID='" + selDeptId + "' ) ";
|
|
}
|
|
|
|
//判断是否管理员账号,如果不是管理员则只查询本部门数据
|
|
if (IsAdmin != "1")
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(DeptID))
|
|
{
|
|
where += " and CAR_NUM in (SELECT CAR_NUM from tbl_sys_car WHERE ORG_ID='" + OrgId + "' and DEPT_ID='" + DeptID + "' ) ";
|
|
}
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(alarmType))
|
|
{
|
|
where += " and ALARM_TYPE='" + alarmType + "'";
|
|
}
|
|
if (!string.IsNullOrEmpty(searchName))
|
|
{
|
|
where += " and EMP_NAME like '%" + searchName + "%' ";
|
|
}
|
|
if (!string.IsNullOrEmpty(searchTime))
|
|
{
|
|
string startTime = "", endTime = "";
|
|
if (searchTime.IndexOf(" - ") != -1)
|
|
{
|
|
startTime = Regex.Split(searchTime, " - ", RegexOptions.IgnoreCase)[0];
|
|
endTime = Regex.Split(searchTime, " - ", RegexOptions.IgnoreCase)[1];
|
|
}
|
|
where += " and date_format(TIME,'%Y-%m-%d') between date_format('" + startTime + "','%Y-%m-%d') and date_format('" + endTime + "','%Y-%m-%d')";
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(searchType))
|
|
{
|
|
where += " and EXTENDCODE1='" + searchType + "'";
|
|
}
|
|
if (!string.IsNullOrEmpty(ALARMTYPE))
|
|
{
|
|
where += " and ALARMTYPE= '" + ALARMTYPE + "'";
|
|
}
|
|
|
|
returnstr = "{\"code\":0,\"msg\":\"\",";
|
|
int count = bll.GetRecordCount(where, pOrgId);
|
|
returnstr += "\"count\":" + count + ",\"data\":";
|
|
if (count == 0)
|
|
{
|
|
returnstr += "[]";
|
|
}
|
|
else
|
|
{
|
|
DataTable dt = bll.GetListByPage(where, " CREATETIME desc ", (pageIndex - 1) * pageSize, pageSize, pOrgId).Tables[0];
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(dt);
|
|
}
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]}";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "报警操作请求:", "查询报警信息异常:" + e);
|
|
}
|
|
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "报警操作请求", "查询报警信息");
|
|
return returnstr;
|
|
}
|
|
|
|
//查询
|
|
private string alarmListZDJG(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string OrgId = context.Request.Params["OrgId"];
|
|
string alarmType = context.Request.Params["ALARM_TYPE"];
|
|
string searchName = context.Request.Params["searchName"];
|
|
string searchTime = context.Request.Params["searchTime"];
|
|
string searchType = context.Request.Params["searchType"];
|
|
string page = context.Request.Params["page"];
|
|
string limit = context.Request.Params["limit"];
|
|
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 ";
|
|
if (!string.IsNullOrEmpty(OrgId))
|
|
{
|
|
where += " and EMP_ID in (select ID from tbl_sys_emp where DEPT_ID = '" + OrgId + "')";
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(alarmType))
|
|
{
|
|
where += " and ALARM_TYPE='" + alarmType + "'";
|
|
}
|
|
if (!string.IsNullOrEmpty(searchName))
|
|
{
|
|
where += " and ALARM_DES like '%" + searchName + "%' ";
|
|
}
|
|
if (!string.IsNullOrEmpty(searchTime))
|
|
{
|
|
where += " and date_format(TIME,'%Y-%m-%d') =date_format('" + searchTime + "','%Y-%m-%d')";
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(searchType))
|
|
{
|
|
where += " and EXTENDCODE1='" + searchType + "'";
|
|
}
|
|
// 总队机关报警信息七月份以后数据暂不显示
|
|
where += " and TIME < '2022-07-01' ";
|
|
|
|
returnstr = "{\"code\":0,\"msg\":\"\",";
|
|
int count = bll.GetRecordCount(where);
|
|
returnstr += "\"count\":" + count + ",\"data\":";
|
|
if (count == 0)
|
|
{
|
|
returnstr += "[]";
|
|
}
|
|
else
|
|
{
|
|
DataTable dt = bll.GetListByPage(where, " TIME desc ", (pageIndex - 1) * pageSize, pageSize).Tables[0];
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(dt);
|
|
}
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]}";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "报警操作请求", "查询报警信息(总队机关)异常:" + e);
|
|
}
|
|
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "报警操作请求", "查询报警信息(总队机关)");
|
|
return returnstr;
|
|
}
|
|
|
|
//查询(时间段)
|
|
private string alarmListZDJG2(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string OrgId = context.Request.Params["OrgId"];
|
|
string alarmType = context.Request.Params["ALARM_TYPE"];
|
|
string searchName = context.Request.Params["searchName"];
|
|
string searchTime = context.Request.Params["searchTime"];
|
|
string searchType = context.Request.Params["searchType"];
|
|
string page = context.Request.Params["page"];
|
|
string limit = context.Request.Params["limit"];
|
|
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 ";
|
|
if (!string.IsNullOrEmpty(OrgId))
|
|
{
|
|
where += " and EMP_ID in (select ID from tbl_sys_emp where DEPT_ID = '" + OrgId + "')";
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(alarmType))
|
|
{
|
|
where += " and ALARM_TYPE='" + alarmType + "'";
|
|
}
|
|
if (!string.IsNullOrEmpty(searchName))
|
|
{
|
|
where += " and ALARM_DES like '%" + searchName + "%' ";
|
|
}
|
|
if (!string.IsNullOrEmpty(searchTime))
|
|
{
|
|
string startTime = "", endTime = "";
|
|
if (searchTime.IndexOf(" - ") != -1)
|
|
{
|
|
startTime = Regex.Split(searchTime, " - ", RegexOptions.IgnoreCase)[0];
|
|
endTime = Regex.Split(searchTime, " - ", RegexOptions.IgnoreCase)[1];
|
|
}
|
|
where += " and date_format(TIME,'%Y-%m-%d') between date_format('" + startTime + "','%Y-%m-%d') and date_format('" + endTime + "','%Y-%m-%d')";
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(searchType))
|
|
{
|
|
where += " and EXTENDCODE1='" + searchType + "'";
|
|
}
|
|
// 总队机关报警信息七月份以后数据暂不显示
|
|
//where += " and TIME < '2022-07-01' ";
|
|
|
|
returnstr = "{\"code\":0,\"msg\":\"\",";
|
|
int count = bll.GetRecordCount(where);
|
|
returnstr += "\"count\":" + count + ",\"data\":";
|
|
if (count == 0)
|
|
{
|
|
returnstr += "[]";
|
|
}
|
|
else
|
|
{
|
|
DataTable dt = bll.GetListByPage(where, " TIME desc ", (pageIndex - 1) * pageSize, pageSize).Tables[0];
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(dt);
|
|
}
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]}";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "报警操作请求", "查询报警信息(总队机关)异常:" + e);
|
|
}
|
|
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "报警操作请求", "查询报警信息(总队机关)");
|
|
return returnstr;
|
|
}
|
|
|
|
//删除
|
|
private string Del(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
int code = -1;
|
|
string msg = "";
|
|
string delempdvc = "";
|
|
try
|
|
{
|
|
string id = context.Request.Params["id"];
|
|
if (bll.Delete(id))
|
|
{
|
|
msg = "删除成功!";
|
|
code = 1;
|
|
}
|
|
else
|
|
{
|
|
msg = "删除失败!";
|
|
}
|
|
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
msg = e.Message;
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "报警操作请求", "删除报警信息异常:" + e);
|
|
}
|
|
returnstr = "{\"code\":" + code + ",\"msg\":\"" + msg + "\",\"delempdvc\":\"" + delempdvc + "\"}";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Delete, "报警操作请求", "删除报警信息");
|
|
return returnstr;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 撤销
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
private string Cancel(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
int code = -1;
|
|
string msg = "";
|
|
string delempdvc = "";
|
|
try
|
|
{
|
|
string id = context.Request.Params["id"];
|
|
//
|
|
string Cancel_Remark = context.Request.Params["MARK_REMARK"];
|
|
|
|
if (!string.IsNullOrWhiteSpace(Cancel_Remark))
|
|
{
|
|
|
|
|
|
string sql = @" insert into tbl_alarmdata_del(ID,DVC_ID,ORG_ID,TYPE,TIME,ADDR,PIC,PICSRC,VALUE,ALARM_TYPE,ALARM_DES,EMP_ID
|
|
,USERS_UID,CAR_ID,CAR_NUM,LEAVE_ID,CARAPPLY_ID,EXTENDCODE1,EXTENDCODE2,EXTENDCODE3,EXTENDCODE4,EXTENDCODE5,EXTENDCODE6
|
|
,CHANNEL,CHANNELTYPE,CUSTOMINFO,DEVSERIAL,ALARMID,ALARMTYPE,CHANNELNAME,createtime,Cancel_Remark)
|
|
select ID,DVC_ID,ORG_ID,TYPE,TIME,ADDR,PIC,PICSRC,VALUE,ALARM_TYPE,ALARM_DES,EMP_ID
|
|
,USERS_UID,CAR_ID,CAR_NUM,LEAVE_ID,CARAPPLY_ID,EXTENDCODE1,EXTENDCODE2,EXTENDCODE3,EXTENDCODE4,EXTENDCODE5,EXTENDCODE6
|
|
,CHANNEL,CHANNELTYPE,CUSTOMINFO,DEVSERIAL,ALARMID,ALARMTYPE,CHANNELNAME,now(),'" + Cancel_Remark + @"' Cancel_Remark
|
|
from TBL_ALARMDATA where id = '" + id + "'; delete from TBL_ALARMDATA where id = '" + id + "'; ";
|
|
|
|
var n = Common.MySqlHelper.Execute(sql);
|
|
|
|
if (n > 0)
|
|
{
|
|
msg = "操作成功!";
|
|
code = 1;
|
|
}
|
|
else
|
|
{
|
|
msg = "操作失败!";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
msg = "未填写说明";
|
|
}
|
|
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
msg = e.Message;
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "报警操作请求", "删除报警信息异常:" + e);
|
|
}
|
|
returnstr = "{\"code\":" + code + ",\"msg\":\"" + msg + "\",\"delempdvc\":\"" + delempdvc + "\"}";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Delete, "报警操作请求", "删除报警信息");
|
|
return returnstr;
|
|
}
|
|
|
|
//导出
|
|
private void expListCar(HttpContext context)
|
|
{
|
|
try
|
|
{
|
|
string OrgId = context.Request.Params["OrgId"];
|
|
string is_content = context.Request.Params["is_content"];
|
|
string alarmType = context.Request.Params["ALARM_TYPE"];
|
|
string searchCarNum = context.Request.Params["searchCarNum"];
|
|
string searchName = context.Request.Params["searchName"];
|
|
string searchTime = context.Request.Params["searchTime"];
|
|
string searchType = context.Request.Params["searchType"];
|
|
string ALARMTYPE = context.Request.Params["ALARMTYPE"];
|
|
string treeID = context.Request.Params["treeID"];
|
|
|
|
string selDeptId = context.Request.Params["selDeptId"];
|
|
//登录账号所属部门
|
|
string DeptID = context.Request.Params["DeptID"] + "";
|
|
//是否管理员账号
|
|
string IsAdmin = context.Request.Params["IsAdmin"] + "";
|
|
|
|
string page = context.Request.Params["page"];
|
|
string limit = context.Request.Params["limit"];
|
|
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 ";
|
|
if (!string.IsNullOrEmpty(treeID))
|
|
{
|
|
OrgId = treeID;
|
|
}
|
|
if (!string.IsNullOrEmpty(OrgId))
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(is_content) && is_content == "1")
|
|
{
|
|
where += " and ORG_ID in ( select o.org_id from fire_org o,(select get_Org_child_list('" + OrgId + "') cids ) s where find_in_set(org_id,cids) ) ";
|
|
}
|
|
else
|
|
{
|
|
where += " and ORG_ID ='" + OrgId + "' ";
|
|
}
|
|
|
|
}
|
|
|
|
if (!string.IsNullOrWhiteSpace(selDeptId))
|
|
{
|
|
where += " and CAR_NUM in (SELECT CAR_NUM from tbl_sys_car WHERE ORG_ID='" + OrgId + "' and DEPT_ID='" + selDeptId + "' ) ";
|
|
}
|
|
|
|
//判断是否管理员账号,如果不是管理员则只查询本部门数据
|
|
if (IsAdmin != "1")
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(DeptID))
|
|
{
|
|
where += " and CAR_NUM in (SELECT CAR_NUM from tbl_sys_car WHERE ORG_ID='" + OrgId + "' and DEPT_ID='" + DeptID + "' ) ";
|
|
}
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(searchCarNum))
|
|
{
|
|
where += " and CAR_NUM='" + searchCarNum + "'";
|
|
}
|
|
if (!string.IsNullOrEmpty(alarmType))
|
|
{
|
|
where += " and ALARM_TYPE='" + alarmType + "'";
|
|
}
|
|
if (!string.IsNullOrEmpty(searchName))
|
|
{
|
|
where += " and ALARM_DES like '%" + searchName + "%' ";
|
|
}
|
|
if (!string.IsNullOrEmpty(searchTime))
|
|
{
|
|
string startTime = "", endTime = "";
|
|
if (searchTime.IndexOf(" - ") != -1)
|
|
{
|
|
startTime = Regex.Split(searchTime, " - ", RegexOptions.IgnoreCase)[0];
|
|
endTime = Regex.Split(searchTime, " - ", RegexOptions.IgnoreCase)[1];
|
|
}
|
|
where += " and date_format(TIME,'%Y-%m-%d') between date_format('" + startTime + "','%Y-%m-%d') and date_format('" + endTime + "','%Y-%m-%d')";
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(searchType))
|
|
{
|
|
where += " and EXTENDCODE1='" + searchType + "'";
|
|
}
|
|
if (!string.IsNullOrEmpty(ALARMTYPE))
|
|
{
|
|
where += " and ALARMTYPE= '" + ALARMTYPE + "'";
|
|
}
|
|
int count = bll.GetRecordCount(where);
|
|
if (count == 0)
|
|
{
|
|
}
|
|
else
|
|
{
|
|
DataTable dt = bll.expListCar(0, count, where, " CREATETIME desc ");
|
|
Dictionary<string, string> cellHeaders = new System.Collections.Generic.Dictionary<string, string>();
|
|
cellHeaders.Add("CAR_NUM", "车牌号");
|
|
cellHeaders.Add("org_name", "机构");
|
|
cellHeaders.Add("EXTENDCODE1", "类型");
|
|
cellHeaders.Add("TIME", "时间");
|
|
cellHeaders.Add("ALARM_DES", "描述");
|
|
|
|
FangYar.Common.NPOIExcelHelper.ExportByWeb(dt, null, cellHeaders, DateTime.Now.ToString("yyyyMMddHHmmss") + "车辆报警表.xls");
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "报警操作请求", "导出车辆报警信息异常:" + e);
|
|
}
|
|
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Other, "报警操作请求", "导出车辆报警信息");
|
|
}
|
|
|
|
private void expListPerson(HttpContext context)
|
|
{
|
|
try
|
|
{
|
|
string OrgId = context.Request.Params["OrgId"];
|
|
string is_content = context.Request.Params["is_content"];
|
|
string alarmType = context.Request.Params["ALARM_TYPE"];
|
|
string searchName = context.Request.Params["searchName"];
|
|
string searchTime = context.Request.Params["searchTime"];
|
|
string searchType = context.Request.Params["searchType"];
|
|
string ALARMTYPE = context.Request.Params["ALARMTYPE"];
|
|
string treeID = context.Request.Params["treeID"];
|
|
|
|
string selDeptId = context.Request.Params["selDeptId"];
|
|
//登录账号所属部门
|
|
string DeptID = context.Request.Params["DeptID"] + "";
|
|
//是否管理员账号
|
|
string IsAdmin = context.Request.Params["IsAdmin"] + "";
|
|
|
|
string page = context.Request.Params["page"];
|
|
string limit = context.Request.Params["limit"];
|
|
int pageIndex = 1;
|
|
int pageSize = 10;
|
|
if (!string.IsNullOrEmpty(page)) { pageIndex = int.Parse(page); }
|
|
if (!string.IsNullOrEmpty(limit)) { pageSize = int.Parse(limit); }
|
|
string where = null;
|
|
string pOrgId = null;
|
|
if (!string.IsNullOrEmpty(treeID))
|
|
{
|
|
OrgId = treeID;
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(OrgId))
|
|
{
|
|
if (is_content == "1")
|
|
{
|
|
where = " find_in_set(org_id, cids) ";
|
|
}
|
|
else
|
|
{
|
|
where = " ORG_ID = '" + OrgId + "' ";
|
|
}
|
|
pOrgId = OrgId;
|
|
}
|
|
|
|
if (!string.IsNullOrWhiteSpace(selDeptId))
|
|
{
|
|
where += " and CAR_NUM in (SELECT CAR_NUM from tbl_sys_car WHERE ORG_ID='" + OrgId + "' and DEPT_ID='" + selDeptId + "' ) ";
|
|
}
|
|
|
|
//判断是否管理员账号,如果不是管理员则只查询本部门数据
|
|
if (IsAdmin != "1")
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(DeptID))
|
|
{
|
|
where += " and CAR_NUM in (SELECT CAR_NUM from tbl_sys_car WHERE ORG_ID='" + OrgId + "' and DEPT_ID='" + DeptID + "' ) ";
|
|
}
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(alarmType))
|
|
{
|
|
where += " and ALARM_TYPE='" + alarmType + "'";
|
|
}
|
|
if (!string.IsNullOrEmpty(searchName))
|
|
{
|
|
where += " and EMP_NAME like '%" + searchName + "%' ";
|
|
}
|
|
if (!string.IsNullOrEmpty(searchTime))
|
|
{
|
|
string startTime = "", endTime = "";
|
|
if (searchTime.IndexOf(" - ") != -1)
|
|
{
|
|
startTime = Regex.Split(searchTime, " - ", RegexOptions.IgnoreCase)[0];
|
|
endTime = Regex.Split(searchTime, " - ", RegexOptions.IgnoreCase)[1];
|
|
}
|
|
where += " and date_format(TIME,'%Y-%m-%d') between date_format('" + startTime + "','%Y-%m-%d') and date_format('" + endTime + "','%Y-%m-%d')";
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(searchType))
|
|
{
|
|
where += " and EXTENDCODE1='" + searchType + "'";
|
|
}
|
|
if (!string.IsNullOrEmpty(ALARMTYPE))
|
|
{
|
|
where += " and ALARMTYPE= '" + ALARMTYPE + "'";
|
|
}
|
|
int count = bll.GetRecordCount(where, pOrgId);
|
|
if (count == 0)
|
|
{
|
|
}
|
|
else
|
|
{
|
|
//
|
|
DataTable dt = bll.expListPerson(0, count, where, " time desc ", pOrgId);
|
|
|
|
Dictionary<string, string> cellHeaders = new System.Collections.Generic.Dictionary<string, string>();
|
|
cellHeaders.Add("emp_name", "姓名");
|
|
cellHeaders.Add("org_name", "机构");
|
|
cellHeaders.Add("EXTENDCODE1", "类型");
|
|
cellHeaders.Add("TIME", "时间");
|
|
cellHeaders.Add("ALARM_DES", "描述");
|
|
|
|
FangYar.Common.NPOIExcelHelper.ExportByWeb(dt, null, cellHeaders, DateTime.Now.ToString("yyyyMMddHHmmss") + "人员报警表.xls");
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "报警操作请求", "导出人员报警信息异常:" + e);
|
|
}
|
|
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Other, "报警操作请求", "导出人员报警信息");
|
|
}
|
|
|
|
|
|
|
|
private void expListPersonZDJG(HttpContext context)
|
|
{
|
|
try
|
|
{
|
|
string OrgId = context.Request.Params["OrgId"];
|
|
string alarmType = context.Request.Params["ALARM_TYPE"];
|
|
|
|
string searchTime = context.Request.Params["searchTime"];
|
|
string searchType = context.Request.Params["searchType"];
|
|
string page = context.Request.Params["page"];
|
|
string limit = context.Request.Params["limit"];
|
|
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 ";
|
|
|
|
if (!string.IsNullOrEmpty(OrgId))
|
|
{
|
|
where += " and EMP_ID in (select ID from tbl_sys_emp where DEPT_ID = '" + OrgId + "') and org_id = '734389c7ae364584aea9918693bba3de' ";
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(alarmType))
|
|
{
|
|
where += " and ALARM_TYPE='" + alarmType + "'";
|
|
}
|
|
if (!string.IsNullOrEmpty(searchTime))
|
|
{
|
|
where += " and date_format(TIME,'%Y-%m-%d') =date_format('" + searchTime + "','%Y-%m-%d')";
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(searchType))
|
|
{
|
|
where += " and EXTENDCODE1='" + searchType + "'";
|
|
}
|
|
int count = bll.GetRecordCount(where);
|
|
if (count == 0)
|
|
{
|
|
}
|
|
else
|
|
{
|
|
//访客出入记录表
|
|
DataTable dt = bll.expListPerson(0, count, where, " time desc ");
|
|
Dictionary<string, string> cellHeaders = new System.Collections.Generic.Dictionary<string, string>();
|
|
cellHeaders.Add("emp_name", "姓名");
|
|
cellHeaders.Add("org_name", "机构");
|
|
cellHeaders.Add("EXTENDCODE1", "类型");
|
|
cellHeaders.Add("TIME", "时间");
|
|
cellHeaders.Add("ALARM_DES", "描述");
|
|
|
|
FangYar.Common.NPOIExcelHelper.ExportByWeb(dt, null, cellHeaders, DateTime.Now.ToString("yyyyMMddHHmmss") + "人员报警表.xls");
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "报警操作请求", "导出人员报警信息异常:" + e);
|
|
}
|
|
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Other, "报警操作请求", "导出人员报警信息");
|
|
}
|
|
|
|
private string alarmSta(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
int code = -1;
|
|
string msg = "";
|
|
string data = "";
|
|
try
|
|
{
|
|
string ORG_ID = context.Request.Params["Org_Id"];
|
|
string Alarm_Type = context.Request.Params["Alarm_Type"];
|
|
string S_Time = context.Request.Params["S_Time"];
|
|
string E_Time = context.Request.Params["E_Time"];
|
|
string is_content = context.Request.Params["is_content"];
|
|
if (!string.IsNullOrEmpty(ORG_ID))
|
|
{
|
|
code = 1;
|
|
string strWhere = "";
|
|
if (!string.IsNullOrEmpty(is_content))
|
|
{
|
|
strWhere = " ORG_ID in (select o.org_id from fire_org o,(select get_Org_child_list('" + ORG_ID + "') cids ) s where o.type = '0' and FIND_IN_SET(org_id,cids)) ";
|
|
}
|
|
else
|
|
{
|
|
strWhere = " ORG_ID='" + ORG_ID + "' ";
|
|
}
|
|
if (!string.IsNullOrEmpty(Alarm_Type))
|
|
{
|
|
strWhere += " and ALARM_TYPE = '" + Alarm_Type + "'";
|
|
}
|
|
if (!string.IsNullOrEmpty(S_Time) && !string.IsNullOrEmpty(E_Time))
|
|
{
|
|
strWhere += " and date(TIME) between '" + S_Time + "' and '" + E_Time + "' ";
|
|
}
|
|
else
|
|
{
|
|
strWhere += " and date_format(now(),'%Y-%m-%d') = date_format(TIME,'%Y-%m-%d')";
|
|
}
|
|
|
|
DataTable dt = bll.alarmSta(strWhere);
|
|
data = FangYar.Common.JsonHelper.ToJson(dt);
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
msg = "获取失败!";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "报警操作请求", "查询报警信息[alarmSta]异常:" + e);
|
|
}
|
|
returnstr = "{\"code\":" + code + ",\"msg\":\"" + msg + "\",\"data\":" + data + "}";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "报警操作请求", "查询报警信息[alarmSta]");
|
|
return returnstr;
|
|
}
|
|
|
|
|
|
private string getAlarmInfo(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
int code = -1;
|
|
string msg = "";
|
|
string data = "";
|
|
try
|
|
{
|
|
string taskId = context.Request.Params["taskId"];
|
|
if (!string.IsNullOrEmpty(taskId))
|
|
{
|
|
Model.OA.TBL_ALARMDATA model = bll.GetModel(taskId);
|
|
data = Common.JsonHelper.ToJson(model);
|
|
code = 1;
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
msg = "获取失败!";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "报警操作请求", "查询报警信息[getAlarmInfo]异常:" + e);
|
|
}
|
|
returnstr = "{\"code\":" + code + ",\"msg\":\"" + msg + "\",\"data\":" + data + "}";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "报警操作请求", "查询报警信息[getAlarmInfo]");
|
|
return returnstr;
|
|
}
|
|
/// <summary>
|
|
/// 首页报警统计
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
private string homeAlarmSta(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
int code = -1;
|
|
string msg = "";
|
|
string data = "";
|
|
string strWhere = " 1=1";
|
|
try
|
|
{
|
|
string ORG_ID = context.Request.Params["Org_Id"];
|
|
if (!string.IsNullOrEmpty(ORG_ID))
|
|
{
|
|
code = 1;
|
|
strWhere += " and ORG_ID='" + ORG_ID + "'";
|
|
strWhere += " and date_format( time, '%Y-%m-%d' ) >= date_format( date_sub(now(), INTERVAL 7 DAY), '%Y-%m-%d' )";
|
|
|
|
DataTable dt = bll.homeAlarmSta(strWhere);
|
|
data = FangYar.Common.JsonHelper.ToJson(dt);
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
msg = "获取失败!";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "报警操作请求", "查询首页报警统计异常:" + e);
|
|
}
|
|
returnstr = "{\"code\":" + code + ",\"msg\":\"" + msg + "\",\"data\":" + data + "}";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "报警操作请求", "查询首页报警统计");
|
|
return returnstr;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 首页报警统计
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
private string homeAlarmStaAll(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
int code = -1;
|
|
string msg = "";
|
|
string data = "";
|
|
string strWhere = " (ALARM_TYPE='1'||ALARM_TYPE='2') ";
|
|
try
|
|
{
|
|
string ORG_ID = context.Request.Params["Org_Id"];
|
|
if (!string.IsNullOrEmpty(ORG_ID))
|
|
{
|
|
code = 1;
|
|
strWhere += " and date_format( time, '%Y-%m-%d' ) >= date_format( date_sub(now(), INTERVAL 7 DAY), '%Y-%m-%d' )";
|
|
strWhere += " and org_id in (select o.org_id from fire_org o,(select get_Org_child_list('" + ORG_ID + "') cids ) s where o.type = '0' and find_in_set(o.org_id,cids) )";
|
|
|
|
|
|
DataTable dt = bll.homeAlarmSta(strWhere);
|
|
data = FangYar.Common.JsonHelper.ToJson(dt);
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
msg = "获取失败!";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "报警操作请求", "查询首页报警统计[homeAlarmStaAll]异常:" + e);
|
|
}
|
|
returnstr = "{\"code\":" + code + ",\"msg\":\"" + msg + "\",\"data\":" + data + "}";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "报警操作请求", "查询首页报警统计[homeAlarmStaAll]");
|
|
return returnstr;
|
|
}
|
|
//添加
|
|
private string addCameraAlarm(HttpContext context)
|
|
{
|
|
HttpRequest request = context.Request;
|
|
Stream stream = request.InputStream;
|
|
|
|
string returnstr = "";
|
|
int code = -1;
|
|
string msg = "";
|
|
try
|
|
{
|
|
string car_name = context.Request.Params["car_name"];//车辆名称
|
|
|
|
//报警表
|
|
FangYar.Model.OA.TBL_ALARMDATA model = new FangYar.Model.OA.TBL_ALARMDATA();
|
|
|
|
if (bll.Add(model))
|
|
{
|
|
msg = "添加成功!";
|
|
code = 1;
|
|
}
|
|
else { msg = "添加失败!"; }
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
msg = "添加失败!";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "报警操作请求", "添加报警信息异常:" + e);
|
|
}
|
|
returnstr = "{\"msg\":\"" + msg + "\",\"code\":" + code + "}";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "报警操作请求", "添加报警信息");
|
|
return returnstr;
|
|
}
|
|
|
|
public bool IsReusable
|
|
{
|
|
get
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|