|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204 |
- using Learun.Cache.Base;
- using Learun.Cache.Factory;
- using Learun.Util;
- using System;
- using System.Collections.Generic;
-
- namespace Learun.Application.WorkFlow
- {
- /// <summary>
- /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
- /// Copyright (c) 2013-2018 北京泉江科技有限公司
- /// 创建人:陈彬彬
- /// 日 期:2017.04.17
- /// 描 述:工作流实例
- /// </summary>
- public class WfProcessInstanceBLL : WfProcessInstanceIBLL
- {
- private WfProcessInstanceService wfProcessService = new WfProcessInstanceService();
-
- #region 缓存定义
- private ICache cache = CacheFactory.CaChe();
- private string cacheKey = "Learun_adms_wfprocess_";// +实例主键
- #endregion
-
- #region 获取数据
- /// <summary>
- /// 获取流程实例
- /// </summary>
- /// <param name="keyValue">主键</param>
- /// <returns></returns>
- public WfProcessInstanceEntity GetEntity(string keyValue)
- {
- try
- {
- WfProcessInstanceEntity entity = cache.Read<WfProcessInstanceEntity>(cacheKey + keyValue, CacheId.workflow);
- if (entity == null)
- {
- entity = wfProcessService.GetEntity(keyValue);
- cache.Write<WfProcessInstanceEntity>(cacheKey + keyValue, entity, CacheId.workflow);
- }
- return entity;
- }
- catch (Exception ex)
- {
- if (ex is ExceptionEx)
- {
- throw;
- }
- else
- {
- throw ExceptionEx.ThrowBusinessException(ex);
- }
- }
- }
-
- /// <summary>
- /// 获取流程信息列表
- /// </summary>
- /// <param name="pagination">分页参数</param>
- /// <param name="queryJson">查询条件</param>
- /// <returns></returns>
- public IEnumerable<WfProcessInstanceEntity> GetPageList(Pagination pagination, string queryJson)
- {
- try
- {
- return wfProcessService.GetPageList(pagination, queryJson);
- }
- catch (Exception ex)
- {
- if (ex is ExceptionEx)
- {
- throw;
- }
- else
- {
- throw ExceptionEx.ThrowBusinessException(ex);
- }
- }
- }
- /// <summary>
- /// 获取我的流程信息列表
- /// </summary>
- /// <param name="userId">用户主键</param>
- /// <param name="pagination">分页参数</param>
- /// <param name="queryJson">查询条件</param>
- /// <returns></returns>
- public IEnumerable<WfProcessInstanceEntity> GetMyPageList(string userId, Pagination pagination, string queryJson)
- {
- try
- {
- return wfProcessService.GetMyPageList(userId, pagination, queryJson);
- }
- catch (Exception ex)
- {
- if (ex is ExceptionEx)
- {
- throw;
- }
- else
- {
- throw ExceptionEx.ThrowBusinessException(ex);
- }
- }
- }
- /// <summary>
- /// 获取流程实例信息
- /// </summary>
- /// <param name="processId">实例主键</param>
- /// <returns></returns>
- public IEnumerable<WfProcessInstanceEntity> GetListByProcessIds(string processIds)
- {
- try
- {
- return wfProcessService.GetListByProcessIds(processIds);
- }
- catch (Exception ex)
- {
- if (ex is ExceptionEx)
- {
- throw;
- }
- else
- {
- throw ExceptionEx.ThrowServiceException(ex);
- }
- }
- }
- /// <summary>
- /// 获取全部流程实例
- /// </summary>
- /// <param name="processIds"></param>
- /// <returns></returns>
- public IEnumerable<WfProcessInstanceEntity> GetListByAllProcessIds(string processIds)
- {
- try
- {
- return wfProcessService.GetListByAllProcessIds(processIds);
- }
- catch (Exception ex)
- {
- if (ex is ExceptionEx)
- {
- throw;
- }
- else
- {
- throw ExceptionEx.ThrowServiceException(ex);
- }
- }
- }
- #endregion
-
- #region 提交数据
- /// <summary>
- /// 删除流程实例
- /// </summary>
- /// <param name="keyValue"></param>
- public void DeleteEntity(string keyValue)
- {
- try
- {
- cache.Remove(cacheKey + keyValue, CacheId.workflow);
- wfProcessService.DeleteEntity(keyValue);
- }
- catch (Exception ex)
- {
- if (ex is ExceptionEx)
- {
- throw;
- }
- else
- {
- throw ExceptionEx.ThrowBusinessException(ex);
- }
- }
- }
- /// <summary>
- /// 保存流程实例
- /// </summary>
- /// <param name="keyValue">主键</param>
- /// <param name="entity">实体</param>
- public void SaveEntity(string keyValue, WfProcessInstanceEntity entity)
- {
- try
- {
- cache.Remove(cacheKey + keyValue, CacheId.workflow);
- wfProcessService.SaveEntity(keyValue, entity);
- }
- catch (Exception ex)
- {
- if (ex is ExceptionEx)
- {
- throw;
- }
- else
- {
- throw ExceptionEx.ThrowBusinessException(ex);
- }
- }
- }
-
- #endregion
- }
- }
|