TASK:AiDA模块化

This commit is contained in:
shahaibo
2025-03-18 17:38:28 +08:00
parent 7742bd56f8
commit 2db65776b1
2 changed files with 54 additions and 1 deletions

View File

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

View File

@@ -19,7 +19,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sun.org.apache.bcel.internal.generic.NEW;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileItemFactory;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
@@ -338,6 +337,58 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
return vo;
}
@Override
public WorkspaceVO getByIdForProject(Long id) {
AuthPrincipalVo authPrincipalVo = UserContext.getUserHolder();
Long accountId = UserContext.getUserHolder().getId();
// QueryWrapper<Workspace> qwOld = new QueryWrapper<>();
// qwOld.lambda().eq(Workspace::getAccountId, accountId);
// qwOld.lambda().eq(Workspace::getIsLastIndex, 1);
// Workspace oldIsLastIndex = workspaceMapper.selectOne(qwOld);
// oldIsLastIndex.setIsLastIndex(0);
// workspaceMapper.updateById(oldIsLastIndex);
Workspace newIsLastIndex = workspaceMapper.selectById(id);
// newIsLastIndex.setIsLastIndex(1);
// workspaceMapper.updateById(newIsLastIndex);
WorkspaceVO vo = CopyUtil.copyObject(newIsLastIndex, WorkspaceVO.class);
if (vo.getMannequinFemaleId() != null) {
if (vo.getMannequinFemaleType().equals(ModelType.SYSTEM.getValue())) {
vo.setFemalePresignedUrl(minioUtil.getPreSignedUrl(sysFileMapper.selectById(vo.getMannequinFemaleId()).getUrl(), 24 * 60));
} else if (vo.getMannequinFemaleType().equals(ModelType.LIBRARY.getValue())) {
vo.setFemalePresignedUrl(minioUtil.getPreSignedUrl(libraryMapper.selectById(vo.getMannequinFemaleId()).getUrl(), 24 * 60));
}
}
if (vo.getMannequinMaleId() != null) {
if (vo.getMannequinMaleType().equals(ModelType.SYSTEM.getValue())) {
vo.setMalePresignedUrl(minioUtil.getPreSignedUrl(sysFileMapper.selectById(vo.getMannequinMaleId()).getUrl(), 24 * 60));
} else if (vo.getMannequinMaleType().equals(ModelType.LIBRARY.getValue())) {
vo.setMalePresignedUrl(minioUtil.getPreSignedUrl(libraryMapper.selectById(vo.getMannequinMaleId()).getUrl(), 24 * 60));
}
}
Sex sex = Sex.getSex(vo.getSex());
Position position = Position.getPosition(vo.getPosition());
vo.setSexEnum(new BizJson(sex.getValue(), sex.name(), BusinessException.getMessageFromResource(sex.name())));
vo.setPositionEnum(new BizJson(position.getValue(), position.name(), BusinessException.getMessageFromResource(position.name())));
QueryWrapper<WorkspaceRelStyle> qw = new QueryWrapper<>();
qw.lambda().eq(WorkspaceRelStyle::getWorkspaceId, vo.getId());
List<WorkspaceRelStyle> workspaceRelStyles = workspaceRelStyleMapper.selectList(qw);
if (!CollectionUtils.isEmpty(workspaceRelStyles)) {
Long styleId = workspaceRelStyles.get(0).getStyleId();
vo.setStyleId(styleId);
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())) {
vo.setStyleName(styleEnum.getEnglish());
}else {
vo.setStyleName(styleEnum.getChinese());
}
}
return vo;
}
@Override
public List<ModelsVO> getMannequins(String sex, String style) {
AuthPrincipalVo userInfo = UserContext.getUserHolder();