BUGFIX: 1、修改画布时,不再上传新文件,改为覆盖原文件

2、删除toProduct relight结果时没删干净导致获取源文件失败
This commit is contained in:
2025-07-29 15:00:13 +08:00
parent 020cfe9016
commit 0fcd8e5444

View File

@@ -361,20 +361,32 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
throw new BusinessException("project id cannot be empty", ResultEnum.PROMPT.getCode());
}
String upload = minioUtil.upload("aida-users", userHolder.getId() + "/exportFile", file);
QueryWrapper<ExportFile> qw = new QueryWrapper<>();
List<ExportFile> exportFiles = null;
if (Objects.nonNull(projectId)){
qw.lambda().eq(ExportFile::getProjectId, projectId);
qw.lambda().eq(ExportFile::getModule, module);
exportFiles = exportFileMapper.selectList(qw);
} else if (Objects.nonNull(designItemDetailId)){
DesignItemDetailCanvas designItemDetailCanvas = designItemDetailService.getDIDCByDesignItemDetailId(designItemDetailId);
if (Objects.nonNull(designItemDetailCanvas) && Objects.nonNull(designItemDetailCanvas.getExportFileId())){
qw.lambda().eq(ExportFile::getId, designItemDetailCanvas.getExportFileId());
qw.lambda().eq(ExportFile::getModule, module);
exportFiles = exportFileMapper.selectList(qw);
}
}
// String upload = minioUtil.upload("aida-users", userHolder.getId() + "/exportFile", file);
if (CollectionUtil.isNotEmpty(exportFiles)) {
ExportFile exportFile = exportFiles.get(0);
exportFile.setUrl(upload);
exportFileMapper.updateById(exportFile);
// 更新画布信息时只重新上传图片不用修改数据库url
String url = exportFile.getUrl();
String path = url.substring(url.indexOf("/") + 1);
minioUtil.upload("aida-users", path, file, null);
// exportFile.setUrl(upload);
// exportFileMapper.updateById(exportFile);
}else {
String upload = minioUtil.upload("aida-users", userHolder.getId() + "/exportFile", file);
ExportFile exportFile = new ExportFile();
exportFile.setProjectId(projectId);
exportFile.setModule(module);
@@ -1326,9 +1338,10 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
// 2. 删除主表数据
UpdateWrapper<ToProductImageResult> wrapper = new UpdateWrapper<>();
wrapper.eq("id", id)
.eq("project_id", projectId)
.set("is_deleted", 1);
wrapper.lambda().eq(ToProductImageResult::getProjectId, projectId)
.eq(ToProductImageResult::getId, id).or().eq(ToProductImageResult::getElementId, id)
.set(ToProductImageResult::getIsDeleted, 1);
int update = toProductImageResultMapper.update(null, wrapper);
log.info("删除 {} 结果, id={}, 影响行数={}", type, id, update);