BUGFIX
This commit is contained in:
@@ -253,32 +253,7 @@ public class SavedCollectionController {
|
|||||||
@Operation(summary = "relight")
|
@Operation(summary = "relight")
|
||||||
@PostMapping("/relight")
|
@PostMapping("/relight")
|
||||||
public Response<List<ToProductImageResultVO>> relight(@Valid @RequestBody ToProductImageDTO toProductImageDTO) {
|
public Response<List<ToProductImageResultVO>> relight(@Valid @RequestBody ToProductImageDTO toProductImageDTO) {
|
||||||
log.info("【relight请求】收到relight请求, projectId={}, isDefaultLike={}, taskCount={}",
|
return Response.success(userLikeGroupService.relight(toProductImageDTO));
|
||||||
toProductImageDTO.getProjectId(),
|
|
||||||
toProductImageDTO.getIsDefaultLike(),
|
|
||||||
toProductImageDTO.getToProductImageVOList() != null ? toProductImageDTO.getToProductImageVOList().size() : 0);
|
|
||||||
long startTime = System.currentTimeMillis();
|
|
||||||
List<ToProductImageResultVO> result = userLikeGroupService.relight(toProductImageDTO);
|
|
||||||
long costTime = System.currentTimeMillis() - startTime;
|
|
||||||
log.info("【relight请求】relight请求处理完成, projectId={}, 返回结果数={}, 耗时={}ms",
|
|
||||||
toProductImageDTO.getProjectId(),
|
|
||||||
result != null ? result.size() : 0,
|
|
||||||
costTime);
|
|
||||||
// 打印返回结果中的关键信息,用于追踪 collection_sort 变动
|
|
||||||
if (result != null) {
|
|
||||||
for (int i = 0; i < result.size(); i++) {
|
|
||||||
ToProductImageResultVO vo = result.get(i);
|
|
||||||
log.info("【relight请求】第{}个结果: id={}, taskId={}, isLike={}, parentId={}, sort={}, status={}",
|
|
||||||
i + 1,
|
|
||||||
vo.getId(),
|
|
||||||
vo.getTaskId(),
|
|
||||||
vo.getIsLike(),
|
|
||||||
vo.getParentId(),
|
|
||||||
vo.getSort(),
|
|
||||||
vo.getStatus());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Response.success(result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "转relight元素")
|
@Operation(summary = "转relight元素")
|
||||||
@@ -290,27 +265,7 @@ public class SavedCollectionController {
|
|||||||
@Operation(summary = "获取relight结果")
|
@Operation(summary = "获取relight结果")
|
||||||
@PostMapping("/relightResult")
|
@PostMapping("/relightResult")
|
||||||
public Response<List<MagicToolResultVO>> getRelightResult(@Valid @RequestBody List<String> taskIdList) {
|
public Response<List<MagicToolResultVO>> getRelightResult(@Valid @RequestBody List<String> taskIdList) {
|
||||||
log.info("【getRelightResult请求】收到获取relight结果请求, taskIdList={}", taskIdList);
|
|
||||||
long startTime = System.currentTimeMillis();
|
|
||||||
List<MagicToolResultVO> magicToolResultVOList = userLikeGroupService.getRelightResult(taskIdList);
|
List<MagicToolResultVO> magicToolResultVOList = userLikeGroupService.getRelightResult(taskIdList);
|
||||||
long costTime = System.currentTimeMillis() - startTime;
|
|
||||||
log.info("【getRelightResult请求】获取relight结果处理完成, taskIdList={}, 返回结果数={}, 耗时={}ms",
|
|
||||||
taskIdList,
|
|
||||||
magicToolResultVOList != null ? magicToolResultVOList.size() : 0,
|
|
||||||
costTime);
|
|
||||||
// 打印返回结果中的关键信息,用于追踪 collection_sort 变动
|
|
||||||
if (magicToolResultVOList != null) {
|
|
||||||
for (int i = 0; i < magicToolResultVOList.size(); i++) {
|
|
||||||
MagicToolResultVO vo = magicToolResultVOList.get(i);
|
|
||||||
log.info("【getRelightResult请求】第{}个结果: taskId={}, status={}, id={}, parentId={}, url={}",
|
|
||||||
i + 1,
|
|
||||||
vo.getTaskId(),
|
|
||||||
vo.getStatus(),
|
|
||||||
vo.getId(),
|
|
||||||
vo.getParentId(),
|
|
||||||
vo.getUrl() != null ? (vo.getUrl().length() > 50 ? vo.getUrl().substring(0, 50) + "..." : vo.getUrl()) : null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Response.success(magicToolResultVOList);
|
return Response.success(magicToolResultVOList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1305,7 +1305,6 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
toProductImageRecord.setPrompt(toProductImageDTO.getPrompt());
|
toProductImageRecord.setPrompt(toProductImageDTO.getPrompt());
|
||||||
}
|
}
|
||||||
toProductImageRecordMapper.insert(toProductImageRecord);
|
toProductImageRecordMapper.insert(toProductImageRecord);
|
||||||
log.info("【relight方法】插入to_product_image_record记录, recordId={}", toProductImageRecord.getId());
|
|
||||||
|
|
||||||
List<ToProductImageResultVO> result = new ArrayList<>();
|
List<ToProductImageResultVO> result = new ArrayList<>();
|
||||||
|
|
||||||
@@ -1353,30 +1352,20 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
toProductImageResult.setResultType(CollectionType.RELIGHT.getValue());
|
toProductImageResult.setResultType(CollectionType.RELIGHT.getValue());
|
||||||
toProductImageResult.setStatus("Pending");
|
toProductImageResult.setStatus("Pending");
|
||||||
toProductImageResultMapper.insert(toProductImageResult);
|
toProductImageResultMapper.insert(toProductImageResult);
|
||||||
log.info("【relight方法】插入to_product_image_result记录, resultId={}, taskId={}, elementType={}, elementId={}, isDefaultLike={}, parentId={}",
|
|
||||||
toProductImageResult.getId(), taskId, toProductImageResult.getElementType(),
|
|
||||||
toProductImageResult.getElementId(), toProductImageDTO.getIsDefaultLike(), toProductImageVO.getParentId());
|
|
||||||
// toProductImageResult.setUrl(minioUtil.getPresignedUrl(toProductImageResult.getUrl(), 24 * 60));
|
// toProductImageResult.setUrl(minioUtil.getPresignedUrl(toProductImageResult.getUrl(), 24 * 60));
|
||||||
// 先判断是否需要默认like
|
// 先判断是否需要默认like
|
||||||
if (Objects.nonNull(toProductImageDTO.getIsDefaultLike()) && toProductImageDTO.getIsDefaultLike()) {
|
if (Objects.nonNull(toProductImageDTO.getIsDefaultLike()) && toProductImageDTO.getIsDefaultLike()) {
|
||||||
// 满足条件情况下默认添加到like
|
// 满足条件情况下默认添加到like
|
||||||
log.info("【relight方法】isDefaultLike=true,准备添加collection_sort记录, resultId={}, parentId={}, projectId={}",
|
|
||||||
toProductImageResult.getId(), toProductImageVO.getParentId(), toProductImageDTO.getProjectId());
|
|
||||||
CollectionSort collectionSort = addToProductLike(toProductImageVO.getParentId(), toProductImageResult.getId(), toProductImageDTO.getProjectId());
|
CollectionSort collectionSort = addToProductLike(toProductImageVO.getParentId(), toProductImageResult.getId(), toProductImageDTO.getProjectId());
|
||||||
log.info("【relight方法】addToProductLike返回结果, resultId={}, collectionSort={}",
|
|
||||||
toProductImageResult.getId(), collectionSort != null ? "id=" + collectionSort.getId() + ", sort=" + collectionSort.getSort() : "null");
|
|
||||||
// 重新排序
|
// 重新排序
|
||||||
Integer reSort = collectionSortService.rearrangeChildSort(toProductImageResult.getId(), CollectionType.RELIGHT.getValue(),
|
Integer reSort = collectionSortService.rearrangeChildSort(toProductImageResult.getId(), CollectionType.RELIGHT.getValue(),
|
||||||
toProductImageVO.getParentId(), toProductImageVO.getUserLikeSortId());
|
toProductImageVO.getParentId(), toProductImageVO.getUserLikeSortId());
|
||||||
log.info("【relight方法】rearrangeChildSort返回结果, resultId={}, reSort={}", toProductImageResult.getId(), reSort);
|
|
||||||
// 将生成结果的排序返回
|
// 将生成结果的排序返回
|
||||||
toProductImageResult.setSort(Objects.isNull(reSort) ? Objects.isNull(collectionSort) ? null : collectionSort.getSort() : reSort);
|
toProductImageResult.setSort(Objects.isNull(reSort) ? Objects.isNull(collectionSort) ? null : collectionSort.getSort() : reSort);
|
||||||
toProductImageResult.setParentId(toProductImageVO.getParentId());
|
toProductImageResult.setParentId(toProductImageVO.getParentId());
|
||||||
toProductImageResult.setUserLikeSortId(Objects.isNull(collectionSort) ? null : collectionSort.getId());
|
toProductImageResult.setUserLikeSortId(Objects.isNull(collectionSort) ? null : collectionSort.getId());
|
||||||
} else if (Objects.nonNull(toProductImageDTO.getIsDefaultLike()) && Objects.nonNull(toProductImageVO.getParentId())) {
|
} else if (Objects.nonNull(toProductImageDTO.getIsDefaultLike()) && Objects.nonNull(toProductImageVO.getParentId())) {
|
||||||
toProductImageResult.setParentId(toProductImageVO.getParentId());
|
toProductImageResult.setParentId(toProductImageVO.getParentId());
|
||||||
log.info("【relight方法】isDefaultLike存在但不为true,不添加collection_sort记录, resultId={}, isDefaultLike={}, parentId={}",
|
|
||||||
toProductImageResult.getId(), toProductImageDTO.getIsDefaultLike(), toProductImageVO.getParentId());
|
|
||||||
// 默认不添加到like,但是需要有parentId,所以这里添加到collectionSort表中
|
// 默认不添加到like,但是需要有parentId,所以这里添加到collectionSort表中
|
||||||
// designService.addCollectionSort(toProductImageResult.getId(), CollectionType.RELIGHT.getValue(), toProductImageDTO.getProjectId(), toProductImageVO.getParentId());
|
// designService.addCollectionSort(toProductImageResult.getId(), CollectionType.RELIGHT.getValue(), toProductImageDTO.getProjectId(), toProductImageVO.getParentId());
|
||||||
}
|
}
|
||||||
@@ -1410,30 +1399,20 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
toProductImageResult.setResultType(CollectionType.RELIGHT.getValue());
|
toProductImageResult.setResultType(CollectionType.RELIGHT.getValue());
|
||||||
toProductImageResult.setStatus("Pending");
|
toProductImageResult.setStatus("Pending");
|
||||||
toProductImageResultMapper.insert(toProductImageResult);
|
toProductImageResultMapper.insert(toProductImageResult);
|
||||||
log.info("【relight方法】插入to_product_image_result记录, resultId={}, taskId={}, elementType={}, elementId={}, isDefaultLike={}, parentId={}",
|
|
||||||
toProductImageResult.getId(), taskId, toProductImageResult.getElementType(),
|
|
||||||
toProductImageResult.getElementId(), toProductImageDTO.getIsDefaultLike(), toProductImageVO.getParentId());
|
|
||||||
// toProductImageResult.setUrl(minioUtil.getPresignedUrl(toProductImageResult.getUrl(), 24 * 60));
|
// toProductImageResult.setUrl(minioUtil.getPresignedUrl(toProductImageResult.getUrl(), 24 * 60));
|
||||||
// 先判断是否需要默认like
|
// 先判断是否需要默认like
|
||||||
if (Objects.nonNull(toProductImageDTO.getIsDefaultLike()) && toProductImageDTO.getIsDefaultLike()) {
|
if (Objects.nonNull(toProductImageDTO.getIsDefaultLike()) && toProductImageDTO.getIsDefaultLike()) {
|
||||||
// 满足条件情况下默认添加到like
|
// 满足条件情况下默认添加到like
|
||||||
log.info("【relight方法】isDefaultLike=true,准备添加collection_sort记录, resultId={}, parentId={}, projectId={}",
|
|
||||||
toProductImageResult.getId(), toProductImageVO.getParentId(), toProductImageDTO.getProjectId());
|
|
||||||
CollectionSort collectionSort = addToProductLike(toProductImageVO.getParentId(), toProductImageResult.getId(), toProductImageDTO.getProjectId());
|
CollectionSort collectionSort = addToProductLike(toProductImageVO.getParentId(), toProductImageResult.getId(), toProductImageDTO.getProjectId());
|
||||||
log.info("【relight方法】addToProductLike返回结果, resultId={}, collectionSort={}",
|
|
||||||
toProductImageResult.getId(), collectionSort != null ? "id=" + collectionSort.getId() + ", sort=" + collectionSort.getSort() : "null");
|
|
||||||
// 重新排序
|
// 重新排序
|
||||||
Integer reSort = collectionSortService.rearrangeChildSort(toProductImageResult.getId(), CollectionType.RELIGHT.getValue(),
|
Integer reSort = collectionSortService.rearrangeChildSort(toProductImageResult.getId(), CollectionType.RELIGHT.getValue(),
|
||||||
toProductImageVO.getParentId(), toProductImageVO.getUserLikeSortId());
|
toProductImageVO.getParentId(), toProductImageVO.getUserLikeSortId());
|
||||||
log.info("【relight方法】rearrangeChildSort返回结果, resultId={}, reSort={}", toProductImageResult.getId(), reSort);
|
|
||||||
// 将生成结果的排序返回
|
// 将生成结果的排序返回
|
||||||
toProductImageResult.setSort(Objects.isNull(reSort) ? Objects.isNull(collectionSort) ? null : collectionSort.getSort() : reSort);
|
toProductImageResult.setSort(Objects.isNull(reSort) ? Objects.isNull(collectionSort) ? null : collectionSort.getSort() : reSort);
|
||||||
toProductImageResult.setParentId(toProductImageVO.getParentId());
|
toProductImageResult.setParentId(toProductImageVO.getParentId());
|
||||||
toProductImageResult.setUserLikeSortId(Objects.isNull(collectionSort) ? null : collectionSort.getId());
|
toProductImageResult.setUserLikeSortId(Objects.isNull(collectionSort) ? null : collectionSort.getId());
|
||||||
} else if (Objects.nonNull(toProductImageDTO.getIsDefaultLike()) && Objects.nonNull(toProductImageVO.getParentId())) {
|
} else if (Objects.nonNull(toProductImageDTO.getIsDefaultLike()) && Objects.nonNull(toProductImageVO.getParentId())) {
|
||||||
toProductImageResult.setParentId(toProductImageVO.getParentId());
|
toProductImageResult.setParentId(toProductImageVO.getParentId());
|
||||||
log.info("【relight方法】isDefaultLike存在但不为true,不添加collection_sort记录, resultId={}, isDefaultLike={}, parentId={}",
|
|
||||||
toProductImageResult.getId(), toProductImageDTO.getIsDefaultLike(), toProductImageVO.getParentId());
|
|
||||||
// 默认不添加到like,但是需要有parentId,所以这里添加到collectionSort表中
|
// 默认不添加到like,但是需要有parentId,所以这里添加到collectionSort表中
|
||||||
// designService.addCollectionSort(toProductImageResult.getId(), CollectionType.RELIGHT.getValue(), toProductImageDTO.getProjectId(), toProductImageVO.getParentId());
|
// designService.addCollectionSort(toProductImageResult.getId(), CollectionType.RELIGHT.getValue(), toProductImageDTO.getProjectId(), toProductImageVO.getParentId());
|
||||||
}
|
}
|
||||||
@@ -1446,7 +1425,6 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
}
|
}
|
||||||
// 更新项目更新时间
|
// 更新项目更新时间
|
||||||
projectService.modifyProjectUpdateTime(toProductImageDTO.getProjectId());
|
projectService.modifyProjectUpdateTime(toProductImageDTO.getProjectId());
|
||||||
log.info("【relight方法】relight方法执行完成, projectId={}, 生成结果数量={}", projectId, result.size());
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1455,79 +1433,46 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
List<MagicToolResultVO> results = new ArrayList<>();
|
List<MagicToolResultVO> results = new ArrayList<>();
|
||||||
Set<String> collect = new HashSet<>();
|
Set<String> collect = new HashSet<>();
|
||||||
taskIdList.forEach(taskId -> {
|
taskIdList.forEach(taskId -> {
|
||||||
log.info("【getRelightResult方法】开始处理taskId={}", taskId);
|
|
||||||
QueryWrapper<ToProductImageResult> qw = new QueryWrapper<>();
|
QueryWrapper<ToProductImageResult> qw = new QueryWrapper<>();
|
||||||
qw.lambda().eq(ToProductImageResult::getTaskId, taskId);
|
qw.lambda().eq(ToProductImageResult::getTaskId, taskId);
|
||||||
ToProductImageResult toProductImageResult = toProductImageResultMapper.selectOne(qw);
|
ToProductImageResult toProductImageResult = toProductImageResultMapper.selectOne(qw);
|
||||||
if (Objects.isNull(toProductImageResult)) {
|
if (Objects.isNull(toProductImageResult)) {
|
||||||
log.error("【getRelightResult方法】未找到toProductImageResult记录, taskId={}", taskId);
|
|
||||||
throw new BusinessException("source.image.does.not.exist");
|
throw new BusinessException("source.image.does.not.exist");
|
||||||
}
|
}
|
||||||
log.info("【getRelightResult方法】找到toProductImageResult记录, id={}, taskId={}, status={}, modelName={}, isLike={}",
|
|
||||||
toProductImageResult.getId(), taskId, toProductImageResult.getStatus(),
|
|
||||||
toProductImageResult.getModelName(), toProductImageResult.getIsLike());
|
|
||||||
|
|
||||||
// 查询collection_sort记录,用于追踪
|
|
||||||
QueryWrapper<CollectionSort> sortQw = new QueryWrapper<>();
|
|
||||||
sortQw.lambda().eq(CollectionSort::getRelationId, toProductImageResult.getId())
|
|
||||||
.eq(CollectionSort::getRelationType, CollectionType.RELIGHT.getValue());
|
|
||||||
List<CollectionSort> beforeSorts = collectionSortMapper.selectList(sortQw);
|
|
||||||
log.info("【getRelightResult方法】处理前collection_sort记录数={}, resultId={}", beforeSorts.size(), toProductImageResult.getId());
|
|
||||||
if (!beforeSorts.isEmpty()) {
|
|
||||||
for (CollectionSort cs : beforeSorts) {
|
|
||||||
log.info("【getRelightResult方法】处理前collection_sort记录: id={}, relationId={}, sort={}", cs.getId(), cs.getRelationId(), cs.getSort());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ToProductImageRecord toProductImageRecord = toProductImageRecordMapper.selectById(toProductImageResult.getToProductImageRecordId());
|
ToProductImageRecord toProductImageRecord = toProductImageRecordMapper.selectById(toProductImageResult.getToProductImageRecordId());
|
||||||
if (Objects.isNull(toProductImageRecord)) {
|
if (Objects.isNull(toProductImageRecord)) {
|
||||||
log.error("【getRelightResult方法】未找到toProductImageRecord记录, recordId={}", toProductImageResult.getToProductImageRecordId());
|
|
||||||
throw new BusinessException("This task does not exist.");
|
throw new BusinessException("This task does not exist.");
|
||||||
}
|
}
|
||||||
// 判断当任务从哪个模型获取结果
|
// 判断当任务从哪个模型获取结果
|
||||||
if (!StringUtil.isNullOrEmpty(toProductImageResult.getModelName())
|
if (!StringUtil.isNullOrEmpty(toProductImageResult.getModelName())
|
||||||
&& toProductImageResult.getModelName().equals("flux")) {
|
&& toProductImageResult.getModelName().equals("flux")) {
|
||||||
log.info("【getRelightResult方法】使用flux模型处理, resultId={}", toProductImageResult.getId());
|
|
||||||
Project project = projectService.getById(toProductImageResult.getProjectId());
|
Project project = projectService.getById(toProductImageResult.getProjectId());
|
||||||
if (Objects.isNull(project)) {
|
if (Objects.isNull(project)) {
|
||||||
log.error("【getRelightResult方法】未找到project记录, projectId={}", toProductImageResult.getProjectId());
|
|
||||||
throw new BusinessException("unknown project");
|
throw new BusinessException("unknown project");
|
||||||
}
|
}
|
||||||
String fluxResult;
|
String fluxResult;
|
||||||
if (toProductImageResult.getStatus().equals("Success") && !StringUtil.isNullOrEmpty(toProductImageResult.getUrl())) {
|
if (toProductImageResult.getStatus().equals("Success") && !StringUtil.isNullOrEmpty(toProductImageResult.getUrl())) {
|
||||||
log.info("【getRelightResult方法】数据库中已有成功结果,直接使用, resultId={}", toProductImageResult.getId());
|
|
||||||
fluxResult = toProductImageResult.getUrl();
|
fluxResult = toProductImageResult.getUrl();
|
||||||
} else {
|
} else {
|
||||||
String objectName = project.getAccountId() + "/relight_image/" + taskId + ".png";
|
String objectName = project.getAccountId() + "/relight_image/" + taskId + ".png";
|
||||||
log.info("【getRelightResult方法】调用getFluxResult获取结果, resultId={}, objectName={}", toProductImageResult.getId(), objectName);
|
|
||||||
fluxResult = generateService.getFluxResult(taskId, objectName);
|
fluxResult = generateService.getFluxResult(taskId, objectName);
|
||||||
log.info("【getRelightResult方法】getFluxResult返回结果, resultId={}, fluxResult={}", toProductImageResult.getId(), fluxResult);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StringUtil.isNullOrEmpty(fluxResult)) {
|
if (StringUtil.isNullOrEmpty(fluxResult)) {
|
||||||
log.warn("【getRelightResult方法】fluxResult为null,判定为失败, resultId={}, isLike={}", toProductImageResult.getId(), toProductImageResult.getIsLike());
|
|
||||||
toProductImageResult.setStatus("Fail");
|
toProductImageResult.setStatus("Fail");
|
||||||
toProductImageResultMapper.updateById(toProductImageResult);
|
toProductImageResultMapper.updateById(toProductImageResult);
|
||||||
if (toProductImageResult.getIsLike() != null && toProductImageResult.getIsLike() == 1) {
|
if (toProductImageResult.getIsLike() != null && toProductImageResult.getIsLike() == 1) {
|
||||||
log.info("【getRelightResult方法】isLike=1,准备调用sortRank删除collection_sort记录, resultId={}", toProductImageResult.getId());
|
|
||||||
sortRank(toProductImageResult);
|
sortRank(toProductImageResult);
|
||||||
} else {
|
|
||||||
log.info("【getRelightResult方法】isLike不等于1,不删除collection_sort记录, resultId={}, isLike={}", toProductImageResult.getId(), toProductImageResult.getIsLike());
|
|
||||||
}
|
}
|
||||||
results.add(new MagicToolResultVO(taskId, "Fail"));
|
results.add(new MagicToolResultVO(taskId, "Fail"));
|
||||||
} else if (fluxResult.equals("Fail") || fluxResult.equals("Pending")) {
|
} else if (fluxResult.equals("Fail") || fluxResult.equals("Pending")) {
|
||||||
log.warn("【getRelightResult方法】fluxResult为{},判定为失败/待处理, resultId={}, isLike={}", fluxResult, toProductImageResult.getId(), toProductImageResult.getIsLike());
|
|
||||||
toProductImageResult.setStatus(fluxResult);
|
toProductImageResult.setStatus(fluxResult);
|
||||||
toProductImageResultMapper.updateById(toProductImageResult);
|
toProductImageResultMapper.updateById(toProductImageResult);
|
||||||
if (fluxResult.equals("Fail") && toProductImageResult.getIsLike() != null && toProductImageResult.getIsLike() == 1) {
|
if (toProductImageResult.getIsLike() != null && toProductImageResult.getIsLike() == 1) {
|
||||||
log.info("【getRelightResult方法】isLike=1,准备调用sortRank删除collection_sort记录, resultId={}", toProductImageResult.getId());
|
|
||||||
sortRank(toProductImageResult);
|
sortRank(toProductImageResult);
|
||||||
} else {
|
|
||||||
log.info("【getRelightResult方法】isLike不等于1,不删除collection_sort记录, resultId={}, isLike={}", toProductImageResult.getId(), toProductImageResult.getIsLike());
|
|
||||||
}
|
}
|
||||||
results.add(new MagicToolResultVO(taskId, fluxResult));
|
results.add(new MagicToolResultVO(taskId, fluxResult));
|
||||||
} else {
|
} else {
|
||||||
log.info("【getRelightResult方法】fluxResult有效,调用processFluxResult处理成功结果, resultId={}", toProductImageResult.getId());
|
|
||||||
results.add(processFluxResult(fluxResult, toProductImageResult, taskId, toProductImageRecord.getPrompt()));
|
results.add(processFluxResult(fluxResult, toProductImageResult, taskId, toProductImageRecord.getPrompt()));
|
||||||
// 扣积分
|
// 扣积分
|
||||||
Boolean flag = creditsService.taskCreditsDeduction(project.getAccountId(), taskId);
|
Boolean flag = creditsService.taskCreditsDeduction(project.getAccountId(), taskId);
|
||||||
@@ -1538,21 +1483,9 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
creditsService.deleteCreditsDeduction(project.getAccountId(), taskId);
|
creditsService.deleteCreditsDeduction(project.getAccountId(), taskId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理后查询collection_sort记录,用于追踪
|
|
||||||
List<CollectionSort> afterSorts = collectionSortMapper.selectList(sortQw);
|
|
||||||
log.info("【getRelightResult方法】处理后collection_sort记录数={}, resultId={}", afterSorts.size(), toProductImageResult.getId());
|
|
||||||
if (!afterSorts.isEmpty()) {
|
|
||||||
for (CollectionSort cs : afterSorts) {
|
|
||||||
log.info("【getRelightResult方法】处理后collection_sort记录: id={}, relationId={}, sort={}", cs.getId(), cs.getRelationId(), cs.getSort());
|
|
||||||
}
|
|
||||||
} else if (!beforeSorts.isEmpty()) {
|
|
||||||
log.warn("【getRelightResult方法】collection_sort记录被删除了! resultId={}, 处理前记录数={}, 处理后记录数=0", toProductImageResult.getId(), beforeSorts.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("【getRelightResult方法】非flux模型,从Redis获取结果, resultId={}", toProductImageResult.getId());
|
|
||||||
String key = relightResultKey + ":" + taskId;
|
String key = relightResultKey + ":" + taskId;
|
||||||
MagicToolResultVO magicToolResultVO = new Gson().fromJson(redisUtil.getFromString(key), MagicToolResultVO.class);
|
MagicToolResultVO magicToolResultVO = new Gson().fromJson(redisUtil.getFromString(key), MagicToolResultVO.class);
|
||||||
if (!Objects.isNull(magicToolResultVO) && !StringUtil.isNullOrEmpty(magicToolResultVO.getUrl())) {
|
if (!Objects.isNull(magicToolResultVO) && !StringUtil.isNullOrEmpty(magicToolResultVO.getUrl())) {
|
||||||
@@ -1584,9 +1517,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
}
|
}
|
||||||
if (!StringUtil.isNullOrEmpty(magicToolResultVO.getStatus())) collect.add(magicToolResultVO.getStatus());
|
if (!StringUtil.isNullOrEmpty(magicToolResultVO.getStatus())) collect.add(magicToolResultVO.getStatus());
|
||||||
results.add(magicToolResultVO);
|
results.add(magicToolResultVO);
|
||||||
log.info("【getRelightResult方法】taskId处理完成, taskId={}, 返回结果status={}", taskId, magicToolResultVO.getStatus());
|
|
||||||
});
|
});
|
||||||
log.info("【getRelightResult方法】所有taskId处理完成, 返回结果数={}", results.size());
|
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user