Merge remote-tracking branch 'origin/dev-ltx' into dev/3.1_release_merge

This commit is contained in:
litianxiang
2025-11-12 13:50:14 +08:00
23 changed files with 119 additions and 45 deletions

View File

@@ -82,7 +82,7 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
@Resource
private MinioUtil minioUtil;
private WorkspaceService workspaceService;
private final WorkspaceService workspaceService;
@Value("${minio.bucketName.collectionElement}")
private String collectionElement;
@@ -644,7 +644,7 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
if (result) {
throw new BusinessException("sketchBoards.designType.cannot.be.empty");
}
List<CollectionElement> sketchBoardElements = new ArrayList<>();
// 提取类型为COLLECTION的sketchBoard ID列表
List<Long> sketchBoardIds = designDTO.getSketchBoards().stream()
.filter(f -> f.getDesignType().equals(DesignTypeEnum.COLLECTION.getRealName()))
@@ -652,12 +652,12 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
.collect(Collectors.toList());
if (!CollectionUtils.isEmpty(sketchBoardIds)) {
// 从数据库查询验证sketchBoard元素是否存在
List<CollectionElement> sketchBoardElements = collectionElementMapper.selectBatchIds(sketchBoardIds);
sketchBoardElements = collectionElementMapper.selectBatchIds(sketchBoardIds);
if (CollectionUtil.isEmpty(sketchBoardElements) || sketchBoardElements.size() != sketchBoardIds.size()) {
throw new BusinessException("get.sketchBoards.data.is.mismatch");
}
// 设置验证通过的sketchBoard元素到结果对象
elementVO.setSketchBoardElements(sketchBoardElements);
// 记录已使用的元素ID
usedElementIds.addAll(sketchBoardIds);
}
@@ -675,7 +675,9 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
Map<Long, CollectionSketchDTO> idToMap = designDTO.getSketchBoards()
.stream()
.collect(Collectors.toMap(CollectionSketchDTO::getSketchBoardId, v -> v));
libraryCollectionElements.addAll(covertLibrarysToCollections(librarys, idToMap));
List<CollectionElement> librarysToCollections = covertLibrarysToCollections(librarys, idToMap);
libraryCollectionElements.addAll(librarysToCollections);
sketchBoardElements.addAll(librarysToCollections);
}
}
@@ -691,9 +693,13 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
Map<Long, CollectionSketchDTO> idToMap = designDTO.getSketchBoards()
.stream()
.collect(Collectors.toMap(CollectionSketchDTO::getSketchBoardId, v -> v));
generateCollectionElements.addAll(covertGeneratesToCollections(generateDetailList, idToMap));
List<CollectionElement> generatesToCollections = covertGeneratesToCollections(generateDetailList, idToMap);
generateCollectionElements.addAll(generatesToCollections);
sketchBoardElements.addAll(generatesToCollections);
}
}
// 设置验证通过的sketchBoard元素到结果对象
elementVO.setSketchBoardElements(sketchBoardElements);
}
}
//校验marketingSketch
@@ -796,7 +802,7 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
SysFileVO byId = sysFileService.getById(designDTO.getTemplateId());
// 设置女性模特的风格类型
if (Objects.nonNull(byId) && !StringUtils.isEmpty(byId.getLevel3Type()) && byId.getLevel2Type().equals("Female")) {
elementVO.setStyle(byId.getLevel3Type());
// elementVO.setStyle(byId.getLevel3Type());
}
LibraryModelPoint modelPoint = libraryModelPointService.getByRelationId(byId.getId(), designDTO.getModelType());
elementVO.setDesignLibraryModelPoint(calculateTemplatePointTemplate(modelPoint, 700, 320, byId.getUrl()));
@@ -821,6 +827,10 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
elementVO.setBrandScale(designDTO.getBrandScale()); // 设置品牌比例
}
//设置风格
String style = workspaceService.getStyleByProjectId(designDTO.getProjectId());
elementVO.setStyle(style);
// 返回验证结果对象
return elementVO;
}

View File

@@ -1456,7 +1456,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
response.setHighDesignUrl(designItem.getHighDesignUrl());
List<DesignItemDetail> filterDetail = designItemDetails.stream()
.filter(f -> OUTWEAR_DRESS_BLOUSE.contains(f.getType()) || SKIRT_TROUSERS.contains(f.getType())
|| TOPS.contains(f.getType()) || BOTTOMS.contains(f.getType()))
|| TOPS.contains(f.getType()) || BOTTOMS.contains(f.getType())|| OTHERS.contains(f.getType()))
.collect(Collectors.toList());
response.setClothes(CopyUtil.copyList(filterDetail, DesignItemClothesDetailVO.class, (o, d) -> {
d.setId(o.getId());

View File

@@ -867,6 +867,9 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
if (base64Data != null && !base64Data.isEmpty()) {
String resultPath = userId + "/product_image" + "/" + uuid;
String minioPath = minioUtil.base64UploadToPath("data:image/png;base64," + base64Data, userBucket, resultPath);
if (StringUtil.isNullOrEmpty(minioPath)){
log.warn("Google API调用成功但图片保存失败 for taskId: {}", taskId);
}
// 生成成功更新Redis状态和URL
GenerateResultVO successResultVO = new GenerateResultVO(taskId, null, minioPath, "Success");
redisUtil.addToString(key, new Gson().toJson(successResultVO), CommonConstant.GENERATE_RESULT_EXPIRE_TIME);
@@ -1495,9 +1498,6 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
GenerateResultVO successResultVO = new GenerateResultVO(taskId, null, imageUrl, "Success");
redisUtil.addToString(key, new Gson().toJson(successResultVO), CommonConstant.GENERATE_RESULT_EXPIRE_TIME);
// TODO: 处理积分扣除逻辑
} catch (Exception e) {
log.error("Doubao image generation failed for taskId: {}", taskId, e);
LambdaQueryWrapper<Account> select = new LambdaQueryWrapper<Account>().eq(Account::getId, userId).select(Account::getLanguage);

View File

@@ -898,6 +898,11 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
return null;
}
@Override
public String getStyleByProjectId(Long projectId) {
return workspaceMapper.getStyleByProjectId(projectId);
}
// 由于在数据库中表设计问题,目前只能通过路径来判断项目中是否存在某一个模特
public Boolean checkIfModelExistsInProject(String md5, Long projectId) {
QueryWrapper<CollectionElement> qw = new QueryWrapper<>();