sketch暂时修改为java端推荐,根据style进行推荐

This commit is contained in:
litianxiang
2025-11-12 13:49:01 +08:00
parent 15f2b78c94
commit e4e6cfbff7
9 changed files with 88 additions and 35 deletions

View File

@@ -68,4 +68,6 @@ public interface WorkspaceService extends IService<Workspace> {
String getProjectSexById(Long projectId);
String getStyleByProjectId(Long projectId);
}

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;
@@ -802,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()));
@@ -827,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

@@ -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<>();