HomeController.cs 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using PMS.BusinessModels.Account;
  7. using PMS.Interface;
  8. using PMS.Interface.Problems;
  9. using PMS.Interface.SysManager;
  10. using QWPlatform.SystemLibrary.LogManager;
  11. using QWPlatform.SystemLibrary;
  12. using PMS.Interface.MessageManage;
  13. namespace PMS.WebUI.Controllers
  14. {
  15. /// <summary>
  16. /// 创 建 人:王海洋
  17. /// 创建日期:2018-12-10
  18. /// 功能描述:系统首页控制器
  19. /// </summary>
  20. public class HomeController : BaseController
  21. {
  22. //todo:test
  23. ISystemModule systemModule = InterfaceFactory.CreateBusinessInstance<ISystemModule>();
  24. //问题查询接口
  25. IProjectProblems problems = InterfaceFactory.CreateBusinessInstance<IProjectProblems>();
  26. IMessageManage notice = InterfaceFactory.CreateBusinessInstance<IMessageManage>();
  27. // GET: Home
  28. public ActionResult Index()
  29. {
  30. //var user = ViewData["Account"] as UserInfo;
  31. var user = this.GetCurrentUser();
  32. if (user != null)
  33. {//显示用户姓名
  34. ViewBag.Name = user.Name;
  35. ViewBag.Company = user.Company;
  36. ViewBag.Email = user.Email;
  37. ViewBag.Account = user.Account;
  38. ViewBag.UserProp = string.Format("{0}({1})", user.PersonPropertyString(), user.PersonJob);
  39. ViewBag.UserId = user.PersonID;//人员ID
  40. ViewBag.PersonProperty = user.PersonProperty;
  41. }
  42. return View();
  43. }
  44. //GET:首页
  45. public ActionResult Dashboard()
  46. {
  47. ViewBag.RYXZ = GetCurrentUser().PersonProperty;
  48. return View();
  49. }
  50. //未完成的问题列表
  51. public ActionResult NotFinishProblem(string Type)
  52. {
  53. ViewBag.Type = Type;
  54. ViewBag.PersonProperty = GetCurrentUser().PersonProperty;
  55. return View();
  56. }
  57. //查询未完成的数量:首页使用
  58. public ActionResult QueryNotFinishCount()
  59. {
  60. var user = this.GetCurrentUser();
  61. var dt = problems.QueryNotFinishProblem(user.PersonID, user.PersonProperty, user.CompanyID, user.DefaultProjectID, user.OrgID);
  62. return Content(dt.ToJson(), "text/json");
  63. }
  64. [HttpGet]
  65. //查询未完成问题列表:首页使用
  66. public ActionResult NotFinishProblemList(int Type,int page = 1, int rows = 20 )
  67. {
  68. var user = this.GetCurrentUser();
  69. var json = problems.NotFinishProblemList(user.PersonID, user.PersonProperty, user.CompanyID, user.DefaultProjectID, user.OrgID, Type, page, rows);
  70. return Content(json, "text/json");
  71. }
  72. //查询各渠道的问题数量
  73. public ActionResult QueryCompanyProblemCount()
  74. {
  75. System.Data.DataTable dt = null;
  76. var user = this.GetCurrentUser();
  77. if (user.PersonProperty == 1)
  78. {//中联人员显示所有渠道信息
  79. dt = problems.QueryCompanyProblemCount();
  80. }
  81. else if (user.PersonProperty == 2 || user.PersonProperty == 5)
  82. {//渠道人员(渠道卫计委显示所有机构问题)
  83. dt = problems.QueryOrgProblemCount(user.CompanyID);
  84. }
  85. else
  86. {//机构管理员与用户显示该机构所有用户问题数量
  87. dt = problems.QueryOrgPersonProblemCount(user.OrgID);
  88. }
  89. return Content(dt.ToJson(), "text/json");
  90. }
  91. //查询我的问题
  92. public ActionResult QueryMyProblemList()
  93. {
  94. var user = this.GetCurrentUser();
  95. var dt = problems.QueryMyProblemList(user.PersonID);
  96. return Content(dt.ToJson(), "text/json");
  97. }
  98. //查询出问题停留位置
  99. public ActionResult QueryAllProblemStopWorkFlow()
  100. {
  101. var user = this.GetCurrentUser();
  102. var dt = problems.QueryAllProblemStopWorkFlow(user.PersonProperty, user.CompanyID, user.OrgID, user.PersonID);
  103. return Content(dt.ToJson(), "text/json");
  104. }
  105. //常见问题top5
  106. public ActionResult QueryOftenProblemList()
  107. {
  108. var dt = problems.QueryOftenProblemList();
  109. return Content(dt.ToJson(), "text/json");
  110. }
  111. //我的配置信息
  112. public ActionResult MyConfigInfo()
  113. {
  114. var user = this.GetCurrentUser();
  115. var obj = account_obj.GetConfigInfo(user.ID);
  116. ViewBag.PersonProperty = user.PersonProperty;
  117. if (obj == null)
  118. {
  119. obj = new NotefiyConfigInfo()
  120. {
  121. Assign = new ConfigInfo(),
  122. BackTime = new ConfigInfo(),
  123. SolveTime = new ConfigInfo(),
  124. StopTime = new ConfigInfo()
  125. };
  126. }
  127. return View(obj);
  128. }
  129. //保存个人配置信息
  130. public ActionResult SaveConfigInfo(my_configinfo myconfiginfo)
  131. {
  132. var user = this.GetCurrentUser();
  133. var r = account_obj.SaveConfig(myconfiginfo, user.ID);
  134. return Content(r ? "1" : "0");
  135. }
  136. [HttpGet]
  137. public ActionResult GetMenus()
  138. {//todo:需要获取用户信息
  139. var user = this.GetCurrentUser();
  140. if (user != null)
  141. {
  142. var str = systemModule.GetTreeMenu(user.Roles, user.IsSuperAdmin);
  143. return Content(str, "application/json");
  144. }
  145. else
  146. {
  147. Logger.Instance.Warn("登录用户信息为空,请重新登录");
  148. return null;
  149. }
  150. }
  151. #region 消息
  152. public ActionResult MessageDeatil(string id)
  153. {
  154. ViewBag.ID = id;
  155. return View();
  156. }
  157. public ActionResult GetMessageDeatilById(string id)
  158. {
  159. var json = notice.SelecteMessageById(id);
  160. return Content(json, "text/json");
  161. }
  162. public ActionResult MessageList()
  163. {
  164. var user= this.GetCurrentUser();
  165. var config = account_obj.GetMessageInfo(user.ID);
  166. if(config!=null )
  167. {
  168. ViewBag.IsOpen = config.IsOpen;
  169. }
  170. else
  171. {
  172. ViewBag.IsOpen = "true";
  173. }
  174. return View();
  175. }
  176. public ActionResult MessageSet()
  177. {
  178. return View();
  179. }
  180. //保存消息配置
  181. public ActionResult SaveMessageInfo(Mssage_config Mssage_config)
  182. {
  183. var user = this.GetCurrentUser();
  184. var r = account_obj.SaveMessageInfo(Mssage_config, user.ID);
  185. return Content(r ? "1" : "0");
  186. }
  187. #endregion
  188. }
  189. }