|
@@ -4,6 +4,7 @@ import cn.hutool.core.util.StrUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.fdkankan.indoor.base.constant.CmdConstant;
|
|
|
import com.fdkankan.indoor.base.constant.ConfigConstant;
|
|
|
+import com.fdkankan.indoor.base.constant.MsgCode;
|
|
|
import com.fdkankan.indoor.base.constant.TypeConstant;
|
|
|
import com.fdkankan.indoor.base.convert.*;
|
|
|
import com.fdkankan.indoor.base.exception.BaseRuntimeException;
|
|
@@ -93,6 +94,11 @@ public class InitServiceImpl implements InitService {
|
|
|
return Result.failure("场景码或路径不能为空");
|
|
|
}
|
|
|
|
|
|
+ path = "/laserData";
|
|
|
+
|
|
|
+ // step1 创建t_route表
|
|
|
+ createRoute(sceneCode, path);
|
|
|
+
|
|
|
// step3 创建poi表, 热点,默认没有
|
|
|
createPoi(sceneCode);
|
|
|
|
|
@@ -102,8 +108,7 @@ public class InitServiceImpl implements InitService {
|
|
|
// step5 创建poi_type_group表
|
|
|
createPoiTypeGroup(sceneCode);
|
|
|
|
|
|
- // step6 创建t_route表
|
|
|
- createRoute(sceneCode, path);
|
|
|
+
|
|
|
|
|
|
|
|
|
// step7 复制静态资源
|
|
@@ -221,6 +226,9 @@ public class InitServiceImpl implements InitService {
|
|
|
@Override
|
|
|
public InitEntity findById(String id) {
|
|
|
Optional<InitEntity> optional = initMapper.findById(id);
|
|
|
+ if (!optional.isPresent()){
|
|
|
+ throw new BaseRuntimeException(MsgCode.e3001, "初始化数据不存在");
|
|
|
+ }
|
|
|
return optional.get();
|
|
|
}
|
|
|
|
|
@@ -228,10 +236,8 @@ public class InitServiceImpl implements InitService {
|
|
|
path = path +"/vision.txt";
|
|
|
JSONArray jsonArray = convertToPanoInfoFor4dkk.createFilter(sceneCode, path, dto);
|
|
|
FilterEntity entity = new FilterEntity();
|
|
|
-// entity.setId(SnowFlakeUUidUtils.getUuid("FR"));
|
|
|
entity.setId(sceneCode);
|
|
|
entity.setCreateTime(LocalDateTime.now());
|
|
|
-// entity.setSceneCode(sceneCode);
|
|
|
//将array数组转换成字符串
|
|
|
List<FilterHotDto> list = JSONArray.toList(jsonArray, FilterHotDto.class);
|
|
|
entity.setData(list);
|
|
@@ -388,7 +394,7 @@ public class InitServiceImpl implements InitService {
|
|
|
private void createPoi(String sceneCode){
|
|
|
PoiEntity entity = new PoiEntity();
|
|
|
entity.setId(SnowFlakeUUidUtils.getUuid("PO"));
|
|
|
- entity.setSceneCode(sceneCode);
|
|
|
+// entity.setId(sceneCode);
|
|
|
entity.setUpdateTime(LocalDateTime.now());
|
|
|
// 默认热点为空
|
|
|
entity.setData(new ArrayList<>());
|
|
@@ -481,19 +487,26 @@ public class InitServiceImpl implements InitService {
|
|
|
private void createRoute(String sceneCode, String path){
|
|
|
List<String> list = new ArrayList<>();
|
|
|
try {
|
|
|
-// list = FileUtil.readFileByLines2(path + "/routeMap.txt");
|
|
|
- list = FileUtil.readFileByLines2(path + "/final_freespace.csv");
|
|
|
+ String routePath = path + "/final_freespace.csv";
|
|
|
+ if (!cn.hutool.core.io.FileUtil.exist(routePath)){
|
|
|
+ log.info("输入路径有误, path: {}", routePath);
|
|
|
+ throw new BaseRuntimeException(MsgCode.e3001, "final_freespace.csv路径有误,文件不存在");
|
|
|
+ }
|
|
|
+ list = FileUtil.readFileByLines2(routePath);
|
|
|
+
|
|
|
+ RouteEntity entity = new RouteEntity();
|
|
|
+// entity.setId(SnowFlakeUUidUtils.getUuid("RT"));
|
|
|
+ entity.setId(sceneCode);
|
|
|
+// entity.setSceneCode(sceneCode);
|
|
|
+ entity.setUpdateTime(LocalDateTime.now());
|
|
|
+ entity.setData(list);
|
|
|
+ routeService.save(entity);
|
|
|
+ log.info(" Route数据初始化创建完成");
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- RouteEntity entity = new RouteEntity();
|
|
|
- entity.setId(SnowFlakeUUidUtils.getUuid("RT"));
|
|
|
- entity.setSceneCode(sceneCode);
|
|
|
- entity.setUpdateTime(LocalDateTime.now());
|
|
|
- entity.setData(list);
|
|
|
- routeService.save(entity);
|
|
|
- log.info(" Route数据初始化创建完成");
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|