Пример #1
0
        public async Task CreatePlan(CreateResumePlanInput input)
        {
            var model = await _repository.FirstOrDefaultAsync(x => x.Id == input.ResumeId);

            if (model == null)
            {
                throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "该数据不存在。");
            }
            CreatePlanInput planInput = new CreatePlanInput();

            planInput.FileList = await _abpFileRelationAppService.GetListAsync(new GetAbpFilesInput()
            {
                BusinessId   = model.Id.ToString(),
                BusinessType = (int)AbpFileBusinessType.人力资源招聘人才库
            });

            planInput.ApplyUser   = model.Name;
            planInput.Phone       = model.Phone;
            planInput.ApplyJob    = model.Position;
            planInput.FlowId      = Guid.Parse("df798037-dc22-4b12-bbb8-71f671659613");
            planInput.FlowTitle   = "招聘流程";
            planInput.ApplyPostId = input.PostId;
            model.Status          = ResumeStatus.未面试;
            _repository.Update(model);
            var plan = await _planAppService.Create(planInput);

            _workFlowWorkTaskAppService.InitWorkFlowInstance(new InitWorkFlowInput()
            {
                FlowId = planInput.FlowId, FlowTitle = planInput.FlowTitle, InStanceId = plan.InStanceId
            });
        }
Пример #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()
            });
        }