lyhzzz 7 месяцев назад
Родитель
Сommit
48c1b3ae66
40 измененных файлов с 598 добавлено и 251 удалено
  1. 1 0
      src/main/java/com/fdkankan/fusion/common/FilePath.java
  2. 1 3
      src/main/java/com/fdkankan/fusion/common/ResultCode.java
  3. 8 0
      src/main/java/com/fdkankan/fusion/common/util/FileWriterUtil.java
  4. 17 0
      src/main/java/com/fdkankan/fusion/common/util/MinIoChunkUtils.java
  5. 1 1
      src/main/java/com/fdkankan/fusion/common/util/OBJToGLBUtil.java
  6. 1 1
      src/main/java/com/fdkankan/fusion/common/util/ShellUtil.java
  7. 0 27
      src/main/java/com/fdkankan/fusion/controller/NoLoginController.java
  8. 1 1
      src/main/java/com/fdkankan/fusion/controller/SceneController.java
  9. 44 81
      src/main/java/com/fdkankan/fusion/controller/UploadController.java
  10. 2 27
      src/main/java/com/fdkankan/fusion/controller/UploadSceneController.java
  11. 5 0
      src/main/java/com/fdkankan/fusion/entity/Model.java
  12. 8 0
      src/main/java/com/fdkankan/fusion/entity/ScenePlus.java
  13. 24 1
      src/main/java/com/fdkankan/fusion/entity/UploadChunk.java
  14. 4 1
      src/main/java/com/fdkankan/fusion/entity/UploadScene.java
  15. 8 7
      src/main/java/com/fdkankan/fusion/httpClient/FdService.java
  16. 1 0
      src/main/java/com/fdkankan/fusion/httpClient/request/UploadEditSceneParam.java
  17. 4 0
      src/main/java/com/fdkankan/fusion/mapper/IModelMapper.java
  18. 4 0
      src/main/java/com/fdkankan/fusion/mapper/IUploadChunkMapper.java
  19. 1 1
      src/main/java/com/fdkankan/fusion/mapper/IUploadSceneMapper.java
  20. 2 0
      src/main/java/com/fdkankan/fusion/request/ModelPram.java
  21. 1 1
      src/main/java/com/fdkankan/fusion/request/ScenePram.java
  22. 2 1
      src/main/java/com/fdkankan/fusion/request/UploadSceneParam.java
  23. 12 0
      src/main/java/com/fdkankan/fusion/response/ModelVo.java
  24. 4 0
      src/main/java/com/fdkankan/fusion/response/SceneVo.java
  25. 5 0
      src/main/java/com/fdkankan/fusion/service/IModelService.java
  26. 9 0
      src/main/java/com/fdkankan/fusion/service/IUploadChunkService.java
  27. 1 2
      src/main/java/com/fdkankan/fusion/service/IUploadSceneService.java
  28. 35 17
      src/main/java/com/fdkankan/fusion/service/impl/CaseNumServiceImpl.java
  29. 1 1
      src/main/java/com/fdkankan/fusion/service/impl/CaseServiceImpl.java
  30. 1 1
      src/main/java/com/fdkankan/fusion/service/impl/DownService.java
  31. 33 29
      src/main/java/com/fdkankan/fusion/service/impl/ModelServiceImpl.java
  32. 25 8
      src/main/java/com/fdkankan/fusion/service/impl/SceneService.java
  33. 4 0
      src/main/java/com/fdkankan/fusion/service/impl/ThreadService.java
  34. 60 0
      src/main/java/com/fdkankan/fusion/service/impl/UploadChunkServiceImpl.java
  35. 1 38
      src/main/java/com/fdkankan/fusion/service/impl/UploadSceneServiceImpl.java
  36. 186 0
      src/main/java/com/fdkankan/fusion/task/ThreadService2.java
  37. 1 1
      src/main/resources/application.yaml
  38. 50 0
      src/main/resources/mapper/fusion/ModelMapper.xml
  39. 1 1
      src/main/resources/mapper/fusion/ScenePlusMapper.xml
  40. 29 0
      src/main/resources/mapper/fusion/UploadChunkMapper.xml

+ 1 - 0
src/main/java/com/fdkankan/fusion/common/FilePath.java

@@ -2,6 +2,7 @@ package com.fdkankan.fusion.common;
 
 public class FilePath {
 
+    public final static String localPath = "/mnt/";
     public final static String LOCAL_BASE_PATH = "/mnt/fusion/";
     public final static String MNT_BASE_PATH = "/mnt/fusion/";
     public final static String OBJ_OSS_PATH = "scene_view_data/%s";

+ 1 - 3
src/main/java/com/fdkankan/fusion/common/ResultCode.java

@@ -76,9 +76,7 @@ public enum ResultCode {
     COMPOSE_FILE_ERROR(7029, "合并文件失败"),
     TYPE_ERROR(7030, "上传资源类型错误"),
 
-
-    ;
-
+;
 
     public int code;
     public String msg;

+ 8 - 0
src/main/java/com/fdkankan/fusion/common/util/FileWriterUtil.java

@@ -6,6 +6,8 @@ import java.nio.file.Paths;
 import java.nio.file.StandardCopyOption;
 import java.util.List;
 import java.util.Objects;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 import static cn.hutool.core.util.ClassUtil.getClassLoader;
 
@@ -96,4 +98,10 @@ public class FileWriterUtil {
         return null;
     }
 
+    public static boolean isChinese(String str) {
+        String regEx = "[\\u4e00-\\u9fa5]+";
+        Pattern p = Pattern.compile(regEx);
+        Matcher m = p.matcher(str);
+        return m.find();
+    }
 }

+ 17 - 0
src/main/java/com/fdkankan/fusion/common/util/MinIoChunkUtils.java

@@ -333,6 +333,23 @@ public class MinIoChunkUtils implements InitializingBean {
         }
         return expiry;
     }
+
+    /**
+     * 判断文件是否存在
+     *
+     * @param bucketName 存储桶
+     * @param objectName 文件名
+     * @return
+     */
+    public static boolean isObjectExist(String bucketName, String objectName) {
+        boolean exist = true;
+        try {
+            minioClient.statObject(StatObjectArgs.builder().bucket(bucketName).object(objectName).build());
+        } catch (Exception e) {
+            exist = false;
+        }
+        return exist;
+    }
     public static String buZero(Long size,Integer index){
         String numStr = String.valueOf(size);
         return StringUtils.leftPad(String.valueOf(index),numStr.length()+1,'0');

+ 1 - 1
src/main/java/com/fdkankan/fusion/common/util/OBJToGLBUtil.java

@@ -142,7 +142,7 @@ public class OBJToGLBUtil {
         return imgName;
     }
 
-    public static File lasOrPlyToBin(File srcFile) throws IOException {
+    public static File lasOrPlyToBin(File srcFile)  {
         if(!srcFile.exists()){
             srcFile.mkdirs();
         }

+ 1 - 1
src/main/java/com/fdkankan/fusion/common/util/ShellUtil.java

@@ -145,7 +145,7 @@ public class ShellUtil {
      * @return
      * @throws IOException
      */
-    public static JSONObject fixCloud(String path) throws IOException {
+    public static JSONObject fixCloud(String path)  {
         FileReader fileReader = new FileReader(path);
         String str = fileReader.readString();
         JSONObject json = JSONObject.parseObject(str);

+ 0 - 27
src/main/java/com/fdkankan/fusion/controller/NoLoginController.java

@@ -1,39 +1,19 @@
 package com.fdkankan.fusion.controller;
 
-import cn.hutool.captcha.CaptchaUtil;
-import cn.hutool.captcha.CircleCaptcha;
 import cn.hutool.captcha.LineCaptcha;
-import cn.hutool.captcha.ShearCaptcha;
-import cn.hutool.captcha.generator.CodeGenerator;
-import cn.hutool.captcha.generator.MathGenerator;
 import cn.hutool.captcha.generator.RandomGenerator;
-import cn.hutool.crypto.digest.MD5;
-import cn.hutool.http.ContentType;
-import com.alibaba.fastjson.JSONObject;
-import com.fdkankan.fusion.common.ResultCode;
 import com.fdkankan.fusion.common.ResultData;
-import com.fdkankan.fusion.common.util.MD5Checksum;
 import com.fdkankan.fusion.common.util.RedisKeyUtil;
-import com.fdkankan.fusion.common.util.StringUtils;
-import com.fdkankan.fusion.exception.BusinessException;
 import com.fdkankan.fusion.response.UserAddRequest;
 import com.fdkankan.fusion.service.ITmUserService;
 import com.fdkankan.redis.util.RedisUtil;
-import jdk.nashorn.internal.runtime.regexp.joni.Config;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.compress.utils.OsgiUtils;
-import org.apache.http.HttpHeaders;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.autoconfigure.kafka.KafkaProperties;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import java.awt.image.BufferedImage;
 import java.io.IOException;
-import java.nio.charset.StandardCharsets;
-import java.security.Security;
-import java.util.Properties;
 @RestController
 @RequestMapping("/notAuth")
 @Slf4j
@@ -73,11 +53,4 @@ public class NoLoginController {
         return ResultData.ok( tmUserService.getMsgAuthCode(phoneNum));
     }
 
-
-    public static void main(String[] args) {
-        String passwordHash = MD5.create().digestHex("6N^KJTG*GkWj3C");
-        System.out.println(passwordHash);
-        String passwordHash2 = MD5.create().digestHex(passwordHash);
-        System.out.println(passwordHash2);
-    }
 }

+ 1 - 1
src/main/java/com/fdkankan/fusion/controller/SceneController.java

@@ -95,7 +95,7 @@ public class SceneController extends BaseController{
             Long size = null;
             String sceneObjPath =null;
 
-            if(type == 2 || type == 5){  //点云
+            if(type == 2 || type == 5 || type == 7){  //点云
                 sceneObjPath = String.format(FilePath.LASER_OSS_PATH, num,num) ;
                 fileInfo = minIoUploadService.getFileStatusInfo(sceneObjPath);
             }else {

+ 44 - 81
src/main/java/com/fdkankan/fusion/controller/UploadController.java

@@ -1,5 +1,6 @@
 package com.fdkankan.fusion.controller;
 
+import cn.dev33.satoken.stp.StpUtil;
 import com.fdkankan.fusion.common.FilePath;
 import com.fdkankan.fusion.common.ResultCode;
 import com.fdkankan.fusion.common.util.MinIoChunkUtils;
@@ -25,7 +26,7 @@ import java.util.Map;
 
 @RestController
 @RequestMapping("/upload")
-public class UploadController {
+public class UploadController extends BaseController{
 
     @Autowired
     UploadService uploadService;
@@ -41,87 +42,54 @@ public class UploadController {
 
     @Autowired
     IUploadChunkService uploadChunkService;
-    @Autowired
-    IUploadSceneService uploadSceneService;
 
     @PostMapping("/init-chunk-upload")
     public ResultData initChunkUpload(@RequestBody UploadChunk uploadDto){
-        if(StringUtils.isBlank(uploadDto.getFileMd5()) || StringUtils.isBlank(uploadDto.getFileName()) || uploadDto.getFileSize() ==null){
+        if(uploadDto.getFileType() == null || StringUtils.isBlank(uploadDto.getTitle()) ||StringUtils.isBlank(uploadDto.getFileMd5())
+                || StringUtils.isBlank(uploadDto.getFileName()) || uploadDto.getFileSize() ==null){
             throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
         }
-
+        uploadDto.setDeptId(getDeptId());
+        uploadDto.setUserName(getUserName());
         String suffix = uploadDto.getFileName().substring(uploadDto.getFileName().lastIndexOf("."));
-
-        Long chunkCount = uploadDto.getFileSize() / MinIoChunkUtils.chunkSize < 0 ? 1:uploadDto.getFileSize() / MinIoChunkUtils.chunkSize ;
+        uploadDto.setChunkSize(MinIoChunkUtils.chunkSize);
+        Long chunkCount = uploadDto.getFileSize() / MinIoChunkUtils.chunkSize <= 0 ? 1:uploadDto.getFileSize() / MinIoChunkUtils.chunkSize ;
         uploadDto.setChunkCount(chunkCount);
-
-        //校验文件md5,该文件是否上传过
-        UploadChunk uploadChunk = uploadChunkService.getByFileMd5(uploadDto.getFileMd5());
-
-        if(uploadChunk != null){
-            if(uploadChunk.getUploadStatus() == 1 ){
-                return ResultData.ok(uploadChunk);
-            }
-            //续传
-            //获取到该文件已上传分片
-            List<ChunkVo> uploadChunkVos  = new ArrayList<>();
+        uploadDto.setSuffix(suffix);
+        String filePath = uploadDto.getFileMd5() +"_result"+suffix;
+        List<ChunkVo> uploadChunkVos  = new ArrayList<>();
+        if(!MinIoChunkUtils.isObjectExist(MinIoChunkUtils.chunkBucKet,filePath)){
+            //文件不存在创建新文件
             Map<Integer,String> okChunkMap = new HashMap<>();
             if(uploadDto.getChunkCount() >1){
-                  okChunkMap = MinIoChunkUtils.mapChunkObjectNames(MinIoChunkUtils.chunkBucKet,uploadDto.getFileMd5());
+                //获取到该文件已上传分片
+                if( MinIoChunkUtils.isObjectExist(MinIoChunkUtils.chunkBucKet,uploadDto.getFileMd5())){
+                    okChunkMap = MinIoChunkUtils.mapChunkObjectNames(MinIoChunkUtils.chunkBucKet,uploadDto.getFileMd5());
+                }
             }
             for (int i = 1; i <= uploadDto.getChunkCount(); i++) {
-                //判断当前分片是否已经上传过了
-                if(!okChunkMap.containsKey(i)){
-                    //生成分片上传url
-                    ChunkVo url = new ChunkVo();
-                    url.setPartNumber(MinIoChunkUtils.buZero(uploadDto.getChunkCount(),i));
-                    String uploadUrl = null;
-                    if(uploadDto.getChunkCount() >1){
-                         uploadUrl = MinIoChunkUtils.createUploadChunkUrl(MinIoChunkUtils.chunkBucKet,uploadDto.getFileMd5(),url.getPartNumber());
-                    }else {
-                         uploadUrl = MinIoChunkUtils.createUploadUrl(MinIoChunkUtils.chunkBucKet,uploadDto.getFileMd5() +"_result"+suffix);
-                    }
-                    url.setUploadUrl(uploadUrl);
-                    uploadChunkVos.add(url);
+                if(okChunkMap.containsKey(i)){
+                    continue;
                 }
+                ChunkVo url = new ChunkVo();
+                String uploadUrl = null;
+                url.setPartNumber(MinIoChunkUtils.buZero(uploadDto.getChunkCount(),i));
+                if(uploadDto.getChunkCount() >1){
+                    uploadUrl = MinIoChunkUtils.createUploadChunkUrl(MinIoChunkUtils.chunkBucKet,uploadDto.getFileMd5(),url.getPartNumber());
+                }else {
+                    uploadUrl = MinIoChunkUtils.createUploadUrl(MinIoChunkUtils.chunkBucKet,filePath);
+                }
+                url.setUploadUrl(uploadUrl);
+                uploadChunkVos.add(url);
             }
-            UploadChunkVo vo = new UploadChunkVo();
-            BeanUtils.copyProperties(uploadChunk,vo);
-            vo.setUploadChunkVos(uploadChunkVos);
-            return ResultData.ok(vo);
-        }
-        //初次上传和已有文件信息但未上传任何分片的情况下则直接生成所有上传url
-        List<ChunkVo> uploadChunkVos  = new ArrayList<>();
-        List<String> uploadUrls = new ArrayList<>();
-        if(uploadDto.getChunkCount() >1){
-            uploadUrls = MinIoChunkUtils.createUploadChunkUrlList(MinIoChunkUtils.chunkBucKet,uploadDto.getFileMd5(),uploadDto.getChunkCount());
-        }else {
-            uploadUrls.add("1");
-        }
-        for (int i = 1; i <= uploadUrls.size(); i++) {
-            ChunkVo url = new ChunkVo();
-            url.setPartNumber(MinIoChunkUtils.buZero(Long.valueOf(uploadUrls.size()),i));
-            String uploadUrl = null;
-            if(uploadDto.getChunkCount() >1){
-                uploadUrl = MinIoChunkUtils.createUploadChunkUrl(MinIoChunkUtils.chunkBucKet,uploadDto.getFileMd5(),url.getPartNumber());
-            }else {
-                uploadUrl = MinIoChunkUtils.createUploadUrl(MinIoChunkUtils.chunkBucKet,uploadDto.getFileMd5() +"_result"+suffix);
-            }
-            url.setUploadUrl(uploadUrl);
-            uploadChunkVos.add(url);
         }
 
-        //向数据库中记录该文件的上传信息
-        UploadChunk uploadChunk2 = new UploadChunk();
-        uploadChunk2.setBucketName(MinIoChunkUtils.chunkBucKet);
-        uploadChunk2.setChunkCount(uploadDto.getChunkCount());
-        uploadChunk2.setFileMd5(uploadDto.getFileMd5());
-        uploadChunk2.setFileName(uploadDto.getFileName());
-        uploadChunk2.setSuffix(suffix);
-        uploadChunkService.save(uploadChunk2);
+        uploadDto.setBucketName(MinIoChunkUtils.chunkBucKet);
+        uploadDto.setFilePath(filePath);
+        uploadChunkService.saveOrUpdate(uploadDto);
 
         UploadChunkVo vo = new UploadChunkVo();
-        BeanUtils.copyProperties(uploadChunk2,vo);
+        BeanUtils.copyProperties(uploadDto,vo);
         vo.setUploadChunkVos(uploadChunkVos);
         return ResultData.ok(vo);
     }
@@ -129,31 +97,26 @@ public class UploadController {
 
     @PostMapping("/compose-file")
     public ResultData composeFile(@RequestBody UploadChunk uploadDto){
-        if(StringUtils.isBlank(uploadDto.getFileMd5()) ){
+        if(uploadDto.getId() == null ){
             throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
         }
-        UploadChunk uploadChunk = uploadChunkService.getByFileMd5(uploadDto.getFileMd5());
+        UploadChunk uploadChunk = uploadChunkService.getById(uploadDto.getId());
         if(uploadChunk == null){
             throw new BusinessException(ResultCode.FILE_NOT_EXIST);
         }
-        //自定义文件名称
-        String fileName = uploadDto.getFileName();
-        String suffix = fileName.substring(fileName.lastIndexOf("."));
-        fileName = uploadDto.getFileMd5()+"_result" + suffix;
-        //合并文件
-        String url = "/"+fileName;
-
-        //根据md5获取所有分片文件名称(minio的文件名称 = 文件path)
-        if(uploadChunk.getChunkCount() >1){
-            List<String> chunks = MinIoChunkUtils.listChunkObjectNames(MinIoChunkUtils.chunkBucKet,uploadDto.getFileMd5());
-            if(!MinIoChunkUtils.composeObject(MinIoChunkUtils.chunkBucKet,chunks,fileName)){
+
+        if(!MinIoChunkUtils.isObjectExist(MinIoChunkUtils.chunkBucKet,uploadChunk.getFilePath()) && uploadChunk.getChunkCount() >1 ){
+            List<String> chunks = MinIoChunkUtils.listChunkObjectNames(MinIoChunkUtils.chunkBucKet,uploadChunk.getFileMd5());
+            if(!MinIoChunkUtils.composeObject(MinIoChunkUtils.chunkBucKet,chunks,uploadChunk.getFilePath())){
                 //String url = MinIoChunkUtils.getObjectUrl(MinIoChunkUtils.chunkBucKet,fileName,60);
-                uploadSceneService.updateStatusByUploadId(uploadChunk.getId(),-1);
+                uploadChunkService.updateStatusByUploadId(uploadChunk.getId(),-1);
                 throw new BusinessException(ResultCode.COMPOSE_FILE_ERROR);
             }
         }
-        uploadChunkService.updateUrlByMd5(uploadDto.getFileMd5(),url);
-        uploadSceneService.updateStatusByUploadId(uploadChunk.getId(),1);
+        uploadChunkService.updateStatusByUploadId(uploadChunk.getId(),1);
+        //后续处理
+        uploadChunkService.uploadSuccess(uploadChunk);
+
         return ResultData.ok(uploadChunk);
 
     }

+ 2 - 27
src/main/java/com/fdkankan/fusion/controller/UploadSceneController.java

@@ -1,17 +1,6 @@
 package com.fdkankan.fusion.controller;
 
 
-import com.fdkankan.fusion.common.ResultCode;
-import com.fdkankan.fusion.common.ResultData;
-import com.fdkankan.fusion.entity.UploadScene;
-import com.fdkankan.fusion.exception.BusinessException;
-import com.fdkankan.fusion.request.UploadSceneParam;
-import com.fdkankan.fusion.service.IUploadSceneService;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 
 import org.springframework.web.bind.annotation.RestController;
@@ -22,25 +11,11 @@ import org.springframework.web.bind.annotation.RestController;
  * </p>
  *
  * @author 
- * @since 2024-12-17
+ * @since 2024-12-23
  */
 @RestController
-@RequestMapping("/uploadScene")
+@RequestMapping("/fusion/uploadScene")
 public class UploadSceneController {
 
-
-    @Autowired
-    IUploadSceneService uploadSceneService;
-
-    @PostMapping("/add")
-    public ResultData add(@RequestBody UploadSceneParam param){
-        if(StringUtils.isBlank(param.getTitle()) || param.getType() == null || param.getUploadId() == null){
-            throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
-        }
-        UploadScene uploadScene = new UploadScene();
-        BeanUtils.copyProperties(param,uploadScene);
-        uploadSceneService.save(uploadScene);
-        return ResultData.ok();
-    }
 }
 

+ 5 - 0
src/main/java/com/fdkankan/fusion/entity/Model.java

@@ -95,4 +95,9 @@ public class Model implements Serializable {
 
     @TableField("render_type")
     private String renderType;
+
+    @TableField("upload_id")
+    private Integer uploadId;
+    @TableField("file_md5")
+    private String fileMd5;
 }

+ 8 - 0
src/main/java/com/fdkankan/fusion/entity/ScenePlus.java

@@ -116,5 +116,13 @@ public class ScenePlus implements Serializable {
     @TableLogic(value = "A",delval = "I")
     private String recStatus;
 
+    /**
+     */
+    @TableField("other_type")
+    private String otherType;
 
+    /**
+     */
+    @TableField("source_id")
+    private Integer sourceId;
 }

+ 24 - 1
src/main/java/com/fdkankan/fusion/entity/UploadChunk.java

@@ -32,6 +32,17 @@ public class UploadChunk implements Serializable {
     private Integer id;
 
     /**
+     * 标题
+     */
+    @TableField("title")
+    private String title;
+    /**
+     * 类型,0法如e57 ,1法如e57加全景图,2标准e57,3AZ系列数据包,4,obj模型,5,点云模型,6倾斜模型
+     */
+    @TableField("file_type")
+    private Integer fileType;
+
+    /**
      * 云名称
      */
     @TableField("fyun_type")
@@ -47,6 +58,11 @@ public class UploadChunk implements Serializable {
      */
     @TableField("chunk_count")
     private Long chunkCount;
+    /**
+     * 分片大小
+     */
+    @TableField("chunk_size")
+    private Long chunkSize;
 
     /**
      * 文件md5
@@ -79,7 +95,7 @@ public class UploadChunk implements Serializable {
     private String filePath;
 
     /**
-     * 0上传中,1上传完成
+     * 0上传中,1上传完成,-1上传失败
      */
     @TableField("upload_status")
     private Integer uploadStatus;
@@ -94,6 +110,13 @@ public class UploadChunk implements Serializable {
     @TableField("update_time")
     private Date updateTime;
 
+    /**
+     * 用户名称
+     */
+    @TableField("user_name")
+    private String userName;
 
+    @TableField("dept_id")
+    private String deptId;
 
 }

+ 4 - 1
src/main/java/com/fdkankan/fusion/entity/UploadScene.java

@@ -16,7 +16,7 @@ import lombok.Setter;
  * </p>
  *
  * @author 
- * @since 2024-12-17
+ * @since 2024-12-23
  */
 @Getter
 @Setter
@@ -49,6 +49,9 @@ public class UploadScene implements Serializable {
     @TableField("tm_user_id")
     private Integer tmUserId;
 
+    /**
+     * -1失败,0上传中,1上传成功
+     */
     @TableField("status")
     private Integer status;
 

+ 8 - 7
src/main/java/com/fdkankan/fusion/httpClient/FdService.java

@@ -22,6 +22,7 @@ import com.fdkankan.fusion.response.CameraVo;
 import com.fdkankan.fusion.service.IUploadChunkService;
 import com.fdkankan.fusion.service.IUploadSceneService;
 import com.fdkankan.redis.util.RedisUtil;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -33,6 +34,7 @@ import java.util.List;
 import java.util.stream.Collectors;
 
 @Service
+@Slf4j
 public class FdService {
 
     @Autowired
@@ -150,25 +152,24 @@ public class FdService {
     @Autowired
     IUploadSceneService uploadSceneService;
 
-    public void toFdCreateScene(UploadScene uploadScene) {
-        UploadChunk uploadChunk = uploadChunkService.getById(uploadScene.getUploadId());
+    public void toFdCreateScene(UploadChunk uploadChunk) {
         UploadEditSceneParam editSceneParam = new UploadEditSceneParam();
-        editSceneParam.setTitle(uploadScene.getTitle());
+        editSceneParam.setTitle(uploadChunk.getTitle());
         editSceneParam.setUserId(getFdUserId());
         editSceneParam.setPath(uploadChunk.getFilePath());
         editSceneParam.setBucket(uploadChunk.getBucketName());
         editSceneParam.setFyunType(uploadChunk.getFyunType());
-        editSceneParam.setOtherType(toFdType(uploadScene.getType()));
+        editSceneParam.setOtherType(toFdType(uploadChunk.getFileType()));
+        editSceneParam.setSourceId(uploadChunk.getId());
         try {
             JSONObject jsonObject = fdKKClient.reverseScene(editSceneParam);
             Integer code = jsonObject.getInteger("code");
             if(code != 0){
-               uploadScene.setStatus(-2);
+                uploadChunkService.updateStatusByUploadId(uploadChunk.getId(),-2);
             }
         }catch (Exception e){
-            uploadScene.setStatus(-2);
+            log.info("调用失败-toFdCreateScene:",e);
         }
-        uploadSceneService.updateById(uploadScene);
     }
 
     public String toFdType(Integer type){

+ 1 - 0
src/main/java/com/fdkankan/fusion/httpClient/request/UploadEditSceneParam.java

@@ -16,4 +16,5 @@ public class UploadEditSceneParam {
     private String path;
     private String bucket;
     private String fyunType;
+    private Integer sourceId;
 }

+ 4 - 0
src/main/java/com/fdkankan/fusion/mapper/IModelMapper.java

@@ -1,7 +1,10 @@
 package com.fdkankan.fusion.mapper;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fdkankan.fusion.entity.Model;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fdkankan.fusion.request.ModelPram;
+import com.fdkankan.fusion.response.ModelVo;
 import org.apache.ibatis.annotations.Mapper;
 
 /**
@@ -15,4 +18,5 @@ import org.apache.ibatis.annotations.Mapper;
 @Mapper
 public interface IModelMapper extends BaseMapper<Model> {
 
+    Page<ModelVo> pageList(Page<Object> objectPage, ModelPram param);
 }

+ 4 - 0
src/main/java/com/fdkankan/fusion/mapper/IUploadChunkMapper.java

@@ -1,7 +1,10 @@
 package com.fdkankan.fusion.mapper;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fdkankan.fusion.entity.UploadChunk;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fdkankan.fusion.request.ScenePram;
+import com.fdkankan.fusion.response.SceneVo;
 import org.apache.ibatis.annotations.Mapper;
 
 /**
@@ -15,4 +18,5 @@ import org.apache.ibatis.annotations.Mapper;
 @Mapper
 public interface IUploadChunkMapper extends BaseMapper<UploadChunk> {
 
+    Page<SceneVo> getScenePageList(Page<Object> objectPage, ScenePram param);
 }

+ 1 - 1
src/main/java/com/fdkankan/fusion/mapper/IUploadSceneMapper.java

@@ -10,7 +10,7 @@ import org.apache.ibatis.annotations.Mapper;
  * </p>
  *
  * @author 
- * @since 2024-12-17
+ * @since 2024-12-23
  */
 @Mapper
 public interface IUploadSceneMapper extends BaseMapper<UploadScene> {

+ 2 - 0
src/main/java/com/fdkankan/fusion/request/ModelPram.java

@@ -12,5 +12,7 @@ public class ModelPram extends RequestBase {
     private Integer modelId;
     private Integer caseId;
     private String deptId;
+    private List<String> deptIds;
     private String renderType;
+    private Integer uploadId;
 }

+ 1 - 1
src/main/java/com/fdkankan/fusion/request/ScenePram.java

@@ -48,7 +48,7 @@ public class ScenePram extends RequestBase {
     }
 
     public Integer getIsObj() {
-        if(type == 4 || type == 6){
+        if(type != null && (type == 4 || type == 6)){
             return 1;
         }
         return isObj;

+ 2 - 1
src/main/java/com/fdkankan/fusion/request/UploadSceneParam.java

@@ -1,9 +1,10 @@
 package com.fdkankan.fusion.request;
 
+import com.fdkankan.fusion.common.RequestBase;
 import lombok.Data;
 
 @Data
-public class UploadSceneParam {
+public class UploadSceneParam extends RequestBase {
     private String title;
     private Integer type;  //0法如e57 ,1法如e57加全景图,2标准e57,3AZ系列数据包
     private Integer uploadId;

+ 12 - 0
src/main/java/com/fdkankan/fusion/response/ModelVo.java

@@ -0,0 +1,12 @@
+package com.fdkankan.fusion.response;
+
+import com.fdkankan.fusion.entity.Model;
+import lombok.Data;
+
+@Data
+public class ModelVo extends Model {
+    private Integer uploadStatus;
+    private String uploadTitle;
+    private Integer fileType;
+
+}

+ 4 - 0
src/main/java/com/fdkankan/fusion/response/SceneVo.java

@@ -14,6 +14,7 @@ public class SceneVo extends Model {
     private String sceneName;
     private String snCode;
     private Integer status;
+    private Integer uploadStatus;
     private String thumb;
     private String title;
     private Integer viewCount;
@@ -25,6 +26,9 @@ public class SceneVo extends Model {
     private Boolean bind = true;
     private String deptId;
     private String deptName;
+    private Integer sceneId;
+    private Integer fileType;
+    private String fileSize;
 
     /**
      *      "    Scene_Location_Slam  = 0, //slam\n" +

+ 5 - 0
src/main/java/com/fdkankan/fusion/service/IModelService.java

@@ -3,6 +3,7 @@ package com.fdkankan.fusion.service;
 import com.fdkankan.fusion.common.PageInfo;
 import com.fdkankan.fusion.entity.Model;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.fdkankan.fusion.entity.UploadChunk;
 import com.fdkankan.fusion.request.ModelPram;
 import org.springframework.web.multipart.MultipartFile;
 
@@ -46,4 +47,8 @@ public interface IModelService extends IService<Model> {
     HashMap<String, Model> getMapByNum(List<String> numList);
 
     void copyModel(Integer modelId);
+
+    void copyModel(Model modelEntity,UploadChunk uploadChunk);
+
+    Model getByUploadSuccess(String fileMd5);
 }

+ 9 - 0
src/main/java/com/fdkankan/fusion/service/IUploadChunkService.java

@@ -1,7 +1,10 @@
 package com.fdkankan.fusion.service;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fdkankan.fusion.entity.UploadChunk;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.fdkankan.fusion.request.ScenePram;
+import com.fdkankan.fusion.response.SceneVo;
 
 /**
  * <p>
@@ -16,4 +19,10 @@ public interface IUploadChunkService extends IService<UploadChunk> {
     UploadChunk getByFileMd5(String fileMd5);
 
     void updateUrlByMd5(String fileMd5, String url);
+
+    void updateStatusByUploadId(Integer id, Integer status);
+
+    void uploadSuccess(UploadChunk uploadChunk);
+
+    Page<SceneVo> getScenePageList(Page<Object> objectPage, ScenePram param);
 }

+ 1 - 2
src/main/java/com/fdkankan/fusion/service/IUploadSceneService.java

@@ -9,9 +9,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
  * </p>
  *
  * @author 
- * @since 2024-12-17
+ * @since 2024-12-23
  */
 public interface IUploadSceneService extends IService<UploadScene> {
 
-    void updateStatusByUploadId(Integer uploadId, Integer status);
 }

+ 35 - 17
src/main/java/com/fdkankan/fusion/service/impl/CaseNumServiceImpl.java

@@ -58,8 +58,8 @@ public class CaseNumServiceImpl extends ServiceImpl<ICaseNumMapper, CaseNumEntit
     ICaseTagService caseTagService;
     @Autowired
     ICaseTagPointService caseTagPointService;
-    @Autowired
-    ThreadService threadService;
+   // @Autowired
+    //ThreadService threadService;
 
     @Override
     public List<CaseNumEntity> getByCaseId(Integer caseId) {
@@ -102,7 +102,7 @@ public class CaseNumServiceImpl extends ServiceImpl<ICaseNumMapper, CaseNumEntit
                 model.setType(param.getType());
                 model.setModelType("pointcloud");    //深时点云类型
                 model.setCreateStatus(1);
-                if(param.getType() == 0 || param.getType() == 1 || param.getType() == 4 || param.getType() == 6){           //看看,看见
+                if(param.getType() == 0 || param.getType() == 1 || param.getType() == 4 || param.getType() == 6 || param.getType() == 8){           //看看,看见
                     String mesh3DtilesPath  = String.format(FilePath.OBJ_OSS_PATH,num) + "/images/3dtiles/tileset.json";
                     String sizePath = String.format(FilePath.OBJ_OSS_PATH,num) + "/images/3dtiles";
                     if(uploadToOssUtil.existKey(mesh3DtilesPath)){
@@ -111,12 +111,9 @@ public class CaseNumServiceImpl extends ServiceImpl<ICaseNumMapper, CaseNumEntit
                         model.setModelGlbUrl(JSONArray.toJSONString(Arrays.asList(queryPath +mesh3DtilesPath)));
                         model.setModelSize(FileWriterUtil.setFileSize(uploadToOssUtil.getSize( sizePath)));
                     }else {
-                        model.setCreateStatus(2);
-                        threadService.objToB3dm(num,param.getType());
-//                        model.setModelObjUrl(String.format(FilePath.OBJ_LOCAL_PATH,environment ,num) +"/mesh.obj");
-//                        model.setModelGlbUrl(getGlbUrl(param.getType(),num,model));
-//                        model.setModelType("b3dm");
-//                        model.setModelDateType("b3dm");
+                        model.setModelObjUrl(String.format(FilePath.OBJ_LOCAL_PATH,environment ,num) +"/mesh.obj");
+                        model.setModelGlbUrl(getGlbUrl(param.getType(),num,model));
+                        model.setModelType("glb");
                     }
 
                 }
@@ -136,7 +133,34 @@ public class CaseNumServiceImpl extends ServiceImpl<ICaseNumMapper, CaseNumEntit
 
 
     private String getGlbUrl(Integer type, String num,Model model) {
-
+        if(type == 0 || type == 1 || type == 4 || type == 6 || type == 8){ //看看,看见
+            String objPath = String.format(FilePath.OBJ_LOCAL_PATH ,environment,num);
+            ShellUtil.yunDownload(String.format(FilePath.OBJ_OSS_PATH, num)+"/data/mesh" ,objPath);
+            List<String> localGlbPaths = new ArrayList<>();
+            List<String> ossGlbPaths = new ArrayList<>();
+            File localFile = new File(objPath);
+            this.toGlB(localFile,localGlbPaths);
+            Long modelSize = 0L;
+            if(localGlbPaths.size() >0){
+                for (String localGlbPath : localGlbPaths) {
+                    String ossGlbPath = localGlbPath.replace(FilePath.LOCAL_BASE_PATH,"fusion/");
+                    uploadToOssUtil.uploadOss(localGlbPath,ossGlbPath);
+                    if(ossGlbPath.contains("lod_")){
+                        if(ossGlbPath.contains("lod_0")){
+                            ossGlbPaths.add(queryPath  +ossGlbPath);
+                            modelSize +=  uploadToOssUtil.getSize(ossGlbPath);
+                        }
+                        continue;
+                    }
+                    modelSize +=  uploadToOssUtil.getSize(ossGlbPath);
+                    ossGlbPaths.add(queryPath +ossGlbPath);
+                }
+                model.setModelSize(FileWriterUtil.setFileSize(modelSize));
+                FileUtil.del(objPath);
+                return JSONArray.toJSONString(ossGlbPaths);
+            }
+            FileUtil.del(objPath);
+        }
         return null;
     }
 
@@ -146,14 +170,8 @@ public class CaseNumServiceImpl extends ServiceImpl<ICaseNumMapper, CaseNumEntit
             if(file.isDirectory()){
                 toGlB(file,localGlbPath);
             }
-            if(file.getParent().contains("lod_") && file.getParent().contains("lod_0") ){
-                String glbPath =  OBJToGLBUtil.objToB3dm(file.getPath(),file.getParentFile().getPath()+"/b3dm");
-                localGlbPath.add(glbPath);
-                continue;
-            }
-
             if(file.getName().contains(".obj")){
-               String glbPath =  OBJToGLBUtil.objToB3dm(file.getPath(),file.getParentFile().getPath()+"/b3dm");
+               String glbPath =  OBJToGLBUtil.objToGlb(file.getPath(),file.getPath().replace(".obj",".glb") );
                localGlbPath.add(glbPath);
             }
         }

+ 1 - 1
src/main/java/com/fdkankan/fusion/service/impl/CaseServiceImpl.java

@@ -208,7 +208,7 @@ public class CaseServiceImpl extends ServiceImpl<ICaseMapper, CaseEntity> implem
             }
             List<String> delNumList2 = new ArrayList<>();
             for (SceneVo sceneVo : sceneVos) {
-                if(sceneVo.getStatus() !=2 && sceneVo.getStatus() !=3 && sceneVo.getType().equals(type)){
+                if(sceneVo.getStatus() != null && sceneVo.getStatus() !=2 && sceneVo.getStatus() !=3 && sceneVo.getType().equals(type)){
                     delNumList2.add(sceneVo.getNum());
                 }
             }

+ 1 - 1
src/main/java/com/fdkankan/fusion/service/impl/DownService.java

@@ -153,7 +153,7 @@ public class DownService implements IDownService {
         sceneDownloadLogEntity.setSceneTitle(scenePlus.getTitle());
         sceneDownloadLogEntity.setUserName(userName);
         sceneDownloadLogEntity.setNickName(nickName);
-        sceneDownloadLogEntity.setSnCode(camera.getSnCode());
+        sceneDownloadLogEntity.setSnCode(camera !=null ?camera.getSnCode():null);
         sceneDownloadLogEntity.setDeptName(tmDepartment.getName());
         sceneDownloadLogEntity.setDeptLevel(tmDepartment.getDeptType());
         sceneDownloadLogEntity.setDeptId(deptId);

+ 33 - 29
src/main/java/com/fdkankan/fusion/service/impl/ModelServiceImpl.java

@@ -21,6 +21,7 @@ import com.fdkankan.fusion.entity.*;
 import com.fdkankan.fusion.exception.BusinessException;
 import com.fdkankan.fusion.mapper.IModelMapper;
 import com.fdkankan.fusion.request.ModelPram;
+import com.fdkankan.fusion.response.ModelVo;
 import com.fdkankan.fusion.response.SceneVo;
 import com.fdkankan.fusion.service.*;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -124,31 +125,26 @@ public class ModelServiceImpl extends ServiceImpl<IModelMapper, Model> implement
 
     @Override
     public PageInfo pageList(ModelPram param, String userName) {
-        LambdaQueryWrapper<Model> wrapper = new LambdaQueryWrapper<>();
         List<String> deptIds = tmDepartmentService.getDeptIds();
         if(deptIds.size() <=0){
             return PageInfo.PageInfo(new Page<>(param.getPageNum(),param.getPageSize()));
         }
         if(param.getCaseId() !=null){
             String deptId =  caseService.getDeptId(param.getCaseId());
-            wrapper.eq(Model::getDeptId,deptId);
+            param.setDeptId(deptId);
         }
         List<String> deptIds2 = tmDepartmentService.getSonByDeptIdAndDeptIds(deptIds, param.getDeptId());
-        wrapper.in(Model::getDeptId,deptIds2);
-        wrapper.eq(Model::getType,3);
-        wrapper.notIn(Model::getCreateStatus,-2);
+        param.setDeptIds(deptIds2);
         if(param.getStatus()!=null){    //参数2为成功,数据库中成功为1
-            wrapper.eq(Model::getCreateStatus,param.getStatus() == 2 ? 1 :param.getStatus());
-        }
-        if(StringUtils.isNotBlank(param.getModelTitle())){
-            wrapper.like(Model::getModelTitle,param.getModelTitle());
+            param.setStatus(param.getStatus() == 2 ? 1 :param.getStatus());
         }
-        wrapper.orderByDesc(Model::getCreateTime);
-        Page<Model> page = this.page(new Page<>(param.getPageNum(),param.getPageSize()),wrapper);
-        Set<String> deptIdset = page.getRecords().stream().map(Model::getDeptId).collect(Collectors.toSet());
+       // Page<Model> page = this.page(new Page<>(param.getPageNum(),param.getPageSize()),wrapper);
+        Page<ModelVo> page =  this.getBaseMapper().pageList(new Page<>(param.getPageNum(),param.getPageSize()),param);
+
+        Set<String> deptIdset = page.getRecords().stream().map(ModelVo::getDeptId).collect(Collectors.toSet());
         HashMap<String, TmDepartment> mapByDept = tmDepartmentService.getMapByDeptIds(deptIdset);
-        for (Model model : page.getRecords()) {
-            if(model.getType() == 3 && StringUtils.isEmpty(model.getNum())) {
+        for (ModelVo model : page.getRecords()) {
+            if( model.getModelId() != null && StringUtils.isEmpty(model.getNum()) ) {
                 model.setNum(model.getModelId().toString());
             }
             if(StringUtils.isNotBlank(model.getDeptId())){
@@ -302,28 +298,36 @@ public class ModelServiceImpl extends ServiceImpl<IModelMapper, Model> implement
         if(modelEntity == null){
             throw new BusinessException(ResultCode.MODEL_NOT_EXIST);
         }
-        Integer oldId = modelEntity.getModelId();
         modelEntity.setModelTitle(modelEntity.getModelTitle() +"(copy)");
         modelEntity.setModelId(null);
         this.save(modelEntity);
-//        if(StringUtils.isNotBlank(modelEntity.getModelGlbUrl())){
-//            String modelGlbUrl = modelEntity.getModelGlbUrl();
-//            copyOssResource(modelGlbUrl,oldId,modelEntity.getModelId());
-//            String newModelObjUrl = modelGlbUrl.replaceAll(oldId+"",modelEntity.getModelId()+"");
-//            modelEntity.setModelGlbUrl(newModelObjUrl);
-//            this.updateById(modelEntity);
-//        }
+    }
 
+    @Override
+    public void copyModel(Model modelEntity,UploadChunk uploadChunk) {
+        if(modelEntity == null){
+            return;
+        }
+        modelEntity.setModelTitle(uploadChunk.getTitle());
+        modelEntity.setUserName(uploadChunk.getUserName());
+        modelEntity.setDeptId(uploadChunk.getDeptId());
+        modelEntity.setModelId(null);
+        this.save(modelEntity);
     }
 
 
-    private void copyOssResource(String modelGlbUrl,Integer oldModelId,Integer newModelId) {
-        JSONArray jsonArray = JSONArray.parseArray(modelGlbUrl);
-        for (Object object : jsonArray) {
-            String ossUrl = (String) object;
-            String oldOssPath = ossUrl.replaceAll(queryPath,"");
-            String newOssPath = oldOssPath.replaceAll(oldModelId+"",newModelId+"");
-            uploadToOssUtil.copyFile(oldOssPath,newOssPath);
+    @Override
+    public Model getByUploadSuccess(String fileMd5) {
+        LambdaQueryWrapper<Model> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(Model::getFileMd5,fileMd5);
+        wrapper.eq(Model::getCreateStatus,1);
+        List<Model> list = this.list(wrapper);
+        if(list.isEmpty()){
+            return null;
         }
+        return list.get(0);
     }
+
+
+
 }

+ 25 - 8
src/main/java/com/fdkankan/fusion/service/impl/SceneService.java

@@ -65,6 +65,8 @@ public class SceneService implements ISceneService {
     IScenePlusService scenePlusService;
     @Autowired
     ITmUserService tmUserService;
+    @Autowired
+    IUploadChunkService uploadChunkService;
 
     @Override
     public List<SceneVo> getSceneListAndModel(ScenePram param) {
@@ -117,21 +119,32 @@ public class SceneService implements ISceneService {
                 param.setNumList(numList);
             }
         }
-
-        Page<SceneVo> sceneVoPage = scenePlusService.pageList(new Page<>(param.getPageNum(), param.getPageSize()), param);
+        //上传的场景
+        Page<SceneVo> sceneVoPage;
+        if(param.getType() == 7 || param.getType() == 8 ){
+             sceneVoPage = uploadChunkService.getScenePageList(new Page<>(param.getPageNum(),param.getPageSize()),param);
+            for (SceneVo record : sceneVoPage.getRecords()) {
+                if(record.getSceneId() != null){
+                    record.setTitle(record.getSceneName());
+                }
+                record.setIsLaser(param.getType() == 7);
+            }
+        }else {
+             sceneVoPage = scenePlusService.pageList(new Page<>(param.getPageNum(), param.getPageSize()), param);
+        }
 
         HashMap<String,JSONObject> laserMap = new HashMap<>();
-        if(param.getType() == 2 || param.getType() == 5){
-            List<String> laserNumList = sceneVoPage.getRecords().stream().filter(e-> e.getSceneSource() == 4 || e.getSceneSource() == 5)
+        if(param.getType() == 2 || param.getType() == 5 || param.getType() == 7){
+            List<String> laserNumList = sceneVoPage.getRecords().stream().filter(e->e.getSceneSource() != null && ( e.getSceneSource() == 4 || e.getSceneSource() == 5))
                     .map(SceneVo::getNum).collect(Collectors.toList());
             if(!laserNumList.isEmpty()){
                 List<JSONObject> laserList = scenePlusService.getLaserScene(laserNumList);
                 laserList.forEach(e->laserMap.put(e.getString("scene_code"),e));
             }
         }
-
-        List<String> modelingScene = sceneVoPage.getRecords().stream().filter(e -> e.getStatus() == 0).map(SceneVo::getNum).collect(Collectors.toList());
-        HashMap<String,Boolean> modelingMap =  mqSendLogService.getMapByNumList(modelingScene);
+        HashMap<String,Boolean> modelingMap = new HashMap<>();
+        List<String> modelingScene = sceneVoPage.getRecords().stream().filter(e -> e.getStatus() != null && e.getStatus() == 0).map(SceneVo::getNum).collect(Collectors.toList());
+        modelingMap =  mqSendLogService.getMapByNumList(modelingScene);
 
         List<String> userNameList = sceneVoPage.getRecords().stream().map(Model::getUserName).collect(Collectors.toList());
         HashMap<String, TmDepartment> map = tmUserService.getMapByUserNames(userNameList);
@@ -147,10 +160,11 @@ public class SceneService implements ISceneService {
             sceneVo.setPayStatus(1);
 
             sceneVo.setStatus(setLaserStatus(sceneVo.getStatus(),sceneVo.getPayStatus()));
-            if(param.getType() == 2 ||  param.getType() == 5){ //
+            if(param.getType() == 2 ||  param.getType() == 5 || param.getType() == 7){  //
                 JSONObject jsonObject = laserMap.get(sceneVo.getNum());
                 if(jsonObject != null){
                     sceneVo.setTitle(jsonObject.getString("title"));
+                    sceneVo.setStatus(jsonObject.getInteger("status"));
                 }
             }
             sceneVo.setSceneName(sceneVo.getTitle());
@@ -222,6 +236,9 @@ public class SceneService implements ISceneService {
 
     private Integer setLaserStatus(Integer status,Integer payStatus){
         //深时状态,-1:场景被删 0:计算中 1计算失败 2计算成功 3封存 4生成OBJ中
+        if(status == null){
+            return null;
+        }
         if(status == 0){
             return 0;
         }

+ 4 - 0
src/main/java/com/fdkankan/fusion/service/impl/ThreadService.java

@@ -4,8 +4,10 @@ import cn.hutool.core.io.FileUtil;
 import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.fdkankan.fusion.common.FilePath;
+import com.fdkankan.fusion.common.ResultCode;
 import com.fdkankan.fusion.common.util.*;
 import com.fdkankan.fusion.entity.Model;
+import com.fdkankan.fusion.entity.UploadChunk;
 import com.fdkankan.fusion.exception.BusinessException;
 import com.fdkankan.fusion.service.IModelService;
 import com.fdkankan.redis.util.RedisUtil;
@@ -258,4 +260,6 @@ public class ThreadService {
         }
     }
 
+
+
 }

+ 60 - 0
src/main/java/com/fdkankan/fusion/service/impl/UploadChunkServiceImpl.java

@@ -1,15 +1,37 @@
 package com.fdkankan.fusion.service.impl;
 
+import cn.hutool.core.io.FileUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fdkankan.fusion.common.FilePath;
 import com.fdkankan.fusion.common.ResultCode;
+import com.fdkankan.fusion.common.util.FileWriterUtil;
+import com.fdkankan.fusion.common.util.OBJToGLBUtil;
+import com.fdkankan.fusion.common.util.ShellUtil;
+import com.fdkankan.fusion.common.util.UploadToOssUtil;
+import com.fdkankan.fusion.entity.Model;
 import com.fdkankan.fusion.entity.UploadChunk;
 import com.fdkankan.fusion.exception.BusinessException;
+import com.fdkankan.fusion.httpClient.FdService;
 import com.fdkankan.fusion.mapper.IUploadChunkMapper;
+import com.fdkankan.fusion.request.ScenePram;
+import com.fdkankan.fusion.response.SceneVo;
+import com.fdkankan.fusion.service.IModelService;
 import com.fdkankan.fusion.service.IUploadChunkService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fdkankan.fusion.task.ThreadService2;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
 /**
  * <p>
  *  服务实现类
@@ -19,6 +41,7 @@ import org.springframework.stereotype.Service;
  * @since 2024-12-16
  */
 @Service
+@Slf4j
 public class UploadChunkServiceImpl extends ServiceImpl<IUploadChunkMapper, UploadChunk> implements IUploadChunkService {
 
     @Override
@@ -36,4 +59,41 @@ public class UploadChunkServiceImpl extends ServiceImpl<IUploadChunkMapper, Uplo
         wrapper.set(UploadChunk::getUploadStatus,1);
         this.update(wrapper);
     }
+
+    @Override
+    public void updateStatusByUploadId(Integer id, Integer status) {
+        LambdaUpdateWrapper<UploadChunk> wrapper = new LambdaUpdateWrapper<>();
+        wrapper.eq(UploadChunk::getId,id);
+        wrapper.set(UploadChunk::getUploadStatus,1);
+        this.update(wrapper);
+    }
+
+    @Autowired
+    FdService fdService;
+    @Autowired
+    ThreadService2 threadService2;
+    @Override
+    public void uploadSuccess(UploadChunk uploadChunk) {
+        switch (uploadChunk.getFileType()){
+            case 0:
+            case 1:
+            case 2:
+            case 3:
+                fdService.toFdCreateScene(uploadChunk);
+                return; //
+            case 4:
+            case 5:
+            case 6:
+                threadService2.toModel(uploadChunk);
+                return;
+        }
+    }
+
+
+    @Override
+    public Page<SceneVo> getScenePageList(Page<Object> objectPage, ScenePram param) {
+        return this.getBaseMapper().getScenePageList(objectPage,param);
+    }
+
+
 }

+ 1 - 38
src/main/java/com/fdkankan/fusion/service/impl/UploadSceneServiceImpl.java

@@ -1,57 +1,20 @@
 package com.fdkankan.fusion.service.impl;
 
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.fdkankan.fusion.entity.UploadScene;
-import com.fdkankan.fusion.httpClient.FdService;
-import com.fdkankan.fusion.httpClient.client.FdKKClient;
-import com.fdkankan.fusion.httpClient.request.UploadEditSceneParam;
 import com.fdkankan.fusion.mapper.IUploadSceneMapper;
 import com.fdkankan.fusion.service.IUploadSceneService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.List;
-
 /**
  * <p>
  *  服务实现类
  * </p>
  *
  * @author 
- * @since 2024-12-17
+ * @since 2024-12-23
  */
 @Service
 public class UploadSceneServiceImpl extends ServiceImpl<IUploadSceneMapper, UploadScene> implements IUploadSceneService {
 
-    @Autowired
-    FdService fdService;
-    @Override
-    public void updateStatusByUploadId(Integer uploadId, Integer status) {
-
-        LambdaUpdateWrapper<UploadScene> wrapper = new LambdaUpdateWrapper<>();
-        wrapper.eq(UploadScene::getUploadId,uploadId);
-        wrapper.eq(UploadScene::getStatus,0);
-        wrapper.set(UploadScene::getStatus,status);
-        this.update(wrapper);
-
-        if(status == 1){
-            List<UploadScene> byUploadId = this.getByUploadId(uploadId);
-            if(!byUploadId.isEmpty()){
-                for (UploadScene uploadScene : byUploadId) {
-                    fdService.toFdCreateScene(uploadScene);
-                }
-            }
-        }
-    }
-
-    private List<UploadScene> getByUploadId(Integer uploadId) {
-        LambdaQueryWrapper<UploadScene> wrapper = new LambdaQueryWrapper<>();
-        wrapper.eq(UploadScene::getUploadId,uploadId);
-        wrapper.eq(UploadScene::getStatus,0);
-        return this.list(wrapper);
-    }
-
-
 }

+ 186 - 0
src/main/java/com/fdkankan/fusion/task/ThreadService2.java

@@ -0,0 +1,186 @@
+package com.fdkankan.fusion.task;
+
+import cn.hutool.core.io.FileUtil;
+import com.fdkankan.fusion.common.FilePath;
+import com.fdkankan.fusion.common.ResultCode;
+import com.fdkankan.fusion.common.util.FileWriterUtil;
+import com.fdkankan.fusion.common.util.OBJToGLBUtil;
+import com.fdkankan.fusion.common.util.ShellUtil;
+import com.fdkankan.fusion.common.util.UploadToOssUtil;
+import com.fdkankan.fusion.entity.Model;
+import com.fdkankan.fusion.entity.UploadChunk;
+import com.fdkankan.fusion.exception.BusinessException;
+import com.fdkankan.fusion.service.IModelService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Service;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+@Service
+@Slf4j
+public class ThreadService2 {
+
+    @Autowired
+    IModelService modelService;
+    @Autowired
+    UploadToOssUtil uploadToOssUtil;
+
+
+    @Async
+    public void toModel(UploadChunk uploadChunk) {
+        Model model = modelService.getByUploadSuccess(uploadChunk.getFileMd5());
+        if(model != null){
+            modelService.copyModel(model,uploadChunk);
+            return;
+        }
+        model = new Model();
+        model.setModelTitle(uploadChunk.getTitle());
+        model.setModelSize(FileWriterUtil.setFileSize(uploadChunk.getFileSize()));
+        model.setType(3);
+        model.setUserName(uploadChunk.getUserName());
+        model.setDeptId(uploadChunk.getDeptId());
+        model.setCreateStatus(-1);
+        model.setUploadId(uploadChunk.getId());
+        model.setFileMd5(uploadChunk.getFileMd5());
+
+        String zipPath = FilePath.MNT_BASE_PATH+"model/"+ uploadChunk.getFilePath();
+        String unZipPath = FilePath.MNT_BASE_PATH+"model/"+ uploadChunk.getFileMd5();
+        ShellUtil.yunDownloadChunk(uploadChunk.getFilePath(),zipPath);
+        ShellUtil.unZip(zipPath,unZipPath);
+
+        File unZipFile = new File(unZipPath);
+        File modelFile = checkUnzip(unZipFile);
+        if(modelFile != null){
+            String modelFileFormat = modelFile.getName().split("\\.")[1].toLowerCase();
+            String url = null;
+            String resultFormat = modelFileFormat;
+            switch (modelFileFormat){
+                case "obj" :
+                    resultFormat = "glb";
+                    url = uploadObjOss(unZipPath,modelFile);break;
+                case "laz" :
+                case "shp" :
+                    url = uploadOss(unZipPath,modelFile); break;
+                case "b3dm" :
+                    url = uploadB3dm(unZipPath,modelFile); break;
+                case "las" :
+                case "ply" :
+                    url = uploadLasOrPly(unZipPath,modelFile);break;
+//                case "osgb":
+//                    resultFormat = "b3dm";
+//                    uploadOsgb(unZipPath,modelFile) ;break;
+                default:
+                    break;
+            }
+            model.setCreateStatus(1);
+            model.setModelDateType(modelFileFormat);
+            model.setModelGlbUrl(url);
+            model.setModelType(resultFormat);
+            ShellUtil.yunUpload(zipPath,zipPath.replace(FilePath.localPath,""));
+            model.setFileNewName(ossUrlPrefix + zipPath.replace(FilePath.localPath,""));
+        }
+
+        modelService.save(model);
+
+        FileUtil.del(zipPath);
+        FileUtil.del(unZipFile);
+    }
+
+
+    private File checkUnzip(File unZipFile) {
+        if(!unZipFile.exists() || !unZipFile.isDirectory()){
+            log.info("toModel-解压失败-error:,{}",unZipFile.getPath());
+            return null;
+        }
+        List<File> fileList = new ArrayList<>();
+        FileWriterUtil.getCanRunList(fileList,unZipFile);
+        if(fileList.size() <=0){
+            log.info("toModel-获取模型文件失败-error:{}",unZipFile.getPath());
+            return null;
+        }
+        File modelFile = fileList.get(0);
+
+        if(FileWriterUtil.isChinese(modelFile.getName())){
+            log.info("toModel-获取模型文件包含中文-error:,{}",unZipFile.getPath());
+            return null;
+        }
+        String modelFileFormat = modelFile.getName().split("\\.")[1].toLowerCase();
+        switch (modelFileFormat) {
+            case "obj":
+            case "laz":
+            case "shp":
+            case "b3dm":
+            case "las":
+            case "ply":
+                return modelFile;
+            default:
+                return null;
+        }
+    }
+
+
+    @Value("${upload.query-path}")
+    private String ossUrlPrefix;
+    private String uploadObjOss(String unzipPath, File modelFile) {
+        OBJToGLBUtil.checkObj(modelFile.getPath());
+        String localGlbPath = modelFile.getPath().replace(".obj",".glb");
+        OBJToGLBUtil.objToGlb2(modelFile.getPath(),localGlbPath);
+        String ossPath = unzipPath.replace(FilePath.localPath,"");
+        ShellUtil.yunUpload(unzipPath,ossPath);
+        if(!uploadToOssUtil.existKey(localGlbPath.replace(FilePath.localPath,""))){
+            return null;
+        }
+        FileUtil.del(unzipPath);
+        return  ossUrlPrefix +  localGlbPath.replace(FilePath.localPath,"");
+    }
+
+    private String uploadB3dm(String unzipPath, File modelFile) {
+        String b3dmJsonPath = FileWriterUtil.checkB3dmTileset(new File(unzipPath));
+        if(b3dmJsonPath == null){
+            throw new BusinessException(ResultCode.UPLOAD_FILE_OBJ_ERROR);
+        }
+        String ossPath = b3dmJsonPath.replace(FilePath.localPath, "");
+        uploadOss(unzipPath,modelFile);
+        if(!uploadToOssUtil.existKey(ossPath)){
+            return null;
+        }
+        return ossUrlPrefix +  ossPath;
+    }
+
+
+    private void uploadOsgb(String unzipPath, File modelFile) {
+        //容器不支持转化,通知fusion容器执行
+        HashMap<String,String > map = new HashMap<>();
+        map.put("path",unzipPath);
+    }
+
+
+
+    private String uploadOss(String unzipPath,File modelFile) {
+        String ossPath = unzipPath.replace(FilePath.localPath,"");
+        String modelOssPath = modelFile.getPath().replace(FilePath.localPath, "");
+        ShellUtil.yunUpload(unzipPath,ossPath);
+        if(!uploadToOssUtil.existKey(modelOssPath)){
+            return null;
+        }
+        FileUtil.del(unzipPath);
+        return ossUrlPrefix +  modelOssPath;
+    }
+
+    private String uploadLasOrPly(String unzipPath ,File modelFile) {
+        File mntFile = OBJToGLBUtil.lasOrPlyToBin(modelFile);
+        String ossPath = mntFile.getPath().replace(FilePath.localPath,"");
+        ShellUtil.yunUpload(mntFile.getPath(),ossPath);
+        if(!uploadToOssUtil.existKey(ossPath+"/webcloud/cloud.js")){
+            return null;
+        }
+        FileUtil.del(unzipPath);
+        return ossUrlPrefix +  ossPath + "/webcloud";
+    }
+}

+ 1 - 1
src/main/resources/application.yaml

@@ -125,6 +125,6 @@ minio:
   accessKey: 2dn1SibXOo1VrKWERTrE                         # 用户名
   secretKey: RrKrSifN6BwFpqMKp8g1xg4xoN0u8wUSuDEWkpMK      # 密码
   bucketChunk: fusion-chunk
-  chunkSize: 5253125
+  chunkSize: 10485760
 
 

+ 50 - 0
src/main/resources/mapper/fusion/ModelMapper.xml

@@ -2,4 +2,54 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.fdkankan.fusion.mapper.IModelMapper">
 
+    <select id="pageList" resultType="com.fdkankan.fusion.response.ModelVo">
+        select * from (
+        select
+        u.model_id,u.model_title,u.model_date_type,u.model_size,u.model_obj_url,u.model_glb_url,u.type,u.user_name,u.create_status,u.num,
+        u.model_type,u.tb_status,u.create_time,u.dept_id,u.file_new_name,u.render_type,u.upload_id,null as uploadTitle,null as uploadStatus,null as fileType
+        from t_model u
+        where u.tb_status = 0 and u.type = 3 and u.upload_id is null
+        <if test="param.deptId != null and param.deptId != ''">
+            and u.dept_id = #{param.deptId}
+        </if>
+        <if test="param.deptIds != null and param.deptIds.size >0">
+            and u.dept_id in
+            <foreach collection="param.deptIds" item="deptId" open="(" separator="," close=")">
+                #{deptId}
+            </foreach>
+        </if>
+        <if test="param.modelTitle != null and param.modelTitle !=''">
+            and u.model_tile like concat ('%',#{param.modelTitle},'%')
+        </if>
+        <if test="param.status != null ">
+            and u.create_status = #{param.status}
+        </if>
+        UNION all
+        select
+        u.model_id,u.model_title,u.model_date_type,u.model_size,u.model_obj_url,u.model_glb_url,u.type,uc.user_name,u.create_status,u.num,
+        u.model_type,uc.tb_status,uc.create_time,uc.dept_id,u.file_new_name,u.render_type,uc.id as upload_id,uc.title as uploadTitle,uc.upload_status ,uc.file_type
+        from t_upload_chunk uc
+        left join t_model u on uc.id = u.upload_id
+        where uc.tb_status = 0 and uc.file_type in (4,5,6)
+        <if test="param.deptId != null and param.deptId != ''">
+            and uc.dept_id = #{param.deptId}
+        </if>
+        <if test="param.deptIds != null and param.deptIds.size >0">
+            and uc.dept_id in
+            <foreach collection="param.deptIds" item="deptId" open="(" separator="," close=")">
+                #{deptId}
+            </foreach>
+        </if>
+        <if test="param.modelTitle != null and param.modelTitle !=''">
+            and (uc.title like concat ('%',#{param.modelTitle},'%') or
+            u.model_tile like concat ('%',#{param.modelTitle},'%'))
+        </if>
+        <if test="param.status != null ">
+            and u.create_status = #{param.status}
+        </if>
+        ) as tb
+        order by create_time desc
+    </select>
+
+
 </mapper>

+ 1 - 1
src/main/resources/mapper/fusion/ScenePlusMapper.xml

@@ -39,7 +39,7 @@
             left join t_scene_plus_ext e on s.id = e.plus_id
             left join t_camera a on s.camera_id = a.id
             left join t_user u on s.user_id = u.id
-        where s.rec_status = 'A'
+        where s.rec_status = 'A'  and s.other_type  not in ('E57_V1','E57_V2','E57_V3','AZ')
         <if test="param.snCode != null and param.snCode != ''">
             and a.sn_code like concat ('%',#{param.snCode},'%')
         </if>

+ 29 - 0
src/main/resources/mapper/fusion/UploadChunkMapper.xml

@@ -2,4 +2,33 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.fdkankan.fusion.mapper.IUploadChunkMapper">
 
+    <select id="getScenePageList" resultType="com.fdkankan.fusion.response.SceneVo">
+--         select s.id,s.title,s.num,s.scene_source ,a.sn_code,s.create_time, s.scene_status as status,e.thumb,e.web_site ,u.user_name from t_scene_plus s
+    select  u.id,u.title,s.num,s.scene_source,u.create_time,s.scene_status as status ,u.upload_status ,u.user_name,u.dept_id ,s.title as sceneName,s.id as sceneId,u.file_md5,u.file_type,u.file_size
+        from fd_fusion_xj.t_upload_chunk u
+        left join  4dkankan_v4.t_scene_plus s on u.id = s.source_id
+    where u.tb_status = 0
+        <if test="param.type != null and param.type ==7">
+              and u.file_type in (0,1,2)
+        </if>
+        <if test="param.type != null and param.type ==8">
+            and u.file_type = 3
+        </if>
+        <if test="param.status != null and param.status ==2">
+            and s.scene_status = -2
+        </if>
+        <if test="param.numList != null and param.numList.size >0">
+            and s.num in
+            <foreach collection="param.numList" item="num" open="(" separator="," close=")">
+                #{num}
+            </foreach>
+        </if>
+
+        <if test="param.sceneName != null and param.sceneName != ''">
+            and (u.title like concat ('%',#{param.sceneName},'%')
+                or s.title like concat ('%',#{param.sceneName},'%') )
+        </if>
+
+    order by  u.id desc
+    </select>
 </mapper>