コード例 #1
0
ファイル: Format.cs プロジェクト: 348282932/BadoucaiData
        /// <summary>
        /// 解析智联为八斗才格式简历
        /// </summary>
        /// <param name="source"></param>
        /// <returns></returns>
        public static Resume Convert_V0(SourceResume source)
        {
            if (source != null)
            {
                var tag = new Resume
                {
                    Id       = source.BdcId,
                    Name     = source.Name,
                    Gender   = FormatGender(source.Gender, "source-value", "").ToCharArray().First(),
                    Birthday = Convert.ToDateTime(source.Birthday)
                };
                var workYear = Regex.Match(source.WorkStarts, "^[0-9]*").Value;
                tag.WorkStarts         = Convert.ToDateTime(DateTime.Now.Year - Convert.ToInt32(workYear) + "-01-01");
                tag.Cellphone          = string.IsNullOrWhiteSpace(source.Cellphone)?0:Convert.ToInt64(source.Cellphone.ToDBC());
                tag.Email              = source.Email;
                tag.CurrentResidence   = int.Parse(FormatCurrentResidence(source.CurrentResidence, "source-value", "").Replace("0x", ""), System.Globalization.NumberStyles.HexNumber);
                tag.RegisteredResidenc = int.Parse(FormatCurrentResidence(source.RegisteredResidenc, "source-value", "").Replace("0x", ""), System.Globalization.NumberStyles.HexNumber);
                tag.Degree             = FormatDegree(source.Degree, "source-value", "").ToCharArray().First();
                tag.Major              = source.Major;
                tag.MaritalStatus      = FormatMaritalStatus(source.MaritalStatus, "source-value", "").ToCharArray().First();
                tag.JobStatus          = FormatJobStatus(source.JobStatus, "source-value", "").ToCharArray().First();
                tag.UpdateTime         = Convert.ToDateTime(source.UpdateTime);

                tag.Intention          = FormatIntention(source.Intention, "source-value", "");
                tag.Intention.ResumeId = source.BdcId;
                tag.Works      = FormatWorks(source.Works, "source-value", source.BdcId, "");
                tag.Projects   = FormatProjects(source.Projects, source.BdcId);
                tag.Educations = FormatEducations(source.Educations, "source-value", source.BdcId, "");
                tag.Trainings  = FormatTrainings(source.Trainings, source.BdcId);
                tag.Reference  = new Reference {
                    HasContract = true, Id = source.ResumeId, ResumeId = source.BdcId, Tag = "O", Source = "ZHAOPIN", Template = "", UpdateTime = Convert.ToDateTime(source.UpdateTime)
                };
                var mappings = new List <ReferenceMapping> {
                    new ReferenceMapping {
                        Id = source.ResumeId, Key = "ResumeNumber", Value = source.ResumeNumber, Source = "ZHAOPIN"
                    }
                };
                if (!string.IsNullOrWhiteSpace(source.UserMasterExtId))
                {
                    mappings.Add(new ReferenceMapping {
                        Id = source.ResumeId, Key = "UserMasterExtId", Value = source.UserMasterExtId, Source = "ZHAOPIN"
                    });
                }
                if (!string.IsNullOrWhiteSpace(source.UserMasterId))
                {
                    mappings.Add(new ReferenceMapping {
                        Id = source.ResumeId, Key = "UserMasterId", Value = source.UserMasterId, Source = "ZHAOPIN"
                    });
                }
                tag.Reference.Mapping = mappings;

                return(tag);
            }

            return(null);
        }
コード例 #2
0
        /// <summary>
        /// 智联搜索——网聘5.0
        /// </summary>
        /// <param name="document"></param>
        /// <returns></returns>
        public static SourceResume ConvertTo_Dtl_V0(HtmlDocument document)
        {
            var dto = new SourceResume();

            dto.ResumeNumber = document.DocumentNode.SelectSingleNode("//input[@id='extId']")?.Attributes["value"]?.Value;
            dto.ResumeId     = document.DocumentNode.SelectSingleNode("//input[@id='resume_id']")?.Attributes["value"]?.Value;
            dto.UserMasterId = document.DocumentNode.SelectSingleNode("//input[@id='resumeUserId']")?.Attributes["value"]?.Value;
            dto.Height       = "";
            //if (string.IsNullOrWhiteSpace(dto.Id))
            //return null;
            dto.Name                 = document.DocumentNode.SelectSingleNode("//input[@id='tt_username']")?.Attributes["value"]?.Value;
            dto.Gender               = DeserializeGender(document);
            dto.MaritalStatus        = DeserializeMaritalStatus(document);
            dto.Cellphone            = DeserializeCellphone(document);
            dto.Email                = DeserializeEmail(document);
            dto.Birthday             = DeserializeBirthday(document);
            dto.CurrentResidence     = DeserializePresentLocus(document);
            dto.RegisteredResidenc   = DeserializeRegisteredAddress(document);
            dto.UpdateTime           = document.DocumentNode.SelectSingleNode("//strong[@id='resumeUpdateTime']")?.InnerText;
            dto.WorkStarts           = DeserializeServiceYear(document);
            dto.Degree               = DeserializeEducationalBackground(document);
            dto.JobStatus            = DeserializePresentStatus(document);
            dto.Intention            = new ResumeIntention();
            dto.Intention.JobType    = DeserializeExpectedNature(document);
            dto.Intention.Salary     = DeserializeExpectedSalary(document);
            dto.Intention.Industry   = DeserializeExpectedIndustry(document);
            dto.Intention.Function   = DeserializeExpectedPosition(document);
            dto.Intention.Location   = DeserializeExpectedLocus(document);
            dto.Intention.Evaluation = DeserializeSelfAssessment(document);
            dto.Intention.DutyTime   = "";
            dto.Works                = DeserializeWorkingExperiences(document);
            dto.Projects             = DeserializeProjectExperiences(document);
            dto.Educations           = DeserializeEducationExperiences(document);

            if (dto.Educations != null && dto.Educations.Count > 0)
            {
                dto.Major = dto.Educations[0].Major;
            }
            else
            {
                dto.Major = "";
            }
            dto.Trainings    = DeserializeTrainingExperiences(document);
            dto.Skills       = DeserializeSkill(document);
            dto.Certificates = DeserializeCert(document);
            dto.Honors       = DeserializeHonor(document);
            dto.Practices    = DeserializePractice(document);
            dto.Others       = DeserializeOther(document);

            return(dto);
        }
コード例 #3
0
ファイル: Format.cs プロジェクト: 348282932/BadoucaiData
        /// <summary>
        /// 解析前程为八斗才格式
        /// </summary>
        /// <param name="source"></param>
        /// <returns></returns>
        public static Resume Convert_V1(SourceResume source)
        {
            if (source != null)
            {
                var tag = new Resume();
                tag.Id                 = source.BdcId;
                tag.Name               = source.Name;
                tag.Gender             = FormatGender(source.Gender, "source-value", "51").ToCharArray().First();
                tag.Birthday           = Convert.ToDateTime(source.Birthday);
                tag.Cellphone          = Convert.ToInt64(source.Cellphone);
                tag.Email              = source.Email;
                tag.CurrentResidence   = int.Parse(FormatCurrentResidence(source.CurrentResidence, "source-value", "51").Replace("0x", ""), System.Globalization.NumberStyles.HexNumber);
                tag.RegisteredResidenc = int.Parse(FormatCurrentResidence(source.RegisteredResidenc, "source-key", "51").Replace("0x", ""), System.Globalization.NumberStyles.HexNumber);
                tag.Degree             = FormatDegree(source.Degree, "source-value", "51").ToCharArray().First();
                tag.Major              = source.Major;
                tag.MaritalStatus      = FormatMaritalStatus(source.MaritalStatus, "source-value", "51").ToCharArray().First();
                tag.JobStatus          = FormatJobStatus(source.JobStatus, "source-value", "51").ToCharArray().First();
                tag.UpdateTime         = Convert.ToDateTime(source.UpdateTime);

                tag.Intention          = FormatIntention(source.Intention, "source-value", "51");
                tag.Intention.ResumeId = source.BdcId;
                tag.Works      = FormatWorks(source.Works, "source-value", source.BdcId, "51");
                tag.Projects   = FormatProjects(source.Projects, source.BdcId);
                tag.Educations = FormatEducations(source.Educations, "source-value", source.BdcId, "51");
                tag.Trainings  = FormatTrainings(source.Trainings, source.BdcId);
                tag.Reference  = new Reference {
                    HasContract = true, Id = source.ResumeId, ResumeId = source.BdcId, Tag = "O", Source = "51JOB", Template = "JSON.2017.1", UpdateTime = Convert.ToDateTime(source.UpdateTime)
                };
                if (tag.Works != null && tag.Works.Count > 0)
                {
                    tag.WorkStarts = tag.Works.Min(a => a.Begin);
                }
                else
                {
                    tag.WorkStarts = DateTime.Now;
                }

                return(tag);
            }

            return(null);
        }
コード例 #4
0
ファイル: Format.cs プロジェクト: 348282932/BadoucaiData
        public static SourceResume ConvertTo_Dtl_V5(string content)
        {
            var dto    = new SourceResume();
            var source = JsonConvert.DeserializeObject <dynamic>(content);

            dto.Id = source.resumeNo;
            var Dtl = JsonConvert.DeserializeObject <dynamic>(source.detialJSonStr.ToString());

            if (source.userDetials != null)
            {
                dto.Name               = source.userDetials.userName;
                dto.Gender             = source.userDetials.gender;
                dto.MaritalStatus      = source.userDetials.maritalStatus;
                dto.Cellphone          = source.userDetials.mobilePhone;
                dto.Email              = source.userDetials.email;
                dto.Birthday           = source.userDetials.birthStr;
                dto.CurrentResidence   = source.userDetials.cityId;
                dto.RegisteredResidenc = source.userDetials.hUKOUCityId;
            }
            else
            {
                dto.Name          = Dtl.UserMasterName;
                dto.Gender        = Dtl.Gender;
                dto.MaritalStatus = Dtl.MaritalStatus;
                dto.Birthday      = Dtl.BirthYear;
            }
            dto.ResumeId        = Dtl.ResumeId;
            dto.ResumeName      = Dtl.Name;
            dto.UserMasterId    = Dtl.UserMasterId;
            dto.UserMasterExtId = Dtl.UserMasterExtId;
            dto.ResumeNumber    = Dtl.ResumeNumber;
            dto.WorkStarts      = Dtl.WorkYearsRangeId;
            dto.Degree          = Dtl.CurrentEducationLevel;

            dto.JobStatus = Dtl.DesiredPosition[0].CurrentCareerStatus;
            dto.Intention = new ResumeIntention();
            if (Dtl.DesiredPosition != null && Dtl.DesiredPosition.Count > 0)
            {
                dto.Intention.JobType  = Dtl.DesiredPosition[0].DesiredEmploymentType;
                dto.Intention.Salary   = Dtl.DesiredPosition[0].DesiredSalaryScope;
                dto.Intention.Industry = Dtl.DesiredPosition[0].DesiredIndustry;
                dto.Intention.Function = Dtl.DesiredPosition[0].DesiredJobType;
                dto.Intention.Location = Dtl.DesiredPosition[0].DesiredCity;
            }
            else
            {
                dto.Intention.JobType  = "默认";
                dto.Intention.Salary   = "面议";
                dto.Intention.Industry = "默认";
                dto.Intention.Function = "中国";
                dto.Intention.Location = "中国";
            }

            if (Dtl.SelfEvaluate != null && Dtl.SelfEvaluate.Count > 0)
            {
                dto.Intention.Evaluation = Dtl.SelfEvaluate[0]?.CommentContent;
            }
            else
            {
                dto.Intention.Evaluation = "";
            }

            #region 工作经验

            if (Dtl.WorkExperience != null && Dtl.WorkExperience.Count > 0)
            {
                dto.Works = new List <ResumeWork>();
                foreach (var o in Dtl.WorkExperience)
                {
                    var work = new ResumeWork();
                    work.Begin       = o.DateStart;
                    work.End         = o.DateEnd;
                    work.Company     = o.CompanyName;
                    work.Industry    = o.CompanyIndustry;
                    work.Size        = o.CompanySize;
                    work.Nature      = o.CompanyProperty;
                    work.Department  = o.ResideDepartment;
                    work.Position    = o.JobTitle;
                    work.Description = o.WorkDescription;
                    dto.Works.Add(work);
                }
            }

            #endregion

            #region 项目经验

            if (Dtl.ProjectExperience != null && Dtl.ProjectExperience.Count > 0)
            {
                dto.Projects = new List <ResumeProject>();
                foreach (var o in Dtl.ProjectExperience)
                {
                    var project = new ResumeProject();
                    project.Begin       = o.DateStart;
                    project.End         = o.DateEnd;
                    project.Company     = "";
                    project.Name        = o.ProjectName;
                    project.Description = o.ProjectDescription;
                    project.Duty        = o.ProjectResponsibility;
                    dto.Projects.Add(project);
                }
            }

            #endregion

            #region 教育经历

            if (Dtl.EducationExperience != null && Dtl.EducationExperience.Count > 0)
            {
                dto.Educations = new List <ResumeEducation>();
                foreach (var o in Dtl.EducationExperience)
                {
                    var edu = new ResumeEducation();
                    edu.Begin       = o.DateStart;
                    edu.End         = o.DateEnd;
                    edu.School      = o.SchoolName;
                    edu.Degree      = o.EducationLevel;
                    edu.Description = "";
                    edu.Major       = o.MajorName;
                    dto.Educations.Add(edu);
                }
            }

            #endregion

            #region 培训经历

            if (Dtl.Training != null && Dtl.Training.Count > 0)
            {
                dto.Trainings = new List <ResumeTraining>();
                foreach (var o in Dtl.Training)
                {
                    var train = new ResumeTraining();
                    train.Begin       = o.DateStart;
                    train.End         = o.DateEnd;
                    train.Course      = o.Course;
                    train.Institution = o.Institution;
                    train.Description = o.TrainingDescription;
                    train.Location    = o.Location;
                    dto.Trainings.Add(train);
                }
            }

            #endregion

            #region 技能/语言
            if (Dtl.ProfessionnalSkill != null && Dtl.ProfessionnalSkill.Count > 0)
            {
                dto.Skills = new List <ResumeSkill>();
                foreach (var o in Dtl.ProfessionnalSkill)
                {
                    var skill = new ResumeSkill {
                        Name = o.SkillName, Level = o.MasterDegree.ToString() + "|" + o.UsedMonths.ToString() + "个月", Description = ""
                    };
                    dto.Skills.Add(skill);
                }
            }
            if (Dtl.LanguageSkill != null && Dtl.LanguageSkill.Count > 0)
            {
                if (dto.Skills == null)
                {
                    dto.Skills = new List <ResumeSkill>();
                }
                foreach (var o in Dtl.LanguageSkill)
                {
                    var skill = new ResumeSkill {
                        Name = o.LanguageName, Level = "听说" + o.HearSpeakSkill.ToString() + "|读写" + o.ReadWriteSkill.ToString(), Description = ""
                    };
                    dto.Skills.Add(skill);
                }
            }
            #endregion

            #region 证书

            if (Dtl.AchieveCertificate != null && Dtl.AchieveCertificate.Count > 0)
            {
                dto.Certificates = new List <ResumeCertificate>();
                foreach (var o in Dtl.AchieveCertificate)
                {
                    try
                    {
                        var cert = new ResumeCertificate {
                            Time = Convert.ToDateTime(o.AchieveDate), CertName = o.CertificateName, Description = o.CertificateDescription
                        };

                        dto.Certificates.Add(cert);
                    }
                    catch
                    {
                        // ignored
                    }
                }
            }
            #endregion

            #region 校内荣誉
            if (Dtl.AchieveAward != null && Dtl.AchieveAward.Count > 0)
            {
                dto.Honors = new List <SchoolHonor>();
                foreach (var o in Dtl.AchieveAward)
                {
                    try
                    {
                        var cert = new SchoolHonor {
                            Time = o.AchieveDate, Honor = o.AwardName, Description = o.Description
                        };

                        dto.Honors.Add(cert);
                    }
                    catch
                    {
                        // ignored
                    }
                }
            }
            #endregion

            #region 校内实践

            if (Dtl.PracticeExperience != null && Dtl.PracticeExperience.Count > 0)
            {
                dto.Practices = new List <SchoolPractice>();
                foreach (var o in Dtl.PracticeExperience)
                {
                    try
                    {
                        var cert = new SchoolPractice {
                            Name = o.PracticeName, Begin = o.DateStart, End = o.DateEnd, Description = o.PracticeDescription
                        };

                        dto.Practices.Add(cert);
                    }
                    catch
                    {
                        // ignored
                    }
                }
            }
            #endregion

            #region 其他

            if (Dtl.Other != null && Dtl.Other.Count > 0)
            {
                dto.Others = new List <OtherInfo>();
                foreach (var o in Dtl.Other)
                {
                    try
                    {
                        var cert = new OtherInfo {
                            Title = o.Name, Description = o.Description
                        };

                        dto.Others.Add(cert);
                    }
                    catch
                    {
                        // ignored
                    }
                }
            }
            #endregion
            return(dto);
        }
コード例 #5
0
ファイル: Format.cs プロジェクト: 348282932/BadoucaiData
        /// <summary>
        /// 解析为前程格式Json对象
        /// </summary>
        /// <param name="source"></param>
        /// <returns></returns>
        public static dynamic ConvertToZhaopin(SourceResume source)
        {
            return(new
            {
                Flag = -1,
                detialJSonStr = new
                {
                    ResumeId = Convert.ToInt32(source.ResumeId),
                    UserMasterId = Convert.ToInt32(source.UserMasterId),
                    WorkYearsRangeId = Convert.ToInt32(Regex.Match(source.WorkStarts, "(\\d+)").ResultOrDefault("$1", "0")),
                    DesiredSalaryScope = source.Intention.Salary.Contains("不显示") || string.IsNullOrWhiteSpace(source.Intention.Salary) ? 0 : Convert.ToInt64(source.Intention.Salary.Replace("-", "").Replace("元/月", "").Replace("以下", "").Replace("以上", "")),
                    UserMasterName = source.Name,
                    source.Gender,
                    source.MaritalStatus,
                    BirthYear = source.Birthday,
                    //Name = source.ResumeName,
                    source.UserMasterExtId,
                    source.ResumeNumber,
                    CurrentEducationLevel = source.Degree,
                    DateLastReleased = new DateTime(1970, 1, 1),
                    DateLastViewed = new DateTime(1970, 1, 1),
                    DateModified = new DateTime(1970, 1, 1),
                    DateCreated = new DateTime(1970, 1, 1),
                    DesiredPosition = new[]
                    {
                        new
                        {
                            DesiredEmploymentType = source.Intention.JobType,
                            DesiredSalaryScope = source.Intention.Salary,
                            DesiredIndustry = source.Intention.Industry,
                            DesiredJobType = source.Intention.Function,
                            DesiredCity = source.Intention.Location
                        }
                    },
                    WorkExperience = source.Works?.Select(s => new
                    {
                        DateStart = s.Begin,
                        DateEnd = s.End,
                        CompanyName = s.Company,
                        CompanyIndustry = s.Industry,
                        CompanySize = s.Size,
                        CompanyProperty = s.Nature,
                        ResideDepartment = s.Department,
                        JobTitle = s.Position,
                        WorkDescription = s.Description
                    }),
                    ProjectExperience = source.Projects?.Select(s => new
                    {
                        DateStart = s.Begin,
                        DateEnd = s.End,
                        ProjectName = s.Name,
                        ProjectDescription = s.Description,
                        ProjectResponsibility = s.Duty
                    }),
                    EducationExperience = source.Educations?.Select(s => new
                    {
                        DateStart = s.Begin,
                        DateEnd = s.End,
                        SchoolName = s.School,
                        EducationLevel = s.Degree,
                        MajorName = s.Major
                    }),
                    Training = source.Trainings?.Select(s => new
                    {
                        DateStart = s.Begin,
                        DateEnd = s.End,
                        s.Course,
                        s.Institution,
                        TrainingDescription = s.Description,
                        s.Location
                    }),
                    ProfessionnalSkill = source.Skills?.Where(w => !w.Level.Contains("听说") && !w.Level.Contains("读写")).Select(s => new
                    {
                        SkillName = s.Name,
                        MasterDegree = s.Level.Split("|")[0].Trim(),
                        UsedMonths = s.Level.Split("|")[1].Replace("个月", "").Trim()
                    }),
                    LanguageSkill = source.Skills?.Where(w => w.Level.Contains("听说") || w.Level.Contains("读写")).Select(s => new
                    {
                        LanguageName = s.Name,
                        HearSpeakSkill = s.Level.Contains("听说") ? (s.Level.Split("|").Length > 1 ? s.Level.Split("|")[1].LanguageSkillReplace("听说能力", "一般").Trim() : s.Level.Split("|")[0].LanguageSkillReplace("听说能力", "一般").Trim()) : "",
                        ReadWriteSkill = s.Level.Contains("读写") ? s.Level.Split("|")[0].LanguageSkillReplace("读写能力", "一般").Trim() : ""
                    }),
                    AchieveCertificate = source.Certificates?.Select(s => new
                    {
                        AchieveDate = s.Time.ToString("yyyy-MM-dd HH:mm:ss"),
                        CertificateName = s.CertName,
                        CertificateDescription = s.Description
                    }),
                    AchieveAward = source.Honors?.Select(s => new
                    {
                        AchieveDate = s.Time,
                        AwardName = s.Honor,
                        s.Description
                    }),
                    PracticeExperience = source.Practices?.Select(s => new
                    {
                        PracticeName = s.Name,
                        DateStart = s.Begin,
                        DateEnd = s.End,
                        PracticeDescription = s.Description
                    }),
                    Other = source.Others?.Select(s => new
                    {
                        Name = s.Title,
                        s.Description
                    })
                },

                resumeId = source.ResumeId,
                resumeNo = source.ResumeNumber,

                userDetials = new
                {
                    userName = source.Name,
                    gender = source.Gender,
                    maritalStatus = source.MaritalStatus,
                    mobilePhone = source.Cellphone,
                    email = source.Email,
                    birthStr = source.Birthday,
                    cityId = source.CurrentResidence,
                    hUKOUCityId = source.RegisteredResidenc,
                    userMasterId = source.UserMasterId
                }
            });
        }