wanshenmean
2026-03-27 71403dd5e730c6966b2754f94b8a2df50729bfd3
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/Service/RouterService.cs
@@ -430,8 +430,10 @@
        public List<object> GetAllWholeRouters()
        {
            List<object> data = new List<object>();
            // 查询所有路由
            List<Dt_Router> allRouters = BaseDal.QueryData(x => true);
            // 从缓存加载入口类型和出口类型的全量路由数据并合并
            List<Dt_Router> inRouters = GetAllRoutersFromCache(RouterInOutType.In.ObjToInt());
            List<Dt_Router> outRouters = GetAllRoutersFromCache(RouterInOutType.Out.ObjToInt());
            List<Dt_Router> allRouters = inRouters.Concat(outRouters).ToList();
            // 查询所有结束的路由,并按Id排序
            List<Dt_Router> dt_Routers = allRouters.Where(x => x.IsEnd).OrderBy(x => x.Id).ToList();
@@ -602,6 +604,20 @@
                // 添加新的路由信息
                BaseDal.AddData(routers);
                // 重新查询全量路由(此时才包含新增的路由),再写入缓存
                List<Dt_Router> updatedRouters = BaseDal.QueryData(x => x.InOutType == routerType);
                string cacheKey = $"Router:AllRouters:{(routerType == RouterInOutType.In.ObjToInt() ? "In" : "Out")}";
                try
                {
                    _cacheService.AddOrUpdate(cacheKey, updatedRouters);
                }
                catch
                {
                    // 缓存更新失败时静默忽略,下次查询会从DB自动重建缓存
                }
                content = WebResponseContent.Instance.OK();
            }
            catch (Exception ex)