|
@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
+import com.amazonaws.services.devicefarm.model.UploadType;
|
|
import com.fdkankan.common.constant.ConstantFilePath;
|
|
import com.fdkankan.common.constant.ConstantFilePath;
|
|
import com.fdkankan.common.constant.ConstantUrl;
|
|
import com.fdkankan.common.constant.ConstantUrl;
|
|
import com.fdkankan.common.constant.UploadFilePath;
|
|
import com.fdkankan.common.constant.UploadFilePath;
|
|
@@ -12,6 +13,7 @@ import com.fdkankan.common.util.CreateObjUtil;
|
|
import com.fdkankan.common.util.FileUtil;
|
|
import com.fdkankan.common.util.FileUtil;
|
|
import com.fdkankan.common.util.FileUtils;
|
|
import com.fdkankan.common.util.FileUtils;
|
|
import com.fdkankan.dingtalk.DingTalkSendUtils;
|
|
import com.fdkankan.dingtalk.DingTalkSendUtils;
|
|
|
|
+import com.fdkankan.fyun.constant.StorageType;
|
|
import com.fdkankan.fyun.oss.UploadToOssUtil;
|
|
import com.fdkankan.fyun.oss.UploadToOssUtil;
|
|
import com.fdkankan.modeling.constants.SysConstants;
|
|
import com.fdkankan.modeling.constants.SysConstants;
|
|
import com.fdkankan.mq.message.BuildSceneMqMessage;
|
|
import com.fdkankan.mq.message.BuildSceneMqMessage;
|
|
@@ -180,7 +182,7 @@ public class BuildSceneMQListener implements RocketMQListener<String> {
|
|
boolean buildSuccess = Boolean.FALSE;
|
|
boolean buildSuccess = Boolean.FALSE;
|
|
String projectNum = null;
|
|
String projectNum = null;
|
|
Long computeTime = null;//计算耗时
|
|
Long computeTime = null;//计算耗时
|
|
- com.alibaba.fastjson.JSONObject videosJson = null;
|
|
|
|
|
|
+ JSONObject videosJson = null;
|
|
//如果mq生产者在消息体中执行了计算结果mq的主题名,就发到这个主题名,否则就发送到配置的主题名
|
|
//如果mq生产者在消息体中执行了计算结果mq的主题名,就发到这个主题名,否则就发送到配置的主题名
|
|
buildSceneResultTopic = StrUtil.isNotBlank(message.getResultReceiverMqName()) ?
|
|
buildSceneResultTopic = StrUtil.isNotBlank(message.getResultReceiverMqName()) ?
|
|
message.getResultReceiverMqName() : buildSceneResultTopic;
|
|
message.getResultReceiverMqName() : buildSceneResultTopic;
|
|
@@ -238,7 +240,6 @@ public class BuildSceneMQListener implements RocketMQListener<String> {
|
|
|
|
|
|
//4表示硬件部研发的双球目相机,其余为旧版本相机
|
|
//4表示硬件部研发的双球目相机,其余为旧版本相机
|
|
if(Integer.parseInt(cameraType) < 3){
|
|
if(Integer.parseInt(cameraType) < 3){
|
|
-
|
|
|
|
for(int i = 0;i<5;++i){
|
|
for(int i = 0;i<5;++i){
|
|
try{
|
|
try{
|
|
FileUtils.downLoadFromUrl(prefix+imgsName+"?m="+new Date().getTime(), imgsName,
|
|
FileUtils.downLoadFromUrl(prefix+imgsName+"?m="+new Date().getTime(), imgsName,
|
|
@@ -291,74 +292,39 @@ public class BuildSceneMQListener implements RocketMQListener<String> {
|
|
|
|
|
|
long start = System.currentTimeMillis();
|
|
long start = System.currentTimeMillis();
|
|
|
|
|
|
- //cameraType=5为新版本双目, cameraType=6为小红屋新版本双目
|
|
|
|
- if(Integer.parseInt(cameraType) == 5 || Integer.parseInt(cameraType) == 6){
|
|
|
|
- path = ConstantFilePath.BUILD_MODEL_PATH + unicode;
|
|
|
|
-
|
|
|
|
- //下载zip包
|
|
|
|
- FileUtils.downLoadFromUrl(prefix + "/" + imgsName + "?m=" + System.currentTimeMillis(), imgsName, path + File.separator + "capture");
|
|
|
|
- //解压
|
|
|
|
- FileUtils.decompress(path + File.separator + "capture" + File.separator + imgsName,
|
|
|
|
- path + File.separator + "capture") ;
|
|
|
|
- //删除压缩包
|
|
|
|
- FileUtil.delFile(path + File.separator + "capture" + File.separator + imgsName);
|
|
|
|
- }else if(Integer.parseInt(cameraType) == 14 ) {
|
|
|
|
- CreateObjUtil.ossUtilCp(ConstantFilePath.OSS_PREFIX + cameraName.replace("4DKKPRO_", "")
|
|
|
|
- .replace("-fdage", "").toLowerCase() + File.separator + fileId + File.separator
|
|
|
|
- + unicode + File.separator,
|
|
|
|
- ConstantFilePath.BUILD_MODEL_LASER_PATH + cameraName.replace("4DKKPRO_", "")
|
|
|
|
- .replace("-fdage", "").toLowerCase() + File.separator + fileId + File.separator
|
|
|
|
- + unicode + File.separator + "capture");
|
|
|
|
- path = ConstantFilePath.BUILD_MODEL_LASER_PATH + cameraName.replace("4DKKPRO_", "").replace("-fdage", "").toLowerCase() + File.separator + fileId + File.separator + unicode;
|
|
|
|
- } else if(Integer.parseInt(cameraType) >= 4 ) {
|
|
|
|
- CreateObjUtil.ossUtilCp(ConstantFilePath.OSS_PREFIX + cameraName.replace("4DKKPRO_", "")
|
|
|
|
- .replace("-fdage", "").toLowerCase() + File.separator + fileId + File.separator
|
|
|
|
- + unicode + File.separator,
|
|
|
|
- ConstantFilePath.BUILD_MODEL_PATH + cameraName.replace("4DKKPRO_", "")
|
|
|
|
- .replace("-fdage", "").toLowerCase() + File.separator + fileId + File.separator
|
|
|
|
- + unicode + File.separator + "capture");
|
|
|
|
- path = ConstantFilePath.BUILD_MODEL_PATH + cameraName.replace("4DKKPRO_", "").replace("-fdage", "").toLowerCase() + File.separator + fileId + File.separator + unicode;
|
|
|
|
- }
|
|
|
|
- String data = FileUtils.readFile(path + File.separator + "capture" +File.separator+"data.fdage");
|
|
|
|
|
|
+ //下载资源到本地
|
|
|
|
+ path = this.downLoadSource(path, Integer.valueOf(cameraType), cameraName, unicode, fileId, imgsName, prefix);
|
|
|
|
+
|
|
|
|
+ String dataFdagePath = path + File.separator + "capture" +File.separator+"data.fdage";
|
|
|
|
+ log.info("dataFdagePath 文件路径 :{}", dataFdagePath);
|
|
|
|
+ String data = FileUtils.readFile(dataFdagePath);
|
|
//获取data.fdage的内容
|
|
//获取data.fdage的内容
|
|
JSONObject dataJson = new JSONObject();
|
|
JSONObject dataJson = new JSONObject();
|
|
if(data!=null){
|
|
if(data!=null){
|
|
dataJson = JSONObject.parseObject(data);
|
|
dataJson = JSONObject.parseObject(data);
|
|
}
|
|
}
|
|
- //判断是否计算过资源,若计算过删除缓存
|
|
|
|
- File caches = new File(path + File.separator + "caches");
|
|
|
|
- if(caches.exists()){
|
|
|
|
- for(File deleteFile : caches.listFiles()){
|
|
|
|
- if(new File(path + "_images").exists()){
|
|
|
|
- if(deleteFile.isDirectory()){
|
|
|
|
- FileUtils.delAllFile(deleteFile.getAbsolutePath());
|
|
|
|
- }else {
|
|
|
|
- FileUtils.deleteFile(deleteFile.getAbsolutePath());
|
|
|
|
- }
|
|
|
|
- }else if(!deleteFile.getAbsolutePath().contains("images")){
|
|
|
|
- if(deleteFile.isDirectory()){
|
|
|
|
- FileUtils.delAllFile(deleteFile.getAbsolutePath());
|
|
|
|
- }else {
|
|
|
|
- FileUtils.deleteFile(deleteFile.getAbsolutePath());
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if(new File(path + File.separator + "results").exists()){
|
|
|
|
- FileUtils.delAllFile(path + File.separator + "results");
|
|
|
|
- }
|
|
|
|
|
|
|
|
- //生成project.json和data.json供算法部使用
|
|
|
|
- log.info("path:" + path);
|
|
|
|
|
|
+ /*
|
|
|
|
+ 1、判断是否计算过资源,若计算过删除缓存, 如果caches中存在_images文件或者目录,就删除掉,否则就删除除了images以外的所有文件和目录
|
|
|
|
+ 2、删除上一次计算出来的result目录
|
|
|
|
+ */
|
|
|
|
+ this.deleteCachesAndResult(path);
|
|
|
|
|
|
- if(dataJson.containsKey("videoVersion") && StringUtils.isNotEmpty(dataJson.getString("videoVersion")) && Integer.parseInt(dataJson.getString("videoVersion")) < 4){
|
|
|
|
- //v2版本使用4k算法
|
|
|
|
|
|
+ //v2版本使用4k算法
|
|
|
|
+ if(dataJson.containsKey("videoVersion")
|
|
|
|
+ && StringUtils.isNotEmpty(dataJson.getString("videoVersion"))
|
|
|
|
+ && Integer.parseInt(dataJson.getString("videoVersion")) < 4){
|
|
skyboxType = "SKYBOX_V6";
|
|
skyboxType = "SKYBOX_V6";
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //生成project.json和data.json并写到path目录下供算法部使用
|
|
|
|
+ log.info("path:" + path);
|
|
ComputerUtil.createJson(path, splitType, skyboxType, dataDescribe, projectNum, path);
|
|
ComputerUtil.createJson(path, splitType, skyboxType, dataDescribe, projectNum, path);
|
|
//计算模型并返回需要上传oss的文件集合
|
|
//计算模型并返回需要上传oss的文件集合
|
|
map = ComputerUtil.computer(projectNum, path, buildType);
|
|
map = ComputerUtil.computer(projectNum, path, buildType);
|
|
|
|
+ //计算完成时间
|
|
|
|
+ computeTime = (System.currentTimeMillis() - start) / 1000;
|
|
|
|
+ log.info("计算完成耗时:{}",computeTime);
|
|
|
|
|
|
if(Integer.parseInt(cameraType) == 5 || Integer.parseInt(cameraType) == 6){
|
|
if(Integer.parseInt(cameraType) == 5 || Integer.parseInt(cameraType) == 6){
|
|
//todo 老版本old_path 待删除
|
|
//todo 老版本old_path 待删除
|
|
@@ -387,9 +353,10 @@ public class BuildSceneMQListener implements RocketMQListener<String> {
|
|
map.put(path + File.separator + "capture/Up2.txt",dataPath + "Up2.txt");
|
|
map.put(path + File.separator + "capture/Up2.txt",dataPath + "Up2.txt");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ log.info("计算完成,批量上传文件集合:{}", map.toString());
|
|
uploadToOssUtil.uploadMulFiles(map);
|
|
uploadToOssUtil.uploadMulFiles(map);
|
|
- payStatus = 1;
|
|
|
|
|
|
|
|
|
|
+ payStatus = 1;
|
|
File spaceFile = null;
|
|
File spaceFile = null;
|
|
for (String key : map.keySet()) {
|
|
for (String key : map.keySet()) {
|
|
spaceFile = new File(key);
|
|
spaceFile = new File(key);
|
|
@@ -400,223 +367,17 @@ public class BuildSceneMQListener implements RocketMQListener<String> {
|
|
|
|
|
|
log.info("八目上完oss结束修改数据:"+projectNum);
|
|
log.info("八目上完oss结束修改数据:"+projectNum);
|
|
|
|
|
|
- //获取upload中的video视频名称
|
|
|
|
- String uploadData = FileUtils.readFile(path + File.separator + "results" +File.separator+"upload.json");
|
|
|
|
- com.alibaba.fastjson.JSONObject uploadJson = null;
|
|
|
|
- JSONArray array = null;
|
|
|
|
- if(uploadData!=null) {
|
|
|
|
- uploadJson = com.alibaba.fastjson.JSONObject.parseObject(uploadData);
|
|
|
|
- array = uploadJson.getJSONArray("upload");
|
|
|
|
- }
|
|
|
|
- com.alibaba.fastjson.JSONObject fileJson = null;
|
|
|
|
- String fileName = "";
|
|
|
|
-
|
|
|
|
- //读取videos_hdr_param.json, 保存点位视频的value
|
|
|
|
- Map<String, Object> videoMap = new HashMap<>();
|
|
|
|
- String videosHdr = FileUtils.readFile(path + File.separator + "results/videos/videos_hdr_param.json");
|
|
|
|
- JSONArray videoArray = null;
|
|
|
|
- if(StringUtils.isNotEmpty(videosHdr)){
|
|
|
|
- videoArray = com.alibaba.fastjson.JSONObject.parseObject(videosHdr).getJSONArray("hdr_param");
|
|
|
|
- }
|
|
|
|
- if(videoArray != null){
|
|
|
|
- for(int i = 0, len = videoArray.size(); i < len; i++) {
|
|
|
|
- videoMap.put(videoArray.getJSONObject(i).getString("name"), videoArray.getJSONObject(i).getString("value"));
|
|
|
|
- if(videoArray.getJSONObject(i).containsKey("fov")){
|
|
|
|
- videoMap.put(videoArray.getJSONObject(i).getString("name") + "_fov", videoArray.getJSONObject(i).getString("fov"));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //计算ts文件的大小,并拼接成json格式
|
|
|
|
- JSONArray jsonArray = new JSONArray();
|
|
|
|
- com.alibaba.fastjson.JSONObject videoJson = null;
|
|
|
|
- videosJson = new com.alibaba.fastjson.JSONObject();
|
|
|
|
- long videoSize = 0L;
|
|
|
|
- for(int i = 0, len = array.size(); i < len; i++) {
|
|
|
|
- fileJson = array.getJSONObject(i);
|
|
|
|
- fileName = fileJson.getString("file");
|
|
|
|
- if(fileJson.getIntValue("clazz") == 11 && fileName.contains(".mp4") && !fileName.contains("-ios.mp4")){
|
|
|
|
- videoJson = new com.alibaba.fastjson.JSONObject();
|
|
|
|
- videoJson.put("id", fileName.substring(
|
|
|
|
- 0, fileName.lastIndexOf(".")).replace("videos/", ""));
|
|
|
|
-
|
|
|
|
- //如果ts文件存在,就计算ts大小
|
|
|
|
- if(new File(path + File.separator + "results" +File.separator+ fileName.replace(".mp4", ".ts")).exists()){
|
|
|
|
- videoSize = new File(path + File.separator + "results" +File.separator+ fileName.replace(".mp4", ".ts")).length();
|
|
|
|
- videoJson.put("tsSize", videoSize);
|
|
|
|
- }
|
|
|
|
- if(videoMap.containsKey(videoJson.get("id"))){
|
|
|
|
- videoJson.put("value", videoMap.get(videoJson.get("id")));
|
|
|
|
- }
|
|
|
|
- if(videoMap.containsKey(videoJson.get("id") + "_fov")){
|
|
|
|
- videoJson.put("blend_fov", videoMap.get(videoJson.get("id") + "_fov"));
|
|
|
|
- }else {
|
|
|
|
- videoJson.put("blend_fov", 7);
|
|
|
|
- }
|
|
|
|
- jsonArray.add(videoJson);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- videosJson.put("data", jsonArray);
|
|
|
|
- if(dataJson.containsKey("videoVersion") && StringUtils.isNotEmpty(dataJson.getString("videoVersion")) && Integer.parseInt(dataJson.getString("videoVersion")) >= 4){
|
|
|
|
- videosJson.put("version", 3);
|
|
|
|
- if("oss".equals(ossType)){
|
|
|
|
- videosJson.put("upPath", prefixAli + "data/data" + projectNum + "/Up.xml");
|
|
|
|
- }
|
|
|
|
- if("aws".equals(ossType)){
|
|
|
|
- videosJson.put("upPath", ConstantUrl.PREFIX_AWS + "data/data" + projectNum + "/Up.xml");
|
|
|
|
- }
|
|
|
|
- if(Integer.parseInt(cameraType) == 13){
|
|
|
|
- //转台相机
|
|
|
|
- videosJson.put("upPath", videosJson.getString("upPath").replace(".xml", ".txt"));
|
|
|
|
- }
|
|
|
|
- }else {
|
|
|
|
- videosJson.put("version", 1);
|
|
|
|
- if("oss".equals(ossType)){
|
|
|
|
- videosJson.put("upPath", prefixAli + "data/data" + projectNum + "/Up2.xml");
|
|
|
|
- }
|
|
|
|
- if("aws".equals(ossType)){
|
|
|
|
- videosJson.put("upPath", ConstantUrl.PREFIX_AWS + "data/data" + projectNum + "/Up2.xml");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if(Integer.parseInt(cameraType) == 13){
|
|
|
|
- //转台相机
|
|
|
|
- videosJson.put("upPath", videosJson.getString("upPath").replace(".xml", ".txt"));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if(Integer.parseInt(cameraType) == 5 || Integer.parseInt(cameraType) == 6){
|
|
|
|
- videosJson.put("version", 1);
|
|
|
|
- if("oss".equals(ossType)){
|
|
|
|
- videosJson.put("upPath", prefixAli + "data/data" + projectNum + "/stitch_params.txt");
|
|
|
|
- }
|
|
|
|
- if("aws".equals(ossType)){
|
|
|
|
- videosJson.put("upPath", ConstantUrl.PREFIX_AWS + "data/data" + projectNum + "/stitch_params.txt");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- computeTime = (System.currentTimeMillis() - start) / 1000;
|
|
|
|
|
|
+ //读取计算结果文件生成videosJson
|
|
|
|
+ videosJson = this.getVideosJson(path, dataJson, projectNum, Integer.valueOf(cameraType));
|
|
|
|
|
|
//更新scene.json里面的video数据
|
|
//更新scene.json里面的video数据
|
|
- String sceneJsonPath = String.format(ConstantFilePath.SCENE_PATH_FORMAT, projectNum);
|
|
|
|
- com.alibaba.fastjson.JSONObject scenejson = new com.alibaba.fastjson.JSONObject();
|
|
|
|
- if(sceneJsonPath!=null){
|
|
|
|
- scenejson = com.alibaba.fastjson.JSONObject.parseObject(sceneJsonPath);
|
|
|
|
- }
|
|
|
|
- scenejson.put("videos", videosJson.toJSONString());
|
|
|
|
- FileUtils.writeFile(sceneJsonPath, scenejson.toString());
|
|
|
|
|
|
+ this.updateVideosToSceneJson(projectNum, videosJson);
|
|
|
|
|
|
//根据data.fdage推送计算完成的消息
|
|
//根据data.fdage推送计算完成的消息
|
|
- log.info("推送消息,渠道是 {}, 手机token是 {}", dataJson.get("pushChannel"), dataJson.get("pushToken"));
|
|
|
|
- if(dataJson.containsKey("pushChannel") && dataJson.containsKey("pushToken")){
|
|
|
|
- try{
|
|
|
|
- if(!"aws".equals(ossType)){
|
|
|
|
-
|
|
|
|
- PushMessageConfig demo = null;
|
|
|
|
- if(dataJson.getIntValue("pushChannel") == 0){
|
|
|
|
-
|
|
|
|
- if(Integer.parseInt(cameraType) == 10 || Integer.parseInt(cameraType) == 13){
|
|
|
|
- //ios
|
|
|
|
- log.info("IOS_KEY:{}, IOS_SECRET:{}", IOS_KEY_Z, IOS_SECRET_Z);
|
|
|
|
- demo = new PushMessageConfig(IOS_KEY_Z, IOS_SECRET_Z);
|
|
|
|
- demo.sendIOSUnicast(dataJson.getString("pushToken"),
|
|
|
|
- "四维看看Minion", sceneName + "计算完成", "您上传的" + sceneName + "计算完成,点击查看",
|
|
|
|
- webSite);
|
|
|
|
- }else {
|
|
|
|
- //ios
|
|
|
|
- log.info("IOS_KEY:{}, IOS_SECRET:{}", IOS_KEY, IOS_SECRET);
|
|
|
|
- demo = new PushMessageConfig(IOS_KEY, IOS_SECRET);
|
|
|
|
- demo.sendIOSUnicast(dataJson.getString("pushToken"),
|
|
|
|
- "四维看看Pro", sceneName + "计算完成", "您上传的" + sceneName + "计算完成,点击查看",
|
|
|
|
- webSite);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }else {
|
|
|
|
- if(Integer.parseInt(cameraType) == 10 || Integer.parseInt(cameraType) == 13){
|
|
|
|
- //ios
|
|
|
|
- //安卓
|
|
|
|
- log.info("ANDROID_KEY:{}, ANDROID_SECRET:{}", ANDROID_KEY_Z, ANDROID_SECRET_Z);
|
|
|
|
- demo = new PushMessageConfig(ANDROID_KEY_Z, ANDROID_SECRET_Z);
|
|
|
|
- demo.sendAndroidUnicast2(dataJson.getString("pushToken"),
|
|
|
|
- "四维看看Minion", sceneName + "计算完成", "您上传的" + sceneName + "计算完成,点击查看",
|
|
|
|
- webSite);
|
|
|
|
- }else {
|
|
|
|
- //安卓
|
|
|
|
- log.info("ANDROID_KEY:{}, ANDROID_SECRET:{}", ANDROID_KEY, ANDROID_SECRET);
|
|
|
|
- demo = new PushMessageConfig(ANDROID_KEY, ANDROID_SECRET);
|
|
|
|
- demo.sendAndroidUnicast(dataJson.getString("pushToken"),
|
|
|
|
- "四维看看Pro", sceneName + "计算完成", "您上传的" + sceneName + "计算完成,点击查看",
|
|
|
|
- webSite);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }else {
|
|
|
|
- PushMsgUtil.googlePushMsg(ConstantFilePath.BASE_PATH + "/refreshToken.json",dataJson.getString("pushToken"),
|
|
|
|
- sceneName + "计算完成", "您上传的" + sceneName + "计算完成,点击查看",
|
|
|
|
- webSite);
|
|
|
|
- }
|
|
|
|
- log.info("消息推送结束!");
|
|
|
|
- }catch (Exception e){
|
|
|
|
- log.info("推送消息失败:");
|
|
|
|
- e.printStackTrace();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //计算成功 激光转台相机推送
|
|
|
|
- log.info("激光转台相机 同步 请求 ");
|
|
|
|
- if(Integer.parseInt(cameraType) == 14){
|
|
|
|
- try {
|
|
|
|
- String title = "";
|
|
|
|
- if(StringUtils.isNotEmpty(sceneName)){
|
|
|
|
- title = sceneName;
|
|
|
|
- }
|
|
|
|
-// String dataSource = sceneProExt.getDataSource();
|
|
|
|
- String jgPath = dataSource;
|
|
|
|
- //创建目录
|
|
|
|
- if(dataSource.lastIndexOf("/")!=-1){
|
|
|
|
- jgPath = jgPath + "_laserData";
|
|
|
|
- }else{
|
|
|
|
- jgPath = jgPath.substring(0,jgPath.length()-1) + "_laserData";
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- FileUtils.createDir(jgPath+"/extras");
|
|
|
|
-
|
|
|
|
- log.info("生成 激光相机目录 " + jgPath);
|
|
|
|
- //生成data.json
|
|
|
|
- JSONObject jgDataJson = new JSONObject();
|
|
|
|
- jgDataJson.put("split_type", "SPLIT_V15");
|
|
|
|
- jgDataJson.put("skybox_type", "SKYBOX_V5");
|
|
|
|
- jgDataJson.put("extras", null);
|
|
|
|
- FileUtils.writeFile(jgPath + File.separator + "data.json", jgDataJson.toString());
|
|
|
|
|
|
+ this.sendSms(dataJson, Integer.valueOf(cameraType), sceneName, webSite);
|
|
|
|
|
|
- CreateObjUtil.cpfile(dataSource + "/results/laserData/cover", jgPath+"/extras/");
|
|
|
|
- CreateObjUtil.cplaserfile(dataSource + "/results/laserData", jgPath+File.separator);
|
|
|
|
-
|
|
|
|
- //激光相机
|
|
|
|
- String url = laserHost+"/indoor/{sceneCode}/api/init?path="
|
|
|
|
- + jgPath + File.separator + "laserData" + "&title="+ title
|
|
|
|
- + "&childName=" + cameraName + "&createTime=" + createTime
|
|
|
|
- + "&snCode="+ cameraName;
|
|
|
|
-
|
|
|
|
- if(userId!=null){
|
|
|
|
- url = url + "&userId=" + userId;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if(StringUtils.isNotEmpty(userName)){
|
|
|
|
- url = url + "&phone=" + userName;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- url = url.replace("{sceneCode}",projectNum);
|
|
|
|
- log.info("激光转台相机 同步 :" + url);
|
|
|
|
- com.alibaba.fastjson.JSONObject hotListJson =
|
|
|
|
- com.alibaba.fastjson.JSONObject.parseObject(restTemplate.getForObject(url,String.class));
|
|
|
|
- log.info("激光转台相机 同步结束 :" + hotListJson);
|
|
|
|
- }catch (Exception e){
|
|
|
|
- log.error("激光转台相机同步失败", e);
|
|
|
|
- // TODO: 2022/1/25 测试阶段,先注释掉推送
|
|
|
|
-// handFail("激光转台相机同步失败",message);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ //计算成功 激光转台相机 同步 请求
|
|
|
|
+ this.jgSynch(projectNum, Integer.valueOf(cameraType), sceneName, dataSource, createTime, userId, userName, cameraName);
|
|
}
|
|
}
|
|
|
|
|
|
CreateObjUtil.deleteFile(path.replace(ConstantFilePath.BUILD_MODEL_PATH, "/") + "/capture");
|
|
CreateObjUtil.deleteFile(path.replace(ConstantFilePath.BUILD_MODEL_PATH, "/") + "/capture");
|
|
@@ -631,54 +392,343 @@ public class BuildSceneMQListener implements RocketMQListener<String> {
|
|
// handFail("计算失败",message);
|
|
// handFail("计算失败",message);
|
|
}finally {
|
|
}finally {
|
|
//发送计算结果到mq,再由消费者消费并操作数据库
|
|
//发送计算结果到mq,再由消费者消费并操作数据库
|
|
- rocketMQProducer.sendOneWay(buildSceneResultTopic,
|
|
|
|
- BuildSceneResultMqMessage.builder()
|
|
|
|
- .buildSuccess(buildSuccess)
|
|
|
|
- .cameraType(cameraType)
|
|
|
|
- .computeTime(computeTime)
|
|
|
|
- .fileId(fileId)
|
|
|
|
- .payStatus(payStatus)
|
|
|
|
- .sceneCode(projectNum)
|
|
|
|
- .space(space)
|
|
|
|
- .videosJson(buildSuccess? videosJson.toJSONString() : null)
|
|
|
|
- .build());
|
|
|
|
|
|
+ this.sendCallResult(buildSuccess, cameraType, computeTime, fileId, payStatus, projectNum, space, videosJson);
|
|
|
|
+ //上传status.json console.log
|
|
|
|
+ this.uploadStatusJsonAndConsoleLog(sceneProId, sceneStatus, webSite, projectNum, thumb, payStatus, dataPath, dataSource);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void sendCallResult(boolean buildSuccess, String cameraType, Long computeTime, String fileId,
|
|
|
|
+ Integer payStatus, String projectNum, Long space, JSONObject videosJson){
|
|
|
|
+ rocketMQProducer.sendOneWay(buildSceneResultTopic,
|
|
|
|
+ BuildSceneResultMqMessage.builder()
|
|
|
|
+ .buildSuccess(buildSuccess)
|
|
|
|
+ .cameraType(cameraType)
|
|
|
|
+ .computeTime(computeTime)
|
|
|
|
+ .fileId(fileId)
|
|
|
|
+ .payStatus(payStatus)
|
|
|
|
+ .sceneCode(projectNum)
|
|
|
|
+ .space(space)
|
|
|
|
+ .videosJson(buildSuccess? videosJson.toJSONString() : null)
|
|
|
|
+ .build());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void uploadStatusJsonAndConsoleLog(Long sceneProId, Integer sceneStatus, String webSite, String projectNum,
|
|
|
|
+ String thumb, Integer payStatus, String dataPath, String dataSource){
|
|
|
|
+ try{
|
|
|
|
+ if(Objects.nonNull(sceneProId)){
|
|
|
|
+ com.alibaba.fastjson.JSONObject statusJson = new com.alibaba.fastjson.JSONObject();
|
|
|
|
+ //临时将-2改成1,app还没完全更新
|
|
|
|
+ if(sceneStatus == -2){
|
|
|
|
+ sceneStatus = 1;
|
|
|
|
+ }else if(sceneStatus == -1){
|
|
|
|
+ // 失败状态不予显示到客户端
|
|
|
|
+ sceneStatus = 0;
|
|
|
|
+ }
|
|
|
|
+ statusJson.put("status", sceneStatus);
|
|
|
|
+ statusJson.put("webSite", webSite);
|
|
|
|
+ statusJson.put("sceneNum", projectNum);
|
|
|
|
+ statusJson.put("thumb", thumb);
|
|
|
|
+ statusJson.put("payStatus", payStatus);
|
|
|
|
+ FileUtils.writeFile(ConstantFilePath.SCENE_PATH+"data/data"+projectNum+File.separator+"status.json", statusJson.toString());
|
|
|
|
+
|
|
|
|
+ //todo 待删除old_path
|
|
|
|
+ uploadToOssUtil.upload(ConstantFilePath.SCENE_PATH+"data/data"+projectNum+File.separator+"status.json",
|
|
|
|
+ "data/data"+projectNum+File.separator+"status.json");
|
|
|
|
+
|
|
|
|
+ uploadToOssUtil.upload(ConstantFilePath.SCENE_PATH+"data/data"+projectNum+File.separator+"status.json",
|
|
|
|
+ dataPath+"status.json");
|
|
|
|
+
|
|
|
|
+ //上送日志 //todo 待删除old_path
|
|
|
|
+ uploadToOssUtil.upload(dataSource+File.separator+"console.log",
|
|
|
|
+ "build_log/"+projectNum+File.separator+"console.log");
|
|
|
|
+
|
|
|
|
+ //上送日志
|
|
|
|
+ uploadToOssUtil.upload(dataSource+File.separator+"console.log",
|
|
|
|
+ dataPath+"console.log");
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }catch (Exception e){
|
|
|
|
+ log.error("上传status.json/console.log失败", e);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void jgSynch(String projectNum, int cameraType, String sceneName, String dataSource, Date createTime, Long userId, String userName, String cameraName){
|
|
|
|
+ log.info("激光转台相机 同步 请求 ");
|
|
|
|
+ if(cameraType != 14)
|
|
|
|
+ return;
|
|
|
|
+ try {
|
|
|
|
+ String title = "";
|
|
|
|
+ if(StringUtils.isNotEmpty(sceneName)){
|
|
|
|
+ title = sceneName;
|
|
|
|
+ }
|
|
|
|
+// String dataSource = sceneProExt.getDataSource();
|
|
|
|
+ String jgPath = dataSource;
|
|
|
|
+ //创建目录
|
|
|
|
+ if(dataSource.lastIndexOf("/")!=-1){
|
|
|
|
+ jgPath = jgPath + "_laserData";
|
|
|
|
+ }else{
|
|
|
|
+ jgPath = jgPath.substring(0,jgPath.length()-1) + "_laserData";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ FileUtils.createDir(jgPath+"/extras");
|
|
|
|
+
|
|
|
|
+ log.info("生成 激光相机目录 " + jgPath);
|
|
|
|
+ //生成data.json
|
|
|
|
+ JSONObject jgDataJson = new JSONObject();
|
|
|
|
+ jgDataJson.put("split_type", "SPLIT_V15");
|
|
|
|
+ jgDataJson.put("skybox_type", "SKYBOX_V5");
|
|
|
|
+ jgDataJson.put("extras", null);
|
|
|
|
+ FileUtils.writeFile(jgPath + File.separator + "data.json", jgDataJson.toString());
|
|
|
|
+
|
|
|
|
+ CreateObjUtil.cpfile(dataSource + "/results/laserData/cover", jgPath+"/extras/");
|
|
|
|
+ CreateObjUtil.cplaserfile(dataSource + "/results/laserData", jgPath+File.separator);
|
|
|
|
+
|
|
|
|
+ //激光相机
|
|
|
|
+ String url = laserHost+"/indoor/{sceneCode}/api/init?path="
|
|
|
|
+ + jgPath + File.separator + "laserData" + "&title="+ title
|
|
|
|
+ + "&childName=" + cameraName + "&createTime=" + createTime
|
|
|
|
+ + "&snCode="+ cameraName;
|
|
|
|
+
|
|
|
|
+ if(userId!=null){
|
|
|
|
+ url = url + "&userId=" + userId;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(StringUtils.isNotEmpty(userName)){
|
|
|
|
+ url = url + "&phone=" + userName;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ url = url.replace("{sceneCode}",projectNum);
|
|
|
|
+ log.info("激光转台相机 同步 :" + url);
|
|
|
|
+ com.alibaba.fastjson.JSONObject hotListJson =
|
|
|
|
+ com.alibaba.fastjson.JSONObject.parseObject(restTemplate.getForObject(url,String.class));
|
|
|
|
+ log.info("激光转台相机 同步结束 :" + hotListJson);
|
|
|
|
+ }catch (Exception e){
|
|
|
|
+ log.error("激光转台相机同步失败", e);
|
|
|
|
+ // TODO: 2022/1/25 测试阶段,先注释掉推送
|
|
|
|
+// handFail("激光转台相机同步失败",message);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void sendSms(JSONObject dataJson, int cameraType, String sceneName, String webSite){
|
|
|
|
+ log.info("推送消息,渠道是 {}, 手机token是 {}", dataJson.get("pushChannel"), dataJson.get("pushToken"));
|
|
|
|
+ if(dataJson.containsKey("pushChannel") && dataJson.containsKey("pushToken")){
|
|
try{
|
|
try{
|
|
- if(Objects.nonNull(sceneProId)){
|
|
|
|
- com.alibaba.fastjson.JSONObject statusJson = new com.alibaba.fastjson.JSONObject();
|
|
|
|
- //临时将-2改成1,app还没完全更新
|
|
|
|
- if(sceneStatus == -2){
|
|
|
|
- sceneStatus = 1;
|
|
|
|
- }else if(sceneStatus == -1){
|
|
|
|
- // 失败状态不予显示到客户端
|
|
|
|
- sceneStatus = 0;
|
|
|
|
|
|
+ if(StorageType.AWS.code().equals(ossType)){
|
|
|
|
+ PushMsgUtil.googlePushMsg(ConstantFilePath.BASE_PATH + "/refreshToken.json",dataJson.getString("pushToken"),
|
|
|
|
+ sceneName + "计算完成", "您上传的" + sceneName + "计算完成,点击查看",
|
|
|
|
+ webSite);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ PushMessageConfig demo = null;
|
|
|
|
+ if(dataJson.getIntValue("pushChannel") == 0){
|
|
|
|
+
|
|
|
|
+ if(cameraType == 10 || cameraType == 13){
|
|
|
|
+ //ios
|
|
|
|
+ log.info("IOS_KEY:{}, IOS_SECRET:{}", IOS_KEY_Z, IOS_SECRET_Z);
|
|
|
|
+ demo = new PushMessageConfig(IOS_KEY_Z, IOS_SECRET_Z);
|
|
|
|
+ demo.sendIOSUnicast(dataJson.getString("pushToken"),
|
|
|
|
+ "四维看看Minion", sceneName + "计算完成", "您上传的" + sceneName + "计算完成,点击查看",
|
|
|
|
+ webSite);
|
|
|
|
+ }else {
|
|
|
|
+ //ios
|
|
|
|
+ log.info("IOS_KEY:{}, IOS_SECRET:{}", IOS_KEY, IOS_SECRET);
|
|
|
|
+ demo = new PushMessageConfig(IOS_KEY, IOS_SECRET);
|
|
|
|
+ demo.sendIOSUnicast(dataJson.getString("pushToken"),
|
|
|
|
+ "四维看看Pro", sceneName + "计算完成", "您上传的" + sceneName + "计算完成,点击查看",
|
|
|
|
+ webSite);
|
|
}
|
|
}
|
|
- statusJson.put("status", sceneStatus);
|
|
|
|
- statusJson.put("webSite", webSite);
|
|
|
|
- statusJson.put("sceneNum", projectNum);
|
|
|
|
- statusJson.put("thumb", thumb);
|
|
|
|
- statusJson.put("payStatus", payStatus);
|
|
|
|
- FileUtils.writeFile(ConstantFilePath.SCENE_PATH+"data/data"+projectNum+File.separator+"status.json", statusJson.toString());
|
|
|
|
|
|
|
|
- //todo 待删除old_path
|
|
|
|
- uploadToOssUtil.upload(ConstantFilePath.SCENE_PATH+"data/data"+projectNum+File.separator+"status.json",
|
|
|
|
- "data/data"+projectNum+File.separator+"status.json");
|
|
|
|
|
|
+ }else {
|
|
|
|
+ if(cameraType == 10 || cameraType == 13){
|
|
|
|
+ //ios
|
|
|
|
+ //安卓
|
|
|
|
+ log.info("ANDROID_KEY:{}, ANDROID_SECRET:{}", ANDROID_KEY_Z, ANDROID_SECRET_Z);
|
|
|
|
+ demo = new PushMessageConfig(ANDROID_KEY_Z, ANDROID_SECRET_Z);
|
|
|
|
+ demo.sendAndroidUnicast2(dataJson.getString("pushToken"),
|
|
|
|
+ "四维看看Minion", sceneName + "计算完成", "您上传的" + sceneName + "计算完成,点击查看",
|
|
|
|
+ webSite);
|
|
|
|
+ }else {
|
|
|
|
+ //安卓
|
|
|
|
+ log.info("ANDROID_KEY:{}, ANDROID_SECRET:{}", ANDROID_KEY, ANDROID_SECRET);
|
|
|
|
+ demo = new PushMessageConfig(ANDROID_KEY, ANDROID_SECRET);
|
|
|
|
+ demo.sendAndroidUnicast(dataJson.getString("pushToken"),
|
|
|
|
+ "四维看看Pro", sceneName + "计算完成", "您上传的" + sceneName + "计算完成,点击查看",
|
|
|
|
+ webSite);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ log.info("消息推送结束!");
|
|
|
|
+ }catch (Exception e){
|
|
|
|
+ log.error("推送消息失败:", e);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
- uploadToOssUtil.upload(ConstantFilePath.SCENE_PATH+"data/data"+projectNum+File.separator+"status.json",
|
|
|
|
- dataPath+"status.json");
|
|
|
|
|
|
+ private void updateVideosToSceneJson(String projectNum, JSONObject videosJson) throws IOException {
|
|
|
|
+ String sceneJsonPath = String.format(ConstantFilePath.SCENE_PATH_FORMAT, projectNum);
|
|
|
|
+ com.alibaba.fastjson.JSONObject scenejson = new com.alibaba.fastjson.JSONObject();
|
|
|
|
+ if(sceneJsonPath!=null){
|
|
|
|
+ scenejson = com.alibaba.fastjson.JSONObject.parseObject(sceneJsonPath);
|
|
|
|
+ }
|
|
|
|
+ scenejson.put("videos", videosJson.toJSONString());
|
|
|
|
+ FileUtils.writeFile(sceneJsonPath, scenejson.toString());
|
|
|
|
+ }
|
|
|
|
|
|
- //上送日志 //todo 待删除old_path
|
|
|
|
- uploadToOssUtil.upload(dataSource+File.separator+"console.log",
|
|
|
|
- "build_log/"+projectNum+File.separator+"console.log");
|
|
|
|
|
|
+ private JSONObject getVideosJson(String path, JSONObject dataJson, String projectNum, int cameraType) throws Exception {
|
|
|
|
+ //读取videos_hdr_param.json, 保存点位视频的value
|
|
|
|
+ Map<String, Object> videoMap = new HashMap<>();
|
|
|
|
+ String videosHdr = FileUtils.readFile(path + File.separator + "results/videos/videos_hdr_param.json");
|
|
|
|
+ JSONArray videoArray = null;
|
|
|
|
+ if(StringUtils.isNotEmpty(videosHdr)){
|
|
|
|
+ videoArray = com.alibaba.fastjson.JSONObject.parseObject(videosHdr).getJSONArray("hdr_param");
|
|
|
|
+ }
|
|
|
|
+ if(videoArray != null){
|
|
|
|
+ for(int i = 0, len = videoArray.size(); i < len; i++) {
|
|
|
|
+ videoMap.put(videoArray.getJSONObject(i).getString("name"), videoArray.getJSONObject(i).getString("value"));
|
|
|
|
+ if(videoArray.getJSONObject(i).containsKey("fov")){
|
|
|
|
+ videoMap.put(videoArray.getJSONObject(i).getString("name") + "_fov", videoArray.getJSONObject(i).getString("fov"));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //获取upload中的video视频名称
|
|
|
|
+ String uploadData = FileUtils.readFile(path + File.separator + "results" +File.separator+"upload.json");
|
|
|
|
+ com.alibaba.fastjson.JSONObject uploadJson = null;
|
|
|
|
+ JSONArray array = null;
|
|
|
|
+ if(uploadData!=null) {
|
|
|
|
+ uploadJson = com.alibaba.fastjson.JSONObject.parseObject(uploadData);
|
|
|
|
+ array = uploadJson.getJSONArray("upload");
|
|
|
|
+ }
|
|
|
|
+ com.alibaba.fastjson.JSONObject fileJson = null;
|
|
|
|
+ String fileName = "";
|
|
|
|
+
|
|
|
|
+ //计算ts文件的大小,并拼接成json格式
|
|
|
|
+ JSONArray jsonArray = new JSONArray();
|
|
|
|
+ com.alibaba.fastjson.JSONObject videoJson = null;
|
|
|
|
+ JSONObject videosJson = new JSONObject();
|
|
|
|
+ long videoSize = 0L;
|
|
|
|
+ for(int i = 0, len = array.size(); i < len; i++) {
|
|
|
|
+ fileJson = array.getJSONObject(i);
|
|
|
|
+ fileName = fileJson.getString("file");
|
|
|
|
+ if(fileJson.getIntValue("clazz") == 11 && fileName.contains(".mp4") && !fileName.contains("-ios.mp4")){
|
|
|
|
+ videoJson = new com.alibaba.fastjson.JSONObject();
|
|
|
|
+ videoJson.put("id", fileName.substring(
|
|
|
|
+ 0, fileName.lastIndexOf(".")).replace("videos/", ""));
|
|
|
|
+
|
|
|
|
+ //如果ts文件存在,就计算ts大小
|
|
|
|
+ if(new File(path + File.separator + "results" +File.separator+ fileName.replace(".mp4", ".ts")).exists()){
|
|
|
|
+ videoSize = new File(path + File.separator + "results" +File.separator+ fileName.replace(".mp4", ".ts")).length();
|
|
|
|
+ videoJson.put("tsSize", videoSize);
|
|
|
|
+ }
|
|
|
|
+ if(videoMap.containsKey(videoJson.get("id"))){
|
|
|
|
+ videoJson.put("value", videoMap.get(videoJson.get("id")));
|
|
|
|
+ }
|
|
|
|
+ if(videoMap.containsKey(videoJson.get("id") + "_fov")){
|
|
|
|
+ videoJson.put("blend_fov", videoMap.get(videoJson.get("id") + "_fov"));
|
|
|
|
+ }else {
|
|
|
|
+ videoJson.put("blend_fov", 7);
|
|
|
|
+ }
|
|
|
|
+ jsonArray.add(videoJson);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ videosJson.put("data", jsonArray);
|
|
|
|
+ if(dataJson.containsKey("videoVersion") && StringUtils.isNotEmpty(dataJson.getString("videoVersion")) && Integer.parseInt(dataJson.getString("videoVersion")) >= 4){
|
|
|
|
+ videosJson.put("version", 3);
|
|
|
|
+ if(StorageType.OSS.code().equals(ossType)){
|
|
|
|
+ videosJson.put("upPath", prefixAli + "data/data" + projectNum + "/Up.xml");
|
|
|
|
+ }
|
|
|
|
+ if(StorageType.AWS.code().equals(ossType)){
|
|
|
|
+ videosJson.put("upPath", ConstantUrl.PREFIX_AWS + "data/data" + projectNum + "/Up.xml");
|
|
|
|
+ }
|
|
|
|
+ if(cameraType == 13){
|
|
|
|
+ //转台相机
|
|
|
|
+ videosJson.put("upPath", videosJson.getString("upPath").replace(".xml", ".txt"));
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ videosJson.put("version", 1);
|
|
|
|
+ if("oss".equals(ossType)){
|
|
|
|
+ videosJson.put("upPath", prefixAli + "data/data" + projectNum + "/Up2.xml");
|
|
|
|
+ }
|
|
|
|
+ if("aws".equals(ossType)){
|
|
|
|
+ videosJson.put("upPath", ConstantUrl.PREFIX_AWS + "data/data" + projectNum + "/Up2.xml");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(cameraType == 13){
|
|
|
|
+ //转台相机
|
|
|
|
+ videosJson.put("upPath", videosJson.getString("upPath").replace(".xml", ".txt"));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(cameraType == 5 || cameraType == 6){
|
|
|
|
+ videosJson.put("version", 1);
|
|
|
|
+ if("oss".equals(ossType)){
|
|
|
|
+ videosJson.put("upPath", prefixAli + "data/data" + projectNum + "/stitch_params.txt");
|
|
|
|
+ }
|
|
|
|
+ if("aws".equals(ossType)){
|
|
|
|
+ videosJson.put("upPath", ConstantUrl.PREFIX_AWS + "data/data" + projectNum + "/stitch_params.txt");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
- //上送日志
|
|
|
|
- uploadToOssUtil.upload(dataSource+File.separator+"console.log",
|
|
|
|
- dataPath+"console.log");
|
|
|
|
|
|
+ return videosJson;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private String downLoadSource(String path, int cameraType, String cameraName, String unicode, String fileId, String imgsName, String prefix) throws Exception {
|
|
|
|
+ if(cameraType < 4){
|
|
|
|
+ throw new Exception("cameraType 不能小于4");
|
|
|
|
+ }
|
|
|
|
+ //cameraType=5为新版本双目, cameraType=6为小红屋新版本双目
|
|
|
|
+ String ossPath = ConstantFilePath.OSS_PREFIX + cameraName.replace("4DKKPRO_", "")
|
|
|
|
+ .replace("-fdage", "").toLowerCase() + File.separator + fileId + File.separator
|
|
|
|
+ + unicode + File.separator;
|
|
|
|
+ String localPath = cameraName.replace("4DKKPRO_", "").replace("-fdage", "").toLowerCase() +
|
|
|
|
+ File.separator + fileId + File.separator + unicode;
|
|
|
|
+ if(cameraType == 5 || cameraType == 6){
|
|
|
|
+ path = ConstantFilePath.BUILD_MODEL_PATH + unicode;
|
|
|
|
+ //下载zip包
|
|
|
|
+ FileUtils.downLoadFromUrl(prefix + "/" + imgsName + "?m=" + System.currentTimeMillis(), imgsName, path + File.separator + "capture");
|
|
|
|
+ //解压
|
|
|
|
+ FileUtils.decompress(path + File.separator + "capture" + File.separator + imgsName,
|
|
|
|
+ path + File.separator + "capture") ;
|
|
|
|
+ //删除压缩包
|
|
|
|
+ FileUtil.delFile(path + File.separator + "capture" + File.separator + imgsName);
|
|
|
|
+ }else if(cameraType == 14) {
|
|
|
|
+// + File.separator + "capture"
|
|
|
|
+ path = ConstantFilePath.BUILD_MODEL_LASER_PATH + localPath;
|
|
|
|
+ CreateObjUtil.ossUtilCp(ossPath,path + File.separator + "capture");
|
|
|
|
+ } else{
|
|
|
|
+ path = ConstantFilePath.BUILD_MODEL_PATH + localPath;
|
|
|
|
+ CreateObjUtil.ossUtilCp(ossPath,path + File.separator + "capture");
|
|
|
|
+ }
|
|
|
|
+ return path;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ private void deleteCachesAndResult(String path){
|
|
|
|
+ //判断是否计算过资源,若计算过删除缓存, 如果caches中存在_images文件或者目录,就删除掉,否则就删除除了images以外的所有文件和目录
|
|
|
|
+ File caches = new File(path + File.separator + "caches");
|
|
|
|
+ if(caches.exists()){
|
|
|
|
+ for(File deleteFile : caches.listFiles()){
|
|
|
|
+ if(new File(path + "_images").exists()){
|
|
|
|
+ if(deleteFile.isDirectory()){
|
|
|
|
+ FileUtils.delAllFile(deleteFile.getAbsolutePath());
|
|
|
|
+ }else {
|
|
|
|
+ FileUtils.deleteFile(deleteFile.getAbsolutePath());
|
|
|
|
+ }
|
|
|
|
+ }else if(!deleteFile.getAbsolutePath().contains("images")){
|
|
|
|
+ if(deleteFile.isDirectory()){
|
|
|
|
+ FileUtils.delAllFile(deleteFile.getAbsolutePath());
|
|
|
|
+ }else {
|
|
|
|
+ FileUtils.deleteFile(deleteFile.getAbsolutePath());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }catch (Exception e){
|
|
|
|
- e.printStackTrace();
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ //删除上一次计算出来的result目录
|
|
|
|
+ if(new File(path + File.separator + "results").exists()){
|
|
|
|
+ FileUtils.delAllFile(path + File.separator + "results");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
private void handFail(String reason,BuildSceneMqMessage message){
|
|
private void handFail(String reason,BuildSceneMqMessage message){
|