diff --git a/src/main/java/com/ai/da/service/impl/GenerateServiceImpl.java b/src/main/java/com/ai/da/service/impl/GenerateServiceImpl.java index fc1b148a..5f32628c 100644 --- a/src/main/java/com/ai/da/service/impl/GenerateServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/GenerateServiceImpl.java @@ -1244,11 +1244,13 @@ public class GenerateServiceImpl extends ServiceImpl i ArrayList poseTransformationVOS = new ArrayList<>(); for (String taskId : taskIdList){ String type = resolveModelType(taskId, CreditsEventsEnum.POSE_TRANSFORMATION.getValue()); + PoseTransformation poseTransformation = poseTransformationMapper.selectOne(new QueryWrapper().eq("unique_id", taskId)); String key = generateResultKey + ":" + taskId; String resultJson = redisUtil.getFromString(key); + PoseTransformationVO poseTransformationVO; if (!StringUtil.isNullOrEmpty(resultJson)){ - PoseTransformationVO poseTransformationVO = new Gson().fromJson(redisUtil.getFromString(key), PoseTransformationVO.class); + poseTransformationVO = new Gson().fromJson(redisUtil.getFromString(key), PoseTransformationVO.class); if (poseTransformationVO.getStatus().equals("Success") && !type.equals("wx")){ // 处理各种URL processUrl(poseTransformationVO.getGifUrl(), url -> @@ -1259,18 +1261,27 @@ public class GenerateServiceImpl extends ServiceImpl i poseTransformationVO.setFirstFrameUrl(minioUtil.getPreSignedUrl(url, CommonConstant.MINIO_IMAGE_EXPIRE_TIME))); } poseTransformationVO.setResultType(CollectionType.POSE_TRANSFORM.getValue()); - Long parentId = userLikeGroupService.getParentIdByElementIdAndElementType(poseTransformationVO.getId(), CollectionType.POSE_TRANSFORM.getValue()); - poseTransformationVO.setParentId(parentId); - poseTransformationVOS.add(poseTransformationVO); } else if(type.equals("wx")){ - poseTransformationVOS.add(getAnimateResult(taskId)); + poseTransformationVO = getAnimateResult(taskId); } else { - poseTransformationVOS.add(new PoseTransformationVO(taskId, "Executing")); + poseTransformationVO = new PoseTransformationVO(taskId, "Executing"); } + ToProductImageResult productResultByPath = getProductResultByPath(poseTransformation.getProductImage()); + if (Objects.nonNull(productResultByPath)){ + Long parentId = userLikeGroupService.getParentIdByElementIdAndElementType(productResultByPath.getId(), CollectionType.TO_PRODUCT_IMAGE.getValue()); + poseTransformationVO.setParentId(parentId); + } + poseTransformationVOS.add(poseTransformationVO); } return poseTransformationVOS; } + private ToProductImageResult getProductResultByPath(String minioPath){ + QueryWrapper qw = new QueryWrapper<>(); + qw.lambda().eq(ToProductImageResult::getUrl, minioPath); + return toProductImageResultMapper.selectOne(qw); + } + public List getPoseTransformationResultList(Long projectId, boolean like){ List poseTransformations = poseTransformationMapper.selectList(new QueryWrapper().eq("project_id", projectId).eq("is_liked", like ? 1 : 0)); List vos = new ArrayList<>(); @@ -1926,8 +1937,6 @@ public class GenerateServiceImpl extends ServiceImpl i if (!StringUtil.isNullOrEmpty(poseTransformation.getFirstFrameUrl())){ poseTransformationVO.setFirstFrameUrl(minioUtil.getPreSignedUrl(poseTransformation.getFirstFrameUrl(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME)); } - Long parentId = userLikeGroupService.getParentIdByElementIdAndElementType(poseTransformation.getId(), CollectionType.POSE_TRANSFORM.getValue()); - poseTransformationVO.setParentId(parentId); // 执行积分扣除 Long accountId = poseTransformation.getAccountId(); Boolean flag = creditsService.taskCreditsDeduction(accountId, taskId); diff --git a/src/main/java/com/ai/da/service/impl/UserLikeGroupServiceImpl.java b/src/main/java/com/ai/da/service/impl/UserLikeGroupServiceImpl.java index 9d15568a..df43ff64 100644 --- a/src/main/java/com/ai/da/service/impl/UserLikeGroupServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/UserLikeGroupServiceImpl.java @@ -501,7 +501,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl userLikeQueryWrapper = new QueryWrapper<>(); + userLikeQueryWrapper.lambda().eq(UserLike::getDesignOutfitId, tDesignPythonOutfit.getId()); + List userLikeList = userLikeMapper.selectList(userLikeQueryWrapper); + if (!CollectionUtils.isEmpty(userLikeList)) { + UserLike userLike = userLikeList.get(0); + Long parentId = getParentIdByElementIdAndElementType(userLike.getId(), toProductImageResult.getElementType()); + magicToolResultVO.setParentId(parentId); + } } else if (toProductImageResult.getElementType().equals("ToProductImage")){ ToProductImageResult toProductImage = toProductImageResultMapper.selectById(toProductImageResult.getElementId()); magicToolResultVO.setSourceUrl(minioUtil.getPreSignedUrl(toProductImage.getUrl(), 24 * 60)); + + Long parentId = getParentIdByElementIdAndElementType(toProductImageResult.getElementId(), toProductImageResult.getElementType()); + magicToolResultVO.setParentId(parentId); } - Long parentId = getParentIdByElementIdAndElementType(toProductImageResult.getId(), toProductImageResult.getResultType()); - magicToolResultVO.setParentId(parentId); + +// Long parentId = getParentIdByElementIdAndElementType(toProductImageResult.getId(), toProductImageResult.getResultType()); +// magicToolResultVO.setParentId(parentId); return magicToolResultVO; } @@ -1160,7 +1176,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl