TASK:1. 通过定时任务,补偿获取第三方api的运行结果;
2. pose 生成,对使用万相模型的生成限流,最大支持5个并发 3. Slogan限流,一分钟内,最多接收3个请求
This commit is contained in:
@@ -1,99 +1,99 @@
|
||||
package com.ai.da.service;
|
||||
|
||||
import com.ai.da.common.enums.CreditsEventsEnum;
|
||||
import com.ai.da.mapper.primary.entity.CollectionSort;
|
||||
import com.ai.da.mapper.primary.entity.Generate;
|
||||
import com.ai.da.mapper.primary.entity.GenerateDetail;
|
||||
import com.ai.da.model.dto.*;
|
||||
import com.ai.da.model.vo.*;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface GenerateService extends IService<Generate> {
|
||||
|
||||
GenerateCaptionVO generateCaption(Long sketchElementId);
|
||||
|
||||
void generateThroughImageText(GenerateThroughImageTextDTO generateThroughImageTextDTO);
|
||||
|
||||
void processGenerateResult(String taskId, String url, String category);
|
||||
|
||||
void processToProductImageResult(String taskId, String url, String category);
|
||||
|
||||
void updateToProductTaskStatus(String taskId, String status);
|
||||
|
||||
GenerateLikeVO generateLike(GenerateLikeDTO generateLikeDTO);
|
||||
|
||||
Boolean generateDislike(Long generateDetailId, String timeZone);
|
||||
|
||||
void updateLikeStatusBatch(List<Long> generateDetailIdList, Byte hasLike, Long libraryId, String timeZone);
|
||||
|
||||
List<GenerateDetail> selectBatchByLibraryId(List<Long> libraryId);
|
||||
|
||||
// GenerateCollectionVO getGenerateResult(String uniqueId);
|
||||
|
||||
List<GenerateResultVO> getGenerateResultList(List<String> taskIdList);
|
||||
|
||||
PrepareForGenerateVO prepareForGenerate(GenerateThroughImageTextDTO generateThroughImageTextDTO);
|
||||
|
||||
Long getRankPosition(String uniqueId);
|
||||
|
||||
void cancelGenerate(Long userId, List<String> uniqueId, String timeZone, String type);
|
||||
|
||||
void processRelightResult(String taskId, String url, String category);
|
||||
|
||||
List<Map<String, Object>> getCountByUserAndTime(String startTime, String endTime, List<Long> accountIdList);
|
||||
|
||||
GenerateResultVO imageToSketch(ImageToSketchDTO imageToSketchDTO, String collagePictureUrl, Long projectId);
|
||||
|
||||
String imageToSketchAsync(ImageToSketchDTO imageToSketchDTO, String collagePictureUrl, Long projectId);
|
||||
|
||||
GenerateResultVO modifySketch(GenerateModifyDTO generateModifyDTO);
|
||||
|
||||
ToProductImageResultVO poseTransform(PoseTransformDTO poseTransformDTO);
|
||||
|
||||
void processPoseTransformResult(String taskId, String gifUrl, String videoUrl, String imageUrl);
|
||||
|
||||
List<PoseTransformationVO> getPoseTransformationResult(List<String> taskIdList, Long projectId, Boolean like);
|
||||
|
||||
void updatePoseTransferStatus(String taskId, String status);
|
||||
|
||||
|
||||
CollectionSort disOrLikePose(Long transformedId, String likeOrDislike, Long projectId, Long sortLikeParentId);
|
||||
|
||||
String modifyModelProportion(ModifyModelProportionDTO proportionDTO);
|
||||
|
||||
GenerateResultVO sketchReconstructionGenerate(SketchReconstructionDTO sketchReconstructionDTO);
|
||||
|
||||
SketchReconstructionVO getSketchReconstruction(Long projectId);
|
||||
|
||||
List<Map<String, String>> getAllPose();
|
||||
|
||||
void processPoseTransformResultBatch(String taskId, String gifUrl, String videoUrl, String imageUrl, String progress);
|
||||
|
||||
void processPoseTransformResultBatch(String taskId, String progress);
|
||||
|
||||
void deleteGeneratedPose(Long projectId, Long id);
|
||||
|
||||
String createAsyncTask(GenerateThroughImageTextDTO generateThroughImageTextDTO);
|
||||
|
||||
GenerateResultVO getAsyncTaskResult(String taskId);
|
||||
|
||||
String animateAnyone(PoseTransformDTO poseTransformDTO, Long accountId);
|
||||
|
||||
String getVideoTemplateId(String videoPath);
|
||||
|
||||
PoseTransformationVO getAnimateResult(String taskId);
|
||||
|
||||
String reimagineFreePik(String path, String prompt, String style) throws IOException;
|
||||
|
||||
String getImageDescription(String imagePath);
|
||||
|
||||
String flux(CreditsEventsEnum func, String prompt, String imagePath, boolean childStyle);
|
||||
|
||||
String getFluxResult(String taskId, String objectName);
|
||||
|
||||
byte[] downloadVideoOrImage(String url);
|
||||
}
|
||||
package com.ai.da.service;
|
||||
|
||||
import com.ai.da.common.enums.CreditsEventsEnum;
|
||||
import com.ai.da.mapper.primary.entity.CollectionSort;
|
||||
import com.ai.da.mapper.primary.entity.Generate;
|
||||
import com.ai.da.mapper.primary.entity.GenerateDetail;
|
||||
import com.ai.da.mapper.primary.entity.PoseTransformation;
|
||||
import com.ai.da.model.dto.*;
|
||||
import com.ai.da.model.vo.*;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface GenerateService extends IService<Generate> {
|
||||
|
||||
GenerateCaptionVO generateCaption(Long sketchElementId);
|
||||
|
||||
void generateThroughImageText(GenerateThroughImageTextDTO generateThroughImageTextDTO);
|
||||
|
||||
void processGenerateResult(String taskId, String url, String category);
|
||||
|
||||
void processToProductImageResult(String taskId, String url, String category);
|
||||
|
||||
void updateToProductTaskStatus(String taskId, String status);
|
||||
|
||||
GenerateLikeVO generateLike(GenerateLikeDTO generateLikeDTO);
|
||||
|
||||
Boolean generateDislike(Long generateDetailId, String timeZone);
|
||||
|
||||
void updateLikeStatusBatch(List<Long> generateDetailIdList, Byte hasLike, Long libraryId, String timeZone);
|
||||
|
||||
List<GenerateDetail> selectBatchByLibraryId(List<Long> libraryId);
|
||||
|
||||
// GenerateCollectionVO getGenerateResult(String uniqueId);
|
||||
|
||||
List<GenerateResultVO> getGenerateResultList(List<String> taskIdList);
|
||||
|
||||
PrepareForGenerateVO prepareForGenerate(GenerateThroughImageTextDTO generateThroughImageTextDTO);
|
||||
|
||||
Long getRankPosition(String uniqueId);
|
||||
|
||||
void cancelGenerate(Long userId, List<String> uniqueId, String timeZone, String type);
|
||||
|
||||
void processRelightResult(String taskId, String url, String category);
|
||||
|
||||
List<Map<String, Object>> getCountByUserAndTime(String startTime, String endTime, List<Long> accountIdList);
|
||||
|
||||
GenerateResultVO imageToSketch(ImageToSketchDTO imageToSketchDTO, String collagePictureUrl, Long projectId);
|
||||
|
||||
String imageToSketchAsync(ImageToSketchDTO imageToSketchDTO, String collagePictureUrl, Long projectId);
|
||||
|
||||
GenerateResultVO modifySketch(GenerateModifyDTO generateModifyDTO);
|
||||
|
||||
ToProductImageResultVO poseTransform(PoseTransformDTO poseTransformDTO);
|
||||
|
||||
void processPoseTransformResult(String taskId, String gifUrl, String videoUrl, String imageUrl);
|
||||
|
||||
List<PoseTransformationVO> getPoseTransformationResult(List<String> taskIdList, Long projectId, Boolean like);
|
||||
|
||||
void updatePoseTransferStatus(String taskId, String status, PoseTransformation poseTransformation);
|
||||
|
||||
CollectionSort disOrLikePose(Long transformedId, String likeOrDislike, Long projectId, Long sortLikeParentId);
|
||||
|
||||
String modifyModelProportion(ModifyModelProportionDTO proportionDTO);
|
||||
|
||||
GenerateResultVO sketchReconstructionGenerate(SketchReconstructionDTO sketchReconstructionDTO);
|
||||
|
||||
SketchReconstructionVO getSketchReconstruction(Long projectId);
|
||||
|
||||
List<Map<String, String>> getAllPose();
|
||||
|
||||
void processPoseTransformResultBatch(String taskId, String gifUrl, String videoUrl, String imageUrl, String progress);
|
||||
|
||||
void processPoseTransformResultBatch(String taskId, String progress);
|
||||
|
||||
void deleteGeneratedPose(Long projectId, Long id);
|
||||
|
||||
String createAsyncTask(GenerateThroughImageTextDTO generateThroughImageTextDTO);
|
||||
|
||||
GenerateResultVO getAsyncTaskResult(String taskId);
|
||||
|
||||
String animateAnyone(PoseTransformDTO poseTransformDTO, Long accountId);
|
||||
|
||||
String getVideoTemplateId(String videoPath);
|
||||
|
||||
PoseTransformationVO getAnimateResult(String taskId);
|
||||
|
||||
String reimagineFreePik(String path, String prompt, String style) throws IOException;
|
||||
|
||||
String getImageDescription(String imagePath);
|
||||
|
||||
String flux(CreditsEventsEnum func, String prompt, String imagePath, boolean childStyle);
|
||||
|
||||
String getFluxResult(String taskId, String objectName);
|
||||
|
||||
byte[] downloadVideoOrImage(String url);
|
||||
}
|
||||
|
||||
@@ -53,7 +53,8 @@ public class APIGenerateServiceImpl extends ServiceImpl<APIGenerateMapper, APIGe
|
||||
qw.lambda().eq(APIGenerate::getTaskId, taskId);
|
||||
APIGenerate apiGenerate = baseMapper.selectOne(qw);
|
||||
if (Objects.nonNull(apiGenerate)){
|
||||
if (apiGenerate.getStatus().equals("Ready") || apiGenerate.getStatus().equals("SUCCEEDED")) {
|
||||
if (apiGenerate.getStatus().equals("Ready") || apiGenerate.getStatus().equals("SUCCEEDED")
|
||||
|| apiGenerate.getStatus().equals("Success")) {
|
||||
log.warn("当前任务 {} 状态已达Success, 不做修改", taskId);
|
||||
} else {
|
||||
apiGenerate.setStatus(status);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user