Ver código fonte

编辑中心的定时任务迁移到这里

dengsixing 11 meses atrás
pai
commit
3e5aa1a3f4
23 arquivos alterados com 643 adições e 387 exclusões
  1. 44 90
      LOG_PATH_IS_UNDEFINED/job-executor/logs/log_info.log
  2. 4 18
      LOG_PATH_IS_UNDEFINED/job-executor/logs/log_warn.log
  3. 11 11
      pom.xml
  4. 11 0
      src/main/java/com/fdkankan/job/bean/SceneBean.java
  5. 21 0
      src/main/java/com/fdkankan/job/controller/SceneDownloadLogController.java
  6. 78 0
      src/main/java/com/fdkankan/job/entity/SceneDownloadLog.java
  7. 1 1
      src/main/java/com/fdkankan/job/generate/AutoGenerate.java
  8. 0 58
      src/main/java/com/fdkankan/job/job/CleanDownloadPanoramaHandler.java
  9. 69 71
      src/main/java/com/fdkankan/job/job/CleanOss4DeleteSceneHandler.java
  10. 44 0
      src/main/java/com/fdkankan/job/job/CleanSceneAsyncOperDataHandler.java
  11. 56 0
      src/main/java/com/fdkankan/job/job/CleanSceneOfflineZipHandler.java
  12. 91 113
      src/main/java/com/fdkankan/job/job/SceneColdStorageHandler.java
  13. 18 0
      src/main/java/com/fdkankan/job/mapper/ISceneDownloadLogMapper.java
  14. 7 2
      src/main/java/com/fdkankan/job/mapper/IScenePlusMapper.java
  15. 4 2
      src/main/java/com/fdkankan/job/service/ISceneAsynOperLogService.java
  16. 18 0
      src/main/java/com/fdkankan/job/service/ISceneDownloadLogService.java
  17. 12 11
      src/main/java/com/fdkankan/job/service/impl/SceneAsynOperLogServiceImpl.java
  18. 12 9
      src/main/java/com/fdkankan/job/service/impl/SceneColdStorageServiceImpl.java
  19. 27 0
      src/main/java/com/fdkankan/job/service/impl/SceneDownloadLogServiceImpl.java
  20. 21 1
      src/main/resources/bootstrap-dev.yml
  21. 5 0
      src/main/resources/mapper/job/SceneDownloadLogMapper.xml
  22. 46 0
      src/main/resources/mapper/job/ScenePlusMapper.xml
  23. 43 0
      src/main/resources/mapper/job/SceneProMapper.xml

Diferenças do arquivo suprimidas por serem muito extensas
+ 44 - 90
LOG_PATH_IS_UNDEFINED/job-executor/logs/log_info.log


+ 4 - 18
LOG_PATH_IS_UNDEFINED/job-executor/logs/log_warn.log

@@ -1,18 +1,4 @@
-2024-01-16 14:23:58.543 [main] WARN  c.a.cloud.nacos.client.NacosPropertySourceBuilder - Ignore the empty nacos configuration and get it based on dataId[4dkankan-center-job-executor] & group[DEFAULT_GROUP]
-2024-01-16 14:23:58.578 [main] WARN  c.a.cloud.nacos.client.NacosPropertySourceBuilder - Ignore the empty nacos configuration and get it based on dataId[4dkankan-center-job-executor-test.yaml] & group[DEFAULT_GROUP]
-2024-01-16 14:26:54.848 [main] WARN  c.a.cloud.nacos.client.NacosPropertySourceBuilder - Ignore the empty nacos configuration and get it based on dataId[4dkankan-center-job-executor] & group[DEFAULT_GROUP]
-2024-01-16 14:26:54.880 [main] WARN  c.a.cloud.nacos.client.NacosPropertySourceBuilder - Ignore the empty nacos configuration and get it based on dataId[4dkankan-center-job-executor-test.yaml] & group[DEFAULT_GROUP]
-2024-01-16 14:28:02.305 [main] WARN  c.a.cloud.nacos.client.NacosPropertySourceBuilder - Ignore the empty nacos configuration and get it based on dataId[4dkankan-center-job-executor] & group[DEFAULT_GROUP]
-2024-01-16 14:28:02.336 [main] WARN  c.a.cloud.nacos.client.NacosPropertySourceBuilder - Ignore the empty nacos configuration and get it based on dataId[4dkankan-center-job-executor-test.yaml] & group[DEFAULT_GROUP]
-2024-01-16 14:28:45.727 [main] WARN  c.a.cloud.nacos.client.NacosPropertySourceBuilder - Ignore the empty nacos configuration and get it based on dataId[4dkankan-center-job-executor] & group[DEFAULT_GROUP]
-2024-01-16 14:28:45.761 [main] WARN  c.a.cloud.nacos.client.NacosPropertySourceBuilder - Ignore the empty nacos configuration and get it based on dataId[4dkankan-center-job-executor-test.yaml] & group[DEFAULT_GROUP]
-2024-01-16 14:29:42.125 [main] WARN  c.a.cloud.nacos.client.NacosPropertySourceBuilder - Ignore the empty nacos configuration and get it based on dataId[4dkankan-center-job-executor] & group[DEFAULT_GROUP]
-2024-01-16 14:29:42.158 [main] WARN  c.a.cloud.nacos.client.NacosPropertySourceBuilder - Ignore the empty nacos configuration and get it based on dataId[4dkankan-center-job-executor-test.yaml] & group[DEFAULT_GROUP]
-2024-01-16 14:30:14.733 [main] WARN  c.a.cloud.nacos.client.NacosPropertySourceBuilder - Ignore the empty nacos configuration and get it based on dataId[4dkankan-center-job-executor] & group[DEFAULT_GROUP]
-2024-01-16 14:30:14.764 [main] WARN  c.a.cloud.nacos.client.NacosPropertySourceBuilder - Ignore the empty nacos configuration and get it based on dataId[4dkankan-center-job-executor-test.yaml] & group[DEFAULT_GROUP]
-2024-01-16 14:46:25.946 [main] WARN  c.a.cloud.nacos.client.NacosPropertySourceBuilder - Ignore the empty nacos configuration and get it based on dataId[4dkankan-center-job-executor] & group[DEFAULT_GROUP]
-2024-01-16 14:46:25.982 [main] WARN  c.a.cloud.nacos.client.NacosPropertySourceBuilder - Ignore the empty nacos configuration and get it based on dataId[4dkankan-center-job-executor-test.yaml] & group[DEFAULT_GROUP]
-2024-01-16 14:48:37.390 [main] WARN  c.a.cloud.nacos.client.NacosPropertySourceBuilder - Ignore the empty nacos configuration and get it based on dataId[4dkankan-center-job-executor] & group[DEFAULT_GROUP]
-2024-01-16 14:48:37.423 [main] WARN  c.a.cloud.nacos.client.NacosPropertySourceBuilder - Ignore the empty nacos configuration and get it based on dataId[4dkankan-center-job-executor-test.yaml] & group[DEFAULT_GROUP]
-2024-01-16 14:50:44.727 [main] WARN  c.a.cloud.nacos.client.NacosPropertySourceBuilder - Ignore the empty nacos configuration and get it based on dataId[4dkankan-center-job-executor] & group[DEFAULT_GROUP]
-2024-01-16 14:50:44.758 [main] WARN  c.a.cloud.nacos.client.NacosPropertySourceBuilder - Ignore the empty nacos configuration and get it based on dataId[4dkankan-center-job-executor-test.yaml] & group[DEFAULT_GROUP]
+2024-07-16 18:04:36.343 [main] WARN  c.a.cloud.nacos.client.NacosPropertySourceBuilder - Ignore the empty nacos configuration and get it based on dataId[4dkankan-center-job-executor] & group[DEFAULT_GROUP]
+2024-07-16 18:04:36.382 [main] WARN  c.a.cloud.nacos.client.NacosPropertySourceBuilder - Ignore the empty nacos configuration and get it based on dataId[4dkankan-center-job-executor-test.yaml] & group[DEFAULT_GROUP]
+2024-07-16 18:06:28.924 [main] WARN  c.a.cloud.nacos.client.NacosPropertySourceBuilder - Ignore the empty nacos configuration and get it based on dataId[4dkankan-center-job-executor] & group[DEFAULT_GROUP]
+2024-07-16 18:06:28.960 [main] WARN  c.a.cloud.nacos.client.NacosPropertySourceBuilder - Ignore the empty nacos configuration and get it based on dataId[4dkankan-center-job-executor-dev.yaml] & group[DEFAULT_GROUP]

+ 11 - 11
pom.xml

@@ -301,16 +301,16 @@
         </plugins>
     </build>
 
-    <distributionManagement>
-        <repository>
-            <id>releases</id>
-            <url>http://192.168.0.115:8081/nexus-2.14.2-01/content/repositories/releases/</url>
-        </repository>
-
-        <snapshotRepository>
-            <id>snapshots</id>
-            <url>http://192.168.0.115:8081/nexus-2.14.2-01/content/repositories/snapshots/</url>
-        </snapshotRepository>
-    </distributionManagement>
+<!--    <distributionManagement>-->
+<!--        <repository>-->
+<!--            <id>releases</id>-->
+<!--            <url>http://192.168.0.115:8081/nexus-2.14.2-01/content/repositories/releases/</url>-->
+<!--        </repository>-->
+
+<!--        <snapshotRepository>-->
+<!--            <id>snapshots</id>-->
+<!--            <url>http://192.168.0.115:8081/nexus-2.14.2-01/content/repositories/snapshots/</url>-->
+<!--        </snapshotRepository>-->
+<!--    </distributionManagement>-->
 
 </project>

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

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

+ 21 - 0
src/main/java/com/fdkankan/job/controller/SceneDownloadLogController.java

@@ -0,0 +1,21 @@
+package com.fdkankan.job.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author 
+ * @since 2024-08-30
+ */
+@RestController
+@RequestMapping("/job/sceneDownloadLog")
+public class SceneDownloadLogController {
+
+}
+

+ 78 - 0
src/main/java/com/fdkankan/job/entity/SceneDownloadLog.java

@@ -0,0 +1,78 @@
+package com.fdkankan.job.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * <p>
+ *
+ * </p>
+ *
+ * @author
+ * @since 2024-08-30
+ */
+@Getter
+@Setter
+@TableName("t_scene_download_log")
+public class SceneDownloadLog implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 用户id
+     */
+    @TableField("user_id")
+    private Long userId;
+
+    /**
+     * 场景码
+     */
+    @TableField("scene_num")
+    private String sceneNum;
+
+    /**
+     * 场景版本
+     */
+    @TableField("scene_version")
+    private Integer sceneVersion;
+
+    /**
+     * 场景打包之后的连接
+     */
+    @TableField("download_url")
+    private String downloadUrl;
+
+    /**
+     * 0下载中,1下载成功,2下载失败
+     */
+    @TableField("status")
+    private Integer status;
+
+    /**
+     * 下载版本v3,v4
+     */
+    @TableField("sys_version")
+    private String sysVersion;
+
+    @TableField("rec_status")
+    @TableLogic(value = "A", delval = "I")
+    private String recStatus;
+
+    @TableField("create_time")
+    private Date createTime;
+
+    @TableField("update_time")
+    private Date updateTime;
+
+
+}

+ 1 - 1
src/main/java/com/fdkankan/job/generate/AutoGenerate.java

@@ -17,7 +17,7 @@ public class AutoGenerate {
         String path =System.getProperty("user.dir");
 
         generate(path,"job", getTables(new String[]{
-                "t_scene_copy_log"
+                "t_scene_asyn_oper_log"
         }));
 
 //        generate(path,"goods", getTables(new String[]{

+ 0 - 58
src/main/java/com/fdkankan/job/job/CleanDownloadPanoramaHandler.java

@@ -1,58 +0,0 @@
-//package com.fdkankan.job.job;
-//
-//import cn.hutool.core.img.ImgUtil;
-//import com.fdkankan.job.service.ISceneAsynOperLogService;
-//import com.fdkankan.job.service.ISceneCleanOrigService;
-//import com.fdkankan.job.service.IScenePlusService;
-//import com.fdkankan.job.service.ISceneProService;
-//import com.fdkankan.redis.constant.RedisLockKey;
-//import com.fdkankan.redis.util.RedisLockUtil;
-//import com.xxl.job.core.context.XxlJobHelper;
-//import com.xxl.job.core.handler.annotation.XxlJob;
-//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 java.io.File;
-//import java.sql.SQLException;
-//
-///**
-// * <p>
-// * 场景冻结定时任务
-// * </p>
-// *
-// * @author dengsixing
-// * @since 2022/12/16
-// **/
-//@RefreshScope
-//@Component
-//@Slf4j
-//public class CleanDownloadPanoramaHandler {
-//
-//    @Value("${env}")
-//    private String env;
-//
-//    @Autowired
-//    private IScenePlusService scenePlusService;
-//    @Autowired
-//    private ISceneProService sceneProService;
-//    @Autowired
-//    private RedisLockUtil redisLockUtil;
-//    @Autowired
-//    private ISceneCleanOrigService sceneCleanOrigService;
-//    @Autowired
-//    private ISceneAsynOperLogService sceneAsynOperLogService;
-//
-//    @XxlJob("cleanDownloadPanorama")
-//    public void coldStorageHomeV3() throws Exception {
-//        XxlJobHelper.log("cleanDownloadPanorama start.....");
-//
-//        log.info("定时清除全景图压缩包开始");
-//        sceneAsynOperLogService.cleanDownloadPanorama();
-//        log.info("定时清除全景图压缩包完毕");
-//
-//        XxlJobHelper.log("cleanDownloadPanorama end.....");
-//    }
-//}

+ 69 - 71
src/main/java/com/fdkankan/job/job/CleanOss4DeleteSceneHandler.java

@@ -1,71 +1,69 @@
-//package com.fdkankan.job.job;
-//
-//import com.fdkankan.job.service.ISceneCleanOrigService;
-//import com.fdkankan.redis.constant.RedisLockKey;
-//import com.fdkankan.redis.util.RedisLockUtil;
-//import com.xxl.job.core.context.XxlJobHelper;
-//import com.xxl.job.core.handler.annotation.XxlJob;
-//import lombok.extern.slf4j.Slf4j;
-//import org.springframework.beans.factory.annotation.Autowired;
-//import org.springframework.cloud.context.config.annotation.RefreshScope;
-//import org.springframework.stereotype.Component;
-//
-///**
-// * <p>
-// * 已删除场景 清除oss文件
-// * </p>
-// *
-// * @author dengsixing
-// * @since 2022/12/16
-// **/
-//@RefreshScope
-//@Component
-//@Slf4j
-//public class CleanOss4DeleteSceneHandler {
-//
-//    @Autowired
-//    private RedisLockUtil redisLockUtil;
-//    @Autowired
-//    private ISceneCleanOrigService sceneCleanOrigService;
-//
-//    @XxlJob("cleanOss4DeletedSceneV3")
-//    public void cleanOss4DeletedSceneV3(){
-//        XxlJobHelper.log("cleanOss4DeletedSceneV3 start.....");
-//
-//        log.info("删除已删除V3场景原始资源开始");
-//        String lockKey = RedisLockKey.LOCK_CLEAN_SCENE_DELETED_ORIG_V3;
-//        try {
-//            boolean lock = redisLockUtil.lock(lockKey, 24*60*60);
-//            if(!lock){
-//                return;
-//            }
-//            sceneCleanOrigService.cleanOss4DeletedSceneV3();
-//        }finally {
-//            redisLockUtil.unlockLua(lockKey);
-//        }
-//        log.info("删除已删除V3场景原始资源结束");
-//
-//        XxlJobHelper.log("cleanOss4DeletedSceneV3 end.....");
-//    }
-//
-//    @XxlJob("cleanOss4DeletedSceneV4")
-//    public void cleanOss4DeletedSceneV4() throws Exception {
-//        XxlJobHelper.log("cleanOss4DeletedSceneV4 start.....");
-//
-//        log.info("删除已删除V4场景原始资源开始");
-//        String lockKey = RedisLockKey.LOCK_CLEAN_SCENE_DELETED_ORIG_V4;
-//        try {
-//            boolean lock = redisLockUtil.lock(lockKey, 24*60*60);
-//            if(!lock){
-//                return;
-//            }
-//            sceneCleanOrigService.cleanOss4DeletedSceneV4();
-//        }finally {
-//            redisLockUtil.unlockLua(lockKey);
-//        }
-//        log.info("删除已删除V4场景原始资源结束");
-//
-//        XxlJobHelper.log("cleanOss4DeletedSceneV4 end.....");
-//    }
-//
-//}
+package com.fdkankan.job.job;
+
+import com.fdkankan.job.service.ISceneCleanOrigService;
+import com.fdkankan.redis.constant.RedisLockKey;
+import com.fdkankan.redis.util.RedisLockUtil;
+import com.xxl.job.core.context.XxlJobHelper;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cloud.context.config.annotation.RefreshScope;
+import org.springframework.stereotype.Component;
+
+/**
+ * <p>
+ * 已删除场景 清除oss文件
+ * </p>
+ *
+ * @author dengsixing
+ * @since 2022/12/16
+ **/
+@RefreshScope
+@Component
+@Slf4j
+public class CleanOss4DeleteSceneHandler {
+
+    @Autowired
+    private RedisLockUtil redisLockUtil;
+    @Autowired
+    private ISceneCleanOrigService sceneCleanOrigService;
+
+    @XxlJob("cleanOss4DeletedSceneV3")
+    public void cleanOss4DeletedSceneV3(){
+        XxlJobHelper.log("cleanOss4DeletedSceneV3 start.....");
+        log.info("删除已删除V3场景原始资源开始");
+        String lockKey = RedisLockKey.LOCK_CLEAN_SCENE_DELETED_ORIG_V3;
+        try {
+            boolean lock = redisLockUtil.lock(lockKey, 24*60*60);
+            if(!lock){
+                return;
+            }
+            sceneCleanOrigService.cleanOss4DeletedSceneV3();
+        }finally {
+            redisLockUtil.unlockLua(lockKey);
+        }
+        log.info("删除已删除V3场景原始资源结束");
+        XxlJobHelper.log("cleanOss4DeletedSceneV3 end.....");
+    }
+
+    @XxlJob("cleanOss4DeletedSceneV4")
+    public void cleanOss4DeletedSceneV4() throws Exception {
+        XxlJobHelper.log("cleanOss4DeletedSceneV4 start.....");
+
+        log.info("删除已删除V4场景原始资源开始");
+        String lockKey = RedisLockKey.LOCK_CLEAN_SCENE_DELETED_ORIG_V4;
+        try {
+            boolean lock = redisLockUtil.lock(lockKey, 24*60*60);
+            if(!lock){
+                return;
+            }
+            sceneCleanOrigService.cleanOss4DeletedSceneV4();
+        }finally {
+            redisLockUtil.unlockLua(lockKey);
+        }
+        log.info("删除已删除V4场景原始资源结束");
+
+        XxlJobHelper.log("cleanOss4DeletedSceneV4 end.....");
+    }
+
+}

+ 44 - 0
src/main/java/com/fdkankan/job/job/CleanSceneAsyncOperDataHandler.java

@@ -0,0 +1,44 @@
+package com.fdkankan.job.job;
+
+import com.fdkankan.common.constant.SceneAsynFuncType;
+import com.fdkankan.job.mapper.ISceneAsynOperLogMapper;
+import com.fdkankan.job.service.ISceneAsynOperLogService;
+import com.fdkankan.job.service.ISceneDownloadLogService;
+import com.xxl.job.core.context.XxlJobHelper;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cloud.context.config.annotation.RefreshScope;
+import org.springframework.stereotype.Component;
+
+/**
+ * 清除场景离线包
+ **/
+@RefreshScope
+@Component
+public class CleanSceneAsyncOperDataHandler {
+
+    @Autowired
+    private ISceneAsynOperLogService sceneAsynOperLogService;
+
+
+    /**
+     * 清除异步批量下载全景图OSS压缩包
+     */
+    @XxlJob("cleanDownloadPanorama")
+    public void CleanSceneOfflineZipHandler(){
+        XxlJobHelper.log("定时清除全景图压缩包开始.....");
+        sceneAsynOperLogService.cleanDownloadOssPage(SceneAsynFuncType.PANORAMIC_IMAGE.code(), 1);
+        XxlJobHelper.log("定时清除全景图压缩包完毕.....");
+    }
+
+    @XxlJob("cleanDownloadModel")
+    public void cleanDownloadModel(){
+        XxlJobHelper.log("定时清除模型压缩包开始.....");
+        sceneAsynOperLogService.cleanDownloadOssPage(SceneAsynFuncType.MODEL.code(), 1);
+        XxlJobHelper.log("定时清除模型压缩包完毕.....");
+    }
+
+
+
+
+}

+ 56 - 0
src/main/java/com/fdkankan/job/job/CleanSceneOfflineZipHandler.java

@@ -0,0 +1,56 @@
+package com.fdkankan.job.job;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.fdkankan.common.constant.CommonOperStatus;
+import com.fdkankan.common.util.DateExtUtil;
+import com.fdkankan.dingtalk.DingTalkSendUtils;
+import com.fdkankan.job.entity.SceneBuildProcessLog;
+import com.fdkankan.job.entity.ScenePlus;
+import com.fdkankan.job.entity.ScenePro;
+import com.fdkankan.job.service.ISceneBuildProcessLogService;
+import com.fdkankan.job.service.ISceneDownloadLogService;
+import com.fdkankan.job.service.IScenePlusService;
+import com.fdkankan.job.service.ISceneProService;
+import com.fdkankan.model.constants.SceneBuildProcessType;
+import com.xxl.job.core.context.XxlJobHelper;
+import com.xxl.job.core.handler.annotation.XxlJob;
+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 java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * 清除场景离线包
+ **/
+@RefreshScope
+@Component
+public class CleanSceneOfflineZipHandler {
+
+    @Autowired
+    private ISceneDownloadLogService sceneDownloadLogService;
+
+
+    @XxlJob("CleanSceneOfflineZipHandler")
+    public void CleanSceneOfflineZipHandler() throws Exception {
+        XxlJobHelper.log("CleanSceneOfflineZipHandler start.....");
+
+        sceneDownloadLogService.cleanSceneOfflineZip();
+
+
+
+        XxlJobHelper.log("CleanSceneOfflineZipHandler end.....");
+    }
+
+
+
+
+}

+ 91 - 113
src/main/java/com/fdkankan/job/job/SceneColdStorageHandler.java

@@ -1,113 +1,91 @@
-//package com.fdkankan.job.job;
-//
-//import cn.hutool.core.collection.CollUtil;
-//import cn.hutool.core.img.ImgUtil;
-//import cn.hutool.core.util.StrUtil;
-//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-//import com.fdkankan.common.constant.CommonOperStatus;
-//import com.fdkankan.common.util.DateExtUtil;
-//import com.fdkankan.dingtalk.DingTalkSendUtils;
-//import com.fdkankan.job.entity.SceneBuildProcessLog;
-//import com.fdkankan.job.entity.ScenePlus;
-//import com.fdkankan.job.entity.ScenePro;
-//import com.fdkankan.job.service.ISceneBuildProcessLogService;
-//import com.fdkankan.job.service.ISceneCleanOrigService;
-//import com.fdkankan.job.service.IScenePlusService;
-//import com.fdkankan.job.service.ISceneProService;
-//import com.fdkankan.model.constants.SceneBuildProcessType;
-//import com.fdkankan.redis.constant.RedisLockKey;
-//import com.fdkankan.redis.util.RedisLockUtil;
-//import com.xxl.job.core.context.XxlJobHelper;
-//import com.xxl.job.core.handler.annotation.XxlJob;
-//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 java.io.File;
-//import java.sql.SQLException;
-//import java.util.ArrayList;
-//import java.util.Calendar;
-//import java.util.Date;
-//import java.util.List;
-//import java.util.concurrent.atomic.AtomicInteger;
-//import java.util.stream.Collectors;
-//
-///**
-// * <p>
-// * 场景冻结定时任务
-// * </p>
-// *
-// * @author dengsixing
-// * @since 2022/12/16
-// **/
-//@RefreshScope
-//@Component
-//@Slf4j
-//public class SceneColdStorageHandler {
-//
-//    @Value("${env}")
-//    private String env;
-//
-//    @Autowired
-//    private IScenePlusService scenePlusService;
-//    @Autowired
-//    private ISceneProService sceneProService;
-//    @Autowired
-//    private RedisLockUtil redisLockUtil;
-//    @Autowired
-//    private ISceneCleanOrigService sceneCleanOrigService;
-//
-//    @XxlJob("coldStorageHomeV3")
-//    public void coldStorageHomeV3() throws Exception {
-//        XxlJobHelper.log("coldStorageHomeV3 start.....");
-//
-//        log.info("冻结v3场景原始资源开始");
-//        String lockKey = RedisLockKey.LOCK_CLEAN_SCENE_ORIG_V3;
-//        try {
-//            boolean lock = redisLockUtil.lock(lockKey, 24*60*60);
-//            if(!lock){
-//                return;
-//            }
-//            sceneCleanOrigService.coldStorageHomeV3();
-//        }finally {
-//            redisLockUtil.unlockLua(lockKey);
-//        }
-//        log.info("冻结v3场景原始资源结束");
-//
-//
-//
-//        XxlJobHelper.log("coldStorageHomeV3 end.....");
-//    }
-//
-//    @XxlJob("coldStorageHomeV4")
-//    public void coldStorageHomeV4() throws Exception {
-//        XxlJobHelper.log("coldStorageHomeV4 start.....");
-//
-//        log.info("冻结v4场景原始资源开始");
-//        String lockKey = RedisLockKey.LOCK_CLEAN_SCENE_ORIG_V4;
-//        try {
-//            boolean lock = redisLockUtil.lock(lockKey, 24*60*60);
-//            if(!lock){
-//                return;
-//            }
-//            sceneCleanOrigService.coldStorageHomeV4();
-//        }finally {
-//            redisLockUtil.unlockLua(lockKey);
-//        }
-//        log.info("冻结v4场景原始资源结束");
-//
-//
-//
-//        XxlJobHelper.log("coldStorageHomeV4 end.....");
-//    }
-//
-//    public static void main(String[] args) throws SQLException {
-//
-//        ImgUtil.scale(new File("C:\\Users\\dsx\\Desktop\\test\\20230116173304.jpg"), new File("C:\\Users\\dsx\\Desktop\\test\\3.jpg"), (float) 0.3);
-//
-//    }
-//
-//
-//}
+package com.fdkankan.job.job;
+
+import cn.hutool.core.img.ImgUtil;
+import com.fdkankan.job.service.ISceneCleanOrigService;
+import com.fdkankan.job.service.IScenePlusService;
+import com.fdkankan.job.service.ISceneProService;
+import com.fdkankan.redis.constant.RedisLockKey;
+import com.fdkankan.redis.util.RedisLockUtil;
+import com.xxl.job.core.context.XxlJobHelper;
+import com.xxl.job.core.handler.annotation.XxlJob;
+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 java.io.File;
+import java.sql.SQLException;
+
+/**
+ * <p>
+ * 场景冻结定时任务
+ * </p>
+ *
+ * @author dengsixing
+ * @since 2022/12/16
+ **/
+@RefreshScope
+@Component
+@Slf4j
+public class SceneColdStorageHandler {
+
+    @Value("${env}")
+    private String env;
+
+    @Autowired
+    private IScenePlusService scenePlusService;
+    @Autowired
+    private ISceneProService sceneProService;
+    @Autowired
+    private RedisLockUtil redisLockUtil;
+    @Autowired
+    private ISceneCleanOrigService sceneCleanOrigService;
+
+    @XxlJob("coldStorageHomeV3")
+    public void coldStorageHomeV3() throws Exception {
+        XxlJobHelper.log("coldStorageHomeV3 start.....");
+
+        log.info("冻结v3场景原始资源开始");
+        String lockKey = RedisLockKey.LOCK_CLEAN_SCENE_ORIG_V3;
+        try {
+            boolean lock = redisLockUtil.lock(lockKey, 24*60*60);
+            if(!lock){
+                return;
+            }
+            sceneCleanOrigService.coldStorageHomeV3();
+        }finally {
+            redisLockUtil.unlockLua(lockKey);
+        }
+        log.info("冻结v3场景原始资源结束");
+
+        XxlJobHelper.log("coldStorageHomeV3 end.....");
+    }
+
+    @XxlJob("coldStorageHomeV4")
+    public void coldStorageHomeV4() throws Exception {
+        XxlJobHelper.log("coldStorageHomeV4 start.....");
+        log.info("冻结v4场景原始资源开始");
+        String lockKey = RedisLockKey.LOCK_CLEAN_SCENE_ORIG_V4;
+        try {
+            boolean lock = redisLockUtil.lock(lockKey, 24*60*60);
+            if(!lock){
+                return;
+            }
+            sceneCleanOrigService.coldStorageHomeV4();
+        }finally {
+            redisLockUtil.unlockLua(lockKey);
+        }
+        log.info("冻结v4场景原始资源结束");
+
+        XxlJobHelper.log("coldStorageHomeV4 end.....");
+    }
+
+    public static void main(String[] args) throws SQLException {
+
+        ImgUtil.scale(new File("C:\\Users\\dsx\\Desktop\\test\\20230116173304.jpg"), new File("C:\\Users\\dsx\\Desktop\\test\\3.jpg"), (float) 0.3);
+
+    }
+
+
+}

+ 18 - 0
src/main/java/com/fdkankan/job/mapper/ISceneDownloadLogMapper.java

@@ -0,0 +1,18 @@
+package com.fdkankan.job.mapper;
+
+import com.fdkankan.job.entity.SceneDownloadLog;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2024-08-30
+ */
+@Mapper
+public interface ISceneDownloadLogMapper extends BaseMapper<SceneDownloadLog> {
+
+}

+ 7 - 2
src/main/java/com/fdkankan/job/mapper/IScenePlusMapper.java

@@ -7,20 +7,25 @@ import org.apache.ibatis.annotations.Mapper;
 
 import java.util.Date;
 import java.util.List;
+import java.util.Set;
 
 /**
  * <p>
  * 场景主表 Mapper 接口
  * </p>
  *
- * @author 
+ * @author
  * @since 2022-12-16
  */
 @Mapper
 public interface IScenePlusMapper extends BaseMapper<ScenePlus> {
 
-    List<SceneBean> selectColdStorageScene(Date time);
+    List<SceneBean> selectCleanOrigScene(Date time);
 
     List<SceneBean> selectCleanOrigSceneDeleted(Date time);
 
+    List<SceneBean> listCleanOss4TestCamera(Set<Long> cameraIds, Date time);
+
+    List<SceneBean> selectColdStorageScene(Date time);
+
 }

+ 4 - 2
src/main/java/com/fdkankan/job/service/ISceneAsynOperLogService.java

@@ -10,13 +10,15 @@ import com.fdkankan.web.response.ResultData;
  *  服务类
  * </p>
  *
- * @author 
+ * @author
  * @since 2022-12-07
  */
 public interface ISceneAsynOperLogService extends IService<SceneAsynOperLog> {
 
     ResultData getAsynOperLog(SceneAsynOperLogParamVO param);
 
-    void cleanDownloadPanorama();
+    void cleanDownloadOssPage(String asynFuncType, int preMonth);
+
+
 
 }

+ 18 - 0
src/main/java/com/fdkankan/job/service/ISceneDownloadLogService.java

@@ -0,0 +1,18 @@
+package com.fdkankan.job.service;
+
+import com.fdkankan.job.entity.SceneDownloadLog;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author
+ * @since 2024-08-30
+ */
+public interface ISceneDownloadLogService extends IService<SceneDownloadLog> {
+
+    void cleanSceneOfflineZip();
+
+}

+ 12 - 11
src/main/java/com/fdkankan/job/service/impl/SceneAsynOperLogServiceImpl.java

@@ -18,6 +18,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
 import java.io.IOException;
 import java.util.Calendar;
 import java.util.List;
@@ -28,14 +29,14 @@ import java.util.stream.Collectors;
  *  服务实现类
  * </p>
  *
- * @author 
+ * @author
  * @since 2022-12-07
  */
 @Slf4j
 @Service
 public class SceneAsynOperLogServiceImpl extends ServiceImpl<ISceneAsynOperLogMapper, SceneAsynOperLog> implements ISceneAsynOperLogService {
 
-    @Autowired
+    @Resource
     private FYunFileServiceInterface fYunFileService;
 
 
@@ -76,20 +77,20 @@ public class SceneAsynOperLogServiceImpl extends ServiceImpl<ISceneAsynOperLogMa
     }
 
     @Override
-    public void cleanDownloadPanorama() {
+    public void cleanDownloadOssPage(String asynFuncType, int preMonth) {
 
         List<SceneAsynOperLog> downloadList = this.list(
-            new LambdaQueryWrapper<SceneAsynOperLog>()
-                .eq(SceneAsynOperLog::getOperType, SceneAsynOperType.DOWNLOAD.code())
-                .eq(SceneAsynOperLog::getModule, SceneAsynModuleType.UPLOAD_DOWNLOAD.code())
-                .eq(SceneAsynOperLog::getFunc, SceneAsynFuncType.PANORAMIC_IMAGE.code()));
+                new LambdaQueryWrapper<SceneAsynOperLog>()
+                        .eq(SceneAsynOperLog::getOperType, SceneAsynOperType.DOWNLOAD.code())
+                        .eq(SceneAsynOperLog::getModule, SceneAsynModuleType.UPLOAD_DOWNLOAD.code())
+                        .eq(SceneAsynOperLog::getFunc, asynFuncType));
         if(CollUtil.isEmpty(downloadList)){
             return;
         }
-        DateTime preMonth = DateUtil.offsetMonth(Calendar.getInstance().getTime(), -1);
+        DateTime preDate = DateUtil.offsetMonth(Calendar.getInstance().getTime(), -preMonth);
         List<SceneAsynOperLog> deleteList = downloadList.parallelStream().filter(log -> {
-            if (log.getCreateTime().before(preMonth)) {
-                return Boolean.TRUE;
+            if (log.getCreateTime().before(preDate)) {
+                return true;
             }
             return false;
         }).collect(Collectors.toList());
@@ -106,7 +107,7 @@ public class SceneAsynOperLogServiceImpl extends ServiceImpl<ISceneAsynOperLogMa
                 try {
                     fYunFileService.deleteFile(item.getUrl());
                 } catch (IOException e) {
-                    log.warn("删除oss全景图下载压缩包失败,key:{}", item.getUrl());
+                    log.warn("删除oss下载压缩包失败,key:{}", item.getUrl());
                 }
             }
         });

+ 12 - 9
src/main/java/com/fdkankan/job/service/impl/SceneColdStorageServiceImpl.java

@@ -1,11 +1,14 @@
 package com.fdkankan.job.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fdkankan.job.entity.SceneColdStorage;
 import com.fdkankan.job.mapper.ISceneColdStorageMapper;
 import com.fdkankan.job.service.ISceneColdStorageService;
 import org.springframework.stereotype.Service;
 
+import java.util.Objects;
+
 /**
  * <p>
  * 场景封存状态表 服务实现类
@@ -20,14 +23,14 @@ public class SceneColdStorageServiceImpl extends ServiceImpl<ISceneColdStorageMa
     @Override
     public void save(String num, Integer state, String coldBucket, String standarBucket) {
 
-//        SceneColdStorage sceneColdStorage = this.getOne(new LambdaQueryWrapper<SceneColdStorage>().eq(SceneColdStorage::getNum, num));
-//        if(Objects.isNull(sceneColdStorage)){
-//            sceneColdStorage = new SceneColdStorage();
-//        }
-//        sceneColdStorage.setNum(num);
-//        sceneColdStorage.setState(state);
-//        sceneColdStorage.setColdBucket(coldBucket);
-//        sceneColdStorage.setBucket(standarBucket);
-//        this.saveOrUpdate(sceneColdStorage);
+        SceneColdStorage sceneColdStorage = this.getOne(new LambdaQueryWrapper<SceneColdStorage>().eq(SceneColdStorage::getNum, num));
+        if(Objects.isNull(sceneColdStorage)){
+            sceneColdStorage = new SceneColdStorage();
+        }
+        sceneColdStorage.setNum(num);
+        sceneColdStorage.setState(state);
+        sceneColdStorage.setColdBucket(coldBucket);
+        sceneColdStorage.setBucket(standarBucket);
+        this.saveOrUpdate(sceneColdStorage);
     }
 }

+ 27 - 0
src/main/java/com/fdkankan/job/service/impl/SceneDownloadLogServiceImpl.java

@@ -0,0 +1,27 @@
+package com.fdkankan.job.service.impl;
+
+import com.fdkankan.job.entity.SceneDownloadLog;
+import com.fdkankan.job.mapper.ISceneDownloadLogMapper;
+import com.fdkankan.job.service.ISceneDownloadLogService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author
+ * @since 2024-08-30
+ */
+@Service
+public class SceneDownloadLogServiceImpl extends ServiceImpl<ISceneDownloadLogMapper, SceneDownloadLog> implements ISceneDownloadLogService {
+
+    @Override
+    public void cleanSceneOfflineZip() {
+
+
+
+
+    }
+}

+ 21 - 1
src/main/resources/bootstrap-dev.yml

@@ -4,7 +4,7 @@ spring:
   cloud:
     nacos:
       server-addr: 120.24.144.164:8848
-      namespace: 4dkankan-v4-test
+      namespace: 4dkankan-v4-dev
       config:
         file-extension: yaml
         namespace: ${spring.cloud.nacos.namespace}
@@ -24,6 +24,26 @@ spring:
           - data-id: common-fyun-config.yaml
             group: DEFAULT_GROUP
             refresh: true
+
+          - data-id: common-rabbitmq-config.yaml
+            group: DEFAULT_GROUP
+            refresh: true
+
+          - data-id: common-logback-config.yaml
+            group: DEFAULT_GROUP
+            refresh: true
+
+          - data-id: common-scaling.yaml
+            group: DEFAULT_GROUP
+            refresh: true
+
+          - data-id: forest-config.yaml
+            group: DEFAULT_GROUP
+            refresh: true
+
+          - data-id: sms-config.yaml
+            group: DEFAULT_GROUP
+            refresh: true
       discovery:
         namespace: ${spring.cloud.nacos.namespace}
 

+ 5 - 0
src/main/resources/mapper/job/SceneDownloadLogMapper.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.job.mapper.ISceneDownloadLogMapper">
+
+</mapper>

+ 46 - 0
src/main/resources/mapper/job/ScenePlusMapper.xml

@@ -0,0 +1,46 @@
+<?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.job.mapper.IScenePlusMapper">
+
+    <select id="selectCleanOrigScene" resultType="com.fdkankan.job.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>
+
+    <select id="selectCleanOrigSceneDeleted" resultType="com.fdkankan.job.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.rec_status = 'I' and plus.update_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 o.type = 2)
+    </select>
+
+    <select id="listCleanOss4TestCamera" resultType="com.fdkankan.job.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 plus.rec_status = 'A' and ext.algorithm_time <![CDATA[ < ]]> #{time}
+        and ext.data_source is NOT null
+        and plus.camera_id in
+        <foreach collection="cameraIds" item="cameraId" open="(" close=")" separator=",">
+            #{cameraId}
+        </foreach>
+        and NOT EXISTS (select o.num from t_scene_clean_orig o where o.rec_status = 'A' and o.num = plus.num and o.type = 3 and ext.algorithm_time <![CDATA[ < ]]> o.create_time)
+    </select>
+
+    <select id="selectColdStorageScene" resultType="com.fdkankan.job.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 c.num from t_scene_cold_storage c where c.rec_status = 'A' AND c.`state` = 1 and c.num = plus.num)
+        and NOT EXISTS (select o.num from t_scene_clean_orig o where o.rec_status = 'A' and o.state != -1 and o.num = plus.num and ext.algorithm_time <![CDATA[ < ]]> o.create_time)
+    </select>
+
+</mapper>

+ 43 - 0
src/main/resources/mapper/job/SceneProMapper.xml

@@ -0,0 +1,43 @@
+<?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.job.mapper.ISceneProMapper">
+
+    <select id="selectCleanOrigScene" resultType="com.fdkankan.job.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>
+
+    <select id="listCleanOss4DeletedScene" resultType="com.fdkankan.scene.bean.SceneBean">
+        select pro.num, pro.data_source
+        from t_scene_pro pro
+        where pro.rec_status = 'I' and pro.update_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 o.type = 2)
+    </select>
+
+    <select id="listCleanOss4TestCamera" 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.rec_status = 'A' and pro.create_time <![CDATA[ < ]]> #{time}
+        and pro.data_source is not null
+        and pro.camera_id in
+        <foreach collection="cameraIds" item="cameraId" open="(" close=")" separator=",">
+            #{cameraId}
+        </foreach>
+        and NOT EXISTS (select o.num from t_scene_clean_orig o where o.rec_status = 'A' and o.num = pro.num and o.type = 3 and pro.create_time <![CDATA[ < ]]> o.create_time)
+    </select>
+
+    <select id="selectColdStorageScene" 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 pro.is_upgrade = 0
+        and NOT EXISTS (select c.num from t_scene_cold_storage c where c.rec_status = 'A' and c.state = 1 and c.num = pro.num)
+        and NOT EXISTS (select o.num from t_scene_clean_orig o where o.rec_status = 'A' and o.state != -1 and o.num = pro.num and pro.create_time <![CDATA[ < ]]> o.create_time)
+    </select>
+
+</mapper>