|
@@ -1,22 +1,24 @@
|
|
|
package com.fdkankan.manage_jp.task;
|
|
package com.fdkankan.manage_jp.task;
|
|
|
|
|
|
|
|
|
|
+import cn.hutool.core.io.FileUtil;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
+import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
|
|
|
+import com.fdkankan.manage_jp.config.ManageConfig;
|
|
|
import com.fdkankan.manage_jp.entity.Project;
|
|
import com.fdkankan.manage_jp.entity.Project;
|
|
|
import com.fdkankan.manage_jp.entity.ProjectSceneGps;
|
|
import com.fdkankan.manage_jp.entity.ProjectSceneGps;
|
|
|
import com.fdkankan.manage_jp.entity.ScenePlus;
|
|
import com.fdkankan.manage_jp.entity.ScenePlus;
|
|
|
|
|
+import com.fdkankan.manage_jp.entity.ScenePro;
|
|
|
import com.fdkankan.manage_jp.httpClient.service.LaserService;
|
|
import com.fdkankan.manage_jp.httpClient.service.LaserService;
|
|
|
import com.fdkankan.manage_jp.service.IProjectSceneGpsService;
|
|
import com.fdkankan.manage_jp.service.IProjectSceneGpsService;
|
|
|
import com.fdkankan.manage_jp.service.ISceneProService;
|
|
import com.fdkankan.manage_jp.service.ISceneProService;
|
|
|
import com.fdkankan.manage_jp.vo.response.SceneGpsDb;
|
|
import com.fdkankan.manage_jp.vo.response.SceneGpsDb;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
|
|
-import java.util.Date;
|
|
|
|
|
-import java.util.HashMap;
|
|
|
|
|
-import java.util.List;
|
|
|
|
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
@Service
|
|
@Service
|
|
@@ -77,4 +79,117 @@ public class TaskService {
|
|
|
}
|
|
}
|
|
|
sceneProService.openMapShow(sceneMapShowList);
|
|
sceneProService.openMapShow(sceneMapShowList);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ ManageConfig manageConfig;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ FYunFileServiceInterface fYunFileServiceInterface;
|
|
|
|
|
+
|
|
|
|
|
+ @Scheduled(initialDelay = 3000,fixedDelay = 1000 * 60 * 60 *24)
|
|
|
|
|
+ public void delScene() {
|
|
|
|
|
+ List<ScenePro> scenePros = sceneProService.getDelSceneNumV3();
|
|
|
|
|
+ for (ScenePro scenePro : scenePros) {
|
|
|
|
|
+ if(StringUtils.isBlank(scenePro.getNum())){
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ delSource(scenePro.getNum(),scenePro.getDataSource());
|
|
|
|
|
+ sceneProService.updateDelSourceV3(scenePro.getNum());
|
|
|
|
|
+ }
|
|
|
|
|
+ List<ScenePlus> scenePluses = sceneProService.getDelSceneNumV4();
|
|
|
|
|
+ for (ScenePlus scenePlus : scenePluses) {
|
|
|
|
|
+ if(StringUtils.isBlank(scenePlus.getNum())){
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ delSource(scenePlus.getNum(),scenePlus.getDataSource());
|
|
|
|
|
+ sceneProService.updateDelSourceV4(scenePlus.getNum());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 删除场景nas和oss数据
|
|
|
|
|
+ * oss
|
|
|
|
|
+ * 正式:laser_p_data/场景码
|
|
|
|
|
+ * 测试:laser_u_data/场景码
|
|
|
|
|
+ * 原始资源 v3 v4
|
|
|
|
|
+ * 查看资源 scene_view_data v4
|
|
|
|
|
+ * 编辑资源 scene_edit_data v4
|
|
|
|
|
+ * 缓存资源 scene_result_data v4
|
|
|
|
|
+ * data/data<num> v3
|
|
|
|
|
+ * images/images<num> v3
|
|
|
|
|
+ * video/video<num> v3
|
|
|
|
|
+ * voice/voice<num> v3
|
|
|
|
|
+ * scene/<num>
|
|
|
|
|
+ * downloads/scene/<num>
|
|
|
|
|
+ * downloads/scenes/<num>.zip
|
|
|
|
|
+ * downloads/extras/<num>_extras.zip
|
|
|
|
|
+ * downloads/extras/<num>_mesh.zip
|
|
|
|
|
+ */
|
|
|
|
|
+
|
|
|
|
|
+ public static List<String> meshOssPath = Arrays.asList(
|
|
|
|
|
+ "scene_view_data/%s",
|
|
|
|
|
+ "scene_edit_data/%s",
|
|
|
|
|
+ "data/data%s",
|
|
|
|
|
+ "images/images%s",
|
|
|
|
|
+ "video/video%s",
|
|
|
|
|
+ "voice/voice%s",
|
|
|
|
|
+ "scene/%s",
|
|
|
|
|
+ "downloads/scene/%s",
|
|
|
|
|
+ "downloads/scenes/%s.zip",
|
|
|
|
|
+ "downloads/extras/%s_extras.zip",
|
|
|
|
|
+ "downloads/extras/%s_mesh.zip"
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ public static List<String> meshNasDataSourcePath = Arrays.asList(
|
|
|
|
|
+ "%s_images",
|
|
|
|
|
+ "%s_laser_obj",
|
|
|
|
|
+ "%s_obj2Tiles",
|
|
|
|
|
+ "%s_obj2txt"
|
|
|
|
|
+ );
|
|
|
|
|
+ public static List<String> meshNasNumPath = Arrays.asList(
|
|
|
|
|
+ "/mnt/4Dkankan/scene_v4/%s",
|
|
|
|
|
+ "/mnt/4Dkankan/scene/data/data%s",
|
|
|
|
|
+ "/mnt/4Dkankan/scene/images/images%s",
|
|
|
|
|
+ "/mnt/4Dkankan/scene/voice/voice%s"
|
|
|
|
|
+ );
|
|
|
|
|
+ private void delSource(String num,String dataSource){
|
|
|
|
|
+ try {
|
|
|
|
|
+ String active = manageConfig.getActive();
|
|
|
|
|
+ String laserOssPath = "laser_u_data/"+ num;
|
|
|
|
|
+ if(active.contains("prod")){
|
|
|
|
|
+ laserOssPath= "laser_p_data/"+ num;
|
|
|
|
|
+ }
|
|
|
|
|
+ log.info("del-scene:{},oss-path:{}",num,laserOssPath);
|
|
|
|
|
+ fYunFileServiceInterface.deleteFolder(laserOssPath);
|
|
|
|
|
+
|
|
|
|
|
+ String origPath = dataSource.replace("/mnt/data","home");
|
|
|
|
|
+ log.info("del-scene:{},oss-orig-path:{}",num,origPath);
|
|
|
|
|
+ fYunFileServiceInterface.deleteFolder(origPath);
|
|
|
|
|
+
|
|
|
|
|
+ for (String meshPath : meshOssPath) {
|
|
|
|
|
+ log.info("del-scene:{},oss-path:{}",num,String.format(meshPath,num));
|
|
|
|
|
+ fYunFileServiceInterface.deleteFolder(String.format(meshPath,num));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ for (String meshPath : meshNasNumPath) {
|
|
|
|
|
+ log.info("del-scene:{},nas-path:{}",num,String.format(meshPath,num));
|
|
|
|
|
+ FileUtil.del(String.format(meshPath,num));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if(StringUtils.isNotBlank(dataSource)){
|
|
|
|
|
+ log.info("del-scene:{},nas-path:{}",num,dataSource);
|
|
|
|
|
+ FileUtil.del(dataSource);
|
|
|
|
|
+ for (String meshPath : meshNasDataSourcePath) {
|
|
|
|
|
+ log.info("del-scene:{},nas-path:{}",num,String.format(meshPath,dataSource));
|
|
|
|
|
+ FileUtil.del(String.format(meshPath,dataSource));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ log.info("删除失败:{}",e);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|