Beispiel #1
0
        private EmployeePlanEditInput GetChangeModel(EmployeePlan model)
        {
            // 如果有外键数据 在这里转换
            var ret = model.MapTo <EmployeePlanEditInput>();
            var doc = _repository.Get(ret.Id);

            if (string.IsNullOrWhiteSpace(ret.AdminUserId) == false)
            {
                ret.AdminUserId_Name = _workFlowOrganizationUnitsManager.GetNames(ret.AdminUserId);
            }
            if (string.IsNullOrWhiteSpace(ret.EmployeeUserIds) == false)
            {
                ret.EmployeeUserIds_Name = _workFlowOrganizationUnitsManager.GetNames(ret.EmployeeUserIds);
            }
            if (string.IsNullOrWhiteSpace(ret.MergeUserId) == false)
            {
                ret.MergeUserId_Name = _workFlowOrganizationUnitsManager.GetNames(ret.MergeUserId);
            }
            if (string.IsNullOrWhiteSpace(ret.RecordUserId) == false)
            {
                ret.RecordUserId_Name = _workFlowOrganizationUnitsManager.GetNames(ret.RecordUserId);
            }
            if (string.IsNullOrWhiteSpace(ret.VerifyUserId) == false)
            {
                ret.VerifyUserId_Name = _workFlowOrganizationUnitsManager.GetNames(ret.VerifyUserId);
            }
            return(ret);
        }
Beispiel #2
0
        public async Task <InitWorkFlowOutput> Create(CreatePlanInput input)
        {
            EmployeePlan model = null;

            model = input.MapTo <EmployeePlan>();
            var has = _repository.GetAll().FirstOrDefault(ite => ite.Phone == input.Phone.Trim() && ite.Status >= 0);

            if (has != null)
            {
                throw new Abp.UI.UserFriendlyException((int)ErrorCode.CodeValErr, "当前人员已存在面试计划,电话号码重复。");
            }
            model.ApplyNo = "ZP" + DateTime.Now.ToString("yyyyMMddHHmmss");
            if (model.ApplyPostId.HasValue == false)
            {
                throw new Abp.UI.UserFriendlyException((int)ErrorCode.CodeValErr, "应聘职位不能为空。");
            }
            await _repository.InsertAsync(model);

            if (input.FileList != null)
            {
                var fileList = new List <AbpFileListInput>();
                foreach (var item in input.FileList)
                {
                    fileList.Add(new AbpFileListInput()
                    {
                        Id = item.Id, Sort = item.Sort
                    });
                }
                await _abpFileRelationAppService.CreateAsync(new CreateFileRelationsInput()
                {
                    BusinessId   = model.Id.ToString(),
                    BusinessType = (int)AbpFileBusinessType.人力资源面试者简历,
                    Files        = fileList
                });
            }
            return(new InitWorkFlowOutput()
            {
                InStanceId = model.Id.ToString()
            });
        }