|
@@ -13,6 +13,7 @@ import com.aliyun.oss.model.ListObjectsRequest;
|
|
import com.aliyun.oss.model.OSSObjectSummary;
|
|
import com.aliyun.oss.model.OSSObjectSummary;
|
|
import com.aliyun.oss.model.ObjectListing;
|
|
import com.aliyun.oss.model.ObjectListing;
|
|
import com.aliyun.oss.model.ObjectMetadata;
|
|
import com.aliyun.oss.model.ObjectMetadata;
|
|
|
|
+import com.amazonaws.services.storagegateway.model.StorageGatewayError;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
@@ -2225,20 +2226,21 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
- LambdaUpdateWrapper<SceneEditInfo> updateWrapper =
|
|
|
|
- new LambdaUpdateWrapper<SceneEditInfo>()
|
|
|
|
- .setSql("version=version+" + 1)
|
|
|
|
- .eq(SceneEditInfo::getSceneProId, sceneProId);
|
|
|
|
-
|
|
|
|
- //如果有热点数据,更新数据库tags标识为1,否则为0
|
|
|
|
- if(hashTags){
|
|
|
|
- updateWrapper.set(SceneEditInfo::getTags, CommonStatus.YES.code());
|
|
|
|
|
|
+ SceneEditInfo sceneEditInfo = sceneEditInfoService.getBySceneProId(sceneProId);
|
|
|
|
+ if(Objects.isNull(sceneEditInfo)){
|
|
|
|
+ sceneEditInfo = new SceneEditInfo();
|
|
|
|
+ sceneEditInfo.setSceneProId(sceneProId);
|
|
|
|
+ sceneEditInfo.setTags(hashTags ? CommonStatus.YES.code() : CommonStatus.NO.code());
|
|
|
|
+ sceneEditInfoService.save(sceneEditInfo);
|
|
}else{
|
|
}else{
|
|
- updateWrapper.set(SceneEditInfo::getTags, CommonStatus.NO.code());
|
|
|
|
|
|
+ //更改场景编辑版本
|
|
|
|
+ sceneEditInfoService.update(
|
|
|
|
+ new LambdaUpdateWrapper<SceneEditInfo>()
|
|
|
|
+ .setSql("version=version+" + 1)
|
|
|
|
+ .set(SceneEditInfo::getTags, hashTags ? CommonStatus.YES.code() : CommonStatus.NO.code())
|
|
|
|
+ .eq(SceneEditInfo::getId, sceneEditInfo.getId()));
|
|
}
|
|
}
|
|
|
|
|
|
- //更改场景编辑版本
|
|
|
|
- sceneEditInfoService.update(updateWrapper);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
private void addOrUpdateHotData(String num, Map<String, String> addOrUpdateMap){
|
|
private void addOrUpdateHotData(String num, Map<String, String> addOrUpdateMap){
|
|
@@ -2635,8 +2637,8 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
-// @SystemServiceLog(description = "漫游可行")
|
|
|
|
- public ResultData saveLinkPano(SceneEditParamVO base) throws Exception {
|
|
|
|
|
|
+// @SystemServiceLog(description = "保存热点可见性的数据")
|
|
|
|
+ public ResultData saveHotVisible(SceneEditParamVO base) throws Exception {
|
|
if(StrUtil.isEmpty(base.getData()) || StrUtil.isEmpty(base.getNum())){
|
|
if(StrUtil.isEmpty(base.getData()) || StrUtil.isEmpty(base.getNum())){
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
|
|
}
|
|
}
|
|
@@ -2646,7 +2648,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
return ResultData.error(ErrorCode.FAILURE_CODE_5005);
|
|
return ResultData.error(ErrorCode.FAILURE_CODE_5005);
|
|
}
|
|
}
|
|
|
|
|
|
- JSONArray inputData = JSONObject.parseArray(base.getData());
|
|
|
|
|
|
+ JSONArray visiblePanos = JSONArray.parseArray(base.getData());
|
|
|
|
|
|
StringBuffer dataBuf = new StringBuffer()
|
|
StringBuffer dataBuf = new StringBuffer()
|
|
.append("data").append(File.separator)
|
|
.append("data").append(File.separator)
|
|
@@ -2657,48 +2659,24 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
.append("images").append(scenePro.getNum())
|
|
.append("images").append(scenePro.getNum())
|
|
.append(File.separator);
|
|
.append(File.separator);
|
|
|
|
|
|
|
|
+ StringBuffer imagesBuffer = new StringBuffer(ConstantFilePath.SCENE_PATH).append(imagesBuf.toString());
|
|
StringBuffer dataBuffer = new StringBuffer(ConstantFilePath.SCENE_PATH).append(dataBuf.toString());
|
|
StringBuffer dataBuffer = new StringBuffer(ConstantFilePath.SCENE_PATH).append(dataBuf.toString());
|
|
|
|
|
|
- File directory = new File(dataBuffer.toString());
|
|
|
|
- if (!directory.exists()) {
|
|
|
|
- directory.mkdirs();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- JSONArray inputdata = JSONArray.parseArray(base.getData());
|
|
|
|
-
|
|
|
|
- String modeldataUrl = prefixAli + imagesBuf.toString() + "vision.modeldata?t=" + System.currentTimeMillis();
|
|
|
|
- if("aws".equals(type)){
|
|
|
|
- modeldataUrl = ConstantUrl.PREFIX_AWS + imagesBuf.toString() + "vision.modeldata?t=" + System.currentTimeMillis();
|
|
|
|
- }
|
|
|
|
- FileUtils.downLoadFromUrl(modeldataUrl, "vision.modeldata", dataBuffer.toString());
|
|
|
|
- File file = new File(dataBuffer.toString() + "vision.modeldata");
|
|
|
|
- if(!file.exists()) {
|
|
|
|
- return ResultData.error(ErrorCode.FAILURE_CODE_5012);
|
|
|
|
|
|
+ File file = new File(dataBuffer.toString() + "hot.json");
|
|
|
|
+ if (!file.exists()) {
|
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_3018);
|
|
}
|
|
}
|
|
- ConvertUtils.convertVisionModelDataToTxt(dataBuffer.toString() + "vision.modeldata", dataBuffer.toString() + "vision.json");
|
|
|
|
|
|
|
|
- String str = FileUtils.readFile(dataBuffer.toString() + "vision.json");
|
|
|
|
- JSONObject json = JSONObject.parseObject(str);
|
|
|
|
- JSONArray panos = json.getJSONArray("sweepLocations");
|
|
|
|
- for (int i = 0; i < panos.size(); ++i) {
|
|
|
|
- JSONObject pano = panos.getJSONObject(i);
|
|
|
|
- for (int j = 0; j < inputData.size(); ++j) {
|
|
|
|
- JSONObject jo = inputData.getJSONObject(j);
|
|
|
|
- String currentPanoId = jo.getString("panoID");
|
|
|
|
- JSONArray visibles = jo.getJSONArray("visibles");
|
|
|
|
- JSONArray visibles3 = jo.getJSONArray("visibles3");
|
|
|
|
- if (pano.getString("uuid").equals(currentPanoId)) {
|
|
|
|
- pano.put("visibles", visibles);
|
|
|
|
- pano.put("visibles3", visibles3);
|
|
|
|
|
|
+ String str = FileUtils.readFile(dataBuffer.toString() + "hot.json");
|
|
|
|
+ JSONArray hots = JSONArray.parseArray(str);
|
|
|
|
+ for (int i = 0; i < hots.size(); ++i) {
|
|
|
|
+ JSONObject hot = hots.getJSONObject(i);
|
|
|
|
+ for (int j = 0; j < visiblePanos.size(); ++j) {
|
|
|
|
+ if (hot.getString("sid").equals(((JSONObject) visiblePanos.get(j)).getString("sid"))) {
|
|
|
|
+ hot.put("visiblePanos", ((JSONObject) visiblePanos.get(j)).getJSONArray("value"));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- FileUtils.deleteFile(dataBuffer.toString() + "vision.json");
|
|
|
|
- FileUtils.deleteFile(dataBuffer.toString() + "vision.modeldata");
|
|
|
|
- FileUtils.writeFile(dataBuffer.toString() + "vision.json", json.toString());
|
|
|
|
- ConvertUtils.convertTxtToVisionModelData(dataBuffer.toString() + "vision.json", dataBuffer.toString() + "vision.modeldata");
|
|
|
|
- uploadToOssUtil.upload(dataBuffer.toString() + "vision.modeldata", imagesBuf.toString() + "vision.modeldata");
|
|
|
|
-
|
|
|
|
String strsceneInfos = FileUtils.readFile(dataBuffer.toString() + "scene.json");
|
|
String strsceneInfos = FileUtils.readFile(dataBuffer.toString() + "scene.json");
|
|
JSONObject scenejson = new JSONObject();
|
|
JSONObject scenejson = new JSONObject();
|
|
if(strsceneInfos!=null){
|
|
if(strsceneInfos!=null){
|
|
@@ -2709,73 +2687,82 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
FileUtils.writeFile(dataBuffer.toString() + "scene.json", scenejson.toString());
|
|
FileUtils.writeFile(dataBuffer.toString() + "scene.json", scenejson.toString());
|
|
|
|
|
|
SceneProEdit sceneProEdit = sceneProEditService.findByProId(scenePro.getId());
|
|
SceneProEdit sceneProEdit = sceneProEditService.findByProId(scenePro.getId());
|
|
- if (sceneProEdit == null ) {
|
|
|
|
- return ResultData.error(ErrorCode.FAILURE_CODE_5005);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- sceneProEdit.setVersion(scenejson.getIntValue("version") + 1);
|
|
|
|
|
|
+ sceneProEdit.setVersion(sceneProEdit.getVersion() + 1);
|
|
sceneProEdit.setUpdateTime(Calendar.getInstance().getTime());
|
|
sceneProEdit.setUpdateTime(Calendar.getInstance().getTime());
|
|
sceneProEditService.updateById(sceneProEdit);
|
|
sceneProEditService.updateById(sceneProEdit);
|
|
|
|
+
|
|
|
|
+ FileUtils.deleteFile(dataBuffer.toString() + "hot.json");
|
|
|
|
+ FileUtils.writeFile(dataBuffer.toString() + "hot.json", hots.toString());
|
|
return ResultData.ok();
|
|
return ResultData.ok();
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
-// @SystemServiceLog(description = "保存热点可见性的数据")
|
|
|
|
- public ResultData saveHotVisible(SceneEditParamVO base) throws Exception {
|
|
|
|
- if(StrUtil.isEmpty(base.getData()) || StrUtil.isEmpty(base.getNum())){
|
|
|
|
- throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
|
|
|
|
- }
|
|
|
|
|
|
+// @SystemServiceLog(description = "漫游可行")
|
|
|
|
+ public ResultData saveLinkPano(SaveRoamParamVO param) throws Exception {
|
|
|
|
|
|
- ScenePro scenePro = findBySceneNum(base.getNum());
|
|
|
|
|
|
+ ScenePro scenePro = this.findBySceneNum(param.getNum());
|
|
if (scenePro == null ) {
|
|
if (scenePro == null ) {
|
|
return ResultData.error(ErrorCode.FAILURE_CODE_5005);
|
|
return ResultData.error(ErrorCode.FAILURE_CODE_5005);
|
|
}
|
|
}
|
|
|
|
|
|
- JSONArray visiblePanos = JSONArray.parseArray(base.getData());
|
|
|
|
|
|
+ JSONArray inputData = JSONObject.parseArray(param.getData());
|
|
|
|
|
|
- StringBuffer dataBuf = new StringBuffer()
|
|
|
|
- .append("data").append(File.separator)
|
|
|
|
- .append("data").append(scenePro.getNum())
|
|
|
|
- .append(File.separator);
|
|
|
|
- StringBuffer imagesBuf = new StringBuffer()
|
|
|
|
- .append("images").append(File.separator)
|
|
|
|
- .append("images").append(scenePro.getNum())
|
|
|
|
- .append(File.separator);
|
|
|
|
|
|
+ String localDataPath = String.format(ConstantFilePath.DATABUFFER_FORMAT, param.getNum());
|
|
|
|
+ File directory = new File(localDataPath);
|
|
|
|
+ if (!directory.exists()) {
|
|
|
|
+ directory.mkdirs();
|
|
|
|
+ }
|
|
|
|
+ String editImagesPath = String.format(UploadFilePath.IMG_EDIT_PATH, param.getNum());
|
|
|
|
+ String modeldataUrl = prefixAli + editImagesPath + "vision.modeldata?t=" + System.currentTimeMillis();
|
|
|
|
|
|
- StringBuffer imagesBuffer = new StringBuffer(ConstantFilePath.SCENE_PATH).append(imagesBuf.toString());
|
|
|
|
- StringBuffer dataBuffer = new StringBuffer(ConstantFilePath.SCENE_PATH).append(dataBuf.toString());
|
|
|
|
|
|
+ //如果是云存储,将vision.modeldata下载到本地,如果是本地存储,场景计算完就已经将这个文件拷贝到编辑目录了存在这个文件了,不需要再下载
|
|
|
|
+ if(!StorageType.LOCAL.code().equals(this.type)){
|
|
|
|
+ FileUtils.downLoadFromUrl(modeldataUrl, "vision.modeldata", localDataPath);
|
|
|
|
+ }
|
|
|
|
|
|
- File file = new File(dataBuffer.toString() + "hot.json");
|
|
|
|
- if (!file.exists()) {
|
|
|
|
- throw new BusinessException(ErrorCode.FAILURE_CODE_3018);
|
|
|
|
|
|
+ //检查vision.modeldata本地是否存在,不存在抛出异常
|
|
|
|
+ File file = new File(localDataPath + "vision.modeldata");
|
|
|
|
+ if(!file.exists()) {
|
|
|
|
+ return ResultData.error(ErrorCode.FAILURE_CODE_5012);
|
|
}
|
|
}
|
|
|
|
+ //将vision.modeldata解压缩至vision.json
|
|
|
|
+ ConvertUtils.convertVisionModelDataToTxt(localDataPath + "vision.modeldata", localDataPath + "vision.json");
|
|
|
|
|
|
- String str = FileUtils.readFile(dataBuffer.toString() + "hot.json");
|
|
|
|
- JSONArray hots = JSONArray.parseArray(str);
|
|
|
|
- for (int i = 0; i < hots.size(); ++i) {
|
|
|
|
- JSONObject hot = hots.getJSONObject(i);
|
|
|
|
- for (int j = 0; j < visiblePanos.size(); ++j) {
|
|
|
|
- if (hot.getString("sid").equals(((JSONObject) visiblePanos.get(j)).getString("sid"))) {
|
|
|
|
- hot.put("visiblePanos", ((JSONObject) visiblePanos.get(j)).getJSONArray("value"));
|
|
|
|
|
|
+ String str = FileUtils.readFile(localDataPath + "vision.json");
|
|
|
|
+ JSONObject json = JSONObject.parseObject(str);
|
|
|
|
+ JSONArray panos = json.getJSONArray("sweepLocations");
|
|
|
|
+ for (int i = 0; i < panos.size(); ++i) {
|
|
|
|
+ JSONObject pano = panos.getJSONObject(i);
|
|
|
|
+ for (int j = 0; j < inputData.size(); ++j) {
|
|
|
|
+ JSONObject jo = inputData.getJSONObject(j);
|
|
|
|
+ String currentPanoId = jo.getString("panoID");
|
|
|
|
+ JSONArray visibles = jo.getJSONArray("visibles");
|
|
|
|
+ JSONArray visibles3 = jo.getJSONArray("visibles3");
|
|
|
|
+ if (pano.getString("uuid").equals(currentPanoId)) {
|
|
|
|
+ pano.put("visibles", visibles);
|
|
|
|
+ pano.put("visibles3", visibles3);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- String strsceneInfos = FileUtils.readFile(dataBuffer.toString() + "scene.json");
|
|
|
|
- JSONObject scenejson = new JSONObject();
|
|
|
|
- if(strsceneInfos!=null){
|
|
|
|
- scenejson = JSONObject.parseObject(strsceneInfos);
|
|
|
|
- }
|
|
|
|
|
|
+ FileUtils.deleteFile(localDataPath + "vision.json");
|
|
|
|
+ FileUtils.deleteFile(localDataPath + "vision.modeldata");
|
|
|
|
+ FileUtils.writeFile(localDataPath + "vision.json", json.toString());
|
|
|
|
+ ConvertUtils.convertTxtToVisionModelData(localDataPath + "vision.json", localDataPath + "vision.modeldata");
|
|
|
|
+ uploadToOssUtil.upload(localDataPath + "vision.modeldata", editImagesPath + "vision.modeldata");
|
|
|
|
|
|
- scenejson.put("version", scenejson.getIntValue("version") + 1);
|
|
|
|
- FileUtils.writeFile(dataBuffer.toString() + "scene.json", scenejson.toString());
|
|
|
|
|
|
+ //更新版本号
|
|
|
|
+ SceneEditInfo editInfo = sceneEditInfoService.getBySceneProId(scenePro.getId());
|
|
|
|
+ if(Objects.isNull(editInfo)){
|
|
|
|
+ editInfo = new SceneEditInfo();
|
|
|
|
+ editInfo.setSceneProId(scenePro.getId());
|
|
|
|
+ sceneEditInfoService.save(editInfo);
|
|
|
|
+ }else{
|
|
|
|
+ sceneEditInfoService.update(new LambdaUpdateWrapper<SceneEditInfo>()
|
|
|
|
+ .setSql("version=version+" + 1)
|
|
|
|
+ .eq(SceneEditInfo::getId, editInfo.getId()));
|
|
|
|
+ }
|
|
|
|
|
|
- SceneProEdit sceneProEdit = sceneProEditService.findByProId(scenePro.getId());
|
|
|
|
- sceneProEdit.setVersion(sceneProEdit.getVersion() + 1);
|
|
|
|
- sceneProEdit.setUpdateTime(Calendar.getInstance().getTime());
|
|
|
|
- sceneProEditService.updateById(sceneProEdit);
|
|
|
|
|
|
|
|
- FileUtils.deleteFile(dataBuffer.toString() + "hot.json");
|
|
|
|
- FileUtils.writeFile(dataBuffer.toString() + "hot.json", hots.toString());
|
|
|
|
return ResultData.ok();
|
|
return ResultData.ok();
|
|
}
|
|
}
|
|
|
|
|