TASK:模块化;

This commit is contained in:
shahaibo
2025-03-31 11:21:45 +08:00
parent 2edf7d211b
commit a2bd2fa6c6
3 changed files with 46 additions and 30 deletions

View File

@@ -75,6 +75,8 @@ public class MyTaskScheduler {
@Resource @Resource
private UserLikeGroupService userLikeGroupService; private UserLikeGroupService userLikeGroupService;
@Resource
private ExportFileMapper exportFileMapper;
// 定时任务,每十五天执行一次 // 定时任务,每十五天执行一次
// @Scheduled(cron = "0 0 0 ? * MON") // @Scheduled(cron = "0 0 0 ? * MON")
@@ -1391,27 +1393,39 @@ public class MyTaskScheduler {
// userLikeGroup.setProjectId(project.getId()); // userLikeGroup.setProjectId(project.getId());
// userLikeGroupMapper.updateById(userLikeGroup); // userLikeGroupMapper.updateById(userLikeGroup);
// } // }
QueryWrapper<Project> projectQueryWrapper = new QueryWrapper<>(); // QueryWrapper<Project> projectQueryWrapper = new QueryWrapper<>();
List<Project> projects = projectMapper.selectList(projectQueryWrapper); // List<Project> projects = projectMapper.selectList(projectQueryWrapper);
for (Project project : projects) { // for (Project project : projects) {
UserLikeGroup userLikeGroup = userLikeGroupService.getByProjectId(project.getId()); // UserLikeGroup userLikeGroup = userLikeGroupService.getByProjectId(project.getId());
// if (Objects.nonNull(userLikeGroup)) {
// Long userLikeGroupId = userLikeGroup.getId();
// QueryWrapper<ToProductImageRecord> toProductImageRecordQueryWrapper = new QueryWrapper<>();
// toProductImageRecordQueryWrapper.lambda().eq(ToProductImageRecord::getUserLikeGroupId, userLikeGroupId);
// List<ToProductImageRecord> toProductImageRecords = toProductImageRecordMapper.selectList(toProductImageRecordQueryWrapper);
// for (ToProductImageRecord toProductImageRecord : toProductImageRecords) {
// toProductImageRecord.setProjectId(project.getId());
// toProductImageRecordMapper.updateById(toProductImageRecord);
// }
//
// QueryWrapper<ToProductImageResult> toProductImageResultQueryWrapper = new QueryWrapper<>();
// toProductImageResultQueryWrapper.lambda().eq(ToProductImageResult::getUserLikeGroupId, userLikeGroupId);
// List<ToProductImageResult> toProductImageResults = toProductImageResultMapper.selectList(toProductImageResultQueryWrapper);
// for (ToProductImageResult toProductImageResult : toProductImageResults) {
// toProductImageResult.setProjectId(project.getId());
// toProductImageResultMapper.updateById(toProductImageResult);
// }
// }
// }
QueryWrapper<ExportFile> exportFileQueryWrapper = new QueryWrapper<>();
exportFileQueryWrapper.lambda().ge(ExportFile::getId, 10);
exportFileQueryWrapper.lambda().le(ExportFile::getId, 86);
List<ExportFile> exportFiles = exportFileMapper.selectList(exportFileQueryWrapper);
for (ExportFile exportFile : exportFiles) {
Long userLikeGroupId = exportFile.getProjectId();
UserLikeGroup userLikeGroup = userLikeGroupMapper.selectById(userLikeGroupId);
if (Objects.nonNull(userLikeGroup)) { if (Objects.nonNull(userLikeGroup)) {
Long userLikeGroupId = userLikeGroup.getId(); exportFile.setProjectId(userLikeGroup.getProjectId());
QueryWrapper<ToProductImageRecord> toProductImageRecordQueryWrapper = new QueryWrapper<>(); exportFileMapper.updateById(exportFile);
toProductImageRecordQueryWrapper.lambda().eq(ToProductImageRecord::getUserLikeGroupId, userLikeGroupId);
List<ToProductImageRecord> toProductImageRecords = toProductImageRecordMapper.selectList(toProductImageRecordQueryWrapper);
for (ToProductImageRecord toProductImageRecord : toProductImageRecords) {
toProductImageRecord.setProjectId(project.getId());
toProductImageRecordMapper.updateById(toProductImageRecord);
}
QueryWrapper<ToProductImageResult> toProductImageResultQueryWrapper = new QueryWrapper<>();
toProductImageResultQueryWrapper.lambda().eq(ToProductImageResult::getUserLikeGroupId, userLikeGroupId);
List<ToProductImageResult> toProductImageResults = toProductImageResultMapper.selectList(toProductImageResultQueryWrapper);
for (ToProductImageResult toProductImageResult : toProductImageResults) {
toProductImageResult.setProjectId(project.getId());
toProductImageResultMapper.updateById(toProductImageResult);
}
} }
} }
} }

View File

@@ -33,7 +33,7 @@ public class ThreeDSave {
private void minioSave() { private void minioSave() {
// 指定目标文件夹路径 // 指定目标文件夹路径
String folderPath = "C:\\workspace\\3D\\3D虚拟 1-7\\3D服装整理\\femaleZip"; String folderPath = "C:\\workspace\\3D\\3D虚拟 1-7\\3D服装整理\\maleZip";
// 创建文件对象 // 创建文件对象
File folder = new File(folderPath); File folder = new File(folderPath);
@@ -65,8 +65,8 @@ public class ThreeDSave {
ThreeDDetail threeDDetail = new ThreeDDetail(); ThreeDDetail threeDDetail = new ThreeDDetail();
threeDDetail.setName(zipFileName); threeDDetail.setName(zipFileName);
String url = "aida-threed/female/zip/" + zipFileName; String url = "aida-threed/male/zip/" + zipFileName;
threeDDetail.setGender("female"); threeDDetail.setGender("male");
threeDDetail.setSizeType(prefix); threeDDetail.setSizeType(prefix);
threeDDetail.setSize(suffix); threeDDetail.setSize(suffix);
threeDDetail.setUrl(url); threeDDetail.setUrl(url);
@@ -75,15 +75,15 @@ public class ThreeDSave {
QueryWrapper<ThreeDSimple> qw = new QueryWrapper<>(); QueryWrapper<ThreeDSimple> qw = new QueryWrapper<>();
qw.lambda().eq(ThreeDSimple::getName, zipName); qw.lambda().eq(ThreeDSimple::getName, zipName);
qw.lambda().eq(ThreeDSimple::getGender, "female"); qw.lambda().eq(ThreeDSimple::getGender, "male");
List<ThreeDSimple> threeDSimples = threeDSimpleMapper.selectList(qw); List<ThreeDSimple> threeDSimples = threeDSimpleMapper.selectList(qw);
if (CollectionUtils.isEmpty(threeDSimples)) { if (CollectionUtils.isEmpty(threeDSimples)) {
ThreeDSimple threeDSimple = new ThreeDSimple(); ThreeDSimple threeDSimple = new ThreeDSimple();
threeDSimple.setName(zipName); threeDSimple.setName(zipName);
threeDSimple.setGender("female"); threeDSimple.setGender("male");
String glbPath = "C:\\workspace\\3D\\3D虚拟 1-7\\3D服装整理\\female\\" + zipName + "\\" +"亚码L"; String glbPath = "C:\\workspace\\3D\\3D虚拟 1-7\\3D服装整理\\male\\" + zipName + "\\" +"亚码L";
File glbFolder = new File(glbPath); File glbFolder = new File(glbPath);
// 查找 .glb 文件 // 查找 .glb 文件
@@ -92,7 +92,7 @@ public class ThreeDSave {
if (glbFiles != null && glbFiles.length > 0) { if (glbFiles != null && glbFiles.length > 0) {
for (File glbFile : glbFiles) { for (File glbFile : glbFiles) {
String name = glbFile.getName(); String name = glbFile.getName();
String glbUrl = "aida-threed/female/glb/" + name; String glbUrl = "aida-threed/male/glb/" + name;
threeDSimple.setUrl(glbUrl); threeDSimple.setUrl(glbUrl);
minioUtil.upload(glbUrl, glbFile); minioUtil.upload(glbUrl, glbFile);
} }

View File

@@ -701,9 +701,11 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
JSONObject custom = jsonObjectLevel1.getJSONObject("custom"); JSONObject custom = jsonObjectLevel1.getJSONObject("custom");
if (custom.getString("type").equals("init")) { if (custom.getString("type").equals("init")) {
String minioUrl = jsonObjectLevel1.getString("minioUrl"); String minioUrl = jsonObjectLevel1.getString("minioUrl");
JSONObject fill = jsonObjectLevel1.getJSONObject("fill"); if (!StringUtils.isEmpty(minioUrl)) {
fill.put("source", minioUtil.getPreSignedUrl(minioUrl, 24 * 60)); JSONObject fill = jsonObjectLevel1.getJSONObject("fill");
jsonObjectLevel1.put("fill", fill); fill.put("source", minioUtil.getPreSignedUrl(minioUrl, 24 * 60));
jsonObjectLevel1.put("fill", fill);
}
} }
} }
objectJSONArrayLevel1.set(i, jsonObjectLevel1); objectJSONArrayLevel1.set(i, jsonObjectLevel1);