Преглед на файлове

Merge branch 'release' into project-liantong

# Conflicts:
#	src/main/java/com/fdkankan/contro/mq/service/impl/BuildSceneServiceImpl.java
#	src/main/java/com/fdkankan/contro/service/ISceneFileBuildService.java
#	src/main/java/com/fdkankan/contro/service/impl/BuildSceneDTServiceImpl.java
#	src/main/java/com/fdkankan/contro/service/impl/SceneFileBuildServiceImpl.java
dengsixing преди 9 месеца
родител
ревизия
b65c31a33c
променени са 53 файла, в които са добавени 2633 реда и са изтрити 448 реда
  1. 26 0
      src/main/java/com/fdkankan/contro/bean/SyncLaserResultBean.java
  2. 49 0
      src/main/java/com/fdkankan/contro/controller/InnerController.java
  3. 43 2
      src/main/java/com/fdkankan/contro/controller/SceneFileController.java
  4. 4 2
      src/main/java/com/fdkankan/contro/controller/TestController.java
  5. 52 0
      src/main/java/com/fdkankan/contro/entity/AppCameraFailLog.java
  6. 4 1
      src/main/java/com/fdkankan/contro/entity/SceneBuildProcessLog.java
  7. 3 0
      src/main/java/com/fdkankan/contro/entity/ScenePlusExt.java
  8. 49 0
      src/main/java/com/fdkankan/contro/entity/SceneRebuildLog.java
  9. 51 0
      src/main/java/com/fdkankan/contro/entity/SceneUploadCount.java
  10. 1 1
      src/main/java/com/fdkankan/contro/generate/AutoGenerate.java
  11. 18 0
      src/main/java/com/fdkankan/contro/mapper/IAppCameraFailLogMapper.java
  12. 18 0
      src/main/java/com/fdkankan/contro/mapper/ISceneRebuildLogMapper.java
  13. 18 0
      src/main/java/com/fdkankan/contro/mapper/ISceneUploadCountMapper.java
  14. 10 10
      src/main/java/com/fdkankan/contro/mq/listener/AbstrackBuildSceneListener.java
  15. 121 0
      src/main/java/com/fdkankan/contro/mq/listener/BuildE57Listener.java
  16. 2 2
      src/main/java/com/fdkankan/contro/mq/listener/BuildIntermitSceneListener.java
  17. 54 0
      src/main/java/com/fdkankan/contro/mq/listener/BuildLiguangListener.java
  18. 2 2
      src/main/java/com/fdkankan/contro/mq/listener/BuildObjListener.java
  19. 2 2
      src/main/java/com/fdkankan/contro/mq/listener/BuildSceneListener.java
  20. 2 2
      src/main/java/com/fdkankan/contro/mq/listener/BuildSceneProcessLogListener.java
  21. 2 2
      src/main/java/com/fdkankan/contro/mq/listener/BuildV3SceneListener.java
  22. 2 2
      src/main/java/com/fdkankan/contro/mq/listener/IBuildSceneListener.java
  23. 6 1
      src/main/java/com/fdkankan/contro/mq/listener/UpdateSceneStatusListener.java
  24. 185 0
      src/main/java/com/fdkankan/contro/mq/service/impl/BuildE57SceneServiceImpl.java
  25. 7 84
      src/main/java/com/fdkankan/contro/mq/service/impl/BuildIntermitSceneServiceImpl.java
  26. 591 0
      src/main/java/com/fdkankan/contro/mq/service/impl/BuildLiguangServiceImpl.java
  27. 10 2
      src/main/java/com/fdkankan/contro/mq/service/impl/BuildObjServiceImpl.java
  28. 62 263
      src/main/java/com/fdkankan/contro/mq/service/impl/BuildSceneServiceImpl.java
  29. 14 2
      src/main/java/com/fdkankan/contro/mq/service/impl/BuildV3SceneServiceImpl.java
  30. 23 0
      src/main/java/com/fdkankan/contro/service/IAppCameraFailLogService.java
  31. 2 0
      src/main/java/com/fdkankan/contro/service/IBuildSceneDTService.java
  32. 10 2
      src/main/java/com/fdkankan/contro/service/ICommonService.java
  33. 2 1
      src/main/java/com/fdkankan/contro/service/IFdkkLaserService.java
  34. 7 0
      src/main/java/com/fdkankan/contro/service/IInnerService.java
  35. 3 3
      src/main/java/com/fdkankan/contro/service/ISceneBuildProcessLogService.java
  36. 3 1
      src/main/java/com/fdkankan/contro/service/ISceneFileBuildService.java
  37. 16 0
      src/main/java/com/fdkankan/contro/service/ISceneRebuildLogService.java
  38. 27 0
      src/main/java/com/fdkankan/contro/service/ISceneUploadCountService.java
  39. 7 0
      src/main/java/com/fdkankan/contro/service/IWbService.java
  40. 27 0
      src/main/java/com/fdkankan/contro/service/impl/AppCameraFailLogServiceImpl.java
  41. 280 9
      src/main/java/com/fdkankan/contro/service/impl/CommonServiceImpl.java
  42. 40 24
      src/main/java/com/fdkankan/contro/service/impl/IFdkkLaserServiceImpl.java
  43. 339 0
      src/main/java/com/fdkankan/contro/service/impl/InnerServiceImpl.java
  44. 43 21
      src/main/java/com/fdkankan/contro/service/impl/SceneBuildProcessLogServiceImpl.java
  45. 184 7
      src/main/java/com/fdkankan/contro/service/impl/SceneFileBuildServiceImpl.java
  46. 20 0
      src/main/java/com/fdkankan/contro/service/impl/SceneRebuildLogServiceImpl.java
  47. 69 0
      src/main/java/com/fdkankan/contro/service/impl/SceneUploadCountServiceImpl.java
  48. 66 0
      src/main/java/com/fdkankan/contro/service/impl/WbServiceImpl.java
  49. 25 0
      src/main/java/com/fdkankan/contro/vo/ReportFailLogVO.java
  50. 17 0
      src/main/java/com/fdkankan/contro/vo/SceneUploadCountParamVO.java
  51. 5 0
      src/main/resources/mapper/contro/AppCameraFailLogMapper.xml
  52. 5 0
      src/main/resources/mapper/contro/SceneRebuildLogMapper.xml
  53. 5 0
      src/main/resources/mapper/contro/SceneUploadCountMapper.xml

+ 26 - 0
src/main/java/com/fdkankan/contro/bean/SyncLaserResultBean.java

@@ -0,0 +1,26 @@
+package com.fdkankan.contro.bean;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.Date;
+
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class SyncLaserResultBean {
+
+    private String num;
+    private String dataSource;
+    private Integer sceneStatus;
+    private Date createTime;
+    private Integer shootCount;
+    private Integer payStatus;
+    private Integer mixture;
+    private String version;
+
+
+}

+ 49 - 0
src/main/java/com/fdkankan/contro/controller/InnerController.java

@@ -0,0 +1,49 @@
+package com.fdkankan.contro.controller;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.fdkankan.common.constant.ErrorCode;
+import com.fdkankan.common.constant.ModelingBuildStatus;
+import com.fdkankan.common.exception.BusinessException;
+import com.fdkankan.contro.service.IAppCameraFailLogService;
+import com.fdkankan.contro.service.IInnerService;
+import com.fdkankan.contro.service.ISceneFileBuildService;
+import com.fdkankan.contro.service.ISceneUploadCountService;
+import com.fdkankan.contro.vo.ReportFailLogVO;
+import com.fdkankan.contro.vo.ResponseSceneFile;
+import com.fdkankan.contro.vo.SceneUploadCountParamVO;
+import com.fdkankan.fyun.face.FYunFileServiceInterface;
+import com.fdkankan.rabbitmq.bean.BuildSceneResultMqMessage;
+import com.fdkankan.web.response.ResultData;
+import lombok.extern.log4j.Log4j2;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 场景文件上传模块
+ */
+@Log4j2
+@RestController
+@RequestMapping("/api/inner")
+public class InnerController {
+
+    @Autowired
+    private IInnerService innerService;
+
+    @GetMapping("uploadArtificialResult")
+    public ResultData uploadArtificialResult(String num) throws Exception {
+        innerService.uploadArtificialResult(num);
+        return ResultData.ok();
+    }
+
+
+}

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

@@ -5,8 +5,12 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.fdkankan.common.constant.ErrorCode;
 import com.fdkankan.common.exception.BusinessException;
+import com.fdkankan.contro.service.IAppCameraFailLogService;
 import com.fdkankan.contro.service.ISceneFileBuildService;
+import com.fdkankan.contro.service.ISceneUploadCountService;
+import com.fdkankan.contro.vo.ReportFailLogVO;
 import com.fdkankan.contro.vo.ResponseSceneFile;
+import com.fdkankan.contro.vo.SceneUploadCountParamVO;
 import com.fdkankan.fyun.face.FYunFileServiceInterface;
 import com.fdkankan.web.response.ResultData;
 import lombok.extern.log4j.Log4j2;
@@ -15,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
+import javax.validation.Valid;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -35,6 +40,12 @@ public class SceneFileController{
     @Autowired
     private FYunFileServiceInterface fYunFileService;
 
+    @Autowired
+    private ISceneUploadCountService sceneUploadCountService;
+
+    @Autowired
+    private IAppCameraFailLogService appCameraFailLogService;
+
 
     /**
      * 场景文件上传之前先获取fileId
@@ -70,8 +81,11 @@ public class SceneFileController{
     }
 
     @GetMapping("rebuildScene")
-    public ResultData rebuildScene(@RequestParam(value = "num") String num,@RequestParam(value = "force",defaultValue = "false") Boolean force ,@RequestParam(value = "deleteExtras",defaultValue = "true") Boolean deleteExtras) throws IOException {
-        return sceneFileBuildService.rebuildScene(num,force,deleteExtras);
+    public ResultData rebuildScene(@RequestParam(value = "num") String num,
+                                   @RequestParam(value = "force",defaultValue = "false") Boolean force ,
+                                   @RequestParam(value = "deleteExtras",defaultValue = "true") Boolean deleteExtras,
+                                   @RequestParam(value = "from", defaultValue = "api") String from) throws IOException {
+        return sceneFileBuildService.rebuildScene(num,force,deleteExtras, from);
     }
 
     /**
@@ -132,4 +146,31 @@ public class SceneFileController{
                                        @RequestParam(value = "sourceBucket") String sourceBucket) throws Exception {
         return sceneFileBuildService.copyDataAndBuild(sourceBucket,dataSource ,sceneVer);
     }
+
+    /**
+     * 记录app触发上传场景
+     * @param param
+     * @return
+     */
+    @PostMapping("/increSceneUploadCount")
+    public ResultData increSceneUploadCount(@RequestBody @Valid SceneUploadCountParamVO param){
+        sceneUploadCountService.increSceneUploadCount(param);
+        return ResultData.ok();
+    }
+
+    @PostMapping("/reportFailLog")
+    public ResultData reportFailLog(@RequestBody @Valid ReportFailLogVO param){
+        appCameraFailLogService.reportFailLog(param);
+        return ResultData.ok();
+    }
+
+    /**
+     * 计算理光相机格式场景
+     * @return
+     */
+    @PostMapping("uploadLiguang")
+    public ResultData uploadLiguang(String num, String snCode, String ossPath) throws Exception {
+        return sceneFileBuildService.uploadLiguang(num, snCode, ossPath);
+    }
+
 }

+ 4 - 2
src/main/java/com/fdkankan/contro/controller/TestController.java

@@ -4,6 +4,7 @@ import com.fdkankan.contro.service.ICommonService;
 import com.fdkankan.contro.service.IScene3dNumService;
 import com.fdkankan.web.response.ResultData;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
@@ -24,11 +25,12 @@ public class TestController {
     private IScene3dNumService scene3dNumService;
     @Autowired
     private ICommonService commonService;
+    @Value("${4dkk.laserService.bucket}")
+    private String bucket;
 
     @GetMapping("/test")
     public ResultData test(String num) throws Exception {
-        commonService.sendEmail(num);
-        return ResultData.ok();
+        return ResultData.ok(bucket);
     }
 
 }

+ 52 - 0
src/main/java/com/fdkankan/contro/entity/AppCameraFailLog.java

@@ -0,0 +1,52 @@
+package com.fdkankan.contro.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * <p>
+ * app错误上报
+ * </p>
+ *
+ * @author 
+ * @since 2024-05-20
+ */
+@Getter
+@Setter
+@TableName("t_app_camera_fail_log")
+public class AppCameraFailLog implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    @TableField("uuid")
+    private String uuid;
+
+    /**
+     * 错误来源(app,camera)
+     */
+    @TableField("source")
+    private String source;
+
+    /**
+     * 错误原因
+     */
+    @TableField("reason")
+    private String reason;
+
+    /**
+     * 创建时间
+     */
+    @TableField("create_time")
+    private Date createTime;
+
+
+}

+ 4 - 1
src/main/java/com/fdkankan/contro/entity/SceneBuildProcessLog.java

@@ -15,7 +15,7 @@ import lombok.Setter;
  * 场景计算流程状态表
  * </p>
  *
- * @author 
+ * @author
  * @since 2023-01-28
  */
 @Getter
@@ -77,5 +77,8 @@ public class SceneBuildProcessLog implements Serializable {
     @TableLogic(value = "A", delval = "I")
     private String recStatus;
 
+    @TableField("biz_type")
+    private String bizType;
+
 
 }

+ 3 - 0
src/main/java/com/fdkankan/contro/entity/ScenePlusExt.java

@@ -154,6 +154,9 @@ public class ScenePlusExt implements Serializable {
     @TableField("location")
     private Integer location;
 
+    @TableField("mixture")
+    private Integer mixture;
+
     /**
      * 创建时间
      */

+ 49 - 0
src/main/java/com/fdkankan/contro/entity/SceneRebuildLog.java

@@ -0,0 +1,49 @@
+package com.fdkankan.contro.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * <p>
+ * 场景重算接口调用日志表
+ * </p>
+ *
+ * @author
+ * @since 2024-05-17
+ */
+@Getter
+@Setter
+@TableName("t_scene_rebuild_log")
+public class SceneRebuildLog implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 场景码
+     */
+    @TableField("num")
+    private String num;
+
+    /**
+     * 调用来源(api-接口调用,manage-管理后台调用,laser-点位校准调用)
+     */
+    @TableField("source")
+    private String source;
+
+    /**
+     * 创建时间
+     */
+    @TableField("create_time")
+    private Date createTime;
+
+
+}

+ 51 - 0
src/main/java/com/fdkankan/contro/entity/SceneUploadCount.java

@@ -0,0 +1,51 @@
+package com.fdkankan.contro.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * <p>
+ * app触发场景上传统计表
+ * </p>
+ *
+ * @author 
+ * @since 2024-05-20
+ */
+@Getter
+@Setter
+@TableName("t_scene_upload_count")
+public class SceneUploadCount implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId("id")
+    private Long id;
+
+    @TableField("uuid")
+    private String uuid;
+
+    /**
+     * 相机码
+     */
+    @TableField("sn_code")
+    private String snCode;
+
+    /**
+     * 触发上传次数
+     */
+    @TableField("count")
+    private Integer count;
+
+    @TableField("create_time")
+    private Date createTime;
+
+    @TableField("update_time")
+    private Date updateTime;
+
+
+}

+ 1 - 1
src/main/java/com/fdkankan/contro/generate/AutoGenerate.java

@@ -17,7 +17,7 @@ public class AutoGenerate {
         String path =System.getProperty("user.dir");
 
         generate(path,"contro", getTables(new String[]{
-                "t_scene_info_sync_mq_config"
+                "t_app_camera_fail_log"
         }));
 
 //        generate(path,"goods", getTables(new String[]{

+ 18 - 0
src/main/java/com/fdkankan/contro/mapper/IAppCameraFailLogMapper.java

@@ -0,0 +1,18 @@
+package com.fdkankan.contro.mapper;
+
+import com.fdkankan.contro.entity.AppCameraFailLog;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ * app错误上报 Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2024-05-20
+ */
+@Mapper
+public interface IAppCameraFailLogMapper extends BaseMapper<AppCameraFailLog> {
+
+}

+ 18 - 0
src/main/java/com/fdkankan/contro/mapper/ISceneRebuildLogMapper.java

@@ -0,0 +1,18 @@
+package com.fdkankan.contro.mapper;
+
+import com.fdkankan.contro.entity.SceneRebuildLog;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ * 场景重算接口调用日志表 Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2024-05-17
+ */
+@Mapper
+public interface ISceneRebuildLogMapper extends BaseMapper<SceneRebuildLog> {
+
+}

+ 18 - 0
src/main/java/com/fdkankan/contro/mapper/ISceneUploadCountMapper.java

@@ -0,0 +1,18 @@
+package com.fdkankan.contro.mapper;
+
+import com.fdkankan.contro.entity.SceneUploadCount;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ * app触发场景上传统计表 Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2024-05-20
+ */
+@Mapper
+public interface ISceneUploadCountMapper extends BaseMapper<SceneUploadCount> {
+
+}

+ 10 - 10
src/main/java/com/fdkankan/contro/mq/listener/AbstrackBuildSceneListener.java

@@ -32,7 +32,7 @@ public class AbstrackBuildSceneListener implements IBuildSceneListener {
     private ICommonService commonService;
 
     @Override
-    public void preHandle(Channel channel, String queueName, Message message, IBuildSceneService buildSceneService) throws IOException {
+    public void preHandle(Channel channel, String queueName, Message message, IBuildSceneService buildSceneService, String bizType) throws IOException {
         // 添加消息幂等处理
         String messageId = message.getMessageProperties().getMessageId();
         if(!ObjectUtils.isEmpty(messageId)){
@@ -57,21 +57,21 @@ public class AbstrackBuildSceneListener implements IBuildSceneListener {
                 buildSceneMessage.getBuildContext().put("sceneNum",buildSceneMessage.getSceneNum());
             }
             //记录日志
-            sceneBuildProcessLogService.clearSceneBuildProcessLog(num, SceneBuildProcessType.PRE.code(), queueName);
-            sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.PRE.code(), queueName, CommonOperStatus.WAITING.code(), null);
+            sceneBuildProcessLogService.clearSceneBuildProcessLog(num, SceneBuildProcessType.PRE.code(), queueName, bizType);
+            sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.PRE.code(), queueName, CommonOperStatus.WAITING.code(), null, bizType);
             buildSceneService.buildScenePre(buildSceneMessage);
             commonService.saveMqSendLog(num, buildSceneMessage);
-            sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.PRE.code(), queueName, CommonOperStatus.SUCCESS.code(), null);
+            sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.PRE.code(), queueName, CommonOperStatus.SUCCESS.code(), null, bizType);
         }catch (Exception e){
             log.error("场景计算前置处理出错,num=" + num, e);
-            sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.PRE.code(), queueName, CommonOperStatus.FAILD.code(), ExceptionUtil.stacktraceToString(e, 3000));
+            sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.PRE.code(), queueName, CommonOperStatus.FAILD.code(), ExceptionUtil.stacktraceToString(e, 3000), bizType);
         }
         log.info("准备场景计算资源完成,队列名:{},id:{},消息体:{}", queueName, messageId, msg);
         channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
     }
 
     @Override
-    public void postHandle(Channel channel, String queueName, Message message, IBuildSceneService buildSceneService) throws Exception {
+    public void postHandle(Channel channel, String queueName, Message message, IBuildSceneService buildSceneService, String bizType) throws Exception {
         // 添加消息幂等处理
         String messageId = message.getMessageProperties().getMessageId();
         if(!ObjectUtils.isEmpty(messageId)){
@@ -89,13 +89,13 @@ public class AbstrackBuildSceneListener implements IBuildSceneListener {
         BuildSceneResultMqMessage buildSceneMessage = JSONObject.parseObject(msg, BuildSceneResultMqMessage.class);
         String num = buildSceneMessage.getBuildContext().get("sceneNum").toString();
         try {
-            sceneBuildProcessLogService.clearSceneBuildProcessLog(num, SceneBuildProcessType.POST.code(), queueName);
-            sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.POST.code(), queueName, CommonOperStatus.WAITING.code(), null);
+            sceneBuildProcessLogService.clearSceneBuildProcessLog(num, SceneBuildProcessType.POST.code(), queueName, bizType);
+            sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.POST.code(), queueName, CommonOperStatus.WAITING.code(), null, bizType);
             buildSceneService.buildScenePost(buildSceneMessage);
-            sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.POST.code(), queueName, CommonOperStatus.SUCCESS.code(), null);
+            sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.POST.code(), queueName, CommonOperStatus.SUCCESS.code(), null, bizType);
         }catch (Exception e){
             log.error("场景计算结果处理出错,num=" + num, e);
-            sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.POST.code(), queueName, CommonOperStatus.FAILD.code(), ExceptionUtil.stacktraceToString(e, 3000));
+            sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.POST.code(), queueName, CommonOperStatus.FAILD.code(), ExceptionUtil.stacktraceToString(e, 3000), bizType);
         }
         log.info("场景计算结果处理完成,队列名:{},id:{},消息体:{}", queueName, messageId, msg);
         channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);

+ 121 - 0
src/main/java/com/fdkankan/contro/mq/listener/BuildE57Listener.java

@@ -0,0 +1,121 @@
+package com.fdkankan.contro.mq.listener;
+
+import cn.hutool.core.exceptions.ExceptionUtil;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.fdkankan.common.constant.CommonOperStatus;
+import com.fdkankan.contro.constant.RedisConstants;
+import com.fdkankan.contro.mq.service.impl.BuildE57SceneServiceImpl;
+import com.fdkankan.contro.service.ICommonService;
+import com.fdkankan.contro.service.ISceneBuildProcessLogService;
+import com.fdkankan.model.constants.SceneBuildProcessType;
+import com.fdkankan.rabbitmq.bean.BuildSceneCallMessage;
+import com.fdkankan.rabbitmq.bean.BuildSceneResultMqMessage;
+import com.fdkankan.redis.util.RedisLockUtil;
+import com.rabbitmq.client.Channel;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.amqp.core.Message;
+import org.springframework.amqp.rabbit.annotation.Queue;
+import org.springframework.amqp.rabbit.annotation.RabbitListener;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+import org.springframework.util.ObjectUtils;
+
+import java.nio.charset.StandardCharsets;
+import java.util.HashMap;
+
+@Slf4j
+@Component
+public class BuildE57Listener{
+
+    @Value("${queue.modeling.e57.modeling-pre:e57-modeling-pre}")
+    private String queueModelingPre;
+
+    @Value("${queue.modeling.e57.modeling-post:e57-modeling-post}")
+    private String queueModelingPost;
+
+    @Autowired
+    private RedisLockUtil redisLockUtil;
+
+    @Autowired
+    private ISceneBuildProcessLogService sceneBuildProcessLogService;
+    @Autowired
+    private ICommonService commonService;
+    @Autowired
+    private BuildE57SceneServiceImpl buildSceneService;
+
+
+    /**
+     * 场景计算前置资源准备处理
+     * @param channel
+     * @param message
+     * @throws Exception
+     */
+    @RabbitListener(
+            queuesToDeclare = @Queue("${queue.modeling.e57.modeling-pre:e57-modeling-pre}"),
+            concurrency = "${maxThread.modeling.modeling-pre}"
+    )
+    public void buildScenePreHandler(Channel channel, Message message) throws Exception {
+        String messageId = message.getMessageProperties().getMessageId();
+        String msg = new String(message.getBody(), StandardCharsets.UTF_8);
+        HashMap<String, Object> map = JSON.parseObject(msg, HashMap.class);
+        String num = (String) map.get("num");
+        map.put("bizType", "e57");
+
+        log.info("开始准备e57计算资源,队列名:{},id:{},消息体:{}", queueModelingPre, messageId, msg);
+        BuildSceneCallMessage buildSceneMessage = new BuildSceneCallMessage();
+        buildSceneMessage.setSceneNum(num);
+        buildSceneMessage.setExt(map);
+        buildSceneMessage.setBuildType("V3");
+        try {
+            if(ObjectUtils.isEmpty(buildSceneMessage.getBuildContext())){
+                buildSceneMessage.setBuildContext(new HashMap<>());
+            }
+            if(!ObjectUtils.isEmpty(buildSceneMessage.getSceneNum())){
+                buildSceneMessage.getBuildContext().put("sceneNum",buildSceneMessage.getSceneNum());
+            }
+            //记录日志
+            sceneBuildProcessLogService.clearSceneBuildProcessLog(num, SceneBuildProcessType.PRE.code(), queueModelingPre, "e57");
+            sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.PRE.code(), queueModelingPre, CommonOperStatus.WAITING.code(), null, "e57");
+            buildSceneService.buildScenePre(buildSceneMessage);
+            commonService.saveMqSendLog(num, buildSceneMessage);
+            sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.PRE.code(), queueModelingPre, CommonOperStatus.SUCCESS.code(), null,"e57");
+        }catch (Exception e){
+            log.error("e57计算前置处理出错,num=" + num, e);
+            sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.PRE.code(), queueModelingPre, CommonOperStatus.FAILD.code(), ExceptionUtil.stacktraceToString(e, 3000), "e57");
+        }
+        log.info("准备e57计算资源完成,队列名:{},id:{},消息体:{}", queueModelingPre, messageId, msg);
+        channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
+    }
+
+    /**
+     * 场景计算后置结果处理
+     * @param channel
+     * @param message
+     * @throws Exception
+     */
+    @RabbitListener(
+            queuesToDeclare = @Queue("${queue.modeling.e57.modeling-post:e57-modeling-post}"),
+            concurrency = "${maxThread.modeling.modeling-post}"
+    )
+    public void buildScenePostHandler(Channel channel, Message message) throws Exception {
+        String messageId = message.getMessageProperties().getMessageId();
+        String msg = new String(message.getBody(), StandardCharsets.UTF_8);
+        log.info("场景计算完成,开始处理e57计算结果,队列名:{},id:{},消息体:{}", queueModelingPost, messageId, msg);
+        BuildSceneResultMqMessage buildSceneMessage = JSONObject.parseObject(msg, BuildSceneResultMqMessage.class);
+        String num = buildSceneMessage.getBuildContext().get("sceneNum").toString();
+        try {
+            sceneBuildProcessLogService.clearSceneBuildProcessLog(num, SceneBuildProcessType.POST.code(), queueModelingPost, "e57");
+            sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.POST.code(), queueModelingPost, CommonOperStatus.WAITING.code(), null, "e57");
+            buildSceneService.buildScenePost(buildSceneMessage);
+            sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.POST.code(), queueModelingPost, CommonOperStatus.SUCCESS.code(), null, "e57");
+        }catch (Exception e){
+            log.error("场景计算结果处理出错,num=" + num, e);
+            sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.POST.code(), queueModelingPost, CommonOperStatus.FAILD.code(), ExceptionUtil.stacktraceToString(e, 3000), "e57");
+        }
+        log.info("场景计算结果处理完成,队列名:{},id:{},消息体:{}", queueModelingPost, messageId, msg);
+        channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
+
+    }
+}

+ 2 - 2
src/main/java/com/fdkankan/contro/mq/listener/BuildIntermitSceneListener.java

@@ -34,7 +34,7 @@ public class BuildIntermitSceneListener extends AbstrackBuildSceneListener {
             concurrency = "${maxThread.modeling.modeling-pre}"
     )
     public void buildScenePreHandler(Channel channel, Message message) throws Exception {
-        preHandle(channel,queueModelingPre,message,buildSceneService);
+        preHandle(channel,queueModelingPre,message,buildSceneService, "intermit");
     }
 
     /**
@@ -48,7 +48,7 @@ public class BuildIntermitSceneListener extends AbstrackBuildSceneListener {
             concurrency = "${maxThread.modeling.modeling-post}"
     )
     public void buildScenePostHandler(Channel channel, Message message) throws Exception {
-        postHandle(channel,queueModelingPost,message,buildSceneService);
+        postHandle(channel,queueModelingPost,message,buildSceneService, "intermit");
 
     }
 }

+ 54 - 0
src/main/java/com/fdkankan/contro/mq/listener/BuildLiguangListener.java

@@ -0,0 +1,54 @@
+package com.fdkankan.contro.mq.listener;
+
+import com.fdkankan.contro.mq.service.impl.BuildLiguangServiceImpl;
+import com.fdkankan.contro.mq.service.impl.BuildSceneServiceImpl;
+import com.rabbitmq.client.Channel;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.amqp.core.Message;
+import org.springframework.amqp.rabbit.annotation.Queue;
+import org.springframework.amqp.rabbit.annotation.RabbitListener;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+@Slf4j
+@Component
+public class BuildLiguangListener extends AbstrackBuildSceneListener {
+
+    @Value("${queue.modeling.liguang.modeling-pre:liguang-modeling-pre}")
+    private String queueModelingPre;
+    @Value("${queue.modeling.liguang.modeling-post:liguang-modeling-post}")
+    private String queueModelingPost;
+
+    @Autowired
+    private BuildLiguangServiceImpl buildSceneService;
+
+    /**
+     * 场景计算前置资源准备处理
+     * @param channel
+     * @param message
+     * @throws Exception
+     */
+    @RabbitListener(
+            queuesToDeclare = @Queue("${queue.modeling.liguang.modeling-pre:liguang-modeling-pre}"),
+            concurrency = "${maxThread.modeling.modeling-pre}"
+    )
+    public void buildScenePreHandler(Channel channel, Message message) throws Exception {
+        preHandle(channel,queueModelingPre,message,buildSceneService, "standard");
+    }
+
+    /**
+     * 场景计算后置结果处理
+     * @param channel
+     * @param message
+     * @throws Exception
+     */
+    @RabbitListener(
+            queuesToDeclare = @Queue("${queue.modeling.liguang.modeling-post:liguang-modeling-post}"),
+            concurrency = "${maxThread.modeling.modeling-post}"
+    )
+    public void buildScenePostHandler(Channel channel, Message message) throws Exception {
+        postHandle(channel,queueModelingPost,message,buildSceneService, "standard");
+
+    }
+}

+ 2 - 2
src/main/java/com/fdkankan/contro/mq/listener/BuildObjListener.java

@@ -44,7 +44,7 @@ public class BuildObjListener extends AbstrackBuildSceneListener {
             concurrency = "${maxThread.modeling.modeling-pre}"
     )
     public void buildObjScenePreHandler(Channel channel, Message message) throws Exception {
-        preHandle(channel, queueObjModelingPre, message, buildObjService);
+        preHandle(channel, queueObjModelingPre, message, buildObjService,"obj");
     }
 
 
@@ -60,7 +60,7 @@ public class BuildObjListener extends AbstrackBuildSceneListener {
             concurrency = "${maxThread.modeling.modeling-post}"
     )
     public void buildObjScenePostHandler(Channel channel, Message message) throws Exception {
-        postHandle(channel, queueObjModelingPost, message, buildObjService);
+        postHandle(channel, queueObjModelingPost, message, buildObjService, "obj");
 
     }
 }

+ 2 - 2
src/main/java/com/fdkankan/contro/mq/listener/BuildSceneListener.java

@@ -33,7 +33,7 @@ public class BuildSceneListener extends AbstrackBuildSceneListener {
             concurrency = "${maxThread.modeling.modeling-pre}"
     )
     public void buildScenePreHandler(Channel channel, Message message) throws Exception {
-        preHandle(channel,queueModelingPre,message,buildSceneService);
+        preHandle(channel,queueModelingPre,message,buildSceneService, "standard");
     }
 
     /**
@@ -47,7 +47,7 @@ public class BuildSceneListener extends AbstrackBuildSceneListener {
             concurrency = "${maxThread.modeling.modeling-post}"
     )
     public void buildScenePostHandler(Channel channel, Message message) throws Exception {
-        postHandle(channel,queueModelingPost,message,buildSceneService);
+        postHandle(channel,queueModelingPost,message,buildSceneService, "standard");
 
     }
 }

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

@@ -48,7 +48,7 @@ public class BuildSceneProcessLogListener{
             int buildStatus = buildSceneMessage.getBuildStatus();
             //新的计算开始,需要将之前的记录置为失效
             if(buildStatus == ModelingBuildStatus.CALCULATING.code()){
-                sceneBuildProcessLogService.clearSceneBuildProcessLog(num, SceneBuildProcessType.CALL.code(),queueModelingCall);
+                sceneBuildProcessLogService.clearSceneBuildProcessLog(num, SceneBuildProcessType.CALL.code(),queueModelingCall, buildSceneMessage.getBizType());
                 status = CommonOperStatus.WAITING.code();
             }else{
                 if(buildStatus != ModelingBuildStatus.SUCCESS.code()){
@@ -56,7 +56,7 @@ public class BuildSceneProcessLogListener{
                     reason = ModelingBuildStatus.get(buildStatus).message();
                 }
             }
-            sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.CALL.code(), queueModelingCall, status, reason);
+            sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.CALL.code(), queueModelingCall, status, reason, buildSceneMessage.getBizType());
         }catch (Exception e){
             log.error("场景计算流程状态日志记录出错, num="+num, e);
         }finally {

+ 2 - 2
src/main/java/com/fdkankan/contro/mq/listener/BuildV3SceneListener.java

@@ -33,7 +33,7 @@ public class BuildV3SceneListener extends AbstrackBuildSceneListener {
             concurrency = "${maxThread.modeling.modeling-pre}"
     )
     public void buildScenePreHandler(Channel channel, Message message) throws Exception {
-        preHandle(channel,queueModelingPre,message,buildSceneService);
+        preHandle(channel,queueModelingPre,message,buildSceneService, "standard");
     }
 
     /**
@@ -47,7 +47,7 @@ public class BuildV3SceneListener extends AbstrackBuildSceneListener {
             concurrency = "${maxThread.modeling.modeling-post}"
     )
     public void buildScenePostHandler(Channel channel, Message message) throws Exception {
-        postHandle(channel,queueModelingPost,message,buildSceneService);
+        postHandle(channel,queueModelingPost,message,buildSceneService, "standard");
 
     }
 }

+ 2 - 2
src/main/java/com/fdkankan/contro/mq/listener/IBuildSceneListener.java

@@ -7,6 +7,6 @@ import org.springframework.amqp.core.Message;
 import java.io.IOException;
 
 public interface IBuildSceneListener {
-    void preHandle(Channel channel,String queueName, Message message, IBuildSceneService buildSceneService) throws IOException;
-    void postHandle(Channel channel,String queueName, Message message,IBuildSceneService buildSceneService) throws Exception;
+    void preHandle(Channel channel,String queueName, Message message, IBuildSceneService buildSceneService, String bizType) throws IOException;
+    void postHandle(Channel channel,String queueName, Message message,IBuildSceneService buildSceneService, String bizType) throws Exception;
 }

+ 6 - 1
src/main/java/com/fdkankan/contro/mq/listener/UpdateSceneStatusListener.java

@@ -4,6 +4,7 @@ import cn.hutool.core.io.FileUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.fdkankan.common.util.FileUtils;
+import com.fdkankan.contro.service.ICommonService;
 import com.fdkankan.fyun.face.FYunFileServiceInterface;
 import com.fdkankan.model.constants.ConstantFilePath;
 import com.fdkankan.model.constants.UploadFilePath;
@@ -25,6 +26,8 @@ public class UpdateSceneStatusListener {
 
     @Autowired
     private FYunFileServiceInterface fYunFileService;
+    @Autowired
+    private ICommonService commonService;
 
     /**
      * 更新场景status.json状态
@@ -43,12 +46,14 @@ public class UpdateSceneStatusListener {
         Integer status = (Integer)map.get("status");
         String statusJsonPath = String.format(UploadFilePath.DATA_VIEW_PATH, num).concat("status.json");
         try {
-
             String fileContent = fYunFileService.getFileContent(statusJsonPath);
             JSONObject jsonObject = JSON.parseObject(fileContent);
             jsonObject.put("status", status);
             FileUtil.writeUtf8String(jsonObject.toJSONString(),ConstantFilePath.SCENE_PATH + "data/data" + num + File.separator + "status.json");
             fYunFileService.uploadFile(ConstantFilePath.SCENE_PATH + "data/data" + num + File.separator + "status.json", statusJsonPath);
+            if(status == 1){
+                commonService.sendEmail(num, "standar");
+            }
         }catch (Exception e){
             log.error("更新场景的的status.json状态, content:{}", msg, e);
         }finally {

+ 185 - 0
src/main/java/com/fdkankan/contro/mq/service/impl/BuildE57SceneServiceImpl.java

@@ -0,0 +1,185 @@
+package com.fdkankan.contro.mq.service.impl;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.util.ZipUtil;
+import com.alibaba.fastjson.JSON;
+import com.fdkankan.common.constant.CommonSuccessStatus;
+import com.fdkankan.contro.entity.ScenePlus;
+import com.fdkankan.contro.entity.ScenePlusExt;
+import com.fdkankan.contro.mq.service.IBuildSceneService;
+import com.fdkankan.contro.service.*;
+import com.fdkankan.fyun.config.FYunFileConfig;
+import com.fdkankan.fyun.face.FYunFileServiceInterface;
+import com.fdkankan.model.constants.ConstantFilePath;
+import com.fdkankan.model.constants.UploadFilePath;
+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.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.cloud.context.config.annotation.RefreshScope;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.io.File;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * <p>
+ * TODO
+ * </p>
+ *
+ * @author dengsixing
+ * @since 2022/4/20
+ **/
+@Slf4j
+@Service
+@RefreshScope
+public class BuildE57SceneServiceImpl implements IBuildSceneService {
+    public static final String logUrlFormat = "**algorithm-log**: [%sbuild_log/%s/e57/console.log](%sbuild_log/%s/e57/console.log)";
+
+    @Value("${queue.modeling.e57.modeling-post}")
+    private String queueModelingPost;
+    @Value("${model.type:#{null}}")
+    private String modelType;
+    @Value("${env:gn}")
+    private String env;
+    @Value("#{'${build.scene.post.not-delete-nas-nums:}'.split(',')}")
+    private List<String> notDeleteNasNumList;
+    @Value("${queue.application.laser.e57-modeling-done:e57-modeling-done}")
+    private String queueE57ModelingDone;
+    @Autowired
+    private RabbitMqProducer mqProducer;
+    @Resource
+    private FYunFileServiceInterface fYunFileService;
+    @Autowired
+    private FYunFileConfig fYunFileConfig;
+    @Autowired
+    private IScenePlusService scenePlusService;
+    @Autowired
+    private IScenePlusExtService scenePlusExtService;
+    @Autowired
+    private IBuildSceneDTService buildSceneDTService;
+    @Autowired
+    private ICommonService commonService;
+    @Autowired
+    private ISceneColdStorageService sceneColdStorageService;
+    @Autowired
+    private IntermitSceneService intermitSceneService;
+
+    @Override
+    public void buildScenePre(BuildSceneCallMessage message) throws Exception{
+        String num = message.getSceneNum();
+        try {
+            ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
+            ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
+            String dataSource = scenePlusExt.getDataSource();
+            String path = dataSource + "_e57";
+            message.setPath(dataSource);
+
+            //根据相机类型,组装资源路径
+            //下载资源到本地
+            this.downLoadSource(message, path);
+
+            //发送mq,就进行计算
+            message.setPath(path);
+            message.setResultReceiverMqName(queueModelingPost);
+            message.setBizType("e57");
+
+            log.info("e57计算资源准备结束,场景码:{}", message.getSceneNum());
+
+        }catch (Exception e){
+            log.error("e57计算前置处理出错,num"+num, e);
+            buildSceneDTService.handBaseFail("e57计算资源准备异常!", 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(buildSceneMqMessage.getPath());
+        fYunFileService.downloadFileByCommand(path + "/capture", ossPath);
+
+        //下载点位校准文件
+        //上传点位校准相关文件(小)
+        String localExtraPath = path + "/extras/vision_edit.txt";
+        String ossExtras = String.format(UploadFilePath.scene_result_data_path, buildSceneMqMessage.getSceneNum()) + "extras";
+        List<String> extras = fYunFileService.listRemoteFiles(ossExtras);
+        log.info("key:{}, list:{}", ossExtras, JSON.toJSONString(extras));
+        if(CollUtil.isNotEmpty(extras)){
+            extras.parallelStream().forEach(key->{
+                fYunFileService.downloadFile(key, localExtraPath);
+            });
+        }
+    }
+
+    @Override
+    public void buildScenePost(BuildSceneResultMqMessage message) throws Exception {
+        String num = message.getBuildContext().get("sceneNum").toString();
+        String path = message.getPath();
+        String bucket = (String)message.getExt().get("bucket");
+        String bizId = (String)message.getExt().get("bizId");
+        String ossKeyFormat = (String)message.getExt().get("ossKey");
+        try {
+            // 上传计算日志
+            //如果是重复计算,没有走到计算逻辑,不需要上传日志文件
+            log.info("开始上传计算日志");
+            String buildLogPath = String.format(UploadFilePath.BUILD_LOG_PATH, num) + "e57/";
+            fYunFileService.uploadFile(path + File.separator + "console.log", buildLogPath + "console.log");
+            log.info("计算日志上传完成");
+            Map<String, Object> laserMqContent = new HashMap<>();
+            laserMqContent.put("num", num);
+            laserMqContent.put("bizId", bizId);
+            if (!message.getBuildSuccess()) {
+
+                //发送mq通知激光系统
+                laserMqContent.put("status", CommonSuccessStatus.FAIL.code());
+                mqProducer.sendByWorkQueue(queueE57ModelingDone, laserMqContent);
+
+                // 发送钉钉消息,计算失败
+                String logUrl = String.format(logUrlFormat,fYunFileConfig.getHost(),num,fYunFileConfig.getHost(),num);
+                buildSceneDTService.handModelFail("计算失败", message.getPath(), num, message.getHostName(), logUrl);
+                return;
+            }
+
+            //压缩e57
+            String localPath = path + "/results/laserData/laser.e57";
+            String zipPath = path + "/results/laserData/laser-e57.zip";
+            String ossKey = String.format(ossKeyFormat, num, num);
+            ZipUtil.zip(localPath, zipPath);
+            fYunFileService.uploadFileByCommand(bucket,zipPath, ossKey);
+
+            //发送mq通知激光系统
+            laserMqContent.put("status", CommonSuccessStatus.SUCCESS.code());
+            mqProducer.sendByWorkQueue(queueE57ModelingDone, laserMqContent);
+
+            try {
+                FileUtil.del(path);
+            }catch (Exception e){
+                log.error("删除计算目录失败,path:{}", path);
+            }
+
+            log.info("e57场景计算结果处理结束,场景码:{}", num);
+        }catch (Exception e){
+            log.error("e57场景计算结果处理出错,num"+num, e);
+            buildSceneDTService.handBaseFail("e57场景计算结果处理出错!", message.getPath(), num, "计算控制服务器");
+            throw e;
+        }
+    }
+
+}

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

@@ -111,6 +111,7 @@ public class BuildIntermitSceneServiceImpl implements IBuildSceneService {
 
             //发送mq,就进行计算
             message.setResultReceiverMqName(queueModelingPost);
+            message.setBizType("intermit");
 
             log.info("场景计算资源准备结束,场景码:{}", message.getSceneNum());
 
@@ -149,17 +150,21 @@ public class BuildIntermitSceneServiceImpl implements IBuildSceneService {
             fYunFileService.uploadFile(path + File.separator + "console.log", buildLogPath + "console.log");
             log.info("计算日志上传完成");
 
+            JSONObject fdageData = getFdageData(path + File.separator + "capture" +File.separator+"data.fdage");
+
             if (!message.getBuildSuccess()) {
                 log.error("建模失败,修改状态为失败状态");
                 scenePlusService.update(new LambdaUpdateWrapper<ScenePlus>()
                         .set(ScenePlus::getSceneStatus, SceneStatus.FAILD.code())
                         .eq(ScenePlus::getNum, sceneCode));
 
+                //推送到全景看看
+                intermitSceneService.sendMq(sceneCode, fdageData, CommonSuccessStatus.FAIL.code());
+
                 // 发送钉钉消息,计算失败
                 buildSceneDTService.handModelFail("计算失败", message.getPath(), sceneCode, message.getHostName());
                 return;
             }
-            JSONObject fdageData = getFdageData(path + File.separator + "capture" +File.separator+"data.fdage");
 
             ScenePlus scenePlus = scenePlusService.getScenePlusByNum(sceneCode);
 
@@ -172,7 +177,7 @@ public class BuildIntermitSceneServiceImpl implements IBuildSceneService {
 
             Integer videoVersion = fdageData.getInteger("videoVersion");
             //读取计算结果文件生成videosJson
-            JSONObject videosJson = this.getVideosJson(path, videoVersion, sceneCode, cameraType);
+            JSONObject videosJson = commonService.getVideosJson(path, videoVersion, sceneCode, cameraType);
 
             ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
 
@@ -277,88 +282,6 @@ public class BuildIntermitSceneServiceImpl implements IBuildSceneService {
         fYunFileService.uploadFile(statusJson.toJSONString().getBytes(StandardCharsets.UTF_8), dataViewPath + "status.json");
     }
 
-    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(UploadFilePath.DATA_VIEW_PATH, 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(UploadFilePath.DATA_VIEW_PATH, 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(UploadFilePath.DATA_VIEW_PATH, projectNum) + "stitch_params.txt");
-        }
-
-        return videosJson;
-    }
     private void updateDbPlus(int sceneSource,Long space,String videosJson, Long computeTime,boolean isObj,ScenePlusExt scenePlusExt){
 
         scenePlusExt.setSpace(space);

+ 591 - 0
src/main/java/com/fdkankan/contro/mq/service/impl/BuildLiguangServiceImpl.java

@@ -0,0 +1,591 @@
+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 cn.hutool.core.util.ZipUtil;
+import cn.hutool.extra.qrcode.QrCodeUtil;
+import cn.hutool.extra.qrcode.QrConfig;
+import cn.hutool.http.ContentType;
+import cn.hutool.http.HttpUtil;
+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.*;
+import com.fdkankan.common.util.FileUtils;
+import com.fdkankan.contro.bean.SyncLaserResultBean;
+import com.fdkankan.contro.constant.UserEditDataType;
+import com.fdkankan.contro.entity.*;
+import com.fdkankan.contro.mq.service.IBuildSceneService;
+import com.fdkankan.contro.service.*;
+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.enums.ModelTypeEnums;
+import com.fdkankan.model.utils.CreateHouseJsonUtil;
+import com.fdkankan.model.utils.CreateObjUtil;
+import com.fdkankan.model.utils.SceneUtil;
+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 com.fdkankan.redis.util.RedisUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.ObjectUtils;
+import org.apache.http.HttpHeaders;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.cloud.context.config.annotation.RefreshScope;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.io.File;
+import java.io.IOException;
+import java.util.*;
+import java.util.Map.Entry;
+
+
+/**
+ * <p>
+ * TODO
+ * </p>
+ *
+ * @author dengsixing
+ * @since 2022/4/20
+ **/
+@Slf4j
+@Service
+@RefreshScope
+public class BuildLiguangServiceImpl implements IBuildSceneService {
+
+    @Value("${queue.modeling.modeling-call}")
+    private String queueModelingCall;
+
+    @Value("${queue.modeling.single.modeling-call}")
+    private String singleModelingCall;
+
+    @Value("${model.type:#{null}}")
+    private String modelType;
+
+    @Value("${env:gn}")
+    private String env;
+
+    @Value("#{'${build.scene.post.not-delete-nas-nums:}'.split(',')}")
+    private List<String> notDeleteNasNumList;
+
+    @Value("4dkk.laserService.bucket")
+    private String laserBucket;
+
+    @Autowired
+    private RabbitMqProducer mqProducer;
+
+    @Resource
+    private FYunFileServiceInterface fYunFileService;
+    @Autowired
+    private ICameraDetailService cameraDetailService;
+    @Autowired
+    private ISceneEditInfoService sceneEditInfoService;
+    @Autowired
+    private ISceneEditControlsService sceneEditControlsService;
+
+    @Autowired
+    private FYunFileConfig fYunFileConfig;
+
+    @Autowired
+    private RedisUtil redisUtil;
+    @Autowired
+    private IScenePlusService scenePlusService;
+    @Autowired
+    private IScenePlusExtService scenePlusExtService;
+    @Autowired
+    private ISceneEditInfoExtService sceneEditInfoExtService;
+
+    @Autowired
+    private IUserIncrementService userIncrementService;
+
+    @Autowired
+    private IFdkkLaserService fdkkLaserService;
+
+
+    @Autowired
+    private IBuildSceneDTService buildSceneDTService;
+
+
+    @Autowired
+    private IIncrementTypeService incrementTypeService;
+
+    @Autowired
+    private ICompanyService companyService;
+    @Autowired
+    private ISceneAsynOperLogService sceneAsynOperLogService;
+    @Autowired
+    private ICommonService commonService;
+    @Autowired
+    private ISceneBuildProcessLogService sceneBuildProcessLogService;
+    @Autowired
+    private ISceneColdStorageService sceneColdStorageService;
+
+
+    @Override
+    public void buildScenePre(BuildSceneCallMessage message) throws Exception{
+        String num = message.getSceneNum();
+        try {
+            //重新计算时需要删除文件夹,否知使用缓存
+            if(new File(message.getPath() + File.separator + "results").exists()){
+                FileUtils.deleteDirectory(message.getPath() + File.separator + "results");
+            }
+            //由于刘强说caches会影响计算结果,所以这里删除caches
+            if(new File(message.getPath() + File.separator + "caches").exists()){
+                FileUtils.deleteDirectory(message.getPath() + File.separator + "caches");
+            }
+
+            //删除点位校准数据
+            if (Objects.nonNull(message.getExt())
+                    && message.getExt().containsKey("deleteExtras")
+                    && (Boolean) message.getExt().get("deleteExtras")) {
+                String extras = String.format(UploadFilePath.scene_result_data_path, num).concat("extras");
+                if(CollUtil.isNotEmpty(fYunFileService.listRemoteFiles(extras))){
+                    fYunFileService.deleteFolder(extras);
+                }
+            }
+
+            //根据相机类型,组装资源路径
+            //下载资源到本地
+            this.downLoadSource(message, message.getPath());
+
+
+            message.getBuildContext().put("cameraType",message.getCameraType());
+
+            message.setBizType("standard");
+
+            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 = (String) buildSceneMqMessage.getExt().get("ossPath");
+        fYunFileService.downloadFileByCommand(path + File.separator + "capture", ossPath);
+    }
+
+    @Override
+    public void buildScenePost(BuildSceneResultMqMessage message) throws Exception {
+        String sceneCode = message.getBuildContext().get("sceneNum").toString();
+        String path = message.getPath();
+        try {
+            // 上传计算日志
+            //如果是重复计算,没有走到计算逻辑,不需要上传日志文件
+            log.info("开始上传计算日志");
+            String buildLogPath = String.format(UploadFilePath.BUILD_LOG_PATH, sceneCode);
+            fYunFileService.uploadFile(path + File.separator + "console.log", buildLogPath + "console.log");
+            log.info("计算日志上传完成");
+
+            if (!message.getBuildSuccess()) {
+                log.error("建模失败,修改状态为失败状态");
+                scenePlusService.update(new LambdaUpdateWrapper<ScenePlus>()
+                        .set(ScenePlus::getSceneStatus, SceneStatus.FAILD.code())
+                        .eq(ScenePlus::getNum, sceneCode));
+
+                // 发送钉钉消息,计算失败
+                buildSceneDTService.handModelFail("计算失败", message.getPath(), sceneCode, message.getHostName());
+                return;
+            }
+            JSONObject fdageData = commonService.getFdageData(path + File.separator + "capture" +File.separator+"data.fdage");
+
+            ScenePlus scenePlus = scenePlusService.getScenePlusByNum(sceneCode);
+
+            Integer cameraType = Integer.parseInt(message.getBuildContext().get("cameraType").toString());
+            Map<String, String> uploadFiles = commonService.getUploadFiles(scenePlus,path,cameraType,fdageData);
+
+            scenePlus.setPayStatus(PayStatus.PAY.code());
+            scenePlus.setUpdateTime(new Date());
+            scenePlus.setSceneStatus(SceneStatus.NO_DISPLAY.code());
+
+            Integer videoVersion = fdageData.getInteger("videoVersion");
+            //读取计算结果文件生成videosJson
+            JSONObject videosJson = commonService.getVideosJson(path, videoVersion, sceneCode, cameraType);
+
+            ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
+            boolean isObj = fdageData.containsKey("exportMeshObj") && fdageData.getIntValue("exportMeshObj") == 1;
+
+            //上传全景图俯视图
+            this.uploadFloorCad(path, sceneCode, uploadFiles);
+
+            log.info("开始上传场景计算结果数据,num:{}", sceneCode);
+            //由于3dtiles算法mesh文件发生变化,所以这里需要先清除一下oss的mesh目录,避免存在旧算法obj文件
+            fYunFileService.deleteFolder(String.format(UploadFilePath.DATA_VIEW_PATH, sceneCode) + "mesh");
+            fYunFileService.deleteFolder(String.format(UploadFilePath.IMG_VIEW_PATH,  sceneCode) + ModelKind.THREE_D_TILE.code());
+            //上传文件
+            fYunFileService.uploadMulFiles(uploadFiles);
+
+            //修改oss上dam的内容编码
+            Map<String,String> damFileHeaders = new HashMap<>();
+            damFileHeaders.put("Content-Encoding","gzip");
+            String damPath = path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam";
+            fYunFileService.uploadFile(damPath,  String.format(UploadFilePath.IMG_VIEW_PATH, sceneCode) + ConstantFileName.modelUUID + "_50k.dam", damFileHeaders);
+
+            //拷贝部分文件到编辑目录,用于用户编辑
+            this.copyToEditDir(sceneCode);
+
+            //计算完毕后,同步全景图到缓存目录
+//            this.cachePanorama(path, sceneCode);
+
+            //生成houseTypejson并上传
+            boolean existHouseType = this.uploadHouseTypeJson(sceneCode, path);
+            scenePlus.setHouseType(existHouseType ? CommonStatus.YES.code().intValue() : CommonStatus.NO.code().intValue());
+
+            //生成floorpan.json
+            commonService.uploadFloorplanJson(sceneCode, path);
+
+            //重置异步操作记录
+            commonService.removeSceneAsynOperLog(sceneCode);
+
+            //清除用户编辑业务数据
+            Set<String> bizs = new HashSet<>();
+            bizs.add(UserEditDataType.BOX_MODEL.message());
+            bizs.add(UserEditDataType.FLOORPLAN.message());
+            bizs.add(UserEditDataType.FILTERS.message());
+            commonService.initUserEditData(sceneCode, bizs, null);
+
+            //上传计算结果文件
+            commonService.uploadBuildResultData(sceneCode, path, SceneVersionType.V4.code());
+
+            //容量统计
+            Long space = commonService.getSpace(sceneCode);
+
+            //写入数据库
+            this.updateDbPlus(scenePlus.getSceneSource(), space, videosJson.toJSONString(), message.getComputeTime(),isObj,scenePlusExt);
+
+            Object[] editInfoArr = commonService.updateEditInfo(scenePlus);
+            SceneEditInfo sceneEditInfo = (SceneEditInfo)editInfoArr[0];
+            SceneEditInfoExt sceneEditInfoExt = (SceneEditInfoExt)editInfoArr[1];
+            SceneEditControls sceneEditControls = (SceneEditControls)editInfoArr[2];
+
+            //更新场景主表
+            //如果相机容量不足,需要把场景的paystatus改为容量不足状态
+            scenePlus.setPayStatus(commonService.getPayStatus(scenePlus.getCameraId(), space));
+            //统计原始资源大小
+            scenePlusExt.setOrigSpace(FileUtil.size(new File(path.concat(File.separator).concat("capture"))));
+
+            if (new File(path + "/results/laserData/vision_edit.txt").exists()) {
+                fdkkLaserService.cloudPointBuild(sceneCode,path);
+            }
+
+            log.info("生成scene.json上传oss并设置缓存,num:{}", sceneCode);
+            CameraDetail cameraDetail = cameraDetailService.getByCameraId(scenePlus.getCameraId());
+            Company company = !ObjectUtils.isEmpty(cameraDetail.getCompanyId()) ? companyService.getById(cameraDetail.getCompanyId()) : null;
+            //写scene.json
+            commonService.writeSceneJson(sceneCode,sceneEditInfo, sceneEditInfoExt, sceneEditControls, scenePlus,scenePlusExt,company);
+
+            String qrLogo = !ObjectUtils.isEmpty(company) && !ObjectUtils.isEmpty(company.getQrLogo()) ? company.getQrLogo() : null;
+
+            qrLogo = ObjectUtils.isEmpty(qrLogo) && !ObjectUtils.isEmpty(sceneEditInfoExt.getShareLogoImg()) ? fYunFileConfig.getHost().concat(sceneEditInfoExt.getShareLogoImg()) : null;
+
+            createQrCode(sceneCode, scenePlusExt, qrLogo);
+
+//            //删除计算目录
+            if(CollUtil.isEmpty(notDeleteNasNumList) || !notDeleteNasNumList.contains(sceneCode)){
+                CreateObjUtil.deleteFile(path.replace(ConstantFilePath.BUILD_MODEL_PATH, "/"));
+            }
+
+            this.uploadStatusJson(scenePlus, scenePlusExt);
+
+            scenePlusService.updateById(scenePlus);
+            scenePlusExtService.updateById(scenePlusExt);
+
+            log.info("场景计算结果处理结束,场景码:{}", sceneCode);
+
+        }catch (Exception e){
+            log.error("场景计算结果处理出错,num"+sceneCode, e);
+            buildSceneDTService.handBaseFail("场景计算结果处理出错!", message.getPath(), sceneCode, "计算控制服务器");
+            throw e;
+        }
+    }
+
+//    private void cachePanorama(String dataSource, String num){
+//        String cachedImagesPath = String.format(ConstantFilePath.SCENE_CACHE_IMAGES, num);
+//        //将全景图缓存到缓存目录
+//        List<String> imagesList = FileUtil.listFileNames(dataSource + "/caches/images");
+//        //先清除旧的全景图
+//        cn.hutool.core.io.FileUtil.del(cachedImagesPath);
+//        String visionPath = dataSource + "/results/vision.txt";
+//        List<String> panoramaImageList = SceneUtil.getPanoramaImageList(visionPath);
+//        imagesList.stream().forEach(fileName -> {
+//            if (panoramaImageList.contains(fileName)) {
+//                String srcPath = dataSource + "/caches/images/" + fileName;
+//                String targetPath = cachedImagesPath + fileName;
+//                log.info("源文件:{}, 目标文件:{}", srcPath, targetPath);
+//                cn.hutool.core.io.FileUtil.copy(srcPath, targetPath, true);
+//            }
+//        });
+//    }
+
+
+
+    private void uploadFloorCad(String path, String num, Map<String, String> uploadFiles){
+
+        //户型图上传
+        String  dataViewPath = UploadFilePath.DATA_VIEW_PATH + "floor-cad-%s.%s";
+        String floorCadPath = path + "/results/floorplan_cad";
+        List<String> floorCadList = FileUtils.getFileList(floorCadPath);
+        if(CollUtil.isNotEmpty(floorCadList)){
+            floorCadList.stream().forEach(str->{
+                String substring = str.substring(str.lastIndexOf(File.separator) + 1);
+                String[] arr = substring.split("floor");
+                String[] arr2 = arr[1].split("\\.");
+                uploadFiles.put(str, String.format(dataViewPath, num, arr2[0], arr2[1]));
+            });
+        }
+
+    }
+
+    private void uploadStatusJson(ScenePlus scenePlus, ScenePlusExt scenePlusExt){
+        String num = scenePlus.getNum();
+        String dataViewPath = String.format(UploadFilePath.DATA_VIEW_PATH, num);
+
+        Integer status = 1;
+        if(scenePlus.getSceneSource() == 4 || scenePlus.getSceneSource() == 5){//如果是激光场景,需要激光系统那边完全处理好之后再发mq通知更新状态
+            status = 0;
+        }
+
+        // 上传status JSON.
+        JSONObject statusJson = new JSONObject();
+        //临时将-2改成1,app还没完全更新
+        statusJson.put("status", status);
+        statusJson.put("webSite", scenePlusExt.getWebSite());
+        statusJson.put("sceneNum", num);
+        statusJson.put("thumb", scenePlusExt.getThumb());
+        statusJson.put("payStatus", scenePlus.getPayStatus());
+        statusJson.put("sceneScheme", scenePlusExt.getSceneScheme());
+        FileUtils.writeFile(ConstantFilePath.SCENE_PATH + "data/data" + num + File.separator + "status.json", statusJson.toString());
+
+        Map<String,String> headers = new HashMap<>();
+        headers.put(HttpHeaders.CONTENT_TYPE, ContentType.JSON.getValue());
+        fYunFileService.uploadFile(ConstantFilePath.SCENE_PATH + "data/data" + num + File.separator + "status.json", dataViewPath + "status.json", headers);
+    }
+
+    private void createQrCode(String num, ScenePlusExt scenePlusExt, String qrLogo) {
+        String localLogoPath = null;
+        if (!ObjectUtils.isEmpty(qrLogo)) {
+            try {
+                localLogoPath = ConstantFilePath.AGENT_PATH + qrLogo.substring(qrLogo.lastIndexOf("//") + 1);
+                HttpUtil.downloadFile(qrLogo, localLogoPath);
+            } catch (Exception e) {
+                log.error("公司logo下载失败:{}", qrLogo);
+                localLogoPath = null;
+            }
+        }
+        //生成二维码
+        String outPathZh = ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+ num +".png";
+        String outPathEn = ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+ num +"_en.png";
+        QrConfig qrConfig = QrConfig.create();
+        qrConfig.setWidth(1024);
+        qrConfig.setHeight(1024);
+        if(StrUtil.isNotEmpty(localLogoPath)){
+            qrConfig.setImg(localLogoPath);
+        }
+        QrCodeUtil.generate(scenePlusExt.getWebSite(), qrConfig, FileUtil.file(outPathZh));
+        QrCodeUtil.generate(scenePlusExt.getWebSite() + "&lang=en", qrConfig, FileUtil.file(outPathEn));
+        //上传二维码
+        fYunFileService.uploadFile(outPathZh, String.format(UploadFilePath.DOWNLOADS_QRCODE, num) + num + ".png");
+        fYunFileService.uploadFile(outPathEn, String.format(UploadFilePath.DOWNLOADS_QRCODE, num) + num + "_en.png");
+
+        if(!ObjectUtils.isEmpty(localLogoPath)){
+            FileUtils.deleteFile(localLogoPath);
+        }
+    }
+
+    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 void copyToEditDir(String num) throws IOException {
+
+        String editImagesPath = String.format(UploadFilePath.IMG_EDIT_PATH, num);
+        String viewImagesPath = String.format(UploadFilePath.IMG_VIEW_PATH, num);
+
+        String editDataPath = String.format(UploadFilePath.DATA_EDIT_PATH, num);
+        String viewDataPath = String.format(UploadFilePath.DATA_VIEW_PATH, num);
+
+        Map<String, String> map = new HashMap<>();
+        map.put(editImagesPath + "vision.modeldata", viewImagesPath + "vision.modeldata");
+        map.put(editImagesPath + "vision2.modeldata", viewImagesPath + "vision2.modeldata");
+        map.put(editDataPath + "floorplan_cad.json", viewDataPath + "floorplan_cad.json");
+
+        for (Entry<String, String> entry : map.entrySet()) {
+                fYunFileService.copyFileInBucket(entry.getValue(), entry.getKey());
+        }
+    }
+
+    private void updateDbPlus(int sceneSource,Long space,String videosJson, Long computeTime,boolean isObj,ScenePlusExt scenePlusExt){
+
+        scenePlusExt.setSpace(space);
+        scenePlusExt.setComputeTime(computeTime.toString());
+        scenePlusExt.setAlgorithmTime(new Date());
+        scenePlusExt.setVideos(videosJson);
+        scenePlusExt.setIsObj(isObj ? 1 : 0);
+
+        if(ModelTypeEnums.TILE_CODE.equals(modelType)){
+            scenePlusExt.setSceneScheme(3);
+        }
+
+        switch (SceneSource.get(sceneSource)){
+            case BM:
+                scenePlusExt.setSceneResolution(SceneResolution.two_K.code());
+                scenePlusExt.setSceneFrom(SceneFrom.PRO.code());
+                break;
+            case SM:
+                scenePlusExt.setSceneResolution(SceneResolution.one_k.code());
+                scenePlusExt.setSceneFrom(SceneFrom.LITE.code());
+                break;
+            case ZT:
+                scenePlusExt.setSceneResolution(SceneResolution.four_K.code());
+                scenePlusExt.setSceneFrom(SceneFrom.MINION.code());
+                break;
+            case JG:
+                scenePlusExt.setSceneResolution(SceneResolution.four_K.code());
+                scenePlusExt.setSceneFrom(SceneFrom.LASER.code());
+                break;
+            case SG:
+                scenePlusExt.setSceneResolution(SceneResolution.four_K.code());
+                scenePlusExt.setSceneFrom(SceneFrom.LASER.code());
+                break;
+        }
+
+        String sceneKind = scenePlusExt.getSceneScheme() == 3 ? SceneKind.FACE.code():SceneKind.TILES.code();
+        scenePlusExt.setSceneKind(sceneKind);
+//        scenePlusExt.setModelKind(modelKind);
+
+        //统计点位数量
+        Map<String, Integer> result = this.getShootCount(scenePlusExt);
+        Integer shootCount = result.get("shootCount");
+        Integer mixture = result.get("mixture");
+        scenePlusExt.setShootCount(shootCount);
+        scenePlusExt.setMixture(mixture);
+
+        scenePlusExtService.updateById(scenePlusExt);
+    }
+
+    private Map<String, Integer> getShootCount(ScenePlusExt scenePlusExt){
+
+        Map<String, Integer> result = new HashMap<>();
+
+        Integer shootCount = 0;
+        Integer mixture = Objects.isNull(scenePlusExt.getMixture()) ? 0 : scenePlusExt.getMixture();
+        String homePath = SceneUtil.getHomePath(scenePlusExt.getDataSource());
+        JSONObject dataFdageObj = JSON.parseObject(fYunFileService.getFileContent(homePath.concat("data.fdage")));
+        if(Objects.nonNull(dataFdageObj)){
+            JSONArray points = dataFdageObj.getJSONArray("points");
+            if(CollUtil.isNotEmpty(points)){
+                shootCount = points.size();
+            }
+        }
+        if(Objects.nonNull(shootCount) && shootCount > 0){
+            if(Objects.nonNull(scenePlusExt.getLocation()) && scenePlusExt.getLocation() == 6){
+                mixture = CommonStatus.YES.code().intValue();
+            }
+        }else{
+            String slamDataStr = fYunFileService.getFileContent(homePath.concat("slam_data.json"));
+            JSONObject slamDataObj = JSON.parseObject(slamDataStr);
+            if(Objects.nonNull(slamDataObj)){
+                JSONArray viewsInfo = slamDataObj.getJSONArray("views_info");
+                if(CollUtil.isNotEmpty(viewsInfo)){
+                    shootCount = viewsInfo.stream().mapToInt(info -> {
+                        return  ((JSONObject) info).getJSONArray("list_pose").size();
+                    }).sum();
+                }
+            }
+            mixture = CommonStatus.NO.code().intValue();
+        }
+
+        result.put("shootCount", shootCount);
+        result.put("mixture", mixture);
+
+        return result;
+    }
+
+    public static void main(String[] args) {
+        JSONObject dataFdageObj = JSON.parseObject(null);
+        System.out.println(dataFdageObj);
+    }
+
+
+    public boolean uploadHouseTypeJson(String num, String dataSource) {
+        String floorPlanCardFilePath = dataSource + File.separator + "results/floorplan_cad.json";
+        if (!new File(floorPlanCardFilePath).exists()) {
+            log.warn("floorplan_cad.json 文件不存在,文件路径:{}", floorPlanCardFilePath);
+            return false;
+        }
+        JSONObject json = CreateHouseJsonUtil.createHouseTypeJsonByCad(floorPlanCardFilePath);
+        if(Objects.isNull(json)){
+            return false;
+        }
+        String hourseTypeJsonPath = String.format(UploadFilePath.USER_VIEW_PATH, num) + "houseType.json";
+        fYunFileService.uploadFile(json.toJSONString().getBytes(), hourseTypeJsonPath);
+        hourseTypeJsonPath = String.format(UploadFilePath.USER_EDIT_PATH, num) + "houseType.json";
+        fYunFileService.uploadFile(json.toJSONString().getBytes(), hourseTypeJsonPath);
+
+        return true;
+    }
+}

+ 10 - 2
src/main/java/com/fdkankan/contro/mq/service/impl/BuildObjServiceImpl.java

@@ -144,6 +144,7 @@ public class BuildObjServiceImpl implements IBuildSceneService {
             message.setResolution(jsonObject.getString("resolution"));
             message.setPath(laserObjFilePath);
             message.setResultReceiverMqName(queueObjModelingPost);
+            message.setBizType("obj");
 
             success = true;
 
@@ -224,6 +225,8 @@ public class BuildObjServiceImpl implements IBuildSceneService {
                     log.error("3dtiles目录异常,3dtiles地址:{}", new File(path + File.separator + "results" + File.separator + ModelKind.THREE_D_TILE.code()));
                     throw new Exception("3dtiles目录异常");
                 }
+                //先删除
+                fYunFileService.deleteFolder(oss3dtilesPath);
                 //上传3dtiles文件
                 fYunFileService.uploadFileByCommand(threedtilesPath, oss3dtilesPath);
             }
@@ -247,6 +250,8 @@ public class BuildObjServiceImpl implements IBuildSceneService {
             log.info("开始拷贝obj文件");
             FileUtils.copyFolderAllFiles(laserObjFilePath + "/results/mesh", laserObjFilePath + "/laserData/mesh/", true);
 
+            //先删除
+            fYunFileService.deleteFolder(String.format(UploadFilePath.DATA_VIEW_PATH,  projectNum) + "mesh");
             //上传mesh文件
             fYunFileService.uploadFileByCommand(laserObjFilePath + "/results/mesh", String.format(UploadFilePath.DATA_VIEW_PATH,  projectNum) + "mesh");
 
@@ -297,9 +302,12 @@ public class BuildObjServiceImpl implements IBuildSceneService {
                 CameraDetail cameraDetail = cameraDetailService.getByCameraId(scenePlus.getCameraId());
                 Company company = !org.apache.commons.lang3.ObjectUtils.isEmpty(cameraDetail.getCompanyId()) ? companyService.getById(cameraDetail.getCompanyId()) : null;
                 //写scene.json
-                commonService.writeSceneJson(projectNum, new JSONObject(),sceneEditInfo, sceneEditInfoExt, sceneEditControls, scenePlus,scenePlusExt,company);
+                commonService.writeSceneJson(projectNum,sceneEditInfo, sceneEditInfoExt, sceneEditControls, scenePlus,scenePlusExt,company);
             }
 
+            //重置异步操作记录
+            commonService.removeSceneAsynOperLog(projectNum);
+
             // 如果未升级V4,则升级V4
             if("v3".equals(version)){
                 fdkkV4Service.upgradeToV4(projectNum);
@@ -309,7 +317,7 @@ public class BuildObjServiceImpl implements IBuildSceneService {
 
             //国际环境需要发邮件通知
             if("eur".equals(env)){
-                commonService.sendEmail(projectNum);
+                commonService.sendEmail(projectNum, "obj");
             }
 
         }catch (Exception e){

+ 62 - 263
src/main/java/com/fdkankan/contro/mq/service/impl/BuildSceneServiceImpl.java

@@ -7,6 +7,7 @@ import cn.hutool.core.util.StrUtil;
 import cn.hutool.core.util.ZipUtil;
 import cn.hutool.extra.qrcode.QrCodeUtil;
 import cn.hutool.extra.qrcode.QrConfig;
+import cn.hutool.http.ContentType;
 import cn.hutool.http.HttpUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
@@ -15,6 +16,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.fdkankan.common.constant.*;
 import com.fdkankan.common.util.FileUtils;
+import com.fdkankan.contro.bean.SyncLaserResultBean;
 import com.fdkankan.contro.constant.UserEditDataType;
 import com.fdkankan.contro.entity.*;
 import com.fdkankan.contro.mq.service.IBuildSceneService;
@@ -38,6 +40,7 @@ import com.fdkankan.redis.util.RedisUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.http.HttpHeaders;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.cloud.context.config.annotation.RefreshScope;
@@ -74,12 +77,6 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
     @Value("${model.type:#{null}}")
     private String modelType;
 
-    @Value("${model.modelKind:3dtiles}")
-    private String modelKind;
-
-    @Value("#{'${model.3dtiles.sceneSource:}'.split(',')}")
-    private List<Integer> sdTilesSceneSourceList;
-
     @Value("${env:gn}")
     private String env;
 
@@ -89,9 +86,6 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
     @Value("4dkk.laserService.bucket")
     private String laserBucket;
 
-    @Value("${4dkk.laserService.dir}")
-    private String laserDir;
-
     @Autowired
     private RabbitMqProducer mqProducer;
 
@@ -140,6 +134,8 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
     private ISceneBuildProcessLogService sceneBuildProcessLogService;
     @Autowired
     private ISceneColdStorageService sceneColdStorageService;
+    @Autowired
+    private IWbService wbService;
 
 
     @Override
@@ -212,6 +208,8 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
                 ext.put("128G", 1);
             }
 
+            message.setBizType("standard");
+
             log.info("场景计算资源准备结束,场景码:{}", message.getSceneNum());
 
         }catch (Exception e){
@@ -255,16 +253,18 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
                         .set(ScenePlus::getSceneStatus, SceneStatus.FAILD.code())
                         .eq(ScenePlus::getNum, sceneCode));
 
+                wbService.sendMq(sceneCode, CommonSuccessStatus.FAIL.code());
+
                 // 发送钉钉消息,计算失败
                 buildSceneDTService.handModelFail("计算失败", message.getPath(), sceneCode, message.getHostName());
                 return;
             }
-            JSONObject fdageData = getFdageData(path + File.separator + "capture" +File.separator+"data.fdage");
+            JSONObject fdageData = commonService.getFdageData(path + File.separator + "capture" +File.separator+"data.fdage");
 
             ScenePlus scenePlus = scenePlusService.getScenePlusByNum(sceneCode);
 
             Integer cameraType = Integer.parseInt(message.getBuildContext().get("cameraType").toString());
-            Map<String, String> uploadFiles = getUploadFiles(scenePlus,path,cameraType,fdageData);
+            Map<String, String> uploadFiles = commonService.getUploadFiles(scenePlus,path,cameraType,fdageData);
 
             scenePlus.setPayStatus(PayStatus.PAY.code());
             scenePlus.setUpdateTime(new Date());
@@ -272,7 +272,7 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
 
             Integer videoVersion = fdageData.getInteger("videoVersion");
             //读取计算结果文件生成videosJson
-            JSONObject videosJson = this.getVideosJson(path, videoVersion, sceneCode, cameraType);
+            JSONObject videosJson = commonService.getVideosJson(path, videoVersion, sceneCode, cameraType);
 
             ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
             boolean isObj = fdageData.containsKey("exportMeshObj") && fdageData.getIntValue("exportMeshObj") == 1;
@@ -283,6 +283,7 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
             log.info("开始上传场景计算结果数据,num:{}", sceneCode);
             //由于3dtiles算法mesh文件发生变化,所以这里需要先清除一下oss的mesh目录,避免存在旧算法obj文件
             fYunFileService.deleteFolder(String.format(UploadFilePath.DATA_VIEW_PATH, sceneCode) + "mesh");
+            fYunFileService.deleteFolder(String.format(UploadFilePath.IMG_VIEW_PATH,  sceneCode) + ModelKind.THREE_D_TILE.code());
             //上传文件
             fYunFileService.uploadMulFiles(uploadFiles);
 
@@ -306,7 +307,7 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
             commonService.uploadFloorplanJson(sceneCode, path);
 
             //重置异步操作记录
-            this.removeSceneAsynOperLog(sceneCode);
+            commonService.removeSceneAsynOperLog(sceneCode);
 
             //清除用户编辑业务数据
             Set<String> bizs = new HashSet<>();
@@ -337,7 +338,15 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
 
             if (cameraType == 14) {
                 //计算成功  激光转台相机 同步 请求
-                fdkkLaserService.syncBuildResult(scenePlus.getNum(), path, scenePlus.getCreateTime(), Calendar.getInstance().getTime(), scenePlusExt.getShootCount(), scenePlus.getPayStatus());
+                fdkkLaserService.syncBuildResult(
+                        SyncLaserResultBean.builder()
+                        .num(sceneCode).dataSource(path)
+                        .sceneStatus(2)
+                        .createTime(scenePlus.getCreateTime())
+                        .shootCount(scenePlusExt.getShootCount())
+                        .payStatus(scenePlus.getPayStatus())
+                        .mixture(scenePlusExt.getMixture())
+                        .version(SceneVersionType.V4.code()).build());
                 sceneEditControlsService.update(new LambdaUpdateWrapper<SceneEditControls>().set(SceneEditControls::getShowMap,0)
                         .eq(SceneEditControls::getEditInfoId,sceneEditInfo.getId()));
                 sceneEditControls.setShowMap(0);
@@ -350,7 +359,7 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
             CameraDetail cameraDetail = cameraDetailService.getByCameraId(scenePlus.getCameraId());
             Company company = !ObjectUtils.isEmpty(cameraDetail.getCompanyId()) ? companyService.getById(cameraDetail.getCompanyId()) : null;
             //写scene.json
-            commonService.writeSceneJson(sceneCode, videosJson,sceneEditInfo, sceneEditInfoExt, sceneEditControls, scenePlus,scenePlusExt,company);
+            commonService.writeSceneJson(sceneCode,sceneEditInfo, sceneEditInfoExt, sceneEditControls, scenePlus,scenePlusExt,company);
 
             String qrLogo = !ObjectUtils.isEmpty(company) && !ObjectUtils.isEmpty(company.getQrLogo()) ? company.getQrLogo() : null;
 
@@ -376,10 +385,14 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
             scenePlusExtService.updateById(scenePlusExt);
 
             //国际环境需要发邮件通知
-            if("eur".equals(env)){
-                commonService.sendEmail(sceneCode);
+            if("eur".equals(env) &&
+                    !scenePlus.getSceneSource().equals(SceneSource.JG.code()) &&
+                    !scenePlus.getSceneSource().equals(SceneSource.SG.code())){
+                commonService.sendEmail(sceneCode, "standar");
             }
 
+            wbService.sendMq(sceneCode, CommonSuccessStatus.SUCCESS.code());
+
             log.info("场景计算结果处理结束,场景码:{}", sceneCode);
 
         }catch (Exception e){
@@ -394,26 +407,6 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
         }
     }
 
-    private void removeSceneAsynOperLog(String num){
-        List<SceneAsynOperLog> list = sceneAsynOperLogService.list(new LambdaQueryWrapper<SceneAsynOperLog>().eq(SceneAsynOperLog::getNum, num));
-        if(CollUtil.isEmpty(list)){
-            return;
-        }
-        //删除数据库记录
-        List<Long> deleteIdList = list.parallelStream().map(item -> item.getId()).collect(Collectors.toList());
-        sceneAsynOperLogService.removeByIds(deleteIdList);
-
-        list.parallelStream().forEach(item -> {
-            if(StrUtil.isNotEmpty(item.getUrl())){
-                try {
-                    fYunFileService.deleteFile(item.getUrl());
-                } catch (IOException e) {
-                    log.warn("删除oss全景图下载压缩包失败,key:{}", item.getUrl());
-                }
-            }
-        });
-    }
-
 //    private void cachePanorama(String dataSource, String num){
 //        String cachedImagesPath = String.format(ConstantFilePath.SCENE_CACHE_IMAGES, num);
 //        //将全景图缓存到缓存目录
@@ -432,135 +425,7 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
 //        });
 //    }
 
-    private Map<String, String> getUploadFiles(ScenePlus scenePlus,String path,Integer cameraType,JSONObject fdageData) throws Exception {
-        if (ObjectUtils.isEmpty(scenePlus)) {
-            throw new Exception("未找到场景信息:" + path);
-        }
-
-        String projectNum = scenePlus.getNum();
-
-        String dataViewPath = String.format(UploadFilePath.DATA_VIEW_PATH, projectNum);
-        String imagesPath = String.format(UploadFilePath.IMG_VIEW_PATH, projectNum);
-        String videoPath = String.format(UploadFilePath.VIDEOS_VIEW_PATH, 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 updown = FileUtils.readFile(filePath);
-                JSONObject updownJson = JSONObject.parseObject(updown);
-                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);
-                }
-            }
-        }
-
-        //exportMeshObj这个是字段由app写入的
-        boolean genModel = true;//是否生成模型 默认生成,深时场景要根据 exportMeshObj判断是否生成
-        if(!ObjectUtils.isEmpty(cameraType)
-                && cameraType == 14
-                && (!fdageData.containsKey("exportMeshObj") || fdageData.getIntValue("exportMeshObj") != 1)){
-            genModel = false;
-        }
-        boolean gen3dTiles = true;//是否生成3dtiles模型 默认生成
-        if(!ModelKind.THREE_D_TILE.code().equals(modelKind)
-                || CollUtil.isEmpty(sdTilesSceneSourceList)
-                || !sdTilesSceneSourceList.contains(scenePlus.getSceneSource())){
-            gen3dTiles = false;
-        }
-
-        if(genModel){
-            if (!gen3dTiles) {
-                String damPath = path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam";
-                CreateObjUtil.convertTxtToDam(path + File.separator + "results" + File.separator + "tex" + File.separator + "modeldata.txt", damPath);
-//                FileUtil.writeBytes(ZipUtil.gzip(new File(damPath)), damPath);
-                map.put(damPath, imagesPath + ConstantFileName.modelUUID + "_50k.dam");
-            }else{
-                List<String> list = FileUtils.list(new File(path + File.separator + "results" + File.separator + ModelKind.THREE_D_TILE.code()));
-                if(CollUtil.isEmpty(list)){
-                    log.error("3dtiles目录异常,3dtiles地址:{}", new File(path + File.separator + "results" + File.separator + ModelKind.THREE_D_TILE.code()));
-                    throw new Exception("3dtiles目录异常");
-                }
-                list.stream().forEach(str->{
-                    map.put(str, str.replace(path + File.separator + "results" + File.separator, imagesPath));
-                });
-            }
-        }
-
-        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);
-        if(!new File("/mnt/4Dkankan/scene/data" + File.separator + "data" + projectNum).exists()){
-            FileUtil.mkdir("/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 uploadFloorCad(String path, String num, Map<String, String> uploadFiles){
 
@@ -599,7 +464,9 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
         statusJson.put("sceneScheme", scenePlusExt.getSceneScheme());
         FileUtils.writeFile(ConstantFilePath.SCENE_PATH + "data/data" + num + File.separator + "status.json", statusJson.toString());
 
-        fYunFileService.uploadFile(statusJson.toJSONString().getBytes(StandardCharsets.UTF_8), dataViewPath + "status.json");
+        Map<String,String> headers = new HashMap<>();
+        headers.put(HttpHeaders.CONTENT_TYPE, ContentType.JSON.getValue());
+        fYunFileService.uploadFile(ConstantFilePath.SCENE_PATH + "data/data" + num + File.separator + "status.json", dataViewPath + "status.json", headers);
     }
 
     private void createQrCode(String num, ScenePlusExt scenePlusExt, String qrLogo) {
@@ -696,88 +563,6 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
         }
     }
 
-    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(UploadFilePath.DATA_VIEW_PATH, projectNum) + "Up.xml");
-            if(cameraType == 13 || cameraType == 14){
-                //转台相机
-                videosJson.put("upPath", videosJson.getString("upPath").replace(".xml", ".txt"));
-            }
-        }else {
-            videosJson.put("version", 1);
-            videosJson.put("upPath", fYunFileConfig.getHost() + String.format(UploadFilePath.DATA_VIEW_PATH, projectNum) + "Up2.xml");
-            if(cameraType == 13 || cameraType == 14){
-                //转台相机
-                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(UploadFilePath.DATA_VIEW_PATH, projectNum) + "stitch_params.txt");
-        }
-
-        return videosJson;
-    }
     private void updateDbPlus(int sceneSource,Long space,String videosJson, Long computeTime,boolean isObj,ScenePlusExt scenePlusExt){
 
         scenePlusExt.setSpace(space);
@@ -818,13 +603,21 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
 //        scenePlusExt.setModelKind(modelKind);
 
         //统计点位数量
-        scenePlusExt.setShootCount(this.getShootCount(scenePlusExt));
+        Map<String, Integer> result = this.getShootCount(scenePlusExt);
+        Integer shootCount = result.get("shootCount");
+        Integer mixture = result.get("mixture");
+        scenePlusExt.setShootCount(shootCount);
+        scenePlusExt.setMixture(mixture);
 
         scenePlusExtService.updateById(scenePlusExt);
     }
 
-    private Integer getShootCount(ScenePlusExt scenePlusExt){
-        Integer shootCount = null;
+    private Map<String, Integer> getShootCount(ScenePlusExt scenePlusExt){
+
+        Map<String, Integer> result = new HashMap<>();
+
+        Integer shootCount = 0;
+        Integer mixture = Objects.isNull(scenePlusExt.getMixture()) ? 0 : scenePlusExt.getMixture();
         String homePath = SceneUtil.getHomePath(scenePlusExt.getDataSource());
         JSONObject dataFdageObj = JSON.parseObject(fYunFileService.getFileContent(homePath.concat("data.fdage")));
         if(Objects.nonNull(dataFdageObj)){
@@ -834,21 +627,27 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
             }
         }
         if(Objects.nonNull(shootCount) && shootCount > 0){
-            return shootCount;
-        }
-
-        String slamDataStr = fYunFileService.getFileContent(homePath.concat("slam_data.json"));
-        JSONObject slamDataObj = JSON.parseObject(slamDataStr);
-        if(Objects.nonNull(slamDataObj)){
-            JSONArray viewsInfo = slamDataObj.getJSONArray("views_info");
-            if(CollUtil.isNotEmpty(viewsInfo)){
-                shootCount = viewsInfo.stream().mapToInt(info -> {
-                    return  ((JSONObject) info).getJSONArray("list_pose").size();
-                }).sum();
+            if(Objects.nonNull(scenePlusExt.getLocation()) && scenePlusExt.getLocation() == 6){
+                mixture = CommonStatus.YES.code().intValue();
+            }
+        }else{
+            String slamDataStr = fYunFileService.getFileContent(homePath.concat("slam_data.json"));
+            JSONObject slamDataObj = JSON.parseObject(slamDataStr);
+            if(Objects.nonNull(slamDataObj)){
+                JSONArray viewsInfo = slamDataObj.getJSONArray("views_info");
+                if(CollUtil.isNotEmpty(viewsInfo)){
+                    shootCount = viewsInfo.stream().mapToInt(info -> {
+                        return  ((JSONObject) info).getJSONArray("list_pose").size();
+                    }).sum();
+                }
             }
+            mixture = CommonStatus.NO.code().intValue();
         }
 
-        return shootCount;
+        result.put("shootCount", shootCount);
+        result.put("mixture", mixture);
+
+        return result;
     }
 
     public static void main(String[] args) {

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

@@ -13,7 +13,9 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.fdkankan.common.constant.PayStatus;
 import com.fdkankan.common.constant.SceneScheme;
 import com.fdkankan.common.constant.SceneStatus;
+import com.fdkankan.common.constant.SceneVersionType;
 import com.fdkankan.common.util.FileUtils;
+import com.fdkankan.contro.bean.SyncLaserResultBean;
 import com.fdkankan.contro.entity.*;
 import com.fdkankan.contro.mq.service.IBuildSceneService;
 import com.fdkankan.contro.service.ICommonService;
@@ -160,6 +162,8 @@ public class BuildV3SceneServiceImpl implements IBuildSceneService {
 
             message.setResultReceiverMqName(queueV3ModelingPost);
 
+            message.setBizType("standard");
+
             log.info("场景计算资源准备结束,场景码:{}", message.getSceneNum());
 
         }catch (Exception e){
@@ -278,7 +282,15 @@ public class BuildV3SceneServiceImpl implements IBuildSceneService {
             sceneProEdit.setFloorPublishVer(ObjectUtils.isEmpty(sceneProEdit.getFloorPublishVer()) ? 0 : sceneProEdit.getFloorPublishVer() + 1);
             if (cameraType == 14) {
                 //计算成功  激光转台相机 同步 请求
-                fdkkLaserService.syncBuildResult(scenePro.getNum(), scenePro.getDataSource(),scenePro.getCreateTime(), Calendar.getInstance().getTime(), scenePro.getShootCount(), scenePro.getPayStatus());
+                fdkkLaserService.syncBuildResult(
+                        SyncLaserResultBean.builder()
+                        .num(sceneCode).dataSource(path)
+                        .sceneStatus(2)
+                        .createTime(scenePro.getCreateTime())
+                        .shootCount(scenePro.getShootCount())
+                        .payStatus(scenePro.getPayStatus())
+                        .mixture(0)
+                        .version(SceneVersionType.V3.code()).build());
                 sceneProEdit.setMapVisi(0);
             }
             sceneProEditService.updateById(sceneProEdit);
@@ -296,7 +308,7 @@ public class BuildV3SceneServiceImpl implements IBuildSceneService {
 
             //国际环境需要发邮件通知
             if("eur".equals(env)){
-                commonService.sendEmail(sceneCode);
+                commonService.sendEmail(sceneCode, "standar");
             }
 
         }catch (Exception e){

+ 23 - 0
src/main/java/com/fdkankan/contro/service/IAppCameraFailLogService.java

@@ -0,0 +1,23 @@
+package com.fdkankan.contro.service;
+
+import com.fdkankan.contro.entity.AppCameraFailLog;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.fdkankan.contro.vo.ReportFailLogVO;
+import org.springframework.web.bind.annotation.RequestBody;
+
+import javax.validation.Valid;
+
+/**
+ * <p>
+ * app错误上报 服务类
+ * </p>
+ *
+ * @author
+ * @since 2024-05-20
+ */
+public interface IAppCameraFailLogService extends IService<AppCameraFailLog> {
+
+    void reportFailLog(ReportFailLogVO param);
+
+
+}

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

@@ -12,6 +12,8 @@ public interface IBuildSceneDTService {
 
     void handModelFail(String reason, String serverPath, String num, String hostName);
 
+    void handModelFail(String reason, String serverPath, String num, String hostName, String logUrl);
+
     void handBaseFail(String reason, String serverPath, String num, String hostName);
 
 }

+ 10 - 2
src/main/java/com/fdkankan/contro/service/ICommonService.java

@@ -30,7 +30,7 @@ public interface ICommonService {
 
     public void uploadFloorplanJson(String num, String dataSource) throws Exception;
 
-    public void sendEmail(String num);
+    public void sendEmail(String num, String type);
 
     String getOssOrignPath(String path);
 
@@ -44,10 +44,18 @@ public interface ICommonService {
 
     Object[] updateEditInfo(ScenePlus scenePlus);
 
-    void writeSceneJson(String num, JSONObject videosJson, SceneEditInfo sceneEditInfo, SceneEditInfoExt sceneEditInfoExt,
+    void writeSceneJson(String num, SceneEditInfo sceneEditInfo, SceneEditInfoExt sceneEditInfoExt,
                         SceneEditControls sceneEditControls, ScenePlus scenePlus, ScenePlusExt scenePlusExt, Company company);
 
     void saveMqSendLog(String num, BuildSceneCallMessage message);
 
     void sendUpdateSceneStatusMqToQueues(Map<String, Object> content);
+
+    void removeSceneAsynOperLog(String num);
+
+    JSONObject getVideosJson(String path, Integer videoVersion, String projectNum, int cameraType);
+
+    JSONObject getFdageData(String path);
+
+    Map<String, String> getUploadFiles(ScenePlus scenePlus,String path,Integer cameraType,JSONObject fdageData) throws Exception;
 }

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

@@ -1,6 +1,7 @@
 package com.fdkankan.contro.service;
 
 import com.alibaba.fastjson.JSONObject;
+import com.fdkankan.contro.bean.SyncLaserResultBean;
 import com.fdkankan.contro.entity.Camera;
 import com.fdkankan.contro.entity.ScenePlus;
 import com.fdkankan.contro.entity.ScenePlusExt;
@@ -17,7 +18,7 @@ import java.util.Date;
  * @since 2022/1/14
  **/
 public interface IFdkkLaserService {
-    void syncBuildResult(String sceneNum, String dataSource, Date createTime, Date algorithmTime, Integer shootCount, Integer payStatus);
+    void syncBuildResult(SyncLaserResultBean laserResultBean);
 
     void pushBuildStatusToLaserSystem(String projectNum, String laserObjFilePath, Integer buildObjStatus);
 

+ 7 - 0
src/main/java/com/fdkankan/contro/service/IInnerService.java

@@ -0,0 +1,7 @@
+package com.fdkankan.contro.service;
+
+public interface IInnerService {
+
+    void uploadArtificialResult(String num) throws Exception;
+
+}

+ 3 - 3
src/main/java/com/fdkankan/contro/service/ISceneBuildProcessLogService.java

@@ -8,13 +8,13 @@ import com.baomidou.mybatisplus.extension.service.IService;
  * 场景计算流程状态表 服务类
  * </p>
  *
- * @author 
+ * @author
  * @since 2023-01-28
  */
 public interface ISceneBuildProcessLogService extends IService<SceneBuildProcessLog> {
 
-    public void clearSceneBuildProcessLog(String num, String process, String queueName);
+    public void clearSceneBuildProcessLog(String num, String process, String queueName, String bizType);
 
-    public void saveSceneBuildProcessLog(String num, String process, String queueName, int status, String reason);
+    public void saveSceneBuildProcessLog(String num, String process, String queueName, int status, String reason, String bizType);
 
 }

+ 3 - 1
src/main/java/com/fdkankan/contro/service/ISceneFileBuildService.java

@@ -26,9 +26,11 @@ public interface ISceneFileBuildService extends IService<SceneFileBuild> {
 
     ResultData turntableUploadSuccess(String params) throws Exception;
 
-    ResultData rebuildScene(String num,Boolean force,Boolean deleteExtras) throws IOException;
+    ResultData rebuildScene(String num,Boolean force,Boolean deleteExtras, String from) throws IOException;
 
     ResultData copyDataAndBuild(String sourceBucet,String dataSource,String sceneVer) throws Exception;
 
     ResultData uploadFile(MultipartFile file, String params) throws Exception;
+
+    ResultData uploadLiguang(String num, String snCode, String ossPath) throws Exception;
 }

+ 16 - 0
src/main/java/com/fdkankan/contro/service/ISceneRebuildLogService.java

@@ -0,0 +1,16 @@
+package com.fdkankan.contro.service;
+
+import com.fdkankan.contro.entity.SceneRebuildLog;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 场景重算接口调用日志表 服务类
+ * </p>
+ *
+ * @author 
+ * @since 2024-05-17
+ */
+public interface ISceneRebuildLogService extends IService<SceneRebuildLog> {
+
+}

+ 27 - 0
src/main/java/com/fdkankan/contro/service/ISceneUploadCountService.java

@@ -0,0 +1,27 @@
+package com.fdkankan.contro.service;
+
+import com.fdkankan.contro.entity.SceneUploadCount;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.fdkankan.contro.vo.SceneUploadCountParamVO;
+import org.springframework.web.bind.annotation.RequestBody;
+
+import javax.validation.Valid;
+
+/**
+ * <p>
+ * app触发场景上传统计表 服务类
+ * </p>
+ *
+ * @author
+ * @since 2024-05-20
+ */
+public interface ISceneUploadCountService extends IService<SceneUploadCount> {
+
+    void increSceneUploadCount(SceneUploadCountParamVO param);
+
+    void resetCountByUuid(String uuid);
+
+    SceneUploadCount getByUUid(String uuid);
+
+
+}

+ 7 - 0
src/main/java/com/fdkankan/contro/service/IWbService.java

@@ -0,0 +1,7 @@
+package com.fdkankan.contro.service;
+
+public interface IWbService {
+
+    void sendMq(String num, Integer status);
+
+}

+ 27 - 0
src/main/java/com/fdkankan/contro/service/impl/AppCameraFailLogServiceImpl.java

@@ -0,0 +1,27 @@
+package com.fdkankan.contro.service.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import com.fdkankan.contro.entity.AppCameraFailLog;
+import com.fdkankan.contro.mapper.IAppCameraFailLogMapper;
+import com.fdkankan.contro.service.IAppCameraFailLogService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fdkankan.contro.vo.ReportFailLogVO;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * app错误上报 服务实现类
+ * </p>
+ *
+ * @author
+ * @since 2024-05-20
+ */
+@Service
+public class AppCameraFailLogServiceImpl extends ServiceImpl<IAppCameraFailLogMapper, AppCameraFailLog> implements IAppCameraFailLogService {
+
+    @Override
+    public void reportFailLog(ReportFailLogVO param) {
+        AppCameraFailLog bean = BeanUtil.toBean(param, AppCameraFailLog.class);
+        this.save(bean);
+    }
+}

+ 280 - 9
src/main/java/com/fdkankan/contro/service/impl/CommonServiceImpl.java

@@ -3,17 +3,16 @@ package com.fdkankan.contro.service.impl;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.util.ZipUtil;
 import cn.hutool.http.HttpUtil;
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.fdkankan.common.constant.*;
 import com.fdkankan.common.util.FileUtils;
 import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.fdkankan.common.constant.CommonStatus;
-import com.fdkankan.common.constant.PayStatus;
-import com.fdkankan.common.constant.SceneStatus;
-import com.fdkankan.common.constant.SpaceType;
 import com.fdkankan.common.util.FileUtils;
 import com.fdkankan.contro.bean.SceneJsonBean;
 import com.fdkankan.contro.entity.*;
@@ -25,8 +24,10 @@ import com.fdkankan.contro.vo.SceneEditControlsVO;
 import com.fdkankan.contro.vo.ScenePlusVO;
 import com.fdkankan.fyun.config.FYunFileConfig;
 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.CreateObjUtil;
 import com.fdkankan.model.utils.FloorPlanUserUtil;
 import com.fdkankan.rabbitmq.bean.BuildSceneCallMessage;
 import com.fdkankan.rabbitmq.util.RabbitMqProducer;
@@ -35,6 +36,7 @@ import com.fdkankan.redis.util.RedisUtil;
 import com.fdkankan.sms.SendMailAcceUtils;
 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.cloud.context.config.annotation.RefreshScope;
@@ -42,6 +44,8 @@ import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.io.File;
+import java.io.IOException;
+import java.security.GeneralSecurityException;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -49,14 +53,15 @@ import java.util.Objects;
 import java.util.Set;
 import java.util.Objects;
 import java.util.*;
+import java.util.stream.Collectors;
 
 @Slf4j
 @Service
 @RefreshScope
 public class CommonServiceImpl implements ICommonService {
 
-    @Value("${main.url}")
-    private String mainUrl;
+    @Value("${main.laserUrl:#{null}}")
+    private String laserUrl;
 
     @Value("${env:gn}")
     private String env;
@@ -70,7 +75,14 @@ public class CommonServiceImpl implements ICommonService {
     @Value("#{'${camType.laser:}'.split(',')}")
     private List<Integer> laserCamTypeList;
 
+    @Value("${model.modelKind:3dtiles}")
+    private String modelKind;
 
+    @Value("#{'${model.3dtiles.sceneSource:}'.split(',')}")
+    private List<Integer> sdTilesSceneSourceList;
+
+    @Autowired
+    private ISceneAsynOperLogService sceneAsynOperLogService;
     @Resource
     private FYunFileServiceInterface fYunFileServiceInterface;
     @Autowired
@@ -240,11 +252,12 @@ public class CommonServiceImpl implements ICommonService {
     }
 
     @Override
-    public void sendEmail(String num) {
+    public void sendEmail(String num, String type) {
         try {
             Long userId = null;
             String websize = "";
             String title = "";
+            Integer sceneSource = null;
             ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
             if(Objects.isNull(scenePlus)){
                 ScenePro scenePro = sceneProService.getByNum(num);
@@ -254,11 +267,13 @@ public class CommonServiceImpl implements ICommonService {
                 userId = scenePro.getUserId();
                 websize = scenePro.getWebSite();
                 title = scenePro.getSceneName();
+                sceneSource = scenePro.getSceneSource();
             }else{
                 userId = scenePlus.getUserId();
                 ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
                 websize = scenePlusExt.getWebSite();
                 title = scenePlus.getTitle();
+                sceneSource = scenePlus.getSceneSource();
             }
 
             if(Objects.isNull(userId)){
@@ -276,6 +291,10 @@ public class CommonServiceImpl implements ICommonService {
                 helpLink = helpLinkZh;
             }
             websize += "&lang=" + lang;
+            if(("standar".equals(type))
+                    && (sceneSource == SceneSource.JG.code() || sceneSource == SceneSource.SG.code())){
+                websize = String.format(laserUrl, num, lang);
+            }
 
             MailTemplate mailTemplate = mailTemplateService.getOne(new LambdaQueryWrapper<MailTemplate>().eq(MailTemplate::getRemark, "计算完成").eq(MailTemplate::getLang, lang));
             String content = mailTemplate.getMsg().replaceAll("scene_name", title).replaceAll("scene_link", websize).replaceAll("help_link", helpLink);
@@ -285,6 +304,22 @@ public class CommonServiceImpl implements ICommonService {
         }
     }
 
+    public static void main(String[] args) throws GeneralSecurityException {
+        String content  = "<p>Dear Valued Customer,&nbsp;</p>\n" +
+                "<p>&nbsp;</p>\n" +
+                "<p>The scene \"scene_name\" has been successfully calculated, please review the following:&nbsp;<a href=\"scene_link\" target=\"_blank\" rel=\"noopener\">scene_link</a>&nbsp;</p>\n" +
+                "<p>&nbsp;</p>\n" +
+                "<p>If you need to edit the scene, the User Manual can provide instructions: <a href=\"help_link\" target=\"_blank\" rel=\"noopener\">help_link</a>&nbsp;</p>\n" +
+                "<p>&nbsp;</p>\n" +
+                "<p>Sincerely,&nbsp;</p>\n" +
+                "<p>4Dage Support Team</p>\n" +
+                "<p>&nbsp;</p>\n" +
+                "<p>------------------</p>\n" +
+                "<p><img src=\"http://4dkk.4dage.com/ucenter/image/4dkankan_en.png\" /></p>\n" +
+                "<p><br /><strong><em>Web:</em></strong><a href=\"http://eur.4dkankan.com/\" target=\"_blank\" rel=\"noopener\">eur.4dkankan.com</a></p>";
+        SendMailAcceUtils.sendMail("4Dkankan@4dage.com", "6996790AAaa", "smtp.exmail.qq.com", "qinyongcheng@cgaii.com", "The Scene Calculation is Now Complete.", content, null);
+    }
+
     public String getOssOrignPath(String path) {
         String ossPath = ConstantFilePath.OSS_PREFIX
                 + path.replace(ConstantFilePath.BUILD_MODEL_PATH, "")
@@ -426,7 +461,7 @@ public class CommonServiceImpl implements ICommonService {
         return new Object[]{sceneEditInfo, sceneEditInfoExt, sceneEditControls};
     }
 
-    public void writeSceneJson(String num, JSONObject videosJson, SceneEditInfo sceneEditInfo, SceneEditInfoExt sceneEditInfoExt,
+    public void writeSceneJson(String num, SceneEditInfo sceneEditInfo, SceneEditInfoExt sceneEditInfoExt,
                                 SceneEditControls sceneEditControls, ScenePlus scenePlus, ScenePlusExt scenePlusExt,Company company){
         String dataViewPath = String.format(UploadFilePath.DATA_VIEW_PATH, num);
 
@@ -445,7 +480,7 @@ public class CommonServiceImpl implements ICommonService {
         sceneJson.setSceneFrom(scenePlusExt.getSceneFrom());
         sceneJson.setSceneKind(scenePlusExt.getSceneKind());
         sceneJson.setModelKind(scenePlusExt.getModelKind());
-        sceneJson.setVideos(JSON.toJSONString(videosJson));
+        sceneJson.setVideos(scenePlusExt.getVideos());
         sceneJson.setPayStatus(scenePlus.getPayStatus());
         if(StrUtil.isNotEmpty(oldSceneJson)){
             SceneJsonBean oldSceneJsonBean = JSON.parseObject(oldSceneJson, SceneJsonBean.class);
@@ -516,4 +551,240 @@ public class CommonServiceImpl implements ICommonService {
             rabbitMqProducer.sendByWorkQueue(config.getQueueName(), content);
         }
     }
+
+    @Override
+    public void removeSceneAsynOperLog(String num) {
+        List<SceneAsynOperLog> list = sceneAsynOperLogService.list(new LambdaQueryWrapper<SceneAsynOperLog>().eq(SceneAsynOperLog::getNum, num));
+        if(CollUtil.isEmpty(list)){
+            return;
+        }
+        //删除数据库记录
+        List<Long> deleteIdList = list.parallelStream().map(item -> item.getId()).collect(Collectors.toList());
+        sceneAsynOperLogService.removeByIds(deleteIdList);
+
+        list.parallelStream().forEach(item -> {
+            if(StrUtil.isNotEmpty(item.getUrl())){
+                try {
+                    fYunFileServiceInterface.deleteFile(item.getUrl());
+                } catch (IOException e) {
+                    log.warn("删除oss全景图下载压缩包失败,key:{}", item.getUrl());
+                }
+            }
+        });
+    }
+
+    public JSONObject getVideosJson(String path, Integer videoVersion, String projectNum, int cameraType){
+        //读取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(UploadFilePath.DATA_VIEW_PATH, projectNum) + "Up.xml");
+            if(cameraType == 13 || cameraType == 14){
+                //转台相机
+                videosJson.put("upPath", videosJson.getString("upPath").replace(".xml", ".txt"));
+            }
+        }else {
+            videosJson.put("version", 1);
+            videosJson.put("upPath", fYunFileConfig.getHost() + String.format(UploadFilePath.DATA_VIEW_PATH, projectNum) + "Up2.xml");
+            if(cameraType == 13 || cameraType == 14){
+                //转台相机
+                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(UploadFilePath.DATA_VIEW_PATH, projectNum) + "stitch_params.txt");
+        }
+
+        return videosJson;
+    }
+
+    @Override
+    public 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;
+    }
+
+    @Override
+    public Map<String, String> getUploadFiles(ScenePlus scenePlus,String path,Integer cameraType,JSONObject fdageData) throws Exception {
+        if (ObjectUtils.isEmpty(scenePlus)) {
+            throw new Exception("未找到场景信息:" + path);
+        }
+
+        String projectNum = scenePlus.getNum();
+
+        String dataViewPath = String.format(UploadFilePath.DATA_VIEW_PATH, projectNum);
+        String imagesPath = String.format(UploadFilePath.IMG_VIEW_PATH, projectNum);
+        String videoPath = String.format(UploadFilePath.VIDEOS_VIEW_PATH, 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 updown = FileUtils.readFile(filePath);
+                JSONObject updownJson = JSONObject.parseObject(updown);
+                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);
+                }
+            }
+        }
+
+        //exportMeshObj这个是字段由app写入的
+        boolean genModel = true;//是否生成模型 默认生成,深时场景要根据 exportMeshObj判断是否生成
+        if(!ObjectUtils.isEmpty(cameraType)
+                && cameraType == 14
+                && (!fdageData.containsKey("exportMeshObj") || fdageData.getIntValue("exportMeshObj") != 1)){
+            genModel = false;
+        }
+        boolean gen3dTiles = true;//是否生成3dtiles模型 默认生成
+        if(!ModelKind.THREE_D_TILE.code().equals(modelKind)
+                || CollUtil.isEmpty(sdTilesSceneSourceList)
+                || !sdTilesSceneSourceList.contains(scenePlus.getSceneSource())){
+            gen3dTiles = false;
+        }
+
+        if(genModel){
+            if (!gen3dTiles) {
+                String damPath = path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam";
+                CreateObjUtil.convertTxtToDam(path + File.separator + "results" + File.separator + "tex" + File.separator + "modeldata.txt", damPath);
+                FileUtil.writeBytes(ZipUtil.gzip(new File(damPath)), damPath);
+                map.put(damPath, imagesPath + ConstantFileName.modelUUID + "_50k.dam");
+            }else{
+                List<String> list = FileUtils.list(new File(path + File.separator + "results" + File.separator + ModelKind.THREE_D_TILE.code()));
+                if(CollUtil.isEmpty(list)){
+                    log.error("3dtiles目录异常,3dtiles地址:{}", new File(path + File.separator + "results" + File.separator + ModelKind.THREE_D_TILE.code()));
+                    throw new Exception("3dtiles目录异常");
+                }
+                list.stream().forEach(str->{
+                    map.put(str, str.replace(path + File.separator + "results" + File.separator, imagesPath));
+                });
+            }
+        }
+
+        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);
+        if(!new File("/mnt/4Dkankan/scene/data" + File.separator + "data" + projectNum).exists()){
+            FileUtil.mkdir("/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;
+
+    }
 }

+ 40 - 24
src/main/java/com/fdkankan/contro/service/impl/IFdkkLaserServiceImpl.java

@@ -2,13 +2,17 @@ package com.fdkankan.contro.service.impl;
 
 import cn.hutool.core.io.FileUtil;
 import com.alibaba.fastjson.JSONObject;
+import com.fdkankan.common.constant.CommonStatus;
+import com.fdkankan.common.constant.SceneVersionType;
 import com.fdkankan.common.util.DateUtil;
 import com.fdkankan.common.util.FileUtils;
+import com.fdkankan.contro.bean.SyncLaserResultBean;
 import com.fdkankan.contro.entity.Camera;
 import com.fdkankan.contro.entity.ScenePlus;
 import com.fdkankan.contro.entity.ScenePlusExt;
 import com.fdkankan.contro.entity.ScenePro;
 import com.fdkankan.contro.service.IFdkkLaserService;
+import com.fdkankan.contro.service.IScenePlusExtService;
 import com.fdkankan.contro.service.IScenePlusService;
 import com.fdkankan.contro.service.ISceneProService;
 import com.fdkankan.fyun.face.FYunFileServiceInterface;
@@ -16,18 +20,18 @@ import com.fdkankan.rabbitmq.util.RabbitMqProducer;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.cloud.context.config.annotation.RefreshScope;
 import org.springframework.stereotype.Service;
 import org.springframework.util.ObjectUtils;
 
+import javax.annotation.Resource;
 import java.io.File;
 import java.io.IOException;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Objects;
+import java.util.*;
 
 @Service
 @Slf4j
+@RefreshScope
 public class IFdkkLaserServiceImpl implements IFdkkLaserService {
 
     @Autowired
@@ -35,6 +39,8 @@ public class IFdkkLaserServiceImpl implements IFdkkLaserService {
 
     @Autowired
     private IScenePlusService scenePlusService;
+    @Autowired
+    private IScenePlusExtService scenePlusExtService;
 
     @Autowired
     private RabbitMqProducer rabbitMqProducer;
@@ -42,6 +48,9 @@ public class IFdkkLaserServiceImpl implements IFdkkLaserService {
     @Value("${queue.application.laser.update-scene}")
     private String updateScene;
 
+    @Value("${queue.application.laser.init-scene:laser-init-scene}")
+    private String initScene;
+
     @Value("${queue.application.laser.update-build-status}")
     private String updateBuildStatus;
 
@@ -54,28 +63,22 @@ public class IFdkkLaserServiceImpl implements IFdkkLaserService {
     @Value("${4dkk.laserService.cloud-point-fyun-path}")
     private String cloudPointFyunPath;
 
-    @Autowired
+    @Resource
     private FYunFileServiceInterface fYunFileService;
 
 
-    public void updateSceneStatus(String sceneCode, int sceneStatus, String path, Date createTime, Date algorithmTime, Integer shootCount, Integer payStatus) {
-        Map<String, Object> params = new HashMap<>();
-        params.put("sceneCode", sceneCode);
-        params.put("status", sceneStatus);
-        params.put("version",getSceneVersion(sceneCode));
-        params.put("createTime", DateUtil.date2String(createTime, null));
-        params.put("algorithmTime", DateUtil.date2String(algorithmTime, null));
-        if (!ObjectUtils.isEmpty(path)) {
-            params.put("path", path);
-        }
-        params.put("shootCount", shootCount);
-        params.put("payStatus", payStatus);
-        rabbitMqProducer.sendByWorkQueue(updateScene, params);
-    }
-
-    public void syncBuildResult(String sceneNum, String dataSource,Date createTime, Date algorithmTime, Integer shootCount, Integer payStatus) {
+    public void syncBuildResult(SyncLaserResultBean laserResultBean) {
         log.info("激光转台相机构建结果 同步 请求 ");
         try {
+            String num = laserResultBean.getNum();
+            String dataSource = laserResultBean.getDataSource();
+            Integer sceneStatus = laserResultBean.getSceneStatus();
+            Date createTime = laserResultBean.getCreateTime();
+            Integer shootCount = laserResultBean.getShootCount();
+            Integer payStatus = laserResultBean.getPayStatus();
+            Boolean mixture = laserResultBean.getMixture() == CommonStatus.NO.code().intValue() ? false : true;
+            String version = SceneVersionType.V4.code();
+
             String jgPath = dataSource;
             //创建目录
             if (dataSource.lastIndexOf("/") != -1) {
@@ -105,7 +108,19 @@ public class IFdkkLaserServiceImpl implements IFdkkLaserService {
             }
             FileUtils.copyFile(dataSource + "/results/laserData", jgPath, true);
 
-            updateSceneStatus(sceneNum, 2, jgPath + File.separator + "laserData",createTime, algorithmTime, shootCount, payStatus);
+//            updateSceneStatus(scenePlus, scenePlusExt, jgPath + File.separator + "laserData",createTime, algorithmTime, scenePlusExt);
+
+            Map<String, Object> params = new HashMap<>();
+            params.put("sceneCode", num);
+            params.put("status", sceneStatus);
+            params.put("version",version);
+            params.put("createTime", DateUtil.date2String(createTime, null));
+            params.put("algorithmTime", DateUtil.date2String(Calendar.getInstance().getTime(), null));
+            params.put("path", jgPath + File.separator + "laserData");
+            params.put("shootCount", shootCount);
+            params.put("payStatus", payStatus);
+            params.put("mixture", mixture);
+            rabbitMqProducer.sendByWorkQueue(updateScene, params);
         } catch (Exception e) {
             log.error("激光转台相机同步失败", e);
         }
@@ -144,7 +159,7 @@ public class IFdkkLaserServiceImpl implements IFdkkLaserService {
             params.put("location", fdageJson.getInteger("location"));
         }
         params.put("payStatus", payStatus);
-        rabbitMqProducer.sendByWorkQueue(updateScene, params);
+        rabbitMqProducer.sendByWorkQueue(initScene, params);
     }
 
     public void saveScene(ScenePro scenePro, String scenePassword, Camera cameraEntity, String phone, boolean rebuild, Integer payStatus) {
@@ -167,7 +182,7 @@ public class IFdkkLaserServiceImpl implements IFdkkLaserService {
         params.put("title", scenePro.getSceneName());
         params.put("userId", scenePro.getUserId());
         params.put("payStatus", payStatus);
-        rabbitMqProducer.sendByWorkQueue(updateScene, params);
+        rabbitMqProducer.sendByWorkQueue(initScene, params);
     }
 
     private String getSceneVersion(String num) {
@@ -195,6 +210,7 @@ public class IFdkkLaserServiceImpl implements IFdkkLaserService {
         }
 
         // 上传点云编辑文件,并通知激光系统
+        log.info("开始上传点云文件,bucket:{}", bucket);
         fYunFileService.uploadFile(bucket,path + "/results/laserData/vision_edit.txt", String.format(cloudPointFyunPath,sceneCode,sceneCode) + "vision_edit.txt");
         fYunFileService.uploadFileByCommand(bucket,path + "/results/laserData/uuidcloud", String.format(cloudPointFyunPath,sceneCode,sceneCode) + "uuidcloud");
 

+ 339 - 0
src/main/java/com/fdkankan/contro/service/impl/InnerServiceImpl.java

@@ -0,0 +1,339 @@
+package com.fdkankan.contro.service.impl;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.io.FileUtil;
+import cn.hutool.http.ContentType;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.fdkankan.common.constant.*;
+import com.fdkankan.common.exception.BusinessException;
+import com.fdkankan.common.util.FileUtils;
+import com.fdkankan.contro.bean.SyncLaserResultBean;
+import com.fdkankan.contro.constant.UserEditDataType;
+import com.fdkankan.contro.entity.*;
+import com.fdkankan.contro.service.*;
+import com.fdkankan.fyun.config.FYunFileConfig;
+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.enums.ModelTypeEnums;
+import com.fdkankan.model.utils.CreateHouseJsonUtil;
+import com.fdkankan.model.utils.SceneUtil;
+import org.apache.commons.lang3.ObjectUtils;
+import org.apache.http.HttpHeaders;
+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.io.File;
+import java.io.IOException;
+import java.util.*;
+
+@Service
+public class InnerServiceImpl implements IInnerService {
+
+    @Value("${model.type:#{null}}")
+    private String modelType;
+
+    @Autowired
+    private IScenePlusService scenePlusService;
+    @Autowired
+    private IScenePlusExtService scenePlusExtService;
+    @Autowired
+    private ICommonService commonService;
+    @Resource
+    private FYunFileServiceInterface fYunFileService;
+    @Autowired
+    private IFdkkLaserService fdkkLaserService;
+    @Autowired
+    private ICameraDetailService cameraDetailService;
+    @Autowired
+    private ICompanyService companyService;
+    @Resource
+    private FYunFileConfig fYunFileConfig;
+
+    @Override
+    public void uploadArtificialResult(String num) throws Exception {
+
+        ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
+        if(Objects.isNull(scenePlus)){
+            throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
+        }
+        ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
+
+        String path = scenePlusExt.getDataSource();
+
+        JSONObject fdageData = commonService.getFdageData(path + File.separator + "capture" +File.separator+"data.fdage");
+
+        Integer cameraType = 10;
+        if(scenePlus.getSceneSource() == SceneSource.ZT.code()){
+            cameraType = 13;
+        }else{
+            cameraType = 14;
+        }
+
+        Map<String, String> uploadFiles = commonService.getUploadFiles(scenePlus,path,cameraType,fdageData);
+
+        scenePlus.setPayStatus(PayStatus.PAY.code());
+        scenePlus.setUpdateTime(new Date());
+        scenePlus.setSceneStatus(SceneStatus.NO_DISPLAY.code());
+
+        Integer videoVersion = fdageData.getInteger("videoVersion");
+        //读取计算结果文件生成videosJson
+        JSONObject videosJson = commonService.getVideosJson(path, videoVersion, num, cameraType);
+
+        boolean isObj = fdageData.containsKey("exportMeshObj") && fdageData.getIntValue("exportMeshObj") == 1;
+
+        //上传全景图俯视图
+        this.uploadFloorCad(path, num, uploadFiles);
+
+        //由于3dtiles算法mesh文件发生变化,所以这里需要先清除一下oss的mesh目录,避免存在旧算法obj文件
+        fYunFileService.deleteFolder(String.format(UploadFilePath.DATA_VIEW_PATH, num) + "mesh");
+        fYunFileService.deleteFolder(String.format(UploadFilePath.IMG_VIEW_PATH,  num) + ModelKind.THREE_D_TILE.code());
+        //上传文件
+        fYunFileService.uploadMulFiles(uploadFiles);
+
+        //修改oss上dam的内容编码
+        Map<String,String> damFileHeaders = new HashMap<>();
+        damFileHeaders.put("Content-Encoding","gzip");
+        String damPath = path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam";
+        fYunFileService.uploadFile(damPath,  String.format(UploadFilePath.IMG_VIEW_PATH, num) + ConstantFileName.modelUUID + "_50k.dam", damFileHeaders);
+
+        //拷贝部分文件到编辑目录,用于用户编辑
+        this.copyToEditDir(num);
+
+        //计算完毕后,同步全景图到缓存目录
+//            this.cachePanorama(path, sceneCode);
+
+        //生成houseTypejson并上传
+        boolean existHouseType = this.uploadHouseTypeJson(num, path);
+        scenePlus.setHouseType(existHouseType ? CommonStatus.YES.code().intValue() : CommonStatus.NO.code().intValue());
+
+        //生成floorpan.json
+        commonService.uploadFloorplanJson(num, path);
+
+        //重置异步操作记录
+        commonService.removeSceneAsynOperLog(num);
+
+        //清除用户编辑业务数据
+        Set<String> bizs = new HashSet<>();
+        bizs.add(UserEditDataType.BOX_MODEL.message());
+        bizs.add(UserEditDataType.FLOORPLAN.message());
+        bizs.add(UserEditDataType.FILTERS.message());
+        commonService.initUserEditData(num, bizs, null);
+
+        //上传计算结果文件
+        commonService.uploadBuildResultData(num, path, SceneVersionType.V4.code());
+
+        //容量统计
+        Long space = commonService.getSpace(num);
+
+        //写入数据库
+        this.updateDbPlus(scenePlus.getSceneSource(), space, videosJson.toJSONString(), 0L,isObj,scenePlusExt);
+
+        Object[] editInfoArr = commonService.updateEditInfo(scenePlus);
+        SceneEditInfo sceneEditInfo = (SceneEditInfo)editInfoArr[0];
+        SceneEditInfoExt sceneEditInfoExt = (SceneEditInfoExt)editInfoArr[1];
+        SceneEditControls sceneEditControls = (SceneEditControls)editInfoArr[2];
+
+        //更新场景主表
+        //如果相机容量不足,需要把场景的paystatus改为容量不足状态
+        scenePlus.setPayStatus(commonService.getPayStatus(scenePlus.getCameraId(), space));
+        //统计原始资源大小
+        scenePlusExt.setOrigSpace(FileUtil.size(new File(path.concat(File.separator).concat("capture"))));
+
+        if (cameraType == 14) {
+            //计算成功  激光转台相机 同步 请求
+            fdkkLaserService.syncBuildResult(
+                    SyncLaserResultBean.builder()
+                            .num(num).dataSource(path)
+                            .sceneStatus(2)
+                            .createTime(scenePlus.getCreateTime())
+                            .shootCount(scenePlusExt.getShootCount())
+                            .payStatus(scenePlus.getPayStatus())
+                            .mixture(scenePlusExt.getMixture())
+                            .version(SceneVersionType.V4.code()).build());
+            sceneEditControls.setShowMap(0);
+        } else if (new File(path + "/results/laserData/vision_edit.txt").exists()) {
+            fdkkLaserService.cloudPointBuild(num,path);
+        }
+
+
+        CameraDetail cameraDetail = cameraDetailService.getByCameraId(scenePlus.getCameraId());
+        Company company = !ObjectUtils.isEmpty(cameraDetail.getCompanyId()) ? companyService.getById(cameraDetail.getCompanyId()) : null;
+        //写scene.json
+        commonService.writeSceneJson(num,sceneEditInfo, sceneEditInfoExt, sceneEditControls, scenePlus,scenePlusExt,company);
+
+        this.uploadStatusJson(scenePlus, scenePlusExt);
+
+        scenePlusService.updateById(scenePlus);
+        scenePlusExtService.updateById(scenePlusExt);
+    }
+
+    private void uploadStatusJson(ScenePlus scenePlus, ScenePlusExt scenePlusExt){
+        String num = scenePlus.getNum();
+        String dataViewPath = String.format(UploadFilePath.DATA_VIEW_PATH, num);
+
+        Integer status = 1;
+        if(scenePlus.getSceneSource() == 4 || scenePlus.getSceneSource() == 5){//如果是激光场景,需要激光系统那边完全处理好之后再发mq通知更新状态
+            status = 0;
+        }
+
+        // 上传status JSON.
+        JSONObject statusJson = new JSONObject();
+        //临时将-2改成1,app还没完全更新
+        statusJson.put("status", status);
+        statusJson.put("webSite", scenePlusExt.getWebSite());
+        statusJson.put("sceneNum", num);
+        statusJson.put("thumb", scenePlusExt.getThumb());
+        statusJson.put("payStatus", scenePlus.getPayStatus());
+        statusJson.put("sceneScheme", scenePlusExt.getSceneScheme());
+        FileUtils.writeFile(ConstantFilePath.SCENE_PATH + "data/data" + num + File.separator + "status.json", statusJson.toString());
+
+        Map<String,String> headers = new HashMap<>();
+        headers.put(HttpHeaders.CONTENT_TYPE, ContentType.JSON.getValue());
+        fYunFileService.uploadFile(ConstantFilePath.SCENE_PATH + "data/data" + num + File.separator + "status.json", dataViewPath + "status.json", headers);
+    }
+
+    private void uploadFloorCad(String path, String num, Map<String, String> uploadFiles){
+
+        //户型图上传
+        String  dataViewPath = UploadFilePath.DATA_VIEW_PATH + "floor-cad-%s.%s";
+        String floorCadPath = path + "/results/floorplan_cad";
+        List<String> floorCadList = FileUtils.getFileList(floorCadPath);
+        if(CollUtil.isNotEmpty(floorCadList)){
+            floorCadList.stream().forEach(str->{
+                String substring = str.substring(str.lastIndexOf(File.separator) + 1);
+                String[] arr = substring.split("floor");
+                String[] arr2 = arr[1].split("\\.");
+                uploadFiles.put(str, String.format(dataViewPath, num, arr2[0], arr2[1]));
+            });
+        }
+
+    }
+
+    private void copyToEditDir(String num) throws IOException {
+
+        String editImagesPath = String.format(UploadFilePath.IMG_EDIT_PATH, num);
+        String viewImagesPath = String.format(UploadFilePath.IMG_VIEW_PATH, num);
+
+        String editDataPath = String.format(UploadFilePath.DATA_EDIT_PATH, num);
+        String viewDataPath = String.format(UploadFilePath.DATA_VIEW_PATH, num);
+
+        Map<String, String> map = new HashMap<>();
+        map.put(editImagesPath + "vision.modeldata", viewImagesPath + "vision.modeldata");
+        map.put(editImagesPath + "vision2.modeldata", viewImagesPath + "vision2.modeldata");
+        map.put(editDataPath + "floorplan_cad.json", viewDataPath + "floorplan_cad.json");
+
+        for (Map.Entry<String, String> entry : map.entrySet()) {
+            fYunFileService.copyFileInBucket(entry.getValue(), entry.getKey());
+        }
+    }
+
+    public boolean uploadHouseTypeJson(String num, String dataSource) {
+        String floorPlanCardFilePath = dataSource + File.separator + "results/floorplan_cad.json";
+        if (!new File(floorPlanCardFilePath).exists()) {
+            return false;
+        }
+        JSONObject json = CreateHouseJsonUtil.createHouseTypeJsonByCad(floorPlanCardFilePath);
+        if(Objects.isNull(json)){
+            return false;
+        }
+        String hourseTypeJsonPath = String.format(UploadFilePath.USER_VIEW_PATH, num) + "houseType.json";
+        fYunFileService.uploadFile(json.toJSONString().getBytes(), hourseTypeJsonPath);
+        hourseTypeJsonPath = String.format(UploadFilePath.USER_EDIT_PATH, num) + "houseType.json";
+        fYunFileService.uploadFile(json.toJSONString().getBytes(), hourseTypeJsonPath);
+
+        return true;
+    }
+
+    private void updateDbPlus(int sceneSource,Long space,String videosJson, Long computeTime,boolean isObj,ScenePlusExt scenePlusExt){
+
+        scenePlusExt.setSpace(space);
+        scenePlusExt.setComputeTime(computeTime.toString());
+        scenePlusExt.setAlgorithmTime(new Date());
+        scenePlusExt.setVideos(videosJson);
+        scenePlusExt.setIsObj(isObj ? 1 : 0);
+
+        if(ModelTypeEnums.TILE_CODE.equals(modelType)){
+            scenePlusExt.setSceneScheme(3);
+        }
+
+        switch (SceneSource.get(sceneSource)){
+            case BM:
+                scenePlusExt.setSceneResolution(SceneResolution.two_K.code());
+                scenePlusExt.setSceneFrom(SceneFrom.PRO.code());
+                break;
+            case SM:
+                scenePlusExt.setSceneResolution(SceneResolution.one_k.code());
+                scenePlusExt.setSceneFrom(SceneFrom.LITE.code());
+                break;
+            case ZT:
+                scenePlusExt.setSceneResolution(SceneResolution.four_K.code());
+                scenePlusExt.setSceneFrom(SceneFrom.MINION.code());
+                break;
+            case JG:
+                scenePlusExt.setSceneResolution(SceneResolution.four_K.code());
+                scenePlusExt.setSceneFrom(SceneFrom.LASER.code());
+                break;
+            case SG:
+                scenePlusExt.setSceneResolution(SceneResolution.four_K.code());
+                scenePlusExt.setSceneFrom(SceneFrom.LASER.code());
+                break;
+        }
+
+        String sceneKind = scenePlusExt.getSceneScheme() == 3 ? SceneKind.FACE.code():SceneKind.TILES.code();
+        scenePlusExt.setSceneKind(sceneKind);
+//        scenePlusExt.setModelKind(modelKind);
+
+        //统计点位数量
+        Map<String, Integer> result = this.getShootCount(scenePlusExt);
+        Integer shootCount = result.get("shootCount");
+        Integer mixture = result.get("mixture");
+        scenePlusExt.setShootCount(shootCount);
+        scenePlusExt.setMixture(mixture);
+
+        scenePlusExtService.updateById(scenePlusExt);
+    }
+
+    private Map<String, Integer> getShootCount(ScenePlusExt scenePlusExt){
+
+        Map<String, Integer> result = new HashMap<>();
+
+        Integer shootCount = 0;
+        Integer mixture = Objects.isNull(scenePlusExt.getMixture()) ? 0 : scenePlusExt.getMixture();
+        String homePath = SceneUtil.getHomePath(scenePlusExt.getDataSource());
+        JSONObject dataFdageObj = JSON.parseObject(fYunFileService.getFileContent(homePath.concat("data.fdage")));
+        if(Objects.nonNull(dataFdageObj)){
+            JSONArray points = dataFdageObj.getJSONArray("points");
+            if(CollUtil.isNotEmpty(points)){
+                shootCount = points.size();
+            }
+        }
+        if(Objects.nonNull(shootCount) && shootCount > 0){
+            if(Objects.nonNull(scenePlusExt.getLocation()) && scenePlusExt.getLocation() == 6){
+                mixture = CommonStatus.YES.code().intValue();
+            }
+        }else{
+            String slamDataStr = fYunFileService.getFileContent(homePath.concat("slam_data.json"));
+            JSONObject slamDataObj = JSON.parseObject(slamDataStr);
+            if(Objects.nonNull(slamDataObj)){
+                JSONArray viewsInfo = slamDataObj.getJSONArray("views_info");
+                if(CollUtil.isNotEmpty(viewsInfo)){
+                    shootCount = viewsInfo.stream().mapToInt(info -> {
+                        return  ((JSONObject) info).getJSONArray("list_pose").size();
+                    }).sum();
+                }
+            }
+            mixture = CommonStatus.NO.code().intValue();
+        }
+
+        result.put("shootCount", shootCount);
+        result.put("mixture", mixture);
+
+        return result;
+    }
+}

+ 43 - 21
src/main/java/com/fdkankan/contro/service/impl/SceneBuildProcessLogServiceImpl.java

@@ -1,12 +1,15 @@
 package com.fdkankan.contro.service.impl;
 
+import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.fdkankan.contro.entity.SceneBuildProcessLog;
 import com.fdkankan.contro.mapper.ISceneBuildProcessLogMapper;
 import com.fdkankan.contro.service.ISceneBuildProcessLogService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 
+import java.util.Date;
 import java.util.Objects;
 
 /**
@@ -14,37 +17,56 @@ import java.util.Objects;
  * 场景计算流程状态表 服务实现类
  * </p>
  *
- * @author 
+ * @author
  * @since 2023-01-28
  */
+@Slf4j
 @Service
 public class SceneBuildProcessLogServiceImpl extends ServiceImpl<ISceneBuildProcessLogMapper, SceneBuildProcessLog> implements ISceneBuildProcessLogService {
 
 
     @Override
-    public void clearSceneBuildProcessLog(String num, String process, String queueName) {
-        this.remove(new LambdaQueryWrapper<SceneBuildProcessLog>()
-                .eq(SceneBuildProcessLog::getNum, num)
-                .eq(SceneBuildProcessLog::getProcess, process)
-                .eq(SceneBuildProcessLog::getQueueName, queueName));
+    public void clearSceneBuildProcessLog(String num, String process, String queueName, String bizType) {
+        try {
+            LambdaQueryWrapper<SceneBuildProcessLog> wrapper = new LambdaQueryWrapper<SceneBuildProcessLog>()
+                    .eq(SceneBuildProcessLog::getNum, num)
+                    .eq(SceneBuildProcessLog::getProcess, process);
+            if(StrUtil.isNotEmpty(bizType)){
+                wrapper.eq(SceneBuildProcessLog::getBizType, bizType);
+            }
+            this.remove(wrapper);
+        }catch (Exception e){
+            log.error("清楚计算流程日志报错", e);
+        }
     }
 
     @Override
-    public void saveSceneBuildProcessLog(String num, String process, String queueName, int status, String reason) {
-
-        SceneBuildProcessLog log = this.getOne(new LambdaQueryWrapper<SceneBuildProcessLog>()
-                .eq(SceneBuildProcessLog::getNum, num)
-                .eq(SceneBuildProcessLog::getProcess,process)
-                .eq(SceneBuildProcessLog::getQueueName, queueName));
-        if(Objects.isNull(log)){
-            log = new SceneBuildProcessLog();
+    public void saveSceneBuildProcessLog(String num, String process, String queueName, int status, String reason, String bizType) {
+        try {
+            LambdaQueryWrapper<SceneBuildProcessLog> wrapper = new LambdaQueryWrapper<SceneBuildProcessLog>()
+                    .eq(SceneBuildProcessLog::getNum, num)
+                    .eq(SceneBuildProcessLog::getProcess, process)
+                    .eq(SceneBuildProcessLog::getQueueName, queueName);
+            if(StrUtil.isNotEmpty(bizType)){
+                wrapper.eq(SceneBuildProcessLog::getBizType, bizType);
+            }
+
+            SceneBuildProcessLog log = this.getOne(wrapper);
+            if(Objects.isNull(log)){
+                log = new SceneBuildProcessLog();
+            }
+            log.setNum(num);
+            log.setProcess(process);
+            log.setProcess(process);
+            log.setQueueName(queueName);
+            log.setState(status);
+            log.setReason(reason);
+            log.setUpdateTime(new Date());
+            log.setBizType(bizType);
+            this.saveOrUpdate(log);
+        }catch (Exception e){
+            log.error("保存计算流程日志报错", e);
         }
-        log.setNum(num);
-        log.setProcess(process);
-        log.setProcess(process);
-        log.setQueueName(queueName);
-        log.setState(status);
-        log.setReason(reason);
-        this.saveOrUpdate(log);
+
     }
 }

+ 184 - 7
src/main/java/com/fdkankan/contro/service/impl/SceneFileBuildServiceImpl.java

@@ -101,6 +101,9 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
     @Value("${queue.modeling.intermit.modeling-pre}")
     private String queueIntermitModelingPre;
 
+    @Value("${queue.modeling.liguang.modeling-pre:liguang-modeling-pre}")
+    private String queueLiguangModelingPre;
+
     @Value("${v3.controlUrl:#{null}}")
     private String v3controlUrl;
 
@@ -201,6 +204,12 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
     private ISceneColdStorageService sceneColdStorageService;
     @Autowired
     private IntermitSceneService intermitSceneService;
+    @Autowired
+    private ISceneRebuildLogService sceneRebuildLogService;
+    @Autowired
+    private ISceneUploadCountService sceneUploadCountService;
+    @Autowired
+    private IWbService wbService;
 
     @Override
     public SceneFileBuild findByFileId(String fileId) {
@@ -467,6 +476,10 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
             intermitSceneService.sendMq(scenePlusVO.getNum(), jsonObject, CommonSuccessStatus.WAITING.code());
             rabbitMqProducer.sendByWorkQueue(queueIntermitModelingPre, mqMessage);
         }else{
+            //如果是四普的看见相机场景,也需要推送全景vr
+            if(cameraType == 13 && Objects.nonNull(cameraDetail.getCompanyId()) && cameraDetail.getCompanyId() == 26){
+                wbService.sendMq(sceneNum, CommonSuccessStatus.WAITING.code());
+            }
             rabbitMqProducer.sendByWorkQueue(queueModelingPre, mqMessage);
         }
 
@@ -632,6 +645,8 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
             folderName = fileBuild.getUnicode();
             redisUtil.set(String.format(RedisConstants.FILEID_FOLDER_BUILD, fileId), folderName,2 * 24 * 60 * 60);
         }
+        sceneUploadCountService.resetCountByUuid(folderName);
+
         StringBuilder prefixBuffer = new StringBuilder(mac).append(File.separator).append(fileId).append(File.separator).append(folderName).append(File.separator);
 
         String buildType = "V2";
@@ -781,6 +796,8 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
             redisUtil.set(String.format(RedisConstants.FILEID_FOLDER_BUILD, fileId), folderName);
         }
 
+        sceneUploadCountService.resetCountByUuid(folderName);
+
         //云目录
         StringBuilder prefixBuffer = new StringBuilder(mac).append(File.separator).append(fileId).append(File.separator).append(folderName).append(File.separator);
 
@@ -1194,7 +1211,7 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
     }
 
     @Override
-    public ResultData rebuildScene(String num,Boolean force,Boolean deleteExtras) throws IOException {
+    public ResultData rebuildScene(String num,Boolean force,Boolean deleteExtras, String from) throws IOException {
 
         ScenePro scenePro = sceneProService.getByNum(num);
         ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
@@ -1303,13 +1320,29 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
             message.setRebuild("1");
         }
 
-        if(Objects.nonNull(scenePlusExt.getLocation()) && scenePlusExt.getLocation() == 7){
-            //发送到全景看看进行初始化
-            JSONObject jsonObject = JSONObject.parseObject(fYunFileService.getFileContent(SceneUtil.getHomePath(scenePlusExt.getDataSource()) + "data.fdage"));
-            intermitSceneService.sendMq(num, jsonObject, CommonSuccessStatus.WAITING.code());
-            rabbitMqProducer.sendByWorkQueue(queueIntermitModelingPre, message);
+        String ossOrignPath = commonService.getOssOrignPath(path);
+        String ossPath = fYunFileService.getFileContent(ossOrignPath + "custom.txt");
+        if(StrUtil.isNotEmpty(ossPath) && ossPath.contains("MKT862")){
+            JSONObject jsonObject = new JSONObject();
+            jsonObject.put("location", 4);
+            BuildSceneCallMessage mqMessage = getBuildSceneMqMessage(num, 13L, null, jsonObject, "V3",
+                    path);
+            mqMessage.getExt().put("deleteExtras", deleteExtras);
+            mqMessage.getExt().put("ossPath", ossPath);
+            //故宫博物馆需求,特殊算法参数
+            mqMessage.getExt().put("splitType", "SPLIT_V3");
+            mqMessage.getExt().put("skyboxType", "SKYBOX_V6");
+            rabbitMqProducer.sendByWorkQueue(queueLiguangModelingPre, mqMessage);
         }else{
-            rabbitMqProducer.sendByWorkQueue(queueModelingPre, message);
+            if(Objects.nonNull(scenePlusExt.getLocation()) && scenePlusExt.getLocation() == 7){
+                //发送到全景看看进行初始化
+                JSONObject jsonObject = JSONObject.parseObject(fYunFileService.getFileContent(SceneUtil.getHomePath(scenePlusExt.getDataSource()) + "data.fdage"));
+                intermitSceneService.sendMq(num, jsonObject, CommonSuccessStatus.WAITING.code());
+                rabbitMqProducer.sendByWorkQueue(queueIntermitModelingPre, message);
+            }else{
+                wbService.sendMq(num, CommonSuccessStatus.WAITING.code());
+                rabbitMqProducer.sendByWorkQueue(queueModelingPre, message);
+            }
         }
 
         scenePlusService.update(new LambdaUpdateWrapper<ScenePlus>()
@@ -1323,6 +1356,12 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
         }
         scenePlusExtService.updateById(scenePlusExt);
 
+        //记录日志表
+        SceneRebuildLog rebuildLog = new SceneRebuildLog();
+        rebuildLog.setNum(num);
+        rebuildLog.setSource(from);
+        sceneRebuildLogService.save(rebuildLog);
+
         return ResultData.ok();
     }
 
@@ -2019,4 +2058,142 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
         return result;
     }
 
+    @Override
+    public ResultData uploadLiguang(String num, String snCode, String ossPath) throws Exception {
+
+        if(StrUtil.isEmpty(ossPath)){
+            return ResultData.error(-1, "资源路径不能为空");
+        }
+        if(!StrUtil.endWith(ossPath, "/")){
+            ossPath = ossPath + "/";
+        }
+
+        if(StrUtil.isEmpty(num) && StrUtil.isEmpty(snCode)){
+            return ResultData.error(-1, "场景码或者相机码不能同时为空");
+        }
+
+        String fileId = null, unicode = null;
+        String dataSource = null;
+        String[] arr = null;
+        ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
+        ScenePlusExt scenePlusExt = null;
+        SceneEditInfo sceneEditInfo = null;
+        SceneEditInfoExt sceneEditInfoExt = null;
+        SceneEditControls sceneEditControls = null;
+        if(Objects.nonNull(scenePlus)){
+            scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
+            sceneEditInfo = sceneEditInfoService.getByScenePlusId(scenePlus.getId());
+            sceneEditInfoExt = sceneEditInfoExtService.getByEditInfoId(sceneEditInfo.getId());
+            sceneEditControls = sceneEditControlsService.getBySceneEditId(sceneEditInfo.getId());
+            dataSource = scenePlusExt.getDataSource();
+            arr = dataSource.replace(ConstantFilePath.BUILD_MODEL_PATH, "").split("/");
+            fileId = arr[1];
+            unicode = arr[2];
+            snCode = arr[0];
+        }else{
+            //生成场景码
+            num = scene3dNumService.generateSceneNum(CameraTypeEnum.DOUBLE_EYE_TURN.getType());
+        }
+
+        Camera camera = cameraService.getBySnCode(snCode);
+        CameraDetail cameraDetail = cameraDetailService.getByCameraId(camera.getId());
+
+        //生成unicode
+        if(StrUtil.isEmpty(unicode)){
+            unicode = snCode + "_" + DateUtil.format(new Date(), "yyyyMMddHHmmss");
+        }
+
+        //生成fileid
+        if (StrUtil.isEmpty(fileId)) {
+            fileId = new SnowflakeIdGenerator(0, 0).nextId() + "";
+            SceneFileBuild sceneFileBuild = new SceneFileBuild();
+            sceneFileBuild.setChildName(snCode);
+            sceneFileBuild.setFileId(fileId);
+            sceneFileBuild.setUnicode(unicode);
+            sceneFileBuild.setTotalPicNum(0);
+            sceneFileBuild.setChunks(0);
+            sceneFileBuild.setCreateTime(new Date());
+            this.save(sceneFileBuild);
+        }
+
+        dataSource = ConstantFilePath.BUILD_MODEL_PATH + snCode + "/" + fileId + "/" + unicode;
+
+        String dataFdageStr = fYunFileService.getFileContent(ossPath + "data.fdage");
+        JSONObject dataFdage = JSON.parseObject(dataFdageStr);
+        String name = dataFdage.getString("name");
+
+        //生成主表
+        if(Objects.isNull(scenePlus)){
+            scenePlus = new ScenePlus();
+            scenePlus.setNum(num);
+            scenePlus.setDescription("<p>四维看看 让空间讲故事</p>");
+            scenePlus.setUserId(cameraDetail.getUserId());
+            scenePlus.setPhoneId(snCode);
+            scenePlus.setTitle(name);
+            scenePlus.setSceneStatus(SceneStatus.wait.code());
+            scenePlus.setSceneSource(SceneSource.ZT.code());
+            scenePlus.setPayStatus(PayStatus.PAY.code());
+            scenePlus.setSceneType(SceneType.OTHER.code());
+            scenePlus.setCameraId(camera.getId());
+        }
+        scenePlusService.saveOrUpdate(scenePlus);
+        if(Objects.isNull(scenePlusExt)){
+            scenePlusExt = new ScenePlusExt();
+            scenePlusExt.setPlusId(scenePlus.getId());
+            scenePlusExt.setDataSource(dataSource);
+            scenePlusExt.setWebSite(mainUrl + "/smg.html?m=" + num);
+            scenePlusExt.setThumb(ConstantUrl.DEFAULT_SCENE_PIC);
+            scenePlusExt.setSceneScheme(SceneScheme.FOUR_K.code());
+            scenePlusExt.setSceneResolution(SceneResolution.four_K.code());
+            scenePlusExt.setSceneFrom(SceneFrom.MINION.code());
+            scenePlusExt.setSceneKind(SceneKind.TILES.code());
+            scenePlusExt.setModelKind(ModelKind.DAM.code());
+            scenePlusExt.setYunFileBucket(fYunFileConfig.getBucket());
+            scenePlusExt.setLocation(4);
+            scenePlusExt.setBuildType("V3");
+        }
+        scenePlusExtService.saveOrUpdate(scenePlusExt);
+
+        //生成编辑表
+        if(Objects.isNull(sceneEditInfo)){
+            sceneEditInfo = new SceneEditInfo();
+            sceneEditInfo.setScenePlusId(scenePlus.getId());
+            sceneEditInfo.setTitle(name);
+            sceneEditInfo.setDescription(scenePlus.getDescription());
+        }
+        sceneEditInfoService.saveOrUpdate(sceneEditInfo);
+        if(Objects.isNull(sceneEditInfoExt)){
+            sceneEditInfoExt = new SceneEditInfoExt();
+            sceneEditInfoExt.setScenePlusId(scenePlus.getId());
+            sceneEditInfoExt.setEditInfoId(sceneEditInfo.getId());
+        }
+        sceneEditInfoExtService.saveOrUpdate(sceneEditInfoExt);
+
+        //生成控制表
+        if(Objects.isNull(sceneEditControls)){
+            sceneEditControls = new SceneEditControls();
+            sceneEditControls.setEditInfoId(sceneEditInfo.getId());
+        }
+        sceneEditControlsService.saveOrUpdate(sceneEditControls);
+
+        //上传data.fdage和custom.txt到home目录
+        String homePath = dataSource.replace(ConstantFilePath.BUILD_MODEL_PATH, ConstantFilePath.OSS_PREFIX);
+        fYunFileService.uploadFile(dataFdageStr.getBytes(StandardCharsets.UTF_8), homePath + "data.fdage");
+        fYunFileService.uploadFile(ossPath.getBytes(StandardCharsets.UTF_8), homePath + "custom.txt");
+
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("location", 4);
+        BuildSceneCallMessage mqMessage = getBuildSceneMqMessage(num, 13L, null, jsonObject, "V3",
+                dataSource);
+        mqMessage.getExt().put("deleteExtras", true);
+        mqMessage.getExt().put("ossPath", ossPath);
+        //故宫博物馆需求,特殊算法参数
+        mqMessage.getExt().put("splitType", "SPLIT_V3");
+        mqMessage.getExt().put("skyboxType", "SKYBOX_V6");
+        rabbitMqProducer.sendByWorkQueue(queueLiguangModelingPre, mqMessage);
+
+        //推送mq到前置计算
+        return ResultData.ok(num);
+    }
+
 }

+ 20 - 0
src/main/java/com/fdkankan/contro/service/impl/SceneRebuildLogServiceImpl.java

@@ -0,0 +1,20 @@
+package com.fdkankan.contro.service.impl;
+
+import com.fdkankan.contro.entity.SceneRebuildLog;
+import com.fdkankan.contro.mapper.ISceneRebuildLogMapper;
+import com.fdkankan.contro.service.ISceneRebuildLogService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 场景重算接口调用日志表 服务实现类
+ * </p>
+ *
+ * @author 
+ * @since 2024-05-17
+ */
+@Service
+public class SceneRebuildLogServiceImpl extends ServiceImpl<ISceneRebuildLogMapper, SceneRebuildLog> implements ISceneRebuildLogService {
+
+}

+ 69 - 0
src/main/java/com/fdkankan/contro/service/impl/SceneUploadCountServiceImpl.java

@@ -0,0 +1,69 @@
+package com.fdkankan.contro.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.fdkankan.common.constant.CameraConstant;
+import com.fdkankan.common.exception.BusinessException;
+import com.fdkankan.contro.entity.Camera;
+import com.fdkankan.contro.entity.SceneUploadCount;
+import com.fdkankan.contro.mapper.ISceneUploadCountMapper;
+import com.fdkankan.contro.service.ICameraService;
+import com.fdkankan.contro.service.ISceneUploadCountService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fdkankan.contro.vo.SceneUploadCountParamVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Objects;
+
+/**
+ * <p>
+ * app触发场景上传统计表 服务实现类
+ * </p>
+ *
+ * @author
+ * @since 2024-05-20
+ */
+@Service
+public class SceneUploadCountServiceImpl extends ServiceImpl<ISceneUploadCountMapper, SceneUploadCount> implements ISceneUploadCountService {
+
+    @Autowired
+    private ICameraService cameraService;
+
+    @Override
+    public void increSceneUploadCount(SceneUploadCountParamVO param) {
+        String uuid = param.getUuid();
+        String snCode = uuid.split("_")[0];
+
+        Camera camera = cameraService.getBySnCode(snCode);
+        if (camera == null) {
+            throw new BusinessException(CameraConstant.FAILURE_6003);
+        }
+
+        SceneUploadCount sceneUploadCount = this.getByUUid(uuid);
+        if(Objects.isNull(sceneUploadCount)){
+            sceneUploadCount = new SceneUploadCount();
+            sceneUploadCount.setUuid(uuid);
+            sceneUploadCount.setSnCode(snCode);
+            sceneUploadCount.setCount(1);
+        }else{
+            sceneUploadCount.setCount(sceneUploadCount.getCount() + 1);
+        }
+
+        this.saveOrUpdate(sceneUploadCount);
+    }
+
+    @Override
+    public void resetCountByUuid(String uuid) {
+        SceneUploadCount sceneUploadCount = this.getByUUid(uuid);
+        if(Objects.isNull(sceneUploadCount)){
+            return;
+        }
+        sceneUploadCount.setCount(0);
+        this.updateById(sceneUploadCount);
+    }
+
+    @Override
+    public SceneUploadCount getByUUid(String uuid) {
+        return this.getOne(new LambdaQueryWrapper<SceneUploadCount>().eq(SceneUploadCount::getUuid, uuid));
+    }
+}

+ 66 - 0
src/main/java/com/fdkankan/contro/service/impl/WbServiceImpl.java

@@ -0,0 +1,66 @@
+package com.fdkankan.contro.service.impl;
+
+import com.fdkankan.common.constant.SceneSource;
+import com.fdkankan.contro.entity.*;
+import com.fdkankan.contro.service.*;
+import com.fdkankan.rabbitmq.util.RabbitMqProducer;
+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 java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+@Slf4j
+@Service
+public class WbServiceImpl implements IWbService {
+
+    @Autowired
+    private RabbitMqProducer mqProducer;
+    @Autowired
+    private IScenePlusService scenePlusService;
+    @Autowired
+    private IScenePlusExtService scenePlusExtService;
+    @Autowired
+    private ICameraService cameraService;
+    @Autowired
+    private IUserService userService;
+    @Autowired
+    private ICameraDetailService cameraDetailService;
+
+    @Override
+    public void sendMq(String num, Integer status) {
+        try {
+            ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
+            ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
+            Camera camera = cameraService.getById(scenePlus.getCameraId());
+            CameraDetail cameraDetail = cameraDetailService.getByCameraId(camera.getId());
+            if(Objects.isNull(cameraDetail.getCompanyId()) || cameraDetail.getCompanyId() != 26 || scenePlus.getSceneSource() != SceneSource.ZT.code().intValue()){
+                return;
+            }
+            String phoneNum = null;
+            if(Objects.nonNull(scenePlus.getUserId())){
+                SSOUser user = userService.getSSOUserByUserId(scenePlus.getUserId());
+                phoneNum = user.getUserName();
+            }
+            Map<String, Object> params = new HashMap<>();
+            params.put("sceneCode", num);
+            params.put("location", scenePlusExt.getLocation());
+            params.put("sceneSource", scenePlus.getSceneSource());
+            params.put("algorithmTime", scenePlusExt.getAlgorithmTime());
+            params.put("createTime", scenePlus.getCreateTime());
+            params.put("phoneNum", phoneNum);
+            params.put("userId", scenePlus.getUserId());
+            params.put("snCode", camera.getSnCode());
+            params.put("status", status);
+            params.put("sceneName", scenePlus.getTitle());
+            params.put("shootCount", scenePlusExt.getShootCount());
+            mqProducer.sendByWorkQueue("relics-init-queue", params);
+        }catch (Exception e){
+            log.error("发送看见场景到全景看看失败, num:{}", num, e);
+        }
+
+    }
+}

+ 25 - 0
src/main/java/com/fdkankan/contro/vo/ReportFailLogVO.java

@@ -0,0 +1,25 @@
+package com.fdkankan.contro.vo;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.validation.constraints.NotBlank;
+
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class ReportFailLogVO {
+
+    @NotBlank(message = "uuid不能为空")
+    private String uuid;
+
+    @NotBlank(message = "source不能为空")
+    private String source;
+
+    private String reason;
+
+
+}

+ 17 - 0
src/main/java/com/fdkankan/contro/vo/SceneUploadCountParamVO.java

@@ -0,0 +1,17 @@
+package com.fdkankan.contro.vo;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.validation.constraints.NotBlank;
+
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class SceneUploadCountParamVO {
+    @NotBlank(message = "uuid不能为空")
+    private String uuid;
+}

+ 5 - 0
src/main/resources/mapper/contro/AppCameraFailLogMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.fdkankan.contro.mapper.IAppCameraFailLogMapper">
+
+</mapper>

+ 5 - 0
src/main/resources/mapper/contro/SceneRebuildLogMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.fdkankan.contro.mapper.ISceneRebuildLogMapper">
+
+</mapper>

+ 5 - 0
src/main/resources/mapper/contro/SceneUploadCountMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.fdkankan.contro.mapper.ISceneUploadCountMapper">
+
+</mapper>