Merge branch 'dev/dev' into dev/dev_xp

# Conflicts:
#	src/main/java/com/ai/da/common/security/filter/AuthenticationFilter.java
This commit is contained in:
2024-06-20 10:39:36 +08:00
11 changed files with 215 additions and 7 deletions

View File

@@ -31,4 +31,8 @@ public interface PortfolioService extends IService<Portfolio> {
Boolean unlike(Long id);
Long getLikeCount(Long id);
Boolean viewsIncrease(Long id);
Long viewsGet(Long id);
}

View File

@@ -396,6 +396,7 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
Canvas canvas = canvasMapper.selectById(vo.getCanvasId());
vo.setCanvasUrl(minioUtil.getPresignedUrl(canvas.getUrl(), 24 * 60));
vo.setLikeNum(redisUtil.getLikeCount(vo.getId()));
vo.setViewNums(redisUtil.getViewCount(vo.getId()));
return vo;
}
return null;
@@ -435,6 +436,9 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
}else {
vo.setIsLike(0);
}
redisUtil.increaseViewCount(portfolioDTO.getId());
vo.setViewNums(redisUtil.getViewCount(portfolioDTO.getId()));
vo.setUserName(accountMapper.selectById(vo.getAccountId()).getUserName());
return vo;
}
@@ -620,6 +624,17 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
return redisUtil.getLikeCount(id);
}
@Override
public Boolean viewsIncrease(Long id) {
redisUtil.increaseViewCount(id);
return Boolean.TRUE;
}
@Override
public Long viewsGet(Long id) {
return redisUtil.getViewCount(id);
}
private List<CommentVO> getChildCommentVOList(Long id) {
QueryWrapper<Comment> qw = new QueryWrapper<>();
qw.lambda().eq(Comment::getParentLevel1Id, id);

View File

@@ -238,13 +238,16 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
List<ToProductImageResult> result = new ArrayList<>();
int i = 0;
// 翻译
String prompt = toProductImageDTO.getPrompt();
String s = pythonService.promptTranslate(prompt);
for (ToProductImageVO toProductImageVO : toProductImageDTO.getToProductImageVOList()) {
if (toProductImageVO.getElementType().equals("DesignOutfit")) {
String taskId = UUID.randomUUID() + "-" + i + "-" + userHolder.getId();
i ++;
TDesignPythonOutfit tDesignPythonOutfit = designPythonOutfitMapper.selectById(toProductImageVO.getElementId());
// 走模型
pythonService.toProductImage(tDesignPythonOutfit.getDesignUrl(), taskId, toProductImageDTO.getPrompt());
pythonService.toProductImage(tDesignPythonOutfit.getDesignUrl(), taskId, s);
ToProductImageResult toProductImageResult = new ToProductImageResult();
toProductImageResult.setElementId(tDesignPythonOutfit.getId());
toProductImageResult.setElementType("DesignOutfit");
@@ -261,7 +264,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
String taskId = UUID.randomUUID() + "-" + i + "-" + userHolder.getId();
ToProductElement toProductElement = toProductElementMapper.selectById(toProductImageVO.getElementId());
// 走模型
pythonService.toProductImage(toProductElement.getUrl(), taskId, toProductImageDTO.getPrompt());
pythonService.toProductImage(toProductElement.getUrl(), taskId, s);
ToProductImageResult toProductImageResult = new ToProductImageResult();
toProductImageResult.setElementId(toProductElement.getId());
toProductImageResult.setElementType("ProductElement");

View File

@@ -34,10 +34,7 @@ import javax.annotation.Resource;
import javax.naming.Context;
import java.io.*;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.*;
import java.util.stream.Collectors;
@@ -313,6 +310,9 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
Long styleId = workspaceRelStyles.get(0).getStyleId();
Style style = styleMapper.selectById(styleId);
StyleEnum styleEnum = StyleEnum.fromName(style.getName());
Map<String, List<String>> allKeywordsByStyle = StyleKeywordMapper.getAllKeywordsByStyle(styleEnum);
vo.setAllKeywordsByStyle(allKeywordsByStyle);
if (authPrincipalVo.getLanguage().equals(Language.ENGLISH.name())) {
vo.setStyleName(styleEnum.getEnglish());
}else {