Compare commits
13 Commits
e665b50bb4
...
8557335cd2
| Author | SHA1 | Date | |
|---|---|---|---|
| 8557335cd2 | |||
| a16cb37c7f | |||
| dbf6c45ec8 | |||
| d38a439e3c | |||
|
|
adde1b007e | ||
|
|
9fb7f3128b | ||
|
|
e285b252df | ||
|
|
61faf40ca4 | ||
|
|
002e39a99f | ||
|
|
e08517cdcc | ||
|
|
8fb082d5bc | ||
| 73b7a25e83 | |||
| 34f666719a |
@@ -40,7 +40,7 @@ public class WebConfig implements WebMvcConfigurer {
|
||||
registry.addInterceptor(jwtInterceptor)
|
||||
.addPathPatterns("/api/**/**") // 保护这些路径
|
||||
.excludePathPatterns(Arrays.asList("/api/auth/precheckEmail", "/api/auth/registerOrLogin",
|
||||
"/api/auth/forgotPwd", "/api/style/callback", "/api/auth/parseGoogleCredential")); // 排除登录接口
|
||||
"/api/auth/forgotPwd", "/api/style/callback", "/api/auth/parseGoogleAccessToken")); // 排除登录接口
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,8 +28,8 @@ public class CustomerController {
|
||||
description = "验证顾客身份并创建入店记录,如果是新顾客则自动注册到系统中。"
|
||||
)
|
||||
@GetMapping("/checkIn")
|
||||
public ApiResponse<CustomerCheckInVO> customerCheckIn(@RequestParam String name, @RequestParam String email) {
|
||||
return ApiResponse.success(customerService.customerCheckIn(name, email));
|
||||
public ApiResponse<CustomerCheckInVO> customerCheckIn(@RequestParam String vipId) {
|
||||
return ApiResponse.success(customerService.customerCheckIn(vipId));
|
||||
}
|
||||
|
||||
@PostMapping("/getAllCustomer")
|
||||
|
||||
@@ -106,10 +106,19 @@ public class LoginController {
|
||||
* 前端直接将credential传给服务端验证
|
||||
* 服务端直接解析和验证JWT,无需与Google服务器交换
|
||||
*/
|
||||
@CrossOrigin
|
||||
@GetMapping("/parseGoogleCredential")
|
||||
// @GetMapping("/parseGoogleCredential")
|
||||
public ApiResponse<LoginVO> parseGoogleCredential(@RequestParam("credential") String credential) throws ParseException, IOException, JOSEException {
|
||||
return ApiResponse.success(loginService.parseGoogleCredential(credential));
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用OAuth 2.0方式登录
|
||||
* @param accessToken 前端通过Google回调获取的token
|
||||
* @return 用户登录信息
|
||||
*/
|
||||
@GetMapping("/parseGoogleAccessToken")
|
||||
public ApiResponse<LoginVO> parseGoogleAccessToken(@RequestParam("accessToken") String accessToken) {
|
||||
return ApiResponse.success(loginService.parseGoogleAccessToken(accessToken));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.aida.lanecarford.controller;
|
||||
|
||||
import com.aida.lanecarford.common.ApiResponse;
|
||||
import com.aida.lanecarford.entity.Suggestion;
|
||||
import com.aida.lanecarford.entity.TryOnEffect;
|
||||
import com.aida.lanecarford.service.TryOnEffectService;
|
||||
import com.aida.lanecarford.vo.TryOnResultVo;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@@ -11,6 +13,7 @@ import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -77,4 +80,39 @@ public class TryOnEffectController {
|
||||
tryOnEffectService.cancelFavoriteTryOnEffect(tryOnId);
|
||||
return ApiResponse.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 为生成结果添加意见和建议
|
||||
*/
|
||||
@Operation(summary = "为生成结果添加意见和建议", description = "为指定试穿效果添加意见和建议")
|
||||
@PostMapping("/add-comment")
|
||||
public ApiResponse<Void> addComment(@RequestBody Suggestion suggestion) {
|
||||
tryOnEffectService.addComment(suggestion);
|
||||
return ApiResponse.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 首页默认图换脸演示
|
||||
*/
|
||||
@Operation(summary = "首页点击换脸", description = "传入上传顾客照片后得到的ID")
|
||||
@PostMapping("/reFace")
|
||||
public ApiResponse<String> reFace(@Nullable @RequestParam Long customerPhotoId,
|
||||
@Nullable @RequestParam String prompt,
|
||||
@Nullable @RequestParam String tryonUrl) {
|
||||
if (customerPhotoId == null&& StringUtil.isNullOrEmpty(prompt)&& StringUtil.isNullOrEmpty(tryonUrl)){
|
||||
return ApiResponse.error("system error:Parameter null");
|
||||
}
|
||||
String result = "";
|
||||
if (StringUtil.isNullOrEmpty(prompt)){
|
||||
//换脸
|
||||
result = tryOnEffectService.reFace(customerPhotoId);
|
||||
}else {
|
||||
if (StringUtil.isNullOrEmpty(tryonUrl)){
|
||||
return ApiResponse.error("system error:Parameter null");
|
||||
}
|
||||
//根据提示词修改图像
|
||||
result = tryOnEffectService.generateUrl(prompt,tryonUrl);
|
||||
}
|
||||
return ApiResponse.success("操作成功",result);
|
||||
}
|
||||
}
|
||||
14
src/main/java/com/aida/lanecarford/dto/GoogleUser.java
Normal file
14
src/main/java/com/aida/lanecarford/dto/GoogleUser.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package com.aida.lanecarford.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class GoogleUser {
|
||||
private String sub; // 用户唯一标识
|
||||
private String email;
|
||||
private String name;
|
||||
private String picture;
|
||||
private boolean emailVerified;
|
||||
private String givenName;
|
||||
private String familyName;
|
||||
}
|
||||
@@ -20,6 +20,12 @@ import java.time.LocalDateTime;
|
||||
@TableName("customers")
|
||||
public class Customer extends BaseEntity {
|
||||
|
||||
/**
|
||||
* vip ID
|
||||
*/
|
||||
@TableField("vip_id")
|
||||
private String vipId;
|
||||
|
||||
/**
|
||||
* 顾客姓名
|
||||
*/
|
||||
|
||||
53
src/main/java/com/aida/lanecarford/entity/Suggestion.java
Normal file
53
src/main/java/com/aida/lanecarford/entity/Suggestion.java
Normal file
@@ -0,0 +1,53 @@
|
||||
package com.aida.lanecarford.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 意见建议实体类
|
||||
*
|
||||
* @author AI Assistant
|
||||
* @since 2024-01-01
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("suggestions")
|
||||
public class Suggestion extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 顾客ID
|
||||
*/
|
||||
@Schema(description = "顾客ID", example = "1", required = true)
|
||||
@TableField("customer_id")
|
||||
private Long customerId;
|
||||
|
||||
/**
|
||||
* 进店记录ID
|
||||
*/
|
||||
@Schema(description = "进店记录ID", example = "1", required = true)
|
||||
@TableField("visit_record_id")
|
||||
private Long visitRecordId;
|
||||
|
||||
/**
|
||||
* 试穿效果ID
|
||||
*/
|
||||
@Schema(description = "试穿效果ID", example = "1", required = true)
|
||||
@TableField("try_on_effects_id")
|
||||
private Long tryOnEffectsId;
|
||||
|
||||
/**
|
||||
* 意见建议内容
|
||||
*/
|
||||
@Schema(description = "意见建议内容", example = "这件衣服颜色不太合适,建议换成浅色系", required = true)
|
||||
@TableField("suggestion")
|
||||
private String suggestion;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.aida.lanecarford.mapper;
|
||||
|
||||
import com.aida.lanecarford.entity.Suggestion;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 意见建议Mapper接口
|
||||
*
|
||||
* @author AI Assistant
|
||||
* @since 2024-01-01
|
||||
*/
|
||||
@Mapper
|
||||
public interface SuggestionMapper extends BaseMapper<Suggestion> {
|
||||
|
||||
}
|
||||
@@ -12,7 +12,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
*/
|
||||
public interface CustomerService extends IService<Customer> {
|
||||
|
||||
CustomerCheckInVO customerCheckIn(String name, String email);
|
||||
CustomerCheckInVO customerCheckIn(String vipId);
|
||||
|
||||
IPage<CustomerVO> getAllCustomer(BaseRequest request);
|
||||
|
||||
|
||||
@@ -34,4 +34,6 @@ public interface LoginService extends IService<User> {
|
||||
User getUserInfo();
|
||||
|
||||
LoginVO parseGoogleCredential(String credential) throws ParseException, JOSEException, IOException;
|
||||
|
||||
LoginVO parseGoogleAccessToken(String accessToken);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.aida.lanecarford.service;
|
||||
|
||||
import com.aida.lanecarford.entity.Suggestion;
|
||||
import com.aida.lanecarford.entity.TryOnEffect;
|
||||
import com.aida.lanecarford.vo.TryOnResultVo;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
@@ -32,4 +33,15 @@ public interface TryOnEffectService extends IService<TryOnEffect> {
|
||||
void cancelFavoriteTryOnEffect(Long tryOnId);
|
||||
|
||||
List<TryOnResultVo> getTryOnEffectsByStyleId(Long styleId);
|
||||
|
||||
/**
|
||||
* 添加意见建议
|
||||
* @param suggestion 意见建议实体
|
||||
* @return 是否添加成功
|
||||
*/
|
||||
boolean addComment(Suggestion suggestion);
|
||||
|
||||
String reFace(Long customerPhotoId);
|
||||
|
||||
String generateUrl(String prompt, String tryonUrl);
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import com.aida.lanecarford.common.security.context.UserContext;
|
||||
import com.aida.lanecarford.dto.BaseRequest;
|
||||
import com.aida.lanecarford.entity.Customer;
|
||||
import com.aida.lanecarford.entity.VisitRecord;
|
||||
import com.aida.lanecarford.exception.BusinessException;
|
||||
import com.aida.lanecarford.mapper.CustomerMapper;
|
||||
import com.aida.lanecarford.service.CustomerService;
|
||||
import com.aida.lanecarford.service.VisitRecordService;
|
||||
@@ -14,6 +15,7 @@ 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 io.netty.util.internal.StringUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -30,10 +32,13 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
|
||||
private final VisitRecordService visitRecordService;
|
||||
|
||||
// 选择顾客登录并添加入店记录
|
||||
public CustomerCheckInVO customerCheckIn(String name, String email) {
|
||||
public CustomerCheckInVO customerCheckIn(String vipId) {
|
||||
if (StringUtil.isNullOrEmpty(vipId)) {
|
||||
throw new BusinessException("Please enter a VIP ID.");
|
||||
}
|
||||
// 1. 判断当前顾客信息在数据库中是否有存储
|
||||
LambdaQueryWrapper<Customer> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(Customer::getName, name).eq(Customer::getEmail, email);
|
||||
queryWrapper.eq(Customer::getVipId, vipId);
|
||||
|
||||
Customer customer = getOne(queryWrapper);
|
||||
|
||||
@@ -45,8 +50,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
|
||||
// 如果找到了,则添加到数据库
|
||||
// 3. 添加当前顾客到本系统数据库
|
||||
customer = new Customer();
|
||||
customer.setName(name);
|
||||
customer.setEmail(email);
|
||||
customer.setVipId(vipId);
|
||||
customer.setCreatedTime(LocalDateTime.now());
|
||||
|
||||
save(customer);
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.aida.lanecarford.common.enums.LanguageEnum;
|
||||
import com.aida.lanecarford.common.response.ResultEnum;
|
||||
import com.aida.lanecarford.common.security.JwtUtil;
|
||||
import com.aida.lanecarford.common.security.context.UserContext;
|
||||
import com.aida.lanecarford.dto.GoogleUser;
|
||||
import com.aida.lanecarford.dto.LoginRequest;
|
||||
import com.aida.lanecarford.entity.User;
|
||||
import com.aida.lanecarford.exception.BusinessException;
|
||||
@@ -16,9 +17,11 @@ import com.aida.lanecarford.util.RandomsUtil;
|
||||
import com.aida.lanecarford.util.SendEmailUtil;
|
||||
import com.aida.lanecarford.vo.AuthPrincipalVO;
|
||||
import com.aida.lanecarford.vo.LoginVO;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.google.api.client.googleapis.auth.oauth2.GoogleTokenResponse;
|
||||
import com.nimbusds.jose.JOSEException;
|
||||
import com.nimbusds.jose.crypto.RSASSAVerifier;
|
||||
import com.nimbusds.jose.jwk.JWK;
|
||||
@@ -30,12 +33,13 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.text.ParseException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
|
||||
import static com.aida.lanecarford.common.enums.AuthenticationOperationTypeEnum.*;
|
||||
|
||||
@@ -58,6 +62,8 @@ public class LoginServiceImpl extends ServiceImpl<UserMapper, User> implements L
|
||||
private String googleClientId;
|
||||
@Value("${google.client_secret}")
|
||||
private String googleClientSecret;
|
||||
@Value("${google.redirect_uri}")
|
||||
private String googleRedirectUri;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -316,7 +322,72 @@ public class LoginServiceImpl extends ServiceImpl<UserMapper, User> implements L
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoginVO parseGoogleAccessToken(String accessToken) {
|
||||
try {
|
||||
log.info("accessToken: {}", accessToken);
|
||||
// 使用 accessToken 获取 Google 用户信息
|
||||
// GoogleUser googleUser = getGoogleUserFromCode(accessToken);
|
||||
GoogleUser googleUser = getGoogleUserInfo(accessToken);
|
||||
log.info("googleUser: {}", JSON.toJSONString(googleUser));
|
||||
|
||||
|
||||
// 1. 根据用户邮箱查询是登录还是注册
|
||||
QueryWrapper<User> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(User::getEmail, googleUser.getEmail());
|
||||
|
||||
User user = getOne(queryWrapper);
|
||||
AuthenticationOperationTypeEnum type = Objects.isNull(user) ? REGISTER: LOGIN;
|
||||
LoginRequest loginRequest = new LoginRequest();
|
||||
loginRequest.setName(googleUser.getName());
|
||||
loginRequest.setEmail(googleUser.getEmail());
|
||||
loginRequest.setOperationType(type.name());
|
||||
|
||||
return switch (type) {
|
||||
case REGISTER -> register(loginRequest);
|
||||
case LOGIN -> login(loginRequest);
|
||||
default -> throw new BusinessException("Unknown authentication operation type.");
|
||||
};
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException("Error processing Google login: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private static final String TOKEN_URL = "https://oauth2.googleapis.com/token";
|
||||
|
||||
public GoogleUser getGoogleUserFromCode(String code) {
|
||||
// Step 1: Exchange code for access_token
|
||||
String accessToken = getAccessToken(code);
|
||||
log.info("accessToken" + accessToken);
|
||||
|
||||
// Step 2: Use access_token to get Google User info
|
||||
return getGoogleUserInfo(accessToken);
|
||||
}
|
||||
|
||||
private String getAccessToken(String code) {
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("client_id", googleClientId);
|
||||
params.put("client_secret", googleClientSecret);
|
||||
params.put("redirect_uri", googleRedirectUri);
|
||||
params.put("grant_type", "authorization_code");
|
||||
params.put("code", code);
|
||||
|
||||
// 使用 RestTemplate 发起请求以获取 access_token
|
||||
GoogleTokenResponse response = restTemplate.postForObject(TOKEN_URL, params, GoogleTokenResponse.class);
|
||||
return response.getAccessToken();
|
||||
}
|
||||
|
||||
private static final String USER_INFO_URL = "https://www.googleapis.com/oauth2/v3/userinfo";
|
||||
private GoogleUser getGoogleUserInfo(String accessToken) {
|
||||
/*System.setProperty("http.proxyHost", "127.0.0.1");
|
||||
System.setProperty("http.proxyPort", "7890");
|
||||
System.setProperty("https.proxyHost", "127.0.0.1");
|
||||
System.setProperty("https.proxyPort", "7890");*/
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
String url = USER_INFO_URL + "?access_token=" + accessToken;
|
||||
return restTemplate.getForObject(url, GoogleUser.class);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ public class StyleServiceImpl extends ServiceImpl<StyleMapper, Style> implements
|
||||
params.put("stylist_path", stylistPath);
|
||||
params.put("callback_url", webhookDomain);
|
||||
params.put("gender", gender);
|
||||
params.put("max_len", 9);
|
||||
params.put("max_len", 5);
|
||||
params.put("session_id", sessionId);
|
||||
|
||||
return params;
|
||||
|
||||
@@ -10,8 +10,10 @@ import com.aida.lanecarford.entity.*;
|
||||
import com.aida.lanecarford.exception.BusinessException;
|
||||
import com.aida.lanecarford.mapper.CustomerMapper;
|
||||
import com.aida.lanecarford.mapper.OutfitRequestMapper;
|
||||
import com.aida.lanecarford.mapper.SuggestionMapper;
|
||||
import com.aida.lanecarford.mapper.TryOnEffectMapper;
|
||||
import com.aida.lanecarford.service.*;
|
||||
import com.aida.lanecarford.entity.Suggestion;
|
||||
import com.aida.lanecarford.util.MinioUtil;
|
||||
import com.aida.lanecarford.util.StringListConverter;
|
||||
import com.aida.lanecarford.vo.TryOnResultVo;
|
||||
@@ -53,6 +55,7 @@ public class TryOnEffectServiceImpl extends ServiceImpl<TryOnEffectMapper, TryOn
|
||||
private final MinioUtil minioUtil;
|
||||
private final MinioConfig minioConfig;
|
||||
private final FaceSwapConfig faceSwapConfig;
|
||||
private final SuggestionMapper suggestionMapper;
|
||||
private final OutfitRequestMapper outfitRequestMapper;
|
||||
|
||||
@Override
|
||||
@@ -179,6 +182,79 @@ public class TryOnEffectServiceImpl extends ServiceImpl<TryOnEffectMapper, TryOn
|
||||
return tryOnResultVos;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加意见建议
|
||||
* @param suggestion 意见建议实体
|
||||
* @return 是否添加成功
|
||||
*/
|
||||
@Override
|
||||
public boolean addComment(Suggestion suggestion) {
|
||||
try {
|
||||
// 保存意见建议
|
||||
int result = suggestionMapper.insert(suggestion);
|
||||
|
||||
if (result > 0) {
|
||||
log.info("意见建议添加成功 - id: {}", suggestion.getId());
|
||||
return true;
|
||||
} else {
|
||||
log.error("意见建议添加失败");
|
||||
return false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("添加意见建议时发生异常: {}", e.getMessage(), e);
|
||||
throw new BusinessException("Add suggestion failed", "添加意见建议失败", ResultEnum.ERROR.getCode());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String reFace(Long customerPhotoId) {
|
||||
|
||||
List<String> imageUrls = new ArrayList<>();
|
||||
//默认展示图片
|
||||
imageUrls.add("lanecarford/try_on_result/default.jpg");
|
||||
|
||||
if (customerPhotoId != null) {
|
||||
//根据id查到对应customerurl
|
||||
CustomerPhoto customerPhoto = customerPhotoService.getById(customerPhotoId);
|
||||
String customerPhotoUrl = customerPhoto.getPhotoUrl();
|
||||
if (customerPhotoUrl != null && !customerPhotoUrl.trim().isEmpty()) {
|
||||
imageUrls.add(customerPhotoUrl);
|
||||
}
|
||||
}
|
||||
String aiRreultlogicalUrl = callFaceSwapAPI(imageUrls);
|
||||
String presignedUrl = minioUtil.getPresignedUrl(aiRreultlogicalUrl, CommonConstants.MINIO_PATH_TIMEOUT);
|
||||
return presignedUrl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String generateUrl(String prompt, String tryonUrl) {
|
||||
int startIndex = tryonUrl.indexOf("lanecarford");
|
||||
String aiRreultlogicalUrl = "";
|
||||
if (startIndex != -1) {
|
||||
// 支持jpg和png格式的图片识别
|
||||
int jpgEndIndex = tryonUrl.indexOf(".jpg");
|
||||
int pngEndIndex = tryonUrl.indexOf(".png");
|
||||
|
||||
int endIndex = -1;
|
||||
|
||||
if (jpgEndIndex != -1 && (pngEndIndex == -1 || jpgEndIndex < pngEndIndex)) {
|
||||
// 找到jpg格式
|
||||
endIndex = jpgEndIndex + ".jpg".length();
|
||||
} else if (pngEndIndex != -1 && (jpgEndIndex == -1 || pngEndIndex < jpgEndIndex)) {
|
||||
// 找到png格式
|
||||
endIndex = pngEndIndex + ".png".length();
|
||||
}
|
||||
|
||||
if (endIndex != -1) {
|
||||
String resultString = tryonUrl.substring(startIndex, endIndex);
|
||||
aiRreultlogicalUrl = AITryOnEffect(prompt, Arrays.asList(resultString));
|
||||
} else {
|
||||
log.error("未找到jpg或png格式的图片,无法识别图片类型");
|
||||
}
|
||||
}
|
||||
return minioUtil.convertToPresignedUrl(aiRreultlogicalUrl, CommonConstants.MINIO_PATH_TIMEOUT);
|
||||
}
|
||||
|
||||
//目前用于customize your look页面点击finish后的显示
|
||||
@Override
|
||||
public List<TryOnResultVo> getTryOnEffectsByStyleId(Long styleId) {
|
||||
|
||||
@@ -91,4 +91,5 @@ webhook:
|
||||
|
||||
google:
|
||||
client_id: 216037134725-7q8vqp0ohtmohlosltkfg7bd2v29rm5a.apps.googleusercontent.com
|
||||
client_secret: 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
|
||||
client_secret: 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
|
||||
redirect_uri: ${webhook.domain}/api/auth/google_callback
|
||||
@@ -91,4 +91,5 @@ webhook:
|
||||
|
||||
google:
|
||||
client_id: 216037134725-7q8vqp0ohtmohlosltkfg7bd2v29rm5a.apps.googleusercontent.com
|
||||
client_secret: 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
|
||||
client_secret: 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
|
||||
redirect_uri: ${webhook.domain}/api/auth/google_callback
|
||||
@@ -166,4 +166,19 @@ CREATE TABLE `outfit_request` (
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='穿搭请求表';
|
||||
|
||||
-- 9. 意见建议表
|
||||
CREATE TABLE `suggestions` (
|
||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '意见建议ID',
|
||||
`customer_id` bigint NOT NULL COMMENT '顾客ID',
|
||||
`visit_record_id` bigint NOT NULL COMMENT '进店记录ID',
|
||||
`try_on_effects_id` bigint NOT NULL COMMENT '试穿效果ID',
|
||||
`suggestion` varchar(500) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '意见建议内容',
|
||||
`created_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`updated_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`deleted` tinyint DEFAULT '0' COMMENT '逻辑删除标志(0-未删除,1-已删除)',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='意见建议表';
|
||||
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user