lyhzzz 6 bulan lalu
induk
melakukan
7d16c02e59

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

@@ -6,11 +6,8 @@ import com.alibaba.fastjson.JSONObject;
 import com.fdkankan.fusion.common.FilePath;
 import com.fdkankan.fusion.common.ResultCode;
 import com.fdkankan.fusion.exception.BusinessException;
-import com.fdkankan.geo.GeoQueryUtil;
-import com.fdkankan.geo.GeoTransformUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
-import org.locationtech.proj4j.ProjCoordinate;
 import org.omg.CosNaming.NamingContextExtPackage.StringNameHelper;
 
 import java.io.*;

+ 41 - 0
src/main/java/com/fdkankan/fusion/common/util/SceneTypeUtil.java

@@ -0,0 +1,41 @@
+package com.fdkankan.fusion.common.util;
+
+public class SceneTypeUtil {
+
+
+    public static Integer getSceneSource(Integer type){
+        switch (type){
+            case 0: return 1;
+            case 1: return 3;
+            case 2: return 4;
+            case 4: return 4;
+            case 5: return 5;
+            case 6: return 5;
+            default:return 1;
+        }
+    }
+
+    public static Boolean isLaser(Integer type){
+        switch (type){
+            case 0: return false;
+            case 1: return false;
+            case 2: return true;
+            case 4: return false;
+            case 5: return true;
+            case 6: return false;
+            default:return false;
+        }
+    }
+
+    public static Boolean isLaserMesh(Integer type){
+        switch (type){
+            case 0: return false;
+            case 1: return false;
+            case 2: return false;
+            case 4: return true;
+            case 5: return false;
+            case 6: return true;
+            default:return false;
+        }
+    }
+}

+ 124 - 0
src/main/java/com/fdkankan/fusion/controller/SceneCommonController.java

@@ -0,0 +1,124 @@
+package com.fdkankan.fusion.controller;
+
+import cn.hutool.core.io.FileUtil;
+import com.fdkankan.fusion.common.FilePath;
+import com.fdkankan.fusion.common.ResultCode;
+import com.fdkankan.fusion.common.ResultData;
+import com.fdkankan.fusion.common.util.LocalToOssUtil;
+import com.fdkankan.fusion.exception.BusinessException;
+import com.fdkankan.fusion.httpClient.request.LaserSceneParam;
+import com.fdkankan.fusion.request.ScenePram;
+import com.fdkankan.fusion.response.FileInfoVo;
+import com.fdkankan.fusion.service.ISceneCommonService;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStream;
+
+@RestController
+@RequestMapping("/scene")
+public class SceneCommonController extends BaseController{
+
+    @Autowired
+    ISceneCommonService sceneService;
+
+    @PostMapping("/list")
+    public ResultData list(@RequestBody ScenePram param){
+        param.setShare(getShare());
+        return ResultData.ok(sceneService.pageList(param));
+    }
+
+    @GetMapping("/getFdTokenByNum")
+    public Object getFdTokenByNum(@RequestParam(required = false) String num){
+
+        return sceneService.getFdTokenByNum(num);
+    }
+
+    @GetMapping("/deleteNum")
+    public ResultData deleteNum(@RequestParam(required = false) String num){
+        sceneService.deleteNum(num);
+        return ResultData.ok();
+    }
+
+
+    @PostMapping("/sceneDetail")
+    public ResultData sceneDetail(@RequestBody LaserSceneParam param){
+        return ResultData.ok(sceneService.sceneDetail(param));
+    }
+
+    @PostMapping("/buildSceneObj")
+    public ResultData buildSceneObj(@RequestBody LaserSceneParam param){
+        sceneService.buildSceneObj(param);
+        return ResultData.ok();
+    }
+
+    @PostMapping("/copyScene")
+    public ResultData copyScene(@RequestBody ScenePram param){
+        sceneService.copyScene(param);
+        return ResultData.ok();
+    }
+
+    @Autowired
+    LocalToOssUtil localToOssUtil;
+
+    @Value("${spring.profiles.active}")
+    private String environment;
+    @GetMapping("/downMD5")
+    public void downMD5(@RequestParam(required = false) String num,
+                        @RequestParam(required = false) Integer type,
+                               HttpServletResponse res, HttpServletRequest req) throws IOException {
+        if(StringUtils.isBlank(num) || type == null){
+            throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
+        }
+
+        // 设置响应头,指定文件类型和内容长度
+        OutputStream os = null;
+        try {
+            FileInfoVo fileInfo = null;
+            Long size = null;
+            String sceneObjPath =null;
+
+            if(type == 2 || type == 5){  //点云
+                sceneObjPath = String.format(FilePath.LASER_OSS_PATH, num,num)+"/cloud.js" ;
+                fileInfo = localToOssUtil.getFileInfo(sceneObjPath);
+                String scenePath = String.format(FilePath.LASER_OSS_PATH, num,num);
+                size = localToOssUtil.getSize(scenePath);
+            }else {
+                sceneObjPath = String.format(FilePath.OBJ_OSS_PATH,num) + "/images/3dtiles/tileset.json";
+                if(!localToOssUtil.existKey(sceneObjPath)){
+                    sceneObjPath = String.format(FilePath.OBJ_OSS_PATH,num) + "/data/mesh/mesh.json";
+                }
+                if(!localToOssUtil.existKey(sceneObjPath)){
+                    sceneObjPath = String.format(FilePath.OBJ_OSS_PATH,num) + "/data/mesh/mesh.obj";
+                }
+                fileInfo = localToOssUtil.getFileInfo(sceneObjPath);
+                String scenePath = String.format(FilePath.OBJ_OSS_PATH, num);
+                size = localToOssUtil.getSize(scenePath);
+            }
+            if(fileInfo == null){
+                throw new BusinessException(ResultCode.FILE_NOT_EXIST);
+            }
+            fileInfo.setSize(size);
+            String objPath = String.format(FilePath.OBJ_LOCAL_PATH,environment , num) ;
+            File file = new File(objPath +"/"+num + "_hash.txt");
+            res.setContentType("application/octet-stream");
+            res.setHeader("Content-Disposition", "attachment; filename="+num + "_hash.txt");
+            os = res.getOutputStream();
+            FileUtil.writeString(fileInfo.toString(),file,"UTF-8");
+            os.write(FileUtils.readFileToByteArray(file));
+            os.flush();
+        } finally {
+            if(os!=null){
+                os.close();
+            }
+        }
+    }
+
+}

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

@@ -1,124 +1,21 @@
 package com.fdkankan.fusion.controller;
 
-import cn.hutool.core.io.FileUtil;
-import com.fdkankan.fusion.common.FilePath;
-import com.fdkankan.fusion.common.ResultCode;
-import com.fdkankan.fusion.common.ResultData;
-import com.fdkankan.fusion.common.util.LocalToOssUtil;
-import com.fdkankan.fusion.exception.BusinessException;
-import com.fdkankan.fusion.httpClient.request.LaserSceneParam;
-import com.fdkankan.fusion.request.ScenePram;
-import com.fdkankan.fusion.response.FileInfoVo;
-import com.fdkankan.fusion.service.ISceneCommonService;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.web.bind.annotation.*;
 
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.File;
-import java.io.IOException;
-import java.io.OutputStream;
+import org.springframework.web.bind.annotation.RequestMapping;
 
-@RestController
-@RequestMapping("/scene")
-public class SceneController extends BaseController{
-
-    @Autowired
-    ISceneCommonService sceneService;
-
-    @PostMapping("/list")
-    public ResultData list(@RequestBody ScenePram param){
-        param.setShare(getShare());
-        return ResultData.ok(sceneService.pageList(param));
-    }
-
-    @GetMapping("/getFdTokenByNum")
-    public Object getFdTokenByNum(@RequestParam(required = false) String num){
-
-        return sceneService.getFdTokenByNum(num);
-    }
-
-    @GetMapping("/deleteNum")
-    public ResultData deleteNum(@RequestParam(required = false) String num){
-        sceneService.deleteNum(num);
-        return ResultData.ok();
-    }
-
-
-    @PostMapping("/sceneDetail")
-    public ResultData sceneDetail(@RequestBody LaserSceneParam param){
-        return ResultData.ok(sceneService.sceneDetail(param));
-    }
+import org.springframework.web.bind.annotation.RestController;
 
-    @PostMapping("/buildSceneObj")
-    public ResultData buildSceneObj(@RequestBody LaserSceneParam param){
-        sceneService.buildSceneObj(param);
-        return ResultData.ok();
-    }
-
-    @PostMapping("/copyScene")
-    public ResultData copyScene(@RequestBody ScenePram param){
-        sceneService.copyScene(param);
-        return ResultData.ok();
-    }
-
-    @Autowired
-    LocalToOssUtil localToOssUtil;
-
-    @Value("${spring.profiles.active}")
-    private String environment;
-    @GetMapping("/downMD5")
-    public void downMD5(@RequestParam(required = false) String num,
-                        @RequestParam(required = false) Integer type,
-                               HttpServletResponse res, HttpServletRequest req) throws IOException {
-        if(StringUtils.isBlank(num) || type == null){
-            throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
-        }
-
-        // 设置响应头,指定文件类型和内容长度
-        OutputStream os = null;
-        try {
-            FileInfoVo fileInfo = null;
-            Long size = null;
-            String sceneObjPath =null;
-
-            if(type == 2 || type == 5){  //点云
-                sceneObjPath = String.format(FilePath.LASER_OSS_PATH, num,num)+"/cloud.js" ;
-                fileInfo = localToOssUtil.getFileInfo(sceneObjPath);
-                String scenePath = String.format(FilePath.LASER_OSS_PATH, num,num);
-                size = localToOssUtil.getSize(scenePath);
-            }else {
-                sceneObjPath = String.format(FilePath.OBJ_OSS_PATH,num) + "/images/3dtiles/tileset.json";
-                if(!localToOssUtil.existKey(sceneObjPath)){
-                    sceneObjPath = String.format(FilePath.OBJ_OSS_PATH,num) + "/data/mesh/mesh.json";
-                }
-                if(!localToOssUtil.existKey(sceneObjPath)){
-                    sceneObjPath = String.format(FilePath.OBJ_OSS_PATH,num) + "/data/mesh/mesh.obj";
-                }
-                fileInfo = localToOssUtil.getFileInfo(sceneObjPath);
-                String scenePath = String.format(FilePath.OBJ_OSS_PATH, num);
-                size = localToOssUtil.getSize(scenePath);
-            }
-            if(fileInfo == null){
-                throw new BusinessException(ResultCode.FILE_NOT_EXIST);
-            }
-            fileInfo.setSize(size);
-            String objPath = String.format(FilePath.OBJ_LOCAL_PATH,environment , num) ;
-            File file = new File(objPath +"/"+num + "_hash.txt");
-            res.setContentType("application/octet-stream");
-            res.setHeader("Content-Disposition", "attachment; filename="+num + "_hash.txt");
-            os = res.getOutputStream();
-            FileUtil.writeString(fileInfo.toString(),file,"UTF-8");
-            os.write(FileUtils.readFileToByteArray(file));
-            os.flush();
-        } finally {
-            if(os!=null){
-                os.close();
-            }
-        }
-    }
+/**
+ * <p>
+ * 初始化信息表 前端控制器
+ * </p>
+ *
+ * @author 
+ * @since 2025-02-18
+ */
+@RestController
+@RequestMapping("/fusion/scene")
+public class SceneController {
 
 }
+

+ 336 - 0
src/main/java/com/fdkankan/fusion/entity/Scene.java

@@ -0,0 +1,336 @@
+package com.fdkankan.fusion.entity;
+
+import com.baomidou.mybatisplus.annotation.*;
+
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * <p>
+ * 初始化信息表
+ * </p>
+ *
+ * @author 
+ * @since 2025-02-18
+ */
+@Getter
+@Setter
+@TableName("t_scene")
+public class Scene implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 创建者
+     */
+    @TableField("create_by")
+    private String createBy;
+
+    /**
+     * 创建时间
+     */
+    @TableField("create_time")
+    private String createTime;
+
+    /**
+     * 更新者
+     */
+    @TableField("update_by")
+    private String updateBy;
+
+    /**
+     * 更新时间
+     */
+    @TableField("update_time")
+    private String updateTime;
+
+    /**
+     * 备注
+     */
+    @TableField("remark")
+    private String remark;
+
+    /**
+     * 逻辑未删除值0,逻辑已删除值1
+     */
+    @TableField("deleted")
+    @TableLogic
+    private String deleted;
+
+    /**
+     * 场景码
+     */
+    @TableField("scene_code")
+    private String sceneCode;
+
+    /**
+     * 文件基础路径
+     */
+    @TableField("path")
+    private String path;
+
+    /**
+     * 状态, -1:场景被删;0:计算中;1:计算失败;2:计算成功;3:封存(目前未使用此状态);4:重算中
+     */
+    @TableField("status")
+    private Integer status;
+
+    /**
+     * 重算次数
+     */
+    @TableField("recount")
+    private Integer recount;
+
+    /**
+     * 标题
+     */
+    @TableField("title")
+    private String title;
+
+    @TableField("child_name")
+    private String childName;
+
+    /**
+     * sn码
+     */
+    @TableField("sn_code")
+    private String snCode;
+
+    /**
+     * 拍摄时间
+     */
+    @TableField("shoot_time")
+    private Date shootTime;
+
+    /**
+     * 展示链接
+     */
+    @TableField("web_site")
+    private String webSite;
+
+    /**
+     * 用户id
+     */
+    @TableField("user_Id")
+    private Integer userId;
+
+    /**
+     * (用户名)手机号
+     */
+    @TableField("user_name")
+    private String userName;
+
+    /**
+     * 封面图地址
+     */
+    @TableField("init_pic")
+    private String initPic;
+
+    /**
+     * 访问密码
+     */
+    @TableField("password")
+    private String password;
+
+    /**
+     * 是否公开,默认公开
+     */
+    @TableField("is_open")
+    private Integer isOpen;
+
+    /**
+     * 是否要禁止显示平面图 默认false
+     */
+    @TableField("disable_floor_pan")
+    private Integer disableFloorPan;
+
+    /**
+     * 平面图类型,默认default
+     */
+    @TableField("floor_pan_type")
+    private String floorPanType;
+
+    /**
+     * 默认las文件地址
+     */
+    @TableField("las_url")
+    private String lasUrl;
+
+    /**
+     * 0表示全景图 1表示点云
+     */
+    @TableField("show_mode")
+    private Integer showMode;
+
+    /**
+     * 浏览次数
+     */
+    @TableField("view_count")
+    private Integer viewCount;
+
+    /**
+     * 协作人id
+     */
+    @TableField("cooperation_user_id")
+    private Integer cooperationUserId;
+
+    /**
+     * 协作人手机号
+     */
+    @TableField("cooperation_user_name")
+    private String cooperationUserName;
+
+    /**
+     * 数据集ID
+     */
+    @TableField("dataset_id")
+    private String datasetId;
+
+    /**
+     * 上传次数
+     */
+    @TableField("upload_count")
+    private Integer uploadCount;
+
+    /**
+     * 默认ply文件地址
+     */
+    @TableField("ply_url")
+    private String plyUrl;
+
+    /**
+     * unicode
+     */
+    @TableField("unicode")
+    private String unicode;
+
+    /**
+     * 默认obj文件地址
+     */
+    @TableField("obj_url")
+    private String objUrl;
+
+    /**
+     * 生成OBJ状态,0,未生成 1完成,2计算中
+     */
+    @TableField("build_obj_status")
+    private Integer buildObjStatus;
+
+    /**
+     * 逻辑删除
+     */
+    @TableField("delete_flag")
+    private Date deleteFlag;
+
+    /**
+     * 是否复制,默认否
+     */
+    @TableField("is_copy")
+    private Integer isCopy;
+
+    /**
+     * 复制时间
+     */
+    @TableField("copy_time")
+    private Date copyTime;
+
+    /**
+     * 场景版本
+     */
+    @TableField("scene_version")
+    private String sceneVersion;
+
+    /**
+     * 离线包版本,和重算次数对比
+     */
+    @TableField("offline_ver")
+    private Integer offlineVer;
+
+    /**
+     * 离线包地址
+     */
+    @TableField("offline_url")
+    private String offlineUrl;
+
+    /**
+     * 离线包状态是否需要重新生成 1 不需要 2需要
+     */
+    @TableField("offline_status")
+    private Integer offlineStatus;
+
+    /**
+     * 语言版本
+     */
+    @TableField("offline_lang")
+    private String offlineLang;
+
+    /**
+     * 场景来源:相机拍摄10以内表示,1表示八目,2双目,3转台,4 激光 5深光  其他来源10以上,11:一键换装,12:123看房,13文通虚拟场景
+     */
+    @TableField("scene_source")
+    private Integer sceneSource;
+
+    /**
+     * 计算完成时间
+     */
+    @TableField("algorithm_time")
+    private Date algorithmTime;
+
+    /**
+     * 判断是否为slam场景,深光和深时 以前的场景都是4
+     */
+    @TableField("location")
+    private Integer location;
+
+    /**
+     * 拍摄点位数量
+     */
+    @TableField("shoot_count")
+    private Integer shootCount;
+
+    /**
+     * 使用容量
+     */
+    @TableField("space")
+    private Long space;
+
+    /**
+     * 离线包版本-提供自动推送
+     */
+    @TableField("offline_ver_for_push")
+    private Integer offlineVerForPush;
+
+    @TableField("mixture")
+    private Integer mixture;
+
+    @TableField("pay_status")
+    private Integer payStatus;
+
+    /**
+     * 生成e57状态,-1 失败 0,未生成 1完成,2计算中
+     */
+    @TableField("build_e57_status")
+    private Integer buildE57Status;
+
+    /**
+     * 映射路径
+     */
+    @TableField("mapping")
+    private String mapping;
+
+    /**
+     * 本地资源路径
+     */
+    @TableField("web_path")
+    private String webPath;
+
+
+}

+ 3 - 3
src/main/java/com/fdkankan/fusion/generate/AutoGenerate.java

@@ -18,7 +18,7 @@ public class AutoGenerate {
         String path =System.getProperty("user.dir") ;
 
         generate(path,"fusion", getTables(new String[]{
-               "t_common_upload","t_dict","t_dict_file"
+               "t_scene"
         }));
 
 //        generate(path,"goods", getTables(new String[]{
@@ -48,8 +48,8 @@ public class AutoGenerate {
     public static void  generate(String path,String moduleName,  List<String> tables){
 //        FastAutoGenerator.create("jdbc:mysql://192.168.0.25:3306/fd_fusion_xj",
 //                "root","mysql123!ROOT.")
-        FastAutoGenerator.create("jdbc:mysql://192.168.0.25:3306/4dkankan_v4",
-                "root","4dkk2023cuikuan%")
+        FastAutoGenerator.create("jdbc:mysql://127.0.0.1:3306/fd_laser",
+                "root","123456")
                 .globalConfig(builder -> {
                     builder.author("")               //作者
                             .outputDir(path+"\\src\\main\\java")    //输出路径(写到java目录)

+ 18 - 0
src/main/java/com/fdkankan/fusion/mapper/ISceneMapper.java

@@ -0,0 +1,18 @@
+package com.fdkankan.fusion.mapper;
+
+import com.fdkankan.fusion.entity.Scene;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ * 初始化信息表 Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2025-02-18
+ */
+@Mapper
+public interface ISceneMapper extends BaseMapper<Scene> {
+
+}

+ 0 - 2
src/main/java/com/fdkankan/fusion/mq/consumer/OsgbToB3dmConsumer.java

@@ -7,10 +7,8 @@ import com.fdkankan.fusion.common.ResultCode;
 import com.fdkankan.fusion.common.util.*;
 import com.fdkankan.fusion.exception.BusinessException;
 import com.fdkankan.fusion.service.ICommonUploadService;
-import com.fdkankan.geo.GeoTransformUtil;
 import com.fdkankan.redis.util.RedisUtil;
 import lombok.extern.slf4j.Slf4j;
-import org.locationtech.proj4j.ProjCoordinate;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;

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

@@ -25,6 +25,8 @@ public class ScenePram extends RequestBase {
 
     private String num;
 
+    private Boolean isLaserMesh = false;
+
     public String getSceneName() {
         return sceneName== null ?null :sceneName.trim();
     }

+ 16 - 0
src/main/java/com/fdkankan/fusion/service/ISceneService.java

@@ -0,0 +1,16 @@
+package com.fdkankan.fusion.service;
+
+import com.fdkankan.fusion.entity.Scene;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 初始化信息表 服务类
+ * </p>
+ *
+ * @author 
+ * @since 2025-02-18
+ */
+public interface ISceneService extends IService<Scene> {
+
+}

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

@@ -5,6 +5,7 @@ import cn.hutool.core.bean.BeanUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fdkankan.fusion.common.ResultCode;
+import com.fdkankan.fusion.common.util.SceneTypeUtil;
 import com.fdkankan.fusion.entity.*;
 import com.fdkankan.fusion.exception.BusinessException;
 import com.fdkankan.fusion.common.PageInfo;
@@ -107,22 +108,37 @@ public class CaseServiceImpl extends ServiceImpl<ICaseMapper, CaseEntity> implem
             param.setTypeMap(typeMap);
         }
         List<SceneVo> listAll = new ArrayList<>();
+        HashMap<Integer,List<String>> map = new HashMap<>();
         for (Integer type : param.getTypeMap().keySet()) {
             List<String> numList = param.getTypeMap().get(type);
             if(numList ==null || numList.size() <=0 || type ==3){
                 continue;
             }
+            Integer mapKey = 0;
+            if(SceneTypeUtil.isLaserMesh(type)){
+                mapKey =1 ;
+            }
+            if(map.get(mapKey) == null){
+                map.put(mapKey,numList);
+            }else {
+                map.get(mapKey).addAll(numList);
+            }
+
+        }
+        for (Integer type : map.keySet()) {
             ScenePram scenePram = new ScenePram();
-            scenePram.setType(type);
+            //scenePram.setType(type);
             scenePram.setPageNum(1);
             scenePram.setPageSize(99999);
             scenePram.setNumList(param.getTypeMap().get(type));
-            scenePram.setShare("1");
+
             PageInfo pageInfo = sceneService.pageList(scenePram);
             List<SceneVo> list1 = (List<SceneVo>) pageInfo.getList();
             listAll.addAll(list1);
 
+
         }
+
         if(listAll.size() >0){
             List<String> numList = listAll.parallelStream().map(SceneVo::getNum).collect(Collectors.toList());
             //设置模型

+ 38 - 100
src/main/java/com/fdkankan/fusion/service/impl/SceneCommonService.java

@@ -4,8 +4,10 @@ package com.fdkankan.fusion.service.impl;
 import cn.hutool.core.collection.CollectionUtil;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fdkankan.fusion.common.ResultCode;
+import com.fdkankan.fusion.common.util.SceneTypeUtil;
 import com.fdkankan.fusion.entity.*;
 import com.fdkankan.fusion.exception.BusinessException;
 import com.fdkankan.fusion.common.PageInfo;
@@ -74,120 +76,56 @@ public class SceneCommonService implements ISceneCommonService {
         return listAll;
     }
 
+    @Autowired
+    ISceneService sceneService;
     @Override
     public PageInfo pageList(ScenePram param) {
         if(param.getType() == null){
            throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
         }
 
-        if(StringUtils.isNotBlank(param.getDeptId())){
-            List<String> deptIds = new ArrayList<>();
-            if(param.getSearchType() == 0){
-                List<TmDepartment> sonByDeptId = tmDepartmentService.getSonByDeptId(param.getDeptId());
-                deptIds = sonByDeptId.stream().map(TmDepartment::getId).collect(Collectors.toList());
-            }
-            deptIds.add(param.getDeptId());
-            List<TmCamera> tmCameras = tmCameraService.getByDeptIds(deptIds);
-            Set<String> snCodeSet = tmCameras.parallelStream().map(TmCamera::getCameraSn).collect(Collectors.toSet());
-            List<String> snCodes = param.getSnCodes();
-            if(snCodes == null){
-                snCodes = new ArrayList<>(snCodeSet);
-            }else {
-                snCodes = snCodes.stream().filter(snCodeSet::contains).collect(Collectors.toList());
-            }
-            param.setSnCodes(snCodes);
+        LambdaQueryWrapper<Scene> wrapper = new LambdaQueryWrapper<>();
+        if(StringUtils.isNotBlank(param.getSceneName())){
+            wrapper.like(Scene::getTitle,param.getSceneName());
         }
-//        if(StringUtils.isNotBlank(param.getSnCode())){
-//            List<String> snCodes = param.getSnCodes();
-//            List<String> snCodes1 = new ArrayList<>();
-//            snCodes1.add(param.getSnCode());
-//            if(snCodes == null){
-//                snCodes = snCodes1;
-//            }else {
-//                snCodes = snCodes.stream().filter(snCodes1::contains).collect(Collectors.toList());
-//            }
-//            param.setSnCodes(snCodes);
-//        }
-        if(param.getCaseId() !=null){
-            String deptId =  caseService.getDeptId(param.getCaseId());
-            List<TmCamera> tmCameras = tmCameraService.getByDeptIds(Arrays.asList(deptId));
-            List<String> snCodes = param.getSnCodes();
-            List<String> snCodes1 = tmCameras.stream().map(TmCamera::getCameraSn).collect(Collectors.toList());
-            snCodes1.add(param.getSnCode());
-            if(snCodes == null){
-                snCodes = snCodes1;
-            }else {
-                snCodes = snCodes.stream().filter(snCodes1::contains).collect(Collectors.toList());
-            }
-            param.setSnCodes(snCodes);
+        wrapper.eq(Scene::getSceneSource, SceneTypeUtil.getSceneSource(param.getType()));
+        if(SceneTypeUtil.isLaserMesh(param.getType())){
+            param.setIsLaserMesh(true);
         }
-        if(CollectionUtil.isEmpty(param.getSnCodes()) && CollectionUtil.isEmpty(param.getNumList())){
-            return PageInfo.PageInfoEmpty();
+        if(param.getIsLaserMesh()){
+            wrapper.notIn(Scene::getBuildObjStatus,0);
         }
-        List<SceneVo> sceneVoList = new ArrayList<>();
-        long total = 0;
-        if(param.getType() == 0 || param.getType() == 1 || param.getType() == 4 || param.getType() == 6 || param.getType() == 7){      //看看,看见 ,深时obj
-            //获取四维(看看,看见)场景数据
-            FdkkResponse fdkkResponse = fdKKClient.sceneList(param);
-            if(fdkkResponse.getCode() !=0){
-                throw new BusinessException(fdkkResponse.getCode(),fdkkResponse.getMsg());
-            }
-            PageInfo pageInfo = JSONObject.parseObject(JSONObject.toJSONString(fdkkResponse.getData()), PageInfo.class);
-            total =  pageInfo.getTotal();
-            JSONArray list = JSONArray.parseArray(JSONObject.toJSONString( pageInfo.getList()));
-            sceneVoList = overSceneVo(list,param.getType());
 
+        Page<Scene> page = sceneService.page(new Page<>(param.getPageNum(), param.getPageSize()), wrapper);
+        List<SceneVo> sceneVoList = new ArrayList<>();
+        for (Scene scene : page.getRecords()) {
+            SceneVo vo = new SceneVo();
+            vo.setId(scene.getId());
+            vo.setBuildObjStatus(scene.getBuildObjStatus());
+            vo.setCreateTime(scene.getCreateTime());
+            vo.setName(scene.getTitle());
+            vo.setNum(scene.getSceneCode());
+            vo.setPayStatus(1);
+            vo.setSceneName(scene.getTitle());
+            vo.setSnCode(scene.getSnCode());
+            vo.setStatus(scene.getStatus());
+            vo.setThumb(scene.getInitPic());
+            vo.setTitle(scene.getTitle());
+            vo.setViewCount(scene.getViewCount());
+            vo.setIsLaser(SceneTypeUtil.isLaser(param.getType()));
+            vo.setType(param.getType());
+            vo.setPhone(scene.getUserName());
+            vo.setBind(true);
+            vo.setLocation(scene.getLocation());
+            vo.setInFusion(false);
+            //vo.setOrientation();
+            //vo.setRtkLocation();
+            sceneVoList.add(vo);
         }
-        if(param.getType() == 2 || param.getType() == 5){       //深时
-            //获取激光(深时)场景数据
-            LaserSceneParam laserSceneParam = new LaserSceneParam();
-            laserSceneParam.setPageNum(param.getPageNum());
-            laserSceneParam.setPageSize(param.getPageSize());
-            laserSceneParam.setStatus(param.getStatus());
-            laserSceneParam.setSnCode(param.getSnCode());
-            laserSceneParam.setSnCodes(param.getSnCodes());
-            if(param.getType() == 5){
-                laserSceneParam.setSceneSource(5);
-            }
-            if(StringUtils.isNotBlank(param.getSceneName())){
-                laserSceneParam.setTitle(param.getSceneName());
-            }
-            if(param.getNumList() != null && param.getNumList().size() >0){
-                laserSceneParam.setSceneCodes(param.getNumList());
-            }
-            FdkkResponse fdkkResponse = laserClient.sceneList(laserSceneParam);
-            if(fdkkResponse.getCode() !=200){
-                throw new BusinessException(fdkkResponse.getCode(),fdkkResponse.getMsg());
-            }
-            JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(fdkkResponse.getData()));
-            JSONArray list = jsonObject.getJSONArray("list");
-            total =jsonObject.getLong("total");
-            for (Object o : list) {
-                String res = JSONObject.toJSONString(o);
-                SceneVo vo = JSONObject.parseObject(res,SceneVo.class);
-                if( StringUtils.isEmpty(vo.getPhone())){
-                    vo.setBind(false);
-                }
-                if(vo.getStatus() == 4){    //4生成OBJ中设置为计算中
-                    vo.setStatus(0);
-                }
-                vo.setType(param.getType());
-                sceneVoList.add(vo);
-            }
-        }
-        Set<String> snCodes = sceneVoList.stream().map(SceneVo::getSnCode).collect(Collectors.toSet());
 
-        HashMap<String, TmDepartment> map = tmCameraService.getMapBySnCodes(snCodes);
-        for (SceneVo sceneVo : sceneVoList) {
-            TmDepartment tmDepartment = map.get(sceneVo.getSnCode().toUpperCase());
-            if(tmDepartment != null){
-                sceneVo.setDeptId(tmDepartment.getId());
-                sceneVo.setDeptName(tmDepartment.getName());
-            }
-        }
         Page<SceneVo> voPage = new Page<>(param.getPageNum(),param.getPageSize());
         voPage.setRecords(sceneVoList);
-        voPage.setTotal(total);
+        voPage.setTotal(page.getTotal());
         return PageInfo.PageInfo(voPage);
     }
 

+ 20 - 0
src/main/java/com/fdkankan/fusion/service/impl/SceneServiceImpl.java

@@ -0,0 +1,20 @@
+package com.fdkankan.fusion.service.impl;
+
+import com.fdkankan.fusion.entity.Scene;
+import com.fdkankan.fusion.mapper.ISceneMapper;
+import com.fdkankan.fusion.service.ISceneService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 初始化信息表 服务实现类
+ * </p>
+ *
+ * @author 
+ * @since 2025-02-18
+ */
+@Service
+public class SceneServiceImpl extends ServiceImpl<ISceneMapper, Scene> implements ISceneService {
+
+}

+ 5 - 0
src/main/resources/mapper/fusion/SceneMapper.xml

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