Example #1
0
        /// <inheritdoc />
        public override IList <IUserInfo> Execute(ICommandContext commandContext)
        {
            IUserServiceProxy proxy = ProcessEngineServiceProvider.Resolve <IUserServiceProxy>();

            string id = Condition.QueryCondition.FirstOrDefault().Id;

            string[] users      = null;
            var      hisService = commandContext.ProcessEngineConfiguration.HistoryService;

            if (string.IsNullOrWhiteSpace(id))
            {
                var uid = hisService.CreateHistoricProcessInstanceQuery()
                          .SetProcessInstanceId(this.Execution.ProcessInstanceId)
                          .SingleResult().StartUserId;
                users = new string[] { uid };
            }
            else
            {
                users = hisService.CreateHistoricTaskInstanceQuery()
                        .SetProcessInstanceId(this.Execution.ProcessInstanceId)
                        .SetTaskDefinitionKey(id)
                        .List()
                        .Select(x => x.Assignee)
                        .ToArray();
            }

            return(proxy.GetUsers(externalConnector.GetUserByDirectReporter, new RequestUserParameter
            {
                IdList = users,
                Category = RequestUserCategory.GETUSER_DIRECTREPOT
            }).ConfigureAwait(false).GetAwaiter().GetResult());
        }
        /// <inheritdoc />
        public override IList <IUserInfo> Execute(ICommandContext commandContext)
        {
            IUserServiceProxy proxy = ProcessEngineServiceProvider.Resolve <IUserServiceProxy>();

            return(AsyncHelper.RunSync(() => proxy.GetUsers(externalConnector.GetUserByDeptLeader, new
            {
                idList = Condition.QueryCondition.Select(x => x.Id).ToArray()
            })));
        }
Example #3
0
        /// <inheritdoc />
        public override IList <IUserInfo> Execute(ICommandContext commandContext)
        {
            IUserServiceProxy proxy = ProcessEngineServiceProvider.Resolve <IUserServiceProxy>();

            return(proxy.GetUsers(externalConnector.GetUserByDuty, new RequestUserParameter
            {
                IdList = Condition.QueryCondition.Select(x => x.Id).ToArray(),
                Category = RequestUserCategory.GETUSERS_DUTY
            }).ConfigureAwait(false).GetAwaiter().GetResult());
        }
        /// <inheritdoc />
        public override IList <IUserInfo> Execute(ICommandContext commandContext)
        {
            IList <IHistoricTaskInstance> hisTasks = commandContext.ProcessEngineConfiguration.HistoryService
                                                     .CreateHistoricTaskInstanceQuery()
                                                     .SetExecutionId(this.Execution.Id)
                                                     .List();

            IList <IUserInfo> users = hisTasks.Where(x => Condition.QueryCondition.Any(y => y.Id == x.TaskDefinitionKey))
                                      .Select(x => new UserInfo
            {
                Id = x.Assignee
            })
                                      .ToList <IUserInfo>();

            if (Condition.QueryCondition.Any(x => string.Equals("", x.Id)))
            {
                var hisInst = commandContext.ProcessEngineConfiguration.HistoryService
                              .CreateHistoricProcessInstanceQuery()
                              .SetProcessInstanceId(this.Execution.ProcessInstanceId)
                              .SingleResult();

                string uid = hisInst == null ? this.Execution.Parent.StartUserId : hisInst.StartUserId;
                users.Add(new UserInfo
                {
                    Id = uid
                });
            }

            IUserServiceProxy proxy = ProcessEngineServiceProvider.Resolve <IUserServiceProxy>();

            return(proxy.GetUsers(externalConnector.GetUser, new RequestUserParameter
            {
                IdList = users.Select(x => x.Id).ToArray(),
                Category = RequestUserCategory.GETUSER_EXECUTOR
            }).ConfigureAwait(false).GetAwaiter().GetResult());
        }