TASK: 结果返回parentId;
This commit is contained in:
@@ -48,6 +48,7 @@ import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
@@ -152,6 +153,8 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
@Resource
|
||||
private UserBehaviorMapper userBehaviorMapper;
|
||||
@Resource
|
||||
private UserPreferenceLogMapper userPreferenceLogMapper;
|
||||
@Resource
|
||||
private CollectionElementRelModelMapper collectionElementRelModelMapper;
|
||||
|
||||
private final ConcurrentHashMap<String, Map<String, Object>> designContext = new ConcurrentHashMap<>();
|
||||
@@ -1242,6 +1245,15 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
userBehavior.setUrl(designItemDetail.getPath());
|
||||
userBehavior.setCreateTime(LocalDateTime.now());
|
||||
userBehaviorMapper.insert(userBehavior);
|
||||
|
||||
UserPreferenceLogTest userPreferenceLogTest = new UserPreferenceLogTest();
|
||||
userPreferenceLogTest.setPath(designItemDetail.getPath());
|
||||
userPreferenceLogTest.setAccountId(userHolder.getId());
|
||||
// userPreferenceLogTest.setUserLikeGroupId(userLike.getUserLikeGroupId());
|
||||
userPreferenceLogTest.setDataTime(designItemDetail.getCreateDate().toInstant()
|
||||
.atZone(ZoneId.systemDefault())
|
||||
.toLocalDateTime());
|
||||
userPreferenceLogMapper.insert(userPreferenceLogTest);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2533,7 +2545,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
public void processDesignBatch(Map<String, Object> designBatchResult) {
|
||||
Object progress = designBatchResult.get("progress");
|
||||
if (progress instanceof String) {
|
||||
if (progress.equals("0/100")) {
|
||||
if (((String) progress).startsWith("0/")) {
|
||||
return;
|
||||
}
|
||||
if (progress.equals("ok")) {
|
||||
|
||||
@@ -690,9 +690,21 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
if (toProductImageResult.getElementType().equals("ProductElement")) {
|
||||
ToProductElement toProductElement = toProductElementMapper.selectById(toProductImageResult.getElementId());
|
||||
magicToolResultVO.setSourceUrl(minioUtil.getPreSignedUrl(toProductElement.getUrl(), 24 * 60));
|
||||
|
||||
Long parentId = getParentIdByElementIdAndElementType(toProductImageResult.getElementId(), toProductImageResult.getElementType());
|
||||
magicToolResultVO.setParentId(parentId);
|
||||
}else {
|
||||
TDesignPythonOutfit tDesignPythonOutfit = designPythonOutfitMapper.selectById(toProductImageResult.getElementId());
|
||||
magicToolResultVO.setSourceUrl(minioUtil.getPreSignedUrl(tDesignPythonOutfit.getDesignUrl(), 24 * 60));
|
||||
|
||||
QueryWrapper<UserLike> userLikeQueryWrapper = new QueryWrapper<>();
|
||||
userLikeQueryWrapper.lambda().eq(UserLike::getDesignOutfitId, tDesignPythonOutfit.getId());
|
||||
List<UserLike> userLikeList = userLikeMapper.selectList(userLikeQueryWrapper);
|
||||
if (!CollectionUtils.isEmpty(userLikeList)) {
|
||||
UserLike userLike = userLikeList.get(0);
|
||||
Long parentId = getParentIdByElementIdAndElementType(userLike.getId(), toProductImageResult.getElementType());
|
||||
magicToolResultVO.setParentId(parentId);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (Objects.isNull(magicToolResultVO)) {
|
||||
@@ -704,6 +716,22 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
return results;
|
||||
}
|
||||
|
||||
private Long getParentIdByElementIdAndElementType(Long elementId, String elementType) {
|
||||
QueryWrapper<CollectionSort> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(CollectionSort::getRelationId, elementId);
|
||||
qw.lambda().eq(CollectionSort::getRelationType, elementType);
|
||||
List<CollectionSort> collectionSortList = collectionSortMapper.selectList(qw);
|
||||
if (CollectionUtils.isEmpty(collectionSortList)) {
|
||||
return null;
|
||||
}
|
||||
CollectionSort collectionSort = collectionSortList.get(0);
|
||||
Long parentId = collectionSort.getParentId();
|
||||
if (parentId == null) {
|
||||
return collectionSort.getId();
|
||||
}
|
||||
return collectionSort.getParentId();
|
||||
}
|
||||
|
||||
private MagicToolResultVO processFluxResult(String fluxImgMinioPath, ToProductImageResult toProductImageResult, String taskId){
|
||||
toProductImageResult.setUrl(fluxImgMinioPath);
|
||||
toProductImageResultMapper.updateById(toProductImageResult);
|
||||
|
||||
Reference in New Issue
Block a user