Merge branch 'dev/dev_xp' into dev/3.1_release_merge
This commit is contained in:
@@ -6,10 +6,7 @@ import com.ai.da.common.utils.RedisUtil;
|
||||
import com.ai.da.model.dto.GenerateThroughImageTextDTO;
|
||||
import com.ai.da.model.vo.GenerateResultVO;
|
||||
import com.ai.da.model.vo.PoseTransformationVO;
|
||||
import com.ai.da.service.CloudTaskService;
|
||||
import com.ai.da.service.DesignService;
|
||||
import com.ai.da.service.GenerateService;
|
||||
import com.ai.da.service.UserLikeGroupService;
|
||||
import com.ai.da.service.*;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.fasterxml.jackson.core.JsonParseException;
|
||||
@@ -17,17 +14,16 @@ import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.google.gson.Gson;
|
||||
import com.rabbitmq.client.Channel;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.text.StringEscapeUtils;
|
||||
import org.springframework.amqp.core.Message;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
@@ -37,25 +33,22 @@ import java.util.Objects;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class GenerateConsumer {
|
||||
|
||||
@Resource
|
||||
private GenerateService generateService;
|
||||
private final GenerateService generateService;
|
||||
|
||||
@Resource
|
||||
private UserLikeGroupService userLikeGroupService;
|
||||
private final UserLikeGroupService userLikeGroupService;
|
||||
|
||||
@Resource
|
||||
private DesignService designService;
|
||||
private final DesignService designService;
|
||||
|
||||
@Resource
|
||||
private CloudTaskService cloudTaskService;
|
||||
private final CloudTaskService cloudTaskService;
|
||||
|
||||
@Autowired
|
||||
private RabbitMQProperties rabbitMQProperties;
|
||||
private final RabbitMQProperties rabbitMQProperties;
|
||||
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
private final RedisUtil redisUtil;
|
||||
|
||||
private final MessageCenterService messageCenterService;
|
||||
|
||||
@Value("${redis.key.orderForGenerate}")
|
||||
private String consumptionOrderKey;
|
||||
|
||||
@@ -3,13 +3,12 @@ package com.ai.da.controller;
|
||||
import com.ai.da.common.config.exception.BusinessException;
|
||||
import com.ai.da.common.response.PageBaseResponse;
|
||||
import com.ai.da.common.response.Response;
|
||||
import com.ai.da.mapper.primary.entity.Account;
|
||||
import com.ai.da.model.dto.*;
|
||||
import com.ai.da.model.vo.*;
|
||||
import com.ai.da.model.vo.CommentVO;
|
||||
import com.ai.da.model.vo.PortfolioVO;
|
||||
import com.ai.da.model.vo.UserLikeChooseVO;
|
||||
import com.ai.da.service.PortfolioService;
|
||||
import com.ai.da.service.UserFollowService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -29,6 +28,9 @@ public class PortfolioController {
|
||||
@Resource
|
||||
private PortfolioService portfolioService;
|
||||
|
||||
@Resource
|
||||
private UserFollowService userFollowService;
|
||||
|
||||
@ApiOperation(value = "发布作品集")
|
||||
@PostMapping("/publish")
|
||||
public Response<Long> publish(@RequestParam("file") MultipartFile canvas, @RequestParam("data") String data) {
|
||||
@@ -138,13 +140,13 @@ public class PortfolioController {
|
||||
@ApiOperation(value = "获取关注列表")
|
||||
@PostMapping("/getFolloweeList")
|
||||
public Response<List<AccountFollowVO>> getFolloweeList(@Valid @RequestBody GetFollowListDTO getFollowListDTO) {
|
||||
return Response.success(portfolioService.getFolloweeList(getFollowListDTO));
|
||||
return Response.success(userFollowService.getFolloweeList(getFollowListDTO));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取粉丝列表")
|
||||
@PostMapping("/getFollowerList")
|
||||
public Response<List<AccountFollowVO>> getFollowerList(@Valid @RequestBody GetFollowListDTO getFollowListDTO) {
|
||||
return Response.success(portfolioService.getFollowerList(getFollowListDTO));
|
||||
return Response.success(userFollowService.getFollowerList(getFollowListDTO));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -95,10 +95,6 @@ public interface DesignService extends IService<Design> {
|
||||
|
||||
Integer designProcess(String processId);
|
||||
|
||||
void parseMoodboardPosition(String moodboardPosition, Long collectionIdParam);
|
||||
|
||||
void relationImageId(DesignPythonObjects objects);
|
||||
|
||||
List<CollectionSketchVO> sketchesBoundingBox(ReDesignCollectionDTO reDesignCollectionDTO);
|
||||
|
||||
List<String> getModel(List<Long> designItemIdList);
|
||||
@@ -124,6 +120,4 @@ public interface DesignService extends IService<Design> {
|
||||
Boolean cloudTaskNameUpdate(CloudTaskDTO cloudTaskDTO);
|
||||
|
||||
Boolean cloudTaskDelete(CloudTaskDTO cloudTaskDTO);
|
||||
|
||||
String getAgeGroupByProjectOrCollectionId(Long projectId, Long collectionId);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.ai.da.service;
|
||||
|
||||
import com.ai.da.mapper.primary.entity.MoodboardPosition;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
public interface MoodboardPositionService extends IService<MoodboardPosition> {
|
||||
|
||||
void parseMoodboardPosition(String moodboardPosition, Long collectionIdParam);
|
||||
}
|
||||
@@ -47,20 +47,8 @@ public interface PortfolioService extends IService<Portfolio> {
|
||||
|
||||
void cancelFollow(Long followeeId);
|
||||
|
||||
Long getFolloweeCount(Long accountId);
|
||||
|
||||
List<AccountFollowVO> getFolloweeList(GetFollowListDTO getFollowListDTO);
|
||||
|
||||
Long getFollowerCount(Long accountId);
|
||||
|
||||
List<AccountFollowVO> getFollowerList(GetFollowListDTO getFollowListDTO);
|
||||
|
||||
Integer getIfFollowed(Long followeeId, Long followerId);
|
||||
|
||||
Long getPortfolioCount(Long accountId);
|
||||
|
||||
List<Long> getFolloweeList(Long accountId);
|
||||
|
||||
// List<PortfolioVO> queryPortfolioByTag(String tagName, Long tagId);
|
||||
|
||||
void setPortfolioToPublic(Long portfolioId);
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.ai.da.service;
|
||||
|
||||
|
||||
import com.ai.da.mapper.primary.entity.PythonTAllInfo;
|
||||
import com.ai.da.python.vo.DesignPythonObjects;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
@@ -14,4 +15,6 @@ public interface PythonTAllInfoService extends IService<PythonTAllInfo> {
|
||||
|
||||
|
||||
Long getImageIdByPath(String path);
|
||||
|
||||
void relationImageId(DesignPythonObjects pythonObjects);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.ai.da.service;
|
||||
|
||||
import com.ai.da.mapper.primary.entity.ToProductImageResult;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
public interface ToProductImageResultService extends IService<ToProductImageResult> {
|
||||
|
||||
Long getUnlikedResultParentId(ToProductImageResult toProductImageResult, String url);
|
||||
}
|
||||
24
src/main/java/com/ai/da/service/UserFollowService.java
Normal file
24
src/main/java/com/ai/da/service/UserFollowService.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package com.ai.da.service;
|
||||
|
||||
import com.ai.da.mapper.primary.entity.UserFollow;
|
||||
import com.ai.da.model.dto.GetFollowListDTO;
|
||||
import com.ai.da.model.vo.AccountFollowVO;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface UserFollowService extends IService<UserFollow> {
|
||||
|
||||
Long getFollowerCount(Long accountId);
|
||||
|
||||
List<AccountFollowVO> getFollowerList(GetFollowListDTO getFollowListDTO);
|
||||
|
||||
Long getFolloweeCount(Long accountId);
|
||||
|
||||
List<AccountFollowVO> getFolloweeList(GetFollowListDTO getFollowListDTO);
|
||||
|
||||
Integer getIfFollowed(Long followeeId, Long followerId);
|
||||
|
||||
List<Long> getFolloweeList(Long accountId);
|
||||
|
||||
}
|
||||
@@ -121,6 +121,4 @@ public interface UserLikeGroupService extends IService<UserLikeGroup> {
|
||||
Boolean toProductImageElementDelete(Long id);
|
||||
|
||||
ToProductElementVO convertRelightElement(Long id);
|
||||
|
||||
Long getUnlikedResultParentId(ToProductImageResult toProductImageResult, String url);
|
||||
}
|
||||
|
||||
@@ -70,4 +70,6 @@ public interface WorkspaceService extends IService<Workspace> {
|
||||
String getProjectSexById(Long projectId);
|
||||
|
||||
String getStyleByProjectId(Long projectId);
|
||||
|
||||
String getAgeGroupByProjectOrCollectionId(Long projectId, Long collectionId);
|
||||
}
|
||||
|
||||
@@ -143,6 +143,9 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
@Resource
|
||||
private AffiliateService affiliateService;
|
||||
|
||||
@Resource
|
||||
private UserFollowService userFollowService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AccountPreLoginVO preLogin(AccountPreLoginDTO accountDTO) {
|
||||
@@ -261,8 +264,8 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
avatar = account.getAvatar();
|
||||
}
|
||||
response.setAvatar(minioUtil.getPreSignedUrl(avatar, CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
response.setFolloweeCount(portfolioService.getFolloweeCount(account.getId()));
|
||||
response.setFollowerCount(portfolioService.getFollowerCount(account.getId()));
|
||||
response.setFolloweeCount(userFollowService.getFolloweeCount(account.getId()));
|
||||
response.setFollowerCount(userFollowService.getFollowerCount(account.getId()));
|
||||
//判断是否常用ip 不是则发邮件提示
|
||||
calculateExceptionIp(RequestInfoUtil.getIpAddress(request), account);
|
||||
return response;
|
||||
@@ -2050,8 +2053,8 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
personalHomepageVO.setAvatar(minioUtil.getPreSignedUrl(avatar, CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
|
||||
personalHomepageVO.setPortfolioCount(portfolioService.getPortfolioCount(accountId));
|
||||
personalHomepageVO.setFolloweeCount(portfolioService.getFolloweeCount(accountId));
|
||||
personalHomepageVO.setFollowerCount(portfolioService.getFollowerCount(accountId));
|
||||
personalHomepageVO.setFolloweeCount(userFollowService.getFolloweeCount(accountId));
|
||||
personalHomepageVO.setFollowerCount(userFollowService.getFollowerCount(accountId));
|
||||
personalHomepageVO.setHomepageViewCount(viewPersonalHomepageCount(0L));
|
||||
|
||||
|
||||
@@ -2061,7 +2064,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
// 只有本人才能看到个人主页浏览量
|
||||
personalHomepageVO.setHomepageViewCount(viewCount == null ? 0 : viewCount);
|
||||
} else {
|
||||
personalHomepageVO.setIsFollow(portfolioService.getIfFollowed(accountId, currentUserId));
|
||||
personalHomepageVO.setIsFollow(userFollowService.getIfFollowed(accountId, currentUserId));
|
||||
// 非本人浏览主页时增加浏览量
|
||||
viewsIncrease(accountId);
|
||||
}
|
||||
@@ -2925,8 +2928,8 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
avatar = account.getAvatar();
|
||||
}
|
||||
response.setAvatar(minioUtil.getPreSignedUrl(avatar, CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
response.setFolloweeCount(portfolioService.getFolloweeCount(account.getId()));
|
||||
response.setFollowerCount(portfolioService.getFollowerCount(account.getId()));
|
||||
response.setFolloweeCount(userFollowService.getFolloweeCount(account.getId()));
|
||||
response.setFollowerCount(userFollowService.getFollowerCount(account.getId()));
|
||||
return response;
|
||||
} else {
|
||||
throw new IllegalArgumentException("Invalid ID token.");
|
||||
@@ -3030,8 +3033,8 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
avatar = account.getAvatar();
|
||||
}
|
||||
response.setAvatar(minioUtil.getPreSignedUrl(avatar, CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
response.setFolloweeCount(portfolioService.getFolloweeCount(account.getId()));
|
||||
response.setFollowerCount(portfolioService.getFollowerCount(account.getId()));
|
||||
response.setFolloweeCount(userFollowService.getFolloweeCount(account.getId()));
|
||||
response.setFollowerCount(userFollowService.getFollowerCount(account.getId()));
|
||||
return response;
|
||||
}
|
||||
|
||||
@@ -3122,8 +3125,8 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
avatar = account.getAvatar();
|
||||
}
|
||||
response.setAvatar(minioUtil.getPreSignedUrl(avatar, CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
response.setFolloweeCount(portfolioService.getFolloweeCount(account.getId()));
|
||||
response.setFollowerCount(portfolioService.getFollowerCount(account.getId()));
|
||||
response.setFolloweeCount(userFollowService.getFolloweeCount(account.getId()));
|
||||
response.setFollowerCount(userFollowService.getFollowerCount(account.getId()));
|
||||
|
||||
QueryWrapper<AccountExtend> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(AccountExtend::getAccountId, response.getUserId());
|
||||
|
||||
@@ -59,29 +59,19 @@ import java.util.stream.Collectors;
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementMapper, CollectionElement> implements CollectionElementService {
|
||||
@Resource
|
||||
private CollectionElementMapper collectionElementMapper;
|
||||
@Resource
|
||||
private FileProperties fileProperties;
|
||||
@Resource
|
||||
private PanToneService panToneService;
|
||||
@Resource
|
||||
private PythonService pythonService;
|
||||
@Resource
|
||||
private LibraryService libraryService;
|
||||
@Resource
|
||||
private SysFileService sysFileService;
|
||||
@Resource
|
||||
private GenerateMapper generateMapper;
|
||||
@Resource
|
||||
private GenerateDetailMapper generateDetailMapper;
|
||||
@Resource
|
||||
private LibraryModelPointService libraryModelPointService;
|
||||
@Resource
|
||||
private TCollectionElementRelationService tCollectionElementRelationService;
|
||||
@Resource
|
||||
private MinioUtil minioUtil;
|
||||
|
||||
private final CollectionElementMapper collectionElementMapper;
|
||||
private final EmailService emailService;
|
||||
private final FileProperties fileProperties;
|
||||
private final GenerateMapper generateMapper;
|
||||
private final GenerateDetailMapper generateDetailMapper;
|
||||
private final LibraryModelPointService libraryModelPointService;
|
||||
private final LibraryService libraryService;
|
||||
private final MinioUtil minioUtil;
|
||||
private final PanToneService panToneService;
|
||||
private final PythonService pythonService;
|
||||
private final RedisUtil redisUtil;
|
||||
private final SysFileService sysFileService;
|
||||
private final TCollectionElementRelationService tCollectionElementRelationService;
|
||||
private final WorkspaceService workspaceService;
|
||||
|
||||
@Value("${minio.bucketName.collectionElement}")
|
||||
@@ -90,13 +80,7 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
||||
private String gradientBucketName;
|
||||
@Value("${minio.bucketName.users}")
|
||||
private String userBucketName;
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
// @Resource
|
||||
// private RedisUtil redisUtil;
|
||||
@Resource
|
||||
private EmailService emailService;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.ai.da.common.enums.SingleOverallEnum;
|
||||
import com.ai.da.common.enums.SysFileLevel2TypeEnum;
|
||||
import com.ai.da.common.utils.*;
|
||||
import com.ai.da.mapper.primary.DesignItemMapper;
|
||||
import com.ai.da.mapper.primary.DesignMapper;
|
||||
import com.ai.da.mapper.primary.UserLikeMapper;
|
||||
import com.ai.da.mapper.primary.entity.*;
|
||||
import com.ai.da.model.dto.*;
|
||||
@@ -27,6 +28,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
import com.google.common.collect.Lists;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.SerializationUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -55,37 +57,25 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignItem> implements DesignItemService {
|
||||
@Resource
|
||||
private DesignItemMapper designItemMapper;
|
||||
@Resource
|
||||
private SysFileService sysFileService;
|
||||
@Resource
|
||||
private PythonService pythonService;
|
||||
@Resource
|
||||
private DesignService designService;
|
||||
@Resource
|
||||
private DesignItemDetailService designItemDetailService;
|
||||
@Resource
|
||||
private LibraryModelPointService libraryModelPointService;
|
||||
@Resource
|
||||
private LibraryService libraryService;
|
||||
@Resource
|
||||
private CollectionElementService collectionElementService;
|
||||
@Resource
|
||||
private ITDesignPythonOutfitService designPythonOutfitService;
|
||||
@Resource
|
||||
private ITDesignPythonOutfitDetailService designPythonOutfitDetailService;
|
||||
@Resource
|
||||
private PanToneService panToneService;
|
||||
@Resource
|
||||
private DesignItemDetailPrintService designItemDetailPrintService;
|
||||
@Resource
|
||||
private MinioUtil minioUtil;
|
||||
@Resource
|
||||
private UserLikeService userLikeService;
|
||||
@Resource
|
||||
private UserLikeGroupService userLikeGroupService;
|
||||
|
||||
private final CollectionElementService collectionElementService;
|
||||
private final DesignMapper designMapper;
|
||||
private final DesignItemMapper designItemMapper;
|
||||
private final DesignItemDetailService designItemDetailService;
|
||||
private final DesignItemDetailPrintService designItemDetailPrintService;
|
||||
private final ITDesignPythonOutfitService designPythonOutfitService;
|
||||
private final ITDesignPythonOutfitDetailService designPythonOutfitDetailService;
|
||||
private final LibraryService libraryService;
|
||||
private final LibraryModelPointService libraryModelPointService;
|
||||
private final MinioUtil minioUtil;
|
||||
private final PythonService pythonService;
|
||||
private final PanToneService panToneService;
|
||||
private final SysFileService sysFileService;
|
||||
private final UserLikeService userLikeService;
|
||||
private final UserLikeGroupService userLikeGroupService;
|
||||
private final WorkspaceService workspaceService;
|
||||
|
||||
@Value("${minio.bucketName.modifiedSketch}")
|
||||
private String modifiedSketchBucket;
|
||||
@@ -196,7 +186,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
if (Objects.isNull(designItem)) {
|
||||
throw new BusinessException("designItem.not.found");
|
||||
}
|
||||
Design design = designService.getById(designItem.getDesignId());
|
||||
Design design = designMapper.selectById(designItem.getDesignId());
|
||||
if (Objects.isNull(design)) {
|
||||
throw new BusinessException("design.not.found");
|
||||
}
|
||||
@@ -246,7 +236,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
if (Objects.isNull(designItem)) {
|
||||
throw new BusinessException("designItem.not.found");
|
||||
}
|
||||
Design design = designService.getById(designItem.getDesignId());
|
||||
Design design = designMapper.selectById(designItem.getDesignId());
|
||||
if (Objects.isNull(design)) {
|
||||
throw new BusinessException("design.not.found");
|
||||
}
|
||||
@@ -283,6 +273,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// todo check这个方法是否还在用
|
||||
private DesignCollectionItemVO saveSingleDesignItemAndDetail(DesignPythonObjects pythonObjects
|
||||
, Long designId, Long designItemId, Long collectionId, AuthPrincipalVo userInfo, String timeZone) {
|
||||
@@ -501,7 +492,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
if (Objects.isNull(designItem)) {
|
||||
throw new BusinessException("designItem.not.found");
|
||||
}
|
||||
Design design = designService.getById(designItem.getDesignId());
|
||||
Design design = designMapper.selectById(designItem.getDesignId());
|
||||
if (Objects.isNull(design)) {
|
||||
throw new BusinessException("design.not.found");
|
||||
}
|
||||
@@ -744,7 +735,8 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
JSONObject jsonObject = layers.getJSONObject(i);
|
||||
String priority = jsonObject.getString("priority");
|
||||
String category = jsonObject.getString("image_category").split("_")[0];
|
||||
if (!category.equals("body") && !priorityAndLayer.containsKey(priority)) priorityAndLayer.put(priority, Arrays.asList(jsonObject.getString("pattern_overall_image_url"), jsonObject.getString("pattern_print_image_url")));
|
||||
if (!category.equals("body") && !priorityAndLayer.containsKey(priority))
|
||||
priorityAndLayer.put(priority, Arrays.asList(jsonObject.getString("pattern_overall_image_url"), jsonObject.getString("pattern_print_image_url")));
|
||||
}
|
||||
return priorityAndLayer;
|
||||
}
|
||||
@@ -756,7 +748,8 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
for (int i = 0; i < layers.size(); i++) {
|
||||
JSONObject jsonObject = layers.getJSONObject(i);
|
||||
String category = jsonObject.getString("image_category").split("_")[0];
|
||||
if (!category.equals("body") && !typeAndLayer.containsKey(category)) typeAndLayer.put(category, jsonObject.getString("pattern_image_url"));
|
||||
if (!category.equals("body") && !typeAndLayer.containsKey(category))
|
||||
typeAndLayer.put(category, jsonObject.getString("pattern_image_url"));
|
||||
}
|
||||
return typeAndLayer;
|
||||
}
|
||||
@@ -846,6 +839,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
userLikeGroupService.updateDate(userLikeGroupId, timeZone);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateUserLikeConvertStatus(Long designItemId, String timeZone) {
|
||||
UserLike userLike = userLikeService.getByDesignItemId(designItemId);
|
||||
if (!ObjectUtil.isEmpty(userLike) && userLike.getConverted() == 0) {
|
||||
@@ -886,7 +880,8 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
// 重置sketch的minio临时访问凭证
|
||||
designItemClothesDetailVO.setPath(minioUtil.getPreSignedUrl(singleItem.getPath(), 24 * 60, true));
|
||||
designItemClothesDetailVO.setMinIOPath(singleItem.getPath());
|
||||
if (!StringUtil.isNullOrEmpty(singleItem.getColor())) designItemClothesDetailVO.setColor(panToneService.getPantoneByRgb(singleItem.getColor()));
|
||||
if (!StringUtil.isNullOrEmpty(singleItem.getColor()))
|
||||
designItemClothesDetailVO.setColor(panToneService.getPantoneByRgb(singleItem.getColor()));
|
||||
designItemClothesDetailVO.setPrintObject(singleItem.getPrintObject());
|
||||
designItemClothesDetailVO.setTrims(singleItem.getTrims());
|
||||
designItemClothesDetailVO.setLayersObject(layersObject.stream().filter(
|
||||
@@ -1032,7 +1027,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
library.setLevel1Type(CollectionLevel1TypeEnum.SKETCH_BOARD.getRealName());
|
||||
library.setLevel2Type(designSingleItem.getType());
|
||||
library.setLevel3Type(designSingleIncludeLayersDTO.getGender());
|
||||
String ageGroup = designService.getAgeGroupByProjectOrCollectionId(designSingleIncludeLayersDTO.getProjectId(), null);
|
||||
String ageGroup = workspaceService.getAgeGroupByProjectOrCollectionId(designSingleIncludeLayersDTO.getProjectId(), null);
|
||||
library.setAgeGroup(ageGroup);
|
||||
library.setUrl(designSingleItem.getPath());
|
||||
library.setName(LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")));
|
||||
@@ -1099,6 +1094,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
|
||||
@Resource
|
||||
private UserLikeMapper userLikeMapper;
|
||||
|
||||
@Override
|
||||
public void convertHistoryMaskWithoutGradient() {
|
||||
// 1、获取全部需要转换的designOutfitId
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.Lists;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import okhttp3.*;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@@ -61,56 +62,47 @@ import static com.ai.da.python.vo.DesignPythonItem.*;
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> implements DesignService {
|
||||
@Resource
|
||||
private DesignMapper designMapper;
|
||||
@Resource
|
||||
private CollectionElementService collectionElementService;
|
||||
@Resource
|
||||
private CollectionService collectionService;
|
||||
@Resource
|
||||
private PythonService pythonService;
|
||||
@Resource
|
||||
private LibraryService libraryService;
|
||||
@Resource
|
||||
private GenerateDetailMapper generateDetailMapper;
|
||||
@Resource
|
||||
private DesignItemService designItemService;
|
||||
@Resource
|
||||
private DesignItemDetailService designItemDetailService;
|
||||
@Resource
|
||||
private FileProperties fileProperties;
|
||||
@Resource
|
||||
private UserLikeGroupService userLikeGroupService;
|
||||
@Resource
|
||||
private UserLikeService userLikeService;
|
||||
@Resource
|
||||
private SysFileService sysFileService;
|
||||
@Resource
|
||||
private TCollectionElementRelationService tCollectionElementRelationService;
|
||||
@Resource
|
||||
private ITDesignPythonOutfitService designPythonOutfitService;
|
||||
@Resource
|
||||
private ITDesignPythonOutfitDetailService designPythonOutfitDetailService;
|
||||
@Resource
|
||||
private PanToneService panToneService;
|
||||
@Resource
|
||||
private PythonTAllInfoService pythonTAllInfoService;
|
||||
@Resource
|
||||
private DesignItemDetailPrintService designItemDetailPrintService;
|
||||
|
||||
@Resource
|
||||
private TDesignPythonOutfitMapper designPythonOutfitMapper;
|
||||
@Resource
|
||||
private DesignItemDetailMapper designItemDetailMapper;
|
||||
@Resource
|
||||
private ToProductImageResultMapper toProductImageResultMapper;
|
||||
@Resource
|
||||
private ToProductElementMapper toProductElementMapper;
|
||||
@Resource
|
||||
private MoodboardPositionMapper moodboardPositionMapper;
|
||||
@Resource
|
||||
private CollectionSortService collectionSortService;
|
||||
private final CloudTaskMapper cloudTaskMapper;
|
||||
private final CloudTaskService cloudTaskService;
|
||||
private final CreditsService creditsService;
|
||||
private final CollectionElementService collectionElementService;
|
||||
private final CollectionService collectionService;
|
||||
private final CollectionSortService collectionSortService;
|
||||
private final ColorLoopUpTableService colorLoopUpTableService;
|
||||
private final CollectionElementRelModelMapper collectionElementRelModelMapper;
|
||||
private final DesignBatchMapper designBatchMapper;
|
||||
private final DesignMapper designMapper;
|
||||
private final DesignItemService designItemService;
|
||||
private final DesignItemDetailMapper designItemDetailMapper;
|
||||
private final DesignItemDetailService designItemDetailService;
|
||||
private final DesignItemDetailPrintService designItemDetailPrintService;
|
||||
private final TDesignPythonOutfitMapper designPythonOutfitMapper;
|
||||
private final ITDesignPythonOutfitService designPythonOutfitService;
|
||||
private final ITDesignPythonOutfitDetailService designPythonOutfitDetailService;
|
||||
private final FileProperties fileProperties;
|
||||
private final GenerateDetailMapper generateDetailMapper;
|
||||
private final LibraryService libraryService;
|
||||
private final MinioUtil minioUtil;
|
||||
private final MoodboardPositionMapper moodboardPositionMapper;
|
||||
private final ProjectService projectService;
|
||||
private final PythonService pythonService;
|
||||
private final PanToneMapper panToneMapper;
|
||||
private final PanToneService panToneService;
|
||||
private final PoseTransformationMapper poseTransformationMapper;
|
||||
private final PythonTAllInfoService pythonTAllInfoService;
|
||||
private final RedisUtil redisUtil;
|
||||
private final SysFileService sysFileService;
|
||||
private final TCollectionElementRelationService tCollectionElementRelationService;
|
||||
private final ToProductImageResultMapper toProductImageResultMapper;
|
||||
private final ToProductElementMapper toProductElementMapper;
|
||||
private final ToProductImageRecordMapper toProductImageRecordMapper;
|
||||
private final UserLikeGroupService userLikeGroupService;
|
||||
private final UserLikeService userLikeService;
|
||||
private final UserBehaviorMapper userBehaviorMapper;
|
||||
private final UserPreferenceLogMapper userPreferenceLogMapper;
|
||||
private final WorkspaceService workspaceService;
|
||||
|
||||
@Value("${minio.endpoint}")
|
||||
private String endpoint;
|
||||
@@ -123,34 +115,6 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
@Value("${access.python.port:''}")
|
||||
private String accessPythonPort;
|
||||
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
@Resource
|
||||
private PoseTransformationMapper poseTransformationMapper;
|
||||
|
||||
@Resource
|
||||
private DesignBatchMapper designBatchMapper;
|
||||
@Resource
|
||||
private ProjectService projectService;
|
||||
@Resource
|
||||
private WorkspaceService workspaceService;
|
||||
@Resource
|
||||
private CloudTaskMapper cloudTaskMapper;
|
||||
@Resource
|
||||
private CloudTaskService cloudTaskService;
|
||||
@Resource
|
||||
private CreditsService creditsService;
|
||||
@Resource
|
||||
private ToProductImageRecordMapper toProductImageRecordMapper;
|
||||
@Resource
|
||||
private ColorLoopUpTableService colorLoopUpTableService;
|
||||
@Resource
|
||||
private UserBehaviorMapper userBehaviorMapper;
|
||||
@Resource
|
||||
private UserPreferenceLogMapper userPreferenceLogMapper;
|
||||
@Resource
|
||||
private CollectionElementRelModelMapper collectionElementRelModelMapper;
|
||||
|
||||
private final ConcurrentHashMap<String, Map<String, Object>> designContext = new ConcurrentHashMap<>();
|
||||
|
||||
|
||||
@@ -323,11 +287,11 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
// List<Long> reLationelementIds = reLationelements.stream().map(CollectionElement::getId).collect(Collectors.toList());
|
||||
// handleCollectionElementRelation(collectionId, (null == collectionIdParam) ? false : true, reLationelementIds);
|
||||
// //保存python返回信息
|
||||
|
||||
/// / return savePythonDesignItemAndDetail(pythonObjects,designId,collectionId,userInfo,designDTO.getTimeZone(),responseJSONObject);
|
||||
// //保存designItem 和detail
|
||||
// return saveDesignItemAndDetail(pythonObjects, designId, collectionId, userInfo, designDTO.getTimeZone());
|
||||
// }
|
||||
|
||||
private String designOrRedesignOperateNew(DesignCollectionDTO designDTO, AuthPrincipalVo userInfo,
|
||||
Long collectionIdParam, ValidateElementVO elementVO) {
|
||||
// if (CollectionUtil.isNotEmpty(designDTO.getSketchBoards())) {
|
||||
@@ -388,7 +352,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
|
||||
// 生成library - 根据设计元素生成设计库信息
|
||||
startTime = System.currentTimeMillis();
|
||||
String ageGroup = getAgeGroupByProjectOrCollectionId(designDTO.getProjectId(), collectionId);
|
||||
String ageGroup = workspaceService.getAgeGroupByProjectOrCollectionId(designDTO.getProjectId(), collectionId);
|
||||
generateLibrary(elementVO, designDTO.getTimeZone(), ageGroup);
|
||||
//处理关联关系,修复element覆盖得情况
|
||||
// List<CollectionElement> relationElements = collectionElementService.getByOnlyCollectionId(collectionId);
|
||||
@@ -419,124 +383,6 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
return requestId;
|
||||
}
|
||||
|
||||
public String getAgeGroupByProjectOrCollectionId(Long projectId, Long collectionId){
|
||||
if (Objects.nonNull(projectId)){
|
||||
Workspace workspace = workspaceService.getWSByProjectId(projectId);
|
||||
if (workspace != null && !StringUtil.isNullOrEmpty(workspace.getAgeGroup())){
|
||||
return workspace.getAgeGroup();
|
||||
}
|
||||
} else if (Objects.nonNull(collectionId) && collectionId != 0){
|
||||
List<CollectionElement> byCollectionId = collectionElementService.getByCollectionId(collectionId);
|
||||
if (byCollectionId != null && !byCollectionId.isEmpty()){
|
||||
projectId = byCollectionId.get(0).getProjectId();
|
||||
if (projectId != null && projectId != 0L){
|
||||
Workspace workspace = workspaceService.getWSByProjectId(projectId);
|
||||
if (workspace != null && !StringUtil.isNullOrEmpty(workspace.getAgeGroup())){
|
||||
return workspace.getAgeGroup();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return AgeGroup.ADULT.getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void parseMoodboardPosition(String moodboardPosition, Long collectionIdParam) {
|
||||
if (!StringUtils.isEmpty(moodboardPosition)) {
|
||||
// 将 JSON 字符串解析为 JSONObject
|
||||
JSONObject moodboardPositionJson = JSONObject.parseObject(moodboardPosition);
|
||||
|
||||
// 准备保存的 MoodboardPosition 列表
|
||||
List<MoodboardPosition> moodboardPositions = new ArrayList<>();
|
||||
|
||||
// 遍历 JSON 对象的 key(即样式类型)
|
||||
for (String key : moodboardPositionJson.keySet()) {
|
||||
// 特殊处理 "class" 字段
|
||||
if ("class".equals(key)) {
|
||||
// 获取 "class" 字段的值并将其转为 List<String>
|
||||
JSONArray classArray = moodboardPositionJson.getJSONArray(key);
|
||||
if (classArray != null) {
|
||||
|
||||
for (int j = 0; j < classArray.size(); j++) {
|
||||
// 将 classList 存入 MoodboardPosition(或者其他结构)
|
||||
|
||||
MoodboardPosition position = new MoodboardPosition()
|
||||
.setCollectionId(collectionIdParam) // 关联 Collection ID
|
||||
.setType(key) // 样式类型
|
||||
.setStyleData(classArray.getString(j)) // 设置 class 字段
|
||||
.setSequence(j) // 根据索引值设置顺序
|
||||
.setCreateTime(LocalDateTime.now()) // 创建时间
|
||||
.setUpdateTime(LocalDateTime.now()); // 更新时间
|
||||
|
||||
// 添加到列表中
|
||||
moodboardPositions.add(position);
|
||||
}
|
||||
}
|
||||
continue; // 跳过 "class" 字段的常规处理
|
||||
}
|
||||
|
||||
JSONArray styleArray = moodboardPositionJson.getJSONArray(key);
|
||||
if (styleArray != null) {
|
||||
for (int i = 0; i < styleArray.size(); i++) {
|
||||
// 获取当前样式数据
|
||||
JSONObject styleData = styleArray.getJSONObject(i);
|
||||
|
||||
// 构建 MoodboardPosition 实例
|
||||
MoodboardPosition position = new MoodboardPosition()
|
||||
.setCollectionId(collectionIdParam) // 关联 Collection ID
|
||||
.setType(key) // 样式类型
|
||||
.setStyleData(styleData.toJSONString()) // 样式数据存为 JSON 字符串
|
||||
.setSequence(i) // 根据索引值设置顺序
|
||||
.setCreateTime(LocalDateTime.now()) // 创建时间
|
||||
.setUpdateTime(LocalDateTime.now()); // 更新时间
|
||||
|
||||
// 添加到列表中
|
||||
moodboardPositions.add(position);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 如果解析结果非空,保存到数据库
|
||||
if (!moodboardPositions.isEmpty()) {
|
||||
for (MoodboardPosition position : moodboardPositions) {
|
||||
moodboardPositionMapper.insert(position);
|
||||
}
|
||||
log.info("成功解析并保存 {} 条 MoodboardPosition 数据", moodboardPositions.size());
|
||||
} else {
|
||||
log.warn("未找到可保存的 MoodboardPosition 数据");
|
||||
}
|
||||
} else {
|
||||
log.warn("传入的 moodboardPosition 字段为空");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void relationImageId(DesignPythonObjects pythonObjects) {
|
||||
if (Objects.isNull(pythonObjects)) {
|
||||
return;
|
||||
}
|
||||
pythonObjects.getObjects().forEach(
|
||||
o -> {
|
||||
for (DesignPythonItem item : o.getItems()) {
|
||||
List<Long> list = new ArrayList<>();
|
||||
list.add(1L);
|
||||
list.add(1L);
|
||||
item.setOffset(list);
|
||||
item.setResize_scale(new Float[]{1.0f,1.0f});
|
||||
String path = item.getPath();
|
||||
if (StringUtils.isEmpty(path)) {
|
||||
String bodyPath = item.getBody_path();
|
||||
Long imageId = pythonTAllInfoService.getImageIdByPath(bodyPath);
|
||||
item.setImage_id(imageId);
|
||||
} else {
|
||||
Long imageId = pythonTAllInfoService.getImageIdByPath(path);
|
||||
item.setImage_id(imageId);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CollectionSketchVO> sketchesBoundingBox(ReDesignCollectionDTO reDesignDTO) {
|
||||
List<CollectionSketchDTO> sketchBoards = new ArrayList<>();
|
||||
@@ -757,8 +603,6 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
LocalCacheUtils.setDesignProcessCache(userId, saveNames);
|
||||
}
|
||||
|
||||
@Resource
|
||||
private MinioUtil minioUtil;
|
||||
|
||||
private DesignCollectionVO savePythonDesignItemAndDetailSingle(DesignPythonObjects pythonObjects, Long designId, Long collectionId, AuthPrincipalVo userInfo, String timeZone, JSONObject outfit, String singleOverall, Map<String, Object> context) {
|
||||
Object designCollectionVO = context.get("DesignCollectionVO");
|
||||
@@ -928,6 +772,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
private DesignCollectionVO savePythonDesignItemAndDetail(DesignPythonObjects pythonObjects
|
||||
, Long designId, Long collectionId, AuthPrincipalVo userInfo, String timeZone, JSONObject responseJSONObject, String singleOverall) {
|
||||
DesignCollectionVO response = new DesignCollectionVO();
|
||||
@@ -1197,7 +1042,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public DesignLikeVO like(DesignLikeDTO designLikeDTO) {
|
||||
Long userGroupId = designLikeDTO.getUserGroupId();;
|
||||
Long userGroupId = designLikeDTO.getUserGroupId();
|
||||
Long groupDetailId;
|
||||
AuthPrincipalVo userInfo = UserContext.getUserHolder();
|
||||
DesignItem designItem = designItemService.getById(designLikeDTO.getDesignItemId());
|
||||
@@ -2526,7 +2371,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
log.info("design python端运行时间:" + totalTimeInSeconds + " 秒");
|
||||
//生成library
|
||||
startTime = System.currentTimeMillis();
|
||||
String ageGroup = getAgeGroupByProjectOrCollectionId(designDTO.getProjectId(), collectionId);
|
||||
String ageGroup = workspaceService.getAgeGroupByProjectOrCollectionId(designDTO.getProjectId(), collectionId);
|
||||
generateLibrary(elementVO, designDTO.getTimeZone(), ageGroup);
|
||||
//处理关联关系,修复element覆盖得情况
|
||||
// List<CollectionElement> relationElements = collectionElementService.getByOnlyCollectionId(collectionId);
|
||||
@@ -2902,9 +2747,6 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
return result;
|
||||
}
|
||||
|
||||
@Resource
|
||||
private PanToneMapper panToneMapper;
|
||||
|
||||
@Override
|
||||
public Boolean receiveDesignParams(ReceiveDesignParam receiveDesignParam) {
|
||||
List<ReceiveCollectionElement> receiveCollectionElementList = receiveDesignParam.getReceiveCollectionElementList();
|
||||
|
||||
@@ -88,33 +88,31 @@ import static com.ai.da.common.enums.WangXiangTaskStatusEnum.UNKNOWN_W;
|
||||
@RequiredArgsConstructor
|
||||
public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> implements GenerateService {
|
||||
|
||||
private final CollectionElementMapper collectionElementMapper;
|
||||
private final GenerateDetailMapper generateDetailMapper;
|
||||
private final LibraryService libraryService;
|
||||
private final PythonService pythonService;
|
||||
private final CollectionElementService collectionElementService;
|
||||
private final CreditsService creditsService;
|
||||
private final MinioUtil minioUtil;
|
||||
private final RabbitMQService rabbitMQService;
|
||||
private final RedisUtil redisUtil;
|
||||
private final GenerateCancelMapper generateCancelMapper;
|
||||
private final SketchReconstructionMapper sketchReconstructionMapper;
|
||||
private final SendRequestUtil sendRequestUtil;
|
||||
private final ProjectService projectService;
|
||||
private final CollectionSortService collectionSortService;
|
||||
private final CloudTaskService cloudTaskService;
|
||||
private final APIGenerateMapper apiGenerateMapper;
|
||||
private final CollectionSortMapper collectionSortMapper;
|
||||
private final SysFileService sysFileService;
|
||||
private final LibraryModelPointService libraryModelPointService;
|
||||
private final PoseTransformationMapper poseTransformationMapper;
|
||||
private final CloudTaskMapper cloudTaskMapper;
|
||||
private final ToProductImageResultMapper toProductImageResultMapper;
|
||||
private final AccountService accountService;
|
||||
private final APIGenerateService apiGenerateService;
|
||||
private final UserLikeGroupService userLikeGroupService;
|
||||
private final CollectionElementMapper collectionElementMapper;
|
||||
private final CollectionElementService collectionElementService;
|
||||
private final CreditsService creditsService;
|
||||
private final CollectionSortMapper collectionSortMapper;
|
||||
private final CollectionSortService collectionSortService;
|
||||
private final CloudTaskMapper cloudTaskMapper;
|
||||
private final CloudTaskService cloudTaskService;
|
||||
private final GenerateCancelMapper generateCancelMapper;
|
||||
private final GenerateDetailMapper generateDetailMapper;
|
||||
private final LibraryService libraryService;
|
||||
// private final LibraryModelPointService libraryModelPointService;
|
||||
private final MinioUtil minioUtil;
|
||||
private final MessageCenterService messageCenterService;
|
||||
|
||||
private final PythonService pythonService;
|
||||
private final ProjectService projectService;
|
||||
private final PoseTransformationMapper poseTransformationMapper;
|
||||
private final RabbitMQService rabbitMQService;
|
||||
private final RedisUtil redisUtil;
|
||||
private final SketchReconstructionMapper sketchReconstructionMapper;
|
||||
private final SendRequestUtil sendRequestUtil;
|
||||
private final SysFileService sysFileService;
|
||||
private final ToProductImageResultMapper toProductImageResultMapper;
|
||||
private final ToProductImageResultService toProductImageResultService;
|
||||
@Value("${redis.key.orderForGenerate}")
|
||||
private String consumptionOrderKey;
|
||||
|
||||
@@ -2735,7 +2733,7 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
Long parentId = collectionSortService.getParentIdByElementIdAndElementType(
|
||||
productResult.getId(), CollectionType.TO_PRODUCT_IMAGE.getValue());
|
||||
if (Objects.isNull(parentId)) {
|
||||
parentId = userLikeGroupService.getUnlikedResultParentId(null, poseTransformation.getProductImage());
|
||||
parentId = toProductImageResultService.getUnlikedResultParentId(null, poseTransformation.getProductImage());
|
||||
}
|
||||
vo.setParentId(parentId);
|
||||
vo.setId(poseTransformation.getId());
|
||||
@@ -4214,8 +4212,7 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
}
|
||||
}
|
||||
|
||||
public
|
||||
com.alibaba.fastjson.JSONObject createParamsForMotion(PoseTransformDTO poseTransformDTO, String taskId) {
|
||||
public com.alibaba.fastjson.JSONObject createParamsForMotion(PoseTransformDTO poseTransformDTO, String taskId) {
|
||||
|
||||
com.alibaba.fastjson.JSONObject params = new com.alibaba.fastjson.JSONObject();
|
||||
params.put("tasks_id", taskId);
|
||||
|
||||
@@ -17,21 +17,20 @@ import com.ai.da.model.enums.Sex;
|
||||
import com.ai.da.model.vo.LibraryModelPointVO;
|
||||
import com.ai.da.python.PythonService;
|
||||
import com.ai.da.python.vo.DesignPythonObjects;
|
||||
import com.ai.da.service.DesignService;
|
||||
import com.ai.da.service.LibraryModelPointService;
|
||||
import com.ai.da.service.LibraryService;
|
||||
import com.ai.da.service.PythonTAllInfoService;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -45,17 +44,13 @@ import java.util.Objects;
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class LibraryModelPointServiceImpl extends ServiceImpl<LibraryModelPointMapper, LibraryModelPoint> implements LibraryModelPointService {
|
||||
@Resource
|
||||
private LibraryModelPointMapper libraryModelPointMapper;
|
||||
@Resource
|
||||
private LibraryService libraryService;
|
||||
@Resource
|
||||
private PythonService pythonService;
|
||||
@Resource
|
||||
private DesignService designService;
|
||||
@Autowired
|
||||
private MinioUtil minioUtil;
|
||||
private final LibraryModelPointMapper libraryModelPointMapper;
|
||||
private final LibraryService libraryService;
|
||||
private final MinioUtil minioUtil;
|
||||
private final PythonService pythonService;
|
||||
private final PythonTAllInfoService pythonTAllInfoService;
|
||||
|
||||
@Override
|
||||
public LibraryModelPointVO saveOrEditTemplatePoint(LibraryModelPointDTO libraryModelPointDTO) {
|
||||
@@ -226,7 +221,7 @@ public class LibraryModelPointServiceImpl extends ServiceImpl<LibraryModelPointM
|
||||
public String modelsDot(ModelsDotDTO modelsDotDTO) {
|
||||
DesignPythonObjects objects = pythonService.covertModelsDotParam(
|
||||
modelsDotDTO, SingleOverallEnum.OVERALL.getRealName(), "");
|
||||
designService.relationImageId(objects);
|
||||
pythonTAllInfoService.relationImageId(objects);
|
||||
JSONObject jsonObject = pythonService.designNew(objects);
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
if (data == null) {
|
||||
|
||||
@@ -8,20 +8,15 @@ import com.ai.da.common.utils.CopyUtil;
|
||||
import com.ai.da.common.utils.MinioUtil;
|
||||
import com.ai.da.common.utils.RedisUtil;
|
||||
import com.ai.da.common.websocket.NotificationConnection;
|
||||
import com.ai.da.mapper.primary.CanvasMapper;
|
||||
import com.ai.da.mapper.primary.NotificationMapper;
|
||||
import com.ai.da.mapper.primary.SysNotificationReadStatusMapper;
|
||||
import com.ai.da.mapper.primary.entity.Account;
|
||||
import com.ai.da.mapper.primary.entity.Notification;
|
||||
import com.ai.da.mapper.primary.entity.Portfolio;
|
||||
import com.ai.da.mapper.primary.entity.SysNotificationReadStatus;
|
||||
import com.ai.da.mapper.primary.*;
|
||||
import com.ai.da.mapper.primary.entity.*;
|
||||
import com.ai.da.model.dto.GetNotificationDTO;
|
||||
import com.ai.da.model.dto.PublishSysNotificationDTO;
|
||||
import com.ai.da.model.enums.Language;
|
||||
import com.ai.da.model.vo.NotificationVO;
|
||||
import com.ai.da.service.AccountService;
|
||||
import com.ai.da.service.MessageCenterService;
|
||||
import com.ai.da.service.PortfolioService;
|
||||
import com.ai.da.service.UserFollowService;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
@@ -31,12 +26,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.google.gson.Gson;
|
||||
import com.mysql.cj.util.StringUtils;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
@@ -45,22 +39,18 @@ import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class MessageCenterServiceImpl extends ServiceImpl<NotificationMapper, Notification> implements MessageCenterService {
|
||||
|
||||
@Resource
|
||||
private NotificationConnection notificationConnection;
|
||||
@Resource
|
||||
private SysNotificationReadStatusMapper sysNotificationReadStatusMapper;
|
||||
@Resource
|
||||
private AccountService accountService;
|
||||
@Resource
|
||||
private MinioUtil minioUtil;
|
||||
@Resource
|
||||
private PortfolioService portfolioService;
|
||||
@Resource
|
||||
private CanvasMapper canvasMapper;
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
private final AccountService accountService;
|
||||
private final CanvasMapper canvasMapper;
|
||||
private final MinioUtil minioUtil;
|
||||
private final NotificationConnection notificationConnection;
|
||||
private final PortfolioMapper portfolioMapper;
|
||||
private final RedisUtil redisUtil;
|
||||
private final SysNotificationReadStatusMapper sysNotificationReadStatusMapper;
|
||||
private final UserFollowService userFollowService;
|
||||
|
||||
@Value("${redis.key.newPosted}")
|
||||
private String lastViewNewPostedTimeKey;
|
||||
|
||||
@@ -125,7 +115,7 @@ public class MessageCenterServiceImpl extends ServiceImpl<NotificationMapper, No
|
||||
if (Objects.isNull(notificationVO.getPortfolioId())) {
|
||||
notificationVO.setPortfolioId(null);
|
||||
} else {
|
||||
Portfolio byId = portfolioService.getById(notificationVO.getPortfolioId());
|
||||
Portfolio byId = portfolioMapper.selectById(notificationVO.getPortfolioId());
|
||||
if (!Objects.isNull(byId)) {
|
||||
if (Objects.isNull(byId.getPortfolioName())) {
|
||||
notificationVO.setPortfolioName(null);
|
||||
@@ -171,6 +161,7 @@ public class MessageCenterServiceImpl extends ServiceImpl<NotificationMapper, No
|
||||
/**
|
||||
* 只记录唯一点赞和关注
|
||||
* 重复点赞、关注只会记录最新的一次操作
|
||||
*
|
||||
* @param notification
|
||||
* @return
|
||||
*/
|
||||
@@ -207,8 +198,8 @@ public class MessageCenterServiceImpl extends ServiceImpl<NotificationMapper, No
|
||||
if (type.equals("follow")) {
|
||||
HashMap<String, Object> followee = new HashMap<>();
|
||||
HashMap<String, Object> follower = new HashMap<>();
|
||||
follower.put("followerCount",portfolioService.getFollowerCount(receiverId));
|
||||
followee.put("followeeCount",portfolioService.getFolloweeCount(receiverId));
|
||||
follower.put("followerCount", userFollowService.getFollowerCount(receiverId));
|
||||
followee.put("followeeCount", userFollowService.getFolloweeCount(receiverId));
|
||||
resp.add(followee);
|
||||
resp.add(follower);
|
||||
}
|
||||
@@ -324,7 +315,7 @@ public class MessageCenterServiceImpl extends ServiceImpl<NotificationMapper, No
|
||||
|
||||
public Long getNewPostedCount(Long accountId) {
|
||||
// 1.1 获取我关注的所有用户
|
||||
List<Long> followeeList = portfolioService.getFolloweeList(accountId);
|
||||
List<Long> followeeList = userFollowService.getFolloweeList(accountId);
|
||||
// 1.2 查询我关注的用户在我上次查看动态之后发布的作品数量
|
||||
String lastViewTime = redisUtil.getFromString(lastViewNewPostedTimeKey + ":" + accountId);
|
||||
|
||||
@@ -340,7 +331,7 @@ public class MessageCenterServiceImpl extends ServiceImpl<NotificationMapper, No
|
||||
} else {
|
||||
return 0L;
|
||||
}
|
||||
return portfolioService.getBaseMapper().selectCount(queryWrapper);
|
||||
return portfolioMapper.selectCount(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -350,7 +341,7 @@ public class MessageCenterServiceImpl extends ServiceImpl<NotificationMapper, No
|
||||
|
||||
// 1、获取关注用户发布的所有作品
|
||||
// 1.1 获取我关注的所有用户
|
||||
List<Long> followeeList = portfolioService.getFolloweeList(accountId);
|
||||
List<Long> followeeList = userFollowService.getFolloweeList(accountId);
|
||||
// 1.2 分页查询我关注的用户发布的作品
|
||||
QueryWrapper<Portfolio> queryWrapper = new QueryWrapper<>();
|
||||
if (!followeeList.isEmpty()) {
|
||||
@@ -359,7 +350,7 @@ public class MessageCenterServiceImpl extends ServiceImpl<NotificationMapper, No
|
||||
return new PageBaseResponse<>(new ArrayList<>(), page, size, 0, 0);
|
||||
}
|
||||
queryWrapper.orderByDesc("create_date");
|
||||
Page<Portfolio> portfolioPage = portfolioService.getBaseMapper().selectPage(new Page<>(page, size), queryWrapper);
|
||||
Page<Portfolio> portfolioPage = portfolioMapper.selectPage(new Page<>(page, size), queryWrapper);
|
||||
// 2、组装返回的数据
|
||||
|
||||
IPage<NotificationVO> convert = portfolioPage.convert(o -> {
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
package com.ai.da.service.impl;
|
||||
|
||||
import com.ai.da.mapper.primary.MoodboardPositionMapper;
|
||||
import com.ai.da.mapper.primary.entity.MoodboardPosition;
|
||||
import com.ai.da.service.MoodboardPositionService;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class MoodboardPositionServiceImpl extends ServiceImpl<MoodboardPositionMapper, MoodboardPosition> implements MoodboardPositionService {
|
||||
|
||||
@Override
|
||||
public void parseMoodboardPosition(String moodboardPosition, Long collectionIdParam) {
|
||||
if (!StringUtils.isEmpty(moodboardPosition)) {
|
||||
// 将 JSON 字符串解析为 JSONObject
|
||||
JSONObject moodboardPositionJson = JSONObject.parseObject(moodboardPosition);
|
||||
|
||||
// 准备保存的 MoodboardPosition 列表
|
||||
List<MoodboardPosition> moodboardPositions = new ArrayList<>();
|
||||
|
||||
// 遍历 JSON 对象的 key(即样式类型)
|
||||
for (String key : moodboardPositionJson.keySet()) {
|
||||
// 特殊处理 "class" 字段
|
||||
if ("class".equals(key)) {
|
||||
// 获取 "class" 字段的值并将其转为 List<String>
|
||||
JSONArray classArray = moodboardPositionJson.getJSONArray(key);
|
||||
if (classArray != null) {
|
||||
|
||||
for (int j = 0; j < classArray.size(); j++) {
|
||||
// 将 classList 存入 MoodboardPosition(或者其他结构)
|
||||
|
||||
MoodboardPosition position = new MoodboardPosition()
|
||||
.setCollectionId(collectionIdParam) // 关联 Collection ID
|
||||
.setType(key) // 样式类型
|
||||
.setStyleData(classArray.getString(j)) // 设置 class 字段
|
||||
.setSequence(j) // 根据索引值设置顺序
|
||||
.setCreateTime(LocalDateTime.now()) // 创建时间
|
||||
.setUpdateTime(LocalDateTime.now()); // 更新时间
|
||||
|
||||
// 添加到列表中
|
||||
moodboardPositions.add(position);
|
||||
}
|
||||
}
|
||||
continue; // 跳过 "class" 字段的常规处理
|
||||
}
|
||||
|
||||
JSONArray styleArray = moodboardPositionJson.getJSONArray(key);
|
||||
if (styleArray != null) {
|
||||
for (int i = 0; i < styleArray.size(); i++) {
|
||||
// 获取当前样式数据
|
||||
JSONObject styleData = styleArray.getJSONObject(i);
|
||||
|
||||
// 构建 MoodboardPosition 实例
|
||||
MoodboardPosition position = new MoodboardPosition()
|
||||
.setCollectionId(collectionIdParam) // 关联 Collection ID
|
||||
.setType(key) // 样式类型
|
||||
.setStyleData(styleData.toJSONString()) // 样式数据存为 JSON 字符串
|
||||
.setSequence(i) // 根据索引值设置顺序
|
||||
.setCreateTime(LocalDateTime.now()) // 创建时间
|
||||
.setUpdateTime(LocalDateTime.now()); // 更新时间
|
||||
|
||||
// 添加到列表中
|
||||
moodboardPositions.add(position);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 如果解析结果非空,保存到数据库
|
||||
if (!moodboardPositions.isEmpty()) {
|
||||
for (MoodboardPosition position : moodboardPositions) {
|
||||
baseMapper.insert(position);
|
||||
}
|
||||
log.info("成功解析并保存 {} 条 MoodboardPosition 数据", moodboardPositions.size());
|
||||
} else {
|
||||
log.warn("未找到可保存的 MoodboardPosition 数据");
|
||||
}
|
||||
} else {
|
||||
log.warn("传入的 moodboardPosition 字段为空");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -30,6 +30,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.google.common.base.Function;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -45,107 +46,41 @@ import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio> implements PortfolioService {
|
||||
|
||||
@Resource
|
||||
private UserLikeGroupMapper userLikeGroupMapper;
|
||||
|
||||
@Resource
|
||||
private CollectionMapper collectionMapper;
|
||||
|
||||
@Resource
|
||||
private CollectionElementService collectionElementService;
|
||||
|
||||
@Resource
|
||||
private CollectionElementMapper collectionElementMapper;
|
||||
@Resource
|
||||
private CollectionSortService collectionSortService;
|
||||
@Resource
|
||||
private CollectionSortMapper collectionSortMapper;
|
||||
@Resource
|
||||
private TCollectionElementRelationMapper collectionElementRelationMapper;
|
||||
|
||||
@Resource
|
||||
private PortfolioMapper portfolioMapper;
|
||||
|
||||
@Resource
|
||||
private UserLikeService userLikeService;
|
||||
|
||||
@Resource
|
||||
private UserLikeMapper userLikeMapper;
|
||||
|
||||
@Resource
|
||||
private TDesignPythonOutfitMapper designPythonOutfitMapper;
|
||||
|
||||
@Resource
|
||||
private TDesignPythonOutfitDetailMapper designPythonOutfitDetailMapper;
|
||||
|
||||
@Resource
|
||||
private DesignItemMapper designItemMapper;
|
||||
|
||||
@Resource
|
||||
private DesignItemDetailMapper designItemDetailMapper;
|
||||
|
||||
@Resource
|
||||
private DesignItemDetailPrintMapper designItemDetailPrintMapper;
|
||||
|
||||
|
||||
@Resource
|
||||
private MinioUtil minioUtil;
|
||||
|
||||
@Resource
|
||||
private WorkspaceService workspaceService;
|
||||
|
||||
@Resource
|
||||
private DesignMapper designMapper;
|
||||
|
||||
@Resource
|
||||
private UserLikeGroupService userLikeGroupService;
|
||||
|
||||
@Resource
|
||||
private CanvasMapper canvasMapper;
|
||||
|
||||
@Resource
|
||||
private AccountMapper accountMapper;
|
||||
|
||||
@Resource
|
||||
private WorkspaceMapper workspaceMapper;
|
||||
|
||||
@Resource
|
||||
private SysFileMapper sysFileMapper;
|
||||
|
||||
@Resource
|
||||
private LibraryMapper libraryMapper;
|
||||
|
||||
@Resource
|
||||
private StyleMapper styleMapper;
|
||||
|
||||
@Resource
|
||||
private WorkspaceRelStyleMapper workspaceRelStyleMapper;
|
||||
|
||||
@Resource
|
||||
private UserFollowMapper userFollowMapper;
|
||||
|
||||
@Resource
|
||||
private PortfolioTagsMapper portfolioTagsMapper;
|
||||
|
||||
@Resource
|
||||
private TagsService tagsService;
|
||||
|
||||
@Resource
|
||||
private TagsMapper tagsMapper;
|
||||
|
||||
@Resource
|
||||
private ProjectMapper projectMapper;
|
||||
|
||||
@Resource
|
||||
private CollectionElementRelModelMapper collectionElementRelModelMapper;
|
||||
@Resource
|
||||
private ToProductImageResultMapper toProductImageResultMapper;
|
||||
@Resource
|
||||
private ToProductImageRecordMapper toProductImageRecordMapper;
|
||||
@Resource
|
||||
private PoseTransformationMapper poseTransformationMapper;
|
||||
private final AccountMapper accountMapper;
|
||||
private final CanvasMapper canvasMapper;
|
||||
private final CollectionMapper collectionMapper;
|
||||
private final CollectionElementMapper collectionElementMapper;
|
||||
private final CollectionElementService collectionElementService;
|
||||
private final CollectionSortMapper collectionSortMapper;
|
||||
private final CollectionSortService collectionSortService;
|
||||
private final CollectionElementRelModelMapper collectionElementRelModelMapper;
|
||||
private final TCollectionElementRelationMapper collectionElementRelationMapper;
|
||||
private final DesignMapper designMapper;
|
||||
private final DesignItemMapper designItemMapper;
|
||||
private final DesignItemDetailMapper designItemDetailMapper;
|
||||
private final DesignItemDetailPrintMapper designItemDetailPrintMapper;
|
||||
private final TDesignPythonOutfitMapper designPythonOutfitMapper;
|
||||
private final TDesignPythonOutfitDetailMapper designPythonOutfitDetailMapper;
|
||||
private final MinioUtil minioUtil;
|
||||
private final ProjectMapper projectMapper;
|
||||
private final PortfolioMapper portfolioMapper;
|
||||
private final PortfolioTagsMapper portfolioTagsMapper;
|
||||
private final PoseTransformationMapper poseTransformationMapper;
|
||||
private final TagsMapper tagsMapper;
|
||||
private final TagsService tagsService;
|
||||
private final ToProductImageResultMapper toProductImageResultMapper;
|
||||
private final ToProductImageRecordMapper toProductImageRecordMapper;
|
||||
private final UserFollowMapper userFollowMapper;
|
||||
private final UserFollowService userFollowService;
|
||||
private final UserLikeService userLikeService;
|
||||
private final UserLikeMapper userLikeMapper;
|
||||
private final UserLikeGroupMapper userLikeGroupMapper;
|
||||
private final UserLikeGroupService userLikeGroupService;
|
||||
private final WorkspaceMapper workspaceMapper;
|
||||
private final WorkspaceService workspaceService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -585,7 +520,7 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
|
||||
vo.setIsLike(0);
|
||||
}
|
||||
// 设置当前用户是否关注了所查看作品的作者
|
||||
Integer ifFollowed = getIfFollowed(portfolio.getAccountId(), portfolioDTO.getAccountId());
|
||||
Integer ifFollowed = userFollowService.getIfFollowed(portfolio.getAccountId(), portfolioDTO.getAccountId());
|
||||
vo.setIsFollow(ifFollowed);
|
||||
avatar = StringUtil.isNullOrEmpty(account.getAvatar()) ? CommonConstant.DEFAULT_AVATAR : account.getAvatar();
|
||||
}
|
||||
@@ -1157,7 +1092,7 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
|
||||
if (!collect.contains(CommonConstant.RCA_WORKSHOP_TAG)) {
|
||||
return false;
|
||||
} else {
|
||||
UserLikeGroup userLikeGroup = userLikeGroupService.getById(userLikeGroupId);
|
||||
UserLikeGroup userLikeGroup = userLikeGroupMapper.selectById(userLikeGroupId);
|
||||
// 不是原创的作品不能参与活动
|
||||
if (userLikeGroup.getOriginal().equals(0)) {
|
||||
throw new BusinessException("only.original.works.can.participate.in.the.event", ResultEnum.PROMPT.getCode());
|
||||
@@ -1276,86 +1211,6 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
|
||||
messageCenterService.pushMessage("follow", followeeId);
|
||||
}
|
||||
|
||||
public Long getFolloweeCount(Long accountId) {
|
||||
QueryWrapper<UserFollow> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("follower_id", accountId).select("followee_id");
|
||||
return userFollowMapper.selectCount(queryWrapper);
|
||||
}
|
||||
|
||||
// 获取某个用户的关注列表 + 按名字查询
|
||||
public List<AccountFollowVO> getFolloweeList(GetFollowListDTO getFollowListDTO) {
|
||||
Long accountId = UserContext.getUserHolder().getId();
|
||||
// 1、判断是否有按用户名查询
|
||||
List<AccountFollowVO> followeeList;
|
||||
if (!StringUtil.isNullOrEmpty(getFollowListDTO.getSearchByName())) {
|
||||
followeeList = userFollowMapper.getFolloweeListByName(getFollowListDTO.getSearchByName(), accountId);
|
||||
} else {
|
||||
// 2、查全部 分页查询
|
||||
String order = StringUtil.isNullOrEmpty(getFollowListDTO.getOrder()) ? "DESC" : getFollowListDTO.getOrder().equals("DESC") ? "DESC" : "ASC";
|
||||
Integer limit = getFollowListDTO.getSize() > 0 ? getFollowListDTO.getSize() : 20;
|
||||
Integer offset = getFollowListDTO.getPage() > 0 ? (getFollowListDTO.getPage() - 1) * getFollowListDTO.getSize() : 0;
|
||||
followeeList = userFollowMapper.getFolloweeListByFollower(accountId, limit, offset, order);
|
||||
}
|
||||
|
||||
if (!followeeList.isEmpty()) {
|
||||
followeeList.forEach(followee -> {
|
||||
String avatar = StringUtil.isNullOrEmpty(followee.getAvatar()) ? CommonConstant.DEFAULT_AVATAR : followee.getAvatar();
|
||||
followee.setAvatar(minioUtil.getPreSignedUrl(avatar, CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
});
|
||||
return followeeList;
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
public Long getFollowerCount(Long accountId) {
|
||||
QueryWrapper<UserFollow> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("followee_id", accountId).select("follower_id");
|
||||
return userFollowMapper.selectCount(queryWrapper);
|
||||
}
|
||||
|
||||
// 获取某个用户的粉丝列表 + 按名字查询 需返回是否关注该粉丝
|
||||
public List<AccountFollowVO> getFollowerList(GetFollowListDTO getFollowListDTO) {
|
||||
Long accountId = UserContext.getUserHolder().getId();
|
||||
|
||||
// 获取当前用户的所有粉丝
|
||||
QueryWrapper<UserFollow> qw = new QueryWrapper<>();
|
||||
qw.eq("follower_id", accountId).select("followee_id", "create_time");
|
||||
List<UserFollow> userFollows = userFollowMapper.selectList(qw);
|
||||
Map<Long, LocalDateTime> followeeMap = userFollows.stream().collect(Collectors.toMap(UserFollow::getFolloweeId, UserFollow::getCreateTime));
|
||||
|
||||
List<AccountFollowVO> followerList;
|
||||
// 1、判断是否有按用户名查询粉丝
|
||||
if (!StringUtil.isNullOrEmpty(getFollowListDTO.getSearchByName())) {
|
||||
followerList = userFollowMapper.getFollowerListByName(getFollowListDTO.getSearchByName(), accountId);
|
||||
} else {
|
||||
// 2、查全部 分页查询
|
||||
String order = StringUtil.isNullOrEmpty(getFollowListDTO.getOrder()) ? "DESC" : getFollowListDTO.getOrder().equals("DESC") ? "DESC" : "ASC";
|
||||
Integer limit = getFollowListDTO.getSize() > 0 ? getFollowListDTO.getSize() : 20;
|
||||
Integer offset = getFollowListDTO.getPage() > 0 ? (getFollowListDTO.getPage() - 1) * getFollowListDTO.getSize() : 0;
|
||||
followerList = userFollowMapper.getFollowerListByFollowee(accountId, limit, offset, order);
|
||||
}
|
||||
|
||||
if (!followerList.isEmpty()) {
|
||||
// 判断当前用户是否与粉丝互关
|
||||
followerList.forEach(follower -> {
|
||||
String avatar = StringUtil.isNullOrEmpty(follower.getAvatar()) ? CommonConstant.DEFAULT_AVATAR : follower.getAvatar();
|
||||
follower.setAvatar(minioUtil.getPreSignedUrl(avatar, CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
follower.setIsFollow(Objects.isNull(followeeMap.get(follower.getSenderId())) ? 0 : 1);
|
||||
// follower.setFollowTime(followeeMap.get(follower.getUserId()));
|
||||
});
|
||||
return followerList;
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
public Integer getIfFollowed(Long followeeId, Long followerId) {
|
||||
// 设置当前用户是否关注了所查看作品的作者
|
||||
QueryWrapper<UserFollow> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("followee_id", followeeId).eq("follower_id", followerId);
|
||||
UserFollow userFollow = userFollowMapper.selectOne(queryWrapper);
|
||||
return Objects.isNull(userFollow) ? 0 : 1;
|
||||
}
|
||||
|
||||
public Long getPortfolioCount(Long accountId) {
|
||||
QueryWrapper<Portfolio> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("account_id", accountId);
|
||||
@@ -1363,19 +1218,6 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
|
||||
return baseMapper.selectCount(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取关注列表
|
||||
*
|
||||
* @param accountId
|
||||
* @return
|
||||
*/
|
||||
public List<Long> getFolloweeList(Long accountId) {
|
||||
QueryWrapper<UserFollow> qw = new QueryWrapper<>();
|
||||
qw.eq("follower_id", accountId).select("followee_id");
|
||||
|
||||
List<UserFollow> userFollows = userFollowMapper.selectList(qw);
|
||||
return userFollows.stream().map(UserFollow::getFolloweeId).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public void setPortfolioToPublic(Long portfolioId) {
|
||||
// 判断当前用户与作品用户是不是一家公司的
|
||||
|
||||
@@ -4,6 +4,8 @@ package com.ai.da.service.impl;
|
||||
import com.ai.da.common.config.exception.BusinessException;
|
||||
import com.ai.da.mapper.primary.PythonTAllInfoMapper;
|
||||
import com.ai.da.mapper.primary.entity.PythonTAllInfo;
|
||||
import com.ai.da.python.vo.DesignPythonItem;
|
||||
import com.ai.da.python.vo.DesignPythonObjects;
|
||||
import com.ai.da.service.PythonTAllInfoService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@@ -13,7 +15,9 @@ import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* (PythonTAllInfo)表服务实现类
|
||||
@@ -48,4 +52,31 @@ public class PythonTAllInfoServiceImpl extends ServiceImpl<PythonTAllInfoMapper,
|
||||
}
|
||||
return pythonTAllInfo.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void relationImageId(DesignPythonObjects pythonObjects) {
|
||||
if (Objects.isNull(pythonObjects)) {
|
||||
return;
|
||||
}
|
||||
pythonObjects.getObjects().forEach(
|
||||
o -> {
|
||||
for (DesignPythonItem item : o.getItems()) {
|
||||
List<Long> list = new ArrayList<>();
|
||||
list.add(1L);
|
||||
list.add(1L);
|
||||
item.setOffset(list);
|
||||
item.setResize_scale(new Float[]{1.0f, 1.0f});
|
||||
String path = item.getPath();
|
||||
if (StringUtils.isEmpty(path)) {
|
||||
String bodyPath = item.getBody_path();
|
||||
Long imageId = getImageIdByPath(bodyPath);
|
||||
item.setImage_id(imageId);
|
||||
} else {
|
||||
Long imageId = getImageIdByPath(path);
|
||||
item.setImage_id(imageId);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.ai.da.service.impl;
|
||||
|
||||
import com.ai.da.mapper.primary.ToProductImageResultMapper;
|
||||
import com.ai.da.mapper.primary.entity.CollectionSort;
|
||||
import com.ai.da.mapper.primary.entity.ToProductImageResult;
|
||||
import com.ai.da.mapper.primary.entity.UserLike;
|
||||
import com.ai.da.service.CollectionSortService;
|
||||
import com.ai.da.service.ToProductImageResultService;
|
||||
import com.ai.da.service.UserLikeService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class ToProductImageResultServiceImpl extends ServiceImpl<ToProductImageResultMapper, ToProductImageResult> implements ToProductImageResultService {
|
||||
|
||||
private final CollectionSortService collectionSortService;
|
||||
|
||||
private final UserLikeService userLikeService;
|
||||
|
||||
// 获取未被like的to product\relight的parentId
|
||||
public Long getUnlikedResultParentId(ToProductImageResult toProductImageResult, String url) {
|
||||
// 卫语句处理null情况
|
||||
if (toProductImageResult == null && StringUtil.isNullOrEmpty(url)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 如果需要查询结果对象
|
||||
if (toProductImageResult == null) {
|
||||
toProductImageResult = baseMapper.selectOne(
|
||||
new QueryWrapper<ToProductImageResult>().eq("url", url));
|
||||
}
|
||||
|
||||
// 卫语句处理查询结果为空的情况
|
||||
if (toProductImageResult == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 根据不同类型处理
|
||||
String elementType = toProductImageResult.getElementType();
|
||||
if ("DesignOutfit".equals(elementType)) {
|
||||
return handleDesignOutfitCase(toProductImageResult);
|
||||
} else if ("ToProductImage".equals(elementType)) {
|
||||
// 两种情况 resultType : ToProductImage | Relight
|
||||
return handleToProductImageCase(toProductImageResult);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private Long handleDesignOutfitCase(ToProductImageResult result) {
|
||||
UserLike userLike = userLikeService.getByDesignOutfitId(result.getElementId());
|
||||
if (userLike == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
CollectionSort collectionSort = collectionSortService.queryCollectionSortByRelation(
|
||||
userLike.getId(), "Design", result.getProjectId());
|
||||
return collectionSort != null ? collectionSort.getId() : null;
|
||||
}
|
||||
|
||||
private Long handleToProductImageCase(ToProductImageResult result) {
|
||||
CollectionSort collectionSort = collectionSortService.queryCollectionSortByRelation(
|
||||
result.getElementId(), result.getResultType(), result.getProjectId());
|
||||
if (Objects.isNull(collectionSort) && result.getElementType().equals("ToProductImage")) {
|
||||
ToProductImageResult toProductImageResult = baseMapper.selectById(result.getElementId());
|
||||
return getUnlikedResultParentId(toProductImageResult, null);
|
||||
}
|
||||
return collectionSort != null ? collectionSort.getParentId() : null;
|
||||
}
|
||||
}
|
||||
125
src/main/java/com/ai/da/service/impl/UserFollowServiceImpl.java
Normal file
125
src/main/java/com/ai/da/service/impl/UserFollowServiceImpl.java
Normal file
@@ -0,0 +1,125 @@
|
||||
package com.ai.da.service.impl;
|
||||
|
||||
import com.ai.da.common.constant.CommonConstant;
|
||||
import com.ai.da.common.context.UserContext;
|
||||
import com.ai.da.common.utils.MinioUtil;
|
||||
import com.ai.da.mapper.primary.UserFollowMapper;
|
||||
import com.ai.da.mapper.primary.entity.UserFollow;
|
||||
import com.ai.da.model.dto.GetFollowListDTO;
|
||||
import com.ai.da.model.vo.AccountFollowVO;
|
||||
import com.ai.da.service.UserFollowService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class UserFollowServiceImpl extends ServiceImpl<UserFollowMapper, UserFollow> implements UserFollowService {
|
||||
|
||||
private final MinioUtil minioUtil;
|
||||
|
||||
public Long getFolloweeCount(Long accountId) {
|
||||
QueryWrapper<UserFollow> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("follower_id", accountId).select("followee_id");
|
||||
return baseMapper.selectCount(queryWrapper);
|
||||
}
|
||||
|
||||
// 获取某个用户的关注列表 + 按名字查询
|
||||
public List<AccountFollowVO> getFolloweeList(GetFollowListDTO getFollowListDTO) {
|
||||
Long accountId = UserContext.getUserHolder().getId();
|
||||
// 1、判断是否有按用户名查询
|
||||
List<AccountFollowVO> followeeList;
|
||||
if (!StringUtil.isNullOrEmpty(getFollowListDTO.getSearchByName())) {
|
||||
followeeList = baseMapper.getFolloweeListByName(getFollowListDTO.getSearchByName(), accountId);
|
||||
} else {
|
||||
// 2、查全部 分页查询
|
||||
String order = StringUtil.isNullOrEmpty(getFollowListDTO.getOrder()) ? "DESC" : getFollowListDTO.getOrder().equals("DESC") ? "DESC" : "ASC";
|
||||
Integer limit = getFollowListDTO.getSize() > 0 ? getFollowListDTO.getSize() : 20;
|
||||
Integer offset = getFollowListDTO.getPage() > 0 ? (getFollowListDTO.getPage() - 1) * getFollowListDTO.getSize() : 0;
|
||||
followeeList = baseMapper.getFolloweeListByFollower(accountId, limit, offset, order);
|
||||
}
|
||||
|
||||
if (!followeeList.isEmpty()) {
|
||||
followeeList.forEach(followee -> {
|
||||
String avatar = StringUtil.isNullOrEmpty(followee.getAvatar()) ? CommonConstant.DEFAULT_AVATAR : followee.getAvatar();
|
||||
followee.setAvatar(minioUtil.getPreSignedUrl(avatar, CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
});
|
||||
return followeeList;
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
public Long getFollowerCount(Long accountId) {
|
||||
QueryWrapper<UserFollow> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("followee_id", accountId).select("follower_id");
|
||||
return baseMapper.selectCount(queryWrapper);
|
||||
}
|
||||
|
||||
// 获取某个用户的粉丝列表 + 按名字查询 需返回是否关注该粉丝
|
||||
public List<AccountFollowVO> getFollowerList(GetFollowListDTO getFollowListDTO) {
|
||||
Long accountId = UserContext.getUserHolder().getId();
|
||||
|
||||
// 获取当前用户的所有粉丝
|
||||
QueryWrapper<UserFollow> qw = new QueryWrapper<>();
|
||||
qw.eq("follower_id", accountId).select("followee_id", "create_time");
|
||||
List<UserFollow> userFollows = baseMapper.selectList(qw);
|
||||
Map<Long, LocalDateTime> followeeMap = userFollows.stream().collect(Collectors.toMap(UserFollow::getFolloweeId, UserFollow::getCreateTime));
|
||||
|
||||
List<AccountFollowVO> followerList;
|
||||
// 1、判断是否有按用户名查询粉丝
|
||||
if (!StringUtil.isNullOrEmpty(getFollowListDTO.getSearchByName())) {
|
||||
followerList = baseMapper.getFollowerListByName(getFollowListDTO.getSearchByName(), accountId);
|
||||
} else {
|
||||
// 2、查全部 分页查询
|
||||
String order = StringUtil.isNullOrEmpty(getFollowListDTO.getOrder()) ? "DESC" : getFollowListDTO.getOrder().equals("DESC") ? "DESC" : "ASC";
|
||||
Integer limit = getFollowListDTO.getSize() > 0 ? getFollowListDTO.getSize() : 20;
|
||||
Integer offset = getFollowListDTO.getPage() > 0 ? (getFollowListDTO.getPage() - 1) * getFollowListDTO.getSize() : 0;
|
||||
followerList = baseMapper.getFollowerListByFollowee(accountId, limit, offset, order);
|
||||
}
|
||||
|
||||
if (!followerList.isEmpty()) {
|
||||
// 判断当前用户是否与粉丝互关
|
||||
followerList.forEach(follower -> {
|
||||
String avatar = StringUtil.isNullOrEmpty(follower.getAvatar()) ? CommonConstant.DEFAULT_AVATAR : follower.getAvatar();
|
||||
follower.setAvatar(minioUtil.getPreSignedUrl(avatar, CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
follower.setIsFollow(Objects.isNull(followeeMap.get(follower.getSenderId())) ? 0 : 1);
|
||||
// follower.setFollowTime(followeeMap.get(follower.getUserId()));
|
||||
});
|
||||
return followerList;
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
public Integer getIfFollowed(Long followeeId, Long followerId) {
|
||||
// 设置当前用户是否关注了所查看作品的作者
|
||||
QueryWrapper<UserFollow> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("followee_id", followeeId).eq("follower_id", followerId);
|
||||
UserFollow userFollow = baseMapper.selectOne(queryWrapper);
|
||||
return Objects.isNull(userFollow) ? 0 : 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取关注列表
|
||||
*
|
||||
* @param accountId
|
||||
* @return
|
||||
*/
|
||||
public List<Long> getFolloweeList(Long accountId) {
|
||||
QueryWrapper<UserFollow> qw = new QueryWrapper<>();
|
||||
qw.eq("follower_id", accountId).select("followee_id");
|
||||
|
||||
List<UserFollow> userFollows = baseMapper.selectList(qw);
|
||||
return userFollows.stream().map(UserFollow::getFolloweeId).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,9 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -38,6 +40,7 @@ import com.google.common.base.Function;
|
||||
import com.google.gson.Gson;
|
||||
import io.minio.errors.MinioException;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -66,98 +69,54 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, UserLikeGroup> implements UserLikeGroupService {
|
||||
@Resource
|
||||
private UserLikeGroupMapper userLikeGroupMapper;
|
||||
@Resource
|
||||
private AccountService accountService;
|
||||
@Resource
|
||||
private CollectionService collectionService;
|
||||
@Resource
|
||||
private UserLikeService userLikeService;
|
||||
@Resource
|
||||
private WorkspaceService workspaceService;
|
||||
@Resource
|
||||
private UserLikeMapper userLikeMapper;
|
||||
@Resource
|
||||
private MinioUtil minioUtil;
|
||||
@Resource
|
||||
private TDesignPythonOutfitMapper designPythonOutfitMapper;
|
||||
@Resource
|
||||
private DesignMapper designMapper;
|
||||
@Resource
|
||||
private DesignService designService;
|
||||
@Resource
|
||||
private SysFileMapper sysFileMapper;
|
||||
@Resource
|
||||
private LibraryMapper libraryMapper;
|
||||
@Resource
|
||||
private GenerateDetailMapper generateDetailMapper;
|
||||
@Resource
|
||||
private PortfolioMapper portfolioMapper;
|
||||
@Resource
|
||||
private TagsMapper tagsMapper;
|
||||
@Resource
|
||||
private DesignItemDetailService designItemDetailService;
|
||||
@Resource
|
||||
private CollectionElementMapper collectionElementMapper;
|
||||
@Resource
|
||||
private AttributeRetrievalMapper attributeRetrievalMapper;
|
||||
@Resource
|
||||
private ProductImageAttributeMapper productImageAttributeMapper;
|
||||
@Resource
|
||||
private CollectionSortMapper collectionSortMapper;
|
||||
@Resource
|
||||
private ClassificationService classificationService;
|
||||
@Resource
|
||||
private final UserLikeGroupMapper userLikeGroupMapper;
|
||||
private final AccountService accountService;
|
||||
private final CollectionService collectionService;
|
||||
private final UserLikeService userLikeService;
|
||||
private final WorkspaceService workspaceService;
|
||||
private final UserLikeMapper userLikeMapper;
|
||||
private final MinioUtil minioUtil;
|
||||
private final TDesignPythonOutfitMapper designPythonOutfitMapper;
|
||||
private final DesignMapper designMapper;
|
||||
private final MoodboardPositionService moodboardPositionService;
|
||||
private final SysFileMapper sysFileMapper;
|
||||
private final LibraryMapper libraryMapper;
|
||||
private final GenerateDetailMapper generateDetailMapper;
|
||||
private final PortfolioMapper portfolioMapper;
|
||||
private final TagsMapper tagsMapper;
|
||||
private final DesignItemDetailService designItemDetailService;
|
||||
private final CollectionElementMapper collectionElementMapper;
|
||||
private final AttributeRetrievalMapper attributeRetrievalMapper;
|
||||
private final ProductImageAttributeMapper productImageAttributeMapper;
|
||||
private final CollectionSortMapper collectionSortMapper;
|
||||
private final ClassificationService classificationService;
|
||||
// private ProjectMapper projectMapper;
|
||||
private ProjectService projectService;
|
||||
@Resource
|
||||
private PortfolioService portfolioService;
|
||||
@Resource
|
||||
private LibraryModelPointMapper libraryModelPointMapper;
|
||||
@Resource
|
||||
private LibraryService libraryService;
|
||||
@Resource
|
||||
private BrandDNAMapper brandDNAMapper;
|
||||
@Resource
|
||||
private BrandRelLibraryMapper brandRelLibraryMapper;
|
||||
@Resource
|
||||
private ThreeDLayoutMapper threeDLayoutMapper;
|
||||
@Resource
|
||||
private ThreeDPatternLayoutMapper threeDPatternLayoutMapper;
|
||||
@Resource
|
||||
private ThreeDDetailMapper threeDDetailMapper;
|
||||
@Resource
|
||||
private ThreeDSimpleMapper threeDSimpleMapper;
|
||||
@Resource
|
||||
private ThreeDModuleMapper threeDModuleMapper;
|
||||
@Resource
|
||||
private ProductImageService productImageService;
|
||||
@Resource
|
||||
private CollectionElementRelModelMapper collectionElementRelModelMapper;
|
||||
@Resource
|
||||
private CollectionSortService collectionSortService;
|
||||
@Resource
|
||||
private GenerateService generateService;
|
||||
@Resource
|
||||
private ToProductElementMapper toProductElementMapper;
|
||||
@Resource
|
||||
private ToProductImageRecordMapper toProductImageRecordMapper;
|
||||
@Resource
|
||||
private ToProductImageResultMapper toProductImageResultMapper;
|
||||
@Resource
|
||||
private CloudTaskMapper cloudTaskMapper;
|
||||
@Resource
|
||||
private PythonService pythonService;
|
||||
@Resource
|
||||
private CreditsService creditsService;
|
||||
@Resource
|
||||
private PoseTransformationMapper poseTransformationMapper;
|
||||
@Resource
|
||||
private ExportFileMapper exportFileMapper;
|
||||
@Resource
|
||||
private DesignItemDetailCanvasMapper designItemDetailCanvasMapper;
|
||||
private final ProjectService projectService;
|
||||
private final LibraryModelPointMapper libraryModelPointMapper;
|
||||
private final LibraryService libraryService;
|
||||
private final BrandDNAMapper brandDNAMapper;
|
||||
private final BrandRelLibraryMapper brandRelLibraryMapper;
|
||||
private final ThreeDLayoutMapper threeDLayoutMapper;
|
||||
private final ThreeDPatternLayoutMapper threeDPatternLayoutMapper;
|
||||
private final ThreeDDetailMapper threeDDetailMapper;
|
||||
private final ThreeDSimpleMapper threeDSimpleMapper;
|
||||
private final ThreeDModuleMapper threeDModuleMapper;
|
||||
private final ProductImageService productImageService;
|
||||
private final CollectionElementRelModelMapper collectionElementRelModelMapper;
|
||||
private final CollectionSortService collectionSortService;
|
||||
private final GenerateService generateService;
|
||||
private final ToProductElementMapper toProductElementMapper;
|
||||
private final ToProductImageRecordMapper toProductImageRecordMapper;
|
||||
private final ToProductImageResultMapper toProductImageResultMapper;
|
||||
private final ToProductImageResultService toProductImageResultService;
|
||||
private final CloudTaskMapper cloudTaskMapper;
|
||||
private final PythonService pythonService;
|
||||
private final CreditsService creditsService;
|
||||
private final PoseTransformationMapper poseTransformationMapper;
|
||||
private final ExportFileMapper exportFileMapper;
|
||||
private final DesignItemDetailCanvasMapper designItemDetailCanvasMapper;
|
||||
@Value("${redis.key.generateResult}")
|
||||
private String generateResultKey;
|
||||
|
||||
@@ -2033,7 +1992,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
}
|
||||
if (userLikeGroupVO.getOriginal() == 0) {
|
||||
userLikeGroupVO.setOriginalAccountName(accountService.getById(userLikeGroupVO.getOriginalAccountId()).getUserName());
|
||||
Portfolio byId = portfolioService.getByIdAll(userLikeGroupVO.getOriginalPortfolioId());
|
||||
Portfolio byId = portfolioMapper.getByIdAll(userLikeGroupVO.getOriginalPortfolioId());
|
||||
if (Objects.nonNull(byId)) {
|
||||
String portfolioName = byId.getPortfolioName();
|
||||
userLikeGroupVO.setOriginalPortfolioName(portfolioName);
|
||||
@@ -2368,7 +2327,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
if (Objects.nonNull(toProductImageRecord)) {
|
||||
vo.setPrompt(toProductImageRecord.getPrompt());
|
||||
}
|
||||
vo.setParentId(getUnlikedResultParentId(result, null));
|
||||
vo.setParentId(toProductImageResultService.getUnlikedResultParentId(result, null));
|
||||
// 按isLike分类
|
||||
if (result.getIsLike() != null && result.getIsLike() == 1) {
|
||||
likedList.add(vo);
|
||||
@@ -2497,56 +2456,6 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
return duration.toHours() >= 1;
|
||||
}
|
||||
|
||||
// 获取未被like的to product\relight的parentId
|
||||
public Long getUnlikedResultParentId(ToProductImageResult toProductImageResult, String url) {
|
||||
// 卫语句处理null情况
|
||||
if (toProductImageResult == null && StringUtil.isNullOrEmpty(url)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 如果需要查询结果对象
|
||||
if (toProductImageResult == null) {
|
||||
toProductImageResult = toProductImageResultMapper.selectOne(
|
||||
new QueryWrapper<ToProductImageResult>().eq("url", url));
|
||||
}
|
||||
|
||||
// 卫语句处理查询结果为空的情况
|
||||
if (toProductImageResult == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 根据不同类型处理
|
||||
String elementType = toProductImageResult.getElementType();
|
||||
if ("DesignOutfit".equals(elementType)) {
|
||||
return handleDesignOutfitCase(toProductImageResult);
|
||||
} else if ("ToProductImage".equals(elementType)) {
|
||||
// 两种情况 resultType : ToProductImage | Relight
|
||||
return handleToProductImageCase(toProductImageResult);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private Long handleDesignOutfitCase(ToProductImageResult result) {
|
||||
UserLike userLike = userLikeService.getByDesignOutfitId(result.getElementId());
|
||||
if (userLike == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
CollectionSort collectionSort = collectionSortService.queryCollectionSortByRelation(
|
||||
userLike.getId(), "Design", result.getProjectId());
|
||||
return collectionSort != null ? collectionSort.getId() : null;
|
||||
}
|
||||
|
||||
private Long handleToProductImageCase(ToProductImageResult result) {
|
||||
CollectionSort collectionSort = collectionSortService.queryCollectionSortByRelation(
|
||||
result.getElementId(), result.getResultType(), result.getProjectId());
|
||||
if (Objects.isNull(collectionSort) && result.getElementType().equals("ToProductImage")) {
|
||||
ToProductImageResult toProductImageResult = toProductImageResultMapper.selectById(result.getElementId());
|
||||
return getUnlikedResultParentId(toProductImageResult, null);
|
||||
}
|
||||
return collectionSort != null ? collectionSort.getParentId() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
@@ -2568,7 +2477,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
collectionElementMapper.updateById(compositeImage);
|
||||
if (!StringUtils.isEmpty(moodBoard.getMoodboardPosition())) {
|
||||
// 合成图位置信息通过collectElementId关联(旧逻辑通过collectionId关联)
|
||||
designService.parseMoodboardPosition(moodBoard.getMoodboardPosition(), compositeImage.getId());
|
||||
moodboardPositionService.parseMoodboardPosition(moodBoard.getMoodboardPosition(), compositeImage.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3358,6 +3267,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
toProductElementVO.setUrl(minioUtil.getPreSignedUrl(toProductElementVO.getUrl(), 24 * 60));
|
||||
return toProductElementVO;
|
||||
}
|
||||
|
||||
private String buildAdvancedPrompt(Long projectId, String prompt) {
|
||||
String process = projectService.getById(projectId).getProcess();
|
||||
String ageGroup = workspaceService.getWSByProjectId(projectId).getAgeGroup();
|
||||
|
||||
@@ -12,17 +12,14 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.google.common.collect.Lists;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 服务实现类
|
||||
@@ -32,13 +29,10 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class UserLikeServiceImpl extends ServiceImpl<UserLikeMapper, UserLike> implements UserLikeService {
|
||||
@Resource
|
||||
private UserLikeMapper userLikeMapper;
|
||||
@Resource
|
||||
private UserLikeGroupMapper userLikeGroupMapper;
|
||||
@Resource
|
||||
private DesignItemServiceImpl designItemService;
|
||||
private final UserLikeMapper userLikeMapper;
|
||||
private final UserLikeGroupMapper userLikeGroupMapper;
|
||||
|
||||
@Override
|
||||
public List<UserLikeVO> getGroupDetail(Long userGroupId) {
|
||||
@@ -50,12 +44,6 @@ public class UserLikeServiceImpl extends ServiceImpl<UserLikeMapper, UserLike> i
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
return CopyUtil.copyList(userLikes, UserLikeVO.class);
|
||||
// List<Long> designItemIds = userLikes.stream().map(UserLike::getDesignItemId).collect(Collectors.toList());
|
||||
// List<DesignItem> designItems = designItemService.listByIds(designItemIds);
|
||||
// Map<Long,String> idToUrlMap = designItems.stream().collect(Collectors.toMap(DesignItem::getId,DesignItem::getDesignUrl));
|
||||
// return CopyUtil.copyList(userLikes,UserLikeVO.class,(o,d) ->{
|
||||
// d.setUrl(idToUrlMap.get(o.getDesignItemId()));
|
||||
// });
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -980,4 +980,32 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
||||
return kvs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAgeGroupByProjectOrCollectionId(Long projectId, Long collectionId) {
|
||||
if (Objects.nonNull(projectId)) {
|
||||
Workspace workspace = getWSByProjectId(projectId);
|
||||
if (workspace != null && !StringUtil.isNullOrEmpty(workspace.getAgeGroup())) {
|
||||
return workspace.getAgeGroup();
|
||||
}
|
||||
} else if (Objects.nonNull(collectionId) && collectionId != 0) {
|
||||
List<CollectionElement> byCollectionId = getByCollectionId(collectionId);
|
||||
if (byCollectionId != null && !byCollectionId.isEmpty()) {
|
||||
projectId = byCollectionId.get(0).getProjectId();
|
||||
if (projectId != null && projectId != 0L) {
|
||||
Workspace workspace = getWSByProjectId(projectId);
|
||||
if (workspace != null && !StringUtil.isNullOrEmpty(workspace.getAgeGroup())) {
|
||||
return workspace.getAgeGroup();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return AgeGroup.ADULT.getValue();
|
||||
}
|
||||
|
||||
private List<CollectionElement> getByCollectionId(Long collectionId) {
|
||||
QueryWrapper<CollectionElement> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(CollectionElement::getCollectionId, collectionId);
|
||||
return collectionElementMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user