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.
 
 
 
 
 
 

434 lines
14 KiB

  1. using Learun.Application.OA;
  2. using Learun.Util;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Configuration;
  6. using System.Linq;
  7. using System.Threading.Tasks;
  8. using System.Web;
  9. using System.Web.Mvc;
  10. using Learun.Application.Base.AuthorizeModule;
  11. using Learun.Application.Base.SystemModule;
  12. using Learun.Application.Organization;
  13. using Learun.Application.TwoDevelopment.LR_Desktop;
  14. using Learun.Util.Operat;
  15. using Microsoft.AspNet.SignalR.Client;
  16. using Microsoft.Owin.Logging;
  17. using Newtonsoft.Json;
  18. using Learun.Application.TwoDevelopment.EducationalAdministration;
  19. using Learun.Application.TwoDevelopment.Permission;
  20. namespace Learun.Application.Web.Areas.LR_OAModule.Controllers
  21. {
  22. /// <summary>
  23. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  24. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  25. /// 创建人:陈彬彬
  26. /// 日 期:2017.04.01
  27. /// 描 述:公告管理
  28. /// </summary>
  29. public class NoticeController : MvcControllerBase
  30. {
  31. private NoticeIBLL noticeIBLL = new NoticeBLL();
  32. private WeChatConfigIBLL weChatConfigIbll = new WeChatConfigBLL();
  33. private WeChatTempletIBLL weChatTempletIbll = new WeChatTempletBLL();
  34. private UserIBLL userIbll = new UserBLL();
  35. private UserRelationIBLL userRelationIBLL = new UserRelationBLL();
  36. private DataItemIBLL dataItemIbll = new DataItemBLL();
  37. private DepartmentIBLL departmentIbll = new DepartmentBLL();
  38. private Sys_InformationPushIBLL sys_InformationPushIBLL = new Sys_InformationPushBLL();
  39. private DepartmentReleasePermissionsIBLL departmentReleasePermissionsIbll = new DepartmentReleasePermissionsBLL();
  40. private MessageRindIBLL messageRindIBLL = new MessageRindBLL();
  41. #region 视图功能
  42. /// <summary>
  43. /// 管理页面
  44. /// </summary>
  45. /// <returns></returns>
  46. [HttpGet]
  47. public ActionResult Index()
  48. {
  49. return View();
  50. }
  51. /// <summary>
  52. /// 表单页面
  53. /// </summary>
  54. /// <returns></returns>
  55. [HttpGet]
  56. public ActionResult Form()
  57. {
  58. return View();
  59. }
  60. /// <summary>
  61. /// 通知公告(需要审核)
  62. /// </summary>
  63. /// <returns></returns>
  64. [HttpGet]
  65. public ActionResult IndexFlow()
  66. {
  67. return View();
  68. }
  69. /// <summary>
  70. /// 通知公告表单(需要审核)
  71. /// </summary>
  72. /// <returns></returns>
  73. [HttpGet]
  74. public ActionResult FormFlow()
  75. {
  76. return View();
  77. }
  78. /// <summary>
  79. /// 通知公告表单(需要审核)
  80. /// </summary>
  81. /// <returns></returns>
  82. [HttpGet]
  83. public ActionResult FormFlowView()
  84. {
  85. return View();
  86. }
  87. /// <summary>
  88. /// 管理页面【查看通知公告】
  89. /// </summary>
  90. /// <returns></returns>
  91. [HttpGet]
  92. public ActionResult ViewIndex()
  93. {
  94. return View();
  95. }
  96. /// <summary>
  97. /// 回收站
  98. /// </summary>
  99. /// <returns></returns>
  100. [HttpGet]
  101. public ActionResult IndexRecycle()
  102. {
  103. return View();
  104. }
  105. /// <summary>
  106. /// 表单页面【查看通知公告】
  107. /// </summary>
  108. /// <returns></returns>
  109. [HttpGet]
  110. public ActionResult ViewForm()
  111. {
  112. return View();
  113. }
  114. /// <summary>
  115. /// 失物招领
  116. /// </summary>
  117. /// <returns></returns>
  118. [HttpGet]
  119. public ActionResult IndexLostArticle()
  120. {
  121. return View();
  122. }
  123. /// <summary>
  124. /// 失物招领表单
  125. /// </summary>
  126. /// <returns></returns>
  127. [HttpGet]
  128. public ActionResult FormLostArticle()
  129. {
  130. return View();
  131. }
  132. /// <summary>
  133. /// 失物招领表单
  134. /// </summary>
  135. /// <returns></returns>
  136. [HttpGet]
  137. public ActionResult FormLostArticleView()
  138. {
  139. return View();
  140. }
  141. #endregion
  142. #region 获取数据
  143. /// <summary>
  144. /// 获取分页数据
  145. /// </summary>
  146. /// <param name="pagination">分页参数</param>
  147. /// <param name="keyword">关键词</param>
  148. /// <returns></returns>
  149. public ActionResult GetPageList(string pagination, string keyword)
  150. {
  151. Pagination paginationobj = pagination.ToObject<Pagination>();
  152. var data = noticeIBLL.GetPageList(paginationobj, keyword);
  153. var jsonData = new
  154. {
  155. rows = data,
  156. total = paginationobj.total,
  157. page = paginationobj.page,
  158. records = paginationobj.records,
  159. };
  160. return JsonResult(jsonData);
  161. }
  162. /// <summary>
  163. /// 获取分页数据
  164. /// </summary>
  165. /// <param name="pagination">分页参数</param>
  166. /// <param name="keyword">关键词</param>
  167. /// <returns></returns>
  168. public ActionResult GetPageLists(string pagination, string keyword)
  169. {
  170. Pagination paginationobj = pagination.ToObject<Pagination>();
  171. var data = noticeIBLL.GetPageLists(paginationobj, keyword);
  172. var jsonData = new
  173. {
  174. rows = data,
  175. total = paginationobj.total,
  176. page = paginationobj.page,
  177. records = paginationobj.records,
  178. };
  179. return JsonResult(jsonData);
  180. }
  181. public ActionResult GetPageListRevert(string pagination, string keyword)
  182. {
  183. Pagination paginationobj = pagination.ToObject<Pagination>();
  184. var data = noticeIBLL.GetPageListRevert(paginationobj, keyword);
  185. var jsonData = new
  186. {
  187. rows = data,
  188. total = paginationobj.total,
  189. page = paginationobj.page,
  190. records = paginationobj.records,
  191. };
  192. return JsonResult(jsonData);
  193. }
  194. /// <summary>
  195. /// 查看通知公告
  196. /// </summary>
  197. /// <param name="pagination">分页参数</param>
  198. /// <param name="keyword">关键词</param>
  199. /// <returns></returns>
  200. public ActionResult GetListOfSelf(string keyword, string categoryId = null)
  201. {
  202. var userinfo = LoginUserInfo.Get();
  203. Pagination paginationobj = new Pagination();
  204. var newsList = noticeIBLL.GetList(keyword, categoryId);
  205. //var newsListOfSelf = new List<NewsEntity>();
  206. //foreach (var newsitemEntity in newsList)
  207. //{
  208. // if (!string.IsNullOrEmpty(newsitemEntity.F_SendPostId))
  209. // {
  210. // if (!string.IsNullOrEmpty(userinfo.postIds))
  211. // {
  212. // if (userinfo.postIds.Contains(","))
  213. // {
  214. // foreach (var postid in userinfo.postIds.Split(','))
  215. // {
  216. // if (newsitemEntity.F_SendPostId.Contains(postid))
  217. // {
  218. // newsListOfSelf.Add(newsitemEntity);
  219. // break;
  220. // }
  221. // }
  222. // }
  223. // else
  224. // {
  225. // if (newsitemEntity.F_SendPostId.Contains(userinfo.postIds))
  226. // {
  227. // newsListOfSelf.Add(newsitemEntity);
  228. // }
  229. // }
  230. // }
  231. // }
  232. // else
  233. // {
  234. // if (!string.IsNullOrEmpty(newsitemEntity.F_SendDeptId))
  235. // {
  236. // if (newsitemEntity.F_SendDeptId.Contains(userinfo.departmentId))
  237. // {
  238. // newsListOfSelf.Add(newsitemEntity);
  239. // }
  240. // }
  241. // else
  242. // {
  243. // newsListOfSelf.Add(newsitemEntity);
  244. // }
  245. // }
  246. //}
  247. return JsonResult(newsList);
  248. }
  249. /// <summary>
  250. /// 查看通知公告
  251. /// </summary>
  252. /// <param name="pagination">分页参数</param>
  253. /// <param name="keyword">关键词</param>
  254. /// <returns></returns>
  255. public ActionResult GetListOfSelfJY(string queryJson, string categoryId = null)
  256. {
  257. var userinfo = LoginUserInfo.Get();
  258. Pagination paginationobj = new Pagination();
  259. var newsList = noticeIBLL.GetLists(queryJson, categoryId).
  260. Where(a => a.F_Status == "2");
  261. //var newsListOfSelf = new List<NewsEntity>();
  262. //foreach (var newsitemEntity in newsList)
  263. //{
  264. // if (!string.IsNullOrEmpty(newsitemEntity.F_SendPostId))
  265. // {
  266. // if (!string.IsNullOrEmpty(userinfo.postIds))
  267. // {
  268. // if (userinfo.postIds.Contains(","))
  269. // {
  270. // foreach (var postid in userinfo.postIds.Split(','))
  271. // {
  272. // if (newsitemEntity.F_SendPostId.Contains(postid))
  273. // {
  274. // newsListOfSelf.Add(newsitemEntity);
  275. // break;
  276. // }
  277. // }
  278. // }
  279. // else
  280. // {
  281. // if (newsitemEntity.F_SendPostId.Contains(userinfo.postIds))
  282. // {
  283. // newsListOfSelf.Add(newsitemEntity);
  284. // }
  285. // }
  286. // }
  287. // }
  288. // else
  289. // {
  290. // if (!string.IsNullOrEmpty(newsitemEntity.F_SendDeptId))
  291. // {
  292. // if (newsitemEntity.F_SendDeptId.Contains(userinfo.departmentId))
  293. // {
  294. // newsListOfSelf.Add(newsitemEntity);
  295. // }
  296. // }
  297. // else
  298. // {
  299. // newsListOfSelf.Add(newsitemEntity);
  300. // }
  301. // }
  302. //}
  303. return JsonResult(newsList);
  304. }
  305. /// <summary>
  306. /// 获取实体数据
  307. /// </summary>
  308. /// <param name="keyValue">主键</param>
  309. /// <returns></returns>
  310. public ActionResult GetEntity(string keyValue)
  311. {
  312. var data = noticeIBLL.GetEntity(keyValue);
  313. data.F_NewsContent = WebHelper.HtmlDecode(data.F_NewsContent);
  314. return JsonResult(data);
  315. }
  316. public ActionResult GetNoticeCategoryByDepartment(string userId)
  317. {
  318. var typeList = dataItemIbll.GetDetailList("NoticeCategory");
  319. var permissionsEntity = departmentReleasePermissionsIbll.GetTypesByUserId(userId);
  320. List<object> list = new List<object>();
  321. if (permissionsEntity != null)
  322. {
  323. var typetext = permissionsEntity.Permission?.Split(',');
  324. foreach (var item in typetext)
  325. {
  326. var entity = typeList.FirstOrDefault(a => a.F_ItemValue.Equals(item));
  327. if (entity != null)
  328. {
  329. list.Add(new { text = entity.F_ItemName, value = entity.F_ItemValue });
  330. }
  331. }
  332. }
  333. return JsonResult(list);
  334. }
  335. #endregion
  336. #region 提交数据
  337. /// <summary>
  338. /// 保存表单数据
  339. /// </summary>
  340. /// <param name="keyValue">主键</param>
  341. /// <param name="entity">实体</param>
  342. /// <returns></returns>
  343. [HttpPost, ValidateAntiForgeryToken, AjaxOnly, ValidateInput(false)]
  344. public ActionResult SaveForm(string keyValue, NewsEntity entity)
  345. {
  346. entity.F_NewsContent = WebHelper.HtmlEncode(entity.F_NewsContent);
  347. noticeIBLL.SaveEntity(keyValue, entity);
  348. return Success("保存成功!");
  349. }
  350. /// <summary>
  351. /// 删除表单数据
  352. /// </summary>
  353. /// <param name="keyValue">主键</param>
  354. /// <returns></returns>
  355. [HttpPost]
  356. [AjaxOnly]
  357. public ActionResult DeleteForm(string keyValue)
  358. {
  359. noticeIBLL.DeleteEntity(keyValue);
  360. return Success("删除成功!");
  361. }
  362. [HttpPost]
  363. [AjaxOnly]
  364. public ActionResult RecycleForm(string keyValue)
  365. {
  366. noticeIBLL.RecycleForm(keyValue, "-1");
  367. return Success("操作成功!");
  368. }
  369. [HttpPost]
  370. [AjaxOnly]
  371. public ActionResult RevertForm(string keyValue)
  372. {
  373. noticeIBLL.RecycleForm(keyValue, "0");
  374. return Success("操作成功!");
  375. }
  376. #endregion
  377. #region 流程
  378. /// <summary>
  379. /// 提交
  380. /// </summary>
  381. /// <param name="keyValue"></param>
  382. /// <returns></returns>
  383. [HttpPost]
  384. [AjaxOnly]
  385. public ActionResult ChangeStatusById(string keyValue, string processId)
  386. {
  387. noticeIBLL.ChangeStatusById(keyValue, 1, processId);
  388. return Success("操作成功!");
  389. }
  390. /// <summary>
  391. /// 获取表单数据
  392. /// <summary>
  393. /// <returns></returns>
  394. [HttpGet]
  395. [AjaxOnly]
  396. public ActionResult GetFormDataByProcessId(string processId)
  397. {
  398. NewsEntity OANewsData = noticeIBLL.GetEntityByProcessId(processId);
  399. OANewsData.F_NewsContent = WebHelper.HtmlDecode(OANewsData.F_NewsContent);
  400. var jsonData = new
  401. {
  402. OANews = OANewsData,
  403. };
  404. return Success(jsonData);
  405. }
  406. #endregion
  407. }
  408. }