TASK:AiDA模块化

This commit is contained in:
shahaibo
2025-03-20 16:46:13 +08:00
parent 55ec6da74b
commit 4d7673e8df
10 changed files with 178 additions and 4 deletions

View File

@@ -109,6 +109,10 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
private LibraryModelPointMapper libraryModelPointMapper;
@Resource
private LibraryService libraryService;
@Resource
private BrandDNAMapper brandDNAMapper;
@Resource
private BrandRelLibraryMapper brandRelLibraryMapper;
@Override
public void deleteUserGroup(Long userGroupId) {
@@ -1120,15 +1124,23 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
}
@Override
public Boolean productImageInitialize(ProductImageInitializeDTO productImageInitializeDTO) {
Long brandId = productImageInitializeDTO.getBrandId();
QueryWrapper<BrandRelLibrary> brandRelLibraryQueryWrapper = new QueryWrapper<>();
brandRelLibraryQueryWrapper.lambda().eq(BrandRelLibrary::getBrandId, brandId);
List<BrandRelLibrary> brandRelLibraries = brandRelLibraryMapper.selectList(brandRelLibraryQueryWrapper);
Set<Long> collect = brandRelLibraries.stream().map(BrandRelLibrary::getLibraryId).collect(Collectors.toSet());
AuthPrincipalVo authPrincipalVo = UserContext.getUserHolder();
accountService.getById(authPrincipalVo.getId());
for (Long libraryId : productImageInitializeDTO.getLibraryIds()) {
for (Long libraryId : collect) {
Library library = libraryMapper.selectById(libraryId);
String url = library.getUrl();
String gender = library.getLevel2Type();
// 提取sketch TODO
String clothCategory = pythonService.getClothCategory(url, gender);
JSONObject attributeRecognition = pythonService.getAttributeRecognition(url, clothCategory, gender);
JSONObject data = attributeRecognition.getJSONObject("data");
@@ -1529,7 +1541,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
toProductImageResultVO.setSourceUrl(minioUtil.getPreSignedUrl(toProductImageResult1.getUrl(), 24 * 60));
}
}
moduleChooseVO.setToProduct(toProductImageResultVOS);
moduleChooseVO.setRelight(toProductImageResultVOS);
}
}
return moduleChooseVO;
@@ -1803,4 +1815,45 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
}
return libraryModelPoints.get(0);
}
@Override
public String brandLogoUpload(MultipartFile file) {
AuthPrincipalVo userHolder = UserContext.getUserHolder();
String path = userHolder.getId().toString() + "/brandLogo";
return minioUtil.upload("aida-users",path,file);
// return null;
}
@Override
public Boolean brandDNASaveOrUpdate(BrandDNADTO brandDNADTO) {
if (brandDNADTO.getId() != null) {
BrandDNA brandDNA = CopyUtil.copyObject(brandDNADTO, BrandDNA.class);
brandDNAMapper.updateById(brandDNA);
}else {
BrandDNA brandDNA = CopyUtil.copyObject(brandDNADTO, BrandDNA.class);
brandDNAMapper.insert(brandDNA);
}
return Boolean.TRUE;
}
@Override
public String brandDNAUpload(MultipartFile file, Long brandId) throws IOException {
AuthPrincipalVo userHolder = UserContext.getUserHolder();
String path = userHolder.getId().toString() + "/brandLogo";
String upload = minioUtil.upload("aida-users", path, file);
Library library = new Library();
library.setAccountId(userHolder.getId());
library.setLevel1Type("BrandDNA");
library.setName(file.getOriginalFilename());
library.setUrl(upload);
library.setMd5(MD5Utils.encryptFile(file.getInputStream()));
library.setCreateDate(new Date());
BrandRelLibrary brandRelLibrary = new BrandRelLibrary();
brandRelLibrary.setLibraryId(library.getId());
brandRelLibrary.setBrandId(brandId);
brandRelLibraryMapper.insert(brandRelLibrary);
return upload;
}
}