Compare commits
15 Commits
5e6e9a8787
...
dev/dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fd6be37bc5 | ||
| f7f221ae62 | |||
| 2972ab1dca | |||
|
|
76cd268d0e | ||
|
|
e25f8e0844 | ||
|
|
f4bb4b27a2 | ||
|
|
10d39ac0c4 | ||
|
|
6687d0b5ff | ||
|
|
8eb42c9364 | ||
|
|
658149639f | ||
|
|
3df8767c47 | ||
|
|
3352bc82d9 | ||
|
|
23cb45062f | ||
| 3561cd098a | |||
|
|
dba7f09cd9 |
@@ -10,5 +10,9 @@ public class CommonConstants {
|
|||||||
|
|
||||||
public static final int CONN_TIMEOUT = 30000; // (milliseconds)
|
public static final int CONN_TIMEOUT = 30000; // (milliseconds)
|
||||||
|
|
||||||
|
public static final String OUTFIT = "Outfit";
|
||||||
|
public static final String TRYON = "Try-on";
|
||||||
|
public static final String GENAI = "Gen-AI";
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.aida.lanecarford.controller;
|
|||||||
|
|
||||||
import com.aida.lanecarford.common.ApiResponse;
|
import com.aida.lanecarford.common.ApiResponse;
|
||||||
import com.aida.lanecarford.dto.BaseRequest;
|
import com.aida.lanecarford.dto.BaseRequest;
|
||||||
|
import com.aida.lanecarford.entity.Customer;
|
||||||
import com.aida.lanecarford.service.CustomerService;
|
import com.aida.lanecarford.service.CustomerService;
|
||||||
import com.aida.lanecarford.vo.CustomerCheckInVO;
|
import com.aida.lanecarford.vo.CustomerCheckInVO;
|
||||||
import com.aida.lanecarford.vo.CustomerVO;
|
import com.aida.lanecarford.vo.CustomerVO;
|
||||||
@@ -25,11 +26,11 @@ public class CustomerController {
|
|||||||
|
|
||||||
@Operation(
|
@Operation(
|
||||||
summary = "顾客入店登记",
|
summary = "顾客入店登记",
|
||||||
description = "验证顾客身份并创建入店记录,如果是新顾客则自动注册到系统中。"
|
description = "验证顾客身份并创建入店记录"
|
||||||
)
|
)
|
||||||
@GetMapping("/checkIn")
|
@GetMapping("/checkIn")
|
||||||
public ApiResponse<CustomerCheckInVO> customerCheckIn(@RequestParam String vipId) {
|
public ApiResponse<CustomerCheckInVO> customerCheckIn(@RequestParam String nickname) {
|
||||||
return ApiResponse.success(customerService.customerCheckIn(vipId));
|
return ApiResponse.success(customerService.customerCheckIn(nickname));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/getAllCustomer")
|
@PostMapping("/getAllCustomer")
|
||||||
@@ -37,4 +38,15 @@ public class CustomerController {
|
|||||||
return ApiResponse.success(customerService.getAllCustomer(request));
|
return ApiResponse.success(customerService.getAllCustomer(request));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(
|
||||||
|
summary = "新增顾客",
|
||||||
|
description = "根据用户提供的vipId和昵称与当前sales绑定,创建账号"
|
||||||
|
)
|
||||||
|
@GetMapping("/createCustomer")
|
||||||
|
public ApiResponse<Customer> createCustomer(@RequestParam String vipId, @RequestParam String nickname) {
|
||||||
|
return ApiResponse.success(customerService.createCustomer(vipId, nickname));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -78,4 +78,39 @@ public class StyleController {
|
|||||||
return ApiResponse.success(styleService.getOutfitResult(requestIDs));
|
return ApiResponse.success(styleService.getOutfitResult(requestIDs));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置喜欢的风格
|
||||||
|
*/
|
||||||
|
@Operation(summary = "设置喜欢的outfit", description = "将指定风格设置为收藏")
|
||||||
|
@PostMapping("/set-favorite/{styleId}")
|
||||||
|
public ApiResponse<Void> setFavoriteStyle(
|
||||||
|
@Parameter(description = "风格ID", required = true)
|
||||||
|
@PathVariable Long styleId) {
|
||||||
|
styleService.setFavoriteStyle(styleId);
|
||||||
|
return ApiResponse.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消喜欢的风格
|
||||||
|
*/
|
||||||
|
@Operation(summary = "取消喜欢的outfit", description = "取消指定风格的收藏")
|
||||||
|
@PostMapping("/cancel-favorite/{styleId}")
|
||||||
|
public ApiResponse<Void> cancelFavoriteStyle(
|
||||||
|
@Parameter(description = "风格ID", required = true)
|
||||||
|
@PathVariable Long styleId) {
|
||||||
|
styleService.cancelFavoriteStyle(styleId);
|
||||||
|
return ApiResponse.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(
|
||||||
|
summary = "回溯历史对话,重新生成搭配图",
|
||||||
|
description = "根据当前的穿搭结果,回溯历史穿搭请求数据及历史对话,重新生成搭配"
|
||||||
|
)
|
||||||
|
@GetMapping("/retrieveAndRegenerate")
|
||||||
|
public ApiResponse<List<String>> retrieveAndRegenerate(
|
||||||
|
@Parameter(description = "tryOn后的图片id", required = true, example = "1369")
|
||||||
|
@RequestParam Long tryOnEffectsId) {
|
||||||
|
return ApiResponse.success(styleService.retrieveAndRegenerate(tryOnEffectsId));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,15 @@
|
|||||||
package com.aida.lanecarford.controller;
|
package com.aida.lanecarford.controller;
|
||||||
|
|
||||||
import com.aida.lanecarford.common.ApiResponse;
|
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;
|
import com.aida.lanecarford.entity.Suggestion;
|
||||||
import com.aida.lanecarford.entity.TryOnEffect;
|
import com.aida.lanecarford.entity.TryOnEffect;
|
||||||
import com.aida.lanecarford.service.TryOnEffectService;
|
import com.aida.lanecarford.service.TryOnEffectService;
|
||||||
import com.aida.lanecarford.vo.TryOnResultVo;
|
import com.aida.lanecarford.vo.BaseVO;
|
||||||
|
import com.aida.lanecarford.vo.OutfitHisVO;
|
||||||
|
import com.aida.lanecarford.vo.TryOnResultVO;
|
||||||
import io.netty.util.internal.StringUtil;
|
import io.netty.util.internal.StringUtil;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
@@ -32,29 +37,25 @@ public class TryOnEffectController {
|
|||||||
|
|
||||||
@Operation(summary = "生成试穿效果", description = "根据服装,模特照片生成试穿效果,其中styleId是必选,当二次生成时,要带上相关参数,比如顾客照片")
|
@Operation(summary = "生成试穿效果", description = "根据服装,模特照片生成试穿效果,其中styleId是必选,当二次生成时,要带上相关参数,比如顾客照片")
|
||||||
@PostMapping("/generate")
|
@PostMapping("/generate")
|
||||||
public ApiResponse<TryOnResultVo> generateTryOnEffect(
|
public ApiResponse<TryOnResultVO> generateTryOnEffect(
|
||||||
@Parameter(description = "试穿效果请求参数", required = true)
|
@Parameter(description = "试穿效果请求参数", required = true)
|
||||||
@Valid @RequestBody TryOnEffect tryOnEffectDto) {
|
@Valid @RequestBody TryOnEffect tryOnEffectDto) {
|
||||||
TryOnResultVo tryOnResultVo = tryOnEffectService.generateTryOnEffect(tryOnEffectDto);
|
TryOnResultVO tryOnResultVo = tryOnEffectService.generateTryOnEffect(tryOnEffectDto);
|
||||||
return ApiResponse.success(tryOnResultVo);
|
return ApiResponse.success(tryOnResultVo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "获取收藏的试穿效果", description = "对应library页面点击details后的显示,参数为进店记录id")
|
@Operation(summary = "获取历史生成记录", description = "根据type,进店记录id,是否收藏来决定返回的数据,支持分页")
|
||||||
@GetMapping("/favorites/{visitRecordId}")
|
@GetMapping("/getHistoricals")
|
||||||
public ApiResponse<List<TryOnResultVo>> getFavoriteTryOnEffects(
|
public ApiResponse<PageResult<? extends BaseVO>> getHistoricals(
|
||||||
@Parameter(description = "进店记录ID", required = true)
|
@Parameter(description = "历史记录查询参数", required = true)
|
||||||
@PathVariable Long visitRecordId) {
|
@ModelAttribute HistoricalDTO historicalDTO) {
|
||||||
List<TryOnResultVo> tryOnResultVos = tryOnEffectService.getFavoriteTryOnEffects(visitRecordId);
|
if (CommonConstants.OUTFIT.equals(historicalDTO.getType())) {
|
||||||
|
PageResult<OutfitHisVO> outfitHisVOS = tryOnEffectService.getOutfitHistoricals(historicalDTO);
|
||||||
|
return ApiResponse.success(outfitHisVOS);
|
||||||
|
} else {
|
||||||
|
PageResult<TryOnResultVO> tryOnResultVos = tryOnEffectService.getTryOnHistoricals(historicalDTO);
|
||||||
return ApiResponse.success(tryOnResultVos);
|
return ApiResponse.success(tryOnResultVos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/style/{styleId}")
|
|
||||||
@Operation(summary = "获取某套服装的所有生成结果", description = "对应customize your look页面点击finish后的显示")
|
|
||||||
public ApiResponse<List<TryOnResultVo>> getTryOnEffectsByStyleId(
|
|
||||||
@Parameter(description = "服装ID", required = true)
|
|
||||||
@PathVariable Long styleId) {
|
|
||||||
List<TryOnResultVo> tryOnResultVos = tryOnEffectService.getTryOnEffectsByStyleId(styleId);
|
|
||||||
return ApiResponse.success(tryOnResultVos);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
27
src/main/java/com/aida/lanecarford/dto/HistoricalDTO.java
Normal file
27
src/main/java/com/aida/lanecarford/dto/HistoricalDTO.java
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
package com.aida.lanecarford.dto;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class HistoricalDTO {
|
||||||
|
|
||||||
|
@Schema(description = "顾客ID", example = "1")
|
||||||
|
private Long customerId;
|
||||||
|
|
||||||
|
@Schema(description = "进店记录ID", example = "1")
|
||||||
|
private Long visitRecordId;
|
||||||
|
|
||||||
|
@Schema(description = "类型", example = "Outfit , Try-on , Gen-AI")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
@Schema(description = "是否是收藏", example = "true")
|
||||||
|
private Boolean isLibrary;
|
||||||
|
|
||||||
|
@Schema(description = "当前页码,从1开始", example = "1")
|
||||||
|
private Integer pageNum;
|
||||||
|
|
||||||
|
@Schema(description = "每页大小", example = "10")
|
||||||
|
private Integer pageSize;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -16,4 +16,8 @@ public class OutfitCallbackDTO {
|
|||||||
private String path;
|
private String path;
|
||||||
|
|
||||||
private List<Map<String, String>> items;
|
private List<Map<String, String>> items;
|
||||||
|
|
||||||
|
private String request_summary;
|
||||||
|
|
||||||
|
private List<String> occasions;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
package com.aida.lanecarford.dto;
|
package com.aida.lanecarford.dto;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.Hidden;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@Schema(description = "AI穿搭推荐请求参数")
|
@Schema(description = "AI穿搭推荐请求参数")
|
||||||
@@ -59,4 +62,10 @@ public class RequestOutfitDTO {
|
|||||||
)
|
)
|
||||||
private String sessionId;
|
private String sessionId;
|
||||||
|
|
||||||
|
@Hidden
|
||||||
|
private String summary;
|
||||||
|
|
||||||
|
@Hidden
|
||||||
|
private List<String> occasion;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,12 @@ import java.time.LocalDateTime;
|
|||||||
@TableName("customers")
|
@TableName("customers")
|
||||||
public class Customer extends BaseEntity {
|
public class Customer extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导购id,即user表的主键id
|
||||||
|
*/
|
||||||
|
@TableField("user_id")
|
||||||
|
private Long salesId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* vip ID
|
* vip ID
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -31,4 +31,9 @@ public class OutfitRequest extends BaseEntity{
|
|||||||
* 当前任务状态
|
* 当前任务状态
|
||||||
*/
|
*/
|
||||||
private int status;
|
private int status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会话记录id
|
||||||
|
*/
|
||||||
|
private Long sessionRecordId;
|
||||||
}
|
}
|
||||||
|
|||||||
51
src/main/java/com/aida/lanecarford/entity/SessionRecord.java
Normal file
51
src/main/java/com/aida/lanecarford/entity/SessionRecord.java
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
package com.aida.lanecarford.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("session_record")
|
||||||
|
public class SessionRecord extends BaseEntity{
|
||||||
|
|
||||||
|
private Long visitRecordId;
|
||||||
|
|
||||||
|
private String sessionId;
|
||||||
|
|
||||||
|
private String requestSummary;
|
||||||
|
|
||||||
|
private String occasions;
|
||||||
|
|
||||||
|
// 获取时转换为List
|
||||||
|
@JsonIgnore
|
||||||
|
public List<String> getOccasionsList() {
|
||||||
|
if (StringUtils.isBlank(this.occasions)) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
// 使用特定分隔符,确保不会出现在内容中
|
||||||
|
return Arrays.asList(this.occasions.split("\\|\\|"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置时转换为String
|
||||||
|
public void setOccasionsList(List<String> occasionsList) {
|
||||||
|
if (occasionsList == null || occasionsList.isEmpty()) {
|
||||||
|
this.occasions = null;
|
||||||
|
} else {
|
||||||
|
this.occasions = String.join("||", occasionsList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.aida.lanecarford.entity;
|
package com.aida.lanecarford.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
@@ -76,4 +77,11 @@ public class Style extends BaseEntity {
|
|||||||
private String errorMessage;
|
private String errorMessage;
|
||||||
|
|
||||||
// 注意:createdTime、updatedTime 字段已在 BaseEntity 中定义
|
// 注意:createdTime、updatedTime 字段已在 BaseEntity 中定义
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否喜欢(0-否,1-是)
|
||||||
|
*/
|
||||||
|
@Schema(description = "是否喜欢(0-否,1-是)", example = "1", required = false)
|
||||||
|
@TableField("is_favorite")
|
||||||
|
private Integer isFavorite;
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.aida.lanecarford.mapper;
|
||||||
|
|
||||||
|
import com.aida.lanecarford.entity.SessionRecord;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface SessionRecordMapper extends BaseMapper<SessionRecord> {
|
||||||
|
}
|
||||||
@@ -16,4 +16,6 @@ public interface CustomerService extends IService<Customer> {
|
|||||||
|
|
||||||
IPage<CustomerVO> getAllCustomer(BaseRequest request);
|
IPage<CustomerVO> getAllCustomer(BaseRequest request);
|
||||||
|
|
||||||
|
Customer createCustomer(String vipId, String nickname);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -19,4 +19,18 @@ public interface StyleService extends IService<Style> {
|
|||||||
|
|
||||||
List<OutfitResultVO> getOutfitResult(List<String> requestIDs);
|
List<OutfitResultVO> getOutfitResult(List<String> requestIDs);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置风格为收藏
|
||||||
|
* @param styleId 风格ID
|
||||||
|
*/
|
||||||
|
void setFavoriteStyle(Long styleId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消风格的收藏
|
||||||
|
* @param styleId 风格ID
|
||||||
|
*/
|
||||||
|
void cancelFavoriteStyle(Long styleId);
|
||||||
|
|
||||||
|
List<String> retrieveAndRegenerate(Long tryOnEffectsId);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,11 @@
|
|||||||
package com.aida.lanecarford.service;
|
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.Suggestion;
|
||||||
import com.aida.lanecarford.entity.TryOnEffect;
|
import com.aida.lanecarford.entity.TryOnEffect;
|
||||||
import com.aida.lanecarford.vo.TryOnResultVo;
|
import com.aida.lanecarford.vo.OutfitHisVO;
|
||||||
|
import com.aida.lanecarford.vo.TryOnResultVO;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
|
||||||
@@ -16,9 +19,9 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface TryOnEffectService extends IService<TryOnEffect> {
|
public interface TryOnEffectService extends IService<TryOnEffect> {
|
||||||
|
|
||||||
TryOnResultVo generateTryOnEffect(@Valid TryOnEffect tryOnEffectDto);
|
TryOnResultVO generateTryOnEffect(@Valid TryOnEffect tryOnEffectDto);
|
||||||
|
|
||||||
List<TryOnResultVo> getFavoriteTryOnEffects(Long visitRecordId);
|
List<TryOnResultVO> getFavoriteTryOnEffects(Long visitRecordId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置试穿效果为收藏
|
* 设置试穿效果为收藏
|
||||||
@@ -32,7 +35,7 @@ public interface TryOnEffectService extends IService<TryOnEffect> {
|
|||||||
*/
|
*/
|
||||||
void cancelFavoriteTryOnEffect(Long tryOnId);
|
void cancelFavoriteTryOnEffect(Long tryOnId);
|
||||||
|
|
||||||
List<TryOnResultVo> getTryOnEffectsByStyleId(Long styleId);
|
List<TryOnResultVO> getTryOnEffectsByStyleId(Long styleId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加意见建议
|
* 添加意见建议
|
||||||
@@ -44,4 +47,8 @@ public interface TryOnEffectService extends IService<TryOnEffect> {
|
|||||||
String reFace(Long customerPhotoId);
|
String reFace(Long customerPhotoId);
|
||||||
|
|
||||||
String generateUrl(String prompt, String tryonUrl);
|
String generateUrl(String prompt, String tryonUrl);
|
||||||
|
|
||||||
|
PageResult<TryOnResultVO> getTryOnHistoricals(HistoricalDTO historicalDTO);
|
||||||
|
|
||||||
|
PageResult<OutfitHisVO> getOutfitHistoricals(HistoricalDTO historicalDTO);
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.aida.lanecarford.service.impl;
|
package com.aida.lanecarford.service.impl;
|
||||||
|
|
||||||
|
import com.aida.lanecarford.common.response.ResultEnum;
|
||||||
import com.aida.lanecarford.common.security.context.UserContext;
|
import com.aida.lanecarford.common.security.context.UserContext;
|
||||||
import com.aida.lanecarford.dto.BaseRequest;
|
import com.aida.lanecarford.dto.BaseRequest;
|
||||||
import com.aida.lanecarford.entity.Customer;
|
import com.aida.lanecarford.entity.Customer;
|
||||||
@@ -15,8 +16,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import io.netty.util.internal.StringUtil;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@@ -32,13 +33,16 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
|
|||||||
private final VisitRecordService visitRecordService;
|
private final VisitRecordService visitRecordService;
|
||||||
|
|
||||||
// 选择顾客登录并添加入店记录
|
// 选择顾客登录并添加入店记录
|
||||||
public CustomerCheckInVO customerCheckIn(String vipId) {
|
public CustomerCheckInVO customerCheckIn(String nickname) {
|
||||||
if (StringUtil.isNullOrEmpty(vipId)) {
|
// sales ID即当前的用户id
|
||||||
throw new BusinessException("Please enter a VIP ID.");
|
Long salesId = UserContext.getUserHolder().getId();
|
||||||
|
if (StringUtils.isBlank(nickname)) {
|
||||||
|
throw new BusinessException("Please enter a nickname.", ResultEnum.PROMPT.getCode());
|
||||||
}
|
}
|
||||||
// 1. 判断当前顾客信息在数据库中是否有存储
|
// 1. 判断当前顾客信息在数据库中是否有存储
|
||||||
LambdaQueryWrapper<Customer> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<Customer> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.eq(Customer::getVipId, vipId);
|
queryWrapper.eq(Customer::getName, nickname)
|
||||||
|
.eq(Customer::getSalesId, salesId);
|
||||||
|
|
||||||
Customer customer = getOne(queryWrapper);
|
Customer customer = getOne(queryWrapper);
|
||||||
|
|
||||||
@@ -46,26 +50,28 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
|
|||||||
if (Objects.isNull(customer)) {
|
if (Objects.isNull(customer)) {
|
||||||
// todo 从连卡佛数据库查数据
|
// todo 从连卡佛数据库查数据
|
||||||
// 先假设都找不到
|
// 先假设都找不到
|
||||||
// throw new BusinessException("This customer does not currently have a registered VIP account.");
|
throw new BusinessException("This customer does not currently have a registered VIP account.");
|
||||||
// 如果找到了,则添加到数据库
|
// 如果找到了,则添加到数据库
|
||||||
// 3. 添加当前顾客到本系统数据库
|
// 3. 添加当前顾客到本系统数据库
|
||||||
customer = new Customer();
|
// customer = new Customer();
|
||||||
customer.setVipId(vipId);
|
// customer.setVipId(vipId);
|
||||||
customer.setCreatedTime(LocalDateTime.now());
|
// customer.setCreatedTime(LocalDateTime.now());
|
||||||
|
//
|
||||||
save(customer);
|
// save(customer);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. 添加入店记录
|
// 4. 添加入店记录
|
||||||
VisitRecord visitRecord = visitRecordService.addRecord(customer.getId(), UserContext.getUserHolder().getId());
|
VisitRecord visitRecord = visitRecordService.addRecord(customer.getId(), salesId);
|
||||||
|
|
||||||
return new CustomerCheckInVO(customer.getId(), visitRecord.getId());
|
return new CustomerCheckInVO(customer.getId(), visitRecord.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取所有的顾客名单
|
// 获取所有的顾客名单
|
||||||
public IPage<CustomerVO> getAllCustomer(BaseRequest request) {
|
public IPage<CustomerVO> getAllCustomer(BaseRequest request) {
|
||||||
|
Long salesId = UserContext.getUserHolder().getId();
|
||||||
LambdaQueryWrapper<Customer> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<Customer> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.select(Customer::getName, Customer::getEmail);
|
queryWrapper.eq(Customer::getSalesId, salesId);
|
||||||
|
queryWrapper.select(Customer::getName, Customer::getVipId);
|
||||||
|
|
||||||
Page<Customer> page = page(new Page<>(request.getCurrent(), request.getSize()), queryWrapper);
|
Page<Customer> page = page(new Page<>(request.getCurrent(), request.getSize()), queryWrapper);
|
||||||
|
|
||||||
@@ -77,4 +83,34 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Customer createCustomer(String vipId, String nickname) {
|
||||||
|
Long salesId = UserContext.getUserHolder().getId();
|
||||||
|
// 1. 确认nickname是否有重复,有,返回提示信息
|
||||||
|
boolean nicknameExists = lambdaQuery().eq(Customer::getName, nickname)
|
||||||
|
.eq(Customer::getSalesId, salesId).count() > 0;
|
||||||
|
if (nicknameExists) {
|
||||||
|
throw new BusinessException("'" + nickname + "' already exists. Please choose a different nickname.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 确认输入的vipId是否已存在账号
|
||||||
|
LambdaQueryWrapper<Customer> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(Customer::getVipId, vipId)
|
||||||
|
.eq(Customer::getSalesId, salesId);
|
||||||
|
|
||||||
|
Customer customer = getOne(queryWrapper);
|
||||||
|
|
||||||
|
// 3. 不存在则新建
|
||||||
|
if (Objects.isNull(customer)) {
|
||||||
|
customer = new Customer();
|
||||||
|
customer.setVipId(vipId);
|
||||||
|
customer.setName(nickname);
|
||||||
|
customer.setSalesId(salesId);
|
||||||
|
customer.setCreatedTime(LocalDateTime.now());
|
||||||
|
|
||||||
|
save(customer);
|
||||||
|
}
|
||||||
|
|
||||||
|
return customer;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -4,13 +4,18 @@ import com.aida.lanecarford.common.constant.CommonConstants;
|
|||||||
import com.aida.lanecarford.common.constant.RedisURIConstants;
|
import com.aida.lanecarford.common.constant.RedisURIConstants;
|
||||||
import com.aida.lanecarford.common.enums.StatusEnum;
|
import com.aida.lanecarford.common.enums.StatusEnum;
|
||||||
import com.aida.lanecarford.common.enums.StylistPathEnum;
|
import com.aida.lanecarford.common.enums.StylistPathEnum;
|
||||||
|
import com.aida.lanecarford.common.response.ResultEnum;
|
||||||
import com.aida.lanecarford.dto.OutfitCallbackDTO;
|
import com.aida.lanecarford.dto.OutfitCallbackDTO;
|
||||||
import com.aida.lanecarford.dto.RequestOutfitDTO;
|
import com.aida.lanecarford.dto.RequestOutfitDTO;
|
||||||
import com.aida.lanecarford.entity.OutfitRequest;
|
import com.aida.lanecarford.entity.OutfitRequest;
|
||||||
|
import com.aida.lanecarford.entity.SessionRecord;
|
||||||
import com.aida.lanecarford.entity.Style;
|
import com.aida.lanecarford.entity.Style;
|
||||||
|
import com.aida.lanecarford.entity.TryOnEffect;
|
||||||
import com.aida.lanecarford.exception.BusinessException;
|
import com.aida.lanecarford.exception.BusinessException;
|
||||||
import com.aida.lanecarford.mapper.OutfitRequestMapper;
|
import com.aida.lanecarford.mapper.OutfitRequestMapper;
|
||||||
|
import com.aida.lanecarford.mapper.SessionRecordMapper;
|
||||||
import com.aida.lanecarford.mapper.StyleMapper;
|
import com.aida.lanecarford.mapper.StyleMapper;
|
||||||
|
import com.aida.lanecarford.mapper.TryOnEffectMapper;
|
||||||
import com.aida.lanecarford.service.StyleService;
|
import com.aida.lanecarford.service.StyleService;
|
||||||
import com.aida.lanecarford.util.CacheUtil;
|
import com.aida.lanecarford.util.CacheUtil;
|
||||||
import com.aida.lanecarford.util.MinioUtil;
|
import com.aida.lanecarford.util.MinioUtil;
|
||||||
@@ -20,12 +25,16 @@ import com.aida.lanecarford.vo.OutfitResultVO;
|
|||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import io.netty.util.internal.StringUtil;
|
import io.netty.util.internal.StringUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@@ -41,6 +50,8 @@ public class StyleServiceImpl extends ServiceImpl<StyleMapper, Style> implements
|
|||||||
private final CacheUtil cacheUtil;
|
private final CacheUtil cacheUtil;
|
||||||
private final MinioUtil minioUtil;
|
private final MinioUtil minioUtil;
|
||||||
private final OutfitRequestMapper outfitRequestMapper;
|
private final OutfitRequestMapper outfitRequestMapper;
|
||||||
|
private final SessionRecordMapper sessionRecordMapper;
|
||||||
|
private final TryOnEffectMapper tryOnEffectMapper;
|
||||||
|
|
||||||
@Value("${webhook.domain}")
|
@Value("${webhook.domain}")
|
||||||
private String webhookDomain;
|
private String webhookDomain;
|
||||||
@@ -51,14 +62,16 @@ public class StyleServiceImpl extends ServiceImpl<StyleMapper, Style> implements
|
|||||||
// 请求需要顾客id, 生成的数量,风格
|
// 请求需要顾客id, 生成的数量,风格
|
||||||
|
|
||||||
StylistPathEnum stylistPathEnum = StylistPathEnum.of(requestOutfitDTO.getStylist());
|
StylistPathEnum stylistPathEnum = StylistPathEnum.of(requestOutfitDTO.getStylist());
|
||||||
Map<String, Object> params = setRequestOutfitParams(requestOutfitDTO.getCustomerId(), requestOutfitDTO.getNum(),
|
Map<String, Object> params = setRequestOutfitParams(requestOutfitDTO, stylistPathEnum);
|
||||||
stylistPathEnum.getName(), requestOutfitDTO.getGender(), requestOutfitDTO.getSessionId());
|
|
||||||
|
SessionRecord sessionRecord = saveOrUpdateSession(requestOutfitDTO.getSessionId(), requestOutfitDTO.getCheckInId(), null, null);
|
||||||
|
|
||||||
OutfitRequest outfitRequest = new OutfitRequest();
|
OutfitRequest outfitRequest = new OutfitRequest();
|
||||||
outfitRequest.setCustomerId(requestOutfitDTO.getCustomerId());
|
outfitRequest.setCustomerId(requestOutfitDTO.getCustomerId());
|
||||||
outfitRequest.setVisitRecordId(requestOutfitDTO.getCheckInId());
|
outfitRequest.setVisitRecordId(requestOutfitDTO.getCheckInId());
|
||||||
outfitRequest.setStylist(requestOutfitDTO.getStylist());
|
outfitRequest.setStylist(requestOutfitDTO.getStylist());
|
||||||
outfitRequest.setGender(requestOutfitDTO.getGender());
|
outfitRequest.setGender(requestOutfitDTO.getGender());
|
||||||
|
outfitRequest.setSessionRecordId(sessionRecord.getId());
|
||||||
outfitRequestMapper.insert(outfitRequest);
|
outfitRequestMapper.insert(outfitRequest);
|
||||||
|
|
||||||
log.info("agent request params: {}", JSON.toJSONString(params));
|
log.info("agent request params: {}", JSON.toJSONString(params));
|
||||||
@@ -94,16 +107,22 @@ public class StyleServiceImpl extends ServiceImpl<StyleMapper, Style> implements
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, Object> setRequestOutfitParams(Long customerId, int num, String stylistPath, String gender, String sessionId) {
|
private Map<String, Object> setRequestOutfitParams(RequestOutfitDTO requestOutfitDTO, StylistPathEnum stylistPathEnum) {
|
||||||
HashMap<String, Object> params = new HashMap<>();
|
HashMap<String, Object> params = new HashMap<>();
|
||||||
params.put("user_id", customerId.toString());
|
params.put("user_id", requestOutfitDTO.getCustomerId().toString());
|
||||||
params.put("num_outfits", num);
|
params.put("num_outfits", requestOutfitDTO.getNum());
|
||||||
params.put("stylist_path", stylistPath);
|
params.put("stylist_path", stylistPathEnum.getName());
|
||||||
params.put("callback_url", webhookDomain);
|
params.put("callback_url", webhookDomain);
|
||||||
params.put("gender", gender);
|
params.put("gender", requestOutfitDTO.getGender());
|
||||||
// params.put("max_len", 5);
|
// params.put("max_len", 5);
|
||||||
params.put("session_id", sessionId);
|
params.put("session_id", requestOutfitDTO.getSessionId());
|
||||||
params.put("batch_sources", Collections.singleton("2025_q4"));
|
params.put("batch_sources", Collections.singleton("2025_q4"));
|
||||||
|
if (StringUtils.isNotBlank(requestOutfitDTO.getSummary())) {
|
||||||
|
params.put("request_summary", requestOutfitDTO.getSummary());
|
||||||
|
}
|
||||||
|
if (!CollectionUtils.isEmpty(requestOutfitDTO.getOccasion())) {
|
||||||
|
params.put("occasions", requestOutfitDTO.getOccasion());
|
||||||
|
}
|
||||||
|
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
@@ -166,6 +185,13 @@ public class StyleServiceImpl extends ServiceImpl<StyleMapper, Style> implements
|
|||||||
outfit.setItems(itemsJson);
|
outfit.setItems(itemsJson);
|
||||||
|
|
||||||
updateById(outfit);
|
updateById(outfit);
|
||||||
|
OutfitRequest outfitRequest = outfitRequestMapper.selectById(outfit.getOutfitRequestId());
|
||||||
|
if (Objects.nonNull(outfitRequest) && Objects.nonNull(outfitRequest.getSessionRecordId())) {
|
||||||
|
SessionRecord sessionRecord = sessionRecordMapper.selectById(outfitRequest.getSessionRecordId());
|
||||||
|
saveOrUpdateSession(sessionRecord.getSessionId(), sessionRecord.getVisitRecordId(),
|
||||||
|
callbackDTO.getRequest_summary(), callbackDTO.getOccasions());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -206,4 +232,111 @@ public class StyleServiceImpl extends ServiceImpl<StyleMapper, Style> implements
|
|||||||
return resultVOS;
|
return resultVOS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setFavoriteStyle(Long styleId) {
|
||||||
|
if (styleId == null) {
|
||||||
|
throw new BusinessException("Style ID is required", "风格ID不能为空", ResultEnum.PARAMETER_ERROR.getCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
Style style = this.getById(styleId);
|
||||||
|
if (style == null) {
|
||||||
|
throw new BusinessException("Style not found", "风格不存在", ResultEnum.FAIL.getCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置为收藏
|
||||||
|
style.setIsFavorite(1);
|
||||||
|
this.updateById(style);
|
||||||
|
log.info("风格ID: {} 已设置为收藏", styleId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void cancelFavoriteStyle(Long styleId) {
|
||||||
|
if (styleId == null) {
|
||||||
|
throw new BusinessException("Style ID is required", "风格ID不能为空", ResultEnum.PARAMETER_ERROR.getCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
Style style = this.getById(styleId);
|
||||||
|
if (style == null) {
|
||||||
|
throw new BusinessException("Style not found", "风格不存在", ResultEnum.FAIL.getCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取消收藏
|
||||||
|
style.setIsFavorite(0);
|
||||||
|
this.updateById(style);
|
||||||
|
log.info("风格ID: {} 已取消收藏", styleId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SessionRecord saveOrUpdateSession(String sessionId, Long visitsId, String summary, List<String> occasion) {
|
||||||
|
// 判断同一次进店记录中,当前会话id是否已存在
|
||||||
|
QueryWrapper<SessionRecord> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.lambda().eq(SessionRecord::getVisitRecordId, visitsId)
|
||||||
|
.eq(SessionRecord::getSessionId, sessionId);
|
||||||
|
SessionRecord sessionRecord = sessionRecordMapper.selectOne(queryWrapper);
|
||||||
|
if (Objects.isNull(sessionRecord)) {
|
||||||
|
sessionRecord = new SessionRecord();
|
||||||
|
sessionRecord.setVisitRecordId(visitsId);
|
||||||
|
sessionRecord.setSessionId(sessionId);
|
||||||
|
sessionRecord.setRequestSummary(summary);
|
||||||
|
sessionRecord.setOccasionsList(occasion);
|
||||||
|
sessionRecord.setCreatedTime(LocalDateTime.now());
|
||||||
|
int insert = sessionRecordMapper.insert(sessionRecord);
|
||||||
|
log.info("新增session record,影响{}条记录", insert);
|
||||||
|
} else {
|
||||||
|
sessionRecord.setRequestSummary(summary);
|
||||||
|
sessionRecord.setOccasionsList(occasion);
|
||||||
|
sessionRecord.setUpdatedTime(LocalDateTime.now());
|
||||||
|
int row = sessionRecordMapper.updateById(sessionRecord);
|
||||||
|
log.info("更新session record,影响{}条记录", row);
|
||||||
|
}
|
||||||
|
return sessionRecord;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> retrieveAndRegenerate(Long tryOnEffectsId) {
|
||||||
|
// 1. 判断id是否有效
|
||||||
|
TryOnEffect tryOnEffect = tryOnEffectMapper.selectById(tryOnEffectsId);
|
||||||
|
if (Objects.isNull(tryOnEffect)) {
|
||||||
|
log.error("无效id: {}", tryOnEffectsId);
|
||||||
|
throw new BusinessException("Error: Invalid ID.");
|
||||||
|
}
|
||||||
|
if (Objects.isNull(tryOnEffect.getStyleId())) {
|
||||||
|
log.error("Id 为:{} 的tryOnEffects记录,没有style_id", tryOnEffectsId);
|
||||||
|
throw new BusinessException("Cannot recreate outfit from past data.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 组装参数
|
||||||
|
Style style = baseMapper.selectById(tryOnEffect.getStyleId());
|
||||||
|
if (Objects.nonNull(style)) {
|
||||||
|
OutfitRequest outfitRequest = outfitRequestMapper.selectById(style.getOutfitRequestId());
|
||||||
|
if (Objects.isNull(outfitRequest)){
|
||||||
|
log.error("找不到Id 为:{} 的OutfitRequest记录", style.getOutfitRequestId());
|
||||||
|
throw new BusinessException("Cannot recreate outfit from past data.");
|
||||||
|
}
|
||||||
|
SessionRecord sessionRecord = sessionRecordMapper.selectById(outfitRequest.getSessionRecordId());
|
||||||
|
if (Objects.isNull(sessionRecord)){
|
||||||
|
log.error("找不到Id 为:{} 的SessionRecord记录", outfitRequest.getSessionRecordId());
|
||||||
|
throw new BusinessException("Cannot recreate outfit from past data.");
|
||||||
|
}
|
||||||
|
RequestOutfitDTO requestOutfitDTO = getRequestOutfitDTO(outfitRequest, sessionRecord);
|
||||||
|
|
||||||
|
return requestOutfit(requestOutfitDTO);
|
||||||
|
} else {
|
||||||
|
log.error("找不到Id 为:{} 的Style记录", tryOnEffect.getStyleId());
|
||||||
|
throw new BusinessException("Cannot recreate outfit from past data.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private static RequestOutfitDTO getRequestOutfitDTO(OutfitRequest outfitRequest, SessionRecord sessionRecord) {
|
||||||
|
RequestOutfitDTO requestOutfitDTO = new RequestOutfitDTO();
|
||||||
|
requestOutfitDTO.setCustomerId(outfitRequest.getCustomerId());
|
||||||
|
requestOutfitDTO.setCheckInId(outfitRequest.getVisitRecordId());
|
||||||
|
requestOutfitDTO.setStylist(outfitRequest.getStylist());
|
||||||
|
requestOutfitDTO.setGender(outfitRequest.getGender());
|
||||||
|
requestOutfitDTO.setNum(1);
|
||||||
|
requestOutfitDTO.setSessionId(sessionRecord.getSessionId());
|
||||||
|
requestOutfitDTO.setSummary(sessionRecord.getRequestSummary());
|
||||||
|
requestOutfitDTO.setOccasion(sessionRecord.getOccasionsList());
|
||||||
|
return requestOutfitDTO;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,13 @@
|
|||||||
package com.aida.lanecarford.service.impl;
|
package com.aida.lanecarford.service.impl;
|
||||||
|
|
||||||
import cn.hutool.json.JSONObject;
|
import cn.hutool.json.JSONObject;
|
||||||
|
import com.aida.lanecarford.common.PageResult;
|
||||||
import com.aida.lanecarford.common.constant.CommonConstants;
|
import com.aida.lanecarford.common.constant.CommonConstants;
|
||||||
import com.aida.lanecarford.config.MinioConfig;
|
import com.aida.lanecarford.config.MinioConfig;
|
||||||
import com.aida.lanecarford.config.FaceSwapConfig;
|
import com.aida.lanecarford.config.FaceSwapConfig;
|
||||||
import com.aida.lanecarford.common.response.ResultEnum;
|
import com.aida.lanecarford.common.response.ResultEnum;
|
||||||
import com.aida.lanecarford.common.constant.MinioFileConstants;
|
import com.aida.lanecarford.common.constant.MinioFileConstants;
|
||||||
|
import com.aida.lanecarford.dto.HistoricalDTO;
|
||||||
import com.aida.lanecarford.entity.*;
|
import com.aida.lanecarford.entity.*;
|
||||||
import com.aida.lanecarford.exception.BusinessException;
|
import com.aida.lanecarford.exception.BusinessException;
|
||||||
import com.aida.lanecarford.mapper.CustomerMapper;
|
import com.aida.lanecarford.mapper.CustomerMapper;
|
||||||
@@ -16,10 +18,13 @@ import com.aida.lanecarford.service.*;
|
|||||||
import com.aida.lanecarford.entity.Suggestion;
|
import com.aida.lanecarford.entity.Suggestion;
|
||||||
import com.aida.lanecarford.util.MinioUtil;
|
import com.aida.lanecarford.util.MinioUtil;
|
||||||
import com.aida.lanecarford.util.StringListConverter;
|
import com.aida.lanecarford.util.StringListConverter;
|
||||||
import com.aida.lanecarford.vo.TryOnResultVo;
|
import com.aida.lanecarford.vo.OutfitHisVO;
|
||||||
|
import com.aida.lanecarford.vo.TryOnResultVO;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.google.auth.oauth2.GoogleCredentials;
|
import com.google.auth.oauth2.GoogleCredentials;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -38,7 +43,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
*
|
*
|
||||||
* @author AI Assistant
|
* @author AI Assistant
|
||||||
* @since 2024-01-01
|
* @since 2024-01-01
|
||||||
/**
|
* /**
|
||||||
* 试穿效果服务实现类
|
* 试穿效果服务实现类
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@@ -46,12 +51,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
public class TryOnEffectServiceImpl extends ServiceImpl<TryOnEffectMapper, TryOnEffect> implements TryOnEffectService {
|
public class TryOnEffectServiceImpl extends ServiceImpl<TryOnEffectMapper, TryOnEffect> implements TryOnEffectService {
|
||||||
private static final Logger log = LoggerFactory.getLogger(TryOnEffectServiceImpl.class);
|
private static final Logger log = LoggerFactory.getLogger(TryOnEffectServiceImpl.class);
|
||||||
private final StyleService styleService;
|
private final StyleService styleService;
|
||||||
private final ModelPhotoService modelPhotoService;
|
|
||||||
private final CustomerPhotoService customerPhotoService;
|
private final CustomerPhotoService customerPhotoService;
|
||||||
private final ImageCompositionService imageCompositionService;
|
|
||||||
|
|
||||||
private final CustomerMapper customerMapper;
|
|
||||||
|
|
||||||
private final MinioUtil minioUtil;
|
private final MinioUtil minioUtil;
|
||||||
private final MinioConfig minioConfig;
|
private final MinioConfig minioConfig;
|
||||||
private final FaceSwapConfig faceSwapConfig;
|
private final FaceSwapConfig faceSwapConfig;
|
||||||
@@ -59,7 +59,7 @@ public class TryOnEffectServiceImpl extends ServiceImpl<TryOnEffectMapper, TryOn
|
|||||||
private final OutfitRequestMapper outfitRequestMapper;
|
private final OutfitRequestMapper outfitRequestMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TryOnResultVo generateTryOnEffect(TryOnEffect tryOnEffectDto) {
|
public TryOnResultVO generateTryOnEffect(TryOnEffect tryOnEffectDto) {
|
||||||
Integer isRegenerated = tryOnEffectDto.getIsRegenerated();
|
Integer isRegenerated = tryOnEffectDto.getIsRegenerated();
|
||||||
String toAIlogicalUrl = null;
|
String toAIlogicalUrl = null;
|
||||||
String prompt = null;
|
String prompt = null;
|
||||||
@@ -74,7 +74,13 @@ public class TryOnEffectServiceImpl extends ServiceImpl<TryOnEffectMapper, TryOn
|
|||||||
throw BusinessException.parameterRequired("originalTryOnId");
|
throw BusinessException.parameterRequired("originalTryOnId");
|
||||||
}
|
}
|
||||||
TryOnEffect originalTryOn = this.getById(originalTryOnId);
|
TryOnEffect originalTryOn = this.getById(originalTryOnId);
|
||||||
|
if (tryOnEffectDto.getStyleId()==null){
|
||||||
|
tryOnEffectDto.setStyleId(originalTryOn.getStyleId());
|
||||||
|
}
|
||||||
String resultImageUrl = originalTryOn.getResultImageUrl();
|
String resultImageUrl = originalTryOn.getResultImageUrl();
|
||||||
|
if (tryOnEffectDto.getStyleId()==null){
|
||||||
|
tryOnEffectDto.setStyleId(originalTryOn.getStyleId());
|
||||||
|
}
|
||||||
imageUrls.add(resultImageUrl);
|
imageUrls.add(resultImageUrl);
|
||||||
|
|
||||||
Long customerPhotoId = tryOnEffectDto.getCustomerPhotoId();
|
Long customerPhotoId = tryOnEffectDto.getCustomerPhotoId();
|
||||||
@@ -140,8 +146,8 @@ public class TryOnEffectServiceImpl extends ServiceImpl<TryOnEffectMapper, TryOn
|
|||||||
tryOnEffectDto.setGenerationStatus("completed");
|
tryOnEffectDto.setGenerationStatus("completed");
|
||||||
this.saveOrUpdate(tryOnEffectDto);
|
this.saveOrUpdate(tryOnEffectDto);
|
||||||
|
|
||||||
TryOnResultVo tryOnResultVo = new TryOnResultVo();
|
TryOnResultVO tryOnResultVo = new TryOnResultVO();
|
||||||
tryOnResultVo.setTryOnId(tryOnEffectDto.getId());
|
tryOnResultVo.setId(tryOnEffectDto.getId());
|
||||||
|
|
||||||
tryOnResultVo.setTryOnUrl(minioUtil.convertToPresignedUrl(aiRreultlogicalUrl, CommonConstants.MINIO_PATH_TIMEOUT));
|
tryOnResultVo.setTryOnUrl(minioUtil.convertToPresignedUrl(aiRreultlogicalUrl, CommonConstants.MINIO_PATH_TIMEOUT));
|
||||||
|
|
||||||
@@ -150,15 +156,15 @@ public class TryOnEffectServiceImpl extends ServiceImpl<TryOnEffectMapper, TryOn
|
|||||||
|
|
||||||
//library页面点击details后的显示
|
//library页面点击details后的显示
|
||||||
@Override
|
@Override
|
||||||
public List<TryOnResultVo> getFavoriteTryOnEffects(Long visitRecordId) {
|
public List<TryOnResultVO> getFavoriteTryOnEffects(Long visitRecordId) {
|
||||||
List<TryOnEffect> tryOnEffects = this.list(new LambdaQueryWrapper<TryOnEffect>()
|
List<TryOnEffect> tryOnEffects = this.list(new LambdaQueryWrapper<TryOnEffect>()
|
||||||
.eq(TryOnEffect::getVisitRecordId, visitRecordId)
|
.eq(TryOnEffect::getVisitRecordId, visitRecordId)
|
||||||
.eq(TryOnEffect::getIsFavorite, 1)
|
.eq(TryOnEffect::getIsFavorite, 1)
|
||||||
.orderByAsc(TryOnEffect::getCreatedTime));
|
.orderByDesc(TryOnEffect::getCreatedTime));
|
||||||
List<TryOnResultVo> tryOnResultVos = new ArrayList<>();
|
List<TryOnResultVO> tryOnResultVos = new ArrayList<>();
|
||||||
for (TryOnEffect tryOnEffect : tryOnEffects) {
|
for (TryOnEffect tryOnEffect : tryOnEffects) {
|
||||||
TryOnResultVo tryOnResultVo = new TryOnResultVo();
|
TryOnResultVO tryOnResultVo = new TryOnResultVO();
|
||||||
tryOnResultVo.setTryOnId(tryOnEffect.getId());
|
tryOnResultVo.setId(tryOnEffect.getId());
|
||||||
// 使用新的API获取预签名URL,数据库存储的是逻辑URL
|
// 使用新的API获取预签名URL,数据库存储的是逻辑URL
|
||||||
tryOnResultVo.setTryOnUrl(minioUtil.convertToPresignedUrl(
|
tryOnResultVo.setTryOnUrl(minioUtil.convertToPresignedUrl(
|
||||||
tryOnEffect.getResultImageUrl(),
|
tryOnEffect.getResultImageUrl(),
|
||||||
@@ -184,6 +190,7 @@ public class TryOnEffectServiceImpl extends ServiceImpl<TryOnEffectMapper, TryOn
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加意见建议
|
* 添加意见建议
|
||||||
|
*
|
||||||
* @param suggestion 意见建议实体
|
* @param suggestion 意见建议实体
|
||||||
* @return 是否添加成功
|
* @return 是否添加成功
|
||||||
*/
|
*/
|
||||||
@@ -255,16 +262,96 @@ public class TryOnEffectServiceImpl extends ServiceImpl<TryOnEffectMapper, TryOn
|
|||||||
return minioUtil.convertToPresignedUrl(aiRreultlogicalUrl, CommonConstants.MINIO_PATH_TIMEOUT);
|
return minioUtil.convertToPresignedUrl(aiRreultlogicalUrl, CommonConstants.MINIO_PATH_TIMEOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<TryOnResultVO> getTryOnHistoricals(HistoricalDTO historicalDTO) {
|
||||||
|
LambdaQueryWrapper<TryOnEffect> tryOnEffectLambdaQueryWrapper = new LambdaQueryWrapper<TryOnEffect>()
|
||||||
|
.eq(TryOnEffect::getCustomerId, historicalDTO.getCustomerId())
|
||||||
|
.orderByDesc(TryOnEffect::getCreatedTime);
|
||||||
|
if (historicalDTO.getVisitRecordId() != null) {
|
||||||
|
tryOnEffectLambdaQueryWrapper.eq(TryOnEffect::getVisitRecordId, historicalDTO.getVisitRecordId());
|
||||||
|
}
|
||||||
|
if (historicalDTO.getIsLibrary() != null && historicalDTO.getIsLibrary()) {
|
||||||
|
tryOnEffectLambdaQueryWrapper.eq(TryOnEffect::getIsFavorite, 1);
|
||||||
|
}
|
||||||
|
if (CommonConstants.TRYON.equals(historicalDTO.getType())) {
|
||||||
|
tryOnEffectLambdaQueryWrapper.eq(TryOnEffect::getIsRegenerated, 0);
|
||||||
|
} else if (CommonConstants.GENAI.equals(historicalDTO.getType())) {
|
||||||
|
tryOnEffectLambdaQueryWrapper.eq(TryOnEffect::getIsRegenerated, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
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 : page.getRecords()) {
|
||||||
|
TryOnResultVO tryOnResultVo = new TryOnResultVO();
|
||||||
|
tryOnResultVo.setId(tryOnEffect.getId());
|
||||||
|
tryOnResultVo.setTryOnUrl(minioUtil.convertToPresignedUrl(
|
||||||
|
tryOnEffect.getResultImageUrl(),
|
||||||
|
CommonConstants.MINIO_PATH_TIMEOUT
|
||||||
|
));
|
||||||
|
// 如果是原始效果,则获取对应的style图片
|
||||||
|
if (tryOnEffect.getIsRegenerated() == 0) {
|
||||||
|
LambdaQueryWrapper<Style> styleLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
styleLambdaQueryWrapper.eq(Style::getId, tryOnEffect.getStyleId()).select(Style::getStyleImageUrl);
|
||||||
|
Style style = styleService.getOne(styleLambdaQueryWrapper);
|
||||||
|
tryOnResultVo.setStyleUrl(minioUtil.convertToPresignedUrl(
|
||||||
|
style.getStyleImageUrl(),
|
||||||
|
CommonConstants.MINIO_PATH_TIMEOUT
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
tryOnResultVo.setIsRegenerated(tryOnEffect.getIsRegenerated());
|
||||||
|
tryOnResultVo.setIsFavorite(tryOnEffect.getIsFavorite());
|
||||||
|
tryOnResultVos.add(tryOnResultVo);
|
||||||
|
}
|
||||||
|
return new PageResult<>(tryOnResultVos, page.getTotal(), page.getCurrent(), page.getSize());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<OutfitHisVO> getOutfitHistoricals(HistoricalDTO historicalDTO) {
|
||||||
|
LambdaQueryWrapper<Style> styleLambdaQueryWrapper = new LambdaQueryWrapper<Style>()
|
||||||
|
.eq(Style::getCustomerId, historicalDTO.getCustomerId())
|
||||||
|
.eq(Style::getGenerationStatus, 1)
|
||||||
|
.orderByDesc(Style::getCreatedTime);
|
||||||
|
if (historicalDTO.getVisitRecordId() != null) {
|
||||||
|
styleLambdaQueryWrapper.eq(Style::getVisitRecordId, historicalDTO.getVisitRecordId());
|
||||||
|
}
|
||||||
|
if (historicalDTO.getIsLibrary() != null && historicalDTO.getIsLibrary()) {
|
||||||
|
styleLambdaQueryWrapper.eq(Style::getIsFavorite, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
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 : page.getRecords()) {
|
||||||
|
OutfitHisVO outfitHisVo = new OutfitHisVO();
|
||||||
|
outfitHisVo.setId(style.getId());
|
||||||
|
outfitHisVo.setUrl(minioUtil.convertToPresignedUrl(
|
||||||
|
style.getStyleImageUrl(),
|
||||||
|
CommonConstants.MINIO_PATH_TIMEOUT
|
||||||
|
));
|
||||||
|
outfitHisVo.setIsFavorite(style.getIsFavorite());
|
||||||
|
outfitHisVos.add(outfitHisVo);
|
||||||
|
}
|
||||||
|
return new PageResult<>(outfitHisVos, page.getTotal(), page.getCurrent(), page.getSize());
|
||||||
|
}
|
||||||
|
|
||||||
//目前用于customize your look页面点击finish后的显示
|
//目前用于customize your look页面点击finish后的显示
|
||||||
@Override
|
@Override
|
||||||
public List<TryOnResultVo> getTryOnEffectsByStyleId(Long styleId) {
|
public List<TryOnResultVO> getTryOnEffectsByStyleId(Long styleId) {
|
||||||
List<TryOnEffect> tryOnEffects = this.list(new LambdaQueryWrapper<TryOnEffect>()
|
List<TryOnEffect> tryOnEffects = this.list(new LambdaQueryWrapper<TryOnEffect>()
|
||||||
.eq(TryOnEffect::getStyleId, styleId)
|
.eq(TryOnEffect::getStyleId, styleId)
|
||||||
.orderByAsc(TryOnEffect::getCreatedTime));
|
.orderByDesc(TryOnEffect::getCreatedTime));
|
||||||
List<TryOnResultVo> tryOnResultVos = new ArrayList<>();
|
List<TryOnResultVO> tryOnResultVos = new ArrayList<>();
|
||||||
for (TryOnEffect tryOnEffect : tryOnEffects) {
|
for (TryOnEffect tryOnEffect : tryOnEffects) {
|
||||||
TryOnResultVo tryOnResultVo = new TryOnResultVo();
|
TryOnResultVO tryOnResultVo = new TryOnResultVO();
|
||||||
tryOnResultVo.setTryOnId(tryOnEffect.getId());
|
tryOnResultVo.setId(tryOnEffect.getId());
|
||||||
// 使用新的API获取预签名URL,数据库存储的是逻辑URL
|
// 使用新的API获取预签名URL,数据库存储的是逻辑URL
|
||||||
tryOnResultVo.setTryOnUrl(minioUtil.convertToPresignedUrl(
|
tryOnResultVo.setTryOnUrl(minioUtil.convertToPresignedUrl(
|
||||||
tryOnEffect.getResultImageUrl(),
|
tryOnEffect.getResultImageUrl(),
|
||||||
@@ -402,7 +489,7 @@ public class TryOnEffectServiceImpl extends ServiceImpl<TryOnEffectMapper, TryOn
|
|||||||
return processGoogleAPIResponse(response);
|
return processGoogleAPIResponse(response);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("调用Google API失败: {}", e.getMessage(), e);
|
log.error("调用Google API失败: {}", e.getMessage(), e);
|
||||||
throw new BusinessException("Google API call failed", "Google API调用失败", ResultEnum.ERROR.getCode());
|
throw new BusinessException("Generation timed out. Please try again later.", "生成超时,请稍后再试", ResultEnum.ERROR.getCode());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -616,6 +703,7 @@ public class TryOnEffectServiceImpl extends ServiceImpl<TryOnEffectMapper, TryOn
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 调用换脸API
|
* 调用换脸API
|
||||||
|
*
|
||||||
* @param imageUrls 图片URL列表,第一个为源图片,第二个为目标图片
|
* @param imageUrls 图片URL列表,第一个为源图片,第二个为目标图片
|
||||||
* @return 换脸后的图片URL
|
* @return 换脸后的图片URL
|
||||||
*/
|
*/
|
||||||
@@ -638,9 +726,11 @@ public class TryOnEffectServiceImpl extends ServiceImpl<TryOnEffectMapper, TryOn
|
|||||||
requestBody.put("input_face", inputFaceUrl);
|
requestBody.put("input_face", inputFaceUrl);
|
||||||
requestBody.put("threshold", 0.2);
|
requestBody.put("threshold", 0.2);
|
||||||
|
|
||||||
|
log.info("换脸API请求体: {}", requestBody.toString());
|
||||||
// 调用换脸API
|
// 调用换脸API
|
||||||
String response = sendFaceSwapRequest(faceSwapConfig.getRefaceUrl(), requestBody.toString());
|
String response = sendFaceSwapRequest(faceSwapConfig.getRefaceUrl(), requestBody.toString());
|
||||||
|
|
||||||
|
|
||||||
// 处理响应
|
// 处理响应
|
||||||
return processFaceSwapResponse(response);
|
return processFaceSwapResponse(response);
|
||||||
|
|
||||||
@@ -733,7 +823,6 @@ public class TryOnEffectServiceImpl extends ServiceImpl<TryOnEffectMapper, TryOn
|
|||||||
log.info("换脸成功,图片路径: {}", imagePath);
|
log.info("换脸成功,图片路径: {}", imagePath);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 下载图片并上传到MinIO
|
// 下载图片并上传到MinIO
|
||||||
return imagePath;
|
return imagePath;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
15
src/main/java/com/aida/lanecarford/vo/BaseVO.java
Normal file
15
src/main/java/com/aida/lanecarford/vo/BaseVO.java
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
package com.aida.lanecarford.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class BaseVO implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 10007L;
|
||||||
|
|
||||||
|
@Schema(description = "ID")
|
||||||
|
private Long id;
|
||||||
|
}
|
||||||
@@ -16,12 +16,15 @@ public class CustomerVO {
|
|||||||
/**
|
/**
|
||||||
* 顾客姓名
|
* 顾客姓名
|
||||||
*/
|
*/
|
||||||
@Schema(description = "顾客姓名", example = "张三", required = true)
|
@Schema(description = "顾客姓名", example = "张三")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 顾客邮箱
|
* 顾客邮箱
|
||||||
*/
|
*/
|
||||||
@Schema(description = "顾客邮箱地址", example = "zhangsan@example.com", required = true)
|
@Schema(description = "顾客邮箱地址", example = "zhangsan@example.com")
|
||||||
private String email;
|
private String email;
|
||||||
|
|
||||||
|
@Schema(description = "顾客vipId", example = "1")
|
||||||
|
private String vipId;
|
||||||
}
|
}
|
||||||
|
|||||||
11
src/main/java/com/aida/lanecarford/vo/OutfitHisVO.java
Normal file
11
src/main/java/com/aida/lanecarford/vo/OutfitHisVO.java
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
package com.aida.lanecarford.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class OutfitHisVO extends BaseVO {
|
||||||
|
|
||||||
|
private String url;
|
||||||
|
|
||||||
|
private Integer isFavorite;
|
||||||
|
}
|
||||||
@@ -3,9 +3,7 @@ package com.aida.lanecarford.vo;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class TryOnResultVo {
|
public class TryOnResultVO extends BaseVO {
|
||||||
|
|
||||||
private Long tryOnId;
|
|
||||||
|
|
||||||
private String tryOnUrl;
|
private String tryOnUrl;
|
||||||
|
|
||||||
@@ -71,6 +71,7 @@ CREATE TABLE `styles` (
|
|||||||
`style_image_url` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '风格图片URL',
|
`style_image_url` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '风格图片URL',
|
||||||
`python_request_id` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Python请求ID',
|
`python_request_id` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Python请求ID',
|
||||||
`generation_status` tinyint DEFAULT '0' COMMENT '生成状态(0-处理中,1-已完成,2-失败)',
|
`generation_status` tinyint DEFAULT '0' COMMENT '生成状态(0-处理中,1-已完成,2-失败)',
|
||||||
|
`is_favorite` tinyint NOT NULL DEFAULT '0' COMMENT '是否喜欢(0-否,1-是)',
|
||||||
`items` json DEFAULT NULL COMMENT '单品唯一标识',
|
`items` json DEFAULT NULL COMMENT '单品唯一标识',
|
||||||
`error_message` text COLLATE utf8mb4_unicode_ci COMMENT '错误信息',
|
`error_message` text COLLATE utf8mb4_unicode_ci COMMENT '错误信息',
|
||||||
`created_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
`created_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||||
|
|||||||
Reference in New Issue
Block a user