Compare commits
2 Commits
dev
...
prod_20251
| Author | SHA1 | Date |
|---|---|---|
|
|
10c23f3f5b | 7 months ago |
|
|
9420aa3ac4 | 7 months ago |
167 changed files with 1201 additions and 13149 deletions
@ -1,260 +0,0 @@
|
||||
# S7 PLC数据采集功能说明 |
||||
|
||||
## 概述 |
||||
|
||||
本功能实现了通过S7协议读取西门子PLC200 Smart设备的数据,支持定时自动采集和手动读写操作。 |
||||
|
||||
## 功能特性 |
||||
|
||||
### 1. 支持的地址类型 |
||||
- **M区**: M0.1, M0.2 (位地址), M10 (字节地址) |
||||
- **I区**: I0.1, I0.2 (输入位), I0 (输入字节) |
||||
- **Q区**: Q0.1, Q0.2 (输出位), Q0 (输出字节) |
||||
- **VB区**: VB12 (字节) |
||||
- **VW区**: VW314 (字,2字节) |
||||
- **VD区**: VD11 (双字,4字节,浮点数) |
||||
- **AIW区**: AIW0, AIW64 (模拟量输入字,2字节,只读) |
||||
- **AQW区**: AQW0, AQW64 (模拟量输出字,2字节,可读写) |
||||
|
||||
### 2. 核心功能 |
||||
- ✅ 定时自动采集(每5分钟执行一次) |
||||
- ✅ 手动优先逻辑(Constant.WEB_FLAG为true时跳过采集) |
||||
- ✅ 根据gateway_manage中community_type='S7'的dataCom查询采集参数 |
||||
- ✅ 指令创建、下发、解析一体化 |
||||
- ✅ 数据倍率、初始值、小数点处理 |
||||
- ✅ 连接缓存管理,避免频繁创建连接 |
||||
|
||||
## 文件结构 |
||||
|
||||
``` |
||||
user-service/src/main/java/com/mh/user/ |
||||
├── s7/ |
||||
│ └── S7ConnectorUtil.java # S7通信工具类 |
||||
├── job/ |
||||
│ └── S7PlcCollectionJob.java # 定时采集任务 |
||||
├── controller/ |
||||
│ └── S7PlcController.java # 手动读写接口 |
||||
└── mapper/ |
||||
├── GatewayManageMapper.java # 新增queryS7Gateways()方法 |
||||
└── CollectionParamsManageMapper.java # 新增selectCPMByDataCom()方法 |
||||
``` |
||||
|
||||
## 数据库配置 |
||||
|
||||
### 1. gateway_manage表配置 |
||||
```sql |
||||
-- 添加S7类型的网关记录 |
||||
INSERT INTO gateway_manage ( |
||||
gateway_name, |
||||
gateway_ip, |
||||
gateway_port, -- 格式: "rack,slot" 例如 "0,1" |
||||
data_com, -- 通讯口标识,例如 "S7_PLC_1" |
||||
community_type,-- 必须设置为 'S7' |
||||
grade -- 连接状态: 1=在线 |
||||
) VALUES ( |
||||
'PLC200Smart_1', |
||||
'192.168.1.100', |
||||
'0,1', |
||||
'S7_PLC_1', |
||||
'S7', |
||||
'1' |
||||
); |
||||
``` |
||||
|
||||
### 2. device_install表配置 |
||||
```sql |
||||
-- 添加设备安装记录,关联到S7网关 |
||||
INSERT INTO device_install ( |
||||
device_name, |
||||
device_type, |
||||
data_com, -- 与gateway_manage中的data_com一致 |
||||
building_id |
||||
) VALUES ( |
||||
'S7设备1', |
||||
'PLC', |
||||
'S7_PLC_1', |
||||
'1' |
||||
); |
||||
``` |
||||
|
||||
### 3. collection_params_manage表配置 |
||||
```sql |
||||
-- 添加采集点位配置 |
||||
INSERT INTO collection_params_manage ( |
||||
device_install_id, |
||||
register_addr, -- 寄存器地址,如 M0.1, VB12, VW314, VD11 |
||||
func_code, -- 功能码(可选) |
||||
mt_ratio, -- 倍率 |
||||
mt_init_value, -- 初始值 |
||||
digits, -- 小数点位数 |
||||
is_use, -- 是否启用: 1=启用 |
||||
other_name, -- 点位别名(唯一) |
||||
building_id |
||||
) VALUES ( |
||||
1, -- device_install_id |
||||
'M0.1', -- 寄存器地址 |
||||
NULL, |
||||
1, -- 倍率 |
||||
0, -- 初始值 |
||||
2, -- 2位小数 |
||||
1, -- 启用 |
||||
'plc_status', -- 点位名称 |
||||
'1' -- building_id |
||||
); |
||||
``` |
||||
|
||||
## 使用方式 |
||||
|
||||
### 1. 自动定时采集 |
||||
|
||||
系统启动后会自动执行定时任务,每5分钟采集一次所有S7网关的数据。 |
||||
|
||||
**定时任务配置:** |
||||
- Cron表达式: `0 0/5 * * * ?` (每5分钟) |
||||
- 可在`S7PlcCollectionJob.collectS7Data()`方法中修改 |
||||
|
||||
**手动优先逻辑:** |
||||
- 当`Constant.WEB_FLAG = true`时,跳过本次采集 |
||||
- 确保手动操作不被定时任务干扰 |
||||
|
||||
### 2. 手动写入数据 |
||||
|
||||
**API接口:** |
||||
``` |
||||
POST /s7plc/write |
||||
参数: |
||||
- cpmId: 采集参数ID (Long) |
||||
- value: 要写入的值 (Object) |
||||
|
||||
返回: |
||||
{ |
||||
"code": 200, |
||||
"msg": "写入成功" |
||||
} |
||||
``` |
||||
|
||||
**示例:** |
||||
```bash |
||||
curl -X POST "http://localhost:8080/s7plc/write?cpmId=1&value=1" |
||||
``` |
||||
|
||||
### 3. 清理连接缓存 |
||||
|
||||
**API接口:** |
||||
``` |
||||
POST /s7plc/clearCache |
||||
|
||||
返回: |
||||
{ |
||||
"code": 200, |
||||
"msg": "缓存清理成功" |
||||
} |
||||
``` |
||||
|
||||
## 代码示例 |
||||
|
||||
### 在Service中调用手动写入 |
||||
```java |
||||
@Autowired |
||||
private S7PlcCollectionJob s7PlcCollectionJob; |
||||
|
||||
public void controlDevice(Long cpmId, Object value) { |
||||
// 设置手动操作标志 |
||||
Constant.WEB_FLAG = true; |
||||
try { |
||||
boolean success = s7PlcCollectionJob.writeData(cpmId, value); |
||||
if (success) { |
||||
log.info("控制成功"); |
||||
} else { |
||||
log.error("控制失败"); |
||||
} |
||||
} finally { |
||||
Constant.WEB_FLAG = false; |
||||
} |
||||
} |
||||
``` |
||||
|
||||
## 注意事项 |
||||
|
||||
### 1. PLC连接配置 |
||||
- **IP地址**: 确保gateway_manage.gatewayIP正确配置 |
||||
- **Rack/Slot**: 默认为0,1,可通过gatewayPort字段配置(格式: "rack,slot") |
||||
- **网络**: 确保服务器能访问PLC的IP地址和端口(默认102) |
||||
|
||||
### 2. 数据类型映射 |
||||
| 地址类型 | 数据类型 | DaveArea | 说明 | |
||||
|---------|---------|----------|------| |
||||
| M0.1 | Boolean | FLAGS | 位地址,返回0或1 | |
||||
| M10 | Byte | FLAGS | 字节地址,返回0-255 | |
||||
| I0.1 | Boolean | INPUTS | 输入位,返回0或1(只读) | |
||||
| I0 | Byte | INPUTS | 输入字节,返回0-255(只读) | |
||||
| Q0.1 | Boolean | OUTPUTS | 输出位,返回0或1 | |
||||
| Q0 | Byte | OUTPUTS | 输出字节,返回0-255 | |
||||
| VB12 | Byte | DB | V区字节,返回0-255 | |
||||
| VW314 | Word | DB | V区字,返回0-65535 | |
||||
| VD11 | Float | DB | V区双字,返回浮点数 | |
||||
| AIW0 | Word | INPUTS | 模拟量输入字,返回0-65535(只读) | |
||||
| AQW0 | Word | OUTPUTS | 模拟量输出字,返回0-65535 | |
||||
|
||||
### 3. 注意事项 |
||||
|
||||
#### 读写权限说明 |
||||
- **只读区域**: I区(输入)、AIW(模拟量输入) - 这些区域通常由PLC硬件控制,不建议写入 |
||||
- **可写区域**: M区、Q区(输出)、V区、AQW(模拟量输出) |
||||
- 尝试写入只读区域时会记录警告日志,但仍会执行写入操作 |
||||
|
||||
### 4. 性能优化 |
||||
- 连接器采用缓存机制,避免频繁创建连接 |
||||
- 批量采集时使用同一个连接器实例 |
||||
- 可通过`clearCache()`方法清理缓存 |
||||
|
||||
### 5. 异常处理 |
||||
- 连接失败会记录日志并跳过该网关 |
||||
- 单个点位采集失败不影响其他点位 |
||||
- 所有异常都会记录详细日志 |
||||
|
||||
## 依赖库 |
||||
|
||||
项目已添加s7connector依赖: |
||||
```xml |
||||
<dependency> |
||||
<groupId>com.github.s7connector</groupId> |
||||
<artifactId>s7connector</artifactId> |
||||
<version>2.1</version> |
||||
</dependency> |
||||
``` |
||||
|
||||
## 后续优化方向 |
||||
|
||||
1. **连接池管理**: 实现更完善的连接池,支持断线重连 |
||||
2. **批量读写**: 支持一次性读取多个点位,提高效率 |
||||
3. **数据校验**: 增加数据范围校验和异常值过滤 |
||||
4. **监控告警**: 添加PLC连接状态监控和异常告警 |
||||
5. **配置化**: 将定时任务周期等参数配置化 |
||||
6. **测试用例**: 编写单元测试和集成测试 |
||||
|
||||
## 常见问题 |
||||
|
||||
### Q1: 连接失败怎么办? |
||||
- 检查PLC IP地址是否正确 |
||||
- 检查网络连接是否正常 |
||||
- 检查PLC是否允许S7通信 |
||||
- 查看日志中的详细错误信息 |
||||
|
||||
### Q2: 读取数据不正确? |
||||
- 检查registerAddr格式是否正确 |
||||
- 确认数据类型是否匹配(M/VB/VW/VD) |
||||
- 检查倍率和初始值配置 |
||||
- 对比PLC中的实际值 |
||||
|
||||
### Q3: 如何调试? |
||||
- 查看日志文件:`logs/user-service/info/` |
||||
- 启用DEBUG日志级别 |
||||
- 使用PLC仿真软件进行测试 |
||||
|
||||
## 联系方式 |
||||
|
||||
如有问题,请联系开发团队。 |
||||
|
||||
--- |
||||
**最后更新**: 2026-06-23 |
||||
@ -1,303 +0,0 @@
|
||||
# S7 PLC 地址类型扩展说明 |
||||
|
||||
## 更新概述 |
||||
|
||||
本次更新为S7ConnectorUtil工具类新增了以下地址类型的支持: |
||||
- **I区**: 数字量输入 (Input) |
||||
- **Q区**: 数字量输出 (Output) |
||||
- **AIW区**: 模拟量输入字 (Analog Input Word) |
||||
- **AQW区**: 模拟量输出字 (Analog Output Word) |
||||
|
||||
## 支持的地址格式 |
||||
|
||||
### 1. I区 - 数字量输入 |
||||
**地址格式:** |
||||
- 位地址: `I0.1`, `I1.5`, `I2.3` 等 |
||||
- 字节地址: `I0`, `I1`, `I10` 等 |
||||
|
||||
**特性:** |
||||
- DaveArea: `PE` (Process Inputs) |
||||
- 数据类型: Boolean (位) 或 Byte (字节) |
||||
- **通常只读**,由外部传感器/开关控制 |
||||
- 写入时会记录警告日志 |
||||
|
||||
**示例:** |
||||
```java |
||||
// 读取输入位 I0.1 |
||||
Object value = connector.readData("I0.1"); // 返回 0 或 1 |
||||
|
||||
// 读取输入字节 I0 |
||||
Object value = connector.readData("I0"); // 返回 0-255 |
||||
``` |
||||
|
||||
### 2. Q区 - 数字量输出 |
||||
**地址格式:** |
||||
- 位地址: `Q0.1`, `Q1.5`, `Q2.3` 等 |
||||
- 字节地址: `Q0`, `Q1`, `Q10` 等 |
||||
|
||||
**特性:** |
||||
- DaveArea: `PA` (Process Outputs) |
||||
- 数据类型: Boolean (位) 或 Byte (字节) |
||||
- **可读写**,用于控制继电器/指示灯等 |
||||
|
||||
**示例:** |
||||
```java |
||||
// 读取输出位 Q0.1 |
||||
Object value = connector.readData("Q0.1"); // 返回 0 或 1 |
||||
|
||||
// 写入输出位 Q0.1 |
||||
connector.writeData("Q0.1", 1); // 置位 |
||||
|
||||
// 写入输出字节 Q0 |
||||
connector.writeData("Q0", 255); // 所有位都置1 |
||||
``` |
||||
|
||||
### 3. AIW区 - 模拟量输入字 |
||||
**地址格式:** |
||||
- `AIW0`, `AIW64`, `AIW128` 等 |
||||
|
||||
**特性:** |
||||
- DaveArea: `PE` (Process Inputs) |
||||
- 数据类型: Word (2字节, 0-65535) |
||||
- **只读**,用于读取模拟量传感器(温度、压力等) |
||||
- 通常对应PLC的模拟量输入模块 |
||||
- 写入时会记录警告日志 |
||||
|
||||
**示例:** |
||||
```java |
||||
// 读取模拟量输入 AIW0 |
||||
Object value = connector.readData("AIW0"); // 返回 0-65535 |
||||
|
||||
// 转换为实际值(例如温度传感器 0-10V 对应 0-100°C) |
||||
int rawValue = (Integer) value; |
||||
double temperature = rawValue * 100.0 / 65535.0; |
||||
``` |
||||
|
||||
### 4. AQW区 - 模拟量输出字 |
||||
**地址格式:** |
||||
- `AQW0`, `AQW64`, `AQW128` 等 |
||||
|
||||
**特性:** |
||||
- DaveArea: `PA` (Process Outputs) |
||||
- 数据类型: Word (2字节, 0-65535) |
||||
- **可读写**,用于控制模拟量执行器(变频器、调节阀等) |
||||
- 通常对应PLC的模拟量输出模块 |
||||
|
||||
**示例:** |
||||
```java |
||||
// 读取模拟量输出 AQW0 |
||||
Object value = connector.readData("AQW0"); // 返回 0-65535 |
||||
|
||||
// 写入模拟量输出(例如设置变频器频率 0-50Hz) |
||||
double frequency = 25.0; // 25Hz |
||||
int outputValue = (int)(frequency * 65535.0 / 50.0); |
||||
connector.writeData("AQW0", outputValue); |
||||
``` |
||||
|
||||
## DaveArea映射表 |
||||
|
||||
| PLC区域 | DaveArea枚举 | 说明 | |
||||
|---------|-------------|------| |
||||
| M区 | FLAGS | 位存储区/Merkers | |
||||
| I区 | INPUTS | 数字量输入/Inputs | |
||||
| Q区 | OUTPUTS | 数字量输出/Outputs | |
||||
| V区(DB) | DB | 数据块/Data Block | |
||||
| AIW | INPUTS | 模拟量输入(映射到输入区) | |
||||
| AQW | OUTPUTS | 模拟量输出(映射到输出区) | |
||||
|
||||
## 数据库配置示例 |
||||
|
||||
### 配置I区点位 |
||||
```sql |
||||
-- 数字量输入点位 |
||||
INSERT INTO collection_params_manage ( |
||||
device_install_id, |
||||
register_addr, |
||||
is_use, |
||||
other_name, |
||||
building_id |
||||
) VALUES ( |
||||
1, |
||||
'I0.1', -- 急停按钮状态 |
||||
1, |
||||
'emergency_stop', |
||||
'1' |
||||
); |
||||
``` |
||||
|
||||
### 配置Q区点位 |
||||
```sql |
||||
-- 数字量输出点位 |
||||
INSERT INTO collection_params_manage ( |
||||
device_install_id, |
||||
register_addr, |
||||
is_use, |
||||
other_name, |
||||
building_id |
||||
) VALUES ( |
||||
1, |
||||
'Q0.1', -- 启动指示灯 |
||||
1, |
||||
'start_indicator', |
||||
'1' |
||||
); |
||||
``` |
||||
|
||||
### 配置AIW区点位 |
||||
```sql |
||||
-- 模拟量输入点位(温度传感器) |
||||
INSERT INTO collection_params_manage ( |
||||
device_install_id, |
||||
register_addr, |
||||
mt_ratio, -- 倍率 |
||||
digits, -- 小数点 |
||||
is_use, |
||||
other_name, |
||||
building_id |
||||
) VALUES ( |
||||
1, |
||||
'AIW0', -- 温度传感器 |
||||
0.0015259, -- 倍率: 100/65535 ≈ 0.0015259 |
||||
2, -- 2位小数 |
||||
1, |
||||
'temperature_sensor', |
||||
'1' |
||||
); |
||||
``` |
||||
|
||||
### 配置AQW区点位 |
||||
```sql |
||||
-- 模拟量输出点位(变频器控制) |
||||
INSERT INTO collection_params_manage ( |
||||
device_install_id, |
||||
register_addr, |
||||
is_use, |
||||
other_name, |
||||
building_id |
||||
) VALUES ( |
||||
1, |
||||
'AQW0', -- 变频器频率设定 |
||||
1, |
||||
'vfd_frequency', |
||||
'1' |
||||
); |
||||
``` |
||||
|
||||
## 实际应用案例 |
||||
|
||||
### 案例1: 读取多个传感器数据 |
||||
```java |
||||
// 在S7PlcCollectionJob中自动采集 |
||||
// 配置以下点位: |
||||
// - I0.1: 急停按钮 |
||||
// - I0.2: 启动按钮 |
||||
// - AIW0: 温度传感器 |
||||
// - AIW64: 压力传感器 |
||||
|
||||
// 系统会每5分钟自动读取并保存到数据库 |
||||
``` |
||||
|
||||
### 案例2: 手动控制输出 |
||||
```java |
||||
@Autowired |
||||
private S7PlcCollectionJob s7PlcCollectionJob; |
||||
|
||||
// 通过API控制Q区输出 |
||||
@PostMapping("/control/light") |
||||
public HttpResult controlLight(@RequestParam boolean on) { |
||||
Constant.WEB_PLC_FLAG = true; |
||||
try { |
||||
// 获取Q0.1对应的cpmId |
||||
Long cpmId = getCpmIdByOtherName("start_indicator"); |
||||
s7PlcCollectionJob.writeData(cpmId, on ? 1 : 0); |
||||
return HttpResult.ok(); |
||||
} finally { |
||||
Constant.WEB_PLC_FLAG = false; |
||||
} |
||||
} |
||||
``` |
||||
|
||||
### 案例3: 模拟量转换 |
||||
```java |
||||
// 温度传感器: 0-10V 对应 0-100°C |
||||
// AIW0 原始值: 0-65535 |
||||
|
||||
// 在Service中进行转换 |
||||
public double getTemperature() { |
||||
CollectionParamsManageEntity param = |
||||
collectionParamsManageMapper.selectDeviceInstallByOtherName( |
||||
"temperature_sensor", "1" |
||||
); |
||||
|
||||
// 原始值已经应用了倍率 0.0015259 |
||||
BigDecimal rawValue = param.getCurValue(); |
||||
|
||||
// 直接得到摄氏度 |
||||
return rawValue.doubleValue(); |
||||
} |
||||
``` |
||||
|
||||
## 注意事项 |
||||
|
||||
### 1. I区和AIW区的只读特性 |
||||
- 这些区域由PLC硬件或外部设备控制 |
||||
- 尝试写入会导致警告日志 |
||||
- 在实际应用中应避免写入操作 |
||||
|
||||
### 2. Q区和AQW区的写入权限 |
||||
- 确保PLC程序允许外部写入 |
||||
- 注意PLC程序中是否有互锁逻辑 |
||||
- 写入前确认设备状态安全 |
||||
|
||||
### 3. 模拟量量程匹配 |
||||
- AIW/AQW的0-65535对应实际物理量 |
||||
- 需要在PLC中配置正确的量程 |
||||
- 或在Java代码中进行转换计算 |
||||
|
||||
### 4. 地址偏移 |
||||
- AIW和AQW的地址通常是2的倍数(AIW0, AIW64, AIW128...) |
||||
- 具体取决于PLC硬件配置 |
||||
- 请参考PLC硬件手册 |
||||
|
||||
## 测试建议 |
||||
|
||||
### 1. 使用PLC仿真软件 |
||||
- S7-PLCSIM Advanced |
||||
- 可以模拟各种地址类型的读写 |
||||
- 验证地址解析是否正确 |
||||
|
||||
### 2. 逐步测试 |
||||
1. 先测试M区和V区(最常用) |
||||
2. 再测试I区和Q区(数字量) |
||||
3. 最后测试AIW和AQW(模拟量) |
||||
|
||||
### 3. 监控日志 |
||||
- 查看读写操作的日志 |
||||
- 确认数据类型转换正确 |
||||
- 检查是否有警告或错误 |
||||
|
||||
## 常见问题 |
||||
|
||||
### Q1: 为什么I区写入会有警告? |
||||
A: I区是输入区,通常由外部硬件控制。写入I区在技术上可行,但不符合PLC编程规范,可能导致意外行为。 |
||||
|
||||
### Q2: AIW和AQW的地址为什么是64、128这样的数字? |
||||
A: 这取决于PLC的硬件配置。每个模拟量通道占用2个字节,地址间隔由模块插槽位置决定。 |
||||
|
||||
### Q3: 如何确定模拟量的量程? |
||||
A: |
||||
1. 查看PLC硬件模块手册 |
||||
2. 检查PLC程序中的量程配置 |
||||
3. 使用万用表测量实际电压/电流 |
||||
4. 对比PLC显示值和实际值进行校准 |
||||
|
||||
### Q4: Q区写入后PLC没有响应? |
||||
A: |
||||
1. 检查PLC程序是否覆盖了Q区 |
||||
2. 确认PLC处于RUN模式 |
||||
3. 检查是否有硬件故障 |
||||
4. 验证网络连接正常 |
||||
|
||||
--- |
||||
**更新日期**: 2026-06-23 |
||||
**版本**: v1.1 |
||||
@ -1,301 +0,0 @@
|
||||
# S7 PLC 数据解析问题排查指南 |
||||
|
||||
## 问题现象 |
||||
虽然有数据返回,但解析出来的数值与实际PLC中的值不一致。 |
||||
|
||||
## 常见原因及解决方案 |
||||
|
||||
### 1. 字节序问题 (最常见) |
||||
|
||||
**问题描述:** |
||||
- 西门子S7协议使用**大端序**(Big-Endian) |
||||
- 如果库返回的是小端序,会导致数值错误 |
||||
|
||||
**示例:** |
||||
``` |
||||
PLC中VW100 = 256 (0x0100) |
||||
大端序: [0x01, 0x00] → 计算: (0x01 << 8) | 0x00 = 256 ✓ |
||||
小端序: [0x00, 0x01] → 计算: (0x00 << 8) | 0x01 = 1 ✗ |
||||
``` |
||||
|
||||
**当前实现:** |
||||
代码已使用大端序转换: |
||||
```java |
||||
private int bytesToWord(byte[] data) { |
||||
return ((data[0] & 0xFF) << 8) | (data[1] & 0xFF); // 大端序 |
||||
} |
||||
``` |
||||
|
||||
**排查方法:** |
||||
查看日志中的原始数据和计算结果: |
||||
``` |
||||
读取VW区: addr=VW100, data=[1, 0], hex=01 00, value=256 |
||||
``` |
||||
|
||||
--- |
||||
|
||||
### 2. DB块号问题 |
||||
|
||||
**问题描述:** |
||||
V区(VB/VW/VD)对应PLC中的数据块(DB),不同项目可能使用不同的DB块号。 |
||||
|
||||
**当前实现:** |
||||
```java |
||||
// 固定使用DB1 |
||||
data = connector.read(DaveArea.DB, 1, addressInfo.getByteOffset(), 2); |
||||
``` |
||||
|
||||
**解决方案:** |
||||
如果你的PLC使用其他DB块(如DB2、DB100等),需要修改代码或配置。 |
||||
|
||||
**排查步骤:** |
||||
1. 在PLC程序中确认V区对应的DB块号 |
||||
2. 查看TIA Portal或STEP 7中的符号表 |
||||
3. 修改代码中的DB块号参数 |
||||
|
||||
--- |
||||
|
||||
### 3. AIW/AQW地址偏移问题 |
||||
|
||||
**问题描述:** |
||||
模拟量模块的地址可能不是从0开始,而是从64、128等开始。 |
||||
|
||||
**示例:** |
||||
``` |
||||
第一个模拟量通道: AIW0 |
||||
第二个模拟量通道: AIW2 或 AIW64 (取决于硬件配置) |
||||
``` |
||||
|
||||
**排查方法:** |
||||
1. 查看PLC硬件组态 |
||||
2. 确认模拟量模块的起始地址 |
||||
3. 在PLC监控表中验证实际地址 |
||||
|
||||
--- |
||||
|
||||
### 4. 数据类型不匹配 |
||||
|
||||
**问题描述:** |
||||
使用了错误的读取方法,导致数据类型解析错误。 |
||||
|
||||
**对照表:** |
||||
| PLC地址 | 正确方法 | 错误示例 | |
||||
|---------|---------|---------| |
||||
| VW100 (字) | bytesToWord() - 2字节 | bytesToDWord() - 4字节 | |
||||
| VD200 (双字) | bytesToDWord() - 4字节 | bytesToWord() - 2字节 | |
||||
| M0.1 (位) | getBit() | 直接读取字节 | |
||||
|
||||
**排查方法:** |
||||
查看日志中的字节长度: |
||||
``` |
||||
读取VW区: data=[1, 0] ← 应该是2字节 |
||||
读取VD区: data=[64, 66, 0, 0] ← 应该是4字节 |
||||
``` |
||||
|
||||
--- |
||||
|
||||
### 5. 浮点数精度问题 |
||||
|
||||
**问题描述:** |
||||
VD区存储的是IEEE 754浮点数,转换可能有精度损失。 |
||||
|
||||
**示例:** |
||||
``` |
||||
PLC中: 25.5 |
||||
读取后: 25.500001 或 25.499999 |
||||
``` |
||||
|
||||
**解决方案:** |
||||
在应用层进行四舍五入: |
||||
```java |
||||
BigDecimal value = new BigDecimal(result); |
||||
value = value.setScale(2, BigDecimal.ROUND_HALF_UP); |
||||
``` |
||||
|
||||
--- |
||||
|
||||
## 调试步骤 |
||||
|
||||
### 第1步: 启用DEBUG日志 |
||||
|
||||
在`application.yml`或`application.properties`中设置: |
||||
```yaml |
||||
logging: |
||||
level: |
||||
com.mh.user.s7.S7ConnectorUtil: DEBUG |
||||
``` |
||||
|
||||
### 第2步: 查看原始数据日志 |
||||
|
||||
运行程序后,查看日志输出: |
||||
``` |
||||
2026-06-23 10:30:15 DEBUG - 读取VW区: addr=VW100, data=[1, 0], hex=01 00, value=256 |
||||
2026-06-23 10:30:15 INFO - 读取成功: addr=VW100, value=256 |
||||
``` |
||||
|
||||
### 第3步: 对比PLC实际值 |
||||
|
||||
1. 打开TIA Portal或STEP 7 |
||||
2. 进入在线监控模式 |
||||
3. 查看对应地址的实际值 |
||||
4. 对比日志中的value值 |
||||
|
||||
### 第4步: 分析差异 |
||||
|
||||
**情况A: 字节顺序相反** |
||||
``` |
||||
PLC显示: 256 (0x0100) |
||||
日志显示: data=[0, 1], value=1 |
||||
``` |
||||
→ 需要交换字节顺序 |
||||
|
||||
**情况B: 数值完全不对** |
||||
``` |
||||
PLC显示: 100 |
||||
日志显示: value=16777216 |
||||
``` |
||||
→ 可能是DB块号错误或地址偏移错误 |
||||
|
||||
**情况C: 浮点数异常** |
||||
``` |
||||
PLC显示: 25.5 |
||||
日志显示: value=1.23E-40 |
||||
``` |
||||
→ 字节序错误或数据类型错误 |
||||
|
||||
--- |
||||
|
||||
## 常见问题案例 |
||||
|
||||
### 案例1: VW区读数是小端序 |
||||
|
||||
**现象:** |
||||
``` |
||||
PLC: VW100 = 256 |
||||
日志: data=[0, 1], value=1 |
||||
``` |
||||
|
||||
**解决:** |
||||
检查`bytesToWord()`方法,确保是大端序: |
||||
```java |
||||
// 正确 - 大端序 |
||||
return ((data[0] & 0xFF) << 8) | (data[1] & 0xFF); |
||||
|
||||
// 错误 - 小端序 |
||||
return (data[0] & 0xFF) | ((data[1] & 0xFF) << 8); |
||||
``` |
||||
|
||||
--- |
||||
|
||||
### 案例2: VD区浮点数解析错误 |
||||
|
||||
**现象:** |
||||
``` |
||||
PLC: VD200 = 25.5 |
||||
日志: data=[65, 76, 0, 0], value=25.5 ← 正确 |
||||
或 |
||||
日志: data=[0, 0, 76, 65], value=异常值 ← 错误 |
||||
``` |
||||
|
||||
**解决:** |
||||
确认`bytesToDWord()`使用大端序: |
||||
```java |
||||
int intBits = ((data[0] & 0xFF) << 24) | |
||||
((data[1] & 0xFF) << 16) | |
||||
((data[2] & 0xFF) << 8) | |
||||
(data[3] & 0xFF); |
||||
return Float.intBitsToFloat(intBits); |
||||
``` |
||||
|
||||
--- |
||||
|
||||
### 案例3: DB块号错误 |
||||
|
||||
**现象:** |
||||
``` |
||||
PLC: DB100.DBW0 = 1000 |
||||
日志: value=0 或随机值 |
||||
``` |
||||
|
||||
**解决:** |
||||
修改读取时的DB块号: |
||||
```java |
||||
// 如果V区对应DB100 |
||||
data = connector.read(DaveArea.DB, 100, addressInfo.getByteOffset(), 2); |
||||
``` |
||||
|
||||
--- |
||||
|
||||
## 快速验证方法 |
||||
|
||||
### 方法1: 使用已知值测试 |
||||
|
||||
在PLC程序中设置一个已知值: |
||||
``` |
||||
MB10 = 123 (0x7B) |
||||
VW100 = 256 (0x0100) |
||||
VD200 = 10.5 (浮点数) |
||||
``` |
||||
|
||||
然后读取并对比: |
||||
``` |
||||
预期日志: |
||||
读取M区: addr=M10, data=[123], hex=7B, value=123 |
||||
读取VW区: addr=VW100, data=[1, 0], hex=01 00, value=256 |
||||
读取VD区: addr=VD200, data=[65, 40, 0, 0], hex=41 28 00 00, value=10.5 |
||||
``` |
||||
|
||||
### 方法2: 使用PLC仿真软件 |
||||
|
||||
1. 安装S7-PLCSIM Advanced |
||||
2. 创建测试程序,设置已知值 |
||||
3. 运行Java程序读取 |
||||
4. 对比结果 |
||||
|
||||
### 方法3: 使用其他S7客户端工具 |
||||
|
||||
推荐使用: |
||||
- **Modbus Poll** (支持S7) |
||||
- **CAS Modbus Scanner** |
||||
- **QModMaster** |
||||
|
||||
用这些工具读取相同的地址,对比结果。 |
||||
|
||||
--- |
||||
|
||||
## 性能优化建议 |
||||
|
||||
### 1. 批量读取 |
||||
|
||||
如果需要读取多个连续地址,建议使用批量读取: |
||||
```java |
||||
// 一次性读取10个字 |
||||
byte[] data = connector.read(DaveArea.DB, 1, 0, 20); // 20字节 = 10个字 |
||||
``` |
||||
|
||||
### 2. 减少日志输出 |
||||
|
||||
生产环境关闭DEBUG日志: |
||||
```yaml |
||||
logging: |
||||
level: |
||||
com.mh.user.s7.S7ConnectorUtil: INFO |
||||
``` |
||||
|
||||
### 3. 连接复用 |
||||
|
||||
当前已实现连接缓存,确保不要频繁创建新连接。 |
||||
|
||||
--- |
||||
|
||||
## 联系支持 |
||||
|
||||
如果以上方法都无法解决问题,请提供: |
||||
|
||||
1. **日志输出**: 包含完整的DEBUG日志 |
||||
2. **PLC截图**: TIA Portal中对应地址的监控值 |
||||
3. **地址信息**: 具体的registerAddr配置 |
||||
4. **期望值vs实际值**: 对比表格 |
||||
|
||||
--- |
||||
**更新日期**: 2026-06-23 |
||||
@ -1,49 +0,0 @@
|
||||
package com.mh.user.config; |
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator; |
||||
import com.fasterxml.jackson.core.JsonParser; |
||||
import com.fasterxml.jackson.databind.DeserializationContext; |
||||
import com.fasterxml.jackson.databind.DeserializationFeature; |
||||
import com.fasterxml.jackson.databind.JsonDeserializer; |
||||
import com.fasterxml.jackson.databind.ObjectMapper; |
||||
import com.fasterxml.jackson.databind.module.SimpleModule; |
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; |
||||
import com.mh.user.model.MyBigDecimalDeserializer; |
||||
import org.springframework.context.annotation.Bean; |
||||
import org.springframework.context.annotation.Configuration; |
||||
|
||||
import java.io.IOException; |
||||
import java.math.BigDecimal; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project CHWS |
||||
* @description 避免使用科学计数算法 |
||||
* @date 2026-01-07 14:37:11 |
||||
*/ |
||||
@Configuration |
||||
public class MyJacksonConfig { |
||||
|
||||
@Bean("customObjectMapper") |
||||
public ObjectMapper customObjectMapper() { |
||||
ObjectMapper mapper = new ObjectMapper(); |
||||
|
||||
// 注册 JavaTimeModule
|
||||
mapper.registerModule(new JavaTimeModule()); |
||||
|
||||
// 启用 BigDecimal 作为普通格式输出(避免科学计数法)
|
||||
mapper.enable(JsonGenerator.Feature.WRITE_BIGDECIMAL_AS_PLAIN); |
||||
|
||||
// 注册自定义反序列化器
|
||||
SimpleModule module = new SimpleModule(); |
||||
module.addDeserializer(BigDecimal.class, new MyBigDecimalDeserializer()); |
||||
mapper.registerModule(module); |
||||
|
||||
// 启用 BigDecimal 处理浮点数
|
||||
mapper.enable(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS); |
||||
|
||||
return mapper; |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,62 @@
|
||||
package com.mh.user.config.mqtt; |
||||
|
||||
import com.mh.user.config.MHConfig; |
||||
import com.mh.user.constants.ChannelName; |
||||
import com.mh.user.constants.TopicEnum; |
||||
import com.mh.user.utils.SpringBeanUtil; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.integration.annotation.Router; |
||||
import org.springframework.integration.mqtt.support.MqttHeaders; |
||||
import org.springframework.integration.router.AbstractMessageRouter; |
||||
import org.springframework.messaging.Message; |
||||
import org.springframework.messaging.MessageChannel; |
||||
import org.springframework.messaging.MessageHeaders; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
import java.util.Collection; |
||||
import java.util.Collections; |
||||
import java.util.Objects; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project springboot-mqtt-demo |
||||
* @description 入站消息路由分发中心 |
||||
* @date 2024-10-29 17:04:17 |
||||
*/ |
||||
@Slf4j |
||||
@Component |
||||
public class InboundMessageRouter extends AbstractMessageRouter { |
||||
|
||||
/** 系统基础配置 */ |
||||
@Autowired |
||||
private MHConfig mHConfig; |
||||
|
||||
/** |
||||
* 目前只需要这个方式,后期在拓展使用IntegrationFlow方式 |
||||
* @param message |
||||
* @return |
||||
*/ |
||||
@Router(inputChannel = ChannelName.INBOUND) |
||||
@Override |
||||
protected Collection<MessageChannel> determineTargetChannels(Message<?> message) { |
||||
MessageHeaders headers = message.getHeaders(); |
||||
String topic = Objects.requireNonNull(headers.get(MqttHeaders.RECEIVED_TOPIC)).toString(); |
||||
// byte[] payload = (byte[]) message.getPayload();
|
||||
// log.info("从当前主题 topic: {}, 接收到的消息:{}", topic, new String(payload));
|
||||
// 判断当前主题是否是当前项目的,温湿度目前写死的
|
||||
if (!topic.startsWith(mHConfig.getName()) && !topic.contains("/temp")) { |
||||
log.info("当前主题 topic: {} 不是当前项目的,直接丢弃", topic); |
||||
return Collections.singleton((MessageChannel) SpringBeanUtil.getBean(ChannelName.DEFAULT_BOUND)); |
||||
} |
||||
// 找到对应的主题消息通道
|
||||
if (topic.contains("/temp")) { |
||||
return Collections.singleton((MessageChannel) SpringBeanUtil.getBean(ChannelName.EVENTS_UPLOAD_INBOUND)); |
||||
} else { |
||||
TopicEnum topicEnum = TopicEnum.find(mHConfig.getName() + "/", topic); |
||||
MessageChannel bean = (MessageChannel) SpringBeanUtil.getBean(topicEnum.getBeanName()); |
||||
return Collections.singleton(bean); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,99 @@
|
||||
package com.mh.user.config.mqtt; |
||||
|
||||
import com.mh.user.constants.MqttClientOptions; |
||||
import com.mh.user.constants.MqttProtocolEnum; |
||||
import com.mh.user.constants.MqttUseEnum; |
||||
import lombok.Data; |
||||
import org.eclipse.paho.client.mqttv3.MqttConnectOptions; |
||||
import org.springframework.boot.context.properties.ConfigurationProperties; |
||||
import org.springframework.context.annotation.Bean; |
||||
import org.springframework.context.annotation.Configuration; |
||||
import org.springframework.integration.mqtt.core.DefaultMqttPahoClientFactory; |
||||
import org.springframework.integration.mqtt.core.MqttPahoClientFactory; |
||||
import org.springframework.util.StringUtils; |
||||
|
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project springboot-mqtt-demo |
||||
* @description mqtt连接配置 |
||||
* @date 2024-10-29 14:44:51 |
||||
*/ |
||||
@Configuration |
||||
@Data |
||||
@ConfigurationProperties |
||||
public class MqttConfig { |
||||
|
||||
private static Map<MqttUseEnum, MqttClientOptions> mqttSpring; |
||||
|
||||
public void setMqttSpring(Map<MqttUseEnum, MqttClientOptions> mqtt) { |
||||
MqttConfig.mqttSpring = mqtt; |
||||
} |
||||
|
||||
/** |
||||
* 获取mqtt基本配置 |
||||
* @return |
||||
*/ |
||||
static MqttClientOptions getBasicMqttClientOptions() { |
||||
if (!mqttSpring.containsKey(MqttUseEnum.BASIC)) { |
||||
throw new Error("请先配置MQTT的基本连接参数,否则无法启动项目"); |
||||
} |
||||
return mqttSpring.get(MqttUseEnum.BASIC); |
||||
} |
||||
|
||||
/** |
||||
* 拼接获取对应mqtt的连接地址 |
||||
* @param options |
||||
* @return |
||||
*/ |
||||
public static String getMqttAddress(MqttClientOptions options) { |
||||
StringBuilder addr = new StringBuilder(); |
||||
addr.append(options.getProtocol().getProtocolAddr()) |
||||
.append(options.getHost().trim()) |
||||
.append(":") |
||||
.append(options.getPort()); |
||||
if ((options.getProtocol() == MqttProtocolEnum.WS || options.getProtocol() == MqttProtocolEnum.WSS) |
||||
&& StringUtils.hasText(options.getPath())) { |
||||
addr.append(options.getPath()); |
||||
} |
||||
return addr.toString(); |
||||
} |
||||
|
||||
public static String getBasicMqttAddress() { |
||||
return getMqttAddress(getBasicMqttClientOptions()); |
||||
} |
||||
|
||||
/** |
||||
* 获取连接参数,注入到spring中 |
||||
* @return |
||||
*/ |
||||
@Bean |
||||
public MqttConnectOptions mqttConnectionOptions() { |
||||
|
||||
MqttConnectOptions mqttConnectOptions = new MqttConnectOptions(); |
||||
|
||||
MqttClientOptions customizeOptions = getBasicMqttClientOptions(); |
||||
String basicMqttAddress = getBasicMqttAddress(); |
||||
mqttConnectOptions.setServerURIs(new String[]{basicMqttAddress}); |
||||
mqttConnectOptions.setUserName(StringUtils.hasText(customizeOptions.getUsername()) ? |
||||
customizeOptions.getUsername() : ""); |
||||
mqttConnectOptions.setPassword(StringUtils.hasText(customizeOptions.getPassword()) ? |
||||
customizeOptions.getPassword().toCharArray() : new char[0]); |
||||
// 直接进行自动连接
|
||||
mqttConnectOptions.setAutomaticReconnect(true); |
||||
// 时间间隔时间10s
|
||||
mqttConnectOptions.setKeepAliveInterval(10); |
||||
|
||||
return mqttConnectOptions; |
||||
} |
||||
|
||||
@Bean |
||||
public MqttPahoClientFactory mqttClientFactory() { |
||||
DefaultMqttPahoClientFactory factory = new DefaultMqttPahoClientFactory(); |
||||
factory.setConnectionOptions(mqttConnectionOptions()); |
||||
return factory; |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,91 @@
|
||||
package com.mh.user.config.mqtt; |
||||
|
||||
import com.mh.user.constants.ChannelName; |
||||
import com.mh.user.constants.MqttClientOptions; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.context.annotation.Bean; |
||||
import org.springframework.context.annotation.Configuration; |
||||
import org.springframework.integration.annotation.IntegrationComponentScan; |
||||
import org.springframework.integration.annotation.ServiceActivator; |
||||
import org.springframework.integration.endpoint.MessageProducerSupport; |
||||
import org.springframework.integration.mqtt.core.MqttPahoClientFactory; |
||||
import org.springframework.integration.mqtt.inbound.MqttPahoMessageDrivenChannelAdapter; |
||||
import org.springframework.integration.mqtt.support.DefaultPahoMessageConverter; |
||||
import org.springframework.integration.mqtt.support.MqttHeaders; |
||||
import org.springframework.messaging.MessageChannel; |
||||
import org.springframework.messaging.MessageHandler; |
||||
|
||||
import javax.annotation.Resource; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project springboot-mqtt-demo |
||||
* @description 入站配置 |
||||
* @date 2024-10-29 16:22:10 |
||||
*/ |
||||
@Slf4j |
||||
@Configuration |
||||
@IntegrationComponentScan |
||||
public class MqttInboundConfig { |
||||
|
||||
@Autowired |
||||
private MqttPahoClientFactory mqttClientFactory; |
||||
|
||||
@Resource(name = ChannelName.INBOUND) |
||||
private MessageChannel inboundChannel; |
||||
|
||||
private String clientId; |
||||
|
||||
/** |
||||
* 入站适配器 |
||||
* @return |
||||
*/ |
||||
@Bean(name = "adapter") |
||||
public MessageProducerSupport mqttInbound() { |
||||
MqttClientOptions options = MqttConfig.getBasicMqttClientOptions(); |
||||
// 此处初始化的时候,默认订阅了配置文件中已经写好的topic
|
||||
// 如果需要订阅多个,可以自己手动订阅,会写一个addTopic()进行添加订阅
|
||||
clientId = options.getClientId() + "_consumer_" + System.currentTimeMillis(); |
||||
MqttPahoMessageDrivenChannelAdapter adapter = new MqttPahoMessageDrivenChannelAdapter( |
||||
clientId, |
||||
mqttClientFactory, |
||||
options.getInboundTopic().split(",")); |
||||
// System.out.println("每一次都会入站适配器吗?"+clientId);
|
||||
DefaultPahoMessageConverter converter = new DefaultPahoMessageConverter(); |
||||
// 统一是字节处理
|
||||
converter.setPayloadAsBytes(true); |
||||
// 设置消息转换器
|
||||
adapter.setConverter(converter); |
||||
// 设置qos(quality of service)
|
||||
// 0:最多一次传输(消息会丢失),
|
||||
// 1:至少一次传输(消息会重复),
|
||||
// 2:只有当消息发送成功时才确认(消息不回丢,但延迟高)。
|
||||
adapter.setQos(0); |
||||
// 设置在接收已经订阅的主题信息后,发送给哪个通道,具体的发送方法需要翻上层的抽象类
|
||||
adapter.setOutputChannel(inboundChannel); |
||||
return adapter; |
||||
} |
||||
|
||||
/** |
||||
* 默认声明一个消息处理器,用于处理无效的消息 |
||||
* @return |
||||
*/ |
||||
@Bean |
||||
@ServiceActivator(inputChannel = ChannelName.DEFAULT_BOUND) |
||||
public MessageHandler handler() { |
||||
return message -> { |
||||
log.info("The default channel does not handle messages." + |
||||
"\nTopic: {}" + |
||||
"\nPayload: {}", |
||||
message.getHeaders().get(MqttHeaders.RECEIVED_TOPIC), |
||||
message.getPayload()); |
||||
}; |
||||
} |
||||
|
||||
public String getClientId() { |
||||
return clientId; |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,55 @@
|
||||
package com.mh.user.config.mqtt; |
||||
|
||||
import com.mh.user.constants.ChannelName; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springframework.context.annotation.Bean; |
||||
import org.springframework.context.annotation.Configuration; |
||||
import org.springframework.integration.channel.DirectChannel; |
||||
import org.springframework.messaging.MessageChannel; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project springboot-mqtt-demo |
||||
* @description 声明所有通道的定义类 |
||||
* @date 2024-10-29 16:23:32 |
||||
*/ |
||||
@Slf4j |
||||
@Configuration |
||||
public class MqttMessageChannel { |
||||
|
||||
@Bean(name = ChannelName.OUTBOUND) |
||||
public MessageChannel outboundChannel() { |
||||
return new DirectChannel(); |
||||
} |
||||
|
||||
@Bean(name = ChannelName.INBOUND) |
||||
public MessageChannel inboundChannel() { |
||||
return new DirectChannel(); |
||||
} |
||||
|
||||
/** |
||||
* 事件主动上报通道 |
||||
* @return |
||||
*/ |
||||
@Bean(name = ChannelName.EVENTS_UPLOAD_INBOUND) |
||||
public MessageChannel eventsUploadInbound() { |
||||
return new DirectChannel(); |
||||
} |
||||
|
||||
@Bean(name = ChannelName.EVENTS_COLLECTION_INBOUND) |
||||
public MessageChannel eventsCollectionInbound() { |
||||
return new DirectChannel(); |
||||
} |
||||
|
||||
@Bean(name = ChannelName.EVENTS_CONTROL_INBOUND) |
||||
public MessageChannel eventsControlInbound() { |
||||
return new DirectChannel(); |
||||
} |
||||
|
||||
@Bean(name = ChannelName.EVENTS_SEND_INBOUND) |
||||
public MessageChannel eventsSendInbound() { |
||||
return new DirectChannel(); |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,51 @@
|
||||
package com.mh.user.config.mqtt; |
||||
|
||||
import com.mh.user.constants.ChannelName; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.context.annotation.Bean; |
||||
import org.springframework.context.annotation.Configuration; |
||||
import org.springframework.integration.annotation.IntegrationComponentScan; |
||||
import org.springframework.integration.annotation.ServiceActivator; |
||||
import org.springframework.integration.mqtt.core.MqttPahoClientFactory; |
||||
import org.springframework.integration.mqtt.outbound.MqttPahoMessageHandler; |
||||
import org.springframework.integration.mqtt.support.DefaultPahoMessageConverter; |
||||
import org.springframework.messaging.MessageHandler; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project springboot-mqtt-demo |
||||
* @description 入站配置 |
||||
* @date 2024-10-29 16:22:10 |
||||
*/ |
||||
@Slf4j |
||||
@Configuration |
||||
@IntegrationComponentScan |
||||
public class MqttOutboundConfig { |
||||
|
||||
@Autowired |
||||
private MqttPahoClientFactory mqttClientFactory; |
||||
|
||||
/** |
||||
* 默认声明一个出站处理器,用于处理无效的消息 |
||||
* @return |
||||
*/ |
||||
@Bean |
||||
@ServiceActivator(inputChannel = ChannelName.OUTBOUND) |
||||
public MessageHandler mqttOutbound() { |
||||
MqttPahoMessageHandler messageHandler = new MqttPahoMessageHandler( |
||||
MqttConfig.getBasicMqttClientOptions().getClientId() + "_producer_" + System.currentTimeMillis(), |
||||
mqttClientFactory); |
||||
DefaultPahoMessageConverter converter = new DefaultPahoMessageConverter(); |
||||
// use byte types uniformly
|
||||
converter.setPayloadAsBytes(true); |
||||
|
||||
messageHandler.setAsync(true); |
||||
messageHandler.setDefaultQos(0); |
||||
messageHandler.setConverter(converter); |
||||
return messageHandler; |
||||
} |
||||
|
||||
|
||||
} |
||||
@ -1,71 +0,0 @@
|
||||
package com.mh.user.controller; |
||||
|
||||
import com.mh.common.http.HttpResult; |
||||
import com.mh.common.utils.StringUtils; |
||||
import com.mh.user.annotation.SysLogger; |
||||
import com.mh.user.entity.CollectionParamsManageEntity; |
||||
import com.mh.user.entity.DeviceInstallEntity; |
||||
import com.mh.user.model.DeviceModel; |
||||
import com.mh.user.service.*; |
||||
import org.apache.poi.hssf.usermodel.HSSFCell; |
||||
import org.apache.poi.hssf.usermodel.HSSFSheet; |
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
||||
import org.apache.poi.ss.usermodel.CellType; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.web.bind.annotation.*; |
||||
import org.springframework.web.multipart.MultipartFile; |
||||
|
||||
import javax.servlet.http.HttpServletRequest; |
||||
import java.io.IOException; |
||||
import java.io.InputStream; |
||||
import java.text.SimpleDateFormat; |
||||
import java.util.*; |
||||
|
||||
/** |
||||
* 基表参数信息管理 |
||||
*/ |
||||
@RestController |
||||
@RequestMapping("cpm") |
||||
public class CollectionParamsManageController { |
||||
|
||||
@Autowired |
||||
private CollectionParamsManageService collectionParamsManageService; |
||||
|
||||
//保存
|
||||
@SysLogger(title="基表采集信息",optDesc = "保存基表采集参数信息") |
||||
@PostMapping(value="/save") |
||||
public HttpResult saveDevice(@RequestBody CollectionParamsManageEntity collectionParamsManageEntity) { |
||||
return HttpResult.ok(collectionParamsManageService.insertCPM(collectionParamsManageEntity)); |
||||
} |
||||
|
||||
//修改
|
||||
@SysLogger(title="基表采集参数信息",optDesc = "修改基表采集参数信息") |
||||
@PostMapping(value="/update") |
||||
public HttpResult updateDevice(@RequestBody CollectionParamsManageEntity collectionParamsManageEntity) { |
||||
return HttpResult.ok(collectionParamsManageService.updateCPM(collectionParamsManageEntity)); |
||||
} |
||||
|
||||
// 删除多
|
||||
@PostMapping(value="/deletes") |
||||
public HttpResult deleteDevices(@RequestBody String[] ids) { |
||||
return HttpResult.ok(collectionParamsManageService.deleteByIds(ids)); |
||||
} |
||||
|
||||
// 按条件查询
|
||||
@SysLogger(title="基表采集信息",optDesc = "按条件查询基表采集参数信息") |
||||
@PostMapping(value="/query") |
||||
public HttpResult queryDevice( @RequestParam(value = "deviceInstallId", required = false)String deviceInstallId, |
||||
@RequestParam(value = "buildingId", required = false)String buildingId, |
||||
@RequestParam(value = "otherName", required = false)String otherName, |
||||
@RequestParam(value = "page", required=true)Integer page, |
||||
@RequestParam(value = "limit", required=true)Integer limit) { |
||||
try{ |
||||
int count=collectionParamsManageService.selectCPMListCount(buildingId, deviceInstallId,otherName, page, limit); |
||||
List<CollectionParamsManageEntity> records=collectionParamsManageService.selectCPMList(buildingId, deviceInstallId,otherName, page, limit); |
||||
return HttpResult.ok(count,records); |
||||
}catch (Exception e){ |
||||
return HttpResult.error(e.getMessage()); |
||||
} |
||||
} |
||||
|
||||
} |
||||
@ -1,57 +0,0 @@
|
||||
package com.mh.user.controller; |
||||
|
||||
import com.mh.common.http.HttpResult; |
||||
import com.mh.user.dto.HotWaterControlDTO; |
||||
import com.mh.user.dto.HotWaterNowDataDTO; |
||||
import com.mh.user.service.CollectionParamsManageService; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.web.bind.annotation.GetMapping; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RequestParam; |
||||
import org.springframework.web.bind.annotation.RestController; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project CHWS |
||||
* @description 热水监控 |
||||
* @date 2025-12-16 16:02:20 |
||||
*/ |
||||
@RestController |
||||
@RequestMapping("/device/hotWater") |
||||
public class HotWaterMonitorController { |
||||
|
||||
@Autowired |
||||
private CollectionParamsManageService collectionParamsManageService; |
||||
|
||||
/** |
||||
* 获取生活热水监控热泵信息 |
||||
* @param buildingId |
||||
* @return |
||||
*/ |
||||
@GetMapping("/monitorList") |
||||
public HttpResult monitorList(@RequestParam("buildingId") String buildingId) { |
||||
List<HotWaterNowDataDTO> list = collectionParamsManageService.monitorList(buildingId); |
||||
return HttpResult. ok(list); |
||||
} |
||||
|
||||
/** |
||||
* 获取生活热水监控操作信息内容 |
||||
* @param buildingId |
||||
* @return |
||||
*/ |
||||
@GetMapping("/operateList") |
||||
public HttpResult operateList(@RequestParam("buildingId") String buildingId, @RequestParam(value = "deviceInstallId", required = false) Integer deviceInstallId) { |
||||
if (deviceInstallId == null) { |
||||
List<HotWaterControlDTO> list = collectionParamsManageService.operateList(buildingId); |
||||
return HttpResult.ok(list); |
||||
} else { |
||||
List<HotWaterControlDTO> list = collectionParamsManageService.operateList(buildingId, deviceInstallId); |
||||
return HttpResult.ok(list); |
||||
} |
||||
} |
||||
|
||||
|
||||
} |
||||
@ -1,68 +0,0 @@
|
||||
package com.mh.user.controller; |
||||
|
||||
import com.mh.common.http.HttpResult; |
||||
import com.mh.user.job.S7PlcCollectionJob; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
/** |
||||
* S7 PLC控制接口 |
||||
* 提供手动读写PLC点位的功能 |
||||
* |
||||
* @author System |
||||
* @date 2026-06-23 |
||||
*/ |
||||
@Slf4j |
||||
@RestController |
||||
@RequestMapping("/s7plc") |
||||
public class S7PlcController { |
||||
|
||||
private final S7PlcCollectionJob s7PlcCollectionJob; |
||||
|
||||
public S7PlcController(S7PlcCollectionJob s7PlcCollectionJob) { |
||||
this.s7PlcCollectionJob = s7PlcCollectionJob; |
||||
} |
||||
|
||||
/** |
||||
* 手动写入数据到PLC |
||||
* |
||||
* @param cpmId 采集参数ID |
||||
* @param value 要写入的值 |
||||
* @return 操作结果 |
||||
*/ |
||||
@PostMapping("/write") |
||||
public HttpResult writeData(@RequestParam Long cpmId, @RequestParam Object value) { |
||||
try { |
||||
log.info("收到手动写入请求: cpmId={}, value={}", cpmId, value); |
||||
|
||||
boolean success = s7PlcCollectionJob.writeData(cpmId, value); |
||||
|
||||
if (success) { |
||||
return HttpResult.ok("写入成功"); |
||||
} else { |
||||
return HttpResult.error(500, "写入失败"); |
||||
} |
||||
} catch (Exception e) { |
||||
log.error("手动写入异常: cpmId={}", cpmId, e); |
||||
return HttpResult.error(500, "写入异常: " + e.getMessage()); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 清理S7连接器缓存 |
||||
* 用于重启连接或维护 |
||||
* |
||||
* @return 操作结果 |
||||
*/ |
||||
@PostMapping("/clearCache") |
||||
public HttpResult clearCache() { |
||||
try { |
||||
log.info("收到清理S7连接器缓存请求"); |
||||
s7PlcCollectionJob.clearConnectorCache(); |
||||
return HttpResult.ok("缓存清理成功"); |
||||
} catch (Exception e) { |
||||
log.error("清理缓存异常", e); |
||||
return HttpResult.error(500, "清理缓存异常: " + e.getMessage()); |
||||
} |
||||
} |
||||
} |
||||
@ -1,159 +0,0 @@
|
||||
package com.mh.user.dto; |
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
import lombok.Getter; |
||||
import lombok.Setter; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.util.StringJoiner; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 电动阀控制界面VO |
||||
* @date 2025-03-14 09:00:37 |
||||
*/ |
||||
@Setter |
||||
@Getter |
||||
public class ElecValveControlVO implements TimeControlVO { |
||||
|
||||
private String id; |
||||
|
||||
private String name; |
||||
|
||||
private int orderNum; |
||||
|
||||
// 定时_时开1
|
||||
private int oneHourTimeOpenSetOne; |
||||
private String oneHourTimeOpenSetOneId; |
||||
|
||||
// 定时_分开1
|
||||
private int oneMinTimeOpenSetOne; |
||||
private String oneMinTimeOpenSetOneId; |
||||
|
||||
// 定时_时关1
|
||||
private int oneHourTimeCloseSetOne; |
||||
private String oneHourTimeCloseSetOneId; |
||||
|
||||
// 定时_分关1
|
||||
private int oneMinTimeCloseSetOne; |
||||
private String oneMinTimeCloseSetOneId; |
||||
|
||||
// 定时_时分开1
|
||||
private String oneHourMinTimeOpenSetOneStr; |
||||
// 定时_时分关1
|
||||
private String oneHourMinTimeCloseSetOneStr; |
||||
|
||||
// 定时_时开2
|
||||
private int oneHourTimeOpenSetTwo; |
||||
private String oneHourTimeOpenSetTwoId; |
||||
|
||||
// 定时_分开2
|
||||
private int oneMinTimeOpenSetTwo; |
||||
private String oneMinTimeOpenSetTwoId; |
||||
|
||||
// 定时_时关2
|
||||
private int oneHourTimeCloseSetTwo; |
||||
private String oneHourTimeCloseSetTwoId; |
||||
|
||||
// 定时_分关2
|
||||
private int oneMinTimeCloseSetTwo; |
||||
private String oneMinTimeCloseSetTwoId; |
||||
|
||||
// 定时_时分开2
|
||||
private String oneHourMinTimeOpenSetTwoStr; |
||||
// 定时_时分关2
|
||||
private String oneHourMinTimeCloseSetTwoStr; |
||||
|
||||
// 定时_时开3
|
||||
private int oneHourTimeOpenSetThree; |
||||
private String oneHourTimeOpenSetThreeId; |
||||
|
||||
// 定时_分开3
|
||||
private int oneMinTimeOpenSetThree; |
||||
private String oneMinTimeOpenSetThreeId; |
||||
|
||||
// 定时_时关3
|
||||
private int oneHourTimeCloseSetThree; |
||||
private String oneHourTimeCloseSetThreeId; |
||||
|
||||
// 定时_分关3
|
||||
private int oneMinTimeCloseSetThree; |
||||
private String oneMinTimeCloseSetThreeId; |
||||
|
||||
// 定时_时分开3
|
||||
private String oneHourMinTimeOpenSetThreeStr; |
||||
// 定时_时分关3
|
||||
private String oneHourMinTimeCloseSetThreeStr; |
||||
|
||||
// 开延时
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private int openDelayTime; |
||||
private String openDelayTimeId; |
||||
|
||||
// 温差
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal tempDiff; |
||||
private String tempDiffId; |
||||
|
||||
// 温差设置
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal tempDiffSet; |
||||
private String tempDiffSetId; |
||||
|
||||
// 累计运行时间
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal runTime; |
||||
private String runTimeId; |
||||
|
||||
// 运行状态
|
||||
private int runState; |
||||
private String runStateId; |
||||
|
||||
// 启停控制
|
||||
private int startStopControl; |
||||
private String startStopControlId; |
||||
|
||||
// 故障
|
||||
private int fault; |
||||
private String faultId; |
||||
|
||||
// 一键启动
|
||||
private int startOneKey; |
||||
private String startOneKeyId; |
||||
|
||||
// 手自动切换
|
||||
private int manualAutoSwitch; |
||||
private String manualAutoSwitchId; |
||||
|
||||
@Override |
||||
public String toString() { |
||||
return new StringJoiner(", ", ElecValveControlVO.class.getSimpleName() + "[", "]") |
||||
.add("id='" + id + "'") |
||||
.add("name='" + name + "'") |
||||
.add("orderNum=" + orderNum) |
||||
.add("oneHourTimeOpenSetOne=" + oneHourTimeOpenSetOne) |
||||
.add("oneHourTimeOpenSetOneId='" + oneHourTimeOpenSetOneId + "'") |
||||
.add("oneMinTimeOpenSetOne=" + oneMinTimeOpenSetOne) |
||||
.add("oneMinTimeOpenSetOneId='" + oneMinTimeOpenSetOneId + "'") |
||||
.add("oneHourTimeCloseSetOne=" + oneHourTimeCloseSetOne) |
||||
.add("oneHourTimeCloseSetOneId='" + oneHourTimeCloseSetOneId + "'") |
||||
.add("oneMinTimeCloseSetOne=" + oneMinTimeCloseSetOne) |
||||
.add("oneMinTimeCloseSetOneId='" + oneMinTimeCloseSetOneId + "'") |
||||
.add("tempDiff=" + tempDiff) |
||||
.add("tempDiffId='" + tempDiffId + "'") |
||||
.add("tempDiffSet=" + tempDiffSet) |
||||
.add("tempDiffSetId='" + tempDiffSetId + "'") |
||||
.add("runTime=" + runTime) |
||||
.add("runTimeId='" + runTimeId + "'") |
||||
.add("runState=" + runState) |
||||
.add("runStateId='" + runStateId + "'") |
||||
.add("startStopControl=" + startStopControl) |
||||
.add("startStopControlId='" + startStopControlId + "'") |
||||
.add("fault=" + fault) |
||||
.add("faultId='" + faultId + "'") |
||||
.toString(); |
||||
} |
||||
|
||||
} |
||||
@ -1,179 +0,0 @@
|
||||
package com.mh.user.dto; |
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
import lombok.Getter; |
||||
import lombok.Setter; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.util.StringJoiner; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 回水泵热泵控制界面VO |
||||
* @date 2025-03-14 09:00:37 |
||||
*/ |
||||
@Setter |
||||
@Getter |
||||
public class HotWaterBackPumpControlVO { |
||||
|
||||
private String id; |
||||
|
||||
private String name; |
||||
|
||||
private int orderNum; |
||||
|
||||
// 定时_时开1
|
||||
private int oneHourTimeOpenSetOne; |
||||
private String oneHourTimeOpenSetOneId; |
||||
|
||||
// 定时_分开1
|
||||
private int oneMinTimeOpenSetOne; |
||||
private String oneMinTimeOpenSetOneId; |
||||
|
||||
// 定时_时关1
|
||||
private int oneHourTimeCloseSetOne; |
||||
private String oneHourTimeCloseSetOneId; |
||||
|
||||
// 定时_分关1
|
||||
private int oneMinTimeCloseSetOne; |
||||
private String oneMinTimeCloseSetOneId; |
||||
|
||||
// 定时_时分开1
|
||||
private String oneHourMinTimeOpenSetOneStr; |
||||
// 定时_时分关1
|
||||
private String oneHourMinTimeCloseSetOneStr; |
||||
|
||||
// 定时_时开2
|
||||
private int oneHourTimeOpenSetTwo; |
||||
private String oneHourTimeOpenSetTwoId; |
||||
|
||||
// 定时_分开2
|
||||
private int oneMinTimeOpenSetTwo; |
||||
private String oneMinTimeOpenSetTwoId; |
||||
|
||||
// 定时_时关2
|
||||
private int oneHourTimeCloseSetTwo; |
||||
private String oneHourTimeCloseSetTwoId; |
||||
|
||||
// 定时_分关2
|
||||
private int oneMinTimeCloseSetTwo; |
||||
private String oneMinTimeCloseSetTwoId; |
||||
|
||||
// 定时_时分开2
|
||||
private String oneHourMinTimeOpenSetTwoStr; |
||||
// 定时_时分关2
|
||||
private String oneHourMinTimeCloseSetTwoStr; |
||||
|
||||
// 定时_时开3
|
||||
private int oneHourTimeOpenSetThree; |
||||
private String oneHourTimeOpenSetThreeId; |
||||
|
||||
// 定时_分开3
|
||||
private int oneMinTimeOpenSetThree; |
||||
private String oneMinTimeOpenSetThreeId; |
||||
|
||||
// 定时_时关3
|
||||
private int oneHourTimeCloseSetThree; |
||||
private String oneHourTimeCloseSetThreeId; |
||||
|
||||
// 定时_分关3
|
||||
private int oneMinTimeCloseSetThree; |
||||
private String oneMinTimeCloseSetThreeId; |
||||
|
||||
// 定时_时分开3
|
||||
private String oneHourMinTimeOpenSetThreeStr; |
||||
// 定时_时分关3
|
||||
private String oneHourMinTimeCloseSetThreeStr; |
||||
|
||||
// 开延时
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private int openDelayTime; |
||||
private String openDelayTimeId; |
||||
|
||||
// 温度设置
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal tempSet; |
||||
private String tempSetId; |
||||
|
||||
// 累计运行时间
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal runTime; |
||||
private String runTimeId; |
||||
|
||||
// 运行状态
|
||||
private int runState; |
||||
private String runStateId; |
||||
|
||||
// 启停控制
|
||||
private int startStopControl; |
||||
private String startStopControlId; |
||||
|
||||
// 故障
|
||||
private int fault; |
||||
private String faultId; |
||||
|
||||
// 一键启动
|
||||
private int startOneKey; |
||||
private String startOneKeyId; |
||||
|
||||
// 手自动切换
|
||||
private int manualAutoSwitch; |
||||
private String manualAutoSwitchId; |
||||
|
||||
// 选择两台回水泵启动
|
||||
private int twoPumpStart; |
||||
private String twoPumpStartId; |
||||
|
||||
// 温度设置上限
|
||||
private BigDecimal tempSetUpperLimit; |
||||
private String tempSetUpperLimitId; |
||||
|
||||
// 温度设置下限
|
||||
private BigDecimal tempSetLowerLimit; |
||||
private String tempSetLowerLimitId; |
||||
|
||||
@Override |
||||
public String toString() { |
||||
return new StringJoiner(", ", HotWaterBackPumpControlVO.class.getSimpleName() + "[", "]") |
||||
.add("id='" + id + "'") |
||||
.add("name='" + name + "'") |
||||
.add("orderNum=" + orderNum) |
||||
.add("oneHourTimeOpenSetOne=" + oneHourTimeOpenSetOne) |
||||
.add("oneHourTimeOpenSetOneId='" + oneHourTimeOpenSetOneId + "'") |
||||
.add("oneMinTimeOpenSetOne=" + oneMinTimeOpenSetOne) |
||||
.add("oneMinTimeOpenSetOneId='" + oneMinTimeOpenSetOneId + "'") |
||||
.add("oneHourTimeCloseSetOne=" + oneHourTimeCloseSetOne) |
||||
.add("oneHourTimeCloseSetOneId='" + oneHourTimeCloseSetOneId + "'") |
||||
.add("oneMinTimeCloseSetOne=" + oneMinTimeCloseSetOne) |
||||
.add("oneMinTimeCloseSetOneId='" + oneMinTimeCloseSetOneId + "'") |
||||
.add("oneHourTimeOpenSetTwo=" + oneHourTimeOpenSetTwo) |
||||
.add("oneHourTimeOpenSetTwoId='" + oneHourTimeOpenSetTwoId + "'") |
||||
.add("oneMinTimeOpenSetTwo=" + oneMinTimeOpenSetTwo) |
||||
.add("oneMinTimeOpenSetTwoId='" + oneMinTimeOpenSetTwoId + "'") |
||||
.add("oneHourTimeCloseSetTwo=" + oneHourTimeCloseSetTwo) |
||||
.add("oneHourTimeCloseSetTwoId='" + oneHourTimeCloseSetTwoId + "'") |
||||
.add("oneMinTimeCloseSetTwo=" + oneMinTimeCloseSetTwo) |
||||
.add("oneMinTimeCloseSetTwoId='" + oneMinTimeCloseSetTwoId + "'") |
||||
.add("oneHourTimeOpenSetThree=" + oneHourTimeOpenSetThree) |
||||
.add("oneHourTimeOpenSetThreeId='" + oneHourTimeOpenSetThreeId + "'") |
||||
.add("oneMinTimeOpenSetThree=" + oneMinTimeOpenSetThree) |
||||
.add("oneMinTimeOpenSetThreeId='" + oneMinTimeOpenSetThreeId + "'") |
||||
.add("oneHourTimeCloseSetThree=" + oneHourTimeCloseSetThree) |
||||
.add("oneHourTimeCloseSetThreeId='" + oneHourTimeCloseSetThreeId + "'") |
||||
.add("openDelayTime=" + openDelayTime) |
||||
.add("openDelayTimeId='" + openDelayTimeId + "'") |
||||
.add("tempSet=" + tempSet) |
||||
.add("tempSetId='" + tempSetId + "'") |
||||
.add("runTime=" + runTime) |
||||
.add("runTimeId='" + runTimeId + "'") |
||||
.add("runState=" + runState) |
||||
.add("runStateId='" + runStateId + "'") |
||||
.add("startStopControl=" + startStopControl) |
||||
.add("startStopControlId='" + startStopControlId + "'") |
||||
.add("fault=" + fault) |
||||
.add("faultId='" + faultId + "'") |
||||
.toString(); |
||||
} |
||||
} |
||||
@ -1,118 +0,0 @@
|
||||
package com.mh.user.dto; |
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
import lombok.Getter; |
||||
import lombok.Setter; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.util.StringJoiner; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 热泵控制界面VO |
||||
* @date 2025-03-14 09:00:37 |
||||
*/ |
||||
@Setter |
||||
@Getter |
||||
public class HotWaterCircuitPumpControlVO { |
||||
|
||||
private String id; |
||||
|
||||
private String name; |
||||
|
||||
private int orderNum; |
||||
|
||||
// 定时_时开1
|
||||
private int oneHourTimeOpenSetOne; |
||||
private String oneHourTimeOpenSetOneId; |
||||
|
||||
// 定时_分开1
|
||||
private int oneMinTimeOpenSetOne; |
||||
private String oneMinTimeOpenSetOneId; |
||||
|
||||
// 定时_时分开1
|
||||
private String oneHourMinTimeOpenSetOneStr; |
||||
|
||||
// 定时_时关1
|
||||
private int oneHourTimeCloseSetOne; |
||||
private String oneHourTimeCloseSetOneId; |
||||
|
||||
// 定时_分关1
|
||||
private int oneMinTimeCloseSetOne; |
||||
private String oneMinTimeCloseSetOneId; |
||||
|
||||
// 定时_时分关1
|
||||
private String oneHourMinTimeCloseSetOneStr; |
||||
|
||||
// 开延时
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private int openDelayTime; |
||||
private String openDelayTimeId; |
||||
|
||||
// 温差
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal tempDiff; |
||||
private String tempDiffId; |
||||
|
||||
// 温差设置
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal tempDiffSet; |
||||
private String tempDiffSetId; |
||||
|
||||
// 累计运行时间
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal runTime; |
||||
private String runTimeId; |
||||
|
||||
// 运行状态
|
||||
private int runState; |
||||
private String runStateId; |
||||
|
||||
// 启停控制
|
||||
private int startStopControl; |
||||
private String startStopControlId; |
||||
|
||||
// 故障
|
||||
private int fault; |
||||
private String faultId; |
||||
|
||||
// 一键启动
|
||||
private int startOneKey; |
||||
private String startOneKeyId; |
||||
|
||||
// 手自动切换
|
||||
private int manualAutoSwitch; |
||||
private String manualAutoSwitchId; |
||||
|
||||
@Override |
||||
public String toString() { |
||||
return new StringJoiner(", ", HotWaterCircuitPumpControlVO.class.getSimpleName() + "[", "]") |
||||
.add("id='" + id + "'") |
||||
.add("name='" + name + "'") |
||||
.add("orderNum=" + orderNum) |
||||
.add("oneHourTimeOpenSetOne=" + oneHourTimeOpenSetOne) |
||||
.add("oneHourTimeOpenSetOneId='" + oneHourTimeOpenSetOneId + "'") |
||||
.add("oneMinTimeOpenSetOne=" + oneMinTimeOpenSetOne) |
||||
.add("oneMinTimeOpenSetOneId='" + oneMinTimeOpenSetOneId + "'") |
||||
.add("oneHourTimeCloseSetOne=" + oneHourTimeCloseSetOne) |
||||
.add("oneHourTimeCloseSetOneId='" + oneHourTimeCloseSetOneId + "'") |
||||
.add("oneMinTimeCloseSetOne=" + oneMinTimeCloseSetOne) |
||||
.add("oneMinTimeCloseSetOneId='" + oneMinTimeCloseSetOneId + "'") |
||||
.add("tempDiff=" + tempDiff) |
||||
.add("tempDiffId='" + tempDiffId + "'") |
||||
.add("tempDiffSet=" + tempDiffSet) |
||||
.add("tempDiffSetId='" + tempDiffSetId + "'") |
||||
.add("runTime=" + runTime) |
||||
.add("runTimeId='" + runTimeId + "'") |
||||
.add("runState=" + runState) |
||||
.add("runStateId='" + runStateId + "'") |
||||
.add("startStopControl=" + startStopControl) |
||||
.add("startStopControlId='" + startStopControlId + "'") |
||||
.add("fault=" + fault) |
||||
.add("faultId='" + faultId + "'") |
||||
.toString(); |
||||
} |
||||
|
||||
} |
||||
@ -1,38 +0,0 @@
|
||||
package com.mh.user.dto; |
||||
|
||||
import lombok.Getter; |
||||
import lombok.Setter; |
||||
import org.apache.poi.ss.formula.functions.T; |
||||
|
||||
import java.util.List; |
||||
import java.util.StringJoiner; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 生活热水监控dto |
||||
* @date 2025-03-14 09:13:19 |
||||
*/ |
||||
@Setter |
||||
@Getter |
||||
public class HotWaterControlDTO { |
||||
|
||||
private String id; |
||||
|
||||
private String name; |
||||
|
||||
private int orderNum; |
||||
|
||||
private List<?> children; |
||||
|
||||
@Override |
||||
public String toString() { |
||||
return new StringJoiner(", ", HotWaterControlDTO.class.getSimpleName() + "[", "]") |
||||
.add("id='" + id + "'") |
||||
.add("name='" + name + "'") |
||||
.add("orderNum=" + orderNum) |
||||
.add("children=" + children) |
||||
.toString(); |
||||
} |
||||
} |
||||
@ -1,85 +0,0 @@
|
||||
package com.mh.user.dto; |
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
import lombok.Getter; |
||||
import lombok.Setter; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.util.Date; |
||||
import java.util.StringJoiner; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 生活热水监控需要的列表信息 |
||||
* @date 2025-03-14 09:07:46 |
||||
*/ |
||||
@Setter |
||||
@Getter |
||||
public class HotWaterControlListVO { |
||||
|
||||
private String cpmId; |
||||
|
||||
private String registerAddr; |
||||
|
||||
private String buildingId; |
||||
|
||||
private String buildingName; |
||||
|
||||
private String deviceType; |
||||
|
||||
private String deviceId; |
||||
|
||||
private String deviceName; |
||||
|
||||
private BigDecimal curValue; |
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
||||
private Date curTime; |
||||
|
||||
private String paramTypeId; |
||||
|
||||
private String paramTypeGroupId; |
||||
|
||||
private String otherName; |
||||
|
||||
private int orderNum; |
||||
|
||||
private int dlOrderNum; |
||||
|
||||
private int ctOrderNum; |
||||
|
||||
private int digits; |
||||
|
||||
public BigDecimal getCurValue() { |
||||
return curValue; |
||||
} |
||||
|
||||
public void setCurValue(BigDecimal curValue) { |
||||
if (curValue!= null) { |
||||
// 保留两位小数
|
||||
curValue = curValue.setScale(2, BigDecimal.ROUND_HALF_UP); |
||||
} |
||||
this.curValue = curValue; |
||||
} |
||||
|
||||
@Override |
||||
public String toString() { |
||||
return new StringJoiner(", ", HotWaterControlListVO.class.getSimpleName() + "[", "]") |
||||
.add("cpmId='" + cpmId + "'") |
||||
.add("buildingId='" + buildingId + "'") |
||||
.add("buildingName='" + buildingName + "'") |
||||
.add("deviceType='" + deviceType + "'") |
||||
.add("deviceId='" + deviceId + "'") |
||||
.add("deviceName='" + deviceName + "'") |
||||
.add("curValue=" + curValue) |
||||
.add("curTime=" + curTime) |
||||
.add("paramTypeId='" + paramTypeId + "'") |
||||
.add("otherName='" + otherName + "'") |
||||
.add("orderNum=" + orderNum) |
||||
.add("dlOrderNum=" + dlOrderNum) |
||||
.add("ctOrderNum=" + ctOrderNum) |
||||
.toString(); |
||||
} |
||||
} |
||||
@ -1,186 +0,0 @@
|
||||
package com.mh.user.dto; |
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
import lombok.Getter; |
||||
import lombok.Setter; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.util.Date; |
||||
import java.util.StringJoiner; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 生活热水系统控制界面VO |
||||
* @date 2025-03-14 09:00:37 |
||||
*/ |
||||
@Setter |
||||
@Getter |
||||
public class HotWaterControlVO { |
||||
|
||||
private String id; |
||||
|
||||
private String name; |
||||
|
||||
// 运行状态 1d
|
||||
private int runningStatus; |
||||
private String runningStatusId; |
||||
|
||||
// 启停控制 2
|
||||
private int switchStatus; |
||||
private String switchStatusId; |
||||
|
||||
// 频率设置 3
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal frequencySet; |
||||
private String frequencySetId; |
||||
|
||||
// 频率 4
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal frequency; |
||||
private String frequencyId; |
||||
|
||||
// 故障状态 5
|
||||
private int alarmStatus; |
||||
private String alarmStatusId; |
||||
|
||||
// 手动自动切换 6
|
||||
private int handAutomaticSwitch; |
||||
private String handAutomaticSwitchId; |
||||
|
||||
// 开控制 8
|
||||
private int openSwitch; |
||||
private String openSwitchId; |
||||
|
||||
// 关控制 9
|
||||
private int closeSwitch; |
||||
private String closeSwitchId; |
||||
|
||||
// 水位设置 10
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0.0") |
||||
private BigDecimal waterLevelSet; |
||||
private String waterLevelSetId; |
||||
|
||||
// 水位 11
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0.0") |
||||
private BigDecimal waterLevel; |
||||
private String waterLevelId; |
||||
|
||||
// 温度 12
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal temp; |
||||
private String tempId; |
||||
|
||||
// 压力 13
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal pressure; |
||||
private String pressureId; |
||||
|
||||
// 温度设置 14
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal tempSet; |
||||
private String tempSetId; |
||||
|
||||
// 压力设置 15
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal pressureSet; |
||||
private String pressureSetId; |
||||
|
||||
// 延时时间设置 34
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal delayTimeSet; |
||||
private String delayTimeSetId; |
||||
|
||||
// 差值设置 35
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal diffValueSet; |
||||
private String diffValueSetId; |
||||
|
||||
// 计数器设置 36
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal counterSet; |
||||
private String counterSetId; |
||||
|
||||
// 切换时间设置 37
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal switchTimeSet; |
||||
private String switchTimeSetId; |
||||
|
||||
// 故障复位状态 38
|
||||
private int faultResetStatus; |
||||
private String faultResetStatusId; |
||||
|
||||
// 急停状态 39
|
||||
private int emergencyStopStatus; |
||||
private String emergencyStopStatusId; |
||||
|
||||
// 最低设置值 44
|
||||
private int minSet; |
||||
private String minSetId; |
||||
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai") |
||||
private Date curTime; |
||||
|
||||
private int orderNum; |
||||
|
||||
public void setCounterSet(BigDecimal counterSet) { |
||||
if (counterSet != null) { |
||||
counterSet = counterSet.setScale(0, BigDecimal.ROUND_HALF_UP); |
||||
} |
||||
this.counterSet = counterSet; |
||||
} |
||||
|
||||
@Override |
||||
public String toString() { |
||||
return new StringJoiner(", ", HotWaterControlVO.class.getSimpleName() + "[", "]") |
||||
.add("id='" + id + "'") |
||||
.add("name='" + name + "'") |
||||
.add("runningStatus=" + runningStatus) |
||||
.add("runningStatusId='" + runningStatusId + "'") |
||||
.add("switchStatus=" + switchStatus) |
||||
.add("switchStatusId='" + switchStatusId + "'") |
||||
.add("frequencySet=" + frequencySet) |
||||
.add("frequencySetId='" + frequencySetId + "'") |
||||
.add("frequency=" + frequency) |
||||
.add("frequencyId='" + frequencyId + "'") |
||||
.add("alarmStatus=" + alarmStatus) |
||||
.add("alarmStatusId='" + alarmStatusId + "'") |
||||
.add("handAutomaticSwitch=" + handAutomaticSwitch) |
||||
.add("handAutomaticSwitchId='" + handAutomaticSwitchId + "'") |
||||
.add("openSwitch=" + openSwitch) |
||||
.add("openSwitchId='" + openSwitchId + "'") |
||||
.add("closeSwitch=" + closeSwitch) |
||||
.add("closeSwitchId='" + closeSwitchId + "'") |
||||
.add("waterLevelSet=" + waterLevelSet) |
||||
.add("waterLevelSetId='" + waterLevelSetId + "'") |
||||
.add("waterLevel=" + waterLevel) |
||||
.add("waterLevelId='" + waterLevelId + "'") |
||||
.add("temp=" + temp) |
||||
.add("tempId='" + tempId + "'") |
||||
.add("pressure=" + pressure) |
||||
.add("pressureId='" + pressureId + "'") |
||||
.add("tempSet=" + tempSet) |
||||
.add("tempSetId='" + tempSetId + "'") |
||||
.add("pressureSet=" + pressureSet) |
||||
.add("pressureSetId='" + pressureSetId + "'") |
||||
.add("delayTimeSet=" + delayTimeSet) |
||||
.add("delayTimeSetId='" + delayTimeSetId + "'") |
||||
.add("diffValueSet=" + diffValueSet) |
||||
.add("diffValueSetId='" + diffValueSetId + "'") |
||||
.add("counterSet=" + counterSet) |
||||
.add("counterSetId='" + counterSetId + "'") |
||||
.add("switchTimeSet=" + switchTimeSet) |
||||
.add("switchTimeSetId='" + switchTimeSetId + "'") |
||||
.add("faultResetStatus=" + faultResetStatus) |
||||
.add("faultResetStatusId='" + faultResetStatusId + "'") |
||||
.add("emergencyStopStatus=" + emergencyStopStatus) |
||||
.add("emergencyStopStatusId='" + emergencyStopStatusId + "'") |
||||
.add("minSet=" + minSet) |
||||
.add("minSetId='" + minSetId + "'") |
||||
.add("curTime=" + curTime) |
||||
.add("orderNum=" + orderNum) |
||||
.toString(); |
||||
} |
||||
} |
||||
@ -1,87 +0,0 @@
|
||||
package com.mh.user.dto; |
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
import lombok.Getter; |
||||
import lombok.Setter; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.util.Date; |
||||
import java.util.StringJoiner; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 生活热水监控需要的列表信息 |
||||
* @date 2025-03-14 09:07:46 |
||||
*/ |
||||
@Setter |
||||
@Getter |
||||
public class HotWaterControlZDListVO { |
||||
|
||||
private String cpmId; |
||||
|
||||
private String registerAddr; |
||||
|
||||
private String buildingId; |
||||
|
||||
private String buildingName; |
||||
|
||||
private String deviceType; |
||||
|
||||
private String deviceId; |
||||
|
||||
private String deviceName; |
||||
|
||||
private String curValue; |
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
||||
private Date curTime; |
||||
|
||||
private String paramTypeId; |
||||
|
||||
private String paramTypeGroupId; |
||||
|
||||
private String otherName; |
||||
|
||||
private int orderNum; |
||||
|
||||
private int dlOrderNum; |
||||
|
||||
private int ctOrderNum; |
||||
|
||||
private int digits; |
||||
|
||||
public String getCurValue() { |
||||
return curValue; |
||||
} |
||||
|
||||
public void setCurValue(String curValue) { |
||||
// 判断curValue是否是数字类型
|
||||
boolean isNumeric = curValue!= null && curValue.matches("[0-9]+(\\.[0-9]+)?"); |
||||
if (curValue!= null && isNumeric) { |
||||
// 保留两位小数
|
||||
curValue = new BigDecimal(curValue).setScale(2, BigDecimal.ROUND_HALF_UP).toString(); |
||||
} |
||||
this.curValue = curValue; |
||||
} |
||||
|
||||
@Override |
||||
public String toString() { |
||||
return new StringJoiner(", ", HotWaterControlZDListVO.class.getSimpleName() + "[", "]") |
||||
.add("cpmId='" + cpmId + "'") |
||||
.add("buildingId='" + buildingId + "'") |
||||
.add("buildingName='" + buildingName + "'") |
||||
.add("deviceType='" + deviceType + "'") |
||||
.add("deviceId='" + deviceId + "'") |
||||
.add("deviceName='" + deviceName + "'") |
||||
.add("curValue=" + curValue) |
||||
.add("curTime=" + curTime) |
||||
.add("paramTypeId='" + paramTypeId + "'") |
||||
.add("otherName='" + otherName + "'") |
||||
.add("orderNum=" + orderNum) |
||||
.add("dlOrderNum=" + dlOrderNum) |
||||
.add("ctOrderNum=" + ctOrderNum) |
||||
.toString(); |
||||
} |
||||
} |
||||
@ -1,76 +0,0 @@
|
||||
package com.mh.user.dto; |
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
import lombok.Getter; |
||||
import lombok.Setter; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.util.Date; |
||||
import java.util.StringJoiner; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 设备校准控制界面VO |
||||
* @date 2025-03-14 09:00:37 |
||||
*/ |
||||
@Setter |
||||
@Getter |
||||
public class HotWaterDeviceCalibrationControlVO { |
||||
|
||||
private String id; |
||||
|
||||
private String name; |
||||
|
||||
private int orderNum; |
||||
|
||||
// 校准值
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal calibrationValue; |
||||
private String calibrationValueId; |
||||
|
||||
// 工程量最低值
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal engineeringMinValue; |
||||
private String engineeringMinValueId; |
||||
|
||||
// 工程量最高值
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal engineeringMaxValue; |
||||
private String engineeringMaxValueId; |
||||
|
||||
// 数字量最低值
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal digitalMinValue; |
||||
private String digitalMinValueId; |
||||
|
||||
// 数字量最高值
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal digitalMaxValue; |
||||
private String digitalMaxValueId; |
||||
|
||||
// 实时值
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal realTimeValue; |
||||
private String realTimeValueId; |
||||
|
||||
@Override |
||||
public String toString() { |
||||
return new StringJoiner(", ", HotWaterDeviceCalibrationControlVO.class.getSimpleName() + "[", "]") |
||||
.add("id='" + id + "'") |
||||
.add("name='" + name + "'") |
||||
.add("orderNum=" + orderNum) |
||||
.add("calibrationValue=" + calibrationValue) |
||||
.add("calibrationValueId='" + calibrationValueId + "'") |
||||
.add("engineeringMinValue=" + engineeringMinValue) |
||||
.add("engineeringMinValueId='" + engineeringMinValueId + "'") |
||||
.add("engineeringMaxValue=" + engineeringMaxValue) |
||||
.add("engineeringMaxValueId='" + engineeringMaxValueId + "'") |
||||
.add("digitalMinValue=" + digitalMinValue) |
||||
.add("digitalMinValueId='" + digitalMinValueId + "'") |
||||
.add("digitalMaxValue=" + digitalMaxValue) |
||||
.add("digitalMaxValueId='" + digitalMaxValueId + "'") |
||||
.toString(); |
||||
} |
||||
} |
||||
@ -1,69 +0,0 @@
|
||||
package com.mh.user.dto; |
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
import lombok.Getter; |
||||
import lombok.Setter; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.util.Date; |
||||
import java.util.StringJoiner; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 生活热水系统控制界面VO |
||||
* @date 2025-03-14 09:00:37 |
||||
*/ |
||||
@Setter |
||||
@Getter |
||||
public class HotWaterDeviceControlVO { |
||||
|
||||
private String id; |
||||
|
||||
private String name; |
||||
|
||||
private int orderNum; |
||||
|
||||
// 累计读数
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING) |
||||
private BigDecimal totalReading; |
||||
private String totalReadingId; |
||||
|
||||
// 当前时间
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
||||
private Date currentTime; |
||||
private String currentTimeId; |
||||
|
||||
/** |
||||
* 通讯失败 |
||||
*/ |
||||
private int communicationFailure; |
||||
private String communicationFailureId; |
||||
|
||||
/** |
||||
* 通讯失败次数 |
||||
* @return |
||||
*/ |
||||
private int communicationFailureCount; |
||||
private String communicationFailureCountId; |
||||
|
||||
/** |
||||
* modbus 复位 |
||||
*/ |
||||
private int reset; |
||||
private String resetId; |
||||
|
||||
@Override |
||||
public String toString() { |
||||
return new StringJoiner(", ", HotWaterDeviceControlVO.class.getSimpleName() + "[", "]") |
||||
.add("id='" + id + "'") |
||||
.add("name='" + name + "'") |
||||
.add("orderNum=" + orderNum) |
||||
.add("totalReading=" + totalReading) |
||||
.add("totalReadingId='" + totalReadingId + "'") |
||||
.add("currentTime=" + currentTime) |
||||
.add("currentTimeId='" + currentTimeId + "'") |
||||
.toString(); |
||||
} |
||||
} |
||||
@ -1,316 +0,0 @@
|
||||
package com.mh.user.dto; |
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
import lombok.Getter; |
||||
import lombok.Setter; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.util.StringJoiner; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 热泵控制界面VO |
||||
* @date 2025-03-14 09:00:37 |
||||
*/ |
||||
@Setter |
||||
@Getter |
||||
public class HotWaterHotPumpControlVO { // 去掉pump后的类名
|
||||
|
||||
private String id; |
||||
|
||||
private String name; |
||||
|
||||
private int orderNum; |
||||
|
||||
// 热泵12定时_时开1
|
||||
private int oneHourTimeOpenSetOne; |
||||
private String oneHourTimeOpenSetOneId; |
||||
|
||||
// 热泵12定时_分开1 (新增分钟设置)
|
||||
private int oneMinTimeOpenSetOne; |
||||
private String oneMinTimeOpenSetOneId; |
||||
|
||||
// 定时_时分开1
|
||||
private String oneHourMinTimeOpenSetOneStr; |
||||
|
||||
// 热泵12定时_时关1
|
||||
private int oneHourTimeCloseSetOne; |
||||
private String oneHourTimeCloseSetOneId; |
||||
|
||||
// 热泵12定时_分关1 (新增分钟设置)
|
||||
private int oneMinTimeCloseSetOne; |
||||
private String oneMinTimeCloseSetOneId; |
||||
|
||||
// 定时_时分关1
|
||||
private String oneHourMinTimeCloseSetOneStr; |
||||
|
||||
// 热泵12定时_时开2
|
||||
private int oneHourTimeOpenSetTwo; |
||||
private String oneHourTimeOpenSetTwoId; |
||||
|
||||
// 热泵12定时_分开2 (新增分钟设置)
|
||||
private int oneMinTimeOpenSetTwo; |
||||
private String oneMinTimeOpenSetTwoId; |
||||
|
||||
// 定时_时分开2
|
||||
private String oneHourMinTimeOpenSetTwoStr; |
||||
|
||||
// 热泵12定时_时关2
|
||||
private int oneHourTimeCloseSetTwo; |
||||
private String oneHourTimeCloseSetTwoId; |
||||
|
||||
// 热泵12定时_分关2 (新增分钟设置)
|
||||
private int oneMinTimeCloseSetTwo; |
||||
private String oneMinTimeCloseSetTwoId; |
||||
|
||||
// 定时_时分关2
|
||||
private String oneHourMinTimeCloseSetTwoStr; |
||||
|
||||
// 热泵12定时_时开3
|
||||
private int oneHourTimeOpenSetThree; |
||||
private String oneHourTimeOpenSetThreeId; |
||||
|
||||
// 热泵12定时_分开3 (新增分钟设置)
|
||||
private int oneMinTimeOpenSetThree; |
||||
private String oneMinTimeOpenSetThreeId; |
||||
|
||||
// 定时_时分开3
|
||||
private String oneHourMinTimeOpenSetThreeStr; |
||||
|
||||
// 热泵12定时_时关3
|
||||
private int oneHourTimeCloseSetThree; |
||||
private String oneHourTimeCloseSetThreeId; |
||||
|
||||
// 热泵12定时_分关3 (新增分钟设置)
|
||||
private int oneMinTimeCloseSetThree; |
||||
private String oneMinTimeCloseSetThreeId; |
||||
|
||||
// 定时_时分关3
|
||||
private String oneHourMinTimeCloseSetThreeStr; |
||||
|
||||
// 热泵34定时_时开1
|
||||
private int twoHourTimeOpenSetOne; |
||||
private String twoHourTimeOpenSetOneId; |
||||
|
||||
// 热泵34定时_分开1 (新增分钟设置)
|
||||
private int twoMinTimeOpenSetOne; |
||||
private String twoMinTimeOpenSetOneId; |
||||
|
||||
// 定时_时分开1
|
||||
private String twoHourMinTimeOpenSetOneStr; |
||||
|
||||
// 热泵34定时_时关1
|
||||
private int twoHourTimeCloseSetOne; |
||||
private String twoHourTimeCloseSetOneId; |
||||
|
||||
// 热泵34定时_分关1 (新增分钟设置)
|
||||
private int twoMinTimeCloseSetOne; |
||||
private String twoMinTimeCloseSetOneId; |
||||
|
||||
// 定时_时分关1
|
||||
private String twoHourMinTimeCloseSetOneStr; |
||||
|
||||
// 热泵34定时_时开2
|
||||
private int twoHourTimeOpenSetTwo; |
||||
private String twoHourTimeOpenSetTwoId; |
||||
|
||||
// 热泵34定时_分开2 (新增分钟设置)
|
||||
private int twoMinTimeOpenSetTwo; |
||||
private String twoMinTimeOpenSetTwoId; |
||||
|
||||
// 定时_时分开2
|
||||
private String twoHourMinTimeOpenSetTwoStr; |
||||
|
||||
// 热泵34定时_时关2
|
||||
private int twoHourTimeCloseSetTwo; |
||||
private String twoHourTimeCloseSetTwoId; |
||||
|
||||
// 热泵34定时_分关2 (新增分钟设置)
|
||||
private int twoMinTimeCloseSetTwo; |
||||
private String twoMinTimeCloseSetTwoId; |
||||
|
||||
// 定时_时分关2
|
||||
private String twoHourMinTimeCloseSetTwoStr; |
||||
|
||||
// 热泵34定时_时开3
|
||||
private int twoHourTimeOpenSetThree; |
||||
private String twoHourTimeOpenSetThreeId; |
||||
|
||||
// 热泵34定时_分开3 (新增分钟设置)
|
||||
private int twoMinTimeOpenSetThree; |
||||
private String twoMinTimeOpenSetThreeId; |
||||
|
||||
// 定时_时分开3
|
||||
private String twoHourMinTimeOpenSetThreeStr; |
||||
|
||||
// 热泵34定时_时关3
|
||||
private int twoHourTimeCloseSetThree; |
||||
private String twoHourTimeCloseSetThreeId; |
||||
|
||||
// 热泵34定时_分关3 (新增分钟设置)
|
||||
private int twoMinTimeCloseSetThree; |
||||
private String twoMinTimeCloseSetThreeId; |
||||
|
||||
// 定时_时分关3
|
||||
private String twoHourMinTimeCloseSetThreeStr; |
||||
|
||||
// 热泵_开机 -> 去掉pump前缀
|
||||
private String start; |
||||
private String startId; |
||||
|
||||
// 热泵_关机 -> 去掉pump前缀
|
||||
private String stop; |
||||
private String stopId; |
||||
|
||||
// 热泵_运行状态 -> 去掉pump前缀
|
||||
private int runState; |
||||
private String runStateId; |
||||
|
||||
// 热泵_启停控制 -> 去掉pump前缀
|
||||
private int startStopControl; |
||||
private String startStopControlId; |
||||
|
||||
// 热泵_手自动切换 -> 去掉pump前缀
|
||||
private int manualAutoSwitch; |
||||
private String manualAutoSwitchId; |
||||
|
||||
// 热泵_12启停控制
|
||||
private int startStopControlOne; |
||||
private String startStopControlOneId; |
||||
|
||||
// 热泵_34启停控制
|
||||
private int startStopControlTwo; |
||||
private String startStopControlTwoId; |
||||
// 热泵_12手自动切换
|
||||
private int manualAutoSwitchOne; |
||||
private String manualAutoSwitchOneId; |
||||
|
||||
// 热泵_34手自动切换
|
||||
private int manualAutoSwitchTwo; |
||||
private String manualAutoSwitchTwoId; |
||||
|
||||
|
||||
// 热泵_设定温度 -> 去掉pump前缀
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal setTemp; |
||||
private String setTempId; |
||||
|
||||
// 热泵_水箱温度 -> 去掉pump前缀
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal tankTemp; |
||||
private String tankTempId; |
||||
|
||||
// 热泵累计运行时间 -> 去掉pump前缀
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal runTime; |
||||
private String runTimeId; |
||||
|
||||
// 热泵_出水温度 -> 去掉pump前缀
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal outWaterTemp; |
||||
private String outWaterTempId; |
||||
|
||||
// 热泵_进水温度 -> 去掉pump前缀
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal inWaterTemp; |
||||
private String inWaterTempId; |
||||
|
||||
// 热泵_故障 -> 去掉pump前缀
|
||||
private int fault; |
||||
|
||||
/** |
||||
* 通讯失败 |
||||
*/ |
||||
private int communicationFailure; |
||||
private String communicationFailureId; |
||||
|
||||
/** |
||||
* 通讯失败次数 |
||||
* @return |
||||
*/ |
||||
private int communicationFailureCount; |
||||
private String communicationFailureCountId; |
||||
|
||||
/** |
||||
* modbus 复位 |
||||
*/ |
||||
private int reset; |
||||
private String resetId; |
||||
|
||||
@Override |
||||
public String toString() { |
||||
return new StringJoiner(", ", HotWaterHotPumpControlVO.class.getSimpleName() + "[", "]") // 更新类名引用
|
||||
.add("id='" + id + "'") |
||||
.add("name='" + name + "'") |
||||
.add("oneHourTimeOpenSetOne=" + oneHourTimeOpenSetOne) |
||||
.add("oneHourTimeOpenSetOneId='" + oneHourTimeOpenSetOneId + "'") |
||||
.add("oneMinTimeOpenSetOne=" + oneMinTimeOpenSetOne) // 新增分钟字段
|
||||
.add("oneMinTimeOpenSetOneId='" + oneMinTimeOpenSetOneId + "'") // 新增分钟字段
|
||||
.add("oneHourTimeCloseSetOne=" + oneHourTimeCloseSetOne) |
||||
.add("oneHourTimeCloseSetOneId='" + oneHourTimeCloseSetOneId + "'") |
||||
.add("oneMinTimeCloseSetOne=" + oneMinTimeCloseSetOne) // 新增分钟字段
|
||||
.add("oneMinTimeCloseSetOneId='" + oneMinTimeCloseSetOneId + "'") // 新增分钟字段
|
||||
.add("oneHourTimeOpenSetTwo=" + oneHourTimeOpenSetTwo) |
||||
.add("oneHourTimeOpenSetTwoId='" + oneHourTimeOpenSetTwoId + "'") |
||||
.add("oneMinTimeOpenSetTwo=" + oneMinTimeOpenSetTwo) // 新增分钟字段
|
||||
.add("oneMinTimeOpenSetTwoId='" + oneMinTimeOpenSetTwoId + "'") // 新增分钟字段
|
||||
.add("oneHourTimeCloseSetTwo=" + oneHourTimeCloseSetTwo) |
||||
.add("oneHourTimeCloseSetTwoId='" + oneHourTimeCloseSetTwoId + "'") |
||||
.add("oneMinTimeCloseSetTwo=" + oneMinTimeCloseSetTwo) // 新增分钟字段
|
||||
.add("oneMinTimeCloseSetTwoId='" + oneMinTimeCloseSetTwoId + "'") // 新增分钟字段
|
||||
.add("oneHourTimeOpenSetThree=" + oneHourTimeOpenSetThree) |
||||
.add("oneHourTimeOpenSetThreeId='" + oneHourTimeOpenSetThreeId + "'") |
||||
.add("oneMinTimeOpenSetThree=" + oneMinTimeOpenSetThree) // 新增分钟字段
|
||||
.add("oneMinTimeOpenSetThreeId='" + oneMinTimeOpenSetThreeId + "'") // 新增分钟字段
|
||||
.add("oneHourTimeCloseSetThree=" + oneHourTimeCloseSetThree) |
||||
.add("oneHourTimeCloseSetThreeId='" + oneHourTimeCloseSetThreeId + "'") |
||||
.add("oneMinTimeCloseSetThree=" + oneMinTimeCloseSetThree) // 新增分钟字段
|
||||
.add("oneMinTimeCloseSetThreeId='" + oneMinTimeCloseSetThreeId + "'") // 新增分钟字段
|
||||
.add("twoHourTimeOpenSetOne=" + twoHourTimeOpenSetOne) |
||||
.add("twoHourTimeOpenSetOneId='" + twoHourTimeOpenSetOneId + "'") |
||||
.add("twoMinTimeOpenSetOne=" + twoMinTimeOpenSetOne) // 新增分钟字段
|
||||
.add("twoMinTimeOpenSetOneId='" + twoMinTimeOpenSetOneId + "'") // 新增分钟字段
|
||||
.add("twoHourTimeCloseSetOne=" + twoHourTimeCloseSetOne) |
||||
.add("twoHourTimeCloseSetOneId='" + twoHourTimeCloseSetOneId + "'") |
||||
.add("twoMinTimeCloseSetOne=" + twoMinTimeCloseSetOne) // 新增分钟字段
|
||||
.add("twoMinTimeCloseSetOneId='" + twoMinTimeCloseSetOneId + "'") // 新增分钟字段
|
||||
.add("twoHourTimeOpenSetTwo=" + twoHourTimeOpenSetTwo) |
||||
.add("twoHourTimeOpenSetTwoId='" + twoHourTimeOpenSetTwoId + "'") |
||||
.add("twoMinTimeOpenSetTwo=" + twoMinTimeOpenSetTwo) // 新增分钟字段
|
||||
.add("twoMinTimeOpenSetTwoId='" + twoMinTimeOpenSetTwoId + "'") // 新增分钟字段
|
||||
.add("twoHourTimeCloseSetTwo=" + twoHourTimeCloseSetTwo) |
||||
.add("twoHourTimeCloseSetTwoId='" + twoHourTimeCloseSetTwoId + "'") |
||||
.add("twoMinTimeCloseSetTwo=" + twoMinTimeCloseSetTwo) // 新增分钟字段
|
||||
.add("twoMinTimeCloseSetTwoId='" + twoMinTimeCloseSetTwoId + "'") // 新增分钟字段
|
||||
.add("twoHourTimeOpenSetThree=" + twoHourTimeOpenSetThree) |
||||
.add("twoHourTimeOpenSetThreeId='" + twoHourTimeOpenSetThreeId + "'") |
||||
.add("twoMinTimeOpenSetThree=" + twoMinTimeOpenSetThree) // 新增分钟字段
|
||||
.add("twoMinTimeOpenSetThreeId='" + twoMinTimeOpenSetThreeId + "'") // 新增分钟字段
|
||||
.add("twoHourTimeCloseSetThree=" + twoHourTimeCloseSetThree) |
||||
.add("twoHourTimeCloseSetThreeId='" + twoHourTimeCloseSetThreeId + "'") |
||||
.add("twoMinTimeCloseSetThree=" + twoMinTimeCloseSetThree) // 新增分钟字段
|
||||
.add("twoMinTimeCloseSetThreeId='" + twoMinTimeCloseSetThreeId + "'") // 新增分钟字段
|
||||
.add("start='" + start + "'") |
||||
.add("startId='" + startId + "'") |
||||
.add("stop='" + stop + "'") |
||||
.add("stopId='" + stopId + "'") |
||||
.add("runState='" + runState + "'") |
||||
.add("runStateId='" + runStateId + "'") |
||||
.add("startStopControl='" + startStopControl + "'") |
||||
.add("startStopControlId='" + startStopControlId + "'") |
||||
.add("setTemp=" + setTemp) |
||||
.add("setTempId='" + setTempId + "'") |
||||
.add("tankTemp=" + tankTemp) |
||||
.add("tankTempId='" + tankTempId + "'") |
||||
.add("runTime=" + runTime) |
||||
.add("runTimeId='" + runTimeId + "'") |
||||
.add("outWaterTemp=" + outWaterTemp) |
||||
.add("outWaterTempId='" + outWaterTempId + "'") |
||||
.add("inWaterTemp=" + inWaterTemp) |
||||
.add("inWaterTempId='" + inWaterTempId + "'") |
||||
.add("fault=" + fault) |
||||
.toString(); |
||||
} |
||||
} |
||||
@ -1,63 +0,0 @@
|
||||
package com.mh.user.dto; |
||||
|
||||
import lombok.Data; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 热水实时监控列表数据 |
||||
* @date 2025-03-10 15:43:36 |
||||
*/ |
||||
@Data |
||||
public class HotWaterNowDataDTO { |
||||
|
||||
private String id; |
||||
private String curDate; //日期
|
||||
private String buildingId; //楼栋编号
|
||||
private String buildingName; //楼栋名称
|
||||
private String pumpId; //热泵编号
|
||||
private String pumpName; //热泵名称
|
||||
private String tempSet; //水温设定
|
||||
private String waterTemp; //水箱水温
|
||||
private String runState; //运行状态
|
||||
private String isFault; //是否故障
|
||||
private String levelSet1; //水位设置
|
||||
private String levelSet2; //水位设置
|
||||
private String waterLevel1; //实际水位
|
||||
private String waterLevel2; //实际水位
|
||||
private String tankId; //水箱编号
|
||||
private String tankName; //水箱名称
|
||||
private String envTemp; //环境温度
|
||||
|
||||
private String upWaterState1; // 供水1泵状态
|
||||
|
||||
private String freq1; // 供水频率1
|
||||
|
||||
private String upWaterState2; // 供水2泵状态
|
||||
|
||||
private String freq2; // 供水频率2
|
||||
|
||||
private String upWaterState3; // 供水3泵状态
|
||||
|
||||
private String freq3; // 供水频率3
|
||||
|
||||
private String upWaterState4; // 供水4泵状态
|
||||
|
||||
private String freq4; // 供水频率4
|
||||
|
||||
private String useWaterState; // 补水状态
|
||||
|
||||
private String backWaterState; // 回水状态1
|
||||
|
||||
private String backWaterState2; // 回水状态2
|
||||
|
||||
private String pressure; // 压力
|
||||
|
||||
private String circulateState; // 循环泵状态1
|
||||
|
||||
private String circulateState2; // 循环泵状态2
|
||||
|
||||
private int orderNum; |
||||
|
||||
} |
||||
@ -1,240 +0,0 @@
|
||||
package com.mh.user.dto; |
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
import lombok.Getter; |
||||
import lombok.Setter; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.util.StringJoiner; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 回水泵热泵控制界面VO |
||||
* @date 2025-03-14 09:00:37 |
||||
*/ |
||||
@Setter |
||||
@Getter |
||||
public class HotWaterSupplyPumpControlVO implements TimeControlVO { |
||||
|
||||
private String id; |
||||
|
||||
private String name; |
||||
|
||||
private int orderNum; |
||||
|
||||
// 定时_时开1
|
||||
private int oneHourTimeOpenSetOne; |
||||
private String oneHourTimeOpenSetOneId; |
||||
|
||||
// 定时_分开1
|
||||
private int oneMinTimeOpenSetOne; |
||||
private String oneMinTimeOpenSetOneId; |
||||
|
||||
// 定时_时关1
|
||||
private int oneHourTimeCloseSetOne; |
||||
private String oneHourTimeCloseSetOneId; |
||||
|
||||
// 定时_分关1
|
||||
private int oneMinTimeCloseSetOne; |
||||
private String oneMinTimeCloseSetOneId; |
||||
|
||||
// 定时_时分开1
|
||||
private String oneHourMinTimeOpenSetOneStr; |
||||
// 定时_时分关1
|
||||
private String oneHourMinTimeCloseSetOneStr; |
||||
|
||||
// 定时_时开2
|
||||
private int oneHourTimeOpenSetTwo; |
||||
private String oneHourTimeOpenSetTwoId; |
||||
|
||||
// 定时_分开2
|
||||
private int oneMinTimeOpenSetTwo; |
||||
private String oneMinTimeOpenSetTwoId; |
||||
|
||||
// 定时_时关2
|
||||
private int oneHourTimeCloseSetTwo; |
||||
private String oneHourTimeCloseSetTwoId; |
||||
|
||||
// 定时_分关2
|
||||
private int oneMinTimeCloseSetTwo; |
||||
private String oneMinTimeCloseSetTwoId; |
||||
|
||||
// 定时_时分开2
|
||||
private String oneHourMinTimeOpenSetTwoStr; |
||||
// 定时_时分关2
|
||||
private String oneHourMinTimeCloseSetTwoStr; |
||||
|
||||
// 定时_时开3
|
||||
private int oneHourTimeOpenSetThree; |
||||
private String oneHourTimeOpenSetThreeId; |
||||
|
||||
// 定时_分开3
|
||||
private int oneMinTimeOpenSetThree; |
||||
private String oneMinTimeOpenSetThreeId; |
||||
|
||||
// 定时_时关3
|
||||
private int oneHourTimeCloseSetThree; |
||||
private String oneHourTimeCloseSetThreeId; |
||||
|
||||
// 定时_分关3
|
||||
private int oneMinTimeCloseSetThree; |
||||
private String oneMinTimeCloseSetThreeId; |
||||
|
||||
// 定时_时分开3
|
||||
private String oneHourMinTimeOpenSetThreeStr; |
||||
// 定时_时分关3
|
||||
private String oneHourMinTimeCloseSetThreeStr; |
||||
|
||||
// 开延时
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private int openDelayTime; |
||||
private String openDelayTimeId; |
||||
|
||||
// 温度设置
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal tempSet; |
||||
private String tempSetId; |
||||
|
||||
// 累计运行时间
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal runTime; |
||||
private String runTimeId; |
||||
|
||||
// 运行状态
|
||||
private int runState; |
||||
private String runStateId; |
||||
|
||||
// 启停控制
|
||||
private int startStopControl; |
||||
private String startStopControlId; |
||||
|
||||
// 故障
|
||||
private int fault; |
||||
private String faultId; |
||||
|
||||
// 一键启动
|
||||
private int startOneKey; |
||||
private String startOneKeyId; |
||||
|
||||
// 手自动切换
|
||||
private int manualAutoSwitch; |
||||
private String manualAutoSwitchId; |
||||
|
||||
// 频率手自动切换
|
||||
private int frequencyManualAutoSwitch; |
||||
private String frequencyManualAutoSwitchId; |
||||
|
||||
// 频率手动设置
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal frequencyManualSet; |
||||
private String frequencyManualSetId; |
||||
|
||||
// 选择两台回水泵启动
|
||||
private int twoPumpStart; |
||||
private String twoPumpStartId; |
||||
|
||||
// 温度设置上限
|
||||
private BigDecimal tempSetUpperLimit; |
||||
private String tempSetUpperLimitId; |
||||
|
||||
// 温度设置下限
|
||||
private BigDecimal tempSetLowerLimit; |
||||
private String tempSetLowerLimitId; |
||||
|
||||
// 加泵压差设置
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal addPumpPressureSet; |
||||
private String addPumpPressureSetId; |
||||
|
||||
// 加泵误差设置
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal addPumpErrorSet; |
||||
private String addPumpErrorSetId; |
||||
|
||||
// 加泵延时时间设置
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal addPumpDelayTimeSet; |
||||
private String addPumpDelayTimeSetId; |
||||
|
||||
// 减泵压差设置
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal reducePumpPressureSet; |
||||
private String reducePumpPressureSetId; |
||||
|
||||
// 减泵误差设置
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal reducePumpErrorSet; |
||||
private String reducePumpErrorSetId; |
||||
|
||||
// 减泵延时时间设置
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal reducePumpDelayTimeSet; |
||||
private String reducePumpDelayTimeSetId; |
||||
|
||||
/** |
||||
* 单箱液位设置 |
||||
* @return |
||||
*/ |
||||
private int singleBoxLevelSet; |
||||
private String singleBoxLevelSetId; |
||||
|
||||
/** |
||||
* 多箱液位设置 |
||||
* @return |
||||
*/ |
||||
private int multiBoxLevelSet; |
||||
private String multiBoxLevelSetId; |
||||
|
||||
/** |
||||
* 压力设置 |
||||
* @return |
||||
*/ |
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal pressureSet; |
||||
private String pressureSetId; |
||||
|
||||
@Override |
||||
public String toString() { |
||||
return new StringJoiner(", ", HotWaterSupplyPumpControlVO.class.getSimpleName() + "[", "]") |
||||
.add("id='" + id + "'") |
||||
.add("name='" + name + "'") |
||||
.add("orderNum=" + orderNum) |
||||
.add("oneHourTimeOpenSetOne=" + oneHourTimeOpenSetOne) |
||||
.add("oneHourTimeOpenSetOneId='" + oneHourTimeOpenSetOneId + "'") |
||||
.add("oneMinTimeOpenSetOne=" + oneMinTimeOpenSetOne) |
||||
.add("oneMinTimeOpenSetOneId='" + oneMinTimeOpenSetOneId + "'") |
||||
.add("oneHourTimeCloseSetOne=" + oneHourTimeCloseSetOne) |
||||
.add("oneHourTimeCloseSetOneId='" + oneHourTimeCloseSetOneId + "'") |
||||
.add("oneMinTimeCloseSetOne=" + oneMinTimeCloseSetOne) |
||||
.add("oneMinTimeCloseSetOneId='" + oneMinTimeCloseSetOneId + "'") |
||||
.add("oneHourTimeOpenSetTwo=" + oneHourTimeOpenSetTwo) |
||||
.add("oneHourTimeOpenSetTwoId='" + oneHourTimeOpenSetTwoId + "'") |
||||
.add("oneMinTimeOpenSetTwo=" + oneMinTimeOpenSetTwo) |
||||
.add("oneMinTimeOpenSetTwoId='" + oneMinTimeOpenSetTwoId + "'") |
||||
.add("oneHourTimeCloseSetTwo=" + oneHourTimeCloseSetTwo) |
||||
.add("oneHourTimeCloseSetTwoId='" + oneHourTimeCloseSetTwoId + "'") |
||||
.add("oneMinTimeCloseSetTwo=" + oneMinTimeCloseSetTwo) |
||||
.add("oneMinTimeCloseSetTwoId='" + oneMinTimeCloseSetTwoId + "'") |
||||
.add("oneHourTimeOpenSetThree=" + oneHourTimeOpenSetThree) |
||||
.add("oneHourTimeOpenSetThreeId='" + oneHourTimeOpenSetThreeId + "'") |
||||
.add("oneMinTimeOpenSetThree=" + oneMinTimeOpenSetThree) |
||||
.add("oneMinTimeOpenSetThreeId='" + oneMinTimeOpenSetThreeId + "'") |
||||
.add("oneHourTimeCloseSetThree=" + oneHourTimeCloseSetThree) |
||||
.add("oneHourTimeCloseSetThreeId='" + oneHourTimeCloseSetThreeId + "'") |
||||
.add("openDelayTime=" + openDelayTime) |
||||
.add("openDelayTimeId='" + openDelayTimeId + "'") |
||||
.add("tempSet=" + tempSet) |
||||
.add("tempSetId='" + tempSetId + "'") |
||||
.add("runTime=" + runTime) |
||||
.add("runTimeId='" + runTimeId + "'") |
||||
.add("runState=" + runState) |
||||
.add("runStateId='" + runStateId + "'") |
||||
.add("startStopControl=" + startStopControl) |
||||
.add("startStopControlId='" + startStopControlId + "'") |
||||
.add("fault=" + fault) |
||||
.add("faultId='" + faultId + "'") |
||||
.toString(); |
||||
} |
||||
} |
||||
@ -1,205 +0,0 @@
|
||||
package com.mh.user.dto; |
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
import lombok.Getter; |
||||
import lombok.Setter; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.util.Date; |
||||
import java.util.StringJoiner; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 生活热水系统控制界面VO |
||||
* @date 2025-03-14 09:00:37 |
||||
*/ |
||||
@Setter |
||||
@Getter |
||||
public class HotWaterSystemControlVO { |
||||
|
||||
private String id; |
||||
|
||||
private String name; |
||||
|
||||
// 启用时间写入 1
|
||||
private int timeSet; |
||||
private String timeSetId; |
||||
|
||||
/** |
||||
* 校时手自动切换:22 |
||||
*/ |
||||
private int timeSetAuto; |
||||
private String timeSetAutoId; |
||||
|
||||
// 水箱温度 2
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal tankTemp; |
||||
private String tankTempId; |
||||
|
||||
// 太阳能温度 3
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal solarTemp; |
||||
private String solarTempId; |
||||
|
||||
// 回水温度 4
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal inTemp; |
||||
private String inTempId; |
||||
|
||||
// 压力 4
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal pressure; |
||||
private String pressureId; |
||||
|
||||
// PLC 时间
|
||||
private String plcTime; |
||||
// 秒_读 6
|
||||
private int scTimeRead; |
||||
private String scTimeReadId; |
||||
|
||||
// 分_读 8
|
||||
private int minTimeRead; |
||||
private String minTimeReadId; |
||||
|
||||
// 时_读 9
|
||||
private int hourTimeRead; |
||||
private String hourTimeReadId; |
||||
|
||||
// 日_读 9
|
||||
private int dayTimeRead; |
||||
private String dayTimeReadId; |
||||
|
||||
// 月_读 10
|
||||
private int monthTimeRead; |
||||
private String monthTimeReadId; |
||||
|
||||
// 年_读 11
|
||||
private int yearTimeRead; |
||||
private String yearTimeReadId; |
||||
|
||||
// 秒_写 6
|
||||
private int scTimeSet; |
||||
private String scTimeSetId; |
||||
|
||||
// 分_写 8
|
||||
private int minTimeSet; |
||||
private String minTimeSetId; |
||||
|
||||
// 时_写 9
|
||||
private int hourTimeSet; |
||||
private String hourTimeSetId; |
||||
|
||||
// 日_写 9
|
||||
private int dayTimeSet; |
||||
private String dayTimeSetId; |
||||
|
||||
// 月_写 10
|
||||
private int monthTimeSet; |
||||
private String monthTimeSetId; |
||||
|
||||
// 年_写 11
|
||||
private int yearTimeSet; |
||||
private String yearTimeSetId; |
||||
|
||||
// 自动_分_写 8
|
||||
private int minTimeSetAuto; |
||||
private String minTimeSetAutoId; |
||||
|
||||
// 自动_时_写 9
|
||||
private int hourTimeSetAuto; |
||||
private String hourTimeSetAutoId; |
||||
|
||||
// 自动_日_写 9
|
||||
private int dayTimeSetAuto; |
||||
private String dayTimeSetAutoId; |
||||
|
||||
// 自动_月_写 10
|
||||
private int monthTimeSetAuto; |
||||
private String monthTimeSetAutoId; |
||||
|
||||
// 自动_年_写 11
|
||||
private int yearTimeSetAuto; |
||||
private String yearTimeSetAutoId; |
||||
|
||||
private int orderNum; |
||||
|
||||
/** |
||||
* modbus 复位 |
||||
*/ |
||||
private int reset; |
||||
private String resetId; |
||||
|
||||
/** |
||||
* pressureSet 压力设置 |
||||
* @return |
||||
*/ |
||||
private int pressureSet; |
||||
private String pressureSetId; |
||||
|
||||
/** |
||||
* 单箱液位 |
||||
* @return |
||||
*/ |
||||
private int singleBoxLevel; |
||||
private String singleBoxLevelId; |
||||
|
||||
/** |
||||
* 多箱液位 |
||||
* @return |
||||
*/ |
||||
private int multiBoxLevel; |
||||
private String multiBoxLevelId; |
||||
|
||||
/** |
||||
* 水箱高度 26 |
||||
* @return |
||||
*/ |
||||
private int tankHeight; |
||||
private String tankHeightId; |
||||
|
||||
@Override |
||||
public String toString() { |
||||
return new StringJoiner(", ", HotWaterSystemControlVO.class.getSimpleName() + "[", "]") |
||||
.add("id='" + id + "'") |
||||
.add("name='" + name + "'") |
||||
.add("timeSet=" + timeSet) |
||||
.add("timeSetId='" + timeSetId + "'") |
||||
.add("tankTemp=" + tankTemp) |
||||
.add("tankTempId='" + tankTempId + "'") |
||||
.add("solarTemp=" + solarTemp) |
||||
.add("solarTempId='" + solarTempId + "'") |
||||
.add("inTemp=" + inTemp) |
||||
.add("inTempId='" + inTempId + "'") |
||||
.add("pressure=" + pressure) |
||||
.add("pressureId='" + pressureId + "'") |
||||
.add("plcTime='" + plcTime + "'") |
||||
.add("scTimeRead=" + scTimeRead) |
||||
.add("scTimeReadId='" + scTimeReadId + "'") |
||||
.add("minTimeRead=" + minTimeRead) |
||||
.add("minTimeReadId='" + minTimeReadId + "'") |
||||
.add("hourTimeRead=" + hourTimeRead) |
||||
.add("hourTimeReadId='" + hourTimeReadId + "'") |
||||
.add("dayTimeRead=" + dayTimeRead) |
||||
.add("dayTimeReadId='" + dayTimeReadId + "'") |
||||
.add("monthTimeRead=" + monthTimeRead) |
||||
.add("monthTimeReadId='" + monthTimeReadId + "'") |
||||
.add("yearTimeRead=" + yearTimeRead) |
||||
.add("yearTimeReadId='" + yearTimeReadId + "'") |
||||
.add("scTimeSet=" + scTimeSet) |
||||
.add("scTimeSetId='" + scTimeSetId + "'") |
||||
.add("minTimeSet=" + minTimeSet) |
||||
.add("minTimeSetId='" + minTimeSetId + "'") |
||||
.add("hourTimeSet=" + hourTimeSet) |
||||
.add("hourTimeSetId='" + hourTimeSetId + "'") |
||||
.add("dayTimeSet=" + dayTimeSet) |
||||
.add("dayTimeSetId='" + dayTimeSetId + "'") |
||||
.add("monthTimeSet=" + monthTimeSet) |
||||
.add("monthTimeSetId='" + monthTimeSetId + "'") |
||||
.add("yearTimeSet=" + yearTimeSet) |
||||
.add("yearTimeSetId='" + yearTimeSetId + "'") |
||||
.add("orderNum=" + orderNum) |
||||
.toString(); |
||||
} |
||||
} |
||||
@ -1,194 +0,0 @@
|
||||
package com.mh.user.dto; |
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
import lombok.Getter; |
||||
import lombok.Setter; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.util.StringJoiner; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 补水电磁阀控制界面VO |
||||
* @date 2025-03-14 09:00:37 |
||||
*/ |
||||
@Setter |
||||
@Getter |
||||
public class HydrateSolenoidValveControlVO implements TimeControlVO { |
||||
|
||||
private String id; |
||||
|
||||
private String name; |
||||
|
||||
private int orderNum; |
||||
|
||||
// 定时_时开1
|
||||
private int oneHourTimeOpenSetOne; |
||||
private String oneHourTimeOpenSetOneId; |
||||
|
||||
// 定时_分开1
|
||||
private int oneMinTimeOpenSetOne; |
||||
private String oneMinTimeOpenSetOneId; |
||||
|
||||
// 定时_时关1
|
||||
private int oneHourTimeCloseSetOne; |
||||
private String oneHourTimeCloseSetOneId; |
||||
|
||||
// 定时_分关1
|
||||
private int oneMinTimeCloseSetOne; |
||||
private String oneMinTimeCloseSetOneId; |
||||
|
||||
// 定时_时分开1
|
||||
private String oneHourMinTimeOpenSetOneStr; |
||||
// 定时_时分关1
|
||||
private String oneHourMinTimeCloseSetOneStr; |
||||
|
||||
// 定时_时开2
|
||||
private int oneHourTimeOpenSetTwo; |
||||
private String oneHourTimeOpenSetTwoId; |
||||
|
||||
// 定时_分开2
|
||||
private int oneMinTimeOpenSetTwo; |
||||
private String oneMinTimeOpenSetTwoId; |
||||
|
||||
// 定时_时关2
|
||||
private int oneHourTimeCloseSetTwo; |
||||
private String oneHourTimeCloseSetTwoId; |
||||
|
||||
// 定时_分关2
|
||||
private int oneMinTimeCloseSetTwo; |
||||
private String oneMinTimeCloseSetTwoId; |
||||
|
||||
// 定时_时分开2
|
||||
private String oneHourMinTimeOpenSetTwoStr; |
||||
// 定时_时分关2
|
||||
private String oneHourMinTimeCloseSetTwoStr; |
||||
|
||||
// 定时_时开3
|
||||
private int oneHourTimeOpenSetThree; |
||||
private String oneHourTimeOpenSetThreeId; |
||||
|
||||
// 定时_分开3
|
||||
private int oneMinTimeOpenSetThree; |
||||
private String oneMinTimeOpenSetThreeId; |
||||
|
||||
// 定时_时关3
|
||||
private int oneHourTimeCloseSetThree; |
||||
private String oneHourTimeCloseSetThreeId; |
||||
|
||||
// 定时_分关3
|
||||
private int oneMinTimeCloseSetThree; |
||||
private String oneMinTimeCloseSetThreeId; |
||||
|
||||
// 定时_时分开3
|
||||
private String oneHourMinTimeOpenSetThreeStr; |
||||
// 定时_时分关3
|
||||
private String oneHourMinTimeCloseSetThreeStr; |
||||
|
||||
// 开延时
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private int openDelayTime; |
||||
private String openDelayTimeId; |
||||
|
||||
// 温差
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal tempDiff; |
||||
private String tempDiffId; |
||||
|
||||
// 温差设置
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal tempDiffSet; |
||||
private String tempDiffSetId; |
||||
|
||||
// 累计运行时间
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal runTime; |
||||
private String runTimeId; |
||||
|
||||
// 运行状态
|
||||
private int runState; |
||||
private String runStateId; |
||||
|
||||
// 启停控制
|
||||
private int startStopControl; |
||||
private String startStopControlId; |
||||
|
||||
// 故障
|
||||
private int fault; |
||||
private String faultId; |
||||
|
||||
// 一键启动
|
||||
private int startOneKey; |
||||
private String startOneKeyId; |
||||
|
||||
// 手自动切换
|
||||
private int manualAutoSwitch; |
||||
private String manualAutoSwitchId; |
||||
|
||||
// 单箱液位设置上限
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal setSingleUpperLimit; |
||||
private String setSingleUpperLimitId; |
||||
|
||||
// 单箱液位设置下限
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal setSingleLowerLimit; |
||||
private String setSingleLowerLimitId; |
||||
|
||||
// 液位设置
|
||||
// 单箱液位设置
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal setSingleLevel; |
||||
private String setSingleLevelId; |
||||
|
||||
// 多箱液位设置上限
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal setMultiUpperLimit; |
||||
private String setMultiUpperLimitId; |
||||
// 多箱液位设置下限
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal setMultiLowerLimit; |
||||
private String setMultiLowerLimitId; |
||||
|
||||
// 液位设置
|
||||
// 多箱液位设置
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal setMultiLevel; |
||||
private String setMultiLevelId; |
||||
|
||||
// 控制模式
|
||||
private int controlMode; |
||||
private String controlModeId; |
||||
|
||||
@Override |
||||
public String toString() { |
||||
return new StringJoiner(", ", HydrateSolenoidValveControlVO.class.getSimpleName() + "[", "]") |
||||
.add("id='" + id + "'") |
||||
.add("name='" + name + "'") |
||||
.add("orderNum=" + orderNum) |
||||
.add("oneHourTimeOpenSetOne=" + oneHourTimeOpenSetOne) |
||||
.add("oneHourTimeOpenSetOneId='" + oneHourTimeOpenSetOneId + "'") |
||||
.add("oneMinTimeOpenSetOne=" + oneMinTimeOpenSetOne) |
||||
.add("oneMinTimeOpenSetOneId='" + oneMinTimeOpenSetOneId + "'") |
||||
.add("oneHourTimeCloseSetOne=" + oneHourTimeCloseSetOne) |
||||
.add("oneHourTimeCloseSetOneId='" + oneHourTimeCloseSetOneId + "'") |
||||
.add("oneMinTimeCloseSetOne=" + oneMinTimeCloseSetOne) |
||||
.add("oneMinTimeCloseSetOneId='" + oneMinTimeCloseSetOneId + "'") |
||||
.add("tempDiff=" + tempDiff) |
||||
.add("tempDiffId='" + tempDiffId + "'") |
||||
.add("tempDiffSet=" + tempDiffSet) |
||||
.add("tempDiffSetId='" + tempDiffSetId + "'") |
||||
.add("runTime=" + runTime) |
||||
.add("runTimeId='" + runTimeId + "'") |
||||
.add("runState=" + runState) |
||||
.add("runStateId='" + runStateId + "'") |
||||
.add("startStopControl=" + startStopControl) |
||||
.add("startStopControlId='" + startStopControlId + "'") |
||||
.add("fault=" + fault) |
||||
.add("faultId='" + faultId + "'") |
||||
.toString(); |
||||
} |
||||
|
||||
} |
||||
@ -1,171 +0,0 @@
|
||||
package com.mh.user.dto; |
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
import lombok.Getter; |
||||
import lombok.Setter; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.util.StringJoiner; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 电磁阀控制界面VO |
||||
* @date 2025-03-14 09:00:37 |
||||
*/ |
||||
@Setter |
||||
@Getter |
||||
public class SolenoidValveControlVO implements TimeControlVO { |
||||
|
||||
private String id; |
||||
|
||||
private String name; |
||||
|
||||
private int orderNum; |
||||
|
||||
// 定时_时开1
|
||||
private int oneHourTimeOpenSetOne; |
||||
private String oneHourTimeOpenSetOneId; |
||||
|
||||
// 定时_分开1
|
||||
private int oneMinTimeOpenSetOne; |
||||
private String oneMinTimeOpenSetOneId; |
||||
|
||||
// 定时_时关1
|
||||
private int oneHourTimeCloseSetOne; |
||||
private String oneHourTimeCloseSetOneId; |
||||
|
||||
// 定时_分关1
|
||||
private int oneMinTimeCloseSetOne; |
||||
private String oneMinTimeCloseSetOneId; |
||||
|
||||
// 定时_时分开1
|
||||
private String oneHourMinTimeOpenSetOneStr; |
||||
// 定时_时分关1
|
||||
private String oneHourMinTimeCloseSetOneStr; |
||||
|
||||
// 定时_时开2
|
||||
private int oneHourTimeOpenSetTwo; |
||||
private String oneHourTimeOpenSetTwoId; |
||||
|
||||
// 定时_分开2
|
||||
private int oneMinTimeOpenSetTwo; |
||||
private String oneMinTimeOpenSetTwoId; |
||||
|
||||
// 定时_时关2
|
||||
private int oneHourTimeCloseSetTwo; |
||||
private String oneHourTimeCloseSetTwoId; |
||||
|
||||
// 定时_分关2
|
||||
private int oneMinTimeCloseSetTwo; |
||||
private String oneMinTimeCloseSetTwoId; |
||||
|
||||
// 定时_时分开2
|
||||
private String oneHourMinTimeOpenSetTwoStr; |
||||
// 定时_时分关2
|
||||
private String oneHourMinTimeCloseSetTwoStr; |
||||
|
||||
// 定时_时开3
|
||||
private int oneHourTimeOpenSetThree; |
||||
private String oneHourTimeOpenSetThreeId; |
||||
|
||||
// 定时_分开3
|
||||
private int oneMinTimeOpenSetThree; |
||||
private String oneMinTimeOpenSetThreeId; |
||||
|
||||
// 定时_时关3
|
||||
private int oneHourTimeCloseSetThree; |
||||
private String oneHourTimeCloseSetThreeId; |
||||
|
||||
// 定时_分关3
|
||||
private int oneMinTimeCloseSetThree; |
||||
private String oneMinTimeCloseSetThreeId; |
||||
|
||||
// 定时_时分开3
|
||||
private String oneHourMinTimeOpenSetThreeStr; |
||||
// 定时_时分关3
|
||||
private String oneHourMinTimeCloseSetThreeStr; |
||||
|
||||
// 开延时
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private int openDelayTime; |
||||
private String openDelayTimeId; |
||||
|
||||
// 温差
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal tempDiff; |
||||
private String tempDiffId; |
||||
|
||||
// 温差设置
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal tempDiffSet; |
||||
private String tempDiffSetId; |
||||
|
||||
// 累计运行时间
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") |
||||
private BigDecimal runTime; |
||||
private String runTimeId; |
||||
|
||||
// 运行状态
|
||||
private int runState; |
||||
private String runStateId; |
||||
|
||||
// 启停控制
|
||||
private int startStopControl; |
||||
private String startStopControlId; |
||||
|
||||
// 故障
|
||||
private int fault; |
||||
private String faultId; |
||||
|
||||
// 一键启动
|
||||
private int startOneKey; |
||||
private String startOneKeyId; |
||||
|
||||
// 手自动切换
|
||||
private int manualAutoSwitch; |
||||
private String manualAutoSwitchId; |
||||
|
||||
// 温度设置上限
|
||||
private BigDecimal setUpperLimit; |
||||
private String setUpperLimitId; |
||||
|
||||
// 温度设置下限
|
||||
private BigDecimal setLowerLimit; |
||||
private String setLowerLimitId; |
||||
|
||||
// 控制模式
|
||||
private int controlMode; |
||||
private String controlModeId; |
||||
|
||||
@Override |
||||
public String toString() { |
||||
return new StringJoiner(", ", SolenoidValveControlVO.class.getSimpleName() + "[", "]") |
||||
.add("id='" + id + "'") |
||||
.add("name='" + name + "'") |
||||
.add("orderNum=" + orderNum) |
||||
.add("oneHourTimeOpenSetOne=" + oneHourTimeOpenSetOne) |
||||
.add("oneHourTimeOpenSetOneId='" + oneHourTimeOpenSetOneId + "'") |
||||
.add("oneMinTimeOpenSetOne=" + oneMinTimeOpenSetOne) |
||||
.add("oneMinTimeOpenSetOneId='" + oneMinTimeOpenSetOneId + "'") |
||||
.add("oneHourTimeCloseSetOne=" + oneHourTimeCloseSetOne) |
||||
.add("oneHourTimeCloseSetOneId='" + oneHourTimeCloseSetOneId + "'") |
||||
.add("oneMinTimeCloseSetOne=" + oneMinTimeCloseSetOne) |
||||
.add("oneMinTimeCloseSetOneId='" + oneMinTimeCloseSetOneId + "'") |
||||
.add("tempDiff=" + tempDiff) |
||||
.add("tempDiffId='" + tempDiffId + "'") |
||||
.add("tempDiffSet=" + tempDiffSet) |
||||
.add("tempDiffSetId='" + tempDiffSetId + "'") |
||||
.add("runTime=" + runTime) |
||||
.add("runTimeId='" + runTimeId + "'") |
||||
.add("runState=" + runState) |
||||
.add("runStateId='" + runStateId + "'") |
||||
.add("startStopControl=" + startStopControl) |
||||
.add("startStopControlId='" + startStopControlId + "'") |
||||
.add("fault=" + fault) |
||||
.add("faultId='" + faultId + "'") |
||||
.toString(); |
||||
} |
||||
|
||||
} |
||||
@ -1,40 +0,0 @@
|
||||
package com.mh.user.dto; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project CHWS |
||||
* @description |
||||
* @date 2026-06-26 10:38:48 |
||||
*/ |
||||
public interface TimeControlVO { |
||||
// Setters for 定时1
|
||||
void setOneHourTimeOpenSetOne(int value); |
||||
void setOneHourTimeOpenSetOneId(String id); |
||||
void setOneMinTimeOpenSetOne(int value); |
||||
void setOneMinTimeOpenSetOneId(String id); |
||||
void setOneHourTimeCloseSetOne(int value); |
||||
void setOneHourTimeCloseSetOneId(String id); |
||||
void setOneMinTimeCloseSetOne(int value); |
||||
void setOneMinTimeCloseSetOneId(String id); |
||||
|
||||
// Setters for 定时2
|
||||
void setOneHourTimeOpenSetTwo(int value); |
||||
void setOneHourTimeOpenSetTwoId(String id); |
||||
void setOneMinTimeOpenSetTwo(int value); |
||||
void setOneMinTimeOpenSetTwoId(String id); |
||||
void setOneHourTimeCloseSetTwo(int value); |
||||
void setOneHourTimeCloseSetTwoId(String id); |
||||
void setOneMinTimeCloseSetTwo(int value); |
||||
void setOneMinTimeCloseSetTwoId(String id); |
||||
|
||||
// Setters for 定时3
|
||||
void setOneHourTimeOpenSetThree(int value); |
||||
void setOneHourTimeOpenSetThreeId(String id); |
||||
void setOneMinTimeOpenSetThree(int value); |
||||
void setOneMinTimeOpenSetThreeId(String id); |
||||
void setOneHourTimeCloseSetThree(int value); |
||||
void setOneHourTimeCloseSetThreeId(String id); |
||||
void setOneMinTimeCloseSetThree(int value); |
||||
void setOneMinTimeCloseSetThreeId(String id); |
||||
} |
||||
@ -1,112 +0,0 @@
|
||||
package com.mh.user.entity; |
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
import lombok.Getter; |
||||
import lombok.Setter; |
||||
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
||||
import java.io.Serializable; |
||||
import java.math.BigDecimal; |
||||
import java.time.LocalDateTime; |
||||
import java.util.Date; |
||||
import java.util.StringJoiner; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project CHWS |
||||
* @description 采集参数实体类 |
||||
* @date 2025-12-10 10:53:33 |
||||
*/ |
||||
@Getter |
||||
@Setter |
||||
public class CollectionParamsManageEntity implements Serializable { |
||||
|
||||
static final long serialVersionUID = 42L; |
||||
|
||||
private Long id; |
||||
|
||||
/** 当前时间 */ |
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai") |
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
private Date createTime; |
||||
|
||||
/** 当前时间 */ |
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai") |
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
private Date updateTime; |
||||
private Long buildingId; |
||||
/** 设备id */ |
||||
private Long deviceInstallId; |
||||
/** 寄存器地址 */ |
||||
private String registerAddr; |
||||
/** 功能码 */ |
||||
private String funcCode; |
||||
/** 倍率 */ |
||||
private Integer mtRatio; |
||||
/** 初始值 */ |
||||
private BigDecimal mtInitValue; |
||||
/** 小数点 */ |
||||
private Integer digits; |
||||
/** 数据类型 */ |
||||
private Integer dataType; |
||||
/** 当前值 */ |
||||
private BigDecimal curValue; |
||||
/** 当前时间 */ |
||||
/** 当前时间 */ |
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai") |
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
private Date curTime; |
||||
/** 是否是总表 (0: 是, 1: 否) */ |
||||
private Integer mtIsSum; |
||||
/** 单位 */ |
||||
private String unit; |
||||
/** 排序 */ |
||||
private Long orderNum; |
||||
/** 备注 */ |
||||
private String remark; |
||||
/** 读取的寄存器大小 */ |
||||
private Integer registerSize; |
||||
/** 是否使用 */ |
||||
private Integer isUse; |
||||
/** 别名:mqtt上传名,唯一值 */ |
||||
private String otherName; |
||||
/** 40,累计值,140瞬时值 */ |
||||
private Integer grade; |
||||
/** 参数id */ |
||||
private Integer paramTypeId; |
||||
/** |
||||
* 参数组类型 |
||||
*/ |
||||
private Integer paramTypeGroupId; |
||||
/** 遥测、遥信数据类型 */ |
||||
private Integer collectionType; |
||||
/** 上报质量 */ |
||||
private String quality; |
||||
|
||||
@Override |
||||
public String toString() { |
||||
return new StringJoiner(", ", CollectionParamsManageEntity.class.getSimpleName() + "[", "]") |
||||
.add("deviceInstallId=" + deviceInstallId) |
||||
.add("registerAddr='" + registerAddr + "'") |
||||
.add("funcCode='" + funcCode + "'") |
||||
.add("mtRatio=" + mtRatio) |
||||
.add("mtInitValue=" + mtInitValue) |
||||
.add("digits=" + digits) |
||||
.add("dataType=" + dataType) |
||||
.add("curValue=" + curValue) |
||||
.add("curTime=" + curTime) |
||||
.add("mtIsSum=" + mtIsSum) |
||||
.add("unit='" + unit + "'") |
||||
.add("orderNum=" + orderNum) |
||||
.add("remark='" + remark + "'") |
||||
.add("registerSize=" + registerSize) |
||||
.add("isUse=" + isUse) |
||||
.add("otherName='" + otherName + "'") |
||||
.add("grade=" + grade) |
||||
.add("paramTypeId=" + paramTypeId) |
||||
.add("collectionType=" + collectionType) |
||||
.add("quality='" + quality + "'") |
||||
.toString(); |
||||
} |
||||
} |
||||
@ -1,38 +0,0 @@
|
||||
package com.mh.user.entity; |
||||
|
||||
import lombok.Data; |
||||
|
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* @Author: ljf |
||||
* @Date: 2018/10/15 14:30 |
||||
* @Version 1.0 |
||||
* 水压数据 |
||||
*/ |
||||
|
||||
@Data |
||||
public class WaterPressureEntity { |
||||
|
||||
private Date curDate; |
||||
private String buildingID; |
||||
private String buildingName; |
||||
private String deviceAddr; |
||||
private String deviceName; |
||||
private String pressure00; |
||||
private String pressure02; |
||||
private String pressure06; |
||||
private String pressure08; |
||||
private String pressure11; |
||||
private String pressure13; |
||||
private String pressure14; |
||||
private String pressure15; |
||||
private String pressure16; |
||||
private String pressure17; |
||||
private String pressure18; |
||||
private String pressure19; |
||||
private String pressure20; |
||||
private String pressure21; |
||||
private String pressure22; |
||||
private String pressure23; |
||||
} |
||||
@ -1,51 +0,0 @@
|
||||
package com.mh.user.factory; |
||||
|
||||
import com.mh.user.entity.CollectionParamsManageEntity; |
||||
import com.mh.user.entity.DeviceCodeParamEntity; |
||||
import com.mh.user.entity.DeviceInstallEntity; |
||||
import com.mh.user.strategy.DeviceStrategy; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project CHWS |
||||
* @description 系统参数 |
||||
* @date 2024-03-18 16:53:35 |
||||
*/ |
||||
public class SystemParams implements Device { |
||||
|
||||
private DeviceStrategy strategy; |
||||
|
||||
private static class SingletonHolder { |
||||
private static final SystemParams INSTANCE = new SystemParams(); |
||||
} |
||||
|
||||
private SystemParams() { |
||||
// 防止外部直接实例化
|
||||
} |
||||
|
||||
public static SystemParams getInstance() { |
||||
return SystemParams.SingletonHolder.INSTANCE; |
||||
} |
||||
|
||||
@Override |
||||
public void setStrategy(DeviceStrategy strategy) { |
||||
this.strategy = strategy; |
||||
} |
||||
|
||||
@Override |
||||
public String createOrders(DeviceCodeParamEntity deviceCodeParamEntity) { |
||||
return strategy.createOrders(deviceCodeParamEntity); |
||||
} |
||||
|
||||
@Override |
||||
public String analysisReceiveData(String dateStr, String deviceType, String registerAddr, String brand, String buildingId, String buildingName, String dataStr, DeviceCodeParamEntity deviceCodeParamEntity) { |
||||
return strategy.analysisReceiveData(dateStr, deviceType, registerAddr, brand, buildingId, buildingName, dataStr, deviceCodeParamEntity); |
||||
} |
||||
|
||||
@Override |
||||
public String analysisMQTTReceiveData(String dateStr, String registerAddr, String dataStr, String operateType, DeviceInstallEntity deviceInstallEntity, CollectionParamsManageEntity collectionParamsManageEntity) { |
||||
return strategy.analysisMQTTReceiveData(dateStr, registerAddr, dataStr, operateType, deviceInstallEntity, collectionParamsManageEntity); |
||||
} |
||||
|
||||
} |
||||
@ -1,469 +0,0 @@
|
||||
package com.mh.user.job; |
||||
|
||||
import com.mh.user.constants.Constant; |
||||
import com.mh.user.entity.CollectionParamsManageEntity; |
||||
import com.mh.user.entity.DeviceInstallEntity; |
||||
import com.mh.user.entity.GatewayManageEntity; |
||||
import com.mh.user.mapper.CollectionParamsManageMapper; |
||||
import com.mh.user.mapper.DeviceInstallMapper; |
||||
import com.mh.user.mapper.GatewayManageMapper; |
||||
import com.mh.user.mapper.NowDataMapper; |
||||
import com.mh.user.s7.S7ConnectorUtil; |
||||
import com.mh.user.utils.DateUtil; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springframework.scheduling.annotation.Scheduled; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.math.RoundingMode; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
import java.util.concurrent.ConcurrentHashMap; |
||||
import java.util.stream.Collectors; |
||||
|
||||
/** |
||||
* S7 PLC定时采集任务 |
||||
* 支持M、VB、VW、VD等地址类型的读写操作 |
||||
* |
||||
* @author System |
||||
* @date 2026-06-23 |
||||
*/ |
||||
@Slf4j |
||||
@Component |
||||
public class S7PlcCollectionJob { |
||||
|
||||
private final GatewayManageMapper gatewayManageMapper; |
||||
private final CollectionParamsManageMapper collectionParamsManageMapper; |
||||
|
||||
// 缓存S7连接器,避免频繁创建连接
|
||||
private static final Map<String, S7ConnectorUtil> connectorCache = new ConcurrentHashMap<>(); |
||||
private final DeviceInstallMapper deviceInstallMapper; |
||||
private final NowDataMapper nowDataMapper; |
||||
|
||||
public S7PlcCollectionJob(GatewayManageMapper gatewayManageMapper, |
||||
CollectionParamsManageMapper collectionParamsManageMapper, DeviceInstallMapper deviceInstallMapper, NowDataMapper nowDataMapper, NowDataMapper nowDataMapper1) { |
||||
this.gatewayManageMapper = gatewayManageMapper; |
||||
this.collectionParamsManageMapper = collectionParamsManageMapper; |
||||
this.deviceInstallMapper = deviceInstallMapper; |
||||
this.nowDataMapper = nowDataMapper1; |
||||
} |
||||
|
||||
/** |
||||
* 定时采集S7 PLC数据 |
||||
* 每5分钟执行一次,可根据实际需求调整 |
||||
* 优先处理手动操作:如果Constant.WEB_PLC_FLAG为true,则跳过本次采集 |
||||
*/ |
||||
@Scheduled(cron = "0 0/5 * * * ?") |
||||
public void collectS7Data() { |
||||
log.info("------S7 PLC定时采集开始>>>>Constant.FLAG=={}------", Constant.PLC_FLAG); |
||||
|
||||
try { |
||||
// 检查是否有手动操作正在进行
|
||||
if (Constant.PLC_FLAG || Constant.WEB_PLC_FLAG) { |
||||
log.info("存在手动操作,跳过本次S7 PLC采集"); |
||||
return; |
||||
} |
||||
|
||||
Constant.PLC_FLAG = true; |
||||
|
||||
// 查询所有在线的S7网关
|
||||
List<GatewayManageEntity> s7Gateways = gatewayManageMapper.queryS7Gateways(); |
||||
if (s7Gateways == null || s7Gateways.isEmpty()) { |
||||
log.info("未找到在线的S7网关"); |
||||
return; |
||||
} |
||||
|
||||
log.info("找到{}个在线S7网关", s7Gateways.size()); |
||||
|
||||
// 遍历每个S7网关
|
||||
for (GatewayManageEntity gateway : s7Gateways) { |
||||
try { |
||||
processGateway(gateway); |
||||
} catch (Exception e) { |
||||
log.error("处理S7网关异常: gatewayName={}, dataCom={}", |
||||
gateway.getGatewayName(), gateway.getDataCom(), e); |
||||
} |
||||
} |
||||
|
||||
} catch (Exception e) { |
||||
log.error("S7 PLC定时采集异常", e); |
||||
} finally { |
||||
Constant.PLC_FLAG = false; |
||||
log.info("------S7 PLC定时采集结束>>>>Constant.FLAG=={}------", Constant.PLC_FLAG); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 处理单个S7网关的数据采集 |
||||
*/ |
||||
private void processGateway(GatewayManageEntity gateway) { |
||||
String dataCom = gateway.getDataCom(); |
||||
if (dataCom == null || dataCom.isEmpty()) { |
||||
log.warn("网关dataCom为空: {}", gateway.getGatewayName()); |
||||
return; |
||||
} |
||||
|
||||
// 获取或创建S7连接器
|
||||
S7ConnectorUtil connector = getOrCreateConnector(gateway); |
||||
if (connector == null) { |
||||
log.error("无法创建S7连接器: {}", gateway.getGatewayName()); |
||||
return; |
||||
} |
||||
|
||||
// 查询该网关对应的采集参数
|
||||
List<CollectionParamsManageEntity> params = collectionParamsManageMapper.selectCPMByDataCom(dataCom); |
||||
if (params == null || params.isEmpty()) { |
||||
log.info("网关{}没有配置采集参数", gateway.getGatewayName()); |
||||
return; |
||||
} |
||||
|
||||
log.info("开始采集网关{}的{}个点位", gateway.getGatewayName(), params.size()); |
||||
|
||||
// 过滤掉重复的采集参数
|
||||
params = params.stream().distinct().collect(Collectors.toList()); |
||||
String dateStr = DateUtil.dateToString(new Date(), "yyyy-MM-dd HH:mm:ss"); |
||||
|
||||
// 遍历采集参数并读取数据
|
||||
for (CollectionParamsManageEntity param : params) { |
||||
try { |
||||
// 再次检查是否有手动操作
|
||||
if (Constant.WEB_PLC_FLAG) { |
||||
log.info("检测到手动操作,中断采集"); |
||||
break; |
||||
} |
||||
|
||||
readAndSaveData(connector, param, dateStr); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("采集点位异常: registerAddr={}, otherName={}", |
||||
param.getRegisterAddr(), param.getOtherName(), e); |
||||
} |
||||
} |
||||
// 遍历完全之后更新回水状态,因为有多箱和单箱电磁阀
|
||||
// params遍历得出多少个buildingId分组
|
||||
List<Long> buildingIds = params.stream().map(CollectionParamsManageEntity::getBuildingId).distinct().collect(Collectors.toList()); |
||||
for (Long buildingId : buildingIds) { |
||||
List<Map<String, Object>> backWaterStates = collectionParamsManageMapper.selectBackWaterState(buildingId); |
||||
// map值有cur_value,cur_time,通过stream判断cur_time是否是当前时间,然后cur_value如果存在一天记录等于1的,back_water_state=运行,否则back_water_state=不运行
|
||||
backWaterStates.forEach(backWaterState -> { |
||||
if (backWaterState.get("cur_time").toString().substring(0, 10).equals(dateStr.substring(0, 10))) { |
||||
if (backWaterState.get("cur_value").equals(1)) { |
||||
nowDataMapper.updateBackWaterState(buildingId, "运行"); |
||||
} else { |
||||
nowDataMapper.updateBackWaterState(buildingId, "不运行"); |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 读取并保存数据 |
||||
*/ |
||||
private void readAndSaveData(S7ConnectorUtil connector, |
||||
CollectionParamsManageEntity param, |
||||
String dateStr) { |
||||
String registerAddr = param.getRegisterAddr(); |
||||
if (registerAddr == null || registerAddr.isEmpty()) { |
||||
log.warn("点位寄存器地址为空: id={}", param.getId()); |
||||
return; |
||||
} |
||||
|
||||
// 读取数据
|
||||
Object value = connector.readData(registerAddr); |
||||
|
||||
DeviceInstallEntity deviceInstallEntity = deviceInstallMapper.selectDeviceById(param.getDeviceInstallId()); |
||||
|
||||
if (value == null) { |
||||
log.warn("读取数据为空: registerAddr={}", registerAddr); |
||||
// 更新deviceInstall离线
|
||||
deviceInstallMapper.updateNotOnlineById(param.getDeviceInstallId()); |
||||
// 更新now_data离线
|
||||
nowDataMapper.updateRunState(deviceInstallEntity.getBuildingId(), |
||||
deviceInstallEntity.getDeviceAddr(), |
||||
"2", deviceInstallEntity.getDeviceName()); |
||||
// 在判断设备类型,如果是供水泵,up_water_state=运行
|
||||
// 如果是补水电磁阀开,use_water_state=运行,
|
||||
// 如果是单箱电磁阀或者多箱电磁阀开,back_water_state=运行
|
||||
if (deviceInstallEntity.getDeviceType().equals("供水泵")) { |
||||
nowDataMapper.updateUpWaterState(deviceInstallEntity.getBuildingId(), |
||||
deviceInstallEntity.getDeviceAddr(), |
||||
"2", deviceInstallEntity.getDeviceName()); |
||||
} else if (deviceInstallEntity.getDeviceType().equals("补水电磁阀")) { |
||||
nowDataMapper.updateUseWaterState(deviceInstallEntity.getBuildingId(), |
||||
deviceInstallEntity.getDeviceAddr(), |
||||
"2", deviceInstallEntity.getDeviceName()); |
||||
} |
||||
return; |
||||
} |
||||
|
||||
// 转换值为BigDecimal
|
||||
BigDecimal curValue; |
||||
try { |
||||
// BigDecimal 构造函数可以直接处理 String 和 Number.toString()
|
||||
curValue = new BigDecimal(value.toString()); |
||||
} catch (NumberFormatException e) { |
||||
log.warn("无法转换为数字: registerAddr={}, value={}", "", value); |
||||
return; |
||||
} |
||||
|
||||
// 应用倍率和初始值
|
||||
if (param.getMtRatio() != null && param.getMtRatio() != 1) { |
||||
curValue = curValue.multiply(new BigDecimal(param.getMtRatio())); |
||||
} |
||||
if (param.getMtInitValue() != null) { |
||||
curValue = curValue.add(param.getMtInitValue()); |
||||
} |
||||
|
||||
// 应用小数点位数
|
||||
if (param.getDigits() != null && param.getDigits() > 0) { |
||||
curValue = curValue.setScale(param.getDigits(), BigDecimal.ROUND_HALF_UP); |
||||
} |
||||
|
||||
// 更新数据库
|
||||
collectionParamsManageMapper.updateCollectionParamsManage( |
||||
param.getDeviceInstallId().intValue(), |
||||
registerAddr, |
||||
curValue.toString(), |
||||
dateStr, |
||||
param.getBuildingId() != null ? param.getBuildingId().toString() : null |
||||
); |
||||
|
||||
// 在同步更新device_install表
|
||||
deviceInstallMapper.updateLastValueByOtherParam(param.getDeviceInstallId(), curValue.toString()); |
||||
|
||||
if (deviceInstallEntity != null) { |
||||
// 更新设备安装表中的now_date字段,根据param.getParamTypeId()的值进行判断 // 在对now_date进行更新
|
||||
// 查询当前点位是否是运行状态、压力、液位、液位设置、回水温度、故障状态
|
||||
log.error("进入nowData设置==>{}", param.toString()); |
||||
switch(param.getParamTypeId()) { |
||||
case 2: // 运行状态
|
||||
nowDataMapper.updateRunState(deviceInstallEntity.getBuildingId(), |
||||
deviceInstallEntity.getDeviceAddr(), |
||||
String.valueOf(curValue.intValue()), deviceInstallEntity.getDeviceName()); |
||||
// 在判断设备类型,如果是供水泵,up_water_state=运行
|
||||
// 如果是补水电磁阀开,use_water_state=运行,
|
||||
// 如果是单箱电磁阀或者多箱电磁阀开,back_water_state=运行
|
||||
if (deviceInstallEntity.getDeviceType().equals("供水泵")) { |
||||
nowDataMapper.updateUpWaterState(deviceInstallEntity.getBuildingId(), |
||||
deviceInstallEntity.getDeviceAddr(), |
||||
String.valueOf(curValue.intValue()), deviceInstallEntity.getDeviceName()); |
||||
} else if (deviceInstallEntity.getDeviceType().equals("补水电磁阀")) { |
||||
nowDataMapper.updateUseWaterState(deviceInstallEntity.getBuildingId(), |
||||
deviceInstallEntity.getDeviceAddr(), |
||||
String.valueOf(curValue.intValue()), deviceInstallEntity.getDeviceName()); |
||||
} |
||||
break; |
||||
case 5: // 压力
|
||||
if (param.getOtherName().contains("供水压力")) { |
||||
nowDataMapper.updatePressure(deviceInstallEntity.getBuildingId(), |
||||
null, |
||||
curValue.setScale(1, RoundingMode.HALF_UP).toString(), null); |
||||
} |
||||
break; |
||||
case 31: // 液位
|
||||
if (param.getOtherName().contains("单箱") && deviceInstallEntity.getIsSingleBox() == 1) { |
||||
// 更新单箱液位
|
||||
nowDataMapper.updateBoxLevel(deviceInstallEntity.getBuildingId(), |
||||
null, |
||||
curValue.setScale(1, RoundingMode.HALF_UP).toString(), |
||||
null, 1); |
||||
} else { |
||||
// 获取多箱的液位
|
||||
nowDataMapper.updateBoxLevel(deviceInstallEntity.getBuildingId(), |
||||
null, |
||||
curValue.setScale(1, RoundingMode.HALF_UP).toString(), |
||||
null, 0); |
||||
} |
||||
break; |
||||
case 26: // 液位设置
|
||||
if (param.getOtherName().contains("单箱液位") && param.getOtherName().contains("上限") && deviceInstallEntity.getIsSingleBox() == 1) { |
||||
// 更新单箱液位
|
||||
nowDataMapper.updateBoxLevelSet(deviceInstallEntity.getBuildingId(), |
||||
null, |
||||
curValue.setScale(1, RoundingMode.HALF_UP).toString(), |
||||
null, 1); |
||||
} if (param.getOtherName().contains("多箱液位") && param.getOtherName().contains("上限") && deviceInstallEntity.getIsSingleBox() == 0) { |
||||
// 获取多箱的液位
|
||||
nowDataMapper.updateBoxLevelSet(deviceInstallEntity.getBuildingId(), |
||||
null, |
||||
curValue.setScale(1, RoundingMode.HALF_UP).toString(), |
||||
null, 0); |
||||
} |
||||
break; |
||||
case 32: // 压力设置
|
||||
nowDataMapper.updatePressureSet(deviceInstallEntity.getBuildingId(), |
||||
null, |
||||
curValue.setScale(1, RoundingMode.HALF_UP).toString(), null); |
||||
break; |
||||
case 12: // 回水温度
|
||||
nowDataMapper.updateBackWaterTemp(deviceInstallEntity.getBuildingId(), |
||||
null, |
||||
curValue.setScale(1, RoundingMode.HALF_UP).toString(), null); |
||||
break; |
||||
case 3: // 故障状态
|
||||
nowDataMapper.updatePressureSet(deviceInstallEntity.getBuildingId(), |
||||
deviceInstallEntity.getDeviceAddr(), |
||||
curValue.intValue() == 0 ? "正常" : "故障", deviceInstallEntity.getDeviceName()); |
||||
break; |
||||
case 41: // 回水阀控制模式:0单箱,1多箱
|
||||
nowDataMapper.updateBackControlModel(deviceInstallEntity.getBuildingId(), |
||||
null, |
||||
String.valueOf(curValue.intValue()), null); |
||||
break; |
||||
} |
||||
// 根据deviceInstall查询对应的deviceInstall表数据
|
||||
// 根据查询出来的deviceInstall表数据,根据device_addr和device_name值进行更新
|
||||
} |
||||
|
||||
log.debug("采集成功: registerAddr={}, value={}, otherName={}", |
||||
registerAddr, curValue, param.getOtherName()); |
||||
} |
||||
|
||||
/** |
||||
* 获取或创建S7连接器 |
||||
*/ |
||||
private S7ConnectorUtil getOrCreateConnector(GatewayManageEntity gateway) { |
||||
String cacheKey = gateway.getDataCom(); |
||||
|
||||
// 从缓存中获取
|
||||
S7ConnectorUtil connector = connectorCache.get(cacheKey); |
||||
if (connector != null) { |
||||
return connector; |
||||
} |
||||
|
||||
// 创建新连接器
|
||||
try { |
||||
String ipAddress = gateway.getGatewayIP(); |
||||
if (ipAddress == null || ipAddress.isEmpty()) { |
||||
log.error("网关IP地址为空: {}", gateway.getGatewayName()); |
||||
return null; |
||||
} |
||||
|
||||
// 解析rack和slot,默认为0和1
|
||||
int rack = 0; |
||||
int slot = 1; |
||||
if (gateway.getGatewayPort() != null && !gateway.getGatewayPort().isEmpty()) { |
||||
try { |
||||
String[] parts = gateway.getGatewayPort().split(","); |
||||
if (parts.length >= 2) { |
||||
rack = Integer.parseInt(parts[0].trim()); |
||||
slot = Integer.parseInt(parts[1].trim()); |
||||
} |
||||
} catch (NumberFormatException e) { |
||||
log.warn("解析rack/slot失败,使用默认值: {}", gateway.getGatewayPort()); |
||||
} |
||||
} |
||||
|
||||
connector = new S7ConnectorUtil(ipAddress, rack, slot); |
||||
connectorCache.put(cacheKey, connector); |
||||
log.info("创建S7连接器成功: IP={}, rack={}, slot={}", ipAddress, rack, slot); |
||||
return connector; |
||||
|
||||
} catch (Exception e) { |
||||
log.error("创建S7连接器失败: {}", gateway.getGatewayName(), e); |
||||
return null; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 手动写入数据到PLC(供Controller调用) |
||||
* |
||||
* @param cpmId 采集参数ID |
||||
* @param value 要写入的值 |
||||
* @return 是否成功 |
||||
*/ |
||||
public boolean writeData(Long cpmId, Object value) { |
||||
try { |
||||
// 查询采集参数
|
||||
CollectionParamsManageEntity param = collectionParamsManageMapper.selectById(cpmId.toString()); |
||||
if (param == null) { |
||||
log.error("采集参数不存在: cpmId={}", cpmId); |
||||
return false; |
||||
} |
||||
|
||||
// 查询网关信息
|
||||
String dataCom = getDataComByDeviceId(param.getDeviceInstallId()); |
||||
if (dataCom == null) { |
||||
log.error("无法获取设备对应的dataCom: deviceInstallId={}", param.getDeviceInstallId()); |
||||
return false; |
||||
} |
||||
|
||||
GatewayManageEntity gateway = getGatewayByDataCom(dataCom); |
||||
if (gateway == null) { |
||||
log.error("无法获取网关信息: dataCom={}", dataCom); |
||||
return false; |
||||
} |
||||
|
||||
// 获取连接器
|
||||
S7ConnectorUtil connector = getOrCreateConnector(gateway); |
||||
if (connector == null) { |
||||
log.error("无法获取S7连接器"); |
||||
return false; |
||||
} |
||||
|
||||
// 写入数据
|
||||
connector.writeData(param.getRegisterAddr(), value); |
||||
|
||||
// 更新数据库
|
||||
String dateStr = DateUtil.dateToString(new Date(), "yyyy-MM-dd HH:mm:ss"); |
||||
// BigDecimal curValue;
|
||||
// if (value instanceof Number) {
|
||||
// curValue = new BigDecimal(value.toString());
|
||||
// } else {
|
||||
// curValue = new BigDecimal(value.toString());
|
||||
// }
|
||||
|
||||
collectionParamsManageMapper.updateCollectionParamsManageById( |
||||
cpmId, |
||||
value.toString(), |
||||
dateStr |
||||
); |
||||
|
||||
log.info("手动写入成功: cpmId={}, registerAddr={}, value={}", cpmId, param.getRegisterAddr(), value); |
||||
return true; |
||||
|
||||
} catch (Exception e) { |
||||
log.error("手动写入失败: cpmId={}", cpmId, e); |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 根据deviceInstallId获取dataCom |
||||
*/ |
||||
private String getDataComByDeviceId(Long deviceInstallId) { |
||||
return gatewayManageMapper.getDataComByDeviceInstallId(deviceInstallId); |
||||
} |
||||
|
||||
/** |
||||
* 根据dataCom获取网关信息 |
||||
*/ |
||||
private GatewayManageEntity getGatewayByDataCom(String dataCom) { |
||||
List<GatewayManageEntity> gateways = gatewayManageMapper.queryS7Gateways(); |
||||
if (gateways != null) { |
||||
for (GatewayManageEntity gw : gateways) { |
||||
if (dataCom.equals(gw.getDataCom())) { |
||||
return gw; |
||||
} |
||||
} |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
/** |
||||
* 清理连接器缓存(可选,用于重启或维护) |
||||
*/ |
||||
public void clearConnectorCache() { |
||||
for (Map.Entry<String, S7ConnectorUtil> entry : connectorCache.entrySet()) { |
||||
try { |
||||
entry.getValue().disconnect(); |
||||
} catch (Exception e) { |
||||
log.error("断开S7连接异常: {}", entry.getKey(), e); |
||||
} |
||||
} |
||||
connectorCache.clear(); |
||||
log.info("S7连接器缓存已清理"); |
||||
} |
||||
} |
||||
@ -1,193 +0,0 @@
|
||||
package com.mh.user.job; |
||||
|
||||
import com.alibaba.fastjson2.JSONObject; |
||||
import com.mh.common.http.HttpResult; |
||||
import com.mh.user.constants.Constant; |
||||
import com.mh.user.entity.CollectionParamsManageEntity; |
||||
import com.mh.user.model.SerialPortModel; |
||||
import com.mh.user.service.CollectionParamsManageService; |
||||
import com.mh.user.service.DeviceControlService; |
||||
import com.mh.user.utils.ExchangeStringUtil; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springframework.scheduling.annotation.Scheduled; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
import java.time.LocalDate; |
||||
import java.time.ZoneId; |
||||
import java.util.ArrayList; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
import java.util.stream.Collectors; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project CHWS |
||||
* @description 定时开关机热泵 |
||||
* @date 2026-06-04 13:45:02 |
||||
*/ |
||||
@Slf4j |
||||
@Component |
||||
public class StartOrStopHotpumpJob { |
||||
|
||||
private final CollectionParamsManageService collectionParamsManageService; |
||||
|
||||
private final DeviceControlService deviceControlService; |
||||
|
||||
public StartOrStopHotpumpJob(CollectionParamsManageService collectionParamsManageService, DeviceControlService deviceControlService) { |
||||
this.collectionParamsManageService = collectionParamsManageService; |
||||
this.deviceControlService = deviceControlService; |
||||
} |
||||
|
||||
// @Scheduled(cron = "0 0/1 * * * ?")
|
||||
public void startOrStopHotpump() { |
||||
log.info("定时开关机热泵开始"); |
||||
// 查询定时时间
|
||||
List<CollectionParamsManageEntity> paramsManageEntities = collectionParamsManageService.selectAllCPMList(); |
||||
// 过滤获取paramTypeGroupId为3的数据
|
||||
List<CollectionParamsManageEntity> filterList = paramsManageEntities.stream().filter(entity -> entity.getParamTypeGroupId() == 3).collect(Collectors.toList()); |
||||
// 再根据device_install_id进行分组
|
||||
Map<Long, List<CollectionParamsManageEntity>> listMap = filterList.stream().collect(Collectors.groupingBy(CollectionParamsManageEntity::getDeviceInstallId)); |
||||
for (Map.Entry<Long, List<CollectionParamsManageEntity>> entry : listMap.entrySet()) { |
||||
List<CollectionParamsManageEntity> value = entry.getValue(); |
||||
// 查看是否启动定时,register_addr = START_TIME1的cur_value值是否等于1,
|
||||
CollectionParamsManageEntity startTime1 = value.stream().filter(entity -> entity.getRegisterAddr().equals("START_TIME1")).findFirst().orElse(null); |
||||
if (startTime1 != null && startTime1.getCurValue().intValue() == 1) { |
||||
// 同时查看对应的设备是否是开机状态,同时判断curTime是否是今天,如果是开机状态则不执行定时开关机
|
||||
CollectionParamsManageEntity entity1 = paramsManageEntities.stream().filter(entity -> entity.getDeviceInstallId().equals(entry.getKey())) |
||||
.filter(entity -> entity.getRegisterAddr().equals("B000")) |
||||
.filter(entity -> entity.getCurTime() != null) |
||||
.filter(entity -> entity.getCurValue().intValue() == 1).findFirst().orElse(null); |
||||
// 判断设备状态更新时间是否是今天
|
||||
boolean isTodayUpdate = false; |
||||
if (entity1 != null && entity1.getCurTime() != null) { |
||||
Date curTime = entity1.getCurTime(); |
||||
LocalDate updateDate = curTime.toInstant().atZone(java.time.ZoneId.systemDefault()).toLocalDate(); |
||||
java.time.LocalDate today = java.time.LocalDate.now(); |
||||
isTodayUpdate = updateDate.equals(today); |
||||
log.info("设备{}的状态更新时间: {}, 是否是今天: {}", entry.getKey(), curTime, isTodayUpdate); |
||||
} |
||||
|
||||
// 如果设备已开机且状态是今天更新的,则不执行定时开关机
|
||||
if (entity1 != null && entity1.getCurValue().intValue() == 1 && isTodayUpdate) { |
||||
log.info("设备{}已开机且状态为今天更新,不执行定时开关机", entry.getKey()); |
||||
} else { |
||||
|
||||
// value过滤,开始查看当前时间是否是定时时间,register_name分别是
|
||||
//OPEN_HOUR_TIME1:开始小时
|
||||
//OPEN_MIN_TIME1:开始分钟
|
||||
//CLOSE_HOUR_TIME1:结束小时
|
||||
//CLOSE_MIN_TIME1:结束分钟
|
||||
// 这几个查询出来在拼接成时间范围,然后判断当前时间是否在范围内,如果在范围内则执行定时开关机
|
||||
// 获取定时开关机参数
|
||||
CollectionParamsManageEntity openHour = value.stream() |
||||
.filter(entity -> entity.getRegisterAddr().equals("OPEN_HOUR_TIME1")) |
||||
.findFirst().orElse(null); |
||||
CollectionParamsManageEntity openMin = value.stream() |
||||
.filter(entity -> entity.getRegisterAddr().equals("OPEN_MIN_TIME1")) |
||||
.findFirst().orElse(null); |
||||
CollectionParamsManageEntity closeHour = value.stream() |
||||
.filter(entity -> entity.getRegisterAddr().equals("CLOSE_HOUR_TIME1")) |
||||
.findFirst().orElse(null); |
||||
CollectionParamsManageEntity closeMin = value.stream() |
||||
.filter(entity -> entity.getRegisterAddr().equals("CLOSE_MIN_TIME1")) |
||||
.findFirst().orElse(null); |
||||
|
||||
// 检查所有定时参数是否都存在
|
||||
if (openHour != null && openMin != null && closeHour != null && closeMin != null) { |
||||
// 获取当前时间
|
||||
java.time.LocalDateTime now = java.time.LocalDateTime.now(); |
||||
int currentHour = now.getHour(); |
||||
int currentMinute = now.getMinute(); |
||||
int currentTime = currentHour * 100 + currentMinute; // 格式化为 HHmm
|
||||
|
||||
// 计算开始时间和结束时间
|
||||
int startTime = openHour.getCurValue().intValue() * 100 + openMin.getCurValue().intValue(); |
||||
int endTime = closeHour.getCurValue().intValue() * 100 + closeMin.getCurValue().intValue(); |
||||
|
||||
log.info("设备{}的定时时间 - 当前: {}, 开始: {}, 结束: {}", entry.getKey(), currentTime, startTime, endTime); |
||||
|
||||
// 判断当前时间是否在定时范围内
|
||||
boolean isInTimeRange = false; |
||||
if (startTime <= endTime) { |
||||
// 正常情况:开始时间 <= 结束时间
|
||||
isInTimeRange = currentTime >= startTime && currentTime <= endTime; |
||||
} else { |
||||
// 跨天情况:开始时间 > 结束时间(如 22:00 ~ 06:00)
|
||||
isInTimeRange = currentTime >= startTime || currentTime <= endTime; |
||||
} |
||||
|
||||
if (isInTimeRange) { |
||||
// 在时间范围内,执行开机操作
|
||||
log.info("设备{}在定时范围内,执行开机操作", entry.getKey()); |
||||
executeHotPumpControl(entry.getKey(), paramsManageEntities, "1"); |
||||
} else { |
||||
// 不在时间范围内,执行关机操作
|
||||
log.info("设备{}不在定时范围内,执行关机操作", entry.getKey()); |
||||
executeHotPumpControl(entry.getKey(), paramsManageEntities, "0"); |
||||
} |
||||
} else { |
||||
log.warn("设备{}的定时参数不完整", entry.getKey()); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
log.info("定时开关机热泵结束"); |
||||
} |
||||
|
||||
/** |
||||
* 执行热泵开关机控制 |
||||
* @param deviceInstallId 设备安装ID |
||||
* @param params 参数列表 |
||||
* @param command 命令:1-开机,0-关机 |
||||
*/ |
||||
private void executeHotPumpControl(Long deviceInstallId, List<CollectionParamsManageEntity> params, String command) { |
||||
try { |
||||
// 获取设备信息
|
||||
CollectionParamsManageEntity deviceInfo = params.stream() |
||||
.filter(entity -> entity.getDeviceInstallId().equals(deviceInstallId)) |
||||
.filter(entity -> entity.getRegisterAddr().equals("B000")) |
||||
.findFirst().orElse(null); |
||||
|
||||
if (deviceInfo == null) { |
||||
log.error("未找到设备{}的开关机寄存器信息", deviceInstallId); |
||||
return; |
||||
} |
||||
|
||||
// 检查当前状态,如果已经是目标状态则不执行
|
||||
if (deviceInfo.getCurValue() != null && deviceInfo.getCurValue().intValue() == Integer.parseInt(command)) { |
||||
log.info("设备{}已是目标状态{},无需操作", deviceInstallId, command); |
||||
return; |
||||
} |
||||
|
||||
// 构建串口通信参数
|
||||
SerialPortModel serialPortModel = new SerialPortModel(); |
||||
serialPortModel.setCpmId(String.valueOf(deviceInfo.getId())); |
||||
serialPortModel.setDataValue(command); |
||||
serialPortModel.setParam(""); |
||||
|
||||
// 调用设备控制服务执行开关机
|
||||
List<SerialPortModel> paramList = new ArrayList<>(); |
||||
paramList.add(serialPortModel); |
||||
|
||||
try { |
||||
Constant.WEB_FLAG = true; //单抄,暂时停止采集
|
||||
Thread.sleep(1000); |
||||
String rtData = deviceControlService.readOrWriteDevice(paramList, Constant.WRITE); |
||||
if (ExchangeStringUtil.getJSONType(rtData)) { |
||||
// Map map = JSONObject.parseObject(rtData);
|
||||
log.info("设备{}{}成功", deviceInstallId, "1".equals(command) ? "开机" : "关机"); |
||||
} else { |
||||
log.error("设备{}{}失败,结果: {}", deviceInstallId, "1".equals(command) ? "开机" : "关机", rtData); |
||||
} |
||||
} catch (Exception e) { |
||||
Constant.WEB_FLAG = false; //单抄,恢复采集
|
||||
} finally { |
||||
Constant.WEB_FLAG = false; //单抄,恢复采集
|
||||
} |
||||
} catch (Exception e) { |
||||
log.error("执行设备{}开关机控制异常", deviceInstallId, e); |
||||
} |
||||
} |
||||
} |
||||
@ -1,440 +0,0 @@
|
||||
package com.mh.user.mapper; |
||||
|
||||
import com.mh.user.dto.HotWaterControlListVO; |
||||
import com.mh.user.dto.HotWaterControlZDListVO; |
||||
import com.mh.user.entity.CollectionParamsManageEntity; |
||||
import com.mh.user.entity.DeviceInstallEntity; |
||||
import com.mh.user.model.SanShiFengDatas; |
||||
import org.apache.ibatis.annotations.*; |
||||
import tk.mybatis.mapper.common.BaseMapper; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project CHWS |
||||
* @description 采集参数设备mapper类 |
||||
* @date 2025-12-10 11:31:42 |
||||
*/ |
||||
@Mapper |
||||
public interface CollectionParamsManageMapper extends BaseMapper<CollectionParamsManageEntity> { |
||||
|
||||
@Select("<script>" + |
||||
"SELECT * FROM (" + |
||||
"SELECT cpm.*, ROW_NUMBER() OVER (ORDER BY cpm.device_install_id) AS row_num " + |
||||
"FROM collection_params_manage cpm join device_install di on cpm.device_install_id = di.id where 1=1" + |
||||
"<if test='deviceInstallId != null and deviceInstallId != \"\"'>" + |
||||
"AND cpm.device_install_id = #{deviceInstallId} " + |
||||
"</if>" + |
||||
"<if test='buildingId != null and buildingId != \"\"'>" + |
||||
"AND di.building_id = #{buildingId} " + |
||||
"</if>" + |
||||
"<if test='otherName != null and otherName != \"\"'>" + |
||||
"AND cpm.other_name LIKE CONCAT('%', #{otherName}, '%') " + |
||||
"</if>" + |
||||
") AS t WHERE t.row_num BETWEEN (#{pageNum}-1)*#{pageSize} AND #{pageNum}*#{pageSize}" + |
||||
"</script>") |
||||
@Results({ |
||||
@Result(column = "id", property = "id"), |
||||
@Result(column = "create_time", property = "createTime"), |
||||
@Result(column = "update_time", property = "updateTime"), |
||||
@Result(column = "device_install_id", property = "deviceInstallId"), |
||||
@Result(column = "register_addr", property = "registerAddr"), |
||||
@Result(column = "func_code", property = "funcCode"), |
||||
@Result(column = "mt_ratio", property = "mtRatio"), |
||||
@Result(column = "mt_init_value", property = "mtInitValue"), |
||||
@Result(column = "digits", property = "digits"), |
||||
@Result(column = "data_type", property = "dataType"), |
||||
@Result(column = "cur_value", property = "curValue"), |
||||
@Result(column = "cur_time", property = "curTime"), |
||||
@Result(column = "mt_is_sum", property = "mtIsSum"), |
||||
@Result(column = "unit", property = "unit"), |
||||
@Result(column = "order_num", property = "orderNum"), |
||||
@Result(column = "remark", property = "remark"), |
||||
@Result(column = "register_size", property = "registerSize"), |
||||
@Result(column = "is_use", property = "isUse"), |
||||
@Result(column = "other_name", property = "otherName"), |
||||
@Result(column = "grade", property = "grade"), |
||||
@Result(column = "param_type_id", property = "paramTypeId"), |
||||
@Result(column = "collection_type", property = "collectionType"), |
||||
@Result(column = "quality", property = "quality") |
||||
}) |
||||
List<CollectionParamsManageEntity> selectCPMList(String buildingId,String deviceInstallId, String otherName, Integer pageNum, Integer pageSize); |
||||
|
||||
@Select("<script>" + |
||||
"SELECT count(1) " + |
||||
"FROM collection_params_manage cpm join device_install di on cpm.device_install_id = di.id where 1=1" + |
||||
"<if test='deviceInstallId != null and deviceInstallId != \"\"'>" + |
||||
"AND cpm.device_install_id = #{deviceInstallId} " + |
||||
"</if>" + |
||||
"<if test='buildingId != null and buildingId != \"\"'>" + |
||||
"AND di.building_id = #{buildingId} " + |
||||
"</if>" + |
||||
"<if test='otherName != null and otherName != \"\"'>" + |
||||
"AND cpm.other_name LIKE CONCAT('%', #{otherName}, '%') " + |
||||
"</if>" + |
||||
"</script>") |
||||
int selectCPMListCount(String buildingId, String deviceInstallId, String otherName, Integer pageNum, Integer pageSize); |
||||
|
||||
@Select("select count(1) from collection_params_manage where other_name = #{otherName} ") |
||||
int selectCountByOtherName(String otherName); |
||||
|
||||
@Update("update collection_params_manage set cur_value = #{value}, cur_time = #{time}, quality = #{quality} where other_name = #{name} and building_id = #{buildingId}") |
||||
void updateCPMByOtherName(String name, BigDecimal value, String time, String quality, String buildingId); |
||||
|
||||
@Update("<script>" + |
||||
"WITH BatchData AS (" + |
||||
"<foreach collection='batch' item='item' separator='UNION ALL'>" + |
||||
"SELECT #{item.name} AS other_name, #{item.value} AS cur_value" + |
||||
"</foreach>" + |
||||
") " + |
||||
"MERGE collection_params_manage AS target " + |
||||
"USING BatchData AS source " + |
||||
"ON (target.other_name = source.other_name AND target.building_id = #{buildingId}) " + |
||||
"WHEN MATCHED THEN " + |
||||
" UPDATE SET " + |
||||
" cur_value = source.cur_value, " + |
||||
" cur_time = #{time}, " + |
||||
" quality = #{quality};" + |
||||
"</script>") |
||||
void updateBatchCPMByOtherName(@Param("batch") List<SanShiFengDatas> batch, |
||||
@Param("time") String time, |
||||
@Param("quality") String quality, |
||||
@Param("buildingId") String buildingId); |
||||
|
||||
|
||||
@Select("select top 1 * from collection_params_manage where other_name = #{name} and building_id = #{buildingId} ") |
||||
@Results({ |
||||
@Result(column = "id", property = "id"), |
||||
@Result(column = "create_time", property = "createTime"), |
||||
@Result(column = "update_time", property = "updateTime"), |
||||
@Result(column = "device_install_id", property = "deviceInstallId"), |
||||
@Result(column = "register_addr", property = "registerAddr"), |
||||
@Result(column = "func_code", property = "funcCode"), |
||||
@Result(column = "mt_ratio", property = "mtRatio"), |
||||
@Result(column = "mt_init_value", property = "mtInitValue"), |
||||
@Result(column = "digits", property = "digits"), |
||||
@Result(column = "data_type", property = "dataType"), |
||||
@Result(column = "cur_value", property = "curValue"), |
||||
@Result(column = "cur_time", property = "curTime"), |
||||
@Result(column = "mt_is_sum", property = "mtIsSum"), |
||||
@Result(column = "unit", property = "unit"), |
||||
@Result(column = "order_num", property = "orderNum"), |
||||
@Result(column = "remark", property = "remark"), |
||||
@Result(column = "register_size", property = "registerSize"), |
||||
@Result(column = "is_use", property = "isUse"), |
||||
@Result(column = "other_name", property = "otherName"), |
||||
@Result(column = "grade", property = "grade"), |
||||
@Result(column = "param_type_id", property = "paramTypeId"), |
||||
@Result(column = "collection_type", property = "collectionType"), |
||||
@Result(column = "quality", property = "quality") |
||||
}) |
||||
CollectionParamsManageEntity selectDeviceInstallByOtherName(String name, String buildingId); |
||||
|
||||
@Insert("insert into collection_params_manage(" + |
||||
"device_install_id, register_addr, func_code, mt_ratio, mt_init_value, digits, data_type, " + |
||||
"mt_is_sum, unit, order_num, remark, register_size, is_use, " + |
||||
"other_name, grade, param_type_id, collection_type, quality, create_time, building_id, cur_value, cur_time) " + |
||||
"values(#{deviceInstallId}, #{registerAddr}, #{funcCode}, #{mtRatio}, #{mtInitValue}, " + |
||||
"#{digits}, #{dataType}, #{mtIsSum}, #{unit}, #{orderNum}, " + |
||||
"#{remark}, #{registerSize}, #{isUse}, #{otherName}, #{grade}, #{paramTypeId}, " + |
||||
"#{collectionType}, #{quality}, getdate(), #{buildingId}, #{curValue}, #{curTime})") |
||||
void insertCPM(CollectionParamsManageEntity cpmEntity); |
||||
|
||||
@Update("<script>" + |
||||
"update collection_params_manage " + |
||||
"<set>" + |
||||
"<if test='deviceInstallId != null'>device_install_id = #{deviceInstallId},</if>" + |
||||
"<if test='registerAddr != null'>register_addr = #{registerAddr},</if>" + |
||||
"<if test='funcCode != null'>func_code = #{funcCode},</if>" + |
||||
"<if test='mtRatio != null'>mt_ratio = #{mtRatio},</if>" + |
||||
"<if test='mtInitValue != null'>mt_init_value = #{mtInitValue},</if>" + |
||||
"<if test='digits != null'>digits = #{digits},</if>" + |
||||
"<if test='dataType != null'>data_type = #{dataType},</if>" + |
||||
"<if test='curValue != null'>cur_value = #{curValue},</if>" + |
||||
"<if test='curTime != null'>cur_time = #{curTime},</if>" + |
||||
"<if test='mtIsSum != null'>mt_is_sum = #{mtIsSum},</if>" + |
||||
"<if test='unit != null'>unit = #{unit},</if>" + |
||||
"<if test='orderNum != null'>order_num = #{orderNum},</if>" + |
||||
"<if test='remark != null'>remark = #{remark},</if>" + |
||||
"<if test='registerSize != null'>register_size = #{registerSize},</if>" + |
||||
"<if test='isUse != null'>is_use = #{isUse},</if>" + |
||||
"<if test='otherName != null'>other_name = #{otherName},</if>" + |
||||
"<if test='grade != null'>grade = #{grade},</if>" + |
||||
"<if test='paramTypeId != null'>param_type_id = #{paramTypeId},</if>" + |
||||
"<if test='collectionType != null'>collection_type = #{collectionType},</if>" + |
||||
"<if test='quality != null'>quality = #{quality},</if>" + |
||||
"<if test='buildingId != null'>building_id = #{buildingId},</if>" + |
||||
" update_time = getdate() " + |
||||
"</set>" + |
||||
"where id = #{id}" + |
||||
"</script>") |
||||
void updateById(CollectionParamsManageEntity cpmEntity); |
||||
|
||||
@Delete("delete from collection_params_manage where id = #{msId}") |
||||
void deleteById(String msId); |
||||
|
||||
@Select("SELECT " + |
||||
" cpm.id as cpm_id, " + |
||||
" di.building_id, " + |
||||
" di.building_name, " + |
||||
" di.device_type, " + |
||||
" di.id as device_id, " + |
||||
" di.device_name, " + |
||||
" cpm.other_name, " + |
||||
" COALESCE(cpm.cur_value, 0) as cur_value, " + |
||||
" cpm.cur_time, " + |
||||
" cpm.param_type_id, " + |
||||
" cpm.digits, " + |
||||
" ct.order_num AS ct_order_num, " + |
||||
" di.order_num AS dl_order_num " + |
||||
"FROM " + |
||||
" device_install di " + |
||||
" JOIN collection_params_manage cpm ON di.id = cpm.device_install_id " + |
||||
" JOIN code_table ct ON ct.des = di.device_type " + |
||||
" AND di.building_id = #{buildingId} " + |
||||
" AND ct.name = 'deviceType' " + |
||||
"ORDER BY " + |
||||
" ct.order_num, " + |
||||
" di.order_num ") |
||||
@Results({ |
||||
@Result(column = "cpm_id", property = "cpmId"), |
||||
@Result(column = "building_id", property = "buildingId"), |
||||
@Result(column = "building_name", property = "buildingName"), |
||||
@Result(column = "device_type", property = "deviceType"), |
||||
@Result(column = "device_id", property = "deviceId"), |
||||
@Result(column = "device_name", property = "deviceName"), |
||||
@Result(column = "other_name", property = "otherName"), |
||||
@Result(column = "cur_value", property = "curValue"), |
||||
@Result(column = "cur_time", property = "curTime"), |
||||
@Result(column = "param_type_id", property = "paramTypeId"), |
||||
@Result(column = "digits", property = "digits"), |
||||
@Result(column = "ct_order_num", property = "ctOrderNum"), |
||||
@Result(column = "dl_order_num", property = "dlOrderNum") |
||||
}) |
||||
List<HotWaterControlListVO> selectHotWaterByBuildingId(String buildingId); |
||||
|
||||
@Select("SELECT " + |
||||
" top 1 gm.community_type " + |
||||
"FROM " + |
||||
" device_install di " + |
||||
" JOIN collection_params_manage cpm ON di.id = cpm.device_install_id " + |
||||
" JOIN gateway_manage gm ON di.data_com = gm.data_com " + |
||||
" AND cpm.id = #{cpmId} ") |
||||
String selectCommunicationType(String cpmId); |
||||
|
||||
@Select("SELECT " + |
||||
" top 1 gm.sn " + |
||||
"FROM " + |
||||
" device_install di " + |
||||
" JOIN collection_params_manage cpm ON di.id = cpm.device_install_id " + |
||||
" JOIN gateway_manage gm ON di.data_com = gm.data_com " + |
||||
" AND cpm.id = #{cpmId} ") |
||||
String selectSn(String cpmId); |
||||
|
||||
@Select("SELECT " + |
||||
" top 1 gm.gateway_name " + |
||||
"FROM " + |
||||
" device_install di " + |
||||
" JOIN collection_params_manage cpm ON di.id = cpm.device_install_id " + |
||||
" JOIN gateway_manage gm ON di.data_com = gm.data_com " + |
||||
" AND cpm.id = #{cpmId} ") |
||||
String selectPlcName(String cpmId); |
||||
|
||||
@Select("select top 1 * from collection_params_manage where id = #{id}") |
||||
@Results({ |
||||
@Result(column = "id", property = "id"), |
||||
@Result(column = "create_time", property = "createTime"), |
||||
@Result(column = "update_time", property = "updateTime"), |
||||
@Result(column = "device_install_id", property = "deviceInstallId"), |
||||
@Result(column = "register_addr", property = "registerAddr"), |
||||
@Result(column = "func_code", property = "funcCode"), |
||||
@Result(column = "mt_ratio", property = "mtRatio"), |
||||
@Result(column = "mt_init_value", property = "mtInitValue"), |
||||
@Result(column = "digits", property = "digits"), |
||||
@Result(column = "data_type", property = "dataType"), |
||||
@Result(column = "cur_value", property = "curValue"), |
||||
@Result(column = "cur_time", property = "curTime"), |
||||
@Result(column = "mt_is_sum", property = "mtIsSum"), |
||||
@Result(column = "unit", property = "unit"), |
||||
@Result(column = "order_num", property = "orderNum"), |
||||
@Result(column = "remark", property = "remark"), |
||||
@Result(column = "register_size", property = "registerSize"), |
||||
@Result(column = "is_use", property = "isUse"), |
||||
@Result(column = "other_name", property = "otherName"), |
||||
@Result(column = "grade", property = "grade"), |
||||
@Result(column = "param_type_id", property = "paramTypeId"), |
||||
@Result(column = "param_type_group_id", property = "paramTypeGroupId"), |
||||
@Result(column = "collection_type", property = "collectionType"), |
||||
@Result(column = "quality", property = "quality") |
||||
}) |
||||
CollectionParamsManageEntity selectById(String id); |
||||
|
||||
@Select("select top 1 * from collection_params_manage where device_install_id = #{deviceInstallId} and param_type_id = #{paramTypeId}") |
||||
@Results({ |
||||
@Result(column = "id", property = "id"), |
||||
@Result(column = "create_time", property = "createTime"), |
||||
@Result(column = "update_time", property = "updateTime"), |
||||
@Result(column = "device_install_id", property = "deviceInstallId"), |
||||
@Result(column = "register_addr", property = "registerAddr"), |
||||
@Result(column = "func_code", property = "funcCode"), |
||||
@Result(column = "mt_ratio", property = "mtRatio"), |
||||
@Result(column = "mt_init_value", property = "mtInitValue"), |
||||
@Result(column = "digits", property = "digits"), |
||||
@Result(column = "data_type", property = "dataType"), |
||||
@Result(column = "cur_value", property = "curValue"), |
||||
@Result(column = "cur_time", property = "curTime"), |
||||
@Result(column = "mt_is_sum", property = "mtIsSum"), |
||||
@Result(column = "unit", property = "unit"), |
||||
@Result(column = "order_num", property = "orderNum"), |
||||
@Result(column = "remark", property = "remark"), |
||||
@Result(column = "register_size", property = "registerSize"), |
||||
@Result(column = "is_use", property = "isUse"), |
||||
@Result(column = "other_name", property = "otherName"), |
||||
@Result(column = "grade", property = "grade"), |
||||
@Result(column = "param_type_id", property = "paramTypeId"), |
||||
@Result(column = "collection_type", property = "collectionType"), |
||||
@Result(column = "quality", property = "quality") |
||||
}) |
||||
CollectionParamsManageEntity selectByDeviceIdAndParamTypeId(Long deviceInstallId, String paramTypeId); |
||||
|
||||
@Select("select * from collection_params_manage order by create_time desc") |
||||
@Results({ |
||||
@Result(column = "id", property = "id"), |
||||
@Result(column = "create_time", property = "createTime"), |
||||
@Result(column = "update_time", property = "updateTime"), |
||||
@Result(column = "device_install_id", property = "deviceInstallId"), |
||||
@Result(column = "register_addr", property = "registerAddr"), |
||||
@Result(column = "func_code", property = "funcCode"), |
||||
@Result(column = "mt_ratio", property = "mtRatio"), |
||||
@Result(column = "mt_init_value", property = "mtInitValue"), |
||||
@Result(column = "digits", property = "digits"), |
||||
@Result(column = "data_type", property = "dataType"), |
||||
@Result(column = "cur_value", property = "curValue"), |
||||
@Result(column = "cur_time", property = "curTime"), |
||||
@Result(column = "mt_is_sum", property = "mtIsSum"), |
||||
@Result(column = "unit", property = "unit"), |
||||
@Result(column = "order_num", property = "orderNum"), |
||||
@Result(column = "remark", property = "remark"), |
||||
@Result(column = "register_size", property = "registerSize"), |
||||
@Result(column = "is_use", property = "isUse"), |
||||
@Result(column = "other_name", property = "otherName"), |
||||
@Result(column = "grade", property = "grade"), |
||||
@Result(column = "param_type_id", property = "paramTypeId"), |
||||
@Result(column = "param_type_group_id", property = "paramTypeGroupId"), |
||||
@Result(column = "collection_type", property = "collectionType"), |
||||
@Result(column = "quality", property = "quality"), |
||||
@Result(column = "building_id", property = "buildingId") |
||||
}) |
||||
List<CollectionParamsManageEntity> selectAllCPMList(); |
||||
|
||||
@Update("update collection_params_manage set cur_value = #{curValue}, cur_time = #{dateStr} where device_install_id = #{deviceInstallId} " + |
||||
"and register_addr = #{regAddr} and building_id = #{buildingId} ") |
||||
void updateCollectionParamsManage(Integer deviceInstallId, String regAddr, String curValue, String dateStr, String buildingId); |
||||
|
||||
@Select("SELECT " + |
||||
" cpm.id as cpm_id, " + |
||||
" cpm.register_addr, " + |
||||
" di.building_id, " + |
||||
" di.building_name, " + |
||||
" ct.des as device_type, " + |
||||
" di.id as device_id, " + |
||||
" di.device_name, " + |
||||
" cpm.other_name, " + |
||||
" COALESCE(cpm.cur_value, 0) as cur_value, " + |
||||
" cpm.cur_time, " + |
||||
" cpm.param_type_id, " + |
||||
" cpm.param_type_group_id, " + |
||||
" cpm.digits, " + |
||||
" ct.order_num AS ct_order_num, " + |
||||
" di.order_num AS dl_order_num, " + |
||||
" cpm.order_num AS order_num " + |
||||
"FROM " + |
||||
" device_install di " + |
||||
" JOIN collection_params_manage cpm ON di.id = cpm.device_install_id " + |
||||
" JOIN code_table ct ON ct.code = cpm.param_type_group_id " + |
||||
" AND di.building_id = #{buildingId} " + |
||||
" AND cpm.device_install_id = #{deviceInstallId} " + |
||||
" AND ct.name = 'paramGroupType' " + |
||||
"ORDER BY " + |
||||
" ct.order_num, " + |
||||
" di.order_num ") |
||||
@Results({ |
||||
@Result(column = "cpm_id", property = "cpmId"), |
||||
@Result(column = "building_id", property = "buildingId"), |
||||
@Result(column = "register_addr", property = "registerAddr"), |
||||
@Result(column = "building_name", property = "buildingName"), |
||||
@Result(column = "device_type", property = "deviceType"), |
||||
@Result(column = "device_id", property = "deviceId"), |
||||
@Result(column = "device_name", property = "deviceName"), |
||||
@Result(column = "other_name", property = "otherName"), |
||||
@Result(column = "cur_value", property = "curValue"), |
||||
@Result(column = "cur_time", property = "curTime"), |
||||
@Result(column = "param_type_id", property = "paramTypeId"), |
||||
@Result(column = "param_type_group_id", property = "paramTypeGroupId"), |
||||
@Result(column = "digits", property = "digits"), |
||||
@Result(column = "ct_order_num", property = "ctOrderNum"), |
||||
@Result(column = "dl_order_num", property = "dlOrderNum"), |
||||
@Result(column = "order_num", property = "orderNum") |
||||
}) |
||||
List<HotWaterControlZDListVO> selectHotWaterByDeviceInstallId(String buildingId, Integer deviceInstallId); |
||||
|
||||
/** |
||||
* 根据dataCom查询对应的采集参数列表(S7协议使用) |
||||
* @param dataCom 通讯口 |
||||
* @return 采集参数列表 |
||||
*/ |
||||
@Select("SELECT cpm.* FROM collection_params_manage cpm " + |
||||
"JOIN device_install di ON cpm.device_install_id = di.id " + |
||||
"WHERE di.data_com = #{dataCom} AND cpm.is_use = 1 " + |
||||
"ORDER BY cpm.device_install_id, cpm.order_num") |
||||
@Results({ |
||||
@Result(column = "id", property = "id"), |
||||
@Result(column = "create_time", property = "createTime"), |
||||
@Result(column = "update_time", property = "updateTime"), |
||||
@Result(column = "device_install_id", property = "deviceInstallId"), |
||||
@Result(column = "register_addr", property = "registerAddr"), |
||||
@Result(column = "func_code", property = "funcCode"), |
||||
@Result(column = "mt_ratio", property = "mtRatio"), |
||||
@Result(column = "mt_init_value", property = "mtInitValue"), |
||||
@Result(column = "digits", property = "digits"), |
||||
@Result(column = "data_type", property = "dataType"), |
||||
@Result(column = "cur_value", property = "curValue"), |
||||
@Result(column = "cur_time", property = "curTime"), |
||||
@Result(column = "mt_is_sum", property = "mtIsSum"), |
||||
@Result(column = "unit", property = "unit"), |
||||
@Result(column = "order_num", property = "orderNum"), |
||||
@Result(column = "remark", property = "remark"), |
||||
@Result(column = "register_size", property = "registerSize"), |
||||
@Result(column = "is_use", property = "isUse"), |
||||
@Result(column = "other_name", property = "otherName"), |
||||
@Result(column = "grade", property = "grade"), |
||||
@Result(column = "param_type_id", property = "paramTypeId"), |
||||
@Result(column = "param_type_group_id", property = "paramTypeGroupId"), |
||||
@Result(column = "collection_type", property = "collectionType"), |
||||
@Result(column = "quality", property = "quality"), |
||||
@Result(column = "building_id", property = "buildingId") |
||||
}) |
||||
List<CollectionParamsManageEntity> selectCPMByDataCom(String dataCom); |
||||
|
||||
@Update("update collection_params_manage set cur_value = #{value}, cur_time = #{dateStr} where id = #{cpmId} ") |
||||
void updateCollectionParamsManageById(@Param("cpmId") Long cpmId, |
||||
@Param("value") String value, |
||||
@Param("dateStr") String dateStr); |
||||
|
||||
@Select("SELECT " + |
||||
" cpm.cur_value, " + |
||||
" cpm.cur_time " + |
||||
"FROM " + |
||||
" collection_params_manage cpm " + |
||||
"JOIN device_install di ON " + |
||||
" cpm.device_install_id = di.id " + |
||||
"WHERE " + |
||||
" cpm.building_id = #{buildingId} " + |
||||
" AND cpm.param_type_id = 2 " + |
||||
" AND di.device_type IN ('单箱电磁阀', '多箱电磁阀');") |
||||
List<Map<String, Object>> selectBackWaterState(Long buildingId); |
||||
} |
||||
@ -1,34 +0,0 @@
|
||||
package com.mh.user.model; |
||||
|
||||
import com.fasterxml.jackson.core.JsonParser; |
||||
import com.fasterxml.jackson.databind.DeserializationContext; |
||||
import com.fasterxml.jackson.databind.JsonDeserializer; |
||||
|
||||
import java.io.IOException; |
||||
import java.math.BigDecimal; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project CHWS |
||||
* @description 格式化 |
||||
* @date 2026-01-07 14:20:36 |
||||
*/ |
||||
public class MyBigDecimalDeserializer extends JsonDeserializer<BigDecimal> { |
||||
|
||||
@Override |
||||
public BigDecimal deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { |
||||
String value = p.getValueAsString(); |
||||
if (value == null || value.trim().isEmpty()) { |
||||
return BigDecimal.ZERO; |
||||
} |
||||
|
||||
try { |
||||
// 直接使用字符串构造BigDecimal,能正确处理科学计数法
|
||||
return new BigDecimal(value); |
||||
} catch (NumberFormatException e) { |
||||
// 如果转换失败,返回0
|
||||
return BigDecimal.ZERO; |
||||
} |
||||
} |
||||
} |
||||
@ -1,36 +1,30 @@
|
||||
package com.mh.user.model; |
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; |
||||
import lombok.Data; |
||||
|
||||
import java.math.BigDecimal; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 三石峰数据体 |
||||
* @description 研华数据体 |
||||
* @date 2025-01-22 14:47:25 |
||||
*/ |
||||
@Data |
||||
public class SanShiFengDatas { |
||||
public class SanShiFengDatas<T extends Number> { |
||||
|
||||
/** |
||||
* 对应研华的标签值 |
||||
*/ |
||||
private String name; |
||||
private String tag; |
||||
|
||||
/** |
||||
* 上报值 |
||||
*/ |
||||
// 使用自定义反序列化器处理科学计数法
|
||||
@JsonDeserialize(using = MyBigDecimalDeserializer.class) |
||||
@JsonFormat(shape = JsonFormat.Shape.STRING) // 以字符串形式输出,避免科学计数法
|
||||
private BigDecimal value; |
||||
// /**
|
||||
// * 质量值
|
||||
// */
|
||||
// private T quality;
|
||||
private T value; |
||||
|
||||
/** |
||||
* 质量值 |
||||
*/ |
||||
private T quality; |
||||
|
||||
} |
||||
|
||||
@ -1,33 +0,0 @@
|
||||
package com.mh.user.model; |
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; |
||||
import lombok.Data; |
||||
|
||||
import java.math.BigDecimal; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 三石峰数据体 |
||||
* @date 2025-01-22 14:47:25 |
||||
*/ |
||||
@Data |
||||
public class SanShiFengStrDatas { |
||||
|
||||
/** |
||||
* 对应研华的标签值 |
||||
*/ |
||||
private String name; |
||||
|
||||
/** |
||||
* 上报值 |
||||
*/ |
||||
// 使用自定义反序列化器处理科学计数法
|
||||
private String value; |
||||
// /**
|
||||
// * 质量值
|
||||
// */
|
||||
// private T quality;
|
||||
|
||||
} |
||||
@ -1,543 +0,0 @@
|
||||
package com.mh.user.s7; |
||||
|
||||
import com.github.s7connector.api.DaveArea; |
||||
import com.github.s7connector.api.S7Connector; |
||||
import com.github.s7connector.api.factory.S7ConnectorFactory; |
||||
import com.mh.user.utils.ExchangeStringUtil; |
||||
import lombok.Data; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.util.regex.Matcher; |
||||
import java.util.regex.Pattern; |
||||
|
||||
/** |
||||
* S7 PLC通信工具类 |
||||
* 支持M、VB、VW、VD等地址类型的读写操作 |
||||
*/ |
||||
@Slf4j |
||||
public class S7ConnectorUtil { |
||||
|
||||
private S7Connector connector; |
||||
private String ipAddress; |
||||
private int rack; |
||||
private int slot; |
||||
|
||||
/** |
||||
* 构造函数 - 初始化S7连接 |
||||
* |
||||
* @param ipAddress PLC IP地址 |
||||
* @param rack 机架号(通常为0) |
||||
* @param slot 插槽号(通常为1) |
||||
*/ |
||||
public S7ConnectorUtil(String ipAddress, int rack, int slot) { |
||||
this.ipAddress = ipAddress; |
||||
this.rack = rack; |
||||
this.slot = slot; |
||||
connect(); |
||||
} |
||||
|
||||
/** |
||||
* 建立S7连接 |
||||
*/ |
||||
public void connect() { |
||||
try { |
||||
if (connector != null) { |
||||
disconnect(); |
||||
} |
||||
connector = S7ConnectorFactory |
||||
.buildTCPConnector() |
||||
.withHost(ipAddress) |
||||
.withRack(rack) |
||||
.withSlot(slot) |
||||
.build(); |
||||
log.info("S7 PLC连接成功: {} (rack={}, slot={})", ipAddress, rack, slot); |
||||
} catch (Exception e) { |
||||
log.error("S7 PLC连接失败: {}", ipAddress, e); |
||||
throw new RuntimeException("S7 PLC连接失败", e); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 断开S7连接 |
||||
*/ |
||||
public void disconnect() { |
||||
try { |
||||
if (connector != null) { |
||||
connector.close(); |
||||
log.info("S7 PLC连接已关闭: {}", ipAddress); |
||||
} |
||||
} catch (Exception e) { |
||||
log.error("S7 PLC断开连接异常: {}", ipAddress, e); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 根据寄存器地址读取数据 |
||||
* |
||||
* @param registerAddr 寄存器地址,如 M0.1, VB12, VW314, VD11 |
||||
* @return 读取的值 |
||||
*/ |
||||
public Object readData(String registerAddr) { |
||||
try { |
||||
AddressInfo addressInfo = parseAddress(registerAddr); |
||||
if (addressInfo == null) { |
||||
log.error("无法解析寄存器地址: {}", registerAddr); |
||||
return null; |
||||
} |
||||
|
||||
byte[] data = null; |
||||
Object result = null; |
||||
|
||||
switch (addressInfo.getArea()) { |
||||
case "M": |
||||
// M区是位存储区(Merkers/Flags),按字节读取
|
||||
data = connector.read(DaveArea.FLAGS, 0, 1, addressInfo.getByteOffset()); |
||||
if (data == null || data.length == 0) { |
||||
log.warn("读取M区数据为空: addr={}", registerAddr); |
||||
return null; |
||||
} |
||||
log.info("读取M区: addr={}, data=[{}], hex={}", |
||||
registerAddr, data[0] & 0xFF, bytesToHex(data)); |
||||
if (addressInfo.isBit()) { |
||||
// 如果是位地址,提取指定位
|
||||
boolean bitValue = getBit(data[0], addressInfo.getBitOffset()); |
||||
result = bitValue ? 1 : 0; |
||||
} else { |
||||
result = data[0] & 0xFF; |
||||
} |
||||
break; |
||||
|
||||
case "I": |
||||
// I区是输入区(Inputs),使用INPUTS
|
||||
data = connector.read(DaveArea.INPUTS, 0, 1, addressInfo.getByteOffset()); |
||||
if (data == null || data.length == 0) { |
||||
log.warn("读取I区数据为空: addr={}, 可能PLC未配置该输入点", registerAddr); |
||||
return 0; // 输入区无数据时返回0
|
||||
} |
||||
log.info("读取I区: addr={}, data=[{}], hex={}", |
||||
registerAddr, data[0] & 0xFF, bytesToHex(data)); |
||||
if (addressInfo.isBit()) { |
||||
boolean bitValue = getBit(data[0], addressInfo.getBitOffset()); |
||||
result = bitValue ? 1 : 0; |
||||
} else { |
||||
result = data[0] & 0xFF; |
||||
} |
||||
break; |
||||
|
||||
case "Q": |
||||
// Q区是输出区(Outputs),使用OUTPUTS
|
||||
data = connector.read(DaveArea.OUTPUTS, 0, 1, addressInfo.getByteOffset()); |
||||
if (data == null || data.length == 0) { |
||||
log.warn("读取Q区数据为空: addr={}, 可能PLC未配置该输出点", registerAddr); |
||||
return 0; // 输出区无数据时返回0
|
||||
} |
||||
log.info("读取Q区: addr={}, data=[{}], hex={}", |
||||
registerAddr, data[0] & 0xFF, bytesToHex(data)); |
||||
if (addressInfo.isBit()) { |
||||
boolean bitValue = getBit(data[0], addressInfo.getBitOffset()); |
||||
result = bitValue ? 1 : 0; |
||||
} else { |
||||
result = data[0] & 0xFF; |
||||
} |
||||
break; |
||||
|
||||
case "VB": |
||||
// V区字节 (DB块)
|
||||
data = connector.read(DaveArea.DB, 1, 1, addressInfo.getByteOffset()); |
||||
if (data == null || data.length == 0) { |
||||
log.warn("读取VB区数据为空: addr={}", registerAddr); |
||||
return null; |
||||
} |
||||
String string = bytesToHex(data).replace(" ", ""); |
||||
result = ExchangeStringUtil.hexToDec(string.substring(string.length() - 2)); |
||||
log.info("读取VB区: addr={}, data=[{}], hex={}", |
||||
registerAddr, data[0] & 0xFF, string); |
||||
break; |
||||
|
||||
case "VW": |
||||
// V区字(2字节) - 大端序
|
||||
data = connector.read(DaveArea.DB, 1, 2, addressInfo.getByteOffset()); |
||||
if (data == null || data.length < 2) { |
||||
log.warn("读取VW区数据为空或长度不足: addr={}", registerAddr); |
||||
return null; |
||||
} |
||||
String s = bytesToHex(data).replace(" ", ""); |
||||
// bytesToHex(data)获取最右边的2个字节
|
||||
result = ExchangeStringUtil.hexToDec(s.substring(s.length() - 4)); |
||||
log.info("读取VW区: addr={}, data=[{}, {}], hex={}, value={}", |
||||
registerAddr, data[0] & 0xFF, data[1] & 0xFF, s, result); |
||||
break; |
||||
|
||||
case "VD": |
||||
// V区双字(4字节) - 大端序浮点数
|
||||
data = connector.read(DaveArea.DB, 1, 4, addressInfo.getByteOffset()); |
||||
if (data == null || data.length < 4) { |
||||
log.warn("读取VD区数据为空或长度不足: addr={}", registerAddr); |
||||
return null; |
||||
} |
||||
String hex = bytesToHex(data).replace(" ", ""); |
||||
result = ExchangeStringUtil.hexToSingle(hex.substring(hex.length() - 8)); |
||||
log.info("读取VD区: addr={}, data=[{}, {}, {}, {}], hex={}, value={}", |
||||
registerAddr, data[0] & 0xFF, data[1] & 0xFF, data[2] & 0xFF, data[3] & 0xFF, |
||||
hex, result); |
||||
break; |
||||
|
||||
case "AIW": |
||||
// 模拟量输入字(2字节),只读,使用INPUTS - 大端序
|
||||
data = connector.read(DaveArea.INPUTS, 0, 2, addressInfo.getByteOffset()); |
||||
if (data == null || data.length < 2) { |
||||
log.warn("读取AIW区数据为空或长度不足: addr={}", registerAddr); |
||||
return 0; |
||||
} |
||||
result = bytesToWord(data); |
||||
log.info("读取AIW区: addr={}, data=[{}, {}], hex={}, value={}", |
||||
registerAddr, data[0] & 0xFF, data[1] & 0xFF, bytesToHex(data), result); |
||||
break; |
||||
|
||||
case "AQW": |
||||
// 模拟量输出字(2字节),可读写,使用OUTPUTS - 大端序
|
||||
data = connector.read(DaveArea.OUTPUTS, 0, 2, addressInfo.getByteOffset()); |
||||
if (data == null || data.length < 2) { |
||||
log.warn("读取AQW区数据为空或长度不足: addr={}", registerAddr); |
||||
return 0; |
||||
} |
||||
String aqwStr = bytesToHex(data).replace(" ",""); |
||||
result = ExchangeStringUtil.hexToDec(aqwStr.substring(aqwStr.length() - 4)); |
||||
log.info("读取AQW区: addr={}, data=[{}, {}], hex={}, value={}", |
||||
registerAddr, data[0] & 0xFF, data[1] & 0xFF, aqwStr, result); |
||||
break; |
||||
|
||||
default: |
||||
log.error("不支持的地址类型: {}", addressInfo.getArea()); |
||||
return null; |
||||
} |
||||
|
||||
log.info("读取成功: addr={}, value={}", registerAddr, result); |
||||
return result; |
||||
|
||||
} catch (Exception e) { |
||||
log.error("读取S7数据失败: {}", registerAddr, e); |
||||
return null; |
||||
} |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 根据寄存器地址写入数据 |
||||
* |
||||
* @param registerAddr 寄存器地址,如 M0.1, VB12, VW314, VD11 |
||||
* @param value 要写入的值 |
||||
*/ |
||||
public void writeData(String registerAddr, Object value) { |
||||
try { |
||||
AddressInfo addressInfo = parseAddress(registerAddr); |
||||
if (addressInfo == null) { |
||||
log.error("无法解析寄存器地址: {}", registerAddr); |
||||
return; |
||||
} |
||||
|
||||
switch (addressInfo.getArea()) { |
||||
case "M": |
||||
if (addressInfo.isBit()) { |
||||
// 写入位
|
||||
int intValue = value instanceof Number ? ((Number) value).intValue() : Integer.parseInt(value.toString()); |
||||
writeBit(DaveArea.FLAGS, 0, addressInfo.getByteOffset(), addressInfo.getBitOffset(), intValue != 0); |
||||
} else { |
||||
// 写入字节
|
||||
int intValue = value instanceof Number ? ((Number) value).intValue() : Integer.parseInt(value.toString()); |
||||
byte[] data = {(byte) (intValue & 0xFF)}; |
||||
connector.write(DaveArea.FLAGS, 0, addressInfo.getByteOffset(), data); |
||||
} |
||||
break; |
||||
case "I": |
||||
// I区是输入区,通常只读,不建议写入
|
||||
log.warn("I区是输入区,通常只读,不建议写入: {}", registerAddr); |
||||
if (addressInfo.isBit()) { |
||||
int intValue = value instanceof Number ? ((Number) value).intValue() : Integer.parseInt(value.toString()); |
||||
writeBit(DaveArea.INPUTS, 0, addressInfo.getByteOffset(), addressInfo.getBitOffset(), intValue != 0); |
||||
} else { |
||||
int intValue = value instanceof Number ? ((Number) value).intValue() : Integer.parseInt(value.toString()); |
||||
byte[] data = {(byte) (intValue & 0xFF)}; |
||||
connector.write(DaveArea.INPUTS, 0, addressInfo.getByteOffset(), data); |
||||
} |
||||
break; |
||||
case "Q": |
||||
// Q区是输出区,可读写
|
||||
if (addressInfo.isBit()) { |
||||
int intValue = value instanceof Number ? ((Number) value).intValue() : Integer.parseInt(value.toString()); |
||||
writeBit(DaveArea.OUTPUTS, 0, addressInfo.getByteOffset(), addressInfo.getBitOffset(), intValue != 0); |
||||
} else { |
||||
int intValue = value instanceof Number ? ((Number) value).intValue() : Integer.parseInt(value.toString()); |
||||
byte[] data = {(byte) (intValue & 0xFF)}; |
||||
connector.write(DaveArea.OUTPUTS, 0, addressInfo.getByteOffset(), data); |
||||
} |
||||
break; |
||||
case "VB": |
||||
// 写入字节
|
||||
int vbValue = value instanceof Number ? ((Number) value).intValue() : Integer.parseInt(value.toString()); |
||||
byte[] vbData = {(byte) (vbValue & 0xFF)}; |
||||
connector.write(DaveArea.DB, 1, addressInfo.getByteOffset(), vbData); |
||||
break; |
||||
case "VW": |
||||
// 写入字(2字节)
|
||||
int vwValue = value instanceof Number ? ((Number) value).intValue() : Integer.parseInt(value.toString()); |
||||
byte[] vwData = wordToBytes(vwValue); |
||||
connector.write(DaveArea.DB, 1, addressInfo.getByteOffset(), vwData); |
||||
break; |
||||
case "VD": |
||||
// 写入双字(4字节)
|
||||
float vdValue; |
||||
if (value instanceof Number) { |
||||
vdValue = ((Number) value).floatValue(); |
||||
} else { |
||||
vdValue = Float.parseFloat(value.toString()); |
||||
} |
||||
byte[] vdData = dwordToBytes(vdValue); |
||||
connector.write(DaveArea.DB, 1, addressInfo.getByteOffset(), vdData); |
||||
break; |
||||
case "AIW": |
||||
// AIW是模拟量输入,通常只读,不建议写入
|
||||
log.warn("AIW是模拟量输入,通常只读,不建议写入: {}", registerAddr); |
||||
int aiwValue = value instanceof Number ? ((Number) value).intValue() : Integer.parseInt(value.toString()); |
||||
byte[] aiwData = wordToBytes(aiwValue); |
||||
connector.write(DaveArea.INPUTS, 0, addressInfo.getByteOffset(), aiwData); |
||||
break; |
||||
case "AQW": |
||||
// AQW是模拟量输出,可读写
|
||||
int aqwValue = value instanceof Number ? ((Number) value).intValue() : Integer.parseInt(value.toString()); |
||||
byte[] aqwData = wordToBytes(aqwValue); |
||||
connector.write(DaveArea.OUTPUTS, 0, addressInfo.getByteOffset(), aqwData); |
||||
break; |
||||
default: |
||||
log.error("不支持的地址类型: {}", addressInfo.getArea()); |
||||
} |
||||
log.info("写入S7数据成功: {} = {}", registerAddr, value); |
||||
} catch (Exception e) { |
||||
log.error("写入S7数据失败: {}", registerAddr, e); |
||||
throw new RuntimeException("写入S7数据失败", e); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 解析寄存器地址 |
||||
* |
||||
* @param registerAddr 寄存器地址字符串 |
||||
* @return 地址信息对象 |
||||
*/ |
||||
private AddressInfo parseAddress(String registerAddr) { |
||||
if (registerAddr == null || registerAddr.isEmpty()) { |
||||
return null; |
||||
} |
||||
|
||||
AddressInfo info = new AddressInfo(); |
||||
|
||||
// 匹配纯M地址 (如 M0, M10)
|
||||
Pattern mBytePattern = Pattern.compile("^M(\\d+)$"); |
||||
Matcher mByteMatcher = mBytePattern.matcher(registerAddr.toUpperCase()); |
||||
if (mByteMatcher.find()) { |
||||
info.setArea("M"); |
||||
info.setByteOffset(Integer.parseInt(mByteMatcher.group(1))); |
||||
info.setBit(false); |
||||
return info; |
||||
} |
||||
|
||||
// 匹配M位地址 (如 M0.1, M10.5)
|
||||
Pattern mBitPattern = Pattern.compile("^M(\\d+)\\.(\\d+)$"); |
||||
Matcher mBitMatcher = mBitPattern.matcher(registerAddr.toUpperCase()); |
||||
if (mBitMatcher.find()) { |
||||
info.setArea("M"); |
||||
info.setByteOffset(Integer.parseInt(mBitMatcher.group(1))); |
||||
info.setBitOffset(Integer.parseInt(mBitMatcher.group(2))); |
||||
info.setBit(true); |
||||
return info; |
||||
} |
||||
|
||||
// 匹配I字节地址 (如 I0, I1)
|
||||
Pattern iBytePattern = Pattern.compile("^I(\\d+)$"); |
||||
Matcher iByteMatcher = iBytePattern.matcher(registerAddr.toUpperCase()); |
||||
if (iByteMatcher.find()) { |
||||
info.setArea("I"); |
||||
info.setByteOffset(Integer.parseInt(iByteMatcher.group(1))); |
||||
info.setBit(false); |
||||
return info; |
||||
} |
||||
|
||||
// 匹配I位地址 (如 I0.1, I1.5)
|
||||
Pattern iBitPattern = Pattern.compile("^I(\\d+)\\.(\\d+)$"); |
||||
Matcher iBitMatcher = iBitPattern.matcher(registerAddr.toUpperCase()); |
||||
if (iBitMatcher.find()) { |
||||
info.setArea("I"); |
||||
info.setByteOffset(Integer.parseInt(iBitMatcher.group(1))); |
||||
info.setBitOffset(Integer.parseInt(iBitMatcher.group(2))); |
||||
info.setBit(true); |
||||
return info; |
||||
} |
||||
|
||||
// 匹配Q字节地址 (如 Q0, Q1)
|
||||
Pattern qBytePattern = Pattern.compile("^Q(\\d+)$"); |
||||
Matcher qByteMatcher = qBytePattern.matcher(registerAddr.toUpperCase()); |
||||
if (qByteMatcher.find()) { |
||||
info.setArea("Q"); |
||||
info.setByteOffset(Integer.parseInt(qByteMatcher.group(1))); |
||||
info.setBit(false); |
||||
return info; |
||||
} |
||||
|
||||
// 匹配Q位地址 (如 Q0.1, Q1.5)
|
||||
Pattern qBitPattern = Pattern.compile("^Q(\\d+)\\.(\\d+)$"); |
||||
Matcher qBitMatcher = qBitPattern.matcher(registerAddr.toUpperCase()); |
||||
if (qBitMatcher.find()) { |
||||
info.setArea("Q"); |
||||
info.setByteOffset(Integer.parseInt(qBitMatcher.group(1))); |
||||
info.setBitOffset(Integer.parseInt(qBitMatcher.group(2))); |
||||
info.setBit(true); |
||||
return info; |
||||
} |
||||
|
||||
// 匹配VB地址 (如 VB12)
|
||||
Pattern vbPattern = Pattern.compile("^VB(\\d+)$"); |
||||
Matcher vbMatcher = vbPattern.matcher(registerAddr.toUpperCase()); |
||||
if (vbMatcher.find()) { |
||||
info.setArea("VB"); |
||||
info.setByteOffset(Integer.parseInt(vbMatcher.group(1))); |
||||
info.setBit(false); |
||||
return info; |
||||
} |
||||
|
||||
// 匹配VW地址 (如 VW314)
|
||||
Pattern vwPattern = Pattern.compile("^VW(\\d+)$"); |
||||
Matcher vwMatcher = vwPattern.matcher(registerAddr.toUpperCase()); |
||||
if (vwMatcher.find()) { |
||||
info.setArea("VW"); |
||||
info.setByteOffset(Integer.parseInt(vwMatcher.group(1))); |
||||
info.setBit(false); |
||||
return info; |
||||
} |
||||
|
||||
// 匹配VD地址 (如 VD11)
|
||||
Pattern vdPattern = Pattern.compile("^VD(\\d+)$"); |
||||
Matcher vdMatcher = vdPattern.matcher(registerAddr.toUpperCase()); |
||||
if (vdMatcher.find()) { |
||||
info.setArea("VD"); |
||||
info.setByteOffset(Integer.parseInt(vdMatcher.group(1))); |
||||
info.setBit(false); |
||||
return info; |
||||
} |
||||
|
||||
// 匹配AIW地址 (模拟量输入字,如 AIW0, AIW64)
|
||||
Pattern aiwPattern = Pattern.compile("^AIW(\\d+)$"); |
||||
Matcher aiwMatcher = aiwPattern.matcher(registerAddr.toUpperCase()); |
||||
if (aiwMatcher.find()) { |
||||
info.setArea("AIW"); |
||||
info.setByteOffset(Integer.parseInt(aiwMatcher.group(1))); |
||||
info.setBit(false); |
||||
return info; |
||||
} |
||||
|
||||
// 匹配AQW地址 (模拟量输出字,如 AQW0, AQW64)
|
||||
Pattern aqwPattern = Pattern.compile("^AQW(\\d+)$"); |
||||
Matcher aqwMatcher = aqwPattern.matcher(registerAddr.toUpperCase()); |
||||
if (aqwMatcher.find()) { |
||||
info.setArea("AQW"); |
||||
info.setByteOffset(Integer.parseInt(aqwMatcher.group(1))); |
||||
info.setBit(false); |
||||
return info; |
||||
} |
||||
|
||||
log.error("无法识别的寄存器地址格式: {}", registerAddr); |
||||
return null; |
||||
} |
||||
|
||||
/** |
||||
* 从字节中获取指定位的值 |
||||
*/ |
||||
private boolean getBit(byte data, int bitPosition) { |
||||
return ((data >> bitPosition) & 0x01) == 1; |
||||
} |
||||
|
||||
/** |
||||
* 字节数组转十六进制字符串(用于调试) |
||||
*/ |
||||
private String bytesToHex(byte[] data) { |
||||
if (data == null || data.length == 0) { |
||||
return ""; |
||||
} |
||||
StringBuilder sb = new StringBuilder(); |
||||
for (byte b : data) { |
||||
sb.append(String.format("%02X ", b & 0xFF)); |
||||
} |
||||
return sb.toString().trim(); |
||||
} |
||||
|
||||
/** |
||||
* 写入指定位的值 |
||||
*/ |
||||
private void writeBit(DaveArea area, int dbNumber, int byteOffset, int bitPosition, boolean value) throws Exception { |
||||
// 先读取当前字节
|
||||
byte[] currentData = connector.read(area, dbNumber, 1, byteOffset); |
||||
byte currentByte = currentData[0]; |
||||
|
||||
// 修改指定位
|
||||
if (value) { |
||||
currentByte |= (1 << bitPosition); // 置位
|
||||
} else { |
||||
currentByte &= ~(1 << bitPosition); // 复位
|
||||
} |
||||
|
||||
// 写回
|
||||
connector.write(area, dbNumber, byteOffset, new byte[]{currentByte}); |
||||
} |
||||
|
||||
/** |
||||
* 字节数组转字(2字节,无符号) |
||||
*/ |
||||
private int bytesToWord(byte[] data) { |
||||
return ((data[0] & 0xFF) << 8) | (data[1] & 0xFF); |
||||
} |
||||
|
||||
/** |
||||
* 字转字节数组(2字节) |
||||
*/ |
||||
private byte[] wordToBytes(int value) { |
||||
return new byte[]{ |
||||
(byte) ((value >> 8) & 0xFF), |
||||
(byte) (value & 0xFF) |
||||
}; |
||||
} |
||||
|
||||
/** |
||||
* 字节数组转双字(4字节,浮点数) |
||||
*/ |
||||
private float bytesToDWord(byte[] data) { |
||||
int intBits = ((data[0] & 0xFF) << 24) | |
||||
((data[1] & 0xFF) << 16) | |
||||
((data[2] & 0xFF) << 8) | |
||||
(data[3] & 0xFF); |
||||
return Float.intBitsToFloat(intBits); |
||||
} |
||||
|
||||
/** |
||||
* 双字(浮点数)转字节数组(4字节) |
||||
*/ |
||||
private byte[] dwordToBytes(float value) { |
||||
int intBits = Float.floatToIntBits(value); |
||||
return new byte[]{ |
||||
(byte) ((intBits >> 24) & 0xFF), |
||||
(byte) ((intBits >> 16) & 0xFF), |
||||
(byte) ((intBits >> 8) & 0xFF), |
||||
(byte) (intBits & 0xFF) |
||||
}; |
||||
} |
||||
|
||||
/** |
||||
* 地址信息内部类 |
||||
*/ |
||||
@Data |
||||
private static class AddressInfo { |
||||
private String area; // 区域类型: M, VB, VW, VD
|
||||
private int byteOffset; // 字节偏移
|
||||
private int bitOffset; // 位偏移(仅M区位地址使用)
|
||||
private boolean isBit; // 是否为位地址
|
||||
} |
||||
} |
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue