|
@@ -122,6 +122,8 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
private int maxCheckTimes;
|
|
|
@Value("${ecs.checkFile.waitTime:5000}")
|
|
|
private int waitTime;
|
|
|
+ @Value("${fyun.host}")
|
|
|
+ private String fyunHost;
|
|
|
|
|
|
@Override
|
|
|
public ResultData upgradeToV4ResultSync(RequestSceneProV4 param) throws Exception {
|
|
@@ -3380,4 +3382,74 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
return Result.success(mainUrl + "/" + sceneProNewUrl + param.getNum());
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ResultData downloadPanoramaData(String sceneNum) throws Exception {
|
|
|
+ ScenePro sceneProEntity = findBySceneNum(sceneNum);
|
|
|
+ if(sceneProEntity == null){
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
|
|
|
+ }
|
|
|
+ StringBuffer imagesBuf = new StringBuffer().append("images").append(File.separator)
|
|
|
+ .append("images").append(sceneProEntity.getNum()).append(File.separator);
|
|
|
+
|
|
|
+ StringBuffer imagesBuffer = new StringBuffer(ConstantFilePath.SCENE_PATH).append(imagesBuf.toString());
|
|
|
+
|
|
|
+ String highPath = sceneProEntity.getDataSource() + "/results/high";
|
|
|
+ if(!new File(highPath).exists()){
|
|
|
+ fYunFileService.downloadFileByCommand(highPath, sceneProEntity.getDataSource().replace(ConstantFilePath.BUILD_MODEL_LASER_PATH,ConstantFilePath.OSS_PREFIX).replace(ConstantFilePath.BUILD_MODEL_PATH,ConstantFilePath.OSS_PREFIX)+"_results/results/high/");
|
|
|
+ if(!new File(highPath).exists()){
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_5012);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //获取高清图,拷贝高清图
|
|
|
+ String content = FileUtils.readFile(sceneProEntity.getDataSource() + "/results/vision.txt");
|
|
|
+ if (!ObjectUtils.isEmpty(content)) {
|
|
|
+ File file = new File(highPath.concat("/pano"));
|
|
|
+ if(!file.exists()){
|
|
|
+ file.mkdirs();
|
|
|
+ }
|
|
|
+ JSONObject.parseObject(content).getJSONArray("sweepLocations").stream()
|
|
|
+ .map(o -> (JSONObject) o)
|
|
|
+ .map(o -> o.getString("uuid"))
|
|
|
+ .forEach(fileName -> FileUtils.copyFile(sceneProEntity.getDataSource().concat("/caches/images/").concat(fileName).concat(".jpg"),
|
|
|
+ highPath.concat("/pano/").concat(fileName).concat(".jpg"), true)
|
|
|
+
|
|
|
+ );
|
|
|
+ }
|
|
|
+ if(!new File(imagesBuffer.toString()).exists()){
|
|
|
+ new File(imagesBuffer.toString()).mkdirs();
|
|
|
+ }
|
|
|
+ ZipUtil.zip(highPath, imagesBuffer.toString() + sceneNum + "-high.zip");
|
|
|
+ fYunFileService.uploadFileByCommand(imagesBuffer.toString() + sceneNum + "-high.zip", imagesBuf.toString() + sceneNum + "-high.zip");
|
|
|
+ return ResultData.ok(fyunHost + imagesBuf.toString() + sceneNum + "-high.zip?t=" + System.currentTimeMillis());
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ResultData downloadVisionData(String sceneNum) throws Exception {
|
|
|
+ ScenePro sceneProEntity = findBySceneNum(sceneNum);
|
|
|
+ if(sceneProEntity == null){
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
|
|
|
+ }
|
|
|
+ StringBuffer dataBuf = new StringBuffer().append("data").append(File.separator)
|
|
|
+ .append("data").append(sceneProEntity.getNum()).append(File.separator);
|
|
|
+
|
|
|
+ StringBuffer imagesBuf = new StringBuffer().append("images").append(File.separator)
|
|
|
+ .append("images").append(sceneProEntity.getNum()).append(File.separator);
|
|
|
+
|
|
|
+ StringBuffer dataBuffer = new StringBuffer(ConstantFilePath.SCENE_PATH).append(dataBuf.toString());
|
|
|
+ StringBuffer imagesBuffer = new StringBuffer(ConstantFilePath.SCENE_PATH).append(imagesBuf.toString());
|
|
|
+
|
|
|
+
|
|
|
+ fYunFileService.downloadFile(imagesBuf.toString() + "vision.modeldata", dataBuffer.toString() + "vision.modeldata");
|
|
|
+ File file = new File(dataBuffer.toString() + "vision.modeldata");
|
|
|
+ if(!file.exists()) {
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_5012);
|
|
|
+ }
|
|
|
+ ConvertUtils.convertVisionModelDataToTxt(dataBuffer.toString() + "vision.modeldata", dataBuffer.toString() + "vision.json");
|
|
|
+
|
|
|
+ fYunFileService.uploadFile(dataBuffer.toString() + "vision.json", dataBuf.toString() + "vision.json");
|
|
|
+ return ResultData.ok(fyunHost + dataBuf.toString() + "vision.json?t=" + System.currentTimeMillis());
|
|
|
+ }
|
|
|
}
|