瀏覽代碼

修改构建逻辑

tianboguang 2 年之前
父節點
當前提交
1e15619e44

+ 8 - 52
src/main/java/com/fdkankan/contro/mq/service/impl/BuildSceneServiceImpl.java

@@ -103,16 +103,12 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
     @Autowired
     private IFdkkLaserService fdkkLaserService;
 
-    @Autowired
-    private FdkkV4Service fdkkV4Service;
-
     @Override
     public void buildScenePre(BuildSceneCallMessage message) {
         boolean success = false;
         try {
             //根据相机类型,组装资源路径
-            String path = SceneUtil.getPath(message.getPath(), message.getCameraName(),
-                    message.getFileId(), Integer.parseInt(message.getCameraType()), message.getUnicode());
+            String path = message.getDataSource();
 
             //下载资源到本地
             this.downLoadSource(message, path);
@@ -137,51 +133,11 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
     }
 
     @Override
-    public void downLoadSource(BuildSceneCallMessage buildSceneMqMessage,String path) throws Exception{
-        String cameraName = buildSceneMqMessage.getCameraName();
-        String fileId = buildSceneMqMessage.getFileId();
-        String unicode = buildSceneMqMessage.getUnicode();
-        int cameraType = Integer.parseInt(buildSceneMqMessage.getCameraType());
-        String prefix = buildSceneMqMessage.getPrefix();
-        String imgsName = buildSceneMqMessage.getImgsName();
-        if(cameraType < 3){
-            for(int i = 0;i<5;++i){
-                try{
-                    FileUtils.downLoadFromUrl(prefix+imgsName+"?m="+new Date().getTime(), imgsName,
-                            path + File.separator + "capture");
-                    FileUtils.decompress(path + File.separator + "capture" +File.separator+imgsName,
-                            path + File.separator + "capture") ;
-                    break;
-                }catch(Exception e){
-                    log.error(String.format("第%d次下载并解压资源失败", i+1),  e);
-                    if(i<4)
-                    {
-                        FileUtils.deleteFile(path + File.separator + "capture" +File.separator+imgsName);
-                        FileUtils.delFolder(path + File.separator + "capture" +File.separator+"images");
-                    }
-                    Thread.sleep(10000);
-                }
-            }
-            FileUtils.deleteFile(path + File.separator + "capture" +File.separator+"zip.Zip");
-        }else{
-            String ossPath = ConstantFilePath.OSS_PREFIX + cameraName.replace("4DKKPRO_", "")
-                    .replace("-fdage", "").toLowerCase() + File.separator + fileId + File.separator
-                    + unicode + File.separator;
-            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") ;
-                //删除压缩包
-                FileUtils.delFile(path + File.separator + "capture" + File.separator + imgsName);
-            }else if(cameraType == 14) {
-                fYunFileService.downloadFileByCommand(path + File.separator + "capture", ossPath);
-            } else{
-                fYunFileService.downloadFileByCommand(path + File.separator + "capture", ossPath);
-            }
-        }
+    public void downLoadSource(BuildSceneCallMessage buildSceneMqMessage,String path){
+        String ossPath = ConstantFilePath.OSS_PREFIX
+                + path.replace(ConstantFilePath.BUILD_MODEL_PATH, "")
+                .replace(ConstantFilePath.BUILD_MODEL_LASER_PATH, "");
+        fYunFileService.downloadFileByCommand(path + File.separator + "capture", ossPath);
     }
 
 
@@ -200,8 +156,6 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
         Integer videoVersion = fdageData.getInteger("videoVersion");
 
 
-        Integer pushChannel = message.getPushChannel();
-        String pushToken = message.getPushToken();
         String prefix = message.getPrefix();
         try {
             // 上传计算日志
@@ -303,6 +257,8 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
                     scenePlusExt, arrearCap);
 
             //计算成功,通知APP
+            Integer pushChannel = fdageData.getInteger("pushChannel");
+            String pushToken = fdageData.getString("pushToken");
             this.pushMsgToApp(pushChannel,pushToken, cameraType, scenePlus.getTitle(), scenePlusExt.getWebSite());
 
             if (cameraType == 14) {

+ 34 - 99
src/main/java/com/fdkankan/contro/service/impl/SceneFileBuildServiceImpl.java

@@ -397,24 +397,15 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
                 ScenePlusVO scenePlusVO = null;
                 Object[] objects = null;
                 BuildSceneCallMessage mqMessage = null;
-                if(fromOss){
-                    objects = this.createScenePlus(sceneNum, camera.getId(), camera.getChildName(), jsonObject.getString("creator"),
-                            jsonObject.getString("pwd"), unicode,
-                            cameraType, fileId, prefix, "", icon, "0", cameraDetail.getUserId(), userName,
-                            jsonObject.getString("location") != null && "1".equals(jsonObject.getString("location")) ? "sfm" : "slam",
-                            jsonObject.getJSONArray("points").size(), jsonObject.getString("name"), jsonObject.getString("info"),
-                            jsonObject.getInteger("scenetype"), jsonObject.getString("gps"), rebuild,
-                            jsonObject.getInteger("resolution"), firmwareVersion.toString(), sceneUrl, buildType,cameraDetail.getCooperationUser());
 
-                }else {
-                    objects = this.createScenePlus(sceneNum, camera.getId(), camera.getChildName(), jsonObject.getString("creator"),
-                            jsonObject.getString("pwd"), unicode,
-                            cameraDetail.getGoodsId(), String.valueOf(fileId), "", "", icon, "0", cameraDetail.getUserId(), userName,
-                            jsonObject.getString("location") != null && "1".equals(jsonObject.getString("location")) ? "sfm" : "slam",
-                            jsonObject.getJSONArray("points").size(), jsonObject.getString("name"), jsonObject.getString("info"),
-                            jsonObject.getInteger("scenetype"), jsonObject.getString("gps"), rebuild,
-                            jsonObject.getInteger("resolution"), firmwareVersion.toString(), sceneUrl, buildType, cameraDetail.getCooperationUser());
-                }
+                objects = this.createScenePlus(sceneNum, camera.getId(), camera.getChildName(), jsonObject.getString("creator"),
+                        jsonObject.getString("pwd"), unicode,
+                        cameraType, fileId, prefix, "", icon, "0", cameraDetail.getUserId(), userName,
+                        jsonObject.getString("location") != null && "1".equals(jsonObject.getString("location")) ? "sfm" : "slam",
+                        jsonObject.getJSONArray("points").size(), jsonObject.getString("name"), jsonObject.getString("info"),
+                        jsonObject.getInteger("scenetype"), jsonObject.getString("gps"), rebuild,
+                        jsonObject.getInteger("resolution"), firmwareVersion.toString(), sceneUrl, buildType,cameraDetail.getCooperationUser());
+
                 scenePlusVO = (ScenePlusVO)objects[0];
                 mqMessage = (BuildSceneCallMessage)objects[1];
 
@@ -844,24 +835,15 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
         String path =  ConstantFilePath.BUILD_MODEL_PATH + unicode;
 
         scenePlus.setSceneSource(1);
-        if(cameraType.longValue() == 5 || cameraType.longValue() == 6){
-            //场景来源双目相机
-            scenePlus.setSceneSource(2);
-            scenePlusExt.setDataSource(ConstantFilePath.BUILD_MODEL_PATH + unicode);
-        }else if(cameraType.longValue() == 14){
-
+         if(cameraType.longValue() == 14){
             scenePlusExt.setDataSource(ConstantFilePath.BUILD_MODEL_LASER_PATH +
                     cameraName.replace("4DKKPRO_", "").replace("-fdage", "").toLowerCase() + File.separator +
                     fileId + File.separator + unicode);
             path =  ConstantFilePath.BUILD_MODEL_LASER_PATH + unicode;
-            log.info("激光相机 dataSource :" + scenePlusExt.getDataSource());
-
-        }else if(cameraType.longValue() >= 3){
+        }else{
             scenePlusExt.setDataSource(ConstantFilePath.BUILD_MODEL_PATH +
                     cameraName.replace("4DKKPRO_", "").replace("-fdage", "").toLowerCase() + File.separator +
                     fileId + File.separator + unicode);
-        }else {
-            scenePlusExt.setDataSource(prefix+imgsName);
         }
 
         if(resolution == null || resolution.intValue() == 0){
@@ -870,11 +852,6 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
             scenePlusExt.setSceneScheme(4);
         }
 
-        //场景来源双目相机,sceneScheme为4,加载high,low图
-        if(cameraType.longValue() == 5 || cameraType.longValue() == 6){
-            scenePlusExt.setSceneScheme(4);
-        }
-
         //转台相机用4k图
         if(cameraType.longValue() == 13 ){
             scenePlus.setSceneSource(3);
@@ -887,44 +864,34 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
             scenePlusExt.setSceneScheme(10);
         }
 
-        if(pic!=null&&pic.length()>5)
-        {
+        if (pic != null && pic.length() > 5) {
             scenePlusExt.setThumb(pic);
-        }
-        else
-        {
+        } else {
             scenePlusExt.setThumb(ConstantUrl.DEFAULT_SCENE_PIC);
         }
-        scenePlusExt.setThumb(scenePlusExt.getThumb().concat("?t=")+System.currentTimeMillis());
+        scenePlusExt.setThumb(scenePlusExt.getThumb().concat("?t=") + System.currentTimeMillis());
 
-        if(!ObjectUtils.isEmpty(userName)){
+        if (!ObjectUtils.isEmpty(userName)) {
             scenePlus.setUserId(userId);
         }
 
-        if(sceneShootCount == null)
-        {
+        if (sceneShootCount == null) {
             scenePlusExt.setShootCount(0);
-        }
-        else
-        {
+        } else {
             scenePlusExt.setShootCount(sceneShootCount);
         }
-        if(sceneName!=null)
-        {
+        if (sceneName != null) {
             scenePlus.setTitle(sceneName);
         }
-        if(sceneDec!=null)
-        {
-            scenePlus.setDescription("<p>"+ new String(sceneDec.getBytes("UTF-8"))+"</p>");
+        if (sceneDec != null) {
+            scenePlus.setDescription("<p>" + new String(sceneDec.getBytes("UTF-8")) + "</p>");
         }
 
-        if(sceneType!=null)
-        {
+        if (sceneType != null) {
             scenePlus.setSceneType(sceneType);
         }
 
-        if(gps!=null&&!gps.trim().equals(""))
-        {
+        if (gps != null && !gps.trim().equals("")) {
             scenePlusExt.setGps(gps);
         }
 
@@ -1025,10 +992,8 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
         }
 
         BuildSceneCallMessage buildSceneMqMessage =this.getBuildSceneMqMessage(
-                projectNum, cameraName, unicode, cameraType, fileId, prefix, imgsName, isModel,
-                userName, algorithm, resolution, buildType, path, scenePlus.getId(), scenePlus.getTitle(),
-                scenePlusExt.getWebSite(), scenePlus.getCreateTime(), scenePlus.getUserId(),
-                scenePlusExt.getDataSource(), scenePlus.getSceneStatus(), scenePlus.getPayStatus(), scenePlusExt.getThumb());
+                projectNum, cameraType, algorithm, resolution, buildType,
+                scenePlusExt.getDataSource());
 
         BeanUtil.copyProperties(scenePlusExt, scenePlusVO);
         BeanUtil.copyProperties(scenePlus, scenePlusVO);
@@ -1036,36 +1001,17 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
         return new Object[]{scenePlusVO, buildSceneMqMessage};
     }
 
-    public BuildSceneCallMessage getBuildSceneMqMessage(String projectNum, String cameraName, String unicode,
-                                                        Long cameraType, String fileId,String prefix, String imgsName,
-                                                        String isModel, String userName,String algorithm, Integer resolution,
-                                                        String buildType, String path, Long sceneProId, String sceneName, String webSite,
-                                                        Date sceneProCreateTime, Long userId, String dataSource,
-                                                        Integer sceneStatus, Integer PayStatus, String thumb) {
+    public BuildSceneCallMessage getBuildSceneMqMessage(String projectNum,
+                                                        Long cameraType, String algorithm, Integer resolution,
+                                                        String buildType, String dataSource) {
         BuildSceneCallMessage mqMsg = new BuildSceneCallMessage();
-        mqMsg.setSceneProId(sceneProId);
         mqMsg.setSceneNum(projectNum);
-        mqMsg.setCameraName(cameraName);
-        mqMsg.setUnicode(unicode);
         mqMsg.setCameraType(String.valueOf(cameraType));
-        mqMsg.setFileId(fileId);
-        mqMsg.setPrefix(prefix);
-        mqMsg.setImgsName(imgsName);
-        mqMsg.setIsModel(isModel);
-        mqMsg.setUserName(userName);
         mqMsg.setAlgorithm(algorithm);
         mqMsg.setResolution(String.valueOf(resolution));
         mqMsg.setBuildType(buildType);
-        mqMsg.setPath(path);
-        mqMsg.setSceneName(sceneName);
-        mqMsg.setWebSite(webSite);
-        mqMsg.setSceneProCreateTime(sceneProCreateTime);
-        mqMsg.setUserId(userId);
         mqMsg.setDataSource(dataSource);
-        mqMsg.setSceneStatus(sceneStatus);
-        mqMsg.setPayStatus(PayStatus);
         mqMsg.setCreateTime(DateUtil.format(Calendar.getInstance().getTime(), DateExtUtil.dateStyle));
-        mqMsg.setThumb(thumb);
         return mqMsg;
     }
 
@@ -1162,27 +1108,16 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
         if(sceneSource == 4){
             Camera cameraEntity = cameraService.getByChildName(cameraName);
             fdkkLaserService.saveScene(scenePlus,null,cameraEntity,userName,true);
-            BuildSceneCallMessage buildSceneMqMessage =this.getBuildSceneMqMessage(
-                num, cameraName, unicode, cameraType, fileId,
-                dataSource.replace(ConstantFilePath.BUILD_MODEL_PATH, "")
-                    .replace(ConstantFilePath.BUILD_MODEL_LASER_PATH,"")+ File.separator,
-                "zip.Zip", "0",
-                userName, jsonObject.getString("location") != null && "1".equals(jsonObject.getString("location")) ? "sfm" : "slam",
-                jsonObject.getInteger("resolution"), buildType,
-                ConstantFilePath.BUILD_MODEL_LASER_PATH + unicode, sceneId, sceneName,
-                webSite, createTime, sceneUserId, dataSource, sceneStatus, payStatus, thumb);
+            BuildSceneCallMessage buildSceneMqMessage = this.getBuildSceneMqMessage(
+                    num, cameraType,
+                    jsonObject.getString("location") != null && "1".equals(jsonObject.getString("location")) ? "sfm" : "slam",
+                    jsonObject.getInteger("resolution"), buildType, dataSource);
             rabbitMqProducer.sendByWorkQueue(queueModelingPre, buildSceneMqMessage);
         }else{
-            BuildSceneCallMessage buildSceneMqMessage =this.getBuildSceneMqMessage(
-                num, cameraName, unicode, cameraType, fileId,
-                dataSource.replace(ConstantFilePath.BUILD_MODEL_PATH, "")
-                    .replace(ConstantFilePath.BUILD_MODEL_LASER_PATH,"")+ File.separator,
-                "zip.Zip", "0",
-                userName, jsonObject.getString("location") != null && "1".equals(jsonObject.getString("location")) ? "sfm" : "slam",
-                jsonObject.getInteger("resolution"), buildType,
-                ConstantFilePath.BUILD_MODEL_PATH + unicode, sceneId, sceneName,
-                webSite, createTime, sceneUserId, dataSource, sceneStatus, payStatus, thumb);
-
+            BuildSceneCallMessage buildSceneMqMessage = this.getBuildSceneMqMessage(
+                    num, cameraType, jsonObject.getString("location") != null && "1".equals(jsonObject.getString("location")) ? "sfm" : "slam",
+                    jsonObject.getInteger("resolution"), buildType,
+                    dataSource);
             rabbitMqProducer.sendByWorkQueue(queueModelingPre, buildSceneMqMessage);
         }