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.
 
 
 
 
 
 

205 lines
6.1 KiB

  1. using Learun.Cache.Base;
  2. using Learun.Cache.Factory;
  3. using Learun.Util;
  4. using System;
  5. using System.Collections.Generic;
  6. namespace Learun.Application.WorkFlow
  7. {
  8. /// <summary>
  9. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  10. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  11. /// 创建人:陈彬彬
  12. /// 日 期:2017.04.17
  13. /// 描 述:工作流实例
  14. /// </summary>
  15. public class WfProcessInstanceBLL : WfProcessInstanceIBLL
  16. {
  17. private WfProcessInstanceService wfProcessService = new WfProcessInstanceService();
  18. #region 缓存定义
  19. private ICache cache = CacheFactory.CaChe();
  20. private string cacheKey = "Learun_adms_wfprocess_";// +实例主键
  21. #endregion
  22. #region 获取数据
  23. /// <summary>
  24. /// 获取流程实例
  25. /// </summary>
  26. /// <param name="keyValue">主键</param>
  27. /// <returns></returns>
  28. public WfProcessInstanceEntity GetEntity(string keyValue)
  29. {
  30. try
  31. {
  32. WfProcessInstanceEntity entity = cache.Read<WfProcessInstanceEntity>(cacheKey + keyValue, CacheId.workflow);
  33. if (entity == null)
  34. {
  35. entity = wfProcessService.GetEntity(keyValue);
  36. cache.Write<WfProcessInstanceEntity>(cacheKey + keyValue, entity, CacheId.workflow);
  37. }
  38. return entity;
  39. }
  40. catch (Exception ex)
  41. {
  42. if (ex is ExceptionEx)
  43. {
  44. throw;
  45. }
  46. else
  47. {
  48. throw ExceptionEx.ThrowBusinessException(ex);
  49. }
  50. }
  51. }
  52. /// <summary>
  53. /// 获取流程信息列表
  54. /// </summary>
  55. /// <param name="pagination">分页参数</param>
  56. /// <param name="queryJson">查询条件</param>
  57. /// <returns></returns>
  58. public IEnumerable<WfProcessInstanceEntity> GetPageList(Pagination pagination, string queryJson)
  59. {
  60. try
  61. {
  62. return wfProcessService.GetPageList(pagination, queryJson);
  63. }
  64. catch (Exception ex)
  65. {
  66. if (ex is ExceptionEx)
  67. {
  68. throw;
  69. }
  70. else
  71. {
  72. throw ExceptionEx.ThrowBusinessException(ex);
  73. }
  74. }
  75. }
  76. /// <summary>
  77. /// 获取我的流程信息列表
  78. /// </summary>
  79. /// <param name="userId">用户主键</param>
  80. /// <param name="pagination">分页参数</param>
  81. /// <param name="queryJson">查询条件</param>
  82. /// <returns></returns>
  83. public IEnumerable<WfProcessInstanceEntity> GetMyPageList(string userId, Pagination pagination, string queryJson)
  84. {
  85. try
  86. {
  87. return wfProcessService.GetMyPageList(userId, pagination, queryJson);
  88. }
  89. catch (Exception ex)
  90. {
  91. if (ex is ExceptionEx)
  92. {
  93. throw;
  94. }
  95. else
  96. {
  97. throw ExceptionEx.ThrowBusinessException(ex);
  98. }
  99. }
  100. }
  101. /// <summary>
  102. /// 获取流程实例信息
  103. /// </summary>
  104. /// <param name="processId">实例主键</param>
  105. /// <returns></returns>
  106. public IEnumerable<WfProcessInstanceEntity> GetListByProcessIds(string processIds)
  107. {
  108. try
  109. {
  110. return wfProcessService.GetListByProcessIds(processIds);
  111. }
  112. catch (Exception ex)
  113. {
  114. if (ex is ExceptionEx)
  115. {
  116. throw;
  117. }
  118. else
  119. {
  120. throw ExceptionEx.ThrowServiceException(ex);
  121. }
  122. }
  123. }
  124. /// <summary>
  125. /// 获取全部流程实例
  126. /// </summary>
  127. /// <param name="processIds"></param>
  128. /// <returns></returns>
  129. public IEnumerable<WfProcessInstanceEntity> GetListByAllProcessIds(string processIds)
  130. {
  131. try
  132. {
  133. return wfProcessService.GetListByAllProcessIds(processIds);
  134. }
  135. catch (Exception ex)
  136. {
  137. if (ex is ExceptionEx)
  138. {
  139. throw;
  140. }
  141. else
  142. {
  143. throw ExceptionEx.ThrowServiceException(ex);
  144. }
  145. }
  146. }
  147. #endregion
  148. #region 提交数据
  149. /// <summary>
  150. /// 删除流程实例
  151. /// </summary>
  152. /// <param name="keyValue"></param>
  153. public void DeleteEntity(string keyValue)
  154. {
  155. try
  156. {
  157. cache.Remove(cacheKey + keyValue, CacheId.workflow);
  158. wfProcessService.DeleteEntity(keyValue);
  159. }
  160. catch (Exception ex)
  161. {
  162. if (ex is ExceptionEx)
  163. {
  164. throw;
  165. }
  166. else
  167. {
  168. throw ExceptionEx.ThrowBusinessException(ex);
  169. }
  170. }
  171. }
  172. /// <summary>
  173. /// 保存流程实例
  174. /// </summary>
  175. /// <param name="keyValue">主键</param>
  176. /// <param name="entity">实体</param>
  177. public void SaveEntity(string keyValue, WfProcessInstanceEntity entity)
  178. {
  179. try
  180. {
  181. cache.Remove(cacheKey + keyValue, CacheId.workflow);
  182. wfProcessService.SaveEntity(keyValue, entity);
  183. }
  184. catch (Exception ex)
  185. {
  186. if (ex is ExceptionEx)
  187. {
  188. throw;
  189. }
  190. else
  191. {
  192. throw ExceptionEx.ThrowBusinessException(ex);
  193. }
  194. }
  195. }
  196. #endregion
  197. }
  198. }