|
@@ -297,8 +297,11 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
String editDataPath = String.format(UploadFilePath.DATA_EDIT_PATH, num);
|
|
String editDataPath = String.format(UploadFilePath.DATA_EDIT_PATH, num);
|
|
String editUserPath = String.format(UploadFilePath.USER_EDIT_PATH, num);
|
|
String editUserPath = String.format(UploadFilePath.USER_EDIT_PATH, num);
|
|
String localDataPath = String.format(ConstantFilePath.DATABUFFER_FORMAT, num);
|
|
String localDataPath = String.format(ConstantFilePath.DATABUFFER_FORMAT, num);
|
|
|
|
+ String floorCadUrl = prefixAli + editDataPath + "floorplan_cad.json?t=" + System.currentTimeMillis();
|
|
|
|
+ String floorUserUrl = prefixAli + editUserPath + "floorplan_user.json?t=" + System.currentTimeMillis();
|
|
|
|
|
|
JSONObject fileInfoJson = JSON.parseObject(param.getData());
|
|
JSONObject fileInfoJson = JSON.parseObject(param.getData());
|
|
|
|
+ String filePathStr = null;
|
|
|
|
|
|
String floors = fileInfoJson.getString("floors");
|
|
String floors = fileInfoJson.getString("floors");
|
|
String cadInfo = fileInfoJson.getString("cadInfo");
|
|
String cadInfo = fileInfoJson.getString("cadInfo");
|
|
@@ -306,49 +309,55 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
String filePaths = fileInfoJson.getString("filePaths");
|
|
String filePaths = fileInfoJson.getString("filePaths");
|
|
Byte reSet = fileInfoJson.getByte("reset");
|
|
Byte reSet = fileInfoJson.getByte("reset");
|
|
|
|
|
|
|
|
+ //户型图文件路径
|
|
|
|
+ if(StrUtil.isNotEmpty(filePaths)){
|
|
|
|
+ cn.hutool.json.JSONArray filePathsArrs = JSONUtil.parseArray(filePaths);
|
|
|
|
+ List<String> filePathsList = filePathsArrs.toList(String.class);
|
|
|
|
+ StringBuilder filePathBuilder = new StringBuilder();
|
|
|
|
+ filePathsList.parallelStream().forEach(path -> {
|
|
|
|
+ filePathBuilder.append(",").append(path);
|
|
|
|
+ });
|
|
|
|
+ filePathStr = filePathBuilder.substring(1);
|
|
|
|
+ }
|
|
|
|
|
|
- String filePathStr = null;
|
|
|
|
- //如果floors不为空,只需要根据对应楼层id修改楼层名称
|
|
|
|
- if(StrUtil.isNotEmpty(floors)){
|
|
|
|
- //从编辑目录中下载floorplan_cad.json、floorplan_user.json到本地
|
|
|
|
- String floorCadUrl = prefixAli + editDataPath + "floorplan_cad.json?t=" + System.currentTimeMillis();
|
|
|
|
- String floorUserUrl = prefixAli + editUserPath + "floorplan_user.json?t=" + System.currentTimeMillis();
|
|
|
|
- //如果是云存储,将vision.modeldata下载到本地,如果是本地存储,场景计算完就已经将这个文件拷贝到编辑目录了存在这个文件了,不需要再下载
|
|
|
|
- if(!StorageType.LOCAL.code().equals(this.type)){// TODO: 2022/2/15 这里有可能有问题,可能还需要考虑本地部署的情况
|
|
|
|
|
|
+ //处理户型图数据
|
|
|
|
+ if(StrUtil.isNotEmpty(floors)) {
|
|
|
|
+ //如果入参是空,则加载服务器的
|
|
|
|
+ if(StrUtil.isEmpty(floorJsonData)){
|
|
|
|
+
|
|
|
|
+ if (!StorageType.LOCAL.code().equals(this.type)) {// TODO: 2022/2/15 这里有可能有问题,可能还需要考虑本地部署的情况
|
|
|
|
+ FileUtils.downLoadFromUrl(floorUserUrl, "floorplan_user.json", localDataPath);
|
|
|
|
+ }
|
|
|
|
+ floorJsonData = FileUtils.readFile(localDataPath + "floorplan_user.json");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //如果floors不为空,需要根据对应楼层id修改楼层名称
|
|
|
|
+ if (StrUtil.isNotEmpty(floorJsonData)) {
|
|
|
|
+ JSONObject floorUserJson = this.updateFloorName(floors, floorJsonData);
|
|
|
|
+ floorJsonData = floorUserJson.toJSONString();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //上传floorplan_user.json文件
|
|
|
|
+ FileUtils.writeFile(localDataPath + "floorplan_user.json", floorJsonData);
|
|
|
|
+ uploadToOssUtil.upload(localDataPath + "floorplan_user.json", editUserPath + "floorplan_user.json");
|
|
|
|
+
|
|
|
|
+ //如果floors不为空,需要根据对应楼层id修改楼层名称
|
|
|
|
+ if(StrUtil.isNotEmpty(floors)) {
|
|
|
|
+
|
|
|
|
+ if (!StorageType.LOCAL.code().equals(this.type)) {// TODO: 2022/2/15 这里有可能有问题,可能还需要考虑本地部署的情况
|
|
FileUtils.downLoadFromUrl(floorCadUrl, "floorplan_cad.json", localDataPath);
|
|
FileUtils.downLoadFromUrl(floorCadUrl, "floorplan_cad.json", localDataPath);
|
|
- FileUtils.downLoadFromUrl(floorUserUrl, "floorplan_user.json", localDataPath);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
String floorCadStr = FileUtils.readFile(localDataPath + "floorplan_cad.json");
|
|
String floorCadStr = FileUtils.readFile(localDataPath + "floorplan_cad.json");
|
|
- if(StrUtil.isNotEmpty(floorCadStr)){
|
|
|
|
|
|
+ if (StrUtil.isNotEmpty(floorCadStr)) {
|
|
JSONObject floorCadJson = this.updateFloorName(floors, floorCadStr);
|
|
JSONObject floorCadJson = this.updateFloorName(floors, floorCadStr);
|
|
FileUtils.writeFile(localDataPath + "floorplan_cad.json", floorCadJson.toString());
|
|
FileUtils.writeFile(localDataPath + "floorplan_cad.json", floorCadJson.toString());
|
|
- uploadToOssUtil.upload(localDataPath + "floorplan_cad.json", editDataPath+"floorplan_cad.json");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- String floorUserStr = FileUtils.readFile(localDataPath + "floorplan_user.json");
|
|
|
|
- if(StrUtil.isNotEmpty(floorUserStr)) {
|
|
|
|
- JSONObject floorUserJson = this.updateFloorName(floors, floorUserStr);
|
|
|
|
- FileUtils.writeFile(localDataPath + "floorplan_user.json", floorUserJson.toString());
|
|
|
|
- uploadToOssUtil.upload(localDataPath + "floorplan_user.json",editUserPath + "floorplan_user.json");
|
|
|
|
- }
|
|
|
|
- }else{
|
|
|
|
- //户型图文件路径
|
|
|
|
- if(StrUtil.isNotEmpty(filePaths)){
|
|
|
|
- cn.hutool.json.JSONArray filePathsArrs = JSONUtil.parseArray(filePaths);
|
|
|
|
- List<String> filePathsList = filePathsArrs.toList(String.class);
|
|
|
|
- StringBuilder filePathBuilder = new StringBuilder();
|
|
|
|
- filePathsList.parallelStream().forEach(path -> {
|
|
|
|
- filePathBuilder.append(",").append(path);
|
|
|
|
- });
|
|
|
|
- filePathStr = filePathBuilder.substring(1);
|
|
|
|
|
|
+ uploadToOssUtil.upload(localDataPath + "floorplan_cad.json",editDataPath + "floorplan_cad.json");
|
|
}
|
|
}
|
|
|
|
|
|
- //上传houst_floor.json文件
|
|
|
|
- FileUtils.writeFile(localDataPath + "floorplan_user.json", floorJsonData);
|
|
|
|
- uploadToOssUtil.upload(localDataPath + "floorplan_user.json", editUserPath + "floorplan_user.json");
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
//写入数据库
|
|
//写入数据库
|
|
Byte floorPlanUser = null;
|
|
Byte floorPlanUser = null;
|
|
if(StrUtil.isNotEmpty(floorJsonData)){
|
|
if(StrUtil.isNotEmpty(floorJsonData)){
|