/// <summary> /// 过滤恢武成都简历 /// </summary> private void FilterChengDuResumes() { var sb = new StringBuilder(); sb.AppendLine("姓名\t手机\t邮箱\t年龄\t学历\t更新日期\t性别\t平台\t地点"); var cellphones = File.ReadAllLines(@"D:\给过的手机号.txt"); var educationDic = new Dictionary <int, string> { { 0, "无学历" }, { 1, "初中" }, { 2, "中技" }, { 3, "高中" }, { 4, "中专" }, { 5, "大专" } }; using (var db = new BadoucaiDBEntities()) { var resumes = db.SpiderResumeDownload.Where(w => w.Weight == 4 && w.Cellphone > 0).ToList(); var index = 0; var count = 0; foreach (var resume in resumes) { ++index; if (cellphones.Contains(resume.Cellphone.ToString())) { continue; } var resumeJson = JsonConvert.DeserializeObject <dynamic>(File.ReadAllText("Y:" + resume.SavePath.Replace("/", "\\"))); var age = (int)resumeJson.userDetials.birthYear; var gender = (int)resumeJson.userDetials.gender; var currentEducationLevel = resumeJson.detialJSonStr.MaxEducationLevel != null ? (int)resumeJson.detialJSonStr.MaxEducationLevel : (int)resumeJson.detialJSonStr.CurrentEducationLevel; if (age < 18 || age > 26 || gender != 1 || currentEducationLevel > 5) { continue; } sb.AppendLine($"{(string)resumeJson.userDetials.userName}\t{resume.Cellphone}\t{resume.Email}\t{age}\t{educationDic[currentEducationLevel]}\t{resume.UpdateTime}\t男\t智联\t成都"); this.AsyncSetLog(this.tbx_Log, $"{index}/{resumes.Count} 成功:{++count}"); } File.WriteAllText(@"D:\成都(恢武).txt", sb.ToString()); this.AsyncSetLog(this.tbx_Log, "完成"); } }
public void MatchOldResumeLibrary() { //var count = 0; var queue = new ConcurrentQueue <IEnumerable <dynamic> >(); for (var i = 0; i < 8; i++) { Task.Run(() => { while (true) { IEnumerable <dynamic> list; if (!queue.TryDequeue(out list)) { continue; } var matchedResult = SearchOldLibrary(list); if (matchedResult.Any()) { Interlocked.Add(ref count, matchedResult.Count); if (PostResumes(matchedResult)) { Console.WriteLine($"已匹配成功 {count} 份简历!待匹配队列剩余:{queue.Count},待上传OSS队列剩余:{uploadOssActionBlock.InputCount}"); } } } }); } while (true) { using (var db = new BadoucaiDBEntities()) { if (queue.Count < 32) { var list = db.SpiderResumeDownload.Where(w => w.Status != 99 && w.Cellphone == null).Take(1000).ToList(); if (!list.Any()) { break; } foreach (var item in list) { item.Status = 99; } db.TransactionSaveChanges(); queue.Enqueue(list.Select(s => new { s.ResumeNumber, s.SavePath })); Console.WriteLine($"已匹配成功 {count} 份简历!待匹配队列剩余:{queue.Count},待上传OSS队列剩余:{uploadOssActionBlock.InputCount}"); } } } }