|
|
@@ -1,17 +1,14 @@
|
|
|
package com.zsjz.ai.common.utils;
|
|
|
|
|
|
-import cn.hutool.core.io.FileUtil;
|
|
|
import cn.hutool.core.util.ReUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.zsjz.ai.common.constants.PathConst;
|
|
|
import com.sun.jna.ptr.DoubleByReference;
|
|
|
-import com.zsjz.ai.common.constants.PathConst;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
import java.nio.file.Files;
|
|
|
import java.nio.file.Path;
|
|
|
-import java.nio.file.Paths;
|
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
|
|
|
|
/**
|
|
|
@@ -57,26 +54,21 @@ public class TowerUtils {
|
|
|
return;
|
|
|
}
|
|
|
try {
|
|
|
- String cellLocal = SystemConfManager.INSTANCE.getCellLocal();
|
|
|
- if (StrUtil.isEmpty(cellLocal)) {
|
|
|
- log.info("请先设置基站数据库路径!");
|
|
|
+ // 固定路径:基站库随程序资产放在 qingjian/system/libs/cell/ 下,
|
|
|
+ // 不再读取系统配置里的 cellLocal(配置缺失会让基站查询静默返回空结果)
|
|
|
+ Path path = PathConst.CELL_TOWER_PATH_BIN;
|
|
|
+ if (Files.notExists(path)) {
|
|
|
+ log.error("基站数据库文件不存在: {}", path);
|
|
|
FLAG.set(false);
|
|
|
return;
|
|
|
}
|
|
|
- Path path = Paths.get(cellLocal);
|
|
|
- if (Files.exists(path)) {
|
|
|
- String name = FileUtil.getName(path);
|
|
|
- if (!StrUtil.endWith(name, ".bin")) {
|
|
|
- log.info("基站数据库文件名不正确!");
|
|
|
- FLAG.set(false);
|
|
|
- return;
|
|
|
- }
|
|
|
- CellDll.INSTANCE_DLL.cell_init(cellLocal);
|
|
|
- log.info("基站数据库路径已经加载!");
|
|
|
+ int status = CellDll.INSTANCE_DLL.cell_init(path.toString());
|
|
|
+ if (status != 0) {
|
|
|
+ log.error("基站数据库初始化失败, status={}, path={}", status, path);
|
|
|
+ FLAG.set(false);
|
|
|
return;
|
|
|
}
|
|
|
- log.info("基站数据库路径不存在!");
|
|
|
- FLAG.set(false);
|
|
|
+ log.info("基站数据库已加载: {}", path);
|
|
|
} catch (Throwable t) {
|
|
|
FLAG.set(false);
|
|
|
throw t;
|