示例#1
0
        public IActionResult AssignHandler(Guid processId, string userName)
        {
            //查找用户
            var query = new QueryExpression("systemuser", CurrentUser.UserSettings.LanguageId);

            query.ColumnSet.AddColumns("systemuserid", "name");
            query.Criteria.FilterOperator = LogicalOperator.Or;
            query.Criteria.AddCondition("loginname", ConditionOperator.Equal, userName);
            query.Criteria.AddCondition("usernumber", ConditionOperator.Equal, userName);
            var user = _dataFinder.Retrieve(query);

            if (user == null || user.Count == 0)
            {
                return(JError(T["workflow_nomatchuser"]));
            }
            Guid handlerId = user.GetIdValue();
            //当前步骤
            var processInfo = _workFlowProcessFinder.FindById(processId);

            if (processInfo == null)
            {
                return(NotFound());
            }
            if (handlerId == CurrentUser.SystemUserId)
            {
                return(JError(T["workflow_notallowtome"]));
            }
            var instance = _workFlowInstanceService.FindById(processInfo.WorkFlowInstanceId);

            if (handlerId == instance.ApplicantId)
            {
                return(JError(T["workflow_notallowtoapplier"]));
            }
            //验证是否有移交权限
            //...
            var log = new WorkFlowProcessLog();

            log.CreatedOn            = DateTime.Now;
            log.OperatorId           = CurrentUser.SystemUserId;
            log.Title                = T["workflow_assignto"];
            log.WorkFlowProcessId    = Guid.Empty;
            log.WorkFlowProcessLogId = Guid.NewGuid();
            log.WorkFlowInstanceId   = Guid.Empty;
            _workFlowProcessLogService.Create(log);
            return(JOk(T["operation_success"]));
        }
 public bool Update(WorkFlowProcessLog entity)
 {
     return(_workFlowProcessLogRepository.Update(entity));
 }