|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444 |
- using Learun.Application.Base.Files;
- using Learun.Application.Base.SystemModule;
- using System.Web.Mvc;
- using System;
- using Learun.Util;
- using Learun.Application.WorkFlow;
- using System.Collections.Generic;
-
- namespace Learun.Application.Web.Areas.LR_SystemModule.Controllers
- {
- /// <summary>
- /// 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架
- /// Copyright (c) 2013-2018 上海力软信息技术有限公司
- /// 创 建:超级管理员
- /// 日 期:2019-11-28 09:23
- /// 描 述:文件管理
- /// </summary>
- public class FilesController : MvcControllerBase
- {
- private FolderIBLL folderIBLL = new FolderBLL();
- private FileInfoIBLL fileInfoIBLL = new FileInfoBLL();
- private FileAuthIBLL fileAuthIBLL = new FileAuthBLL();
-
- private CodeRuleIBLL codeRuleIBLL = new CodeRuleBLL();
-
- private NWFProcessIBLL nWFProcessIBLL = new NWFProcessBLL();
-
- #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 FolderIndex() {
- return View();
- }
-
- /// <summary>
- /// 文件夹管理表单
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult FolderForm()
- {
- return View();
- }
- /// <summary>
- /// 文件授权
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult FileAuthIndex()
- {
- return View();
- }
- /// <summary>
- /// 文件授权
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult FileAuthFrom()
- {
- return View();
- }
-
- /// <summary>
- /// 文件授权
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult FileAuthAddFrom()
- {
- return View();
- }
- /// <summary>
- /// 文件历史
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult FileHistroyIndex()
- {
- return View();
- }
- #endregion
-
-
- #region 获取数据
- /// <summary>
- /// 获取文件夹数据
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetFolderList(string keyWord)
- {
- var data = folderIBLL.GetList(keyWord, null);
- return Success(data);
- }
-
- /// <summary>
- /// 获取文件夹列表(树结构)
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetFolderTree()
- {
- var data = folderIBLL.GetTree();
- return this.Success(data);
- }
- /// <summary>
- /// 获取字典分类列表(树结构)
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetFolderEntity(string keyValue)
- {
- var data = folderIBLL.GetEntity(keyValue);
- return this.Success(data);
- }
-
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetFileInfoByWF(string processId, string fileInfoId)
- {
- var fileListEntity = fileInfoIBLL.GetListEntity(processId);
- if (fileListEntity != null) {
- fileInfoId = fileListEntity.F_FileInfoId;
- }
-
- string ver = "V1.0";
- FileBInfoEntity fileInfoEntity = null;
- string code;
- if (string.IsNullOrEmpty(fileInfoId))
- {
- code = codeRuleIBLL.GetBillCode("FS01");
- }
- else
- {
- fileInfoEntity = fileInfoIBLL.GetEntity(fileInfoId);
- code = fileInfoEntity.F_Code;
- if (fileListEntity == null)
- {
- var fileListEntity2 = fileInfoIBLL.GetListEntityByInfoId(fileInfoId);
- if (fileListEntity2 != null)
- {
- string[] verList = fileListEntity2.F_Ver.Split('.');
- var l = verList.Length;
- ver = "";
- for (var i = 0; i < l; i++)
- {
- if (i < l - 1)
- {
- ver += verList[i] + ".";
- }
- else
- {
- ver += (Convert.ToInt32(verList[i]) + 1);
- }
- }
- }
- }
- else {
- ver = fileListEntity.F_Ver;
- }
-
- }
-
- var jsondata = new {
- ver,
- code,
- fileInfoEntity,
- fileListEntity
- };
-
- return this.Success(jsondata);
- }
-
-
- /// <summary>
- /// 获取我的流程信息列表
- /// </summary>
- /// <param name="pagination">分页参数</param>
- /// <param name="keyWord">查询条件</param>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetWFPageList(string pagination, string keyWord, string wfType)
- {
- Pagination paginationobj = pagination.ToObject<Pagination>();
- IEnumerable<WFFileModel> list = new List<WFFileModel>();
- UserInfo userInfo = LoginUserInfo.Get();
- string strSql = "";
-
-
- switch (wfType)
- {
- case "1":// 我的流程
- strSql = nWFProcessIBLL.GetMySql();
- break;
- case "2":// 待办流程
- strSql = nWFProcessIBLL.GetMyTaskSql(userInfo);
- break;
- case "3":// 已办流程
- strSql = nWFProcessIBLL.GetMyFinishTaskSql();
- break;
- }
-
- list = fileInfoIBLL.GetWfPageList(strSql, paginationobj, keyWord, userInfo.userId);
-
- var jsonData = new
- {
- rows = list,
- paginationobj.total,
- paginationobj.page,
- paginationobj.records,
- };
- return Success(jsonData);
- }
-
-
- /// <summary>
- /// 获取我的流程信息列表
- /// </summary>
- /// <param name="pagination">分页参数</param>
- /// <param name="keyWord">查询条件</param>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetAllPublishPageList(string keyWord, string folderId)
- {
- var list = fileInfoIBLL.GetAllPublishPageList(keyWord, folderId);
- return Success(list);
- }
- /// <summary>
- /// 获取正式发布的文件
- /// </summary>
- /// <param name="folderId">文件夹Id</param>
- /// <param name="keyWord">查询条件</param>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetPublishList(string keyWord, string folderId)
- {
- var list = fileInfoIBLL.GetPublishList(keyWord, folderId);
- return Success(list);
- }
-
- /// <summary>
- /// 文件的历史信息
- /// </summary>
- /// <param name="fileInfoId">文件夹Id</param>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetHistoryList(string fileInfoId)
- {
- var list = fileInfoIBLL.GetHistoryList(fileInfoId);
- return Success(list);
- }
-
- /// <summary>
- /// 被删除的文件信息
- /// </summary>
- /// <param name="fileInfoId">文件夹Id</param>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetDeleteList(string fileInfoId)
- {
- var list = fileInfoIBLL.GetDeleteList(fileInfoId);
- return Success(list);
- }
- #endregion
-
- #region 提交数据
- [HttpPost]
- [AjaxOnly]
- public ActionResult SaveFolder(string keyValue,FolderEntity entity)
- {
- folderIBLL.SaveEntity(keyValue,entity);
- return this.Success("保存成功");
- }
- [HttpPost]
- [AjaxOnly]
- public ActionResult DeleteFolder(string keyValue)
- {
- var res = folderIBLL.DeleteEntity(keyValue);
- if (res)
- {
- return this.Success("删除成功");
- }
- else {
- return this.Success("不准删除,有文件或子文件夹");
- }
- }
-
- /// <summary>
- /// 虚拟删除文件
- /// </summary>
- /// <param name="keyValue"></param>
- /// <returns></returns>
- [HttpPost]
- [AjaxOnly]
- public ActionResult VDeleteFile(string keyValue)
- {
- fileInfoIBLL.VDeleteEntity(keyValue);
- return this.Success("删除成功");
- }
- /// <summary>
- /// 还原虚拟删除文件
- /// </summary>
- /// <param name="keyValue"></param>
- /// <returns></returns>
- [HttpPost]
- [AjaxOnly]
- public ActionResult RecoveryFile(string keyValue)
- {
- fileInfoIBLL.RecoveryEntity(keyValue);
- return this.Success("删除成功");
- }
- /// <summary>
- /// 彻底删除文件
- /// </summary>
- /// <param name="keyValue"></param>
- /// <returns></returns>
- [HttpPost]
- [AjaxOnly]
- public ActionResult DeleteFile(string keyValue)
- {
- fileInfoIBLL.DeleteEntity(keyValue);
- return this.Success("删除成功");
- }
-
- /// <summary>
- /// 保存数据
- /// </summary>
- /// <param name="keyValue">主键</param>
- /// <param name="strInfoEntity">文件信息</param>
- /// <param name="strListEntity">文件列表信息</param>
- /// <returns></returns>
- [HttpPost]
- [AjaxOnly]
- public ActionResult SaveFile(string keyValue, string strInfoEntity, string strListEntity)
- {
- FileBInfoEntity fileBInfoEntity = strInfoEntity.ToObject<FileBInfoEntity>();
- FilelistEntity filelistEntity = strListEntity.ToObject<FilelistEntity>();
- if (string.IsNullOrEmpty(fileBInfoEntity.F_Id))
- {
- codeRuleIBLL.UseRuleSeed("FS01");
- }
- fileInfoIBLL.SaveEntity(keyValue, fileBInfoEntity, filelistEntity);
-
- return this.Success("保存成功");
- }
-
- #endregion
-
- #region 权限管理
- /// <summary>
- /// 判断文件有没有上传权限
- /// </summary>
- /// <param name="folderId"></param>
- /// <returns></returns>
- public ActionResult IsUPLoad(string folderId) {
- var res = fileAuthIBLL.IsUPLoad(folderId);
- return Success(res);
- }
- /// <summary>
- /// 获取我的流程信息列表
- /// </summary>
- /// <param name="fileInfoId">文件信息主键</param>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetAuthList(string fileInfoId)
- {
- var list = fileAuthIBLL.GetList(fileInfoId);
- return Success(list);
- }
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetAuthEntity(string keyValue)
- {
- var list = fileAuthIBLL.GetEntity(keyValue);
- return Success(list);
- }
-
- /// <summary>
- /// 删除授权对象
- /// </summary>
- /// <param name="keyValue">主键</param>
- /// <returns></returns>
- [HttpPost]
- [AjaxOnly]
- public ActionResult DeleteAuth(string keyValue)
- {
- fileAuthIBLL.DeleteEntity(keyValue);
- return this.Success("删除成功");
- }
- /// <summary>
- /// 保存授权信息
- /// </summary>
- /// <param name="keyValue">主键</param>
- /// <param name="entity">实体数据</param>
- /// <returns></returns>
- [HttpPost]
- [AjaxOnly]
- public ActionResult SaveAuth(string keyValue, FileAuthEntity entity)
- {
- var res = fileAuthIBLL.SaveEntity(keyValue, entity);
- if (res)
- {
- return this.Success("保存成功");
- }
- else {
- return this.Success("该角色已经对该文件授权过!");
- }
-
- }
-
- #endregion
- }
- }
|