Initial commit: five Maven reactors and docs only

Track maven-cloudwalk-cloud, maven-cw-elevator-application,
maven-intelligent-cwoscomponent, maven-ninca-crk, maven-ninca-qk-alarm,
and docs/. Other workspace paths ignored via .gitignore.

Made-with: Cursor
This commit is contained in:
反编译工作区
2026-04-24 10:35:31 +08:00
commit e2ac14719b
653 changed files with 50372 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
# 仅跟踪:docs/ 与五个 maven-* 聚合工程;其余根目录内容不纳入版本库。
/*
!.gitignore
!/docs/
!/docs/**
!/maven-cloudwalk-cloud/
!/maven-cloudwalk-cloud/**
!/maven-cw-elevator-application/
!/maven-cw-elevator-application/**
!/maven-intelligent-cwoscomponent/
!/maven-intelligent-cwoscomponent/**
!/maven-ninca-crk/
!/maven-ninca-crk/**
!/maven-ninca-qk-alarm/
!/maven-ninca-qk-alarm/**
# 已跟踪目录内的常见构建/IDE 产物(仍保留源码与 pom)
**/target/
**/.idea/
**/*.iml
**/.classpath
**/.project
**/.settings/
+46
View File
@@ -0,0 +1,46 @@
# 文档索引(反编译工作区)
本目录集中存放说明类文档与配套资源,按类别分子目录。
## 目录结构
| 目录 | 说明 |
|------|------|
| [business/](business/) | 业务走查、接口流、用例说明 |
| [build/](build/) | 构建环境、JDK 版本依据等 |
| [style/](style/) | 代码风格配置(P3C / Eclipse Formatter XML,供 Maven `formatter-maven-plugin` 引用) |
| [operations/](operations/) | 发布、私服上传等运维脚本 |
| [architecture/](architecture/) | 工程结构、Maven 聚合模块说明与模块间关系 |
反编译归档与解压树不在 `docs/` 内,而在仓库根目录 [**`artifacts/decompiled/`**](../artifacts/decompiled/)(与本文并列,见该目录 README)。
## 文档列表
### 工程说明(architecture
- [Maven 聚合工程说明](architecture/Maven聚合工程说明.md) — 五个 `maven-*` 聚合工程的定位、子模块、技术栈、工程间依赖与 `artifacts`/运行包分工。
### 业务(business
- [访客注册与派梯楼层业务流程走查](business/访客注册与派梯楼层业务流程走查.md) — 从第三方获取默认楼层到指定楼层、电梯 `add/visitor`、Feign 调用链与用例。
- [租户访客默认楼层技术产品方案](business/租户访客默认楼层技术产品方案.md) — 从第三方登记页初始化(数据项与接口溯源)到派梯开通的**闭环**、多租户默认楼层的实现路径评估与落地建议。
### 构建(build
- [ORIGINAL_BUILD_JDK.txt](build/ORIGINAL_BUILD_JDK.txt) — 原始运行包与构件体现的 **JDK 8** 依据;与各聚合父 POM 中 `maven-enforcer-plugin` 提示一致。
### 风格(style
- [alibaba-eclipse-codestyle.xml](style/alibaba-eclipse-codestyle.xml) — 阿里巴巴 P3C Eclipse 格式化配置;各 `maven-*/pom.xml``alibaba.eclipse.codestyle.path` 指向此处。
### 运维(operations
- [deploy_cw_elevator_v1_lib_to_nexus.py](operations/deploy_cw_elevator_v1_lib_to_nexus.py) — 将 V1 运行包 `lib` 下 JAR 批量 `deploy-file` 到 Nexus 的脚本。
## 反编译二进制与解压树(`artifacts/`
说明类文档在 **`docs/`**;从 JAR 反编译得到的 **`*.jar.src.zip` / `*.jar.src/`** 已归纳至仓库根目录 **`artifacts/decompiled/`**`archives``trees` 分类),详见 [artifacts/decompiled/README.md](../artifacts/decompiled/README.md)。
## 与 `dev-support` 的关系
`dev-support/` 下文档与配置已迁入 `docs/` 对应子目录。若本地仍有旧路径书签,请改为以 `docs/` 为准。
@@ -0,0 +1,197 @@
# Maven 聚合工程说明(反编译工作区)
> **适用范围**:本仓库根目录下五个以 `maven-` 为前缀的 **Maven Reactor(聚合父工程)**,由反编译产物整理而来,用于本地编译、走查与增量修改。
> **不适用范围**:各工程依赖的大量 **NINCA / 云从内部 JAR** 仍须通过 Nexus 等私服解析,本文仅描述**本仓库内可见的模块边界与协作关系**。
---
## 1. 文档目的
- 说明五个聚合工程各自的 **业务定位、子模块划分、技术栈选型原因**
- 说明工程之间的 **Maven 依赖与调用链上的协作**(与 `docs/business/` 中接口走查互补:本文偏「工程与构件」,走查文档偏「接口与数据流」)。
- 说明 **`maven-*`** 目录与 **`artifacts/decompiled/`**、**运行包目录** `cw-elevator-application-V1.0.0.20211103/` 的分工,避免混淆「可改源码树」与「仅对照归档」。
---
## 2. 五工程一览
| 仓库目录 | 聚合 artifactId(父 POM | `groupId` | 版本(父 POM | 子模块(`modules` |
|----------|---------------------------|-----------|----------------|----------------------|
| `maven-cloudwalk-cloud/` | `cloudwalk-cloud-decompiled-reactor` | `cn.cloudwalk.cloud` | `3.7.2-Brussels-SRX` | `cloudwalk-cloud-common``cloudwalk-common-event``cloudwalk-common-service` |
| `maven-cw-elevator-application/` | `cw-elevator-application-decompiled-reactor` | `cn.cloudwalk.elevator` | `1.0-SNAPSHOT` | `cw-elevator-application-common``data``service``web` |
| `maven-intelligent-cwoscomponent/` | `intelligent-cwoscomponent-decompiled-reactor` | `cn.cloudwalk.intelligent` | `2.9.2-xinghewan` | `intelligent-cwoscomponent-parent``interface``rest` |
| `maven-ninca-crk/` | `ninca-crk-decompiled-reactor` | `cn.cloudwalk.ninca` | `1.0.0` | `ninca-crk-gpu-std` |
| `maven-ninca-qk-alarm/` | `ninca-qk-alarm-decompiled-reactor` | `cn.cloudwalk.ninca` | `0.0.2-SNAPSHOT` | `ninca-qk-alarm-app-starter`(其下再含 web / interface 等子模块) |
---
## 3. 各工程详细说明
### 3.1 `maven-cloudwalk-cloud` — 云从公共云底座(事件与服务)
**定位**
聚合 **CloudWalk 内部通用能力**:消息与事件封装(`cloudwalk-common-event`)、通用服务侧抽象与实现(`cloudwalk-common-service`)。电梯应用、智能组件等上层工程普遍依赖这里的 **`CloudwalkResult`、Feign 封装、事件注解** 等构件。
**为何存在「`cloudwalk-cloud-common`」子模块**
反编译得到的子 JAR 原 `parent` 指向 **`cloudwalk-cloud-common`**,而原始父 POM 在工作区中缺失。本聚合工程增加 **`cloudwalk-cloud-common`** 模块,使子模块能 **先 `install` 到本地 `~/.m2`**,满足其它构件对「父 POM 坐标」的解析,同时由本 reactor **继承 Spring Boot**,统一 **Spring Cloud Greenwich** 与内部版本属性(如 `cwos-sdk-event` 与 V1 运行包 `lib` 对齐的说明见父 `pom.xml` 注释)。
**技术栈摘要**
- Spring Boot **2.1.x**(与父 POM 声明一致)
- Spring Cloud **Greenwich**`spring-cloud-dependencies` import
- Java **1.8**
**与其它工程关系**
**`maven-cw-elevator-application`**、**`maven-intelligent-cwoscomponent`**、**`maven-ninca-crk`** 等通过 `dependencyManagement` 或直连依赖引用 `cloudwalk-common-event` / `cloudwalk-common-service` 等坐标。
---
### 3.2 `maven-cw-elevator-application` — 电梯 / ACS 通行应用
**定位**
**电梯与门禁派梯相关业务应用**:人员通行规则(含访客 `add/visitor`)、设备、区域/空间 Feign、乘梯记录、MQTT 等。对应运行环境中常部署的 **`elevator-app`** 一类服务;业务走查见 `docs/business/访客注册与派梯楼层业务流程走查.md`
**子模块分层(推荐理解顺序)**
| 子模块 | 典型职责 |
|--------|----------|
| `cw-elevator-application-common` | 公共枚举、常量、工具、跨层 DTO/注解等 |
| `cw-elevator-application-data` | MyBatis 实体、Mapper、DAO 与数据源相关 |
| `cw-elevator-application-service` | 业务实现:`PersonRuleServiceImpl`、设备服务、记录服务等 |
| `cw-elevator-application-web` | Spring MVC 控制器,对外 HTTP API(如 `/elevator/person/add/visitor` |
**技术栈摘要**
- Spring Boot **2.1.x**、Java **1.8**
- MyBatis、分库分表(ShardingSphere 等版本在父 POM 属性中集中管理)
- 依赖 **`cloudwalk-common-*`**、**`intelligent-cwoscomponent-rest`** 等(与智能侧、组织侧集成)
**与运行包、反编译归档的关系**
- 父 POM 中属性 **`cw.elevator.v1.lib.dir`** 指向根目录 **`cw-elevator-application-V1.0.0.20211103/lib`**,用于与 **V1 运行包内 JAR 文件名** 对齐,便于 `install-file` 或私服核对。
- **`artifacts/decompiled/trees/cw-elevator-application-*-SNAPSHOT.jar.src`** 为历史解压对照;**日常改代码以 `maven-cw-elevator-application` 下各模块为准**。
---
### 3.3 `maven-intelligent-cwoscomponent` — 智能组件(接口 + REST)
**定位**
**智能操作系统组件(CWOS Component**:对上提供 **REST / Feign Client** 入口,对下通过 **Feign** 调用组织人员、电梯、图库、空间等微服务。在业务文档中常作为「第三方或网关」与 **`cw-elevator-application`** 之间的中转层(例如 `ElevatorPersonService.addVisitor` → Feign → `POST /elevator/person/add/visitor`)。
**子模块说明**
| 子模块 | 职责 |
|--------|------|
| `intelligent-cwoscomponent-parent` | 占位/对齐原多模块父工程坐标(若子模块引用需要) |
| `intelligent-cwoscomponent-interface` | API、参数、结果 DTO、对外 Service 接口定义 |
| `intelligent-cwoscomponent-rest` | 接口实现、Feign 客户端声明、与 Spring Cloud 集成 |
**技术栈摘要**
- Spring Boot **2.1.x**、Spring Cloud **Greenwich**
- 管理 **`cloudwalk-device-sdk-protocol-entity`** 等与设备协议相关的版本(父 POM 注释与 V1 `lib` 对齐)
**与其它工程关系**
- **`maven-cw-elevator-application`** 依赖 **`intelligent-cwoscomponent-rest`**(或同版本构件),形成「智能组件编排 ↔ 电梯落地」的链路。
- **`maven-ninca-crk`** 的 `ninca-crk-gpu-std`**`intelligent-cwoscomponent-rest`** 存在 **exclusion** 等精细依赖控制,说明 CRK 打包场景下需避免重复引入或版本冲突,以实际 **`ninca-crk-gpu-std/pom.xml`** 为准。
---
### 3.4 `maven-ninca-crk` — NINCA CRK 产品线(当前聚合 GPU 标准后端)
**定位**
**NINCA CRK**(门禁、考勤、访客、会议等组合能力)产品族中的 **标准 GPU 出入口后端** 工程 **`ninca-crk-gpu-std`**。子模块描述中体现为轻舟 1.4 体系下的 **标准 GPU 服务器-出入口版**;考勤、访客、门禁等大量 **web 模块以私服版本依赖** 引入,**不在本 reactor 的 `modules` 列表中展开**。
**为何使用 Boot 1.5 + Edgware**
父 POM 说明:为 **贴近原 `spring-boot-maven-plugin` 1.3.x 时代栈**,采用 Spring Boot **1.5.22** 与 Spring Cloud **Edgware**,减少与历史 fat jar 字节码、依赖树差异带来的构建问题。
**技术栈摘要**
- Spring Boot **1.5.x**、Cloud **Edgware**
- Java **1.8**
-**`intelligent-cwoscomponent-rest`**、**`cloudwalk-common-event`** 等版本在父 POM `dependencyManagement` 中锁定
**与其它工程关系**
依赖本仓库整理的 **`intelligent-cwoscomponent-rest`**、**`cloudwalk-common-event`** 等;更多 `ninca-crk-*` 构件从 Nexus 拉取。
---
### 3.5 `maven-ninca-qk-alarm` — 轻舟告警应用(Starter 聚合)
**定位**
**区域告警 / 轻舟告警(qk-alarm)** 可执行应用的 Maven 化聚合:原 **`ninca-qk-alarm-app`** 父 POM 缺失,由本 **`ninca-qk-alarm-decompiled-reactor`** 补齐 **`dependencyManagement`、插件版本、编码** 等,当前 reactor **直接列出的模块**为 **`ninca-qk-alarm-app-starter`**(可执行 JAR 形态业务的启动与组装入口)。
**子模块 `ninca-qk-alarm-app-starter` 说明**
- 依赖 **`ninca-qk-alarm-app-web`**、**`ninca-qk-alarm-app-interface`** 等同版本子构件,形成完整 Web + 接口层。
- 使用 **Curator + ZooKeeper**(版本在父 POM 统一管理),适用于注册发现或分布式协调类能力(以实际代码为准)。
**技术栈摘要**
- Spring Boot **2.1.x**、Java **1.8**
- MyBatis Spring Boot、Jacoco 等插件在父 POM `pluginManagement` 中声明
**与其它工程关系**
主要依赖 **`cloudwalk-common-web`** 等云从公共 Web 能力;与电梯、智能组件无强绑定,相对 **独立部署单元**
---
## 4. 工程间依赖与协作(简图)
下列关系表示 **Maven 依赖 / 常见运行时调用方向**,非严格部署拓扑。
```mermaid
flowchart LR
subgraph cloud [maven-cloudwalk-cloud]
CE[cloudwalk-common-event]
CS[cloudwalk-common-service]
end
subgraph intel [maven-intelligent-cwoscomponent]
IR[intelligent-cwoscomponent-rest]
end
subgraph elev [maven-cw-elevator-application]
EW[cw-elevator-application-web]
ES[cw-elevator-application-service]
end
subgraph crk [maven-ninca-crk]
GPU[ninca-crk-gpu-std]
end
subgraph alarm [maven-ninca-qk-alarm]
ST[ninca-qk-alarm-app-starter]
end
CE --> ES
CS --> ES
IR --> ES
ES --> EW
CE --> GPU
IR -.->|可能被 exclusion| GPU
CS --> ST
```
**文字归纳**
- **电梯应用** 依赖 **公共云模块** + **智能组件 REST**,对外暴露电梯 HTTP API;智能组件再通过 Feign 回调电梯、组织等。
- **CRK GPU 标准后端** 依赖公共事件、智能组件等,与考勤/访客等 **NINCA 模块** 打成一个可部署单元(具体以 `ninca-crk-gpu-std/pom.xml` 为准)。
- **告警应用** 相对独立,主要挂 **CloudWalk Web 公共栈**
---
## 5. 源码目录、`artifacts`、运行包三者的分工
| 位置 | 性质 | 建议使用方式 |
|------|------|----------------|
| **`maven-*/*/src/main/java`** | 已整理为 Maven 标准目录的 **主修改区** | 日常开发、编译、`mvn validate/package` |
| **`artifacts/decompiled/trees/*.jar.src`** | 反编译解压树 **归档对照** | 查历史包内资源、与 `META-INF/maven` 对照版本 |
| **`artifacts/decompiled/archives/*.jar.src.zip`** | 未解压的 **zip 备份** | 备份、交付留档 |
| **`cw-elevator-application-V1.0.0.20211103/`** | **V1 运行包展开**(含 `lib/` | 对齐线上依赖列表;`docs/operations/deploy_cw_elevator_v1_lib_to_nexus.py` 默认读取其 `lib` |
详见 [artifacts/decompiled/README.md](../../artifacts/decompiled/README.md)。
---
## 6. 构建与环境(延伸阅读)
- **JDK 版本依据**[ORIGINAL_BUILD_JDK.txt](../build/ORIGINAL_BUILD_JDK.txt)
- **各父 POM** 中 **`maven-enforcer-plugin`** 要求使用 JDK 8 范围,与上述依据一致。
- **代码风格**`docs/style/alibaba-eclipse-codestyle.xml`,各聚合工程通过属性 **`alibaba.eclipse.codestyle.path`** 引用。
- **私服与上传脚本**`docs/operations/deploy_cw_elevator_v1_lib_to_nexus.py`Nexus 地址见各父 POM 中 `nexus.baseUrl` 注释。
---
## 7. 文档维护
- 若新增第六个聚合工程,请在本表与各节补充 **目录、artifactId、modules、与其它工程的依赖边**
- 若 Spring Boot / Cloud 版本升级,请以各 **`maven-*/pom.xml`** 为准同步更新本文「技术栈摘要」小节。
+20
View File
@@ -0,0 +1,20 @@
原始运行包 / 官方构件体现的 Java 版本:Java 81.8
依据(摘录自本工作区内文件,便于审计):
1) cw-elevator-application-V1.0.0.20211103
- META-INF/MANIFEST.MFBuild-Jdk: 1.8.0_144
- META-INF/maven/.../cw-elevator-application-starter/pom.xml
maven.compiler.source=8maven.compiler.target=8
2) cw-elevator-application-V1.0.0.20211103/lib/cw-elevator-application-common-1.0-SNAPSHOT.jar
- META-INF/MANIFEST.MFBuild-Jdk: 1.8.0_144
3) cw-elevator-application-V1.0.0.20211103/lib/cloudwalk-common-event-3.7.2-Brussels-SRX.jar
- META-INF/MANIFEST.MFBuild-Jdk: 1.8.0_191
4) artifacts/decompiled/trees/ninca-crk-std-backend-V2.9.1_20210630.jar.src/META-INF/maven/.../pom.xml
- maven.compiler.source=1.8maven.compiler.target=1.8
结论:五个聚合 Maven 工程应与上述一致,使用 JDK 8 作为运行 Maven 的 JVMJAVA_HOME 指向 1.8.x),
字节码目标为 1.8。各聚合父 POM 已配置 maven-enforcer-plugin,要求 [1.8,1.9),避免误用 JDK 11+ 仅当“编译目标 8”导致注解处理器等问题。
@@ -0,0 +1,424 @@
# 租户访客默认楼层:技术产品方案
> **文档类型**:产品与工程技术方案(含**登记页数据项与接口溯源**、端到端闭环、数据模型与实施路线)。
> **前置阅读**:[访客注册与派梯楼层业务流程走查](访客注册与派梯楼层业务流程走查.md)(UC-01UC-06、对外 HTTP/Feign 与代码位置)。
> **关联工程**[Maven 聚合工程说明](../architecture/Maven聚合工程说明.md)`maven-cw-elevator-application`、`maven-intelligent-cwoscomponent` 等边界)。
---
## 1. 背景与问题陈述
### 1.1 业务背景
多租户部署下,不同机构对**访客可达楼层**的策略不一致:
- **默认诉求**:访客开通派梯时,若业务侧**不显式传楼层列表**(与 [UC-01](访客注册与派梯楼层业务流程走查.md) 一致),系统仍应开通派梯,但**不应简单等同于被访人组织侧 `floorList` 全集**。
- **典型例子(产品化名)**:**「广发基金」类租户**要求:访客**默认仅可派梯至 28 楼**(或某固定接待层),而被访人本人在组织中可能仍具备多层办公权限。
### 1.2 `floorIds` 是谁的字段、空与非空分别代表什么
#### 1.2.1 字段归属(哪个主体的属性)
`floorIds` **不是**组织人员主数据里「被访人」的持久化字段,也**不是**访客人员档案在组织库里的固定属性;在现有实现中,它是 **电梯应用对外接口** 的一次请求参数。
| 项目 | 说明 |
|------|------|
| **载体** | HTTP **`POST /elevator/person/add/visitor`** 的请求体(`AcsPersonAddVisitorForm` / 服务层 `AcsPersonAddVisitorParam`,见 `maven-cw-elevator-application`)。 |
| **语义** | **本次「给访客开通派梯」操作**中,调用方希望电梯在哪些 **空间分区(`zoneId`)** 上为 `visitorId` 写入默认通行规则并绑图库。 |
| **主体** | 归属主体是 **「派梯开通请求」**(一次 API 调用),由 **调用方**(第三方 BFF、访客业务后台、或 `intelligent-cwoscomponent-rest` 等)填入;电梯服务**读取**后执行落库与远程绑图库。 |
因此:在集成文档中应写清——**`floorIds` 列出的是「本次开通涉及的楼层 zoneId 列表」,由调用方在请求时提供;缺省(空)时电梯才按约定去组织侧拉被访人的 `floorList` 补全。**
#### 1.2.2 `floorIds` 非空时:业务含义与电梯行为
当调用方传入 **非空** `floorIds` 时(走查文档中的 **UC-02:访客派梯-第三方指定楼层**):
| 项目 | 说明 |
|------|------|
| **业务含义** | 调用方已明确「本次访客只(或优先)开通这些楼层」的意图;常见来源包括:登记/审批流程里已算好的**生效楼层**、访客在允许范围内**勾选的多层**、或业务规则直接指定的接待层列表。 |
| **电梯侧行为** | **不再**为补楼层去调 **`POST /component/person/detail`**;直接使用请求中的 `floorIds` 作为待写入规则的楼层列表,后续步骤(`zone/page` 取楼栋、`getDefaultByZoneId`、写 `image_rule_ref``batchBind` 等)与「列表来自组织补全」时相同,**仅楼层列表来源不同**。 |
| **责任边界** | **正确性、合法性、与租户策略及被访人授权的一致性**由调用方负责(或通过 BFF 统一校验);电梯按列表执行;若需「仍不得超过被访人 `floorList`」的硬约束,须在 **BFF、intelligent 或电梯增强**中择一层实现(见 §4、§5)。 |
#### 1.2.3 为什么调用方会选择「非空」(不依赖空列表)
| 动机 | 说明 |
|------|------|
| **与 UI/审批结果一致** | 登记页或审批单已确定可访楼层,开通时**显式写入**同一列表,避免电梯侧再解释「默认」。 |
| **多租户策略在域外已算完** | 推荐做法(§4):在第三方 BFF 做 `tenantAllow ∩ hostFloors`,把结果作为 `floorIds` 传入,电梯无需理解租户表。 |
| **避免 UC-01 与产品语义冲突** | 不传 `floorIds` 时电梯等价于「被访人 `floorList` 全集」;若产品要「小于全集」,**应传非空** `floorIds`,否则现网电梯逻辑无法满足。 |
| **集成契约清晰** | 显式列表便于审计、重放、幂等比对(可与登记快照 `effective_preview_json` 逐字一致)。 |
#### 1.2.4 `floorIds` 为空时:电梯侧补全(与上文对照)
当前电梯侧实现(`PersonRuleServiceImpl.addVisitor`)在 **`floorIds` 为空或缺省** 时:
1. 调用组织 **`/component/person/detail`**`personId` + `businessId`);
2. 将返回的 **`PersonResult.getFloorList()`** 赋给本次执行使用的楼层列表;
3. **不使用** `defaultFloor` 单字段作为补全依据。
因此:**仅在「调用方不传 `floorIds`」这一模式下**,现网电梯无法表达租户级收敛;多租户默认接待层需在 **调用方传非空 `floorIds`****电梯/ BFF 增强兜底** 中实现(见全文 §4、§6)。
### 1.3 文档目标
| 维度 | 目标 |
|------|------|
| **产品** | 定义租户策略、角色权限、配置流程、登记/邀约 **UX 与开通结果一致**、验收标准。 |
| **闭环** | 从**第三方系统在注册/邀约流程中初始化访客登记页**开始,明确**每个数据项从哪个系统、哪类接口获取**;经提交、审批(若有)到 **`add/visitor`** 生效,并给出**一致性校验**与回读建议。 |
| **技术** | 可选架构、推荐组合、数据模型与接口草案、改造边界、安全求交、**多租户默认访客楼层的实现路径综合评估**。 |
---
## 2. 端到端闭环:从第三方登记页初始化到派梯生效
本章回答:**登记页打开时要拉哪些数据、按什么顺序调接口、算出什么给 UI 存什么草稿、审批后如何与电梯开通对齐**,从而形成可审计、可测试的闭环。
### 2.1 闭环目标
| 目标 | 说明 |
|------|------|
| **同源计算** | 「页面上展示的预计可派梯楼层」与「最终调用 `add/visitor``floorIds`(或电梯兜底前的逻辑输入)」由**同一套规则函数**得出,避免两套逻辑漂移。 |
| **接口可追溯** | 每个 UI 字段可映射到**具体外部接口或本地配置**;本仓库已明确的接口见走查文档 §3~§4。 |
| **租户可配置** | `businessId`(机构 ID)贯穿上下文;租户策略变更后,**进行中的登记单**行为需在产品中定义(见 §2.7)。 |
### 2.2 阶段划分(第三方视角)
| 阶段 | 名称 | 参与系统 | 产出 |
|------|------|----------|------|
| **P0** | 登记页/邀约页 **初始化** | 第三方 + 组织 + 空间 +(可选)租户策略服务 | 表单默认值、`effectiveFloorsPreview`、可选楼层展示文案 |
| **P1** | 用户填写与 **校验** | 第三方前端 + 后端 | 通过校验的草稿 DTO |
| **P2** | **提交**登记/发起邀约 | 第三方 DB、工作流引擎 | 业务主键、状态机(待审批/已登记) |
| **P3** | **审批**(若存在) | 第三方审批流 | 通过/驳回;通过则触发 P4 |
| **P4** | **组织侧** 写入访客人员、拿到 `visitorId` | 组织/访客模块(**不在本反编译仓**,以实际 API 为准) | `visitorId` |
| **P5** | **派梯开通** | 第三方或 intelligent → **电梯** `POST /elevator/person/add/visitor` | 规则写入、图库绑定 |
| **P6** | **回读与告知** | 第三方查询电梯/通行结果或异步任务状态 | 与 P0 展示一致的「已开通楼层」说明 |
### 2.3 访客登记/邀约页:数据项定义与数据来源
下表面向**第三方业务系统**实现同学:列的是**逻辑字段**;物理表名由各自系统定义。接口路径以走查文档为准;**组织人员搜索**(选被访人)在走查中未展开,行内标注为**待对接清单**。
| 逻辑数据项 | 典型 UI 表现 | 数据来源 | 接口或服务(已知/占位) | 关键入参 / 出参 | 与租户楼层关系 |
|-------------|--------------|----------|---------------------------|-----------------|----------------|
| **租户/机构 ID** | 隐藏或顶部切换 | 登录态 / 网关注入 | 上下文 `businessId`,与 `CloudwalkCallContext.company` 一致 | `businessId` | 策略表主键维度 |
| **被访人 `personId`** | 选人组件 | **组织人员检索**(具体路径以 `ninca-common-component-organization` 或网关文档为准) | 占位:`POST .../person/page` 或等价检索 API | 选中行 → `personId` | 后续 `detail` 入参 |
| **被访人姓名/部门等展示** | 选人后回显 | 同上检索结果或二次 `detail` | 检索结果字段 **或** `POST /component/person/detail` | `PersonResult` 展示字段 | 非楼层核心 |
| **被访人授权楼层 ID 列表 `hostFloors`** | 一般不直接展示 ID | **组织**(与电梯 UC-01 同源) | **`POST /component/person/detail`** | 请求:`id`=被访人 `personId``businessId`;响应:`PersonResult.floorList` | 求交上界 |
| **`defaultFloor` / `floorInfoList` 等** | 若产品要展示「默认办公层」文案 | **组织** `detail` 同响应 | 同上 | `PersonResult.defaultFloor``floorInfoList` | **电梯补全不用 `defaultFloor`**;若 UI 用其展示,须与 `floorList` 语义对齐(走查 §8 风险 1) |
| **空间树/楼层名称** | 楼层中文名、楼栋 | **空间服务** `ninca-common` | **`POST /sysetting/zone/tree`**、**`POST /sysetting/zone/page`** | 用 `hostFloors``zoneId` **反查** `zoneName`、楼栋 | 仅展示增强 |
| **租户访客楼层策略** | 管理员配置页;登记页可不直接展示 | **租户策略存储**(自建表或配置中心) | 草案 §4.3 管理 API **或** 第三方本地表 + 管理端 | `policy_type``allow_zone_ids`、版本号 | **与 `hostFloors` 求交**得预览 |
| **`effectiveFloorsPreview`** | 「本次访问预计可开通派梯的楼层」 | **计算字段**(禁止手写死) | `computeEffective(policy, hostFloors, userOverride?)` | 输出 `List<zoneId>`,可附 `displayNames` | **必须与 P5 输入一致** |
| **访客可选楼层(若产品允许访客改)** | 多选框,默认选中 `effectiveFloorsPreview` | `effectiveFloorsPreview` 的子集 | 前端约束:用户勾选 ⊆ 预览集 | 提交 `userSelectedZoneIds` | 高敏租户可关闭多选 |
| **访客姓名、证件、事由、到访时间等** | 表单 | 用户输入 + 机构规则 | 第三方本地 | — | 与楼层正交 |
| **人脸/照片** | 采集/上传 | 用户 + 第三方存储 | 组织图库/人像接口以实际为准 | — | 走查未展开 |
| **策略版本号 `policyVersion`** | 可不展示 | 租户策略表 | 读取策略时返回 | 写入登记草稿 | 审计与回放 |
| **登记单草稿持久化** | — | 第三方 DB | 本地表建议字段:`draft_id, business_id, host_person_id, host_floors_snapshot_json, policy_snapshot_json, effective_preview_json, policy_version, status` | P5 时读出 `effective_preview` 或重算 | 支持审批前后回放 |
**不在本仓库的接口**(须在集成清单中单独列出):访客人员创建、`visitorId` 发放、审批流回调 URL、人像入库等——闭环在 P4 前依赖这些能力,本文仅要求:**P5 的 `floorIds` 与 P0 预览同源**。
### 2.4 接口编排顺序(推荐:登记页初始化一次请求链)
第三方**后端聚合接口**(推荐由自有 **BFF** 实现,避免前端直连多枚令牌)建议内部按序调用:
```
1) 校验 businessId、操作者权限
2) GET 租户访客楼层策略(若无则视为 HOST_FLOOR_LIST
3) POST /component/person/detailid=被访人 personId, businessId
→ 得 hostFloors = floorList(可能 null/空)
4) computeEffective(policy, hostFloors, requestedFromClient=null)
→ 若空:返回明确错误码,登记页展示「无法为该被访人开通访客派梯,请联系管理员」
5) 可选:POST /sysetting/zone/page 或 tree 子集调用,将 zoneId 映射为 zoneName / 楼栋
6) 返回给前端:{ hostPerson, effectiveFloorsPreview, displayNames, policyVersion, warnings }
```
前端**仅展示**第 6 步结果,**不在前端重复实现求交**(防篡改可签短期 token 或仅信服务端字段)。
### 2.5 可选:统一「预览」能力(降低集成方重复劳动)
可在 **第三方 BFF****intelligent** 增加只读接口(路径示例):
| 方法 | 路径(示例) | 入参 | 出参 |
|------|----------------|------|------|
| `POST` | `/api/visitor/register/preview-floors` | `businessId`, `hostPersonId`, 可选 `userSelectedZoneIds` | `hostFloors`, `tenantPolicy`, `effectiveZoneIds`, `displayFloors[]`, `policyVersion`, `canSubmit` |
**契约**`effectiveZoneIds` 的计算规则须与 P5 调用 `add/visitor` 时组装的 `floorIds` **完全一致**(同一服务端模块单元测试)。
### 2.6 P5 派梯开通:与登记页的衔接
| 路径 | 做法 |
|------|------|
| **推荐(方案 B** | 审批通过后,从登记单读出 **快照**或 **用相同函数重算**(若策略允许重算):组装 **`floorIds` = `effectiveZoneIds`**,调用 **`POST /elevator/person/add/visitor`**(或 `ElevatorPersonFeignClient.addVisitor`),走 **UC-02**。 |
| **兜底(方案 C/D** | 若历史集成方坚持不传 `floorIds`,则由电梯或 intelligent 在服务端求交(见 §4);登记页仍应按 §2.3 展示**与兜底后一致**的预览(通过同一预览 API 或文档约定算法)。 |
**时间参数**`begVisitorTime` / `endVisitorTime` 与走查一致,须与登记单有效期对齐。
### 2.7 闭环一致性:策略中途变更、重试与幂等
| 场景 | 产品建议 |
|------|----------|
| 管理员在**登记草稿未提交**时修改策略 | 下次打开登记页重新走 P0,**以新策略为准**。 |
| 草稿已提交、**待审批**期间策略变更 | 二选一并在需求中写死:**(a)** 审批节点展示「策略已变更请重审」并阻塞直到人工确认;**(b)** 以提交时刻 `policyVersion` **冻结**计算结果,审批通过仍按旧结果开通(需评估合规)。 |
| **审批通过瞬间**策略变更 | P5 使用**出队消息中的快照** `effective_preview_json`,避免 TOCTOU。 |
| 重复点击开通 | `visitorId` + 时间窗幂等;与电梯侧是否已存在规则引用需对齐(可查电梯侧人员规则再调,属增强项)。 |
### 2.8 端到端泳道图(闭环)
```mermaid
sequenceDiagram
participant U as 访客用户
participant FE as 第三方前端
participant BFF as 第三方BFF
participant Pol as 租户策略存储
participant Org as 组织 person/detail
participant Zone as 空间 zone/tree|page
participant Reg as 第三方登记库
participant Apv as 审批流
participant OrgW as 组织写访客
participant Elv as 电梯 add/visitor
U->>FE: 打开登记页
FE->>BFF: 初始化(被访人personId)
BFF->>Pol: 读策略(businessId)
BFF->>Org: detail(personId)
Org-->>BFF: floorList
BFF->>BFF: computeEffective
opt 展示楼层名
BFF->>Zone: page/tree(zoneIds)
Zone-->>BFF: names
end
BFF-->>FE: 预览+policyVersion
U->>FE: 填写并提交
FE->>BFF: 提交草稿
BFF->>Reg: 持久化快照
Reg-->>FE: draftId
opt 需审批
BFF->>Apv: 发起
Apv-->>BFF: 通过+token
end
BFF->>OrgW: 创建访客→visitorId
BFF->>Elv: add/visitor(visitorId,personId,floorIds=effective,...)
Elv-->>BFF: 成功/失败
BFF-->>FE: 结果与楼层说明
```
---
## 3. 产品方案
### 3.1 目标用户与角色
| 角色 | 职责 |
|------|------|
| **平台/租户管理员** | 在本机构内配置「访客默认楼层策略」、维护允许的 `zoneId` 列表或与楼栋的映射、查看审计日志。 |
| **被访人员工** | 日常办公权限仍在组织侧维护;不强制要求其理解访客策略。 |
| **访客** | 通过邀约/登记获得限时通行;仅应看到**实际可派梯楼层**(与开通结果一致)。 |
| **运维/实施** | 将「28 楼」等业务语言映射为空间服务中的 **`zoneId`**,并录入策略或导入模板。 |
### 3.2 用户故事(示例)
1. **作为租户管理员**,我希望为本机构配置「访客默认仅开放指定楼层集合」,以便满足物业/合规对访客活动范围的要求。
2. **作为租户管理员**,我希望可选策略为「与员工授权楼层求交」或「固定楼层但必须仍在员工授权内」,以便在**不放大访客权限**的前提下简化配置。
3. **作为访客业务系统**,在调用电梯开通接口时,我可以在不传 `floorIds` 的情况下仍得到符合租户策略的派梯结果(若采用电梯或 BFF 兜底策略)。
4. **作为访客**,我在登记完成前看到的「可访问楼层」说明,应与最终开通的楼层**一致**,避免纠纷。
### 3.3 策略类型(产品枚举建议)
| 策略代码(建议) | 产品名称 | 行为摘要 | 适用场景 |
|------------------|----------|----------|----------|
| `HOST_FLOOR_LIST` | 与现网 UC-01 一致 | 不传 `floorIds` 时,等价于被访人 **`floorList` 全集** | 默认租户、未配置策略时的回退 |
| `INTERSECT_ALLOWLIST` | 租户允许列表 ∩ 被访人楼层 | 最终楼层 = **`allowZoneIds``floorList`**(交集为空则失败并提示) | **广发基金类**:员工多层、访客只允许接待层等 |
| `FIXED_ZONES` | 固定楼层(仍 ∩ 被访人) | 最终楼层 = **`fixedZoneIds``floorList`** | 强固定少量楼层且必须与员工授权一致 |
| `EXPLICIT_ONLY` | 仅显式开通 | 业务侧**必须**传 `floorIds`(等价 UC-02);租户策略关闭「空列表自动补全」 | 金融高敏楼栋 |
**产品原则(建议写进需求)**:凡涉及「租户默认/固定楼层」的,**最终生效楼层必须 ⊆ 被访人 `floorList`**(安全底线,见第 5 章)。
### 3.4 管理端功能清单(MVP → 完整)
**MVP(最小可用)**
- 租户级开关:是否启用「访客楼层策略」。
- 策略类型选择 + **允许楼层多选**(选项数据来自空间树 `/sysetting/zone/tree` 或分页接口,与走查文档一致)。
- 保存后**审计**:操作人、时间、前后 JSON 快照。
**增强**
- 按**楼栋**分别配置(多栋园区)。
- 按**被访部门**或**职级**附加规则(优先级:部门规则 > 租户默认)。
- 导入/导出 CSV`businessId, zoneName, zoneId`)。
- 与「访客类型」联动(VIP 可走多层等,需单独权限模型)。
### 3.5 验收标准(补充闭环相关)
| 编号 | 场景 | 期望 |
|------|------|------|
| AC-1 | 租户配置「允许 {28F}」,被访人 `floorList` 含 28F 与其它层 | 不传 `floorIds` 时(若走兜底),访客**仅**开通 28F |
| AC-2 | 同上,被访人 `floorList` **不含** 28F | **开通失败**,返回明确错误(禁止静默落到其它层) |
| AC-3 | 租户未配置策略 | 行为与现网 **UC-01** 一致 |
| AC-4 | 业务显式传 `floorIds`UC-02 | **以传入为准**(或启用「显式也求交」须在集成合同写明) |
| AC-5 | 注册前 UI 展示楼层 | 与 `add/visitor` **最终生效楼层**一致(含策略与求交) |
| **AC-6** | 登记页初始化与 P5 开通相隔任意时间(策略不变) | **两次 `computeEffective` 结果一致**(或均使用快照) |
| **AC-7** | 仅改展示文案、不改服务端 | **禁止**;展示必须以服务端预览为准 |
---
## 4. 技术方案
### 4.1 方案族对比
| 方案 | 实现位置 | 优点 | 缺点 | 新租户扩展 |
|------|----------|------|------|------------|
| **A. 组织侧收窄 `floorList`** | `ninca-common-component-organization` | 不改电梯;与 UC-01 完全一致 | 员工本人权限与「访客可继承列表」易混 | 每租户数据治理 |
| **B. 业务/访客层显式传 `floorIds`** | 第三方 BFF:登记页与 P5 **同源计算** | 不改电梯;闭环最清晰(UC-02) | 多调用入口需统一 | 租户表在**业务库** |
| **C. 电梯侧策略引擎** | `PersonRuleServiceImpl.addVisitor` | 直连电梯的旧集成也能兜底 | 电梯存策略、发版耦合 | `businessId` 维表 |
| **D. intelligent BFF** | `intelligent-cwoscomponent-rest` | 不直接改电梯包 | 绕过 intelligent 的直连须约束 | 表可在 intelligent 库 |
| **E. 配置中心** | Nacos 等 | 变更快 | 审计弱 | 适合灰度,长期建议落库 |
**推荐组合(工程上较稳)**
1. **首选****方案 B** — 第三方 **BFF****P0 与 P5 共用** `computeEffective``add/visitor` **始终传 `floorIds`**
2. **可选兜底****方案 C 或 D** 仅在 `floorIds` 为空时求交;登记页预览仍应调用**同一预览逻辑**(可部署在 BFF 或 D),避免「兜底路径」与「预览路径」算法分叉。
### 4.2 核心算法(推荐伪代码)
设:
- `hostFloors` = 组织 `detail` 返回的 `floorList`(可能为空)。
- `tenantAllow` = 租户配置的允许访客楼层 `zoneId` 集合。
- `requested` = 调用方传入的 `floorIds`(可能为空)。
```
if requested 非空:
effective = requested // 默认信任;高敏合同可改为 requested ∩ tenantAllow ∩ hostFloors
else:
effective = tenantAllow ∩ hostFloors // 或 policy=HOST 时 tenantAllow 视为全集
if effective 为空:
返回业务错误(勿继续 zone page / insert
```
**电梯 `addVisitor` 当前风险点**:补全后未校验空列表即使用 `floorIds.get(0)`。无论采用何种产品方案,**建议在生效列表计算完成后统一做空集校验**,与 [UC-04](访客注册与派梯楼层业务流程走查.md) 治理合并。
### 4.3 数据模型草案(租户策略落库)
```sql
CREATE TABLE tenant_visitor_floor_policy (
id VARCHAR(32) PRIMARY KEY,
business_id VARCHAR(64) NOT NULL COMMENT '机构/租户 ID',
policy_type VARCHAR(32) NOT NULL,
allow_zone_ids TEXT COMMENT 'JSON 数组 zoneId',
building_id VARCHAR(64) COMMENT '可选',
enabled TINYINT(1) NOT NULL DEFAULT 1,
policy_version BIGINT NOT NULL DEFAULT 1 COMMENT '每次更新+1,供登记快照引用',
remark VARCHAR(256),
created_by VARCHAR(64),
created_at BIGINT,
updated_by VARCHAR(64),
updated_at BIGINT,
UNIQUE KEY uk_biz_building (business_id, building_id)
);
```
**缓存**:按 `businessId` 缓存;更新策略时递增 `policy_version` 并使缓存失效。
### 4.4 管理 API 草案(REST
| 方法 | 路径 | 说明 |
|------|------|------|
| `GET` | `/admin/tenant/{businessId}/visitor-floor-policy` | 查询当前策略 |
| `PUT` | `/admin/tenant/{businessId}/visitor-floor-policy` | 全量更新;**递增** `policy_version` |
| `POST` | `/admin/tenant/{businessId}/visitor-floor-policy/preview` | body`hostPersonId`;返回与登记页同源结构 |
### 4.5 电梯服务改造要点(若采用方案 C)
见前文;补充:**登记页预览若不走电梯**,则电梯内求交逻辑须与 BFF **算法对齐**(共享库或 OpenAPI 生成的客户端 stub 中携带版本号)。
### 4.6 「28 楼」与 zoneId 映射
- 空间:**`/sysetting/zone/tree`**、**`/sysetting/zone/page`**(走查 §3.2)。
- 台账:`businessId``buildingId``display_name``zoneId`、生效日期。
### 4.7 兼容性与集成契约
| 项目 | 建议 |
|------|------|
| **与 UC-02** | 集成合同写明:`floorIds` 非空是否二次求交。 |
| **幂等** | 审批消息带 `draft_id` + `effective_hash`P5 去重。 |
| **版本** | 请求带 `policyVersion`,与快照比对可告警。 |
---
## 5. 安全与合规
1. **权限上界**:访客生效楼层 ⊆ 被访人 **`floorList`**。
2. **禁止静默降级**:交集为空则失败并记录。
3. **审计**:策略变更、预览请求、开通请求(可采样)。
4. **数据隔离**:所有查询带 `businessId`
---
## 6. 多租户「默认访客楼层」实现路径综合评估
在已具备 **§2 闭环**(登记页初始化 → 快照 → 审批 → `add/visitor`)的前提下,对各实现路径按维度打分(**高 / 中 / 低** 为实施与维护成本或风险的主观分级,供选型会使用)。
### 6.1 评估维度说明
| 维度 | 含义 |
|------|------|
| **登记页契合** | 能否自然地在 **P0** 提供准确预览、少调接口。 |
| **闭环一致性** | 单源计算、快照、防 TOCTOU 是否易实现。 |
| **新租户成本** | 新开租户时配置、实施、回归工作量。 |
| **入侵性** | 对电梯/组织/第三方存量改动的范围。 |
| **绕过风险** | 存在不经过 BFF 直连电梯时是否仍安全。 |
### 6.2 综合对比表
| 路径 | 登记页契合 | 闭环一致性 | 新租户成本 | 入侵性 | 绕过风险 | 结论 |
|------|------------|------------|------------|--------|----------|------|
| **B:第三方 BFF + 显式 `floorIds`** | **高**BFF 聚合 detail+策略+zone | **高**(同函数+快照) | **低**(插策略行 + 空间台账) | **低**(电梯可不改) | **中**(依赖网关禁止直连) | **首推** |
| **Dintelligent 预览 + 转发** | **高** | **高**(预览与转发同模块) | **中**(需发布 intelligent | **中** | **中** | 适合已统一走 intelligent 的客户 |
| **C:仅电梯兜底** | **低**(预览仍需别处算,否则与 UI 不一致) | **中**(易双算法) | **低** | **高** | **低** | 作**兜底**,不宜单独承担预览 |
| **A:仅组织改 `floorList`** | **中** | **中**(与员工权限耦合) | **高**(组织数据治理难) | **高** | **低** | 仅当组织域已区分访客继承列时考虑 |
| **B + C** | **高** | **高** | **低** | **中** | **低** | **大型项目推荐**B 主路径 + C 防直连漏传 |
### 6.3 新租户接入检查清单(SOP)
1. 在空间服务确认 **`zoneId`** 与接待层名称。
2. 在租户策略表插入 **`business_id` + `INTERSECT_ALLOWLIST` + allow_zone_ids**(或走管理端保存)。
3. 第三方 BFF 配置 **Nexus/网关** 指向组织与空间。
4. 跑通 **P0 预览****P5 add/visitor** 自动化用例(覆盖 AC-1~AC-7)。
5. 培训租户管理员:**改策略会影响后续新单**;进行中单据策略见 §2.7。
---
## 7. 实施路线(建议阶段)
| 阶段 | 内容 | 产出 |
|------|------|------|
| **0** | 盘点所有 `add/visitor` 入口;登记页是否已有 `detail` 调用 | 调用方与数据项缺口表 |
| **1** | 定稿:§2.3 数据项表 + §2.7 策略变更策略 + AC-6/7 | PRD、接口契约 |
| **2** | 实现 BFF 聚合初始化 + 登记快照 + P5 显式 `floorIds` | 广发基金类租户上线 |
| **3** | 可选:电梯空列表校验 + C/D 兜底 + 监控 | 零 NPE、直连防护 |
---
## 8. 测试用例矩阵(摘录)
| ID | 阶段 | 条件 | 期望 |
|----|------|------|------|
| T0 | P0 | 被访人无 `floorList` | 预览失败,禁止提交 |
| T1 | P0→P5 | INTERSECT,有交集 | 预览与开通均为交集 |
| T6 | P0→P5 | 审批期间策略变更 + 冻结快照 | 开通结果与提交时预览一致 |
| T7 | P0 | 仅前端改楼层展示 | 服务端拒绝或覆盖(AC-7) |
(原 T1~T5 矩阵仍适用于纯开通层逻辑,可与上表合并维护。)
---
## 9. 文档版本与维护
| 项目 | 内容 |
|------|------|
| 输出路径 | `docs/business/租户访客默认楼层技术产品方案.md` |
| 依据代码 | `maven-cw-elevator-application``maven-intelligent-cwoscomponent`;闭环 P4 依赖组织访客 API(仓外) |
| 修订触发 | 登记页字段增减;`person/detail` 字段变更;`add/visitor` 契约变更 |
---
*本文档为方案级输出;组织人员检索、访客建档等接口以实际部署与网关路由为准。表结构与路径在实施前需经安全评审。*
@@ -0,0 +1,323 @@
# 访客注册与派梯楼层:完整业务流程走查
> **范围说明**:本文基于当前反编译工作区内的源码(`maven-cw-elevator-application`、`maven-intelligent-cwoscomponent` 等)梳理**接口调用链、业务逻辑与用例**。
> **访客业务后台**(如「轻舟 / intelligent/three」访客注册、审批流)若不在本仓库,文中以「第三方业务系统」统称,并标明本仓库可见的**被调接口**与**出站 Feign/HTTP**。
---
## 1. 术语与角色
| 术语 | 含义 |
|------|------|
| 第三方业务系统 | 访客注册、邀约、审批等上层应用;可经 intelligent 组件或直接调电梯服务 |
| 组织人员服务 | `ninca-common-component-organization`(可配置),提供人员详情、图库人员绑定等 |
| 空间/区域服务 | `ninca-common``/sysetting/zone`,提供楼栋-楼层树、分区 page |
| 电梯应用 | `cw-elevator-application`,维护派梯规则 `image_rule_ref`、设备图库绑定等 |
| 被访人 | `personId`,组织侧人员主键 |
| 访客 | `visitorId`,组织侧访客人员主键 |
| 楼层 | 以 **分区/空间 ID**`zoneId` / `floorId`)表示,与 `PersonResult.floorList` 元素一致 |
---
## 2. 业务总览(从「默认楼层」到「指定楼层」)
```mermaid
flowchart TB
subgraph third [第三方业务系统]
A[访客注册/邀约完成]
B{是否已知具体楼层 zoneId 列表?}
C[调组织服务拉人员详情]
D[组装 floorIds 显式列表]
end
subgraph org [组织人员服务 ninca-common-component-organization]
P["POST /component/person/detail"]
I["POST /component/imagestore/person/batchBind 等"]
end
subgraph intel [intelligent-cwoscomponent-rest 可选]
E["ElevatorPersonService.addVisitor → Feign"]
end
subgraph elev [电梯 cw-elevator-application]
F["POST /elevator/person/add/visitor"]
G["PersonRuleServiceImpl.addVisitor"]
end
A --> B
B -->|否 需默认| C
C --> P
P -->|PersonResult.floorList| third
B -->|是 或 已补全| D
D --> E
C --> E
E --> F
F --> G
G -->|缺 floorIds 时内部再调 P 取 floorList| P
G --> I
```
**要点**
- 「**默认有哪些楼层**」在本仓库电梯侧的实现是:**未传 `floorIds` 时**,调用 **`PersonService.detail`**Feign → **`POST /component/person/detail`**),取 **`PersonResult.getFloorList()`****不是** `PersonResult.defaultFloor` 单字段。
- 「**第三方设定具体楼层**」:**在请求体中携带非空的 `floorIds`** 调用 **`POST /elevator/person/add/visitor`**(或经 `ElevatorPersonService` 转发),电梯侧**不再**调人员详情补楼层。
---
## 3. 流程 A:第三方如何获知「默认」楼层(可走的接口)
第三方若**自行**在注册前展示「被访人默认可达楼层」,应在**组织侧**完成数据拉取;本仓库可见的**权威数据源**为人员详情返回的 **`floorList`**(及可能同时返回的 `defaultFloor``floorInfoList` 等,但电梯访客派梯**仅用** `floorList` 补全逻辑)。
### 3.1 推荐:人员详情(与电梯补全逻辑一致)
| 项目 | 内容 |
|------|------|
| 调用方 | 任意有权限的服务;intelligent 中为 `RestPersonServiceImpl``PersonFeignClient` |
| 服务名配置 | `${feign.component-organization.name:ninca-common-component-organization}` |
| HTTP | **`POST /component/person/detail`** |
| 请求体 | `PersonDetailParam``id` = 被访人 `personId``businessId` = 机构 |
| 响应 | `CloudwalkResult<PersonResult>`,关注 **`floorList`**`List<String>` 楼层/分区 ID |
代码位置(Feign 声明):
```19:32:maven-intelligent-cwoscomponent/intelligent-cwoscomponent-rest/src/main/java/cn/cloudwalk/rest/cwoscomponent/intelligent/person/feign/PersonFeignClient.java
@FeignClient(name = "${feign.component-organization.name:ninca-common-component-organization}",
path = "/component/person", fallback = PersonFeignClientFallback.class)
public interface PersonFeignClient {
...
@RequestMapping(value = {"/detail"}, method = {RequestMethod.POST})
CloudwalkResult<PersonResult> detail(@RequestBody PersonDetailParam paramPersonDetailParam);
```
`PersonResult` 中与楼层相关的字段(电梯 `addVisitor` **补全时只用 `floorList`**):
```27:34:maven-intelligent-cwoscomponent/intelligent-cwoscomponent-interface/src/main/java/cn/cloudwalk/client/cwoscomponent/intelligent/person/result/PersonResult.java
private String defaultFloor;
private String chooseFloor;
private List<String> floorList;
private List<AcsPassRuleImageResultDto> floorInfoList;
...
private String defaultChooseFloor;
```
### 3.2 辅助:空间树 / 楼层分页(电梯网关或管理端常用)
| 项目 | 内容 |
|------|------|
| Feign | `ZoneFeignClient` → `${feign.ninca-common.name:ninca-common}` |
| HTTP | **`POST /sysetting/zone/tree`**、**`POST /sysetting/zone/page`** |
| 用途 | 按楼栋展示树、按条件查分区;**不替代**人员已授权楼层列表 |
```16:23:maven-cw-elevator-application/cw-elevator-application-service/src/main/java/cn/cloudwalk/elevator/zone/client/ZoneFeignClient.java
@FeignClient(name = "${feign.ninca-common.name:ninca-common}", path = "/sysetting/zone",
fallback = ZoneFeignClientFallback.class)
public interface ZoneFeignClient {
@RequestMapping(value = {"/tree"}, method = {RequestMethod.POST})
...
@RequestMapping(value = {"/page"}, method = {RequestMethod.POST})
CloudwalkResult<CloudwalkPageAble<ZoneResult>> page(ZoneQueryParam paramZoneQueryParam) throws ServiceException;
}
```
### 3.3 辅助:通行规则-楼层列表(管理派梯规则维度)
| 项目 | 内容 |
|------|------|
| Controller | `AcsPassRuleController` |
| HTTP | **`POST /elevator/passRule/floor`** 等 |
| 用途 | 规则/图库与楼层关系维护与查询;与「人员 floorList」不同维度 |
```45:55:maven-cw-elevator-application/cw-elevator-application-web/src/main/java/cn/cloudwalk/elevator/passrule/controller/AcsPassRuleController.java
@RequestMapping({"/floor"})
public CloudwalkResult<CloudwalkPageAble<AcsPassRuleFloorResult>>
listFloor(@RequestBody AcsPassRuleFloorForm form) {
...
return this.imageRuleRefService.listFloor(param, getCloudwalkContext());
```
### 3.4 访客记录查询(识别访客身份,非楼层来源)
电梯乘梯记录中通过 **RestTemplate** 调 **`intelligent/three/visitor/record/query`**,用于判断是否访客及被访人,**不参与** `addVisitor` 楼层列表计算:
```262:274:maven-cw-elevator-application/cw-elevator-application-service/src/main/java/cn/cloudwalk/elevator/record/impl/AcsElevatorRecordServiceImpl.java
URI uri =
combineAuthClientURI("intelligent/three/visitor/record/query", (MultiValueMap<String, String>)null);
VisitorRecordQueryParam form = new VisitorRecordQueryParam();
form.setVisitorId(addDTO.getRecognitionFaceId());
...
```
另有 Feign **`VisitorFeignClient`**`ninca-crk-std` 的 **`/intelligent/visitor/record/query`**,与上为不同网关路径,同属访客记录查询能力。
---
## 4. 流程 B:第三方设定「具体楼层」并开通访客派梯
### 4.1 对外 HTTP(电梯应用)
| 项目 | 内容 |
|------|------|
| Method / Path | **`POST /elevator/person/add/visitor`** |
| Controller | `AcsPersonController#addVisitor` |
| Body | `AcsPersonAddVisitorForm` → `AcsPersonAddVisitorParam` |
```53:62:maven-cw-elevator-application/cw-elevator-application-web/src/main/java/cn/cloudwalk/elevator/person/controller/AcsPersonController.java
@RequestMapping({"/add/visitor"})
public CloudwalkResult<Boolean> addVisitor(@RequestBody AcsPersonAddVisitorForm form) {
AcsPersonAddVisitorParam param =
(AcsPersonAddVisitorParam)BeanCopyUtils.copyProperties(form, AcsPersonAddVisitorParam.class);
try {
return this.personRuleService.addVisitor(param, getCloudwalkContext());
```
### 4.2 经 intelligent 的 Feign(业务方 SDK 式调用)
| 项目 | 内容 |
|------|------|
| 接口 | `ElevatorPersonService.addVisitor` |
| 实现 | `RestElevatorPersonServiceImpl` |
| Feign | `ElevatorPersonFeignClient` |
| 目标 | `${feign.elevator.name:elevator-app}` **`POST /elevator/person/add/visitor`** |
```11:15:maven-intelligent-cwoscomponent/intelligent-cwoscomponent-rest/src/main/java/cn/cloudwalk/rest/cwoscomponent/intelligent/elevator/feign/ElevatorPersonFeignClient.java
@FeignClient(name = "${feign.elevator.name:elevator-app}", path = "/elevator/person",
fallback = ElevatorPersonFeignClientFallback.class)
public interface ElevatorPersonFeignClient {
@RequestMapping(value = {"/add/visitor"}, method = {RequestMethod.POST})
CloudwalkResult<Boolean> addVisitor(@RequestBody AcsPersonAddVisitorParam paramAcsPersonAddVisitorParam);
```
### 4.3 请求字段语义(用例输入)
| 字段 | 必填性 | 说明 |
|------|--------|------|
| `visitorId` | 是 | 访客在组织侧人员 ID |
| `personId` | 是 | 被访人 ID;**补全楼层时**用于 `detail` |
| `begVisitorTime` / `endVisitorTime` | 视图库接口 | 传入图库绑定有效期 |
| `floorIds` | 否 | **非空**:第三方显式指定可派梯楼层;**空/缺省**:由电梯侧按被访人 **`floorList`** 补全 |
---
## 5. 电梯侧核心业务逻辑:`PersonRuleServiceImpl.addVisitor`
实现类:`PersonRuleServiceImpl``maven-cw-elevator-application/.../PersonRuleServiceImpl.java`)。
### 5.1 步骤分解
| 步骤 | 逻辑 | 外部依赖 |
|------|------|----------|
| 1 | 若 `floorIds` 为空 → `PersonDetailParam(personId, businessId)` → **`personService.detail`** | Feign → **`POST /component/person/detail`**,取 **`getFloorList()`** 赋给 `floorIds` |
| 2 | 用 **`floorIds.get(0)`** 构造 `ZoneQueryParam`**`zoneService.page`** 查分区页,取首条 `ZoneResult` 得 **`parentId`(楼栋)** | Feign → **`POST /sysetting/zone/page`** |
| 3 | **`deviceImageStoreDao.getByBuildingId(parentId)`** 得图库 `imageStoreId` | 本地 DAO |
| 4 | 对 **每个 `floorId`**`imageRuleRefDao.getDefaultByZoneId(floorId)` 取默认通行规则,组装 **`ImageRuleRefAddDto`**(访客 `visitorId` 挂父规则) | 本地 DAO |
| 5 | **`imageRuleRefDao.insertList`** 批量写入派梯规则引用 | 本地 DAO |
| 6 | 组装 **`ImageStorePersonBindParam`**(图库、访客 ID、有效期),**`imageStorePersonService.batchBind`** | Feign → **`POST /component/imagestore/person/batchBind`** |
| 7 | **`imageStorePersonService.updateGroupPersonRef`** 更新组与人员引用 | Feign → **`POST /component/imagestore/person/updateGroupPersonRef`** |
关键代码(补全楼层 + 循环写规则 + 绑图库):
```170:223:maven-cw-elevator-application/cw-elevator-application-service/src/main/java/cn/cloudwalk/elevator/person/impl/PersonRuleServiceImpl.java
if (CollectionUtils.isEmpty(param.getFloorIds())) {
PersonDetailParam detailParam = new PersonDetailParam();
detailParam.setId(param.getPersonId());
detailParam.setBusinessId(context.getCompany().getCompanyId());
CloudwalkResult<PersonResult> detail = this.personService.detail(detailParam, context);
param.setFloorIds(((PersonResult)detail.getData()).getFloorList());
}
ZoneQueryParam zoneQueryParam = new ZoneQueryParam();
zoneQueryParam.setId(param.getFloorIds().get(0));
...
for (String floorId : param.getFloorIds()) {
ImageRuleRefResultDto defaultRule = this.imageRuleRefDao.getDefaultByZoneId(floorId);
...
addDto.setPersonId(param.getVisitorId());
...
}
...
CloudwalkResult<ImgStoreBatchBindPersonResult> bindResult =
this.imageStorePersonService.batchBind(imageStorePersonBindParam, context);
...
this.imageStorePersonService.updateGroupPersonRef(refParam, context);
```
图库 Feign(与上表一致):
```19:41:maven-intelligent-cwoscomponent/intelligent-cwoscomponent-rest/src/main/java/cn/cloudwalk/rest/cwoscomponent/intelligent/imagestore/feign/ImageStorePersonFeignClient.java
@FeignClient(name = "${feign.component-organization.name:ninca-common-component-organization}",
path = "/component/imagestore/person", fallback = ImageStorePersonFeignClientFallback.class)
public interface ImageStorePersonFeignClient {
...
@RequestMapping(value = {"/batchBind"}, method = {RequestMethod.POST})
CloudwalkResult<ImgStoreBatchBindPersonResult>
batchBind(@RequestBody ImageStorePersonBindParam paramImageStorePersonBindParam);
@RequestMapping(value = {"/updateGroupPersonRef"}, method = {RequestMethod.POST})
CloudwalkResult<Boolean>
updateGroupPersonRef(@RequestBody UpdateGroupPersonRefParam paramUpdateGroupPersonRefParam);
```
### 5.2 与「内部员工」派梯开通的对比(非访客)
**`POST /elevator/person/add`** → `PersonRuleServiceImpl.add`:按**单个** `zoneId`(楼层)与 `parentId`(楼栋)给多名 **`personIds`** 写规则并绑图库;**不**调人员 `detail` 取 `floorList`。用于从已有人员批量加通行权限的另一条业务线。
```79:136:maven-cw-elevator-application/cw-elevator-application-service/src/main/java/cn/cloudwalk/elevator/person/impl/PersonRuleServiceImpl.java
public CloudwalkResult<Boolean> add(AcsPersonAddParam param, CloudwalkCallContext context) throws ServiceException {
...
ImageRuleRefResultDto defaultRule = this.imageRuleRefDao.getDefaultByZoneId(param.getZoneId());
...
for (String personId : param.getPersonIds()) {
...
addDto.setZoneId(param.getZoneId());
```
---
## 6. 接口调用流转汇总表
| 序号 | 调用方向 | 协议与路径 | 典型触发 |
|------|----------|------------|----------|
| 1 | 第三方 / intelligent → 电梯 | `POST /elevator/person/add/visitor` | 访客开通派梯 |
| 2 | 电梯 → 组织 | `POST /component/person/detail` | `floorIds` 为空时补全 |
| 3 | 电梯 → 空间 | `POST /sysetting/zone/page` | 取楼层所属楼栋 |
| 4 | 电梯 → 组织 | `POST /component/imagestore/person/batchBind` | 访客绑图库 |
| 5 | 电梯 → 组织 | `POST /component/imagestore/person/updateGroupPersonRef` | 更新组人关系 |
| 6 | 第三方自行(可选) | `POST /component/person/detail` | 注册前展示默认可达楼层 |
| 7 | 管理端(可选) | `POST /elevator/passRule/floor` 等 | 规则/楼层维护 |
| 8 | 电梯 → 网关 HTTP | `POST intelligent/three/visitor/record/query` | 乘梯记录识别访客 |
---
## 7. 用例(UC)说明
| 用例 ID | 名称 | 前置条件 | 主流程 | 期望结果 |
|---------|------|----------|--------|----------|
| UC-01 | 访客派梯-使用被访人默认楼层列表 | 被访人 `personId` 在组织侧 `detail` 返回**非空** `floorList`;访客已注册 | 调 `add/visitor` 且 **不传 `floorIds`** | 电梯取 `floorList` 为访客写入各层默认规则并绑图库 |
| UC-02 | 访客派梯-第三方指定楼层 | `floorIds` 为合法 zoneId 列表 | 调 `add/visitor` 且 **传入 `floorIds`** | **不再**调 `person/detail` 补楼层;按列表写规则 |
| UC-03 | 注册前展示「可访楼层」 | 需与被访人授权一致 | 第三方先调 **`/component/person/detail`**,展示 `floorList`(或产品定义的 `defaultFloor` 映射) | UI 与电梯补全逻辑对齐(若仅用 `defaultFloor` 需与产品确认是否与 `floorList` 一致) |
| UC-04 | `floorList` 为空 | 被访人无派梯楼层 | `add/visitor` 不传 `floorIds` | `floorIds` 仍为空 → 后续 `get(0)` 等**可能异常**;第三方应校验或传显式楼层 |
| UC-05 | 内部人员加单层派梯 | 已知 `zoneId`、楼栋 `parentId` | `POST /elevator/person/add` | 单层规则 + 图库绑定 |
| UC-06 | 乘梯记录标记访客 | 识别到人脸 | 记录服务调 **`visitor/record/query`** | 回填 `isVisitor`、被访人 |
**扩展(租户访客默认楼层)**:若需「在 UC-01 不传 `floorIds` 的前提下,按租户策略收敛访客楼层(如默认仅开放某接待层)」的产品与技术设计,以及**从第三方登记页初始化数据项、接口编排到 `add/visitor` 的端到端闭环**,见 [租户访客默认楼层技术产品方案](租户访客默认楼层技术产品方案.md)(文中 **§2**)。
---
## 8. 风险与待确认项(走查结论)
1. **`PersonResult.defaultFloor` 与 `floorList`**:电梯 `addVisitor` **仅使用 `floorList`**。若产品「默认访问楼层」对应 `defaultFloor` 标量,需核对组织服务是否在 `detail` 中把二者对齐,否则存在**语义偏差**。
2. **`floorIds.get(0)`**:补全后若列表为空,会在取首元素时失败;第三方或组织数据需保证一致性。
3. **`cwos-sdk-event` 等**与本文无关的依赖问题不影响本业务链结论。
4. **访客注册主流程**(表单、审批、写组织人员表)若在三方工程,需在对应仓库继续搜 **`ElevatorPersonService`**、**`addVisitor`**、**`/elevator/person/add/visitor`** 的引用以闭合「从注册到派梯」的端到端文档。
---
## 9. 文档版本信息
| 项目 | 内容 |
|------|------|
| 输出路径 | `docs/business/访客注册与派梯楼层业务流程走查.md` |
| 依据代码根目录 | `maven-cw-elevator-application`、`maven-intelligent-cwoscomponent` |
| 说明 | 外部服务行为以接口契约为准,组织服务内部如何组装 `floorList` 需在 **ninca-common-component-organization** 源码中二次走查 |
---
*本文档由代码走查自动生成梳理,若接口路径随部署配置变化,请以运行环境 `application*.yml` 中 `feign.*` 为准。*
+150
View File
@@ -0,0 +1,150 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
将 cw-elevator-application-V1.0.0.20211103/lib 下全部 JAR 作为初始构件上传到 Nexus。
脚本位置:docs/operations/deploy_cw_elevator_v1_lib_to_nexus.py(与文档同目录,便于运维查找)。
规则:
1. 若 JAR 内含 META-INF/maven/**/pom.properties,则使用其中的 groupId / artifactId / version。
2. 否则使用后备坐标:cn.cloudwalk.elevator.v1.bootlib:<文件名去 .jar>:V1.0.0.20211103
(保证与 Maven Central 坐标不冲突,且一文件一构件。)
version 含 SNAPSHOT 时上传到 maven-snapshots,否则 maven-releases。
需 ~/.m2/settings.xml 中配置 server idnexus-releases、nexus-snapshots(与 URL 对应)。
"""
from __future__ import annotations
import argparse
import os
import subprocess
import sys
import zipfile
from pathlib import Path
DEFAULT_LIB = Path(
"/media/zebra/9e8fa357-7db6-4d70-88ed-d5de5a059a663/星河湾星中星/反编译"
"/cw-elevator-application-V1.0.0.20211103/lib"
)
RELEASES_URL = "http://192.168.3.12:8081/repository/maven-releases/"
SNAPSHOTS_URL = "http://192.168.3.12:8081/repository/maven-snapshots/"
RELEASES_ID = "nexus-releases"
SNAPSHOTS_ID = "nexus-snapshots"
FALLBACK_GROUP = "cn.cloudwalk.elevator.v1.bootlib"
FALLBACK_VERSION = "V1.0.0.20211103"
def read_maven_coords(jar: Path) -> tuple[str, str, str] | None:
try:
with zipfile.ZipFile(jar, "r") as zf:
for name in zf.namelist():
if name.endswith("pom.properties") and "META-INF/maven" in name.replace(
"\\", "/"
):
raw = zf.read(name).decode("utf-8", errors="replace")
props: dict[str, str] = {}
for line in raw.splitlines():
line = line.strip()
if not line or line.startswith("#") or "=" not in line:
continue
k, _, v = line.partition("=")
props[k.strip()] = v.strip()
gid = props.get("groupId")
aid = props.get("artifactId")
ver = props.get("version")
if gid and aid and ver:
return gid, aid, ver
except (zipfile.BadZipFile, OSError):
return None
return None
def fallback_coords(jar: Path) -> tuple[str, str, str]:
stem = jar.name[:-4] if jar.name.lower().endswith(".jar") else jar.name
return FALLBACK_GROUP, stem, FALLBACK_VERSION
def is_snapshot_version(version: str) -> bool:
return "SNAPSHOT" in version.upper()
def deploy_one(
jar: Path,
group_id: str,
artifact_id: str,
version: str,
dry_run: bool,
) -> int:
url = SNAPSHOTS_URL if is_snapshot_version(version) else RELEASES_URL
rid = SNAPSHOTS_ID if is_snapshot_version(version) else RELEASES_ID
cmd = [
"mvn",
"-q",
"deploy:deploy-file",
f"-DrepositoryId={rid}",
f"-Durl={url}",
f"-Dfile={jar}",
f"-DgroupId={group_id}",
f"-DartifactId={artifact_id}",
f"-Dversion={version}",
"-Dpackaging=jar",
"-DgeneratePom=true",
]
if dry_run:
print("DRY-RUN:", " ".join(cmd))
return 0
r = subprocess.run(cmd, capture_output=True, text=True)
if r.returncode != 0:
combined = (r.stdout or "") + (r.stderr or "")
# Nexus maven-releases 对已存在 release 坐标禁止覆盖
if "cannot be updated" in combined:
print(f"SKIP (already in repo): {jar.name} -> {group_id}:{artifact_id}:{version}")
return 0
sys.stderr.write(f"FAIL {jar.name} -> {group_id}:{artifact_id}:{version}\n")
if r.stdout:
sys.stderr.write(r.stdout)
if r.stderr:
sys.stderr.write(r.stderr)
return r.returncode
def main() -> int:
p = argparse.ArgumentParser(description="Deploy all JARs from elevator V1 lib to Nexus.")
p.add_argument(
"--lib",
type=Path,
default=DEFAULT_LIB,
help="Directory containing .jar files",
)
p.add_argument("--dry-run", action="store_true", help="Print mvn commands only")
args = p.parse_args()
lib: Path = args.lib
if not lib.is_dir():
print("Not a directory:", lib, file=sys.stderr)
return 2
jars = sorted(lib.glob("*.jar"))
if not jars:
print("No JAR files in", lib, file=sys.stderr)
return 2
ok, fail = 0, 0
for i, jar in enumerate(jars, 1):
coords = read_maven_coords(jar)
if coords:
gid, aid, ver = coords
src = "embedded"
else:
gid, aid, ver = fallback_coords(jar)
src = "fallback"
print(f"[{i}/{len(jars)}] {jar.name} -> {gid}:{aid}:{ver} ({src})")
rc = deploy_one(jar, gid, aid, ver, args.dry_run)
if rc == 0:
ok += 1
else:
fail += 1
print(f"Done. ok={ok} fail={fail}")
return 0 if fail == 0 else 1
if __name__ == "__main__":
sys.exit(main())
+603
View File
@@ -0,0 +1,603 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles version="12">
<profile kind="CodeFormatterProfile" name="P3C-CodeStyle" version="13">
<!--可变参数的... Idea没有对应的配置项,强制insert-->
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
<!--枚举值之间 Idea没有对应的配置项,强制insert-->
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
<!--org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=Java:SPACE_BEFORE_COMMA-->
<!--org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=Java:SPACE_BEFORE_COMMA
由于IDEA只有一个SPACE_BEFORE_COMMA选项,所以统一设置 insert_space_before_comma 为 do not insert
-->
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations"
value="do not insert"/>
<!--insert_space_before_comma end-->
<!--org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=Java:SPACE_AFTER_COMMA_IN_TYPE_ARGUMENTS-->
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
<!--IDEA只有一个配置项SPACE_AFTER_COMMAinsert_space_after_comma*统一设置成insert-->
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters"
value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations"
value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments"
value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference"
value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations"
value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments"
value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws"
value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters"
value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws"
value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments"
value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
<!--insert_space_after_comma end-->
<!--org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=Java:SPACE_BEFORE_COLON-->
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/>
<!--org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=Java:SPACE_AFTER_COLON-->
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
<!--IDEA不支持配置,默认do not insert-->
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
<!--这个在Eclipse也没有找到配置的地方-->
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="do not insert"/>
<!--org.eclipse.jdt.core.formatter.insert_space_before_semicolon=Java:SPACE_BEFORE_SEMICOLON
程序导入的时候强制将SPACE_BEFORE_SEMICOLON设置为false
-->
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
<!--SPACE_AFTER_SEMICOLON=true-->
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources" value="insert"/>
<!--IDEA不支持配置,do not insert-->
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant"
value="do not insert"/>
<setting
id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration"
value="do not insert"/>
<!--IDEA不支持,使用默认-->
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
<!--org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=Java:<Programmatic>-->
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_binary_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_binary_operator" value="insert"/>
<!--IDEA不支持配置,使用如下值,两者对应-->
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters"
value="insert"/>
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments"
value="do not insert"/>
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters"
value="do not insert"/>
<!--Java:SPACE_BEFORE_OPENING_ANGLE_BRACKET_IN_TYPE_PARAMETER-->
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters"
value="do not insert"/>
<!--org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=Java:SPACE_AFTER_CLOSING_ANGLE_BRACKET_IN_TYPE_ARGUMENT-->
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments"
value="do not insert"/>
<!--org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=Java:<Programmatic>-->
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
<!--IDEA使用了对应的配置:Java:SPACE_WITHIN_ARRAY_INITIALIZER_BRACES,但感觉不太好,IDEA默认不插入,Eclipse也使用不插入-->
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer"
value="do not insert"/>
<!--use default insert-->
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return"
value="insert"/>
<!--use default do not insert -->
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
<!--use default insert-->
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration"
value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration"
value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration"
value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration"
value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw"
value="insert"/>
<!--org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=Java:SPACE_BEFORE_SWITCH_LBRACE-->
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
<!--org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=Java:SPACE_BEFORE_CLASS_LBRACE-->
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration"
value="insert"/>
<!--org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=Java:<Programmatic>-->
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
<!--org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=Java:SPACE_BEFORE_ARRAY_INITIALIZER_LBRACE-->
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer"
value="insert"/>
<!--org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=Java:SPACE_BEFORE_METHOD_LBRACE-->
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration"
value="insert"/>
<!--org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=Java:SPACE_AFTER_QUEST-->
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
<!--org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=Java:SPACE_BEFORE_QUEST-->
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
<!--org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=Java:SPACE_BEFORE_ANOTATION_PARAMETER_LIST-->
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation"
value="do not insert"/>
<!--use default do not insert-->
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference"
value="do not insert"/>
<!--下面两个对应IDEA中的一个配置Java:SPACE_AROUND_ASSIGNMENT_OPERATORS,使用insert-->
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/>
<!--org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=Java:SPACE_BEFORE_CATCH_PARENTHESES-->
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/>
<!--org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=Java:SPACE_BEFORE_METHOD_CALL_PARENTHESES-->
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation"
value="do not insert"/>
<!--org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=Java:SPACE_BEFORE_TRY_PARENTHESES-->
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try" value="insert"/>
<!--下面两个对应IDEA中的一个配置Java:SPACE_AROUND_UNARY_OPERATOR,使用do not insert-->
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
<!--org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=Java:SPACE_BEFORE_IF_PARENTHESES-->
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
<!--org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=Java:SPACE_BEFORE_WHILE_PARENTHESES-->
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/>
<!--org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=Java:SPACE_AFTER_TYPE_CAST-->
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="do not insert"/>
<!--org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=Java:SPACE_BEFORE_METHOD_PARENTHESES-->
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration"
value="do not insert"/>
<!--org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=Java:SPACE_BEFORE_FOR_PARENTHESES-->
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/>
<!--org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=Java:SPACE_BEFORE_SYNCHRONIZED_PARENTHESES-->
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/>
<!--org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=Java:SPACE_BEFORE_SWITCH_PARENTHESES-->
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/>
<!--下面两个对应IDEA中的一个配置Java:SPACE_AROUND_LAMBDA_ARROW,使用insert-->
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow" value="insert"/>
<!--SPACE_WITHIN_EMPTY_ARRAY_INITIALIZER_BRACES-->
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer"
value="do not insert"/>
<!--Idea -> Wrapping And Braces -> Simple classes in one line -->
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration" value="do not insert"/>
<!--Idea -> Wrapping And Braces -> Simple method in one line -->
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body" value="do not insert"/>
<!--因为Idea不支持配置,所以设置为 Idea默认值-->
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_label" value="insert"/>
<!--Idea可以通过Wrap Always实现 TODO-->
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" value="insert"/>
<!--Idea -> Wrapping And Braces -> Simple block in one line -> do not select -->
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block" value="insert"/>
<!--Idea -> Wrapping And Braces -> try statement -> catch.... (Java:CATCH_ON_NEW_LINE)-->
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement"
value="do not insert"/>
<!--org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=<Programmatic>-->
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/>
<!--org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=Java:ARRAY_INITIALIZER_RBRACE_ON_NEXT_LINE-->
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer"
value="do not insert"/>
<!--#org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=Java:ARRAY_INITIALIZER_LBRACE_ON_NEXT_LINE-->
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer"
value="do not insert"/>
<!--org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=Java:ELSE_ON_NEW_LINE-->
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/>
<!--org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=Java:WHILE_ON_NEW_LINE-->
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement"
value="do not insert"/>
<!--org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=Java:FINALLY_ON_NEW_LINE-->
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement"
value="do not insert"/>
<!--comment start-->
<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="120"/>
<!--ENABLE_JAVADOC_FORMATTING-->
<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/>
<!--org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=<Programmatic>-->
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/>
<!--IDEA无对应设置,所以关闭对block comment的格式化 -->
<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="true"/>
<!--org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=Java:KEEP_FIRST_COLUMN_COMMENT-->
<setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/>
<!--org.eclipse.jdt.core.formatter.use_on_off_tags=FORMATTER_TAGS_ENABLED-->
<setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="true"/>
<!--org.eclipse.jdt.core.formatter.disabling_tag=FORMATTER_OFF_TAG-->
<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
<!--org.eclipse.jdt.core.formatter.enabling_tag=FORMATTER_ON_TAG-->
<setting id="org.eclipse.jdt.core.formatter.enabling_tag" value="@formatter:on"/>
<!--下面的没有IDEA对应项,在代码里面对IDEA中使用默认值即可,LINE_COMMENT_AT_FIRST_COLUMN BLOCK_COMMENT_AT_FIRST_COLUMN设置为false-->
<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments"
value="false"/>
<setting id="org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="true"/>
<!--和IDEA保持一致,注释换行-->
<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="do not insert"/>
<!--comment end-->
<!--org.eclipse.jdt.core.formatter.blank_lines_after_imports=Java:BLANK_LINES_AFTER_IMPORTS-->
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/>
<!--org.eclipse.jdt.core.formatter.blank_lines_before_imports=Java:BLANK_LINES_BEFORE_IMPORTS-->
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/>
<!--org.eclipse.jdt.core.formatter.blank_lines_after_package=Java:BLANK_LINES_AFTER_PACKAGE-->
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/>
<!--org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=Java:BLANK_LINES_AROUND_CLASS-->
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/>
<!--org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=Java:BLANK_LINES_BEFORE_METHOD_BODY-->
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/>
<!--org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=Java:<Programmatic>-->
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="0"/>
<!--org.eclipse.jdt.core.formatter.blank_lines_before_field=Java:BLANK_LINES_AROUND_FIELD-->
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/>
<!--org.eclipse.jdt.core.formatter.blank_lines_before_method=Java:BLANK_LINES_AROUND_METHOD-->
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/>
<!--org.eclipse.jdt.core.formatter.blank_lines_before_package=Java:BLANK_LINES_BEFORE_PACKAGE-->
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/>
<!--下面IDEA没有对应设置,使用对应值即可-->
<setting id="org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines" value="2147483647"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/>
<!--org.eclipse.jdt.core.formatter.indentation.size=Java:IndentOptions:INDENT_SIZE-->
<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/>
<!--org.eclipse.jdt.core.formatter.continuation_indentation=Java:IndentOptions:<Programmatic>-->
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="1"/>
<!--org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=Java:<Programmatic>-->
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
<!--org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=Java:IndentOptions:SMART_TABS-->
<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
<!--org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=Java:INDENT_CASE_FROM_SWITCH-->
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="true"/>
<!--KEEP_INDENTS_ON_EMPTY_LINES-->
<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/>
<!--org.eclipse.jdt.core.formatter.tabulation.size=Java:IndentOptions:<Programmatic>-->
<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/>
<!--Java:IndentOptions:<Programmatic>-->
<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/>
<!--下面IDEA没有对应设置,使用对应值即可-->
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header"
value="true"/>
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header"
value="true"/>
<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header"
value="true"/>
<!--Java:<Programmatic>-->
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_binary_expression" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/>
<!--下面没有对应的IDEA设置,Eclipse先使用对应值-->
<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_parameters" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_arguments" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression"
value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header" value="16"/>
<!--IDEA默认配置在同一行,Eclipse使用对应值即可-->
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration"
value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration" value="common_lines"/>
<!--Java:BINARY_OPERATION_SIGN_ON_NEXT_LINE-->
<setting id="org.eclipse.jdt.core.formatter.wrap_before_binary_operator" value="true"/>
<!--ASSIGNMENT_WRAP 需要设置为 WRAP_AS_NEEDED WRAP_AS_NEEDED . Add in jdt.core-3.12it's not work in previous version -->
<setting id="org.eclipse.jdt.core.formatter.wrap_before_assignment_operator" value="false"/>
<!--IDEA无配置项,Eclipse使用对应值即可-->
<setting id="org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_conditional_operator" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="false"/>
<!--org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=Java:KEEP_CONTROL_STATEMENT_IN_ONE_LINE-->
<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
<!--org.eclipse.jdt.core.formatter.compact_else_if=Java:SPECIAL_ELSE_IF_TREATMENT-->
<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/>
<!--Java:ALIGN_GROUP_FIELD_DECLARATIONS-->
<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
<!--Java:<Programmatic>-->
<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="true"/>
<!--统一为end_of_lintIDEA默认一致-->
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_lambda_body" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration"
value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="end_of_line"/>
<!-- <setting id="org.eclipse.jdt.core.compiler.source" value="1.8"/>
<setting id="org.eclipse.jdt.core.compiler.compliance" value="1.8"/>
<setting id="org.eclipse.jdt.core.compiler.codegen.targetPlatform" value="1.8"/>
<setting id="org.eclipse.jdt.core.compiler.problem.enumIdentifier" value="error"/>
<setting id="org.eclipse.jdt.core.compiler.problem.assertIdentifier" value="error"/>
<setting id="org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode" value="enabled"/>
-->
<!--Java:KEEP_SIMPLE_BLOCKS_IN_ONE_LINE-->
<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/>
<!--Java:CLASS_BRACE_STYLE,统一使用end_of_line TODO-->
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="end_of_line"/>
<!--org.eclipse.jdt.core.formatter.lineSplit=RIGHT_MARGIN-->
<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="120"/>
</profile>
</profiles>
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.18.RELEASE</version>
<relativePath/>
</parent>
<groupId>cn.cloudwalk.cloud</groupId>
<artifactId>cloudwalk-cloud-common</artifactId>
<version>3.7.2-Brussels-SRX</version>
<packaging>pom</packaging>
<name>cloudwalk-cloud-common (stub parent)</name>
<description>与历史/私服已发布 JAR 中声明的 parent 对齐;反编译聚合工程见 cloudwalk-cloud-decompiled-reactor。</description>
</project>
@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>cn.cloudwalk.cloud</groupId>
<artifactId>cloudwalk-cloud-decompiled-reactor</artifactId>
<version>3.7.2-Brussels-SRX</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>cloudwalk-common-event</artifactId>
<packaging>jar</packaging>
<description>云从科技-消息总线封装(源码已迁入本模块 src/main/java</description>
<properties>
<alibaba.eclipse.codestyle.path>${project.basedir}/../../docs/style/alibaba-eclipse-codestyle.xml</alibaba.eclipse.codestyle.path>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
</dependency>
<dependency>
<groupId>cn.cloudwalk.cloud</groupId>
<artifactId>cwos-sdk-event</artifactId>
<!-- 旧版 cwos-sdk-event POM 依赖 reflections-maven,会解析到 JFrog 已下线构件,编译不需要 -->
<exclusions>
<exclusion>
<groupId>org.reflections</groupId>
<artifactId>reflections-maven</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>net.revelc.code.formatter</groupId>
<artifactId>formatter-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
@@ -0,0 +1,361 @@
package cn.cloudwalk.event;
import cn.cloudwalk.cwos.client.event.EventClient;
import cn.cloudwalk.cwos.client.event.event.BaseEvent;
import cn.cloudwalk.cwos.client.event.event.CustomEvent;
import cn.cloudwalk.cwos.client.event.event.EventType;
import cn.cloudwalk.cwos.client.event.handler.EventListener;
import cn.cloudwalk.event.annotation.ConsumerGroup;
import cn.cloudwalk.event.annotation.CustomTopic;
import cn.cloudwalk.event.annotation.EventTopicSuffix;
import cn.cloudwalk.event.autoconfig.EventProperties;
import cn.cloudwalk.event.handler.CustomEventHandler;
import cn.cloudwalk.event.handler.EventHandler;
import cn.cloudwalk.event.handler.EventHandlerMapping;
import cn.cloudwalk.event.handler.EventHandlerWorker;
import cn.cloudwalk.event.handler.NamedThreadFactory;
import cn.cloudwalk.event.listener.CloudwalkEventListener;
import cn.cloudwalk.event.listener.GroupEventListener;
import cn.cloudwalk.event.listener.GroupListnerClassMapping;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.context.ApplicationContext;
import org.springframework.core.env.Environment;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
/**
* 应用启动阶段扫描 Spring 容器中的监听器与处理器,构建 {@link cn.cloudwalk.event.handler.EventHandlerMapping} 等运行时结构。
*/
public class CloudwalkEventInitializing implements CommandLineRunner {
private static final Logger LOGGER = LoggerFactory.getLogger(CloudwalkEventInitializing.class);
@Autowired(required = false)
private List<EventHandler> eventHandlers;
@Autowired
private CloudwalkEventManager cloudwalkEventManager;
@Autowired
private Environment environment;
private static final Pattern pattern = Pattern.compile("^\\$\\{(.*?)\\}$");
private static final String DEFAULT_SUFFIX = "";
private String defaultGroup;
private EventClient defaultEventClient;
private Map<String, EventClient> eventClientMap = new HashMap<>();
private EventProperties eventProperties;
private static boolean isHandlerEnable = false;
public void run(String... args) throws Exception {
init();
}
public void init() throws Exception {
initEventClient();
initHandlerMapping();
initHandlerExecutor();
subscribeEvent();
}
public CloudwalkEventInitializing(EventProperties eventProperties) {
this.eventProperties = eventProperties;
}
private void initEventClient() throws ClassNotFoundException {
String[] groupIds = this.eventProperties.getGroupId().split(",");
if (groupIds.length == 0) {
throw new IllegalArgumentException("消费组ID不能为空");
}
Map<String, String> listenerClassMap = this.eventProperties.getListenerClass();
GroupListnerClassMapping groupListnerClassMapping = new GroupListnerClassMapping();
for (int i = 0; i < groupIds.length; i++) {
Class<? extends EventListener> listenerClass;
boolean isFirst = (i == 0);
String groupId = groupIds[i];
if (null == listenerClassMap || StringUtils.isEmpty(listenerClassMap.get(groupId))) {
if (isFirst) {
listenerClass = CloudwalkEventListener.class;
} else {
throw new IllegalArgumentException(
String.format("groupId[%s]缺少listener-class的配置", new Object[] {groupId}));
}
} else {
listenerClass = (Class)Class.forName(listenerClassMap.get(groupId));
}
initEventClient(this.eventProperties.getBootstrapServers(), groupId, listenerClass, isFirst);
groupListnerClassMapping.register(listenerClass, groupId);
}
this.cloudwalkEventManager.setGroupListnerClassMapping(groupListnerClassMapping);
this.cloudwalkEventManager.setEventClient(this.defaultEventClient);
}
@Autowired
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
GroupEventListener.applicationContext = applicationContext;
}
private List<String> extractGroupIds(EventHandler eventHandler) {
if (eventHandler.getClass().isAnnotationPresent((Class)ConsumerGroup.class)) {
ConsumerGroup consumerGroup = eventHandler.getClass().<ConsumerGroup>getAnnotation(ConsumerGroup.class);
List<String> groupIds = new LinkedList<>();
for (String groupId : consumerGroup.groupIds()) {
Matcher matcher = pattern.matcher(groupId);
if (matcher.find()) {
String propertyKey = groupId.substring(2, groupId.length() - 1).trim();
String propertyValue = this.environment.getProperty(propertyKey);
if (!StringUtils.isEmpty(propertyValue)) {
groupId = propertyValue;
}
}
groupIds.add(groupId);
}
return groupIds;
}
return new ArrayList<>(Collections.singletonList(this.defaultGroup));
}
private void initHandlerMapping() {
if (CollectionUtils.isEmpty(this.eventHandlers)) {
return;
}
isHandlerEnable = true;
EventHandlerMapping eventHandlerMapping = new EventHandlerMapping();
for (EventHandler<BaseEvent> handler : this.eventHandlers) {
if (handler.getClass().isAnnotationPresent((Class)EventTopicSuffix.class)) {
Type type = handler.getClass().getGenericInterfaces()[0];
ParameterizedType p = (ParameterizedType)type;
Class<BaseEvent> eventClass = (Class)p.getActualTypeArguments()[0];
EventTopicSuffix eventTopicSuffix =
handler.getClass().<EventTopicSuffix>getAnnotation(EventTopicSuffix.class);
registerHandlerMapping(eventHandlerMapping, handler, eventClass, eventTopicSuffix.value());
continue;
}
if (handler.getClass().isAnnotationPresent((Class)CustomTopic.class)) {
CustomTopic customTopic = handler.getClass().<CustomTopic>getAnnotation(CustomTopic.class);
String topic = customTopic.topic();
if (StringUtils.isEmpty(topic)) {
continue;
}
registerCustomHandlerMapping(eventHandlerMapping, (EventHandler)handler, topic, customTopic.suffix());
}
}
this.cloudwalkEventManager.setEventHandlerMapping(eventHandlerMapping);
}
private void initHandlerExecutor() {
if (isHandlerEnable) {
EventHandlerWorker eventHandlerWorker = new EventHandlerWorker();
EventProperties.HandlerExecutorConfig handlerExecutorConfig =
this.eventProperties.getHandlerExecutorConfig();
eventHandlerWorker
.setPoolExecutor(new ThreadPoolExecutor(handlerExecutorConfig.getCorePoolSize().intValue(),
handlerExecutorConfig.getMaximumPoolSize().intValue(), 1000L, TimeUnit.MILLISECONDS,
new SynchronousQueue<>(),
(ThreadFactory)new NamedThreadFactory(this.eventProperties.getWorkerNamePrefix()),
new ThreadPoolExecutor.CallerRunsPolicy()));
this.cloudwalkEventManager.setEventHandlerWorker(eventHandlerWorker);
}
}
private EventType getEventType(Class<? extends BaseEvent> eventClass) {
for (EventType eventType : EventType.values()) {
if (eventType.getEventClass().getClass().equals(eventClass)) {
return eventType;
}
}
return null;
}
private void subscribeEvent() throws IllegalAccessException, InstantiationException {
EventHandlerMapping eventHandlerMapping = this.cloudwalkEventManager.getEventHandlerMapping();
Map<String, Map<EventType, Set<String>>> subscribedMap = new HashMap<>();
for (Map.Entry<String, Map<EventType, Map<String, List<EventHandler>>>> entry : (Iterable<
Map.Entry<String, Map<EventType, Map<String, List<EventHandler>>>>>)eventHandlerMapping.getHandlerMap()
.entrySet()) {
for (Map.Entry<EventType, Map<String, List<EventHandler>>> eventTypeMapEntry : (Iterable<
Map.Entry<EventType, Map<String, List<EventHandler>>>>)((Map)entry.getValue()).entrySet()) {
for (Object serviceCodeObj : ((Map)eventTypeMapEntry.getValue()).keySet()) {
String serviceCode = (String)serviceCodeObj;
subscribe(subscribedMap, entry.getKey(), eventTypeMapEntry.getKey(), serviceCode);
}
}
}
Map<String, Map<String, Set<String>>> customSubscribedMap = new HashMap<>();
for (Map.Entry<String, Map<String, Map<String, List<CustomEventHandler>>>> entry : (Iterable<
Map.Entry<String, Map<String, Map<String, List<CustomEventHandler>>>>>)eventHandlerMapping
.getCustomHandlerMap().entrySet()) {
for (Map.Entry<String, Map<String, List<CustomEventHandler>>> subEntry : (Iterable<
Map.Entry<String, Map<String, List<CustomEventHandler>>>>)((Map)entry.getValue()).entrySet()) {
for (Map.Entry<String, List<CustomEventHandler>> handlerEntry : (Iterable<
Map.Entry<String, List<CustomEventHandler>>>)((Map)subEntry.getValue()).entrySet()) {
for (CustomEventHandler customEventHandler : handlerEntry.getValue()) {
Type type = customEventHandler.getClass().getGenericInterfaces()[0];
ParameterizedType p = (ParameterizedType)type;
Class<? extends CustomEvent> eventClass = (Class)p.getActualTypeArguments()[0];
customSubscribe(customSubscribedMap, entry.getKey(), subEntry.getKey(), handlerEntry.getKey(),
eventClass);
}
}
}
}
}
private void subscribe(Map<String, Map<EventType, Set<String>>> subscribedMap, String groupId, EventType eventType,
String serviceCode) {
if (StringUtils.isEmpty(groupId)) {
groupId = this.defaultGroup;
}
Map<EventType, Set<String>> eventTypeServiceCodeMap = subscribedMap.get(groupId);
if (null != eventTypeServiceCodeMap) {
Set<String> serviceCodesSet = eventTypeServiceCodeMap.get(eventType);
if (CollectionUtils.isEmpty(serviceCodesSet)) {
eventTypeServiceCodeMap.put(eventType, new HashSet<>(Collections.singleton(serviceCode)));
} else {
serviceCodesSet.add(serviceCode);
}
} else {
eventTypeServiceCodeMap = new HashMap<>();
eventTypeServiceCodeMap.put(eventType, new HashSet<>(Collections.singleton(serviceCode)));
subscribedMap.put(groupId, eventTypeServiceCodeMap);
}
((EventClient)this.eventClientMap.get(groupId)).subEvent(eventType, serviceCode);
}
private void customSubscribe(Map<String, Map<String, Set<String>>> customSubscribedMap, String groupId,
String topic, String serviceCode, Class<? extends CustomEvent> eventClass)
throws IllegalAccessException, InstantiationException {
if (StringUtils.isEmpty(groupId)) {
groupId = this.defaultGroup;
}
Map<String, Set<String>> topicServiceCodeMap = customSubscribedMap.get(groupId);
if (null != topicServiceCodeMap) {
Set<String> serviceCodesSet = topicServiceCodeMap.get(topic);
if (CollectionUtils.isEmpty(serviceCodesSet)) {
topicServiceCodeMap.put(topic, new HashSet<>(Collections.singleton(serviceCode)));
} else {
serviceCodesSet.add(serviceCode);
}
} else {
topicServiceCodeMap = new HashMap<>();
topicServiceCodeMap.put(topic, new HashSet<>(Collections.singleton(serviceCode)));
customSubscribedMap.put(groupId, topicServiceCodeMap);
}
EventClient eventClient = this.eventClientMap.get(groupId);
if (null == eventClient) {
throw new IllegalArgumentException(
String.format("没有找到groupId[%s]对应的配置,请检查 ${cloudwalk.event.group-id} 配置", new Object[] {groupId}));
}
eventClient.subEvent(topic, serviceCode, eventClass.newInstance());
}
private void initEventClient(String bootstrapServers, String groupId, Class<? extends EventListener> listenerClass,
boolean isDefault) {
EventClient eventClient = this.eventClientMap.get(groupId);
if (null == eventClient) {
eventClient = EventClient.getInstance(bootstrapServers, groupId);
eventClient.init();
if (null != this.eventProperties.getFetchDataWorkerNumber()) {
eventClient.setWorkNum(this.eventProperties.getFetchDataWorkerNumber());
}
eventClient.setListenerClass(listenerClass);
this.eventClientMap.put(groupId, eventClient);
}
if (isDefault) {
this.defaultGroup = groupId;
this.defaultEventClient = eventClient;
}
}
private <E extends BaseEvent> void registerHandlerMapping(EventHandlerMapping eventHandlerMapping,
EventHandler<E> handler, Class<E> eventClass, String[] suffixes) {
List<String> groupIds = extractGroupIds(handler);
EventType eventType = getEventType(eventClass);
for (String groupId : groupIds) {
Map<String, List<EventHandler>> handlers =
eventHandlerMapping.getServiceCodeHandlerListMap(groupId, eventType);
if (CollectionUtils.isEmpty(handlers)) {
handlers = new HashMap<>();
if (null == suffixes || suffixes.length == 0) {
handlers.put("", new ArrayList<EventHandler>(Collections.singletonList((EventHandler)handler)));
} else {
for (String suffix : suffixes) {
handlers.put(suffix, new ArrayList<EventHandler>(Collections.singletonList((EventHandler)handler)));
}
}
eventHandlerMapping.registerHandlers(groupId, eventType, handlers);
continue;
}
if (null == suffixes || suffixes.length == 0) {
List<EventHandler> currentHandlers = handlers.get("");
if (CollectionUtils.isEmpty(currentHandlers)) {
currentHandlers = new ArrayList<>();
}
currentHandlers.add(handler);
handlers.put("", currentHandlers);
continue;
}
for (String suffix : suffixes) {
List<EventHandler> currentHandlers = handlers.get(suffix);
if (CollectionUtils.isEmpty(currentHandlers)) {
currentHandlers = new ArrayList<>();
}
currentHandlers.add(handler);
handlers.put(suffix, currentHandlers);
}
}
}
private void registerCustomHandlerMapping(EventHandlerMapping eventHandlerMapping,
EventHandler<? extends CustomEvent> handler, String topic, String serviceCode) {
List<String> groupIds = extractGroupIds(handler);
for (String groupId : groupIds) {
Map<String, List<CustomEventHandler>> customHandlers =
eventHandlerMapping.getServiceCodeCustomHandlerListMap(groupId, topic);
if (null == customHandlers) {
customHandlers = new HashMap<>();
if (StringUtils.isEmpty(topic)) {
customHandlers.put("",
new ArrayList<CustomEventHandler>(
Collections.singletonList((CustomEventHandler)handler)));
} else {
customHandlers.put(serviceCode,
new ArrayList<CustomEventHandler>(
Collections.singletonList((CustomEventHandler)handler)));
}
eventHandlerMapping.registerCustomHandlers(groupId, topic, customHandlers);
continue;
}
if (StringUtils.isEmpty(serviceCode)) {
List<CustomEventHandler> list = customHandlers.get("");
if (CollectionUtils.isEmpty(list)) {
list = new ArrayList<>();
}
list.add((CustomEventHandler)handler);
customHandlers.put("", list);
continue;
}
List<CustomEventHandler> currentHandlers = customHandlers.get(serviceCode);
if (CollectionUtils.isEmpty(currentHandlers)) {
currentHandlers = new ArrayList<>();
}
currentHandlers.add((CustomEventHandler)handler);
customHandlers.put(serviceCode, currentHandlers);
}
}
}
@@ -0,0 +1,76 @@
package cn.cloudwalk.event;
import cn.cloudwalk.cwos.client.event.EventClient;
import cn.cloudwalk.cwos.client.event.event.BaseEvent;
import cn.cloudwalk.cwos.client.event.event.CustomEvent;
import cn.cloudwalk.event.handler.CustomEventHandler;
import cn.cloudwalk.event.handler.EventHandler;
import cn.cloudwalk.event.handler.EventHandlerMapping;
import cn.cloudwalk.event.handler.EventHandlerWorker;
import cn.cloudwalk.event.listener.GroupEventListener;
import cn.cloudwalk.event.listener.GroupListnerClassMapping;
import cn.cloudwalk.event.task.EventHandleTask;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.CollectionUtils;
/**
* 事件派发入口:基于 {@link cn.cloudwalk.event.handler.EventHandlerMapping} 选择处理器并委托
* {@link cn.cloudwalk.event.handler.EventHandlerWorker} 执行。
*/
public class CloudwalkEventManager {
private static final Logger LOGGER = LoggerFactory.getLogger(CloudwalkEventManager.class);
private EventHandlerMapping eventHandlerMapping;
private EventHandlerWorker eventHandlerWorker;
private GroupListnerClassMapping groupListnerClassMapping;
private EventClient eventClient;
public void handle(Class<? extends GroupEventListener> eventListnerClass, BaseEvent baseEvent) {
String groupId = this.groupListnerClassMapping.getGroupId(eventListnerClass);
if (baseEvent instanceof CustomEvent) {
List<CustomEventHandler> customEventHandlers = (List<CustomEventHandler>)this.eventHandlerMapping
.getServiceCodeCustomHandlerListMap(groupId, ((CustomEvent)baseEvent).getTopic())
.get(baseEvent.getServiceCode());
eventHandle(baseEvent, customEventHandlers);
return;
}
List<EventHandler> handlerList = (List<EventHandler>)this.eventHandlerMapping
.getServiceCodeHandlerListMap(groupId, baseEvent.getClass()).get(baseEvent.getServiceCode());
eventHandle(baseEvent, handlerList);
}
private <H extends EventHandler> void eventHandle(BaseEvent baseEvent, List<H> handlers) {
if (CollectionUtils.isEmpty(handlers)) {
LOGGER.error("没有相应的事件处理程序");
return;
}
for (EventHandler eventHandler : handlers) {
this.eventHandlerWorker.work(new EventHandleTask(baseEvent, eventHandler));
}
}
public void publish(BaseEvent baseEvent) {
this.eventClient.pubEvent(baseEvent);
}
public void setEventHandlerMapping(EventHandlerMapping eventHandlerMapping) {
this.eventHandlerMapping = eventHandlerMapping;
}
public EventHandlerMapping getEventHandlerMapping() {
return this.eventHandlerMapping;
}
public void setEventHandlerWorker(EventHandlerWorker eventHandlerWorker) {
this.eventHandlerWorker = eventHandlerWorker;
}
public void setEventClient(EventClient eventClient) {
this.eventClient = eventClient;
}
public void setGroupListnerClassMapping(GroupListnerClassMapping groupListnerClassMapping) {
this.groupListnerClassMapping = groupListnerClassMapping;
}
}
@@ -0,0 +1,18 @@
package cn.cloudwalk.event;
import cn.cloudwalk.event.autoconfig.EventConfiguration;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.springframework.context.annotation.Import;
/**
* 启用云从事件总线自动配置,导入 {@link EventConfiguration} 并绑定 {@code cloudwalk.event.*} 配置项。
*/
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Import({EventConfiguration.class})
public @interface EnableCloudwalkEvent {}
@@ -0,0 +1,18 @@
package cn.cloudwalk.event.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* 声明类型级 Kafka 消费组标识,用于与事件监听/路由配置对齐。
*/
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface ConsumerGroup {
/** 消费组 ID 列表,与平台侧配置保持一致。 */
String[] groupIds() default {};
}
@@ -0,0 +1,26 @@
package cn.cloudwalk.event.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.springframework.core.annotation.AliasFor;
/**
* 为自定义事件主题提供显式 {@code topic},并通过 {@link EventTopicSuffix} 组合后缀。
*/
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@EventTopicSuffix
public @interface CustomTopic {
/** 逻辑主题名。 */
String topic();
/**
* 与 {@link EventTopicSuffix#suffix()} 互为别名,用于拼接完整主题。
*/
@AliasFor(annotation = EventTopicSuffix.class)
String suffix() default "";
}
@@ -0,0 +1,24 @@
package cn.cloudwalk.event.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.springframework.core.annotation.AliasFor;
/**
* 为主题名追加可配置后缀,避免多环境/多租户下 Kafka Topic 冲突。
*/
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface EventTopicSuffix {
/** 与 {@link #suffix()} 互为别名。 */
@AliasFor(attribute = "suffix")
String[] value() default {};
/** 追加在基础主题后的后缀片段。 */
@AliasFor(attribute = "value")
String[] suffix() default {};
}
@@ -0,0 +1,22 @@
package cn.cloudwalk.event.autoconfig;
import cn.cloudwalk.event.CloudwalkEventInitializing;
import cn.cloudwalk.event.CloudwalkEventManager;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
/**
* 事件模块 Spring 配置:注册 {@link cn.cloudwalk.event.CloudwalkEventManager} 与初始化组件。
*/
@EnableConfigurationProperties({EventProperties.class})
public class EventConfiguration {
@Bean
public CloudwalkEventManager cloudwalkEventManager() {
return new CloudwalkEventManager();
}
@Bean
public CloudwalkEventInitializing CloudwalkEventInitializing(EventProperties eventProperties) {
return new CloudwalkEventInitializing(eventProperties);
}
}
@@ -0,0 +1,93 @@
package cn.cloudwalk.event.autoconfig;
import java.util.Map;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* {@code cloudwalk.event} 前缀下的绑定配置:Kafka 地址、消费组、监听器映射与线程池等。
*/
@ConfigurationProperties(prefix = "cloudwalk.event")
public class EventProperties {
protected static final String CONF_PREFIX = "cloudwalk.event";
private String bootstrapServers;
private String groupId;
private Map<String, String> listenerClass;
private Integer fetchDataWorkerNumber;
private String workerNamePrefix;
private HandlerExecutorConfig handlerExecutorConfig =
new HandlerExecutorConfig(Integer.valueOf(5), Integer.valueOf(10));
public static class HandlerExecutorConfig {
private Integer corePoolSize;
private Integer maximumPoolSize;
public HandlerExecutorConfig(Integer corePoolSize, Integer maximumPoolSize) {
this.corePoolSize = corePoolSize;
this.maximumPoolSize = maximumPoolSize;
}
public Integer getCorePoolSize() {
return this.corePoolSize;
}
public void setCorePoolSize(Integer corePoolSize) {
this.corePoolSize = corePoolSize;
}
public Integer getMaximumPoolSize() {
return this.maximumPoolSize;
}
public void setMaximumPoolSize(Integer maximumPoolSize) {
this.maximumPoolSize = maximumPoolSize;
}
}
public String getBootstrapServers() {
return this.bootstrapServers;
}
public void setBootstrapServers(String bootstrapServers) {
this.bootstrapServers = bootstrapServers;
}
public String getGroupId() {
return this.groupId;
}
public void setGroupId(String groupId) {
this.groupId = groupId;
}
public Map<String, String> getListenerClass() {
return this.listenerClass;
}
public void setListenerClass(Map<String, String> listenerClass) {
this.listenerClass = listenerClass;
}
public Integer getFetchDataWorkerNumber() {
return this.fetchDataWorkerNumber;
}
public void setFetchDataWorkerNumber(Integer fetchDataWorkerNumber) {
this.fetchDataWorkerNumber = fetchDataWorkerNumber;
}
public HandlerExecutorConfig getHandlerExecutorConfig() {
return this.handlerExecutorConfig;
}
public void setHandlerExecutorConfig(HandlerExecutorConfig handlerExecutorConfig) {
this.handlerExecutorConfig = handlerExecutorConfig;
}
public String getWorkerNamePrefix() {
return this.workerNamePrefix;
}
public void setWorkerNamePrefix(String workerNamePrefix) {
this.workerNamePrefix = workerNamePrefix;
}
}
@@ -0,0 +1,35 @@
package cn.cloudwalk.event.client;
import cn.cloudwalk.cwos.client.event.event.EventType;
import cn.cloudwalk.event.handler.EventHandler;
import java.util.List;
public class EventSubscribeHandlers {
private EventType eventType;
private String serviceCode;
private List<EventHandler> eventHandlerList;
public EventType getEventType() {
return this.eventType;
}
public void setEventType(EventType eventType) {
this.eventType = eventType;
}
public String getServiceCode() {
return this.serviceCode;
}
public void setServiceCode(String serviceCode) {
this.serviceCode = serviceCode;
}
public List<EventHandler> getEventHandlerList() {
return this.eventHandlerList;
}
public void setEventHandlerList(List<EventHandler> eventHandlerList) {
this.eventHandlerList = eventHandlerList;
}
}
@@ -0,0 +1,4 @@
package cn.cloudwalk.event.handler;
public interface CustomEventHandler<E extends cn.cloudwalk.cwos.client.event.event.CustomEvent>
extends EventHandler<E> {}
@@ -0,0 +1,5 @@
package cn.cloudwalk.event.handler;
public interface EventHandler<E extends cn.cloudwalk.cwos.client.event.event.BaseEvent> {
void onEvent(E paramE);
}
@@ -0,0 +1,74 @@
package cn.cloudwalk.event.handler;
import cn.cloudwalk.cwos.client.event.event.BaseEvent;
import cn.cloudwalk.cwos.client.event.event.EventType;
import cn.cloudwalk.cwos.client.event.handler.EventListener;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class EventHandlerMapping {
private final Map<String, Map<EventType, Map<String, List<EventHandler>>>> handlerMap = new HashMap<>();
private final Map<String, Map<String, Map<String, List<CustomEventHandler>>>> customHandlerMap = new HashMap<>();
private final Map<Class<? extends EventListener>, String> listenerClassGroupMap = new HashMap<>();
public void registerHandlers(String groupId, EventType eventType, Map<String, List<EventHandler>> handlers) {
Map<EventType, Map<String, List<EventHandler>>> map = this.handlerMap.get(groupId);
if (null == map) {
map = new HashMap<>();
map.put(eventType, handlers);
this.handlerMap.put(groupId, map);
} else {
map.put(eventType, handlers);
}
}
public Map<String, List<EventHandler>> getServiceCodeHandlerListMap(String groupId,
Class<? extends BaseEvent> eventClass) {
for (EventType eventType : EventType.values()) {
if (eventType.getEventClass().getClass().equals(eventClass)) {
return getServiceCodeHandlerListMap(groupId, eventType);
}
}
throw new IllegalArgumentException("没有找到合适的事件类型");
}
public Map<String, List<EventHandler>> getServiceCodeHandlerListMap(String groupId, EventType eventType) {
Map<EventType, Map<String, List<EventHandler>>> map = this.handlerMap.get(groupId);
if (null != map) {
return map.get(eventType);
}
return null;
}
public Map<String, List<CustomEventHandler>> getServiceCodeCustomHandlerListMap(String groupId, String topic) {
Map<String, Map<String, List<CustomEventHandler>>> map = this.customHandlerMap.get(groupId);
if (null != map) {
return map.get(topic);
}
return null;
}
public void registerCustomHandlers(String groupId, String topic, Map<String, List<CustomEventHandler>> handlers) {
Map<String, Map<String, List<CustomEventHandler>>> map = this.customHandlerMap.get(groupId);
if (null == map) {
map = new HashMap<>();
map.put(topic, handlers);
this.customHandlerMap.put(groupId, map);
} else {
map.put(topic, handlers);
}
}
public Map<String, Map<EventType, Map<String, List<EventHandler>>>> getHandlerMap() {
return this.handlerMap;
}
public Map<String, Map<String, Map<String, List<CustomEventHandler>>>> getCustomHandlerMap() {
return this.customHandlerMap;
}
public Map<Class<? extends EventListener>, String> getListenerClassGroupMap() {
return this.listenerClassGroupMap;
}
}
@@ -0,0 +1,22 @@
package cn.cloudwalk.event.handler;
import cn.cloudwalk.event.task.EventHandleTask;
import java.util.concurrent.Callable;
import java.util.concurrent.Future;
import java.util.concurrent.ThreadPoolExecutor;
public class EventHandlerWorker {
private ThreadPoolExecutor poolExecutor;
public void setPoolExecutor(ThreadPoolExecutor poolExecutor) {
this.poolExecutor = poolExecutor;
}
public Future<String> work(final EventHandleTask task) {
return this.poolExecutor.submit(new Callable<String>() {
public String call() throws Exception {
return task.start();
}
});
}
}
@@ -0,0 +1,36 @@
package cn.cloudwalk.event.handler;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
public class NamedThreadFactory implements ThreadFactory {
private static final String DEFAULT_POOL_NAME = "cloudwalk-common-event";
protected static final AtomicInteger POOL_SEQ = new AtomicInteger(1);
private final AtomicInteger threadNumber = new AtomicInteger(1);
private final String namePrefix;
private final ThreadGroup threadGroup;
public NamedThreadFactory() {
this("cloudwalk-common-event");
}
public NamedThreadFactory(String namePrefix) {
SecurityManager s = System.getSecurityManager();
this.threadGroup = (s != null) ? s.getThreadGroup() : Thread.currentThread().getThreadGroup();
if (null == namePrefix || "".equals(namePrefix.trim())) {
namePrefix = "cloudwalk-common-event";
}
this.namePrefix = namePrefix + "-" + POOL_SEQ.getAndIncrement() + "-thread-";
}
public Thread newThread(Runnable r) {
Thread t = new Thread(this.threadGroup, r, this.namePrefix + this.threadNumber.getAndIncrement(), 0L);
if (t.isDaemon()) {
t.setDaemon(false);
}
if (t.getPriority() != 5) {
t.setPriority(5);
}
return t;
}
}
@@ -0,0 +1,3 @@
package cn.cloudwalk.event.listener;
public class CloudwalkEventListener extends GroupEventListener {}
@@ -0,0 +1,24 @@
package cn.cloudwalk.event.listener;
import cn.cloudwalk.cwos.client.event.event.BaseEvent;
import cn.cloudwalk.cwos.client.event.handler.EventListener;
import cn.cloudwalk.event.CloudwalkEventManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
public abstract class GroupEventListener implements EventListener {
public static ApplicationContext applicationContext;
private static final Logger LOGGER = LoggerFactory.getLogger(CloudwalkEventListener.class);
public void messageListener(BaseEvent baseEvent) throws RuntimeException {
try {
CloudwalkEventManager cloudwalkEventManager =
(CloudwalkEventManager)applicationContext.getBean(CloudwalkEventManager.class);
cloudwalkEventManager.handle(getClass(), baseEvent);
} catch (Exception e) {
LOGGER.error("事件处理出现异常,原因:", e);
throw new RuntimeException(e);
}
}
}
@@ -0,0 +1,26 @@
package cn.cloudwalk.event.listener;
import cn.cloudwalk.cwos.client.event.handler.EventListener;
import java.util.HashMap;
import java.util.Map;
/**
* 监听类型与 Kafka 消费组 ID 的注册表。
* <p>
* 类名中的 {@code Listner} 为历史产物,与既有字节码/配置引用保持一致,请勿随意重命名。
*/
public class GroupListnerClassMapping {
private final Map<Class<? extends EventListener>, String> mapping = new HashMap<>();
public void register(Class<? extends EventListener> eventListnerClass, String groupId) {
if (this.mapping.containsKey(eventListnerClass)) {
throw new IllegalArgumentException(
String.format("eventListnerClass[%s]已经存在,不允许重复", new Object[] {eventListnerClass.toString()}));
}
this.mapping.put(eventListnerClass, groupId);
}
public String getGroupId(Class<? extends EventListener> eventListnerClass) {
return this.mapping.get(eventListnerClass);
}
}
@@ -0,0 +1,7 @@
/**
* 云从消息总线(Kafka)封装:监听器注册、事件处理链、与 CWOS SDK 的集成。
* <p>
* 入口:在 Spring Boot 启动类或配置类上使用 {@link cn.cloudwalk.event.EnableCloudwalkEvent} 通过 {@code cloudwalk.event.*} 配置项(参见
* {@link cn.cloudwalk.event.autoconfig.EventProperties})完成连接与线程池等参数绑定。
*/
package cn.cloudwalk.event;
@@ -0,0 +1,35 @@
package cn.cloudwalk.event.task;
import cn.cloudwalk.cwos.client.event.event.BaseEvent;
import cn.cloudwalk.event.handler.EventHandler;
public class EventHandleTask<E extends BaseEvent> {
private E event;
private EventHandler<E> handler;
public EventHandleTask(E event, EventHandler<E> handler) {
this.event = event;
this.handler = handler;
}
public String start() {
this.handler.onEvent(this.event);
return this.event.getMessageId();
}
public E getEvent() {
return this.event;
}
public void setEvent(E event) {
this.event = event;
}
public EventHandler<E> getHandler() {
return this.handler;
}
public void setHandler(EventHandler<E> handler) {
this.handler = handler;
}
}
@@ -0,0 +1,6 @@
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Built-By: hechunjie
Created-By: Apache Maven 3.6.0
Build-Jdk: 1.8.0_191
@@ -0,0 +1,58 @@
{
"hints": [],
"groups": [
{
"sourceType": "cn.cloudwalk.event.autoconfig.EventProperties",
"name": "cloudwalk.event",
"type": "cn.cloudwalk.event.autoconfig.EventProperties"
},
{
"sourceType": "cn.cloudwalk.event.autoconfig.EventProperties",
"name": "cloudwalk.event.handler-executor-config",
"sourceMethod": "getHandlerExecutorConfig()",
"type": "cn.cloudwalk.event.autoconfig.EventProperties$HandlerExecutorConfig"
}
],
"properties": [
{
"sourceType": "cn.cloudwalk.event.autoconfig.EventProperties",
"name": "cloudwalk.event.bootstrap-servers",
"description": "服务器地址",
"type": "java.lang.String"
},
{
"sourceType": "cn.cloudwalk.event.autoconfig.EventProperties",
"name": "cloudwalk.event.fetch-data-worker-number",
"description": "获取数据的工作线程数",
"type": "java.lang.Integer"
},
{
"sourceType": "cn.cloudwalk.event.autoconfig.EventProperties",
"name": "cloudwalk.event.group-id",
"description": "组ID",
"type": "java.lang.String"
},
{
"sourceType": "cn.cloudwalk.event.autoconfig.EventProperties$HandlerExecutorConfig",
"name": "cloudwalk.event.handler-executor-config.core-pool-size",
"type": "java.lang.Integer"
},
{
"sourceType": "cn.cloudwalk.event.autoconfig.EventProperties$HandlerExecutorConfig",
"name": "cloudwalk.event.handler-executor-config.maximum-pool-size",
"type": "java.lang.Integer"
},
{
"sourceType": "cn.cloudwalk.event.autoconfig.EventProperties",
"name": "cloudwalk.event.listener-class",
"description": "组与EventListener对应关系",
"type": "java.util.Map<java.lang.String,java.lang.String>"
},
{
"sourceType": "cn.cloudwalk.event.autoconfig.EventProperties",
"name": "cloudwalk.event.worker-name-prefix",
"description": "工作线程名字前缀",
"type": "java.lang.String"
}
]
}
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>cn.cloudwalk.cloud</groupId>
<artifactId>cloudwalk-cloud-decompiled-reactor</artifactId>
<version>3.7.2-Brussels-SRX</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>cloudwalk-common-service</artifactId>
<packaging>jar</packaging>
<description>云从科技-公共组件 service 通用层(源码已迁入本模块 src/main/java</description>
<properties>
<alibaba.eclipse.codestyle.path>${project.basedir}/../../docs/style/alibaba-eclipse-codestyle.xml</alibaba.eclipse.codestyle.path>
</properties>
<dependencies>
<dependency>
<groupId>cn.cloudwalk.cloud</groupId>
<artifactId>cloudwalk-common-result</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>net.revelc.code.formatter</groupId>
<artifactId>formatter-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
@@ -0,0 +1,79 @@
package cn.cloudwalk.service.aop;
import cn.cloudwalk.cloud.annotation.CloudwalkParamsValidate;
import cn.cloudwalk.cloud.result.CloudwalkResult;
import java.lang.reflect.Method;
import java.util.Iterator;
import java.util.Set;
import javax.validation.ConstraintViolation;
import javax.validation.Validator;
import javax.validation.groups.Default;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
/**
* 对标注了 {@link cn.cloudwalk.cloud.annotation.CloudwalkParamsValidate} 的入口进行 Bean Validation 校验。
*/
@Aspect
@Order(-100)
@Component
public class CloudwalkParamsValidateAspect {
private final Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private Validator validator;
@Autowired
private MessageSource messageSource;
public String getMessage(String code) {
return this.messageSource.getMessage(code, null, LocaleContextHolder.getLocale());
}
@Pointcut("@annotation(cn.cloudwalk.cloud.annotation.CloudwalkParamsValidate)")
public void validatePointcat() {}
@Around("validatePointcat()")
public Object around(ProceedingJoinPoint joinPoint) throws Throwable {
MethodSignature methodSignature = (MethodSignature)joinPoint.getSignature();
Method targetMethod =
joinPoint.getTarget().getClass().getMethod(methodSignature.getName(), methodSignature.getParameterTypes());
this.logger.debug("正在进行对类{}中方法{}进行参数检查开始", joinPoint.getTarget().getClass().getName(), targetMethod.getName());
CloudwalkParamsValidate paramsValidate =
targetMethod.<CloudwalkParamsValidate>getAnnotation(CloudwalkParamsValidate.class);
if (paramsValidate == null) {
return joinPoint.proceed();
}
int[] needCheckParamIndexs = paramsValidate.argsIndexs();
if (needCheckParamIndexs == null) {
return joinPoint.proceed();
}
Class<?>[] groupsClazz = paramsValidate.groups();
if (groupsClazz == null) {
groupsClazz = new Class[] {Default.class};
}
Object[] args = joinPoint.getArgs();
for (int index : needCheckParamIndexs) {
Object arg = args[index];
Set<ConstraintViolation<Object>> constraintViolationSet = this.validator.validate(arg, groupsClazz);
if (constraintViolationSet != null && constraintViolationSet.size() > 0) {
Iterator<ConstraintViolation<Object>> iterator = constraintViolationSet.iterator();
if (iterator.hasNext()) {
ConstraintViolation<Object> constraintViolation = iterator.next();
String code = constraintViolation.getMessage();
return CloudwalkResult.fail(code, getMessage(code));
}
}
}
this.logger.debug("正在进行对类{}中方法{}进行参数检查通过", joinPoint.getTarget().getClass().getName(), targetMethod.getName());
return joinPoint.proceed();
}
}
@@ -0,0 +1,31 @@
package cn.cloudwalk.service.config;
import javax.validation.Validation;
import javax.validation.Validator;
import javax.validation.ValidatorFactory;
import org.hibernate.validator.HibernateValidator;
import org.hibernate.validator.HibernateValidatorConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.validation.beanvalidation.MethodValidationPostProcessor;
/**
* Hibernate Validator 与 Spring {@link org.springframework.validation.beanvalidation.MethodValidationPostProcessor} 注册。
*/
@Configuration
public class ValidatorConfig {
@Bean
public Validator validator() {
ValidatorFactory validatorFactory =
((HibernateValidatorConfiguration)Validation.byProvider(HibernateValidator.class).configure())
.failFast(true).buildValidatorFactory();
return validatorFactory.getValidator();
}
@Bean
public MethodValidationPostProcessor methodValidationPostProcessor() {
MethodValidationPostProcessor postProcessor = new MethodValidationPostProcessor();
postProcessor.setValidator(validator());
return postProcessor;
}
}
@@ -0,0 +1,6 @@
/**
* 云从公共 Web/Service 横切能力:参数校验 AOP、校验器与 Spring 集成等。
* <p>
* 典型用法:在依赖了 {@code cloudwalk-common-result} 的应用中注册切面与 {@link org.springframework.validation.Validator}。
*/
package cn.cloudwalk.service;
@@ -0,0 +1,6 @@
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Built-By: hechunjie
Created-By: Apache Maven 3.6.0
Build-Jdk: 1.8.0_191
+150
View File
@@ -0,0 +1,150 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.18.RELEASE</version>
<relativePath/>
</parent>
<groupId>cn.cloudwalk.cloud</groupId>
<artifactId>cloudwalk-cloud-decompiled-reactor</artifactId>
<version>3.7.2-Brussels-SRX</version>
<packaging>pom</packaging>
<name>cloudwalk-cloud (decompiled reactor)</name>
<description>聚合反编译模块:cloudwalk-common-event、cloudwalk-common-service。原父 POM cloudwalk-cloud-common 缺失,由本工程继承 Spring Boot 并集中管理云从内部构件版本。</description>
<modules>
<!-- 先安装到本地 ~/.m2,供其它工程解析私服 JAR 的 parentcloudwalk-cloud-common -->
<module>cloudwalk-cloud-common</module>
<module>cloudwalk-common-event</module>
<module>cloudwalk-common-service</module>
</modules>
<properties>
<java.version>1.8</java.version>
<spring-cloud.version>Greenwich.SR6</spring-cloud.version>
<cloudwalk.internal.version>3.7.2-Brussels-SRX</cloudwalk.internal.version>
<!-- 与 V1 运行包 lib 内 cwos-sdk-event 一致(私服常见为 1.5.0-SNAPSHOT,非 3.7.2 坐标) -->
<cwos.sdk.event.version>1.5.0-SNAPSHOT</cwos.sdk.event.version>
<!-- Nexus UI: http://192.168.3.12/#browse/welcome -->
<nexus.baseUrl>http://192.168.3.12</nexus.baseUrl>
<nexus.public.repo>${nexus.baseUrl}/repository/maven-public/</nexus.public.repo>
<formatter.maven.plugin.version>2.24.1</formatter.maven.plugin.version>
<!-- P3C Eclipse 码风格(阿里巴巴 Java 开发手册配套),文件见 ../docs/style/alibaba-eclipse-codestyle.xml -->
<alibaba.eclipse.codestyle.path>${project.basedir}/../docs/style/alibaba-eclipse-codestyle.xml</alibaba.eclipse.codestyle.path>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>cn.cloudwalk.cloud</groupId>
<artifactId>cloudwalk-common-result</artifactId>
<version>${cloudwalk.internal.version}</version>
</dependency>
<dependency>
<groupId>cn.cloudwalk.cloud</groupId>
<artifactId>cwos-sdk-event</artifactId>
<version>${cwos.sdk.event.version}</version>
</dependency>
<!-- 子模块未写版本;Boot 父 POM 对部分坐标未集中管理,在此补齐 -->
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>6.0.22.Final</version>
</dependency>
</dependencies>
</dependencyManagement>
<repositories>
<repository>
<id>nexus-public</id>
<name>Nexus maven-public</name>
<url>${nexus.public.repo}</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nexus-public-plugins</id>
<name>Nexus maven-public</name>
<url>${nexus.public.repo}</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>net.revelc.code.formatter</groupId>
<artifactId>formatter-maven-plugin</artifactId>
<version>${formatter.maven.plugin.version}</version>
<configuration>
<configFile>${alibaba.eclipse.codestyle.path}</configFile>
<lineEnding>LF</lineEnding>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.4.1</version>
<executions>
<execution>
<id>enforce-jdk8</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireJavaVersion>
<version>[1.8,1.9)</version>
<message>与原始运行包一致须使用 JDK 8 启动 Maven;见 docs/build/ORIGINAL_BUILD_JDK.txt</message>
</requireJavaVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
@@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>cn.cloudwalk.elevator</groupId>
<artifactId>cw-elevator-application-decompiled-reactor</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>cw-elevator-application-common</artifactId>
<packaging>jar</packaging>
<properties>
<alibaba.eclipse.codestyle.path>${project.basedir}/../../docs/style/alibaba-eclipse-codestyle.xml</alibaba.eclipse.codestyle.path>
</properties>
<dependencies>
<dependency>
<groupId>cn.cloudwalk.cloud</groupId>
<artifactId>cloudwalk-common-result</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
</dependency>
<dependency>
<groupId>net.coobird</groupId>
<artifactId>thumbnailator</artifactId>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
</dependency>
<dependency>
<groupId>cn.cloudwalk.cloud</groupId>
<artifactId>cloudwalk-common-web</artifactId>
</dependency>
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>core</artifactId>
</dependency>
<dependency>
<groupId>net.lingala.zip4j</groupId>
<artifactId>zip4j</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>net.revelc.code.formatter</groupId>
<artifactId>formatter-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
@@ -0,0 +1,15 @@
package cn.cloudwalk.elevator.annontation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* 标记字段与达芬奇(Davinci)图片存储或展示相关的元信息。
* <p>
* 所在包名 {@code annontation} 为历史拼写,与既有引用保持一致,请勿单独重命名包路径。
*/
@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
public @interface DavinciPic {}
@@ -0,0 +1,49 @@
package cn.cloudwalk.elevator.cache;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.RedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;
@Configuration
public class CacheOverrideConfig {
public static final String CACHE_NAME_APPLICATIONIDS = "ACS_Applicationids";
public static final String CACHE_NAME_ACS_DEVICE_TYPES = "ACS_DeviceTypesCache";
public static final String CACHE_NAME_ACS_DEVICE_TYPE_FEATURES = "ACS_DeviceTypeFeaturesCache";
public static final String CACHE_NAME_ACS_DEVICE_ATTRS = "ACS_DeviceAttrsCache";
public static final String CACHE_NAME_ACS_RECORD_STATISTICS = "ACS_RecordStatisticsCache";
public static final String CACHE_NAME_ACS_DEVICE_TREE = "ACS_DeviceTreeCache";
public static final String CACHE_NAME_ACS_AREA_TREE = "ACS_AreaTreeCache";
public static final String CACHE_KEY_APPLICATION_IDS_PREFIX = "acs_applicationIds:";
public static final String CACHE_KEY_ACS_DEVICE_TYPES_PREFIX = "acs_deviceTypes:";
public static final String CACHE_KEY_ACS_DEVICE_TYPE_FEATURES_PREFIX = "acs_deviceTypeFeatures:";
public static final String CACHE_KEY_ACS_EXPORT_PREFIX = "acs_export_prefix:";
public static final String CACHE_KEY_ACS_DEVICE_ATTRS_PREFIX = "acs_deviceAttrs:";
public static final String CACHE_KEY_ACS_RECORD_STATISTICS_PREFIX = "acs_recordStatistics:";
public static final String CACHE_KEY_ACS_DEVICE_TREE_PREFIX = "acs_deviceTreeCache";
public static final String CACHE_KEY_ACS_AREA_TREE_PREFIX = "acs_areaTreeCache:";
@Primary
@Bean({"redisTemplate"})
public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) {
RedisTemplate<Object, Object> redisTemplate = new RedisTemplate();
redisTemplate.setConnectionFactory(redisConnectionFactory);
StringRedisSerializer stringRedisSerializer = new StringRedisSerializer();
Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer(Object.class);
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
objectMapper.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
jackson2JsonRedisSerializer.setObjectMapper(objectMapper);
redisTemplate.setValueSerializer((RedisSerializer)jackson2JsonRedisSerializer);
redisTemplate.setKeySerializer((RedisSerializer)stringRedisSerializer);
redisTemplate.afterPropertiesSet();
return redisTemplate;
}
}
@@ -0,0 +1,13 @@
package cn.cloudwalk.elevator.config;
public class AcsConstants {
public static final String SUCCESS_CODE = "00000000";
public static final String SERVICE_CODE = "elevator-app";
public static final Long ONE_DAY_MILLISECONDS = Long.valueOf(86400000L);
public static final Long ONE_YEAR_MILLISECONDS = Long.valueOf(31536000000L);
public static final String DEFAULT_CALLER = "defaultUserId";
public static final String DEFAULT_CALLER_NAME = "defaultUserName";
public static final String ACS_OPEN_DOOR_RECORD_EVENT_TOPIC = "ACS_OPEN_DOOR_RECORD_EVENT_TOPIC";
public static final String ACS_BACKEND_REG_LOG_ID_KEY_PREFIX = "acs:backendRegLogId:";
public static final String ACS_BACKEND_REG_EXPIRE_PREFIX = "acs:backendRegExpire:";
}
@@ -0,0 +1,11 @@
package cn.cloudwalk.elevator.config;
public class AcsLockConstants {
public static final String LOCK_EXPORT_BUSINESSID_PREFIX = "AcsExport:";
public static final String LOCK_RECORD_STATISTICS_BUSINESSID_PREFIX = "AcsRecordStatistics:";
public static final String LOCK_BACKEND_REG_LOG_ID_PREFIX = "AcsBackendRegLogId:";
public static final String LOCK_URGENT_GROUP_DEVICE_ID_PREFIX = "AcsUrgentGroupDeviceIds:";
}
@@ -0,0 +1,18 @@
package cn.cloudwalk.elevator.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Component
@ConfigurationProperties(prefix = "cloudwalk.elevator.common")
public class ElevatorCwosConfig {
private String relativePrefix;
public String getRelativePrefix() {
return this.relativePrefix;
}
public void setRelativePrefix(String relativePrefix) {
this.relativePrefix = relativePrefix;
}
}
@@ -0,0 +1,457 @@
package cn.cloudwalk.elevator.config;
public class ErrorCode {
public static final String OTHER_ERROR = "00000001";
public static final String ID_IS_NULL = "53060410";
public static final String ID_ARRAY_IS_NULL = "53060411";
public static final String ADD_IMAGE_STORE_ERROR = "53060413";
public static final String ID_IS_ERROR = "53060414";
public static final String EDIT_IMAGE_STORE_IS_ERROR = "53060415";
public static final String IMAGE_STORE_REF_IS_ALL_NULL = "53060416";
public static final String IMAGFE_STORE_ORG_ID_ARRAY_IS_ERROR = "53060417";
public static final String IMAGFE_STORE_LABEL_ID_ARRAY_IS_ERROR = "53060418";
public static final String IMAGFE_STORE_PERSON_ID_ARRAY_IS_ERROR = "53060419";
public static final String IMAGFE_STORE_LABEL_ID_EXCLUDE_ARRAY_IS_ERROR = "53060420";
public static final String IMAGFE_STORE_PERSON_ID_EXCLUDE_ARRAY_IS_ERROR = "53060421";
public static final String IMAGE_STORE_DELETE_ERROR = "53060422";
public static final String IMAGE_STORE_NAME_IS_ERROR = "53060423";
public static final String ID_LENGTH_IS_ERROR = "53060424";
public static final String ORG_PARENT_NODE_IS_ERROR = "53060425";
public static final String GET_BUSINESS_NAME_IS_ERROR = "53060426";
public static final String PARENT_ID_LENGTH_IS_ERROR = "53060427";
public static final String FILE_UPLOAD_ERROR = "80014001";
public static final String FILE_UPLOAD_CONTROLLER_ERROR = "80014013";
public static final String FILE_TYPE_IS_INVALID = "53060429";
public static final String FILE_MAX_IS_ERROR = "53060428";
public static final String ROTATE_IMAGE_ERROR = "53060430";
public static final String EXTRACT_FEATURE_FAIL = "53060431";
public static final String FACE_DETECT_IS_EMPTY = "53060432";
public static final String FACE_DETECT_OVER_SIZE = "53060433";
public static final String IMAGE_IS_EMPTY = "53060434";
public static final String EXTRACT_FEATURE_EXCEPTION = "53060435";
public static final String EXTRACT_FEATURE_RESULT_IS_EMPTY = "53060436";
public static final String UPLOAD_SINGLE_FACE = "53060437";
public static final String GROUP_ID_IS_EMPTY = "53060438";
public static final String FACE_DETECT_EXCEPTION = "53060439";
public static final String FACE_DETECT_RESULT_IS_EMPTY = "53060440";
public static final String QUERY_ALL_GROUP_TOPN_FAIL = "53060441";
public static final String QUERY_EVERY_GROUP_TOPN_FAIL = "53060442";
public static final String QUERY_FEATURE_RESULT_IS_EMPTY = "53060443";
public static final String QUERY_FEATURE_RESULT_FAIL = "53060444";
public static final String IMAGE_UNDER_SIZE = "53060445";
public static final String IMAGE_PIXEL_UNDER_SIZE = "53060446";
public static final String ADD_FACE_FAIL = "53060447";
public static final String REMOVE_FACE_FAIL = "53060448";
public static final String FILE_MANAGER_READ_FILE_ERROR = "80014016";
public static final String FILE_MANAGER_DEL_ERROR = "80014017";
public static final String ADD_ORG_TYPE_ERROR = "53003800";
public static final String EDIT_ORG_TYPE_ERROR = "53003801";
public static final String DEL_ORG_TYPE_ERROR = "53003802";
public static final String ADD_ORG_TYPE_DUPLICATE_NAME = "53003803";
public static final String QUERY_ORG_TYPE_ERROR = "53003804";
public static final String PROPERTIES_DUPLICATE_NAME_ERROR = "53003805";
public static final String ADD_AREA_TYPE_ERROR = "53004800";
public static final String EDIT_AREA_TYPE_ERROR = "53004801";
public static final String DEL_AREA_TYPE_ERROR = "53004802";
public static final String ADD_AREA_TYPE_DUPLICATE_NAME = "53004803";
public static final String QUERY_AREA_TYPE_ERROR = "53004804";
public static final String AREA_TYPE_NAME_NOT_NULL = "53004806";
public static final String AREA_TYPE_NAME_LENGTH_INVAILD = "53004807";
public static final String AREA_TYPE_PRO_NAME_NOT_NULL = "53004810";
public static final String AREA_TYPE_PRO_REQUIRED_NOT_NULL = "53004811";
public static final String AREA_TYPE_PRO_REQUIRED_RANGE_INVAILD = "53004812";
public static final String AREA_TYPE_HAS_LOWER_DATA = "53004813";
public static final String AREA_TYPE_NOT_EDIT_DEFAULT = "53004815";
public static final String EXIST_AREA_WITH_TYPE = "53004854";
public static final String AREA_TYPE_PRO_ORDER_NOT_NULL = "53004816";
public static final String AREA_TYPE_PRO_ORDER_RANGE_INVAILD = "53004817";
public static final String QUERY_ORG_ERROR = "53003300";
public static final String TYPE_ID_IS_NULL = "53003301";
public static final String TYPE_ID_LENGTH_IS_ERROR = "53003302";
public static final String PARAM_LENGTH_IS_ERROR = "53003303";
public static final String EXIST_ORG_WITH_TYPE = "53003304";
public static final String ORG_ID_IS_NULL = "53003305";
public static final String ORG_PARENT_HSH_LOWER_LEVEL_ERROR = "53003306";
public static final String ORG_PARENT_ID_IS_NULL = "53003307";
public static final String ORG_LEVEL_IS_ERROR = "53003308";
public static final String ORG_NAME_IS_EXIST = "53003309";
public static final String ORG_ID_IS_ERROR = "53003310";
public static final String PERSON_ID_ARRAY_IS_ERROR = "53003311";
public static final String ORG_NAME_IS_NULL = "53003312";
public static final String ORG_YI_IS_NOT_DELETE = "53003313";
public static final String ORG_PARENT_IS_HAVING = "53003314";
public static final String ORG_CANNOT_DELETE = "53003315";
public static final String QZ_BUSINESS_ID_INVALID = "53014000";
public static final String QZ_PERSON_CODE_INVALID = "53014001";
public static final String QZ_PERSON_NAME_INVALID = "53014002";
public static final String QZ_PERSON_USER_NAME_INVALID = "53014003";
public static final String QZ_PERSON_PHONE_INVALID = "53014004";
public static final String QZ_PERSON_EMAIL_INVALID = "53014005";
public static final String QZ_PERSON_SYNC_ACCOUNT_INVALID = "53014006";
public static final String QZ_PERSON_CUSTOM_FIELD_INVALID = "53014007";
public static final String QZ_PERSON_ADD_ERROR = "53014008";
public static final String QZ_PERSON_EDIT_ERROR = "53014009";
public static final String QZ_PERSON_DEL_ERROR = "53014010";
public static final String QZ_PERSON_QUERY_ERROR = "53014011";
public static final String QZ_PERSON_CODE_DUPLICATE = "53014012";
public static final String QZ_PERSON_USER_NAME_DUPLICATE = "53014013";
public static final String QZ_PERSON_PHONE_DUPLICATE = "53014014";
public static final String QZ_PERSON_EMAIL_DUPLICATE = "53014015";
public static final String QZ_PERSON_FILED_LOSE = "53014016";
public static final String QZ_PERSON_FILED_INVALID = "53014017";
public static final String QZ_PERSON_FILED_NOT_EXISTS = "53014018";
public static final String QZ_PERSON_NO_SYSTEM_ID = "53014019";
public static final String QZ_PERSON_FILED_LABEL_ORGANIZATION_LOSE = "53014020";
public static final String QZ_PERSON_SOURCE_ILLEGAL = "53014021";
public static final String QZ_PERSON_PROPERTIES_CERT_LOSE = "53014022";
public static final String QZ_PERSON_CERT_ID_DUPLICATE = "53014023";
public static final String PERSON_ID_LIST_IS_EMPTY = "53014024";
public static final String IMAGE_ID_LIST_IS_EMPTY = "53014025";
public static final String IMAGE_ID_IS_EMPTY = "53014026";
public static final String QZ_SYSTEM_ID_VALUE_EMPTY = "53014027";
public static final String QZ_SYSTEM_ID_VALUE_DUPLICATE = "53014028";
public static final String PERSONNEL_ATTRIBUTES_ARE_NOT_SET = "53014029";
public static final String QZ_BATCH_ID_INVALID = "53014030";
public static final String QZ_BATCH_STATUS_INVALID = "53014031";
public static final String QZ_BATCH_ADD_ERROR = "53014032";
public static final String QZ_BATCH_QUERY_ERROR = "53014033";
public static final String QZ_BATCH_DETAIL_QUERY_ERROR = "53014034";
public static final String BATCH_IMPORT_INSERT_ERROR = "53014035";
public static final String BATCH_IMPORT_PROCESS_EXCEPTION = "53014036";
public static final String BATCH_IMPORT_ZIP_FILE_EMPTY = "53014037";
public static final String BATCH_IMPORT_UNZIP_FAILED = "53014038";
public static final String BATCH_IMPORT_EXCEL_FILE_NOTFOUND = "53014039";
public static final String BATCH_IMPORT_DATA_EMPTY = "53014040";
public static final String FILE_INIT_FAIL = "53014041";
public static final String FILE_FINISHI_FAIL = "53014042";
public static final String FILE_GET_FAIL = "53014043";
public static final String LABEL_NAME_IS_EXIST = "53003700";
public static final String LABEL_ID_IS_ERROR = "53003701";
public static final String LABEL_PAGE_IS_ERROR = "53003702";
public static final String QZ_LABEL_NAME_INVALID = "53003703";
public static final String QZ_LABEL_CODE_INVALID = "53003704";
public static final String LABEL_CODE_IS_EXIST = "53003705";
public static final String QZ_LABEL_ADD_TYPE_INVALID = "53003706";
public static final String QZ_LABEL_DEL_PERSON_RELATION = "53003707";
public static final String PERSON_PRO_NAME_NOT_NULL = "53014800";
public static final String PERSON_PRO_NAME_LENGTH_INVAILD = "53014801";
public static final String PERSON_PRO_TYPE_NOT_NULL = "53014802";
public static final String PERSON_PRO_TYPE_RANGE_INVAILD = "53014803";
public static final String PERSON_PRO_SYSACCOUNT_RANGE_INVAILD = "53014804";
public static final String PERSON_PRO_REQUIRED_RANGE_INVAILD = "53014805";
public static final String PERSON_PRO_ORDER_NOT_NULL = "53014806";
public static final String PERSON_PRO_REMINDER_NOT_NULL = "53014807";
public static final String PERSON_PRO_REMINDER_LENGTH_INVAILD = "53014808";
public static final String PERSON_PRO_ARRAYDATA_LENGTH_INVAILD = "53014809";
public static final String PERSON_PRO_MULTIPLE_RANGE_INVAILD = "53014810";
public static final String DEFAULT_ACCOUNT_CAN_NOT_CHANGE = "53014811";
public static final String REQUIRED_CAN_NOT_CHANGE = "53014812";
public static final String SWITCH_SIZE_PARAM_INVALID = "53014813";
public static final String SWITCH_BACKGROUND_OBJECT_INVALID = "53014814";
public static final String ORG_TYPE_NAME_NOT_NULL = "53003806";
public static final String ORG_TYPE_NAME_LENGTH_INVAILD = "53003807";
public static final String ORG_TYPE_LOWER_NOT_NULL = "53003808";
public static final String ORG_TYPE_LOWER_RANGE_INVAILD = "53003809";
public static final String ORG_TYPE_PRO_NAME_NOT_NULL = "53003810";
public static final String ORG_TYPE_PRO_REQUIRED_NOT_NULL = "53003811";
public static final String ORG_TYPE_PRO_REQUIRED_RANGE_INVAILD = "53003812";
public static final String ORG_TYPE_HAS_LOWER_DATA = "53003813";
public static final String ORG_TYPE_NOT_NEW_DEFAULT = "53003814";
public static final String ORG_TYPE_NOT_EDIT_DEFAULT = "53003815";
public static final String ORG_TYPE_PRO_ORDER_NOT_NULL = "53003816";
public static final String ORG_TYPE_PRO_ORDER_RANGE_INVAILD = "53003817";
public static final String CAT_NOT_EDIT_DEFAULT_TYPE = "53003818";
public static final String PERSON_NOT_EXIST = "53003819";
public static final String PERSON_IMAGE_SCORE_FAILE = "53003820";
public static final String ORG_SEARCH_PARAM_FAILE = "53003821";
public static final String PERSON_REGISTRY_STATUS_IS_NULL = "53014500";
public static final String PERSON_REGISTRY_DEVICESTATUS_IS_NULL = "53014501";
public static final String PERSON_REGISTRY_CODESTATUS_IS_NULL = "53014502";
public static final String PERSON_REGISTRY_PROPERTY_IS_NULL = "53014503";
public static final String PERSON_REGISTRY_DEVICE_IS_NULL = "53014504";
public static final String PERSON_REGISTRY_STATUS_INVALID = "53014505";
public static final String PERSON_REGISTRY_DEVICESTATUS_INVALID = "53014506";
public static final String PERSON_REGISTRY_CODESTATUS_INVALID = "53014507";
public static final String PERSON_REGISTRY_PRO_ID_LIST_IS_ERROR = "53014508";
public static final String PERSON_REGISTRY_PRO_NAME_IS_REQUIRED = "53014509";
public static final String PERSON_REGISTRY_PRO_ORG_LABEL_IS_REQUIRED = "53014510";
public static final String PERSON_REGISTRY_PRO_IS_REQUIRED = "53014511";
public static final String PERSON_REGISTRY_ORG_IDS_IS_ERROR = "53014512";
public static final String PERSON_REGISTRY_LABEL_IDS_IS_ERROR = "53014513";
public static final String PERSON_REGISTRY_DEVICE_IS_ERROR = "53014514";
public static final String PERSON_REGISTRY_ADD_FAIL = "53014515";
public static final String PERSON_REGISTRY_SAVE_FAIL = "53014516";
public static final String PERSON_REGISTRY_IS_NULL = "53014517";
public static final String PERSON_REGISTRY_STATUS_IS_CLOSED = "53014518";
public static final String PERSON_REGISTRY_DEVICE_IS_NOT_ADD = "53014519";
public static final String PERSON_REGISTRY_DETAIL_FAIL = "53014520";
public static final String PERSON_REGISTRY_PRO_LIST_FAIL = "53014521";
public static final String PERSON_REGISTRY_UNIQUE_PRO_IS_NULL = "53014522";
public static final String PERSON_REGISTRY_UNIQUE_PRO_FAIL = "53014523";
public static final String PERSON_PRO_IS_NULL = "53014524";
public static final String PERSON_CERT_PRO_IS_NULL = "53014525";
public static final String CARDID_NOT_BIND_PRO = "53014526";
public static final String NAME_NOT_BIND_PRO = "53014527";
public static final String BIND_PRO_ONE_TO_MANY = "53014528";
public static final String DEFAULT_PRO_ORG_LABEL_IS_REQUIRED = "53014529";
public static final String PERSON_REGISTRY_TYPE_INVALID = "53014530";
public static final String QUERY_DISTRICT_TREE_FAIL = "53014600";
public static final String QUERY_DEVICE_LIST_FAIL = "53014700";
public static final String DEVICE_ID_IS_NULL = "53014701";
public static final String QUERY_PERSON_GROUP_RELATIONS_FAIL = "53014702";
public static final String QUERY_QR_CODE_URL_FAIL = "53014900";
public static final String PERSON_AUDIT_PARAM_SOURCE = "53060533";
public static final String PERSON_AUDIT_DEVICE_FORBID = "53060534";
public static final String PERSON_AUDIT_ADD_EXCEPTION = "53060535";
public static final String PERSON_AUDIT_ID_INVALID = "53060536";
public static final String PERSON_AUDIT_ID_ISNULL = "53060537";
public static final String PERSON_AUDIT_QUERY_FAILED = "53060538";
public static final String PERSON_AUDIT_APPLY_FAILED = "53060539";
public static final String PERSON_AUDIT_PAGE_FAILED = "53060540";
public static final String PERSON_AUDIT_REGISTRY_SETTING_FAILED = "53060541";
public static final String PERSON_AUDIT_DEVICECODE_EMPTY = "53060542";
public static final String PERSON_AUDIT_DEVICE_INVALID = "53060543";
public static final String PERSON_AUDIT_UPLOAD_BASE64_EMPTY = "53060544";
public static final String PERSON_AUDIT_CHECK_NAME_EMPTY = "53060545";
public static final String PERSON_AUDIT_CHECK_WRONG_CAPTCHA = "53060546";
public static final String PERSON_AUDIT_UNIQUE_PROPERTY_ERROR = "53060547";
public static final String PERSON_AUDIT_QUERY_AUDIT_EMPTY = "53060548";
public static final String PERSON_AUDIT_AGREE_CAN_NOT_EDIT = "53060549";
public static final String AREA_PARENT_ID_IS_NULL = "53015100";
public static final String AREA_PARENT_HSH_LOWER_LEVEL_ERROR = "53015101";
public static final String AREA_PARENT_IS_HAVING = "53015102";
public static final String AREA_NAME_IS_EXIST = "53015103";
public static final String AREA_ID_IS_ERROR = "53015104";
public static final String AREA_PARENT_NODE_IS_ERROR = "53015105";
public static final String AREA_YI_IS_NOT_DELETE = "53015106";
public static final String AREA_TYPE_ID_IS_NULL = "53015107";
public static final String UNIT_ID_ARRAY_IS_ERROR = "53015108";
public static final String QUERY_AREA_ERROR = "53015109";
public static final String DETAIL_AREA_ERROR = "53015110";
}
@@ -0,0 +1,17 @@
package cn.cloudwalk.elevator.config;
public class FeignRemoteConfig {
public static final String PLATFORM_USER_ID = "platformuserid";
public static final String LOGIN_ID = "loginid";
public static final String BUSINESS_ID = "businessid";
public static final String USER_NAME = "username";
public static final String APPLICATION_ID = "applicationid";
public static final String AUTHORIZATION = "authorization";
public static final String SERVICE_CODE = "elevator-app";
}
@@ -0,0 +1,79 @@
package cn.cloudwalk.elevator.config;
import cn.cloudwalk.cloud.context.CloudwalkCallContext;
import cn.cloudwalk.cloud.session.extend.DefaultExtendContext;
import cn.cloudwalk.elevator.context.CloudWalkExtendContextValue;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
public class FeignThreadLocalUtil {
private static ThreadLocal<Map<String, String>> threadLocal = new ThreadLocal<>();
public static void set(Map<String, String> t) {
threadLocal.remove();
threadLocal.set(t);
}
public static Map<String, String> get() {
return threadLocal.get();
}
public static void remove() {
threadLocal.remove();
}
public static Map<String, String> getRequestHeader(HttpServletRequest request) {
Map<String, String> map = new ConcurrentHashMap<>(10);
if (null != request.getHeader("platformuserid")) {
map.put("platformuserid", request.getHeader("platformuserid"));
}
if (null != request.getHeader("loginid")) {
map.put("loginid", request.getHeader("loginid"));
}
if (null != request.getHeader("businessid")) {
map.put("businessid", request.getHeader("businessid"));
}
if (null != request.getHeader("username")) {
map.put("username", request.getHeader("username"));
}
if (null != request.getHeader("applicationid")) {
map.put("applicationid", request.getHeader("applicationid"));
}
if (null != request.getHeader("authorization")) {
map.put("authorization", request.getHeader("authorization"));
}
return map;
}
public static Map<String, String> getDefaultReqesutHeader(String businessId) {
Map<String, String> map = new ConcurrentHashMap<>(2);
map.put("businessid", businessId);
map.put("username", "default");
return map;
}
public static void setRequestHeader(Map<String, String> headerMap) {
set(headerMap);
}
public static Map<String, String> getDefaultRequestHeader(CloudwalkCallContext context) {
Map<String, String> map = new HashMap<>(10);
DefaultExtendContext<CloudWalkExtendContextValue> extendContext =
(DefaultExtendContext<CloudWalkExtendContextValue>)context.getExt();
map.put("platformuserid", context.getUser().getCaller());
map.put("loginid", ((CloudWalkExtendContextValue)extendContext.getValue()).getLoginId());
map.put("businessid", context.getCompany().getCompanyId());
map.put("username",
StringUtils.isEmpty(context.getUser().getCallerName()) ? "default" : context.getUser().getCallerName());
map.put("applicationid", context.getApplicationId());
map.put("authorization", ((CloudWalkExtendContextValue)extendContext.getValue()).getAuthorization());
return map;
}
public static void setRequestHeader(CloudwalkCallContext context) {
set(getDefaultRequestHeader(context));
}
}
@@ -0,0 +1,65 @@
package cn.cloudwalk.elevator.config;
import java.util.Arrays;
import java.util.List;
public class ImageStoreConstants {
public static final short IS_NOT_DEL = 0;
public static final short IS_DEL = 1;
public static final int ASSOCIATED_ACTION_INCLUDE = 0;
public static final int ASSOCIATED_ACTION_EXCLUDE = 1;
public static final int ASSOCIATED_OBJECT_ORG_TYPE = 1;
public static final int ASSOCIATED_OBJECT_LABEL_TYPE = 2;
public static final int ASSOCIATED_OBJECT_PERSON_TYPE = 3;
public static final int ASSOCIATED_OBJECT_MATCHPATTERN_TYPE = 4;
public static final int ASSOCIATED_OBJECT_IMAGE_STORE_TYPE = 5;
public static final String COMMON_BUSINESS_ID = "cloudwalk";
public static final Integer COMMON_PROPERTIES_STATUS = Integer.valueOf(99);
public static final Integer COMMON_UNIT_PROPERTIES_STATUS = Integer.valueOf(98);
public static final Integer COMMON_PARK_PROPERTIES_STATUS = Integer.valueOf(97);
private static final List<String> CUST_PROPERTIES = Arrays.asList(new String[] {"ext1", "ext2", "ext3", "ext4",
"ext5", "ext6", "ext7", "ext8", "ext9", "ext10", "ext11", "ext12", "ext13", "ext14", "ext15", "ext16", "ext17",
"ext18", "ext19", "ext20", "ext21", "ext22", "ext23", "ext24", "ext25", "ext26", "ext27", "ext28", "ext29",
"ext30", "ext31", "ext32", "ext33", "ext34", "ext35", "ext36", "ext37", "ext38", "ext39", "ext40"});
public static final String PERSON_PROPERTY_USER_NAME = "userName";
public static List<String> getCustProperties() {
return CUST_PROPERTIES;
}
public static final String PERSON_PROPERTY_PHONE = "phone";
public static final String PERSON_PROPERTY_EMAIL = "email";
public static final String COMPARE_PICTURE = "comparePicture";
public static final String PERSON_PROPERTY_PERSON_CODE = "personCode";
public static final String IC_CAED_NO = "icCardNo";
public static final String IC_CAED_TYPE = "icCardType";
public static final String FLOORS = "floors";
public static final String PROPERTY_CODE = "code";
public static final String PROPERTY_HAS_REQUIRED = "hasRequired";
public static final int PROPERTY_REQUIRED = 1;
public static final int PROPERTY_UNREQUIRED = 0;
public static final String PERSON_PROPERTY_NAME = "name";
public static final String PERSON_PROPERTY_ORGANIZATIONIDS = "organizationIds";
public static final String PERSON_PROPERTY_LABELIDS = "labelIds";
public static final String CREATE_SYS_ACCOUNT_CODE = "createSysAccount";
public static final String CREATE_SYS_ACCOUNT_NAME = "同步创建账号";
public static final String SYS_ACCOUNT_ID_CODE = "sysAccountId";
public static final String SYS_ACCOUNT_ID_NAME = "同步创建账号系统ID";
public static final Integer AGREE = Integer.valueOf(0);
public static final String SYSTEM_USER = "system";
public static final String IMAGE_STORE_ID = "imageStoreId";
public static final String PASS_CRONS = "passCrons";
public static final short PERSON_DELETED = -1;
public static final short PERSON_VALIDATE = 0;
public static final short PERSON_INVALIDATE = 1;
public static final short DEVICE_PERSON_VALIDATE = 1;
public static final short DEVICE_PERSON_INVALIDATE = 0;
public static final Integer MAX_FILE = Integer.valueOf(3145728);
public static final String SYSTEM_GROUP_CREATE_USER_ID = "group";
public static final int PERSON_ACTION_DELETE = -1;
public static final int PERSON_ACTION_ADD = 0;
public static final int PERSON_ACTION_UPDATE = 1;
public static final short GROUP_MODEL_STATUS_NO_IMG = 0;
public static final int PERSON_VALIDATE_UNPROCESSED = 0;
public static final int PERSON_VALIDATE_PROCESSED = 1;
}
@@ -0,0 +1,22 @@
package cn.cloudwalk.elevator.context;
public class CloudWalkExtendContextValue {
private String loginId;
private String authorization;
public String getLoginId() {
return this.loginId;
}
public void setLoginId(String loginId) {
this.loginId = loginId;
}
public String getAuthorization() {
return this.authorization;
}
public void setAuthorization(String authorization) {
this.authorization = authorization;
}
}
@@ -0,0 +1,30 @@
package cn.cloudwalk.elevator.em;
public enum AcsApplicationSourceEnum {
ACCESS_CONTROL("ACCESS_CONTROL", "门禁应用"), CWOS_PORTAL("CWOS_PORTAL", "平台应用");
private final String code;
private final String name;
AcsApplicationSourceEnum(String code, String name) {
this.code = code;
this.name = name;
}
public static AcsApplicationSourceEnum getEnumByCode(String code) {
for (AcsApplicationSourceEnum item : values()) {
if (code.equals(item.code)) {
return item;
}
}
return null;
}
public String getCode() {
return this.code;
}
public String getName() {
return this.name;
}
}
@@ -0,0 +1,30 @@
package cn.cloudwalk.elevator.em;
public enum AcsDeviceIdentifyTypeEnum {
FRONT_REG(Integer.valueOf(0), "前端识别"), BACKEND_REG(Integer.valueOf(1), "后端识别");
private Integer code;
private String name;
AcsDeviceIdentifyTypeEnum(Integer code, String name) {
this.code = code;
this.name = name;
}
public static AcsDeviceIdentifyTypeEnum getEnumByCode(Integer code) {
for (AcsDeviceIdentifyTypeEnum item : values()) {
if (code.equals(item.getCode())) {
return item;
}
}
return null;
}
public Integer getCode() {
return this.code;
}
public String getName() {
return this.name;
}
}
@@ -0,0 +1,30 @@
package cn.cloudwalk.elevator.em;
public enum AcsDeviceQueryTypeEnum {
QUERY_MAIN(Integer.valueOf(1), "只查询主设备"), QUERY_MAIN_AND_SUB(Integer.valueOf(2), "查询主设备及其子设备");
private Integer code;
private String message;
AcsDeviceQueryTypeEnum(Integer code, String message) {
this.code = code;
this.message = message;
}
public static AcsDeviceQueryTypeEnum getEnumByCode(Integer code) {
for (AcsDeviceQueryTypeEnum item : values()) {
if (code.equals(item.getCode())) {
return item;
}
}
return null;
}
public Integer getCode() {
return this.code;
}
public String getMessage() {
return this.message;
}
}
@@ -0,0 +1,59 @@
package cn.cloudwalk.elevator.em;
import java.util.ArrayList;
import java.util.List;
public enum AcsDeviceSettingEnum {
QUALITY_SCORE("qualityScore", "人脸抓拍质量分", AcsApplicationSourceEnum.CWOS_PORTAL),
TEMP_THRESHOLD("tempThreshold", "温度报警阈值", AcsApplicationSourceEnum.CWOS_PORTAL),
TEMP_MIN("tempMin", "温度最低值", AcsApplicationSourceEnum.CWOS_PORTAL),
MASK_THRESHOLD("maskThreshold", "口罩阈值", AcsApplicationSourceEnum.CWOS_PORTAL),
LIVE_STATE("liveState", "活体检测开关", AcsApplicationSourceEnum.CWOS_PORTAL),
TEMP_STATE("tempState", "温度控制开关", AcsApplicationSourceEnum.CWOS_PORTAL),
FACE_SIZE_MIN("faceSizeMin", "人脸最小尺寸", AcsApplicationSourceEnum.CWOS_PORTAL),
FACE_SIZE_MAX("faceSizeMax", "人脸最大尺寸", AcsApplicationSourceEnum.CWOS_PORTAL),
FACE_ONE_THRESHOLD("faceOneThreshold", "人脸1:1识别阈值", AcsApplicationSourceEnum.CWOS_PORTAL),
FACE_MANY_THRESHOLD("faceManyThreshold", "人脸1:N识别阈值", AcsApplicationSourceEnum.CWOS_PORTAL),
ACS_FACE_REG_THRESHOLD("ACS_FACE_REG_THRESHOLD", "人脸抓拍识别阈值", AcsApplicationSourceEnum.ACCESS_CONTROL);
private String code;
private String remark;
private AcsApplicationSourceEnum source;
public String getCode() {
return this.code;
}
public String getRemark() {
return this.remark;
}
public AcsApplicationSourceEnum getSource() {
return this.source;
}
AcsDeviceSettingEnum(String code, String remark, AcsApplicationSourceEnum source) {
this.code = code;
this.remark = remark;
this.source = source;
}
public static AcsDeviceSettingEnum getEnumByCode(String code) {
for (AcsDeviceSettingEnum item : values()) {
if (code.equals(item.code)) {
return item;
}
}
return null;
}
public static List<AcsDeviceSettingEnum> getEnumBySource(String source) {
List<AcsDeviceSettingEnum> list = new ArrayList<>();
for (AcsDeviceSettingEnum item : values()) {
if (source.equals(item.source.getCode())) {
list.add(item);
}
}
return list;
}
}
@@ -0,0 +1,30 @@
package cn.cloudwalk.elevator.em;
public enum AcsOpenDoorStatusEnum {
INIT(Integer.valueOf(0), "初始化"), SUCESS(Integer.valueOf(1), "成功"), FAIL(Integer.valueOf(2), "失败");
private Integer code;
private String message;
AcsOpenDoorStatusEnum(Integer code, String message) {
this.code = code;
this.message = message;
}
public static AcsOpenDoorStatusEnum getEnumByCode(Integer code) {
for (AcsOpenDoorStatusEnum item : values()) {
if (code.equals(item.getCode())) {
return item;
}
}
return null;
}
public Integer getCode() {
return this.code;
}
public String getMessage() {
return this.message;
}
}
@@ -0,0 +1,30 @@
package cn.cloudwalk.elevator.em;
public enum AcsOperateStatusEnum {
INIT(Integer.valueOf(0), "初始化"), MATCHED(Integer.valueOf(1), "已匹配");
private Integer code;
private String message;
AcsOperateStatusEnum(Integer code, String message) {
this.code = code;
this.message = message;
}
public static AcsOperateStatusEnum getEnumByCode(Integer code) {
for (AcsOperateStatusEnum item : values()) {
if (code.equals(item.getCode())) {
return item;
}
}
return null;
}
public Integer getCode() {
return this.code;
}
public String getMessage() {
return this.message;
}
}
@@ -0,0 +1,30 @@
package cn.cloudwalk.elevator.em;
public enum AcsOperateTypeEnum {
REMOTE_OPEN_DOOR("REMOTE_OPEN_DOOR", "远程开门"), QRCODE_OPEN_DOOR("QRCODE_OPEN_DOOR", "小程序扫码开门");
private String code;
private String message;
AcsOperateTypeEnum(String code, String message) {
this.code = code;
this.message = message;
}
public static AcsOperateTypeEnum getEnumByCode(String code) {
for (AcsOperateTypeEnum item : values()) {
if (code.equals(item.getCode())) {
return item;
}
}
return null;
}
public String getCode() {
return this.code;
}
public String getMessage() {
return this.message;
}
}
@@ -0,0 +1,30 @@
package cn.cloudwalk.elevator.em;
public enum AcsPassTypeEnum {
LONG_TIME(Integer.valueOf(0), "长期"), AUTO_PASS(Integer.valueOf(1), "自定义时间"), PASS_TIME(Integer.valueOf(2), "通行时间段");
private Integer code;
private String message;
AcsPassTypeEnum(Integer code, String message) {
this.code = code;
this.message = message;
}
public static YesNoTypeEnum getEnumByCode(Integer code) {
for (YesNoTypeEnum item : YesNoTypeEnum.values()) {
if (code.equals(item.getCode())) {
return item;
}
}
return null;
}
public Integer getCode() {
return this.code;
}
public String getMessage() {
return this.message;
}
}
@@ -0,0 +1,55 @@
package cn.cloudwalk.elevator.em;
public enum AlarmStateCodeEnum {
OPERATION_FAILED("36000001", "操作失败"), EMPTY_PARAMETERS_WRONG("36000002", "参数不能为空"),
INSERT_DATABSE_EREEOR("36000003", "插入数据库异常"), EMPTY_USER_ID("36000004", "ID不能为空"),
PARAM_ERROR("36000005", "参数不符合要求"), SEARCH_INFORMATION_FAILED("36000006", "查询信息失败"),
TASK_NAME_EXIST("36000007", "布控名称重复"), TASK_TYPE_NAME_EXIST("36000012", "布控类型名称重复"),
DELETE_NOT_EXIST("36000008", "被删除资源不存在"), CONTROL_TASK_TYPE_HAS_TASK("36000009", "存在关联任务"),
SAVE_TASK_TYPE_ERROR("36000010", "保存区控类型失败"), UPDATE_TASK_TYPE_ERROR("36000011", "更新区控类型失败"),
FILE_SIZE_ILLEGAL("3600030", "文件大小超过"), WRONG_PARAMETERS("400", "参数错误"), SERVER_EXCEPTION("500", "服务器异常"),
SUCCESS("00000000", "成功"), CWOS_FEIGN_FAILED("36000007", "调用cwos接口异常"), PAGE_QUERY_FAILED("36000008", "分页查询失败"),
PARAM_REPEAT("36000009", "证件类型+证件号重复"), CONTROL_TASK_ID_NOT_EXIST("36000010", "任务编号不存在"),
DEVICE_NOT_EXIST("36000011", "回放链接已失效"), LABEL_NAME_DUPLICATE_FAILED("10001056", "库名称重复"),
LABEL_NAME_INVALID("10001050", "库名称无效"), LABEL_QUERY_FAILED("10001051", "标签查询失败"),
LABEL_SAVE_FAILED("10001052", "标签保存失败"), LABEL_UPDATE_FAILED("10001053", "标签更新失败"),
LABEL_DELETE_FAILED("10001054", "标签删除失败"), EMPTY_LABEL_NAME("10001055", "标签名称为空"),
LABEL_PAGE_FAILED("10001055", "分页查询标签异常"), LABEL_LIST_FAILED("10001057", "列表查询标签异常"),
LABEL_BRAND_FAILED("10001060", "查询车辆品牌异常"), VEHICLE_TYPE_FAILED("10001061", "查询车辆类型异常"),
VEHICLE_DETAIL_ERROR("10001062", "车辆详情查询失败"), CODE_QUERY_ERROR("10001063", "查询失败"),
LABEL_SIZE_FAILED("10001067", "库名称超过最大长度"), PLATE_NO_DUPLICATE("10001070", "车牌号重复添加"),
VEHICLE_ADD_ERROR("10001071", "车辆添加失败"), VEHICLE_PROPERTY_UNQUALIFIED("10001087", "车辆属性不合格"),
PLATE_NO_INVALID("10005202", "车牌号无效"), VEHICLE_TYPE_INVALID("10005203", "车牌类型无效"),
VEHICLE_BRAND_INVALID("10005204", "车辆品牌无效"), VEHICLE_EDIT_FAIL("10001069", "车辆编辑失败"),
VEHICLE_DELETE_ERROR("10001076", "车辆删除失败"), VEHICLE_PAGE_FAILED("10001064", "车辆分页查询失败"),
VEHICLE_LIST_FAILED("10001065", "车辆LIST查询失败"), LABEL_BIND_VEHICLE("10001058", "该标签已被绑定具体车辆"),
EMPTY_PIC_NAME("10001059", "图片地址为空"), PICTURE_FAILED("10001070", "图片不合法"),
LABEL_BIND_PERSON("10002058", "该标签已被绑定具体人员"), LABEL_BIND_FIELD("10002059", "该标签绑定人员失败"),
PERSON_PROPERTY_UNQUALIFIED("10002087", "人脸属性不合格"), PERSON_PIC_UNQUALIFIED("10002088", "人脸图片不合格"),
PERSON_ORG_ADD_FEILD("10002089", "人员管理添加人员失败"), PERSON_ADD_ERROR("10002071", "人员添加失败"),
PERSON_DUPLICATE("10002070", "人员重复添加"), PHONE_NO_INVALID("10005205", "手机号无效"), CARD_NO_INVALID("10005206", "身份证无效"),
NAME_NO_INVALID("10005207", "名称无效"), CARD_NO_DUPLICATE("10005208", "身份证重复添加"),
PERSON_EDIT_FAIL("10002069", "人员编辑失败"), PERSON_DELETE_ERROR("10002076", "人员删除失败"),
PERSON_PAGE_FAILED("10002064", "人员分页查询失败"), PERSON_LIST_FAILED("10002065", "人员LIST查询失败"),
ORGANIZATION_PERSONS_EMPTY("10002066", "人员管理人员信息为空"), FILE_TYPE_IS_INVALID("53060429", "上传文件类型不合法"),
FILE_MAX_IS_ERROR("53060428", "上传文件超过最大大小"), FILE_UPLOAD_CONTROLLER_ERROR("80014013", "模块文件上传异常"),
PIC_DELETE_ERROR("10001084", "图片删除失败"), EXPORT_TASK_DOWNLOAD_CENTER_FAILURE("36000008", "下载中心创建下载任务失败"),
EXPORT_TASK_FAILURE("36000009", "添加导出任务失败"), EXPORT_TASK_TYPE_ERROR("36000010", "导出任务类型错误"),
EXPORT_TASK_OVERLOAD_THRESHOLD("36000011", "查询导出记录超过设定阈值");
private String code;
private String message;
AlarmStateCodeEnum(String code, String message) {
this.code = code;
this.message = message;
}
public String getCode() {
return this.code;
}
public String getMessage() {
return this.message;
}
}
@@ -0,0 +1,31 @@
package cn.cloudwalk.elevator.em;
public enum CompareTypeEnum {
RECOG(Integer.valueOf(1), "1:N比对"), PERSON_CARD(Integer.valueOf(2), "人证比对"),
ACS_BACK_RECOG(Integer.valueOf(3), "门禁1:N比对"), APP_BACK_RECOG(Integer.valueOf(4), "应用端1:N比对");
private Integer code;
private String message;
CompareTypeEnum(Integer code, String message) {
this.code = code;
this.message = message;
}
public static CompareTypeEnum getEnumByCode(Integer code) {
for (CompareTypeEnum item : values()) {
if (code.equals(item.getCode())) {
return item;
}
}
return null;
}
public Integer getCode() {
return this.code;
}
public String getMessage() {
return this.message;
}
}
@@ -0,0 +1,70 @@
package cn.cloudwalk.elevator.em;
public enum EngineAddressEnum {
PORTAL_USER_PAGE("用户查询接口", "/portal/user/manage/page"),
PERSON_PROPERTIES_LIST("查询商户对应的员工属性", "/component/person/properties/list"),
NINCACOMMON_AREA_GET_ALL_TREE("获取区域树状结构", "/sysetting/deviceArea/tree"),
COMMON_VEHICLE_GET_ALL_LABLES("获取车辆管理标签信息", "/vm/label/list"),
COMMON_VEHICLE_VM_VEHICLE_LABELREF("获取车辆管理车辆分页信息", "/vm/vehicle/control/labelRef"),
COMMON_VEHICLE_VM_VEHICLE_LIST("批量获取车辆管理车辆信息", "/vm/vehicle/list"),
CWOS_DEVICE_GET("设备列表查询", "/component/device/list"), CW0S_DEVICE_DETAIL("设备详情", "/core/atomic/device/detail"),
CWOS_DEVICE_SETTING("下发参数到设备", "/server/push/55000"),
CWOS_AREA_GET_ALL_TREE("获取区域树状结构", "/component/device/area/get/alltree"),
CWOS_QUERY_DEVICE_APPLICATION("查询设备与应用关联列表", "/component/device/app/list"),
CWOS_BIND_DEVICE_APPLICATION("绑定设备与应用", "/component/device/app/add"),
CWOS_SPLIT_DEVICE_APPLICATION("解绑设备与应用", "/component/device/app/delete"),
CWOS_QUERY_APPLICATION_ID("查询应用ID", "/res/application/instance/query"),
CWOS_BIND_DEVICE_IMAGESTORE("绑定图库与设备", "/component/device/imagestore/add"),
CWOS_SPLIT_DEVICE_IMAGESTORE("解除绑定图库与设备", "/component/device/imagestore/delete"),
CWOS_BIND_IMAGESTORE_APPLICATION("绑定图库与应用", "/core/application/group/add"),
CWOS_SPLIT_IMAGESTORE_APPLICATION("解绑图库与应用", "/core/application/group/delete"),
CWOS_ORGANIZATION_TREE("查询机构树型结构", "/component/organization/tree"),
CWOS_BIOLOGY_IMAGE_COMPARE("单库或多库比对", "/component/biology/tool/feature/query"),
CWOS_BIOLOGY_PERSON_DETAIL("查询人员信息详情", "/component/person/detail"),
CWOS_BIOLOGY_PERSON_LIST("查询人员信息", "/component/person/listPerson"),
CWOS_BIOLOGY_IMAGESTORE_ADD("新增图库", "/component/imagestore/add"),
CWOS_BIOLOGY_IMAGESTORE_EDIT("编辑图库", "/component/imagestore/edit"),
CWOS_BIOLOGY_IMAGESTORE_LIST("查询图库", "/component/imagestore/list"),
COWS_BIOLOGY_IMAGESTORE_DELETE("删除图库", "/component/imagestore/delete"),
CWOS_BIOLOGY_IMAGESTORE_DETAIL("图库详情", "/component/imagestore/detail"),
CWOS_BIOLOGY_PERSON_PAGE("分页查询人员", "/component/person/page"),
CWOS_BIOLOGY_PERSON_ADD("新增人员", "/component/person/add"),
CWOS_BIOLOGY_PERSON_EDIT("编辑人员", "/component/person/edit"),
CWOS_BIOLOGY_PERSON_DELETE("删除人员", "/component/person/delete"),
CWOS_BIOLOGY_LABEL_GETALLLABELS("查询标签列表", "/biology/label/getAllLabels"),
CWOS_BIOLOGY_LABLE_ADD("新增标签", "/biology/label/add"), CWOS_BIOLOGY_LABLE_EDIT("编辑标签", "/biology/label/edit"),
CWOS_BIOLOGY_LABLE_DELETE("删除标签", "/biology/label/delete"),
CWOS_BIOLOGY_LABLE_PERSONS_ADD("标签人员新增", "/biology/label/personsAdd"),
CWOS_BIOLOGY_LABLE_PERSONS_DEL("标签人员删除", "/biology/label/personsDel"),
CWOS_FILE_UPLOAD("文件上传", "/portal/fileManager/{moduleCategory}/fileUpload"),
CWOS_FILE_DELETE("文件删除", "/portal/fileManager/remove/images"),
CWOS_FILE_PART_INIT("分片上传文件初始化", "/portal/file/part/init"),
CWOS_FILE_PART_FINISH("分片上传文件结束", "/portal/file/part/finish"), CWOS_FILE_APPEND("文件追加", "/portal/file/part/append"),
PINEAPPLE_FACE_FEATURE_GET("人脸特征提取", "staticdb/search/feature"),
PINEAPPLE_FACE_SEARCH_MULTIPLE("多库人脸检索", "staticdb/search/multiple"),
PINEAPPLE_STRUCTURE_ATTRIBUTE("全结构化属性", "structure/recognize"),
PINEAPPLE_CLUSTER_FACE_ADD("特征入库", "api/cluster/feature/add"),
PINEAPPLE_CLUSTER_START_DEVICE("按groupId聚类", "api/cluster/doClusterByDeviceId"),
PINEAPPLE_CLUSTER_GET_TASK_INFO("获取聚类任务信息", "api/cluster/getAllTaskInfo"),
PINEAPPLE_CLUSTER_STOP("停止聚类", "api/cluster/stopIncreCluster"),
PINEAPPLE_CLUSTER_GROUP_REMOVE("删除聚类库", "api/cluster/group/base/remove"),
PINEAPPLE_ENGINE_PAGE_INFO("引擎分页查询", "gateway/config/server/getbypage"),
SEND_MESSAGE_TO_MQTT("发送数据到mqtt", "mqtt/publish"), GET_ALIVE_CLIENTS_OF_MQTT("获得所有存活的客户端", "mqtt/getClients"),
ALARM_OCCUR("声光报警器触发", "mqtt/publish"), VISITOR_QUERY("查询识别记录详情", "/intelligent/visitor/record/query");
private final String api;
private final String address;
EngineAddressEnum(String api, String address) {
this.api = api;
this.address = address;
}
public String getApi() {
return this.api;
}
public String getAddress() {
return this.address;
}
}
@@ -0,0 +1,41 @@
package cn.cloudwalk.elevator.em;
public enum OpenDoorTypeEnum {
FACE("FACE", "人脸开门"), APP("APP", "远程开门"), GUARD_CARD("GUARD_CARD", "门禁卡开门"), PASSWORD("PASSWORD", "密码开门"),
ID_CARD("ID_CARD", "身份证开门"), FACE_GUARD_CARD("FACE_GUARD_CARD", "人脸门禁卡开门"), INTERCOM("INTERCOM", "室内机开门"),
ONE("01", "人脸开门"), TWO("02", "门禁卡开门"), THREE("03", "二维码开门");
private String code;
private String remark;
public String getCode() {
return this.code;
}
public String getRemark() {
return this.remark;
}
OpenDoorTypeEnum(String code, String remark) {
this.code = code;
this.remark = remark;
}
public static String getEnumByCode(String code) {
for (OpenDoorTypeEnum item : values()) {
if (code.equals(item.code) || code.toUpperCase().equals(item.code)) {
return item.remark;
}
}
return code;
}
public static OpenDoorTypeEnum getOpenDoorTypeEnumByCode(String code) {
for (OpenDoorTypeEnum item : values()) {
if (code.equals(item.code) || code.toUpperCase().equals(item.code)) {
return item;
}
}
return null;
}
}
@@ -0,0 +1,30 @@
package cn.cloudwalk.elevator.em;
public enum YesNoTypeEnum {
N(Integer.valueOf(0), ""), Y(Integer.valueOf(1), "");
private Integer code;
private String message;
YesNoTypeEnum(Integer code, String message) {
this.code = code;
this.message = message;
}
public static YesNoTypeEnum getEnumByCode(Integer code) {
for (YesNoTypeEnum item : values()) {
if (code.equals(item.getCode())) {
return item;
}
}
return null;
}
public Integer getCode() {
return this.code;
}
public String getMessage() {
return this.message;
}
}
@@ -0,0 +1,7 @@
/**
* 电梯应用公共层:工具、上下文、注解与跨模块复用的领域模型片段。
* <p>
* 被 {@code cw-elevator-application-data}、{@code cw-elevator-application-service}、{@code cw-elevator-application-web}
* 等模块依赖, 请勿在本包引入对上层 Web 或具体业务编排的反向依赖。
*/
package cn.cloudwalk.elevator;
@@ -0,0 +1,19 @@
package cn.cloudwalk.elevator.util;
public class AcsCacheKeyUtil {
public static String getOpenDoorCountKey(String date, String businessId) {
return "elevator:passCount:" + date + ":" + businessId;
}
public static String getRecogCountKey(String date, String businessId) {
return "acs_recogCount_" + date + "_" + businessId;
}
public static String getBackendRegLogIdKey(String deviceCode, String businessId, String captureId) {
return "acs:backendRegLogId:" + deviceCode + "_" + businessId + "_" + captureId;
}
public static String getBackendRegExpireKey(String businessId, String openDoorLogId) {
return "acs:backendRegExpire:#" + businessId + "#" + openDoorLogId;
}
}
@@ -0,0 +1,806 @@
package cn.cloudwalk.elevator.util;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.lang.reflect.Array;
import java.util.AbstractList;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Queue;
import java.util.Set;
import java.util.Stack;
import org.springframework.util.Assert;
import org.springframework.util.MultiValueMap;
public class CollectionUtils {
private static final int HASH_MAP_DEFAULT_INITIAL_CAPACITY = 16;
private static final float HASH_MAP_DEFAULT_LOAD_FACTOR = 0.75F;
public static <E> E getFirst(Collection<E> c) {
if (c == null) {
return null;
}
if (c instanceof List) {
List<E> list = (List<E>)c;
return list.isEmpty() ? null : list.get(0);
}
if (c instanceof Set)
return c.isEmpty() ? null : c.iterator().next();
if (c instanceof Queue) {
return c.isEmpty() ? null : ((Queue<E>)c).peek();
}
return c.isEmpty() ? null : c.iterator().next();
}
public static List<String> removeList(List<String> listA, List<String> listB) {
HashSet<String> hs1 = new HashSet<>(listA);
HashSet<String> hs2 = new HashSet<>(listB);
hs1.removeAll(hs2);
List<String> listC = new ArrayList<>();
listC.addAll(hs1);
return listC;
}
public static <E> List<List<E>> split(List<E> list, E element) {
if (list == null) {
return new ArrayList<>(0);
}
List<List<E>> result = new ArrayList<>();
int start = 0, end = 0;
for (E e : list) {
if ((element == null) ? (e == null) : element.equals(e)) {
result.add(new ArrayList<>(list.subList(start, end)));
start = end + 1;
}
end++;
}
if (start == list.size()) {
result.add(new ArrayList<>(0));
} else if (start < list.size()) {
result.add(new ArrayList<>(list.subList(start, list.size())));
}
return result;
}
public static <E> List<List<E>> split(List<E> list, int... index) {
if (list == null) {
return new ArrayList<>(0);
}
if (index == null || index.length == 0) {
ArrayList<List<E>> arrayList = new ArrayList<>();
arrayList.add(new ArrayList<>(list));
return arrayList;
}
if (index.length > list.size()) {
throw new IllegalArgumentException("{index}数量不能大于{list}长度。");
}
List<List<E>> result = new ArrayList<>();
int temp = 0;
for (int i : index) {
if (i < temp) {
throw new IllegalArgumentException("{index}的每个值必须比前一个大。");
}
if (i > list.size()) {
throw new IllegalArgumentException("{index}值不能大于{list}长度。");
}
result.add(new ArrayList<>(list.subList(temp, i)));
temp = i;
}
if (temp == list.size()) {
result.add(new ArrayList<>(0));
} else if (temp < list.size()) {
result.add(new ArrayList<>(list.subList(temp, list.size())));
}
return result;
}
public static <T> List<T> wrap(final T[] array) {
if (array == null) {
return null;
}
return new AbstractList<T>() {
public T get(int index) {
return (T)array[index];
}
public int size() {
return array.length;
}
public T set(int index, T element) {
T old = (T)array[index];
array[index] = element;
return old;
}
public void clear() {
throw new UnsupportedOperationException();
}
public int indexOf(Object o) {
if (o == null) {
for (int i = 0; i < array.length; i++) {
if (null == array[i]) {
return i;
}
}
} else {
for (int i = 0; i < array.length; i++) {
if (o.equals(array[i])) {
return i;
}
}
}
return -1;
}
public int lastIndexOf(Object o) {
if (o == null) {
for (int i = array.length - 1; i > -1; i--) {
if (null == array[i]) {
return i;
}
}
} else {
for (int i = array.length - 1; i > -1; i--) {
if (o.equals(array[i])) {
return i;
}
}
}
return -1;
}
public boolean removeAll(Collection<?> c) {
throw new UnsupportedOperationException();
}
public boolean retainAll(Collection<?> c) {
throw new UnsupportedOperationException();
}
};
}
public static <T> List<T> values(Map<?, T> map) {
if (map == null) {
return null;
}
List<T> list = new ArrayList<>(map.size());
for (T t : map.values()) {
list.add(t);
}
return list;
}
public static <T> List<T> keys(Map<T, ?> map) {
if (map == null) {
return null;
}
List<T> list = new ArrayList<>(map.size());
for (T t : map.keySet()) {
list.add(t);
}
return list;
}
public static <E> int countOccurrence(E element, Iterable<E> elements) {
if (elements == null) {
return 0;
}
int i = 0;
if (element == null) {
for (E e : elements) {
if (null == e) {
i++;
}
}
} else {
for (E e : elements) {
if (element.equals(e)) {
i++;
}
}
}
return i;
}
public static <E> E[] toArray(Collection<E> collection, Class<E> typeClass) {
E[] t = (E[])Array.newInstance(typeClass, collection.size());
int i = 0;
for (Iterator<E> iterator = collection.iterator(); iterator.hasNext(); i++) {
t[i] = iterator.next();
}
return t;
}
public static <E> Iterator<E> iterator(final Enumeration<E> enumeration) {
return new Iterator<E>() {
public boolean hasNext() {
return enumeration.hasMoreElements();
}
public E next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
return enumeration.nextElement();
}
public void remove() {
throw new UnsupportedOperationException("该迭代器没有指向的集合,所以移除元素为不支持的操作。");
}
};
}
public static <E> Enumeration<E> enumeration(final Iterator<E> iterator) {
return new Enumeration<E>() {
public boolean hasMoreElements() {
return iterator.hasNext();
}
public E nextElement() {
return iterator.next();
}
};
}
public static <T> void add(Collection<T> collection, Object value) {
if (value == null) {
collection.add(null);
} else if (value.getClass().isArray()) {
if (value instanceof Object[]) {
for (Object o : (Object[])value) {
collection.add((T)o);
}
} else {
int length = Array.getLength(value);
for (int i = 0; i < length; i++) {
collection.add((T)Array.get(value, i));
}
}
} else if (value instanceof Collection || value instanceof Stack) {
for (Object object : value) {
collection.add((T)object);
}
} else if (value instanceof Iterator) {
for (Iterator<T> iterator = (Iterator<T>)value; iterator.hasNext();) {
collection.add(iterator.next());
}
} else {
collection.add((T)value);
}
}
public static <T> void push(Stack<T> stack, Object value) {
if (value == null) {
stack.push((T)null);
} else if (value.getClass().isArray()) {
if (value instanceof Object[]) {
for (Object o : (Object[])value) {
stack.push((T)o);
}
} else {
int length = Array.getLength(value);
for (int i = 0; i < length; i++) {
stack.push((T)Array.get(value, i));
}
}
} else if (value instanceof Collection || value instanceof Stack) {
for (Object object : value) {
stack.push((T)object);
}
} else {
stack.push((T)value);
}
}
public static <K, V> MultiValueMap<K, V> synchronizedMultiValueMap(MultiValueMap<K, V> multiValueMap) {
if (multiValueMap == null) {
throw new IllegalArgumentException("The input argument is null!");
}
return new SynchronizedMultiValueMap<>(multiValueMap);
}
public static <K, V> MultiValueMap<K, V>
unmodifiableMultiValueMap(MultiValueMap<? extends K, ? extends V> multiValueMap) {
if (multiValueMap == null) {
throw new IllegalArgumentException("The input argument is null!");
}
return new UnmodifiableMultiValueMap<>(multiValueMap);
}
public static boolean isEmpty(Collection<?> collection) {
return (collection == null || collection.isEmpty());
}
public static boolean isEmpty(Stack<?> stack) {
return (stack == null || stack.isEmpty());
}
public static boolean isEmpty(Map<?, ?> map) {
return (map == null || map.isEmpty());
}
public static boolean isNotEmpty(Collection<?> collection) {
return (collection != null && !collection.isEmpty());
}
public static boolean isNotEmpty(Stack<?> stack) {
return (stack != null && !stack.isEmpty());
}
public static boolean isNotEmpty(Map<?, ?> map) {
return (map != null && !map.isEmpty());
}
private static boolean isComparable(List<?> list, List<?> compareList, int index) {
if (isEmpty(list) || isEmpty(compareList)) {
return false;
}
Assert.isTrue((index >= 0 && index < list.size()), "{index} 的值必须从0 至 list.size() - 1 之间。");
if (list.size() < compareList.size()) {
return false;
}
return true;
}
public static String[] toStringArray(Collection<?> collection) {
if (collection == null) {
return null;
}
String[] stringArray = new String[collection.size()];
int i = 0;
for (Object o : collection) {
stringArray[i] = StringUtils.toString(o);
i++;
}
return stringArray;
}
public static <K, V> void putAllIfAbsent(Map<K, V> map, Map<? extends K, ? extends V> paramMap) {
if (map == null || paramMap == null) {
return;
}
for (Map.Entry<? extends K, ? extends V> entry : paramMap.entrySet()) {
if (!map.containsKey(entry.getKey())) {
map.put(entry.getKey(), entry.getValue());
}
}
}
public static int calculateHashMapMinInitialCapacity(int size) {
return calculateHashMapMinInitialCapacity(size, 0.75F, 16);
}
public static int calculateHashMapMinInitialCapacity(int size, float loadFactor, int initlalCapcity) {
return Math.max((int)(size / loadFactor) + 1, initlalCapcity);
}
public static List<Integer> strArrayToList(String var) {
List<Integer> list = new ArrayList<>();
for (String v : var.split(",")) {
list.add(Integer.valueOf(Integer.parseInt(v)));
}
return list;
}
static class SynchronizedMultiValueMap<K, V> implements MultiValueMap<K, V> {
final MultiValueMap<K, V> multiValueMap;
final Object mutex;
private transient Set<K> keySet = null;
private transient Set<Map.Entry<K, List<V>>> entrySet;
private transient Collection<List<V>> values;
private transient Set<Map.Entry<K, V>> singleValueEntrySet;
private transient Collection<V> singleValues;
SynchronizedMultiValueMap(MultiValueMap<K, V> multiValueMap) {
if (multiValueMap == null) {
throw new IllegalArgumentException("The input argument is null!");
}
this.multiValueMap = multiValueMap;
this.mutex = this;
}
SynchronizedMultiValueMap(MultiValueMap<K, V> multiValueMap, Object mutex) {
if (multiValueMap == null) {
throw new IllegalArgumentException("The input argument is null!");
}
this.multiValueMap = multiValueMap;
this.mutex = mutex;
}
public void add(K key, V value) {
synchronized (this.mutex) {
this.multiValueMap.add(key, value);
}
}
public void addAll(K k, List<? extends V> list) {}
public void addAll(MultiValueMap<K, V> multiValueMap) {}
public void clear() {
synchronized (this.mutex) {
this.multiValueMap.clear();
}
}
public boolean containsKey(Object key) {
synchronized (this.mutex) {
return this.multiValueMap.containsKey(key);
}
}
public boolean containsValue(Object value) {
synchronized (this.mutex) {
return this.multiValueMap.containsValue(value);
}
}
public Set<Map.Entry<K, List<V>>> entrySet() {
synchronized (this.mutex) {
if (this.entrySet == null) {
this.entrySet = new CollectionUtils.SynchronizedSet<>(this.multiValueMap.entrySet(), this.mutex);
}
return this.entrySet;
}
}
public boolean equals(Object o) {
synchronized (this.mutex) {
return this.multiValueMap.equals(o);
}
}
public List<V> get(Object key) {
synchronized (this.mutex) {
return (List<V>)this.multiValueMap.get(key);
}
}
public V getFirst(K key) {
synchronized (this.mutex) {
return (V)this.multiValueMap.getFirst(key);
}
}
public int hashCode() {
synchronized (this.mutex) {
return this.multiValueMap.hashCode();
}
}
public boolean isEmpty() {
synchronized (this.mutex) {
return this.multiValueMap.isEmpty();
}
}
public Set<K> keySet() {
synchronized (this.mutex) {
if (this.keySet == null) {
this.keySet = new CollectionUtils.SynchronizedSet<>(this.multiValueMap.keySet(), this.mutex);
}
return this.keySet;
}
}
public List<V> put(K key, List<V> value) {
synchronized (this.mutex) {
return (List<V>)this.multiValueMap.put(key, value);
}
}
public void putAll(Map<? extends K, ? extends List<V>> t) {
synchronized (this.mutex) {
this.multiValueMap.putAll(t);
}
}
public List<V> remove(Object key) {
synchronized (this.mutex) {
return (List<V>)this.multiValueMap.remove(key);
}
}
public void set(K key, V value) {
synchronized (this.mutex) {
this.multiValueMap.set(key, value);
}
}
public void setAll(Map<K, V> values) {
synchronized (this.mutex) {
this.multiValueMap.setAll(values);
}
}
public int size() {
synchronized (this.mutex) {
return this.multiValueMap.size();
}
}
public Map<K, V> toSingleValueMap() {
synchronized (this.mutex) {
return this.multiValueMap.toSingleValueMap();
}
}
public Collection<List<V>> values() {
synchronized (this.mutex) {
if (this.values == null) {
this.values = new CollectionUtils.SynchronizedCollection<>(this.multiValueMap.values(), this.mutex);
}
return this.values;
}
}
public String toString() {
synchronized (this.mutex) {
return this.multiValueMap.toString();
}
}
private void writeObject(ObjectOutputStream s) throws IOException {
synchronized (this.mutex) {
s.defaultWriteObject();
}
}
}
static class SynchronizedCollection<E> implements Collection<E>, Serializable {
private static final long serialVersionUID = -7540724106974451779L;
final Collection<E> collection;
final Object mutex;
SynchronizedCollection(Collection<E> collection) {
if (collection == null) {
throw new IllegalArgumentException("The input argument is null!");
}
this.collection = collection;
this.mutex = this;
}
SynchronizedCollection(Collection<E> collection, Object mutex) {
if (collection == null) {
throw new IllegalArgumentException("The input argument is null!");
}
this.collection = collection;
this.mutex = mutex;
}
public int size() {
synchronized (this.mutex) {
return this.collection.size();
}
}
public boolean isEmpty() {
synchronized (this.mutex) {
return this.collection.isEmpty();
}
}
public boolean contains(Object o) {
synchronized (this.mutex) {
return this.collection.contains(o);
}
}
public Object[] toArray() {
synchronized (this.mutex) {
return this.collection.toArray();
}
}
public <T> T[] toArray(T[] a) {
synchronized (this.mutex) {
return this.collection.toArray(a);
}
}
public Iterator<E> iterator() {
return this.collection.iterator();
}
public boolean add(E o) {
synchronized (this.mutex) {
return this.collection.add(o);
}
}
public boolean remove(Object o) {
synchronized (this.mutex) {
return this.collection.remove(o);
}
}
public boolean containsAll(Collection<?> coll) {
synchronized (this.mutex) {
return this.collection.containsAll(coll);
}
}
public boolean addAll(Collection<? extends E> coll) {
synchronized (this.mutex) {
return this.collection.addAll(coll);
}
}
public boolean removeAll(Collection<?> coll) {
synchronized (this.mutex) {
return this.collection.removeAll(coll);
}
}
public boolean retainAll(Collection<?> coll) {
synchronized (this.mutex) {
return this.collection.retainAll(coll);
}
}
public void clear() {
synchronized (this.mutex) {
this.collection.clear();
}
}
public String toString() {
synchronized (this.mutex) {
return this.collection.toString();
}
}
private void writeObject(ObjectOutputStream s) throws IOException {
synchronized (this.mutex) {
s.defaultWriteObject();
}
}
}
static class SynchronizedSet<E> extends SynchronizedCollection<E> implements Set<E> {
private static final long serialVersionUID = 6982504952424781802L;
SynchronizedSet(Set<E> set) {
super(set);
}
SynchronizedSet(Set<E> set, Object mutex) {
super(set, mutex);
}
public boolean equals(Object o) {
synchronized (this.mutex) {
return this.collection.equals(o);
}
}
public int hashCode() {
synchronized (this.mutex) {
return this.collection.hashCode();
}
}
}
static class UnmodifiableMultiValueMap<K, V> implements MultiValueMap<K, V>, Serializable {
private static final long serialVersionUID = 7629840602579792180L;
final MultiValueMap<K, V> multiValueMap;
Set<Map.Entry<K, List<V>>> entrySet;
Collection<List<V>> values;
Set<K> keySet;
Map<K, V> singleValueMap;
UnmodifiableMultiValueMap(MultiValueMap<? extends K, ? extends V> multiValueMap) {
this.multiValueMap = (MultiValueMap)multiValueMap;
}
public void add(K key, V value) {
throw new UnsupportedOperationException();
}
public void addAll(K k, List<? extends V> list) {}
public void addAll(MultiValueMap<K, V> multiValueMap) {}
public void clear() {
throw new UnsupportedOperationException();
}
public boolean containsKey(Object key) {
return this.multiValueMap.containsKey(key);
}
public boolean containsValue(Object value) {
return this.multiValueMap.containsValue(value);
}
public Set<Map.Entry<K, List<V>>> entrySet() {
if (this.entrySet == null) {
this.entrySet = Collections.unmodifiableSet(this.multiValueMap.entrySet());
}
return this.entrySet;
}
public boolean equals(Object o) {
return this.multiValueMap.equals(o);
}
public List<V> get(Object key) {
return (List<V>)this.multiValueMap.get(key);
}
public V getFirst(K key) {
return (V)this.multiValueMap.getFirst(key);
}
public int hashCode() {
return this.multiValueMap.hashCode();
}
public boolean isEmpty() {
return this.multiValueMap.isEmpty();
}
public Set<K> keySet() {
if (this.keySet == null) {
this.keySet = Collections.unmodifiableSet(this.multiValueMap.keySet());
}
return this.keySet;
}
public List<V> put(K key, List<V> value) {
throw new UnsupportedOperationException();
}
public void putAll(Map<? extends K, ? extends List<V>> t) {
throw new UnsupportedOperationException();
}
public List<V> remove(Object key) {
throw new UnsupportedOperationException();
}
public void set(K key, V value) {
throw new UnsupportedOperationException();
}
public void setAll(Map<K, V> values) {
throw new UnsupportedOperationException();
}
public Set<Map.Entry<K, V>> singleValueEntrySet() {
return toSingleValueMap().entrySet();
}
public Collection<V> singleValues() {
return toSingleValueMap().values();
}
public int size() {
return this.multiValueMap.size();
}
public Map<K, V> toSingleValueMap() {
if (this.singleValueMap == null) {
this.singleValueMap = Collections.unmodifiableMap(this.multiValueMap.toSingleValueMap());
}
return this.singleValueMap;
}
public Collection<List<V>> values() {
if (this.values == null) {
this.values = Collections.unmodifiableCollection(this.multiValueMap.values());
}
return this.values;
}
}
}
@@ -0,0 +1,114 @@
package cn.cloudwalk.elevator.util;
public class CommunityConstants {
public static interface Common {
public static final String NOTE_TYPE_ORG = "1";
public static final String NOTE_TYPE_TAG = "2";
public static final String NOTE_TYPE_PERSON = "3";
public static final String NOTE_TYPE_EDG = "4";
public static final String ACCESS_NAME_SUFFIX = "门禁";
public static final Integer ACCESS_AUTO = Integer.valueOf(0);
public static final Integer ONE_HUNDRED = Integer.valueOf(100);
public static final Integer BATCH_SIZE = Integer.valueOf(500);
public static final Integer MAX_SHOW_CAPTURE = Integer.valueOf(7);
public static final String TEMP_PATH = "java.io.tmpdir";
public static final String FONT_PATH = "font/simsun.ttc";
public static final String TEMPLATE_NAME = "appraiseReportTemplate";
public static final String FONT_SUFFIX = ".ttc";
public static final String DASH = "-";
public static final String HTTP_PREFIX = "http://";
public static final String BR = "<br/>";
public static final String FORMAT = "yyyy/MM/dd/HH";
public static final String CLIENT_IP = "ClientIP";
}
public static interface Snap {
public static final String IMG_DOWNLOAD_PARSE_ERROR = "img_download_parse_error";
public static final String DATA_IMAGE_BASE64_HEAD = "data:image/";
}
public static interface Symbol {
public static final String COMMA = ",";
public static final String HYPHEN = "-";
public static final String COLON = ":";
}
public static interface Alarm {
public static final Integer IN = Integer.valueOf(1);
public static final Integer OUT = Integer.valueOf(0);
public static final String STRANGER = "STRANGER";
public static final String BLACK_LIST = "BLACK_LIST";
}
public static interface Redis {
public static final String EVENT_CODE_INC_KEY = "EVENT_CODE:INC_KEY";
public static final Integer EVENT_CODE_INC_MAX_VALUE = Integer.valueOf(9999);
public static final String TF_BRAIN_ACCESS_TOKEN = "tfbrain_access_token";
public static final String USER_TOKEN_KEY = "USER_TOKEN:%s";
public static final String OUT_IN_IMAGE_STORE = "upOutInStore";
public static final String AGREEMENT = "redis://";
public static final String LOCK = "redisLock";
public static final String OLD_AUTO_CREATE_SETTING = "OLD:AUTO_CREATE";
public static final String CHILD_AUTO_CREATE_SETTING = "CHILD:AUTO_CREATE:%s";
public static final String IMPORT_FAILURE_MSG = "IMPORT:FAILURE:%s";
public static final String VILLAGE_RECORD_LIST = "village:list";
public static final String COMMUNITY_LIST = "community:list";
public static final Long VALUE_CHANGE_EXPIRE_TIME = Long.valueOf(1L);
public static final String PROVINCE_TREE = "tree:province:level:%s";
}
public static interface Data {
public static final String MALE = "";
public static final String FEMALE = "";
public static final String ID = "id";
public static final String CREATE_TIME = "createTime";
public static final String LAST_UPDATE_TIME = "lastUpdateTime";
public static final String REGISTER_PERSON_ID = "register_person_id";
public static final String GRID_ID = "grid_id";
public static final Integer TOP_VALUE = Integer.valueOf(1);
public static final Integer NO_TOP_VALUE = Integer.valueOf(0);
public static final Integer PUBLISH_STATUS_1 = Integer.valueOf(1);
public static final Integer PUBLISH_STATUS_2 = Integer.valueOf(2);
public static final Integer PUBLISH_STATUS_3 = Integer.valueOf(3);
public static final String AGE = "age";
public static final String SEX = "sex";
public static final String COMMUNITY_ID = "community_id";
public static final String VILLAGE_ID = "village_id";
}
public static interface Dcs {
public static final String DCS_URL_ID_FORMAT = "%s:%s@%s:2015?dcsID=";
public static final String DCS_URL_FORMAT = "%s:%s@%s:2015";
}
public static interface Dcr {
public static final String HTTPS_PREFIX = "https://";
public static final String MID_PART_DOWNLOAD_URL = "/object/download?pool=";
public static final String MID_PART_UPLOAD_URL = "/object/upload/do?token=";
public static final String MID_DOWNLOAD_FILE_URL = "/simple-file/download?pool=";
public static final String MID_UPLOAD_FILE_URL = "/simple-file/upload/full?pool=";
public static final String PARA_PATH = "&path=";
public static final String PARA_SIZE = "&offset=0&size=";
public static final String PARA_ID = "&id=";
public static final String ID = "ID";
public static final String AUTH_TYPE = "Basic ";
public static final String AUTH = "authorization";
public static final String POOL = "pool";
public static final String TOKEN = "Token";
public static final String ADDRESS = "Address";
public static final String AUTH_SUFFIX = "/object/upload";
public static final Integer MAX_DOWNLOAD_SIZE = Integer.valueOf(16000000);
public static final String OFFSET = "&offset=";
public static final String SIZE = "&size=";
}
public static interface Icc {
public static final String ICC_RTSP_URL = "rtsp://%s:9090/dss/monitor/param?cameraid=%s%%24%s&substream=1";
public static final String ICC_PLAYBACK_RTSP_URL =
"rtsp://%s:9090/dss/playback/param?cameraid=%s%%24%s&substream=1&type=3";
public static final String ICC_OUTSIDE_HLS_URL = "/live/cameraid/%s%%24%s/substream/1.m3u8";
public static final String ICC_PLAYBACK_OUTSIDE_HLS_URL = "/vod/center/cameraid/%s%%24%s/substream/1";
public static final int DEVICE_TYPE_NVR = 6;
public static final int DEVICE_TYPE_IPC = 2;
}
}
@@ -0,0 +1,436 @@
package cn.cloudwalk.elevator.util;
import java.security.Timestamp;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.DayOfWeek;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.ZoneOffset;
import java.time.temporal.ChronoField;
import java.time.temporal.TemporalAdjusters;
import java.time.temporal.WeekFields;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class DateUtils {
private static final Logger logger = LoggerFactory.getLogger(DateUtils.class);
public static final long ONE_DAY_LONG = 86400000L;
public static final String YYYYMMDD = "yyyyMMdd";
public static final String STANDARD_FORMAT = "yyyy-MM-dd HH:mm";
public static final String YYYY_MM_DD = "yyyy-MM-dd";
public static final String YYYY_MM_DD_HMS = "yyyy-MM-dd HH:mm:ss";
public static final String HHMMSS = "HH:mm:ss";
public static final String YYYYMM = "yyyyMM";
public static final String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
public static long getCurrentTime() {
return System.currentTimeMillis();
}
public static String timestamp2String(Timestamp time, String pattern) {
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
return sdf.format(time.getTimestamp());
}
public static String formatDate(Date date, String pattern) {
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
return sdf.format(date);
}
public static int defaultFormat(Date date) {
return Integer.valueOf(formatDate(date, "yyyyMMdd")).intValue();
}
public static Date defaultFormat(String str) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
try {
return sdf.parse(str);
} catch (ParseException e) {
logger.error("日期格式转换失败", e);
return null;
}
}
public static Date customFormat(String str, String pattern) {
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
try {
return sdf.parse(str);
} catch (ParseException e) {
logger.error("日期格式转换失败", e);
return null;
}
}
public static int defaultFormat(long millis) {
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(millis);
return defaultFormat(cal.getTime());
}
public static String parseTimestamp(Timestamp time) {
return parseDate(time.getTimestamp());
}
public static String parseDate(Date date) {
try {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
return sdf.format(date);
} catch (Exception e) {
logger.error("日期格式转换失败", e);
return null;
}
}
public static String parseDate(Date date, String partern) {
try {
SimpleDateFormat sdf = new SimpleDateFormat(partern);
return sdf.format(date);
} catch (Exception e) {
logger.error("日期格式转换失败", e);
return null;
}
}
public static int getYear() {
Calendar cal = Calendar.getInstance();
cal.setTime(new Date());
return cal.get(1);
}
public static long getMonthFirstDate(Date date) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.set(5, 1);
calendar.set(11, 0);
calendar.set(12, 0);
calendar.set(13, 0);
calendar.set(14, 0);
return calendar.getTime().getTime();
}
public static long getMonthLastDate(Date date) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.set(5, calendar.getActualMaximum(5));
calendar.set(11, 23);
calendar.set(12, 59);
calendar.set(13, 59);
calendar.set(14, 999);
return calendar.getTime().getTime();
}
public static Long dateToStamp(String s) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
try {
Date date = simpleDateFormat.parse(s);
long ts = date.getTime();
return Long.valueOf(ts);
} catch (Exception e) {
logger.error("日期转为时间戳失败", e);
return Long.valueOf(0L);
}
}
public static String stampToDate(String s) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
long lt = (new Long(s)).longValue();
Date date = new Date(lt);
String res = simpleDateFormat.format(date);
return res;
}
public static String getTwoDaysDesc(Integer startTime, Integer endTime) {
String twoDayDesc;
List<Integer> days = new ArrayList<>();
if (null == startTime || null == endTime) {
return "";
}
DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
try {
Date start = dateFormat.parse(String.valueOf(startTime));
Date end = dateFormat.parse(String.valueOf(endTime));
Calendar tempStart = Calendar.getInstance();
tempStart.setTime(start);
Calendar tempEnd = Calendar.getInstance();
tempEnd.setTime(end);
tempEnd.add(5, 1);
while (tempStart.before(tempEnd)) {
days.add(Integer.valueOf(Integer.parseInt(dateFormat.format(tempStart.getTime()))));
tempStart.add(6, 1);
}
} catch (ParseException e) {
logger.error("时间转换失败", e);
}
int dayOfWeek = 7;
if (days.size() > dayOfWeek) {
twoDayDesc = "";
} else if (days.size() > 1) {
twoDayDesc = "";
} else {
twoDayDesc = "";
}
return twoDayDesc;
}
public static Long todayStart() {
Calendar calendar = Calendar.getInstance();
calendar.set(11, 0);
calendar.set(12, 0);
calendar.set(13, 0);
calendar.set(14, 0);
return Long.valueOf(calendar.getTimeInMillis());
}
public static Long dateToStampTomorrow(String s) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
try {
Date date = simpleDateFormat.parse(s);
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(5, 1);
long ts = cal.getTimeInMillis();
return Long.valueOf(ts);
} catch (Exception e) {
logger.error("日期转换失败", e);
return Long.valueOf(0L);
}
}
public static Date getDateSubDay(int day) {
Calendar cal = Calendar.getInstance();
cal.setTime(new Date());
cal.add(5, day);
return cal.getTime();
}
public static Date getDateSubDay(Date date, int day) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(5, day);
return cal.getTime();
}
public static Long todayStart(Date date) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.set(11, 0);
calendar.set(12, 0);
calendar.set(13, 0);
calendar.set(14, 0);
return Long.valueOf(calendar.getTimeInMillis());
}
public static Long todayEnd(Date date) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.set(11, 23);
calendar.set(12, 59);
calendar.set(13, 59);
calendar.set(14, 999);
return Long.valueOf(calendar.getTimeInMillis());
}
public static Long todayEnd() {
Calendar calendar = Calendar.getInstance();
calendar.set(11, 23);
calendar.set(12, 59);
calendar.set(13, 59);
calendar.set(14, 999);
return Long.valueOf(calendar.getTimeInMillis());
}
public static String formatTimeDuration(long duration, int format) {
boolean fu = false;
long fduration = duration;
if (duration < 0L) {
fu = true;
fduration = Math.abs(duration);
}
StringBuilder builder = new StringBuilder();
long sec = fduration / 1000L % 60L;
long min = fduration / 1000L / 60L % 60L;
long hour = fduration / 1000L / 60L / 60L % 24L;
long day = fduration / 1000L / 60L / 60L / 24L;
if (day > 0L && format > 0) {
format--;
builder.append(day).append("");
}
format--;
if (hour > 0L && format > 0) {
builder.append(hour).append("小时");
}
format--;
if (min > 0L && format > 0) {
builder.append(min).append("分钟");
}
format--;
if (sec > 0L && format > 0) {
builder.append(sec).append("");
}
if (fu) {
builder.insert(0, "-");
}
return builder.toString();
}
public static String formatTimeDurationHour(long duration, int format) {
if (duration == 0L) {
return "-";
}
long fduration = Math.abs(duration);
StringBuilder builder = new StringBuilder();
long sec = fduration / 1000L % 60L;
long min = fduration / 1000L / 60L % 60L;
long hour = fduration / 1000L / 60L / 60L;
if (hour > 0L && format > 0) {
builder.append(hour).append("小时");
}
format--;
if (min > 0L && format > 0) {
builder.append(min).append("分钟");
}
format--;
if (sec > 0L && format > 0) {
builder.append(sec).append("");
}
return builder.toString();
}
public static Date getMonth(Date date, int count) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
int month = calendar.get(2);
calendar.set(2, month - count);
return calendar.getTime();
}
public static int getYear(Date date) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
return calendar.get(1);
}
public static int getMonth(Date date) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
return calendar.get(2) + 1;
}
public static Long dateToStampFormat(String s, String format) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format);
try {
Date date = simpleDateFormat.parse(s);
return Long.valueOf(date.getTime());
} catch (Exception e) {
logger.error("日期转换失败", e);
return Long.valueOf(0L);
}
}
public static boolean timeIsInRound(String now, String start, String end, String format) {
Date nowTime, beginTime, endTime;
SimpleDateFormat df = new SimpleDateFormat(format);
try {
nowTime = df.parse(now);
beginTime = df.parse(start);
endTime = df.parse(end);
} catch (Exception e) {
logger.error("时间格式转换异常,原因=[{}]", e.getMessage(), e);
return false;
}
if (nowTime.getTime() >= beginTime.getTime() && nowTime.getTime() <= endTime.getTime()) {
return true;
}
return false;
}
public static int getDayOfWeek(Date date) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
return calendar.get(7);
}
public static LocalDateTime millToDate(Long mill) {
return LocalDateTime.ofInstant(Instant.ofEpochMilli(mill.longValue()), ZoneOffset.ofHours(8));
}
public static List<StartTimeAndEndTime> getCycle(Integer timeType, int cycleNum) {
LocalDateTime nowStartTime, nowEndTime;
int i;
LocalDateTime nowMonday, nowSunday;
int j;
LocalDateTime nowFirstDay, nowLastDay;
int k;
if (timeType == null) {
return Collections.emptyList();
}
List<StartTimeAndEndTime> timeList = new ArrayList<>(cycleNum);
switch (timeType.intValue()) {
case 0:
nowStartTime = LocalDateTime.of(LocalDate.now(), LocalTime.MIN);
nowEndTime = LocalDateTime.of(LocalDate.now(), LocalTime.MAX);
timeList.add(
new StartTimeAndEndTime(Long.valueOf(nowStartTime.toInstant(ZoneOffset.of("+8")).toEpochMilli()),
Long.valueOf(nowEndTime.toInstant(ZoneOffset.of("+8")).toEpochMilli()),
nowStartTime.getDayOfMonth() + ""));
for (i = 1; i < cycleNum; i++) {
LocalDateTime firstDay = nowStartTime.minusDays(i);
LocalDateTime lastDay = nowEndTime.minusDays(i);
timeList.add(
new StartTimeAndEndTime(Long.valueOf(firstDay.toInstant(ZoneOffset.of("+8")).toEpochMilli()),
Long.valueOf(lastDay.toInstant(ZoneOffset.of("+8")).toEpochMilli()),
firstDay.getDayOfMonth() + ""));
}
break;
case 1:
nowMonday = LocalDateTime.of(LocalDate.now(), LocalTime.MIN).with(DayOfWeek.MONDAY);
nowSunday = LocalDateTime.of(LocalDate.now(), LocalTime.MAX).with(DayOfWeek.SUNDAY);
timeList
.add(new StartTimeAndEndTime(Long.valueOf(nowMonday.toInstant(ZoneOffset.of("+8")).toEpochMilli()),
Long.valueOf(nowSunday.toInstant(ZoneOffset.of("+8")).toEpochMilli()),
nowMonday.get(WeekFields.ISO.weekOfWeekBasedYear()) + ""));
for (j = 1; j < cycleNum; j++) {
LocalDateTime lastMonday = nowMonday.minusWeeks(j);
LocalDateTime lastSunday = nowSunday.minusWeeks(j);
timeList.add(
new StartTimeAndEndTime(Long.valueOf(lastMonday.toInstant(ZoneOffset.of("+8")).toEpochMilli()),
Long.valueOf(lastSunday.toInstant(ZoneOffset.of("+8")).toEpochMilli()),
lastMonday.get(WeekFields.ISO.weekOfWeekBasedYear()) + ""));
}
break;
case 2:
nowFirstDay =
LocalDateTime.of(LocalDate.now(), LocalTime.MIN).with(TemporalAdjusters.firstDayOfMonth());
nowLastDay = LocalDateTime.of(LocalDate.now(), LocalTime.MAX).with(TemporalAdjusters.lastDayOfMonth());
timeList.add(
new StartTimeAndEndTime(Long.valueOf(nowFirstDay.toInstant(ZoneOffset.of("+8")).toEpochMilli()),
Long.valueOf(nowLastDay.toInstant(ZoneOffset.of("+8")).toEpochMilli()),
nowFirstDay.get(ChronoField.MONTH_OF_YEAR) + ""));
for (k = 1; k < cycleNum; k++) {
LocalDateTime firstDay = LocalDateTime.now().minusMonths(k)
.with(TemporalAdjusters.firstDayOfMonth()).with(LocalTime.MIN);
LocalDateTime lastDay =
LocalDateTime.now().minusMonths(k).with(TemporalAdjusters.lastDayOfMonth()).with(LocalTime.MAX);
timeList.add(
new StartTimeAndEndTime(Long.valueOf(firstDay.toInstant(ZoneOffset.of("+8")).toEpochMilli()),
Long.valueOf(lastDay.toInstant(ZoneOffset.of("+8")).toEpochMilli()),
firstDay.get(ChronoField.MONTH_OF_YEAR) + ""));
}
break;
}
return timeList;
}
public static void main(String[] args) {
System.out.println(">>>>>>>>>>>>>>" + dateToStampFormat("202002", "yyyyMM"));
}
}
@@ -0,0 +1,74 @@
package cn.cloudwalk.elevator.util;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.Module;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class JsonUtils {
private static final Logger log = LoggerFactory.getLogger(JsonUtils.class);
private static final Logger logger = LoggerFactory.getLogger(DateUtils.class);
public static String toJson(Object obj) {
ObjectMapper mapper = objectMapper();
try {
return mapper.writeValueAsString(obj);
} catch (JsonProcessingException e) {
logger.warn("json parase exception :{}", e.getMessage());
return null;
}
}
public static <T> T toObj(String json, Class<T> clazz) {
ObjectMapper mapper = objectMapper();
T value = null;
try {
value = (T)mapper.readValue(json, clazz);
} catch (IOException e) {
logger.warn("json parase exception :{}", e.getMessage());
}
return value;
}
public static <T> T toObj(String json, TypeReference<T> tTypeReference) {
ObjectMapper mapper = objectMapper();
T value = null;
try {
value = (T)mapper.readValue(json, tTypeReference);
} catch (IOException e) {
logger.warn("json parase exception :{}", e.getMessage());
}
return value;
}
public static <T> List<T> toObjList(String json, Class<T> clazz) {
ObjectMapper mapper = objectMapper();
List<T> value = null;
try {
JavaType jt = mapper.getTypeFactory().constructParametricType(ArrayList.class, new Class[] {clazz});
value = (List<T>)mapper.readValue(json, jt);
} catch (IOException e) {
logger.warn("json parase exception :{}", e.getMessage());
}
return value;
}
public static ObjectMapper objectMapper() {
ObjectMapper mapper = new ObjectMapper();
mapper.registerModule((Module)new JavaTimeModule());
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
return mapper;
}
}
@@ -0,0 +1,163 @@
package cn.cloudwalk.elevator.util;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.net.URI;
import java.util.List;
import javax.annotation.PostConstruct;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.stereotype.Component;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
@Component
public class RestTemplateUtil {
private static final Logger logger = LoggerFactory.getLogger(DateUtils.class);
private static RestTemplate restTemplate;
private static class SingletonRestTemplate {
static SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
static {
requestFactory.setConnectTimeout(10000);
requestFactory.setReadTimeout(10000);
}
static final RestTemplate INSTANCE = new RestTemplate((ClientHttpRequestFactory)requestFactory);
}
@PostConstruct
public void getInstance() {
RestTemplate restTemplate = SingletonRestTemplate.INSTANCE;
List<HttpMessageConverter<?>> converterList = restTemplate.getMessageConverters();
HttpMessageConverter<?> converterTarget = null;
for (HttpMessageConverter<?> item : converterList) {
if (MappingJackson2HttpMessageConverter.class == item.getClass()) {
converterTarget = item;
break;
}
}
if (null != converterTarget) {
converterList.remove(converterTarget);
}
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
converterList.add(new MappingJackson2HttpMessageConverter(objectMapper));
RestTemplateUtil.restTemplate = restTemplate;
}
public static String get(String url) {
HttpHeaders headers = new HttpHeaders();
headers.add("Accept", "application/json");
headers.add("Content-Encoding", "UTF-8");
headers.add("Content-Type", "application/json; charset=UTF-8");
HttpEntity<String> requestEntity = new HttpEntity(null, (MultiValueMap)headers);
ResponseEntity<String> response =
restTemplate.exchange(url, HttpMethod.GET, requestEntity, String.class, new Object[0]);
return (String)response.getBody();
}
public static String get(URI url, HttpHeaders headers) {
HttpEntity<String> requestEntity = new HttpEntity(null, (MultiValueMap)headers);
ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.GET, requestEntity, String.class);
return (String)response.getBody();
}
public static <T> T get(URI url, HttpHeaders headers, Class<T> responseType) {
HttpEntity<Object> requestEntity = new HttpEntity(null, (MultiValueMap)headers);
T resultEntity = null;
try {
ResponseEntity<T> result = restTemplate.exchange(url, HttpMethod.GET, requestEntity, responseType);
resultEntity = getResultEntity(result, url);
} catch (Exception e) {
logger.warn(">>>>>>>>>>>>>>>>>【{}】接口调用失败,错误信息", url, e);
}
return resultEntity;
}
public static <T> T post(URI url, Object data, HttpHeaders headers, Class<T> responseType) {
HttpEntity<Object> requestEntity = new HttpEntity(data, (MultiValueMap)headers);
T resultEntity = null;
try {
logger.info(">>>>>>>>>>>>>>>>>开始请求接口:{}payload:{},", url.toString(), data);
ResponseEntity<T> result = restTemplate.postForEntity(url, requestEntity, responseType);
resultEntity = getResultEntity(result, url);
} catch (Exception e) {
logger.warn(">>>>>>>>>>>>>>>>>接口调用失败,错误信息:{}", e.getMessage());
}
return resultEntity;
}
public static <T> T postTf(URI url, Object data, HttpHeaders headers, Class<T> responseType) throws Exception {
HttpEntity<Object> requestEntity = new HttpEntity(data, (MultiValueMap)headers);
T resultEntity = null;
try {
logger.info(">>>>>>>>>>>>>>>>>开始请求接口:{},payload:{},", url.toString(), data);
ResponseEntity<T> result = restTemplate.postForEntity(url, requestEntity, responseType);
resultEntity = getTfResultEntity(result, url);
} catch (Exception e) {
logger.warn(">>>>>>>>>>>>>>>>>接口调用失败,错误信息:{}", e.getMessage());
throw e;
}
return resultEntity;
}
public static <T> T post(URI url, Object data, HttpHeaders headers, TypeReference<T> tTypeReference) {
HttpEntity<Object> requestEntity = new HttpEntity(data, (MultiValueMap)headers);
T resultEntity = null;
try {
ResponseEntity<String> result = restTemplate.postForEntity(url, requestEntity, String.class);
if (HttpStatus.OK == result.getStatusCode()) {
if (logger.isDebugEnabled()) {
logger.debug("接口返回值:{}", JsonUtils.toJson(result.getBody()));
}
return JsonUtils.toObj((String)result.getBody(), tTypeReference);
}
logger.info(">>>>>>>>>>>>>>>>>接口调用失败,状态码:{},错误原因:{}", result.getStatusCode(),
JsonUtils.toJson(result.getBody()));
} catch (Exception e) {
logger.warn(">>>>>>>>>>>>>>>>>接口调用失败,错误信息:{}", e.getMessage());
}
return resultEntity;
}
private static <T> T getTfResultEntity(ResponseEntity<T> result, URI url) throws Exception {
HttpStatus statusCode = result.getStatusCode();
if (HttpStatus.OK == statusCode) {
logger.info(">>>>>>>>>>>>>>>>>接口:{} 调用成功", url);
if (logger.isDebugEnabled()) {
logger.debug("接口返回值:{}", JsonUtils.toJson(result.getBody()));
}
return (T)result.getBody();
}
logger.info(">>>>>>>>>>>>>>>>>接口调用失败,状态码:{},错误原因:{}", statusCode, JsonUtils.toJson(result.getBody()));
if (HttpStatus.UNAUTHORIZED == statusCode) {
throw new Exception(statusCode.toString());
}
return null;
}
private static <T> T getResultEntity(ResponseEntity<T> result, URI url) {
if (HttpStatus.OK == result.getStatusCode()) {
logger.info(">>>>>>>>>>>>>>>>>接口:{} 调用成功", url);
if (logger.isDebugEnabled()) {
logger.debug("接口返回值:{}", JsonUtils.toJson(result.getBody()));
}
return (T)result.getBody();
}
logger.info(">>>>>>>>>>>>>>>>>接口调用失败,状态码:{},错误原因:{}", result.getStatusCode(),
JsonUtils.toJson(result.getBody()));
return null;
}
}
@@ -0,0 +1,37 @@
package cn.cloudwalk.elevator.util;
public class StartTimeAndEndTime {
public StartTimeAndEndTime(Long startTime, Long endTime, String currentTime) {
this.startTime = startTime;
this.endTime = endTime;
this.currentTime = currentTime;
}
private Long startTime;
private Long endTime;
private String currentTime;
public Long getStartTime() {
return this.startTime;
}
public void setStartTime(Long startTime) {
this.startTime = startTime;
}
public Long getEndTime() {
return this.endTime;
}
public void setEndTime(Long endTime) {
this.endTime = endTime;
}
public String getCurrentTime() {
return this.currentTime;
}
public void setCurrentTime(String currentTime) {
this.currentTime = currentTime;
}
}
@@ -0,0 +1,19 @@
package cn.cloudwalk.elevator.util;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
import java.util.function.Predicate;
public class ToolUtil {
public static String generateUUID() {
String uuid = UUID.randomUUID().toString();
return uuid.replaceAll("-", "");
}
public static <T> Predicate<T> distinctByKey(Function<? super T, ?> keyExtractor) {
Set<Object> seen = ConcurrentHashMap.newKeySet();
return t -> seen.add(keyExtractor.apply(t));
}
}
@@ -0,0 +1,12 @@
Manifest-Version: 1.0
Implementation-Title: cw-elevator-application-common
Implementation-Version: 1.0-SNAPSHOT
Archiver-Version: Plexus Archiver
Built-By: YCWB0304
Implementation-Vendor-Id: cn.cloudwalk.elevator
Created-By: Apache Maven 3.6.1
Build-Jdk: 1.8.0_144
Implementation-URL: http://projects.spring.io/spring-boot/cw-elevator-
application/cw-elevator-application-common/
Implementation-Vendor: Pivotal Software, Inc.
@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>cn.cloudwalk.elevator</groupId>
<artifactId>cw-elevator-application-decompiled-reactor</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>cw-elevator-application-data</artifactId>
<packaging>jar</packaging>
<properties>
<alibaba.eclipse.codestyle.path>${project.basedir}/../../docs/style/alibaba-eclipse-codestyle.xml</alibaba.eclipse.codestyle.path>
</properties>
<dependencies>
<dependency>
<groupId>cn.cloudwalk.elevator</groupId>
<artifactId>cw-elevator-application-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>cn.cloudwalk.cloud</groupId>
<artifactId>cloudwalk-common-result</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-autoconfigure</artifactId>
</dependency>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>sharding-jdbc-spring-boot-starter</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>net.revelc.code.formatter</groupId>
<artifactId>formatter-maven-plugin</artifactId>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
</build>
</project>
@@ -0,0 +1,51 @@
package cn.cloudwalk.elevator;
import cn.cloudwalk.elevator.util.DateUtils;
import com.google.common.collect.Range;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import org.apache.shardingsphere.api.sharding.standard.PreciseShardingAlgorithm;
import org.apache.shardingsphere.api.sharding.standard.PreciseShardingValue;
import org.apache.shardingsphere.api.sharding.standard.RangeShardingAlgorithm;
import org.apache.shardingsphere.api.sharding.standard.RangeShardingValue;
import org.springframework.util.CollectionUtils;
public class YearlyShardingAlgorithm implements PreciseShardingAlgorithm<Long>, RangeShardingAlgorithm<Long> {
public String doSharding(Collection<String> availableTargetNames, PreciseShardingValue<Long> shardingValue) {
Long time = (Long)shardingValue.getValue();
String suffix = DateUtils.formatDate(new Date(time.longValue()), "yyyy");
String logicTableName = shardingValue.getLogicTableName();
String actualTableName = logicTableName + "_" + suffix;
if (!availableTargetNames.contains(actualTableName))
;
return actualTableName;
}
public Collection<String> doSharding(Collection<String> availableTargetNames,
RangeShardingValue<Long> shardingValue) {
Collection<String> availables = new ArrayList<>();
Range<Long> valueRange = shardingValue.getValueRange();
if (!CollectionUtils.isEmpty(availableTargetNames)) {
Integer lowerBoundYear = Integer.valueOf(-2147483648);
Integer upperBoundYear = Integer.valueOf(2147483647);
if (valueRange.hasLowerBound()) {
lowerBoundYear = Integer.valueOf(Integer
.parseInt(DateUtils.formatDate(new Date(((Long)valueRange.lowerEndpoint()).longValue()), "YYYY")));
}
if (valueRange.hasUpperBound()) {
upperBoundYear = Integer.valueOf(Integer
.parseInt(DateUtils.formatDate(new Date(((Long)valueRange.upperEndpoint()).longValue()), "YYYY")));
}
for (String targetTable : availableTargetNames) {
Integer tableNameSuffix = Integer.valueOf(Integer.parseInt(
targetTable.substring(targetTable.lastIndexOf('_') + 1, targetTable.lastIndexOf('_') + 5)));
if (tableNameSuffix.compareTo(lowerBoundYear) < 0 || tableNameSuffix.compareTo(upperBoundYear) > 0) {
continue;
}
availables.add(targetTable);
}
}
return availables;
}
}
@@ -0,0 +1,15 @@
package cn.cloudwalk.elevator.codeElevatorArea.dao;
import cn.cloudwalk.cloud.exception.ServiceException;
import cn.cloudwalk.elevator.codeElevatorArea.dto.AcsElevatorCodeDTO;
import cn.cloudwalk.elevator.codeElevatorArea.dto.AcsElevatorCodeResultDTO;
public interface AcsElevatorCodeDao {
Integer insertNew(AcsElevatorCodeDTO paramAcsElevatorCodeDTO) throws ServiceException;
Integer updateOld(AcsElevatorCodeDTO paramAcsElevatorCodeDTO) throws ServiceException;
AcsElevatorCodeResultDTO get(AcsElevatorCodeDTO paramAcsElevatorCodeDTO);
AcsElevatorCodeResultDTO getFirstByParentId(String paramString);
}
@@ -0,0 +1,43 @@
package cn.cloudwalk.elevator.codeElevatorArea.dto;
import cn.cloudwalk.cloud.entity.CloudwalkBaseTimes;
import java.io.Serializable;
public class AcsElevatorCodeDTO extends CloudwalkBaseTimes implements Serializable {
private String zoneId;
private String code;
private String parentId;
private Integer isFirst;
public String getZoneId() {
return this.zoneId;
}
public void setZoneId(String zoneId) {
this.zoneId = zoneId;
}
public String getCode() {
return this.code;
}
public void setCode(String code) {
this.code = code;
}
public Integer getIsFirst() {
return this.isFirst;
}
public void setIsFirst(Integer isFirst) {
this.isFirst = isFirst;
}
public String getParentId() {
return this.parentId;
}
public void setParentId(String parentId) {
this.parentId = parentId;
}
}
@@ -0,0 +1,58 @@
package cn.cloudwalk.elevator.codeElevatorArea.dto;
public class AcsElevatorCodeQueryDTO {
private String zoneId;
private String id;
private String zoneName;
private String zoneType;
private String code;
private Integer isFirst;
public String getZoneId() {
return this.zoneId;
}
public void setZoneId(String zoneId) {
this.zoneId = zoneId;
}
public String getCode() {
return this.code;
}
public void setCode(String code) {
this.code = code;
}
public String getZoneName() {
return this.zoneName;
}
public void setZoneName(String zoneName) {
this.zoneName = zoneName;
}
public String getZoneType() {
return this.zoneType;
}
public void setZoneType(String zoneType) {
this.zoneType = zoneType;
}
public String getId() {
return this.id;
}
public void setId(String id) {
this.id = id;
}
public Integer getIsFirst() {
return this.isFirst;
}
public void setIsFirst(Integer isFirst) {
this.isFirst = isFirst;
}
}
@@ -0,0 +1,31 @@
package cn.cloudwalk.elevator.codeElevatorArea.dto;
public class AcsElevatorCodeResultDTO {
private String zoneId;
private String code;
private Integer isFirst;
public String getZoneId() {
return this.zoneId;
}
public void setZoneId(String zoneId) {
this.zoneId = zoneId;
}
public String getCode() {
return this.code;
}
public void setCode(String code) {
this.code = code;
}
public Integer getIsFirst() {
return this.isFirst;
}
public void setIsFirst(Integer isFirst) {
this.isFirst = isFirst;
}
}
@@ -0,0 +1,31 @@
package cn.cloudwalk.elevator.codeElevatorArea.impl;
import cn.cloudwalk.cloud.exception.ServiceException;
import cn.cloudwalk.elevator.codeElevatorArea.dao.AcsElevatorCodeDao;
import cn.cloudwalk.elevator.codeElevatorArea.dto.AcsElevatorCodeDTO;
import cn.cloudwalk.elevator.codeElevatorArea.dto.AcsElevatorCodeResultDTO;
import cn.cloudwalk.elevator.codeElevatorArea.mapper.AcsElevatorCodeMapper;
import javax.annotation.Resource;
import org.springframework.stereotype.Repository;
@Repository
public class AcsElevatorCodeDaoImpl implements AcsElevatorCodeDao {
@Resource
private AcsElevatorCodeMapper acsElevatorCodeMapper;
public Integer insertNew(AcsElevatorCodeDTO dto) throws ServiceException {
return Integer.valueOf(this.acsElevatorCodeMapper.insertNew(dto));
}
public Integer updateOld(AcsElevatorCodeDTO dto) throws ServiceException {
return Integer.valueOf(this.acsElevatorCodeMapper.updateOld(dto));
}
public AcsElevatorCodeResultDTO get(AcsElevatorCodeDTO dto) {
return this.acsElevatorCodeMapper.get(dto);
}
public AcsElevatorCodeResultDTO getFirstByParentId(String parentId) {
return this.acsElevatorCodeMapper.getFirstByParentId(parentId);
}
}
@@ -0,0 +1,14 @@
package cn.cloudwalk.elevator.codeElevatorArea.mapper;
import cn.cloudwalk.elevator.codeElevatorArea.dto.AcsElevatorCodeDTO;
import cn.cloudwalk.elevator.codeElevatorArea.dto.AcsElevatorCodeResultDTO;
public interface AcsElevatorCodeMapper {
AcsElevatorCodeResultDTO get(AcsElevatorCodeDTO paramAcsElevatorCodeDTO);
int insertNew(AcsElevatorCodeDTO paramAcsElevatorCodeDTO);
int updateOld(AcsElevatorCodeDTO paramAcsElevatorCodeDTO);
AcsElevatorCodeResultDTO getFirstByParentId(String paramString);
}
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.cloudwalk.elevator.codeElevatorArea.mapper.AcsElevatorCodeMapper">
<insert id="insertNew" parameterType="cn.cloudwalk.elevator.codeElevatorArea.dto.AcsElevatorCodeDTO">
insert into code_elevator_area (zone_id, code, create_time, last_update_time,is_first,parent_id)
values (#{zoneId,jdbcType=VARCHAR}, #{code,jdbcType=VARCHAR},
#{createTime,jdbcType=BIGINT},
#{lastUpdateTime,jdbcType=BIGINT},#{isFirst,jdbcType=TINYINT}, #{parentId,jdbcType=VARCHAR})
</insert>
<select id="get" resultType="cn.cloudwalk.elevator.codeElevatorArea.dto.AcsElevatorCodeResultDTO">
SELECT zone_id AS zoneId,code,is_first AS isFirst
FROM code_elevator_area
WHERE zone_id = #{zoneId,jdbcType=VARCHAR}
</select>
<select id="getFirstByParentId" resultType="cn.cloudwalk.elevator.codeElevatorArea.dto.AcsElevatorCodeResultDTO">
SELECT zone_id AS zoneId,code,is_first AS isFirst
FROM code_elevator_area
WHERE parent_id = #{parentId,jdbcType=VARCHAR}
and is_first = 1
</select>
<update id="updateOld" parameterType="cn.cloudwalk.elevator.codeElevatorArea.dto.AcsElevatorCodeDTO">
update code_elevator_area
<trim prefix="set" suffixOverrides=",">
<if test="lastUpdateTime != null">
last_update_time = #{lastUpdateTime, jdbcType=BIGINT},
</if>
<if test="code != null">
code = #{code, jdbcType=VARCHAR},
</if>
<if test="isFirst != null">
is_first = #{isFirst, jdbcType=TINYINT},
</if>
</trim>
<where>
zone_id = #{zoneId, jdbcType=VARCHAR}
</where>
</update>
</mapper>
@@ -0,0 +1,14 @@
package cn.cloudwalk.elevator.device.dao;
import cn.cloudwalk.elevator.device.dto.AcsDeviceTaskAddDto;
import cn.cloudwalk.elevator.device.dto.AcsDeviceTaskDTO;
public interface AcsDeviceTaskDao {
Integer insert(AcsDeviceTaskAddDto paramAcsDeviceTaskAddDto);
Integer updateBingDevices(AcsDeviceTaskAddDto paramAcsDeviceTaskAddDto);
Integer updateIsStop(AcsDeviceTaskAddDto paramAcsDeviceTaskAddDto);
AcsDeviceTaskDTO getById(String paramString);
}
@@ -0,0 +1,46 @@
package cn.cloudwalk.elevator.device.dao;
import cn.cloudwalk.cloud.exception.DataAccessException;
import cn.cloudwalk.cloud.exception.ServiceException;
import cn.cloudwalk.cloud.page.CloudwalkPageAble;
import cn.cloudwalk.cloud.page.CloudwalkPageInfo;
import cn.cloudwalk.elevator.device.dto.AcsElevatorDeviceAddDTO;
import cn.cloudwalk.elevator.device.dto.AcsElevatorDeviceEditDTO;
import cn.cloudwalk.elevator.device.dto.AcsElevatorDeviceListByBuildingIdDto;
import cn.cloudwalk.elevator.device.dto.AcsElevatorDeviceListDto;
import cn.cloudwalk.elevator.device.dto.AcsElevatorDeviceQueryByIdDTO;
import cn.cloudwalk.elevator.device.dto.AcsElevatorDeviceQueryDTO;
import cn.cloudwalk.elevator.device.dto.AcsElevatorDeviceResultDTO;
import java.util.List;
public interface AcsElevatorDeviceDao {
Integer add(AcsElevatorDeviceAddDTO paramAcsElevatorDeviceAddDTO) throws DataAccessException;
Integer edit(AcsElevatorDeviceEditDTO paramAcsElevatorDeviceEditDTO) throws DataAccessException;
Integer delete(List<String> paramList) throws DataAccessException;
CloudwalkPageAble<AcsElevatorDeviceResultDTO> page(AcsElevatorDeviceQueryDTO paramAcsElevatorDeviceQueryDTO,
CloudwalkPageInfo paramCloudwalkPageInfo) throws DataAccessException;
List<AcsElevatorDeviceResultDTO> listByZoneId(AcsElevatorDeviceListDto paramAcsElevatorDeviceListDto)
throws DataAccessException;
List<AcsElevatorDeviceResultDTO> listByZoneIds(AcsElevatorDeviceListDto paramAcsElevatorDeviceListDto)
throws DataAccessException;
List<AcsElevatorDeviceResultDTO> listBuBuildingId(
AcsElevatorDeviceListByBuildingIdDto paramAcsElevatorDeviceListByBuildingIdDto) throws DataAccessException;
List<AcsElevatorDeviceResultDTO> get(AcsElevatorDeviceQueryDTO paramAcsElevatorDeviceQueryDTO)
throws ServiceException;
AcsElevatorDeviceResultDTO getById(AcsElevatorDeviceQueryByIdDTO paramAcsElevatorDeviceQueryByIdDTO)
throws ServiceException;
AcsElevatorDeviceResultDTO getByDeciveCode(String paramString) throws ServiceException;
String getBuildingId(AcsElevatorDeviceQueryDTO paramAcsElevatorDeviceQueryDTO) throws ServiceException;
String getBusinessId(AcsElevatorDeviceQueryDTO paramAcsElevatorDeviceQueryDTO) throws ServiceException;
}
@@ -0,0 +1,9 @@
package cn.cloudwalk.elevator.device.dao;
import cn.cloudwalk.cloud.exception.ServiceException;
public interface DeviceImageStoreDao {
Boolean save(String paramString1, String paramString2) throws ServiceException;
String getByBuildingId(String paramString) throws ServiceException;
}
@@ -0,0 +1,98 @@
package cn.cloudwalk.elevator.device.dto;
import java.io.Serializable;
import java.util.List;
public class AcsDeviceQueryDTO implements Serializable {
private static final long serialVersionUID = -9107652629099620576L;
private String id;
private List<String> ids;
private String businessId;
private String deviceId;
private List<String> deviceIds;
private String deviceCode;
private String parentDeviceId;
private List<String> parentDeviceIds;
private Integer openStatus;
private Integer queryParent;
public String getId() {
return this.id;
}
public void setId(String id) {
this.id = id;
}
public List<String> getIds() {
return this.ids;
}
public void setIds(List<String> ids) {
this.ids = ids;
}
public String getBusinessId() {
return this.businessId;
}
public void setBusinessId(String businessId) {
this.businessId = businessId;
}
public String getDeviceId() {
return this.deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public List<String> getDeviceIds() {
return this.deviceIds;
}
public void setDeviceIds(List<String> deviceIds) {
this.deviceIds = deviceIds;
}
public String getDeviceCode() {
return this.deviceCode;
}
public void setDeviceCode(String deviceCode) {
this.deviceCode = deviceCode;
}
public String getParentDeviceId() {
return this.parentDeviceId;
}
public void setParentDeviceId(String parentDeviceId) {
this.parentDeviceId = parentDeviceId;
}
public List<String> getParentDeviceIds() {
return this.parentDeviceIds;
}
public void setParentDeviceIds(List<String> parentDeviceIds) {
this.parentDeviceIds = parentDeviceIds;
}
public Integer getQueryParent() {
return this.queryParent;
}
public void setQueryParent(Integer queryParent) {
this.queryParent = queryParent;
}
public Integer getOpenStatus() {
return this.openStatus;
}
public void setOpenStatus(Integer openStatus) {
this.openStatus = openStatus;
}
}
@@ -0,0 +1,71 @@
package cn.cloudwalk.elevator.device.dto;
import cn.cloudwalk.cloud.entity.CloudwalkBaseTimes;
import java.io.Serializable;
public class AcsDeviceResultDTO extends CloudwalkBaseTimes implements Serializable {
private static final long serialVersionUID = 6868258119634367362L;
private String id;
private String businessId;
private String deviceId;
private String deviceCode;
private String parentDeviceId;
private String imageStoreId;
private Integer openStatus;
public String getId() {
return this.id;
}
public void setId(String id) {
this.id = id;
}
public String getBusinessId() {
return this.businessId;
}
public void setBusinessId(String businessId) {
this.businessId = businessId;
}
public String getDeviceId() {
return this.deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public String getDeviceCode() {
return this.deviceCode;
}
public void setDeviceCode(String deviceCode) {
this.deviceCode = deviceCode;
}
public String getParentDeviceId() {
return this.parentDeviceId;
}
public void setParentDeviceId(String parentDeviceId) {
this.parentDeviceId = parentDeviceId;
}
public String getImageStoreId() {
return this.imageStoreId;
}
public void setImageStoreId(String imageStoreId) {
this.imageStoreId = imageStoreId;
}
public Integer getOpenStatus() {
return this.openStatus;
}
public void setOpenStatus(Integer openStatus) {
this.openStatus = openStatus;
}
}
@@ -0,0 +1,35 @@
package cn.cloudwalk.elevator.device.dto;
import cn.cloudwalk.cloud.entity.CloudwalkBaseTimes;
import java.io.Serializable;
public class AcsDeviceTaskAddDto extends CloudwalkBaseTimes implements Serializable {
private static final long serialVersionUID = 6909321999650444051L;
private Integer allDevices;
private Integer bindDevices;
private Integer isStop;
public Integer getAllDevices() {
return this.allDevices;
}
public void setAllDevices(Integer allDevices) {
this.allDevices = allDevices;
}
public Integer getBindDevices() {
return this.bindDevices;
}
public void setBindDevices(Integer bindDevices) {
this.bindDevices = bindDevices;
}
public Integer getIsStop() {
return this.isStop;
}
public void setIsStop(Integer isStop) {
this.isStop = isStop;
}
}
@@ -0,0 +1,43 @@
package cn.cloudwalk.elevator.device.dto;
import java.io.Serializable;
public class AcsDeviceTaskDTO implements Serializable {
private static final long serialVersionUID = -3746361327881264974L;
private String id;
private Integer allDevices;
private Integer bindDevices;
private Integer isStop;
public String getId() {
return this.id;
}
public void setId(String id) {
this.id = id;
}
public Integer getAllDevices() {
return this.allDevices;
}
public void setAllDevices(Integer allDevices) {
this.allDevices = allDevices;
}
public Integer getBindDevices() {
return this.bindDevices;
}
public void setBindDevices(Integer bindDevices) {
this.bindDevices = bindDevices;
}
public Integer getIsStop() {
return this.isStop;
}
public void setIsStop(Integer isStop) {
this.isStop = isStop;
}
}
@@ -0,0 +1,151 @@
package cn.cloudwalk.elevator.device.dto;
import cn.cloudwalk.cloud.entity.CloudwalkBaseTimes;
import java.io.Serializable;
public class AcsElevatorDeviceAddDTO extends CloudwalkBaseTimes implements Serializable {
private String businessId;
private String deviceId;
private String deviceCode;
private String deviceName;
private String deviceTypeName;
private String elevatorFloorList;
private String currentFloorId;
private String currentFloor;
private String currentBuilding;
private String currentBuildingId;
private String areaName;
private Integer status;
private Integer deleteFlag;
private String areaId;
private String elevatorFloorIdList;
public String getElevatorFloorIdList() {
return this.elevatorFloorIdList;
}
public void setElevatorFloorIdList(String elevatorFloorIdList) {
this.elevatorFloorIdList = elevatorFloorIdList;
}
public String getCurrentBuildingId() {
return this.currentBuildingId;
}
public void setCurrentBuildingId(String currentBuildingId) {
this.currentBuildingId = currentBuildingId;
}
public String getAreaId() {
return this.areaId;
}
public void setAreaId(String areaId) {
this.areaId = areaId;
}
public String getBusinessId() {
return this.businessId;
}
public void setBusinessId(String businessId) {
this.businessId = businessId;
}
public String getDeviceId() {
return this.deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public String getDeviceCode() {
return this.deviceCode;
}
public void setDeviceCode(String deviceCode) {
this.deviceCode = deviceCode;
}
public String getDeviceName() {
return this.deviceName;
}
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
public String getDeviceTypeName() {
return this.deviceTypeName;
}
public void setDeviceTypeName(String deviceTypeName) {
this.deviceTypeName = deviceTypeName;
}
public String getElevatorFloorList() {
return this.elevatorFloorList;
}
public void setElevatorFloorList(String elevatorFloorList) {
this.elevatorFloorList = elevatorFloorList;
}
public String getCurrentFloorId() {
return this.currentFloorId;
}
public void setCurrentFloorId(String currentFloorId) {
this.currentFloorId = currentFloorId;
}
public String getCurrentFloor() {
return this.currentFloor;
}
public void setCurrentFloor(String currentFloor) {
this.currentFloor = currentFloor;
}
public String getCurrentBuilding() {
return this.currentBuilding;
}
public void setCurrentBuilding(String currentBuilding) {
this.currentBuilding = currentBuilding;
}
public String getAreaName() {
return this.areaName;
}
public void setAreaName(String areaName) {
this.areaName = areaName;
}
public Integer getStatus() {
return this.status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getDeleteFlag() {
return this.deleteFlag;
}
public void setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
}
public String toString() {
return "AcsElevatorDeviceAddDTO{businessId='" + this.businessId + '\'' + ", deviceId='" + this.deviceId + '\''
+ ", deviceCode='" + this.deviceCode + '\'' + ", deviceName='" + this.deviceName + '\''
+ ", deviceTypeName='" + this.deviceTypeName + '\'' + ", elevatorFloorList='" + this.elevatorFloorList
+ '\'' + ", currentFloorId='" + this.currentFloorId + '\'' + ", currentFloor='" + this.currentFloor + '\''
+ ", currentBuilding='" + this.currentBuilding + '\'' + ", areaName='" + this.areaName + '\'' + ", status="
+ this.status + ", deleteFlag=" + this.deleteFlag + '}';
}
}
@@ -0,0 +1,77 @@
package cn.cloudwalk.elevator.device.dto;
import cn.cloudwalk.cloud.entity.CloudwalkBaseTimes;
import java.io.Serializable;
public class AcsElevatorDeviceEditDTO extends CloudwalkBaseTimes implements Serializable {
private static final long serialVersionUID = 885170301572808321L;
private String elevatorFloorList;
private String currentFloorId;
private String currentFloor;
private String currentBuilding;
private String currentBuildingId;
private String areaId;
private String elevatorFloorIdList;
public String getElevatorFloorIdList() {
return this.elevatorFloorIdList;
}
public void setElevatorFloorIdList(String elevatorFloorIdList) {
this.elevatorFloorIdList = elevatorFloorIdList;
}
public String getAreaId() {
return this.areaId;
}
public void setAreaId(String areaId) {
this.areaId = areaId;
}
public String getElevatorFloorList() {
return this.elevatorFloorList;
}
public void setElevatorFloorList(String elevatorFloorList) {
this.elevatorFloorList = elevatorFloorList;
}
public String getCurrentFloorId() {
return this.currentFloorId;
}
public void setCurrentFloorId(String currentFloorId) {
this.currentFloorId = currentFloorId;
}
public String getCurrentFloor() {
return this.currentFloor;
}
public void setCurrentFloor(String currentFloor) {
this.currentFloor = currentFloor;
}
public String getCurrentBuilding() {
return this.currentBuilding;
}
public void setCurrentBuilding(String currentBuilding) {
this.currentBuilding = currentBuilding;
}
public String getCurrentBuildingId() {
return this.currentBuildingId;
}
public void setCurrentBuildingId(String currentBuildingId) {
this.currentBuildingId = currentBuildingId;
}
public String toString() {
return "AcsElevatorDeciveEditDTO{elevatorFloorList='" + this.elevatorFloorList + '\'' + ", currentFloorId='"
+ this.currentFloorId + '\'' + ", currentFloor='" + this.currentFloor + '\'' + ", currentBuilding='"
+ this.currentBuilding + '\'' + ", currentBuildingId='" + this.currentBuildingId + '\'' + '}';
}
}
@@ -0,0 +1,58 @@
package cn.cloudwalk.elevator.device.dto;
import java.io.Serializable;
public class AcsElevatorDeviceListByBuildingIdDto implements Serializable {
private String businessId;
private String currentBuildingId;
public void setBusinessId(String businessId) {
this.businessId = businessId;
}
public void setCurrentBuildingId(String currentBuildingId) {
this.currentBuildingId = currentBuildingId;
}
public boolean equals(Object o) {
if (o == this)
return true;
if (!(o instanceof AcsElevatorDeviceListByBuildingIdDto))
return false;
AcsElevatorDeviceListByBuildingIdDto other = (AcsElevatorDeviceListByBuildingIdDto)o;
if (!other.canEqual(this))
return false;
Object this$businessId = getBusinessId(), other$businessId = other.getBusinessId();
if ((this$businessId == null) ? (other$businessId != null) : !this$businessId.equals(other$businessId))
return false;
Object this$currentBuildingId = getCurrentBuildingId(), other$currentBuildingId = other.getCurrentBuildingId();
return !((this$currentBuildingId == null) ? (other$currentBuildingId != null)
: !this$currentBuildingId.equals(other$currentBuildingId));
}
protected boolean canEqual(Object other) {
return other instanceof AcsElevatorDeviceListByBuildingIdDto;
}
public int hashCode() {
int PRIME = 59;
result = 1;
Object $businessId = getBusinessId();
result = result * 59 + (($businessId == null) ? 43 : $businessId.hashCode());
Object $currentBuildingId = getCurrentBuildingId();
return result * 59 + (($currentBuildingId == null) ? 43 : $currentBuildingId.hashCode());
}
public String toString() {
return "AcsElevatorDeviceListByBuildingIdDto(businessId=" + getBusinessId() + ", currentBuildingId="
+ getCurrentBuildingId() + ")";
}
public String getBusinessId() {
return this.businessId;
}
public String getCurrentBuildingId() {
return this.currentBuildingId;
}
}
@@ -0,0 +1,35 @@
package cn.cloudwalk.elevator.device.dto;
import cn.cloudwalk.cloud.entity.CloudwalkBaseTimes;
import java.io.Serializable;
import java.util.List;
public class AcsElevatorDeviceListDto extends CloudwalkBaseTimes implements Serializable {
private String businessId;
private String currentFloorId;
private List<String> currentFloorIds;
public List<String> getCurrentFloorIds() {
return this.currentFloorIds;
}
public void setCurrentFloorIds(List<String> currentFloorIds) {
this.currentFloorIds = currentFloorIds;
}
public String getBusinessId() {
return this.businessId;
}
public void setBusinessId(String businessId) {
this.businessId = businessId;
}
public String getCurrentFloorId() {
return this.currentFloorId;
}
public void setCurrentFloorId(String currentFloorId) {
this.currentFloorId = currentFloorId;
}
}
@@ -0,0 +1,208 @@
package cn.cloudwalk.elevator.device.dto;
import cn.cloudwalk.cloud.entity.CloudwalkBaseTimes;
import java.io.Serializable;
public class AcsElevatorDeviceListResultDto extends CloudwalkBaseTimes implements Serializable {
private String businessId;
private String deviceId;
private String deviceCode;
private String deviceName;
private String deviceTypeName;
private String elevatorFloorList;
public boolean equals(Object o) {
if (o == this)
return true;
if (!(o instanceof AcsElevatorDeviceListResultDto))
return false;
AcsElevatorDeviceListResultDto other = (AcsElevatorDeviceListResultDto)o;
if (!other.canEqual(this))
return false;
Object this$businessId = getBusinessId(), other$businessId = other.getBusinessId();
if ((this$businessId == null) ? (other$businessId != null) : !this$businessId.equals(other$businessId))
return false;
Object this$deviceId = getDeviceId(), other$deviceId = other.getDeviceId();
if ((this$deviceId == null) ? (other$deviceId != null) : !this$deviceId.equals(other$deviceId))
return false;
Object this$deviceCode = getDeviceCode(), other$deviceCode = other.getDeviceCode();
if ((this$deviceCode == null) ? (other$deviceCode != null) : !this$deviceCode.equals(other$deviceCode))
return false;
Object this$deviceName = getDeviceName(), other$deviceName = other.getDeviceName();
if ((this$deviceName == null) ? (other$deviceName != null) : !this$deviceName.equals(other$deviceName))
return false;
Object this$deviceTypeName = getDeviceTypeName(), other$deviceTypeName = other.getDeviceTypeName();
if ((this$deviceTypeName == null) ? (other$deviceTypeName != null)
: !this$deviceTypeName.equals(other$deviceTypeName))
return false;
Object this$elevatorFloorList = getElevatorFloorList(), other$elevatorFloorList = other.getElevatorFloorList();
if ((this$elevatorFloorList == null) ? (other$elevatorFloorList != null)
: !this$elevatorFloorList.equals(other$elevatorFloorList))
return false;
Object this$currentFloorId = getCurrentFloorId(), other$currentFloorId = other.getCurrentFloorId();
if ((this$currentFloorId == null) ? (other$currentFloorId != null)
: !this$currentFloorId.equals(other$currentFloorId))
return false;
Object this$currentFloor = getCurrentFloor(), other$currentFloor = other.getCurrentFloor();
if ((this$currentFloor == null) ? (other$currentFloor != null) : !this$currentFloor.equals(other$currentFloor))
return false;
Object this$currentBuilding = getCurrentBuilding(), other$currentBuilding = other.getCurrentBuilding();
if ((this$currentBuilding == null) ? (other$currentBuilding != null)
: !this$currentBuilding.equals(other$currentBuilding))
return false;
Object this$currentBuildingId = getCurrentBuildingId(), other$currentBuildingId = other.getCurrentBuildingId();
if ((this$currentBuildingId == null) ? (other$currentBuildingId != null)
: !this$currentBuildingId.equals(other$currentBuildingId))
return false;
Object this$areaName = getAreaName(), other$areaName = other.getAreaName();
if ((this$areaName == null) ? (other$areaName != null) : !this$areaName.equals(other$areaName))
return false;
Object this$status = getStatus(), other$status = other.getStatus();
return !((this$status == null) ? (other$status != null) : !this$status.equals(other$status));
}
private String currentFloorId;
private String currentFloor;
private String currentBuilding;
private String currentBuildingId;
private String areaName;
private Integer status;
protected boolean canEqual(Object other) {
return other instanceof AcsElevatorDeviceListResultDto;
}
public int hashCode() {
int PRIME = 59;
result = 1;
Object $businessId = getBusinessId();
result = result * 59 + (($businessId == null) ? 43 : $businessId.hashCode());
Object $deviceId = getDeviceId();
result = result * 59 + (($deviceId == null) ? 43 : $deviceId.hashCode());
Object $deviceCode = getDeviceCode();
result = result * 59 + (($deviceCode == null) ? 43 : $deviceCode.hashCode());
Object $deviceName = getDeviceName();
result = result * 59 + (($deviceName == null) ? 43 : $deviceName.hashCode());
Object $deviceTypeName = getDeviceTypeName();
result = result * 59 + (($deviceTypeName == null) ? 43 : $deviceTypeName.hashCode());
Object $elevatorFloorList = getElevatorFloorList();
result = result * 59 + (($elevatorFloorList == null) ? 43 : $elevatorFloorList.hashCode());
Object $currentFloorId = getCurrentFloorId();
result = result * 59 + (($currentFloorId == null) ? 43 : $currentFloorId.hashCode());
Object $currentFloor = getCurrentFloor();
result = result * 59 + (($currentFloor == null) ? 43 : $currentFloor.hashCode());
Object $currentBuilding = getCurrentBuilding();
result = result * 59 + (($currentBuilding == null) ? 43 : $currentBuilding.hashCode());
Object $currentBuildingId = getCurrentBuildingId();
result = result * 59 + (($currentBuildingId == null) ? 43 : $currentBuildingId.hashCode());
Object $areaName = getAreaName();
result = result * 59 + (($areaName == null) ? 43 : $areaName.hashCode());
Object $status = getStatus();
return result * 59 + (($status == null) ? 43 : $status.hashCode());
}
public String toString() {
return "AcsElevatorDeviceListResultDto(businessId=" + getBusinessId() + ", deviceId=" + getDeviceId()
+ ", deviceCode=" + getDeviceCode() + ", deviceName=" + getDeviceName() + ", deviceTypeName="
+ getDeviceTypeName() + ", elevatorFloorList=" + getElevatorFloorList() + ", currentFloorId="
+ getCurrentFloorId() + ", currentFloor=" + getCurrentFloor() + ", currentBuilding=" + getCurrentBuilding()
+ ", currentBuildingId=" + getCurrentBuildingId() + ", areaName=" + getAreaName() + ", status="
+ getStatus() + ")";
}
public String getBusinessId() {
return this.businessId;
}
public void setBusinessId(String businessId) {
this.businessId = businessId;
}
public String getDeviceId() {
return this.deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public String getDeviceCode() {
return this.deviceCode;
}
public void setDeviceCode(String deviceCode) {
this.deviceCode = deviceCode;
}
public String getDeviceName() {
return this.deviceName;
}
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
public String getDeviceTypeName() {
return this.deviceTypeName;
}
public void setDeviceTypeName(String deviceTypeName) {
this.deviceTypeName = deviceTypeName;
}
public String getElevatorFloorList() {
return this.elevatorFloorList;
}
public void setElevatorFloorList(String elevatorFloorList) {
this.elevatorFloorList = elevatorFloorList;
}
public String getCurrentFloorId() {
return this.currentFloorId;
}
public void setCurrentFloorId(String currentFloorId) {
this.currentFloorId = currentFloorId;
}
public String getCurrentFloor() {
return this.currentFloor;
}
public void setCurrentFloor(String currentFloor) {
this.currentFloor = currentFloor;
}
public String getCurrentBuilding() {
return this.currentBuilding;
}
public void setCurrentBuilding(String currentBuilding) {
this.currentBuilding = currentBuilding;
}
public String getCurrentBuildingId() {
return this.currentBuildingId;
}
public void setCurrentBuildingId(String currentBuildingId) {
this.currentBuildingId = currentBuildingId;
}
public String getAreaName() {
return this.areaName;
}
public void setAreaName(String areaName) {
this.areaName = areaName;
}
public Integer getStatus() {
return this.status;
}
public void setStatus(Integer status) {
this.status = status;
}
}
@@ -0,0 +1,16 @@
package cn.cloudwalk.elevator.device.dto;
import cn.cloudwalk.cloud.page.CloudwalkBasePageForm;
import java.io.Serializable;
public class AcsElevatorDeviceQueryByIdDTO extends CloudwalkBasePageForm implements Serializable {
private String id;
public String getId() {
return this.id;
}
public void setId(String id) {
this.id = id;
}
}
@@ -0,0 +1,99 @@
package cn.cloudwalk.elevator.device.dto;
import cn.cloudwalk.cloud.entity.CloudwalkBaseTimes;
import java.io.Serializable;
import java.util.List;
public class AcsElevatorDeviceQueryDTO extends CloudwalkBaseTimes implements Serializable {
private static final long serialVersionUID = -761586737506722816L;
private String areaName;
private String deviceCode;
private String deviceName;
private String deviceTypeName;
private List<String> areaIds;
private String deviceId;
private String businessId;
private String ip;
private Integer status;
private Integer onlineStatus;
public String getIp() {
return this.ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public Integer getStatus() {
return this.status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getOnlineStatus() {
return this.onlineStatus;
}
public void setOnlineStatus(Integer onlineStatus) {
this.onlineStatus = onlineStatus;
}
public String getBusinessId() {
return this.businessId;
}
public void setBusinessId(String businessId) {
this.businessId = businessId;
}
public String getDeviceId() {
return this.deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public List<String> getAreaIds() {
return this.areaIds;
}
public void setAreaIds(List<String> areaIds) {
this.areaIds = areaIds;
}
public String getAreaName() {
return this.areaName;
}
public void setAreaName(String areaName) {
this.areaName = areaName;
}
public String getDeviceCode() {
return this.deviceCode;
}
public void setDeviceCode(String deviceCode) {
this.deviceCode = deviceCode;
}
public String getDeviceName() {
return this.deviceName;
}
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
public String getDeviceTypeName() {
return this.deviceTypeName;
}
public void setDeviceTypeName(String deviceTypeName) {
this.deviceTypeName = deviceTypeName;
}
}
@@ -0,0 +1,235 @@
package cn.cloudwalk.elevator.device.dto;
public class AcsElevatorDeviceQueryFoDTO {
private String id;
private String businessId;
private String deviceId;
private String deviceCode;
private String deviceName;
private String deviceTypeName;
private String elevatorFloorList;
public void setId(String id) {
this.id = id;
}
private String currentFloorId;
private String currentFloor;
private String currentBuilding;
private String currentBuildingId;
private String areaName;
private String areaId;
private String elevatorFloorIdList;
public void setBusinessId(String businessId) {
this.businessId = businessId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public void setDeviceCode(String deviceCode) {
this.deviceCode = deviceCode;
}
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
public void setDeviceTypeName(String deviceTypeName) {
this.deviceTypeName = deviceTypeName;
}
public void setElevatorFloorList(String elevatorFloorList) {
this.elevatorFloorList = elevatorFloorList;
}
public void setCurrentFloorId(String currentFloorId) {
this.currentFloorId = currentFloorId;
}
public void setCurrentFloor(String currentFloor) {
this.currentFloor = currentFloor;
}
public void setCurrentBuilding(String currentBuilding) {
this.currentBuilding = currentBuilding;
}
public void setCurrentBuildingId(String currentBuildingId) {
this.currentBuildingId = currentBuildingId;
}
public void setAreaName(String areaName) {
this.areaName = areaName;
}
public void setAreaId(String areaId) {
this.areaId = areaId;
}
public void setElevatorFloorIdList(String elevatorFloorIdList) {
this.elevatorFloorIdList = elevatorFloorIdList;
}
public boolean equals(Object o) {
if (o == this)
return true;
if (!(o instanceof AcsElevatorDeviceQueryFoDTO))
return false;
AcsElevatorDeviceQueryFoDTO other = (AcsElevatorDeviceQueryFoDTO)o;
if (!other.canEqual(this))
return false;
Object this$id = getId(), other$id = other.getId();
if ((this$id == null) ? (other$id != null) : !this$id.equals(other$id))
return false;
Object this$businessId = getBusinessId(), other$businessId = other.getBusinessId();
if ((this$businessId == null) ? (other$businessId != null) : !this$businessId.equals(other$businessId))
return false;
Object this$deviceId = getDeviceId(), other$deviceId = other.getDeviceId();
if ((this$deviceId == null) ? (other$deviceId != null) : !this$deviceId.equals(other$deviceId))
return false;
Object this$deviceCode = getDeviceCode(), other$deviceCode = other.getDeviceCode();
if ((this$deviceCode == null) ? (other$deviceCode != null) : !this$deviceCode.equals(other$deviceCode))
return false;
Object this$deviceName = getDeviceName(), other$deviceName = other.getDeviceName();
if ((this$deviceName == null) ? (other$deviceName != null) : !this$deviceName.equals(other$deviceName))
return false;
Object this$deviceTypeName = getDeviceTypeName(), other$deviceTypeName = other.getDeviceTypeName();
if ((this$deviceTypeName == null) ? (other$deviceTypeName != null)
: !this$deviceTypeName.equals(other$deviceTypeName))
return false;
Object this$elevatorFloorList = getElevatorFloorList(), other$elevatorFloorList = other.getElevatorFloorList();
if ((this$elevatorFloorList == null) ? (other$elevatorFloorList != null)
: !this$elevatorFloorList.equals(other$elevatorFloorList))
return false;
Object this$currentFloorId = getCurrentFloorId(), other$currentFloorId = other.getCurrentFloorId();
if ((this$currentFloorId == null) ? (other$currentFloorId != null)
: !this$currentFloorId.equals(other$currentFloorId))
return false;
Object this$currentFloor = getCurrentFloor(), other$currentFloor = other.getCurrentFloor();
if ((this$currentFloor == null) ? (other$currentFloor != null) : !this$currentFloor.equals(other$currentFloor))
return false;
Object this$currentBuilding = getCurrentBuilding(), other$currentBuilding = other.getCurrentBuilding();
if ((this$currentBuilding == null) ? (other$currentBuilding != null)
: !this$currentBuilding.equals(other$currentBuilding))
return false;
Object this$currentBuildingId = getCurrentBuildingId(), other$currentBuildingId = other.getCurrentBuildingId();
if ((this$currentBuildingId == null) ? (other$currentBuildingId != null)
: !this$currentBuildingId.equals(other$currentBuildingId))
return false;
Object this$areaName = getAreaName(), other$areaName = other.getAreaName();
if ((this$areaName == null) ? (other$areaName != null) : !this$areaName.equals(other$areaName))
return false;
Object this$areaId = getAreaId(), other$areaId = other.getAreaId();
if ((this$areaId == null) ? (other$areaId != null) : !this$areaId.equals(other$areaId))
return false;
Object this$elevatorFloorIdList = getElevatorFloorIdList(),
other$elevatorFloorIdList = other.getElevatorFloorIdList();
return !((this$elevatorFloorIdList == null) ? (other$elevatorFloorIdList != null)
: !this$elevatorFloorIdList.equals(other$elevatorFloorIdList));
}
protected boolean canEqual(Object other) {
return other instanceof AcsElevatorDeviceQueryFoDTO;
}
public int hashCode() {
int PRIME = 59;
result = 1;
Object $id = getId();
result = result * 59 + (($id == null) ? 43 : $id.hashCode());
Object $businessId = getBusinessId();
result = result * 59 + (($businessId == null) ? 43 : $businessId.hashCode());
Object $deviceId = getDeviceId();
result = result * 59 + (($deviceId == null) ? 43 : $deviceId.hashCode());
Object $deviceCode = getDeviceCode();
result = result * 59 + (($deviceCode == null) ? 43 : $deviceCode.hashCode());
Object $deviceName = getDeviceName();
result = result * 59 + (($deviceName == null) ? 43 : $deviceName.hashCode());
Object $deviceTypeName = getDeviceTypeName();
result = result * 59 + (($deviceTypeName == null) ? 43 : $deviceTypeName.hashCode());
Object $elevatorFloorList = getElevatorFloorList();
result = result * 59 + (($elevatorFloorList == null) ? 43 : $elevatorFloorList.hashCode());
Object $currentFloorId = getCurrentFloorId();
result = result * 59 + (($currentFloorId == null) ? 43 : $currentFloorId.hashCode());
Object $currentFloor = getCurrentFloor();
result = result * 59 + (($currentFloor == null) ? 43 : $currentFloor.hashCode());
Object $currentBuilding = getCurrentBuilding();
result = result * 59 + (($currentBuilding == null) ? 43 : $currentBuilding.hashCode());
Object $currentBuildingId = getCurrentBuildingId();
result = result * 59 + (($currentBuildingId == null) ? 43 : $currentBuildingId.hashCode());
Object $areaName = getAreaName();
result = result * 59 + (($areaName == null) ? 43 : $areaName.hashCode());
Object $areaId = getAreaId();
result = result * 59 + (($areaId == null) ? 43 : $areaId.hashCode());
Object $elevatorFloorIdList = getElevatorFloorIdList();
return result * 59 + (($elevatorFloorIdList == null) ? 43 : $elevatorFloorIdList.hashCode());
}
public String toString() {
return "AcsElevatorDeviceQueryFoDTO(id=" + getId() + ", businessId=" + getBusinessId() + ", deviceId="
+ getDeviceId() + ", deviceCode=" + getDeviceCode() + ", deviceName=" + getDeviceName()
+ ", deviceTypeName=" + getDeviceTypeName() + ", elevatorFloorList=" + getElevatorFloorList()
+ ", currentFloorId=" + getCurrentFloorId() + ", currentFloor=" + getCurrentFloor() + ", currentBuilding="
+ getCurrentBuilding() + ", currentBuildingId=" + getCurrentBuildingId() + ", areaName=" + getAreaName()
+ ", areaId=" + getAreaId() + ", elevatorFloorIdList=" + getElevatorFloorIdList() + ")";
}
public String getId() {
return this.id;
}
public String getBusinessId() {
return this.businessId;
}
public String getDeviceId() {
return this.deviceId;
}
public String getDeviceCode() {
return this.deviceCode;
}
public String getDeviceName() {
return this.deviceName;
}
public String getDeviceTypeName() {
return this.deviceTypeName;
}
public String getElevatorFloorList() {
return this.elevatorFloorList;
}
public String getCurrentFloorId() {
return this.currentFloorId;
}
public String getCurrentFloor() {
return this.currentFloor;
}
public String getCurrentBuilding() {
return this.currentBuilding;
}
public String getCurrentBuildingId() {
return this.currentBuildingId;
}
public String getAreaName() {
return this.areaName;
}
public String getAreaId() {
return this.areaId;
}
public String getElevatorFloorIdList() {
return this.elevatorFloorIdList;
}
}
@@ -0,0 +1,30 @@
package cn.cloudwalk.elevator.device.dto;
import cn.cloudwalk.cloud.entity.CloudwalkBaseTimes;
import java.io.Serializable;
public class AcsElevatorDeviceQueryResultDTO extends CloudwalkBaseTimes implements Serializable {
private static final long serialVersionUID = -761586737506722816L;
private String businessId;
private String deviceId;
private String deviceCode;
private String deviceName;
private String deviceTypeName;
private String elevatorFloorList;
private String currentFloorId;
private String currentFloor;
private String currentBuilding;
private String currentBuildingId;
private Integer status;
}
@@ -0,0 +1,323 @@
package cn.cloudwalk.elevator.device.dto;
public class AcsElevatorDeviceResultDTO {
private String id;
private String businessId;
private String deviceId;
private String deviceCode;
private String deviceName;
private String deviceTypeName;
private String elevatorFloorList;
private String currentFloorId;
private String currentFloor;
private String currentBuilding;
public void setId(String id) {
this.id = id;
}
private String currentBuildingId;
private String areaName;
private String areaId;
private Integer status;
private String statusString;
private String elevatorFloorIdList;
private Long lastHeartbeatTime;
private String imageStoreId;
private String ip;
private Integer onlineStatus;
public void setIp(String ip) {
this.ip = ip;
}
public boolean equals(Object o) {
if (o == this)
return true;
if (!(o instanceof AcsElevatorDeviceResultDTO))
return false;
AcsElevatorDeviceResultDTO other = (AcsElevatorDeviceResultDTO)o;
if (!other.canEqual(this))
return false;
Object this$id = getId(), other$id = other.getId();
if ((this$id == null) ? (other$id != null) : !this$id.equals(other$id))
return false;
Object this$businessId = getBusinessId(), other$businessId = other.getBusinessId();
if ((this$businessId == null) ? (other$businessId != null) : !this$businessId.equals(other$businessId))
return false;
Object this$deviceId = getDeviceId(), other$deviceId = other.getDeviceId();
if ((this$deviceId == null) ? (other$deviceId != null) : !this$deviceId.equals(other$deviceId))
return false;
Object this$deviceCode = getDeviceCode(), other$deviceCode = other.getDeviceCode();
if ((this$deviceCode == null) ? (other$deviceCode != null) : !this$deviceCode.equals(other$deviceCode))
return false;
Object this$deviceName = getDeviceName(), other$deviceName = other.getDeviceName();
if ((this$deviceName == null) ? (other$deviceName != null) : !this$deviceName.equals(other$deviceName))
return false;
Object this$deviceTypeName = getDeviceTypeName(), other$deviceTypeName = other.getDeviceTypeName();
if ((this$deviceTypeName == null) ? (other$deviceTypeName != null)
: !this$deviceTypeName.equals(other$deviceTypeName))
return false;
Object this$elevatorFloorList = getElevatorFloorList(), other$elevatorFloorList = other.getElevatorFloorList();
if ((this$elevatorFloorList == null) ? (other$elevatorFloorList != null)
: !this$elevatorFloorList.equals(other$elevatorFloorList))
return false;
Object this$currentFloorId = getCurrentFloorId(), other$currentFloorId = other.getCurrentFloorId();
if ((this$currentFloorId == null) ? (other$currentFloorId != null)
: !this$currentFloorId.equals(other$currentFloorId))
return false;
Object this$currentFloor = getCurrentFloor(), other$currentFloor = other.getCurrentFloor();
if ((this$currentFloor == null) ? (other$currentFloor != null) : !this$currentFloor.equals(other$currentFloor))
return false;
Object this$currentBuilding = getCurrentBuilding(), other$currentBuilding = other.getCurrentBuilding();
if ((this$currentBuilding == null) ? (other$currentBuilding != null)
: !this$currentBuilding.equals(other$currentBuilding))
return false;
Object this$currentBuildingId = getCurrentBuildingId(), other$currentBuildingId = other.getCurrentBuildingId();
if ((this$currentBuildingId == null) ? (other$currentBuildingId != null)
: !this$currentBuildingId.equals(other$currentBuildingId))
return false;
Object this$areaName = getAreaName(), other$areaName = other.getAreaName();
if ((this$areaName == null) ? (other$areaName != null) : !this$areaName.equals(other$areaName))
return false;
Object this$areaId = getAreaId(), other$areaId = other.getAreaId();
if ((this$areaId == null) ? (other$areaId != null) : !this$areaId.equals(other$areaId))
return false;
Object this$status = getStatus(), other$status = other.getStatus();
if ((this$status == null) ? (other$status != null) : !this$status.equals(other$status))
return false;
Object this$statusString = getStatusString(), other$statusString = other.getStatusString();
if ((this$statusString == null) ? (other$statusString != null) : !this$statusString.equals(other$statusString))
return false;
Object this$elevatorFloorIdList = getElevatorFloorIdList(),
other$elevatorFloorIdList = other.getElevatorFloorIdList();
if ((this$elevatorFloorIdList == null) ? (other$elevatorFloorIdList != null)
: !this$elevatorFloorIdList.equals(other$elevatorFloorIdList))
return false;
Object this$lastHeartbeatTime = getLastHeartbeatTime(), other$lastHeartbeatTime = other.getLastHeartbeatTime();
if ((this$lastHeartbeatTime == null) ? (other$lastHeartbeatTime != null)
: !this$lastHeartbeatTime.equals(other$lastHeartbeatTime))
return false;
Object this$imageStoreId = getImageStoreId(), other$imageStoreId = other.getImageStoreId();
if ((this$imageStoreId == null) ? (other$imageStoreId != null) : !this$imageStoreId.equals(other$imageStoreId))
return false;
Object this$ip = getIp(), other$ip = other.getIp();
if ((this$ip == null) ? (other$ip != null) : !this$ip.equals(other$ip))
return false;
Object this$onlineStatus = getOnlineStatus(), other$onlineStatus = other.getOnlineStatus();
return !((this$onlineStatus == null) ? (other$onlineStatus != null)
: !this$onlineStatus.equals(other$onlineStatus));
}
protected boolean canEqual(Object other) {
return other instanceof AcsElevatorDeviceResultDTO;
}
public int hashCode() {
int PRIME = 59;
result = 1;
Object $id = getId();
result = result * 59 + (($id == null) ? 43 : $id.hashCode());
Object $businessId = getBusinessId();
result = result * 59 + (($businessId == null) ? 43 : $businessId.hashCode());
Object $deviceId = getDeviceId();
result = result * 59 + (($deviceId == null) ? 43 : $deviceId.hashCode());
Object $deviceCode = getDeviceCode();
result = result * 59 + (($deviceCode == null) ? 43 : $deviceCode.hashCode());
Object $deviceName = getDeviceName();
result = result * 59 + (($deviceName == null) ? 43 : $deviceName.hashCode());
Object $deviceTypeName = getDeviceTypeName();
result = result * 59 + (($deviceTypeName == null) ? 43 : $deviceTypeName.hashCode());
Object $elevatorFloorList = getElevatorFloorList();
result = result * 59 + (($elevatorFloorList == null) ? 43 : $elevatorFloorList.hashCode());
Object $currentFloorId = getCurrentFloorId();
result = result * 59 + (($currentFloorId == null) ? 43 : $currentFloorId.hashCode());
Object $currentFloor = getCurrentFloor();
result = result * 59 + (($currentFloor == null) ? 43 : $currentFloor.hashCode());
Object $currentBuilding = getCurrentBuilding();
result = result * 59 + (($currentBuilding == null) ? 43 : $currentBuilding.hashCode());
Object $currentBuildingId = getCurrentBuildingId();
result = result * 59 + (($currentBuildingId == null) ? 43 : $currentBuildingId.hashCode());
Object $areaName = getAreaName();
result = result * 59 + (($areaName == null) ? 43 : $areaName.hashCode());
Object $areaId = getAreaId();
result = result * 59 + (($areaId == null) ? 43 : $areaId.hashCode());
Object $status = getStatus();
result = result * 59 + (($status == null) ? 43 : $status.hashCode());
Object $statusString = getStatusString();
result = result * 59 + (($statusString == null) ? 43 : $statusString.hashCode());
Object $elevatorFloorIdList = getElevatorFloorIdList();
result = result * 59 + (($elevatorFloorIdList == null) ? 43 : $elevatorFloorIdList.hashCode());
Object $lastHeartbeatTime = getLastHeartbeatTime();
result = result * 59 + (($lastHeartbeatTime == null) ? 43 : $lastHeartbeatTime.hashCode());
Object $imageStoreId = getImageStoreId();
result = result * 59 + (($imageStoreId == null) ? 43 : $imageStoreId.hashCode());
Object $ip = getIp();
result = result * 59 + (($ip == null) ? 43 : $ip.hashCode());
Object $onlineStatus = getOnlineStatus();
return result * 59 + (($onlineStatus == null) ? 43 : $onlineStatus.hashCode());
}
public String toString() {
return "AcsElevatorDeviceResultDTO(id=" + getId() + ", businessId=" + getBusinessId() + ", deviceId="
+ getDeviceId() + ", deviceCode=" + getDeviceCode() + ", deviceName=" + getDeviceName()
+ ", deviceTypeName=" + getDeviceTypeName() + ", elevatorFloorList=" + getElevatorFloorList()
+ ", currentFloorId=" + getCurrentFloorId() + ", currentFloor=" + getCurrentFloor() + ", currentBuilding="
+ getCurrentBuilding() + ", currentBuildingId=" + getCurrentBuildingId() + ", areaName=" + getAreaName()
+ ", areaId=" + getAreaId() + ", status=" + getStatus() + ", statusString=" + getStatusString()
+ ", elevatorFloorIdList=" + getElevatorFloorIdList() + ", lastHeartbeatTime=" + getLastHeartbeatTime()
+ ", imageStoreId=" + getImageStoreId() + ", ip=" + getIp() + ", onlineStatus=" + getOnlineStatus() + ")";
}
public String getId() {
return this.id;
}
public String getIp() {
return this.ip;
}
public String getElevatorFloorIdList() {
return this.elevatorFloorIdList;
}
public void setElevatorFloorIdList(String elevatorFloorIdList) {
this.elevatorFloorIdList = elevatorFloorIdList;
}
public String getBusinessId() {
return this.businessId;
}
public void setBusinessId(String businessId) {
this.businessId = businessId;
}
public String getDeviceId() {
return this.deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public String getDeviceCode() {
return this.deviceCode;
}
public void setDeviceCode(String deviceCode) {
this.deviceCode = deviceCode;
}
public String getDeviceName() {
return this.deviceName;
}
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
public String getDeviceTypeName() {
return this.deviceTypeName;
}
public void setDeviceTypeName(String deviceTypeName) {
this.deviceTypeName = deviceTypeName;
}
public String getElevatorFloorList() {
return this.elevatorFloorList;
}
public void setElevatorFloorList(String elevatorFloorList) {
this.elevatorFloorList = elevatorFloorList;
}
public String getCurrentFloorId() {
return this.currentFloorId;
}
public void setCurrentFloorId(String currentFloorId) {
this.currentFloorId = currentFloorId;
}
public String getCurrentFloor() {
return this.currentFloor;
}
public void setCurrentFloor(String currentFloor) {
this.currentFloor = currentFloor;
}
public String getCurrentBuilding() {
return this.currentBuilding;
}
public void setCurrentBuilding(String currentBuilding) {
this.currentBuilding = currentBuilding;
}
public String getCurrentBuildingId() {
return this.currentBuildingId;
}
public void setCurrentBuildingId(String currentBuildingId) {
this.currentBuildingId = currentBuildingId;
}
public String getAreaName() {
return this.areaName;
}
public void setAreaName(String areaName) {
this.areaName = areaName;
}
public Integer getStatus() {
return this.status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Long getLastHeartbeatTime() {
return this.lastHeartbeatTime;
}
public void setLastHeartbeatTime(Long lastHeartbeatTime) {
this.lastHeartbeatTime = lastHeartbeatTime;
}
public String getAreaId() {
return this.areaId;
}
public void setAreaId(String areaId) {
this.areaId = areaId;
}
public String getStatusString() {
return this.statusString;
}
public void setStatusString(String statusString) {
this.statusString = statusString;
}
public String getImageStoreId() {
return this.imageStoreId;
}
public void setImageStoreId(String imageStoreId) {
this.imageStoreId = imageStoreId;
}
public Integer getOnlineStatus() {
return this.onlineStatus;
}
public void setOnlineStatus(Integer onlineStatus) {
this.onlineStatus = onlineStatus;
}
}
@@ -0,0 +1,30 @@
package cn.cloudwalk.elevator.device.impl;
import cn.cloudwalk.elevator.device.dao.AcsDeviceTaskDao;
import cn.cloudwalk.elevator.device.dto.AcsDeviceTaskAddDto;
import cn.cloudwalk.elevator.device.dto.AcsDeviceTaskDTO;
import cn.cloudwalk.elevator.device.mapper.AcsDeviceTaskMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
@Repository
public class AcsDeviceTaskDaoImpl implements AcsDeviceTaskDao {
@Autowired
private AcsDeviceTaskMapper acsDeviceTaskMapper;
public Integer insert(AcsDeviceTaskAddDto dto) {
return this.acsDeviceTaskMapper.insert(dto);
}
public Integer updateBingDevices(AcsDeviceTaskAddDto dto) {
return this.acsDeviceTaskMapper.updateBingDevices(dto);
}
public Integer updateIsStop(AcsDeviceTaskAddDto dto) {
return this.acsDeviceTaskMapper.updateIsStop(dto);
}
public AcsDeviceTaskDTO getById(String taskId) {
return this.acsDeviceTaskMapper.getById(taskId);
}
}
@@ -0,0 +1,121 @@
package cn.cloudwalk.elevator.device.impl;
import cn.cloudwalk.cloud.exception.DataAccessException;
import cn.cloudwalk.cloud.exception.ServiceException;
import cn.cloudwalk.cloud.page.CloudwalkPageAble;
import cn.cloudwalk.cloud.page.CloudwalkPageInfo;
import cn.cloudwalk.cloud.utils.BeanCopyUtils;
import cn.cloudwalk.elevator.device.dao.AcsElevatorDeviceDao;
import cn.cloudwalk.elevator.device.dto.AcsElevatorDeviceAddDTO;
import cn.cloudwalk.elevator.device.dto.AcsElevatorDeviceEditDTO;
import cn.cloudwalk.elevator.device.dto.AcsElevatorDeviceListByBuildingIdDto;
import cn.cloudwalk.elevator.device.dto.AcsElevatorDeviceListDto;
import cn.cloudwalk.elevator.device.dto.AcsElevatorDeviceQueryByIdDTO;
import cn.cloudwalk.elevator.device.dto.AcsElevatorDeviceQueryDTO;
import cn.cloudwalk.elevator.device.dto.AcsElevatorDeviceResultDTO;
import cn.cloudwalk.elevator.device.mapper.AcsElevatorDeviceMapper;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import java.util.List;
import javax.annotation.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;
@Repository
public class AcsElevatorDeviceDaoImpl implements AcsElevatorDeviceDao {
@Resource
private AcsElevatorDeviceMapper acsElevatorDeviceMapper;
protected final Logger logger = LoggerFactory.getLogger(getClass());
public Integer add(AcsElevatorDeviceAddDTO dto) throws DataAccessException {
try {
return Integer.valueOf(this.acsElevatorDeviceMapper.add(dto));
} catch (Exception e) {
this.logger.error("保存派梯设备信息失败,原因:", e);
throw new DataAccessException(e);
}
}
public Integer edit(AcsElevatorDeviceEditDTO dto) throws DataAccessException {
try {
return Integer.valueOf(this.acsElevatorDeviceMapper.edit(dto));
} catch (Exception e) {
this.logger.error("保存派梯设备信息失败,原因:", e);
throw new DataAccessException(e);
}
}
public Integer delete(List<String> ids) throws DataAccessException {
try {
return Integer.valueOf(this.acsElevatorDeviceMapper.delete(ids));
} catch (Exception e) {
this.logger.error("删除派梯设备信息失败,原因:", e);
throw new DataAccessException(e);
}
}
public CloudwalkPageAble<AcsElevatorDeviceResultDTO> page(AcsElevatorDeviceQueryDTO dto, CloudwalkPageInfo page)
throws DataAccessException {
try {
PageHelper.startPage(page.getCurrentPage(), page.getPageSize());
Page<AcsElevatorDeviceResultDTO> result =
(Page<AcsElevatorDeviceResultDTO>)this.acsElevatorDeviceMapper.page(dto);
return new CloudwalkPageAble(BeanCopyUtils.copy(result.getResult(), AcsElevatorDeviceResultDTO.class), page,
result.getTotal());
} catch (Exception e) {
this.logger.error("设备分页查询失败,原因:", e);
throw new DataAccessException(e);
}
}
public List<AcsElevatorDeviceResultDTO> listByZoneId(AcsElevatorDeviceListDto dto) throws DataAccessException {
try {
return this.acsElevatorDeviceMapper.listByZoneId(dto);
} catch (Exception e) {
this.logger.error("根据楼层id获取设备信息失败,原因:", e);
throw new DataAccessException(e);
}
}
public List<AcsElevatorDeviceResultDTO> listByZoneIds(AcsElevatorDeviceListDto dto) throws DataAccessException {
try {
return this.acsElevatorDeviceMapper.listByZoneIds(dto);
} catch (Exception e) {
this.logger.error("根据楼层id集合获取设备信息失败,原因:", e);
throw new DataAccessException(e);
}
}
public List<AcsElevatorDeviceResultDTO> listBuBuildingId(AcsElevatorDeviceListByBuildingIdDto dto)
throws DataAccessException {
try {
return this.acsElevatorDeviceMapper.listBuBuildingId(dto);
} catch (Exception e) {
this.logger.error("根据楼栋id获取设备信息失败,原因:", e);
throw new DataAccessException(e);
}
}
public List<AcsElevatorDeviceResultDTO> get(AcsElevatorDeviceQueryDTO dto) throws ServiceException {
return this.acsElevatorDeviceMapper.get(dto);
}
public AcsElevatorDeviceResultDTO getById(AcsElevatorDeviceQueryByIdDTO dto) throws ServiceException {
return this.acsElevatorDeviceMapper.getById(dto);
}
public AcsElevatorDeviceResultDTO getByDeciveCode(String deviceCode) throws ServiceException {
AcsElevatorDeviceQueryDTO dto = new AcsElevatorDeviceQueryDTO();
dto.setDeviceCode(deviceCode);
return this.acsElevatorDeviceMapper.getByDeciveCode(dto);
}
public String getBuildingId(AcsElevatorDeviceQueryDTO dto) throws ServiceException {
return this.acsElevatorDeviceMapper.getBuildingId(dto);
}
public String getBusinessId(AcsElevatorDeviceQueryDTO dto) throws ServiceException {
return this.acsElevatorDeviceMapper.getBusinessId(dto);
}
}

Some files were not shown because too many files have changed in this diff Show More