using Nancy; using Learun.Util; using System.Collections.Generic; using System; using Learun.Application.TwoDevelopment.EducationalAdministration; using System.Linq; namespace Learun.Application.WebApi { /// /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园 /// Copyright (c) 2013-2018 北京泉江科技有限公司 /// 创 建:超级管理员 /// 日 期:2021-04-30 14:33 /// 描 述:投诉管理 /// public class Sys_SendComplaintApi : BaseApi { private Sys_SendComplaintIBLL sys_SendComplaintIBLL = new Sys_SendComplaintBLL(); private Sys_ReceiveComplaintIBLL sys_ReceiveComplaintIBLL = new Sys_ReceiveComplaintBLL(); /// /// 注册接口 /// public Sys_SendComplaintApi() : base("/Learun/adms/EducationalAdministration/Sys_SendComplaint") { Get["/pagelist"] = GetPageList; Get["/replylist"] = GetReplyList; Get["/form"] = GetForm; Get["/complaintCode"] = GetComplaintCode; Post["/delete"] = DeleteForm; Post["/save"] = SaveForm; Post["/saveAssign"] = SaveAssignForm; Post["/submit"] = SubmitForm; } #region 获取数据 /// /// 获取页面显示列表分页数据 /// /// /// public Response GetPageList(dynamic _) { ReqPageParam parameter = this.GetReqData(); var data = sys_SendComplaintIBLL.GetPageList(parameter.pagination, parameter.queryJson); var jsonData = new { rows = data, total = parameter.pagination.total, page = parameter.pagination.page, records = parameter.pagination.records }; return Success(jsonData); } /// /// 获取表单数据 /// /// /// public Response GetForm(dynamic _) { string keyValue = this.GetReqData(); var Sys_SendComplaintData = sys_SendComplaintIBLL.GetSys_SendComplaintEntity(keyValue); var jsonData = new { Sys_SendComplaint = Sys_SendComplaintData, }; return Success(jsonData); } /// /// 获取表单数据 /// /// /// public Response GetComplaintCode(dynamic _) { var ComplaintCode = "TS_" + Util.CommonHelper.CreateNo(); return SuccessString(ComplaintCode); } /// /// 获取回复消息列表 /// /// /// public Response GetReplyList(dynamic _) { string keyValue = this.GetReqData(); var Sys_ReceiveComplaintList = sys_ReceiveComplaintIBLL.GetSys_ReceiveComplaintList(keyValue).Where(x => x.ReplyFlag == 1).OrderByDescending(x => x.ReplyTime); var jsonData = new { Sys_ReceiveComplaint = Sys_ReceiveComplaintList, }; return Success(jsonData); } #endregion #region 提交数据 /// /// 删除实体数据 /// /// /// public Response DeleteForm(dynamic _) { string keyValue = this.GetReqData(); sys_SendComplaintIBLL.DeleteEntity(keyValue); return Success("删除成功!"); } /// /// 保存实体数据(新增、修改) /// /// /// public Response SaveForm(dynamic _) { ReqFormEntity parameter = this.GetReqData(); Sys_SendComplaintEntity entity = parameter.strEntity.ToObject(); entity.CreateTime = DateTime.Now; entity.CreateUserId = this.userInfo.userId; entity.CreateUserName = this.userInfo.realName; entity.SendFlag = 0; entity.DelFlag = false; entity.AssignFlag = 0; entity.ReplyFlag = 0; sys_SendComplaintIBLL.SaveEntity(parameter.keyValue, entity); return Success("保存成功!"); } /// /// 保存指派 /// /// /// public Response SaveAssignForm(dynamic _) { ReqFormEntity parameter = this.GetReqData(); Sys_SendComplaintEntity entity = parameter.strEntity.ToObject(); entity.SenderId = this.userInfo.userId; entity.Sender = this.userInfo.realName; sys_SendComplaintIBLL.AssignSaveEntity(parameter.keyValue, entity); return Success("保存成功!"); } /// /// 提交 /// /// /// public Response SubmitForm(dynamic _) { string keyValue = this.GetReqData(); sys_SendComplaintIBLL.SubmitEntity(keyValue); return Success("提交成功!"); } #endregion #region 私有类 /// /// 表单实体类 /// private class ReqFormEntity { public string keyValue { get; set; } public string strEntity { get; set; } } #endregion } }