fix:获取历史记录加入顾客id
All checks were successful
git commit 控制 连卡佛 back-java prod 分支构建部署 / build_and_deploy (push) Has been skipped

This commit is contained in:
litianxiang
2025-12-22 15:17:12 +08:00
parent 658149639f
commit 8eb42c9364
4 changed files with 67 additions and 59 deletions

View File

@@ -40,7 +40,7 @@ public class WebConfig implements WebMvcConfigurer {
registry.addInterceptor(jwtInterceptor) registry.addInterceptor(jwtInterceptor)
.addPathPatterns("/api/**/**") // 保护这些路径 .addPathPatterns("/api/**/**") // 保护这些路径
.excludePathPatterns(Arrays.asList("/api/auth/precheckEmail", "/api/auth/registerOrLogin", .excludePathPatterns(Arrays.asList("/api/auth/precheckEmail", "/api/auth/registerOrLogin",
"/api/auth/forgotPwd", "/api/style/callback", "/api/auth/parseGoogleAccessToken")); // 排除登录接口 "/api/auth/forgotPwd", "/api/style/callback", "/api/auth/parseGoogleAccessToken","/api/try-on-effects/getHistoricals")); // 排除登录接口
} }
/** /**

View File

@@ -47,7 +47,7 @@ public class TryOnEffectController {
@GetMapping("/getHistoricals") @GetMapping("/getHistoricals")
public ApiResponse<List<? extends BaseVO>> getHistoricals( public ApiResponse<List<? extends BaseVO>> getHistoricals(
@Parameter(description = "服装ID", required = true) @Parameter(description = "服装ID", required = true)
@RequestBody HistoricalDTO historicalDTO) { @ModelAttribute HistoricalDTO historicalDTO) {
if (CommonConstants.OUTFIT.equals(historicalDTO.getType())){ if (CommonConstants.OUTFIT.equals(historicalDTO.getType())){
List<OutfitHisVO> outfitHisVOS = tryOnEffectService.getOutfitHistoricals(historicalDTO); List<OutfitHisVO> outfitHisVOS = tryOnEffectService.getOutfitHistoricals(historicalDTO);
return ApiResponse.success(outfitHisVOS); return ApiResponse.success(outfitHisVOS);

View File

@@ -5,6 +5,10 @@ import lombok.Data;
@Data @Data
public class HistoricalDTO { public class HistoricalDTO {
@Schema(description = "顾客ID",example = "1")
private Long customerId;
@Schema(description = "进店记录ID",example = "1") @Schema(description = "进店记录ID",example = "1")
private Long visitRecordId; private Long visitRecordId;

View File

@@ -40,7 +40,7 @@ import java.util.concurrent.TimeUnit;
* *
* @author AI Assistant * @author AI Assistant
* @since 2024-01-01 * @since 2024-01-01
/** * /**
* 试穿效果服务实现类 * 试穿效果服务实现类
*/ */
@Service @Service
@@ -186,6 +186,7 @@ public class TryOnEffectServiceImpl extends ServiceImpl<TryOnEffectMapper, TryOn
/** /**
* 添加意见建议 * 添加意见建议
*
* @param suggestion 意见建议实体 * @param suggestion 意见建议实体
* @return 是否添加成功 * @return 是否添加成功
*/ */
@@ -260,11 +261,12 @@ public class TryOnEffectServiceImpl extends ServiceImpl<TryOnEffectMapper, TryOn
@Override @Override
public List<TryOnResultVO> getTryOnHistoricals(HistoricalDTO historicalDTO) { public List<TryOnResultVO> getTryOnHistoricals(HistoricalDTO historicalDTO) {
LambdaQueryWrapper<TryOnEffect> tryOnEffectLambdaQueryWrapper = new LambdaQueryWrapper<TryOnEffect>() LambdaQueryWrapper<TryOnEffect> tryOnEffectLambdaQueryWrapper = new LambdaQueryWrapper<TryOnEffect>()
.eq(TryOnEffect::getCustomerId, historicalDTO.getCustomerId())
.orderByDesc(TryOnEffect::getCreatedTime); .orderByDesc(TryOnEffect::getCreatedTime);
if (historicalDTO.getVisitRecordId() != null) { if (historicalDTO.getVisitRecordId() != null) {
tryOnEffectLambdaQueryWrapper.eq(TryOnEffect::getVisitRecordId, historicalDTO.getVisitRecordId()); tryOnEffectLambdaQueryWrapper.eq(TryOnEffect::getVisitRecordId, historicalDTO.getVisitRecordId());
} }
if (historicalDTO.getIsLibrary() != null||historicalDTO.getIsLibrary()){ if (historicalDTO.getIsLibrary() != null && historicalDTO.getIsLibrary()) {
tryOnEffectLambdaQueryWrapper.eq(TryOnEffect::getIsFavorite, 1); tryOnEffectLambdaQueryWrapper.eq(TryOnEffect::getIsFavorite, 1);
} }
if (CommonConstants.TRYON.equals(historicalDTO.getType())) { if (CommonConstants.TRYON.equals(historicalDTO.getType())) {
@@ -301,11 +303,13 @@ public class TryOnEffectServiceImpl extends ServiceImpl<TryOnEffectMapper, TryOn
@Override @Override
public List<OutfitHisVO> getOutfitHistoricals(HistoricalDTO historicalDTO) { public List<OutfitHisVO> getOutfitHistoricals(HistoricalDTO historicalDTO) {
LambdaQueryWrapper<Style> styleLambdaQueryWrapper = new LambdaQueryWrapper<Style>().orderByDesc(Style::getCreatedTime); LambdaQueryWrapper<Style> styleLambdaQueryWrapper = new LambdaQueryWrapper<Style>()
.eq(Style::getCustomerId, historicalDTO.getCustomerId())
.orderByDesc(Style::getCreatedTime);
if (historicalDTO.getVisitRecordId() != null) { if (historicalDTO.getVisitRecordId() != null) {
styleLambdaQueryWrapper.eq(Style::getVisitRecordId, historicalDTO.getVisitRecordId()); styleLambdaQueryWrapper.eq(Style::getVisitRecordId, historicalDTO.getVisitRecordId());
} }
if (historicalDTO.getIsLibrary() != null||historicalDTO.getIsLibrary()){ if (historicalDTO.getIsLibrary() != null && historicalDTO.getIsLibrary()) {
styleLambdaQueryWrapper.eq(Style::getIsFavorite, 1); styleLambdaQueryWrapper.eq(Style::getIsFavorite, 1);
} }
List<Style> styles = styleService.list(styleLambdaQueryWrapper); List<Style> styles = styleService.list(styleLambdaQueryWrapper);
@@ -684,6 +688,7 @@ public class TryOnEffectServiceImpl extends ServiceImpl<TryOnEffectMapper, TryOn
/** /**
* 调用换脸API * 调用换脸API
*
* @param imageUrls 图片URL列表第一个为源图片第二个为目标图片 * @param imageUrls 图片URL列表第一个为源图片第二个为目标图片
* @return 换脸后的图片URL * @return 换脸后的图片URL
*/ */
@@ -801,7 +806,6 @@ public class TryOnEffectServiceImpl extends ServiceImpl<TryOnEffectMapper, TryOn
log.info("换脸成功,图片路径: {}", imagePath); log.info("换脸成功,图片路径: {}", imagePath);
// 下载图片并上传到MinIO // 下载图片并上传到MinIO
return imagePath; return imagePath;
} else { } else {