BuildReverseE57SceneServiceImpl.java 23 KB

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