BuildSceneServiceImpl.java 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933
  1. package com.fdkankan.contro.mq.service.impl;
  2. import cn.hutool.core.bean.BeanUtil;
  3. import cn.hutool.core.collection.CollUtil;
  4. import cn.hutool.core.io.FileUtil;
  5. import cn.hutool.core.io.file.FileNameUtil;
  6. import cn.hutool.core.util.StrUtil;
  7. import cn.hutool.core.util.ZipUtil;
  8. import cn.hutool.extra.qrcode.QrCodeUtil;
  9. import cn.hutool.extra.qrcode.QrConfig;
  10. import cn.hutool.http.HttpUtil;
  11. import com.alibaba.fastjson.JSON;
  12. import com.alibaba.fastjson.JSONArray;
  13. import com.alibaba.fastjson.JSONObject;
  14. import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  15. import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
  16. import com.fdkankan.common.constant.*;
  17. import com.fdkankan.common.util.FileUtils;
  18. import com.fdkankan.contro.bean.SceneJsonBean;
  19. import com.fdkankan.contro.constant.UserEditDataType;
  20. import com.fdkankan.contro.entity.*;
  21. import com.fdkankan.contro.mq.service.IBuildSceneService;
  22. import com.fdkankan.contro.service.*;
  23. import com.fdkankan.contro.vo.SceneEditControlsVO;
  24. import com.fdkankan.fyun.config.FYunFileConfig;
  25. import com.fdkankan.fyun.constant.FYunTypeEnum;
  26. import com.fdkankan.fyun.face.FYunFileServiceInterface;
  27. import com.fdkankan.model.constants.ConstantFileName;
  28. import com.fdkankan.model.constants.ConstantFilePath;
  29. import com.fdkankan.model.constants.UploadFilePath;
  30. import com.fdkankan.model.enums.ModelTypeEnums;
  31. import com.fdkankan.model.utils.CreateHouseJsonUtil;
  32. import com.fdkankan.model.utils.CreateObjUtil;
  33. import com.fdkankan.push.config.PushMessageConfig;
  34. import com.fdkankan.push.utils.PushMsgUtil;
  35. import com.fdkankan.rabbitmq.bean.BuildSceneCallMessage;
  36. import com.fdkankan.rabbitmq.bean.BuildSceneResultMqMessage;
  37. import com.fdkankan.rabbitmq.util.RabbitMqProducer;
  38. import com.fdkankan.redis.constant.RedisKey;
  39. import com.fdkankan.redis.util.RedisUtil;
  40. import lombok.extern.slf4j.Slf4j;
  41. import org.apache.commons.lang3.ObjectUtils;
  42. import org.apache.commons.lang3.StringUtils;
  43. import org.springframework.beans.factory.annotation.Autowired;
  44. import org.springframework.beans.factory.annotation.Value;
  45. import org.springframework.stereotype.Service;
  46. import java.io.File;
  47. import java.io.IOException;
  48. import java.util.*;
  49. import java.util.Map.Entry;
  50. import java.util.stream.Collectors;
  51. /**
  52. * <p>
  53. * TODO
  54. * </p>
  55. *
  56. * @author dengsixing
  57. * @since 2022/4/20
  58. **/
  59. @Slf4j
  60. @Service
  61. public class BuildSceneServiceImpl implements IBuildSceneService {
  62. @Value("${queue.modeling.modeling-call}")
  63. private String queueModelingCall;
  64. @Value("${queue.modeling.single.modeling-call}")
  65. private String singleModelingCall;
  66. @Value("${model.type:#{null}}")
  67. private String modelType;
  68. @Value("${model.modelKind:3dtiles}")
  69. private String modelKind;
  70. @Value("#{'${model.3dtiles.sceneSource:}'.split(',')}")
  71. private List<Integer> sdTilesSceneSourceList;
  72. @Value("${env:gn}")
  73. private String env;
  74. @Value("#{'${build.scene.post.not-delete-nas-nums:}'.split(',')}")
  75. private List<String> notDeleteNasNumList;
  76. @Autowired
  77. private RabbitMqProducer mqProducer;
  78. @Autowired
  79. private FYunFileServiceInterface fYunFileService;
  80. @Autowired
  81. private ICameraDetailService cameraDetailService;
  82. @Autowired
  83. private ISceneEditInfoService sceneEditInfoService;
  84. @Autowired
  85. private ISceneEditControlsService sceneEditControlsService;
  86. @Autowired
  87. private FYunFileConfig fYunFileConfig;
  88. @Autowired
  89. private RedisUtil redisUtil;
  90. @Autowired
  91. private IScenePlusService scenePlusService;
  92. @Autowired
  93. private IScenePlusExtService scenePlusExtService;
  94. @Autowired
  95. private ISceneEditInfoExtService sceneEditInfoExtService;
  96. @Autowired
  97. private IUserIncrementService userIncrementService;
  98. @Autowired
  99. private IFdkkLaserService fdkkLaserService;
  100. @Autowired
  101. private IBuildSceneDTService buildSceneDTService;
  102. @Autowired
  103. private IIncrementTypeService incrementTypeService;
  104. @Autowired
  105. private ICompanyService companyService;
  106. @Autowired
  107. private ISceneAsynOperLogService sceneAsynOperLogService;
  108. @Autowired
  109. private ICommonService commonService;
  110. @Autowired
  111. private ISceneBuildProcessLogService sceneBuildProcessLogService;
  112. @Autowired
  113. private ISceneColdStorageService sceneColdStorageService;
  114. @Override
  115. public void buildScenePre(BuildSceneCallMessage message) throws Exception{
  116. boolean success = false;
  117. String num = message.getSceneNum();
  118. try {
  119. //重新计算时需要删除文件夹,否知使用缓存
  120. if(new File(message.getPath() + File.separator + "results").exists()){
  121. FileUtils.deleteDirectory(message.getPath() + File.separator + "results");
  122. }
  123. //由于刘强说caches会影响计算结果,所以这里删除caches
  124. if(new File(message.getPath() + File.separator + "caches").exists()){
  125. FileUtils.deleteDirectory(message.getPath() + File.separator + "caches");
  126. }
  127. //删除点位校准数据
  128. if (Objects.nonNull(message.getExt())
  129. && message.getExt().containsKey("deleteExtras")
  130. && (Boolean) message.getExt().get("deleteExtras")) {
  131. String extras = String.format(UploadFilePath.scene_result_data_path, num).concat("extras");
  132. if(CollUtil.isNotEmpty(fYunFileService.listRemoteFiles(extras))){
  133. fYunFileService.deleteFolder(extras);
  134. }
  135. }
  136. //用户相机重新全量上传,需要解冻结
  137. sceneColdStorageService.unfreeze(num, "用户相机重新全量上传", message.getPath());
  138. //根据相机类型,组装资源路径
  139. //下载资源到本地
  140. this.downLoadSource(message, message.getPath());
  141. JSONObject fdageJson = JSONObject.parseObject(FileUtils.readFile(message.getPath().concat("/capture/data.fdage")));
  142. boolean rewrite = false;
  143. // 兼容旧的数据,防止OnlyExportMeshObj标志未删除掉
  144. if (fdageJson.containsKey("OnlyExportMeshObj")) {
  145. log.info("data.fdage 包含 OnlyExportMeshObj,进行去除!");
  146. // 写入data.fdage 防止重算
  147. fdageJson.remove("OnlyExportMeshObj");
  148. String ossPath = getOssPath(message.getPath());
  149. fYunFileService.uploadFile(fdageJson.toJSONString().getBytes(), ossPath + "data.fdage");
  150. rewrite = true;
  151. }
  152. if (!ObjectUtils.isEmpty(modelType)) {
  153. // 修改dataFdage文件
  154. fdageJson.put("modelType", modelType);
  155. rewrite = true;
  156. }
  157. if (rewrite) {
  158. FileUtils.writeFile(message.getPath().concat("/capture/data.fdage"), fdageJson.toJSONString());
  159. }
  160. message.getBuildContext().put("cameraType",message.getCameraType());
  161. // 判断企业是否配置了弹性伸缩
  162. if (message.getFlexibility() == 0) {
  163. //发送mq,就进行计算
  164. mqProducer.sendByWorkQueue(queueModelingCall, message);
  165. } else {
  166. //发送mq,就进行计算
  167. mqProducer.sendByWorkQueue(singleModelingCall, message);
  168. }
  169. success = true;
  170. log.info("场景计算资源准备结束,场景码:{}", message.getSceneNum());
  171. }catch (Exception e){
  172. log.error("场景计算前置处理出错,num"+num, e);
  173. buildSceneDTService.handBaseFail("场景计算资源准备异常!", message.getPath(), message.getSceneNum(), "计算控制服务器");
  174. throw e;
  175. }
  176. }
  177. private String getOssPath(String path) {
  178. String ossPath = ConstantFilePath.OSS_PREFIX
  179. + path.replace(ConstantFilePath.BUILD_MODEL_PATH, "")
  180. .replace(ConstantFilePath.BUILD_MODEL_LASER_PATH, "");
  181. if (!ossPath.endsWith("/")) {
  182. ossPath = ossPath.concat("/");
  183. }
  184. return ossPath;
  185. }
  186. @Override
  187. public void downLoadSource(BuildSceneCallMessage buildSceneMqMessage,String path){
  188. String ossPath = getOssPath(path);
  189. fYunFileService.downloadFileByCommand(path + File.separator + "capture", ossPath);
  190. }
  191. @Override
  192. public void buildScenePost(BuildSceneResultMqMessage message) throws Exception {
  193. String sceneCode = message.getBuildContext().get("sceneNum").toString();
  194. String path = message.getPath();
  195. try {
  196. // 上传计算日志
  197. //如果是重复计算,没有走到计算逻辑,不需要上传日志文件
  198. log.info("开始上传计算日志");
  199. String buildLogPath = String.format(UploadFilePath.BUILD_LOG_PATH, sceneCode);
  200. fYunFileService.uploadFile(path + File.separator + "console.log", buildLogPath + "console.log");
  201. log.info("计算日志上传完成");
  202. if (!message.getBuildSuccess()) {
  203. log.error("建模失败,修改状态为失败状态");
  204. scenePlusService.update(new LambdaUpdateWrapper<ScenePlus>()
  205. .set(ScenePlus::getSceneStatus, SceneStatus.FAILD.code())
  206. .eq(ScenePlus::getNum, sceneCode));
  207. // 发送钉钉消息,计算失败
  208. buildSceneDTService.handModelFail("计算失败", message.getPath(), sceneCode, message.getHostName());
  209. return;
  210. }
  211. JSONObject fdageData = getFdageData(path + File.separator + "capture" +File.separator+"data.fdage");
  212. ScenePlus scenePlus = scenePlusService.getScenePlusByNum(sceneCode);
  213. Integer cameraType = Integer.parseInt(message.getBuildContext().get("cameraType").toString());
  214. Map<String, String> uploadFiles = getUploadFiles(scenePlus,path,cameraType,fdageData);
  215. scenePlus.setPayStatus(PayStatus.PAY.code());
  216. scenePlus.setUpdateTime(new Date());
  217. scenePlus.setSceneStatus(SceneStatus.NO_DISPLAY.code());
  218. Integer videoVersion = fdageData.getInteger("videoVersion");
  219. //读取计算结果文件生成videosJson
  220. JSONObject videosJson = this.getVideosJson(path, videoVersion, sceneCode, cameraType);
  221. ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
  222. boolean isObj = fdageData.containsKey("exportMeshObj") && fdageData.getIntValue("exportMeshObj") == 1;
  223. //上传全景图俯视图
  224. this.uploadFloorCad(path, sceneCode, uploadFiles);
  225. log.info("开始上传场景计算结果数据,num:{}", sceneCode);
  226. //由于3dtiles算法mesh文件发生变化,所以这里需要先清除一下oss的mesh目录,避免存在旧算法obj文件
  227. fYunFileService.deleteFolder(String.format(UploadFilePath.DATA_VIEW_PATH, sceneCode) + "mesh");
  228. //上传文件
  229. fYunFileService.uploadMulFiles(uploadFiles);
  230. //修改oss上dam的内容编码
  231. Map<String,String> damFileHeaders = new HashMap<>();
  232. damFileHeaders.put("Content-Encoding","gzip");
  233. String damPath = path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam";
  234. fYunFileService.uploadFile(damPath, String.format(UploadFilePath.IMG_VIEW_PATH, sceneCode) + ConstantFileName.modelUUID + "_50k.dam", damFileHeaders);
  235. //拷贝部分文件到编辑目录,用于用户编辑
  236. this.copyToEditDir(sceneCode);
  237. //计算完毕后,同步全景图到缓存目录
  238. // this.cachePanorama(path, sceneCode);
  239. //生成houseTypejson并上传
  240. boolean existHouseType = this.uploadHouseTypeJson(sceneCode, path);
  241. scenePlus.setHouseType(existHouseType ? CommonStatus.YES.code().intValue() : CommonStatus.NO.code().intValue());
  242. //生成floorpan.json
  243. commonService.uploadFloorplanJson(sceneCode, path);
  244. //重置异步操作记录
  245. this.removeSceneAsynOperLog(sceneCode);
  246. //清除用户编辑业务数据
  247. Set<String> bizs = new HashSet<>();
  248. bizs.add(UserEditDataType.BOX_MODEL.message());
  249. bizs.add(UserEditDataType.FLOORPLAN.message());
  250. commonService.initUserEditData(sceneCode, bizs, null);
  251. //上传计算结果文件
  252. commonService.uploadBuildResultData(sceneCode, path, SceneVersionType.V4.code());
  253. //容量统计
  254. Long space = commonService.getSpace(sceneCode);
  255. //写入数据库
  256. this.updateDbPlus(scenePlus.getSceneSource(), space, videosJson.toJSONString(), message.getComputeTime(),isObj,scenePlusExt);
  257. Object[] editInfoArr = this.updateEditInfo(scenePlus);
  258. SceneEditInfo sceneEditInfo = (SceneEditInfo)editInfoArr[0];
  259. SceneEditInfoExt sceneEditInfoExt = (SceneEditInfoExt)editInfoArr[1];
  260. SceneEditControls sceneEditControls = (SceneEditControls)editInfoArr[2];
  261. if (cameraType == 14) {
  262. //计算成功 激光转台相机 同步 请求
  263. fdkkLaserService.syncBuildResult(scenePlus.getNum(), path, scenePlus.getCreateTime(), Calendar.getInstance().getTime());
  264. sceneEditControlsService.update(new LambdaUpdateWrapper<SceneEditControls>().set(SceneEditControls::getShowMap,0)
  265. .eq(SceneEditControls::getEditInfoId,sceneEditInfo.getId()));
  266. sceneEditControls.setShowMap(0);
  267. } else if (new File(path + "/results/laserData/vision_edit.txt").exists()) {
  268. fdkkLaserService.cloudPointBuild(sceneCode,path);
  269. }
  270. log.info("生成scene.json上传oss并设置缓存,num:{}", sceneCode);
  271. CameraDetail cameraDetail = cameraDetailService.getByCameraId(scenePlus.getCameraId());
  272. Company company = !ObjectUtils.isEmpty(cameraDetail.getCompanyId()) ? companyService.getById(cameraDetail.getCompanyId()) : null;
  273. //写scene.json
  274. this.writeSceneJson(sceneCode, videosJson,sceneEditInfo, sceneEditInfoExt, sceneEditControls, scenePlus,scenePlusExt,company);
  275. String qrLogo = !ObjectUtils.isEmpty(company) && !ObjectUtils.isEmpty(company.getQrLogo()) ? company.getQrLogo() : null;
  276. qrLogo = ObjectUtils.isEmpty(qrLogo) && !ObjectUtils.isEmpty(sceneEditInfoExt.getShareLogoImg()) ? fYunFileConfig.getHost().concat(sceneEditInfoExt.getShareLogoImg()) : null;
  277. createQrCode(sceneCode, scenePlusExt, qrLogo);
  278. //计算成功,通知APP
  279. Integer pushChannel = fdageData.getInteger("pushChannel");
  280. String pushToken = fdageData.getString("pushToken");
  281. this.pushMsgToApp(pushChannel,pushToken, cameraType, scenePlus.getTitle(), scenePlusExt.getWebSite());
  282. //删除计算目录
  283. if(CollUtil.isEmpty(notDeleteNasNumList) || !notDeleteNasNumList.contains(sceneCode)){
  284. CreateObjUtil.deleteFile(path.replace(ConstantFilePath.BUILD_MODEL_PATH, "/"));
  285. }
  286. //更新场景主表
  287. //如果相机容量不足,需要把场景的paystatus改为容量不足状态
  288. if (cameraType != 14) {
  289. scenePlus.setPayStatus(commonService.getPayStatus(scenePlus.getCameraId(), space));
  290. }
  291. this.uploadStatusJson(scenePlus, scenePlusExt);
  292. scenePlusService.updateById(scenePlus);
  293. //国际环境需要发邮件通知
  294. if("eur".equals(env)){
  295. commonService.sendEmail(sceneCode);
  296. }
  297. log.info("场景计算结果处理结束,场景码:{}", sceneCode);
  298. }catch (Exception e){
  299. log.error("场景计算结果处理出错,num"+sceneCode, e);
  300. buildSceneDTService.handBaseFail("场景计算结果处理出错!", message.getPath(), sceneCode, "计算控制服务器");
  301. throw e;
  302. }
  303. }
  304. private void removeSceneAsynOperLog(String num){
  305. List<SceneAsynOperLog> list = sceneAsynOperLogService.list(new LambdaQueryWrapper<SceneAsynOperLog>().eq(SceneAsynOperLog::getNum, num));
  306. if(CollUtil.isEmpty(list)){
  307. return;
  308. }
  309. //删除数据库记录
  310. List<Long> deleteIdList = list.parallelStream().map(item -> item.getId()).collect(Collectors.toList());
  311. sceneAsynOperLogService.removeByIds(deleteIdList);
  312. list.parallelStream().forEach(item -> {
  313. if(StrUtil.isNotEmpty(item.getUrl())){
  314. try {
  315. fYunFileService.deleteFile(item.getUrl());
  316. } catch (IOException e) {
  317. log.warn("删除oss全景图下载压缩包失败,key:{}", item.getUrl());
  318. }
  319. }
  320. });
  321. }
  322. // private void cachePanorama(String dataSource, String num){
  323. // String cachedImagesPath = String.format(ConstantFilePath.SCENE_CACHE_IMAGES, num);
  324. // //将全景图缓存到缓存目录
  325. // List<String> imagesList = FileUtil.listFileNames(dataSource + "/caches/images");
  326. // //先清除旧的全景图
  327. // cn.hutool.core.io.FileUtil.del(cachedImagesPath);
  328. // String visionPath = dataSource + "/results/vision.txt";
  329. // List<String> panoramaImageList = SceneUtil.getPanoramaImageList(visionPath);
  330. // imagesList.stream().forEach(fileName -> {
  331. // if (panoramaImageList.contains(fileName)) {
  332. // String srcPath = dataSource + "/caches/images/" + fileName;
  333. // String targetPath = cachedImagesPath + fileName;
  334. // log.info("源文件:{}, 目标文件:{}", srcPath, targetPath);
  335. // cn.hutool.core.io.FileUtil.copy(srcPath, targetPath, true);
  336. // }
  337. // });
  338. // }
  339. private Map<String, String> getUploadFiles(ScenePlus scenePlus,String path,Integer cameraType,JSONObject fdageData) throws Exception {
  340. if (ObjectUtils.isEmpty(scenePlus)) {
  341. throw new Exception("未找到场景信息:" + path);
  342. }
  343. String projectNum = scenePlus.getNum();
  344. String dataViewPath = String.format(UploadFilePath.DATA_VIEW_PATH, projectNum);
  345. String imagesPath = String.format(UploadFilePath.IMG_VIEW_PATH, projectNum);
  346. String videoPath = String.format(UploadFilePath.VIDEOS_VIEW_PATH, projectNum);
  347. String resultsPath = path + File.separator + "results" + File.separator;
  348. String uploadData = FileUtils.readFile(resultsPath + "upload.json");
  349. JSONArray array = JSONObject.parseObject(uploadData).getJSONArray("upload");
  350. JSONObject fileJson = null;
  351. String fileName = "";
  352. Map<String, String> map = new HashMap();
  353. for (int i = 0; i < array.size(); ++i) {
  354. fileJson = array.getJSONObject(i);
  355. fileName = fileJson.getString("file");
  356. String filePath = resultsPath + fileName;
  357. if (!(new File(filePath)).exists()) {
  358. throw new Exception(filePath + "文件不存在");
  359. }
  360. if ("vision2.txt".equals(fileName)) {
  361. CreateObjUtil.convertTxtToVisionmodeldata(resultsPath + "vision2.txt", resultsPath + "vision2.modeldata");
  362. map.put(resultsPath + "vision2.modeldata", imagesPath + "vision2.modeldata");
  363. map.put(resultsPath + "vision2.txt", imagesPath + "vision2.txt");
  364. }
  365. if (fileJson.getIntValue("clazz") == 2) {
  366. map.put(filePath, imagesPath + ConstantFileName.modelUUID + "_50k_texture_jpg_high1/" + fileName.replace("tex/", ""));
  367. } else if (fileJson.getIntValue("clazz") == 3) {
  368. map.put(filePath, imagesPath + "pan/high/" + fileName.replace("high/", ""));
  369. } else if (fileJson.getIntValue("clazz") == 4) {
  370. map.put(filePath, imagesPath + "pan/low/" + fileName.replace("low/", ""));
  371. } else if (fileJson.getIntValue("clazz") == 5) {
  372. map.put(filePath, imagesPath + fileName);
  373. } else if (fileJson.getIntValue("clazz") == 7) {
  374. map.put(filePath, imagesPath + fileName);
  375. } else if (fileJson.getIntValue("clazz") == 10) {
  376. String updown = FileUtils.readFile(filePath);
  377. JSONObject updownJson = JSONObject.parseObject(updown);
  378. String mappingOssPath = String.format("scene_edit_data/%s/data/", projectNum) + fileName.replace("updown", "mapping");
  379. map.put(filePath, mappingOssPath);
  380. } else {
  381. if (fileJson.getIntValue("clazz") == 11 || fileJson.getIntValue("clazz") == 12) {
  382. map.put(filePath, videoPath + fileName.replace("videos/", ""));
  383. if (fileName.contains(".mp4")) {
  384. map.put(resultsPath + fileName.replace("mp4", "flv"), videoPath + fileName.replace("videos/", "").replace("mp4", "flv"));
  385. }
  386. }
  387. if (fileJson.getIntValue("clazz") == 16) {
  388. map.put(filePath, dataViewPath + fileName);
  389. }
  390. if (fileJson.getIntValue("clazz") == 18) {
  391. map.put(filePath, imagesPath + fileName);
  392. }
  393. }
  394. }
  395. //exportMeshObj这个是字段由app写入的
  396. boolean genModel = true;//是否生成模型 默认生成,深时场景要根据 exportMeshObj判断是否生成
  397. if(!ObjectUtils.isEmpty(cameraType)
  398. && cameraType == 14
  399. && (!fdageData.containsKey("exportMeshObj") || fdageData.getIntValue("exportMeshObj") != 1)){
  400. genModel = false;
  401. }
  402. boolean gen3dTiles = true;//是否生成3dtiles模型 默认生成
  403. if(!ModelKind.THREE_D_TILE.code().equals(modelKind)
  404. || CollUtil.isEmpty(sdTilesSceneSourceList)
  405. || !sdTilesSceneSourceList.contains(scenePlus.getSceneSource())){
  406. gen3dTiles = false;
  407. }
  408. if(genModel){
  409. if (!gen3dTiles) {
  410. String damPath = path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam";
  411. CreateObjUtil.convertTxtToDam(path + File.separator + "results" + File.separator + "tex" + File.separator + "modeldata.txt", damPath);
  412. FileUtil.writeBytes(ZipUtil.gzip(new File(damPath)), damPath);
  413. map.put(damPath, imagesPath + ConstantFileName.modelUUID + "_50k.dam");
  414. }else{
  415. List<String> list = FileUtils.list(new File(path + File.separator + "results" + File.separator + ModelKind.THREE_D_TILE.code()));
  416. if(CollUtil.isEmpty(list)){
  417. log.error("3dtiles目录异常,3dtiles地址:{}", new File(path + File.separator + "results" + File.separator + ModelKind.THREE_D_TILE.code()));
  418. throw new Exception("3dtiles目录异常");
  419. }
  420. list.stream().forEach(str->{
  421. map.put(str, str.replace(path + File.separator + "results" + File.separator, imagesPath));
  422. });
  423. }
  424. }
  425. CreateObjUtil.convertTxtToVisionmodeldata(resultsPath + "vision.txt", resultsPath + "vision.modeldata");
  426. map.put(resultsPath + "vision.txt", imagesPath + "vision.txt");
  427. map.put(resultsPath + "vision.modeldata", imagesPath + "vision.modeldata");
  428. log.info("数据转换完成:" + projectNum);
  429. if(!new File("/mnt/4Dkankan/scene/data" + File.separator + "data" + projectNum).exists()){
  430. FileUtil.mkdir("/mnt/4Dkankan/scene/data" + File.separator + "data" + projectNum);
  431. }
  432. // map.put(resultsPath + "floorplan.json", dataViewPath + "floor.json");
  433. map.put(resultsPath + "floorplan_cad.json", dataViewPath + "floorplan_cad.json");
  434. map.put(path + File.separator + "capture/stitch_params.txt", dataViewPath + "stitch_params.txt");
  435. map.put(path + File.separator + "capture/Up.xml", dataViewPath + "Up.xml");
  436. map.put(path + File.separator + "capture/Up2.xml", dataViewPath + "Up2.xml");
  437. map.put(path + File.separator + "capture/Up.txt", dataViewPath + "Up.txt");
  438. map.put(path + File.separator + "capture/Up2.txt", dataViewPath + "Up2.txt");
  439. return map;
  440. }
  441. private JSONObject getFdageData(String dataFdagePath) {
  442. log.info("dataFdagePath 文件路径 :{}", dataFdagePath);
  443. String data = FileUtils.readFile(dataFdagePath);
  444. //获取data.fdage的内容
  445. JSONObject dataJson = new JSONObject();
  446. if(data!=null){
  447. dataJson = JSONObject.parseObject(data);
  448. }
  449. return dataJson;
  450. }
  451. private void uploadFloorCad(String path, String num, Map<String, String> uploadFiles){
  452. //户型图上传
  453. String dataViewPath = UploadFilePath.DATA_VIEW_PATH + "floor-cad-%s.%s";
  454. String floorCadPath = path + "/results/floorplan_cad";
  455. List<String> floorCadList = FileUtils.getFileList(floorCadPath);
  456. if(CollUtil.isNotEmpty(floorCadList)){
  457. floorCadList.stream().forEach(str->{
  458. String substring = str.substring(str.lastIndexOf(File.separator) + 1);
  459. String[] arr = substring.split("floor");
  460. String[] arr2 = arr[1].split("\\.");
  461. uploadFiles.put(str, String.format(dataViewPath, num, arr2[0], arr2[1]));
  462. });
  463. }
  464. }
  465. private void writeSceneJson(String num, JSONObject videosJson, SceneEditInfo sceneEditInfo, SceneEditInfoExt sceneEditInfoExt,
  466. SceneEditControls sceneEditControls, ScenePlus scenePlus, ScenePlusExt scenePlusExt,Company company){
  467. String dataViewPath = String.format(UploadFilePath.DATA_VIEW_PATH, num);
  468. SceneJsonBean sceneJson = new SceneJsonBean();
  469. BeanUtil.copyProperties(sceneEditInfoExt, sceneJson);
  470. BeanUtil.copyProperties(sceneEditInfo, sceneJson);
  471. SceneEditControlsVO sceneEditControlsVO = BeanUtil.copyProperties(sceneEditControls, SceneEditControlsVO.class);
  472. sceneJson.setControls(sceneEditControlsVO);
  473. sceneJson.setNum(num);
  474. sceneJson.setCreateTime(scenePlus.getCreateTime());
  475. sceneJson.setSceneResolution(scenePlusExt.getSceneResolution());
  476. sceneJson.setVersion(sceneEditInfo.getVersion());
  477. sceneJson.setImgVersion(sceneEditInfo.getImgVersion());
  478. sceneJson.setSceneFrom(scenePlusExt.getSceneFrom());
  479. sceneJson.setSceneKind(scenePlusExt.getSceneKind());
  480. sceneJson.setModelKind(scenePlusExt.getModelKind());
  481. sceneJson.setVideos(JSON.toJSONString(videosJson));
  482. sceneJson.setPayStatus(scenePlus.getPayStatus());
  483. if(!ObjectUtils.isEmpty(company)){
  484. String userViewPath = String.format(UploadFilePath.USER_VIEW_PATH, num);
  485. String userEditPath = String.format(UploadFilePath.USER_EDIT_PATH, num);
  486. String localLogoPath = null;
  487. if (StrUtil.isNotEmpty(company.getTopLogo())) {
  488. localLogoPath = ConstantFilePath.AGENT_PATH + company.getTopLogo().substring(company.getTopLogo().lastIndexOf("//") + 1);
  489. HttpUtil.downloadFile(company.getTopLogo(), localLogoPath);
  490. fYunFileService.uploadFile(localLogoPath, userViewPath + "loadingLogo-user.png");
  491. fYunFileService.uploadFile(localLogoPath, userEditPath + "loadingLogo-user.png");
  492. sceneJson.setLoadingLogo("user");
  493. sceneJson.setLoadingLogoFile("loadingLogo-user.png");
  494. sceneEditInfo.setLoadingLogo("user");
  495. sceneEditInfo.setLoadingLogoFile("loadingLogo-user.png");
  496. }
  497. if (StrUtil.isNotEmpty(company.getFloorLogo())) {
  498. localLogoPath = ConstantFilePath.AGENT_PATH + company.getFloorLogo().substring(company.getFloorLogo().lastIndexOf("//") + 1);
  499. HttpUtil.downloadFile(company.getFloorLogo(), localLogoPath);
  500. fYunFileService.uploadFile(localLogoPath, userViewPath + "floorLogo-user.png");
  501. fYunFileService.uploadFile(localLogoPath, userEditPath + "floorLogo-user.png");
  502. sceneJson.setFloorLogo("user");
  503. sceneJson.setFloorLogoFile("floorLogo-user.png");
  504. sceneEditInfo.setFloorLogo("user");
  505. sceneEditInfo.setFloorLogoFile("floorLogo-user.png");
  506. }
  507. if(!ObjectUtils.isEmpty(localLogoPath)){
  508. sceneEditInfoService.updateById(sceneEditInfo);
  509. FileUtils.deleteFile(localLogoPath);
  510. }
  511. }
  512. String sceneJsonStr = JSON.toJSONString(sceneJson);
  513. //上传sceneJson文件
  514. fYunFileService.uploadFile(sceneJsonStr.getBytes(), dataViewPath + "scene.json");
  515. //scenejson写入缓存
  516. redisUtil.set(String.format(RedisKey.SCENE_JSON, num), sceneJsonStr);
  517. }
  518. private void uploadStatusJson(ScenePlus scenePlus, ScenePlusExt scenePlusExt){
  519. String num = scenePlus.getNum();
  520. String dataViewPath = String.format(UploadFilePath.DATA_VIEW_PATH, num);
  521. // 上传status JSON.
  522. JSONObject statusJson = new JSONObject();
  523. //临时将-2改成1,app还没完全更新
  524. statusJson.put("status", 1);
  525. statusJson.put("webSite", scenePlusExt.getWebSite());
  526. statusJson.put("sceneNum", num);
  527. statusJson.put("thumb", scenePlusExt.getThumb());
  528. statusJson.put("payStatus", scenePlus.getPayStatus());
  529. statusJson.put("sceneScheme", scenePlusExt.getSceneScheme());
  530. FileUtils.writeFile(ConstantFilePath.SCENE_PATH + "data/data" + num + File.separator + "status.json", statusJson.toString());
  531. fYunFileService.uploadFile(ConstantFilePath.SCENE_PATH + "data/data" + num + File.separator + "status.json",
  532. dataViewPath + "status.json");
  533. }
  534. private void createQrCode(String num, ScenePlusExt scenePlusExt, String qrLogo) {
  535. String localLogoPath = null;
  536. if (!ObjectUtils.isEmpty(qrLogo)) {
  537. try {
  538. localLogoPath = ConstantFilePath.AGENT_PATH + qrLogo.substring(qrLogo.lastIndexOf("//") + 1);
  539. HttpUtil.downloadFile(qrLogo, localLogoPath);
  540. } catch (Exception e) {
  541. log.error("公司logo下载失败:{}", qrLogo);
  542. localLogoPath = null;
  543. }
  544. }
  545. //生成二维码
  546. String outPathZh = ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+ num +".png";
  547. String outPathEn = ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+ num +"_en.png";
  548. QrConfig qrConfig = QrConfig.create();
  549. qrConfig.setWidth(1024);
  550. qrConfig.setHeight(1024);
  551. if(StrUtil.isNotEmpty(localLogoPath)){
  552. qrConfig.setImg(localLogoPath);
  553. }
  554. QrCodeUtil.generate(scenePlusExt.getWebSite(), qrConfig, FileUtil.file(outPathZh));
  555. QrCodeUtil.generate(scenePlusExt.getWebSite() + "&lang=en", qrConfig, FileUtil.file(outPathEn));
  556. //上传二维码
  557. fYunFileService.uploadFile(outPathZh, String.format(UploadFilePath.DOWNLOADS_QRCODE, num) + num + ".png");
  558. fYunFileService.uploadFile(outPathEn, String.format(UploadFilePath.DOWNLOADS_QRCODE, num) + num + "_en.png");
  559. if(!ObjectUtils.isEmpty(localLogoPath)){
  560. FileUtils.deleteFile(localLogoPath);
  561. }
  562. }
  563. private void pushMsgToApp(Integer pushChannel, String pushToken, int cameraType, String sceneName, String webSite){
  564. log.info("推送消息,渠道是 {}, 手机token是 {}", pushChannel, pushToken);
  565. if(Objects.isNull(pushChannel) || StrUtil.isBlank(pushToken)){
  566. return;
  567. }
  568. String title = sceneName + "计算完成";
  569. String body = "您上传的" + sceneName + "计算完成,点击查看";
  570. try{
  571. if(FYunTypeEnum.AWS.code().equals(fYunFileService.getFyunType())){
  572. PushMsgUtil.googlePushMsg(ConstantFilePath.BASE_PATH + "/refreshToken.json", pushToken,
  573. title, body , webSite);
  574. return;
  575. }
  576. PushMessageConfig pushConfig = null;
  577. if(pushChannel == 0){
  578. if(cameraType == 10 || cameraType == 13){
  579. //ios
  580. pushConfig = new PushMessageConfig(PushMessageConfig.IOS_KEY_Z, PushMessageConfig.IOS_SECRET_Z);
  581. pushConfig.sendIOSUnicast(pushToken, "四维看看Minion",title, body, webSite);
  582. }else {
  583. //ios
  584. pushConfig = new PushMessageConfig(PushMessageConfig.IOS_KEY, PushMessageConfig.IOS_SECRET);
  585. pushConfig.sendIOSUnicast(pushToken, "四维看看Pro",title, body, webSite);
  586. }
  587. }else {
  588. if(cameraType == 10 || cameraType == 13){
  589. //ios
  590. //安卓
  591. pushConfig = new PushMessageConfig(PushMessageConfig.ANDROID_KEY_Z, PushMessageConfig.ANDROID_SECRET_Z);
  592. pushConfig.sendAndroidUnicast2(pushToken, "四维看看Minion",title, body, webSite);
  593. }else {
  594. //安卓
  595. pushConfig = new PushMessageConfig(PushMessageConfig.ANDROID_KEY, PushMessageConfig.ANDROID_SECRET);
  596. pushConfig.sendAndroidUnicast(pushToken, "四维看看Pro",title, body, webSite);
  597. }
  598. }
  599. log.info("消息推送结束!");
  600. }catch (Exception e){
  601. log.error("推送消息失败:", e);
  602. }
  603. }
  604. private void copyToEditDir(String num) throws IOException {
  605. String editImagesPath = String.format(UploadFilePath.IMG_EDIT_PATH, num);
  606. String viewImagesPath = String.format(UploadFilePath.IMG_VIEW_PATH, num);
  607. String editDataPath = String.format(UploadFilePath.DATA_EDIT_PATH, num);
  608. String viewDataPath = String.format(UploadFilePath.DATA_VIEW_PATH, num);
  609. Map<String, String> map = new HashMap<>();
  610. map.put(editImagesPath + "vision.modeldata", viewImagesPath + "vision.modeldata");
  611. map.put(editImagesPath + "vision2.modeldata", viewImagesPath + "vision2.modeldata");
  612. map.put(editDataPath + "floorplan_cad.json", viewDataPath + "floorplan_cad.json");
  613. for (Entry<String, String> entry : map.entrySet()) {
  614. fYunFileService.copyFileInBucket(entry.getValue(), entry.getKey());
  615. }
  616. }
  617. private JSONObject getVideosJson(String path, Integer videoVersion, String projectNum, int cameraType) throws Exception {
  618. //读取videos_hdr_param.json, 保存点位视频的value
  619. Map<String, Object> videoMap = new HashMap<>();
  620. String videosHdr = FileUtils.readFile(path + File.separator + "results/videos/videos_hdr_param.json");
  621. JSONArray videoArray = null;
  622. if(StringUtils.isNotEmpty(videosHdr)){
  623. videoArray = JSONObject.parseObject(videosHdr).getJSONArray("hdr_param");
  624. }
  625. if(videoArray != null){
  626. for(int i = 0, len = videoArray.size(); i < len; i++) {
  627. videoMap.put(videoArray.getJSONObject(i).getString("name"), videoArray.getJSONObject(i).getString("value"));
  628. if(videoArray.getJSONObject(i).containsKey("fov")){
  629. videoMap.put(videoArray.getJSONObject(i).getString("name") + "_fov", videoArray.getJSONObject(i).getString("fov"));
  630. }
  631. }
  632. }
  633. //获取upload中的video视频名称
  634. String uploadData = FileUtils.readFile(path + File.separator + "results" +File.separator+"upload.json");
  635. JSONObject uploadJson = null;
  636. JSONArray array = null;
  637. if(uploadData!=null) {
  638. uploadJson = JSONObject.parseObject(uploadData);
  639. array = uploadJson.getJSONArray("upload");
  640. }
  641. JSONObject fileJson = null;
  642. String fileName = "";
  643. //计算ts文件的大小,并拼接成json格式
  644. JSONArray jsonArray = new JSONArray();
  645. JSONObject videoJson = null;
  646. JSONObject videosJson = new JSONObject();
  647. long videoSize = 0L;
  648. for(int i = 0, len = array.size(); i < len; i++) {
  649. fileJson = array.getJSONObject(i);
  650. fileName = fileJson.getString("file");
  651. if(fileJson.getIntValue("clazz") == 11 && fileName.contains(".mp4") && !fileName.contains("-ios.mp4")){
  652. videoJson = new JSONObject();
  653. videoJson.put("id", fileName.substring(
  654. 0, fileName.lastIndexOf(".")).replace("videos/", ""));
  655. //如果ts文件存在,就计算ts大小
  656. if(new File(path + File.separator + "results" +File.separator+ fileName.replace(".mp4", ".ts")).exists()){
  657. videoSize = new File(path + File.separator + "results" +File.separator+ fileName.replace(".mp4", ".ts")).length();
  658. videoJson.put("tsSize", videoSize);
  659. }
  660. if(videoMap.containsKey(videoJson.get("id"))){
  661. videoJson.put("value", videoMap.get(videoJson.get("id")));
  662. }
  663. if(videoMap.containsKey(videoJson.get("id") + "_fov")){
  664. videoJson.put("blend_fov", videoMap.get(videoJson.get("id") + "_fov"));
  665. }else {
  666. videoJson.put("blend_fov", 7);
  667. }
  668. jsonArray.add(videoJson);
  669. }
  670. }
  671. videosJson.put("data", jsonArray);
  672. if(Objects.nonNull(videoVersion) && videoVersion >= 4){
  673. videosJson.put("version", 3);
  674. videosJson.put("upPath", fYunFileConfig.getHost() + String.format(UploadFilePath.DATA_VIEW_PATH, projectNum) + "Up.xml");
  675. if(cameraType == 13){
  676. //转台相机
  677. videosJson.put("upPath", videosJson.getString("upPath").replace(".xml", ".txt"));
  678. }
  679. }else {
  680. videosJson.put("version", 1);
  681. videosJson.put("upPath", fYunFileConfig.getHost() + String.format(UploadFilePath.DATA_VIEW_PATH, projectNum) + "Up2.xml");
  682. if(cameraType == 13){
  683. //转台相机
  684. videosJson.put("upPath", videosJson.getString("upPath").replace(".xml", ".txt"));
  685. }
  686. }
  687. if(cameraType == 5 || cameraType == 6){
  688. videosJson.put("version", 1);
  689. videosJson.put("upPath", fYunFileConfig.getHost() + String.format(UploadFilePath.DATA_VIEW_PATH, projectNum) + "stitch_params.txt");
  690. }
  691. return videosJson;
  692. }
  693. private Long calUseSpace(Map<String, String> uploadFile) {
  694. return uploadFile.keySet().stream().map(File::new).filter(File::exists).mapToLong(File::length).sum();
  695. }
  696. private void updateDbPlus(int sceneSource,Long space,String videosJson, Long computeTime,boolean isObj,ScenePlusExt scenePlusExt){
  697. scenePlusExt.setSpace(space);
  698. scenePlusExt.setComputeTime(computeTime.toString());
  699. scenePlusExt.setAlgorithmTime(new Date());
  700. scenePlusExt.setVideos(videosJson);
  701. scenePlusExt.setIsObj(isObj ? 1 : 0);
  702. if(ModelTypeEnums.TILE_CODE.equals(modelType)){
  703. scenePlusExt.setSceneScheme(3);
  704. }
  705. switch (SceneSource.get(sceneSource)){
  706. case BM:
  707. scenePlusExt.setSceneResolution(SceneResolution.two_K.code());
  708. scenePlusExt.setSceneFrom(SceneFrom.PRO.code());
  709. break;
  710. case SM:
  711. scenePlusExt.setSceneResolution(SceneResolution.one_k.code());
  712. scenePlusExt.setSceneFrom(SceneFrom.LITE.code());
  713. break;
  714. case ZT:
  715. scenePlusExt.setSceneResolution(SceneResolution.four_K.code());
  716. scenePlusExt.setSceneFrom(SceneFrom.MINION.code());
  717. break;
  718. case JG:
  719. scenePlusExt.setSceneResolution(SceneResolution.four_K.code());
  720. scenePlusExt.setSceneFrom(SceneFrom.LASER.code());
  721. break;
  722. }
  723. String sceneKind = scenePlusExt.getSceneScheme() == 3 ? SceneKind.FACE.code():SceneKind.TILES.code();
  724. scenePlusExt.setSceneKind(sceneKind);
  725. // scenePlusExt.setModelKind(modelKind);
  726. String dataFdage = FileUtil.readUtf8String(scenePlusExt.getDataSource().concat("/capture/").concat("data.fdage"));
  727. JSONObject jsonObject = JSON.parseObject(dataFdage);
  728. int points = jsonObject.getJSONArray("points").size();
  729. scenePlusExt.setShootCount(points);
  730. scenePlusExtService.updateById(scenePlusExt);
  731. }
  732. private Object[] updateEditInfo(ScenePlus scenePlus){
  733. SceneEditInfo sceneEditInfo = sceneEditInfoService.getByScenePlusId(scenePlus.getId());
  734. SceneEditControls sceneEditControls = null;
  735. SceneEditInfoExt sceneEditInfoExt = null;
  736. if(sceneEditInfo == null){
  737. sceneEditInfo = new SceneEditInfo();
  738. sceneEditInfo.setScenePlusId(scenePlus.getId());
  739. sceneEditInfo.setDescription(scenePlus.getDescription());
  740. sceneEditInfo.setTitle(scenePlus.getTitle());
  741. sceneEditInfoService.save(sceneEditInfo);
  742. }else{
  743. int version = 0;
  744. int imgVersion = 0;
  745. int linkVersion = 0;
  746. //获取展示页的版本号
  747. String sceneJsonStr = fYunFileService.getFileContent(String.format(UploadFilePath.DATA_VIEW_PATH, scenePlus.getNum()) + "scene.json");
  748. if(StrUtil.isNotEmpty(sceneJsonStr)){
  749. JSONObject sceneJson = JSON.parseObject(sceneJsonStr);
  750. version = sceneJson.getIntValue("version");
  751. imgVersion = sceneJson.getIntValue("imgVersion");
  752. linkVersion = sceneJson.getIntValue("linkVersion");
  753. }
  754. if(version < sceneEditInfo.getVersion()){
  755. version = sceneEditInfo.getVersion();
  756. }
  757. if(imgVersion < sceneEditInfo.getImgVersion()){
  758. imgVersion = sceneEditInfo.getImgVersion();
  759. }
  760. if(linkVersion < sceneEditInfo.getLinkVersion()){
  761. linkVersion = sceneEditInfo.getLinkVersion();
  762. }
  763. sceneEditControls = sceneEditControlsService.getBySceneEditId(sceneEditInfo.getId());
  764. sceneEditInfoExt = sceneEditInfoExtService.getByEditInfoId(sceneEditInfo.getId());
  765. sceneEditInfo.setVersion(version + 1);
  766. sceneEditInfo.setImgVersion(imgVersion + 1);
  767. sceneEditInfo.setLinkVersion(linkVersion + 1);
  768. sceneEditInfo.setIsUploadObj(CommonStatus.NO.code());
  769. sceneEditInfoService.updateById(sceneEditInfo);
  770. }
  771. if(sceneEditControls == null){
  772. sceneEditControls = new SceneEditControls();
  773. sceneEditControls.setEditInfoId(sceneEditInfo.getId());
  774. sceneEditControlsService.save(sceneEditControls);
  775. }
  776. if(sceneEditInfoExt == null){
  777. sceneEditInfoExt = new SceneEditInfoExt();
  778. sceneEditInfoExt.setScenePlusId(scenePlus.getId());
  779. sceneEditInfoExt.setEditInfoId(sceneEditInfo.getId());
  780. sceneEditInfoExtService.save(sceneEditInfoExt);
  781. }
  782. return new Object[]{sceneEditInfo, sceneEditInfoExt, sceneEditControls};
  783. }
  784. public boolean uploadHouseTypeJson(String num, String dataSource) {
  785. String floorPlanCardFilePath = dataSource + File.separator + "results/floorplan_cad.json";
  786. if (!new File(floorPlanCardFilePath).exists()) {
  787. log.warn("floorplan_cad.json 文件不存在,文件路径:{}", floorPlanCardFilePath);
  788. return false;
  789. }
  790. JSONObject json = CreateHouseJsonUtil.createHouseTypeJsonByCad(floorPlanCardFilePath);
  791. if(Objects.isNull(json)){
  792. return false;
  793. }
  794. String hourseTypeJsonPath = String.format(UploadFilePath.USER_VIEW_PATH, num) + "houseType.json";
  795. fYunFileService.uploadFile(json.toJSONString().getBytes(), hourseTypeJsonPath);
  796. hourseTypeJsonPath = String.format(UploadFilePath.USER_EDIT_PATH, num) + "houseType.json";
  797. fYunFileService.uploadFile(json.toJSONString().getBytes(), hourseTypeJsonPath);
  798. return true;
  799. }
  800. }