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.
 
 
 
 
 
 

252 lines
8.3 KiB

  1. using Learun.Util;
  2. using System.Data;
  3. using Learun.Application.TwoDevelopment.LogisticsManagement;
  4. using System.Web.Mvc;
  5. using System.Collections.Generic;
  6. using Learun.Application.TwoDevelopment.LR_Desktop;
  7. using Learun.Application.Organization;
  8. using Learun.Application.Base.AuthorizeModule;
  9. using System;
  10. using Learun.Application.Base.SystemModule;
  11. using System.Linq;
  12. namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers
  13. {
  14. /// <summary>
  15. /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架
  16. /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
  17. /// 创 建:超级管理员
  18. /// 日 期:2023-06-29 15:27
  19. /// 描 述:教师报修
  20. /// </summary>
  21. public class RepairReportTeacherController : MvcControllerBase
  22. {
  23. private RepairReportTeacherIBLL repairReportTeacherIBLL = new RepairReportTeacherBLL();
  24. private UserRelationIBLL userRelationIBLL = new UserRelationBLL();
  25. private MessageRindIBLL messageRindIBLL = new MessageRindBLL();
  26. private DataItemIBLL dataItemIBLL = new DataItemBLL();
  27. private UserIBLL userIbll = new UserBLL();
  28. private RoleIBLL roleIBLL = new RoleBLL();
  29. #region 视图功能
  30. /// <summary>
  31. /// 主页面
  32. /// <summary>
  33. /// <returns></returns>
  34. [HttpGet]
  35. public ActionResult Index()
  36. {
  37. return View();
  38. }
  39. /// <summary>
  40. /// 表单页
  41. /// <summary>
  42. /// <returns></returns>
  43. [HttpGet]
  44. public ActionResult Form()
  45. {
  46. return View();
  47. }
  48. /// <summary>
  49. /// 表单页
  50. /// <summary>
  51. /// <returns></returns>
  52. [HttpGet]
  53. public ActionResult FormView()
  54. {
  55. return View();
  56. }
  57. /// <summary>
  58. /// 表单页
  59. /// <summary>
  60. /// <returns></returns>
  61. [HttpGet]
  62. public ActionResult EvaluateFormView()
  63. {
  64. return View();
  65. }
  66. /// <summary>
  67. /// 统计界面
  68. /// <summary>
  69. /// <returns></returns>
  70. [HttpGet]
  71. public ActionResult statisticIndex()
  72. {
  73. return View();
  74. }
  75. /// <summary>
  76. /// 处理界面
  77. /// <summary>
  78. /// <returns></returns>
  79. [HttpGet]
  80. public ActionResult dealIndex()
  81. {
  82. return View();
  83. }
  84. /// <summary>
  85. /// 表单页处理
  86. /// <summary>
  87. /// <returns></returns>
  88. [HttpGet]
  89. public ActionResult dealFormView()
  90. {
  91. return View();
  92. }
  93. #endregion
  94. #region 获取数据
  95. /// <summary>
  96. /// 获取页面显示列表数据
  97. /// </summary>
  98. /// <param name="pagination">分页参数</param>
  99. /// <param name="queryJson">查询参数</param>
  100. /// <returns></returns>
  101. [HttpGet]
  102. [AjaxOnly]
  103. public ActionResult GetPageList(string pagination, string queryJson)
  104. {
  105. Pagination paginationobj = pagination.ToObject<Pagination>();
  106. var data = repairReportTeacherIBLL.GetPageList(paginationobj, queryJson);
  107. var jsonData = new
  108. {
  109. rows = data,
  110. total = paginationobj.total,
  111. page = paginationobj.page,
  112. records = paginationobj.records
  113. };
  114. return Success(jsonData);
  115. }
  116. /// <summary>
  117. /// 获取表单数据
  118. /// </summary>
  119. /// <param name="keyValue">主键</param>
  120. /// <returns></returns>
  121. [HttpGet]
  122. [AjaxOnly]
  123. public ActionResult GetFormData(string keyValue)
  124. {
  125. var RepairReport_TeacherData = repairReportTeacherIBLL.GetRepairReport_TeacherEntity(keyValue);
  126. var jsonData = new {
  127. RepairReport_Teacher = RepairReport_TeacherData,
  128. };
  129. return Success(jsonData);
  130. }
  131. #endregion
  132. #region 提交数据
  133. /// <summary>
  134. /// 删除实体数据
  135. /// </summary>
  136. /// <param name="keyValue">主键</param>
  137. /// <returns></returns>
  138. [HttpPost]
  139. [AjaxOnly]
  140. public ActionResult DeleteForm(string keyValue)
  141. {
  142. repairReportTeacherIBLL.DeleteEntity(keyValue);
  143. return Success("删除成功!");
  144. }
  145. /// <summary>
  146. /// 保存实体数据(新增、修改)
  147. /// </summary>
  148. /// <param name="keyValue">主键</param>
  149. /// <param name="strEntity">实体</param>
  150. /// <returns></returns>
  151. [HttpPost]
  152. [ValidateAntiForgeryToken]
  153. [AjaxOnly]
  154. public ActionResult SaveForm(string keyValue, string strEntity)
  155. {
  156. RepairReport_TeacherEntity entity = strEntity.ToObject<RepairReport_TeacherEntity>();
  157. repairReportTeacherIBLL.SaveEntity(keyValue, entity);
  158. //entity.Status = 2;
  159. if (entity.Status == 2)
  160. {
  161. var model = repairReportTeacherIBLL.GetRepairReport_TeacherEntity(keyValue);
  162. //获取所有的维修员账号并添加
  163. var userList = userIbll.GetListByUserIds(model.Creator);
  164. List<DataItemDetailEntity> datalist = dataItemIBLL.GetDetailList("repairtype", "");
  165. string servicevalue = datalist.Where(c => c.F_ItemValue == model.ServiceType).FirstOrDefault().F_ItemName;
  166. string content = "您发起" + model.Address + "-" + servicevalue + "维修请求已处理,请评价。";
  167. addmessagerind(userList, model, content, "评价通知");
  168. }
  169. if (string.IsNullOrEmpty(keyValue))
  170. {
  171. }
  172. return Success("保存成功!");
  173. }
  174. #endregion
  175. #region 扩展数据
  176. /// <summary>
  177. /// 提交课程异动记录
  178. /// </summary>
  179. /// <param name="keyValue">课程异动主键</param>
  180. /// <param name="status">审核状态</param>
  181. /// <param name="processId">流程Id</param>
  182. /// <returns></returns>
  183. public ActionResult ModifyStatus(string keyValue, int status, string processId)
  184. {
  185. //修改状态
  186. repairReportTeacherIBLL.ModifyStatus(keyValue, status, processId);
  187. var model = repairReportTeacherIBLL.GetRepairReport_TeacherEntity(keyValue);
  188. //向所有维修员发消息
  189. string roleid = roleIBLL.GetIdByRoleName("维修角色");
  190. var data = userRelationIBLL.GetUserIdList(roleid);
  191. string userIds = "";
  192. foreach (var item in data)
  193. {
  194. if (userIds != "")
  195. {
  196. userIds += ",";
  197. }
  198. userIds += item.F_UserId;
  199. }
  200. //获取所有的维修员账号并添加
  201. var userList = userIbll.GetListByUserIds(userIds);
  202. List<DataItemDetailEntity> datalist = dataItemIBLL.GetDetailList("repairtype", "");
  203. string servicevalue = datalist.Where(c => c.F_ItemValue == model.ServiceType).FirstOrDefault().F_ItemName;
  204. string content = model.DeptName + model.CreatorName + "发起" + model.Address + "-" + servicevalue + "维修请求。";
  205. addmessagerind(userList, model, content);
  206. return Success("提交成功!");
  207. }
  208. private void addmessagerind(List<UserEntity> userList,RepairReport_TeacherEntity model,string content,string title= "维修通知")
  209. {
  210. foreach (var userinfo in userList)
  211. {
  212. //站内通知逻辑
  213. MessageRemindEntity entity = new MessageRemindEntity();
  214. entity.ReceiptId = userinfo.F_UserId;
  215. entity.ReceiptName = userinfo.F_RealName;
  216. entity.SenderId = model.Creator;
  217. entity.SenderName = model.CreatorName;
  218. entity.TheTitle = title;
  219. entity.TheContent = content;
  220. entity.InstanceId = model.ID;
  221. entity.ConnectionUrl = "/LogisticsManagement/RepairReportTeacher/FormView?keyValue=";
  222. entity.SendTime = DateTime.Now;
  223. entity.ReadSigns = false;
  224. messageRindIBLL.SaveEntity("", entity);
  225. }
  226. }
  227. #endregion
  228. }
  229. }