public async Task <InitWorkFlowOutput> Create(CreateEmployeeResignInput input) { var model = new EmployeeResign(); var has = _employeeResignRepository.FirstOrDefault(ite => ite.UserId == AbpSession.UserId.Value && ite.Status > 0); if (has != null) { throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "有未完成的离职申请,请等待处理完成后再创建新申请。"); } 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 }); model.Type = input.Type; model.Status = 0; model.Reason = input.Reason; model.UserId = AbpSession.UserId.Value; model.OrgId = userOrgModel.OrgId; model.PostIds = string.Join(",", userOrgModel.UserPosts.Select(r => r.PostId)); _employeeResignRepository.Insert(model); return(new InitWorkFlowOutput() { InStanceId = model.Id.ToString() }); }
private UpdateEmployeeResignLogDto GetChangeModel(EmployeeResign model) { /// 如果有外键数据 在这里转换 var ret = model.MapTo <UpdateEmployeeResignLogDto>(); ret.Type = model.Type.ToString(); return(ret); }