123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251 |
- using LeaRun.Application.Busines.NBManage;
- using LeaRun.Application.Code;
- using LeaRun.Application.Entity.NBManage;
- using LeaRun.Util;
- using LeaRun.Util.WebControl;
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- namespace LeaRun.Application.Web.Areas.NBManage.Controllers
- {
- public class NBHistorySearchController : MvcControllerBase
- {
- NBHistoryBLL historyBLL = new NBHistoryBLL();
- //历史记录查询
- #region 视图功能
- //[HttpGet]
- //[HandlerAuthorize(PermissionMode.Enforce)]
- public ActionResult Index()
- {
- return View();
- }
- #endregion
- #region 获取数据
- [HttpGet]
- public ActionResult GetRecordJson(Pagination pagination, string queryType, string queryValue, string userNo, string imei, string thisDate = "", string lastDate = "")
- {
- var json = "[]";
- var watch = CommonHelper.TimerStart();
- DataTable data = null;
- try
- {
- string where = " Where 1=1 ";
- if (!string.IsNullOrEmpty(queryType))
- {
- switch (queryType)
- {
- case "1":
- if (!string.IsNullOrEmpty(queryValue))
- {
- where += " And f.AreaId=" + queryValue;
- }
- break;
- case "2":
- if (!string.IsNullOrEmpty(queryValue))
- {
- where += " And e.BldgId=" + queryValue;
- }
- break;
- case "3":
- if (!string.IsNullOrEmpty(queryValue))
- {
- where += " And d.ApmtId=" + queryValue;
- }
- break;
- case "4":
- if (!string.IsNullOrEmpty(queryValue))
- {
- where += " And c.RoomId=" + queryValue;
- }
- break;
- }
- }
- if (!string.IsNullOrEmpty(userNo))
- {
- where += " and c.UserNo like '%" + userNo + "%'";
- }
- if (!string.IsNullOrEmpty(imei))
- {
- where += " and b.IMEI like '%" + imei + "% '";
- }
- if (!string.IsNullOrEmpty(thisDate) && string.IsNullOrEmpty(lastDate))
- {
- where += " and a.ReadingDT > '" + thisDate + "'";
- }
- if (string.IsNullOrEmpty(thisDate) && !string.IsNullOrEmpty(lastDate))
- {
- where += " and a.ReadingDT < '" + lastDate + "'";
- }
- if (!string.IsNullOrEmpty(thisDate) && !string.IsNullOrEmpty(lastDate))
- {
- where += " and a.ReadingDT between '" + thisDate + "' And '" + lastDate + "'";
- }
- if (!OperatorProvider.Provider.Current().IsSystem)
- {
- where += " And f.CompanyId= '" + OperatorProvider.Provider.Current().CompanyId + "'";
- }
- data = historyBLL.GetHistory(where, pagination);
- var JsonData = new
- {
- rows = data,
- total = pagination.total,
- page = pagination.page,
- records = pagination.records,
- costtime = CommonHelper.TimerEnd(watch)
- };
- return Content(JsonData.ToJson());
- }
- catch (Exception ex)
- {
- var JsonData = new
- {
- rows = data,
- total = pagination.total,
- page = pagination.page,
- records = pagination.records,
- costtime = CommonHelper.TimerEnd(watch)
- };
- return Content(JsonData.ToJson());
- }
- }
- /// <summary>
- /// 小区列表(主要是绑定下拉框)
- /// </summary>
- /// <param name="parentId">节点Id</param>
- /// <returns>返回列表Json</returns>
- [HttpGet]
- public ActionResult GetAreaListJson()
- {
- var data = historyBLL.GetAreaList();
- return Content(data.ToJson());
- }
- [HttpGet]
- public ActionResult GetBldgListJson(string parentId)
- {
- var data = historyBLL.GetBldgByArea(parentId);
- return Content(data.ToJson());
- }
- [HttpGet]
- public ActionResult GetApmtListJson(string parentId)
- {
- var data = historyBLL.GetApmtByBldg(parentId);
- return Content(data.ToJson());
- }
- [HttpGet]
- public ActionResult GetRoomListJson(string parentId)
- {
- var data = historyBLL.GetUserByApmt(parentId);
- return Content(data.ToJson());
- }
- [HttpGet]
- public ActionResult GetDeviceJson(string parentId)
- {
- var data = historyBLL.GetDeviceByRoom(parentId);
- return Content(data.ToJson());
- }
- #endregion
- public ActionResult GetPlatformRecord(string queryType, string queryValue, string thisDate = "", string lastDate = "", string isButton = "")
- {
- var dataResult = historyBLL.GetPlatformRecord(queryType, queryValue, thisDate, lastDate, isButton);
- return Content(dataResult.ToJson());
- }
- /// <summary>
- /// 从华为平台获取历史记录
- /// </summary>
- /// <returns></returns>
- public ActionResult Platform()
- {
- return View();
- }
- /// <summary>
- /// 实时数据
- /// </summary>
- /// <returns></returns>
- public ActionResult RealTimeData()
- {
- return View();
- }
- public ActionResult GetRealTimeData(Pagination pagination, string areaID)
- {
- var watch = CommonHelper.TimerStart();
- DataTable data = historyBLL.GetRealTimeData(pagination, areaID);
- var JsonData = new
- {
- rows = data,
- total = pagination.total,
- page = pagination.page,
- records = pagination.records,
- costtime = CommonHelper.TimerEnd(watch)
- };
- return Content(JsonData.ToJson());
- }
- #region 2022-03-25 GetLastedDataBySql
- public ActionResult GetLastedDataBySql()
- {
- return View();
- }
- public ActionResult GetRealTimeDataBySql(Pagination pagination, string areaID)
- {
- var watch = CommonHelper.TimerStart();
- DataTable data = historyBLL.GetRealTimeDataBySql(pagination, areaID);
- var JsonData = new
- {
- rows = data,
- total = pagination.total,
- page = pagination.page,
- records = pagination.records,
- costtime = CommonHelper.TimerEnd(watch)
- };
- return Content(JsonData.ToJson());
- }
- #endregion
-
- public string GetNBMeterHisData(string meterAddr, string beginDate)
- {
- string dtResult = historyBLL.GetNBMeterHisData(meterAddr, beginDate);
- return dtResult;
- }
- /// <summary>
- /// 每只表 去最先的数据
- /// </summary>
- /// <returns></returns>
- public ActionResult GetLastedData()
- {
- return View();
- }
- }
- }
|