Files
starRiverProperty/backend/cw-elevator-application/cw-elevator-application-service/docs/01-device-and-task.md
T
hpd840321 7b2bd307f1 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.
2026-05-09 09:56:45 +08:00

76 lines
3.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 01 设备与设备任务(`device`
## 1.1 业务目标
- 维护 **本应用视角** 的电梯设备与平台设备(`DeviceService`)的关联数据。
- 支持 **重组/绑定**:按区域、标签、组织等条件选择楼层,将 **人员****规则** 批量下发到设备侧(经远程服务)。
- 通过 **设备任务**`AcsDeviceTaskService` / `AcsDeviceTaskServiceImpl`)在楼层维度 **有界并行** 执行远程步骤,并 **按完成顺序** 推进任务上的 `bindDevices` 等进度(与走查约定 §9 一致)。
## 1.2 主接口 `AcsElevatorDeviceService`
| 方法 | 行为概要 |
|------|----------|
| `add` / `edit` / `delete` | 电梯设备增删改,写本库并协调平台设备信息 |
| `get` / `getById` / `getFo` | 分页列表、单条、表单选项数据 |
| `getBuildingId` / `getBusinessId` | 从查询条件解析楼宇或租户 |
| `devicePage` | 走 **平台** 设备分页,与 `Acs` 表关联展示 |
| `listUnbindFloors` / `listFloors` / `listCondition` / `listConditionByLabelIds` | 绑定时待选楼层、已绑楼层、条件筛选(标签等) |
| `bindingFloors` / `bindingPerson` | 启动绑定:创建/更新设备任务,异步 `updateFloors` |
| `getTask` / `setTaskStop` | 查询任务进度、停止任务 |
**实现类**`device/impl/AcsElevatorDeviceServiceImpl.java`
## 1.3 设备任务 `AcsDeviceTaskService`
| 方法 | 行为概要 |
|------|----------|
| `updateFloors` | 在 **增加楼层 / 删除楼层** 两路上,将远程调用按 **每批 `UPDATE_FLOORS_FLOOR_PARALLEL` 个楼层** 提交到 `elevatorRemoteBoundedExecutor``FeignThreadLocalUtil` 在子任务中恢复租户上下文;每步成功再 `advanceBindProgressOne` 更新 `bindDevices`。 |
**实现类**`device/impl/AcsDeviceTaskServiceImpl.java`
## 1.4 用例级视图(操作者:管理员 / 系统)
```mermaid
flowchart TB
subgraph 电梯设备管理
A[增删改电梯设备]
B[分页查询/详情]
end
subgraph 重组绑定
C[选楼层/人员或规则]
D[启动 bindingFloors/bindingPerson]
E[异步 updateFloors]
end
A --> B
C --> D --> E
```
## 1.5 时序:启动楼层绑定后异步推进(概念)
```mermaid
sequenceDiagram
participant Web as Web/Controller
participant Dev as AcsElevatorDeviceServiceImpl
participant Task as AcsDeviceTaskService
participant Pool as 有界线程池
participant Remote as 人员/规则 Feign
Web->>Dev: bindingFloors(参数)
Dev->>Task: 异步 updateFloors(...)
loop 每批楼层
Task->>Pool: invokeAll(子任务)
Pool->>Remote: add/delete 单楼层步骤
Remote-->>Task: 成功
Task->>Task: advanceBindProgressOne(taskId)
end
```
## 1.6 设备设置子域 `device/setting`
- **`AcsDeviceSettingService`**:如体温相关设置查询(`getTemperatureSetting`)。
- **`AcsDeviceImageStoreAppBindService`**:设备与图库应用绑定/解绑等(实现见 `setting/impl`)。
## 1.7 与邻域关系
- **规则/人员**`updateFloors` 内调 `PersonRuleService``ImageRuleRefService` 等,取决于绑定参数是 `personId` 还是标签/组织。
- **data 层**`AcsDeviceTaskDao`、设备相关 DAO 在 **data 模块**