|
@@ -20,11 +20,10 @@ import com.fdkankan.common.util.CreateObjUtil;
|
|
|
import com.fdkankan.common.util.FileUtils;
|
|
|
import com.fdkankan.common.util.MatrixToImageWriterUtil;
|
|
|
import com.fdkankan.common.util.OkHttpUtils;
|
|
|
-import com.fdkankan.fyun.constant.StorageType;
|
|
|
-import com.fdkankan.fyun.oss.UploadToOssUtil;
|
|
|
+import com.fdkankan.fyun.constant.FYunTypeEnum;
|
|
|
+import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
|
import com.fdkankan.redis.constant.RedisKey;
|
|
|
import com.fdkankan.redis.util.RedisUtil;
|
|
|
-import com.fdkankan.scene.annotation.CheckCurrentUser;
|
|
|
import com.fdkankan.scene.annotation.SystemServiceLog;
|
|
|
import com.fdkankan.scene.bean.RequestSceneEdit;
|
|
|
import com.fdkankan.scene.bean.RequestSceneProV4;
|
|
@@ -56,8 +55,6 @@ import java.util.Objects;
|
|
|
import java.util.Set;
|
|
|
import java.util.UUID;
|
|
|
import java.util.stream.Collectors;
|
|
|
-import javax.servlet.http.HttpServletRequest;
|
|
|
-import javax.servlet.http.HttpServletResponse;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import net.coobird.thumbnailator.Thumbnails;
|
|
|
import org.joda.time.DateTime;
|
|
@@ -67,8 +64,6 @@ import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.ObjectUtils;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
/**
|
|
@@ -94,7 +89,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
@Autowired
|
|
|
private ISceneProEditService sceneProEditService;
|
|
|
@Autowired
|
|
|
- private UploadToOssUtil uploadToOssUtil;
|
|
|
+ private FYunFileServiceInterface fYunFileService;
|
|
|
@Autowired
|
|
|
private ISceneService sceneService;
|
|
|
|
|
@@ -108,11 +103,9 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
private String hotDomainList;
|
|
|
@Value("${hot.delete}")
|
|
|
private String hotDelete;
|
|
|
- @Value("${prefix.ali}")
|
|
|
- private String prefixAli;
|
|
|
- @Value("${prefix.s3}")
|
|
|
- private String prefixS3;
|
|
|
- @Value("upload.type")
|
|
|
+ @Value("${fyun.host}")
|
|
|
+ private String ossPrefixUrl;
|
|
|
+ @Value("fyun.type")
|
|
|
private String ossType;
|
|
|
|
|
|
@Override
|
|
@@ -344,7 +337,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
}
|
|
|
|
|
|
if(toOss != null && "1".equals(toOss)){
|
|
|
- uploadToOssUtil.upload(path + File.separator + fileName, "images"+File.separator+"images"+sceneNum + File.separator + fileName);
|
|
|
+ fYunFileService.uploadFile(path + File.separator + fileName, "images"+File.separator+"images"+sceneNum + File.separator + fileName);
|
|
|
}
|
|
|
|
|
|
return ResultData.ok(targetFile.getName());
|
|
@@ -754,10 +747,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
|
|
|
if(sceneProEditEntity.getThumbStatus() == 1)
|
|
|
{
|
|
|
- sceneProEntity.setThumb(prefixAli + imagesBuf.toString() + "thumbSmallImg.jpg");
|
|
|
- if(StorageType.AWS.code().equals(this.ossType)){
|
|
|
- sceneProEntity.setThumb(prefixS3 + imagesBuf.toString() + "thumbSmallImg.jpg");
|
|
|
- }
|
|
|
+ sceneProEntity.setThumb(ossPrefixUrl + imagesBuf.toString() + "thumbSmallImg.jpg");
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -947,12 +937,12 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
|
|
|
if(scenejson.getIntValue("buildImages") == 1){
|
|
|
log.info("下载vision.modeldata文件");
|
|
|
- if(StorageType.AWS.code().equals(this.ossType)){
|
|
|
+ if(FYunTypeEnum.AWS.code().equals(this.ossType)){
|
|
|
FileUtils.downLoadFromUrl(ConstantUrl.PREFIX_AWS + "images/images" + sceneProEntity.getNum() + "/vision.modeldata" + "?m="+new Date().getTime(),
|
|
|
"vision.modeldata", target + File.separator + "extras" + File.separator);
|
|
|
}
|
|
|
- if(StorageType.OSS.code().equals(this.ossType)){
|
|
|
- FileUtils.downLoadFromUrl(prefixAli + "images/images" + sceneProEntity.getNum() + "/vision.modeldata" + "?m="+new Date().getTime(),
|
|
|
+ if(FYunTypeEnum.OSS.code().equals(this.ossType)){
|
|
|
+ FileUtils.downLoadFromUrl(ossPrefixUrl + "images/images" + sceneProEntity.getNum() + "/vision.modeldata" + "?m="+new Date().getTime(),
|
|
|
"vision.modeldata", target + File.separator + "extras" + File.separator);
|
|
|
}
|
|
|
CreateObjUtil.convertVisionmodeldataToTxt(target + File.separator + "extras" + File.separator + "vision.modeldata",
|
|
@@ -993,7 +983,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
FileUtils.delAllFile(target + File.separator + "results");
|
|
|
}
|
|
|
//下载data.fdage
|
|
|
- if(StorageType.AWS.code().equals(this.ossType)){
|
|
|
+ if(FYunTypeEnum.AWS.code().equals(this.ossType)){
|
|
|
//亚马逊保持旧方式,超链接capture
|
|
|
CreateObjUtil.createSoftConnection(path + File.separator + "capture", target + File.separator + "capture");
|
|
|
}
|
|
@@ -1059,13 +1049,13 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
}
|
|
|
if(video.exists() && video.listFiles() != null && video.listFiles().length > 0){
|
|
|
for(String videoName : video.list()){
|
|
|
- uploadToOssUtil.upload(target + File.separator + "extras/video/" + videoName,"video/video"+
|
|
|
+ fYunFileService.uploadFile(target + File.separator + "extras/video/" + videoName,"video/video"+
|
|
|
sceneProEntity.getNum()+ File.separator + videoName);
|
|
|
|
|
|
CreateObjUtil.mp4ToFlv(target + File.separator + "extras/video/" + videoName,
|
|
|
target + File.separator + "extras/video/" + videoName.replace("mp4", "flv"));
|
|
|
|
|
|
- uploadToOssUtil.upload(target + File.separator + "extras/video/" + videoName.replace("mp4", "flv"),"video/video"+
|
|
|
+ fYunFileService.uploadFile(target + File.separator + "extras/video/" + videoName.replace("mp4", "flv"),"video/video"+
|
|
|
sceneProEntity.getNum()+ File.separator + videoName.replace("mp4", "flv"));
|
|
|
|
|
|
//覆盖原始视频资源
|
|
@@ -1100,13 +1090,13 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
}else if(scenejson.getIntValue("buildImages") == 2){
|
|
|
if(video.exists() && video.listFiles() != null && video.listFiles().length > 0){
|
|
|
for(String videoName : video.list()){
|
|
|
- uploadToOssUtil.upload(target + File.separator + "extras/video/" + videoName,"video/video"+
|
|
|
+ fYunFileService.uploadFile(target + File.separator + "extras/video/" + videoName,"video/video"+
|
|
|
sceneProEntity.getNum()+ File.separator + videoName);
|
|
|
|
|
|
CreateObjUtil.mp4ToFlv(target + File.separator + "extras/video/" + videoName,
|
|
|
target + File.separator + "extras/video/" + videoName.replace("mp4", "flv"));
|
|
|
|
|
|
- uploadToOssUtil.upload(target + File.separator + "extras/video/" + videoName.replace("mp4", "flv"),"video/video"+
|
|
|
+ fYunFileService.uploadFile(target + File.separator + "extras/video/" + videoName.replace("mp4", "flv"),"video/video"+
|
|
|
sceneProEntity.getNum()+ File.separator + videoName.replace("mp4", "flv"));
|
|
|
|
|
|
//覆盖原始视频资源
|
|
@@ -1210,7 +1200,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
FileUtils.writeFile(dataBuffer.toString() + "scene.json", scenejson.toString());
|
|
|
|
|
|
if(map.size()>0) {
|
|
|
- uploadToOssUtil.uploadMulFiles(map);
|
|
|
+ fYunFileService.uploadMulFiles(map);
|
|
|
}
|
|
|
this.updateById(sceneProEntity);
|
|
|
sceneProEditService.updateById(sceneProEditEntity);
|
|
@@ -1419,12 +1409,12 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
FileUtils.writeFile(ConstantFilePath.SCENE_PATH+"data"+File.separator+"data"+sceneEdit.getSceneNum() + File.separator + "floor.json", new String(sceneEdit.getWebFloor().getBytes(), "UTF-8"));
|
|
|
//下载vision.modeldata,解压成vision.txt,并且删除vision.modeldata
|
|
|
log.info("下载vision.modeldata文件");
|
|
|
- if(StorageType.AWS.code().equals(ossType)){
|
|
|
+ if(FYunTypeEnum.AWS.code().equals(ossType)){
|
|
|
FileUtils.downLoadFromUrl(ConstantUrl.PREFIX_AWS + "images/images" + sceneEdit.getSceneNum() + "/vision.modeldata" + "?m="+new Date().getTime(),
|
|
|
"vision.modeldata", target + File.separator + "extras" + File.separator);
|
|
|
}
|
|
|
- if(StorageType.OSS.code().equals(this.ossType)){
|
|
|
- FileUtils.downLoadFromUrl(prefixAli + "images/images" + sceneEdit.getSceneNum() + "/vision.modeldata" + "?m="+new Date().getTime(),
|
|
|
+ if(FYunTypeEnum.OSS.code().equals(this.ossType)){
|
|
|
+ FileUtils.downLoadFromUrl(ossPrefixUrl + "images/images" + sceneEdit.getSceneNum() + "/vision.modeldata" + "?m="+new Date().getTime(),
|
|
|
"vision.modeldata", target + File.separator + "extras" + File.separator);
|
|
|
}
|
|
|
CreateObjUtil.convertVisionmodeldataToTxt(target + File.separator + "extras" + File.separator + "vision.modeldata",
|
|
@@ -1433,11 +1423,11 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
FileUtils.deleteFile(target + File.separator + "extras" + File.separator + "vision.modeldata");
|
|
|
|
|
|
log.info("下载vision2.modeldata文件");
|
|
|
- if(StorageType.OSS.code().equals(ossType)){
|
|
|
- FileUtils.downLoadFromUrl(prefixAli + "images/images" + sceneEdit.getSceneNum() + "/vision2.modeldata" + "?m="+new Date().getTime(),
|
|
|
+ if(FYunTypeEnum.OSS.code().equals(ossType)){
|
|
|
+ FileUtils.downLoadFromUrl(ossPrefixUrl + "images/images" + sceneEdit.getSceneNum() + "/vision2.modeldata" + "?m="+new Date().getTime(),
|
|
|
"vision2.modeldata", target + File.separator + "extras" + File.separator);
|
|
|
}
|
|
|
- if(StorageType.AWS.code().equals(ossType)){
|
|
|
+ if(FYunTypeEnum.AWS.code().equals(ossType)){
|
|
|
FileUtils.downLoadFromUrl(ConstantUrl.PREFIX_AWS + "images/images" + sceneEdit.getSceneNum() + "/vision2.modeldata" + "?m="+new Date().getTime(),
|
|
|
"vision2.modeldata", target + File.separator + "extras" + File.separator);
|
|
|
}
|
|
@@ -1526,7 +1516,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
}
|
|
|
|
|
|
FileUtils.copyFile(sceneProEntity.getDataSource() + "/results/floor.json", dataBuffer.toString() + "houst_floor.json", true);
|
|
|
- uploadToOssUtil.upload(dataBuffer.toString() + "houst_floor.json", dataBuf.toString() + "houst_floor.json");
|
|
|
+ fYunFileService.uploadFile(dataBuffer.toString() + "houst_floor.json", dataBuf.toString() + "houst_floor.json");
|
|
|
|
|
|
String result = FileUtils.readFile(dataBuffer.toString() + "houst_floor.json");
|
|
|
return ResultData.ok(result);
|
|
@@ -1534,7 +1524,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
|
|
|
FileUtils.writeFile(dataBuffer.toString() + "houst_floor.json", floorJsonData);
|
|
|
|
|
|
- uploadToOssUtil.upload(dataBuffer.toString() + "houst_floor.json", dataBuf.toString() + "houst_floor.json");
|
|
|
+ fYunFileService.uploadFile(dataBuffer.toString() + "houst_floor.json", dataBuf.toString() + "houst_floor.json");
|
|
|
return ResultData.ok(floorJsonData);
|
|
|
}
|
|
|
|
|
@@ -1637,7 +1627,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if(!StorageType.AWS.code().equals(this.ossType)){
|
|
|
+ if(!FYunTypeEnum.AWS.code().equals(this.ossType)){
|
|
|
JSONObject paramData = new JSONObject();
|
|
|
paramData.put("hotId", sid);
|
|
|
JSONObject hotListJson = JSONObject.parseObject(OkHttpUtils.httpGet(hotDomainList));
|
|
@@ -1795,10 +1785,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
|
|
|
JSONArray inputdata = JSONArray.parseArray(base.getData());
|
|
|
|
|
|
- String modeldataUrl = prefixAli + imagesBuf.toString() + "vision.modeldata?t=" + System.currentTimeMillis();
|
|
|
- if(StorageType.AWS.equals(this.ossType)){
|
|
|
- modeldataUrl =this.prefixS3 + imagesBuf.toString() + "vision.modeldata?t=" + System.currentTimeMillis();
|
|
|
- }
|
|
|
+ String modeldataUrl = ossPrefixUrl + 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()) {
|
|
@@ -1826,7 +1813,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
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");
|
|
|
+ fYunFileService.uploadFile(dataBuffer.toString() + "vision.modeldata", imagesBuf.toString() + "vision.modeldata");
|
|
|
|
|
|
String strsceneInfos = FileUtils.readFile(dataBuffer.toString() + "scene.json");
|
|
|
JSONObject scenejson = new JSONObject();
|
|
@@ -2207,8 +2194,8 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
|
|
|
CreateObjUtil.mp4ToFlv(path + File.separator + fileName, path + File.separator + fileName.replace("mp4", "flv"));
|
|
|
|
|
|
- uploadToOssUtil.upload(path + File.separator + fileName, "images"+File.separator+"images"+sceneNum + File.separator + fileName);
|
|
|
- uploadToOssUtil.upload(path + File.separator + fileName.replace("mp4", "flv"), "images"+File.separator+"images"+sceneNum + File.separator + fileName.replace("mp4", "flv"));
|
|
|
+ fYunFileService.uploadFile(path + File.separator + fileName, "images"+File.separator+"images"+sceneNum + File.separator + fileName);
|
|
|
+ fYunFileService.uploadFile(path + File.separator + fileName.replace("mp4", "flv"), "images"+File.separator+"images"+sceneNum + File.separator + fileName.replace("mp4", "flv"));
|
|
|
}
|
|
|
|
|
|
return ResultData.ok(fileName);
|
|
@@ -2327,7 +2314,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
}
|
|
|
|
|
|
String path = ConstantFilePath.SCENE_PATH+"data"+File.separator+"data"+sceneNum;
|
|
|
- uploadToOssUtil.upload(path + File.separator + "hot.json", "data"+File.separator+"data"+sceneNum + File.separator + "hot.json");
|
|
|
+ fYunFileService.uploadFile(path + File.separator + "hot.json", "data"+File.separator+"data"+sceneNum + File.separator + "hot.json");
|
|
|
|
|
|
return ResultData.ok();
|
|
|
}
|
|
@@ -2438,7 +2425,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
FileUtils.delAllFile(target + File.separator + "results");
|
|
|
}
|
|
|
//下载data.fdage
|
|
|
- if(StorageType.AWS.code().equals(this.ossType)){
|
|
|
+ if(FYunTypeEnum.AWS.code().equals(this.ossType)){
|
|
|
//亚马逊保持旧方式,超链接capture
|
|
|
CreateObjUtil.createSoftConnection(path + File.separator + "capture", target + File.separator + "capture");
|
|
|
}
|
|
@@ -2495,7 +2482,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
//上传全景图
|
|
|
map.put(filePath, "images/images"+ sceneProEntity.getNum()+ File.separator + "pan/high/" + imagesName);
|
|
|
|
|
|
- uploadToOssUtil.uploadMulFiles(map);
|
|
|
+ fYunFileService.uploadMulFiles(map);
|
|
|
|
|
|
String strsceneInfos = FileUtils.readFile(dataBuffer.toString() + "scene.json");
|
|
|
JSONObject scenejson = new JSONObject();
|
|
@@ -2560,7 +2547,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
String target = imagesBuffer.toString() + "panorama/" + sid;
|
|
|
FileUtils.deleteDirectory(target);
|
|
|
// uploadToOssUtil.deleteFile(imagesBuf.toString() + "panorama/" + sid);
|
|
|
- uploadToOssUtil.deleteFile(imagesBuf.toString() + "panorama_edit/" + sid);
|
|
|
+ fYunFileService.deleteFolder(imagesBuf.toString() + "panorama_edit/" + sid);
|
|
|
}
|
|
|
|
|
|
return ResultData.ok();
|
|
@@ -2701,7 +2688,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
|
|
|
if("video".equals(type)){
|
|
|
//使用oss的路径
|
|
|
- url = prefixAli + "video/video" + sceneProEntity.getNum() + "/" + planId + ".mp4";
|
|
|
+ url = ossPrefixUrl + "video/video" + sceneProEntity.getNum() + "/" + planId + ".mp4";
|
|
|
}
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
map.put("fileUrl", url + "?t=" + System.currentTimeMillis());
|