|
@@ -1,13 +1,13 @@
|
|
package com.fdkankan.contro.mq.service.impl;
|
|
package com.fdkankan.contro.mq.service.impl;
|
|
|
|
|
|
-import cn.hutool.core.bean.BeanUtil;
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.io.FileUtil;
|
|
import cn.hutool.core.io.FileUtil;
|
|
-import cn.hutool.core.io.file.FileNameUtil;
|
|
|
|
|
|
+import cn.hutool.core.thread.ThreadUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.ZipUtil;
|
|
import cn.hutool.core.util.ZipUtil;
|
|
import cn.hutool.extra.qrcode.QrCodeUtil;
|
|
import cn.hutool.extra.qrcode.QrCodeUtil;
|
|
import cn.hutool.extra.qrcode.QrConfig;
|
|
import cn.hutool.extra.qrcode.QrConfig;
|
|
|
|
+import cn.hutool.http.ContentType;
|
|
import cn.hutool.http.HttpUtil;
|
|
import cn.hutool.http.HttpUtil;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
@@ -16,12 +16,10 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.fdkankan.common.constant.*;
|
|
import com.fdkankan.common.constant.*;
|
|
import com.fdkankan.common.util.FileUtils;
|
|
import com.fdkankan.common.util.FileUtils;
|
|
-import com.fdkankan.contro.bean.SceneJsonBean;
|
|
|
|
import com.fdkankan.contro.constant.UserEditDataType;
|
|
import com.fdkankan.contro.constant.UserEditDataType;
|
|
import com.fdkankan.contro.entity.*;
|
|
import com.fdkankan.contro.entity.*;
|
|
import com.fdkankan.contro.mq.service.IBuildSceneService;
|
|
import com.fdkankan.contro.mq.service.IBuildSceneService;
|
|
import com.fdkankan.contro.service.*;
|
|
import com.fdkankan.contro.service.*;
|
|
-import com.fdkankan.contro.vo.SceneEditControlsVO;
|
|
|
|
import com.fdkankan.fyun.config.FYunFileConfig;
|
|
import com.fdkankan.fyun.config.FYunFileConfig;
|
|
import com.fdkankan.fyun.constant.FYunTypeEnum;
|
|
import com.fdkankan.fyun.constant.FYunTypeEnum;
|
|
import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
@@ -37,18 +35,20 @@ import com.fdkankan.push.utils.PushMsgUtil;
|
|
import com.fdkankan.rabbitmq.bean.BuildSceneCallMessage;
|
|
import com.fdkankan.rabbitmq.bean.BuildSceneCallMessage;
|
|
import com.fdkankan.rabbitmq.bean.BuildSceneResultMqMessage;
|
|
import com.fdkankan.rabbitmq.bean.BuildSceneResultMqMessage;
|
|
import com.fdkankan.rabbitmq.util.RabbitMqProducer;
|
|
import com.fdkankan.rabbitmq.util.RabbitMqProducer;
|
|
-import com.fdkankan.redis.constant.RedisKey;
|
|
|
|
import com.fdkankan.redis.util.RedisUtil;
|
|
import com.fdkankan.redis.util.RedisUtil;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
+import org.apache.http.HttpHeaders;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
|
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
import java.io.File;
|
|
import java.io.File;
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
|
|
+import java.nio.charset.StandardCharsets;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.Map.Entry;
|
|
import java.util.Map.Entry;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
@@ -91,10 +91,13 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
@Value("#{'${build.scene.post.not-delete-nas-nums:}'.split(',')}")
|
|
@Value("#{'${build.scene.post.not-delete-nas-nums:}'.split(',')}")
|
|
private List<String> notDeleteNasNumList;
|
|
private List<String> notDeleteNasNumList;
|
|
|
|
|
|
|
|
+ @Value("4dkk.laserService.bucket")
|
|
|
|
+ private String laserBucket;
|
|
|
|
+
|
|
@Autowired
|
|
@Autowired
|
|
private RabbitMqProducer mqProducer;
|
|
private RabbitMqProducer mqProducer;
|
|
|
|
|
|
- @Autowired
|
|
|
|
|
|
+ @Resource
|
|
private FYunFileServiceInterface fYunFileService;
|
|
private FYunFileServiceInterface fYunFileService;
|
|
@Autowired
|
|
@Autowired
|
|
private ICameraDetailService cameraDetailService;
|
|
private ICameraDetailService cameraDetailService;
|
|
@@ -152,6 +155,7 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public void buildScenePre(BuildSceneCallMessage message) throws Exception{
|
|
public void buildScenePre(BuildSceneCallMessage message) throws Exception{
|
|
boolean success = false;
|
|
boolean success = false;
|
|
@@ -216,16 +220,17 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
|
|
|
|
message.getBuildContext().put("cameraType",message.getCameraType());
|
|
message.getBuildContext().put("cameraType",message.getCameraType());
|
|
|
|
|
|
- // 判断企业是否配置了弹性伸缩
|
|
|
|
- if (message.getFlexibility() == 0) {
|
|
|
|
- //发送mq,就进行计算
|
|
|
|
- mqProducer.sendByWorkQueue(queueModelingCall, message);
|
|
|
|
- } else {
|
|
|
|
- //发送mq,就进行计算
|
|
|
|
- mqProducer.sendByWorkQueue(singleModelingCall, message);
|
|
|
|
|
|
+ //查询是否超过比例50%,如果超过,则启动128G服务器弹性伸缩
|
|
|
|
+ Float maxRate = fdageJson.getFloat("maxRate");
|
|
|
|
+ if(env.equals("gn") && Objects.nonNull(maxRate) && maxRate > 50){
|
|
|
|
+ Map<String, Object> ext = message.getExt();
|
|
|
|
+ if(Objects.isNull(ext)){
|
|
|
|
+ ext = new HashMap<>();
|
|
|
|
+ message.setExt(ext);
|
|
|
|
+ }
|
|
|
|
+ ext.put("128G", 1);
|
|
}
|
|
}
|
|
-
|
|
|
|
- success = true;
|
|
|
|
|
|
+ mqProducer.sendByWorkQueue(queueModelingCall, message);
|
|
|
|
|
|
log.info("场景计算资源准备结束,场景码:{}", message.getSceneNum());
|
|
log.info("场景计算资源准备结束,场景码:{}", message.getSceneNum());
|
|
|
|
|
|
@@ -330,6 +335,7 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
log.info("开始上传场景计算结果数据,num:{}", sceneCode);
|
|
log.info("开始上传场景计算结果数据,num:{}", sceneCode);
|
|
//由于3dtiles算法mesh文件发生变化,所以这里需要先清除一下oss的mesh目录,避免存在旧算法obj文件
|
|
//由于3dtiles算法mesh文件发生变化,所以这里需要先清除一下oss的mesh目录,避免存在旧算法obj文件
|
|
fYunFileService.deleteFolder(String.format(UploadFilePath.DATA_VIEW_PATH, sceneCode) + "mesh");
|
|
fYunFileService.deleteFolder(String.format(UploadFilePath.DATA_VIEW_PATH, sceneCode) + "mesh");
|
|
|
|
+ fYunFileService.deleteFolder(String.format(UploadFilePath.IMG_VIEW_PATH, sceneCode) + ModelKind.THREE_D_TILE.code());
|
|
//上传文件
|
|
//上传文件
|
|
fYunFileService.uploadMulFiles(uploadFiles);
|
|
fYunFileService.uploadMulFiles(uploadFiles);
|
|
|
|
|
|
@@ -353,12 +359,13 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
commonService.uploadFloorplanJson(sceneCode, path);
|
|
commonService.uploadFloorplanJson(sceneCode, path);
|
|
|
|
|
|
//重置异步操作记录
|
|
//重置异步操作记录
|
|
- this.removeSceneAsynOperLog(sceneCode);
|
|
|
|
|
|
+ commonService.removeSceneAsynOperLog(sceneCode);
|
|
|
|
|
|
//清除用户编辑业务数据
|
|
//清除用户编辑业务数据
|
|
Set<String> bizs = new HashSet<>();
|
|
Set<String> bizs = new HashSet<>();
|
|
bizs.add(UserEditDataType.BOX_MODEL.message());
|
|
bizs.add(UserEditDataType.BOX_MODEL.message());
|
|
bizs.add(UserEditDataType.FLOORPLAN.message());
|
|
bizs.add(UserEditDataType.FLOORPLAN.message());
|
|
|
|
+ bizs.add(UserEditDataType.FILTERS.message());
|
|
commonService.initUserEditData(sceneCode, bizs, null);
|
|
commonService.initUserEditData(sceneCode, bizs, null);
|
|
|
|
|
|
//上传计算结果文件
|
|
//上传计算结果文件
|
|
@@ -370,14 +377,20 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
//写入数据库
|
|
//写入数据库
|
|
this.updateDbPlus(scenePlus.getSceneSource(), space, videosJson.toJSONString(), message.getComputeTime(),isObj,scenePlusExt);
|
|
this.updateDbPlus(scenePlus.getSceneSource(), space, videosJson.toJSONString(), message.getComputeTime(),isObj,scenePlusExt);
|
|
|
|
|
|
- Object[] editInfoArr = this.updateEditInfo(scenePlus);
|
|
|
|
|
|
+ Object[] editInfoArr = commonService.updateEditInfo(scenePlus);
|
|
SceneEditInfo sceneEditInfo = (SceneEditInfo)editInfoArr[0];
|
|
SceneEditInfo sceneEditInfo = (SceneEditInfo)editInfoArr[0];
|
|
SceneEditInfoExt sceneEditInfoExt = (SceneEditInfoExt)editInfoArr[1];
|
|
SceneEditInfoExt sceneEditInfoExt = (SceneEditInfoExt)editInfoArr[1];
|
|
SceneEditControls sceneEditControls = (SceneEditControls)editInfoArr[2];
|
|
SceneEditControls sceneEditControls = (SceneEditControls)editInfoArr[2];
|
|
|
|
|
|
|
|
+ //更新场景主表
|
|
|
|
+ //如果相机容量不足,需要把场景的paystatus改为容量不足状态
|
|
|
|
+ scenePlus.setPayStatus(commonService.getPayStatus(scenePlus.getCameraId(), space));
|
|
|
|
+ //统计原始资源大小
|
|
|
|
+ scenePlusExt.setOrigSpace(FileUtil.size(new File(path.concat(File.separator).concat("capture"))));
|
|
|
|
+
|
|
if (cameraType == 14) {
|
|
if (cameraType == 14) {
|
|
//计算成功 激光转台相机 同步 请求
|
|
//计算成功 激光转台相机 同步 请求
|
|
- fdkkLaserService.syncBuildResult(scenePlus.getNum(), path, scenePlus.getCreateTime(), Calendar.getInstance().getTime());
|
|
|
|
|
|
+ fdkkLaserService.syncBuildResult(scenePlus.getNum(), path, scenePlus.getCreateTime(), Calendar.getInstance().getTime(), scenePlusExt.getShootCount(), scenePlus.getPayStatus());
|
|
sceneEditControlsService.update(new LambdaUpdateWrapper<SceneEditControls>().set(SceneEditControls::getShowMap,0)
|
|
sceneEditControlsService.update(new LambdaUpdateWrapper<SceneEditControls>().set(SceneEditControls::getShowMap,0)
|
|
.eq(SceneEditControls::getEditInfoId,sceneEditInfo.getId()));
|
|
.eq(SceneEditControls::getEditInfoId,sceneEditInfo.getId()));
|
|
sceneEditControls.setShowMap(0);
|
|
sceneEditControls.setShowMap(0);
|
|
@@ -385,11 +398,12 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
fdkkLaserService.cloudPointBuild(sceneCode,path);
|
|
fdkkLaserService.cloudPointBuild(sceneCode,path);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
log.info("生成scene.json上传oss并设置缓存,num:{}", sceneCode);
|
|
log.info("生成scene.json上传oss并设置缓存,num:{}", sceneCode);
|
|
CameraDetail cameraDetail = cameraDetailService.getByCameraId(scenePlus.getCameraId());
|
|
CameraDetail cameraDetail = cameraDetailService.getByCameraId(scenePlus.getCameraId());
|
|
Company company = !ObjectUtils.isEmpty(cameraDetail.getCompanyId()) ? companyService.getById(cameraDetail.getCompanyId()) : null;
|
|
Company company = !ObjectUtils.isEmpty(cameraDetail.getCompanyId()) ? companyService.getById(cameraDetail.getCompanyId()) : null;
|
|
//写scene.json
|
|
//写scene.json
|
|
- this.writeSceneJson(sceneCode, videosJson,sceneEditInfo, sceneEditInfoExt, sceneEditControls, scenePlus,scenePlusExt,company);
|
|
|
|
|
|
+ commonService.writeSceneJson(sceneCode, videosJson,sceneEditInfo, sceneEditInfoExt, sceneEditControls, scenePlus,scenePlusExt,company);
|
|
|
|
|
|
String qrLogo = !ObjectUtils.isEmpty(company) && !ObjectUtils.isEmpty(company.getQrLogo()) ? company.getQrLogo() : null;
|
|
String qrLogo = !ObjectUtils.isEmpty(company) && !ObjectUtils.isEmpty(company.getQrLogo()) ? company.getQrLogo() : null;
|
|
|
|
|
|
@@ -416,6 +430,7 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
this.uploadStatusJson(scenePlus, scenePlusExt);
|
|
this.uploadStatusJson(scenePlus, scenePlusExt);
|
|
|
|
|
|
scenePlusService.updateById(scenePlus);
|
|
scenePlusService.updateById(scenePlus);
|
|
|
|
+ scenePlusExtService.updateById(scenePlusExt);
|
|
|
|
|
|
OrigFileUploadBatch condition = new OrigFileUploadBatch();
|
|
OrigFileUploadBatch condition = new OrigFileUploadBatch();
|
|
condition.setBatchId(batchId);
|
|
condition.setBatchId(batchId);
|
|
@@ -451,29 +466,14 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
log.error("场景计算结果处理出错,num"+sceneCode, e);
|
|
log.error("场景计算结果处理出错,num"+sceneCode, e);
|
|
// buildSceneDTService.handBaseFail("场景计算结果处理出错!", message.getPath(), sceneCode, "计算控制服务器");
|
|
// buildSceneDTService.handBaseFail("场景计算结果处理出错!", message.getPath(), sceneCode, "计算控制服务器");
|
|
throw e;
|
|
throw e;
|
|
|
|
+ } finally {
|
|
|
|
+ Map<String, Object> sceneStatusParam = new HashMap<>();
|
|
|
|
+ sceneStatusParam.put("num", sceneCode);
|
|
|
|
+ sceneStatusParam.put("status", message.getBuildSuccess() ? 1 : -1);
|
|
|
|
+ commonService.sendUpdateSceneStatusMqToQueues(sceneStatusParam);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- private void removeSceneAsynOperLog(String num){
|
|
|
|
- List<SceneAsynOperLog> list = sceneAsynOperLogService.list(new LambdaQueryWrapper<SceneAsynOperLog>().eq(SceneAsynOperLog::getNum, num));
|
|
|
|
- if(CollUtil.isEmpty(list)){
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- //删除数据库记录
|
|
|
|
- List<Long> deleteIdList = list.parallelStream().map(item -> item.getId()).collect(Collectors.toList());
|
|
|
|
- sceneAsynOperLogService.removeByIds(deleteIdList);
|
|
|
|
-
|
|
|
|
- list.parallelStream().forEach(item -> {
|
|
|
|
- if(StrUtil.isNotEmpty(item.getUrl())){
|
|
|
|
- try {
|
|
|
|
- fYunFileService.deleteFile(item.getUrl());
|
|
|
|
- } catch (IOException e) {
|
|
|
|
- log.warn("删除oss全景图下载压缩包失败,key:{}", item.getUrl());
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
// private void cachePanorama(String dataSource, String num){
|
|
// private void cachePanorama(String dataSource, String num){
|
|
// String cachedImagesPath = String.format(ConstantFilePath.SCENE_CACHE_IMAGES, num);
|
|
// String cachedImagesPath = String.format(ConstantFilePath.SCENE_CACHE_IMAGES, num);
|
|
// //将全景图缓存到缓存目录
|
|
// //将全景图缓存到缓存目录
|
|
@@ -639,75 +639,6 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- private void writeSceneJson(String num, JSONObject videosJson, SceneEditInfo sceneEditInfo, SceneEditInfoExt sceneEditInfoExt,
|
|
|
|
- SceneEditControls sceneEditControls, ScenePlus scenePlus, ScenePlusExt scenePlusExt,Company company){
|
|
|
|
- String dataViewPath = String.format(UploadFilePath.DATA_VIEW_PATH, num);
|
|
|
|
-
|
|
|
|
- String oldSceneJson = fYunFileService.getFileContent(dataViewPath + "scene.json");
|
|
|
|
-
|
|
|
|
- SceneJsonBean sceneJson = new SceneJsonBean();
|
|
|
|
- BeanUtil.copyProperties(sceneEditInfoExt, sceneJson);
|
|
|
|
- BeanUtil.copyProperties(sceneEditInfo, sceneJson);
|
|
|
|
- SceneEditControlsVO sceneEditControlsVO = BeanUtil.copyProperties(sceneEditControls, SceneEditControlsVO.class);
|
|
|
|
- sceneJson.setControls(sceneEditControlsVO);
|
|
|
|
- sceneJson.setNum(num);
|
|
|
|
- sceneJson.setCreateTime(scenePlus.getCreateTime());
|
|
|
|
- sceneJson.setSceneResolution(scenePlusExt.getSceneResolution());
|
|
|
|
- sceneJson.setVersion(sceneEditInfo.getVersion());
|
|
|
|
- sceneJson.setImgVersion(sceneEditInfo.getImgVersion());
|
|
|
|
- sceneJson.setSceneFrom(scenePlusExt.getSceneFrom());
|
|
|
|
- sceneJson.setSceneKind(scenePlusExt.getSceneKind());
|
|
|
|
- sceneJson.setModelKind(scenePlusExt.getModelKind());
|
|
|
|
- sceneJson.setVideos(JSON.toJSONString(videosJson));
|
|
|
|
- sceneJson.setPayStatus(scenePlus.getPayStatus());
|
|
|
|
- if(StrUtil.isNotEmpty(oldSceneJson)){
|
|
|
|
- SceneJsonBean oldSceneJsonBean = JSON.parseObject(oldSceneJson, SceneJsonBean.class);
|
|
|
|
- List<JSONObject> mosaicList = JSON.parseObject(oldSceneJson, SceneJsonBean.class).getMosaicList();
|
|
|
|
- sceneJson.setMosaicList(mosaicList);
|
|
|
|
- sceneJson.setFloorLogo(oldSceneJsonBean.getFloorLogo());
|
|
|
|
- sceneJson.setFloorLogoFile(oldSceneJsonBean.getFloorLogoFile());
|
|
|
|
- sceneJson.setBoxModels(oldSceneJsonBean.getBoxModels());
|
|
|
|
- sceneJson.setBoxVideos(oldSceneJsonBean.getBoxVideos());
|
|
|
|
- sceneJson.setBoxPhotos(oldSceneJsonBean.getBoxPhotos());
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if(!ObjectUtils.isEmpty(company)){
|
|
|
|
- String userViewPath = String.format(UploadFilePath.USER_VIEW_PATH, num);
|
|
|
|
- String userEditPath = String.format(UploadFilePath.USER_EDIT_PATH, num);
|
|
|
|
- String localLogoPath = null;
|
|
|
|
- if (StrUtil.isNotEmpty(company.getTopLogo())) {
|
|
|
|
- localLogoPath = ConstantFilePath.AGENT_PATH + company.getTopLogo().substring(company.getTopLogo().lastIndexOf("//") + 1);
|
|
|
|
- HttpUtil.downloadFile(company.getTopLogo(), localLogoPath);
|
|
|
|
- fYunFileService.uploadFile(localLogoPath, userViewPath + "loadingLogo-user.png");
|
|
|
|
- fYunFileService.uploadFile(localLogoPath, userEditPath + "loadingLogo-user.png");
|
|
|
|
- sceneJson.setLoadingLogo("user");
|
|
|
|
- sceneJson.setLoadingLogoFile("loadingLogo-user.png");
|
|
|
|
- sceneEditInfo.setLoadingLogo("user");
|
|
|
|
- sceneEditInfo.setLoadingLogoFile("loadingLogo-user.png");
|
|
|
|
- }
|
|
|
|
- if (StrUtil.isNotEmpty(company.getFloorLogo())) {
|
|
|
|
- localLogoPath = ConstantFilePath.AGENT_PATH + company.getFloorLogo().substring(company.getFloorLogo().lastIndexOf("//") + 1);
|
|
|
|
- HttpUtil.downloadFile(company.getFloorLogo(), localLogoPath);
|
|
|
|
- fYunFileService.uploadFile(localLogoPath, userViewPath + "floorLogo-user.png");
|
|
|
|
- fYunFileService.uploadFile(localLogoPath, userEditPath + "floorLogo-user.png");
|
|
|
|
- sceneJson.setFloorLogo("user");
|
|
|
|
- sceneJson.setFloorLogoFile("floorLogo-user.png");
|
|
|
|
-
|
|
|
|
- sceneEditInfo.setFloorLogo("user");
|
|
|
|
- sceneEditInfo.setFloorLogoFile("floorLogo-user.png");
|
|
|
|
- }
|
|
|
|
- if(!ObjectUtils.isEmpty(localLogoPath)){
|
|
|
|
- sceneEditInfoService.updateById(sceneEditInfo);
|
|
|
|
- FileUtils.deleteFile(localLogoPath);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- String sceneJsonStr = JSON.toJSONString(sceneJson);
|
|
|
|
- //上传sceneJson文件
|
|
|
|
- fYunFileService.uploadFile(sceneJsonStr.getBytes(), dataViewPath + "scene.json");
|
|
|
|
- //scenejson写入缓存
|
|
|
|
- redisUtil.set(String.format(RedisKey.SCENE_JSON, num), sceneJsonStr);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
private void uploadStatusJson(ScenePlus scenePlus, ScenePlusExt scenePlusExt){
|
|
private void uploadStatusJson(ScenePlus scenePlus, ScenePlusExt scenePlusExt){
|
|
String num = scenePlus.getNum();
|
|
String num = scenePlus.getNum();
|
|
String dataViewPath = String.format(UploadFilePath.DATA_VIEW_PATH, num);
|
|
String dataViewPath = String.format(UploadFilePath.DATA_VIEW_PATH, num);
|
|
@@ -728,8 +659,9 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
statusJson.put("sceneScheme", scenePlusExt.getSceneScheme());
|
|
statusJson.put("sceneScheme", scenePlusExt.getSceneScheme());
|
|
FileUtils.writeFile(ConstantFilePath.SCENE_PATH + "data/data" + num + File.separator + "status.json", statusJson.toString());
|
|
FileUtils.writeFile(ConstantFilePath.SCENE_PATH + "data/data" + num + File.separator + "status.json", statusJson.toString());
|
|
|
|
|
|
- fYunFileService.uploadFile(ConstantFilePath.SCENE_PATH + "data/data" + num + File.separator + "status.json",
|
|
|
|
- dataViewPath + "status.json");
|
|
|
|
|
|
+ Map<String,String> headers = new HashMap<>();
|
|
|
|
+ headers.put(HttpHeaders.CONTENT_TYPE, ContentType.JSON.getValue());
|
|
|
|
+ fYunFileService.uploadFile(ConstantFilePath.SCENE_PATH + "data/data" + num + File.separator + "status.json", dataViewPath + "status.json", headers);
|
|
}
|
|
}
|
|
|
|
|
|
private void createQrCode(String num, ScenePlusExt scenePlusExt, String qrLogo) {
|
|
private void createQrCode(String num, ScenePlusExt scenePlusExt, String qrLogo) {
|
|
@@ -908,11 +840,6 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
|
|
|
|
return videosJson;
|
|
return videosJson;
|
|
}
|
|
}
|
|
-
|
|
|
|
- private Long calUseSpace(Map<String, String> uploadFile) {
|
|
|
|
- return uploadFile.keySet().stream().map(File::new).filter(File::exists).mapToLong(File::length).sum();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
private void updateDbPlus(int sceneSource,Long space,String videosJson, Long computeTime,boolean isObj,ScenePlusExt scenePlusExt){
|
|
private void updateDbPlus(int sceneSource,Long space,String videosJson, Long computeTime,boolean isObj,ScenePlusExt scenePlusExt){
|
|
|
|
|
|
scenePlusExt.setSpace(space);
|
|
scenePlusExt.setSpace(space);
|
|
@@ -952,68 +879,43 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
scenePlusExt.setSceneKind(sceneKind);
|
|
scenePlusExt.setSceneKind(sceneKind);
|
|
// scenePlusExt.setModelKind(modelKind);
|
|
// scenePlusExt.setModelKind(modelKind);
|
|
|
|
|
|
- String dataFdage = FileUtil.readUtf8String(scenePlusExt.getDataSource().concat("/capture/").concat("data.fdage"));
|
|
|
|
- JSONObject jsonObject = JSON.parseObject(dataFdage);
|
|
|
|
- int points = jsonObject.getJSONArray("points").size();
|
|
|
|
- scenePlusExt.setShootCount(points);
|
|
|
|
|
|
+ //统计点位数量
|
|
|
|
+ scenePlusExt.setShootCount(this.getShootCount(scenePlusExt));
|
|
|
|
|
|
scenePlusExtService.updateById(scenePlusExt);
|
|
scenePlusExtService.updateById(scenePlusExt);
|
|
}
|
|
}
|
|
|
|
|
|
- private Object[] updateEditInfo(ScenePlus scenePlus){
|
|
|
|
- SceneEditInfo sceneEditInfo = sceneEditInfoService.getByScenePlusId(scenePlus.getId());
|
|
|
|
- SceneEditControls sceneEditControls = null;
|
|
|
|
- SceneEditInfoExt sceneEditInfoExt = null;
|
|
|
|
- if(sceneEditInfo == null){
|
|
|
|
- sceneEditInfo = new SceneEditInfo();
|
|
|
|
- sceneEditInfo.setScenePlusId(scenePlus.getId());
|
|
|
|
- sceneEditInfo.setDescription(scenePlus.getDescription());
|
|
|
|
- sceneEditInfo.setTitle(scenePlus.getTitle());
|
|
|
|
- sceneEditInfoService.save(sceneEditInfo);
|
|
|
|
- }else{
|
|
|
|
-
|
|
|
|
- int version = 0;
|
|
|
|
- int imgVersion = 0;
|
|
|
|
- int linkVersion = 0;
|
|
|
|
- //获取展示页的版本号
|
|
|
|
- String sceneJsonStr = fYunFileService.getFileContent(String.format(UploadFilePath.DATA_VIEW_PATH, scenePlus.getNum()) + "scene.json");
|
|
|
|
- if(StrUtil.isNotEmpty(sceneJsonStr)){
|
|
|
|
- JSONObject sceneJson = JSON.parseObject(sceneJsonStr);
|
|
|
|
- version = sceneJson.getIntValue("version");
|
|
|
|
- imgVersion = sceneJson.getIntValue("imgVersion");
|
|
|
|
- linkVersion = sceneJson.getIntValue("linkVersion");
|
|
|
|
|
|
+ private Integer getShootCount(ScenePlusExt scenePlusExt){
|
|
|
|
+ Integer shootCount = null;
|
|
|
|
+ String homePath = SceneUtil.getHomePath(scenePlusExt.getDataSource());
|
|
|
|
+ JSONObject dataFdageObj = JSON.parseObject(fYunFileService.getFileContent(homePath.concat("data.fdage")));
|
|
|
|
+ if(Objects.nonNull(dataFdageObj)){
|
|
|
|
+ JSONArray points = dataFdageObj.getJSONArray("points");
|
|
|
|
+ if(CollUtil.isNotEmpty(points)){
|
|
|
|
+ shootCount = points.size();
|
|
}
|
|
}
|
|
-
|
|
|
|
- if(version < sceneEditInfo.getVersion()){
|
|
|
|
- version = sceneEditInfo.getVersion();
|
|
|
|
- }
|
|
|
|
- if(imgVersion < sceneEditInfo.getImgVersion()){
|
|
|
|
- imgVersion = sceneEditInfo.getImgVersion();
|
|
|
|
- }
|
|
|
|
- if(linkVersion < sceneEditInfo.getLinkVersion()){
|
|
|
|
- linkVersion = sceneEditInfo.getLinkVersion();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- sceneEditControls = sceneEditControlsService.getBySceneEditId(sceneEditInfo.getId());
|
|
|
|
- sceneEditInfoExt = sceneEditInfoExtService.getByEditInfoId(sceneEditInfo.getId());
|
|
|
|
- sceneEditInfo.setVersion(version + 1);
|
|
|
|
- sceneEditInfo.setImgVersion(imgVersion + 1);
|
|
|
|
- sceneEditInfo.setLinkVersion(linkVersion + 1);
|
|
|
|
- sceneEditInfo.setIsUploadObj(CommonStatus.NO.code());
|
|
|
|
- sceneEditInfoService.updateById(sceneEditInfo);
|
|
|
|
}
|
|
}
|
|
- if(sceneEditControls == null){
|
|
|
|
- sceneEditControls = new SceneEditControls();
|
|
|
|
- sceneEditControls.setEditInfoId(sceneEditInfo.getId());
|
|
|
|
- sceneEditControlsService.save(sceneEditControls);
|
|
|
|
|
|
+ if(Objects.nonNull(shootCount) && shootCount > 0){
|
|
|
|
+ return shootCount;
|
|
}
|
|
}
|
|
- if(sceneEditInfoExt == null){
|
|
|
|
- sceneEditInfoExt = new SceneEditInfoExt();
|
|
|
|
- sceneEditInfoExt.setScenePlusId(scenePlus.getId());
|
|
|
|
- sceneEditInfoExt.setEditInfoId(sceneEditInfo.getId());
|
|
|
|
- sceneEditInfoExtService.save(sceneEditInfoExt);
|
|
|
|
|
|
+
|
|
|
|
+ String slamDataStr = fYunFileService.getFileContent(homePath.concat("slam_data.json"));
|
|
|
|
+ JSONObject slamDataObj = JSON.parseObject(slamDataStr);
|
|
|
|
+ if(Objects.nonNull(slamDataObj)){
|
|
|
|
+ JSONArray viewsInfo = slamDataObj.getJSONArray("views_info");
|
|
|
|
+ if(CollUtil.isNotEmpty(viewsInfo)){
|
|
|
|
+ shootCount = viewsInfo.stream().mapToInt(info -> {
|
|
|
|
+ return ((JSONObject) info).getJSONArray("list_pose").size();
|
|
|
|
+ }).sum();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- return new Object[]{sceneEditInfo, sceneEditInfoExt, sceneEditControls};
|
|
|
|
|
|
+
|
|
|
|
+ return shootCount;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public static void main(String[] args) {
|
|
|
|
+ JSONObject dataFdageObj = JSON.parseObject(null);
|
|
|
|
+ System.out.println(dataFdageObj);
|
|
}
|
|
}
|
|
|
|
|
|
public boolean uploadHouseTypeJson(String num, String dataSource) {
|
|
public boolean uploadHouseTypeJson(String num, String dataSource) {
|