You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ModuleBLL.cs 26 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720
  1. using Learun.Application.Base.AuthorizeModule;
  2. using Learun.Cache.Base;
  3. using Learun.Cache.Factory;
  4. using Learun.Util;
  5. using System;
  6. using System.Collections.Generic;
  7. namespace Learun.Application.Base.SystemModule
  8. {
  9. /// <summary>
  10. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  11. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  12. /// 创建人:陈彬彬
  13. /// 日 期:2017.03.08
  14. /// 描 述:功能模块(缓存在0号库)
  15. /// 功能模块缓存结构
  16. /// </summary>
  17. public class ModuleBLL : ModuleIBLL
  18. {
  19. #region 属性
  20. private ModuleService moduleService = new ModuleService();
  21. private AuthorizeIBLL authorizeIBLL = new AuthorizeBLL();
  22. #endregion
  23. #region 缓存定义
  24. private ICache cache = CacheFactory.CaChe();
  25. private string cacheKey = "learun_adms_modules";
  26. private string cacheKeyBtn = "learun_adms_modules_Btn_"; // + 模块主键
  27. private string cacheKeyColumn = "learun_adms_modules_Column_";// + 模块主键
  28. private string cacheKeyForm = "learun_adms_modules_Form_";// + 模块主键
  29. #endregion
  30. #region 功能模块
  31. /// <summary>
  32. /// 功能列表
  33. /// </summary>
  34. /// <returns></returns>
  35. public List<ModuleEntity> GetModuleList()
  36. {
  37. try
  38. {
  39. List<ModuleEntity> list = cache.Read<List<ModuleEntity>>(cacheKey, CacheId.module);
  40. if (list == null)
  41. {
  42. list = (List<ModuleEntity>)moduleService.GetList();
  43. cache.Write<List<ModuleEntity>>(cacheKey, list, CacheId.module);
  44. }
  45. UserInfo userInfo = LoginUserInfo.Get();
  46. /*关联权限*/
  47. if (!userInfo.isSystem)
  48. {
  49. string objectIds = userInfo.userId + (string.IsNullOrEmpty(userInfo.roleIds) ? "" : ("," + userInfo.roleIds));
  50. List<string> itemIdList = authorizeIBLL.GetItemIdListByobjectIds(objectIds, 1);
  51. list = list.FindAll(t => itemIdList.IndexOf(t.F_ModuleId) >= 0);
  52. }
  53. return list;
  54. }
  55. catch (Exception ex)
  56. {
  57. if (ex is ExceptionEx)
  58. {
  59. throw;
  60. }
  61. else
  62. {
  63. throw ExceptionEx.ThrowBusinessException(ex);
  64. }
  65. }
  66. }
  67. /// <summary>
  68. /// 功能列表
  69. /// </summary>
  70. /// <returns></returns>
  71. public ModuleEntity GetModuleByUrl(string url)
  72. {
  73. try
  74. {
  75. if (url.Contains("?"))
  76. {
  77. if (!url.Contains("/LR_FormModule/FormRelation/PreviewIndex"))
  78. {
  79. url = url.Substring(0, url.IndexOf('?'));
  80. }
  81. }
  82. List<ModuleEntity> list = GetModuleList();
  83. return list.Find(t => t.F_UrlAddress == url);
  84. }
  85. catch (Exception ex)
  86. {
  87. if (ex is ExceptionEx)
  88. {
  89. throw;
  90. }
  91. else
  92. {
  93. throw ExceptionEx.ThrowBusinessException(ex);
  94. }
  95. }
  96. }
  97. /// <summary>
  98. /// 获取功能列表的树形数据
  99. /// </summary>
  100. /// <returns></returns>
  101. public List<TreeModel> GetModuleTree()
  102. {
  103. List<ModuleEntity> modulelist = GetModuleList();
  104. List<TreeModel> treeList = new List<TreeModel>();
  105. foreach (var item in modulelist)
  106. {
  107. TreeModel node = new TreeModel();
  108. node.id = item.F_ModuleId;
  109. node.text = item.F_FullName;
  110. node.value = item.F_EnCode;
  111. node.showcheck = false;
  112. node.checkstate = 0;
  113. node.isexpand = (item.F_AllowExpand == 1);
  114. node.icon = item.F_Icon;
  115. node.parentId = item.F_ParentId;
  116. treeList.Add(node);
  117. }
  118. return treeList.ToTree();
  119. }
  120. /// <summary>
  121. /// 获取功能列表的树形数据(带勾选框)
  122. /// </summary>
  123. /// <returns></returns>
  124. public List<TreeModel> GetModuleCheckTree()
  125. {
  126. List<ModuleEntity> modulelist = GetModuleList();
  127. List<TreeModel> treeList = new List<TreeModel>();
  128. foreach (var item in modulelist)
  129. {
  130. TreeModel node = new TreeModel();
  131. node.id = item.F_ModuleId;
  132. node.text = item.F_FullName;
  133. node.value = item.F_EnCode;
  134. node.showcheck = true;
  135. node.checkstate = 0;
  136. node.isexpand = true;
  137. node.icon = item.F_Icon;
  138. node.parentId = item.F_ParentId;
  139. treeList.Add(node);
  140. }
  141. return treeList.ToTree();
  142. }
  143. /// <summary>
  144. /// 获取功能列表的树形数据(只有展开项)
  145. /// </summary>
  146. /// <returns></returns>
  147. public List<TreeModel> GetExpendModuleTree()
  148. {
  149. List<ModuleEntity> modulelist = GetModuleList();
  150. List<TreeModel> treeList = new List<TreeModel>();
  151. foreach (var item in modulelist)
  152. {
  153. if (item.F_Target == "expand")
  154. {
  155. TreeModel node = new TreeModel();
  156. node.id = item.F_ModuleId;
  157. node.text = item.F_FullName;
  158. node.value = item.F_EnCode;
  159. node.showcheck = false;
  160. node.checkstate = 0;
  161. node.isexpand = true;
  162. node.icon = item.F_Icon;
  163. node.parentId = item.F_ParentId;
  164. treeList.Add(node);
  165. }
  166. }
  167. return treeList.ToTree();
  168. }
  169. /// <summary>
  170. /// 根据父级主键获取数据
  171. /// </summary>
  172. /// <param name="keyword">关键字</param>
  173. /// <param name="parentId">父级主键</param>
  174. /// <returns></returns>
  175. public List<ModuleEntity> GetModuleListByParentId(string keyword, string parentId)
  176. {
  177. try
  178. {
  179. List<ModuleEntity> list = (List<ModuleEntity>)GetModuleList();
  180. list = list.FindAll(t => t.F_ParentId == parentId);
  181. if (!string.IsNullOrEmpty(keyword))
  182. {
  183. list = list.FindAll(t => t.F_FullName.Contains(keyword) || t.F_EnCode.Contains(keyword));
  184. }
  185. return list;
  186. }
  187. catch (Exception ex)
  188. {
  189. if (ex is ExceptionEx)
  190. {
  191. throw;
  192. }
  193. else
  194. {
  195. throw ExceptionEx.ThrowBusinessException(ex);
  196. }
  197. }
  198. }
  199. /// <summary>
  200. /// 功能实体
  201. /// </summary>
  202. /// <param name="keyValue">主键值</param>
  203. /// <returns></returns>
  204. public ModuleEntity GetModuleEntity(string keyValue)
  205. {
  206. try
  207. {
  208. return moduleService.GetEntity(keyValue);
  209. }
  210. catch (Exception ex)
  211. {
  212. if (ex is ExceptionEx)
  213. {
  214. throw;
  215. }
  216. else
  217. {
  218. throw ExceptionEx.ThrowBusinessException(ex);
  219. }
  220. }
  221. }
  222. #endregion
  223. #region 模块按钮
  224. /// <summary>
  225. /// 获取按钮列表数据
  226. /// </summary>
  227. /// <param name="moduleId">模块Id</param>
  228. /// <returns></returns>
  229. public List<ModuleButtonEntity> GetButtonListNoAuthorize(string moduleId)
  230. {
  231. try
  232. {
  233. List<ModuleButtonEntity> list = cache.Read<List<ModuleButtonEntity>>(cacheKeyBtn + moduleId, CacheId.module);
  234. if (list == null)
  235. {
  236. list = (List<ModuleButtonEntity>)moduleService.GetButtonList(moduleId);
  237. cache.Write<List<ModuleButtonEntity>>(cacheKeyBtn + moduleId, list, CacheId.module);
  238. }
  239. return list;
  240. }
  241. catch (Exception ex)
  242. {
  243. if (ex is ExceptionEx)
  244. {
  245. throw;
  246. }
  247. else
  248. {
  249. throw ExceptionEx.ThrowBusinessException(ex);
  250. }
  251. }
  252. }
  253. /// <summary>
  254. /// 获取按钮列表数据
  255. /// </summary>
  256. /// <param name="moduleId">模块Id</param>
  257. /// <returns></returns>
  258. public List<ModuleButtonEntity> GetButtonList(string moduleId)
  259. {
  260. try
  261. {
  262. List<ModuleButtonEntity> list = cache.Read<List<ModuleButtonEntity>>(cacheKeyBtn + moduleId, CacheId.module);
  263. if (list == null)
  264. {
  265. list = (List<ModuleButtonEntity>)moduleService.GetButtonList(moduleId);
  266. cache.Write<List<ModuleButtonEntity>>(cacheKeyBtn + moduleId, list, CacheId.module);
  267. }
  268. UserInfo userInfo = LoginUserInfo.Get();
  269. /*关联权限*/
  270. if (!userInfo.isSystem)
  271. {
  272. string objectIds = userInfo.userId + (string.IsNullOrEmpty(userInfo.roleIds) ? "" : ("," + userInfo.roleIds));
  273. List<string> itemIdList = authorizeIBLL.GetItemIdListByobjectIds(objectIds, 2);
  274. list = list.FindAll(t => itemIdList.IndexOf(t.F_ModuleButtonId) >= 0);
  275. }
  276. return list;
  277. }
  278. catch (Exception ex)
  279. {
  280. if (ex is ExceptionEx)
  281. {
  282. throw;
  283. }
  284. else
  285. {
  286. throw ExceptionEx.ThrowBusinessException(ex);
  287. }
  288. }
  289. }
  290. /// <summary>
  291. /// 获取按钮列表数据
  292. /// </summary>
  293. /// <param name="url">功能模块地址</param>
  294. /// <returns></returns>
  295. public List<ModuleButtonEntity> GetButtonListByUrl(string url)
  296. {
  297. try
  298. {
  299. ModuleEntity moduleEntity = GetModuleByUrl(url);
  300. if (moduleEntity == null)
  301. {
  302. return new List<ModuleButtonEntity>();
  303. }
  304. return GetButtonList(moduleEntity.F_ModuleId);
  305. }
  306. catch (Exception ex)
  307. {
  308. if (ex is ExceptionEx)
  309. {
  310. throw;
  311. }
  312. else
  313. {
  314. throw ExceptionEx.ThrowBusinessException(ex);
  315. }
  316. }
  317. }
  318. /// <summary>
  319. /// 获取按钮列表树形数据(基于功能模块)
  320. /// </summary>
  321. /// <returns></returns>
  322. public List<TreeModel> GetButtonCheckTree()
  323. {
  324. List<ModuleEntity> modulelist = GetModuleList();
  325. List<TreeModel> treeList = new List<TreeModel>();
  326. foreach (var module in modulelist)
  327. {
  328. TreeModel node = new TreeModel();
  329. node.id = module.F_ModuleId + "_learun_moduleId";
  330. node.text = module.F_FullName;
  331. node.value = module.F_EnCode;
  332. node.showcheck = true;
  333. node.checkstate = 0;
  334. node.isexpand = true;
  335. node.icon = module.F_Icon;
  336. node.parentId = module.F_ParentId + "_learun_moduleId";
  337. if (module.F_Target != "expand")
  338. {
  339. List<ModuleButtonEntity> buttonList = GetButtonList(module.F_ModuleId);
  340. if (buttonList.Count > 0)
  341. {
  342. treeList.Add(node);
  343. }
  344. foreach (var button in buttonList)
  345. {
  346. TreeModel buttonNode = new TreeModel();
  347. buttonNode.id = button.F_ModuleButtonId;
  348. buttonNode.text = button.F_FullName;
  349. buttonNode.value = button.F_EnCode;
  350. buttonNode.showcheck = true;
  351. buttonNode.checkstate = 0;
  352. buttonNode.isexpand = true;
  353. buttonNode.icon = "fa fa-wrench";
  354. buttonNode.parentId = (button.F_ParentId == "0" ? button.F_ModuleId + "_learun_moduleId" : button.F_ParentId);
  355. treeList.Add(buttonNode);
  356. };
  357. }
  358. else
  359. {
  360. treeList.Add(node);
  361. }
  362. }
  363. return treeList.ToTree();
  364. }
  365. #endregion
  366. #region 模块视图
  367. /// <summary>
  368. /// 获取视图列表数据
  369. /// </summary>
  370. /// <param name="moduleId">模块Id</param>
  371. /// <returns></returns>
  372. public List<ModuleColumnEntity> GetColumnList(string moduleId)
  373. {
  374. try
  375. {
  376. List<ModuleColumnEntity> list = cache.Read<List<ModuleColumnEntity>>(cacheKeyColumn + moduleId, CacheId.module);
  377. if (list == null)
  378. {
  379. list = (List<ModuleColumnEntity>)moduleService.GetColumnList(moduleId);
  380. cache.Write<List<ModuleColumnEntity>>(cacheKeyColumn + moduleId, list, CacheId.module);
  381. }
  382. UserInfo userInfo = LoginUserInfo.Get();
  383. /*关联权限*/
  384. if (!userInfo.isSystem)
  385. {
  386. string objectIds = userInfo.userId + (string.IsNullOrEmpty(userInfo.roleIds) ? "" : ("," + userInfo.roleIds));
  387. List<string> itemIdList = authorizeIBLL.GetItemIdListByobjectIds(objectIds, 3);
  388. list = list.FindAll(t => itemIdList.IndexOf(t.F_ModuleColumnId) >= 0);
  389. }
  390. return list;
  391. }
  392. catch (Exception ex)
  393. {
  394. if (ex is ExceptionEx)
  395. {
  396. throw;
  397. }
  398. else
  399. {
  400. throw ExceptionEx.ThrowBusinessException(ex);
  401. }
  402. }
  403. }
  404. /// <summary>
  405. /// 获取视图列表数据
  406. /// </summary>
  407. /// <param name="url">功能模块地址</param>
  408. /// <returns></returns>
  409. public List<ModuleColumnEntity> GetColumnListByUrl(string url)
  410. {
  411. try
  412. {
  413. ModuleEntity moduleEntity = GetModuleByUrl(url);
  414. if (moduleEntity == null)
  415. {
  416. return new List<ModuleColumnEntity>();
  417. }
  418. return GetColumnList(moduleEntity.F_ModuleId);
  419. }
  420. catch (Exception ex)
  421. {
  422. if (ex is ExceptionEx)
  423. {
  424. throw;
  425. }
  426. else
  427. {
  428. throw ExceptionEx.ThrowBusinessException(ex);
  429. }
  430. }
  431. }
  432. /// <summary>
  433. /// 获取按钮列表树形数据(基于功能模块)
  434. /// </summary>
  435. /// <returns></returns>
  436. public List<TreeModel> GetColumnCheckTree()
  437. {
  438. List<ModuleEntity> modulelist = GetModuleList();
  439. List<TreeModel> treeList = new List<TreeModel>();
  440. foreach (var module in modulelist)
  441. {
  442. TreeModel node = new TreeModel();
  443. node.id = module.F_ModuleId + "_learun_moduleId";
  444. node.text = module.F_FullName;
  445. node.value = module.F_EnCode;
  446. node.showcheck = true;
  447. node.checkstate = 0;
  448. node.isexpand = true;
  449. node.icon = module.F_Icon;
  450. node.parentId = module.F_ParentId + "_learun_moduleId";
  451. if (module.F_Target != "expand")
  452. {
  453. List<ModuleColumnEntity> columnList = GetColumnList(module.F_ModuleId);
  454. if (columnList.Count > 0)
  455. {
  456. treeList.Add(node);
  457. }
  458. foreach (var column in columnList)
  459. {
  460. TreeModel columnNode = new TreeModel();
  461. columnNode.id = column.F_ModuleColumnId;
  462. columnNode.text = column.F_FullName;
  463. columnNode.value = column.F_EnCode;
  464. columnNode.showcheck = true;
  465. columnNode.checkstate = 0;
  466. columnNode.isexpand = true;
  467. columnNode.icon = "fa fa-filter";
  468. columnNode.parentId = column.F_ModuleId + "_learun_moduleId";
  469. treeList.Add(columnNode);
  470. };
  471. }
  472. else
  473. {
  474. treeList.Add(node);
  475. }
  476. }
  477. return treeList.ToTree();
  478. }
  479. #endregion
  480. #region 模块表单
  481. /// <summary>
  482. /// 获取表单字段数据
  483. /// </summary>
  484. /// <param name="moduleId">模块Id</param>
  485. /// <returns></returns>
  486. public List<ModuleFormEntity> GetFormList(string moduleId)
  487. {
  488. try
  489. {
  490. List<ModuleFormEntity> list = cache.Read<List<ModuleFormEntity>>(cacheKeyForm + moduleId, CacheId.module);
  491. if (list == null)
  492. {
  493. list = (List<ModuleFormEntity>)moduleService.GetFormList(moduleId);
  494. cache.Write<List<ModuleFormEntity>>(cacheKeyForm + moduleId, list, CacheId.module);
  495. }
  496. UserInfo userInfo = LoginUserInfo.Get();
  497. /*关联权限*/
  498. if (!userInfo.isSystem)
  499. {
  500. string objectIds = userInfo.userId + (string.IsNullOrEmpty(userInfo.roleIds) ? "" : ("," + userInfo.roleIds));
  501. List<string> itemIdList = authorizeIBLL.GetItemIdListByobjectIds(objectIds, 3);
  502. list = list.FindAll(t => itemIdList.IndexOf(t.F_ModuleFormId) >= 0);
  503. }
  504. return list;
  505. }
  506. catch (Exception ex)
  507. {
  508. if (ex is ExceptionEx)
  509. {
  510. throw;
  511. }
  512. else
  513. {
  514. throw ExceptionEx.ThrowBusinessException(ex);
  515. }
  516. }
  517. }
  518. /// <summary>
  519. /// 获取表单字段数据
  520. /// </summary>
  521. /// <param name="url">功能模块地址</param>
  522. /// <returns></returns>
  523. public List<ModuleFormEntity> GetFormListByUrl(string url)
  524. {
  525. try
  526. {
  527. ModuleEntity moduleEntity = GetModuleByUrl(url);
  528. if (moduleEntity == null)
  529. {
  530. return new List<ModuleFormEntity>();
  531. }
  532. return GetFormList(moduleEntity.F_ModuleId);
  533. }
  534. catch (Exception ex)
  535. {
  536. if (ex is ExceptionEx)
  537. {
  538. throw;
  539. }
  540. else
  541. {
  542. throw ExceptionEx.ThrowBusinessException(ex);
  543. }
  544. }
  545. }
  546. /// <summary>
  547. /// 获取表单字段树形数据(基于功能模块)
  548. /// </summary>
  549. /// <returns></returns>
  550. public List<TreeModel> GetFormCheckTree()
  551. {
  552. List<ModuleEntity> modulelist = GetModuleList();
  553. List<TreeModel> treeList = new List<TreeModel>();
  554. foreach (var module in modulelist)
  555. {
  556. TreeModel node = new TreeModel();
  557. node.id = module.F_ModuleId + "_learun_moduleId";
  558. node.text = module.F_FullName;
  559. node.value = module.F_EnCode;
  560. node.showcheck = true;
  561. node.checkstate = 0;
  562. node.isexpand = true;
  563. node.icon = module.F_Icon;
  564. node.parentId = module.F_ParentId + "_learun_moduleId";
  565. if (module.F_Target != "expand")
  566. {
  567. List<ModuleFormEntity> columnList = GetFormList(module.F_ModuleId);
  568. if (columnList.Count > 0)
  569. {
  570. treeList.Add(node);
  571. }
  572. foreach (var column in columnList)
  573. {
  574. TreeModel columnNode = new TreeModel();
  575. columnNode.id = column.F_ModuleFormId;
  576. columnNode.text = column.F_FullName;
  577. columnNode.value = column.F_EnCode;
  578. columnNode.showcheck = true;
  579. columnNode.checkstate = 0;
  580. columnNode.isexpand = true;
  581. columnNode.icon = "fa fa-filter";
  582. columnNode.parentId = column.F_ModuleId + "_learun_moduleId";
  583. treeList.Add(columnNode);
  584. };
  585. }
  586. else
  587. {
  588. treeList.Add(node);
  589. }
  590. }
  591. return treeList.ToTree();
  592. }
  593. #endregion
  594. #region 提交数据
  595. /// <summary>
  596. /// 虚拟删除模块功能
  597. /// </summary>
  598. /// <param name="keyValue">主键值</param>
  599. public bool Delete(string keyValue)
  600. {
  601. try
  602. {
  603. List<ModuleEntity> list = GetModuleListByParentId("", keyValue);
  604. if (list.Count > 0)
  605. {
  606. return false;
  607. }
  608. moduleService.Delete(keyValue);
  609. cache.Remove(cacheKey, CacheId.module);
  610. cache.Remove(cacheKeyBtn + keyValue, CacheId.module);
  611. cache.Remove(cacheKeyColumn + keyValue, CacheId.module);
  612. cache.Remove(cacheKeyForm + keyValue, CacheId.module);
  613. return true;
  614. }
  615. catch (Exception ex)
  616. {
  617. if (ex is ExceptionEx)
  618. {
  619. throw;
  620. }
  621. else
  622. {
  623. throw ExceptionEx.ThrowBusinessException(ex);
  624. }
  625. }
  626. }
  627. /// <summary>
  628. /// 保存模块功能实体(新增、修改)
  629. /// </summary>
  630. /// <param name="keyValue">主键值</param>
  631. /// <param name="moduleEntity">实体</param>
  632. /// <param name="moduleButtonEntitys">按钮列表</param>
  633. /// <param name="moduleColumnEntitys">视图列集合</param>
  634. /// <param name="moduleFormEntitys">表单字段集合</param>
  635. public void SaveEntity(string keyValue, ModuleEntity moduleEntity, List<ModuleButtonEntity> moduleButtonEntitys, List<ModuleColumnEntity> moduleColumnEntitys, List<ModuleFormEntity> moduleFormEntitys)
  636. {
  637. try
  638. {
  639. moduleService.SaveEntity(keyValue, moduleEntity, moduleButtonEntitys, moduleColumnEntitys, moduleFormEntitys);
  640. /*移除缓存信息*/
  641. cache.Remove(cacheKey, CacheId.module);
  642. if (!string.IsNullOrEmpty(keyValue))
  643. {
  644. cache.Remove(cacheKeyBtn + keyValue, CacheId.module);
  645. cache.Remove(cacheKeyColumn + keyValue, CacheId.module);
  646. cache.Remove(cacheKeyForm + keyValue, CacheId.module);
  647. }
  648. }
  649. catch (Exception ex)
  650. {
  651. if (ex is ExceptionEx)
  652. {
  653. throw;
  654. }
  655. else
  656. {
  657. throw ExceptionEx.ThrowBusinessException(ex);
  658. }
  659. }
  660. }
  661. #endregion
  662. #region 权限验证
  663. /// <summary>
  664. /// 验证当前访问的地址是否有权限
  665. /// </summary>
  666. /// <param name="url">访问地址</param>
  667. /// <returns></returns>
  668. public bool FilterAuthorize(string url)
  669. {
  670. try
  671. {
  672. List<ModuleEntity> list = GetModuleList();
  673. // 验证是否是功能页面
  674. var modulelist = list.FindAll(t => t.F_UrlAddress == url);
  675. if (modulelist.Count > 0)
  676. {
  677. return true;
  678. }
  679. // 是否是功能按钮的
  680. foreach (var item in list)
  681. {
  682. List<ModuleButtonEntity> buttonList = GetButtonList(item.F_ModuleId);
  683. var buttonList2 = buttonList.FindAll(t => t.F_ActionAddress == url);
  684. if (buttonList2.Count > 0)
  685. {
  686. return true;
  687. }
  688. }
  689. return false;
  690. }
  691. catch (Exception ex)
  692. {
  693. if (ex is ExceptionEx)
  694. {
  695. throw;
  696. }
  697. else
  698. {
  699. throw ExceptionEx.ThrowBusinessException(ex);
  700. }
  701. }
  702. }
  703. #endregion
  704. }
  705. }