mirror of
https://github.com/hpd840321/starRiverProperty.git
synced 2026-06-10 08:50:29 +08:00
Initial commit: reorganized source tree
- backend/: 13 Maven modules (cw-elevator-application, cloudwalk-cloud, intelligent-cwoscomponent, ninca-crk, etc.) - frontend/: 4 Vue projects (elevator-front, cwos-portal, alarm-front, front_acs) + decompiled + scripts - scripts/: build, test-env, tools (Docker Compose, service templates, API parity) - docs/: AGENTS.md, superpowers specs, architecture docs - .gitignore: standard Java/Maven exclusions Moved from legacy maven-*/ root layout to backend/ organized structure.
This commit is contained in:
+51
@@ -0,0 +1,51 @@
|
||||
# 04 MQTT、访客与域事件
|
||||
|
||||
## 4.1 双通道:访客查询
|
||||
|
||||
| 方式 | 路径/Bean | 使用场景(本模块) |
|
||||
|------|-----------|---------------------|
|
||||
| **HTTP + RestTemplate** | `combineAuthClientURI("intelligent/three/visitor/record/query")` | `AcsElevatorRecordServiceImpl#add` 反查是否访客 |
|
||||
| **Feign** | `VisitorFeignClient` → `/intelligent/visitor/record/query` | 定义在 `visitor/client`,**本模块内无直接注入调用** |
|
||||
|
||||
两者 **不是** 同一路径;业务上均面向标准访客中心,但 **「three」** 与 **「intelligent」** 为产品/版本差异,部署时需与 `ninca-crk-std` 实际路由一致。
|
||||
|
||||
## 4.2 `MqttService` 与 `MqttServiceImpl`
|
||||
|
||||
| 项 | 说明 |
|
||||
|----|------|
|
||||
| `sendInfoToOne` | `@Async`:先 **睡眠约 10s** 等待识别记录落库,再查识别流水,拼 `AcsElevatorRecordMqttParam`,向 topic `{businessId}+_elevator_record` 发 JSON |
|
||||
| 远程 | `MqttFeignClient#publish` → 设备第三方 MQTT 服务 |
|
||||
|
||||
**调用关系**:本模块中 **`AcsElevatorRecordServiceImpl` 注入了 `MqttService` 但当前未调用**;若产品要求「保存记录后推送大屏」,可在 **监听 `VisitorRecordPushEvent` 的处理器** 或 **在 `add` 成功后** 显式调用 `sendInfoToOne`(需评估与异步睡眠设计是否一致)。
|
||||
|
||||
## 4.3 时序:MQTT 推送(当显式调用 `sendInfoToOne` 时)
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
participant Caller as 业务/监听器
|
||||
participant M as MqttServiceImpl
|
||||
participant DAO as AcsRecogRecordDao
|
||||
participant F as MqttFeignClient
|
||||
Caller->>M: sendInfoToOne(DTO)
|
||||
Note over M: sleep 10s
|
||||
M->>DAO: page(识别流水)
|
||||
DAO-->>M: 人名/标签
|
||||
M->>F: publish(topic, JSON)
|
||||
F-->>M: CloudwalkResult
|
||||
```
|
||||
|
||||
## 4.4 状态机:从「仅事件」到「+ MQTT」(部署选项)
|
||||
|
||||
```mermaid
|
||||
stateDiagram-v2
|
||||
[*] --> RecordSaved: add DAO 成功
|
||||
RecordSaved --> EventPublished: VisitorRecordPushEvent
|
||||
EventPublished --> MqttOptional: 可选
|
||||
MqttOptional --> MqttPush: 若接线 sendInfoToOne
|
||||
MqttOptional --> NoMqtt: 当前默认
|
||||
```
|
||||
|
||||
## 4.5 域事件与 MQTT 解耦说明
|
||||
|
||||
- `VisitorRecordPushEvent` 经 `CloudwalkEventManager` 发布,**不保证** 与 MQTT 同一步骤执行。
|
||||
- 下游可独立订阅 **事件** 与 **MQTT topic**,避免强耦合。
|
||||
Reference in New Issue
Block a user