Merge branch 'refs/heads/release/3.0' into dev/dev_xp
# Conflicts: # src/main/java/com/ai/da/common/utils/RedisUtil.java # src/main/java/com/ai/da/service/impl/AccountServiceImpl.java # src/main/java/com/ai/da/service/impl/PortfolioServiceImpl.java
This commit is contained in:
@@ -24,10 +24,13 @@ public class MQConfig {
|
||||
public static final String SR_RESULT_QUEUE = "SuperResolution-prod";
|
||||
//
|
||||
// public static final String GENERATE_RESULT_QUEUE = "GenerateImage-local";
|
||||
// public static final String GENERATE_RESULT_QUEUE = "GenerateImage-dev";
|
||||
public static final String GENERATE_RESULT_QUEUE = "GenerateImage-prod";
|
||||
|
||||
// public static final String TO_PRODUCT_IMAGE_RESULT_QUEUE = "ToProductImage-dev";
|
||||
public static final String TO_PRODUCT_IMAGE_RESULT_QUEUE = "ToProductImage-prod";
|
||||
|
||||
// public static final String RELIGHT_RESULT_QUEUE = "Relight-dev";
|
||||
public static final String RELIGHT_RESULT_QUEUE = "Relight-prod";
|
||||
public MQConfig() {
|
||||
}
|
||||
|
||||
@@ -31,20 +31,20 @@ public class AccountTask {
|
||||
}
|
||||
|
||||
// 每天凌晨0点执行一次
|
||||
// @Scheduled(cron = "0 0 0 * * ?")
|
||||
@Scheduled(cron = "0 0 0 * * ?")
|
||||
public void cancelActivityBenefits(){
|
||||
// 1、查询当前所有参与了活动且过期的用户
|
||||
List<Account> accountList = accountService.getExpiredUserBySystemUser(4);
|
||||
|
||||
// 2、将到期用户置为游客
|
||||
for(Account account : accountList){
|
||||
log.info("参与活动的用户到期,置为游客");
|
||||
log.info("参与活动的用户{} : {} 于 {} 账号有效期到期,置为游客",account.getId(),account.getUserEmail(),account.getValidEndTime());
|
||||
accountService.toVisitor(account);
|
||||
}
|
||||
}
|
||||
|
||||
// 每天检测正式用户到期情况,每天凌晨0点执行
|
||||
// @Scheduled(cron = "0 0 0 * * ?")
|
||||
@Scheduled(cron = "0 0 0 * * ?")
|
||||
public void paidUserToVisitor(){
|
||||
// 1、查询当前已过期正式用户或试用用户
|
||||
List<Account> accountList = accountService.getExpiredUserBySystemUser(1);
|
||||
@@ -53,7 +53,7 @@ public class AccountTask {
|
||||
|
||||
// 2、将到期用户置为游客
|
||||
for(Account account : accountList){
|
||||
log.info("用户有效期到期,置为游客");
|
||||
log.info("用户{} : {} 于 {}账号有效期到期,置为游客", account.getId(), account.getUserEmail(),account.getValidEndTime());
|
||||
accountService.toVisitor(account);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,10 +7,7 @@ import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -154,6 +151,8 @@ public class RedisUtil {
|
||||
return redisTemplate.keys(key);
|
||||
}
|
||||
|
||||
public Long getSize(String key){return redisTemplate.opsForSet().size(key);}
|
||||
|
||||
public List<String> getMultiValue(Set<String> keys){
|
||||
return redisTemplate.opsForValue().multiGet(keys);
|
||||
}
|
||||
@@ -216,6 +215,19 @@ public class RedisUtil {
|
||||
return redisTemplate.opsForValue().increment(key, 0);
|
||||
}
|
||||
|
||||
public Long getViewCount(String key) {
|
||||
Object value = redisTemplate.opsForValue().get(key);
|
||||
if (value instanceof Integer) {
|
||||
return Long.valueOf((Integer) value);
|
||||
} else if (value instanceof Long) {
|
||||
return (Long) value;
|
||||
} else if (value instanceof String) {
|
||||
return Long.valueOf((String) value);
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unexpected value type");
|
||||
}
|
||||
}
|
||||
|
||||
public final static String PERSONAL_HOMEPAGE_VIEW_KEY = "PersonalHomepage:view:";
|
||||
|
||||
public void increasePersonalHomepageViewCount(Long accountId) {
|
||||
|
||||
@@ -104,9 +104,9 @@ public class SavedCollectionController {
|
||||
}
|
||||
List<Long> groupIds = page.getRecords().stream().map(UserLikeGroup::getId).collect(Collectors.toList());
|
||||
List<UserLikeVO> groupDetails = userLikeService.getGroupDetails(groupIds);
|
||||
if (CollectionUtils.isEmpty(groupDetails)) {
|
||||
throw new BusinessException("groupDetails.not.found");
|
||||
}
|
||||
// if (CollectionUtils.isEmpty(groupDetails)) {
|
||||
// throw new BusinessException("groupDetails.not.found");
|
||||
// }
|
||||
Map<Long, List<UserLikeVO>> groupDetailMap = groupDetails.stream()
|
||||
.collect(Collectors.groupingBy(UserLikeVO::getUserLikeGroupId));
|
||||
|
||||
@@ -117,13 +117,17 @@ public class SavedCollectionController {
|
||||
userLikeGroupVO.setUpdateDate(group.getUpdateDate().getTime());
|
||||
userLikeGroupVO.setAuthor(account.getUserName());
|
||||
//count 和detail
|
||||
List<UserLikeVO> details = groupDetailMap.get(group.getId());
|
||||
for (UserLikeVO detail : details) {
|
||||
TDesignPythonOutfit tDesignPythonOutfit = designPythonOutfitMapper.selectById(detail.getDesignOutfitId());
|
||||
detail.setUrl(minioUtil.getPreSignedUrl(tDesignPythonOutfit.getDesignUrl(), 24 * 60));
|
||||
if (groupDetailMap.keySet().contains(group.getId())) {
|
||||
List<UserLikeVO> details = groupDetailMap.get(group.getId());
|
||||
for (UserLikeVO detail : details) {
|
||||
TDesignPythonOutfit tDesignPythonOutfit = designPythonOutfitMapper.selectById(detail.getDesignOutfitId());
|
||||
detail.setUrl(minioUtil.getPreSignedUrl(tDesignPythonOutfit.getDesignUrl(), 24 * 60));
|
||||
}
|
||||
userLikeGroupVO.setGroupDetails(details);
|
||||
userLikeGroupVO.setSketchCount(CollectionUtils.isEmpty(details) ? 0 : details.size());
|
||||
}else {
|
||||
userLikeGroupVO.setSketchCount(0);
|
||||
}
|
||||
userLikeGroupVO.setGroupDetails(details);
|
||||
userLikeGroupVO.setSketchCount(CollectionUtils.isEmpty(details) ? 0 : details.size());
|
||||
if (userLikeGroupVO.getOriginal() == 0) {
|
||||
userLikeGroupVO.setOriginalAccountName(accountService.getById(userLikeGroupVO.getOriginalAccountId()).getUserName());
|
||||
Portfolio byId = portfolioService.getByIdAll(userLikeGroupVO.getOriginalPortfolioId());
|
||||
|
||||
@@ -17,11 +17,11 @@ import java.util.List;
|
||||
public interface AttributeRetrievalMapper {
|
||||
|
||||
|
||||
List<AttributeRetrieval> getSystemSketchPool(@Param("attributeRetrievalAttrDict") AttributeRetrieval attributeRetrievalAttrDict, @Param("tableName") String tableName, @Param("poolNum") int poolNum, @Param("style") String style);
|
||||
List<AttributeRetrieval> getSystemSketchPool(@Param("attributeRetrievalAttrDict") AttributeRetrieval attributeRetrievalAttrDict, @Param("tableName") String tableName, @Param("poolNum") int poolNum, @Param("style") String style, @Param("isFemaleTable") boolean isFemaleTable);
|
||||
|
||||
AttributeRetrieval getSystemRandom(String tableName, String style);
|
||||
AttributeRetrieval getSystemRandom(String tableName, String style, boolean isFemaleTable);
|
||||
|
||||
List<AttributeRetrieval> getSystemSketchPoolBySameCategory(AttributeRetrieval attributeRetrievalAttrDict, String tableName, String style);
|
||||
List<AttributeRetrieval> getSystemSketchPoolBySameCategory(AttributeRetrieval attributeRetrievalAttrDict, String tableName, String style, boolean isFemaleTable);
|
||||
|
||||
Long getIdByFileName(String fileName, String tableName);
|
||||
|
||||
|
||||
@@ -642,14 +642,22 @@ public class PythonService {
|
||||
AttributeRetrieval attributeRetrievalAttrDict = toAttrDict(attrDictJSON);
|
||||
String tableName;
|
||||
tableName = getTableName(modelSex, styleCategory);
|
||||
List<AttributeRetrieval> attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPool(attributeRetrievalAttrDict, tableName, poolNum, style);
|
||||
boolean isFemaleTable = false;
|
||||
if (tableName.contains("female")) {
|
||||
isFemaleTable = true;
|
||||
}
|
||||
List<AttributeRetrieval> attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPool(attributeRetrievalAttrDict, tableName, poolNum, style, isFemaleTable);
|
||||
if (CollectionUtil.isEmpty(attributeRetrievalList) || attributeRetrievalList.size() < poolNum) {
|
||||
attributeRetrievalAttrDict.setDesign(null);
|
||||
attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPool(attributeRetrievalAttrDict, tableName, poolNum, style);
|
||||
attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPool(attributeRetrievalAttrDict, tableName, poolNum, style, isFemaleTable);
|
||||
}
|
||||
if (CollectionUtil.isEmpty(attributeRetrievalList) || attributeRetrievalList.size() < poolNum) {
|
||||
attributeRetrievalAttrDict.setSilhouette(null);
|
||||
attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPool(attributeRetrievalAttrDict, tableName, poolNum, style);
|
||||
attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPool(attributeRetrievalAttrDict, tableName, poolNum, style, isFemaleTable);
|
||||
}
|
||||
if (CollectionUtil.isEmpty(attributeRetrievalList) || attributeRetrievalList.size() < poolNum) {
|
||||
style = null;
|
||||
attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPool(attributeRetrievalAttrDict, tableName, poolNum, style, isFemaleTable);
|
||||
}
|
||||
return toColoectionElementList(attributeRetrievalList, styleCategory, modelSex);
|
||||
}
|
||||
@@ -668,7 +676,10 @@ public class PythonService {
|
||||
AttributeRetrieval attributeRetrievalAttrDict = toAttrDict(attrDictJSON);
|
||||
String tableName;
|
||||
tableName = getTableName(modelSex, styleCategory);
|
||||
|
||||
boolean isFemaleTable = false;
|
||||
if (tableName.contains("female")) {
|
||||
isFemaleTable = true;
|
||||
}
|
||||
// 存储非空字段的列表
|
||||
List<String> nonNullFields = new ArrayList<>();
|
||||
if (attributeRetrievalAttrDict.getType() != null) {
|
||||
@@ -710,7 +721,7 @@ public class PythonService {
|
||||
}
|
||||
}
|
||||
|
||||
List<AttributeRetrieval> attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPoolBySameCategory(attributeRetrievalAttrDict, tableName, style);
|
||||
List<AttributeRetrieval> attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPoolBySameCategory(attributeRetrievalAttrDict, tableName, style, isFemaleTable);
|
||||
if (CollectionUtil.isEmpty(attributeRetrievalList)) {
|
||||
System.out.println(attributeRetrievalAttrDict);
|
||||
System.out.println(tableName);
|
||||
@@ -718,12 +729,13 @@ public class PythonService {
|
||||
attributeRetrievalAttrDict.setType(null);
|
||||
attributeRetrievalAttrDict.setOpeningType(null);
|
||||
attributeRetrievalAttrDict.setSubtype(null);
|
||||
attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPoolBySameCategory(attributeRetrievalAttrDict, tableName, style);
|
||||
}else {
|
||||
attributeRetrievalAttrDict.setType(null);
|
||||
attributeRetrievalAttrDict.setOpeningType(null);
|
||||
attributeRetrievalAttrDict.setSubtype(null);
|
||||
attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPoolBySameCategory(attributeRetrievalAttrDict, tableName, style);
|
||||
attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPoolBySameCategory(attributeRetrievalAttrDict, tableName, style, isFemaleTable);
|
||||
}
|
||||
|
||||
if (CollectionUtil.isEmpty(attributeRetrievalList)) {
|
||||
style = null;
|
||||
attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPoolBySameCategory(attributeRetrievalAttrDict, tableName, style, isFemaleTable);
|
||||
|
||||
}
|
||||
}
|
||||
return toColoectionElementList(attributeRetrievalList, styleCategory, modelSex);
|
||||
@@ -944,7 +956,11 @@ public class PythonService {
|
||||
Integer randomNum = RandomsUtil.randomSysFile(dressings.size());
|
||||
String category = dressings.get(randomNum).getStyleCategory();
|
||||
String tableName = getTableName(validateElementVO.getModelSex(), category);
|
||||
AttributeRetrieval attributeRetrieval = attributeRetrievalMapper.getSystemRandom(tableName, validateElementVO.getStyle());
|
||||
boolean isFemaleTable = false;
|
||||
if (tableName.contains("female")) {
|
||||
isFemaleTable = true;
|
||||
}
|
||||
AttributeRetrieval attributeRetrieval = attributeRetrievalMapper.getSystemRandom(tableName, validateElementVO.getStyle(), isFemaleTable);
|
||||
CollectionElement collectionElement = toCollectionElement(attributeRetrieval, category, validateElementVO.getModelSex());
|
||||
return coverSketchToDesignPythonItem(null, collectionElement, validateElementVO);
|
||||
}
|
||||
@@ -984,7 +1000,11 @@ public class PythonService {
|
||||
Integer randomNum = RandomsUtil.randomSysFile(dressings.size());
|
||||
String category = dressings.get(randomNum).getStyleCategory();
|
||||
String tableName = getTableName(validateElementVO.getModelSex(), category);
|
||||
AttributeRetrieval attributeRetrieval = attributeRetrievalMapper.getSystemRandom(tableName, validateElementVO.getStyle());
|
||||
boolean isFemaleTable = false;
|
||||
if (tableName.contains("female")) {
|
||||
isFemaleTable = true;
|
||||
}
|
||||
AttributeRetrieval attributeRetrieval = attributeRetrievalMapper.getSystemRandom(tableName, validateElementVO.getStyle(), isFemaleTable);
|
||||
CollectionElement collectionElement = toCollectionElement(attributeRetrieval, category, validateElementVO.getModelSex());
|
||||
return coverSketchToDesignPythonItem(null, collectionElement, validateElementVO);
|
||||
}
|
||||
|
||||
@@ -322,19 +322,16 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
QueryWrapper<Account> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("BINARY user_email", email);
|
||||
List<Account> accountList = accountMapper.selectList(queryWrapper);
|
||||
log.info(accountList.toString());
|
||||
if (CollectionUtil.isEmpty(accountList)) {
|
||||
throw new BusinessException("email.does.not.exist", ResultEnum.PROMPT.getCode());
|
||||
}
|
||||
return accountList.get(0);
|
||||
}
|
||||
|
||||
// 忽略大小写
|
||||
private Account getAccountByEmail(String email) {
|
||||
private Account getByEmailIgnoreCase(String email) {
|
||||
QueryWrapper<Account> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("user_email", email);
|
||||
List<Account> accountList = accountMapper.selectList(queryWrapper);
|
||||
log.info(accountList.toString());
|
||||
if (CollectionUtil.isEmpty(accountList)) {
|
||||
throw new BusinessException("email.does.not.exist", ResultEnum.PROMPT.getCode());
|
||||
}
|
||||
@@ -1134,7 +1131,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
Boolean flag = Boolean.FALSE;
|
||||
try {
|
||||
// 不是新用户 直接延长使用期限
|
||||
userInfo = getAccountByEmail(email);
|
||||
userInfo = getByEmailIgnoreCase(email);
|
||||
} catch (BusinessException e) {
|
||||
// 通过邮箱找不到用户 说明是新用户 => 创建用户
|
||||
flag = Boolean.TRUE;
|
||||
|
||||
@@ -813,9 +813,9 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
// return new DesignLikeVO();
|
||||
// }
|
||||
List<CollectionElement> oldElements = collectionElementService.getByCollectionId(userLikeGroup.getCollectionId());
|
||||
if (CollectionUtil.isEmpty(oldElements)) {
|
||||
throw new BusinessException("old.elements.not.found");
|
||||
}
|
||||
// if (CollectionUtil.isEmpty(oldElements)) {
|
||||
// throw new BusinessException("old.elements.not.found");
|
||||
// }
|
||||
List<DesignItemDetail> designItemDetails = designItemDetailService.selectByDesignItemId(designLikeDTO.getDesignItemId());
|
||||
if (CollectionUtil.isEmpty(designItemDetails)) {
|
||||
throw new BusinessException("new.designItemDetails.not.found");
|
||||
@@ -867,8 +867,11 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
if (CollectionUtils.isEmpty(hasCollections)) {
|
||||
return null;
|
||||
}
|
||||
List<Long> oldIds = oldElements.stream().map(CollectionElement::getId).collect(Collectors.toList());
|
||||
List<Long> elementIds = hasCollections.stream().map(DesignItemDetail::getCollectionElementId).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(oldElements)) {
|
||||
return elementIds;
|
||||
}
|
||||
List<Long> oldIds = oldElements.stream().map(CollectionElement::getId).collect(Collectors.toList());
|
||||
//本次新增collection个数
|
||||
List<Long> adds = elementIds.stream().filter(id -> !oldIds.contains(id)).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(adds)) {
|
||||
@@ -934,7 +937,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
List<UserLikeVO> userLikeVOS = userLikeService.getGroupDetail(userLike.getUserLikeGroupId());
|
||||
if (CollectionUtils.isEmpty(userLikeVOS)) {
|
||||
//group 下面没有元素时候 直接删除
|
||||
userLikeGroupService.removeById(userLike.getUserLikeGroupId());
|
||||
// userLikeGroupService.removeById(userLike.getUserLikeGroupId());
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@@ -23,6 +23,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.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
@@ -35,6 +36,7 @@ import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio> implements PortfolioService {
|
||||
|
||||
@@ -76,6 +78,7 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
|
||||
@Resource
|
||||
private DesignItemDetailPrintMapper designItemDetailPrintMapper;
|
||||
|
||||
|
||||
@Resource
|
||||
private MinioUtil minioUtil;
|
||||
|
||||
@@ -436,8 +439,31 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
|
||||
return PageBaseResponse.success(new Page<>());
|
||||
}
|
||||
}
|
||||
List<Portfolio> topThree = new ArrayList<>();
|
||||
|
||||
if (query.getPage() == 1 &&
|
||||
(query.getGetMyPortfolio() != 1 || query.getGetLikePortfolio() != 1)) {
|
||||
List<Long> topThreeLike = getTopThreeLikeFromRedis(RedisUtil.PORTFOLIO_LIKE_KEY);
|
||||
log.info("top three like 的作品集的id : {}", topThreeLike);
|
||||
List<Long> topThreeView = getTopThreeViewFromRedis(RedisUtil.PORTFOLIO_VIEW_KEY);
|
||||
log.info("top three view 的作品集的id : {}", topThreeView);
|
||||
QueryWrapper<Portfolio> queryLike = new QueryWrapper<>();
|
||||
queryLike.in("id", topThreeLike);
|
||||
QueryWrapper<Portfolio> queryView = new QueryWrapper<>();
|
||||
queryView.in("id", topThreeView);
|
||||
List<Portfolio> topThreeLikePortfolio = baseMapper.selectList(queryLike);
|
||||
List<Portfolio> topThreeViewPortfolio = baseMapper.selectList(queryView);
|
||||
topThree.addAll(topThreeLikePortfolio);
|
||||
topThree.addAll(topThreeViewPortfolio);
|
||||
}
|
||||
|
||||
qw.lambda().orderByDesc(Portfolio::getUpdateDate);
|
||||
IPage<Portfolio> page = portfolioMapper.selectPage(new Page<>(query.getPage(), query.getSize()), qw);
|
||||
if (!topThree.isEmpty()) {
|
||||
List<Portfolio> records = page.getRecords();
|
||||
records.addAll(0, topThree);
|
||||
page.setRecords(records);
|
||||
}
|
||||
IPage<PortfolioVO> convert = page.convert((Function<Portfolio, PortfolioVO>) portfolio -> {
|
||||
if (portfolio != null) {
|
||||
PortfolioVO vo = CopyUtil.copyObject(portfolio, PortfolioVO.class);
|
||||
@@ -670,8 +696,8 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
|
||||
Long designItemDetailIdNew = designItemDetailOld.getId();
|
||||
QueryWrapper<DesignItemDetailPrint> designItemDetailPrintQueryWrapper = new QueryWrapper<>();
|
||||
designItemDetailPrintQueryWrapper.lambda().eq(DesignItemDetailPrint::getDesignItemDetailId, designItemDetailIdOld);
|
||||
DesignItemDetailPrint designItemDetailPrint = designItemDetailPrintMapper.selectOne(designItemDetailPrintQueryWrapper);
|
||||
if (Objects.nonNull(designItemDetailPrint)) {
|
||||
List<DesignItemDetailPrint> designItemDetailPrintList = designItemDetailPrintMapper.selectList(designItemDetailPrintQueryWrapper);
|
||||
for (DesignItemDetailPrint designItemDetailPrint : designItemDetailPrintList) {
|
||||
designItemDetailPrint.setId(null);
|
||||
designItemDetailPrint.setDesignItemDetailId(designItemDetailIdNew);
|
||||
designItemDetailPrintMapper.insert(designItemDetailPrint);
|
||||
@@ -960,6 +986,65 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
|
||||
return resultList;
|
||||
}
|
||||
|
||||
private List<Long> getTopThreeLikeFromRedis(String prefix) {
|
||||
// 获取所有与 PORTFOLIO_LIKE_KEY 相关的 keys
|
||||
Set<String> keys = redisUtil.getKeysFromString(prefix + "*");
|
||||
|
||||
List<Map.Entry<String, Long>> portfolioSizes = new ArrayList<>();
|
||||
|
||||
if (keys != null) {
|
||||
for (String key : keys) {
|
||||
// 获取 Set 的 size
|
||||
Long size = redisUtil.getSize(key);
|
||||
// 保存 key 和 size
|
||||
portfolioSizes.add(new AbstractMap.SimpleEntry<>(key, size));
|
||||
}
|
||||
// 按 size 倒序排序
|
||||
portfolioSizes.sort((e1, e2) -> e2.getValue().compareTo(e1.getValue()));
|
||||
// 获取 size 最大的前三个
|
||||
List<Long> top3PortfolioIds = portfolioSizes.stream()
|
||||
.limit(3)
|
||||
.map(Map.Entry::getKey)
|
||||
.map(key -> key.replace(prefix, "")) // 去掉前缀,获取 portfolioId
|
||||
.map(Long::valueOf)
|
||||
.collect(Collectors.toList());
|
||||
// 输出 top3PortfolioIds
|
||||
top3PortfolioIds.forEach(System.out::println);
|
||||
return top3PortfolioIds;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private List<Long> getTopThreeViewFromRedis(String prefix) {
|
||||
// Step 1: Get all keys with the specific prefix
|
||||
Set<String> keys = redisUtil.getKeysFromString(prefix + "*");
|
||||
// Step 2: Create a map to store portfolioId and its corresponding value
|
||||
Map<Long, Long> portfolioViews = new HashMap<>();
|
||||
if (keys != null) {
|
||||
for (String key : keys) {
|
||||
// Get the value associated with the key
|
||||
Long value = redisUtil.getViewCount(key);
|
||||
if (!Objects.isNull(value)) {
|
||||
// Extract the portfolioId from the key (assuming the key structure is consistent)
|
||||
Long portfolioId = Long.valueOf(key.replace(prefix, ""));
|
||||
portfolioViews.put(portfolioId, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Step 3: Find the top 3 portfolio IDs with the largest values
|
||||
if (!portfolioViews.isEmpty()){
|
||||
List<Long> top3PortfolioIds = portfolioViews.entrySet().stream()
|
||||
.sorted(Map.Entry.<Long, Long>comparingByValue().reversed())
|
||||
.limit(3)
|
||||
.map(Map.Entry::getKey)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
System.out.println("Top 3 Portfolio IDs: " + top3PortfolioIds);
|
||||
return top3PortfolioIds;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void follow(Long followeeId) {
|
||||
Long accountId = UserContext.getUserHolder().getId();
|
||||
// 1、不能关注自己
|
||||
|
||||
@@ -32,7 +32,9 @@
|
||||
<if test="style != null">
|
||||
AND style = #{style}
|
||||
</if>
|
||||
|
||||
<if test="isFemaleTable">
|
||||
AND deprecated = 0
|
||||
</if>
|
||||
</trim>
|
||||
ORDER BY
|
||||
RAND()
|
||||
@@ -48,7 +50,9 @@
|
||||
<if test="style != null">
|
||||
AND style = #{style}
|
||||
</if>
|
||||
|
||||
<if test="isFemaleTable">
|
||||
AND deprecated = 0
|
||||
</if>
|
||||
</trim>
|
||||
ORDER BY
|
||||
RAND()
|
||||
@@ -73,7 +77,9 @@
|
||||
<if test="style != null">
|
||||
AND style = #{style}
|
||||
</if>
|
||||
|
||||
<if test="isFemaleTable">
|
||||
AND deprecated = 0
|
||||
</if>
|
||||
</trim>
|
||||
ORDER BY
|
||||
RAND()
|
||||
|
||||
@@ -182,8 +182,8 @@ OVERALL=整体
|
||||
TOPS=上装
|
||||
BOTTOMS=下装
|
||||
OUTWEAR=外套
|
||||
BLOUSE=衬衫
|
||||
DRESS=长裙
|
||||
BLOUSE=上衣
|
||||
DRESS=连衣裙
|
||||
TROUSERS=裤子
|
||||
SKIRT=短裙
|
||||
FEMALE=女装
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
##### PayPal
|
||||
|
||||
# developer-sandbox-xp
|
||||
paypal.client-id=ATbaebYi7-GXWRWJqwRLYMzKEbwjh4BFRqD4Y13i4lZq0rplWIM_IpPrtPKpdkAt_KrPXd6IJTwsDqa5
|
||||
paypal.client-secret=EHWWJqGmmbfjLXqCUpGrvxRYBPPtWvA3hR5ZaAyHlGSVJiHoQPS8skbNaJ9h39VObnchUbgiY2pPu__s
|
||||
paypal.receiver.email=sb-ukxfk29608925@business.example.com
|
||||
paypal.mode=sandbox
|
||||
#paypal.client-id=ATbaebYi7-GXWRWJqwRLYMzKEbwjh4BFRqD4Y13i4lZq0rplWIM_IpPrtPKpdkAt_KrPXd6IJTwsDqa5
|
||||
#paypal.client-secret=EHWWJqGmmbfjLXqCUpGrvxRYBPPtWvA3hR5ZaAyHlGSVJiHoQPS8skbNaJ9h39VObnchUbgiY2pPu__s
|
||||
#paypal.receiver.email=sb-ukxfk29608925@business.example.com
|
||||
#paypal.mode=sandbox
|
||||
# local
|
||||
paypal.webhook_id=31797347YC028794L
|
||||
#paypal.webhook_id=31797347YC028794L
|
||||
# dev
|
||||
#paypal.webhook_id=51V87014T6406322F
|
||||
|
||||
@@ -18,12 +18,11 @@ paypal.webhook_id=31797347YC028794L
|
||||
#paypal.webhook_id=1WH327112B602422N
|
||||
|
||||
# aida-live-kim
|
||||
#paypal.client-id=ASWSIZ3MXJU5w5VOeOHeigWcSw6iinl30ZCipruziKpHclxP0ryf8-7VKG1Ba2VwZwa2DMvGEzTfCTgz
|
||||
#paypal.client-secret=EHQg_K5PSqmp4FJlzEcOEH_kFkmq4aBzaI7jridw53L6cOQRULBAnfv2KakRfrsqaU1PDSkO4Co9Vyxc
|
||||
#paypal.receiver.email=kimwong@code-create.com.hk
|
||||
#paypal.mode=live
|
||||
#paypal.webhook_id=41L14847MC833625B
|
||||
#paypal.webhook_id=1D107312EX592781K
|
||||
paypal.client-id=ASWSIZ3MXJU5w5VOeOHeigWcSw6iinl30ZCipruziKpHclxP0ryf8-7VKG1Ba2VwZwa2DMvGEzTfCTgz
|
||||
paypal.client-secret=EHQg_K5PSqmp4FJlzEcOEH_kFkmq4aBzaI7jridw53L6cOQRULBAnfv2KakRfrsqaU1PDSkO4Co9Vyxc
|
||||
paypal.receiver.email=kimwong@code-create.com.hk
|
||||
paypal.mode=live
|
||||
paypal.webhook_id=1D107312EX592781K
|
||||
|
||||
##### Stripe
|
||||
|
||||
|
||||
Reference in New Issue
Block a user