/// <summary> /// 获取业务信息 /// </summary> private void GetBussMap() { BussMap = new ConcurrentDictionary <string, Business>(); foreach (var itemBusiness in (List <Business>)InfoBll.Get_BUSSINFO()) { BussMap.TryGetValue(itemBusiness.Zldbh, out Business bus); if (bus != null) { bus.VehList.Add(itemBusiness.Jhccph); BussMap.AddOrUpdate(itemBusiness.Zldbh, bus, (k, v) => bus); } else { itemBusiness.VehList.Add(itemBusiness.Jhccph); BussMap.AddOrUpdate(itemBusiness.Zldbh, itemBusiness, (k, v) => itemBusiness); } } }
private void CheckBussMap_Timeout(object state) { while (Flag) { ConcurrentDictionary <string, Business> temp = new ConcurrentDictionary <string, Business>(BussMap.Where(p => (DateTime.Now - p.Value.CreateTime).TotalHours >= 24).ToDictionary(key => key.Key, business => business.Value)); foreach (var bus in temp) { JhFeedback jhFeedback = new JhFeedback() { Zldbh = bus.Key, Fkr = "系统", Fkdbh = bus.Value.Lsh is null?"": bus.Value.Lsh, Fksj = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Fknr = "任务受理超时,强制结束", Fkdw = "南京市急救指挥中心", Fkjqlb = "结果反馈", Ext1 = "0", Ext2 = "", Ext3 = "", Ext4 = "", Ext5 = "" }; InfoBll.Update_FEEDBACK(jhFeedback); InfoBll.Update_WORKORDER(jhFeedback.Zldbh, "52"); } BussMap = new ConcurrentDictionary <string, Business>(BussMap.Where(p => (DateTime.Now - p.Value.CreateTime).TotalHours < 24).ToDictionary(key => key.Key, business => business.Value)); Thread.Sleep(1000 * 600); } }