using Learun.Util;
using System.Data;
using Learun.Application.TwoDevelopment.EducationalAdministration;
using System.Web.Mvc;
using System.Collections.Generic;
using System.Linq;
using Learun.Application.Organization;
namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
{
///
/// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
/// Copyright (c) 2013-2018 北京泉江科技有限公司
/// 创 建:超级管理员
/// 日 期:2019-10-22 16:58
/// 描 述:文件接收
///
public class SYS_ReceiveDocumentController : MvcControllerBase
{
private SYS_ReceiveDocumentIBLL sYS_ReceiveDocumentIBLL = new SYS_ReceiveDocumentBLL();
private Sys_ReceiveFileIBLL receiveFileIbll=new Sys_ReceiveFileBLL();
private RoleIBLL roleIBLL = new RoleBLL();
#region 视图功能
///
/// 主页面
///
///
[HttpGet]
public ActionResult Index()
{
return View();
}
///
/// 公文接收归档
///
///
[HttpGet]
public ActionResult IndexFile()
{
return View();
}
///
/// 表单页
///
///
[HttpGet]
public ActionResult Form()
{
return View();
}
///
/// 表单页
///
///
[HttpGet]
public ActionResult FormView()
{
return View();
}
///
/// 指派人列表
///
///
[HttpGet]
public ActionResult IssueForm()
{
return View();
}
///
/// 阅读详情
///
///
[HttpGet]
public ActionResult ReadList()
{
return View();
}
///
/// 打印页面
///
///
[HttpGet]
public ActionResult PrintView()
{
return View();
}
///
/// 阅读详情
///
///
[HttpGet]
public ActionResult RoleForm()
{
return View();
}
#endregion
#region 获取数据
///
/// 获取页面显示列表数据
///
/// 查询参数
///
[HttpGet]
[AjaxOnly]
public ActionResult GetPageList(string pagination, string queryJson)
{
Pagination paginationobj = pagination.ToObject();
var data = sYS_ReceiveDocumentIBLL.GetPageList(paginationobj, queryJson);
foreach (var item in data)
{
var sql = $"SELECT COUNT(*) FROM dbo.Sys_ReceiveFile where ReadFlag=1 AND SFileId='{item.RID}'";
var sendSql = $"SELECT COUNT(*) FROM dbo.Sys_ReceiveFile where SFileId='{item.RID}'";
var readdt = sYS_ReceiveDocumentIBLL.Execute(sql);
var senddt = sYS_ReceiveDocumentIBLL.Execute(sendSql);
var readcount = readdt.Rows[0][0];
var sendcount = senddt.Rows[0][0];
item.NumberPeople = $"{readcount}/{sendcount}";
}
var jsonData = new
{
rows = data,
total = paginationobj.total,
page = paginationobj.page,
records = paginationobj.records
};
return Success(jsonData);
}
///
/// 获取表单数据
///
///
[HttpGet]
[AjaxOnly]
public ActionResult GetFormData(string keyValue)
{
var Sys_ReceiveDocumentData = sYS_ReceiveDocumentIBLL.GetSys_ReceiveDocumentEntity(keyValue);
var jsonData = new
{
Sys_ReceiveDocument = Sys_ReceiveDocumentData,
};
return Success(jsonData);
}
///
/// 获取表单数据
///
///
[HttpGet]
[AjaxOnly]
public ActionResult GetFormDataByProcessId(string processId)
{
var Sys_ReceiveDocumentData = sYS_ReceiveDocumentIBLL.GetEntityByProcessId(processId);
var jsonData = new
{
Sys_ReceiveDocument = Sys_ReceiveDocumentData,
};
return Success(jsonData);
}
///
/// 获取表单数据
///
///
[HttpGet]
[AjaxOnly]
public ActionResult GetRoleData()
{
var data = roleIBLL.GetListForSelect();
return Success(data);
}
public ActionResult PrintInfo(string keyValue)
{
var entity = sYS_ReceiveDocumentIBLL.GetSys_ReceiveDocumentEntity(keyValue);
var entityItem = receiveFileIbll.GetPageListBySendId(keyValue).ToList().Where(a=>a.ReadTime!=null).OrderBy(a=>a.ReadTime);
object data = new
{
entity,
entityItem
};
return Success(data);
}
#endregion
#region 提交数据
///
/// 删除实体数据
/// 主键
///
///
[HttpPost]
[AjaxOnly]
public ActionResult DeleteForm(string keyValue)
{
sYS_ReceiveDocumentIBLL.DeleteEntity(keyValue);
return Success("删除成功!");
}
///
/// 结束下发
/// 主键
///
///
[HttpPost]
[AjaxOnly]
public ActionResult OverIssue(string keyValue)
{
var entity = sYS_ReceiveDocumentIBLL.GetSys_ReceiveDocumentEntity(keyValue);
if (null != entity)
{
entity.RSendFlag = "4";
sYS_ReceiveDocumentIBLL.SaveEntity(keyValue, entity);
}
return Success("操作成功!");
}
///
/// 保存实体数据(新增、修改)
/// 主键
///
///
[HttpPost]
[ValidateAntiForgeryToken]
[AjaxOnly]
[ValidateInput(false)]
public ActionResult SaveForm(string keyValue, string strEntity)
{
Sys_ReceiveDocumentEntity entity = strEntity.ToObject();
sYS_ReceiveDocumentIBLL.SaveEntity(keyValue, entity);
return Success("保存成功!");
}
///
/// 提交申请
///
///
///
[HttpPost]
[AjaxOnly]
public ActionResult ChangeStatusById(string keyValue, string processId)
{
sYS_ReceiveDocumentIBLL.ChangeStatusById(keyValue, 1, processId);
return Success("操作成功!");
}
#endregion
}
}