|
- using Learun.Util;
- using System.Data;
- using Learun.Application.TwoDevelopment.LogisticsManagement;
- using System.Web.Mvc;
- using System.Collections.Generic;
- using Learun.Application.TwoDevelopment.LR_Desktop;
- using Learun.Application.Organization;
- using Learun.Application.Base.AuthorizeModule;
- using System;
- using Learun.Application.Base.SystemModule;
- using System.Linq;
-
- namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers
- {
- /// <summary>
- /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架
- /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
- /// 创 建:超级管理员
- /// 日 期:2023-06-29 15:27
- /// 描 述:教师报修
- /// </summary>
- public class RepairReportTeacherController : MvcControllerBase
- {
- private RepairReportTeacherIBLL repairReportTeacherIBLL = new RepairReportTeacherBLL();
- private UserRelationIBLL userRelationIBLL = new UserRelationBLL();
- private MessageRindIBLL messageRindIBLL = new MessageRindBLL();
- private DataItemIBLL dataItemIBLL = new DataItemBLL();
- private UserIBLL userIbll = new UserBLL();
- private RoleIBLL roleIBLL = new RoleBLL();
-
- #region 视图功能
-
- /// <summary>
- /// 主页面
- /// <summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult Index()
- {
- return View();
- }
- /// <summary>
- /// 表单页
- /// <summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult Form()
- {
- return View();
- }
- /// <summary>
- /// 表单页
- /// <summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult FormView()
- {
- return View();
- }
-
- /// <summary>
- /// 表单页
- /// <summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult EvaluateFormView()
- {
- return View();
- }
-
- /// <summary>
- /// 统计界面
- /// <summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult statisticIndex()
- {
- return View();
- }
-
- /// <summary>
- /// 处理界面
- /// <summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult dealIndex()
- {
- return View();
- }
- /// <summary>
- /// 表单页处理
- /// <summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult dealFormView()
- {
- return View();
- }
- #endregion
-
- #region 获取数据
-
- /// <summary>
- /// 获取页面显示列表数据
- /// </summary>
- /// <param name="pagination">分页参数</param>
- /// <param name="queryJson">查询参数</param>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetPageList(string pagination, string queryJson)
- {
- Pagination paginationobj = pagination.ToObject<Pagination>();
- var data = repairReportTeacherIBLL.GetPageList(paginationobj, queryJson);
- var jsonData = new
- {
- rows = data,
- total = paginationobj.total,
- page = paginationobj.page,
- records = paginationobj.records
- };
- return Success(jsonData);
- }
- /// <summary>
- /// 获取表单数据
- /// </summary>
- /// <param name="keyValue">主键</param>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetFormData(string keyValue)
- {
- var RepairReport_TeacherData = repairReportTeacherIBLL.GetRepairReport_TeacherEntity(keyValue);
- var jsonData = new {
- RepairReport_Teacher = RepairReport_TeacherData,
- };
- return Success(jsonData);
- }
- #endregion
-
- #region 提交数据
-
- /// <summary>
- /// 删除实体数据
- /// </summary>
- /// <param name="keyValue">主键</param>
- /// <returns></returns>
- [HttpPost]
- [AjaxOnly]
- public ActionResult DeleteForm(string keyValue)
- {
- repairReportTeacherIBLL.DeleteEntity(keyValue);
- return Success("删除成功!");
- }
- /// <summary>
- /// 保存实体数据(新增、修改)
- /// </summary>
- /// <param name="keyValue">主键</param>
- /// <param name="strEntity">实体</param>
- /// <returns></returns>
- [HttpPost]
- [ValidateAntiForgeryToken]
- [AjaxOnly]
- public ActionResult SaveForm(string keyValue, string strEntity)
- {
- RepairReport_TeacherEntity entity = strEntity.ToObject<RepairReport_TeacherEntity>();
- repairReportTeacherIBLL.SaveEntity(keyValue, entity);
- //entity.Status = 2;
- if (entity.Status == 2)
- {
- var model = repairReportTeacherIBLL.GetRepairReport_TeacherEntity(keyValue);
-
- //获取所有的维修员账号并添加
- var userList = userIbll.GetListByUserIds(model.Creator);
-
- List<DataItemDetailEntity> datalist = dataItemIBLL.GetDetailList("repairtype", "");
- string servicevalue = datalist.Where(c => c.F_ItemValue == model.ServiceType).FirstOrDefault().F_ItemName;
- string content = "您发起" + model.Address + "-" + servicevalue + "维修请求已处理,请评价。";
-
- addmessagerind(userList, model, content, "评价通知");
- }
- if (string.IsNullOrEmpty(keyValue))
- {
- }
- return Success("保存成功!");
- }
- #endregion
-
-
-
- #region 扩展数据
- /// <summary>
- /// 提交课程异动记录
- /// </summary>
- /// <param name="keyValue">课程异动主键</param>
- /// <param name="status">审核状态</param>
- /// <param name="processId">流程Id</param>
- /// <returns></returns>
- public ActionResult ModifyStatus(string keyValue, int status, string processId)
- {
- //修改状态
- repairReportTeacherIBLL.ModifyStatus(keyValue, status, processId);
-
- var model = repairReportTeacherIBLL.GetRepairReport_TeacherEntity(keyValue);
-
- //向所有维修员发消息
- string roleid = roleIBLL.GetIdByRoleName("维修角色");
- var data = userRelationIBLL.GetUserIdList(roleid);
- string userIds = "";
- foreach (var item in data)
- {
- if (userIds != "")
- {
- userIds += ",";
- }
- userIds += item.F_UserId;
- }
- //获取所有的维修员账号并添加
- var userList = userIbll.GetListByUserIds(userIds);
-
- List<DataItemDetailEntity> datalist = dataItemIBLL.GetDetailList("repairtype", "");
- string servicevalue = datalist.Where(c => c.F_ItemValue == model.ServiceType).FirstOrDefault().F_ItemName;
- string content = model.DeptName + model.CreatorName + "发起" + model.Address + "-" + servicevalue + "维修请求。";
-
- addmessagerind(userList, model, content);
- return Success("提交成功!");
- }
-
- private void addmessagerind(List<UserEntity> userList,RepairReport_TeacherEntity model,string content,string title= "维修通知")
- {
- foreach (var userinfo in userList)
- {
- //站内通知逻辑
- MessageRemindEntity entity = new MessageRemindEntity();
- entity.ReceiptId = userinfo.F_UserId;
- entity.ReceiptName = userinfo.F_RealName;
- entity.SenderId = model.Creator;
- entity.SenderName = model.CreatorName;
- entity.TheTitle = title;
-
- entity.TheContent = content;
- entity.InstanceId = model.ID;
- entity.ConnectionUrl = "/LogisticsManagement/RepairReportTeacher/FormView?keyValue=";
- entity.SendTime = DateTime.Now;
- entity.ReadSigns = false;
- messageRindIBLL.SaveEntity("", entity);
- }
- }
- #endregion
- }
- }
|