Exemplo n.º 1
0
        public async Task <InitWorkFlowOutput> Create(OAWorkonInputDto input)
        {
            var service      = AbpBootstrapper.Create <Abp.Modules.AbpModule>().IocManager.IocContainer.Resolve <IWorkFlowOrganizationUnitsAppService>();
            var userOrgModel = await service.GetUserPostInfo(new NullableIdDto <long>() { Id = AbpSession.UserId.Value, }, new NullableIdDto <long>() { Id = null });

            var model = input.MapTo <OAWorkon>();

            model.Status  = 0;
            model.OrgId   = userOrgModel.OrgId;
            model.PostIds = string.Join(",", userOrgModel.UserPosts.Select(r => r.PostId));
            var ret = _oaWorkonRepository.Insert(model);

            return(new InitWorkFlowOutput()
            {
                InStanceId = ret.Id.ToString()
            });
        }
Exemplo n.º 2
0
        public async Task Update(OAWorkonInputDto input)
        {
            var service      = AbpBootstrapper.Create <Abp.Modules.AbpModule>().IocManager.IocContainer.Resolve <IWorkFlowOrganizationUnitsAppService>();
            var userOrgModel = await service.GetUserPostInfo(new NullableIdDto <long>() { Id = AbpSession.UserId.Value, }, new NullableIdDto <long>() { Id = null });

            var ret       = _oaWorkonRepository.Get(input.Id.Value);
            var old_Model = ret.DeepClone();

            ret         = input.MapTo(ret);
            ret.OrgId   = userOrgModel.OrgId;
            ret.PostIds = string.Join(",", userOrgModel.UserPosts.Select(r => r.PostId));
            _oaWorkonRepository.Update(ret);
            if (input.IsUpdateForChange)
            {
                var flowModel = _workFlowCacheManager.GetWorkFlowModelFromCache(input.FlowId);
                if (flowModel == null)
                {
                    throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "流程不存在");
                }
                var logs = GetChangeModel(old_Model).GetColumnAllLogs(GetChangeModel(ret));
                await _projectAuditManager.InsertAsync(logs, input.Id.ToString(), flowModel.TitleField.Table);
            }
        }