Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 
 

444 linhas
13 KiB

  1. using Learun.Application.Base.Files;
  2. using Learun.Application.Base.SystemModule;
  3. using System.Web.Mvc;
  4. using System;
  5. using Learun.Util;
  6. using Learun.Application.WorkFlow;
  7. using System.Collections.Generic;
  8. namespace Learun.Application.Web.Areas.LR_SystemModule.Controllers
  9. {
  10. /// <summary>
  11. /// 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架
  12. /// Copyright (c) 2013-2018 上海力软信息技术有限公司
  13. /// 创 建:超级管理员
  14. /// 日 期:2019-11-28 09:23
  15. /// 描 述:文件管理
  16. /// </summary>
  17. public class FilesController : MvcControllerBase
  18. {
  19. private FolderIBLL folderIBLL = new FolderBLL();
  20. private FileInfoIBLL fileInfoIBLL = new FileInfoBLL();
  21. private FileAuthIBLL fileAuthIBLL = new FileAuthBLL();
  22. private CodeRuleIBLL codeRuleIBLL = new CodeRuleBLL();
  23. private NWFProcessIBLL nWFProcessIBLL = new NWFProcessBLL();
  24. #region 视图功能
  25. /// <summary>
  26. /// 文件管理
  27. /// </summary>
  28. /// <returns></returns>
  29. [HttpGet]
  30. public ActionResult Index()
  31. {
  32. return View();
  33. }
  34. /// <summary>
  35. /// 文件发布页面
  36. /// </summary>
  37. /// <returns></returns>
  38. [HttpGet]
  39. public ActionResult Form()
  40. {
  41. return View();
  42. }
  43. /// <summary>
  44. /// 文件夹管理
  45. /// </summary>
  46. /// <returns></returns>
  47. [HttpGet]
  48. public ActionResult FolderIndex() {
  49. return View();
  50. }
  51. /// <summary>
  52. /// 文件夹管理表单
  53. /// </summary>
  54. /// <returns></returns>
  55. [HttpGet]
  56. public ActionResult FolderForm()
  57. {
  58. return View();
  59. }
  60. /// <summary>
  61. /// 文件授权
  62. /// </summary>
  63. /// <returns></returns>
  64. [HttpGet]
  65. public ActionResult FileAuthIndex()
  66. {
  67. return View();
  68. }
  69. /// <summary>
  70. /// 文件授权
  71. /// </summary>
  72. /// <returns></returns>
  73. [HttpGet]
  74. public ActionResult FileAuthFrom()
  75. {
  76. return View();
  77. }
  78. /// <summary>
  79. /// 文件授权
  80. /// </summary>
  81. /// <returns></returns>
  82. [HttpGet]
  83. public ActionResult FileAuthAddFrom()
  84. {
  85. return View();
  86. }
  87. /// <summary>
  88. /// 文件历史
  89. /// </summary>
  90. /// <returns></returns>
  91. [HttpGet]
  92. public ActionResult FileHistroyIndex()
  93. {
  94. return View();
  95. }
  96. #endregion
  97. #region 获取数据
  98. /// <summary>
  99. /// 获取文件夹数据
  100. /// </summary>
  101. /// <returns></returns>
  102. [HttpGet]
  103. [AjaxOnly]
  104. public ActionResult GetFolderList(string keyWord)
  105. {
  106. var data = folderIBLL.GetList(keyWord, null);
  107. return Success(data);
  108. }
  109. /// <summary>
  110. /// 获取文件夹列表(树结构)
  111. /// </summary>
  112. /// <returns></returns>
  113. [HttpGet]
  114. [AjaxOnly]
  115. public ActionResult GetFolderTree()
  116. {
  117. var data = folderIBLL.GetTree();
  118. return this.Success(data);
  119. }
  120. /// <summary>
  121. /// 获取字典分类列表(树结构)
  122. /// </summary>
  123. /// <returns></returns>
  124. [HttpGet]
  125. [AjaxOnly]
  126. public ActionResult GetFolderEntity(string keyValue)
  127. {
  128. var data = folderIBLL.GetEntity(keyValue);
  129. return this.Success(data);
  130. }
  131. [HttpGet]
  132. [AjaxOnly]
  133. public ActionResult GetFileInfoByWF(string processId, string fileInfoId)
  134. {
  135. var fileListEntity = fileInfoIBLL.GetListEntity(processId);
  136. if (fileListEntity != null) {
  137. fileInfoId = fileListEntity.F_FileInfoId;
  138. }
  139. string ver = "V1.0";
  140. FileBInfoEntity fileInfoEntity = null;
  141. string code;
  142. if (string.IsNullOrEmpty(fileInfoId))
  143. {
  144. code = codeRuleIBLL.GetBillCode("FS01");
  145. }
  146. else
  147. {
  148. fileInfoEntity = fileInfoIBLL.GetEntity(fileInfoId);
  149. code = fileInfoEntity.F_Code;
  150. if (fileListEntity == null)
  151. {
  152. var fileListEntity2 = fileInfoIBLL.GetListEntityByInfoId(fileInfoId);
  153. if (fileListEntity2 != null)
  154. {
  155. string[] verList = fileListEntity2.F_Ver.Split('.');
  156. var l = verList.Length;
  157. ver = "";
  158. for (var i = 0; i < l; i++)
  159. {
  160. if (i < l - 1)
  161. {
  162. ver += verList[i] + ".";
  163. }
  164. else
  165. {
  166. ver += (Convert.ToInt32(verList[i]) + 1);
  167. }
  168. }
  169. }
  170. }
  171. else {
  172. ver = fileListEntity.F_Ver;
  173. }
  174. }
  175. var jsondata = new {
  176. ver,
  177. code,
  178. fileInfoEntity,
  179. fileListEntity
  180. };
  181. return this.Success(jsondata);
  182. }
  183. /// <summary>
  184. /// 获取我的流程信息列表
  185. /// </summary>
  186. /// <param name="pagination">分页参数</param>
  187. /// <param name="keyWord">查询条件</param>
  188. /// <returns></returns>
  189. [HttpGet]
  190. [AjaxOnly]
  191. public ActionResult GetWFPageList(string pagination, string keyWord, string wfType)
  192. {
  193. Pagination paginationobj = pagination.ToObject<Pagination>();
  194. IEnumerable<WFFileModel> list = new List<WFFileModel>();
  195. UserInfo userInfo = LoginUserInfo.Get();
  196. string strSql = "";
  197. switch (wfType)
  198. {
  199. case "1":// 我的流程
  200. strSql = nWFProcessIBLL.GetMySql();
  201. break;
  202. case "2":// 待办流程
  203. strSql = nWFProcessIBLL.GetMyTaskSql(userInfo);
  204. break;
  205. case "3":// 已办流程
  206. strSql = nWFProcessIBLL.GetMyFinishTaskSql();
  207. break;
  208. }
  209. list = fileInfoIBLL.GetWfPageList(strSql, paginationobj, keyWord, userInfo.userId);
  210. var jsonData = new
  211. {
  212. rows = list,
  213. paginationobj.total,
  214. paginationobj.page,
  215. paginationobj.records,
  216. };
  217. return Success(jsonData);
  218. }
  219. /// <summary>
  220. /// 获取我的流程信息列表
  221. /// </summary>
  222. /// <param name="pagination">分页参数</param>
  223. /// <param name="keyWord">查询条件</param>
  224. /// <returns></returns>
  225. [HttpGet]
  226. [AjaxOnly]
  227. public ActionResult GetAllPublishPageList(string keyWord, string folderId)
  228. {
  229. var list = fileInfoIBLL.GetAllPublishPageList(keyWord, folderId);
  230. return Success(list);
  231. }
  232. /// <summary>
  233. /// 获取正式发布的文件
  234. /// </summary>
  235. /// <param name="folderId">文件夹Id</param>
  236. /// <param name="keyWord">查询条件</param>
  237. /// <returns></returns>
  238. [HttpGet]
  239. [AjaxOnly]
  240. public ActionResult GetPublishList(string keyWord, string folderId)
  241. {
  242. var list = fileInfoIBLL.GetPublishList(keyWord, folderId);
  243. return Success(list);
  244. }
  245. /// <summary>
  246. /// 文件的历史信息
  247. /// </summary>
  248. /// <param name="fileInfoId">文件夹Id</param>
  249. /// <returns></returns>
  250. [HttpGet]
  251. [AjaxOnly]
  252. public ActionResult GetHistoryList(string fileInfoId)
  253. {
  254. var list = fileInfoIBLL.GetHistoryList(fileInfoId);
  255. return Success(list);
  256. }
  257. /// <summary>
  258. /// 被删除的文件信息
  259. /// </summary>
  260. /// <param name="fileInfoId">文件夹Id</param>
  261. /// <returns></returns>
  262. [HttpGet]
  263. [AjaxOnly]
  264. public ActionResult GetDeleteList(string fileInfoId)
  265. {
  266. var list = fileInfoIBLL.GetDeleteList(fileInfoId);
  267. return Success(list);
  268. }
  269. #endregion
  270. #region 提交数据
  271. [HttpPost]
  272. [AjaxOnly]
  273. public ActionResult SaveFolder(string keyValue,FolderEntity entity)
  274. {
  275. folderIBLL.SaveEntity(keyValue,entity);
  276. return this.Success("保存成功");
  277. }
  278. [HttpPost]
  279. [AjaxOnly]
  280. public ActionResult DeleteFolder(string keyValue)
  281. {
  282. var res = folderIBLL.DeleteEntity(keyValue);
  283. if (res)
  284. {
  285. return this.Success("删除成功");
  286. }
  287. else {
  288. return this.Success("不准删除,有文件或子文件夹");
  289. }
  290. }
  291. /// <summary>
  292. /// 虚拟删除文件
  293. /// </summary>
  294. /// <param name="keyValue"></param>
  295. /// <returns></returns>
  296. [HttpPost]
  297. [AjaxOnly]
  298. public ActionResult VDeleteFile(string keyValue)
  299. {
  300. fileInfoIBLL.VDeleteEntity(keyValue);
  301. return this.Success("删除成功");
  302. }
  303. /// <summary>
  304. /// 还原虚拟删除文件
  305. /// </summary>
  306. /// <param name="keyValue"></param>
  307. /// <returns></returns>
  308. [HttpPost]
  309. [AjaxOnly]
  310. public ActionResult RecoveryFile(string keyValue)
  311. {
  312. fileInfoIBLL.RecoveryEntity(keyValue);
  313. return this.Success("删除成功");
  314. }
  315. /// <summary>
  316. /// 彻底删除文件
  317. /// </summary>
  318. /// <param name="keyValue"></param>
  319. /// <returns></returns>
  320. [HttpPost]
  321. [AjaxOnly]
  322. public ActionResult DeleteFile(string keyValue)
  323. {
  324. fileInfoIBLL.DeleteEntity(keyValue);
  325. return this.Success("删除成功");
  326. }
  327. /// <summary>
  328. /// 保存数据
  329. /// </summary>
  330. /// <param name="keyValue">主键</param>
  331. /// <param name="strInfoEntity">文件信息</param>
  332. /// <param name="strListEntity">文件列表信息</param>
  333. /// <returns></returns>
  334. [HttpPost]
  335. [AjaxOnly]
  336. public ActionResult SaveFile(string keyValue, string strInfoEntity, string strListEntity)
  337. {
  338. FileBInfoEntity fileBInfoEntity = strInfoEntity.ToObject<FileBInfoEntity>();
  339. FilelistEntity filelistEntity = strListEntity.ToObject<FilelistEntity>();
  340. if (string.IsNullOrEmpty(fileBInfoEntity.F_Id))
  341. {
  342. codeRuleIBLL.UseRuleSeed("FS01");
  343. }
  344. fileInfoIBLL.SaveEntity(keyValue, fileBInfoEntity, filelistEntity);
  345. return this.Success("保存成功");
  346. }
  347. #endregion
  348. #region 权限管理
  349. /// <summary>
  350. /// 判断文件有没有上传权限
  351. /// </summary>
  352. /// <param name="folderId"></param>
  353. /// <returns></returns>
  354. public ActionResult IsUPLoad(string folderId) {
  355. var res = fileAuthIBLL.IsUPLoad(folderId);
  356. return Success(res);
  357. }
  358. /// <summary>
  359. /// 获取我的流程信息列表
  360. /// </summary>
  361. /// <param name="fileInfoId">文件信息主键</param>
  362. /// <returns></returns>
  363. [HttpGet]
  364. [AjaxOnly]
  365. public ActionResult GetAuthList(string fileInfoId)
  366. {
  367. var list = fileAuthIBLL.GetList(fileInfoId);
  368. return Success(list);
  369. }
  370. [HttpGet]
  371. [AjaxOnly]
  372. public ActionResult GetAuthEntity(string keyValue)
  373. {
  374. var list = fileAuthIBLL.GetEntity(keyValue);
  375. return Success(list);
  376. }
  377. /// <summary>
  378. /// 删除授权对象
  379. /// </summary>
  380. /// <param name="keyValue">主键</param>
  381. /// <returns></returns>
  382. [HttpPost]
  383. [AjaxOnly]
  384. public ActionResult DeleteAuth(string keyValue)
  385. {
  386. fileAuthIBLL.DeleteEntity(keyValue);
  387. return this.Success("删除成功");
  388. }
  389. /// <summary>
  390. /// 保存授权信息
  391. /// </summary>
  392. /// <param name="keyValue">主键</param>
  393. /// <param name="entity">实体数据</param>
  394. /// <returns></returns>
  395. [HttpPost]
  396. [AjaxOnly]
  397. public ActionResult SaveAuth(string keyValue, FileAuthEntity entity)
  398. {
  399. var res = fileAuthIBLL.SaveEntity(keyValue, entity);
  400. if (res)
  401. {
  402. return this.Success("保存成功");
  403. }
  404. else {
  405. return this.Success("该角色已经对该文件授权过!");
  406. }
  407. }
  408. #endregion
  409. }
  410. }