/// <summary> /// 获取区域编码 /// </summary> /// <param name="city">区域(中文)</param> /// <param name="source">类型(0:【智联】1:【前程】2:【猎聘】)3:【BOSS】</param> /// <returns></returns> public static string Get(JobSource source, string city = "深圳") { var cityCode = city = city?.Trim() ?? ""; if (!_cityCodeDictionary.Any()) { InitialData(); } if (_cityCodeDictionary.Keys.Contains(city)) { switch (source) { case JobSource.智联招聘: cityCode = _cityCodeDictionary[city][0]; break; case JobSource.前程无忧: cityCode = _cityCodeDictionary[city][1]; break; case JobSource.猎聘招聘: cityCode = _cityCodeDictionary[city][2]; break; case JobSource.Boss招聘: cityCode = _cityCodeDictionary[city][3]; break; case JobSource.拉钩招聘: break; } } return(cityCode); }
public static string GetCityCode(JobSource source, string city) { if (codes.Count <= 0) { codes.Add("北京", new string[] { "北京", "010000", "010", "101010100" }); codes.Add("上海", new string[] { "上海", "020000", "020", "101020100" }); codes.Add("深圳", new string[] { "深圳", "040000", "050090", "101280600" }); codes.Add("广州", new string[] { "广州", "030200", "050020", "101280100" }); codes.Add("杭州", new string[] { "杭州", "080200", "070020", "101210100" }); codes.Add("成都", new string[] { "成都", "090200", "280020", "101270100" }); codes.Add("南京", new string[] { "南京", "070200", "060020", "101190100" }); codes.Add("武汉", new string[] { "武汉", "180200", "170020", "101200100" }); codes.Add("西安", new string[] { "西安", "200200", "270020", "101110100" }); codes.Add("厦门", new string[] { "厦门", "110300", "090040", "101230200" }); codes.Add("长沙", new string[] { "长沙", "190200", "180020", "101250100" }); codes.Add("苏州", new string[] { "苏州", "070300", "060080", "101190400" }); codes.Add("天津", new string[] { "天津", "050000", "030", "101030100" }); codes.Add("重庆", new string[] { "重庆", "060000", "040", "101040100" }); codes.Add("郑州", new string[] { "郑州", "170200", "150020", "101180100" }); codes.Add("青岛", new string[] { "青岛", "120300", "250070", "101120200" }); codes.Add("合肥", new string[] { "合肥", "150200", "080020", "101220100" }); codes.Add("福州", new string[] { "福州", "110200", "090020", "101230100" }); codes.Add("济南", new string[] { "济南", "120200", "250020", "101120100" }); codes.Add("大连", new string[] { "大连", "230300", "210040", "101070200" }); codes.Add("珠海", new string[] { "珠海", "030500", "050140", "101280700" }); codes.Add("无锡", new string[] { "无锡", "070400", "060100", "101190200" }); codes.Add("佛山", new string[] { "佛山", "030600", "050050", "101280800" }); codes.Add("东莞", new string[] { "东莞", "030800", "050040", "101281600" }); codes.Add("宁波", new string[] { "宁波", "080300", "070030", "101210400" }); codes.Add("常州", new string[] { "常州", "070500", "060040", "101191100" }); codes.Add("沈阳", new string[] { "沈阳", "230200", "210020", "101070100" }); codes.Add("石家庄", new string[] { "石家庄", "160200", "140020", "101090100" }); codes.Add("昆明", new string[] { "昆明", "250200", "310020", "101290100" }); codes.Add("南昌", new string[] { "南昌", "130200", "200020", "101240100" }); codes.Add("南宁", new string[] { "南宁", "140200", "110020", "101300100" }); codes.Add("哈尔滨", new string[] { "哈尔滨", "220200", "160020", "101050100" }); codes.Add("海口", new string[] { "海口", "100200", "130020", "101310100" }); codes.Add("中山", new string[] { "中山", "030700", "050130", "101281700" }); codes.Add("惠州", new string[] { "惠州", "030300", "050060", "101280300" }); codes.Add("贵阳", new string[] { "贵阳", "260200", "120020", "101260100" }); codes.Add("长春", new string[] { "长春", "240200", "190020", "101060100" }); codes.Add("太原", new string[] { "太原", "210200", "260020", "101100100" }); codes.Add("嘉兴", new string[] { "嘉兴", "080700", "070090", "101210300" }); codes.Add("泰安", new string[] { "泰安", "121100", "250090", "101120800" }); codes.Add("昆山", new string[] { "昆山", "070600", "060050", "101191400" }); codes.Add("烟台", new string[] { "烟台", "120400", "250120", "101120500" }); codes.Add("兰州", new string[] { "兰州", "270200", "100020", "101160100" }); codes.Add("泉州", new string[] { "泉州", "110400", "090030", "101230500" }); } if (codes.Keys.Contains(city)) { return(codes[city][(int)source]); } return(null); }
public static Job GetJobEntity( JobSource item, IReadOnlyList <int> weightings) { var job = new Job { JobId = item.JobId, Name = item.Name, Company = item.Company, Skills = item.Skills, JobSkills = JobHelper.GetJobSkills( item.JobId, item.Skills, weightings) }; job.Skills = JobHelper.GetJobSkillsCsv(job.JobSkills); return(job); }
public async Task <JobDetailResponseDTO> GetJobDetailFromJobSourceAsync(string url, JobSource jobSource) { if (RedisHelper.Exists(url)) { return(RedisHelper.Get <JobDetailResponseDTO>(url)); } JobDetailResponseDTO result = null; try { switch (jobSource) { case JobSource.智联: result = await GetJobDetailFromZhilianAsync(url); break; case JobSource.前程: result = await GetJobDetailFromQianchengAsync(url); break; case JobSource.猎聘: result = await GetJobDetailFromLiepinAsync(url); break; case JobSource.BOSS: result = await GetJobDetailFromBossAsync(url); break; case JobSource.拉勾: result = await GetJobDetailFromLagouAsync(url); break; default: return(null); } } catch (Exception ex) { Log.Logger.Error(ex.Message); return(null); } RedisHelper.Set(url, result, 10); return(result); }
internal static StoreIntegrityCheckJob Aggregate(IList <StoreIntegrityCheckJob> jobs) { if (jobs == null || jobs.Count == 0) { return(null); } if (jobs.Count == 1) { return(jobs[0]); } HashSet <MailboxCorruptionType> hashSet = new HashSet <MailboxCorruptionType>(); TimeSpan timeSpan = default(TimeSpan); List <StoreIntegrityCheckJob.Corruption> list = new List <StoreIntegrityCheckJob.Corruption>(); DatabaseId databaseId = jobs[0].databaseId; Guid guid = jobs[0].requestGuid; Guid empty = jobs[0].mailboxGuid; Guid guid2 = jobs[0].jobGuid; JobFlags jobFlags = JobFlags.None; JobSource jobSource = jobs[0].source; JobPriority jobPriority = jobs[0].priority; JobState jobState = jobs[0].state; DateTime? dateTime = null; DateTime? dateTime2 = null; int num = 0; int num2 = 0; DateTime? dateTime3 = jobs[0].finishTime; long num3 = 0L; bool flag = false; for (int i = 0; i < jobs.Count; i++) { StoreIntegrityCheckJob storeIntegrityCheckJob = jobs[i]; if (storeIntegrityCheckJob.mailboxGuid != empty) { empty = Guid.Empty; } if (!hashSet.Contains(storeIntegrityCheckJob.Tasks[0])) { hashSet.Add(storeIntegrityCheckJob.Tasks[0]); } if (dateTime == null) { dateTime = storeIntegrityCheckJob.creationTime; } else if (dateTime != null && storeIntegrityCheckJob.creationTime != null && dateTime.Value > storeIntegrityCheckJob.creationTime.Value) { dateTime = storeIntegrityCheckJob.creationTime; } if (dateTime2 == null) { dateTime2 = storeIntegrityCheckJob.lastExecutionTime; } if (dateTime2 != null && storeIntegrityCheckJob.lastExecutionTime != null && dateTime2 < storeIntegrityCheckJob.lastExecutionTime.Value) { dateTime2 = storeIntegrityCheckJob.lastExecutionTime; } if (dateTime3 != null && storeIntegrityCheckJob.finishTime != null) { if (dateTime3.Value < storeIntegrityCheckJob.finishTime.Value) { dateTime3 = storeIntegrityCheckJob.finishTime; } } else { dateTime3 = null; } if (storeIntegrityCheckJob.TimeInServer != null) { timeSpan += storeIntegrityCheckJob.TimeInServer.Value; } jobFlags |= storeIntegrityCheckJob.flags; if (storeIntegrityCheckJob.state != jobState) { if ((storeIntegrityCheckJob.state == JobState.Succeeded || storeIntegrityCheckJob.state == JobState.Failed) && (jobState == JobState.Succeeded || jobState == JobState.Failed)) { jobState = JobState.Failed; } else { jobState = JobState.Running; } } num3 += (long)storeIntegrityCheckJob.progress; if (storeIntegrityCheckJob.corruptions != null) { list.AddRange(storeIntegrityCheckJob.corruptions); } num += storeIntegrityCheckJob.CorruptionsDetected; num2 += storeIntegrityCheckJob.CorruptionsFixed; if (storeIntegrityCheckJob.errorCode != null && storeIntegrityCheckJob.errorCode.Value != 0) { flag = true; } } num3 /= (long)jobs.Count; int?num4 = null; if (flag) { num4 = new int?(-2147467259); } return(new StoreIntegrityCheckJob(databaseId, empty, guid, Guid.Empty, jobFlags, hashSet.ToArray <MailboxCorruptionType>(), jobState, jobSource, jobPriority, (short)num3, dateTime, dateTime2, dateTime3, new TimeSpan?(timeSpan), num4, num, num2, list.ToArray())); }
internal StoreIntegrityCheckJob(DatabaseId databaseId, Guid mailboxGuid, Guid requestGuid, Guid jobGuid, JobFlags flags, MailboxCorruptionType[] taskIds, JobState state, JobSource source, JobPriority priority, short progress, DateTime?creationTime, DateTime?lastExecutionTime, DateTime?finishTime, TimeSpan?timeInServer, int?errorCode, int corruptionsDetected, int corruptionsFixed, StoreIntegrityCheckJob.Corruption[] corruptions) : this() { this.databaseId = databaseId; this.mailboxGuid = mailboxGuid; this.requestGuid = requestGuid; this.jobGuid = jobGuid; this.flags = flags; this.tasks = taskIds; this.state = state; this.source = source; this.priority = priority; this.progress = progress; this.creationTime = creationTime; this.lastExecutionTime = lastExecutionTime; this.finishTime = finishTime; this.timeInServer = timeInServer; this.errorCode = errorCode; this.corruptions = corruptions; this.corruptionsDetected = corruptionsDetected; this.corruptionsFixed = corruptionsFixed; }