dengsixing 1 месяц назад
Родитель
Сommit
26d23f462f
19 измененных файлов с 489 добавлено и 883 удалено
  1. 6 0
      pom.xml
  2. 31 0
      src/main/java/com/fdkankan/contro/constant/UploadSceneSourceType.java
  3. 7 0
      src/main/java/com/fdkankan/contro/constant/ZipConstant.java
  4. 0 54
      src/main/java/com/fdkankan/contro/mq/listener/BuildLiguangListener.java
  5. 0 47
      src/main/java/com/fdkankan/contro/mq/listener/DingTalkMessageListener.java
  6. 220 0
      src/main/java/com/fdkankan/contro/mq/listener/UploadSceneListener.java
  7. 0 6
      src/main/java/com/fdkankan/contro/mq/service/impl/BuildE57SceneServiceImpl.java
  8. 0 5
      src/main/java/com/fdkankan/contro/mq/service/impl/BuildIntermitSceneServiceImpl.java
  9. 0 595
      src/main/java/com/fdkankan/contro/mq/service/impl/BuildLiguangServiceImpl.java
  10. 0 6
      src/main/java/com/fdkankan/contro/mq/service/impl/BuildObjServiceImpl.java
  11. 0 6
      src/main/java/com/fdkankan/contro/mq/service/impl/BuildReverseE57SceneServiceImpl.java
  12. 0 58
      src/main/java/com/fdkankan/contro/mq/service/impl/BuildSceneServiceImpl.java
  13. 0 5
      src/main/java/com/fdkankan/contro/mq/service/impl/BuildSxRelocationServiceImpl.java
  14. 19 19
      src/main/java/com/fdkankan/contro/service/IBuildSceneDTService.java
  15. 5 2
      src/main/java/com/fdkankan/contro/service/ISceneFileBuildService.java
  16. 70 70
      src/main/java/com/fdkankan/contro/service/impl/BuildSceneDTServiceImpl.java
  17. 0 8
      src/main/java/com/fdkankan/contro/service/impl/Scene3dNumServiceImpl.java
  18. 27 2
      src/main/java/com/fdkankan/contro/service/impl/SceneFileBuildServiceImpl.java
  19. 104 0
      src/main/java/com/fdkankan/contro/util/ZipUtil.java

+ 6 - 0
pom.xml

@@ -159,6 +159,12 @@
     </dependency>
 
     <dependency>
+      <groupId>net.lingala.zip4j</groupId>
+      <artifactId>zip4j</artifactId>
+      <version>2.11.5</version>
+    </dependency>
+
+    <dependency>
       <groupId>com.yomahub</groupId>
       <artifactId>tlog-web-spring-boot-starter</artifactId>
       <version>1.3.6</version>

+ 31 - 0
src/main/java/com/fdkankan/contro/constant/UploadSceneSourceType.java

@@ -0,0 +1,31 @@
+package com.fdkankan.contro.constant;
+
+/**
+ * 用户状态
+ *
+ * @author fdkk
+ */
+public enum UploadSceneSourceType
+{
+    ORIG("orig", "本地版原始资源包"),
+    OFFLINE("offline", "离线包");
+
+    private final String code;
+    private final String info;
+
+    UploadSceneSourceType(String code, String info)
+    {
+        this.code = code;
+        this.info = info;
+    }
+
+    public String getCode()
+    {
+        return code;
+    }
+
+    public String getInfo()
+    {
+        return info;
+    }
+}

+ 7 - 0
src/main/java/com/fdkankan/contro/constant/ZipConstant.java

@@ -0,0 +1,7 @@
+package com.fdkankan.contro.constant;
+
+public class ZipConstant {
+
+    public static final String zipPassword = "a3ad34136de359536af553f9e7f3cefd";
+
+}

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

@@ -1,54 +0,0 @@
-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");
-
-    }
-}

+ 0 - 47
src/main/java/com/fdkankan/contro/mq/listener/DingTalkMessageListener.java

@@ -1,47 +0,0 @@
-package com.fdkankan.contro.mq.listener;
-
-import com.alibaba.fastjson.JSONObject;
-import com.fdkankan.contro.constant.DingTalkConst;
-import com.fdkankan.contro.service.IBuildSceneDTService;
-import com.fdkankan.rabbitmq.bean.BuildSceneFailDTMqMessage;
-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 java.nio.charset.StandardCharsets;
-
-@Slf4j
-@Component
-public class DingTalkMessageListener {
-
-    @Value("${queue.modeling.modeling-dt}")
-    private String queueModelingDt;
-
-    @Autowired
-    private IBuildSceneDTService buildSceneDTService;
-
-    /**
-     * 场景计算发送钉钉消息
-     * @param channel
-     * @param message
-     * @throws Exception
-     */
-    @RabbitListener(
-            queuesToDeclare = @Queue("${queue.modeling.modeling-dt}"),
-            concurrency = "${maxThread.modeling.modeling-dt}"
-    )
-    public void buildSceneDTHandler(Channel channel, Message message) throws Exception {
-        String messageId = message.getMessageProperties().getMessageId();
-        String msg = new String(message.getBody(), StandardCharsets.UTF_8);
-        log.info("发送钉钉消息处理,队列名:{},id:{},消息体:{}", queueModelingDt, messageId, msg);
-        BuildSceneFailDTMqMessage dtMessage = JSONObject.parseObject(msg, BuildSceneFailDTMqMessage.class);
-        buildSceneDTService.handModelFail(dtMessage.getReason(), dtMessage.getServerPath(),
-                dtMessage.getNum(), dtMessage.getHostName());
-        channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
-    }
-}

+ 220 - 0
src/main/java/com/fdkankan/contro/mq/listener/UploadSceneListener.java

@@ -0,0 +1,220 @@
+package com.fdkankan.contro.mq.listener;
+
+import cn.hutool.core.codec.Base64;
+import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.util.CharsetUtil;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.fdkankan.common.constant.ErrorCode;
+import com.fdkankan.common.constant.PayStatus;
+import com.fdkankan.common.constant.SceneStatus;
+import com.fdkankan.common.exception.BusinessException;
+import com.fdkankan.common.util.CmdUtils;
+import com.fdkankan.contro.bean.SceneJsonBean;
+import com.fdkankan.contro.constant.UploadSceneSourceType;
+import com.fdkankan.contro.constant.ZipConstant;
+import com.fdkankan.contro.entity.*;
+import com.fdkankan.contro.service.*;
+import com.fdkankan.contro.util.ZipUtil;
+import com.fdkankan.fyun.face.FYunFileServiceInterface;
+import com.fdkankan.model.constants.ConstantFilePath;
+import com.fdkankan.model.constants.UploadFilePath;
+import com.fdkankan.redis.constant.RedisKey;
+import com.fdkankan.redis.util.RedisUtil;
+import com.fdkankan.web.util.RSAEncrypt;
+import com.rabbitmq.client.Channel;
+import lombok.extern.slf4j.Slf4j;
+import net.lingala.zip4j.ZipFile;
+import org.apache.commons.io.filefilter.NameFileFilter;
+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 javax.annotation.Resource;
+import java.io.File;
+import java.nio.charset.StandardCharsets;
+import java.util.Date;
+
+@Slf4j
+@Component
+public class UploadSceneListener {
+
+    @Value("${scene.pro.new.url}")
+    private String sceneProNewUrl;
+
+    @Autowired
+    private FYunFileServiceInterface fYunFileService;
+    @Autowired
+    private ISceneFileBuildService sceneFileBuildService;
+    @Autowired
+    private IUserService userService;
+    @Autowired
+    private IScenePlusService scenePlusService;
+    @Autowired
+    private IScenePlusExtService scenePlusExtService;
+    @Autowired
+    private ISceneEditInfoService sceneEditInfoService;
+    @Autowired
+    private ISceneEditInfoExtService sceneEditInfoExtService;
+    @Autowired
+    private ISceneEditControlsService sceneEditControlsService;
+    @Autowired
+    private ICommonService commonService;
+    @Resource
+    private RedisUtil redisUtil;
+
+
+
+    /**
+     * @param channel
+     * @param message
+     * @throws Exception
+     */
+    @RabbitListener(
+            queuesToDeclare = @Queue("${queue.scene.manage-upload-scene:manage-upload-scene}")
+    )
+    public void handler(Channel channel, Message message) throws Exception {
+        String msg = new String(message.getBody(), StandardCharsets.UTF_8);
+        log.info("开始处理管理后台上传场景,content:{}", msg);
+        JSONObject jsonObject = JSON.parseObject(msg);
+        String num = jsonObject.getString("num");;
+        String zipPath = jsonObject.getString("zipPath");
+        String sourceType = jsonObject.getString("sourceType");
+        String zipDir = FileUtil.getParent(zipPath, 1) + File.separator;
+        String zipName = FileUtil.getName(zipPath);
+        String uuid = FileUtil.getPrefix(zipName);
+        try {
+            //解压缩
+            ZipFile zipFile = new ZipFile(new File(zipPath));
+            if (zipFile.isEncrypted()) {
+                zipFile.setPassword(ZipConstant.zipPassword.toCharArray());
+                zipFile.extractAll(zipDir + uuid);
+            } else {
+                ZipUtil.unzip(zipPath, zipDir + uuid);
+            }
+            //资源包类型 orig-原始数据  offline 离线包
+            if(UploadSceneSourceType.ORIG.getCode().equalsIgnoreCase(sourceType)){
+                this.uploadSceneOirg(num, zipDir + uuid);
+            }
+
+            if(UploadSceneSourceType.OFFLINE.getCode().equalsIgnoreCase(sourceType)){
+                this.uploadSceneOffline(num, zipDir + uuid);
+            }
+
+        }catch (Exception e){
+            log.error("处理管理后台上传场景报错, content:{}", msg, e);
+            scenePlusService.update(new LambdaUpdateWrapper<ScenePlus>().eq(ScenePlus::getNum, num).set(ScenePlus::getSceneStatus, SceneStatus.FAILD.code()));
+        }finally {
+            channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
+        }
+        log.info("结束处理管理后台上传场景,content:{}", msg);
+    }
+
+//    public static void main(String[] args) {
+//        ZipUtil.unzip("", zipDir + uuid, CharsetUtil.CHARSET_GBK);
+//    }
+
+
+    private void uploadSceneOirg(String num, String sourcePath) throws Exception {
+        ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
+        NameFileFilter fileFilter = new NameFileFilter("data.fdage");
+        File dataFdageFile = FileUtil.loopFiles(sourcePath, fileFilter).stream().findFirst().filter(v -> !v.getAbsolutePath().contains("/backup/")).get();
+
+        //去读data.fdage
+        if(dataFdageFile != null && !dataFdageFile.exists()){
+            throw new BusinessException(ErrorCode.FAILURE_CODE_4002.code(), ErrorCode.FAILURE_CODE_4002.formatMessage("data.fdage"));
+        }
+        JSONObject dataFdageObj = JSONObject.parseObject(FileUtil.readUtf8String(dataFdageFile));
+        int camType = dataFdageObj.getJSONObject("cam").getIntValue("type");
+        String snCode = dataFdageObj.getJSONObject("cam").getString("uuid");
+        String uuidTime = dataFdageObj.getString("uuidtime");
+        String uniCode = snCode + "_" + uuidTime;
+        String fileId = sceneFileBuildService.getFileId(snCode, uniCode);
+        String homePath = "/oss/4dkankan/" + ConstantFilePath.OSS_PREFIX + snCode + "/" + fileId + "/" + uniCode;
+        FileUtil.mkdir(homePath);
+        String fileDir = sourcePath + "/" + uniCode;//本地版压缩包包含了一层unicode目录
+        String cpCmd = "cp -p -r " + fileDir + "/* " + homePath;
+        CmdUtils.callLineSh(cpCmd);
+
+        Long userId = scenePlus.getUserId();
+        User user = userService.getById(userId);
+        String params = snCode + "#" + fileId + "#" + uniCode;
+        String encode = Base64.encode(RSAEncrypt.encrypt(RSAEncrypt.loadPublicKeyByStr(RSAEncrypt.loadPublicKeyByFile()), params.getBytes(StandardCharsets.UTF_8)));
+        if(camType == 9 || camType == 10 || camType == 11){
+            sceneFileBuildService.turntableUploadSuccess(encode, user, true, false);
+        }else{
+            sceneFileBuildService.uploadSuccessBuild(encode, user, true, false);
+        }
+    }
+
+    private void uploadSceneOffline(String num, String sourcePath) throws Exception {
+        ScenePlus scenePlusDb = scenePlusService.getScenePlusByNum(num);
+        ScenePlusExt scenePlusExtDb = scenePlusExtService.getScenePlusExtByPlusId(scenePlusDb.getId());
+        NameFileFilter fileFilter = new NameFileFilter("scene.json");
+        File sceneJsonFile = FileUtil.loopFiles(sourcePath, fileFilter).get(0);
+
+        //去读data.fdage
+        if(sceneJsonFile != null && !sceneJsonFile.exists()){
+            throw new BusinessException(ErrorCode.FAILURE_CODE_4002.code(), ErrorCode.FAILURE_CODE_4002.formatMessage("scene.json"));
+        }
+
+        SceneJsonBean sceneJsonBean = JSONObject.parseObject(FileUtil.readUtf8String(sceneJsonFile), SceneJsonBean.class);
+        String sceneViewDataPath = "/oss/4dkankan/" + String.format(UploadFilePath.VIEW_PATH, num);
+        FileUtil.mkdir(sceneViewDataPath);
+        String cpCmd = "cp -p -r " + sourcePath + "/* " + sceneViewDataPath;
+        CmdUtils.callLineSh(cpCmd);
+
+        String sceneJsonKey = String.format(UploadFilePath.DATA_VIEW_PATH, num) + "scene.json";
+        fYunFileService.uploadFile(JSON.toJSONString(sceneJsonBean).getBytes(StandardCharsets.UTF_8), sceneJsonKey);
+
+        String key = String.format(RedisKey.SCENE_JSON, num);
+        if(redisUtil.hasKey(key)){
+            redisUtil.del(key);
+        }
+
+        //容量统计
+        Long space = commonService.getSpace(num);
+
+        String sceneJsonStr = FileUtil.readUtf8String(sceneJsonFile);
+        ScenePlus scenePlus = JSON.parseObject(sceneJsonStr, ScenePlus.class);
+        scenePlus.setId(scenePlusDb.getId());
+        scenePlus.setSceneStatus(SceneStatus.NO_DISPLAY.code());
+        scenePlus.setPayStatus(PayStatus.PAY.code());
+        scenePlus.setCreateTime(null);
+        scenePlus.setUpdateTime(null);
+        scenePlusService.updateById(scenePlus);
+
+        ScenePlusExt scenePlusExt = JSON.parseObject(sceneJsonStr, ScenePlusExt.class);
+        scenePlusExt.setPlusId(scenePlusExtDb.getPlusId());
+        scenePlusExt.setId(scenePlusExtDb.getId());
+        scenePlusExt.setCreateTime(null);
+        scenePlusExt.setWebSite("/" + sceneProNewUrl + scenePlus.getNum());
+        scenePlusExt.setAlgorithmTime(new Date());
+        scenePlusExt.setSpace(space);
+        scenePlusExtService.updateById(scenePlusExt);
+
+        SceneEditInfo sceneEditInfo = JSON.parseObject(sceneJsonStr, SceneEditInfo.class);
+        sceneEditInfo.setId(null);
+        sceneEditInfo.setScenePlusId(scenePlusDb.getId());
+        sceneEditInfo.setCreateTime(null);
+        sceneEditInfoService.save(sceneEditInfo);
+
+        SceneEditInfoExt sceneEditInfoExt = JSON.parseObject(sceneJsonStr, SceneEditInfoExt.class);
+        sceneEditInfoExt.setId(null);
+        sceneEditInfoExt.setScenePlusId(scenePlusDb.getId());
+        sceneEditInfoExt.setEditInfoId(sceneEditInfo.getId());
+        sceneEditInfoExt.setCreateTime(null);
+        sceneEditInfoExtService.save(sceneEditInfoExt);
+
+        SceneEditControls sceneEditControls = JSON.parseObject(sceneJsonStr, SceneEditControls.class);
+        sceneEditControls.setId(null);
+        sceneEditControls.setEditInfoId(sceneEditInfo.getId());
+        sceneEditControls.setCreateTime(null);
+        sceneEditControlsService.save(sceneEditControls);
+    }
+
+}

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

@@ -7,7 +7,6 @@ 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.IBuildSceneDTService;
 import com.fdkankan.contro.service.IBuildService;
 import com.fdkankan.contro.service.IScenePlusExtService;
 import com.fdkankan.contro.service.IScenePlusService;
@@ -67,8 +66,6 @@ public class BuildE57SceneServiceImpl implements IBuildSceneService {
     @Autowired
     private IScenePlusExtService scenePlusExtService;
     @Autowired
-    private IBuildSceneDTService buildSceneDTService;
-    @Autowired
     private IBuildService buildService;
 
     @Override
@@ -100,7 +97,6 @@ public class BuildE57SceneServiceImpl implements IBuildSceneService {
 
         }catch (Exception e){
             log.error("e57计算前置处理出错,num"+num, e);
-            buildSceneDTService.handBaseFail("e57计算资源准备异常!", message.getPath(), message.getSceneNum(), "计算控制服务器");
             throw e;
         }
     }
@@ -158,7 +154,6 @@ public class BuildE57SceneServiceImpl implements IBuildSceneService {
 
                 // 发送钉钉消息,计算失败
                 String logUrl = String.format(logUrlFormat,fYunFileConfig.getHost(),num,fYunFileConfig.getHost(),num);
-                buildSceneDTService.handModelFail("计算失败", message.getPath(), num, message.getHostName(), logUrl);
                 return;
             }
 
@@ -180,7 +175,6 @@ public class BuildE57SceneServiceImpl implements IBuildSceneService {
             log.info("e57场景计算结果处理结束,场景码:{}", num);
         }catch (Exception e){
             log.error("e57场景计算结果处理出错,num"+num, e);
-            buildSceneDTService.handBaseFail("e57场景计算结果处理出错!", message.getPath(), num, "计算控制服务器");
             throw e;
         }
     }

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

@@ -69,8 +69,6 @@ public class BuildIntermitSceneServiceImpl implements IBuildSceneService {
     @Autowired
     private IScenePlusExtService scenePlusExtService;
     @Autowired
-    private IBuildSceneDTService buildSceneDTService;
-    @Autowired
     private ICommonService commonService;
     @Autowired
     private ISceneColdStorageService sceneColdStorageService;
@@ -124,7 +122,6 @@ public class BuildIntermitSceneServiceImpl implements IBuildSceneService {
 
         }catch (Exception e){
             log.error("场景计算前置处理出错,num"+num, e);
-            buildSceneDTService.handBaseFail("场景计算资源准备异常!", message.getPath(), message.getSceneNum(), "计算控制服务器");
             throw e;
         }
     }
@@ -169,7 +166,6 @@ public class BuildIntermitSceneServiceImpl implements IBuildSceneService {
                 intermitSceneService.sendMq(sceneCode, fdageData, CommonSuccessStatus.FAIL.code());
 
                 // 发送钉钉消息,计算失败
-                buildSceneDTService.handModelFail("计算失败", message.getPath(), sceneCode, message.getHostName());
                 return;
             }
 
@@ -239,7 +235,6 @@ public class BuildIntermitSceneServiceImpl implements IBuildSceneService {
 
         }catch (Exception e){
             log.error("场景计算结果处理出错,num"+sceneCode, e);
-            buildSceneDTService.handBaseFail("场景计算结果处理出错!", message.getPath(), sceneCode, "计算控制服务器");
             throw e;
         }
     }

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

@@ -1,595 +0,0 @@
-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.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.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;
-    @Autowired
-    private IBuildService buildService;
-
-
-    @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");
-
-            Map<String, String> dataMap = new HashMap<>();
-            dataMap.put("splitType", (String) message.getExt().get("splitType"));
-            dataMap.put("skyboxType", (String) message.getExt().get("skyboxType"));
-
-            JSONObject fdageData = commonService.getFdageData(message.getPath() + File.separator + "capture" + File.separator + "data.fdage");
-            buildService.writeDataJson(message, fdageData, dataMap, null);
-
-            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());
-
-            //上传全景图俯视图
-            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(),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, null));
-            //统计原始资源大小
-            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,ScenePlusExt scenePlusExt){
-
-        scenePlusExt.setSpace(space);
-        scenePlusExt.setComputeTime(computeTime);
-        scenePlusExt.setAlgorithmTime(new Date());
-        scenePlusExt.setVideos(videosJson);
-
-        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;
-    }
-}

+ 0 - 6
src/main/java/com/fdkankan/contro/mq/service/impl/BuildObjServiceImpl.java

@@ -83,9 +83,6 @@ public class BuildObjServiceImpl implements IBuildSceneService {
     private FdkkV4Service fdkkV4Service;
 
     @Autowired
-    private IBuildSceneDTService buildSceneDTService;
-
-    @Autowired
     private ISceneProEditService sceneProEditService;
 
     @Autowired
@@ -159,7 +156,6 @@ public class BuildObjServiceImpl implements IBuildSceneService {
 
         }catch (Exception e){
             log.error("生成OBJ场景资源准备异常,num=" + num, e);
-            buildSceneDTService.handBaseFail("生成OBJ场景资源准备异常", message.getPath(), message.getSceneNum(), "计算控制服务器");
             throw e;
         }finally {
             fdkkLaserService.pushBuildStatusToLaserSystem(num, laserObjFilePath + "/laserData/mesh", success ? CommonOperStatus.SUCCESS.code() : CommonOperStatus.FAILD.code());
@@ -219,7 +215,6 @@ public class BuildObjServiceImpl implements IBuildSceneService {
                         .eq(ScenePlus::getNum, projectNum));
 
                 // 发送钉钉消息,计算失败
-                buildSceneDTService.handModelFail("生成OBJ场景计算失败!", message.getPath(), message.getBuildContext().get("sceneNum").toString(), message.getHostName());
                 return;
             }
 
@@ -352,7 +347,6 @@ public class BuildObjServiceImpl implements IBuildSceneService {
 
         }catch (Exception e){
             log.error("生成OBJ场景计算结果处理异常,num=" + projectNum, e);
-            buildSceneDTService.handBaseFail("生成OBJ场景计算结果处理异常", message.getPath(), projectNum, "计算控制服务器");
             throw e;
         }finally {
             fdkkLaserService.pushBuildStatusToLaserSystem(projectNum, laserObjFilePath + "/laserData/mesh", success ? CommonOperStatus.SUCCESS.code() : CommonOperStatus.FAILD.code());

+ 0 - 6
src/main/java/com/fdkankan/contro/mq/service/impl/BuildReverseE57SceneServiceImpl.java

@@ -75,8 +75,6 @@ public class BuildReverseE57SceneServiceImpl implements IBuildSceneService {
     @Autowired
     private IScenePlusExtService scenePlusExtService;
     @Autowired
-    private IBuildSceneDTService buildSceneDTService;
-    @Autowired
     private ICommonService commonService;
     @Autowired
     private IFdkkLaserService fdkkLaserService;
@@ -150,7 +148,6 @@ public class BuildReverseE57SceneServiceImpl implements IBuildSceneService {
             scenePlus.setSceneStatus(CommonSuccessStatus.FAIL.code());
             scenePlusService.updateById(scenePlus);
             fdkkLaserService.sendE57ToLaser(scenePlus, scenePlusExt, null);
-            buildSceneDTService.handBaseFail("上传e57计算资源准备异常!", message.getPath(), message.getSceneNum(), "计算控制服务器");
             throw e;
         }
     }
@@ -211,8 +208,6 @@ public class BuildReverseE57SceneServiceImpl implements IBuildSceneService {
                 scenePlusService.updateById(scenePlus);
                 fdkkLaserService.sendE57ToLaser(scenePlus, scenePlusExt, null);
 
-                // 发送钉钉消息,计算失败
-                buildSceneDTService.handModelFail("计算失败", message.getPath(), sceneCode, message.getHostName());
                 return;
             }
 
@@ -331,7 +326,6 @@ public class BuildReverseE57SceneServiceImpl implements IBuildSceneService {
             scenePlus.setSceneStatus(CommonSuccessStatus.FAIL.code());
             scenePlusService.updateById(scenePlus);
             fdkkLaserService.sendE57ToLaser(scenePlus, scenePlusExt, null);
-            buildSceneDTService.handBaseFail("场景计算结果处理出错!", message.getPath(), sceneCode, "计算控制服务器");
             throw e;
         }
     }

+ 0 - 58
src/main/java/com/fdkankan/contro/mq/service/impl/BuildSceneServiceImpl.java

@@ -19,7 +19,6 @@ 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;
@@ -28,8 +27,6 @@ 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;
@@ -110,11 +107,6 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
     @Autowired
     private IFdkkLaserService fdkkLaserService;
 
-
-    @Autowired
-    private IBuildSceneDTService buildSceneDTService;
-
-
     @Autowired
     private IIncrementTypeService incrementTypeService;
 
@@ -219,7 +211,6 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
             //计算失败通知激光系统修改状态
             fdkkLaserService.updateStatus(num, 1);
 
-            buildSceneDTService.handBaseFail("场景计算资源准备异常!", message.getPath(), message.getSceneNum(), "计算控制服务器");
             throw e;
         }
     }
@@ -263,8 +254,6 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
                 //计算失败通知激光系统修改状态
                 fdkkLaserService.updateStatus(sceneCode, 1);
 
-                // 发送钉钉消息,计算失败
-                buildSceneDTService.handModelFail("计算失败", message.getPath(), sceneCode, message.getHostName());
                 return;
             }
             JSONObject fdageData = commonService.getFdageData(path + File.separator + "capture" +File.separator+"data.fdage");
@@ -391,7 +380,6 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
             //计算成功,通知APP
             Integer pushChannel = fdageData.getInteger("pushChannel");
             String pushToken = fdageData.getString("pushToken");
-            this.pushMsgToApp(pushChannel,pushToken, cameraType, scenePlus.getTitle(), scenePlusExt.getWebSite());
 
 //            //删除计算目录
             if(CollUtil.isEmpty(notDeleteNasNumList) || !notDeleteNasNumList.contains(sceneCode)){
@@ -425,7 +413,6 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
             //计算失败通知激光系统修改状态
             fdkkLaserService.updateStatus(sceneCode, 1);
 
-            buildSceneDTService.handBaseFail("场景计算结果处理出错!", message.getPath(), sceneCode, "计算控制服务器");
             throw e;
         } finally {
             Map<String, Object> sceneStatusParam = new HashMap<>();
@@ -524,51 +511,6 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
         }
     }
 
-    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);

+ 0 - 5
src/main/java/com/fdkankan/contro/mq/service/impl/BuildSxRelocationServiceImpl.java

@@ -66,8 +66,6 @@ public class BuildSxRelocationServiceImpl implements IBuildSceneService {
     @Autowired
     private IScenePlusExtService scenePlusExtService;
     @Autowired
-    private IBuildSceneDTService buildSceneDTService;
-    @Autowired
     private ICommonService commonService;
     @Autowired
     private IBuildService buildService;
@@ -110,7 +108,6 @@ public class BuildSxRelocationServiceImpl implements IBuildSceneService {
             scenePlusService.updateById(scenePlusByNum);
             //修改重定位记录为退出计算
             relocationBatchService.update(new LambdaUpdateWrapper<RelocationBatch>().eq(RelocationBatch::getId, batchId).set(RelocationBatch::getStatus, 2));
-            buildSceneDTService.handBaseFail("深巡场景重定位资源准备异常!", message.getPath(), message.getSceneNum(), "计算控制服务器");
             throw e;
         }
     }
@@ -164,7 +161,6 @@ public class BuildSxRelocationServiceImpl implements IBuildSceneService {
                         .eq(ScenePlus::getNum, sceneCode));
 
                 // 发送钉钉消息,计算失败
-                buildSceneDTService.handModelFail("深巡场景重定向计算失败", message.getPath(), sceneCode, message.getHostName());
                 return;
             }
             ScenePlus scenePlus = scenePlusService.getScenePlusByNum(sceneCode);
@@ -216,7 +212,6 @@ public class BuildSxRelocationServiceImpl implements IBuildSceneService {
         }catch (Exception e){
             log.error("场景重定位计算结果处理出错,num"+sceneCode, e);
             downParams.put("status", CommonSuccessStatus.FAIL.code());
-            buildSceneDTService.handBaseFail("场景重定位计算结果处理出错!", message.getPath(), sceneCode, "计算控制服务器");
             throw e;
         } finally {
             //发送消息到激光系统做处理

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

@@ -1,19 +1,19 @@
-package com.fdkankan.contro.service;
-
-/**
- * <p>
- * TODO
- * </p>
- *
- * @author dengsixing
- * @since 2022/3/1
- **/
-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);
-
-}
+//package com.fdkankan.contro.service;
+//
+///**
+// * <p>
+// * TODO
+// * </p>
+// *
+// * @author dengsixing
+// * @since 2022/3/1
+// **/
+//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);
+//
+//}

+ 5 - 2
src/main/java/com/fdkankan/contro/service/ISceneFileBuildService.java

@@ -3,6 +3,7 @@ package com.fdkankan.contro.service;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.fdkankan.contro.entity.SceneFileBuild;
+import com.fdkankan.contro.entity.User;
 import com.fdkankan.contro.vo.ResponseSceneFile;
 import com.fdkankan.web.response.ResultData;
 
@@ -22,9 +23,9 @@ public interface ISceneFileBuildService extends IService<SceneFileBuild> {
 
     ResponseSceneFile preUpload(String params) throws Exception;
 
-    ResultData uploadSuccessBuild(String params) throws Exception;
+    ResultData uploadSuccessBuild(String params, User user, boolean forceBuild, boolean checkUploadFile) throws Exception;
 
-    ResultData turntableUploadSuccess(String params) throws Exception;
+    ResultData turntableUploadSuccess(String params, User user, boolean forceBuild, boolean checkUploadFile) throws Exception;
 
     ResultData rebuildScene(String num,Boolean force,Boolean deleteExtras, String from) throws IOException;
 
@@ -35,4 +36,6 @@ public interface ISceneFileBuildService extends IService<SceneFileBuild> {
     ResultData uploadLiguang(String num, String snCode, String ossPath) throws Exception;
 
     ResultData reverseScene(JSONObject params) throws Exception;
+
+    String getFileId(String snCode, String uuid);
 }

+ 70 - 70
src/main/java/com/fdkankan/contro/service/impl/BuildSceneDTServiceImpl.java

@@ -1,70 +1,70 @@
-package com.fdkankan.contro.service.impl;
-
-import cn.hutool.core.util.StrUtil;
-import com.fdkankan.contro.service.IBuildSceneDTService;
-import com.fdkankan.fyun.config.FYunFileConfig;
-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.io.UnsupportedEncodingException;
-import java.security.InvalidKeyException;
-import java.security.NoSuchAlgorithmException;
-import java.util.concurrent.CompletableFuture;
-
-/**
- * <p>
- * TODO
- * </p>
- *
- * @author dengsixing
- * @since 2022/4/20
- **/
-@Slf4j
-@Service
-public class BuildSceneDTServiceImpl implements IBuildSceneDTService {
-
-    public static final String DINGTALK_MSG_PATTERN = "**环境**: %s\n\n" +
-        "**服务器名称**: %s\n\n" +
-        "**失败原因**: %s\n\n" +
-        "**num**: %s\n\n" +
-        "**server-path**: %s\n\n";
-
-    public static final String contentExt = "**algorithm-log**: [%sbuild_log/%s/console.log](%sbuild_log/%s/console.log)";
-
-    @Autowired
-    private FYunFileConfig fYunFileConfig;
-
-    @Value("${main.url}")
-    private String mainUrl;
-
-    @Override
-    public void handModelFail(String reason, String serverPath, String num, String hostName) {
-        String logPath = String.format(contentExt,fYunFileConfig.getHost(),num,fYunFileConfig.getHost(),num);
-        this.handModelFail(reason, serverPath, num, hostName, logPath);
-    }
-
-    @Override
-    public void handModelFail(String reason, String serverPath, String num, String hostName, String logPath) {
-        try {
-            log.info("发送钉钉消息,content:{}", logPath);
-            String content = String.format(this.DINGTALK_MSG_PATTERN, this.mainUrl, hostName, reason, num, serverPath) + logPath;
-            log.info("发送钉钉消息,content:{}", content);
-            dingTalkSendUtils.sendActioncardMsgToDingRobot(content,"场景计算失败");
-        } catch (ApiException | UnsupportedEncodingException | NoSuchAlgorithmException | InvalidKeyException apiException) {
-            log.error("发送钉钉消息失败", apiException);
-        }
-    }
-
-    @Override
-    public void handBaseFail(String reason, String serverPath, String num, String hostName) {
-        try {
-            String content = String.format(this.DINGTALK_MSG_PATTERN, this.mainUrl, hostName, reason, num, serverPath);
-            log.info("发送钉钉消息,content:{}", content);
-            dingTalkSendUtils.sendActioncardMsgToDingRobot(content,"场景计算失败");
-        } catch (ApiException | UnsupportedEncodingException | NoSuchAlgorithmException | InvalidKeyException apiException) {
-            log.error("发送钉钉消息失败", apiException);
-        }
-    }
-}
+//package com.fdkankan.contro.service.impl;
+//
+//import cn.hutool.core.util.StrUtil;
+//import com.fdkankan.contro.service.IBuildSceneDTService;
+//import com.fdkankan.fyun.config.FYunFileConfig;
+//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.io.UnsupportedEncodingException;
+//import java.security.InvalidKeyException;
+//import java.security.NoSuchAlgorithmException;
+//import java.util.concurrent.CompletableFuture;
+//
+///**
+// * <p>
+// * TODO
+// * </p>
+// *
+// * @author dengsixing
+// * @since 2022/4/20
+// **/
+//@Slf4j
+//@Service
+//public class BuildSceneDTServiceImpl implements IBuildSceneDTService {
+//
+//    public static final String DINGTALK_MSG_PATTERN = "**环境**: %s\n\n" +
+//        "**服务器名称**: %s\n\n" +
+//        "**失败原因**: %s\n\n" +
+//        "**num**: %s\n\n" +
+//        "**server-path**: %s\n\n";
+//
+//    public static final String contentExt = "**algorithm-log**: [%sbuild_log/%s/console.log](%sbuild_log/%s/console.log)";
+//
+//    @Autowired
+//    private FYunFileConfig fYunFileConfig;
+//
+//    @Value("${main.url}")
+//    private String mainUrl;
+//
+//    @Override
+//    public void handModelFail(String reason, String serverPath, String num, String hostName) {
+//        String logPath = String.format(contentExt,fYunFileConfig.getHost(),num,fYunFileConfig.getHost(),num);
+//        this.handModelFail(reason, serverPath, num, hostName, logPath);
+//    }
+//
+//    @Override
+//    public void handModelFail(String reason, String serverPath, String num, String hostName, String logPath) {
+//        try {
+//            log.info("发送钉钉消息,content:{}", logPath);
+//            String content = String.format(this.DINGTALK_MSG_PATTERN, this.mainUrl, hostName, reason, num, serverPath) + logPath;
+//            log.info("发送钉钉消息,content:{}", content);
+//            dingTalkSendUtils.sendActioncardMsgToDingRobot(content,"场景计算失败");
+//        } catch (ApiException | UnsupportedEncodingException | NoSuchAlgorithmException | InvalidKeyException apiException) {
+//            log.error("发送钉钉消息失败", apiException);
+//        }
+//    }
+//
+//    @Override
+//    public void handBaseFail(String reason, String serverPath, String num, String hostName) {
+//        try {
+//            String content = String.format(this.DINGTALK_MSG_PATTERN, this.mainUrl, hostName, reason, num, serverPath);
+//            log.info("发送钉钉消息,content:{}", content);
+//            dingTalkSendUtils.sendActioncardMsgToDingRobot(content,"场景计算失败");
+//        } catch (ApiException | UnsupportedEncodingException | NoSuchAlgorithmException | InvalidKeyException apiException) {
+//            log.error("发送钉钉消息失败", apiException);
+//        }
+//    }
+//}

+ 0 - 8
src/main/java/com/fdkankan/contro/service/impl/Scene3dNumServiceImpl.java

@@ -14,7 +14,6 @@ import com.fdkankan.contro.enums.CameraTypeEnum;
 import com.fdkankan.contro.mapper.IScene3dNumMapper;
 import com.fdkankan.contro.service.ICameraTypeService;
 import com.fdkankan.contro.service.IScene3dNumService;
-import com.fdkankan.dingtalk.DingTalkSendUtils;
 import com.fdkankan.redis.constant.RedisKey;
 import com.fdkankan.redis.constant.RedisLockKey;
 import com.fdkankan.redis.util.RedisLockUtil;
@@ -68,8 +67,6 @@ public class Scene3dNumServiceImpl extends ServiceImpl<IScene3dNumMapper, Scene3
     private String mainUrl;
 
     @Autowired
-    private DingTalkSendUtils dingTalkSendUtils;
-    @Autowired
     private ICameraTypeService cameraTypeService;
 
     @Override
@@ -87,7 +84,6 @@ public class Scene3dNumServiceImpl extends ServiceImpl<IScene3dNumMapper, Scene3
         sceneNum = redisUtil.lLeftPop(RedisKey.FDKANKAN_SCENE_NUMS);
         if(Objects.isNull(sceneNum)){
             String content = String.format(this.DINGTALK_MSG_PATTERN, mainUrl, "场景码穷尽告警", "场景计算获取场景码失败");
-            dingTalkSendUtils.sendActioncardMsgToDingRobot(content, "场景码穷尽告警");
             throw new Exception("场景计算获取场景码失败");
         }
         return addPrefix(sceneNum,cameraType);
@@ -111,10 +107,6 @@ public class Scene3dNumServiceImpl extends ServiceImpl<IScene3dNumMapper, Scene3
             }
             log.info("开始加载场景码缓存");
             List<String> nums = this.findSceneNum(cachePageSize);
-            if(CollUtil.isEmpty(nums) || nums.size() < cachePageSize){
-                String content = String.format(this.DINGTALK_MSG_PATTERN, mainUrl, "场景码穷尽告警", "场景码表中未使用状态少于" + cachePageSize);
-                dingTalkSendUtils.sendActioncardMsgToDingRobot(content, "场景码穷尽告警");
-            }
             if(CollUtil.isNotEmpty(nums)){
                 redisUtil.lRightPushAll(RedisKey.FDKANKAN_SCENE_NUMS, nums);
                 this.updateUsedStatus(nums);

+ 27 - 2
src/main/java/com/fdkankan/contro/service/impl/SceneFileBuildServiceImpl.java

@@ -650,7 +650,7 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
     }
 
     @Override
-    public ResultData uploadSuccessBuild(String params) throws Exception {
+    public ResultData uploadSuccessBuild(String params, User user, boolean forceBuild, boolean checkUploadFille) throws Exception {
         log.info("uploadSuccessBuild-params: " + params);
         String preParams = params;
         if (StringUtils.isEmpty(params)) {
@@ -799,7 +799,7 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
     }
 
     @Override
-    public ResultData turntableUploadSuccess(String params) throws Exception {
+    public ResultData turntableUploadSuccess(String params, User user, boolean forceBuild, boolean checkUploadFille) throws Exception {
         log.info("turntableUploadSuccess-params: " + params);
         String preParams = params;
         if (StringUtils.isEmpty(params)) {
@@ -2197,4 +2197,29 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
         //推送mq到前置计算
         return ResultData.ok(num);
     }
+
+    @Override
+    public String getFileId(String snCode, String uuid){
+
+        // 检测是否有生成
+        String fileId = null;
+        SceneFileBuild sceneFileBuild = this.findByUnicode(uuid);
+        if(Objects.nonNull(sceneFileBuild)){
+            fileId = sceneFileBuild.getFileId();
+            return fileId;
+        }
+
+        fileId = new SnowflakeIdGenerator(0, 0).nextId() + "";
+        log.info("新场景,fileid:{}", fileId);
+
+        sceneFileBuild = new SceneFileBuild();
+        sceneFileBuild.setChildName(snCode);
+        sceneFileBuild.setFileId(fileId);
+        sceneFileBuild.setRecStatus("A");
+        sceneFileBuild.setUnicode(uuid);
+        sceneFileBuild.setCreateTime(new Date());
+        this.save(sceneFileBuild);
+
+        return fileId;
+    }
 }

+ 104 - 0
src/main/java/com/fdkankan/contro/util/ZipUtil.java

@@ -0,0 +1,104 @@
+package com.fdkankan.contro.util;
+
+import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.io.IoUtil;
+import com.fdkankan.contro.constant.ZipConstant;
+import net.lingala.zip4j.ZipFile;
+import net.lingala.zip4j.model.FileHeader;
+
+import java.io.File;
+import java.io.InputStream;
+import java.nio.charset.Charset;
+import java.nio.file.Paths;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.zip.ZipEntry;
+
+public class ZipUtil {
+
+    public static void main(String[] args) throws Exception {
+
+        // 压缩包路径
+        String zipPath = "D:\\Downloads\\各类相机从App导出的原始数据\\bpvt00017_20250314173801715_meta\\bpvt00017_20250314173801715.zip";
+        System.out.println(readUtf8(zipPath, "data.fdage"));
+    }
+
+    public static String readUtf8(String zipPath, String fileName) throws Exception {
+        ZipFile zipFile = new ZipFile(zipPath);
+        zipFile.setPassword(ZipConstant.zipPassword.toCharArray());
+        // 读取所有条目(文件头)
+        for (FileHeader header : (List<FileHeader>)zipFile.getFileHeaders()) {
+            // 文件名(不含目录)
+            String filePath = header.getFileName();
+            String headerFileName = FileUtil.getName(filePath);
+            if (filePath.contains("backup") || !fileName.equals(headerFileName)) {
+                continue;
+            }
+            try (InputStream is = zipFile.getInputStream(header)) {
+                return IoUtil.readUtf8(is);
+            }
+        }
+        return null;
+    }
+
+    /**
+     * 解压 zip 压缩包到目标目录
+     * @param zipFilePath 压缩包路径
+     * @param destDirPath 解压目录
+     */
+    public static void unzip(String zipFilePath, String destDirPath) {
+        File zipFile = new File(zipFilePath);
+        File destDir = new File(destDirPath);
+
+        // 自动检测编码,常见 GBK / UTF-8
+        Charset charset = detectCharset(zipFile);
+
+        // 解压(如果是 Windows 打包的 zip,GBK 最常见)
+        cn.hutool.core.util.ZipUtil.unzip(zipFile, destDir, charset);
+    }
+
+    /**
+     * 检测 ZIP 文件的编码(仅用于文件名编码判断)
+     * 逻辑:UTF-8 -> GBK -> default
+     * @param zipFile ZIP 文件
+     * @return Charset 识别到的编码
+     */
+    public static Charset detectCharset(File zipFile) {
+        // 1. 尝试 UTF-8
+        if (isCharset(zipFile, Charset.forName("UTF-8"))) {
+            return Charset.forName("UTF-8");
+        }
+
+        // 2. 尝试 GBK(Windows zip 默认编码)
+        if (isCharset(zipFile, Charset.forName("GBK"))) {
+            return Charset.forName("GBK");
+        }
+
+        // 3. 都不行 → 返回系统默认
+        return Charset.defaultCharset();
+    }
+
+    /**
+     * 判断使用该编码读取 ZIP 是否正常(没有乱码字符)
+     */
+    private static boolean isCharset(File zipFile, Charset charset) {
+        try (java.util.zip.ZipFile zf = new java.util.zip.ZipFile(zipFile, charset)) {
+            Enumeration<? extends ZipEntry> entries = zf.entries();
+            while (entries.hasMoreElements()) {
+                ZipEntry entry = entries.nextElement();
+
+                // 只检查名字,不读取内容
+                String name = entry.getName();
+
+                // 若名字中出现 �(替换字符),说明编码不对
+                if (name.contains("\uFFFD")) {
+                    return false;
+                }
+            }
+            return true;
+        } catch (Exception e) {
+            // 出现异常说明该编码不匹配
+            return false;
+        }
+    }
+}