浏览代码

Merge branch 'release' into feature-local-jg

# Conflicts:
#	src/main/java/com/fdkankan/scene/controller/SceneController.java
#	src/main/java/com/fdkankan/scene/generate/AutoGenerate.java
#	src/main/java/com/fdkankan/scene/listener/RabbitMqListener.java
#	src/main/java/com/fdkankan/scene/schedule/ScheduleJob.java
#	src/main/java/com/fdkankan/scene/service/IScenePlusService.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/ScenePlusServiceImpl.java
#	src/main/java/com/fdkankan/scene/service/impl/SceneProServiceImpl.java
#	src/main/resources/bootstrap-test-eur.yml
#	src/main/resources/bootstrap-test.yml
dsx 2 年之前
父节点
当前提交
0c86e871fb
共有 44 个文件被更改,包括 1864 次插入1646 次删除
  1. 6 0
      pom.xml
  2. 22 0
      src/main/java/com/fdkankan/scene/bean/BodySegmentStatusBean.java
  3. 11 0
      src/main/java/com/fdkankan/scene/bean/SceneBean.java
  4. 21 0
      src/main/java/com/fdkankan/scene/controller/SceneCleanOrigController.java
  5. 29 6
      src/main/java/com/fdkankan/scene/controller/SceneController.java
  6. 8 0
      src/main/java/com/fdkankan/scene/controller/SceneEditController.java
  7. 150 0
      src/main/java/com/fdkankan/scene/controller/SceneMarkShapeController.java
  8. 63 0
      src/main/java/com/fdkankan/scene/entity/SceneCleanOrig.java
  9. 26 0
      src/main/java/com/fdkankan/scene/entity/SceneEditControls.java
  10. 74 0
      src/main/java/com/fdkankan/scene/entity/SceneMarkShape.java
  11. 33 0
      src/main/java/com/fdkankan/scene/httpclient/MyClient.java
  12. 18 0
      src/main/java/com/fdkankan/scene/mapper/ISceneCleanOrigMapper.java
  13. 6 0
      src/main/java/com/fdkankan/scene/mapper/IScenePlusMapper.java
  14. 6 0
      src/main/java/com/fdkankan/scene/mapper/ISceneProMapper.java
  15. 16 0
      src/main/java/com/fdkankan/scene/mapper/MarkShapeMapper.java
  16. 52 0
      src/main/java/com/fdkankan/scene/schedule/ScheduleJob.java
  17. 20 0
      src/main/java/com/fdkankan/scene/service/ISceneCleanOrigService.java
  18. 2 0
      src/main/java/com/fdkankan/scene/service/ISceneEditService.java
  19. 30 0
      src/main/java/com/fdkankan/scene/service/ISceneMarkShapeService.java
  20. 3 0
      src/main/java/com/fdkankan/scene/service/IScenePlusService.java
  21. 3 0
      src/main/java/com/fdkankan/scene/service/ISceneProService.java
  22. 16 0
      src/main/java/com/fdkankan/scene/service/ISceneService.java
  23. 161 0
      src/main/java/com/fdkankan/scene/service/impl/SceneCleanOrigServiceImpl.java
  24. 39 30
      src/main/java/com/fdkankan/scene/service/impl/SceneEditInfoServiceImpl.java
  25. 30 3
      src/main/java/com/fdkankan/scene/service/impl/SceneEditServiceImpl.java
  26. 181 0
      src/main/java/com/fdkankan/scene/service/impl/SceneMarkShapeServiceImpl.java
  27. 20 2
      src/main/java/com/fdkankan/scene/service/impl/ScenePlusServiceImpl.java
  28. 117 129
      src/main/java/com/fdkankan/scene/service/impl/SceneProServiceImpl.java
  29. 169 1473
      src/main/java/com/fdkankan/scene/service/impl/SceneServiceImpl.java
  30. 12 0
      src/main/java/com/fdkankan/scene/service/impl/SurveillanceServiceImpl.java
  31. 121 0
      src/main/java/com/fdkankan/scene/util/ConverxyUtil.java
  32. 98 0
      src/main/java/com/fdkankan/scene/util/OssBodySegmentUtil.java
  33. 97 0
      src/main/java/com/fdkankan/scene/util/test.java
  34. 24 0
      src/main/java/com/fdkankan/scene/vo/SceneEditControlsParamVO.java
  35. 21 0
      src/main/java/com/fdkankan/scene/vo/SceneEditControlsVO.java
  36. 5 0
      src/main/java/com/fdkankan/scene/vo/SceneInfoVO.java
  37. 39 0
      src/main/java/com/fdkankan/scene/vo/SceneMarkShapeDetectParamVO.java
  38. 36 0
      src/main/java/com/fdkankan/scene/vo/SceneMarkShapeParamVO.java
  39. 46 0
      src/main/java/com/fdkankan/scene/vo/SceneMarkShapeReDetectParamVO.java
  40. 5 1
      src/main/resources/bootstrap-prod-eur.yml
  41. 4 0
      src/main/resources/bootstrap-prod.yml
  42. 5 0
      src/main/resources/mapper/scene/SceneCleanOrigMapper.xml
  43. 10 1
      src/main/resources/mapper/scene/ScenePlusMapper.xml
  44. 9 1
      src/main/resources/mapper/scene/SceneProMapper.xml

+ 6 - 0
pom.xml

@@ -197,6 +197,12 @@
             <classifier>windows-x86_64</classifier>
         </dependency>
 
+        <dependency>
+            <groupId>com.aliyun</groupId>
+            <artifactId>imageseg20191230</artifactId>
+            <version>1.0.5</version>
+        </dependency>
+
     </dependencies>
 
     <dependencyManagement>

+ 22 - 0
src/main/java/com/fdkankan/scene/bean/BodySegmentStatusBean.java

@@ -0,0 +1,22 @@
+package com.fdkankan.scene.bean;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class BodySegmentStatusBean {
+
+    private String uuid;
+
+    private Integer status;
+
+    private String imageUrl;
+
+
+
+}

+ 11 - 0
src/main/java/com/fdkankan/scene/bean/SceneBean.java

@@ -0,0 +1,11 @@
+package com.fdkankan.scene.bean;
+
+import lombok.Data;
+
+@Data
+public class SceneBean {
+
+    private String num;
+
+    private String dataSource;
+}

+ 21 - 0
src/main/java/com/fdkankan/scene/controller/SceneCleanOrigController.java

@@ -0,0 +1,21 @@
+package com.fdkankan.scene.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 删除oss原始资源记录 前端控制器
+ * </p>
+ *
+ * @author 
+ * @since 2023-03-29
+ */
+@RestController
+@RequestMapping("/scene/sceneCleanOrig")
+public class SceneCleanOrigController {
+
+}
+

+ 29 - 6
src/main/java/com/fdkankan/scene/controller/SceneController.java

@@ -6,6 +6,8 @@ import com.fdkankan.common.constant.SceneInfoReqType;
 import com.fdkankan.scene.bean.LaserSceneBean;
 import com.fdkankan.scene.service.ILaserService;
 import com.fdkankan.scene.vo.InitSceneParamVO;
+import com.fdkankan.scene.annotation.CheckPermit;
+import com.fdkankan.scene.service.ISceneService;
 import com.fdkankan.web.response.ResultData;
 import com.fdkankan.scene.service.ISceneEditInfoService;
 import com.fdkankan.scene.service.IScenePlusService;
@@ -16,11 +18,8 @@ import com.fdkankan.scene.vo.SceneInfoVO;
 import com.fdkankan.web.controller.BaseController;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.GetMapping;
-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 org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
 
 /**
  * <p>
@@ -40,6 +39,8 @@ public class SceneController extends BaseController {
     private IScenePlusService scenePlusService;
     @Autowired
     private ILaserService laserService;
+    @Autowired
+    private ISceneService sceneService;
 
     /**
      * <p>
@@ -76,7 +77,6 @@ public class SceneController extends BaseController {
      * </p>
      * @author dengsixing
      * @date 2022/8/1
-     * @param param
      * @return com.fdkankan.web.response.ResultData
      **/
     @GetMapping(value = "/downLoadZSData")
@@ -106,5 +106,28 @@ public class SceneController extends BaseController {
         return ResultData.ok();
     }
 
+    /**
+     * 上传人体抠图原图
+     * @param num
+     * @param file
+     * @return
+     * @throws Exception
+     */
+    @PostMapping(value = "/uploadBodySegment")
+    public ResultData uploadBodySegment(@RequestParam("file") MultipartFile file,
+                                        @RequestParam(value = "rotate", required = false) Integer rotate) throws Exception {
+        return sceneService.uploadBodySegment(file, rotate);
+    }
+
+    /**
+     * 获取人体抠图提取状态
+     * @return ResultData
+     * @throws Exception
+     */
+    @PostMapping(value = "/getBodySegmentStatus")
+    public ResultData getBodySegmentStatus(@RequestParam(value = "serialNum") String uuid) throws Exception {
+        return sceneService.getBodySegmentStatus(uuid);
+    }
+
 }
 

+ 8 - 0
src/main/java/com/fdkankan/scene/controller/SceneEditController.java

@@ -878,5 +878,13 @@ public class SceneEditController extends BaseController {
         return sceneAsynOperLogService.getAsynOperLog(param);
     }
 
+    /**
+     * 获取编辑器版本信息
+     * @return
+     */
+    @GetMapping("/getServiceUpTip")
+    public ResultData getServiceUpTip(){
+        return sceneEditService.getServiceUpTip();
+    }
 
 }

+ 150 - 0
src/main/java/com/fdkankan/scene/controller/SceneMarkShapeController.java

@@ -0,0 +1,150 @@
+package com.fdkankan.scene.controller;
+
+import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.util.ObjectUtil;
+import com.fdkankan.fyun.face.FYunFileServiceInterface;
+import com.fdkankan.model.constants.UploadFilePath;
+import com.fdkankan.rabbitmq.util.RabbitMqProducer;
+import com.fdkankan.scene.entity.SceneMarkShape;
+import com.fdkankan.scene.entity.ScenePlus;
+import com.fdkankan.scene.entity.ScenePlusExt;
+import com.fdkankan.scene.service.ISceneMarkShapeService;
+import com.fdkankan.scene.service.IScenePlusExtService;
+import com.fdkankan.scene.service.IScenePlusService;
+import com.fdkankan.scene.vo.SceneMarkShapeDetectParamVO;
+import com.fdkankan.scene.vo.SceneMarkShapeParamVO;
+import com.fdkankan.scene.vo.SceneMarkShapeReDetectParamVO;
+import com.fdkankan.web.controller.BaseController;
+import com.fdkankan.web.response.ResultData;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.annotation.Resource;
+import java.io.IOException;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * 初始化接口
+ *
+ * @author fdkk
+ */
+@RestController
+@RequestMapping("/service/scene/sceneMarkShape")
+@Slf4j
+public class SceneMarkShapeController extends BaseController
+{
+    @Value("${queue.scene.yolov5-detect-queue}")
+    private String yolov5DetectQueue;
+    @Autowired
+    private ISceneMarkShapeService sceneMarkShapeService;
+    @Resource
+    private FYunFileServiceInterface fYunFileService;
+    @Autowired
+    private IScenePlusService scenePlusService;
+    @Autowired
+    private IScenePlusExtService scenePlusExtService;
+    @Value("${fyun.host}")
+    private String ossUrlPrefix;
+    @Autowired
+    private RabbitMqProducer rabbitMqProducer;
+    @Value("${main.url}")
+    private String mainUrl;
+
+
+    /**
+     * 获取场景全景图路径连接
+     */
+    @PostMapping("/getPanorama")
+    public ResultData getPanorama(@RequestBody @Validated  SceneMarkShapeParamVO param) {
+        ScenePlus scenePlus = scenePlusService.getScenePlusByNum(param.getNum());
+        if(ObjectUtil.isNotNull(scenePlus)) {
+            ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
+            if (ObjectUtil.isNotNull(scenePlus)) {
+                String publicUserPath = String.format(UploadFilePath.scene_result_data_path, param.getNum());
+                List<String> panoramaList = fYunFileService.listRemoteFiles(scenePlusExt.getYunFileBucket(), publicUserPath + "caches/images/");
+                List<String> panoramaListUrl = panoramaList.stream().filter(f -> FileUtil.extName(f).equals("jpg")).map(s -> ossUrlPrefix + s).collect(Collectors.toList());
+                return ResultData.ok(panoramaListUrl);
+            }
+        }
+        return ResultData.ok("场景数据不存在");
+    }
+    /**
+     * 根据场景码和图片名称获取数据
+     */
+    @PostMapping("/getInfo")
+    public ResultData getInfo(@RequestBody @Validated  SceneMarkShapeParamVO param) {
+        SceneMarkShape res=  sceneMarkShapeService.findByNumAndImagePath(param.getNum(),param.getImagePath());
+        return ResultData.ok(res);
+    }
+    /**
+     * 将需要推理的场景推入到队列
+     */
+    @PostMapping("/detectScene")
+    public ResultData detect(@RequestBody @Validated SceneMarkShapeDetectParamVO param) {
+        param.setWebSite(mainUrl);
+        rabbitMqProducer.sendByWorkQueue(yolov5DetectQueue, param);
+        return ResultData.ok();
+    }
+    /**
+     * 将需要训练的场景推入到队列
+     */
+    @PostMapping("/trainScene")
+    public ResultData trainScene(@RequestBody @Validated SceneMarkShapeReDetectParamVO param) {
+        sceneMarkShapeService.trainScene(param);
+        return ResultData.ok();
+    }
+    /**
+     * 将需要重新推理的场景推入到队列
+     */
+    @PostMapping("/editReDetectStatus")
+    public ResultData editReDetectStatus(@RequestBody @Validated SceneMarkShapeParamVO param) {
+        sceneMarkShapeService.editTrainStatus(param);
+        return ResultData.ok();
+    }
+    /**
+     * 保存或者修改
+     */
+    @PostMapping("/saveOrEdit")
+    public ResultData save(@RequestParam(value = "num") String num,@RequestParam("file") MultipartFile file) throws IOException {
+        sceneMarkShapeService.saveFileToDB(file,num);
+        return ResultData.ok();
+    }
+    /**
+     * 保存或者修改JSON
+     */
+    @PostMapping("/saveOrEditJson")
+    public ResultData saveOrEditJson(@RequestBody SceneMarkShape param) {
+        SceneMarkShape shape = sceneMarkShapeService.findByNumAndImagePath(param.getNum(), param.getImagePath());
+        if (ObjectUtil.isNotNull(shape)){
+            param.setId(shape.getId());
+            param.setUpdateTime(new Date());
+            return ResultData.ok(sceneMarkShapeService.updateById(param));
+        }else {
+            param.setCreateTime(new Date());
+            return ResultData.ok(sceneMarkShapeService.save(param));
+        }
+    }
+    /**
+     * 保存或者修改JSON
+     */
+    @PostMapping("/editLabel")
+    public ResultData editLabel(@RequestParam(value = "num") String num,@RequestParam(value = "imgPath") String imgPath,@RequestParam("file") MultipartFile file) throws IOException {
+        log.info("进入editLabel---num{},imgPath{}",num,imgPath);
+        return sceneMarkShapeService.editLabelByFile(num, imgPath, file);
+    }
+    /**
+     * 保存或者修改JSON
+     */
+    @PostMapping("/testquery")
+    public ResultData testquery()   {
+        Map<String, List<SceneMarkShape>> res=new HashMap<>();
+        res.put("findByReTrainStatus",sceneMarkShapeService.findByReTrainStatus(1));
+        res.put("findByToTrainStatus",sceneMarkShapeService.findByToTrainStatus(0));
+        return ResultData.ok(res);
+    }
+}

+ 63 - 0
src/main/java/com/fdkankan/scene/entity/SceneCleanOrig.java

@@ -0,0 +1,63 @@
+package com.fdkankan.scene.entity;
+
+import com.baomidou.mybatisplus.annotation.*;
+
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * <p>
+ * 删除oss原始资源记录
+ * </p>
+ *
+ * @author 
+ * @since 2023-03-29
+ */
+@Getter
+@Setter
+@TableName("t_scene_clean_orig")
+public class SceneCleanOrig implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    @TableField("num")
+    private String num;
+
+    /**
+     * 0-处理中,1-成功,-1失败
+     */
+    @TableField("state")
+    private Integer state;
+
+    /**
+     * 失败原因
+     */
+    @TableField("reason")
+    private String reason;
+
+    /**
+     * 创建时间
+     */
+    @TableField("create_time")
+    private Date createTime;
+
+    /**
+     * 修改时间
+     */
+    @TableField("update_time")
+    private Date updateTime;
+
+    /**
+     * 记录的状态,A: 生效,I: 禁用
+     */
+    @TableField("rec_status")
+    @TableLogic(value = "A", delval = "I")
+    private String recStatus;
+
+
+}

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

@@ -88,6 +88,32 @@ public class SceneEditControls implements Serializable {
     @TableField("show_rule")
     private Integer showRule;
 
+
+    /**
+     * 是否展示标尺(0-不需要,1-需要)
+     */
+    @TableField("show_scale")
+    private Integer showScale;
+
+    /**
+     * 是否展示分享场景(0-不需要,1-需要)
+     */
+    @TableField("show_share")
+    private Integer showShare;
+
+    /**
+     * 是否展示分享热点(0-不需要,1-需要)
+     */
+    @TableField("show_tagshare")
+    private Integer showTagshare;
+
+    /**
+     * 是否展示合照开关(0-不需要,1-需要)
+     */
+    @TableField("show_capture")
+    private Integer showCapture;
+
+
     /**
      * 创建时间
      */

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

@@ -0,0 +1,74 @@
+package com.fdkankan.scene.entity;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.annotation.*;
+import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
+import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * <p>
+ * 场景标记多边形识别数据
+ * </p>
+ *
+ * @author Xiewj
+ * @date 2023/3/30
+ */
+@Data
+@TableName(value = "t_scene_mark_shape",autoResultMap = true)
+@Accessors(chain = true)
+public class SceneMarkShape implements Serializable {
+
+      /**
+       * 主键
+       */
+      @TableId(value = "id", type = IdType.AUTO)
+      private Long id;
+
+      @TableField("version")
+      private String version;
+      @TableField(typeHandler = FastjsonTypeHandler.class, value = "flag")
+      private JSONObject flag;
+
+      @TableField(typeHandler = FastjsonTypeHandler.class, value = "shapes")
+      private List<JSONObject> shapes;
+
+      @TableField("image_path")
+      private String imagePath;
+      @TableField("image_height")
+      private Integer imageHeight;
+      @TableField("image_width")
+      private Integer imageWidth;
+      @TableField("num")
+      private String num;
+      /**
+       * 0不需要 1需要
+       */
+      @TableField("re_train")
+      private Integer reTrain;
+      /**
+       * 0需要训练 1已经训练过
+       */
+      @TableField("to_train")
+      private Integer toTrain;
+
+      @TableField("create_time")
+      private Date createTime;
+
+      @TableField("update_time")
+      private Date updateTime;
+
+      /**
+       * 记录的状态,A: 生效,I: 禁用
+       */
+      @TableField("rec_status")
+      @TableLogic(value = "A", delval = "I")
+      private String recStatus;
+
+}

+ 33 - 0
src/main/java/com/fdkankan/scene/httpclient/MyClient.java

@@ -0,0 +1,33 @@
+package com.fdkankan.scene.httpclient;
+
+
+import com.dtflys.forest.annotation.Get;
+import com.dtflys.forest.annotation.Var;
+import com.dtflys.forest.callback.OnProgress;
+import com.dtflys.forest.extensions.DownloadFile;
+import com.fdkankan.web.response.ResultData;
+
+import java.io.File;
+
+public interface MyClient {
+
+    /**
+     * 在方法上加上@DownloadFile注解
+     * dir属性表示文件下载到哪个目录
+     * filename属性表示文件下载成功后以什么名字保存,如果不填,这默认从URL中取得文件名
+     * OnProgress参数为监听上传进度的回调函数
+     */
+    @Get(url = "{url}")
+    @DownloadFile(dir = "{dir}", filename = "{filename}")
+    File downloadFile(@Var("url") String url, @Var("dir") String dir, @Var("filename")String filename);
+
+    /**
+     * 在方法上加上@DownloadFile注解
+     * dir属性表示文件下载到哪个目录
+     * filename属性表示文件下载成功后以什么名字保存,如果不填,这默认从URL中取得文件名
+     * OnProgress参数为监听上传进度的回调函数
+     */
+    @Get(url = "${url}?${params}")
+    ResultData get(@Var("url") String url, @Var("params") String params);
+
+}

+ 18 - 0
src/main/java/com/fdkankan/scene/mapper/ISceneCleanOrigMapper.java

@@ -0,0 +1,18 @@
+package com.fdkankan.scene.mapper;
+
+import com.fdkankan.scene.entity.SceneCleanOrig;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ * 删除oss原始资源记录 Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2023-03-29
+ */
+@Mapper
+public interface ISceneCleanOrigMapper extends BaseMapper<SceneCleanOrig> {
+
+}

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

@@ -1,9 +1,13 @@
 package com.fdkankan.scene.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fdkankan.scene.bean.SceneBean;
 import com.fdkankan.scene.entity.ScenePlus;
 import org.apache.ibatis.annotations.Mapper;
 
+import java.util.Date;
+import java.util.List;
+
 /**
  * <p>
  * 场景主表 Mapper 接口
@@ -15,4 +19,6 @@ import org.apache.ibatis.annotations.Mapper;
 @Mapper
 public interface IScenePlusMapper extends BaseMapper<ScenePlus> {
 
+    List<SceneBean> selectCleanOrigScene(Date time);
+
 }

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

@@ -1,9 +1,13 @@
 package com.fdkankan.scene.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fdkankan.scene.bean.SceneBean;
 import com.fdkankan.scene.entity.ScenePro;
 import org.apache.ibatis.annotations.Mapper;
 
+import java.util.Date;
+import java.util.List;
+
 /**
  * <p>
  * pro场景表 Mapper 接口
@@ -15,4 +19,6 @@ import org.apache.ibatis.annotations.Mapper;
 @Mapper
 public interface ISceneProMapper extends BaseMapper<ScenePro> {
 
+    List<SceneBean> selectCleanOrigScene(Date time);
+
 }

+ 16 - 0
src/main/java/com/fdkankan/scene/mapper/MarkShapeMapper.java

@@ -0,0 +1,16 @@
+package com.fdkankan.scene.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fdkankan.scene.entity.SceneMarkShape;
+import org.apache.ibatis.annotations.Mapper;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author Xiewj
+ * @date 2021/11/22
+ */
+@Mapper
+@Component("MarkShapeMapper")
+public interface MarkShapeMapper extends BaseMapper<SceneMarkShape> {
+}
+

+ 52 - 0
src/main/java/com/fdkankan/scene/schedule/ScheduleJob.java

@@ -1,13 +1,21 @@
 package com.fdkankan.scene.schedule;
 
 import com.fdkankan.redis.util.RedisUtil;
+import com.fdkankan.redis.constant.RedisKey;
+import com.fdkankan.redis.constant.RedisLockKey;
+import com.fdkankan.redis.util.RedisLockUtil;
+import com.fdkankan.redis.util.RedisUtil;
 import com.fdkankan.scene.service.ISceneAsynOperLogService;
 import com.fdkankan.scene.service.ISceneDownLoadService;
+import com.fdkankan.scene.service.ISceneCleanOrigService;
 import lombok.extern.log4j.Log4j2;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 
+import javax.annotation.PostConstruct;
+
+@RefreshScope
 @Log4j2
 @Component
 public class ScheduleJob {
@@ -18,6 +26,10 @@ public class ScheduleJob {
     RedisUtil redisUtil;
     @Autowired
     ISceneDownLoadService sceneDownLoadService;
+    @Autowired
+    private ISceneCleanOrigService sceneCleanOrigService;
+    @Autowired
+    private RedisLockUtil redisLockUtil;
 
     /**
      * 每天凌晨一点执行
@@ -44,4 +56,44 @@ public class ScheduleJob {
         sceneDownLoadService.processV3();
     }
 
+
+    /**
+     * 删除场景原始资源
+     * 每天凌晨执行
+     */
+    @Scheduled(cron="0 0 1 * * ?")
+    public void cleanOssHomeV3() {
+        log.info("删除v3场景原始资源开始");
+        String lockKey = RedisLockKey.LOCK_CLEAN_SCENE_ORIG_V3;
+        try {
+            boolean lock = redisLockUtil.lock(lockKey, RedisKey.CAMERA_EXPIRE_7_TIME);
+            if(!lock){
+                return;
+            }
+            sceneCleanOrigService.cleanOrigV3();
+        }finally {
+            redisLockUtil.unlockLua(lockKey);
+        }
+        log.info("删除v3场景原始资源结束");
+    }
+
+    /**
+     * 删除场景原始资源
+     * 每天凌晨执行
+     */
+    @Scheduled(cron="0 0 1 * * ?")
+    public void cleanOssHomeV4() {
+        log.info("删除v4场景原始资源开始");
+        String lockKey = RedisLockKey.LOCK_CLEAN_SCENE_ORIG_V4;
+        try {
+            boolean lock = redisLockUtil.lock(lockKey, RedisKey.CAMERA_EXPIRE_7_TIME);
+            if(!lock){
+                return;
+            }
+            sceneCleanOrigService.cleanOrigV4();
+        }finally {
+            redisLockUtil.unlockLua(lockKey);
+        }
+        log.info("删除v4场景原始资源结束");
+    }
 }

+ 20 - 0
src/main/java/com/fdkankan/scene/service/ISceneCleanOrigService.java

@@ -0,0 +1,20 @@
+package com.fdkankan.scene.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.fdkankan.scene.entity.SceneCleanOrig;
+
+/**
+ * <p>
+ * 删除oss原始资源记录 服务类
+ * </p>
+ *
+ * @author 
+ * @since 2023-03-29
+ */
+public interface ISceneCleanOrigService extends IService<SceneCleanOrig> {
+
+    void cleanOrigV3();
+
+    void cleanOrigV4();
+
+}

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

@@ -26,4 +26,6 @@ public interface ISceneEditService {
 
     ResultData deleteTour(BaseSceneParamVO param) throws Exception;
 
+    ResultData getServiceUpTip();
+
 }

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

@@ -0,0 +1,30 @@
+package com.fdkankan.scene.service;
+
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.fdkankan.scene.entity.SceneMarkShape;
+import com.fdkankan.scene.vo.SceneMarkShapeParamVO;
+import com.fdkankan.scene.vo.SceneMarkShapeReDetectParamVO;
+import com.fdkankan.web.response.ResultData;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * Created by Xiewj on 2021/11/23 0026 10:14
+ */
+public interface ISceneMarkShapeService extends IService<SceneMarkShape> {
+    void saveFileToDB(MultipartFile inPath, String num) throws IOException;
+
+    SceneMarkShape findByNumAndImagePath(String num, String imagePath);
+
+    ResultData editLabelByFile(String num, String imgPath, MultipartFile file) throws IOException;
+
+    void trainScene(SceneMarkShapeReDetectParamVO param);
+
+    List<SceneMarkShape> findByReTrainStatus(Integer reTrain);
+    List<SceneMarkShape> findByToTrainStatus(Integer toTrain);
+
+    void editTrainStatus(SceneMarkShapeParamVO param);
+}

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

@@ -2,6 +2,7 @@ package com.fdkankan.scene.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.fdkankan.scene.bean.LaserSceneBean;
+import com.fdkankan.scene.bean.SceneBean;
 import com.fdkankan.web.response.ResultData;
 import com.fdkankan.scene.vo.BaseSceneParamVO;
 import java.util.List;
@@ -42,4 +43,6 @@ public interface IScenePlusService extends IService<ScenePlus> {
 
     ResultData uploadShareLogo(String num, MultipartFile file) throws Exception;
 
+    List<SceneBean> listCleanOrigScene(int cleanOrigMonth);
+
 }

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

@@ -1,6 +1,7 @@
 package com.fdkankan.scene.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.fdkankan.scene.bean.SceneBean;
 import com.fdkankan.web.response.ResultData;
 import com.fdkankan.scene.entity.ScenePro;
 import com.fdkankan.scene.vo.BaseDataParamVO;
@@ -49,4 +50,6 @@ public interface ISceneProService extends IService<ScenePro> {
 
     ScenePro getByNum(String num);
 
+    List<SceneBean> listCleanOrigScene(int cleanOrigMonth);
+
 }

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

@@ -0,0 +1,16 @@
+package com.fdkankan.scene.service;
+
+import com.fdkankan.scene.bean.BodySegmentStatusBean;
+import com.fdkankan.web.response.ResultData;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.multipart.MultipartFile;
+
+public interface ISceneService {
+
+    ResultData uploadBodySegment(MultipartFile file,Integer rotate) throws Exception;
+
+    void bodySegmentHandler(String imgUrl, String uuid);
+
+    ResultData getBodySegmentStatus(String uuid);
+
+}

+ 161 - 0
src/main/java/com/fdkankan/scene/service/impl/SceneCleanOrigServiceImpl.java

@@ -0,0 +1,161 @@
+package com.fdkankan.scene.service.impl;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.exceptions.ExceptionUtil;
+import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.fdkankan.common.constant.CommonStatus;
+import com.fdkankan.common.constant.CommonSuccessStatus;
+import com.fdkankan.common.constant.OperationType;
+import com.fdkankan.fyun.face.FYunFileServiceInterface;
+import com.fdkankan.model.constants.ConstantFilePath;
+import com.fdkankan.model.utils.SceneUtil;
+import com.fdkankan.redis.constant.RedisKey;
+import com.fdkankan.redis.util.RedisUtil;
+import com.fdkankan.scene.bean.SceneBean;
+import com.fdkankan.scene.entity.SceneCleanOrig;
+import com.fdkankan.scene.mapper.ISceneCleanOrigMapper;
+import com.fdkankan.scene.mapper.IScenePlusExtMapper;
+import com.fdkankan.scene.service.ISceneCleanOrigService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fdkankan.scene.service.IScenePlusExtService;
+import com.fdkankan.scene.service.IScenePlusService;
+import com.fdkankan.scene.service.ISceneProService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.cloud.context.config.annotation.RefreshScope;
+import org.springframework.stereotype.Service;
+import sun.font.TextRecord;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * <p>
+ * 删除oss原始资源记录 服务实现类
+ * </p>
+ *
+ * @author 
+ * @since 2023-03-29
+ */
+@RefreshScope
+@Slf4j
+@Service
+public class SceneCleanOrigServiceImpl extends ServiceImpl<ISceneCleanOrigMapper, SceneCleanOrig> implements ISceneCleanOrigService {
+
+    @Value("${scene.cleanOrig.month}")
+    private Integer cleanOrigMonth;
+
+    @Autowired
+    private ISceneProService sceneProService;
+    @Autowired
+    private IScenePlusService scenePlusService;
+    @Autowired
+    private IScenePlusExtService scenePlusExtService;
+    @Autowired
+    private FYunFileServiceInterface fYunFileService;
+    @Autowired
+    private RedisUtil redisUtil;
+
+    @Override
+    public void cleanOrigV4() {
+        //查询所有计算时间超过限定时间的场景,计算成功、未被删除、最后一次计算后未被删除过的
+        List<SceneBean> sceneBeans = scenePlusService.listCleanOrigScene(cleanOrigMonth);
+        if(CollUtil.isEmpty(sceneBeans)){
+            return;
+        }
+
+        sceneBeans.parallelStream().forEach(scene->{
+            this.cleanOrigHandler(scene);
+        });
+    }
+
+    @Override
+    public void cleanOrigV3() {
+        //查询所有计算时间超过限定时间的场景,计算成功、未被删除
+        List<SceneBean> sceneBeans = sceneProService.listCleanOrigScene(cleanOrigMonth);
+        if(CollUtil.isEmpty(sceneBeans)){
+            return;
+        }
+
+        sceneBeans.parallelStream().forEach(scene->{
+            this.cleanOrigHandler(scene);
+        });
+    }
+
+    private void cleanOrigHandler(SceneBean scene){
+        try {
+            boolean lock = this.lock(scene.getDataSource());
+            if(!lock){
+                throw new RuntimeException("场景正在上传");
+            }
+            int successStatus = CommonSuccessStatus.SUCCESS.code();
+            String reason = null;
+            String dataSource = scene.getDataSource();
+            if(StrUtil.isNotEmpty(dataSource)){
+                String homePath = dataSource.replace(ConstantFilePath.BUILD_MODEL_PATH, ConstantFilePath.OSS_PREFIX);
+                //由于国内测试和生产用的bucket是同一个,这里需要做一个安全校验,保证不会删错
+                String fileContent = fYunFileService.getFileContent(homePath.concat("/").concat("data.fdage"));
+                if(StrUtil.isNotBlank(fileContent)){
+                    JSONObject jsonObject = JSON.parseObject(fileContent);
+                    String snCode = jsonObject.getJSONObject("cam").getString("uuid");
+                    String uuidTime = jsonObject.getString("uuidtime");
+                    if(StrUtil.isEmpty(snCode)
+                            || StrUtil.isEmpty(uuidTime)
+                            || !homePath.contains(snCode)
+                            || !homePath.contains(uuidTime)){
+                        successStatus = CommonSuccessStatus.FAIL.code();
+                        reason = "dataSource与data.fdage文件不匹配";
+                    }else{
+                        fYunFileService.deleteFolder(homePath);
+                    }
+                }
+            }
+            this.saveLog(scene.getNum(), successStatus, reason);
+        }catch (Exception e){
+            log.error("删除原始资源失败,num : " + scene.getNum(), e);
+            this.saveLog(scene.getNum(), CommonSuccessStatus.FAIL.code(), ExceptionUtil.stacktraceToString(e, 3000));
+        }finally {
+            this.releaseLock(scene.getDataSource());
+        }
+    }
+
+
+
+
+    private void saveLog(String num, int status, String reason){
+        //清除旧的日志
+        this.remove(new LambdaQueryWrapper<SceneCleanOrig>().eq(SceneCleanOrig::getNum, num));
+        SceneCleanOrig sceneCleanOrig = new SceneCleanOrig();
+        sceneCleanOrig.setNum(num);
+        sceneCleanOrig.setState(status);
+        sceneCleanOrig.setReason(reason);
+        this.saveOrUpdate(sceneCleanOrig);
+    }
+
+    private boolean lock(String dataSource){
+        Map<String, String> property = SceneUtil.getPropertyFromDataSource(dataSource);
+        String homePath = property.get("homePath");
+        String uuid = property.get("uuid");
+
+        String uploadLock = redisUtil.get(String.format(RedisKey.SCENE_OSS_HOME_DIR_UPLOAD, uuid));
+        //场景正在上传,不删除
+        if(StrUtil.isNotEmpty(uploadLock)){
+            return false;
+        }
+        redisUtil.set(String.format(RedisKey.SCENE_OSS_HOME_DIR_DELETE, uuid), homePath, 8*60*60);
+        return true;
+    }
+
+    private void releaseLock(String dataSource){
+        Map<String, String> property = SceneUtil.getPropertyFromDataSource(dataSource);
+        String uuid = property.get("uuid");
+        redisUtil.del(String.format(RedisKey.SCENE_OSS_HOME_DIR_DELETE, uuid));
+    }
+
+}

+ 39 - 30
src/main/java/com/fdkankan/scene/service/impl/SceneEditInfoServiceImpl.java

@@ -1,4 +1,12 @@
 package com.fdkankan.scene.service.impl;
+import cn.hutool.core.net.multipart.UploadFile;
+import cn.hutool.core.util.CharsetUtil;
+import com.fdkankan.common.constant.*;
+import com.fdkankan.common.util.FileSizeUtil;
+import com.fdkankan.common.util.MD5;
+import com.fdkankan.scene.vo.SaveFiltersParamVO;
+import io.opencensus.metrics.LongGauge;
+import java.util.Date;
 
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.collection.CollUtil;
@@ -230,10 +238,6 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
         String sceneJsonPath = String.format(UploadFilePath.DATA_VIEW_PATH+"scene.json", num);
         ossUtil.uploadFileBytes(sceneJsonPath, JSON.toJSONString(sceneJson).getBytes(StandardCharsets.UTF_8));
 
-        //sceneJson放入缓存
-        String key = String.format(RedisKey.SCENE_JSON, num);
-        redisUtil.set(key, JSON.toJSONString(sceneJson));
-
         //删除发布数据中的user目录
         String publicUserPath = String.format(UploadFilePath.USER_VIEW_PATH, num);
         ossUtil.deleteObject(publicUserPath);
@@ -243,6 +247,10 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
         String viewPath = String.format(UploadFilePath.USER_VIEW_PATH, param.getNum()).replace("user/","");
         ossUtil.copyObject(editPath, viewPath);
 
+        //sceneJson放入缓存
+        String key = String.format(RedisKey.SCENE_JSON, num);
+        redisUtil.set(key, JSON.toJSONString(sceneJson));
+
         //入库
         if(sceneEditInfo.getId() == null){
             this.save(sceneEditInfo);
@@ -391,7 +399,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
         }
         sceneInfoVO.setControls(BeanUtil.copyProperties(sceneEditControls, SceneEditControlsVO.class));
         sceneInfoVO.setNum(num);
-        sceneInfoVO.setCreateTime(scenePlus.getCreateTime());
+        sceneInfoVO.setCreateTime(scenePlusExt.getAlgorithmTime());
 
         sceneInfoVO.setSceneResolution(scenePlusExt.getSceneResolution());
         sceneInfoVO.setSceneFrom(scenePlusExt.getSceneFrom());
@@ -401,6 +409,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
         if(CommonStatus.YES.code().intValue() == sceneEditInfoExt.getMosaic()){
             sceneInfoVO.setMosaicList(this.getMosaicList(num));
         }
+        sceneInfoVO.setSpace(FileSizeUtil.convert(scenePlusExt.getSpace(), FileSizeUnitType.MB.code()));
 
         this.SortBoxVideos(sceneInfoVO);
 
@@ -485,33 +494,26 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
         String sceneJson = redisUtil.get(key);
         SceneInfoVO sceneInfoVO = null;
         //先查询redis
-        if(StrUtil.isNotEmpty(sceneJson)) {
-            sceneInfoVO = JSON.parseObject(sceneJson, SceneInfoVO.class);
-            sceneInfoVO.setScenePassword(null);
-            if(Objects.isNull(sceneInfoVO.getFloorPlanAngle())){
-                sceneInfoVO.setFloorPlanAngle(0f);
-            }
-            if(Objects.isNull(sceneInfoVO.getFloorPlanCompass())){
-                sceneInfoVO.setFloorPlanCompass(0f);
-            }
-            return sceneInfoVO;
+        if(StrUtil.isEmpty(sceneJson)) {
+            String objectName = String.format(ConstantFilePath.SCENE_VIEW_DATA_DATA_SCENEJSON, num);
+            sceneJson = ossUtil.getFileContent(objectName);
+            redisUtil.set(key, sceneJson);
         }
-
-        //如果redis没找到,从scene.json中获取
-        String objectName = String.format(ConstantFilePath.SCENE_VIEW_DATA_DATA_SCENEJSON, num);
-        String objectContent = ossUtil.getFileContent(objectName);
-        log.info("获取scene.json内容,path:{}, content:{}", objectName, objectContent);
-        if(StrUtil.isEmpty(objectContent))
-            return null;
-        sceneInfoVO = JSON.parseObject(objectContent, SceneInfoVO.class);
+        sceneInfoVO = JSON.parseObject(sceneJson, SceneInfoVO.class);
+        sceneInfoVO.setScenePassword(null);
         if(Objects.isNull(sceneInfoVO.getFloorPlanAngle())){
             sceneInfoVO.setFloorPlanAngle(0f);
         }
         if(Objects.isNull(sceneInfoVO.getFloorPlanCompass())){
             sceneInfoVO.setFloorPlanCompass(0f);
         }
-        redisUtil.set(key, JSON.toJSONString(sceneInfoVO));
-        sceneInfoVO.setScenePassword(null);
+        SceneEditControlsVO controls = sceneInfoVO.getControls();
+        if(Objects.isNull(controls.getShowShare())){
+            controls.setShowShare(CommonStatus.YES.code().intValue());
+        }
+        if(Objects.isNull(controls.getShowCapture())){
+            controls.setShowCapture(CommonStatus.YES.code().intValue());
+        }
 
         return sceneInfoVO;
     }
@@ -600,7 +602,11 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
         String bucket = scenePlusExt.getYunFileBucket();
 //        String path = scenePlusExt.getDataSource();
 
-        //户型图上传
+        //户型图上传 恢复默认并发布同时点击刷新查看页面,平面图会变形,所以这里先注释掉 bug-36281 2023-05-04
+//        String ossResultPath = String.format(UploadFilePath.scene_result_data_path, num);
+//        String floorplanCadPath = ossResultPath + "floorplan_cad/";
+//        fYunFileService.copyFileBetweenBucket(bucket, floorplanCadPath, bucket, String.format(UploadFilePath.USER_EDIT_PATH, num));
+
 //        String  userEditPath = UploadFilePath.USER_EDIT_PATH + "floor-cad-%s.%s";
 //        String floorCadPath = path + "/results/floorplan_cad";
 //        List<String> floorCadList = FileUtils.getFileList(floorCadPath);
@@ -767,16 +773,16 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
         ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
         String bucket = scenePlusExt.getYunFileBucket();
 
-        String key = String.format(UploadFilePath.DATA_VIEW_PATH, param.getNum()) + "floorplan_cad.json";
-        String floorplanCadJson = ossUtil.getFileContent(key);
-        if(StrUtil.isEmpty(floorplanCadJson)){
+        String key = String.format(UploadFilePath.USER_EDIT_PATH, param.getNum()) + "floorplan.json";
+        String floorplanJson = ossUtil.getFileContent(key);
+        if(StrUtil.isEmpty(floorplanJson)){
             return ResultData.ok();
         }
         Map<Integer, String> renameMap = new HashMap<>();
         param.getFloors().stream().forEach(floor->{
             renameMap.put(floor.getSubgroup(), floor.getName());
         });
-        JSONObject jsonObject = JSON.parseObject(floorplanCadJson);
+        JSONObject jsonObject = JSON.parseObject(floorplanJson);
         if(Objects.isNull(jsonObject)){
             return ResultData.ok();
         }
@@ -2558,6 +2564,9 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
         sceneEditInfoExt.setFilters(filters);
         sceneEditInfoExtService.updateById(sceneEditInfoExt);
 
+        //更新版本号
+        this.upgradeVersionById(sceneEditInfoExt.getEditInfoId());
+
         return ResultData.ok();
 
     }

+ 30 - 3
src/main/java/com/fdkankan/scene/service/impl/SceneEditServiceImpl.java

@@ -9,6 +9,13 @@ import com.fdkankan.common.constant.CommonStatus;
 import com.fdkankan.common.constant.ErrorCode;
 import com.fdkankan.common.exception.BusinessException;
 import com.fdkankan.model.constants.UploadFilePath;
+import com.fdkankan.scene.httpclient.MyClient;
+import com.fdkankan.web.response.ResultData;
+import com.fdkankan.common.util.DateExtUtil;
+import com.fdkankan.fyun.face.FYunFileServiceInterface;
+import com.fdkankan.scene.entity.Camera;
+import com.fdkankan.scene.entity.CameraDetail;
+import com.fdkankan.scene.entity.SceneCooperation;
 import com.fdkankan.scene.entity.ScenePlus;
 import com.fdkankan.scene.entity.ScenePlusExt;
 import com.fdkankan.scene.entity.SceneResource;
@@ -50,6 +57,12 @@ import org.springframework.util.ObjectUtils;
 @Service
 public class SceneEditServiceImpl implements ISceneEditService {
 
+    @Value("${4dkk.manageService.basePath}")
+    private String manageServiceUrl;
+
+    @Value("${4dkk.manageService.api.getServiceUpTip}")
+    private String getServiceUpTipApi;
+
     @Autowired
     ISceneProService sceneProService;
     @Autowired
@@ -66,6 +79,9 @@ public class SceneEditServiceImpl implements ISceneEditService {
     @Value("${scene.expired.month:#{null}}")
     private Integer expiredMonth;
 
+    @Autowired
+    private MyClient myClient;
+
     @Override
     public SceneAuthVO getAuth(String num, SSOUser ssoUser){
 
@@ -86,9 +102,9 @@ public class SceneEditServiceImpl implements ISceneEditService {
         sceneAuthVO.setInclude(new ArrayList<>());
         sceneAuthVO.setCompany(null);
 
-        //判断本地资源是否已本删除,如果已删除,前端根据字段值为true提示用户不能使用某些功能,需要重算
-        Date algorithmTime = scenePlusExt.getAlgorithmTime() == null ? scenePlus.getCreateTime() : scenePlusExt.getAlgorithmTime();
-        if (!ObjectUtils.isEmpty(expiredMonth) && com.fdkankan.common.util.DateUtil.delay(algorithmTime, expiredMonth, Calendar.MONTH).before(new Date())) {
+        //判断data.json是否存在,如果存在,则证明计算在未被定时任务删除前上传过oss
+        boolean exist = fYunFileService.fileExist(String.format(UploadFilePath.scene_result_data_path, num).concat("data.json"));
+        if(!exist){
             sceneAuthVO.setSourceExpired(true);
         }
 
@@ -183,4 +199,15 @@ public class SceneEditServiceImpl implements ISceneEditService {
         return ResultData.ok();
     }
 
+    @Override
+    public ResultData getServiceUpTip() {
+        try {
+            String url = this.manageServiceUrl.concat(this.getServiceUpTipApi);
+            String params = "type=" + 0;
+            ResultData resultData = myClient.get(url, params);
+            return ResultData.ok(resultData.getData());
+        }catch (Exception e){
+            return ResultData.ok();
+        }
+    }
 }

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

@@ -0,0 +1,181 @@
+package com.fdkankan.scene.service.impl;
+
+import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.lang.UUID;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fdkankan.common.constant.ErrorCode;
+import com.fdkankan.model.constants.ConstantFilePath;
+import com.fdkankan.rabbitmq.util.RabbitMqProducer;
+import com.fdkankan.scene.entity.SceneMarkShape;
+import com.fdkankan.scene.mapper.MarkShapeMapper;
+import com.fdkankan.scene.service.ISceneMarkShapeService;
+import com.fdkankan.scene.util.ConverxyUtil;
+import com.fdkankan.scene.vo.SceneMarkShapeParamVO;
+import com.fdkankan.scene.vo.SceneMarkShapeReDetectParamVO;
+import com.fdkankan.web.response.ResultData;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+
+/**
+ * Created by Xiewj on 2021/11/23 0026 10:14
+ */
+@Slf4j
+@Service
+public class SceneMarkShapeServiceImpl extends ServiceImpl<MarkShapeMapper, SceneMarkShape> implements ISceneMarkShapeService {
+    @Autowired
+    private RabbitMqProducer rabbitMqProducer;
+    @Value("${queue.scene.yolov5-train-queue}")
+    private String yolov5TrainQueue;
+    @Value("${main.url}")
+    private String mainUrl;
+
+    @Override
+    public void editTrainStatus(SceneMarkShapeParamVO param) {
+        SceneMarkShape byNumAndImagePath = findByNumAndImagePath(param.getNum(), param.getImagePath());
+        if (ObjectUtil.isNotNull(byNumAndImagePath)){
+            byNumAndImagePath.setReTrain(0);
+            byNumAndImagePath.setToTrain(1);
+            updateById(byNumAndImagePath);
+        }
+    }
+
+    @Override
+    public List<SceneMarkShape> findByReTrainStatus(Integer reTrain){
+        LambdaQueryWrapper<SceneMarkShape> wrapper = Wrappers.lambdaQuery();
+        wrapper.eq(SceneMarkShape::getReTrain,reTrain);
+        return list(wrapper);
+    }
+
+    @Override
+    public List<SceneMarkShape> findByToTrainStatus(Integer toTrain) {
+        QueryWrapper queryWrapper = new QueryWrapper();
+        queryWrapper.select("DISTINCT num")
+                .eq("to_train",toTrain) ;
+        return getBaseMapper().selectList(queryWrapper);
+    }
+
+    @Override
+    public void trainScene(SceneMarkShapeReDetectParamVO param) {
+        //查询需要重新训练的图片
+        List<SceneMarkShape> reDetectStatuList = findByReTrainStatus(1);
+        for (SceneMarkShape shape : reDetectStatuList) {
+            SceneMarkShapeReDetectParamVO paramVO=new SceneMarkShapeReDetectParamVO();
+            paramVO.setWebSite(mainUrl);
+            if (StrUtil.isNotEmpty(param.getSaveDir())){
+                paramVO.setSaveDir(param.getSaveDir());
+            }
+            paramVO.setNum(shape.getNum());
+            paramVO.setImagePath(shape.getImagePath());
+            paramVO.setDetectType(1);
+            rabbitMqProducer.sendByWorkQueue(yolov5TrainQueue,paramVO);
+        }
+        //查询需要进入训练的场景
+        List<SceneMarkShape> byToDetectStatus = findByToTrainStatus(0);
+        for (SceneMarkShape shape : byToDetectStatus) {
+            SceneMarkShapeReDetectParamVO paramVO=new SceneMarkShapeReDetectParamVO();
+            paramVO.setWebSite(mainUrl);
+            if (StrUtil.isNotEmpty(param.getSaveDir())){
+                paramVO.setSaveDir(param.getSaveDir());
+            }
+            paramVO.setNum(shape.getNum());
+            paramVO.setDetectType(2);
+            rabbitMqProducer.sendByWorkQueue(yolov5TrainQueue,paramVO);
+        }
+    }
+
+    @Override
+    public ResultData editLabelByFile(String num, String imgPath, MultipartFile file) throws IOException {
+
+        SceneMarkShape shape = findByNumAndImagePath(num, imgPath);
+        if (ObjectUtil.isNotNull(shape)){
+            String uuid = UUID.randomUUID().toString();
+            String fileName = file.getOriginalFilename();
+            String extName = FileUtil.extName(fileName);
+            String tempFileName = uuid + "." + extName;
+            String srcPath = ConstantFilePath.SCENE_V4_PATH + num + "/markShapes/" + tempFileName;
+            File tempFile = new File(srcPath);
+            if(!tempFile.getParentFile().exists()){
+                tempFile.getParentFile().mkdirs();
+            }
+            file.transferTo(tempFile);
+
+            List<String> s = FileUtil.readUtf8Lines(tempFile);
+            List<JSONObject> shapeJsons=new ArrayList<>();
+            //转换labelimg标注处理的结果
+            log.info("转换labelimg标注处理的结果开始");
+            for (String s1 : s) {
+                int[] ints = ConverxyUtil.centerWh2xyxy(s1, 4096,2048);
+                String[] s2 = s1.split(" ");
+                JSONObject shapeJson=new JSONObject();
+                shapeJson.put("bbox",ints);
+                shapeJson.put("color",ConverxyUtil.getColor(s2[0]));
+                shapeJson.put("label",s1);
+                shapeJson.put("category",ConverxyUtil.getLabelVal(s2[0]));
+                shapeJson.put("score",0);
+                shapeJsons.add(shapeJson);
+            }
+            log.info("转换labelimg标注处理的结果结束,{}",shapeJsons);
+            shape.setShapes(shapeJsons);
+            shape.setReTrain(1);
+            shape.setUpdateTime(new Date());
+            updateById(shape);
+            return ResultData.ok(shape);
+        }else {
+            return ResultData.error(ErrorCode.NOT_RECORD);
+        }
+    }
+
+    @Override
+    public SceneMarkShape findByNumAndImagePath(String num, String imagePath) {
+        LambdaQueryWrapper<SceneMarkShape> wrapper = Wrappers.lambdaQuery();
+        wrapper.eq(SceneMarkShape::getNum,num);
+        wrapper.eq(SceneMarkShape::getImagePath,imagePath);
+        return getOne(wrapper);
+    }
+
+    @Override
+    public void saveFileToDB(MultipartFile file, String num) throws IOException {
+        String uuid = UUID.randomUUID().toString();
+        String fileName = file.getOriginalFilename();
+        String extName = cn.hutool.core.io.FileUtil.extName(fileName);
+        String tempFileName = uuid + "." + extName;
+        String srcPath = ConstantFilePath.SCENE_V4_PATH + num + "/markShapes/" + tempFileName;
+        File tempFile = new File(srcPath);
+        if(!tempFile.getParentFile().exists()){
+            tempFile.getParentFile().mkdirs();
+        }
+        file.transferTo(tempFile);
+        String s = FileUtil.readUtf8String(tempFile);
+        JSONObject jsonObject = JSONObject.parseObject(s);
+        tempFile.delete();
+        SceneMarkShape sceneMarkShape= JSON.toJavaObject(jsonObject,SceneMarkShape.class);
+        sceneMarkShape.setNum(num);
+        SceneMarkShape shape = findByNumAndImagePath(sceneMarkShape.getNum(), sceneMarkShape.getImagePath());
+        if (ObjectUtil.isNotNull(shape)){
+            log.info("shape-替换id修改---{}",sceneMarkShape);
+            sceneMarkShape.setId(shape.getId());
+            updateById(sceneMarkShape);
+        }else {
+            log.info("新增-替换id修改---{}",sceneMarkShape);
+            log.info("MarkShapeMapper---{}",sceneMarkShape);
+            save(sceneMarkShape);
+        }
+    }
+}

+ 20 - 2
src/main/java/com/fdkankan/scene/service/impl/ScenePlusServiceImpl.java

@@ -1,6 +1,8 @@
 package com.fdkankan.scene.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
+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.extra.qrcode.QrCodeUtil;
@@ -14,6 +16,12 @@ import com.fdkankan.common.exception.BusinessException;
 import com.fdkankan.common.util.FileUtils;
 import com.fdkankan.model.constants.ConstantFilePath;
 import com.fdkankan.model.constants.UploadFilePath;
+import com.fdkankan.scene.bean.SceneBean;
+import com.fdkankan.scene.entity.SceneEditInfoExt;
+import com.fdkankan.scene.entity.ScenePro;
+import com.fdkankan.scene.service.ISceneEditInfoExtService;
+import com.fdkankan.scene.service.ISceneProService;
+import com.fdkankan.web.response.ResultData;
 import com.fdkankan.redis.constant.RedisKey;
 import com.fdkankan.redis.constant.RedisLockKey;
 import com.fdkankan.redis.util.RedisLockUtil;
@@ -29,6 +37,9 @@ import com.fdkankan.scene.vo.SceneCheckKeyParamVO;
 import com.fdkankan.scene.vo.SceneDataDownloadVO;
 import com.fdkankan.scene.vo.SceneEditControlsVO;
 import com.fdkankan.web.response.ResultData;
+import java.io.File;
+import java.util.*;
+
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -222,8 +233,8 @@ public class ScenePlusServiceImpl extends ServiceImpl<IScenePlusMapper, ScenePlu
         String outPathEn = ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+num+"_en.png";
 
         String webSize = mainUrl + "/" + sceneProNewUrl + num;
-        QrCodeUtil.generate(webSize, QrConfig.create().setImg(logoPath).setWidth(512).setHeight(512), FileUtil.file(outPathZh));
-        QrCodeUtil.generate(webSize + "&lang=en", QrConfig.create().setImg(logoPath).setWidth(512).setHeight(512), FileUtil.file(outPathEn));
+        QrCodeUtil.generate(webSize, QrConfig.create().setImg(logoPath).setWidth(1024).setHeight(1024), FileUtil.file(outPathZh));
+        QrCodeUtil.generate(webSize + "&lang=en", QrConfig.create().setImg(logoPath).setWidth(1024).setHeight(1024), FileUtil.file(outPathEn));
         //上传logo图片
         String ossLogoPath = String.format(UploadFilePath.DOWNLOADS_QRCODE, num) + "shareLogo" + extName;
         ossUtil.uploadFile(ossLogoPath, logoPath, false);
@@ -361,4 +372,11 @@ public class ScenePlusServiceImpl extends ServiceImpl<IScenePlusMapper, ScenePlu
 
         return ResultData.ok();
     }
+
+    @Override
+    public List<SceneBean> listCleanOrigScene(int cleanOrigMonth) {
+        Date time = Calendar.getInstance().getTime();
+        time = DateUtil.beginOfDay(DateUtil.offset(time, DateField.MONTH, -cleanOrigMonth));
+        return this.baseMapper.selectCleanOrigScene(time);
+    }
 }

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

@@ -1,6 +1,8 @@
 package com.fdkankan.scene.service.impl;
 
 import cn.hutool.core.collection.CollUtil;
+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.ZipUtil;
@@ -17,6 +19,9 @@ import com.fdkankan.common.util.FileUtils;
 import com.fdkankan.model.constants.ConstantFileName;
 import com.fdkankan.model.constants.ConstantFilePath;
 import com.fdkankan.model.constants.UploadFilePath;
+import com.fdkankan.common.exception.BusinessException;
+import com.fdkankan.scene.bean.SceneBean;
+import com.fdkankan.web.response.ResultData;
 import com.fdkankan.model.utils.ComputerUtil;
 import com.fdkankan.model.utils.ConvertUtils;
 import com.fdkankan.model.utils.CreateObjUtil;
@@ -1025,133 +1030,116 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         }
     }
 
-//    public ResultData downloadTexData(String num) throws Exception {
-//
-//        if(StrUtil.isEmpty(num)){
-//            throw new BusinessException(ErrorCode.PARAM_REQUIRED);
-//        }
-//        ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
-//        if(scenePlus == null){
-//            throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
-//        }
-//        ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
-//        String bucket = scenePlusExt.getYunFileBucket();
-//
-//        SceneEditInfo sceneEditInfo = sceneEditInfoService.getByScenePlusId(scenePlus.getId());
-//
-//        String localImagePath = String.format(ConstantFilePath.IMAGESBUFFER_FORMAT, num);
-//        if(!new File(localImagePath).exists()){
-//            new File(localImagePath).mkdirs();
-//        }
-//
-//
-//        String newData =  scenePlusExt.getDataSource() + "_obj2txt/extras";
-//        String newResultData = scenePlusExt.getDataSource() + "_obj2txt/results/upload.json";
-//        String zipName = num + "_extras.zip";
-//        String zipPath = localImagePath + zipName;
-//        //如果用户上传过模型,就打包上传到oss,直接返回
-//        if(CommonStatus.YES.code().equals(sceneEditInfo.getIsUploadObj())
-//            && new File(newData).exists()
-//            && new File(newResultData).exists()){
-//            //打包
-//            ZipUtil.zip(newData, zipPath);
-//            //上传压缩包
-//            fYunFileService.uploadFile(bucket, zipPath, "downloads/extras/" + zipName);
-//            String url = ossUrlPrefix + "downloads/extras/" + zipName + "?t=" + Calendar.getInstance().getTimeInMillis();
-//            return ResultData.ok(url);
-//        }
-//
-//
-//        String buildType = scenePlusExt.getBuildType();
-//        if("V3".equals(buildType)){
-//            String dataViewPath = String.format(UploadFilePath.DATA_VIEW_PATH, num);
-//            //V3版本去oss下载2048模型
-//            String meshPath =  String.format(ConstantFilePath.DATABUFFER_FORMAT, num) + "mesh";
-//            FileUtils.deleteDirectory(meshPath);
-//            CreateObjUtil.ossUtilCp(dataViewPath + "mesh", meshPath);
-//            log.info("meshPath="+meshPath);
-//            if(!new File(meshPath).exists()){
-//                throw new BusinessException(ErrorCode.FAILURE_CODE_7006);
-//            }
-//            log.info(new File(meshPath).listFiles().toString());
-//            if(new File(meshPath).listFiles().length > 0){
-//                for(File file : new File(meshPath).listFiles()){
-//                    if(file.isDirectory()){
-//                        for (File item : file.listFiles()) {
-//                            if(item.getName().endsWith(".obj") && !"output.house.obj".equals(item.getName()) &&
-//                                !"mesh.obj".equals(item.getName())){
-//                                item.delete();
-//                            }
-//                            if(item.getName().endsWith(".mtl") && !"output.house.mtl".equals(item.getName()) &&
-//                                !"mesh.mtl".equals(item.getName())){
-//                                item.delete();
-//                            }
-//                        }
-//                        continue;
-//                    }
-//                    if(file.getName().endsWith(".obj") && !"output.house.obj".equals(file.getName()) &&
-//                            !"mesh.obj".equals(file.getName())){
-//                        file.delete();
-//                    }
-//                    if(file.getName().endsWith(".mtl") && !"output.house.mtl".equals(file.getName()) &&
-//                            !"mesh.mtl".equals(file.getName())){
-//                        file.delete();
-//                    }
-//                }
-//                //打包
-//                ZipUtil.zip(meshPath, zipPath);
-//                //上传压缩包
-//                fYunFileService.uploadFile(bucket, zipPath, "downloads/extras/" + zipName);
-//                String url = ossUrlPrefix + "downloads/extras/" + zipName + "?t=" + Calendar.getInstance().getTimeInMillis();
-////                FileUtil.del(zipPath);
-//                return ResultData.ok(url);
-//            }
-//        }
-//
-//        //V2版本在本地获取模型资源
-//        //修改过的资源
-//        String editData =  scenePlusExt.getDataSource() + "_edit/caches/tex";
-//        String results = scenePlusExt.getDataSource() + "_edit/results";
-//        if (new File(editData).exists() && new File(results).exists()){
-//            for(File file : new File(editData).listFiles()){
-//                if(file.getName().endsWith(".obj") && !"output.house.obj".equals(file.getName()) &&
-//                        !"mesh.obj".equals(file.getName())){
-//                    file.delete();
-//                }
-//                if(file.getName().endsWith(".mtl") && !"output.house.mtl".equals(file.getName()) &&
-//                        !"mesh.mtl".equals(file.getName())){
-//                    file.delete();
-//                }
-//            }
-//
-//            ZipUtil.zip(editData, zipPath);
-//            //上传压缩包
-//            fYunFileService.uploadFile(bucket, zipPath, "downloads/extras/" + zipName);
-//            String url = ossUrlPrefix + "downloads/extras/" + zipName + "?t=" + Calendar.getInstance().getTimeInMillis();
-//            return ResultData.ok(url);
-//        }
-//
-//        //没上传过返回源资源
-//        String dataPath = scenePlusExt.getDataSource() + "/caches/tex";
-//        File dataFile = new File(dataPath);
-//        if(!dataFile.exists()){
-//            throw new BusinessException(ErrorCode.FAILURE_CODE_3018);
-//        }
-//        for(File file : dataFile.listFiles()){
-//            if(file.getName().endsWith(".obj") && !"output.house.obj".equals(file.getName()) &&
-//                    !"mesh.obj".equals(file.getName())){
-//                file.delete();
-//            }
-//            if(file.getName().endsWith(".mtl") && !"output.house.mtl".equals(file.getName()) &&
-//                    !"mesh.mtl".equals(file.getName())){
-//                file.delete();
-//            }
-//        }
-//
-//        ZipUtil.zip(dataPath, zipPath);
-//        //上传压缩包
-//         fYunFileService.uploadFile(bucket, zipPath, "downloads/extras/" + zipName);
-//        String url = ossUrlPrefix + "downloads/extras/" + zipName + "?t=" + Calendar.getInstance().getTimeInMillis();
-//        return ResultData.ok(url);
-//    }
+    public ResultData downloadTexData(String num) throws Exception {
+
+        if(StrUtil.isEmpty(num)){
+            throw new BusinessException(ErrorCode.PARAM_REQUIRED);
+        }
+        ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
+        if(scenePlus == null){
+            throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
+        }
+        ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
+        String bucket = scenePlusExt.getYunFileBucket();
+
+        SceneEditInfo sceneEditInfo = sceneEditInfoService.getByScenePlusId(scenePlus.getId());
+
+        if(ModelKind.THREE_D_TILE.code().equals(scenePlusExt.getModelKind())){
+            return this.downloadModel43dtiles(num, bucket, scenePlusExt, sceneEditInfo);
+        }
+
+        return this.downloadModel4Dam(num, bucket);
+    }
+
+    @Override
+    public ScenePro getByNum(String num) {
+        return this.getOne(new LambdaQueryWrapper<ScenePro>().eq(ScenePro::getNum, num));
+    }
+
+    private ResultData downloadModel43dtiles(String num, String bucket, ScenePlusExt scenePlusExt, SceneEditInfo sceneEditInfo){
+
+        //下载mesh到本地
+        String meshOssPath = String.format(UploadFilePath.DATA_VIEW_PATH, num) + "mesh/";
+        String meshLocalPath = String.format(ConstantFilePath.SCENE_DATA_PATH_V4, num) + "mesh";
+        String zipName = num + "_mesh.zip";
+        String zipFilePath = String.format(ConstantFilePath.SCENE_DATA_PATH_V4, num) + zipName;
+        //下载
+        fYunFileService.downloadFileByCommand(bucket, meshLocalPath, meshOssPath);
+        //打包
+        ZipUtil.zip(meshLocalPath,zipFilePath);
+        //上传压缩包
+        fYunFileService.uploadFile(bucket, zipFilePath, "downloads/extras/" + zipName);
+        //删除本地文件
+        FileUtil.del(meshLocalPath);
+        FileUtil.del(zipFilePath);
+        String url = ossUrlPrefix + "downloads/extras/" + zipName + "?t=" + Calendar.getInstance().getTimeInMillis();
+        return ResultData.ok(url);
+    }
+
+    public static void main(String[] args) {
+
+        Date time = Calendar.getInstance().getTime();
+        time = DateUtil.beginOfDay(DateUtil.offset(time, DateField.MONTH, -12));
+        System.out.println(time);
+
+    }
+
+
+    private ResultData downloadModel4Dam(String num, String bucket){
+        String localImagePath = String.format(ConstantFilePath.IMAGESBUFFER_FORMAT, num);
+        if(!new File(localImagePath).exists()){
+            new File(localImagePath).mkdirs();
+        }
+
+        String zipName = num + "_extras.zip";
+        String zipPath = localImagePath + zipName;
+
+        String dataViewPath = String.format(UploadFilePath.DATA_VIEW_PATH, num);
+        //V3版本去oss下载2048模型
+        String meshPath =  String.format(ConstantFilePath.DATABUFFER_FORMAT, num) + "mesh";
+        FileUtils.deleteDirectory(meshPath);
+        fYunFileService.downloadFileByCommand(bucket, meshPath, dataViewPath + "mesh");
+        log.info("meshPath="+meshPath);
+        if(!new File(meshPath).exists() || new File(meshPath).listFiles().length < 1){
+            throw new BusinessException(ErrorCode.FAILURE_CODE_7006);
+        }
+        for(File file : new File(meshPath).listFiles()){
+            if(file.isDirectory()){
+                for (File item : file.listFiles()) {
+                    if(item.getName().endsWith(".obj") && !"output.house.obj".equals(item.getName()) &&
+                            !"mesh.obj".equals(item.getName())){
+                        item.delete();
+                    }
+                    if(item.getName().endsWith(".mtl") && !"output.house.mtl".equals(item.getName()) &&
+                            !"mesh.mtl".equals(item.getName())){
+                        item.delete();
+                    }
+                }
+                continue;
+            }
+            if(file.getName().endsWith(".obj") && !"output.house.obj".equals(file.getName()) &&
+                    !"mesh.obj".equals(file.getName())){
+                file.delete();
+            }
+            if(file.getName().endsWith(".mtl") && !"output.house.mtl".equals(file.getName()) &&
+                    !"mesh.mtl".equals(file.getName())){
+                file.delete();
+            }
+        }
+        //打包
+        ZipUtil.zip(meshPath, zipPath);
+        //上传压缩包
+        fYunFileService.uploadFile(bucket, zipPath, "downloads/extras/" + zipName);
+        String url = ossUrlPrefix + "downloads/extras/" + zipName + "?t=" + Calendar.getInstance().getTimeInMillis();
+        FileUtil.del(zipPath);
+        return ResultData.ok(url);
+    }
+
+    @Override
+    public List<SceneBean> listCleanOrigScene(int cleanOrigMonth) {
+        Date time = Calendar.getInstance().getTime();
+        time = DateUtil.beginOfDay(DateUtil.offset(time, DateField.MONTH, -cleanOrigMonth));
+        return this.baseMapper.selectCleanOrigScene(time);
+    }
+
 }

文件差异内容过多而无法显示
+ 169 - 1473
src/main/java/com/fdkankan/scene/service/impl/SceneServiceImpl.java


+ 12 - 0
src/main/java/com/fdkankan/scene/service/impl/SurveillanceServiceImpl.java

@@ -7,11 +7,13 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fdkankan.common.constant.CommonStatus;
 import com.fdkankan.common.constant.ErrorCode;
 import com.fdkankan.common.exception.BusinessException;
+import com.fdkankan.scene.entity.SceneEditInfo;
 import com.fdkankan.scene.entity.SceneEditInfoExt;
 import com.fdkankan.scene.entity.ScenePlus;
 import com.fdkankan.scene.entity.Surveillance;
 import com.fdkankan.scene.mapper.ISurveillanceMapper;
 import com.fdkankan.scene.service.ISceneEditInfoExtService;
+import com.fdkankan.scene.service.ISceneEditInfoService;
 import com.fdkankan.scene.service.IScenePlusService;
 import com.fdkankan.scene.service.ISurveillanceService;
 import com.fdkankan.scene.vo.BaseSidParamVO;
@@ -39,6 +41,8 @@ public class SurveillanceServiceImpl extends ServiceImpl<ISurveillanceMapper, Su
     private IScenePlusService scenePlusService;
     @Autowired
     private ISceneEditInfoExtService sceneEditInfoExtService;
+    @Autowired
+    private ISceneEditInfoService sceneEditInfoService;
 
     @Override
     public ResultData saveSurveillance(SurveillanceParamVO param) {
@@ -47,6 +51,7 @@ public class SurveillanceServiceImpl extends ServiceImpl<ISurveillanceMapper, Su
         if(Objects.isNull(scenePlus)){
             throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
         }
+        SceneEditInfo sceneEditInfo = sceneEditInfoService.getByScenePlusId(scenePlus.getId());
         SceneEditInfoExt sceneEditInfoExt = sceneEditInfoExtService.getByScenePlusId(scenePlus.getId());
 
         Surveillance surveillance = this.getBySid(param.getNum(), param.getSid());
@@ -64,6 +69,9 @@ public class SurveillanceServiceImpl extends ServiceImpl<ISurveillanceMapper, Su
         sceneEditInfoExt.setSurveillances(CommonStatus.YES.code().intValue());
         sceneEditInfoExtService.updateById(sceneEditInfoExt);
 
+        sceneEditInfoService.upgradeVersionById(sceneEditInfo.getId());
+
+
         return ResultData.ok();
     }
 
@@ -73,6 +81,7 @@ public class SurveillanceServiceImpl extends ServiceImpl<ISurveillanceMapper, Su
         if(Objects.isNull(scenePlus)){
             throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
         }
+        SceneEditInfo sceneEditInfo = sceneEditInfoService.getByScenePlusId(scenePlus.getId());
         SceneEditInfoExt sceneEditInfoExt = sceneEditInfoExtService.getByScenePlusId(scenePlus.getId());
 
         this.remove(new LambdaQueryWrapper<Surveillance>().eq(Surveillance::getSid, param.getSid()));
@@ -82,6 +91,9 @@ public class SurveillanceServiceImpl extends ServiceImpl<ISurveillanceMapper, Su
             sceneEditInfoExt.setSurveillances(CommonStatus.NO.code().intValue());
         }
         sceneEditInfoExtService.updateById(sceneEditInfoExt);
+
+        sceneEditInfoService.upgradeVersionById(sceneEditInfo.getId());
+
         return ResultData.ok();
     }
 

+ 121 - 0
src/main/java/com/fdkankan/scene/util/ConverxyUtil.java

@@ -0,0 +1,121 @@
+package com.fdkankan.scene.util;
+
+import cn.hutool.core.io.FileUtil;
+import com.alibaba.fastjson.JSONObject;
+
+import java.io.File;
+import java.math.BigDecimal;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Xiewj
+ * @date 2023/4/11
+ */
+public class ConverxyUtil {
+   static Map<String,String> label=new HashMap<>();
+   static Map<String,int[]> color=new HashMap<>();
+
+   static void init() {
+      label.put("0","cabinet");
+      label.put("1","air");
+      label.put("2","battery");
+
+      color.put("0",new int[]{56,56,255});
+      color.put("1",new int[]{151,157,255});
+      color.put("2",new int[]{31,112,255});
+   }
+   public static String getLabelVal(String key) {
+      if (label.size()==0){
+         init();
+      }
+      //标签类型初始化
+     return label.get(key);
+   }
+   public static int[] getColor(String key) {
+      if (color.size()==0){
+         init();
+      }
+      //标签类型初始化
+      return color.get(key);
+   }
+      // 将中心宽高格式转换为左上角点和右下角点格式
+   /**
+    * 将xywh格式的目标框转换为xyxy格式
+    * @param xywh xywh格式的目标框,格式为"x,y,w,h"
+    * @return xyxy格式的目标框,格式为"x1,y1,x2,y2"
+    */
+   public static int[] centerWh2xyxy(String xywh,int w1,int h1){
+      String[] values = xywh.split(" ");
+      if (values.length<4){
+         return null;
+      }
+      float x = Float.parseFloat(values[1]);
+      float y = Float.parseFloat(values[2]);
+      float w = Float.parseFloat(values[3]);
+      float h = Float.parseFloat(values[4]);
+      int[] xyxy = new int[4];
+      xyxy[0] = (int) ((x - w / 2) * w1); // x1
+      xyxy[1] = (int) ((y - h / 2)* h1); // y1
+      xyxy[2] = (int) ((x + w / 2)* w1); // x2
+      xyxy[3] = (int) ((y+ h / 2)* h1); // y2
+      return xyxy;
+   }
+
+   // 将左上角点和右下角点格式转换为中心宽高格式
+   public static double[] xyxy2centerWh(int x1, int y1, int x2, int y2,int w1,int h1){
+
+      double[] centerWh = new double[4];
+      BigDecimal dx1=BigDecimal.valueOf(x1);
+      BigDecimal  dy1=BigDecimal.valueOf(y1);
+      BigDecimal  dx2=BigDecimal.valueOf(x2);
+      BigDecimal dy2= BigDecimal.valueOf(y2);
+      BigDecimal  dw1=BigDecimal.valueOf(w1);
+      BigDecimal  dh1=BigDecimal.valueOf(h1);
+
+
+      centerWh[0] =((dx1.add(dx2)).divide(BigDecimal.valueOf(2))).divide(dw1).doubleValue(); // centerX
+      centerWh[1] = ((dy1.add(dy2)).divide(BigDecimal.valueOf(2))).divide(dh1).doubleValue(); // centerX
+      centerWh[2] = dx2.subtract(dx1).divide(dw1).doubleValue(); // width
+      centerWh[3] =  dy2.subtract(dy1).divide(dh1).doubleValue(); // width
+
+      return centerWh;
+   }
+   public static void main(String[] args) {
+      // 中心宽高格式转换为左上角点和右下角点格式
+//      int[] xyxy = ConverxyUtil.centerWh2xyxy("0.215149 0.557373 0.067749 0.329590",8192,4096);
+//
+//      System.out.println("x1=" + xyxy[0] + ", y1=" + xyxy[1] + ", x2=" + xyxy[2] + ", y2=" + xyxy[3]);
+//
+//      // 左上角点和右下角点格式转换为中心宽高格式
+//      double[] centerWh = ConverxyUtil.xyxy2centerWh(xyxy[0], xyxy[1], xyxy[2], xyxy[3],8192,4096);
+//      System.out.println("centerX=" + centerWh[0] + ", centerY=" + centerWh[1] + ", width=" + centerWh[2] + ", height=" + centerWh[3]);
+//      int[] xyxy1 = ConverxyUtil.centerWh2xyxy("0.21514892578125 0.5572509765625 0.0677490234375 0.329833984375",8192,4096);
+//      System.out.println("x1=" + xyxy1[0] + ", y1=" + xyxy1[1] + ", x2=" + xyxy1[2] + ", y2=" + xyxy1[3]);
+//
+////      Object labelVal = ConverxyUtil.getLabelVal("1");
+////      System.out.println(labelVal);
+
+      File tempFile=new File("C:\\Users\\4DAGE\\Downloads\\KK-UR4UGMSHEK3\\images\\0.txt");
+      List<String> s = FileUtil.readUtf8Lines(tempFile);
+
+
+      List<JSONObject> shapeJsons=new ArrayList<>();
+      //转换labelimg标注处理的结果
+      for (String s1 : s) {
+         int[] ints = ConverxyUtil.centerWh2xyxy(s1, 4096,2048);
+         String[] s2 = s1.split(" ");
+         JSONObject shapeJson=new JSONObject();
+         shapeJson.put("bbox",ints);
+         shapeJson.put("color",ConverxyUtil.getColor(s2[0]));
+         shapeJson.put("label",s1);
+         shapeJson.put("category",ConverxyUtil.getLabelVal(s2[0]));
+         shapeJson.put("score",0);
+         shapeJsons.add(shapeJson);
+      }
+      System.out.println(shapeJsons);
+   }
+}

+ 98 - 0
src/main/java/com/fdkankan/scene/util/OssBodySegmentUtil.java

@@ -0,0 +1,98 @@
+package com.fdkankan.scene.util;
+
+import cn.hutool.core.io.FileUtil;
+import cn.hutool.http.HttpUtil;
+import com.aliyun.imageseg20191230.models.SegmentBodyResponse;
+import com.aliyun.oss.OSS;
+import com.aliyun.oss.OSSClientBuilder;
+import com.aliyun.tea.TeaException;
+import com.fdkankan.common.util.FileUtils;
+import com.fdkankan.scene.httpclient.MyClient;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.cloud.context.config.annotation.RefreshScope;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.io.File;
+
+@Slf4j
+@Component
+@RefreshScope
+public class OssBodySegmentUtil {
+
+    @Value("${oss.bodySegment.point:oss-cn-shanghai.aliyuncs.com}")
+    private String endPoint;
+
+    @Value("${oss.bodySegment.imagesegPoint:imageseg.cn-shanghai.aliyuncs.com}")
+    private String imagesegEndPoint;
+
+    @Value("${fyun.key}")
+    private String accessKeyId;
+
+    @Value("${fyun.secret}")
+    private String accessKeySecret;
+
+    @Value("${oss.bodySegment.bucket:4dkankan-huadong}")
+    private String bucket;
+
+    @Resource
+    private MyClient myClient;
+
+    public void uploadOss(String filePath, String key){
+        OSS ossClient = new OSSClientBuilder().build(endPoint, accessKeyId, accessKeySecret);
+        try {
+            File file = new File(filePath);
+            if (!file.exists()) {
+                log.error("要上传的文件不存在:" + filePath);
+                return;
+            }
+            ossClient.putObject(bucket, key, new File(filePath));
+        } catch (Exception e) {
+            log.error(e.toString() + filePath);
+        } finally {
+            ossClient.shutdown();
+        }
+    }
+
+    public void extracted(String imageUrl, String dir, String fileName) throws Exception {
+        try {
+            com.aliyun.imageseg20191230.Client client = this.createClient();
+            com.aliyun.imageseg20191230.models.SegmentBodyRequest segmentBodyRequest =
+                    new com.aliyun.imageseg20191230.models.SegmentBodyRequest().setImageURL(imageUrl);
+            com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
+            // 复制代码运行请自行打印 API 的返回值
+            SegmentBodyResponse segmentBodyResponse = client.segmentBodyWithOptions(segmentBodyRequest, runtime);
+            String imageURL = segmentBodyResponse.getBody().getData().getImageURL();
+            log.info("人体抠图imageURL:{}", imageURL);
+            myClient.downloadFile(imageURL, dir, fileName);
+        }catch (Exception e){
+            log.error("人体抠图失败,imageUrl:" + imageUrl, e);
+            myClient.downloadFile(imageUrl, dir, fileName);
+        }
+
+    }
+
+    public static void main(String[] args) {
+        FileUtils.downLoadFromUrl("http://vibktprfx-prod-prod-damo-eas-cn-shanghai.oss-cn-shanghai.aliyuncs.com/segment-body/2023-02-24/5d44fe44-308c-44c3-8e1d-2d4cbe601f86/image.png?Expires=1677208715&OSSAccessKeyId=LTAI4FoLmvQ9urWXgSRpDvh1&Signature=4ZyzaOz6W1nBD9s3KQuFN10c%2BPw%3D",
+                "1.png","D:\\test");
+    }
+
+    /**
+     * 使用AK&SK初始化账号Client
+     * @return Client
+     * @throws Exception
+     */
+    public com.aliyun.imageseg20191230.Client createClient() throws Exception {
+        com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config()
+                // 必填,您的 AccessKey ID
+                .setAccessKeyId(accessKeyId)
+                // 必填,您的 AccessKey Secret
+                .setAccessKeySecret(accessKeySecret);
+        // 访问的域名
+        config.endpoint = this.imagesegEndPoint;
+        return new com.aliyun.imageseg20191230.Client(config);
+    }
+
+}

+ 97 - 0
src/main/java/com/fdkankan/scene/util/test.java

@@ -0,0 +1,97 @@
+package com.fdkankan.scene.util;
+// This file is auto-generated, don't edit it. Thanks.
+
+import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.thread.ThreadUtil;
+import cn.hutool.http.HttpUtil;
+import com.aliyun.imageseg20191230.Client;
+import com.aliyun.imageseg20191230.models.SegmentBodyResponse;
+import com.aliyun.tea.TeaException;
+import com.aliyun.teautil.Common;
+
+import java.io.File;
+
+public class test {
+
+    /**
+     * 使用AK&SK初始化账号Client
+     *
+     * @param accessKeyId
+     * @param accessKeySecret
+     * @return Client
+     * @throws Exception
+     */
+    public static com.aliyun.imageseg20191230.Client createClient(String accessKeyId, String accessKeySecret) throws Exception {
+        com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config()
+                // 必填,您的 AccessKey ID
+                .setAccessKeyId(accessKeyId)
+                // 必填,您的 AccessKey Secret
+                .setAccessKeySecret(accessKeySecret);
+        // 访问的域名
+        config.endpoint = "imageseg.cn-shanghai.aliyuncs.com";
+        return new com.aliyun.imageseg20191230.Client(config);
+    }
+
+    public static void main(String[] args_) throws Exception {
+
+        java.util.List<String> args = java.util.Arrays.asList(args_);
+        // 工程代码泄露可能会导致AccessKey泄露,并威胁账号下所有资源的安全性。以下代码示例仅供参考,建议使用更安全的 STS 方式,更多鉴权访问方式请参见:https://help.aliyun.com/document_detail/378657.html
+        com.aliyun.imageseg20191230.Client client = test.createClient("LTAIUrvuHqj8pvry", "JLOVl0k8Ke0aaM8nLMMiUAZ3EiiqI4");
+        ThreadUtil.execAsync(() -> {
+            extracted(client, "https://4dkankan-huadong.oss-cn-shanghai.aliyuncs.com/segment/1.jpg", "1");
+
+        });
+        ThreadUtil.execAsync(() -> {
+            extracted(client, "https://4dkankan-huadong.oss-cn-shanghai.aliyuncs.com/segment/2.jpg", "2");
+
+        });
+        ThreadUtil.sleep(1000);
+        ThreadUtil.execAsync(() -> {
+            extracted(client, "https://4dkankan-huadong.oss-cn-shanghai.aliyuncs.com/segment/3.jpg", "3");
+
+        });
+        ThreadUtil.execAsync(() -> {
+            extracted(client, "https://4dkankan-huadong.oss-cn-shanghai.aliyuncs.com/segment/4.webp", "4");
+
+        });
+//      ThreadUtil.sleep(2000);
+//      ThreadUtil.sleep(3000);
+
+//      ThreadUtil.sleep(4000);
+
+
+    }
+
+    private static void extracted(Client client, String imageUrl, String imgName) {
+
+        com.aliyun.imageseg20191230.models.SegmentBodyRequest segmentBodyRequest = new com.aliyun.imageseg20191230.models.SegmentBodyRequest()
+                .setImageURL(imageUrl);
+        com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
+        try {
+            // 复制代码运行请自行打印 API 的返回值
+            long stime = System.currentTimeMillis();
+            System.out.println("开始-----------" + imgName);
+            SegmentBodyResponse segmentBodyResponse = client.segmentBodyWithOptions(segmentBodyRequest, runtime);
+            String imageURL = segmentBodyResponse.getBody().getData().getImageURL();
+            long etime = System.currentTimeMillis();
+            System.out.printf("执行时长:%d 毫秒.----%s", (etime - stime), imgName);
+            File file = FileUtil.file("C:\\Users\\4DAGE\\Downloads\\抠像测试\\抠像测试\\1\\" + imgName + ".png");
+            if (FileUtil.exist(file)) {
+                FileUtil.del(file);
+            }
+            System.out.println(imageURL);
+            ThreadUtil.sleep(1000);
+            HttpUtil.downloadFile(imageURL, FileUtil.file(file));
+        } catch (TeaException error) {
+            // 如有需要,请打印 error
+            String s = Common.assertAsString(error.message);
+            System.out.println("错误1" + s);
+        } catch (Exception _error) {
+            TeaException error = new TeaException(_error.getMessage(), _error);
+            // 如有需要,请打印 error
+            String s = Common.assertAsString(error.message);
+            System.out.println("错误2" + s);
+
+        }
+    }
+}

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

@@ -1,5 +1,6 @@
 package com.fdkankan.scene.vo;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import lombok.AllArgsConstructor;
 import lombok.Builder;
 import lombok.Data;
@@ -76,5 +77,28 @@ public class SceneEditControlsParamVO implements Serializable {
      */
     private Integer showRule;
 
+    /**
+     * 是否展示标尺(0-不需要,1-需要)
+     */
+    private Integer showScale;
+
+    /**
+     * 是否展示分享场景(0-不需要,1-需要)
+     */
+    private Integer showShare;
+
+    /**
+     * 是否展示分享热点(0-不需要,1-需要)
+     */
+    private Integer showTagshare;
+
+    /**
+     * 是否展示合照开关(0-不需要,1-需要)
+     */
+    private Integer showCapture;
+
+
+
+
 
 }

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

@@ -1,5 +1,6 @@
 package com.fdkankan.scene.vo;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import lombok.AllArgsConstructor;
 import lombok.Builder;
 import lombok.Data;
@@ -66,5 +67,25 @@ public class SceneEditControlsVO implements Serializable {
      */
     private Integer showRule;
 
+    /**
+     * 是否展示标尺(0-不需要,1-需要)
+     */
+    private Integer showScale;
+
+    /**
+     * 是否展示分享场景(0-不需要,1-需要)
+     */
+    private Integer showShare;
+
+    /**
+     * 是否展示分享热点(0-不需要,1-需要)
+     */
+    private Integer showTagshare;
+
+    /**
+     * 是否展示合照开关(0-不需要,1-需要)
+     */
+    private Integer showCapture;
+
 
 }

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

@@ -229,5 +229,10 @@ public class SceneInfoVO {
      */
     private Integer surveillances;
 
+    /**
+     * 场景容量 单位 MB
+     */
+    private Integer space;
+
 
 }

+ 39 - 0
src/main/java/com/fdkankan/scene/vo/SceneMarkShapeDetectParamVO.java

@@ -0,0 +1,39 @@
+package com.fdkankan.scene.vo;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.validation.constraints.NotBlank;
+
+/**
+ * <p>
+ * TODO
+ * </p>
+ *
+ * @author dengsixing
+ * @since 2022/1/19
+ **/
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class SceneMarkShapeDetectParamVO {
+
+    /**
+     * 场景码
+     */
+    @NotBlank(message = "场景码不能为空")
+    private String num;
+
+    /**
+     *  推送域名
+     */
+    private String webSite;
+
+    /**
+     *  保存路径。可以为空,不为空可以查看结果
+     */
+    private String saveDir="";
+}

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

@@ -0,0 +1,36 @@
+package com.fdkankan.scene.vo;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.validation.constraints.NotBlank;
+
+/**
+ * <p>
+ * TODO
+ * </p>
+ *
+ * @author dengsixing
+ * @since 2022/1/19
+ **/
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class SceneMarkShapeParamVO {
+
+    /**
+     * 场景码
+     */
+    @NotBlank(message = "场景码不能为空")
+    private String num;
+
+    /**
+     * 图片名称路径
+     */
+    private String imagePath;
+
+
+}

+ 46 - 0
src/main/java/com/fdkankan/scene/vo/SceneMarkShapeReDetectParamVO.java

@@ -0,0 +1,46 @@
+package com.fdkankan.scene.vo;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * <p>
+ * TODO
+ * </p>
+ *
+ * @author dengsixing
+ * @since 2022/1/19
+ **/
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class SceneMarkShapeReDetectParamVO {
+
+    /**
+     * 场景码
+     */
+    private String num;
+
+    /**
+     *  推送域名
+     */
+    private String webSite;
+    /**
+     *  图片名称
+     */
+    private String imagePath;
+
+    /**
+     *  保存路径。可以为空,不为空可以查看结果
+     */
+    private String saveDir="";
+
+    /**
+     *  1,场景的单张图片重新进入训练  2,整个场景的推理进入训练
+     */
+    private Integer detectType;
+
+}

+ 5 - 1
src/main/resources/bootstrap-prod-eur.yml

@@ -3,7 +3,7 @@ spring:
     name: 4dkankan-center-scene
   cloud:
     nacos:
-      server-addr: 172.31.42.151:8848
+      server-addr: 172.31.47.163:8848
       namespace: 4dkankan-v4-prod-eur
       config:
         file-extension: yaml
@@ -28,5 +28,9 @@ spring:
           - data-id: common-rabbitmq-config.yaml
             group: DEFAULT_GROUP
             refresh: true
+
+          - data-id: forest-config.yaml
+            group: DEFAULT_GROUP
+            refresh: true
       discovery:
         namespace: ${spring.cloud.nacos.namespace}

+ 4 - 0
src/main/resources/bootstrap-prod.yml

@@ -28,6 +28,10 @@ spring:
           - data-id: common-rabbitmq-config.yaml
             group: DEFAULT_GROUP
             refresh: true
+
+          - data-id: forest-config.yaml
+            group: DEFAULT_GROUP
+            refresh: true
       discovery:
         namespace: ${spring.cloud.nacos.namespace}
 

+ 5 - 0
src/main/resources/mapper/scene/SceneCleanOrigMapper.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.scene.mapper.ISceneCleanOrigMapper">
+
+</mapper>

+ 10 - 1
src/main/resources/mapper/scene/ScenePlusMapper.xml

@@ -1,5 +1,14 @@
 <?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.IScenePlusMapper">
+<mapper namespace="com.fdkankan.scene.mapper.IScenePlusMapper">
+
+    <select id="selectCleanOrigScene" resultType="com.fdkankan.scene.bean.SceneBean">
+        select plus.num, ext.data_source
+        from t_scene_plus plus
+        left join t_scene_plus_ext ext on plus.id = ext.plus_id
+        where plus.scene_status in (1,-2) and ext.algorithm_time <![CDATA[ < ]]> #{time}
+        and ext.data_source is NOT null
+        and NOT EXISTS (select o.num from t_scene_clean_orig o where o.rec_status = 'A' and o.num = plus.num and ext.algorithm_time <![CDATA[ < ]]> o.create_time)
+    </select>
 
 </mapper>

+ 9 - 1
src/main/resources/mapper/scene/SceneProMapper.xml

@@ -1,5 +1,13 @@
 <?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.ISceneProMapper">
+<mapper namespace="com.fdkankan.scene.mapper.ISceneProMapper">
+
+    <select id="selectCleanOrigScene" resultType="com.fdkankan.scene.bean.SceneBean">
+        select pro.num, pro.data_source
+        from t_scene_pro pro
+        where pro.status in (1,-2) and pro.create_time <![CDATA[ < ]]> #{time}
+        and pro.data_source is not null
+        and NOT EXISTS (select o.num from t_scene_clean_orig o where o.rec_status = 'A' and o.num = pro.num and pro.create_time <![CDATA[ < ]]> o.create_time)
+    </select>
 
 </mapper>