feat(device): 新增报警类型枚举并优化设备指令处理逻辑
- 新增 AlarmTypeEnum 枚举类,定义 SOS 和静止报警类型 -优化 AppAuthController 中版本信息解析逻辑,增强空值处理 - 统一设备指令接口参数类型为 DeviceXinghanInstructDto - 在 DeviceXinghanBizService 中实现 SOS 报警创建逻辑 -重构 XinghanDeviceDataRule 报警处理流程,使用统一枚举类型- 添加蓝牙模式下 SOS 指令的特殊处理逻辑- 完善报警 Redis 缓存键构建和续期机制
This commit is contained in:
@ -263,18 +263,21 @@ public class AppAuthController {
|
||||
@GetMapping("/version")
|
||||
public R<List<SysDictDataVo>> getAppVersion() {
|
||||
List<SysDictDataVo> list = dictTypeService.selectDictDataByType("app_version");
|
||||
|
||||
list.forEach(d -> {
|
||||
String[] arr = d.getRemark().split("\\|");
|
||||
d.setDictLabel(d.getDictLabel()); // ios/android
|
||||
d.setDictValue(arr[0]); // 版本号
|
||||
d.setRemark(arr[1]); // 下载地址
|
||||
// 1. 安全拆分
|
||||
String[] arr = d.getRemark() == null ? new String[0] : d.getRemark().split("\\|");
|
||||
if (arr.length < 2) { // 格式不对
|
||||
log.warn("字典数据 app_version 格式非法:dictLabel={}, remark={}", d.getDictLabel(), d.getRemark());
|
||||
d.setDictValue(""); // 或者 d.setDictValue(d.getDictValue());
|
||||
d.setRemark(""); // 下载地址留空
|
||||
return; // 跳过
|
||||
}
|
||||
// 2. 正常赋值
|
||||
d.setDictValue(arr[0].trim()); // 版本号
|
||||
d.setRemark(arr[1].trim()); // 下载地址
|
||||
});
|
||||
// 只保留方法体:筛选 label=ios 且版本号 ≥ 2.5.0 的列表
|
||||
// List<SysDictDataVo> result = list.stream()
|
||||
// .peek(d -> { String[] a = d.getRemark().split("\\|"); d.setDictValue(a[0]); d.setRemark(a[1]); })
|
||||
// .filter(d -> "ios".equalsIgnoreCase(d.getDictLabel()))
|
||||
// .filter(d -> VersionComparator.INSTANCE.compare(d.getDictValue(), "2.5.0") >= 0)
|
||||
// .toList();
|
||||
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user