Merge branch 'dev/dev' into dev/dev_xp

# Conflicts:
#	src/main/java/com/ai/da/service/impl/ChatRobotServiceImpl.java
This commit is contained in:
2024-06-25 15:42:22 +08:00
15 changed files with 73 additions and 12 deletions

View File

@@ -217,7 +217,10 @@ public class MyTaskScheduler {
String directoryPath = "C:\\Users\\10233\\Downloads\\blouse done\\blouse done\\废土风";
List<String> fileNames = getFileNames(directoryPath);
for (String fileName : fileNames) {
String tableName = "female_top";
String style = "feitufeng";
Long idByFileName = attributeRetrievalMapper.getIdByFileName(fileName, tableName);
attributeRetrievalMapper.updateStyleById(idByFileName, style, tableName);
}
}

View File

@@ -105,4 +105,10 @@ public class PortfolioController {
public Response<Long> viewsGet(@RequestParam("id") Long id) {
return Response.success(portfolioService.viewsGet(id));
}
@ApiOperation(value = "删除评论")
@PostMapping("/commentDelete")
public Response<Boolean> commentDelete(@Valid @RequestBody CommentDTO commentDTO) {
return Response.success(portfolioService.commentDelete(commentDTO));
}
}

View File

@@ -95,8 +95,8 @@ public class WorkspaceController {
@GetMapping("/getMannequins")
@ApiOperationSupport(order = 6)
@ApiOperation(value = "获取模特")
public Response<List<ModelsVO>> getMannequins(@RequestParam("sex") String sex) {
List<ModelsVO> modelsVO = workspaceService.getMannequins(sex);
public Response<List<ModelsVO>> getMannequins(@RequestParam("sex") String sex, @RequestParam("style") String style) {
List<ModelsVO> modelsVO = workspaceService.getMannequins(sex, style);
return Response.success(modelsVO);
}

View File

@@ -22,4 +22,8 @@ public interface AttributeRetrievalMapper {
AttributeRetrieval getSystemRandom(String tableName);
List<AttributeRetrieval> getSystemSketchPoolBySameCategory(AttributeRetrieval attributeRetrievalAttrDict, String tableName);
Long getIdByFileName(String fileName, String tableName);
void updateStyleById(Long idByFileName, String style, String tableName);
}

View File

@@ -18,7 +18,7 @@ public class AttributeRetrieval {
private String openingType;
private String subtype;
private String sleeve;
private String sleeve1;
private String sleeve2;
private String style;
private Integer deprecated;
}

View File

@@ -6,7 +6,7 @@ import lombok.Getter;
@Getter
public enum StyleEnum {
// 定义风格及其对应的中英文描述
NEO_CHINESE("新中式", "Neo Chinese"),
NEW_CHINESE("新中式", "New Chinese"),
COUNTRY_STYLE("田园风", "Country Style"),
FUTURISM("未来主义", "Futurism"),
MINIMALISM("极简风", "Minimalism"),

View File

@@ -82,7 +82,7 @@ public class StyleKeywordMapper {
wabiSabiKeywords.put("Printboard", Arrays.asList("natural materials such as wood", "stone", "hemp rope", "neutral tones and light colors"));
wabiSabiKeywords.put("Sketchboard", Arrays.asList("a quiet and peaceful atmosphere"));
styleCategoryKeywords.put(StyleEnum.NEO_CHINESE, neoChineseKeywords);
styleCategoryKeywords.put(StyleEnum.NEW_CHINESE, neoChineseKeywords);
styleCategoryKeywords.put(StyleEnum.COUNTRY_STYLE, countryStyleKeywords);
styleCategoryKeywords.put(StyleEnum.FUTURISM, futurismKeywords);
styleCategoryKeywords.put(StyleEnum.MINIMALISM, minimalistKeywords);

View File

@@ -38,6 +38,8 @@ public class WorkspaceVO extends Workspace {
private String styleName;
private String style;
private Map<String, List<String>> allKeywordsByStyle;
}

View File

@@ -35,4 +35,6 @@ public interface PortfolioService extends IService<Portfolio> {
Boolean viewsIncrease(Long id);
Long viewsGet(Long id);
Boolean commentDelete(CommentDTO commentDTO);
}

View File

@@ -40,7 +40,7 @@ public interface WorkspaceService extends IService<Workspace> {
WorkspaceVO getByIdNew(Long id);
List<ModelsVO> getMannequins(String sex);
List<ModelsVO> getMannequins(String sex, String style);
void systemFileCopy();

View File

@@ -154,6 +154,7 @@ public class ChatRobotServiceImpl implements ChatRobotService {
// .url("http://127.0.0.1:5000/api/chat_stream_test")
// .url(accessPythonIp + ":" + accessPythonPort + "/api/chat_stream_test")
.url(accessPythonIp + ":" + accessPythonPort + "/api/chat_robot")
// .url(fastApiPythonAddress + "/api/chat_robot")
// .url(accessPythonIp + ":10200/aifda/api/v1.0/generate")
.method("POST", body)
.addHeader("Content-Type", "application/json")

View File

@@ -15,6 +15,7 @@ import com.ai.da.model.enums.Sex;
import com.ai.da.model.vo.*;
import com.ai.da.service.*;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -635,6 +636,29 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
return redisUtil.getViewCount(id);
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean commentDelete(CommentDTO commentDTO) {
Long id = commentDTO.getId();
Portfolio portfolio = portfolioMapper.selectById(commentDTO.getPortfolioId());
Comment comment = commentMapper.selectById(id);
if (!Objects.equals(comment.getAccountId(), commentDTO.getAccountId()) || !Objects.equals(portfolio.getAccountId(), commentDTO.getAccountId())) {
throw new BusinessException("You do not have the permission to delete this comment");
}
// 删除主评论
commentMapper.deleteById(id);
// 删除子评论
LambdaQueryWrapper<Comment> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(Comment::getParentLevel1Id, id)
.or()
.eq(Comment::getParentLevel2Id, id);
commentMapper.delete(lambdaQueryWrapper);
return Boolean.TRUE;
}
private List<CommentVO> getChildCommentVOList(Long id) {
QueryWrapper<Comment> qw = new QueryWrapper<>();
qw.lambda().eq(Comment::getParentLevel1Id, id);

View File

@@ -310,7 +310,7 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
Long styleId = workspaceRelStyles.get(0).getStyleId();
Style style = styleMapper.selectById(styleId);
StyleEnum styleEnum = StyleEnum.fromName(style.getName());
vo.setStyle(styleEnum.name());
Map<String, List<String>> allKeywordsByStyle = StyleKeywordMapper.getAllKeywordsByStyle(styleEnum);
vo.setAllKeywordsByStyle(allKeywordsByStyle);
if (authPrincipalVo.getLanguage().equals(Language.ENGLISH.name())) {
@@ -323,7 +323,7 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
}
@Override
public List<ModelsVO> getMannequins(String sex) {
public List<ModelsVO> getMannequins(String sex, String style) {
AuthPrincipalVo userInfo = UserContext.getUserHolder();
List<ModelsVO> result = new ArrayList<>();
QueryWrapper<Library> libraryQueryWrapper = new QueryWrapper<>();
@@ -350,6 +350,11 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
// sysFileQueryWrapper.lambda().eq(SysFile::getLevel2Type, SysFileLevel2TypeEnum.BODY.getRealName());
sysFileQueryWrapper.lambda().eq(SysFile::getLevel1Type, "Models");
sysFileQueryWrapper.lambda().eq(SysFile::getLevel2Type, sex);
if (!StringUtils.isEmpty(style)) {
sysFileQueryWrapper.lambda().eq(SysFile::getLevel3Type, style);
}else {
sysFileQueryWrapper.lambda().isNull(SysFile::getLevel3Type);
}
List<SysFile> sysFileList = sysFileMapper.selectList(sysFileQueryWrapper);
if (!CollectionUtils.isEmpty(sysFileList)) {
List<ModelVO> modelVOList = new ArrayList<>();