TASK:模块化;

This commit is contained in:
shahaibo
2025-03-28 09:37:42 +08:00
parent a8f868e215
commit 3398992bcd
4 changed files with 17 additions and 7 deletions

View File

@@ -28,7 +28,9 @@ public enum LibraryLevel1TypeEnum {
* 模特 * 模特
*/ */
MODELS("Models"), MODELS("Models"),
DESIGN_ELEMENTS("DesignElements"); DESIGN_ELEMENTS("DesignElements"),
BRAND_DNA("BrandDNA");
private String realName; private String realName;

View File

@@ -28,7 +28,7 @@ public final class LocalCacheUtils {
private static LoadingCache<String, String> loadTokenCache() { private static LoadingCache<String, String> loadTokenCache() {
LoadingCache<String, String> tokenCache = CacheBuilder.newBuilder() LoadingCache<String, String> tokenCache = CacheBuilder.newBuilder()
.concurrencyLevel(10) .concurrencyLevel(10)
.expireAfterWrite(24 * 100, TimeUnit.HOURS) .expireAfterWrite(24 * 7 - 1, TimeUnit.HOURS)
.initialCapacity(100) .initialCapacity(100)
.maximumSize(10000) .maximumSize(10000)
.recordStats() .recordStats()

View File

@@ -29,4 +29,6 @@ public class QueryLibraryPageDTO extends PageQueryBaseVo {
@ApiModelProperty("交集还是并集1交集2并集") @ApiModelProperty("交集还是并集1交集2并集")
private Integer intersection; private Integer intersection;
private Long brandId;
} }

View File

@@ -7,6 +7,7 @@ import com.ai.da.common.context.UserContext;
import com.ai.da.common.enums.CollectionLevel1TypeEnum; import com.ai.da.common.enums.CollectionLevel1TypeEnum;
import com.ai.da.common.enums.CreditsEventsEnum; import com.ai.da.common.enums.CreditsEventsEnum;
import com.ai.da.common.enums.DesignTypeEnum; import com.ai.da.common.enums.DesignTypeEnum;
import com.ai.da.common.enums.LibraryLevel1TypeEnum;
import com.ai.da.common.response.PageBaseResponse; import com.ai.da.common.response.PageBaseResponse;
import com.ai.da.common.response.ResultEnum; import com.ai.da.common.response.ResultEnum;
import com.ai.da.common.utils.*; import com.ai.da.common.utils.*;
@@ -1167,7 +1168,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
String gender = library.getLevel2Type(); String gender = library.getLevel2Type();
// 提取sketch // 提取sketch
JSONObject sketchList = pythonService.segProduct(url); JSONObject jsonObject = pythonService.segProduct(url);
String clothCategory = pythonService.getClothCategory(url, gender); String clothCategory = pythonService.getClothCategory(url, gender);
JSONObject attributeRecognition = pythonService.getAttributeRecognition(url, clothCategory, gender); JSONObject attributeRecognition = pythonService.getAttributeRecognition(url, clothCategory, gender);
JSONObject data = attributeRecognition.getJSONObject("data"); JSONObject data = attributeRecognition.getJSONObject("data");
@@ -1893,9 +1894,13 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
public Boolean brandDNASaveOrUpdate(BrandDNADTO brandDNADTO) { public Boolean brandDNASaveOrUpdate(BrandDNADTO brandDNADTO) {
if (brandDNADTO.getId() != null) { if (brandDNADTO.getId() != null) {
BrandDNA brandDNA = CopyUtil.copyObject(brandDNADTO, BrandDNA.class); BrandDNA brandDNA = CopyUtil.copyObject(brandDNADTO, BrandDNA.class);
brandDNA.setUpdateTime(LocalDateTime.now());
brandDNAMapper.updateById(brandDNA); brandDNAMapper.updateById(brandDNA);
}else { }else {
BrandDNA brandDNA = CopyUtil.copyObject(brandDNADTO, BrandDNA.class); BrandDNA brandDNA = CopyUtil.copyObject(brandDNADTO, BrandDNA.class);
AuthPrincipalVo userHolder = UserContext.getUserHolder();
brandDNA.setAccountId(userHolder.getId());
brandDNA.setCreateTime(LocalDateTime.now());
brandDNAMapper.insert(brandDNA); brandDNAMapper.insert(brandDNA);
} }
return Boolean.TRUE; return Boolean.TRUE;
@@ -1908,7 +1913,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
String upload = minioUtil.upload("aida-users", path, file); String upload = minioUtil.upload("aida-users", path, file);
Library library = new Library(); Library library = new Library();
library.setAccountId(userHolder.getId()); library.setAccountId(userHolder.getId());
library.setLevel1Type("BrandDNA"); library.setLevel1Type(LibraryLevel1TypeEnum.BRAND_DNA.getRealName());
library.setName(file.getOriginalFilename()); library.setName(file.getOriginalFilename());
library.setUrl(upload); library.setUrl(upload);
library.setMd5(MD5Utils.encryptFile(file.getInputStream())); library.setMd5(MD5Utils.encryptFile(file.getInputStream()));
@@ -1943,9 +1948,10 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
public BrandDNAGenerateVO brandDNAGenerate(String prompt) { public BrandDNAGenerateVO brandDNAGenerate(String prompt) {
BrandDNAGenerateVO vo = new BrandDNAGenerateVO(); BrandDNAGenerateVO vo = new BrandDNAGenerateVO();
JSONObject jsonObject = pythonService.brandDNAGenerate(prompt); JSONObject jsonObject = pythonService.brandDNAGenerate(prompt);
vo.setBrandSlogan(jsonObject.getString("brand_slogan")); JSONObject data = jsonObject.getJSONObject("data");
vo.setBrandName(jsonObject.getString("brand_name")); vo.setBrandSlogan(data.getString("brand_slogan"));
vo.setBrandLogo(jsonObject.getString("brand_logo")); vo.setBrandName(data.getString("brand_name"));
vo.setBrandLogo(data.getString("brand_logo"));
vo.setMinioUrl(minioUtil.getPreSignedUrl(vo.getBrandLogo(), 24 * 60)); vo.setMinioUrl(minioUtil.getPreSignedUrl(vo.getBrandLogo(), 24 * 60));
return vo; return vo;
} }