Merge remote-tracking branch 'origin/dev/dev' into prod/release_1.0

# Conflicts:
#	src/main/java/com/aida/lanecarford/service/impl/VisitRecordServiceImpl.java
This commit is contained in:
litianxiang
2025-11-03 10:23:18 +08:00
3 changed files with 12 additions and 31 deletions

View File

@@ -1,15 +0,0 @@
package com.aida.lanecarford.common;
public class CommonConstant {
// 单位 秒 10分钟过期
// public static final Long TASK_EXPIRE_TIME = 24 * 60 * 60L;
public static final Long TASK_EXPIRE_TIME = 10 * 60L;
// 单位 秒 两天过期
public static final Long CREDITS_EXPIRE_TIME = 2 * 24 * 60 * 60L;
// 单位 分钟
public static final Integer MINIO_IMAGE_EXPIRE_TIME = 24 * 60;
// 单位 秒 一天过期 in redis
public static final Long GENERATE_RESULT_EXPIRE_TIME = 24 * 60 * 60L;
// 单位 秒 7天过期
public static final Long REDIS_SET_EXPIRE_TIME = 24 * 60 * 60 * 7L;
}

View File

@@ -1,7 +1,7 @@
package com.aida.lanecarford.service.impl;
import cn.hutool.json.JSONObject;
import com.aida.lanecarford.common.CommonConstant;
import com.aida.lanecarford.common.constant.CommonConstants;
import com.aida.lanecarford.config.MinioConfig;
import com.aida.lanecarford.config.FaceSwapConfig;
import com.aida.lanecarford.common.response.ResultEnum;
@@ -21,11 +21,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.auth.oauth2.GoogleCredentials;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import okhttp3.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import java.io.IOException;
@@ -142,7 +140,7 @@ public class TryOnEffectServiceImpl extends ServiceImpl<TryOnEffectMapper, TryOn
TryOnResultVo tryOnResultVo = new TryOnResultVo();
tryOnResultVo.setTryOnId(tryOnEffectDto.getId());
tryOnResultVo.setTryOnUrl(minioUtil.convertToPresignedUrl(aiRreultlogicalUrl, CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
tryOnResultVo.setTryOnUrl(minioUtil.convertToPresignedUrl(aiRreultlogicalUrl, CommonConstants.MINIO_PATH_TIMEOUT));
return tryOnResultVo;
}
@@ -152,7 +150,8 @@ public class TryOnEffectServiceImpl extends ServiceImpl<TryOnEffectMapper, TryOn
public List<TryOnResultVo> getFavoriteTryOnEffects(Long visitRecordId) {
List<TryOnEffect> tryOnEffects = this.list(new LambdaQueryWrapper<TryOnEffect>()
.eq(TryOnEffect::getVisitRecordId, visitRecordId)
.eq(TryOnEffect::getIsFavorite, 1));
.eq(TryOnEffect::getIsFavorite, 1)
.orderByAsc(TryOnEffect::getCreatedTime));
List<TryOnResultVo> tryOnResultVos = new ArrayList<>();
for (TryOnEffect tryOnEffect : tryOnEffects) {
TryOnResultVo tryOnResultVo = new TryOnResultVo();
@@ -160,7 +159,7 @@ public class TryOnEffectServiceImpl extends ServiceImpl<TryOnEffectMapper, TryOn
// 使用新的API获取预签名URL数据库存储的是逻辑URL
tryOnResultVo.setTryOnUrl(minioUtil.convertToPresignedUrl(
tryOnEffect.getResultImageUrl(),
CommonConstant.MINIO_IMAGE_EXPIRE_TIME
CommonConstants.MINIO_PATH_TIMEOUT
));
// 如果是原始效果则获取对应的style图片
if (tryOnEffect.getIsRegenerated() == 0) {
@@ -169,7 +168,7 @@ public class TryOnEffectServiceImpl extends ServiceImpl<TryOnEffectMapper, TryOn
Style style = styleService.getOne(styleLambdaQueryWrapper);
tryOnResultVo.setStyleUrl(minioUtil.convertToPresignedUrl(
style.getStyleImageUrl(),
CommonConstant.MINIO_IMAGE_EXPIRE_TIME
CommonConstants.MINIO_PATH_TIMEOUT
));
}
@@ -184,7 +183,8 @@ public class TryOnEffectServiceImpl extends ServiceImpl<TryOnEffectMapper, TryOn
@Override
public List<TryOnResultVo> getTryOnEffectsByStyleId(Long styleId) {
List<TryOnEffect> tryOnEffects = this.list(new LambdaQueryWrapper<TryOnEffect>()
.eq(TryOnEffect::getStyleId, styleId));
.eq(TryOnEffect::getStyleId, styleId)
.orderByAsc(TryOnEffect::getCreatedTime));
List<TryOnResultVo> tryOnResultVos = new ArrayList<>();
for (TryOnEffect tryOnEffect : tryOnEffects) {
TryOnResultVo tryOnResultVo = new TryOnResultVo();
@@ -192,7 +192,7 @@ public class TryOnEffectServiceImpl extends ServiceImpl<TryOnEffectMapper, TryOn
// 使用新的API获取预签名URL数据库存储的是逻辑URL
tryOnResultVo.setTryOnUrl(minioUtil.convertToPresignedUrl(
tryOnEffect.getResultImageUrl(),
CommonConstant.MINIO_IMAGE_EXPIRE_TIME
CommonConstants.MINIO_PATH_TIMEOUT
));
// 如果是原始效果则获取对应的style图片
if (tryOnEffect.getIsRegenerated() == 0) {
@@ -201,7 +201,7 @@ public class TryOnEffectServiceImpl extends ServiceImpl<TryOnEffectMapper, TryOn
Style style = styleService.getOne(styleLambdaQueryWrapper);
tryOnResultVo.setStyleUrl(minioUtil.convertToPresignedUrl(
style.getStyleImageUrl(),
CommonConstant.MINIO_IMAGE_EXPIRE_TIME
CommonConstants.MINIO_PATH_TIMEOUT
));
}

View File

@@ -1,10 +1,9 @@
package com.aida.lanecarford.service.impl;
import com.aida.lanecarford.common.CommonConstant;
import com.aida.lanecarford.common.constant.CommonConstants;
import com.aida.lanecarford.entity.TryOnEffect;
import com.aida.lanecarford.entity.VisitRecord;
import com.aida.lanecarford.exception.BusinessException;
import com.aida.lanecarford.mapper.TryOnEffectMapper;
import com.aida.lanecarford.mapper.VisitRecordMapper;
import com.aida.lanecarford.service.TryOnEffectService;
import com.aida.lanecarford.service.VisitRecordService;
@@ -22,8 +21,6 @@ import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import static com.aida.lanecarford.common.constant.CommonConstants.MINIO_PATH_TIMEOUT;
/**
* 进店记录服务实现类
*/
@@ -79,8 +76,7 @@ public class VisitRecordServiceImpl extends ServiceImpl<VisitRecordMapper, Visit
if (favoriteEffect != null && favoriteEffect.getResultImageUrl() != null) {
libraryVo.setDefaultImageUrl(minioUtil.convertToPresignedUrl(
favoriteEffect.getResultImageUrl(),
// CommonConstant.MINIO_IMAGE_EXPIRE_TIME
MINIO_PATH_TIMEOUT
CommonConstants.MINIO_PATH_TIMEOUT
));
} else {
//如果仅进店未进行任何喜欢收藏结果,不做展示