|
@@ -1,8 +1,12 @@
|
|
package com.fdkankan.fusion.task;
|
|
package com.fdkankan.fusion.task;
|
|
|
|
|
|
|
|
+import cn.hutool.core.io.FileUtil;
|
|
|
|
+import cn.hutool.core.io.unit.DataSizeUtil;
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.fdkankan.fusion.common.util.DateUtils;
|
|
import com.fdkankan.fusion.common.util.DateUtils;
|
|
-import com.fdkankan.fusion.entity.CaseLive;
|
|
|
|
-import com.fdkankan.fusion.service.ICaseLiveService;
|
|
|
|
|
|
+import com.fdkankan.fusion.entity.*;
|
|
|
|
+import com.fdkankan.fusion.service.*;
|
|
import com.fdkankan.redis.util.RedisUtil;
|
|
import com.fdkankan.redis.util.RedisUtil;
|
|
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;
|
|
@@ -45,4 +49,63 @@ public class TaskService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ IModelService modelService;
|
|
|
|
+ @Autowired
|
|
|
|
+ ICommonUploadService commonUploadService;
|
|
|
|
+ @Autowired
|
|
|
|
+ IDictFileService dictFileService;
|
|
|
|
+ @Autowired
|
|
|
|
+ ITmUserService tmUserService;
|
|
|
|
+
|
|
|
|
+ public void modelToMedia(){
|
|
|
|
+ LambdaQueryWrapper<Model> wrapper = new LambdaQueryWrapper<>();
|
|
|
|
+ wrapper.eq(Model::getType,3);
|
|
|
|
+ wrapper.eq(Model::getCreateStatus,1);
|
|
|
|
+ wrapper.isNotNull(Model::getModelGlbUrl);
|
|
|
|
+ wrapper.isNotNull(Model::getUserName);
|
|
|
|
+ List<Model> list = modelService.list(wrapper);
|
|
|
|
+
|
|
|
|
+ LambdaQueryWrapper<CommonUpload> wrapper1 = new LambdaQueryWrapper<>();
|
|
|
|
+
|
|
|
|
+ for (Model model : list) {
|
|
|
|
+ TmUser tmUser = tmUserService.getByUserName(model.getUserName());
|
|
|
|
+ if(tmUser == null){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ String modelGlbUrl = model.getModelGlbUrl();
|
|
|
|
+ JSONArray jsonArray = JSONArray.parseArray(modelGlbUrl);
|
|
|
|
+ String fileUrl = (String) jsonArray.get(0);
|
|
|
|
+
|
|
|
|
+ wrapper1.eq(CommonUpload::getFileUrl,fileUrl);
|
|
|
|
+ List<CommonUpload> list1 = commonUploadService.list(wrapper1);
|
|
|
|
+ if(!list1.isEmpty()){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ CommonUpload commonUpload = new CommonUpload();
|
|
|
|
+ commonUpload.setFileName(model.getModelTitle());
|
|
|
|
+ commonUpload.setFileUrl(fileUrl);
|
|
|
|
+ commonUpload.setFileSize(String.valueOf(DataSizeUtil.parse(model.getModelSize())));
|
|
|
|
+ commonUpload.setNewFileName(model.getModelTitle());
|
|
|
|
+ commonUpload.setFileType(3);
|
|
|
|
+ commonUpload.setFileTypeStr("模型");
|
|
|
|
+ commonUpload.setFileFormat(model.getModelDateType());
|
|
|
|
+ commonUpload.setResultFileFormat(model.getModelType());
|
|
|
|
+ commonUpload.setStatus(1);
|
|
|
|
+ commonUpload.setUseType("ordinary");
|
|
|
|
+ commonUploadService.save(commonUpload);
|
|
|
|
+
|
|
|
|
+ DictFile dictFile = new DictFile();
|
|
|
|
+ dictFile.setName(model.getModelTitle());
|
|
|
|
+ dictFile.setTypeKey("media-library");
|
|
|
|
+ dictFile.setSysUserId(tmUser.getUserName());
|
|
|
|
+ dictFile.setUploadId(commonUpload.getId());
|
|
|
|
+ dictFile.setUseType("ordinary");
|
|
|
|
+ dictFileService.save(dictFile);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|