|
- using Nancy;
- using Learun.Util;
- using System.Collections.Generic;
- using System;
- using Learun.Application.TwoDevelopment.EducationalAdministration;
- using System.Linq;
-
- namespace Learun.Application.WebApi
- {
- /// <summary>
- /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
- /// Copyright (c) 2013-2018 北京泉江科技有限公司
- /// 创 建:超级管理员
- /// 日 期:2021-04-30 14:33
- /// 描 述:投诉管理
- /// </summary>
- public class Sys_SendComplaintApi : BaseApi
- {
- private Sys_SendComplaintIBLL sys_SendComplaintIBLL = new Sys_SendComplaintBLL();
- private Sys_ReceiveComplaintIBLL sys_ReceiveComplaintIBLL = new Sys_ReceiveComplaintBLL();
-
- /// <summary>
- /// 注册接口
- /// <summary>
- 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 获取数据
-
- /// <summary>
- /// 获取页面显示列表分页数据
- /// <summary>
- /// <param name="_"></param>
- /// <returns></returns>
- public Response GetPageList(dynamic _)
- {
- ReqPageParam parameter = this.GetReqData<ReqPageParam>();
- 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);
- }
-
- /// <summary>
- /// 获取表单数据
- /// <summary>
- /// <param name="_"></param>
- /// <returns></returns>
- 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);
- }
- /// <summary>
- /// 获取表单数据
- /// <summary>
- /// <param name="_"></param>
- /// <returns></returns>
- public Response GetComplaintCode(dynamic _)
- {
- var ComplaintCode = "TS_" + Util.CommonHelper.CreateNo();
- return SuccessString(ComplaintCode);
- }
- /// <summary>
- /// 获取回复消息列表
- /// <summary>
- /// <param name="_"></param>
- /// <returns></returns>
- 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 提交数据
-
- /// <summary>
- /// 删除实体数据
- /// <param name="_"></param>
- /// <summary>
- /// <returns></returns>
- public Response DeleteForm(dynamic _)
- {
- string keyValue = this.GetReqData();
- sys_SendComplaintIBLL.DeleteEntity(keyValue);
- return Success("删除成功!");
- }
- /// <summary>
- /// 保存实体数据(新增、修改)
- /// <param name="_"></param>
- /// <summary>
- /// <returns></returns>
- public Response SaveForm(dynamic _)
- {
- ReqFormEntity parameter = this.GetReqData<ReqFormEntity>();
- Sys_SendComplaintEntity entity = parameter.strEntity.ToObject<Sys_SendComplaintEntity>();
- 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("保存成功!");
- }
- /// <summary>
- /// 保存指派
- /// <param name="_"></param>
- /// <summary>
- /// <returns></returns>
- public Response SaveAssignForm(dynamic _)
- {
- ReqFormEntity parameter = this.GetReqData<ReqFormEntity>();
- Sys_SendComplaintEntity entity = parameter.strEntity.ToObject<Sys_SendComplaintEntity>();
- entity.SenderId = this.userInfo.userId;
- entity.Sender = this.userInfo.realName;
- sys_SendComplaintIBLL.AssignSaveEntity(parameter.keyValue, entity);
- return Success("保存成功!");
- }
-
- /// <summary>
- /// 提交
- /// <param name="_"></param>
- /// <summary>
- /// <returns></returns>
- public Response SubmitForm(dynamic _)
- {
- string keyValue = this.GetReqData();
- sys_SendComplaintIBLL.SubmitEntity(keyValue);
- return Success("提交成功!");
- }
- #endregion
-
- #region 私有类
-
- /// <summary>
- /// 表单实体类
- /// <summary>
- private class ReqFormEntity
- {
- public string keyValue { get; set; }
- public string strEntity { get; set; }
- }
- #endregion
-
- }
- }
|