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

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