浏览代码

Merge branch 'project-jmga' into project-jm-haixin-1.8.0

# Conflicts:
#	src/main/java/com/fdkankan/contro/entity/ScenePlus.java
#	src/main/java/com/fdkankan/contro/mq/service/impl/BuildSceneServiceImpl.java
#	src/main/java/com/fdkankan/contro/schedule/ScheduleJob.java
#	src/main/java/com/fdkankan/contro/service/IScenePlusService.java
#	src/main/java/com/fdkankan/contro/service/impl/SceneFileBuildServiceImpl.java
dengsixing 2 月之前
父节点
当前提交
d8be0fa5ef
共有 20 个文件被更改,包括 709 次插入783 次删除
  1. 14 1
      src/main/java/com/fdkankan/contro/ModelingControlApplication.java
  2. 1 1
      src/main/java/com/fdkankan/contro/controller/SceneFileController.java
  3. 2 0
      src/main/java/com/fdkankan/contro/entity/ScenePlus.java
  4. 25 6
      src/main/java/com/fdkankan/contro/mq/listener/BuildSceneProcessLogListener.java
  5. 8 0
      src/main/java/com/fdkankan/contro/mq/service/CallBuildService.java
  6. 1 1
      src/main/java/com/fdkankan/contro/mq/service/impl/BuildIntermitSceneServiceImpl.java
  7. 54 22
      src/main/java/com/fdkankan/contro/mq/service/impl/BuildObjServiceImpl.java
  8. 78 92
      src/main/java/com/fdkankan/contro/mq/service/impl/BuildSceneProgressServiceImpl.java
  9. 59 46
      src/main/java/com/fdkankan/contro/mq/service/impl/BuildSceneServiceImpl.java
  10. 0 599
      src/main/java/com/fdkankan/contro/mq/service/impl/BuildV3SceneServiceImpl.java
  11. 121 0
      src/main/java/com/fdkankan/contro/mq/service/impl/CallBuildServiceImpl.java
  12. 2 0
      src/main/java/com/fdkankan/contro/service/IJmgaService.java
  13. 1 2
      src/main/java/com/fdkankan/contro/service/IOrigFileUploadService.java
  14. 85 0
      src/main/java/com/fdkankan/contro/service/impl/JmgaServiceImpl.java
  15. 5 1
      src/main/java/com/fdkankan/contro/service/impl/OrigFileUploadServiceImpl.java
  16. 15 8
      src/main/java/com/fdkankan/contro/service/impl/SceneFileBuildServiceImpl.java
  17. 14 2
      src/main/java/com/fdkankan/contro/service/impl/ScenePlusServiceImpl.java
  18. 8 1
      src/main/resources/bootstrap.yml
  19. 215 0
      src/main/resources/logback-nacos.xml
  20. 1 1
      src/main/resources/logback-spring.xml

+ 14 - 1
src/main/java/com/fdkankan/contro/ModelingControlApplication.java

@@ -1,7 +1,9 @@
 package com.fdkankan.contro;
 
 import com.dtflys.forest.springboot.annotation.ForestScan;
+import com.fdkankan.redis.util.RedisUtil;
 import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.boot.CommandLineRunner;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
@@ -9,6 +11,8 @@ import org.springframework.context.annotation.ComponentScan;
 import org.springframework.scheduling.annotation.EnableAsync;
 import org.springframework.scheduling.annotation.EnableScheduling;
 
+import javax.annotation.Resource;
+
 /**
  * <p>
  * </p>
@@ -23,7 +27,11 @@ import org.springframework.scheduling.annotation.EnableScheduling;
 @MapperScan("com.fdkankan.**.mapper")
 @EnableDiscoveryClient
 @ForestScan(basePackages = "com.fdkankan.contro.httpclient")
-public class ModelingControlApplication {
+public class ModelingControlApplication implements CommandLineRunner {
+
+    @Resource
+    private RedisUtil redisUtil;
+
     public static void main(String[] args) {
         SpringApplication.run(ModelingControlApplication.class, args);
 
@@ -40,6 +48,11 @@ public class ModelingControlApplication {
 //
 //        consumer.start();
     }
+
+    @Override
+    public void run(String... args) throws Exception {
+//        redisUtil.del("push-modeling-pre");
+    }
 }
 
 

+ 1 - 1
src/main/java/com/fdkankan/contro/controller/SceneFileController.java

@@ -151,7 +151,7 @@ public class SceneFileController{
      */
     @PostMapping("upload")
     public ResultData upload(@RequestParam(value = "file",required = false) MultipartFile file,
-                         String params, String dir) throws Exception {
+                         String params, @RequestParam(value = "dir", defaultValue = "") String dir) throws Exception {
         return sceneFileBuildService.uploadFile(file, params,dir);
     }
 

+ 2 - 0
src/main/java/com/fdkankan/contro/entity/ScenePlus.java

@@ -146,4 +146,6 @@ public class ScenePlus implements Serializable {
     @TableField("has_floorplan_ai")
     private Integer hasFloorplanAi;
 
+    @TableField("build_fail_reason")
+    private String buildFailReason;
 }

+ 25 - 6
src/main/java/com/fdkankan/contro/mq/listener/BuildSceneProcessLogListener.java

@@ -1,13 +1,18 @@
 package com.fdkankan.contro.mq.listener;
 
+import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.fdkankan.common.constant.CommonOperStatus;
 import com.fdkankan.common.constant.ModelingBuildStatus;
+import com.fdkankan.contro.entity.JyUser;
+import com.fdkankan.contro.entity.OrigFileUploadBatch;
+import com.fdkankan.contro.entity.ScenePlus;
 import com.fdkankan.contro.service.IJmgaService;
+import com.fdkankan.contro.service.IOrigFileUploadBatchService;
 import com.fdkankan.contro.service.ISceneBuildProcessLogService;
 import com.fdkankan.contro.service.IScenePlusService;
 import com.fdkankan.model.constants.SceneBuildProcessType;
-import com.fdkankan.rabbitmq.bean.BuildSceneProcessLogMessage;
 import com.rabbitmq.client.Channel;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.amqp.core.Message;
@@ -21,6 +26,7 @@ import java.nio.charset.StandardCharsets;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Objects;
 
 @Slf4j
 @Component
@@ -37,6 +43,8 @@ public class BuildSceneProcessLogListener{
     private IScenePlusService scenePlusService;
     @Autowired
     private IJmgaService jmgaService;
+    @Autowired
+    private IOrigFileUploadBatchService origFileUploadBatchService;
 
     /**
      * 场景计算状态日志记录
@@ -49,24 +57,35 @@ public class BuildSceneProcessLogListener{
     )
     public void buildScenePreHandler(Channel channel, Message message) throws Exception {
         String msg = new String(message.getBody(), StandardCharsets.UTF_8);
-        BuildSceneProcessLogMessage buildSceneMessage = JSONObject.parseObject(msg, BuildSceneProcessLogMessage.class);
-        String num = buildSceneMessage.getNum();
+        JSONObject buildSceneMessage = JSONObject.parseObject(msg);
+        String num = buildSceneMessage.getString("num");
         try {
             String reason = null;
             int status = CommonOperStatus.SUCCESS.code();
-            int buildStatus = buildSceneMessage.getBuildStatus();
+            int buildStatus = buildSceneMessage.getInteger("buildStatus");
+            String batchIds = buildSceneMessage.getString("batchId");
 
             //新的计算开始,需要将之前的记录置为失效
             if(buildStatus == ModelingBuildStatus.CALCULATING.code()){
                 sceneBuildProcessLogService.clearSceneBuildProcessLog(num, SceneBuildProcessType.CALL.code(),queueModelingCall);
+                if(StrUtil.isNotEmpty(batchIds)){
+                    origFileUploadBatchService.update(new LambdaUpdateWrapper<OrigFileUploadBatch>().set(OrigFileUploadBatch::getStatus, 2).in(OrigFileUploadBatch::getBatchId, batchIds.split(",")));
+                }
                 status = CommonOperStatus.WAITING.code();
                 Map<String, Object> param = new HashMap<>();
                 try {
-                    param.put("event_type", "计算中");
+                    JyUser jyUser = scenePlusService.getJyUserByNum(num);
+                    ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
+                    param.put("event_type", "scene");
                     param.put("event_content", "计算中");
                     param.put("scene_num", num);
                     param.put("event_time", new Date());
-                    param.put("ryid", scenePlusService.getRyIdByNum(num));
+                    if(Objects.nonNull(scenePlus)){
+                        param.put("scene_title", scenePlus.getTitle());
+                    }
+                    param.put("ryid", jyUser.getRyId());
+                    param.put("ryno", jyUser.getRyNo());
+                    param.put("nick_name", jyUser.getRyNickName());
                     jmgaService.sendStatus(param);
                 }catch (Exception e){
                     log.info("推送事件失败,param:{}", param);

+ 8 - 0
src/main/java/com/fdkankan/contro/mq/service/CallBuildService.java

@@ -0,0 +1,8 @@
+package com.fdkankan.contro.mq.service;
+
+public interface CallBuildService {
+
+    void pushPre();
+
+
+}

+ 1 - 1
src/main/java/com/fdkankan/contro/mq/service/impl/BuildIntermitSceneServiceImpl.java

@@ -134,7 +134,7 @@ public class BuildIntermitSceneServiceImpl implements IBuildSceneService {
     @Override
     public void downLoadSource(BuildSceneCallMessage buildSceneMqMessage,String path){
         String ossPath = getOssPath(path);
-        fYunFileService.downloadFileByCommand(path + File.separator + "capture", ossPath);
+        fYunFileService.downloadByCommand(path + File.separator + "capture", ossPath, true);
     }
 
     @Override

+ 54 - 22
src/main/java/com/fdkankan/contro/mq/service/impl/BuildObjServiceImpl.java

@@ -2,16 +2,15 @@ package com.fdkankan.contro.mq.service.impl;
 
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.io.FileUtil;
-import cn.hutool.core.util.StrUtil;
-import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
-import com.fdkankan.common.constant.*;
+import com.fdkankan.common.constant.CommonOperStatus;
+import com.fdkankan.common.constant.CommonStatus;
+import com.fdkankan.common.constant.ModelKind;
+import com.fdkankan.common.constant.SceneSource;
 import com.fdkankan.common.util.FileUtils;
-import com.fdkankan.contro.constant.UserEditDataType;
 import com.fdkankan.contro.entity.*;
 import com.fdkankan.contro.mq.service.IBuildSceneService;
-import com.fdkankan.contro.service.ICommonService;
 import com.fdkankan.contro.service.*;
 import com.fdkankan.contro.service.impl.FdkkV4Service;
 import com.fdkankan.fyun.face.FYunFileServiceInterface;
@@ -22,7 +21,6 @@ import com.fdkankan.model.utils.CreateObjUtil;
 import com.fdkankan.rabbitmq.bean.BuildSceneCallMessage;
 import com.fdkankan.rabbitmq.bean.BuildSceneResultMqMessage;
 import com.fdkankan.rabbitmq.util.RabbitMqProducer;
-import com.fdkankan.redis.constant.RedisKey;
 import com.fdkankan.redis.util.RedisUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -148,11 +146,18 @@ public class BuildObjServiceImpl implements IBuildSceneService {
 
             Map<String, Object> param = new HashMap<>();
             try {
-                param.put("event_type", "排队中");
+                JyUser jyUser = scenePlusService.getJyUserByNum(num);
+                ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
+                param.put("event_type", "scene");
                 param.put("event_content", "排队中");
                 param.put("scene_num", num);
                 param.put("event_time", new Date());
-                param.put("ryid", scenePlusService.getRyIdByNum(num));
+                if(Objects.nonNull(scenePlus)){
+                    param.put("scene_title", scenePlus.getTitle());
+                }
+                param.put("ryid", jyUser.getRyId());
+                param.put("ryno", jyUser.getRyNo());
+                param.put("nick_name", jyUser.getRyNickName());
                 jmgaService.sendStatus(param);
             }catch (Exception ex){
                 log.info("推送事件失败,param:{}", param);
@@ -170,11 +175,18 @@ public class BuildObjServiceImpl implements IBuildSceneService {
 
             Map<String, Object> param = new HashMap<>();
             try {
-                param.put("event_type", "计算失败");
-                param.put("event_content", "计算资源准备失败");
+                JyUser jyUser = scenePlusService.getJyUserByNum(num);
+                ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
+                param.put("event_type", "scene");
+                param.put("event_content", "计算失败");
                 param.put("scene_num", num);
                 param.put("event_time", new Date());
-                param.put("ryid", scenePlusService.getRyIdByNum(num));
+                if(Objects.nonNull(scenePlus)){
+                    param.put("scene_title", scenePlus.getTitle());
+                }
+                param.put("ryid", jyUser.getRyId());
+                param.put("ryno", jyUser.getRyNo());
+                param.put("nick_name", jyUser.getRyNickName());
                 jmgaService.sendStatus(param);
             }catch (Exception ex){
                 log.info("推送事件失败,param:{}", param);
@@ -192,14 +204,14 @@ public class BuildObjServiceImpl implements IBuildSceneService {
 
         //下载原始资源文件
         String ossPath = commonService.getOssOrignPath(message.getPath());
-        fYunFileService.downloadFileByCommand(path + File.separator + "capture", ossPath);
+        fYunFileService.downloadByCommand(path + File.separator + "capture", ossPath, true);
 
         //下载caches/image,算法会执行快一些
         String ossResultPath = String.format(UploadFilePath.scene_result_data_path, message.getSceneNum());
-        fYunFileService.downloadFileByCommand(path + "/caches/images/", ossResultPath + "caches/images/");
+        fYunFileService.downloadByCommand(path + "/caches/images/", ossResultPath + "caches/images/", true);
 
         //下载点位校准文件
-        fYunFileService.downloadFileByCommand(path + "/extras/", ossResultPath + "extras/");
+        fYunFileService.downloadByCommand(path + "/extras/", ossResultPath + "extras/", true);
     }
 
     @Override
@@ -220,11 +232,18 @@ public class BuildObjServiceImpl implements IBuildSceneService {
 
                 Map<String, Object> param = new HashMap<>();
                 try {
-                    param.put("event_type", "计算失败");
-                    param.put("event_content", "算法报错");
+                    ScenePlus scenePlus = scenePlusService.getScenePlusByNum(projectNum);
+                    JyUser jyUser = scenePlusService.getJyUserByNum(projectNum);
+                    param.put("event_type", "scene");
+                    param.put("event_content", "计算失败");
                     param.put("scene_num", projectNum);
                     param.put("event_time", new Date());
-                    param.put("ryid", scenePlusService.getRyIdByNum(projectNum));
+                    if(Objects.nonNull(scenePlus)){
+                        param.put("scene_title", scenePlus.getTitle());
+                    }
+                    param.put("ryid", jyUser.getRyId());
+                    param.put("ryno", jyUser.getRyNo());
+                    param.put("nick_name", jyUser.getRyNickName());
                     jmgaService.sendStatus(param);
                 }catch (Exception ex){
                     log.info("推送事件失败,param:{}", param);
@@ -351,11 +370,17 @@ public class BuildObjServiceImpl implements IBuildSceneService {
 
             Map<String, Object> param = new HashMap<>();
             try {
-                param.put("event_type", "计算成功");
+                JyUser jyUser = scenePlusService.getJyUserByNum(projectNum);
+                param.put("event_type", "scene");
                 param.put("event_content", "计算成功");
                 param.put("scene_num", projectNum);
                 param.put("event_time", new Date());
-                param.put("ryid", scenePlusService.getRyIdByNum(projectNum));
+                if(Objects.nonNull(scenePlus)){
+                    param.put("scene_title", scenePlus.getTitle());
+                }
+                param.put("ryid", jyUser.getRyId());
+                param.put("ryno", jyUser.getRyNo());
+                param.put("nick_name", jyUser.getRyNickName());
                 jmgaService.sendStatus(param);
             }catch (Exception ex){
                 log.info("推送事件失败,param:{}", param);
@@ -379,11 +404,18 @@ public class BuildObjServiceImpl implements IBuildSceneService {
 
             Map<String, Object> param = new HashMap<>();
             try {
-                param.put("event_type", "计算失败");
-                param.put("event_content", "计算结果处理失败");
+                ScenePlus scenePlus = scenePlusService.getScenePlusByNum(projectNum);
+                JyUser jyUser = scenePlusService.getJyUserByNum(projectNum);
+                param.put("event_type", "scene");
+                param.put("event_content", "计算失败");
                 param.put("scene_num", projectNum);
                 param.put("event_time", new Date());
-                param.put("ryid", scenePlusService.getRyIdByNum(projectNum));
+                if(Objects.nonNull(scenePlus)){
+                    param.put("scene_title", scenePlus.getTitle());
+                }
+                param.put("ryid", jyUser.getRyId());
+                param.put("ryno", jyUser.getRyNo());
+                param.put("nick_name", jyUser.getRyNickName());
                 jmgaService.sendStatus(param);
             }catch (Exception ex){
                 log.info("推送事件失败,param:{}", param);

+ 78 - 92
src/main/java/com/fdkankan/contro/mq/service/impl/BuildSceneProgressServiceImpl.java

@@ -1,24 +1,13 @@
 package com.fdkankan.contro.mq.service.impl;
 
-import cn.hutool.core.bean.BeanUtil;
-import cn.hutool.core.io.FileUtil;
 import cn.hutool.core.io.watch.WatchMonitor;
 import cn.hutool.core.io.watch.Watcher;
-import cn.hutool.core.thread.ThreadUtil;
-import cn.hutool.core.util.StrUtil;
 import cn.hutool.http.HttpUtil;
 import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.fdkankan.common.constant.*;
-import com.fdkankan.common.util.FileUtils;
-import com.fdkankan.contro.entity.ScenePlus;
-import com.fdkankan.contro.entity.ScenePlusExt;
 import com.fdkankan.contro.mq.service.IBuildSceneProgressService;
 import com.fdkankan.contro.service.IScenePlusExtService;
 import com.fdkankan.contro.service.IScenePlusService;
 import com.fdkankan.rabbitmq.bean.BuildSceneCallMessage;
-import com.fdkankan.redis.constant.RedisKey;
 import com.fdkankan.redis.util.RedisUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -27,11 +16,9 @@ import org.springframework.cloud.context.config.annotation.RefreshScope;
 import org.springframework.stereotype.Service;
 
 import java.io.File;
-import java.math.BigDecimal;
 import java.nio.file.Path;
 import java.nio.file.WatchEvent;
-import java.util.*;
-import java.util.concurrent.*;
+import java.util.Map;
 
 @RefreshScope
 @Slf4j
@@ -53,84 +40,83 @@ public class BuildSceneProgressServiceImpl implements IBuildSceneProgressService
 
     @Override
     public void monitorProgress(BuildSceneCallMessage buildSceneCallMessage) {
-        String num = buildSceneCallMessage.getSceneNum();
-        String customUserId = (String)buildSceneCallMessage.getExt().get("customUserId");
-        String gps = (String)buildSceneCallMessage.getExt().get("gps");
-        String path = buildSceneCallMessage.getPath();
-
-        ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
-        ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
-        String website = scenePlusExt.getWebSite();
-        String title = scenePlus.getTitle();
-
-        Long factor = 10L;
-        Long totalTime = 300L;
-        Integer shootCount = scenePlusExt.getShootCount();
-        if(Objects.nonNull(shootCount)){
-            totalTime += shootCount*7*60;//预估7分钟一个点位
-        }
-        redisUtil.set(String.format(RedisKey.SCENE_BUILD_EXPECT_TOTAL_TIME_NUM, num), String.valueOf(totalTime));
-        Long intervalTime = totalTime/factor;//发送计算进度时间窗口
-        log.info("推送进度时间窗口:{}", intervalTime);
-
-        Map<String, Object> params = new HashMap<>();
-        params.put("website", mainUrl.concat(website));
-        params.put("title", title);
-        params.put("customUserId", customUserId);
-        params.put("gps", gps);
-        params.put("totalTime", totalTime);
-        params.put("progress", 0);
-        params.put("status", CommonSuccessStatus.WAITING.code());
-        log.info("场景计算开始,发送进度请求,url:{}, param:{}", buildProgressUrl, JSON.toJSONString(params));
-        HttpUtil.post(buildProgressUrl, JSON.toJSONString(params), 2000);
-
-        ExecutorService executorService = ThreadUtil.newSingleExecutor();
-        executorService.submit(()->{
-            boolean finish = false;
-            int mainProgress = 0;
-            do {
-                try {
-                    Thread.sleep(intervalTime*1000);
-                } catch (InterruptedException e) {
-                    e.printStackTrace();
-                }
-                String finishStr = redisUtil.get(String.format(RedisKey.SCENE_BUILD_FINISH_NUM, num));
-                if(StrUtil.isEmpty(finishStr)){
-                    finishStr = "0";
-                }
-                CommonSuccessStatus commonSuccessStatus = CommonSuccessStatus.get(Integer.valueOf(finishStr));
-                switch (commonSuccessStatus){
-                    case SUCCESS:
-                        //计算结果处理消费者消费完毕后,会发送一次进度为100的消息,这里就不需要再做任务操作,
-                        finish = true;
-                        break;
-                    case FAIL:
-                        finish = true;
-                        params.put("progress", mainProgress);
-                        params.put("status", commonSuccessStatus.code());
-                        log.info("场景计算失败,发送进度请求,url:{}, param:{}", buildProgressUrl, JSON.toJSONString(params));
-                        this.sendNotice(params);
-                        break;
-                    case WAITING:
-                        mainProgress += factor;
-                        log.info("mainProgress:{}", mainProgress);
-                        //如果预估的时间比实际的时间要慢,那么这里的进度条会草超过100,所以当超过100时,不需要再发送进度了,只需要等计算结果处理监听中的计算完毕去发送100即可
-                        if(mainProgress >= 100){
-                            finish = true;
-                        }else{
-                            params.put("progress", mainProgress);
-                            params.put("status", commonSuccessStatus.code());
-                            log.info("场景计算进行中,发送进度请求,url:{}, param:{}", buildProgressUrl, JSON.toJSONString(params));
-                            this.sendNotice(params);
-                        }
-                        break;
-                }
-            }while (!finish);
-
-            log.info("场景计算完成,删除计算完成redis记录,key:{}", String.format(RedisKey.SCENE_BUILD_FINISH_NUM, num));
-            redisUtil.del(String.format(RedisKey.SCENE_BUILD_FINISH_NUM, num));
-            log.info("推送计算进度结束,num:{}", num);
-        });
+//        String num = buildSceneCallMessage.getSceneNum();
+//        String customUserId = (String)buildSceneCallMessage.getExt().get("customUserId");
+//        String gps = (String)buildSceneCallMessage.getExt().get("gps");
+//        String path = buildSceneCallMessage.getPath();
+//
+//        ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
+//        ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
+//        String website = scenePlusExt.getWebSite();
+//        String title = scenePlus.getTitle();
+//
+//        Long factor = 10L;
+//        Long totalTime = 300L;
+//        Integer shootCount = scenePlusExt.getShootCount();
+//        if(Objects.nonNull(shootCount)){
+//            totalTime += shootCount*7*60;//预估7分钟一个点位
+//        }
+//        redisUtil.set(String.format(RedisKey.SCENE_BUILD_EXPECT_TOTAL_TIME_NUM, num), String.valueOf(totalTime));
+//        Long intervalTime = totalTime/factor;//发送计算进度时间窗口
+//        log.info("推送进度时间窗口:{}", intervalTime);
+//
+//        Map<String, Object> params = new HashMap<>();
+//        params.put("website", mainUrl.concat(website));
+//        params.put("title", title);
+//        params.put("customUserId", customUserId);
+//        params.put("gps", gps);
+//        params.put("totalTime", totalTime);
+//        params.put("progress", 0);
+//        params.put("status", CommonSuccessStatus.WAITING.code());
+//        log.info("场景计算开始,发送进度请求,url:{}, param:{}", buildProgressUrl, JSON.toJSONString(params));
+//        HttpUtil.post(buildProgressUrl, JSON.toJSONString(params), 2000);
+//
+//        ExecutorService executorService = ThreadUtil.newSingleExecutor();
+//        executorService.submit(()->{
+//            boolean finish = false;
+//            int mainProgress = 0;
+//            do {
+//                try {
+//                    Thread.sleep(intervalTime*1000);
+//                } catch (InterruptedException e) {
+//                    e.printStackTrace();
+//                }
+//                String finishStr = redisUtil.get(String.format(RedisKey.SCENE_BUILD_FINISH_NUM, num));
+//                if(StrUtil.isEmpty(finishStr)){
+//                    finishStr = "0";
+//                }
+//                CommonSuccessStatus commonSuccessStatus = CommonSuccessStatus.get(Integer.valueOf(finishStr));
+//                switch (commonSuccessStatus){
+//                    case SUCCESS:
+//                        //计算结果处理消费者消费完毕后,会发送一次进度为100的消息,这里就不需要再做任务操作,
+//                        finish = true;
+//                        break;
+//                    case FAIL:
+//                        finish = true;
+//                        params.put("progress", mainProgress);
+//                        params.put("status", commonSuccessStatus.code());
+//                        log.info("场景计算失败,发送进度请求,url:{}, param:{}", buildProgressUrl, JSON.toJSONString(params));
+//                        this.sendNotice(params);
+//                        break;
+//                    case WAITING:
+//                        mainProgress += factor;
+//                        log.info("mainProgress:{}", mainProgress);
+//                        //如果预估的时间比实际的时间要慢,那么这里的进度条会草超过100,所以当超过100时,不需要再发送进度了,只需要等计算结果处理监听中的计算完毕去发送100即可
+//                        if(mainProgress >= 100){
+//                            finish = true;
+//                        }else{
+//                            params.put("progress", mainProgress);
+//                            params.put("status", commonSuccessStatus.code());
+//                            log.info("场景计算进行中,发送进度请求,url:{}, param:{}", buildProgressUrl, JSON.toJSONString(params));
+//                            this.sendNotice(params);
+//                        }
+//                        break;
+//                }
+//            }while (!finish);
+//
+//            redisUtil.del(String.format(RedisKey.SCENE_BUILD_FINISH_NUM, num));
+//            log.info("推送计算进度结束,num:{}", num);
+//        });
 
     }
 

文件差异内容过多而无法显示
+ 59 - 46
src/main/java/com/fdkankan/contro/mq/service/impl/BuildSceneServiceImpl.java


+ 0 - 599
src/main/java/com/fdkankan/contro/mq/service/impl/BuildV3SceneServiceImpl.java

@@ -1,599 +0,0 @@
-//package com.fdkankan.contro.mq.service.impl;
-//
-//import cn.hutool.core.io.FileUtil;
-//import cn.hutool.core.io.file.FileNameUtil;
-//import cn.hutool.core.util.StrUtil;
-//import cn.hutool.core.util.ZipUtil;
-//import com.alibaba.fastjson.JSON;
-//import com.alibaba.fastjson.JSONArray;
-//import com.alibaba.fastjson.JSONObject;
-//import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
-//import com.fdkankan.common.constant.PayStatus;
-//import com.fdkankan.common.constant.SceneStatus;
-//import com.fdkankan.common.util.FileUtils;
-//import com.fdkankan.contro.entity.*;
-//import com.fdkankan.contro.mq.service.IBuildSceneService;
-//import com.fdkankan.contro.service.ICommonService;
-//import com.fdkankan.contro.service.*;
-//import com.fdkankan.contro.service.impl.FdkkV4Service;
-//import com.fdkankan.fyun.config.FYunFileConfig;
-//import com.fdkankan.fyun.constant.FYunTypeEnum;
-//import com.fdkankan.fyun.face.FYunFileServiceInterface;
-//import com.fdkankan.model.constants.ConstantFileName;
-//import com.fdkankan.model.constants.ConstantFilePath;
-//import com.fdkankan.model.constants.UploadFilePath;
-//import com.fdkankan.model.utils.CreateHouseJsonUtil;
-//import com.fdkankan.model.utils.CreateObjUtil;
-//import com.fdkankan.push.config.PushMessageConfig;
-//import com.fdkankan.push.utils.PushMsgUtil;
-//import com.fdkankan.rabbitmq.bean.BuildSceneCallMessage;
-//import com.fdkankan.rabbitmq.bean.BuildSceneResultMqMessage;
-//import com.fdkankan.rabbitmq.util.RabbitMqProducer;
-//import lombok.extern.slf4j.Slf4j;
-//import org.apache.commons.lang3.ObjectUtils;
-//import org.apache.commons.lang3.StringUtils;
-//import org.springframework.beans.factory.annotation.Autowired;
-//import org.springframework.beans.factory.annotation.Value;
-//import org.springframework.stereotype.Service;
-//
-//import java.io.File;
-//import java.util.*;
-//
-//
-///**
-// * <p>
-// * </p>
-// *
-// * @author dengsixing
-// * @since 2022/4/20
-// **/
-//@Slf4j
-//@Service
-//public class BuildV3SceneServiceImpl implements IBuildSceneService {
-//
-//    @Value("${queue.modeling.modeling-call}")
-//    private String queueModelingCall;
-//
-//    @Value("${queue.modeling.v3.modeling-post}")
-//    private String queueV3ModelingPost;
-//
-//    @Value("${model.type:#{null}}")
-//    private String modelSceneKind;
-//
-//    @Value("${model.modelKind:3dtiles}")
-//    private String modelKind;
-//
-//    @Value("${env:gn}")
-//    private String env;
-//
-//    @Autowired
-//    private ICommonService commonService;
-//
-//    @Autowired
-//    private RabbitMqProducer mqProducer;
-//
-//    @Autowired
-//    private FYunFileServiceInterface fYunFileService;
-//    @Autowired
-//    private ICameraDetailService cameraDetailService;
-//
-//    @Autowired
-//    private FYunFileConfig fYunFileConfig;
-//
-//    @Autowired
-//    private ISceneProService sceneProService;
-//
-//    @Autowired
-//    private IUserIncrementService userIncrementService;
-//
-//    @Autowired
-//    private IFdkkLaserService fdkkLaserService;
-//
-//    @Autowired
-//    private FdkkV4Service fdkkV4Service;
-//
-//    @Autowired
-//    private IIncrementTypeService incrementTypeService;
-//
-////    @Autowired
-////    private IBuildSceneDTService buildSceneDTService;
-//
-//    @Autowired
-//    private ISceneProEditService sceneProEditService;
-//
-//    @Autowired
-//    private ISceneColdStorageService sceneColdStorageService;
-//
-//    @Override
-//    public void buildScenePre(BuildSceneCallMessage message) {
-//        boolean success = false;
-//        String num = message.getSceneNum();
-//        try {
-//
-//            //重新计算时需要删除文件夹,否知使用缓存
-//            if(new File(message.getPath() + File.separator + "results").exists()){
-//                FileUtils.deleteDirectory(message.getPath() + File.separator + "results");
-//            }
-//
-//            //用户相机重新全量上传,需要解冻结
-//            sceneColdStorageService.unfreeze(num, "用户相机重新全量上传", message.getPath());
-//
-//            //根据相机类型,组装资源路径
-//            //下载资源到本地
-//            this.downLoadSource(message, message.getPath());
-//            JSONObject fdageJson = JSONObject.parseObject(FileUtils.readFile(message.getPath().concat("/capture/data.fdage")));
-//            // 兼容旧的数据,防止OnlyExportMeshObj标志未删除掉
-//            boolean rewrite = false;
-//            if (fdageJson.containsKey("OnlyExportMeshObj")) {
-//                log.info("data.fdage 包含 OnlyExportMeshObj,进行去除!");
-//                // 写入data.fdage 防止重算
-//                fdageJson.remove("OnlyExportMeshObj");
-//                String ossPath = getOssPath(message.getPath());
-//                fYunFileService.uploadFile(fdageJson.toJSONString().getBytes(), ossPath + "data.fdage");
-//                rewrite = true;
-//            }
-//
-//            if (!ObjectUtils.isEmpty(modelSceneKind)) {
-//                // 修改dataFdage文件
-//                fdageJson.put("modelType", modelSceneKind);
-//                rewrite = true;
-//            }
-//
-//            if (rewrite) {
-//                FileUtils.writeFile(message.getPath().concat("/capture/data.fdage"), fdageJson.toJSONString());
-//            }
-//
-//            message.getBuildContext().put("cameraType",message.getCameraType());
-//
-//            message.setResultReceiverMqName(queueV3ModelingPost);
-//
-//            //发送mq,就进行计算
-//            mqProducer.sendByWorkQueue(queueModelingCall, message);
-//
-//            success = true;
-//
-//            log.info("场景计算资源准备结束,场景码:{}", message.getSceneNum());
-//
-//        }catch (Exception e){
-//            log.error("场景计算前置处理出错,num="+num, e);
-////            buildSceneDTService.handBaseFail("场景计算资源准备异常!", message.getPath(), message.getSceneNum(), "计算控制服务器");
-//            throw e;
-//        }
-//    }
-//
-//    private String getOssPath(String path) {
-//        String ossPath = ConstantFilePath.OSS_PREFIX
-//                + path.replace(ConstantFilePath.BUILD_MODEL_PATH, "")
-//                .replace(ConstantFilePath.BUILD_MODEL_LASER_PATH, "");
-//        if (!ossPath.endsWith("/")) {
-//            ossPath = ossPath.concat("/");
-//        }
-//        return ossPath;
-//    }
-//
-//    @Override
-//    public void downLoadSource(BuildSceneCallMessage buildSceneMqMessage,String path){
-//        String ossPath = getOssPath(path);
-//        fYunFileService.downloadFileByCommand(path + File.separator + "capture", ossPath);
-//    }
-//
-//
-//    @Override
-//    public void buildScenePost(BuildSceneResultMqMessage message) throws Exception {
-//        String sceneCode = message.getBuildContext().get("sceneNum").toString();
-//        try {
-//
-//            Integer cameraType = Integer.parseInt(message.getBuildContext().get("cameraType").toString());
-//            Long computeTime = message.getComputeTime();
-//
-//            String path = message.getPath();
-//
-//            Boolean buildSuccess = message.getBuildSuccess();
-//            JSONObject fdageData = getFdageData(path + File.separator + "capture" +File.separator+"data.fdage");
-//            Integer videoVersion = fdageData.getInteger("videoVersion");
-//            // 上传计算日志
-//            //如果是重复计算,没有走到计算逻辑,不需要上传日志文件
-//            log.info("开始上传计算日志");
-//            String buildLogPath = String.format(UploadFilePath.BUILD_LOG_PATH, sceneCode);
-//            fYunFileService.uploadFile(path + File.separator + "console.log", buildLogPath + "console.log");
-//            log.info("计算日志上传完成");
-//
-//            if (!buildSuccess) {
-//                log.error("建模失败,修改状态为失败状态");
-//                sceneProService.update(new LambdaUpdateWrapper<ScenePro>()
-//                        .set(ScenePro::getStatus, SceneStatus.FAILD.code())
-//                        .eq(ScenePro::getNum, sceneCode));
-//                // 发送钉钉消息,计算失败
-////                buildSceneDTService.handModelFail("计算失败", message.getPath(), sceneCode, message.getHostName());
-//                return;
-//            }
-//
-//            Map<String, String> uploadFiles = getUploadFiles(sceneCode,path,cameraType,fdageData);
-//
-//            copyFiles(path,sceneCode);
-//
-//            //建模成功走以下逻辑
-//            log.info("cameraType:{}",cameraType);
-//
-//            //计算场景消耗磁盘空间
-//            long space = this.calUseSpace(uploadFiles);
-//
-//            //读取计算结果文件生成videosJson
-//            JSONObject videosJson = this.getVideosJson(path, videoVersion, sceneCode, cameraType);
-//
-//            //写入数据库
-//            ScenePro scenePro = this.updateDbPlus(sceneCode, space, videosJson.toJSONString(), computeTime,fdageData.containsKey("exportMeshObj") && fdageData.getIntValue("exportMeshObj") == 1);
-//
-//            scenePro.setPayStatus(PayStatus.PAY.code());
-//            //如果相机容量不足,需要把场景的paystatus改为容量不足状态
-//            if (cameraType != 14) {
-//                scenePro.setPayStatus(commonService.getPayStatus(scenePro.getCameraId(), space));
-//                sceneProService.update(
-//                        new LambdaUpdateWrapper<ScenePro>()
-//                                .set(ScenePro::getPayStatus, scenePro.getPayStatus())
-//                                .eq(ScenePro::getId, scenePro.getId()));
-//            }
-//
-//            //上传文件
-//            log.info("开始上传场景计算结果数据,num:{}", sceneCode);
-//            fYunFileService.uploadMulFiles(uploadFiles);
-//
-//            Map<String,String> damFileHeaders = new HashMap<>();
-//            damFileHeaders.put("Content-Encoding","gzip");
-//
-//            // dam 文件设置请求头
-//            uploadFiles.entrySet().stream()
-//                .filter(entry -> FileNameUtil.extName(entry.getKey()).equals("dam"))
-//                .filter(entry -> new File(entry.getKey()).exists())
-//                .forEach(entry -> {
-//                    // gzip压缩
-//                    FileUtil.writeBytes(ZipUtil.gzip(new File(entry.getKey())), entry.getKey() + ".gzip");
-//                    // 重命名
-//                    FileUtil.rename(new File(entry.getKey() + ".gzip"), entry.getKey(), true);
-//                    fYunFileService.uploadFile(entry.getKey(), entry.getValue(), damFileHeaders);
-//                });
-//
-//            //生成houseTypejson并上传
-//            uploadFiles.entrySet().stream().filter(entry-> FileNameUtil.getName(entry.getKey()).equals("floorplan_cad.json"))
-//                    .forEach(entry-> uploadHouseTypeJson(sceneCode,entry.getKey()));
-//
-//
-//
-//            //计算成功,通知APP
-//            Integer pushChannel = fdageData.getInteger("pushChannel");
-//            String pushToken = fdageData.getString("pushToken");
-//            this.pushMsgToApp(pushChannel,pushToken, cameraType, scenePro.getSceneName(), scenePro.getWebSite());
-//
-//            SceneProEdit sceneProEdit = sceneProEditService.getByProId(scenePro.getId());
-//            sceneProEdit.setVersion(ObjectUtils.isEmpty(sceneProEdit.getVersion()) ? 0 : sceneProEdit.getVersion() + 1);
-//            sceneProEdit.setImagesVersion(ObjectUtils.isEmpty(sceneProEdit.getImagesVersion()) ? 0 : sceneProEdit.getImagesVersion() + 1);
-//            sceneProEdit.setFloorEditVer(ObjectUtils.isEmpty(sceneProEdit.getFloorEditVer()) ? 0 : sceneProEdit.getFloorEditVer() + 1);
-//            sceneProEdit.setFloorPublishVer(ObjectUtils.isEmpty(sceneProEdit.getFloorPublishVer()) ? 0 : sceneProEdit.getFloorPublishVer() + 1);
-//            if (cameraType == 14) {
-//                //计算成功  激光转台相机 同步 请求
-//                fdkkLaserService.syncBuildResult(scenePro.getNum(), scenePro.getDataSource(),scenePro.getCreateTime(), Calendar.getInstance().getTime());
-//                sceneProEdit.setMapVisi(0);
-//            }
-//            sceneProEditService.updateById(sceneProEdit);
-//
-//            //写scene.json
-//            log.info("生成scene.json上传oss并设置缓存,num:{}", sceneCode);
-//            this.writeSceneJson(videosJson,scenePro,sceneProEdit);
-//
-//            CreateObjUtil.deleteFile(path.replace(ConstantFilePath.BUILD_MODEL_PATH, "/") + "/capture");
-//            log.info("场景计算结果处理结束,场景码:{}", sceneCode);
-//            // 判断是否升级V4
-////            if(fdageData.containsKey("updateV4") && fdageData.getIntValue("updateV4") == 1){
-////                fdkkV4Service.upgradeToV4(sceneCode);
-////            }
-//
-//            //国际环境需要发邮件通知
-//            if("eur".equals(env)){
-//                commonService.sendEmail(sceneCode);
-//            }
-//
-//        }catch (Exception e){
-//            log.error("场景计算结果处理出错,num"+sceneCode, e);
-////            buildSceneDTService.handBaseFail("场景计算结果处理出错!", message.getPath(), sceneCode, "计算控制服务器");
-//            throw e;
-//        }
-//    }
-//
-//    private void copyFiles(String path, String num) {
-//        if (new File(path + File.separator + "results" + File.separator + "floor.json").exists()) {
-//            FileUtils.copyFile(path + File.separator + "results" + File.separator + "floor.json", ConstantFilePath.SCENE_PATH + "data" + File.separator + "data" + num + File.separator + "floor.json", true);
-//        }
-//        if (new File(path + File.separator + "results" + File.separator + "floorplan.json").exists()) {
-//            FileUtils.copyFile(path + File.separator + "results" + File.separator + "floorplan.json", ConstantFilePath.SCENE_PATH + "data" + File.separator + "data" + num + File.separator + "floor.json", true);
-//            FileUtils.copyFile(path + File.separator + "results" + File.separator + "floorplan.json", ConstantFilePath.SCENE_PATH + "data" + File.separator + "data" + num + File.separator + "floorplan.json", true);
-//        }
-//    }
-//
-//    private Map<String, String> getUploadFiles(String projectNum,String path,Integer cameraType,JSONObject fdageData) throws Exception {
-//        String dataViewPath = String.format(ConstantFilePath.DATA_PATH_FORMAT, projectNum);
-//        String imagesPath = String.format(ConstantFilePath.IMAGE_PATH_FORMAT, projectNum);
-//        String videoPath = String.format(ConstantFilePath.VIDEO_PATH_FORMAT, projectNum);
-//        String resultsPath = path + File.separator + "results" + File.separator;
-//
-//        String uploadData = FileUtils.readFile(resultsPath + "upload.json");
-//        JSONArray array = JSONObject.parseObject(uploadData).getJSONArray("upload");
-//
-//        JSONObject fileJson = null;
-//        String fileName = "";
-//
-//        Map<String, String> map = new HashMap();
-//
-//        for (int i = 0; i < array.size(); ++i) {
-//            fileJson = array.getJSONObject(i);
-//            fileName = fileJson.getString("file");
-//            String filePath = resultsPath + fileName;
-//
-//            if (!(new File(filePath)).exists()) {
-//                throw new Exception(filePath + "文件不存在");
-//            }
-//
-//            if ("vision2.txt".equals(fileName)) {
-//                CreateObjUtil.convertTxtToVisionmodeldata(resultsPath + "vision2.txt", resultsPath + "vision2.modeldata");
-//                map.put(resultsPath + "vision2.modeldata", imagesPath + "vision2.modeldata");
-//                map.put(resultsPath + "vision2.txt", imagesPath + "vision2.txt");
-//            }
-//
-//            if (fileJson.getIntValue("clazz") == 2) {
-//                map.put(filePath, imagesPath + ConstantFileName.modelUUID + "_50k_texture_jpg_high1/" + fileName.replace("tex/", ""));
-//            } else if (fileJson.getIntValue("clazz") == 3) {
-//                map.put(filePath, imagesPath + "pan/high/" + fileName.replace("high/", ""));
-//            } else if (fileJson.getIntValue("clazz") == 4) {
-//                map.put(filePath, imagesPath + "pan/low/" + fileName.replace("low/", ""));
-//            } else if (fileJson.getIntValue("clazz") == 5) {
-//                map.put(filePath, imagesPath + fileName);
-//            } else if (fileJson.getIntValue("clazz") == 7) {
-//                map.put(filePath, imagesPath + fileName);
-//            } else if (fileJson.getIntValue("clazz") == 10) {
-//                String mappingOssPath = String.format("scene_edit_data/%s/data/", projectNum) + fileName.replace("updown", "mapping");
-//                map.put(filePath, mappingOssPath);
-//            } else {
-//                if (fileJson.getIntValue("clazz") == 11 || fileJson.getIntValue("clazz") == 12) {
-//                    map.put(filePath, videoPath + fileName.replace("videos/", ""));
-//                    if (fileName.contains(".mp4")) {
-//                        map.put(resultsPath + fileName.replace("mp4", "flv"), videoPath + fileName.replace("videos/", "").replace("mp4", "flv"));
-//                    }
-//                }
-//
-//                if (fileJson.getIntValue("clazz") == 16) {
-//                    map.put(filePath, dataViewPath + fileName);
-//                }
-//
-//                if (fileJson.getIntValue("clazz") == 18) {
-//                    map.put(filePath, imagesPath + fileName);
-//                }
-//            }
-//        }
-//
-//
-//        if ((fdageData.containsKey("exportMeshObj") && fdageData.getIntValue("exportMeshObj") == 1)
-//                || (!ObjectUtils.isEmpty(cameraType) && cameraType != 14)) {
-//            CreateObjUtil.convertTxtToDam(path + File.separator + "results" + File.separator + "tex" + File.separator + "modeldata.txt", path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam");
-//            CreateObjUtil.convertDamToLzma(path + File.separator + "results/");
-//            CreateObjUtil.convertTxtToDam(path + File.separator + "results" + File.separator + "tex" + File.separator + "modeldata.txt", path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam");
-//            map.put(path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam.lzma", imagesPath + ConstantFileName.modelUUID + "_50k.dam.lzma");
-//            map.put(path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam", imagesPath + ConstantFileName.modelUUID + "_50k.dam");
-//        }
-//
-//        CreateObjUtil.convertTxtToVisionmodeldata(resultsPath + "vision.txt", resultsPath + "vision.modeldata");
-//        map.put(resultsPath + "vision.txt", imagesPath + "vision.txt");
-//        map.put(resultsPath + "vision.modeldata", imagesPath + "vision.modeldata");
-//
-//        log.info("数据转换完成:" + projectNum);
-//
-//        FileUtil.touch("/mnt/4Dkankan/scene/data" + File.separator + "data" + projectNum);
-////        map.put(resultsPath + "floorplan.json", dataViewPath + "floor.json");
-//        map.put(resultsPath + "floorplan_cad.json", dataViewPath + "floorplan_cad.json");
-//        map.put(path + File.separator + "capture/stitch_params.txt", dataViewPath + "stitch_params.txt");
-//        map.put(path + File.separator + "capture/Up.xml", dataViewPath + "Up.xml");
-//        map.put(path + File.separator + "capture/Up2.xml", dataViewPath + "Up2.xml");
-//        map.put(path + File.separator + "capture/Up.txt", dataViewPath + "Up.txt");
-//        map.put(path + File.separator + "capture/Up2.txt", dataViewPath + "Up2.txt");
-//        return map;
-//
-//    }
-//
-//    private JSONObject getFdageData(String dataFdagePath) {
-//        log.info("dataFdagePath 文件路径 :{}", dataFdagePath);
-//        String data = FileUtils.readFile(dataFdagePath);
-//        //获取data.fdage的内容
-//        JSONObject dataJson = new JSONObject();
-//        if(data!=null){
-//            dataJson = JSONObject.parseObject(data);
-//        }
-//        return dataJson;
-//    }
-//
-//    private void writeSceneJson(JSONObject videosJson, ScenePro scenePro,SceneProEdit sceneProEdit)  throws Exception{
-//        String num = scenePro.getNum();
-//        String dataViewPath = String.format(ConstantFilePath.DATA_PATH_FORMAT, num);
-//        //如果云端没有scene.json文件,生成一份
-//
-//        JSONObject sceneJson = JSONObject.parseObject(JSONObject.toJSONString(scenePro));
-//        sceneJson.put("videos",videosJson.toJSONString());
-//        sceneJson.put("version",sceneProEdit.getVersion());
-//        sceneJson.put("imagesVersion",sceneProEdit.getImagesVersion());
-//        sceneJson.put("floorEditVer",sceneProEdit.getFloorEditVer());
-//        sceneJson.put("floorPublishVer",sceneProEdit.getFloorPublishVer());
-//        String sceneJsonStr = JSON.toJSONString(sceneJson);
-//
-//        FileUtils.writeFile(ConstantFilePath.SCENE_PATH + "data/data" + num + File.separator + "scene.json", sceneJsonStr);
-//        //上传sceneJson文件
-//        fYunFileService.uploadFile(sceneJsonStr.getBytes(), dataViewPath + "scene.json");
-//
-//        // 上传status JSON.
-//        JSONObject statusJson = new JSONObject();
-//        //临时将-2改成1,app还没完全更新
-//        statusJson.put("status", 1);
-//        statusJson.put("webSite", scenePro.getWebSite());
-//        statusJson.put("sceneNum", num);
-//        statusJson.put("thumb", scenePro.getThumb());
-//        statusJson.put("payStatus", scenePro.getPayStatus());
-//        FileUtils.writeFile(ConstantFilePath.SCENE_PATH + "data/data" + num + File.separator + "status.json", statusJson.toString());
-//
-//        fYunFileService.uploadFile(ConstantFilePath.SCENE_PATH + "data/data" + num + File.separator + "status.json",
-//                dataViewPath + "status.json");
-//    }
-//
-//    private void pushMsgToApp(Integer pushChannel, String pushToken, int cameraType, String sceneName, String webSite){
-//        log.info("推送消息,渠道是 {}, 手机token是 {}", pushChannel, pushToken);
-//        if(Objects.isNull(pushChannel) && StrUtil.isBlank(pushToken)){
-//            return;
-//        }
-//
-//        String title = sceneName + "计算完成";
-//        String body = "您上传的" + sceneName + "计算完成,点击查看";
-//
-//        try{
-//            if(FYunTypeEnum.AWS.code().equals(fYunFileService.getFyunType())){
-//                PushMsgUtil.googlePushMsg(ConstantFilePath.BASE_PATH + "/refreshToken.json", pushToken,
-//                        title, body , webSite);
-//                return;
-//            }
-//
-//            PushMessageConfig pushConfig = null;
-//            if(pushChannel == 0){
-//                if(cameraType == 10 || cameraType == 13){
-//                    //ios
-//                    pushConfig = new PushMessageConfig(PushMessageConfig.IOS_KEY_Z, PushMessageConfig.IOS_SECRET_Z);
-//                    pushConfig.sendIOSUnicast(pushToken,  "四维看看Minion",title, body, webSite);
-//                }else {
-//                    //ios
-//                    pushConfig = new PushMessageConfig(PushMessageConfig.IOS_KEY, PushMessageConfig.IOS_SECRET);
-//                    pushConfig.sendIOSUnicast(pushToken, "四维看看Pro",title, body, webSite);
-//                }
-//            }else {
-//                if(cameraType == 10 || cameraType == 13){
-//                    //ios
-//                    //安卓
-//                    pushConfig = new PushMessageConfig(PushMessageConfig.ANDROID_KEY_Z, PushMessageConfig.ANDROID_SECRET_Z);
-//                    pushConfig.sendAndroidUnicast2(pushToken, "四维看看Minion",title, body, webSite);
-//                }else {
-//                    //安卓
-//                    pushConfig = new PushMessageConfig(PushMessageConfig.ANDROID_KEY, PushMessageConfig.ANDROID_SECRET);
-//                    pushConfig.sendAndroidUnicast(pushToken, "四维看看Pro",title, body, webSite);
-//                }
-//            }
-//            log.info("消息推送结束!");
-//        }catch (Exception e){
-//            log.error("推送消息失败:", e);
-//        }
-//    }
-//
-//    private JSONObject getVideosJson(String path, Integer videoVersion, 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 = 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");
-//        JSONObject uploadJson = null;
-//        JSONArray array = null;
-//        if(uploadData!=null) {
-//            uploadJson = JSONObject.parseObject(uploadData);
-//            array = uploadJson.getJSONArray("upload");
-//        }
-//        JSONObject fileJson = null;
-//        String fileName = "";
-//
-//        //计算ts文件的大小,并拼接成json格式
-//        JSONArray jsonArray = new JSONArray();
-//        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 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(Objects.nonNull(videoVersion) && videoVersion >= 4){
-//            videosJson.put("version", 3);
-//            videosJson.put("upPath", fYunFileConfig.getHost() + String.format(ConstantFilePath.DATA_PATH_FORMAT, projectNum) + "Up.xml");
-//            if(cameraType == 13){
-//                //转台相机
-//                videosJson.put("upPath", videosJson.getString("upPath").replace(".xml", ".txt"));
-//            }
-//        }else {
-//            videosJson.put("version", 1);
-//            videosJson.put("upPath", fYunFileConfig.getHost() + String.format(ConstantFilePath.DATA_PATH_FORMAT, projectNum) + "Up2.xml");
-//            if(cameraType == 13){
-//                //转台相机
-//                videosJson.put("upPath", videosJson.getString("upPath").replace(".xml", ".txt"));
-//            }
-//        }
-//
-//        if(cameraType == 5 || cameraType == 6){
-//            videosJson.put("version", 1);
-//            videosJson.put("upPath", fYunFileConfig.getHost() + String.format(ConstantFilePath.DATA_PATH_FORMAT, projectNum) + "stitch_params.txt");
-//        }
-//
-//        return videosJson;
-//    }
-//
-//    private Long calUseSpace(Map<String, String> uploadFile) {
-//        return uploadFile.keySet().stream().map(File::new).filter(File::exists).mapToLong(File::length).sum();
-//    }
-//
-//    private ScenePro updateDbPlus(String num, Long space, String videosJson, Long computeTime,boolean isObj){
-//        sceneProService.update(new LambdaUpdateWrapper<ScenePro>()
-//                .eq(ScenePro::getNum, num)
-//                .set(ScenePro::getStatus, SceneStatus.NO_DISPLAY.code())
-//                .set(ScenePro::getUpdateTime, new Date())
-//                .set(ScenePro::getCreateTime, new Date())
-//                .set(ScenePro::getSpace, space)
-//                .set(ScenePro::getComputeTime, computeTime)
-//                .set(ScenePro::getVideos, videosJson)
-//                .set(ScenePro::getIsObj, isObj ? 1 : 0)
-//                .set(ScenePro::getPayStatus, PayStatus.PAY.code()));
-//       return sceneProService.getByNum(num);
-//    }
-//
-//    public void uploadHouseTypeJson(String num, String floorPlanCardFilePath) {
-//        if (!new File(floorPlanCardFilePath).exists()) {
-//            log.error("floorplan_cad.json 文件不存在,文件路径:{}", floorPlanCardFilePath);
-//            return;
-//        }
-//        JSONObject json = CreateHouseJsonUtil.createHouseTypeJsonByCad(floorPlanCardFilePath);
-//        String hourseTypeJsonPath = String.format(ConstantFilePath.DATA_PATH_FORMAT, num) + "houseType.json";
-//        fYunFileService.uploadFile(json.toJSONString().getBytes(), hourseTypeJsonPath);
-//        hourseTypeJsonPath = String.format(UploadFilePath.DATA_EDIT_PATH, num) + "houseType.json";
-//        fYunFileService.uploadFile(json.toJSONString().getBytes(), hourseTypeJsonPath);
-//    }
-//}

+ 121 - 0
src/main/java/com/fdkankan/contro/mq/service/impl/CallBuildServiceImpl.java

@@ -0,0 +1,121 @@
+package com.fdkankan.contro.mq.service.impl;
+
+import cn.hutool.core.collection.CollUtil;
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.fdkankan.contro.entity.OrigFileUploadBatch;
+import com.fdkankan.contro.entity.ScenePlus;
+import com.fdkankan.contro.mq.service.CallBuildService;
+import com.fdkankan.contro.service.IOrigFileUploadBatchService;
+import com.fdkankan.contro.service.IOrigFileUploadService;
+import com.fdkankan.contro.service.IScenePlusService;
+import com.fdkankan.rabbitmq.bean.BuildSceneCallMessage;
+import com.fdkankan.rabbitmq.util.RabbitMqProducer;
+import com.fdkankan.redis.util.RedisLockUtil;
+import com.fdkankan.redis.util.RedisUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.*;
+
+@Slf4j
+@Service
+public class CallBuildServiceImpl implements CallBuildService {
+
+    @Autowired
+    private IOrigFileUploadBatchService origFileUploadBatchService;
+    @Resource
+    private RedisLockUtil redisLockUtil;
+    @Autowired
+    private IScenePlusService scenePlusService;
+    @Autowired
+    private IOrigFileUploadService origFileUploadService;
+    @Resource
+    private RabbitMqProducer rabbitMqProducer;
+    @Value("${queue.modeling.modeling-pre}")
+    private String queueModelingPre;
+    @Resource
+    private RedisUtil redisUtil;
+
+
+    @Override
+    public void pushPre() {
+
+        log.info("推送计算定时任务开始");
+
+        List<OrigFileUploadBatch> list = origFileUploadBatchService.list(
+                new LambdaQueryWrapper<OrigFileUploadBatch>()
+                        .eq(OrigFileUploadBatch::getStatus, 4)
+                        .orderByAsc(OrigFileUploadBatch::getCreateTime));
+        if(CollUtil.isEmpty(list)){
+            return;
+        }
+        LinkedHashMap<String, LinkedList<OrigFileUploadBatch>> map = new LinkedHashMap<>();
+        for (OrigFileUploadBatch origFileUploadBatch : list) {
+            String uuid = origFileUploadBatch.getUuid();
+            LinkedList<OrigFileUploadBatch> origFileUploadBatches = map.get(uuid);
+            if(origFileUploadBatches == null){
+                origFileUploadBatches = new LinkedList<>();
+                map.put(uuid, origFileUploadBatches);
+            }
+            origFileUploadBatches.add(origFileUploadBatch);
+
+        }
+        for (String uuid : map.keySet()) {
+            ScenePlus scenePlus = scenePlusService.getByUuid(uuid);
+            boolean lock = redisLockUtil.lock("push-modeling-pre:" + scenePlus.getNum(), scenePlus.getNum(), 20*60);
+            if(!lock){
+                continue;
+            }
+            try {
+                //过滤出同一个场景且待推送的上传批次
+                Set<String> batchIds = new HashSet<>();
+                StringBuilder batchIdStr = new StringBuilder();
+                for (OrigFileUploadBatch fileUploadBatch : map.get(uuid)) {
+                    if(uuid.equals(fileUploadBatch.getUuid())){
+                        batchIds.add(fileUploadBatch.getBatchId());
+                        batchIdStr.append(",").append(fileUploadBatch.getBatchId());
+                    }
+                }
+                BuildSceneCallMessage mqMessage = JSON.parseObject(map.get(uuid).getLast().getMqContent(), BuildSceneCallMessage.class);
+                mqMessage.getExt().put("batchId", batchIdStr.substring(1));
+                rabbitMqProducer.sendByWorkQueue(queueModelingPre, mqMessage);
+
+                long incr = redisUtil.incr("modeling-count:" + scenePlus.getNum(), 1);
+                log.info("场景:{},计算推送次数:{}", scenePlus.getNum(), incr);
+
+            }catch (Exception e){
+                log.error("推送场景计算失败,uuid:{}", uuid, e);
+            }
+
+        }
+
+        log.info("推送计算定时任务结束");
+    }
+
+    public static void main(String[] args) {
+        List<OrigFileUploadBatch> list = new ArrayList<>();
+        OrigFileUploadBatch a = new OrigFileUploadBatch();
+        a.setUuid("123");
+        OrigFileUploadBatch b = new OrigFileUploadBatch();
+        b.setUuid("123");
+        OrigFileUploadBatch c = new OrigFileUploadBatch();
+        c.setUuid("123");
+        list.add(a);
+        list.add(b);
+        list.add(c);
+        for (OrigFileUploadBatch origFileUploadBatch : list) {
+            String uuid = origFileUploadBatch.getUuid();
+            for (OrigFileUploadBatch fileUploadBatch : list) {
+                if(uuid.equals(fileUploadBatch.getUuid())){
+                    list.remove(fileUploadBatch);
+                }
+            }
+        }
+
+
+    }
+}

+ 2 - 0
src/main/java/com/fdkankan/contro/service/IJmgaService.java

@@ -10,4 +10,6 @@ public interface IJmgaService {
 
     void sendStatus(Map<String, Object> param);
 
+    void checkLackFile(String dataSource);
+
 }

+ 1 - 2
src/main/java/com/fdkankan/contro/service/IOrigFileUploadService.java

@@ -1,8 +1,7 @@
 package com.fdkankan.contro.service;
 
-import com.fdkankan.contro.entity.OrigFileUpload;
 import com.baomidou.mybatisplus.extension.service.IService;
-import com.fdkankan.contro.entity.OrigFileUploadBatch;
+import com.fdkankan.contro.entity.OrigFileUpload;
 
 import java.util.List;
 

+ 85 - 0
src/main/java/com/fdkankan/contro/service/impl/JmgaServiceImpl.java

@@ -1,6 +1,7 @@
 package com.fdkankan.contro.service.impl;
 
 import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.io.FileUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -19,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.io.File;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
@@ -91,4 +93,87 @@ public class JmgaServiceImpl implements IJmgaService {
     public void sendStatus(Map<String, Object> param) {
         mqProducer.sendByWorkQueue("jmga-event-notice", param);
     }
+
+    @Override
+    public void checkLackFile(String dataSource) {
+
+        String dataFdagePath = dataSource.concat(File.separator).concat("capture").concat(File.separator).concat("data.fdage");
+        if(!FileUtil.exist(dataFdagePath)){
+            throw new BusinessException(ErrorCode.FAILURE_CODE_4001.code(), ErrorCode.FAILURE_CODE_4001.formatMessage("data.fdage"));
+        }
+        JSONObject fdageData = null;
+        try {
+            fdageData = JSON.parseObject(FileUtil.readUtf8String(dataFdagePath));
+        }catch (Exception e){
+            throw new BusinessException(ErrorCode.FAILURE_CODE_4001.code(), ErrorCode.FAILURE_CODE_4001.formatMessage("data.fdage"));
+        }
+
+        int camType = fdageData.getJSONObject("cam").getIntValue("type");
+        if(camType == 1 || camType == 2 || camType == 9 || camType == 10 || camType == 11){
+            Integer shootCount = fdageData.getJSONArray("points").size();
+            if(shootCount > 0){//有点位代表架站式
+                String parametersPath = dataSource.concat(File.separator).concat("capture").concat(File.separator).concat("parameters.json");
+                if(!FileUtil.exist(parametersPath)){
+                    throw new BusinessException(ErrorCode.FAILURE_CODE_4001.code(), ErrorCode.FAILURE_CODE_4001.formatMessage("parameters.json"));
+                }
+
+                String sfmDataBinPath = dataSource.concat(File.separator).concat("capture").concat(File.separator).concat("sfm_data.bin");
+                if(!FileUtil.exist(sfmDataBinPath)){
+                    throw new BusinessException(ErrorCode.FAILURE_CODE_4001.code(), ErrorCode.FAILURE_CODE_4001.formatMessage("sfm_data.bin"));
+                }
+
+                String upName = camType > 2 ? "Up.txt" : "Up.xml";
+                String upTxtPath = dataSource.concat(File.separator).concat("capture").concat(File.separator).concat(upName);
+                if(!FileUtil.exist(upTxtPath)){
+                    throw new BusinessException(ErrorCode.FAILURE_CODE_4001.code(), ErrorCode.FAILURE_CODE_4001.formatMessage(upName));
+                }
+            }
+        }
+        if(camType == 5){
+            String parametersPath = dataSource.concat(File.separator).concat("capture").concat(File.separator).concat("images/parameters.json");
+            if(!FileUtil.exist(parametersPath)){
+                throw new BusinessException(ErrorCode.FAILURE_CODE_4001.code(), ErrorCode.FAILURE_CODE_4001.formatMessage("parameters.json"));
+            }
+
+            String sfmDataBinPath = dataSource.concat(File.separator).concat("capture").concat(File.separator).concat("result/reconstruction/sfm_data.bin");
+            if(!FileUtil.exist(sfmDataBinPath)){
+                throw new BusinessException(ErrorCode.FAILURE_CODE_4001.code(), ErrorCode.FAILURE_CODE_4001.formatMessage("sfm_data.bin"));
+            }
+        }
+
+        //从data.fdage中获取需要上传的文件列表
+        JSONArray points = fdageData.getJSONArray("points");
+        if(CollUtil.isEmpty(points)){
+            return;
+        }
+
+        for (Object point : points) {
+            JSONObject pointJson = (JSONObject) point;
+            if(camType == 5){//圆周率相机
+                String name = pointJson.getString("name");
+                this.checkFileAvailable(dataSource, name);
+            }else{//四维相机
+                JSONArray imgs = pointJson.getJSONArray("imgs");
+                for (Object img : imgs) {
+                    JSONObject imgJson = (JSONObject) img;
+                    String name = imgJson.getString("name");
+                    this.checkFileAvailable(dataSource, name);
+                }
+            }
+        }
+    }
+
+    private void checkFileAvailable(String dataSource, String fileName){
+        List<File> fileList = FileUtil.loopFiles(dataSource.concat(File.separator).concat("capture"));
+        if(CollUtil.isEmpty(fileList)){
+            throw new BusinessException(ErrorCode.FAILURE_CODE_4001.code(), ErrorCode.FAILURE_CODE_4001.formatMessage(fileName));
+        }
+        for (File file : fileList) {
+            if(file.getName().equals(fileName) && file.length() > 0){
+                return;
+            }
+        }
+        throw new BusinessException(ErrorCode.FAILURE_CODE_4001.code(), ErrorCode.FAILURE_CODE_4001.formatMessage(fileName));
+    }
+
 }

+ 5 - 1
src/main/java/com/fdkankan/contro/service/impl/OrigFileUploadServiceImpl.java

@@ -2,13 +2,16 @@ package com.fdkankan.contro.service.impl;
 
 import cn.hutool.core.collection.CollUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fdkankan.contro.entity.OrigFileUpload;
 import com.fdkankan.contro.mapper.IOrigFileUploadMapper;
 import com.fdkankan.contro.service.IOrigFileUploadService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 /**
  * <p>
@@ -34,4 +37,5 @@ public class OrigFileUploadServiceImpl extends ServiceImpl<IOrigFileUploadMapper
         }
         return list.get(0);
     }
+
 }

+ 15 - 8
src/main/java/com/fdkankan/contro/service/impl/SceneFileBuildServiceImpl.java

@@ -403,7 +403,7 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
         ResultData post = myClient.post(cameraInStoreUrl, cameraInStoreParams);
         log.info("---------cameraInStore result:{}-----------", post);
 
-        JSONObject configJson = JSONObject.parseObject(fYunFileService.getFileContent(ConstantFilePath.OSS_PREFIX + prefix + "config.fdage"));
+        JSONObject configJson = JSONObject.parseObject(fYunFileService.getFileContent(ConstantFilePath.OSS_PREFIX + prefix + "config.json"));
         String folderName = configJson.getString("id");
         String customUserId = configJson.getString("customUserId");
         String customUserName = configJson.getString("customUserName");
@@ -491,16 +491,16 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
             log.info("上传icon成功....");
         }
 
-        return buildScenePost(dataSource, jsonObject, buildType, cameraType, sceneNum, camera, cameraDetail, rebuild,icon);
+        return buildScenePost(dataSource, jsonObject, buildType, cameraType, sceneNum, camera, cameraDetail, rebuild,icon, user);
     }
 
     private ScenePlusVO buildScenePost(String dataSource, JSONObject jsonObject, String buildType, long cameraType,
-                                       String sceneNum, Camera camera, CameraDetail cameraDetail, int rebuild,String icon) throws Exception {
+                                       String sceneNum, Camera camera, CameraDetail cameraDetail, int rebuild,String icon, User user) throws Exception {
         String imgViewPath = String.format(UploadFilePath.IMG_VIEW_PATH, sceneNum);
 
         String userName = null;
         if (!ObjectUtils.isEmpty(cameraDetail.getUserId())) {
-            SSOUser user = userService.getSSOUserByUserId(cameraDetail.getUserId());
+//            SSOUser user = userService.getSSOUserByUserId(cameraDetail.getUserId());
             userName = ObjectUtils.isEmpty(user) ? null : user.getUserName();
         }
 
@@ -527,7 +527,7 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
         String unicode = jsonObject.getString("creator") + "_" + jsonObject.getString("uuidtime");
 
         ScenePlusVO scenePlusVO = this.createScenePlus(sceneNum, camera.getId(), camera.getChildName(), jsonObject.getString("creator"),
-                jsonObject.getString("pwd"), unicode,cameraType,jsonObject.getJSONObject("cam").getIntValue("type"), dataSource, icon,  cameraDetail.getUserId(), userName,algorithm,jsonObject.getInteger("location"),
+                jsonObject.getString("pwd"), unicode,cameraType,jsonObject.getJSONObject("cam").getIntValue("type"), dataSource, icon,  user.getId(), userName,algorithm,jsonObject.getInteger("location"),
                 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());
@@ -554,7 +554,6 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
             }
         }
         mqMessage.getExt().put("deleteExtras", true);
-        rabbitMqProducer.sendByWorkQueue(queueModelingPre, mqMessage);
         if(jsonObject.getIntValue("location") == 7){
             //发送到全景看看进行初始化
             intermitSceneService.sendMq(scenePlusVO.getNum(), jsonObject, CommonSuccessStatus.WAITING.code());
@@ -749,6 +748,10 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
                 cameraType = 11L;
             }
         }
+        int camType = fdageJson.getJSONObject("cam").getIntValue("type");
+        if(camType == 5){
+            cameraType = 6L;
+        }
 
         this.removeUpdateV4(ConstantFilePath.OSS_PREFIX + prefixBuffer + "data.fdage", fdageJson);
 
@@ -909,8 +912,8 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
         ScenePro scenePro = sceneProService.getOne(
             new LambdaQueryWrapper<ScenePro>().like(ScenePro::getDataSource, "/".concat(fileId).concat("/")));
 
-        boolean callV3 = callV3(scenePro, preParams, fdageJson, "api/scene/file/turntableUploadSuccess");
-        if (callV3) return ResultData.ok();
+//        boolean callV3 = callV3(scenePro, preParams, fdageJson, "api/scene/file/turntableUploadSuccess");
+//        if (callV3) return ResultData.ok();
 
         //激光场景校验是否能够计算
         this.checkJgCanBuild(scenePro);
@@ -1091,6 +1094,7 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
             scenePlus.setRecStatus(RecStatus.VALID.code());
             scenePlus.setPayStatus(PayStatus.NOT_PAY.code());
             scenePlus.setCreateTime(Calendar.getInstance().getTime());
+            scenePlus.setBuildFailReason("");
 
             ScenePlusExt oldSceneExt = scenePlusExtService.getScenePlusExtByPlusId(oldScene.getId());
             scenePlusExt.setSpace(oldSceneExt.getSpace());
@@ -1425,9 +1429,11 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
         }else{
             rabbitMqProducer.sendByWorkQueue(queueModelingPre, message);
         }
+        redisUtil.incr("modeling-count:" + num, 1);
 
         scenePlusService.update(new LambdaUpdateWrapper<ScenePlus>()
             .set(ScenePlus::getSceneStatus, SceneStatus.wait.code())
+            .set(ScenePlus::getBuildFailReason, null)
             .eq(ScenePlus::getNum, num));
 
         if(ModelKind.THREE_D_TILE.code().equals(modelKind)
@@ -1435,6 +1441,7 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
                 && sdTilesSceneSourceList.contains(scenePlus.getSceneSource())){
             scenePlusExt.setModelKind(modelKind);
         }
+        scenePlusExt.setUpdateTime(new Date());
         scenePlusExtService.updateById(scenePlusExt);
 
         //记录日志表

+ 14 - 2
src/main/java/com/fdkankan/contro/service/impl/ScenePlusServiceImpl.java

@@ -41,6 +41,8 @@ public class ScenePlusServiceImpl extends ServiceImpl<IScenePlusMapper, ScenePlu
     private ICameraDetailService cameraDetailService;
     @Autowired
     private IJyUserService jyUserService;
+    @Autowired
+    private IScenePlusService scenePlusService;
 
     @Override
     public ScenePlus getScenePlusByNum(String num) {
@@ -143,11 +145,21 @@ public class ScenePlusServiceImpl extends ServiceImpl<IScenePlusMapper, ScenePlu
     }
 
     @Override
-    public String getRyIdByNum(String num) {
+    public JyUser getJyUserByNum(String num) {
         ScenePlus scenePlus = this.getScenePlusByNum(num);
         Long userId = scenePlus.getUserId();
         JyUser jyUser = jyUserService.getByUserId(userId);
-        return jyUser.getRyId();
+        return jyUser;
+    }
+
+    @Override
+    public ScenePlus getByUuid(String uuid) {
+        ScenePlusExt scenePlusExt = scenePlusExtService.getOne(new LambdaQueryWrapper<ScenePlusExt>().like(ScenePlusExt::getDataSource, uuid));
+        if(Objects.isNull(scenePlusExt)){
+            return null;
+        }
+        ScenePlus scenePlus = scenePlusService.getById(scenePlusExt.getPlusId());
+        return scenePlus;
     }
 
     @Override

+ 8 - 1
src/main/resources/bootstrap.yml

@@ -2,4 +2,11 @@ spring:
   profiles:
     active: test
   application:
-    name: model-control
+    name: model-control
+
+# 不配默认为false
+tlog:
+  enable-invoke-time-print: true
+
+logging:
+  config: classpath:logback-nacos.xml

+ 215 - 0
src/main/resources/logback-nacos.xml

@@ -0,0 +1,215 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 日志级别从低到高分为TRACE < DEBUG < INFO < WARN < ERROR < FATAL,如果设置为WARN,则低于WARN的信息都不会输出 -->
+<!-- scan:当此属性设置为true时,配置文档如果发生改变,将会被重新加载,默认值为true -->
+<!-- scanPeriod:设置监测配置文档是否有修改的时间间隔,如果没有给出时间单位,默认单位是毫秒。 当scan为true时,此属性生效。默认的时间间隔为1分钟。 -->
+<!-- debug:当此属性设置为true时,将打印出logback内部日志信息,实时查看logback运行状态。默认值为false。 -->
+<configuration scan="true" scanPeriod="60 seconds" debug="false">
+	<!--需要使用springProperty,才可使用application.properties(或application.yml)中的值 -->
+	<springProperty name="app.name" source="spring.application.name" default="modeling-control"/>
+	<springProperty name="LOG_PATH" source="log.path" default="/www/VR/4dkankan/modeling-control/logs"/>
+
+	<!-- 定义日志目录 -->
+	<property name="SQL_LOG_PATH" value="${LOG_PATH}/logs/sql"/>
+	<property name="DEBUG_LOG_PATH" value="${LOG_PATH}/logs/debug"/>
+	<property name="INFO_LOG_PATH" value="${LOG_PATH}/logs/info"/>
+	<property name="WARN_LOG_PATH" value="${LOG_PATH}/logs/warn"/>
+	<property name="ERROR_LOG_PATH" value="${LOG_PATH}/logs/error"/>
+	<!-- 定义日志保留天数 -->
+	<property name="MAX_HISTORY" value="180"/>
+	<!-- 定义日志文件总大小 -->
+	<property name="TOTAL_SIZE_CAP" value="10GB"/>
+	<!-- 定义单个日志文件大小 -->
+	<property name="MAX_FILE_SIZE" value="100MB"/>
+
+
+	<!-- 输出到控制台 -->
+	<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
+		<encoder class="com.yomahub.tlog.core.enhance.logback.AspectLogbackEncoder">
+			<!-- 日志输出格式 -->
+			<!--<pattern>[%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36}: %msg%n</pattern>-->
+			<!--日期 日志等级 PID 线程名 类路径 方法名 java源文件 行号 打印信息 换行-->
+			<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %highlight(%5p) %green(${PID:- }) - %magenta([%15.15t]) %cyan(%C.%M\(%F:%L\)) : %msg%n</pattern>
+			<!--同上, 仅输出类路径, 不输出 方法名 java源文件 行号 -->
+			<!--<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %highlight(%5p) %green(${PID:- }) - %magenta([%15.15t]) %cyan(%-40.40logger{40}) : %msg%n</pattern>-->
+		</encoder>
+	</appender>
+
+	<!-- 只输出DEBUG日志 -->
+	<appender name="DEBUG_LOG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+		<file>${DEBUG_LOG_PATH}/debug.log</file>
+		<!-- 基于文件大小和时间的滚动策略 -->
+		<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+			<fileNamePattern>${DEBUG_LOG_PATH}/debug-%d{yyyy-MM-dd}-%i.log</fileNamePattern>
+			<!-- 日志文件保留天数 -->
+			<maxHistory>${MAX_HISTORY}</maxHistory>
+			<!-- 日志归档文件总大小 -->
+			<totalSizeCap>${TOTAL_SIZE_CAP}</totalSizeCap>
+			<!-- 单个日志文件大小 -->
+			<maxFileSize>${MAX_FILE_SIZE}</maxFileSize>
+		</rollingPolicy>
+		<!-- 日志输出格式 -->
+		<encoder class="com.yomahub.tlog.core.enhance.logback.AspectLogbackEncoder">
+			<pattern>[%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36}: %msg%n</pattern>
+			<charset>UTF-8</charset>
+		</encoder>
+		<!-- 日志过滤 -->
+		<filter class="ch.qos.logback.classic.filter.LevelFilter">
+			<!-- 指定日志级别 -->
+			<level>DEBUG</level>
+			<!-- 匹配则全部接受 -->
+			<onMatch>ACCEPT</onMatch>
+			<!-- 不匹配则全部拒绝 -->
+			<onMismatch>DENY</onMismatch>
+		</filter>
+	</appender>
+
+	<!-- 只输出INFO日志 -->
+	<appender name="INFO_LOG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+		<file>${INFO_LOG_PATH}/info.log</file>
+		<!-- 基于文件大小和时间的滚动策略 -->
+		<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+			<fileNamePattern>${INFO_LOG_PATH}/info-%d{yyyy-MM-dd}-%i.log</fileNamePattern>
+			<!-- 日志文件保留天数 -->
+			<maxHistory>${MAX_HISTORY}</maxHistory>
+			<!-- 日志归档文件总大小 -->
+			<totalSizeCap>${TOTAL_SIZE_CAP}</totalSizeCap>
+			<!-- 单个日志文件大小 -->
+			<maxFileSize>${MAX_FILE_SIZE}</maxFileSize>
+		</rollingPolicy>
+		<!-- 日志输出格式 -->
+		<encoder class="com.yomahub.tlog.core.enhance.logback.AspectLogbackEncoder">
+			<pattern>[%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36}: %msg%n</pattern>
+			<charset>UTF-8</charset>
+		</encoder>
+		<!-- 日志过滤 -->
+		<filter class="ch.qos.logback.classic.filter.LevelFilter">
+			<!-- 指定日志级别 -->
+			<level>INFO</level>
+			<!-- 匹配则全部接受 -->
+			<onMatch>ACCEPT</onMatch>
+			<!-- 不匹配则全部拒绝 -->
+			<onMismatch>DENY</onMismatch>
+		</filter>
+	</appender>
+
+	<!-- 只输出WARN日志 -->
+	<appender name="WARN_LOG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+		<file>${WARN_LOG_PATH}/warn.log</file>
+		<!-- 基于文件大小和时间的滚动策略 -->
+		<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+			<fileNamePattern>${WARN_LOG_PATH}/warn-%d{yyyy-MM-dd}-%i.log</fileNamePattern>
+			<!-- 日志文件保留天数 -->
+			<maxHistory>${MAX_HISTORY}</maxHistory>
+			<!-- 日志归档文件总大小 -->
+			<totalSizeCap>${TOTAL_SIZE_CAP}</totalSizeCap>
+			<!-- 单个日志文件大小 -->
+			<maxFileSize>${MAX_FILE_SIZE}</maxFileSize>
+		</rollingPolicy>
+		<!-- 日志输出格式 -->
+		<encoder class="com.yomahub.tlog.core.enhance.logback.AspectLogbackEncoder">
+			<pattern>[%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36}: %msg%n</pattern>
+			<charset>UTF-8</charset>
+		</encoder>
+		<!-- 日志过滤 -->
+		<filter class="ch.qos.logback.classic.filter.LevelFilter">
+			<!-- 指定日志级别 -->
+			<level>WARN</level>
+			<!-- 匹配则全部接受 -->
+			<onMatch>ACCEPT</onMatch>
+			<!-- 不匹配则全部拒绝 -->
+			<onMismatch>DENY</onMismatch>
+		</filter>
+	</appender>
+
+	<!-- 只输出ERROR日志 -->
+	<appender name="ERROR_LOG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+		<file>${ERROR_LOG_PATH}/error.log</file>
+		<!-- 基于文件大小和时间的滚动策略 -->
+		<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+			<fileNamePattern>${ERROR_LOG_PATH}/error-%d{yyyy-MM-dd}-%i.log</fileNamePattern>
+			<!-- 日志文件保留天数 -->
+			<maxHistory>${MAX_HISTORY}</maxHistory>
+			<!-- 日志归档文件总大小 -->
+			<totalSizeCap>${TOTAL_SIZE_CAP}</totalSizeCap>
+			<!-- 单个日志文件大小 -->
+			<maxFileSize>${MAX_FILE_SIZE}</maxFileSize>
+		</rollingPolicy>
+		<!-- 日志输出格式 -->
+		<encoder class="com.yomahub.tlog.core.enhance.logback.AspectLogbackEncoder">
+			<pattern>[%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36}: %msg%n</pattern>
+			<charset>UTF-8</charset>
+		</encoder>
+		<!-- 日志过滤 -->
+		<filter class="ch.qos.logback.classic.filter.LevelFilter">
+			<!-- 指定日志级别 -->
+			<level>ERROR</level>
+			<!-- 匹配则全部接受 -->
+			<onMatch>ACCEPT</onMatch>
+			<!-- 不匹配则全部拒绝 -->
+			<onMismatch>DENY</onMismatch>
+		</filter>
+	</appender>
+
+	<!-- <logger>用来设置某一个包或者具体的某一个类的日志打印级别、以及指定<appender>。<logger>仅有一个name属性,一个可选的level和一个可选的addtivity属性。
+        name:用来指定受此logger约束的某一个包或者具体的某一个类。
+        level:用来设置打印级别,大小写无关:TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF,还有一个特俗值INHERITED或者同义词NULL,代表强制执行上级的级别。
+              如果未设置此属性,那么当前logger将会继承上级的级别。
+        addtivity:是否向上级logger传递打印信息。默认是true -->
+	<!--
+        使用mybatis的时候,sql语句是debug下才会打印,而这里我们只配置了info,所以想要查看sql语句的话,有以下两种操作:
+        第一种把<root level="info">改成<root level="DEBUG">这样就会打印sql,不过这样日志那边会出现很多其他消息
+        第二种就是单独给dao下目录配置debug模式,代码如下,这样配置sql语句会打印,其他还是正常info级别:
+     -->
+	<!--    <logger name="com.xmc.biz.mapper" level="DEBUG" />-->
+	<!--
+        root节点是必选节点,用来指定最基础的日志输出级别,只有一个level属性
+        level:用来设置打印级别,大小写无关:TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF,不能设置为INHERITED或者同义词NULL。
+        默认是DEBUG  可以包含零个或多个元素,标识这个appender将会添加到这个logger。
+    -->
+
+	<!--输出到文件的Appender配置  SQL执行日志-->
+	<appender name="SQL_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+		<file>${SQL_LOG_PATH}/sql.log</file>
+		<!-- 基于文件大小和时间的滚动策略 -->
+		<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+			<fileNamePattern>${SQL_LOG_PATH}/sql-%d{yyyy-MM-dd}-%i.log</fileNamePattern>
+			<!-- 日志文件保留天数 -->
+			<maxHistory>${MAX_HISTORY}</maxHistory>
+			<!-- 日志归档文件总大小 -->
+			<totalSizeCap>${TOTAL_SIZE_CAP}</totalSizeCap>
+			<!-- 单个日志文件大小 -->
+			<maxFileSize>${MAX_FILE_SIZE}</maxFileSize>
+		</rollingPolicy>
+		<!-- 日志输出格式 -->
+		<encoder class="com.yomahub.tlog.core.enhance.logback.AspectLogbackEncoder">
+			<pattern>[%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36}: %msg%n</pattern>
+			<charset>UTF-8</charset>
+		</encoder>
+		<!-- 日志过滤 -->
+		<filter class="ch.qos.logback.classic.filter.LevelFilter">
+			<!-- 指定日志级别 -->
+			<level>TRACE</level>
+			<!-- 匹配则全部接受 -->
+			<onMatch>ACCEPT</onMatch>
+			<!-- 不匹配则全部拒绝 -->
+<!--			<onMismatch>DENY</onMismatch>-->
+		</filter>
+	</appender>
+
+	<!-- 多环境配置 -->
+	<springProfile name="dev,test,prod">
+
+		<!--单独设置mapper包下的日志级别为DEBUG,因为输出执行的sql需要DEBUG级别-->
+		<logger name="com.fdkankan.contro.mapper" level="trace">
+			<appender-ref ref="SQL_FILE"/>
+		</logger>
+		<!-- root -->
+		<root level="INFO">
+			<appender-ref ref="CONSOLE"/>
+			<appender-ref ref="INFO_LOG_FILE"/>
+			<appender-ref ref="WARN_LOG_FILE"/>
+			<appender-ref ref="ERROR_LOG_FILE"/>
+		</root>
+	</springProfile>
+
+</configuration>

+ 1 - 1
src/main/resources/logback-spring.xml

@@ -149,7 +149,7 @@
 	<!-- 使用mybatis的时候,sql语句是debug下才会打印,而这里我们只配置了info,所以想要查看sql语句的话,有以下两种操作: 第一种把<root level="info">改成<root level="DEBUG">这样就会打印sql,不过这样日志那边会出现很多其他消息 第二种就是单独给dao下目录配置debug模式,代码如下,这样配置sql语句会打印,其他还是正常info级别: -->
 	<!-- root节点是必选节点,用来指定最基础的日志输出级别,只有一个level属性 level:用来设置打印级别,大小写无关:TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF, 不能设置为INHERITED或者同义词NULL。默认是DEBUG 可以包含零个或多个元素,标识这个appender将会添加到这个logger。 -->
 
-	<root level="info">
+	<root level="debug">
 		<appender-ref ref="CONSOLE" />
 		<appender-ref ref="DEBUG_FILE" />
 		<appender-ref ref="INFO_FILE" />