IMapCacheService.cs
2.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Rcs.Application.Services
{
/// <summary>
/// 地图缓存服务接口 - 负责地图数据的Redis缓存操作
/// @author zzy
/// </summary>
public interface IMapCacheService
{
/// <summary>
/// 从Redis获取地图完整数据(含节点、边、资源)
/// @author zzy
/// </summary>
Task<MapCacheData?> GetMapAsync(Guid mapId);
/// <summary>
/// 获取所有地图ID列表
/// @author zzy
/// </summary>
Task<IEnumerable<Guid>> GetAllMapIdsAsync();
/// <summary>
/// 通过节点编码快速查找节点ID
/// @author zzy
/// </summary>
Task<Guid?> GetNodeIdByCodeAsync(Guid mapId, string nodeCode);
/// <summary>
/// 更新单个地图缓存
/// @author zzy
/// </summary>
Task UpdateMapCacheAsync(Guid mapId);
/// <summary>
/// 删除地图缓存
/// @author zzy
/// </summary>
Task RemoveMapCacheAsync(Guid mapId);
}
/// <summary>
/// 地图缓存数据
/// @author zzy
/// </summary>
public class MapCacheData
{
public Guid MapId { get; set; }
public string MapCode { get; set; } = string.Empty;
public string MapName { get; set; } = string.Empty;
public int MapType { get; set; }
public string Version { get; set; } = string.Empty;
public bool Active { get; set; }
public List<MapNodeCache> Nodes { get; set; } = new();
public List<MapEdgeCache> Edges { get; set; } = new();
public List<MapResourceCache> Resources { get; set; } = new();
}
public class MapNodeCache
{
public Guid NodeId { get; set; }
public string NodeCode { get; set; } = string.Empty;
public double X { get; set; }
public double Y { get; set; }
public double? Theta { get; set; }
public int Type { get; set; }
public bool Active { get; set; }
}
public class MapEdgeCache
{
public Guid EdgeId { get; set; }
public string EdgeCode { get; set; } = string.Empty;
public Guid FromNode { get; set; }
public Guid ToNode { get; set; }
public double Length { get; set; }
public double? Cost { get; set; }
public bool Active { get; set; }
}
public class MapResourceCache
{
public Guid ResourceId { get; set; }
public string ResourceCode { get; set; } = string.Empty;
public int Type { get; set; }
public int? Capacity { get; set; }
}
}