|
@@ -1,24 +1,32 @@
|
|
|
package com.fdkankan.fusion.task;
|
|
|
|
|
|
+import cn.hutool.core.io.FileUtil;
|
|
|
import com.fdkankan.fusion.common.util.DateUtils;
|
|
|
+import com.fdkankan.fusion.common.util.UploadToOssUtil;
|
|
|
import com.fdkankan.fusion.entity.CaseLive;
|
|
|
import com.fdkankan.fusion.entity.CommonUpload;
|
|
|
import com.fdkankan.fusion.service.ICaseLiveService;
|
|
|
import com.fdkankan.fusion.service.ICommonUploadService;
|
|
|
+import com.fdkankan.fusion.service.IDictFileService;
|
|
|
+import com.fdkankan.fusion.service.IDictService;
|
|
|
import com.fdkankan.redis.util.RedisUtil;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
|
|
import javax.annotation.PostConstruct;
|
|
|
+import java.io.File;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Set;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
import static com.fdkankan.fusion.down.CaseDownService.downProcessKey;
|
|
|
|
|
|
@Service
|
|
|
+@Slf4j
|
|
|
public class TaskService {
|
|
|
|
|
|
@Autowired
|
|
@@ -36,5 +44,46 @@ public class TaskService {
|
|
|
redisUtil.del(key);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ checkSystemModel();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ ICommonUploadService commonUploadService;
|
|
|
+ @Autowired
|
|
|
+ IDictFileService dictFileService;
|
|
|
+
|
|
|
+ private void checkSystemModel() {
|
|
|
+ try {
|
|
|
+ log.info("检查是否存在系统默认动画模型");
|
|
|
+ String dfModel = "/oss/4dkankan/fusion/default/model/glb";
|
|
|
+
|
|
|
+ List<CommonUpload> uploadList = commonUploadService.getIsSystem();
|
|
|
+ File file = new File(dfModel);
|
|
|
+ File[] files = file.listFiles();
|
|
|
+ if(files == null || files.length <=0){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(files.length != uploadList.size()){
|
|
|
+ List<String> dbUrlList = uploadList.stream().map(CommonUpload::getFileUrl).collect(Collectors.toList());
|
|
|
+ for (File s : files) {
|
|
|
+ String path = s.getPath();
|
|
|
+ String name = FileUtil.mainName(s);
|
|
|
+ path = path.replace("4dkankan/","");
|
|
|
+ if(dbUrlList.contains(path)){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ log.info(path);
|
|
|
+ CommonUpload commonUpload = commonUploadService.addSystemFile(path,s.length(),name);
|
|
|
+ if(commonUpload != null){
|
|
|
+ dictFileService.addSystemFile(commonUpload);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ log.info("检查是否存在系统默认动画模型:{}",e);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
}
|