Exemplo n.º 1
0
        public void SaveLastRobAlertStatus(Guid vehicleCode, LastRobAlertStatus status)
        {
            var key = CONST_KEY_LAST_ROB_STATUS + vehicleCode.ToString();
            if (status == null)
            {
                status = new LastRobAlertStatus();
            }

            this.CachedService.Add(key, status, DateTime.Now.AddDays(1));
        }
Exemplo n.º 2
0
        public LastRobAlertStatus GetLastRobAlertStatus(EGPSCurrentInfo current)
        {
            if (!current.VehicleCode.HasValue) return null;

            string key = CONST_KEY_LAST_ROB_STATUS + current.VehicleCode.Value.ToString();
            var status = this.CachedService.Get(key) as LastRobAlertStatus;
            if (status == null)
            {
                // 找不到则从数据库查找最后一条报表记录
                DateTime dt1 = DateTime.Now;
                ERobAlertReport lastReport = GPSServiceFacade.Report.Rob.GetRecentReport(current.GPSCode, current.ReportTime);
                Logger.Info("从数据库查找最后一条Rob报表记录", "开销时间(毫秒)", (DateTime.Now - dt1).TotalMilliseconds, "Vehicle Code", current.VehicleCode.Value);

                status = new LastRobAlertStatus();
                if (lastReport != null)
                {
                    status.LastAlertTime = lastReport.GPSReportTime;
                }
                lastReport = null;

                this.SaveLastRobAlertStatus(current.VehicleCode.Value, status);
            }
            return status;
        }