Merge branch 'dev/dev' into prod/release_1.0
All checks were successful
git commit 控制 连卡佛 back-java prod 分支构建部署 / build_and_deploy (push) Has been skipped
All checks were successful
git commit 控制 连卡佛 back-java prod 分支构建部署 / build_and_deploy (push) Has been skipped
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.aida.lanecarford.controller;
|
||||
|
||||
import com.aida.lanecarford.common.ApiResponse;
|
||||
import com.aida.lanecarford.common.PageResult;
|
||||
import com.aida.lanecarford.common.constant.CommonConstants;
|
||||
import com.aida.lanecarford.dto.HistoricalDTO;
|
||||
import com.aida.lanecarford.entity.Suggestion;
|
||||
@@ -43,16 +44,16 @@ public class TryOnEffectController {
|
||||
return ApiResponse.success(tryOnResultVo);
|
||||
}
|
||||
|
||||
@Operation(summary = "获取历史生成记录", description = "根据type,进店记录id,是否收藏来决定返回的数据")
|
||||
@Operation(summary = "获取历史生成记录", description = "根据type,进店记录id,是否收藏来决定返回的数据,支持分页")
|
||||
@GetMapping("/getHistoricals")
|
||||
public ApiResponse<List<? extends BaseVO>> getHistoricals(
|
||||
@Parameter(description = "服装ID", required = true)
|
||||
public ApiResponse<PageResult<? extends BaseVO>> getHistoricals(
|
||||
@Parameter(description = "历史记录查询参数", required = true)
|
||||
@ModelAttribute HistoricalDTO historicalDTO) {
|
||||
if (CommonConstants.OUTFIT.equals(historicalDTO.getType())){
|
||||
List<OutfitHisVO> outfitHisVOS = tryOnEffectService.getOutfitHistoricals(historicalDTO);
|
||||
if (CommonConstants.OUTFIT.equals(historicalDTO.getType())) {
|
||||
PageResult<OutfitHisVO> outfitHisVOS = tryOnEffectService.getOutfitHistoricals(historicalDTO);
|
||||
return ApiResponse.success(outfitHisVOS);
|
||||
}else {
|
||||
List<TryOnResultVO> tryOnResultVos = tryOnEffectService.getTryOnHistoricals(historicalDTO);
|
||||
} else {
|
||||
PageResult<TryOnResultVO> tryOnResultVos = tryOnEffectService.getTryOnHistoricals(historicalDTO);
|
||||
return ApiResponse.success(tryOnResultVos);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,16 +6,22 @@ import lombok.Data;
|
||||
@Data
|
||||
public class HistoricalDTO {
|
||||
|
||||
@Schema(description = "顾客ID",example = "1")
|
||||
@Schema(description = "顾客ID", example = "1")
|
||||
private Long customerId;
|
||||
|
||||
@Schema(description = "进店记录ID",example = "1")
|
||||
@Schema(description = "进店记录ID", example = "1")
|
||||
private Long visitRecordId;
|
||||
|
||||
@Schema(description = "类型",example = "Outfit , Try-on , Gen-AI")
|
||||
@Schema(description = "类型", example = "Outfit , Try-on , Gen-AI")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "是否是收藏",example = "true")
|
||||
@Schema(description = "是否是收藏", example = "true")
|
||||
private Boolean isLibrary;
|
||||
|
||||
@Schema(description = "当前页码,从1开始", example = "1")
|
||||
private Integer pageNum;
|
||||
|
||||
@Schema(description = "每页大小", example = "10")
|
||||
private Integer pageSize;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.aida.lanecarford.service;
|
||||
|
||||
import com.aida.lanecarford.common.PageResult;
|
||||
import com.aida.lanecarford.dto.HistoricalDTO;
|
||||
import com.aida.lanecarford.entity.Suggestion;
|
||||
import com.aida.lanecarford.entity.TryOnEffect;
|
||||
@@ -47,7 +48,7 @@ public interface TryOnEffectService extends IService<TryOnEffect> {
|
||||
|
||||
String generateUrl(String prompt, String tryonUrl);
|
||||
|
||||
List<TryOnResultVO> getTryOnHistoricals(HistoricalDTO historicalDTO);
|
||||
PageResult<TryOnResultVO> getTryOnHistoricals(HistoricalDTO historicalDTO);
|
||||
|
||||
List<OutfitHisVO> getOutfitHistoricals(HistoricalDTO historicalDTO);
|
||||
PageResult<OutfitHisVO> getOutfitHistoricals(HistoricalDTO historicalDTO);
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.aida.lanecarford.service.impl;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.aida.lanecarford.common.PageResult;
|
||||
import com.aida.lanecarford.common.constant.CommonConstants;
|
||||
import com.aida.lanecarford.config.MinioConfig;
|
||||
import com.aida.lanecarford.config.FaceSwapConfig;
|
||||
@@ -22,6 +23,8 @@ import com.aida.lanecarford.vo.TryOnResultVO;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.google.auth.oauth2.GoogleCredentials;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -48,12 +51,7 @@ import java.util.concurrent.TimeUnit;
|
||||
public class TryOnEffectServiceImpl extends ServiceImpl<TryOnEffectMapper, TryOnEffect> implements TryOnEffectService {
|
||||
private static final Logger log = LoggerFactory.getLogger(TryOnEffectServiceImpl.class);
|
||||
private final StyleService styleService;
|
||||
private final ModelPhotoService modelPhotoService;
|
||||
private final CustomerPhotoService customerPhotoService;
|
||||
private final ImageCompositionService imageCompositionService;
|
||||
|
||||
private final CustomerMapper customerMapper;
|
||||
|
||||
private final MinioUtil minioUtil;
|
||||
private final MinioConfig minioConfig;
|
||||
private final FaceSwapConfig faceSwapConfig;
|
||||
@@ -80,6 +78,9 @@ public class TryOnEffectServiceImpl extends ServiceImpl<TryOnEffectMapper, TryOn
|
||||
tryOnEffectDto.setStyleId(originalTryOn.getStyleId());
|
||||
}
|
||||
String resultImageUrl = originalTryOn.getResultImageUrl();
|
||||
if (tryOnEffectDto.getStyleId()==null){
|
||||
tryOnEffectDto.setStyleId(originalTryOn.getStyleId());
|
||||
}
|
||||
imageUrls.add(resultImageUrl);
|
||||
|
||||
Long customerPhotoId = tryOnEffectDto.getCustomerPhotoId();
|
||||
@@ -262,7 +263,7 @@ public class TryOnEffectServiceImpl extends ServiceImpl<TryOnEffectMapper, TryOn
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TryOnResultVO> getTryOnHistoricals(HistoricalDTO historicalDTO) {
|
||||
public PageResult<TryOnResultVO> getTryOnHistoricals(HistoricalDTO historicalDTO) {
|
||||
LambdaQueryWrapper<TryOnEffect> tryOnEffectLambdaQueryWrapper = new LambdaQueryWrapper<TryOnEffect>()
|
||||
.eq(TryOnEffect::getCustomerId, historicalDTO.getCustomerId())
|
||||
.orderByDesc(TryOnEffect::getCreatedTime);
|
||||
@@ -277,9 +278,14 @@ public class TryOnEffectServiceImpl extends ServiceImpl<TryOnEffectMapper, TryOn
|
||||
} else if (CommonConstants.GENAI.equals(historicalDTO.getType())) {
|
||||
tryOnEffectLambdaQueryWrapper.eq(TryOnEffect::getIsRegenerated, 1);
|
||||
}
|
||||
List<TryOnEffect> tryOnEffects = this.list(tryOnEffectLambdaQueryWrapper);
|
||||
|
||||
long current = historicalDTO.getPageNum() == null || historicalDTO.getPageNum() <= 0 ? 1L : historicalDTO.getPageNum();
|
||||
long size = historicalDTO.getPageSize() == null || historicalDTO.getPageSize() <= 0 ? 10L : historicalDTO.getPageSize();
|
||||
|
||||
IPage<TryOnEffect> page = this.page(new Page<>(current, size), tryOnEffectLambdaQueryWrapper);
|
||||
|
||||
List<TryOnResultVO> tryOnResultVos = new ArrayList<>();
|
||||
for (TryOnEffect tryOnEffect : tryOnEffects) {
|
||||
for (TryOnEffect tryOnEffect : page.getRecords()) {
|
||||
TryOnResultVO tryOnResultVo = new TryOnResultVO();
|
||||
tryOnResultVo.setId(tryOnEffect.getId());
|
||||
tryOnResultVo.setTryOnUrl(minioUtil.convertToPresignedUrl(
|
||||
@@ -301,11 +307,11 @@ public class TryOnEffectServiceImpl extends ServiceImpl<TryOnEffectMapper, TryOn
|
||||
tryOnResultVo.setIsFavorite(tryOnEffect.getIsFavorite());
|
||||
tryOnResultVos.add(tryOnResultVo);
|
||||
}
|
||||
return tryOnResultVos;
|
||||
return new PageResult<>(tryOnResultVos, page.getTotal(), page.getCurrent(), page.getSize());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OutfitHisVO> getOutfitHistoricals(HistoricalDTO historicalDTO) {
|
||||
public PageResult<OutfitHisVO> getOutfitHistoricals(HistoricalDTO historicalDTO) {
|
||||
LambdaQueryWrapper<Style> styleLambdaQueryWrapper = new LambdaQueryWrapper<Style>()
|
||||
.eq(Style::getCustomerId, historicalDTO.getCustomerId())
|
||||
.eq(Style::getGenerationStatus, 1)
|
||||
@@ -316,9 +322,14 @@ public class TryOnEffectServiceImpl extends ServiceImpl<TryOnEffectMapper, TryOn
|
||||
if (historicalDTO.getIsLibrary() != null && historicalDTO.getIsLibrary()) {
|
||||
styleLambdaQueryWrapper.eq(Style::getIsFavorite, 1);
|
||||
}
|
||||
List<Style> styles = styleService.list(styleLambdaQueryWrapper);
|
||||
|
||||
long current = historicalDTO.getPageNum() == null || historicalDTO.getPageNum() <= 0 ? 1L : historicalDTO.getPageNum();
|
||||
long size = historicalDTO.getPageSize() == null || historicalDTO.getPageSize() <= 0 ? 10L : historicalDTO.getPageSize();
|
||||
|
||||
IPage<Style> page = styleService.page(new Page<>(current, size), styleLambdaQueryWrapper);
|
||||
|
||||
List<OutfitHisVO> outfitHisVos = new ArrayList<>();
|
||||
for (Style style : styles) {
|
||||
for (Style style : page.getRecords()) {
|
||||
OutfitHisVO outfitHisVo = new OutfitHisVO();
|
||||
outfitHisVo.setId(style.getId());
|
||||
outfitHisVo.setUrl(minioUtil.convertToPresignedUrl(
|
||||
@@ -328,7 +339,7 @@ public class TryOnEffectServiceImpl extends ServiceImpl<TryOnEffectMapper, TryOn
|
||||
outfitHisVo.setIsFavorite(style.getIsFavorite());
|
||||
outfitHisVos.add(outfitHisVo);
|
||||
}
|
||||
return outfitHisVos;
|
||||
return new PageResult<>(outfitHisVos, page.getTotal(), page.getCurrent(), page.getSize());
|
||||
}
|
||||
|
||||
//目前用于customize your look页面点击finish后的显示
|
||||
|
||||
Reference in New Issue
Block a user