25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 
 
 

415 satır
13 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. public ActionResult GetPageListRevert(string pagination, string keyword)
  163. {
  164. Pagination paginationobj = pagination.ToObject<Pagination>();
  165. var data = noticeIBLL.GetPageListRevert(paginationobj, keyword);
  166. var jsonData = new
  167. {
  168. rows = data,
  169. total = paginationobj.total,
  170. page = paginationobj.page,
  171. records = paginationobj.records,
  172. };
  173. return JsonResult(jsonData);
  174. }
  175. /// <summary>
  176. /// 查看通知公告
  177. /// </summary>
  178. /// <param name="pagination">分页参数</param>
  179. /// <param name="keyword">关键词</param>
  180. /// <returns></returns>
  181. public ActionResult GetListOfSelf(string keyword, string categoryId = null)
  182. {
  183. var userinfo = LoginUserInfo.Get();
  184. Pagination paginationobj = new Pagination();
  185. var newsList = noticeIBLL.GetList(keyword, userinfo.userId, categoryId);
  186. var newsListOfSelf = new List<NewsEntity>();
  187. foreach (var newsitemEntity in newsList)
  188. {
  189. if (!string.IsNullOrEmpty(newsitemEntity.F_SendPostId))
  190. {
  191. if (!string.IsNullOrEmpty(userinfo.postIds))
  192. {
  193. if (userinfo.postIds.Contains(","))
  194. {
  195. foreach (var postid in userinfo.postIds.Split(','))
  196. {
  197. if (newsitemEntity.F_SendPostId.Contains(postid))
  198. {
  199. newsListOfSelf.Add(newsitemEntity);
  200. break;
  201. }
  202. }
  203. }
  204. else
  205. {
  206. if (newsitemEntity.F_SendPostId.Contains(userinfo.postIds))
  207. {
  208. newsListOfSelf.Add(newsitemEntity);
  209. }
  210. }
  211. }
  212. }
  213. else
  214. {
  215. if (!string.IsNullOrEmpty(newsitemEntity.F_SendDeptId))
  216. {
  217. if (newsitemEntity.F_SendDeptId.Contains(userinfo.departmentId))
  218. {
  219. newsListOfSelf.Add(newsitemEntity);
  220. }
  221. }
  222. else
  223. {
  224. newsListOfSelf.Add(newsitemEntity);
  225. }
  226. }
  227. }
  228. return JsonResult(newsListOfSelf);
  229. }
  230. /// <summary>
  231. /// 查看通知公告
  232. /// </summary>
  233. /// <param name="pagination">分页参数</param>
  234. /// <param name="keyword">关键词</param>
  235. /// <returns></returns>
  236. public ActionResult GetListOfSelfJY(string keyword, string categoryId = null)
  237. {
  238. var userinfo = LoginUserInfo.Get();
  239. Pagination paginationobj = new Pagination();
  240. var newsList = noticeIBLL.GetList(keyword, userinfo.userId, categoryId).
  241. Where(a => a.F_Status == "2");
  242. var newsListOfSelf = new List<NewsEntity>();
  243. foreach (var newsitemEntity in newsList)
  244. {
  245. if (!string.IsNullOrEmpty(newsitemEntity.F_SendPostId))
  246. {
  247. if (!string.IsNullOrEmpty(userinfo.postIds))
  248. {
  249. if (userinfo.postIds.Contains(","))
  250. {
  251. foreach (var postid in userinfo.postIds.Split(','))
  252. {
  253. if (newsitemEntity.F_SendPostId.Contains(postid))
  254. {
  255. newsListOfSelf.Add(newsitemEntity);
  256. break;
  257. }
  258. }
  259. }
  260. else
  261. {
  262. if (newsitemEntity.F_SendPostId.Contains(userinfo.postIds))
  263. {
  264. newsListOfSelf.Add(newsitemEntity);
  265. }
  266. }
  267. }
  268. }
  269. else
  270. {
  271. if (!string.IsNullOrEmpty(newsitemEntity.F_SendDeptId))
  272. {
  273. if (newsitemEntity.F_SendDeptId.Contains(userinfo.departmentId))
  274. {
  275. newsListOfSelf.Add(newsitemEntity);
  276. }
  277. }
  278. else
  279. {
  280. newsListOfSelf.Add(newsitemEntity);
  281. }
  282. }
  283. }
  284. return JsonResult(newsListOfSelf);
  285. }
  286. /// <summary>
  287. /// 获取实体数据
  288. /// </summary>
  289. /// <param name="keyValue">主键</param>
  290. /// <returns></returns>
  291. public ActionResult GetEntity(string keyValue)
  292. {
  293. var data = noticeIBLL.GetEntity(keyValue);
  294. data.F_NewsContent = WebHelper.HtmlDecode(data.F_NewsContent);
  295. return JsonResult(data);
  296. }
  297. public ActionResult GetNoticeCategoryByDepartment(string userId)
  298. {
  299. var typeList = dataItemIbll.GetDetailList("NoticeCategory");
  300. var permissionsEntity = departmentReleasePermissionsIbll.GetTypesByUserId(userId);
  301. List<object> list = new List<object>();
  302. if (permissionsEntity != null)
  303. {
  304. var typetext = permissionsEntity.Permission?.Split(',');
  305. foreach (var item in typetext)
  306. {
  307. var entity = typeList.FirstOrDefault(a => a.F_ItemValue.Equals(item));
  308. if (entity != null)
  309. {
  310. list.Add(new { text = entity.F_ItemName, value = entity.F_ItemValue });
  311. }
  312. }
  313. }
  314. return JsonResult(list);
  315. }
  316. #endregion
  317. #region 提交数据
  318. /// <summary>
  319. /// 保存表单数据
  320. /// </summary>
  321. /// <param name="keyValue">主键</param>
  322. /// <param name="entity">实体</param>
  323. /// <returns></returns>
  324. [HttpPost, ValidateAntiForgeryToken, AjaxOnly, ValidateInput(false)]
  325. public ActionResult SaveForm(string keyValue, NewsEntity entity)
  326. {
  327. entity.F_NewsContent = WebHelper.HtmlEncode(entity.F_NewsContent);
  328. noticeIBLL.SaveEntity(keyValue, entity);
  329. return Success("保存成功!");
  330. }
  331. /// <summary>
  332. /// 删除表单数据
  333. /// </summary>
  334. /// <param name="keyValue">主键</param>
  335. /// <returns></returns>
  336. [HttpPost]
  337. [AjaxOnly]
  338. public ActionResult DeleteForm(string keyValue)
  339. {
  340. noticeIBLL.DeleteEntity(keyValue);
  341. return Success("删除成功!");
  342. }
  343. [HttpPost]
  344. [AjaxOnly]
  345. public ActionResult RecycleForm(string keyValue)
  346. {
  347. noticeIBLL.RecycleForm(keyValue, "-1");
  348. return Success("操作成功!");
  349. }
  350. [HttpPost]
  351. [AjaxOnly]
  352. public ActionResult RevertForm(string keyValue)
  353. {
  354. noticeIBLL.RecycleForm(keyValue, "0");
  355. return Success("操作成功!");
  356. }
  357. #endregion
  358. #region 流程
  359. /// <summary>
  360. /// 提交
  361. /// </summary>
  362. /// <param name="keyValue"></param>
  363. /// <returns></returns>
  364. [HttpPost]
  365. [AjaxOnly]
  366. public ActionResult ChangeStatusById(string keyValue, string processId)
  367. {
  368. noticeIBLL.ChangeStatusById(keyValue, 1, processId);
  369. return Success("操作成功!");
  370. }
  371. /// <summary>
  372. /// 获取表单数据
  373. /// <summary>
  374. /// <returns></returns>
  375. [HttpGet]
  376. [AjaxOnly]
  377. public ActionResult GetFormDataByProcessId(string processId)
  378. {
  379. NewsEntity OANewsData = noticeIBLL.GetEntityByProcessId(processId);
  380. OANewsData.F_NewsContent = WebHelper.HtmlDecode(OANewsData.F_NewsContent);
  381. var jsonData = new
  382. {
  383. OANews = OANewsData,
  384. };
  385. return Success(jsonData);
  386. }
  387. #endregion
  388. }
  389. }