Browse Source

Merge remote-tracking branch 'origin/release' into feature-local-jg-v2.0.0

# Conflicts:
#	src/main/java/com/fdkankan/scene/Interceptor/CheckPermitAspect.java
#	src/main/java/com/fdkankan/scene/entity/ScenePlusExt.java
#	src/main/java/com/fdkankan/scene/listener/RabbitMqListener.java
#	src/main/java/com/fdkankan/scene/service/ICommonService.java
#	src/main/java/com/fdkankan/scene/service/impl/BoxModelServiceImpl.java
#	src/main/java/com/fdkankan/scene/service/impl/CommonServiceImpl.java
#	src/main/java/com/fdkankan/scene/service/impl/SceneCopyServiceImpl.java
#	src/main/java/com/fdkankan/scene/service/impl/SceneEditInfoServiceImpl.java
#	src/main/java/com/fdkankan/scene/service/impl/SceneEditServiceImpl.java
#	src/main/java/com/fdkankan/scene/service/impl/SceneProServiceImpl.java
#	src/main/java/com/fdkankan/scene/service/impl/SceneServiceImpl.java
#	src/main/java/com/fdkankan/scene/service/impl/VisionServiceImpl.java
dengsixing 3 months ago
parent
commit
fc0b49e352
41 changed files with 1033 additions and 93 deletions
  1. 1 0
      src/main/java/com/fdkankan/scene/bean/SceneJsonBean.java
  2. 51 0
      src/main/java/com/fdkankan/scene/controller/SceneEditAiController.java
  3. 24 2
      src/main/java/com/fdkankan/scene/controller/SceneEditController.java
  4. 74 0
      src/main/java/com/fdkankan/scene/dto/GeoPoint.java
  5. 18 0
      src/main/java/com/fdkankan/scene/dto/SceneResourceDTO.java
  6. 5 2
      src/main/java/com/fdkankan/scene/entity/SceneCooperation.java
  7. 18 0
      src/main/java/com/fdkankan/scene/entity/SceneEditControls.java
  8. 6 0
      src/main/java/com/fdkankan/scene/entity/SceneMarkShape.java
  9. 6 0
      src/main/java/com/fdkankan/scene/entity/ScenePlus.java
  10. 18 0
      src/main/java/com/fdkankan/scene/entity/ScenePlusExt.java
  11. 61 0
      src/main/java/com/fdkankan/scene/entity/SceneShapeEnum.java
  12. 6 0
      src/main/java/com/fdkankan/scene/mapper/ISceneResourceCooperationMapper.java
  13. 17 0
      src/main/java/com/fdkankan/scene/mapper/SceneShapeEnumMapper.java
  14. 11 0
      src/main/java/com/fdkankan/scene/service/ICommonService.java
  15. 9 0
      src/main/java/com/fdkankan/scene/service/IRemovePortraitService.java
  16. 2 0
      src/main/java/com/fdkankan/scene/service/ISceneCooperationService.java
  17. 2 0
      src/main/java/com/fdkankan/scene/service/ISceneEditInfoService.java
  18. 4 0
      src/main/java/com/fdkankan/scene/service/ISceneMarkShapeService.java
  19. 6 10
      src/main/java/com/fdkankan/scene/service/ISceneProService.java
  20. 3 0
      src/main/java/com/fdkankan/scene/service/ISceneResourceCooperationService.java
  21. 2 1
      src/main/java/com/fdkankan/scene/service/IVisionService.java
  22. 16 0
      src/main/java/com/fdkankan/scene/service/SceneShapeEnumService.java
  23. 53 30
      src/main/java/com/fdkankan/scene/service/impl/BoxModelServiceImpl.java
  24. 29 0
      src/main/java/com/fdkankan/scene/service/impl/CommonServiceImpl.java
  25. 125 0
      src/main/java/com/fdkankan/scene/service/impl/RemovePortraitServiceImpl.java
  26. 9 0
      src/main/java/com/fdkankan/scene/service/impl/SceneCooperationServiceImpl.java
  27. 6 3
      src/main/java/com/fdkankan/scene/service/impl/SceneEditInfoServiceImpl.java
  28. 8 0
      src/main/java/com/fdkankan/scene/service/impl/SceneEditServiceImpl.java
  29. 14 0
      src/main/java/com/fdkankan/scene/service/impl/SceneMarkShapeServiceImpl.java
  30. 117 20
      src/main/java/com/fdkankan/scene/service/impl/SceneProServiceImpl.java
  31. 6 0
      src/main/java/com/fdkankan/scene/service/impl/SceneResourceCooperationServiceImpl.java
  32. 17 7
      src/main/java/com/fdkankan/scene/service/impl/SceneResourceServiceImpl.java
  33. 14 0
      src/main/java/com/fdkankan/scene/service/impl/SceneServiceImpl.java
  34. 24 0
      src/main/java/com/fdkankan/scene/service/impl/SceneShapeEnumServiceImpl.java
  35. 58 17
      src/main/java/com/fdkankan/scene/service/impl/VisionServiceImpl.java
  36. 162 0
      src/main/java/com/fdkankan/scene/util/CoordinateUtil.java
  37. 3 0
      src/main/java/com/fdkankan/scene/vo/SceneEditControlsParamVO.java
  38. 6 0
      src/main/java/com/fdkankan/scene/vo/SceneEditControlsVO.java
  39. 2 0
      src/main/java/com/fdkankan/scene/vo/SceneInfoVO.java
  40. 6 0
      src/main/java/com/fdkankan/scene/vo/SceneMarkShapeParamVO.java
  41. 14 1
      src/main/resources/mapper/scene/SceneResourceCooperationMapper.xml

+ 1 - 0
src/main/java/com/fdkankan/scene/bean/SceneJsonBean.java

@@ -240,5 +240,6 @@ public class SceneJsonBean {
 
     private String orientation;
 
+    private Integer hasRecognition;
 
 }

+ 51 - 0
src/main/java/com/fdkankan/scene/controller/SceneEditAiController.java

@@ -0,0 +1,51 @@
+package com.fdkankan.scene.controller;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.alibaba.fastjson.JSONObject;
+import com.fdkankan.scene.annotation.CheckPermit;
+import com.fdkankan.scene.entity.SceneMarkShape;
+import com.fdkankan.scene.entity.SceneShapeEnum;
+import com.fdkankan.scene.service.ISceneMarkShapeService;
+import com.fdkankan.scene.service.SceneShapeEnumService;
+import com.fdkankan.scene.vo.SceneMarkShapeParamVO;
+import com.fdkankan.web.response.ResultData;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+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;
+
+import java.util.List;
+
+@RestController
+@RequestMapping("/service/scene/edit/ai")
+public class SceneEditAiController {
+
+    @Autowired
+    private ISceneMarkShapeService sceneMarkShapeService;
+    @Autowired
+    private SceneShapeEnumService sceneShapeEnumService;
+
+    @CheckPermit
+    @PostMapping("/box4/getInfos")
+    public ResultData box4GetInfos(@RequestBody @Validated SceneMarkShapeParamVO param) {
+        List<SceneMarkShape> sceneMarkShapes = sceneMarkShapeService.findByNumAndType(param.getNum(),param.getType());
+        for (SceneMarkShape sceneMarkShape : sceneMarkShapes) {
+            if (ObjectUtil.isNotEmpty(sceneMarkShape.getShapes())){
+                for (JSONObject shape : sceneMarkShape.getShapes()) {
+                    String category = shape.getString("category");
+                    SceneShapeEnum sceneShapeEnum = sceneShapeEnumService.findByClassName(category);
+                    if (ObjectUtil.isNotNull(sceneShapeEnum)){
+                        shape.put("name",sceneShapeEnum.getName());
+                    }
+                    if (category.contains("Tag_")){
+                        shape.put("category","Tag");
+                    }
+                }
+            }
+        }
+        return ResultData.ok(sceneMarkShapes);
+    }
+
+}

+ 24 - 2
src/main/java/com/fdkankan/scene/controller/SceneEditController.java

@@ -103,6 +103,30 @@ public class SceneEditController extends BaseController {
 
     /**
      * <p>
+      热点切图上传
+     * </p>
+     * @author dengsixing
+     * @date 2022/1/12
+     * @return com.fdkankan.web.response.ResultData
+     **/
+    @CheckPermit
+    @PostMapping(value = "/tag/img/upload")
+    public ResultData uploadTagImg(@RequestParam(value = "num") String num,
+                                   MultipartFile file,
+                                   @RequestParam(value = "sid") String sid,
+                                   @RequestParam(value = "size", defaultValue = "320") Integer size,
+                                   @RequestParam(value = "tileSize", defaultValue = "511") Integer tileSize) throws Exception {
+        return sceneProService.uploadTagImg(num, file, sid, size, tileSize);
+    }
+
+    @CheckPermit
+    @PostMapping(value = "/tag/img/delete")
+    public ResultData uploadTagImg(@RequestBody @Validated DeleteSidListParamVO param) throws Exception {
+        return sceneProService.deleteTagImg(param);
+    }
+
+    /**
+     * <p>
         新增或修改场景热点
      * </p>
      * @author dengsixing
@@ -335,7 +359,6 @@ public class SceneEditController extends BaseController {
      * </p>
      * @author dengsixing
      * @date 2022/1/20
-     * @param param
      * @return com.fdkankan.web.response.ResultData
      **/
     @CheckPermit
@@ -350,7 +373,6 @@ public class SceneEditController extends BaseController {
      * </p>
      * @author dengsixing
      * @date 2022/1/20
-     * @param param
      * @return com.fdkankan.web.response.ResultData
      **/
     @LastEditTime

+ 74 - 0
src/main/java/com/fdkankan/scene/dto/GeoPoint.java

@@ -0,0 +1,74 @@
+package com.fdkankan.scene.dto;
+
+import lombok.Data;
+
+import java.util.Objects;
+
+/**
+ * @author Xiewj
+ * @date 2021/11/9
+ */
+@Data
+public class GeoPoint {
+
+    public GeoPoint() {
+    }
+
+    public GeoPoint(Double lon, Double lat) {
+        this.lon = lon;
+        this.lat = lat;
+    }
+    public GeoPoint(Double[] point) {
+        if (point != null && point.length != 0) {
+            if (point.length == 1) {
+                this.lon = point[0];
+            } else {
+                this.lon = point[0];
+                this.lat = point[1];
+            }
+        } else {
+            this.lon = 0.0D;
+            this.lat = 0.0D;
+        }
+    }
+    public Double[] getCoordinates() {
+        if(Objects.isNull(this.lon) || Objects.isNull(this.lat) || Objects.isNull(this.alt)){
+            return new Double[]{};
+        }
+        return new Double[]{this.lon, this.lat, this.alt};
+    }
+
+    public void setCoordinates(Double[] coordinates) {
+        if (coordinates != null && coordinates.length != 0) {
+            if (coordinates.length == 1) {
+                this.lon = coordinates[0];
+            } else {
+                this.lon = coordinates[0];
+                this.lat = coordinates[1];
+                this.alt = coordinates[2];
+            }
+        } else {
+            this.lon = 0.0D;
+            this.lat = 0.0D;
+            this.alt = 0.0D;
+        }
+    }
+
+    /* 经度 */
+    private Double lon;
+    /* 纬度 */
+    private Double lat;
+
+    private Double alt;
+
+    private Double[] location;
+
+    private Long id;
+    private Long uuid;
+
+    private int statusIndicator;
+
+    private boolean pointA;
+
+    private boolean pointB;
+}

+ 18 - 0
src/main/java/com/fdkankan/scene/dto/SceneResourceDTO.java

@@ -0,0 +1,18 @@
+package com.fdkankan.scene.dto;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Builder
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class SceneResourceDTO {
+
+    private Long sceneCooperationId;
+
+    private String version;
+
+}

+ 5 - 2
src/main/java/com/fdkankan/scene/entity/SceneCooperation.java

@@ -12,10 +12,10 @@ import lombok.Setter;
 
 /**
  * <p>
- * 
+ *
  * </p>
  *
- * @author 
+ * @author
  * @since 2022-07-04
  */
 @Getter
@@ -50,5 +50,8 @@ public class SceneCooperation implements Serializable {
     @TableField("rec_status")
     private String recStatus;
 
+    @TableField("scene_type")
+    private String sceneType;
+
 
 }

+ 18 - 0
src/main/java/com/fdkankan/scene/entity/SceneEditControls.java

@@ -167,6 +167,12 @@ public class SceneEditControls implements Serializable {
     @TableField("show_panos")
     private Integer showPanos;
 
+    /**
+     * 是否显示地域
+     */
+    @TableField("show_areas")
+    private Integer showAreas;
+
 
     /**
      * 创建时间
@@ -187,5 +193,17 @@ public class SceneEditControls implements Serializable {
     @TableLogic(value = "A", delval = "I")
     private String recStatus;
 
+    /**
+     * 是否显示ai识别
+     */
+    @TableField("show_ai")
+    private Integer showAi;
+
+    /**
+     * 是否显示点云跳转按钮
+     */
+    @TableField("show_laser")
+    private Integer showLaser;
+
 
 }

+ 6 - 0
src/main/java/com/fdkankan/scene/entity/SceneMarkShape.java

@@ -71,4 +71,10 @@ public class SceneMarkShape implements Serializable {
       @TableLogic(value = "A", delval = "I")
       private String recStatus;
 
+      /**
+       * 推理类型 1,全景图识别 2,平面图识别
+       */
+      @TableField("type")
+      private Integer type;
+
 }

+ 6 - 0
src/main/java/com/fdkankan/scene/entity/ScenePlus.java

@@ -127,5 +127,11 @@ public class ScenePlus implements Serializable {
     @TableLogic(value = "A", delval = "I")
     private String recStatus;
 
+    /**
+     * 人像抹除状态
+     */
+    @TableField("remove_portrait")
+    private Integer removePortrait;
+
 
 }

+ 18 - 0
src/main/java/com/fdkankan/scene/entity/ScenePlusExt.java

@@ -178,4 +178,22 @@ public class ScenePlusExt implements Serializable {
 //     */
 //    @TableField("is_obj")
 //    private Integer isObj;
+
+    @TableField("location")
+    private Integer location;
+
+    @TableField("has_recognition")
+    private Integer hasRecognition;
+
+    /**
+     * 帧数
+     */
+    @TableField("slam_count")
+    private int slamCount;
+
+    /**
+     * 计算耗时
+     */
+    @TableField("mesh_compute_time")
+    private Long meshComputeTime;
 }

+ 61 - 0
src/main/java/com/fdkankan/scene/entity/SceneShapeEnum.java

@@ -0,0 +1,61 @@
+package com.fdkankan.scene.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.Date;
+
+/**
+ * 标注框模型表
+ *
+ * @author Xiewj
+ * @since 2023-11-09 11:53
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@TableName("t_scene_shape_enum")
+public class SceneShapeEnum {
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 属性名
+     */
+    private String name;
+
+    /**
+     * 类名
+     */
+    private String className;
+
+    /**
+     * 资源类型ID
+     */
+    private String resourceId;
+
+    /**
+     * 设备类型ID
+     */
+    private String typeId;
+
+    /**
+     * 记录的状态,A: 生效,I: 禁用
+     */
+    private String recStatus;
+
+    /**
+     * 更新时间
+     */
+    private Date updateTime;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+}

+ 6 - 0
src/main/java/com/fdkankan/scene/mapper/ISceneResourceCooperationMapper.java

@@ -1,9 +1,12 @@
 package com.fdkankan.scene.mapper;
 
+import com.fdkankan.scene.dto.SceneResourceDTO;
 import com.fdkankan.scene.entity.SceneResourceCooperation;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Mapper;
 
+import java.util.List;
+
 /**
  * <p>
  * 场景资源和协作用户关联表 Mapper 接口
@@ -15,4 +18,7 @@ import org.apache.ibatis.annotations.Mapper;
 @Mapper
 public interface ISceneResourceCooperationMapper extends BaseMapper<SceneResourceCooperation> {
 
+    List<SceneResourceCooperation> selectByCondition(SceneResourceDTO dto);
+
+
 }

+ 17 - 0
src/main/java/com/fdkankan/scene/mapper/SceneShapeEnumMapper.java

@@ -0,0 +1,17 @@
+package com.fdkankan.scene.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fdkankan.scene.entity.SceneShapeEnum;
+import org.apache.ibatis.annotations.Mapper;
+import org.springframework.stereotype.Component;
+
+/**
+* 标注框模型表 Mapper
+*
+* @author Xiewj
+* @since 2023-11-09 11:53
+*/
+@Mapper
+@Component("SceneShapeEnumMapper")
+public interface SceneShapeEnumMapper extends BaseMapper<SceneShapeEnum> {
+}

+ 11 - 0
src/main/java/com/fdkankan/scene/service/ICommonService.java

@@ -1,5 +1,10 @@
 package com.fdkankan.scene.service;
 
+import com.alibaba.fastjson.JSONObject;
+import com.fdkankan.scene.bean.SceneJsonBean;
+
+import java.util.Map;
+
 import java.util.Map;
 import java.util.Set;
 
@@ -16,4 +21,10 @@ public interface ICommonService {
     public void initUserEditData(String num, Set<String> bizs, Map<String, Map<String ,Object>> params);
 
     void transferToFlv(String num, String fileName, String bucket) throws Exception;
+
+    void updateViewGetInfo(String num, Map<String, Object> param);
+
+    JSONObject getInfoJson(String num);
+
+
 }

+ 9 - 0
src/main/java/com/fdkankan/scene/service/IRemovePortraitService.java

@@ -0,0 +1,9 @@
+package com.fdkankan.scene.service;
+
+import com.alibaba.fastjson.JSONObject;
+
+public interface IRemovePortraitService {
+
+    void removePortrait(JSONObject param) throws Exception;
+
+}

+ 2 - 0
src/main/java/com/fdkankan/scene/service/ISceneCooperationService.java

@@ -15,4 +15,6 @@ public interface ISceneCooperationService extends IService<SceneCooperation> {
 
     SceneCooperation getByNum(String num);
 
+    SceneCooperation getByNumAndUserId(String num, Long userId);
+
 }

+ 2 - 0
src/main/java/com/fdkankan/scene/service/ISceneEditInfoService.java

@@ -114,4 +114,6 @@ public interface ISceneEditInfoService extends IService<SceneEditInfo> {
 
     ResultData listFilter(BaseSceneParamVO param) throws Exception;
 
+    void uploadPanoramaHandler(String num, String bucket, String target, String imgViewPath, List<String> uploadFileList, String targetImagesPath, String bizType) throws Exception;
+
 }

+ 4 - 0
src/main/java/com/fdkankan/scene/service/ISceneMarkShapeService.java

@@ -27,4 +27,8 @@ public interface ISceneMarkShapeService extends IService<SceneMarkShape> {
     List<SceneMarkShape> findByToTrainStatus(Integer toTrain);
 
     void editTrainStatus(SceneMarkShapeParamVO param);
+
+    List<SceneMarkShape> findByNumAndType(String num,Integer type);
+
+    List<SceneMarkShape> findByNum(String num);
 }

+ 6 - 10
src/main/java/com/fdkankan/scene/service/ISceneProService.java

@@ -2,18 +2,10 @@ package com.fdkankan.scene.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.fdkankan.scene.bean.SceneBean;
+import com.fdkankan.scene.vo.*;
 import com.fdkankan.web.response.ResultData;
 import com.fdkankan.scene.entity.ScenePro;
-import com.fdkankan.scene.vo.BaseDataParamVO;
-import com.fdkankan.scene.vo.DeleteHotIconParamVO;
-import com.fdkankan.scene.vo.DeleteHotParamVO;
-import com.fdkankan.scene.vo.FileNameAndDataParamVO;
-import com.fdkankan.scene.vo.FileParamVO;
-import com.fdkankan.scene.vo.SaveTagsParamVO;
-import com.fdkankan.scene.vo.SaveTagsVisibleParamVO;
-import com.fdkankan.scene.vo.SceneEditParamVO;
-import com.fdkankan.scene.vo.SceneParamVO;
-import com.fdkankan.scene.vo.SceneVO;
+
 import java.util.List;
 import java.util.Set;
 
@@ -34,6 +26,10 @@ public interface ISceneProService extends IService<ScenePro> {
 
     ResultData addOrUpdateTag(SaveTagsParamVO param) throws Exception;
 
+    ResultData uploadTagImg(String num, MultipartFile file, String sid, Integer size, Integer tileSize) throws Exception;
+
+    ResultData deleteTagImg(DeleteSidListParamVO param);
+
     ResultData deleteTag(DeleteHotParamVO param) throws Exception;
 
     ResultData deleteIcons(DeleteHotIconParamVO param) throws Exception;

+ 3 - 0
src/main/java/com/fdkankan/scene/service/ISceneResourceCooperationService.java

@@ -1,6 +1,7 @@
 package com.fdkankan.scene.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.fdkankan.scene.dto.SceneResourceDTO;
 import com.fdkankan.scene.entity.SceneResourceCooperation;
 
 import java.util.List;
@@ -18,4 +19,6 @@ public interface ISceneResourceCooperationService extends IService<SceneResource
     void deleteByCooperationId(Long id);
 
     void deleteByCooperationIds(List<Long> ids);
+
+    List<SceneResourceCooperation> listByCondition(SceneResourceDTO dto);
 }

+ 2 - 1
src/main/java/com/fdkankan/scene/service/IVisionService.java

@@ -1,5 +1,6 @@
 package com.fdkankan.scene.service;
 
+import com.fdkankan.scene.dto.GeoPoint;
 import com.fdkankan.web.response.ResultData;
 
 import java.util.List;
@@ -7,6 +8,6 @@ import java.util.Map;
 
 public interface IVisionService {
 
-    List<Map<String, Object>> getPointLatAndLon(String num);
+    List<GeoPoint> getPointLatAndLon(String num);
 
 }

+ 16 - 0
src/main/java/com/fdkankan/scene/service/SceneShapeEnumService.java

@@ -0,0 +1,16 @@
+package com.fdkankan.scene.service;
+
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.fdkankan.scene.entity.SceneShapeEnum;
+
+/**
+ * 标注框模型表 服务类接口
+ *
+ * @author Xiewj
+ * @since 2023-11-09 11:53
+ */
+public interface SceneShapeEnumService extends IService<SceneShapeEnum> {
+
+      SceneShapeEnum findByClassName(String className);
+}

+ 53 - 30
src/main/java/com/fdkankan/scene/service/impl/BoxModelServiceImpl.java

@@ -2,6 +2,7 @@ package com.fdkankan.scene.service.impl;
 
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.util.CharsetUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.core.util.ZipUtil;
 import com.alibaba.fastjson.JSONArray;
@@ -75,42 +76,58 @@ public class BoxModelServiceImpl implements IBoxModelService {
             throw new BusinessException(ErrorCode.FAILURE_CODE_7015);
         }
 
-        if(!FileUtils.checkFileSizeIsLimit(file.getSize(), 5, "M")){
-            throw new BusinessException(ErrorCode.FAILURE_CODE_7023, "5M");
-        }
-        String path = String.format(scenePlusExt.getDataSource()+ ConstantFileLocPath.SCENE_USER_PATH_V4, num)+ "boxModel/" + sid + "/";
-
-        String zipPath = path + file.getOriginalFilename();
-        String srcPath = path + "data/";
-        String glbPath = path + sid + ".glb";
-
-        FileUtil.del(path);
-        FileUtil.mkParentDirs(zipPath);
-        file.transferTo(new File(zipPath));
+//        if(!FileUtils.checkFileSizeIsLimit(file.getSize(), 5, "M")){
+//            throw new BusinessException(ErrorCode.FAILURE_CODE_7023, "5M");
+//        }
+        String path = String.format(ConstantFilePath.SCENE_USER_PATH_V4, num) + "boxModel/" + sid + "/";
+        try {
+            String zipPath = path + file.getOriginalFilename();
+            String srcPath = path + "data/";
+            String glbPath = path + sid + ".glb";
+
+            FileUtil.del(path);
+            FileUtil.mkParentDirs(zipPath);
+            file.transferTo(new File(zipPath));
+
+            //解压
+            ZipUtil.unzip(zipPath,srcPath, CharsetUtil.CHARSET_GBK);
+
+            //校验是否包含目录,如果包含目录提示错误
+            File srcFile = new File(srcPath);
+            Arrays.stream(srcFile.listFiles()).forEach(subFile->{
+                if(subFile.isDirectory()){
+                    throw new BusinessException(ErrorCode.FAILURE_CODE_5065);
+                }
+            });
 
-        //解压
-        ZipUtil.unzip(zipPath,srcPath);
+            //转glb
+            OBJToGLBUtil.objToGlb(srcPath, glbPath);
 
-        //校验是否包含目录,如果包含目录提示错误
-        File srcFile = new File(srcPath);
-        Arrays.stream(srcFile.listFiles()).forEach(subFile->{
-            if(subFile.isDirectory()){
-                throw new BusinessException(ErrorCode.FAILURE_CODE_5065);
+            if(!ComputerUtil.checkComputeCompleted(glbPath, 10, 2000)){
+                throw new BusinessException(ErrorCode.FAILURE_CODE_7013);
             }
-        });
 
-        //转glb
-        OBJToGLBUtil.objToGlb(srcPath, glbPath);
-
-        log.info("glbPath:{}", glbPath);
-        if(!ComputerUtil.checkComputeCompleted(glbPath, 10, 2000)){
-            throw new BusinessException(ErrorCode.FAILURE_CODE_7013);
-        }
+            //上传glb
+            ossUtil.uploadFile(bucket,String.format(UploadFilePath.USER_EDIT_PATH, num) + "boxModels/" + sid + ".glb", glbPath, false);
+
+            //上传原始obj相关文件
+            String objPath = String.format(UploadFilePath.USER_EDIT_PATH, num) + "boxModels/" + sid + "/";
+            //先删除旧的,只需要保留最新的
+            fYunFileService.deleteFolder(objPath);
+            List<File> files = FileUtil.loopFiles(srcPath);
+            files.stream().forEach(v->{
+                String ossKey = String.format(UploadFilePath.USER_EDIT_PATH, num) + "boxModels/" + sid + "/" + v.getAbsolutePath().replace(srcPath, "");
+                fYunFileService.uploadFile(v.getAbsolutePath(), ossKey);
+            });
 
-        //上传glb
-        ossUtil.uploadFile(bucket,String.format(UploadFilePath.USER_EDIT_PATH, num) + "boxModels/" + sid + ".glb", glbPath, false);
+            return ResultData.ok(sid + ".glb");
 
-        return ResultData.ok(sid + ".glb");
+        }catch (Exception e){
+            log.error("上传三维模型失败", e);
+            throw e;
+        }finally {
+            FileUtil.del(path);
+        }
     }
 
     public static void main(String[] args) {
@@ -157,6 +174,12 @@ public class BoxModelServiceImpl implements IBoxModelService {
         //写数据库
         this.updateBoxModels(sceneEditInfo, boxModels);
 
+        //删除oss文件
+        String glbKey = String.format(UploadFilePath.USER_EDIT_PATH, param.getNum()) + "boxModels/" + param.getSid() + ".glb";
+        fYunFileService.deleteFile(glbKey);
+        String modelPath = String.format(UploadFilePath.USER_EDIT_PATH, param.getNum()) + "boxModels/" + param.getSid();
+        fYunFileService.deleteFolder(modelPath);
+
         return ResultData.ok();
     }
 

+ 29 - 0
src/main/java/com/fdkankan/scene/service/impl/CommonServiceImpl.java

@@ -1,10 +1,16 @@
 package com.fdkankan.scene.service.impl;
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.StrUtil;
 import com.fdkankan.common.util.FileUtils;
 import com.fdkankan.model.constants.ConstantFilePath;
 import com.fdkankan.model.constants.UploadFilePath;
+import com.fdkankan.model.utils.CreateObjUtil;
+import com.fdkankan.redis.constant.RedisKey;
+import com.fdkankan.redis.util.RedisUtil;
+import com.fdkankan.scene.bean.SceneJsonBean;
 import com.fdkankan.scene.factory.UserEditData.UserEditDataHandler;
 import com.fdkankan.scene.factory.UserEditData.UserEditDataHandlerFactory;
 import com.fdkankan.scene.oss.OssUtil;
@@ -17,6 +23,8 @@ import javax.annotation.Resource;
 import java.io.File;
 import java.util.Map;
 import java.util.Set;
+import java.nio.charset.StandardCharsets;
+import java.util.Map;
 
 @Slf4j
 @Service
@@ -24,6 +32,8 @@ public class CommonServiceImpl implements ICommonService {
 
     @Resource
     private OssUtil ossUtil;
+    @Resource
+    private RedisUtil redisUtil;
 
     @Override
     public void initUserEditData(String num, Set<String> bizs, Map<String, Map<String ,Object>> params) {
@@ -64,4 +74,23 @@ public class CommonServiceImpl implements ICommonService {
         ossUtil.uploadFile(bucket, userEditPath+flvFileName, localFilePath.replace("mp4", "flv"), false);
     }
 
+    @Override
+    public void updateViewGetInfo(String num, Map<String, Object> param) {
+        JSONObject infoJson = this.getInfoJson(num);
+        param.keySet().stream().forEach(k->{
+            infoJson.put(k, param.get(k));
+        });
+        String sceneJsonKey = String.format(UploadFilePath.DATA_VIEW_PATH, num) + "scene.json";
+        fYunFileService.uploadFile(infoJson.toJSONString().getBytes(StandardCharsets.UTF_8), sceneJsonKey);
+
+        String redisKey = String.format(RedisKey.SCENE_JSON, num);
+        redisUtil.del(redisKey);
+    }
+
+    @Override
+    public JSONObject getInfoJson(String num) {
+        String sceneJsonKey = String.format(UploadFilePath.DATA_VIEW_PATH, num) + "scene.json";
+        String fileContent = fYunFileService.getFileContent(sceneJsonKey);
+        return JSON.parseObject(fileContent);
+    }
 }

+ 125 - 0
src/main/java/com/fdkankan/scene/service/impl/RemovePortraitServiceImpl.java

@@ -0,0 +1,125 @@
+package com.fdkankan.scene.service.impl;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.util.CharsetUtil;
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.core.util.ZipUtil;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.fdkankan.common.constant.*;
+import com.fdkankan.common.exception.BusinessException;
+import com.fdkankan.common.util.FileUtils;
+import com.fdkankan.fyun.face.FYunFileServiceInterface;
+import com.fdkankan.model.constants.ConstantFilePath;
+import com.fdkankan.model.constants.UploadFilePath;
+import com.fdkankan.model.utils.CreateObjUtil;
+import com.fdkankan.model.utils.SceneUtil;
+import com.fdkankan.scene.entity.SceneAsynOperLog;
+import com.fdkankan.scene.entity.ScenePlus;
+import com.fdkankan.scene.entity.ScenePlusExt;
+import com.fdkankan.scene.service.*;
+import com.fdkankan.scene.vo.UploadPanoramaVO;
+import com.fdkankan.web.response.ResultData;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.io.File;
+import java.util.*;
+import java.util.concurrent.CompletableFuture;
+import java.util.stream.Collectors;
+
+@Slf4j
+@Service
+public class RemovePortraitServiceImpl implements IRemovePortraitService {
+
+    @Autowired
+    private IScenePlusService scenePlusService;
+    @Autowired
+    private IScenePlusExtService scenePlusExtService;
+    @Resource
+    private FYunFileServiceInterface fileServiceInterface;
+    @Autowired
+    private ISceneEditInfoService sceneEditInfoService;
+    @Resource
+    private FYunFileServiceInterface fYunFileService;
+    @Autowired
+    private ISceneAsynOperLogService sceneAsynOperLogService;
+
+    @Override
+    public void removePortrait(JSONObject param) throws Exception {
+        String num = param.getString("num");
+
+        ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
+        if(scenePlus.getRemovePortrait() == CommonOperStatus.WAITING.code()){
+            return;
+        }
+        ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
+        String bucket = scenePlusExt.getYunFileBucket();
+        //原始计算根目录
+        String uuid = UUID.randomUUID().toString();
+        //全景图计算根目录
+        String target = String.format(ConstantFilePath.SCENE_USER_PATH_V4, num) + uuid;
+        //解压缩文件存放目录
+        String targetImagesPath = target + "/extras/images/";
+        //更新状态为进行中
+        scenePlus.setRemovePortrait(CommonOperStatus.WAITING.code());
+        scenePlusService.updateById(scenePlus);
+        try {
+            //下载文件
+            String cacheImagesPath = String.format(UploadFilePath.scene_result_data_path, num) + "caches/images/";
+            List<String> imagesList = fileServiceInterface.listRemoteFiles(cacheImagesPath);
+            if(CollUtil.isEmpty(imagesList)){
+                return;
+            }
+
+            imagesList.stream().forEach(key->{
+                if(key.endsWith(".jpg")){
+                    fileServiceInterface.downloadFile(key, targetImagesPath + FileUtil.getName(key));
+                }
+            });
+
+            String imgViewPath = String.format(UploadFilePath.IMG_VIEW_PATH, num);
+            fileServiceInterface.downloadFile(imgViewPath + "vision.txt", target + File.separator + "extras" + File.separator + "vision.txt");
+
+            //data.json增加extras为执行重建算法
+            JSONObject floorplanJson = new JSONObject();
+            floorplanJson.put("has_source_images", true);
+            floorplanJson.put("has_vision_txt", true);
+
+            JSONObject dataJson = new JSONObject();
+            dataJson.put("extras", floorplanJson);
+            dataJson.put("split_type", "SPLIT_V28");
+            //V5表示不需要生成high,low文件
+            String skyboxType = "SKYBOX_V6";
+            if(scenePlusExt.getSceneScheme() == 11){
+                skyboxType = "SKYBOX_V7";
+            }
+            //sceneScheme为3切成瓦片图
+            if(scenePlusExt.getSceneScheme() == 3){
+                if("4k".equals(scenePlusExt.getSceneResolution())){
+                    skyboxType = "SKYBOX_V14";
+                }else{
+                    skyboxType = "SKYBOX_V13";
+                }
+            }
+            dataJson.put("skybox_type", skyboxType);
+            FileUtil.writeUtf8String(dataJson.toJSONString(), target + File.separator+"data.json");
+
+            sceneEditInfoService.uploadPanoramaHandler(num,bucket,target,imgViewPath,new ArrayList<>(),targetImagesPath, "removePortrait");
+            scenePlus.setRemovePortrait(CommonOperStatus.SUCCESS.code());
+
+            //清除全景图异步操作记录,防止再次下载的时候请求到旧的压缩包
+            sceneAsynOperLogService.cleanLog(num, SceneAsynModuleType.UPLOAD_DOWNLOAD.code(), SceneAsynFuncType.PANORAMIC_IMAGE.code());
+
+        }catch (Exception e){
+            log.error("抹除人像失败,num:{}", num, e);
+            scenePlus.setRemovePortrait(CommonOperStatus.FAILD.code());
+        }finally {
+            FileUtil.del(target);
+            scenePlusService.updateById(scenePlus);
+        }
+    }
+}

+ 9 - 0
src/main/java/com/fdkankan/scene/service/impl/SceneCooperationServiceImpl.java

@@ -24,4 +24,13 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
             new LambdaQueryWrapper<SceneCooperation>()
                 .eq(SceneCooperation::getSceneNum, num));
     }
+
+    @Override
+    public SceneCooperation getByNumAndUserId(String num, Long userId) {
+        return this.getOne(
+                new LambdaQueryWrapper<SceneCooperation>()
+                        .eq(SceneCooperation::getSceneNum, num)
+                        .eq(SceneCooperation::getUserId, userId)
+                        .eq(SceneCooperation::getSceneType, "mesh"));
+    }
 }

+ 6 - 3
src/main/java/com/fdkankan/scene/service/impl/SceneEditInfoServiceImpl.java

@@ -242,6 +242,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
         sceneJson.setSceneKind(scenePlusExt.getSceneKind());
         sceneJson.setModelKind(scenePlusExt.getModelKind());
         sceneJson.setOrientation(scenePlusExt.getOrientation());
+        sceneJson.setHasRecognition(scenePlusExt.getHasRecognition());
         if(StrUtil.isNotEmpty(scenePlusExt.getVideos())){
             sceneJson.setVideos(scenePlusExt.getVideos());
         }
@@ -499,6 +500,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
         sceneInfoVO.setSns(JSON.parseObject(sceneEditInfoExt.getSnsInfo()));
         sceneInfoVO.setStarted(JSON.parseObject(sceneEditInfoExt.getStarted()));
         sceneInfoVO.setOrientation(scenePlusExt.getOrientation());
+        sceneInfoVO.setHasRecognition(scenePlusExt.getHasRecognition());
 
         sceneInfoVO.setBucket(mappping);
 
@@ -1242,7 +1244,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
                 }
                 sceneAsynOperLogService.save(sceneAsynOperLog);
                 try {
-                    this.uploadPanoramaHandler(num,bucket,target,imgViewPath, finalUploadFileList,targetImagesPath);
+                    this.uploadPanoramaHandler(num,bucket,target,imgViewPath, finalUploadFileList,targetImagesPath, null);
                     sceneAsynOperLog.setState(CommonOperStatus.SUCCESS.code());
                 } catch (Exception e) {
                     log.error("上传全景图报错,num:" + num, e);
@@ -1251,7 +1253,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
                 sceneAsynOperLogService.updateById(sceneAsynOperLog);
             });
         }else{
-            this.uploadPanoramaHandler(num,bucket,target,imgViewPath,uploadFileList,targetImagesPath);
+            this.uploadPanoramaHandler(num,bucket,target,imgViewPath,uploadFileList,targetImagesPath, null);
             if(CollUtil.isNotEmpty(notExistFileList)){
                 uploadPanoramaVO.setSuccessCnt(uploadFileList.size());
                 uploadPanoramaVO.setFailList(notExistFileList);
@@ -1260,7 +1262,8 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
         return ResultData.ok(uploadPanoramaVO);
     }
 
-    public void uploadPanoramaHandler(String num, String bucket, String target, String imgViewPath, List<String> uploadFileList, String targetImagesPath) throws Exception {
+    @Override
+    public void uploadPanoramaHandler(String num, String bucket, String target, String imgViewPath, List<String> uploadFileList, String targetImagesPath, String bizType) throws Exception {
         ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
         ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
 

+ 8 - 0
src/main/java/com/fdkankan/scene/service/impl/SceneEditServiceImpl.java

@@ -8,6 +8,8 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.fdkankan.common.constant.CommonStatus;
 import com.fdkankan.common.constant.ErrorCode;
+import com.fdkankan.common.constant.SceneSource;
+import com.fdkankan.model.constants.UploadFilePath;
 import com.fdkankan.common.exception.BusinessException;
 import com.fdkankan.model.constants.UploadFilePath;
 import com.fdkankan.scene.entity.Scene;
@@ -106,6 +108,12 @@ public class SceneEditServiceImpl implements ISceneEditService {
         //获取该相机是否有权益
         boolean isExpired  = false;
 
+        //增加判断,如果是e57类型场景,默认给会员(上传e57功能需求临时方案)
+        if(scenePlus.getSceneSource() == SceneSource.E57.code()){
+            isExpired = false;
+            isVip = true;
+        }
+
         sceneAuthVO.setIsExpired(isExpired);
         sceneAuthVO.setIsVip(isVip);
 

+ 14 - 0
src/main/java/com/fdkankan/scene/service/impl/SceneMarkShapeServiceImpl.java

@@ -177,4 +177,18 @@ public class SceneMarkShapeServiceImpl extends ServiceImpl<MarkShapeMapper, Scen
             save(sceneMarkShape);
         }
     }
+    @Override
+    public List<SceneMarkShape> findByNumAndType(String num,Integer type) {
+        LambdaQueryWrapper<SceneMarkShape> wrapper = Wrappers.lambdaQuery();
+        wrapper.eq(SceneMarkShape::getNum,num);
+        wrapper.eq(SceneMarkShape::getType,type);
+        return list(wrapper);
+    }
+
+    @Override
+    public List<SceneMarkShape> findByNum(String num) {
+        LambdaQueryWrapper<SceneMarkShape> wrapper = Wrappers.lambdaQuery();
+        wrapper.eq(SceneMarkShape::getNum,num);
+        return list(wrapper);
+    }
 }

+ 117 - 20
src/main/java/com/fdkankan/scene/service/impl/SceneProServiceImpl.java

@@ -5,6 +5,7 @@ import cn.hutool.core.date.DateField;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.io.FileUtil;
 import cn.hutool.core.util.StrUtil;
+import cn.hutool.core.util.XmlUtil;
 import cn.hutool.core.util.ZipUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
@@ -14,6 +15,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fdkankan.common.constant.*;
 import com.fdkankan.common.exception.BusinessException;
+import com.fdkankan.common.util.CmdUtils;
 import com.fdkankan.common.util.FileUtils;
 import com.fdkankan.common.exception.BusinessException;
 import com.fdkankan.common.util.FileUtils;
@@ -58,6 +60,8 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.multipart.MultipartFile;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
 
 import javax.annotation.Resource;
 import java.io.File;
@@ -185,6 +189,90 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         return ResultData.ok();
     }
 
+    @Override
+    public ResultData uploadTagImg(String num, MultipartFile file, String sid, Integer size, Integer tileSize) throws Exception {
+        String extName = FileUtil.extName(file.getOriginalFilename());
+        String fragmentPath = String.format(ConstantFilePath.SCENE_USER_PATH_V4, num) + "hot_img_fragment/";
+        String workPath = fragmentPath + sid;
+        String dziPath = workPath + ".dzi";
+        String outFilesPath = workPath + "_files/";
+        Integer height = null;
+        Integer width = null;
+        try {
+            FileUtil.mkdir(workPath);
+
+            //保存到本地
+            String origFilePath = workPath + "/" + sid + "." + extName;
+            file.transferTo(new File(origFilePath));
+
+            String ossPath = String.format(UploadFilePath.USER_EDIT_PATH, num) + "hotspot/" + sid + "/";
+            Map<String, String> uploadMap = new HashMap<>();
+
+            //切图
+            String fragmentCmd = "vips dzsave --tile-size "  + tileSize + " " + origFilePath + " " +  workPath;
+            CmdUtils.callLine(fragmentCmd);
+            if(!ComputerUtil.checkComputeCompleted(dziPath, 5, 200)){
+                throw new BusinessException(ErrorCode.FAILURE_CODE_5052);
+            }
+            List<File> files = FileUtil.loopFiles(outFilesPath);
+            files.stream().forEach(v->{
+                uploadMap.put(v.getAbsolutePath(), v.getAbsolutePath().replace(outFilesPath, ossPath));
+            });
+
+            //是否缩放缩略图,判断:读取dzi中的w h,只要有一个超过320,则进行缩放,如果前端传参,则以传参值为准, 缩放默认值320,否则拿原图作为缩略图,
+            String thumbnailName = "thumbnail." + extName;
+            Document document = XmlUtil.readXML(new File(dziPath));
+            Element rootElement = XmlUtil.getRootElement(document);
+            Element sizeElement = XmlUtil.getElement(rootElement, "Size");
+            height = Integer.valueOf(sizeElement.getAttribute("Height"));
+            width = Integer.valueOf(sizeElement.getAttribute("Width"));
+            Integer maxSize = height > width ? height : width;
+            if(maxSize > size){
+                String thumbnailPath =  workPath + "/" + thumbnailName;
+                String scaleCmd = "vipsthumbnail " + origFilePath  + " -s " + size + " -o " + thumbnailPath;
+                CmdUtils.callLine(scaleCmd);
+                if(!ComputerUtil.checkComputeCompleted(thumbnailPath, 5, 200)){
+                    throw new BusinessException(ErrorCode.FAILURE_CODE_5052);
+                }
+                uploadMap.put(thumbnailPath, ossPath + thumbnailName);
+            }else{
+                uploadMap.put(origFilePath, ossPath + thumbnailName);
+            }
+
+            //上传
+            uploadMap.entrySet().stream().forEach(entry->{
+                fYunFileService.uploadFile(entry.getKey(), entry.getValue());
+            });
+
+            //上传原图
+            fYunFileService.uploadFile(origFilePath, ossPath + sid + "." + extName);
+
+        }finally {
+            FileUtil.del(workPath);
+            FileUtil.del(dziPath);
+            FileUtil.del(outFilesPath);
+        }
+
+        Map<String, Object> hw = new HashMap<>();
+        hw.put("height",height);
+        hw.put("width",width);
+        hw.put("sid",sid);
+        hw.put("tileSize",tileSize);
+        return ResultData.ok(hw);
+    }
+
+    @Override
+    public ResultData deleteTagImg(DeleteSidListParamVO param) {
+        param.getSidList().stream().forEach(sid->{
+            String ossPath = String.format(UploadFilePath.USER_EDIT_PATH, param.getNum()) + "hotspot/" + sid + "/";
+            if(CollUtil.isNotEmpty(fYunFileService.listRemoteFiles(ossPath))){
+                fYunFileService.deleteFolder(ossPath);
+            }
+        });
+
+        return ResultData.ok();
+    }
+
     private void addOrUpdateHotData(String num, List<HotParamVO> hotDataList) throws Exception{
         Map<String, String> addOrUpdateMap = new HashMap<>();
         int i = 0;
@@ -557,6 +645,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         }
         //删除图片音频视频等资源文件
         List<String> deleteFileList = new ArrayList<>();
+        List<String> deleteKeys = new ArrayList<>();
         for (String data : hotdataList) {
             if(StrUtil.isBlank(data)){
                 continue;
@@ -580,23 +669,20 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
                 JSONArray media = jsonObject.getJSONArray("media");
                 media.stream().forEach(v->{
                     JSONObject o = (JSONObject) v;
-                    String src = o.getString("src");
-                    if(StrUtil.isNotEmpty(src)){
-                        deleteFileList.add(src);
+                    String fileSid = o.getString("sid");
+                    if(o.containsKey("tileSize")){//4.14.0版本,图片类型热点不调用通用上传接口上传,改为切图接口上传,所以这里直接删除整个文件目录
+                        String ossPath = String.format(UploadFilePath.USER_EDIT_PATH, num) + "hotspot/" + fileSid + "/";
+                        deleteKeys.add(ossPath);
+                    }else{
+                        String src = o.getString("src");
+                        if(StrUtil.isNotEmpty(src)){
+                            deleteFileList.add(src);
+                        }
                     }
+
                 });
             }
 
-            /* v4.12版本之前是这种方式
-            "media": {
-                "image": [
-                {
-                    "src": "FfRdi413774.jpg"
-                }
-		    ]
-            },
-            "type": "image"
-             */
             if("image".equals(type) || "audio".equals(type) || "video".equals(type)){
                 //删除图片、视频
                 JSONObject media = jsonObject.getJSONObject("media");
@@ -611,14 +697,19 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
             }
         }
 
-        if(CollUtil.isEmpty(deleteFileList)){
-            return;
+        if(CollUtil.isNotEmpty(deleteFileList)){
+            sceneUploadService.delete(
+                    DeleteFileParamVO.builder()
+                            .num(num)
+                            .fileNames(deleteFileList)
+                            .bizType("tag-media").build());
         }
-        sceneUploadService.delete(
-                DeleteFileParamVO.builder()
-                        .num(num)
-                        .fileNames(deleteFileList)
-                        .bizType("tag-media").build());
+        if(CollUtil.isNotEmpty(deleteKeys)){
+            deleteKeys.stream().forEach(key->{
+                fYunFileService.deleteFolder(key);
+            });
+        }
+
     }
 
     @Override
@@ -1244,6 +1335,12 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         File copy = FileUtil.copy(new File("D:\\4DMega\\4DKK_PROGRAM_STATIC\\scene_view_data/1680825957743071232/data/mesh/"),
                 new File("/mnt/4Dkankan/scene_v4/1680825957743071232/data"), true);
 
+        Element rootElement = XmlUtil.getRootElement(document);
+        Element size = XmlUtil.getElement(rootElement, "Size");
+        String Height = size.getAttribute("Height");
+        String Width = size.getAttribute("Width");
+
+        System.out.println(123);
     }
 
 

+ 6 - 0
src/main/java/com/fdkankan/scene/service/impl/SceneResourceCooperationServiceImpl.java

@@ -2,6 +2,7 @@ package com.fdkankan.scene.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fdkankan.scene.dto.SceneResourceDTO;
 import com.fdkankan.scene.entity.SceneResourceCooperation;
 import com.fdkankan.scene.mapper.ISceneResourceCooperationMapper;
 import com.fdkankan.scene.service.ISceneResourceCooperationService;
@@ -29,4 +30,9 @@ public class SceneResourceCooperationServiceImpl extends ServiceImpl<ISceneResou
     public void deleteByCooperationIds(List<Long> ids) {
         this.remove(new LambdaQueryWrapper<SceneResourceCooperation>().in(SceneResourceCooperation::getSceneCooperationId, ids));
     }
+
+    @Override
+    public List<SceneResourceCooperation> listByCondition(SceneResourceDTO dto) {
+        return this.baseMapper.selectByCondition(dto);
+    }
 }

+ 17 - 7
src/main/java/com/fdkankan/scene/service/impl/SceneResourceServiceImpl.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fdkankan.common.constant.ErrorCode;
 import com.fdkankan.common.exception.BusinessException;
+import com.fdkankan.scene.dto.SceneResourceDTO;
 import com.fdkankan.scene.entity.SceneResource;
 import com.fdkankan.scene.entity.SceneResourceCooperation;
 import com.fdkankan.scene.mapper.ISceneResourceMapper;
@@ -12,6 +13,8 @@ import com.fdkankan.scene.service.ISceneResourceCooperationService;
 import com.fdkankan.scene.service.ISceneResourceService;
 import java.util.List;
 import java.util.stream.Collectors;
+
+import org.ini4j.spi.RegEscapeTool;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -32,14 +35,21 @@ public class SceneResourceServiceImpl extends ServiceImpl<ISceneResourceMapper,
     @Override
     public List<SceneResource> findByCooperationId(Long sceneCooperationId) {
 
-        long countV4Resource = this.countByVersion("v4");
-
-        List<SceneResourceCooperation> sceneResourceCooperationList
-            = sceneResourceCooperationService.list(
-            new LambdaQueryWrapper<SceneResourceCooperation>()
-                .eq(SceneResourceCooperation::getSceneCooperationId, sceneCooperationId));
+//        List<SceneResourceCooperation> sceneResourceCooperationList
+//                = sceneResourceCooperationService.list(
+//                new LambdaQueryWrapper<SceneResourceCooperation>()
+//                        .eq(SceneResourceCooperation::getSceneCooperationId, sceneCooperationId));
+        List<SceneResourceCooperation> sceneResourceCooperationList =
+                sceneResourceCooperationService.listByCondition(
+                SceneResourceDTO.builder().sceneCooperationId(sceneCooperationId).version("v4").build());
+        //多人协作改造后方案,不写sceneResourceCooperationList表,所以这里,没有查到相关资源绑定信息,即为全部授权协作
+        if(CollUtil.isEmpty(sceneResourceCooperationList)){
+            return null;
+        }
 
-        if(countV4Resource == sceneResourceCooperationList.size()){//如果协作菜单数量与资源数量相同,则返回空,由前端判断当前用户拥有所有该场景编辑权限
+        //如果协作菜单数量与资源数量相同,则返回空,由前端判断当前用户拥有所有该场景编辑权限
+        long countV4Resource = this.countByVersion("v4");
+        if(countV4Resource == sceneResourceCooperationList.size()){
             return null;
         }
 

+ 14 - 0
src/main/java/com/fdkankan/scene/service/impl/SceneServiceImpl.java

@@ -28,6 +28,12 @@ import com.fdkankan.scene.entity.*;
 import com.fdkankan.scene.mapper.ISceneMapper;
 import com.fdkankan.scene.oss.OssUtil;
 import com.fdkankan.scene.service.*;
+import com.fdkankan.scene.entity.ScenePlus;
+import com.fdkankan.scene.entity.ScenePlusExt;
+import com.fdkankan.scene.service.ICommonService;
+import com.fdkankan.scene.service.IScenePlusExtService;
+import com.fdkankan.scene.service.IScenePlusService;
+import com.fdkankan.scene.service.ISceneService;
 import com.fdkankan.scene.util.OssBodySegmentUtil;
 import com.fdkankan.scene.vo.SceneParamVO;
 import com.fdkankan.web.response.ResultData;
@@ -39,6 +45,7 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.web.multipart.MultipartFile;
 
+import javax.annotation.Resource;
 import javax.imageio.ImageIO;
 import java.awt.*;
 import java.awt.image.BufferedImage;
@@ -83,6 +90,8 @@ public class SceneServiceImpl extends ServiceImpl<ISceneMapper, Scene> implement
     private ISurveillanceService surveillanceService;
     @Autowired
     private ISceneService sceneService;
+    @Autowired
+    private ICommonService commonService;
 
     @Override
     public ResultData uploadBodySegment(MultipartFile file, Integer rotate) throws Exception {
@@ -195,6 +204,11 @@ public class SceneServiceImpl extends ServiceImpl<ISceneMapper, Scene> implement
             scenePlusExt.setOrientation(orientation);
             scenePlusExtService.updateById(scenePlusExt);
         }
+
+        //查看页生效
+        Map<String, Object> param = new HashMap<>();
+        param.put("orientation", orientation);
+        commonService.updateViewGetInfo(num,param);
     }
 
     @Override

+ 24 - 0
src/main/java/com/fdkankan/scene/service/impl/SceneShapeEnumServiceImpl.java

@@ -0,0 +1,24 @@
+package com.fdkankan.scene.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fdkankan.scene.entity.SceneShapeEnum;
+import com.fdkankan.scene.mapper.SceneShapeEnumMapper;
+import com.fdkankan.scene.service.SceneShapeEnumService;
+import org.springframework.stereotype.Service;
+
+/**
+ * 标注框模型表 服务实现类
+ *
+ * @author Xiewj
+ * @since 2023-11-09 11:53
+ */
+@Service
+public class SceneShapeEnumServiceImpl extends ServiceImpl<SceneShapeEnumMapper, SceneShapeEnum> implements SceneShapeEnumService {
+    @Override
+    public SceneShapeEnum findByClassName(String className) {
+        return this.getOne(new LambdaQueryWrapper<SceneShapeEnum>().eq(SceneShapeEnum::getClassName, className));
+    }
+
+
+}

+ 58 - 17
src/main/java/com/fdkankan/scene/service/impl/VisionServiceImpl.java

@@ -1,5 +1,6 @@
 package com.fdkankan.scene.service.impl;
 
+import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
@@ -10,17 +11,17 @@ import com.fdkankan.scene.entity.ScenePlusExt;
 import com.fdkankan.scene.oss.OssUtil;
 import com.fdkankan.scene.service.IScenePlusExtService;
 import com.fdkankan.scene.service.IScenePlusService;
+import com.fdkankan.scene.dto.GeoPoint;
 import com.fdkankan.scene.service.IVisionService;
+import com.fdkankan.scene.util.CoordinateUtil;
 import com.google.common.collect.Lists;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
+import java.util.*;
+import java.util.stream.Collectors;
 
 @Service
 @Slf4j
@@ -34,35 +35,75 @@ public class VisionServiceImpl implements IVisionService {
     private IScenePlusExtService scenePlusExtService;
 
     @Override
-    public List<Map<String, Object>> getPointLatAndLon(String num) {
+    public List<GeoPoint> getPointLatAndLon(String num) {
         ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
         ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
         List<Map<String, Object>> list = Lists.newArrayList();
         String visionTxt = ossUtil.getFileContent(scenePlusExt.getYunFileBucket(), String.format(UploadFilePath.IMG_VIEW_PATH, num) + "vision.txt");
         JSONObject visionJson = JSON.parseObject(visionTxt);
         if(!visionJson.containsKey("sweepLocations")){
-            return list;
+            return null;
         }
         JSONArray sweepLocations = visionJson.getJSONArray("sweepLocations");
+        List<GeoPoint> geoPoints = new ArrayList<>();
         for (int i = 0; i < sweepLocations.size(); ++i) {
             JSONObject sweepItem = sweepLocations.getJSONObject(i);
-            String id = sweepItem.getString("id");
-            String uuid = sweepItem.getString("uuid");
+            Long id = sweepItem.getLong("id");
+            Long uuid = sweepItem.getLong("uuid");
             JSONObject ggaLocation = sweepItem.getJSONObject("ggaLocation");
+            GeoPoint geoPoint = new GeoPoint();
+            geoPoint.setId(id);
+            geoPoint.setUuid(uuid);
             if (Objects.nonNull(ggaLocation)
                     && StrUtil.isNotEmpty(ggaLocation.getString("lon"))
                     && StrUtil.isNotEmpty(ggaLocation.getString("lat"))
                     && StrUtil.isNotEmpty(ggaLocation.getString("alt"))) {
-                Map<String, Object> item = new HashMap<>();
-                item.put("lon", ggaLocation.getString("lon"));
-                item.put("lat", ggaLocation.getString("lat"));
-                item.put("alt", ggaLocation.getString("alt"));
-                item.put("id", id);
-                item.put("uuid", uuid);
-                list.add(item);
+                Double[] ggaLocationGps = new Double[3];
+                if(Objects.nonNull(ggaLocation.getDouble("lon"))
+                        && Objects.nonNull(ggaLocation.getDouble("lat"))
+                        && Objects.nonNull(ggaLocation.getDouble("alt"))){
+                    ggaLocationGps[0] = ggaLocation.getDouble("lon");
+                    ggaLocationGps[1] = ggaLocation.getDouble("lat");
+                    ggaLocationGps[2] = ggaLocation.getDouble("alt");
+                }
+                geoPoint.setCoordinates(ggaLocationGps);
+                geoPoint.setStatusIndicator(ggaLocation.getInteger("StatusIndicator"));
+
+            }
+            if (sweepItem.containsKey("puck")){
+                JSONObject puck = sweepItem.getJSONObject("puck");
+                Double[] floor_location = new Double[3];
+                floor_location[0] = puck.getDouble("x");
+                floor_location[1] = puck.getDouble("y");
+                floor_location[2] = puck.getDouble("z");
+                geoPoint.setLocation(floor_location);
             }
+            geoPoints.add(geoPoint);
         }
-
-        return list;
+        if (CollUtil.isNotEmpty(geoPoints) && geoPoints.size() >= 2) {
+            Map<String, GeoPoint> res = new HashMap<>();
+            List<GeoPoint> statusFourPoints  = geoPoints.stream().filter(item -> item.getStatusIndicator() == 4 || item.getStatusIndicator() == 100 || item.getStatusIndicator() == 104).collect(Collectors.toList());
+            if (statusFourPoints.size() >= 2) {
+                CoordinateUtil.divide(0, statusFourPoints.size() - 1, statusFourPoints.toArray(new GeoPoint[0]), res);
+            }else {
+                return null ;
+            }
+            for (GeoPoint geoPoint : geoPoints) {
+                if (res.containsKey("pointA")) {
+                    GeoPoint pointA = res.get("pointA");
+                    if (geoPoint.getId()==pointA.getId()){
+                        geoPoint.setPointA(true);
+                    }
+                }
+                if (res.containsKey("pointB")) {
+                    GeoPoint pointB = res.get("pointB");
+                    if (geoPoint.getId()==pointB.getId()){
+                        geoPoint.setPointB(true);
+                    }
+                }
+            }
+            return geoPoints;
+        }
+        return null;
     }
 }

+ 162 - 0
src/main/java/com/fdkankan/scene/util/CoordinateUtil.java

@@ -0,0 +1,162 @@
+package com.fdkankan.scene.util;
+
+
+import com.fdkankan.scene.dto.GeoPoint;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description: 距离 范围 计算工具类
+ * @author Xiewj
+ * @date 2021/11/23
+ */
+public class CoordinateUtil {
+   /**
+    * 计算经纬度围成的实际面积(平方公里)
+    * @return
+    */
+   public static BigDecimal getArea(List<GeoPoint> ring){
+      double sJ = 6378137;
+      double Hq = 0.017453292519943295;
+      double c = sJ *Hq;
+      double d = 0;
+
+      if (3 > ring.size()) {
+         return new BigDecimal( 0);
+      }
+
+      for (int i = 0; i < ring.size() - 1; i ++){
+         GeoPoint h = ring.get(i);
+         GeoPoint k = ring.get(i + 1);
+         double u = h.getLon() * c * Math.cos(h.getLat() * Hq);
+
+         double hhh = h.getLat() * c;
+         double v = k.getLon() * c * Math.cos(k.getLat() *Hq);
+         d = d + (u * k.getLat() * c - v * hhh);
+      }
+
+      GeoPoint g1 = ring.get(ring.size()-1);
+      GeoPoint point = ring.get(0);
+      double eee = g1.getLon() * c * Math.cos(g1.getLat() * Hq);
+      double g2 = g1.getLat() * c;
+
+      double k = point.getLon() * c * Math.cos(point.getLat() * Hq);
+      d += eee * point.getLat() * c - k * g2;
+      return new BigDecimal( 0.5*Math.abs(d));
+   }
+
+   // WGS84标准参考椭球中的地球长半径(单位:米)
+   private static final double EARTH_RADIUS_WGS84 = 6378137.0;
+   public static  GeoPoint pointA = new GeoPoint();
+   public static  GeoPoint pointB = new GeoPoint();
+
+   /**
+    * 计算两个坐标的距离(粗略计算,单位:米)
+    * 计算公式参照 google map 的距离计算
+    *
+    * @param gps1 坐标1
+    * @param gps2 坐标2
+    * @return
+    */
+   public static double distance(GeoPoint gps1, GeoPoint gps2) {
+
+      double radLat1 = Math.toRadians(gps1.getLat());
+      double radLat2 = Math.toRadians(gps2.getLat());
+
+      double a = radLat1 - radLat2;
+      double b = Math.toRadians(gps1.getLon()) - Math.toRadians(gps2.getLon());
+
+      double s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) +
+              Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2)));
+
+      return Math.round(s * EARTH_RADIUS_WGS84);
+
+   }
+
+
+   public static void distance(List<Object> pointList) {
+
+
+   }
+   /*
+    * @Title divide
+    * @Description 求平面上距离最近的两个点
+    * @author 滑技工厂
+    * @Date 2020/3/28
+    * @param [left, right, points]
+    * @return double
+    * @throws
+    */
+   public static double divide(int left, int right, GeoPoint[] points, Map<String, GeoPoint> res) {
+      // 当前最小两点距离,初始值设置为无穷大
+      double curMaxDis = 1e20;
+      // 如果只有一个点,则不存在最近两点距离,返回无穷大
+      if (left == right) {
+         return curMaxDis;
+      }
+      // 这里是判断是否为只有两个点,如果只有两个点的话那么直接求解。
+      if (left + 1 == right) {
+         res.put("pointA",points[left]);
+         res.put("pointB",points[right]);
+         return distance(points[left], points[right]);
+      }
+
+      // 分治法:第一步:分区,并求取左右分区最小两点距离
+      // 通过右移运算除2,对区域进行合理的划分,使得左右两边保持大致相等个数点
+      int middle = (left + right) >> 1;
+      double leftMinDis = divide(left, middle, points,res);
+      double rightMinDis = divide(middle, right, points,res);
+
+      curMaxDis = (leftMinDis <= rightMinDis) ? leftMinDis : leftMinDis;
+
+      // 分治法:第二步:假设距离最近的两点分别在左右分区中
+      // 关键代码,距离最近的两个点,一个位于左边区域,一个位于右边区域,x轴搜索范围[middle-curMaxDis, middle+curMaxDis]
+      // 记录搜索区间内的点的索引,便于进一步计算最小距离
+      List<Integer> validPointIndex = new ArrayList<>();
+      for (int i = left; i <= right; i++) {
+         if (Math.abs(points[middle].getLat() - points[i].getLat()) <= curMaxDis) {
+            validPointIndex.add(i);
+         }
+      }
+      // 基于索引,进一步计算区间内最小两点距离
+      for (int i = 0; i < validPointIndex.size() - 1; i++) {
+         for (int j = i + 1; j < validPointIndex.size(); j++) {
+            // 如果区间内的两点y轴距离大于curMinDis,则没必要计算了,因为,它们的距离肯定大于curMinDis,
+            if (Math.abs(points[validPointIndex.get(i)].getLon()
+                    - points[validPointIndex.get(j)].getLon()) > curMaxDis) {
+               continue;
+            }
+            double tempDis = distance(points[validPointIndex.get(i)],
+                    points[validPointIndex.get(j)]);
+
+            if (tempDis > curMaxDis){
+               curMaxDis=tempDis;
+               res.put("pointA",points[validPointIndex.get(i)]);
+               res.put("pointB",points[validPointIndex.get(j)]);
+            }
+         }
+      }
+      return curMaxDis;
+   }
+
+
+   public static void main(String[] args) {
+//      int i=500;
+//      List<GeoPoint> ring = new ArrayList<>();
+//
+//      for (int i1 = i; i1 > 0; i1--) {
+//         double a = RandomUtil.randomDouble(113.0000001, 113.9999999);
+//         double b = RandomUtil.randomDouble(22.0000001,22.9999999);
+//         GeoPoint d=new GeoPoint(a,b);
+//         ring.add(d);
+//      }
+//      JSONObject res=new JSONObject();
+//      TimeInterval timer = DateUtil.timer();
+//      System.out.println(divide(0, ring.size()-1, ring.toArray(new GeoPoint[0]),res));
+//      System.out.println(res);
+//      System.out.println("使用秒数"+timer.intervalMs());
+   }
+}

+ 3 - 0
src/main/java/com/fdkankan/scene/vo/SceneEditControlsParamVO.java

@@ -133,7 +133,10 @@ public class SceneEditControlsParamVO implements Serializable {
 
     private Integer showPanos;
 
+    private Integer showAreas;
 
+    private Integer showAi;
 
+    private Integer showLaser;
 
 }

+ 6 - 0
src/main/java/com/fdkankan/scene/vo/SceneEditControlsVO.java

@@ -123,5 +123,11 @@ public class SceneEditControlsVO implements Serializable {
 
     private Integer showPanos;
 
+    private Integer showAreas;
+
+    private Integer showAi;
+
+    private int showLaser;
+
 
 }

+ 2 - 0
src/main/java/com/fdkankan/scene/vo/SceneInfoVO.java

@@ -270,4 +270,6 @@ public class SceneInfoVO {
 
     private String orientation;
 
+    private Integer hasRecognition;
+
 }

+ 6 - 0
src/main/java/com/fdkankan/scene/vo/SceneMarkShapeParamVO.java

@@ -32,5 +32,11 @@ public class SceneMarkShapeParamVO {
      */
     private String imagePath;
 
+    /**
+     * 推理类型 1,全景图识别 2,平面图识别 为了兼容默认给1
+     */
+
+    private Integer type =1 ;
+
 
 }

+ 14 - 1
src/main/resources/mapper/scene/SceneResourceCooperationMapper.xml

@@ -1,5 +1,18 @@
 <?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.com.fdkankan.scene.mapper.ISceneResourceCooperationMapper">
+<mapper namespace="com.fdkankan.scene.mapper.ISceneResourceCooperationMapper">
+
+    <select id="selectByCondition" parameterType="com.fdkankan.scene.dto.SceneResourceDTO" resultType="com.fdkankan.scene.entity.SceneResourceCooperation">
+        select * from t_scene_resource_cooperation t
+        left join t_scene_resource r on t.scene_resource_id = r.id and r.rec_status = 'A'
+        where t.rec_status = 'A'
+        <if test="sceneCooperationId != null">
+            and t.scene_cooperation_id = #{sceneCooperationId}
+        </if>
+        <if test="version != null and version != ''">
+            and r.version = #{version}
+        </if>
+    </select>
+
 
 </mapper>