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()); 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<>(); QueryWrapper<ExportFile> qw = new QueryWrapper<>();
List<ExportFile> exportFiles = null; List<ExportFile> exportFiles = null;
if (Objects.nonNull(projectId)){ if (Objects.nonNull(projectId)){
qw.lambda().eq(ExportFile::getProjectId, projectId); qw.lambda().eq(ExportFile::getProjectId, projectId);
qw.lambda().eq(ExportFile::getModule, module); qw.lambda().eq(ExportFile::getModule, module);
exportFiles = exportFileMapper.selectList(qw); 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)) { if (CollectionUtil.isNotEmpty(exportFiles)) {
ExportFile exportFile = exportFiles.get(0); ExportFile exportFile = exportFiles.get(0);
exportFile.setUrl(upload); // 更新画布信息时只重新上传图片不用修改数据库url
exportFileMapper.updateById(exportFile); 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 { }else {
String upload = minioUtil.upload("aida-users", userHolder.getId() + "/exportFile", file);
ExportFile exportFile = new ExportFile(); ExportFile exportFile = new ExportFile();
exportFile.setProjectId(projectId); exportFile.setProjectId(projectId);
exportFile.setModule(module); exportFile.setModule(module);
@@ -1326,9 +1338,10 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
// 2. 删除主表数据 // 2. 删除主表数据
UpdateWrapper<ToProductImageResult> wrapper = new UpdateWrapper<>(); UpdateWrapper<ToProductImageResult> wrapper = new UpdateWrapper<>();
wrapper.eq("id", id) wrapper.lambda().eq(ToProductImageResult::getProjectId, projectId)
.eq("project_id", projectId) .eq(ToProductImageResult::getId, id).or().eq(ToProductImageResult::getElementId, id)
.set("is_deleted", 1); .set(ToProductImageResult::getIsDeleted, 1);
int update = toProductImageResultMapper.update(null, wrapper); int update = toProductImageResultMapper.update(null, wrapper);
log.info("删除 {} 结果, id={}, 影响行数={}", type, id, update); log.info("删除 {} 结果, id={}, 影响行数={}", type, id, update);