StatisticalController.cs 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. using LeaRun.Application.Busines.PipeNetworkManage;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Web;
  6. using System.Web.Mvc;
  7. using LeaRun.Util.WebControl;
  8. using LeaRun.Util;
  9. using Newtonsoft.Json;
  10. namespace LeaRun.Application.Web.Areas.PipeNetworkManage.Controllers
  11. {
  12. public class StatisticalController : MvcControllerBase
  13. {
  14. private AnalysisBLL ipmAnalysisBll = new AnalysisBLL();
  15. #region 试图功能
  16. /// <summary>
  17. /// 用水分析
  18. /// </summary>
  19. /// <returns></returns>
  20. public ActionResult WaterAnalysis()
  21. {
  22. return View();
  23. }
  24. #endregion
  25. #region 获取数据
  26. /// <summary>
  27. /// 月统计
  28. /// </summary>
  29. /// <param name="pagination"></param>
  30. /// <param name="DeviceID"></param>
  31. /// <param name="time"></param>
  32. /// <returns></returns>
  33. public ActionResult GetMonthReport(string DeviceID, string time,Pagination pagination)
  34. {
  35. if (string.IsNullOrEmpty(DeviceID) && string.IsNullOrEmpty(time))
  36. {
  37. return Content("");
  38. }
  39. else
  40. {
  41. var data = ipmAnalysisBll.GetMonthAnalysis(DeviceID, time, pagination);
  42. var watch = CommonHelper.TimerStart();
  43. var JsonData = new
  44. {
  45. rows = JsonConvert.DeserializeObject(data),
  46. total = pagination.total,
  47. page = pagination.page,
  48. records = pagination.records,
  49. costtime = CommonHelper.TimerEnd(watch)
  50. };
  51. return Content(JsonData.ToJson());
  52. }
  53. }
  54. /// <summary>
  55. /// 年统计
  56. /// </summary>
  57. /// <param name="DepartmentId"></param>
  58. /// <param name="TypeID"></param>
  59. /// <param name="DeviceID"></param>
  60. /// <param name="time"></param>
  61. /// <returns></returns>
  62. public ActionResult GetYearReport(string DeviceID, string time, Pagination pagination)
  63. {
  64. if (string.IsNullOrEmpty(DeviceID) && string.IsNullOrEmpty(time))
  65. {
  66. return Content("");
  67. }
  68. else
  69. {
  70. var data = ipmAnalysisBll.GetYearAnalysis(DeviceID, time, pagination);
  71. var watch = CommonHelper.TimerStart();
  72. var JsonData = new
  73. {
  74. rows = JsonConvert.DeserializeObject(data),
  75. total = pagination.total,
  76. page = pagination.page,
  77. records = pagination.records,
  78. costtime = CommonHelper.TimerEnd(watch)
  79. };
  80. return Content(JsonData.ToJson());
  81. }
  82. }
  83. #endregion
  84. }
  85. }