TASK:AiDA模块化

This commit is contained in:
shahaibo
2025-03-19 14:08:16 +08:00
parent ec836a6470
commit 83d9a5befb
6 changed files with 195 additions and 56 deletions

View File

@@ -36,6 +36,8 @@ public interface UserLikeGroupService extends IService<UserLikeGroup> {
ProjectChooseVO choose(ProjectDTO projectDTO);
UserLikeGroup getByProjectId(Long projectId);
void deleteTrialData(Long id);
void updateDate(Long id,String timeZone);

View File

@@ -7,8 +7,6 @@ import com.ai.da.common.context.UserContext;
import com.ai.da.common.enums.CollectionLevel1TypeEnum;
import com.ai.da.common.enums.CreditsEventsEnum;
import com.ai.da.common.enums.DesignTypeEnum;
import com.ai.da.common.response.PageBaseResponse;
import com.ai.da.common.response.Response;
import com.ai.da.common.response.ResultEnum;
import com.ai.da.common.utils.*;
import com.ai.da.mapper.primary.*;
@@ -311,7 +309,8 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
return new ProjectChooseVO(projectDTO.getId(), workspaceVO, process);
}
private UserLikeGroup getByProjectId(Long projectId) {
@Override
public UserLikeGroup getByProjectId(Long projectId) {
QueryWrapper<UserLikeGroup> qw = new QueryWrapper<>();
qw.lambda().eq(UserLikeGroup::getProjectId, projectId);
List<UserLikeGroup> userLikeGroupList = userLikeGroupMapper.selectList(qw);
@@ -389,9 +388,16 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
}
AuthPrincipalVo userHolder = UserContext.getUserHolder();
Long userLikeGroupId = toProductImageDTO.getUserLikeGroupId();
Long projectId = toProductImageDTO.getProjectId();
UserLikeGroup userLikeGroup = getByProjectId(projectId);
Long userLikeGroupId = null;
ToProductImageRecord toProductImageRecord = new ToProductImageRecord();
toProductImageRecord.setUserLikeGroupId(userLikeGroupId);
toProductImageRecord.setProjectId(projectId);
if (Objects.nonNull(userLikeGroup)) {
userLikeGroupId = userLikeGroup.getId();
toProductImageRecord.setUserLikeGroupId(userLikeGroupId);
}
toProductImageRecord.setCreateTime(LocalDateTime.now());
if (!StringUtils.isEmpty(toProductImageDTO.getPrompt())) {
toProductImageRecord.setPrompt(toProductImageDTO.getPrompt());
@@ -452,7 +458,10 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
// toProductImageResult.setUrl(productImageUrl);
toProductImageResult.setIsLike(0);
toProductImageResult.setTaskId(taskId);
toProductImageResult.setUserLikeGroupId(userLikeGroupId);
toProductImageResult.setProjectId(projectId);
if (userLikeGroupId != null) {
toProductImageResult.setUserLikeGroupId(userLikeGroupId);
}
toProductImageResult.setImageStrength(toProductImageDTO.getImageStrength());
toProductImageResultMapper.insert(toProductImageResult);
// toProductImageResult.setUrl(minioUtil.getPresignedUrl(toProductImageResult.getUrl(), 24 * 60));
@@ -476,7 +485,10 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
// toProductImageResult.setUrl(productImageUrl);
toProductImageResult.setIsLike(0);
toProductImageResult.setTaskId(taskId);
toProductImageResult.setUserLikeGroupId(userLikeGroupId);
toProductImageResult.setProjectId(projectId);
if (userLikeGroupId != null) {
toProductImageResult.setUserLikeGroupId(userLikeGroupId);
}
toProductImageResult.setImageStrength(toProductImageDTO.getImageStrength());
toProductImageResultMapper.insert(toProductImageResult);
// toProductImageResult.setUrl(minioUtil.getPresignedUrl(toProductImageResult.getUrl(), 24 * 60));
@@ -676,7 +688,12 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
public List<ToProductImageResultVO> productImageLikeList(ToProductImageDTO toProductImageDTO) {
QueryWrapper<ToProductImageResult> qw = new QueryWrapper<>();
qw.lambda().eq(ToProductImageResult::getIsLike, 1);
qw.lambda().eq(ToProductImageResult::getUserLikeGroupId, toProductImageDTO.getUserLikeGroupId());
Long projectId = toProductImageDTO.getProjectId();
// UserLikeGroup userLikeGroup = getByProjectId(projectId);
// Long userLikeGroupId = null;
qw.lambda().eq(ToProductImageResult::getProjectId, projectId);
List<ToProductImageResult> toProductImageResults = toProductImageResultMapper.selectList(qw);
for (ToProductImageResult toProductImageResult : toProductImageResults) {
toProductImageResult.setUrl(minioUtil.getPreSignedUrl(toProductImageResult.getUrl(), 24 * 60));
@@ -760,9 +777,17 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
}
AuthPrincipalVo userHolder = UserContext.getUserHolder();
Long userLikeGroupId = toProductImageDTO.getUserLikeGroupId();
Long projectId = toProductImageDTO.getProjectId();
UserLikeGroup userLikeGroup = getByProjectId(projectId);
Long userLikeGroupId = null;
ToProductImageRecord toProductImageRecord = new ToProductImageRecord();
toProductImageRecord.setUserLikeGroupId(userLikeGroupId);
toProductImageRecord.setProjectId(projectId);
if (Objects.nonNull(userLikeGroup)) {
userLikeGroupId = userLikeGroup.getId();
toProductImageRecord.setUserLikeGroupId(userLikeGroupId);
}
toProductImageRecord.setCreateTime(LocalDateTime.now());
if (!StringUtils.isEmpty(toProductImageDTO.getPrompt())) {
toProductImageRecord.setPrompt(toProductImageDTO.getPrompt());
@@ -805,7 +830,10 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
// toProductImageResult.setUrl(productImageUrl);
toProductImageResult.setIsLike(0);
toProductImageResult.setTaskId(taskId);
toProductImageResult.setUserLikeGroupId(userLikeGroupId);
toProductImageResult.setProjectId(projectId);
if (null != userLikeGroupId) {
toProductImageResult.setUserLikeGroupId(userLikeGroupId);
}
if (toProductImageDTO.getBrightenValue() != null) {
toProductImageResult.setBrightenValue(toProductImageDTO.getBrightenValue());
}
@@ -825,7 +853,10 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
// toProductImageResult.setUrl(productImageUrl);
toProductImageResult.setIsLike(0);
toProductImageResult.setTaskId(taskId);
toProductImageResult.setUserLikeGroupId(userLikeGroupId);
toProductImageResult.setProjectId(projectId);
if (null != userLikeGroupId) {
toProductImageResult.setUserLikeGroupId(userLikeGroupId);
}
if (toProductImageDTO.getBrightenValue() != null) {
toProductImageResult.setBrightenValue(toProductImageDTO.getBrightenValue());
}
@@ -1445,12 +1476,13 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
vo.setPortfolioDTO(portfolioDTO);
moduleChooseVO.setCanvas(vo);
}else if (module.equals(Module.toProduct.name())) {
UserLikeGroup userLikeGroup = getByProjectId(projectDTO.getId());
Long userLikeGroupId = userLikeGroup.getId();
Long projectId = projectDTO.getId();
// UserLikeGroup userLikeGroup = getByProjectId(projectDTO.getId());
// Long userLikeGroupId = userLikeGroup.getId();
QueryWrapper<ToProductImageResult> qw = new QueryWrapper<>();
qw.lambda().eq(ToProductImageResult::getIsLike, 1);
qw.lambda().eq(ToProductImageResult::getUserLikeGroupId, userLikeGroupId);
qw.lambda().eq(ToProductImageResult::getProjectId, projectId);
qw.lambda().eq(ToProductImageResult::getResultType, "ToProductImage");
List<ToProductImageResult> toProductImageResults = toProductImageResultMapper.selectList(qw);
for (ToProductImageResult toProductImageResult : toProductImageResults) {
@@ -1471,12 +1503,13 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
}
moduleChooseVO.setToProduct(toProductImageResultVOS);
}else if (module.equals(Module.relight.name())) {
UserLikeGroup userLikeGroup = getByProjectId(projectDTO.getId());
Long userLikeGroupId = userLikeGroup.getId();
Long projectId = projectDTO.getId();
// UserLikeGroup userLikeGroup = getByProjectId(projectDTO.getId());
// Long userLikeGroupId = userLikeGroup.getId();
QueryWrapper<ToProductImageResult> qw = new QueryWrapper<>();
qw.lambda().eq(ToProductImageResult::getIsLike, 1);
qw.lambda().eq(ToProductImageResult::getUserLikeGroupId, userLikeGroupId);
qw.lambda().eq(ToProductImageResult::getProjectId, projectId);
qw.lambda().eq(ToProductImageResult::getResultType, "Relight");
List<ToProductImageResult> toProductImageResults = toProductImageResultMapper.selectList(qw);
for (ToProductImageResult toProductImageResult : toProductImageResults) {