BuildReverseE57SceneServiceImpl.java 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502
  1. package com.fdkankan.contro.mq.service.impl;
  2. import cn.hutool.core.collection.CollUtil;
  3. import cn.hutool.core.io.FileUtil;
  4. import cn.hutool.core.util.CharsetUtil;
  5. import cn.hutool.core.util.StrUtil;
  6. import cn.hutool.core.util.ZipUtil;
  7. import cn.hutool.extra.qrcode.QrCodeUtil;
  8. import cn.hutool.extra.qrcode.QrConfig;
  9. import cn.hutool.http.HttpUtil;
  10. import com.alibaba.fastjson.JSON;
  11. import com.alibaba.fastjson.JSONArray;
  12. import com.alibaba.fastjson.JSONObject;
  13. import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
  14. import com.fdkankan.common.constant.*;
  15. import com.fdkankan.common.util.FileUtils;
  16. import com.fdkankan.contro.bean.SyncLaserResultBean;
  17. import com.fdkankan.contro.constant.UserEditDataType;
  18. import com.fdkankan.contro.entity.*;
  19. import com.fdkankan.contro.mq.service.IBuildSceneService;
  20. import com.fdkankan.contro.service.*;
  21. import com.fdkankan.contro.service.impl.CommonServiceImpl;
  22. import com.fdkankan.fyun.config.FYunFileConfig;
  23. import com.fdkankan.fyun.face.FYunFileServiceInterface;
  24. import com.fdkankan.model.constants.ConstantFileName;
  25. import com.fdkankan.model.constants.ConstantFilePath;
  26. import com.fdkankan.model.constants.UploadFilePath;
  27. import com.fdkankan.model.enums.ModelTypeEnums;
  28. import com.fdkankan.model.utils.CreateHouseJsonUtil;
  29. import com.fdkankan.model.utils.CreateObjUtil;
  30. import com.fdkankan.rabbitmq.bean.BuildSceneCallMessage;
  31. import com.fdkankan.rabbitmq.bean.BuildSceneResultMqMessage;
  32. import com.fdkankan.rabbitmq.util.RabbitMqProducer;
  33. import lombok.extern.slf4j.Slf4j;
  34. import org.apache.commons.lang3.ObjectUtils;
  35. import org.springframework.beans.factory.annotation.Autowired;
  36. import org.springframework.beans.factory.annotation.Value;
  37. import org.springframework.cloud.context.config.annotation.RefreshScope;
  38. import org.springframework.stereotype.Service;
  39. import javax.annotation.Resource;
  40. import java.io.File;
  41. import java.io.IOException;
  42. import java.nio.charset.StandardCharsets;
  43. import java.util.*;
  44. /**
  45. * <p>
  46. * TODO
  47. * </p>
  48. *
  49. * @author dengsixing
  50. * @since 2022/4/20
  51. **/
  52. @Slf4j
  53. @Service
  54. @RefreshScope
  55. public class BuildReverseE57SceneServiceImpl implements IBuildSceneService {
  56. public static final String logUrlFormat = "**algorithm-log**: [%sbuild_log/%s/e57/console.log](%sbuild_log/%s/e57/console.log)";
  57. @Value("${queue.modeling.reverseE57.modeling-post:reverseE57-modeling-post}")
  58. private String queueModelingPost;
  59. @Value("#{'${build.scene.post.not-delete-nas-nums:}'.split(',')}")
  60. private List<String> notDeleteNasNumList;
  61. @Value("${queue.application.laser.e57-modeling-done:e57-modeling-done}")
  62. private String queueE57ModelingDone;
  63. @Autowired
  64. private RabbitMqProducer mqProducer;
  65. @Value("${model.type:#{null}}")
  66. private String modelType;
  67. @Resource
  68. private FYunFileServiceInterface fYunFileService;
  69. @Autowired
  70. private FYunFileConfig fYunFileConfig;
  71. @Autowired
  72. private IScenePlusService scenePlusService;
  73. @Autowired
  74. private IScenePlusExtService scenePlusExtService;
  75. @Autowired
  76. private IBuildSceneDTService buildSceneDTService;
  77. @Autowired
  78. private ICommonService commonService;
  79. @Autowired
  80. private IFdkkLaserService fdkkLaserService;
  81. @Autowired
  82. private ISceneEditControlsService sceneEditControlsService;
  83. @Override
  84. public void buildScenePre(BuildSceneCallMessage message) throws Exception{
  85. String num = message.getSceneNum();
  86. try {
  87. ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
  88. ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
  89. String dataSource = scenePlusExt.getDataSource();
  90. message.setPath(dataSource);
  91. String key = (String)message.getExt().get("path");
  92. //下载资源到本地
  93. String destPath = dataSource + "/capture/" + "input.e57";
  94. fYunFileService.downloadFileByCommand(destPath, key);
  95. //发送mq,就进行计算
  96. // message.setPath(path);
  97. message.setResultReceiverMqName(queueModelingPost);
  98. message.setBizType("reverseE57");
  99. log.info("上传e57计算资源准备结束,场景码:{}", message.getSceneNum());
  100. }catch (Exception e){
  101. log.error("上传e57计算前置处理出错,num"+num, e);
  102. buildSceneDTService.handBaseFail("上传e57计算资源准备异常!", message.getPath(), message.getSceneNum(), "计算控制服务器");
  103. throw e;
  104. }
  105. }
  106. private String getOssPath(String path) {
  107. String ossPath = ConstantFilePath.OSS_PREFIX
  108. + path.replace(ConstantFilePath.BUILD_MODEL_PATH, "")
  109. .replace(ConstantFilePath.BUILD_MODEL_LASER_PATH, "");
  110. if (!ossPath.endsWith("/")) {
  111. ossPath = ossPath.concat("/");
  112. }
  113. return ossPath;
  114. }
  115. @Override
  116. public void downLoadSource(BuildSceneCallMessage buildSceneMqMessage,String path){
  117. String ossPath = getOssPath(buildSceneMqMessage.getPath());
  118. fYunFileService.downloadFileByCommand(path + "/capture", ossPath);
  119. }
  120. @Override
  121. public void buildScenePost(BuildSceneResultMqMessage message) throws Exception {
  122. String sceneCode = message.getBuildContext().get("sceneNum").toString();
  123. String path = message.getPath();
  124. try {
  125. // 上传计算日志
  126. //如果是重复计算,没有走到计算逻辑,不需要上传日志文件
  127. log.info("开始上传计算日志");
  128. String buildLogPath = String.format(UploadFilePath.BUILD_LOG_PATH, sceneCode);
  129. fYunFileService.uploadFile(path + File.separator + "console.log", buildLogPath + "console.log");
  130. log.info("计算日志上传完成");
  131. if (!message.getBuildSuccess()) {
  132. scenePlusService.update(new LambdaUpdateWrapper<ScenePlus>()
  133. .set(ScenePlus::getSceneStatus, SceneStatus.FAILD.code())
  134. .eq(ScenePlus::getNum, sceneCode));
  135. // 发送钉钉消息,计算失败
  136. buildSceneDTService.handModelFail("计算失败", message.getPath(), sceneCode, message.getHostName());
  137. return;
  138. }
  139. ScenePlus scenePlus = scenePlusService.getScenePlusByNum(sceneCode);
  140. JSONObject fdageData = new JSONObject();
  141. fdageData.put("exportMeshObj", 1);
  142. Map<String, String> uploadFiles = commonService.getUploadFiles(scenePlus,path,14,fdageData);
  143. String rebuild = message.getRebuild();
  144. //新拍场景默认是已支付状态,补拍、重算的场景,支付状态无需改变
  145. if("0".equals(rebuild)){
  146. log.info("是新拍");
  147. scenePlus.setPayStatus(PayStatus.PAY.code());
  148. }
  149. scenePlus.setUpdateTime(new Date());
  150. scenePlus.setSceneStatus(SceneStatus.NO_DISPLAY.code());
  151. Integer videoVersion = fdageData.getInteger("videoVersion");
  152. //读取计算结果文件生成videosJson
  153. JSONObject videosJson = null;
  154. ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
  155. boolean isObj = fdageData.containsKey("exportMeshObj") && fdageData.getIntValue("exportMeshObj") == 1;
  156. //上传全景图俯视图
  157. this.uploadFloorCad(path, sceneCode, uploadFiles);
  158. log.info("开始上传场景计算结果数据,num:{}", sceneCode);
  159. //由于3dtiles算法mesh文件发生变化,所以这里需要先清除一下oss的mesh目录,避免存在旧算法obj文件
  160. fYunFileService.deleteFolder(String.format(UploadFilePath.DATA_VIEW_PATH, sceneCode) + "mesh");
  161. fYunFileService.deleteFolder(String.format(UploadFilePath.IMG_VIEW_PATH, sceneCode) + ModelKind.THREE_D_TILE.code());
  162. //上传文件
  163. fYunFileService.uploadMulFiles(uploadFiles);
  164. //修改oss上dam的内容编码
  165. Map<String,String> damFileHeaders = new HashMap<>();
  166. damFileHeaders.put("Content-Encoding","gzip");
  167. String damPath = path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam";
  168. fYunFileService.uploadFile(damPath, String.format(UploadFilePath.IMG_VIEW_PATH, sceneCode) + ConstantFileName.modelUUID + "_50k.dam", damFileHeaders);
  169. //拷贝部分文件到编辑目录,用于用户编辑
  170. this.copyToEditDir(sceneCode);
  171. //计算完毕后,同步全景图到缓存目录
  172. // this.cachePanorama(path, sceneCode);
  173. //生成houseTypejson并上传
  174. boolean existHouseType = this.uploadHouseTypeJson(sceneCode, path);
  175. scenePlus.setHouseType(existHouseType ? CommonStatus.YES.code().intValue() : CommonStatus.NO.code().intValue());
  176. //生成floorpan.json
  177. commonService.uploadFloorplanJson(sceneCode, path);
  178. //重置异步操作记录
  179. commonService.removeSceneAsynOperLog(sceneCode);
  180. //清除用户编辑业务数据
  181. Set<String> bizs = new HashSet<>();
  182. bizs.add(UserEditDataType.BOX_MODEL.message());
  183. bizs.add(UserEditDataType.FLOORPLAN.message());
  184. bizs.add(UserEditDataType.FILTERS.message());
  185. commonService.initUserEditData(sceneCode, bizs, null);
  186. //上传计算结果文件
  187. commonService.uploadBuildResultData(sceneCode, path, SceneVersionType.V4.code());
  188. //容量统计
  189. Long space = commonService.getSpace(sceneCode);
  190. //写入数据库
  191. this.updateDbPlus(scenePlus.getSceneSource(), space, videosJson.toJSONString(), message.getComputeTime(),isObj,scenePlusExt);
  192. Object[] editInfoArr = commonService.updateEditInfo(scenePlus);
  193. SceneEditInfo sceneEditInfo = (SceneEditInfo)editInfoArr[0];
  194. SceneEditInfoExt sceneEditInfoExt = (SceneEditInfoExt)editInfoArr[1];
  195. SceneEditControls sceneEditControls = (SceneEditControls)editInfoArr[2];
  196. //更新场景主表
  197. //如果相机容量不足,需要把场景的paystatus改为容量不足状态
  198. // scenePlus.setPayStatus(commonService.getPayStatus(scenePlus.getCameraId(), space));
  199. //统计原始资源大小
  200. scenePlusExt.setOrigSpace(FileUtil.size(new File(path.concat(File.separator).concat("capture"))));
  201. String visionTxt = FileUtil.readUtf8String(path + "/results/vision.txt");
  202. JSONObject visionObj = JSON.parseObject(visionTxt);
  203. JSONArray sweepLocations = visionObj.getJSONArray("sweepLocations");
  204. scenePlusExt.setShootCount(sweepLocations.size());
  205. String laserPath = fdkkLaserService.syncBuildResult4E57(path);
  206. fdkkLaserService.sendE57ToLaser(scenePlus, scenePlusExt, laserPath);
  207. sceneEditControlsService.update(new LambdaUpdateWrapper<SceneEditControls>().set(SceneEditControls::getShowMap,0)
  208. .eq(SceneEditControls::getEditInfoId,sceneEditInfo.getId()));
  209. sceneEditControls.setShowMap(0);
  210. log.info("生成scene.json上传oss并设置缓存,num:{}", sceneCode);
  211. //写scene.json
  212. commonService.writeSceneJson(sceneCode,sceneEditInfo, sceneEditInfoExt, sceneEditControls, scenePlus,scenePlusExt, null);
  213. createQrCode(sceneCode, scenePlusExt, null);
  214. this.uploadStatusJson(scenePlus, scenePlusExt);
  215. scenePlusService.updateById(scenePlus);
  216. scenePlusExtService.updateById(scenePlusExt);
  217. log.info("场景计算结果处理结束,场景码:{}", sceneCode);
  218. }catch (Exception e){
  219. log.error("场景计算结果处理出错,num"+sceneCode, e);
  220. buildSceneDTService.handBaseFail("场景计算结果处理出错!", message.getPath(), sceneCode, "计算控制服务器");
  221. throw e;
  222. }
  223. }
  224. public boolean uploadHouseTypeJson(String num, String dataSource) {
  225. String floorPlanCardFilePath = dataSource + File.separator + "results/floorplan_cad.json";
  226. if (!new File(floorPlanCardFilePath).exists()) {
  227. log.warn("floorplan_cad.json 文件不存在,文件路径:{}", floorPlanCardFilePath);
  228. return false;
  229. }
  230. JSONObject json = CreateHouseJsonUtil.createHouseTypeJsonByCad(floorPlanCardFilePath);
  231. if(Objects.isNull(json)){
  232. return false;
  233. }
  234. String hourseTypeJsonPath = String.format(UploadFilePath.USER_VIEW_PATH, num) + "houseType.json";
  235. fYunFileService.uploadFile(json.toJSONString().getBytes(), hourseTypeJsonPath);
  236. hourseTypeJsonPath = String.format(UploadFilePath.USER_EDIT_PATH, num) + "houseType.json";
  237. fYunFileService.uploadFile(json.toJSONString().getBytes(), hourseTypeJsonPath);
  238. return true;
  239. }
  240. private void updateDbPlus(int sceneSource,Long space,String videosJson, Long computeTime,boolean isObj,ScenePlusExt scenePlusExt){
  241. scenePlusExt.setSpace(space);
  242. scenePlusExt.setComputeTime(computeTime.toString());
  243. scenePlusExt.setAlgorithmTime(new Date());
  244. scenePlusExt.setVideos(videosJson);
  245. scenePlusExt.setIsObj(isObj ? 1 : 0);
  246. if(ModelTypeEnums.TILE_CODE.equals(modelType)){
  247. scenePlusExt.setSceneScheme(3);
  248. }
  249. switch (SceneSource.get(sceneSource)){
  250. case BM:
  251. scenePlusExt.setSceneResolution(SceneResolution.two_K.code());
  252. scenePlusExt.setSceneFrom(SceneFrom.PRO.code());
  253. break;
  254. case SM:
  255. scenePlusExt.setSceneResolution(SceneResolution.one_k.code());
  256. scenePlusExt.setSceneFrom(SceneFrom.LITE.code());
  257. break;
  258. case ZT:
  259. scenePlusExt.setSceneResolution(SceneResolution.four_K.code());
  260. scenePlusExt.setSceneFrom(SceneFrom.MINION.code());
  261. break;
  262. case JG:
  263. scenePlusExt.setSceneResolution(SceneResolution.four_K.code());
  264. scenePlusExt.setSceneFrom(SceneFrom.LASER.code());
  265. break;
  266. case SG:
  267. scenePlusExt.setSceneResolution(SceneResolution.four_K.code());
  268. scenePlusExt.setSceneFrom(SceneFrom.LASER.code());
  269. break;
  270. }
  271. String sceneKind = scenePlusExt.getSceneScheme() == 3 ? SceneKind.FACE.code():SceneKind.TILES.code();
  272. scenePlusExt.setSceneKind(sceneKind);
  273. // scenePlusExt.setModelKind(modelKind);
  274. //统计点位数量
  275. scenePlusExtService.updateById(scenePlusExt);
  276. }
  277. private void copyToEditDir(String num) throws IOException {
  278. String editImagesPath = String.format(UploadFilePath.IMG_EDIT_PATH, num);
  279. String viewImagesPath = String.format(UploadFilePath.IMG_VIEW_PATH, num);
  280. String editDataPath = String.format(UploadFilePath.DATA_EDIT_PATH, num);
  281. String viewDataPath = String.format(UploadFilePath.DATA_VIEW_PATH, num);
  282. Map<String, String> map = new HashMap<>();
  283. map.put(editImagesPath + "vision.modeldata", viewImagesPath + "vision.modeldata");
  284. map.put(editImagesPath + "vision2.modeldata", viewImagesPath + "vision2.modeldata");
  285. map.put(editDataPath + "floorplan_cad.json", viewDataPath + "floorplan_cad.json");
  286. for (Map.Entry<String, String> entry : map.entrySet()) {
  287. fYunFileService.copyFileInBucket(entry.getValue(), entry.getKey());
  288. }
  289. }
  290. private void createQrCode(String num, ScenePlusExt scenePlusExt, String qrLogo) {
  291. String localLogoPath = null;
  292. if (!ObjectUtils.isEmpty(qrLogo)) {
  293. try {
  294. localLogoPath = ConstantFilePath.AGENT_PATH + qrLogo.substring(qrLogo.lastIndexOf("//") + 1);
  295. HttpUtil.downloadFile(qrLogo, localLogoPath);
  296. } catch (Exception e) {
  297. log.error("公司logo下载失败:{}", qrLogo);
  298. localLogoPath = null;
  299. }
  300. }
  301. //生成二维码
  302. String outPathZh = ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+ num +".png";
  303. String outPathEn = ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+ num +"_en.png";
  304. QrConfig qrConfig = QrConfig.create();
  305. qrConfig.setWidth(1024);
  306. qrConfig.setHeight(1024);
  307. if(StrUtil.isNotEmpty(localLogoPath)){
  308. qrConfig.setImg(localLogoPath);
  309. }
  310. QrCodeUtil.generate(scenePlusExt.getWebSite(), qrConfig, FileUtil.file(outPathZh));
  311. QrCodeUtil.generate(scenePlusExt.getWebSite() + "&lang=en", qrConfig, FileUtil.file(outPathEn));
  312. //上传二维码
  313. fYunFileService.uploadFile(outPathZh, String.format(UploadFilePath.DOWNLOADS_QRCODE, num) + num + ".png");
  314. fYunFileService.uploadFile(outPathEn, String.format(UploadFilePath.DOWNLOADS_QRCODE, num) + num + "_en.png");
  315. if(!ObjectUtils.isEmpty(localLogoPath)){
  316. FileUtils.deleteFile(localLogoPath);
  317. }
  318. }
  319. private void uploadFloorCad(String path, String num, Map<String, String> uploadFiles){
  320. //户型图上传
  321. String dataViewPath = UploadFilePath.DATA_VIEW_PATH + "floor-cad-%s.%s";
  322. String floorCadPath = path + "/results/floorplan_cad";
  323. List<String> floorCadList = FileUtils.getFileList(floorCadPath);
  324. if(CollUtil.isNotEmpty(floorCadList)){
  325. floorCadList.stream().forEach(str->{
  326. String substring = str.substring(str.lastIndexOf(File.separator) + 1);
  327. String[] arr = substring.split("floor");
  328. String[] arr2 = arr[1].split("\\.");
  329. uploadFiles.put(str, String.format(dataViewPath, num, arr2[0], arr2[1]));
  330. });
  331. }
  332. }
  333. private void uploadStatusJson(ScenePlus scenePlus, ScenePlusExt scenePlusExt){
  334. String num = scenePlus.getNum();
  335. String dataViewPath = String.format(UploadFilePath.DATA_VIEW_PATH, num);
  336. Integer status = 0;
  337. // 上传status JSON.
  338. JSONObject statusJson = new JSONObject();
  339. //临时将-2改成1,app还没完全更新
  340. statusJson.put("status", status);
  341. statusJson.put("webSite", scenePlusExt.getWebSite());
  342. statusJson.put("sceneNum", num);
  343. statusJson.put("thumb", scenePlusExt.getThumb());
  344. statusJson.put("payStatus", scenePlus.getPayStatus());
  345. statusJson.put("sceneScheme", scenePlusExt.getSceneScheme());
  346. FileUtils.writeFile(ConstantFilePath.SCENE_PATH + "data/data" + num + File.separator + "status.json", statusJson.toString());
  347. fYunFileService.uploadFile(statusJson.toJSONString().getBytes(StandardCharsets.UTF_8), dataViewPath + "status.json");
  348. }
  349. private Map<String, String> getUploadFiles(ScenePlus scenePlus,String path) throws Exception {
  350. if (ObjectUtils.isEmpty(scenePlus)) {
  351. throw new Exception("未找到场景信息:" + path);
  352. }
  353. String projectNum = scenePlus.getNum();
  354. String dataViewPath = String.format(UploadFilePath.DATA_VIEW_PATH, projectNum);
  355. String imagesPath = String.format(UploadFilePath.IMG_VIEW_PATH, projectNum);
  356. String videoPath = String.format(UploadFilePath.VIDEOS_VIEW_PATH, projectNum);
  357. String resultsPath = path + File.separator + "results" + File.separator;
  358. String uploadData = FileUtils.readFile(resultsPath + "upload.json");
  359. JSONArray array = JSONObject.parseObject(uploadData).getJSONArray("upload");
  360. JSONObject fileJson = null;
  361. String fileName = "";
  362. Map<String, String> map = new HashMap();
  363. for (int i = 0; i < array.size(); ++i) {
  364. fileJson = array.getJSONObject(i);
  365. fileName = fileJson.getString("file");
  366. String filePath = resultsPath + fileName;
  367. if (!(new File(filePath)).exists()) {
  368. throw new Exception(filePath + "文件不存在");
  369. }
  370. if ("vision2.txt".equals(fileName)) {
  371. CreateObjUtil.convertTxtToVisionmodeldata(resultsPath + "vision2.txt", resultsPath + "vision2.modeldata");
  372. map.put(resultsPath + "vision2.modeldata", imagesPath + "vision2.modeldata");
  373. map.put(resultsPath + "vision2.txt", imagesPath + "vision2.txt");
  374. }
  375. if (fileJson.getIntValue("clazz") == 2) {
  376. map.put(filePath, imagesPath + ConstantFileName.modelUUID + "_50k_texture_jpg_high1/" + fileName.replace("tex/", ""));
  377. } else if (fileJson.getIntValue("clazz") == 3) {
  378. map.put(filePath, imagesPath + "pan/high/" + fileName.replace("high/", ""));
  379. } else if (fileJson.getIntValue("clazz") == 4) {
  380. map.put(filePath, imagesPath + "pan/low/" + fileName.replace("low/", ""));
  381. } else if (fileJson.getIntValue("clazz") == 5) {
  382. map.put(filePath, imagesPath + fileName);
  383. } else if (fileJson.getIntValue("clazz") == 7) {
  384. map.put(filePath, imagesPath + fileName);
  385. } else if (fileJson.getIntValue("clazz") == 10) {
  386. String updown = FileUtils.readFile(filePath);
  387. JSONObject updownJson = JSONObject.parseObject(updown);
  388. String mappingOssPath = String.format("scene_edit_data/%s/data/", projectNum) + fileName.replace("updown", "mapping");
  389. map.put(filePath, mappingOssPath);
  390. } else {
  391. if (fileJson.getIntValue("clazz") == 11 || fileJson.getIntValue("clazz") == 12) {
  392. map.put(filePath, videoPath + fileName.replace("videos/", ""));
  393. if (fileName.contains(".mp4")) {
  394. map.put(resultsPath + fileName.replace("mp4", "flv"), videoPath + fileName.replace("videos/", "").replace("mp4", "flv"));
  395. }
  396. }
  397. if (fileJson.getIntValue("clazz") == 16) {
  398. map.put(filePath, dataViewPath + fileName);
  399. }
  400. if (fileJson.getIntValue("clazz") == 18) {
  401. map.put(filePath, imagesPath + fileName);
  402. }
  403. }
  404. }
  405. CreateObjUtil.convertTxtToVisionmodeldata(resultsPath + "vision.txt", resultsPath + "vision.modeldata");
  406. map.put(resultsPath + "vision.txt", imagesPath + "vision.txt");
  407. map.put(resultsPath + "vision.modeldata", imagesPath + "vision.modeldata");
  408. log.info("数据转换完成:" + projectNum);
  409. if(!new File("/mnt/4Dkankan/scene/data" + File.separator + "data" + projectNum).exists()){
  410. FileUtil.mkdir("/mnt/4Dkankan/scene/data" + File.separator + "data" + projectNum);
  411. }
  412. // map.put(resultsPath + "floorplan.json", dataViewPath + "floor.json");
  413. map.put(resultsPath + "floorplan_cad.json", dataViewPath + "floorplan_cad.json");
  414. map.put(path + File.separator + "capture/stitch_params.txt", dataViewPath + "stitch_params.txt");
  415. map.put(path + File.separator + "capture/Up.xml", dataViewPath + "Up.xml");
  416. map.put(path + File.separator + "capture/Up2.xml", dataViewPath + "Up2.xml");
  417. map.put(path + File.separator + "capture/Up.txt", dataViewPath + "Up.txt");
  418. map.put(path + File.separator + "capture/Up2.txt", dataViewPath + "Up2.txt");
  419. return map;
  420. }
  421. }