|
@@ -0,0 +1,94 @@
|
|
|
+package com.fdkankan.job.job;
|
|
|
+
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
+import cn.hutool.core.io.FileUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
+import cn.hutool.extra.spring.SpringUtil;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.fdkankan.common.constant.PayStatus;
|
|
|
+import com.fdkankan.common.util.FileUtils;
|
|
|
+import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
|
+import com.fdkankan.job.entity.*;
|
|
|
+import com.fdkankan.job.service.*;
|
|
|
+import com.fdkankan.model.constants.ConstantFilePath;
|
|
|
+import com.fdkankan.model.constants.UploadFilePath;
|
|
|
+import com.fdkankan.redis.util.RedisUtil;
|
|
|
+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.stereotype.Component;
|
|
|
+
|
|
|
+import java.io.File;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+import java.util.stream.Stream;
|
|
|
+
|
|
|
+/**
|
|
|
+ * <p>
|
|
|
+ * v4场景回退v3
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @author dengsixing
|
|
|
+ * @since 2022/12/16
|
|
|
+ **/
|
|
|
+@Slf4j
|
|
|
+@Component
|
|
|
+public class RepairBucketHandler {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IScenePlusService scenePlusService;
|
|
|
+ @Autowired
|
|
|
+ private IScenePlusExtService scenePlusExtService;
|
|
|
+ @Autowired
|
|
|
+ private FYunFileServiceInterface fYunFileService;
|
|
|
+ @Autowired
|
|
|
+ private RedisUtil redisUtil;
|
|
|
+ @Autowired
|
|
|
+ private ISceneProService sceneProService;
|
|
|
+ @Autowired
|
|
|
+ private ISceneProEditService sceneProEditService;
|
|
|
+ @Autowired
|
|
|
+ ISceneEditInfoService sceneEditInfoService;
|
|
|
+
|
|
|
+
|
|
|
+ @XxlJob("repairBucketHandler")
|
|
|
+ public void repairBucketHandler(){
|
|
|
+ XxlJobHelper.log("repairBucketHandler start.....");
|
|
|
+
|
|
|
+ List<String> numList = null;
|
|
|
+ String nums = XxlJobHelper.getJobParam();
|
|
|
+ if(StrUtil.isNotEmpty(nums)){
|
|
|
+ numList = Arrays.asList(nums.split(","));
|
|
|
+ }
|
|
|
+ LambdaQueryWrapper<ScenePlusExt> condition = new LambdaQueryWrapper<ScenePlusExt>().eq(ScenePlusExt::getYunFileBucket, "test-4dkankan");
|
|
|
+ if(CollUtil.isNotEmpty(numList)){
|
|
|
+ List<ScenePlus> list = scenePlusService.list(new LambdaQueryWrapper<ScenePlus>().in(ScenePlus::getNum, numList));
|
|
|
+ List<Long> idList = list.stream().map(scenePlus -> {
|
|
|
+ return scenePlus.getId();
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ condition.in(ScenePlusExt::getPlusId, idList);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<ScenePlusExt> list = scenePlusExtService.list(condition);
|
|
|
+ list.parallelStream().forEach(ext->{
|
|
|
+ ScenePlus plus = scenePlusService.getById(ext.getPlusId());
|
|
|
+ String editPath = String.format(UploadFilePath.EDIT_PATH, plus.getNum());
|
|
|
+ String viewPath = String.format(UploadFilePath.VIEW_PATH, plus.getNum());
|
|
|
+ fYunFileService.copyFileBetweenBucket("test-4dkankan", editPath, "4dkankan", editPath);
|
|
|
+ fYunFileService.copyFileBetweenBucket("test-4dkankan", viewPath, "4dkankan", viewPath);
|
|
|
+ ext.setYunFileBucket("4dkankan");
|
|
|
+ scenePlusExtService.updateById(ext);
|
|
|
+ });
|
|
|
+ XxlJobHelper.log("repairBucketHandler end.....");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+}
|