TASK:模块化;

This commit is contained in:
shahaibo
2025-04-02 17:13:58 +08:00
parent 3e3b1eb868
commit b6367d72ba
7 changed files with 58 additions and 83 deletions

View File

@@ -1,6 +1,7 @@
package com.ai.da.service;
import com.ai.da.mapper.primary.entity.UserLike;
import com.ai.da.mapper.primary.entity.UserLikeGroup;
import com.ai.da.model.vo.UserLikeVO;
import com.baomidou.mybatisplus.extension.service.IService;
@@ -26,4 +27,6 @@ public interface UserLikeService extends IService<UserLike> {
void updateDate(Long designItemId,String timeZone);
List<UserLike> getUserLikeList(Long id);
UserLikeGroup getUserLikeGroupByProjectId(Long id);
}

View File

@@ -335,7 +335,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
log.info("组装入参运行时间:" + totalTimeInSeconds + "");
// pythonObjects增加image_id关联
startTime = System.currentTimeMillis();
List<Long> imageIds = relationImageIds(pythonObjects);
relationImageIds(pythonObjects);
endTime = System.currentTimeMillis();
totalTimeInSeconds = (endTime - startTime) / 1000;
log.info("增加image_id关联运行时间" + totalTimeInSeconds + "");
@@ -351,9 +351,9 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
startTime = System.currentTimeMillis();
generateLibrary(elementVO, designDTO.getTimeZone());
//处理关联关系,修复element覆盖得情况
List<CollectionElement> relationElements = collectionElementService.getByOnlyCollectionId(collectionId);
List<Long> relationElementIds = relationElements.stream().map(CollectionElement::getId).collect(Collectors.toList());
handleCollectionElementRelation(collectionId, null != collectionIdParam, relationElementIds);
// List<CollectionElement> relationElements = collectionElementService.getByOnlyCollectionId(collectionId);
// List<Long> relationElementIds = relationElements.stream().map(CollectionElement::getId).collect(Collectors.toList());
// handleCollectionElementRelation(collectionId, null != collectionIdParam, relationElementIds);
endTime = System.currentTimeMillis();
totalTimeInSeconds = (endTime - startTime) / 1000;
log.info("处理关联关系运行时间:" + totalTimeInSeconds + "");

View File

@@ -257,78 +257,22 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
Project project = projectMapper.selectById(projectDTO.getId());
// List<String> moduleList = projectDTO.getModuleList();
// for (String module : moduleList) {
//
// }
Long workspaceId = workspaceService.getByProjectId(project.getId());
WorkspaceVO workspaceVO = workspaceService.getByIdForProject(workspaceId);
String process = project.getProcess();
String name = project.getName();
// UserLikeGroup group = getByProjectId(projectDTO.getId());
// if (Objects.isNull(group)) {
// throw new BusinessException("history.not.found");
// }
// List<UserLikeVO> userLikeVOS = userLikeService.getGroupDetail(group.getId());
// String sex = null;
//
// QueryWrapper<UserLikeSort> userLikeSortQw = new QueryWrapper<>();
// userLikeSortQw.lambda().eq(UserLikeSort::getUserLikeGroupId, group.getId());
// List<UserLikeSort> userLikeSortList = userLikeSortMapper.selectList(userLikeSortQw);
// if (CollectionUtil.isEmpty(userLikeSortList)) {
// Integer sort = 1;
// for (UserLikeVO userLikeVO : userLikeVOS) {
// UserLikeSort userLikeSort = new UserLikeSort();
// userLikeSort.setUserLikeId(userLikeVO.getId());
// userLikeSort.setUserLikeGroupId(group.getId());
// userLikeSort.setSort(sort);
// userLikeSortMapper.insert(userLikeSort);
// sort ++;
// }
// }
//
// userLikeVOS.forEach(o -> {
// TDesignPythonOutfit tDesignPythonOutfit1 = designPythonOutfitMapper.selectById(o.getDesignOutfitId());
// o.setUrl(tDesignPythonOutfit1.getDesignUrl());
// if (o.getUrl().contains("/")) {
// int index = o.getUrl().lastIndexOf("/");
// o.setPictureName(o.getUrl().substring(index + 1));
// }
// o.setDesignOutfitUrl(minioUtil.getPreSignedUrl(o.getUrl(), 24 * 60));
// QueryWrapper<TDesignPythonOutfit> qw = new QueryWrapper<>();
// qw.lambda().eq(TDesignPythonOutfit::getDesignItemId, o.getDesignItemId());
// List<TDesignPythonOutfit> tDesignPythonOutfits = designPythonOutfitMapper.selectList(qw);
// if (CollectionUtil.isNotEmpty(tDesignPythonOutfits)) {
// TDesignPythonOutfit tDesignPythonOutfit = tDesignPythonOutfits.get(0);
// o.setDesignOutfitId(tDesignPythonOutfit.getId());
// }
//
// QueryWrapper<UserLikeSort> userLikeSortQueryWrapper = new QueryWrapper<>();
// userLikeSortQueryWrapper.lambda().eq(UserLikeSort::getUserLikeId, o.getId());
// List<UserLikeSort> userLikeSorts = userLikeSortMapper.selectList(userLikeSortQueryWrapper);
// if (CollectionUtil.isNotEmpty(userLikeSorts)) {
// UserLikeSort userLikeSort = userLikeSorts.get(0);
// o.setSort(userLikeSort.getSort());
// o.setUserLikeSortId(userLikeSort.getId());
// }
// });
// UserLikeCollectionVO userLikeCollection = collectionService.chooseCollection(group.getCollectionId());
// Integer beenPublished = 0;
// QueryWrapper<Portfolio> qw = new QueryWrapper<>();
// qw.lambda().eq(Portfolio::getUserLikeGroupSourceId, group.getId());
// List<Portfolio> portfolios = portfolioMapper.selectList(qw);
//// Portfolio portfolio = new Portfolio();
// PortfolioDTO portfolioDTO = new PortfolioDTO();
// if (CollectionUtil.isNotEmpty(portfolios)) {
//// portfolio = portfolios.get(0);
// portfolioDTO = CopyUtil.copyObject(portfolios.get(0), PortfolioDTO.class);
// beenPublished = 1;
// portfolioDTO.setTagsDTO(tagsMapper.getTagByPortfolioId(portfolioDTO.getId()));
// }
return new ProjectChooseVO(projectDTO.getId(), name, workspaceVO, process);
UserLikeGroup userLikeGroup = userLikeService.getUserLikeGroupByProjectId(project.getId());
Long collectionId = null;
if (Objects.nonNull(userLikeGroup)) {
Collection collection = collectionService.getById(userLikeGroup.getCollectionId());
if (Objects.nonNull(collection)) {
collectionId = collection.getId();
}
}
return new ProjectChooseVO(projectDTO.getId(), name, workspaceVO, process, collectionId);
}
@Override

View File

@@ -2,8 +2,10 @@ package com.ai.da.service.impl;
import com.ai.da.common.utils.CopyUtil;
import com.ai.da.common.utils.DateUtil;
import com.ai.da.mapper.primary.UserLikeGroupMapper;
import com.ai.da.mapper.primary.UserLikeMapper;
import com.ai.da.mapper.primary.entity.UserLike;
import com.ai.da.mapper.primary.entity.UserLikeGroup;
import com.ai.da.model.vo.UserLikeVO;
import com.ai.da.service.UserLikeService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -33,6 +35,8 @@ public class UserLikeServiceImpl extends ServiceImpl<UserLikeMapper, UserLike> i
@Resource
private UserLikeMapper userLikeMapper;
@Resource
private UserLikeGroupMapper userLikeGroupMapper;
@Resource
private DesignItemServiceImpl designItemService;
@Override
@@ -95,4 +99,15 @@ public class UserLikeServiceImpl extends ServiceImpl<UserLikeMapper, UserLike> i
return userLikeMapper.selectList(qw);
}
@Override
public UserLikeGroup getUserLikeGroupByProjectId(Long id) {
QueryWrapper<UserLikeGroup> qw = new QueryWrapper<>();
qw.lambda().eq(UserLikeGroup::getProjectId, id);
List<UserLikeGroup> userLikeGroupList = userLikeGroupMapper.selectList(qw);
if (CollectionUtils.isEmpty(userLikeGroupList)) {
return null;
}
return userLikeGroupList.get(0);
}
}