修复mock服务中坐标转换(用标准库来进行CGCS2000和WGS84的转换,和路径方向的问题。
This commit is contained in:
parent
c7a52469dd
commit
d647ab17bc
21
CLAUDE.md
21
CLAUDE.md
@ -131,6 +131,27 @@ tail -f qaup-admin/app.log
|
||||
### Data Access
|
||||
Always use `QuapDataAdapter` for accessing vehicle/driver data in collision module to maintain clean separation between collision detection and system management.
|
||||
|
||||
### **CRITICAL: Serena MCP Token Management**
|
||||
**Claude MUST follow these rules to prevent excessive token usage:**
|
||||
|
||||
#### **Mandatory Parameters**
|
||||
- **Always set max_answer_chars=2000**
|
||||
- **Always set depth=0**
|
||||
- **Always set include_body=false**
|
||||
- **Always specify exact relative_path** (never use ".")
|
||||
|
||||
#### **Simple Usage Pattern**
|
||||
```bash
|
||||
# Good - controlled usage
|
||||
mcp__serena__find_symbol(name_path="ClassName", relative_path="path/to/file.java", include_body=false, depth=0, max_answer_chars=2000)
|
||||
|
||||
# Bad - excessive tokens
|
||||
mcp__serena__find_symbol(depth=1) # Never use depth=1
|
||||
mcp__serena__search_for_pattern(relative_path=".") # Never search entire project
|
||||
```
|
||||
|
||||
**This reduces token usage from 9930+ characters to under 500 characters per query.**
|
||||
|
||||
### Real-time Communication
|
||||
- WebSocket endpoints use `/topic` prefix for broadcasting
|
||||
- PostGIS handles geometric calculations with airport center at (120.0834104, 36.35406879)
|
||||
|
||||
50
doc/design/CA1234.json
Normal file
50
doc/design/CA1234.json
Normal file
@ -0,0 +1,50 @@
|
||||
{
|
||||
"type": "FeatureCollection",
|
||||
"features": [
|
||||
{
|
||||
"type": "Feature",
|
||||
"geometry": {
|
||||
"type": "LineString",
|
||||
"coordinates": [
|
||||
[
|
||||
120.08508640012495,
|
||||
36.36182498963186
|
||||
],
|
||||
[
|
||||
120.08090199425916,
|
||||
36.362577136200784
|
||||
],
|
||||
[
|
||||
120.08077110864791,
|
||||
36.36212595046586
|
||||
],
|
||||
[
|
||||
120.08004241896676,
|
||||
36.36188154498729
|
||||
],
|
||||
[
|
||||
120.07859116299593,
|
||||
36.365372400901556
|
||||
],
|
||||
[
|
||||
120.07757535108954,
|
||||
36.36533179518197
|
||||
],
|
||||
[
|
||||
120.07649732717964,
|
||||
36.36814042245338
|
||||
],
|
||||
[
|
||||
120.07441715579117,
|
||||
36.36757367925402
|
||||
]
|
||||
]
|
||||
},
|
||||
"properties": {
|
||||
"type": "route",
|
||||
"length": 1267.4987536104536,
|
||||
"vertices": 8
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
54
doc/design/MU5123.json
Normal file
54
doc/design/MU5123.json
Normal file
@ -0,0 +1,54 @@
|
||||
{
|
||||
"type": "FeatureCollection",
|
||||
"features": [
|
||||
{
|
||||
"type": "Feature",
|
||||
"geometry": {
|
||||
"type": "LineString",
|
||||
"coordinates": [
|
||||
[
|
||||
120.09353070859456,
|
||||
36.376457497442686
|
||||
],
|
||||
[
|
||||
120.09118060340178,
|
||||
36.37587688907353
|
||||
],
|
||||
[
|
||||
120.09370775664254,
|
||||
36.3694933442094
|
||||
],
|
||||
[
|
||||
120.09309129621212,
|
||||
36.36913901651289
|
||||
],
|
||||
[
|
||||
120.09421002369645,
|
||||
36.365617677245275
|
||||
],
|
||||
[
|
||||
120.09345006300696,
|
||||
36.36536527657874
|
||||
],
|
||||
[
|
||||
120.09260145183363,
|
||||
36.36542372582119
|
||||
],
|
||||
[
|
||||
120.09143729509786,
|
||||
36.3644546644055
|
||||
],
|
||||
[
|
||||
120.09000868390461,
|
||||
36.363111104274545
|
||||
]
|
||||
]
|
||||
},
|
||||
"properties": {
|
||||
"type": "route",
|
||||
"length": 1600.4912629822934,
|
||||
"vertices": 9
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
28
doc/design/坐标系.md
Normal file
28
doc/design/坐标系.md
Normal file
@ -0,0 +1,28 @@
|
||||
## 坐标系
|
||||
|
||||
### 机场坐标系:
|
||||
基于CGCS2000椭球的横轴墨卡托投影,特点:
|
||||
|
||||
-CGCS2000坐标系详细内容
|
||||
|
||||
1. 基本定义
|
||||
|
||||
- 全称: China Geodetic Coordinate System 2000(中国大地坐标系2000)
|
||||
- 性质: 地心坐标系(与WGS84在定义上一致,差异仅0.11mm,相容至cm级)
|
||||
- 启用时间: 2008年7月1日
|
||||
- 法定地位: 中国国家标准坐标系
|
||||
|
||||
2. 椭球参数
|
||||
|
||||
- 长半轴: a = 6,378,137米
|
||||
- 扁率倒数: f⁻¹ = 298.257222101
|
||||
- 椭球: 基于GRS80椭球
|
||||
|
||||
3. 横轴墨卡托投影参数(120°中央经线)
|
||||
|
||||
根据搜索结果,标准的CGCS2000 / 3-degree Gauss-Kruger zone 40参数:
|
||||
- 中央经线: 120°E
|
||||
- 比例因子: 1.0
|
||||
- 东偏移: 40,500,000米(其中40代表带号,500,000是标准偏移)
|
||||
- 北偏移: 0米
|
||||
- 投影方式: 横轴墨卡托投影(高斯-克吕格投影)
|
||||
@ -59,7 +59,7 @@ class DataCollectorServiceFlightNotificationTest {
|
||||
@Test
|
||||
void testCollectFlightNotificationData_Success() {
|
||||
// 准备测试数据
|
||||
FlightNotificationDTO dto1 = createTestFlightNotificationDTO("CA3456", "IN", "02R", "A01", System.currentTimeMillis());
|
||||
FlightNotificationDTO dto1 = createTestFlightNotificationDTO("CA1234", "IN", "02R", "A01", System.currentTimeMillis());
|
||||
FlightNotificationDTO dto2 = createTestFlightNotificationDTO("MU5678", "OUT", "02L", "B15", System.currentTimeMillis());
|
||||
List<FlightNotificationDTO> mockNotifications = Arrays.asList(dto1, dto2);
|
||||
|
||||
@ -96,7 +96,7 @@ class DataCollectorServiceFlightNotificationTest {
|
||||
@Test
|
||||
void testCollectFlightNotificationData_WithInvalidData() {
|
||||
// 准备测试数据(包含无效数据)
|
||||
FlightNotificationDTO validDto = createTestFlightNotificationDTO("CA3456", "IN", "02R", "A01", System.currentTimeMillis());
|
||||
FlightNotificationDTO validDto = createTestFlightNotificationDTO("CA1234", "IN", "02R", "A01", System.currentTimeMillis());
|
||||
FlightNotificationDTO invalidDto = createTestFlightNotificationDTO(null, "INVALID", null, null, null); // 无效数据
|
||||
List<FlightNotificationDTO> mockNotifications = Arrays.asList(validDto, invalidDto);
|
||||
|
||||
|
||||
@ -1,70 +0,0 @@
|
||||
# 航空器路由触发式采集测试
|
||||
|
||||
## 修改摘要
|
||||
|
||||
已成功将航空器路由采集从周期性访问改为触发式访问:
|
||||
|
||||
### 主要变更
|
||||
|
||||
1. **新增缓存机制**
|
||||
- 添加了 `routeRetrievalCache` 缓存Map
|
||||
- 缓存键格式:`{flightNo}:{type}:{time}`
|
||||
- 配置项:路由缓存过期时间(默认2小时)
|
||||
|
||||
2. **修改触发逻辑**
|
||||
- 在 `triggerRouteQueryByFlightNotification()` 开始处添加重复检查
|
||||
- 成功获取路由后标记为已获取
|
||||
- 基于航班进出港通知的时间戳确保精确去重
|
||||
|
||||
3. **禁用周期性采集**
|
||||
- `collectAircraftRouteAndStatus()` 默认禁用
|
||||
- 通过配置项 `data.collector.route.periodic-collection-enabled` 控制
|
||||
- 保留原有方法作为应急备用
|
||||
|
||||
4. **新增缓存管理**
|
||||
- 定时清理过期缓存记录(每小时执行一次)
|
||||
- 详细日志记录便于监控
|
||||
|
||||
### 配置说明
|
||||
|
||||
在 `application.yml` 中可添加以下配置:
|
||||
|
||||
```yaml
|
||||
data:
|
||||
collector:
|
||||
route:
|
||||
cache-expiry-hours: 2 # 路由缓存过期时间(小时)
|
||||
periodic-collection-enabled: false # 是否启用周期性采集(默认禁用)
|
||||
```
|
||||
|
||||
### 预期效果
|
||||
|
||||
1. **避免重复API调用**:同一航班事件(相同航班号+类型+时间戳)的路由只会获取一次
|
||||
2. **事件驱动响应**:完全基于航班进出港通知触发,响应更及时
|
||||
3. **减少系统负载**:取消周期性轮询,减少不必要的API调用
|
||||
4. **保持数据完整性**:每个航班事件都能准确获取和存储路由信息
|
||||
|
||||
### 关键日志示例
|
||||
|
||||
- **首次获取**:`🛫 航班通知触发路由查询: 航班号=CA8901, 类型=OUT, 时间=1732783090000`
|
||||
- **重复跳过**:`🔄 航班路由已获取过,跳过重复查询: 航班号=CA8901, 类型=OUT, 时间=1732783090000`
|
||||
- **成功完成**:`🚀 事件驱动的路由更新完成: 航班号=CA8901, 路由类型=OUT, 时间=1732783090000`
|
||||
- **缓存清理**:`清理过期路由缓存完成:清理前5条,清理后2条,清理了3条记录`
|
||||
|
||||
## 测试验证步骤
|
||||
|
||||
1. **启动系统**:确保 mock_airport.py 正在运行(提供航班进出港通知)
|
||||
2. **观察日志**:查看是否有 "周期性路由采集已禁用" 的调试日志
|
||||
3. **监控触发**:查看航班进出港通知是否正确触发路由查询
|
||||
4. **验证去重**:同一航班事件应该只触发一次路由获取
|
||||
5. **检查缓存**:验证缓存清理机制是否正常工作
|
||||
|
||||
## 回滚方案
|
||||
|
||||
如需恢复周期性采集,在配置文件中设置:
|
||||
```yaml
|
||||
data:
|
||||
collector:
|
||||
route:
|
||||
periodic-collection-enabled: true
|
||||
```
|
||||
BIN
tools/__pycache__/mock_airport.cpython-313.pyc
Normal file
BIN
tools/__pycache__/mock_airport.cpython-313.pyc
Normal file
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user