TASK:AiDA模块化
This commit is contained in:
@@ -28,6 +28,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -257,4 +258,22 @@ public class SavedCollectionController {
|
||||
public Response<Boolean> productImageUpload(@Valid @RequestBody ProductImageInitializeDTO productImageInitializeDTO) {
|
||||
return Response.success(userLikeGroupService.productImageInitialize(productImageInitializeDTO));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "brandDNASaveOrUpdate")
|
||||
@PostMapping("/brandDNASaveOrUpdate")
|
||||
public Response<Boolean> brandDNASaveOrUpdate(@Valid @RequestBody BrandDNADTO brandDNADTO) {
|
||||
return Response.success(userLikeGroupService.brandDNASaveOrUpdate(brandDNADTO));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "brandLogoUpload")
|
||||
@PostMapping("/brandLogoUpload")
|
||||
public Response<String> brandDNASaveOrUpdate(@RequestParam("file") MultipartFile file) {
|
||||
return Response.success(userLikeGroupService.brandLogoUpload(file));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "brandDNAUpload")
|
||||
@PostMapping("/brandDNAUpload")
|
||||
public Response<String> brandDNAUpload(@RequestParam("file") MultipartFile file, @RequestParam("brandId") Long brandId) throws IOException {
|
||||
return Response.success(userLikeGroupService.brandDNAUpload(file, brandId));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.ai.da.mapper.primary;
|
||||
|
||||
import com.ai.da.common.config.mybatis.plus.CommonMapper;
|
||||
import com.ai.da.mapper.primary.entity.BrandDNA;
|
||||
|
||||
public interface BrandDNAMapper extends CommonMapper<BrandDNA> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.ai.da.mapper.primary;
|
||||
|
||||
import com.ai.da.common.config.mybatis.plus.CommonMapper;
|
||||
import com.ai.da.mapper.primary.entity.BrandRelLibrary;
|
||||
|
||||
public interface BrandRelLibraryMapper extends CommonMapper<BrandRelLibrary> {
|
||||
}
|
||||
37
src/main/java/com/ai/da/mapper/primary/entity/BrandDNA.java
Normal file
37
src/main/java/com/ai/da/mapper/primary/entity/BrandDNA.java
Normal file
@@ -0,0 +1,37 @@
|
||||
package com.ai.da.mapper.primary.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName("brand")
|
||||
public class BrandDNA implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
private Long accountId;
|
||||
|
||||
private String brandName;
|
||||
|
||||
private String brandSlogan;
|
||||
|
||||
private String brandLogo;
|
||||
|
||||
private LocalDateTime createTime;
|
||||
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.ai.da.mapper.primary.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName("brand_rel_library")
|
||||
public class BrandRelLibrary implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
private Long brandId;
|
||||
private Long libraryId;
|
||||
|
||||
}
|
||||
@@ -98,7 +98,7 @@ public class DesignItemDetail implements Serializable {
|
||||
/**
|
||||
* 局部design 只会有一张图
|
||||
*/
|
||||
private String partialDesign;
|
||||
// private String partialDesign;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
|
||||
13
src/main/java/com/ai/da/model/dto/BrandDNADTO.java
Normal file
13
src/main/java/com/ai/da/model/dto/BrandDNADTO.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package com.ai.da.model.dto;
|
||||
|
||||
import com.ai.da.mapper.primary.entity.BrandDNA;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
//@AllArgsConstructor
|
||||
//@NoArgsConstructor
|
||||
public class BrandDNADTO extends BrandDNA {
|
||||
|
||||
}
|
||||
@@ -7,4 +7,6 @@ import java.util.List;
|
||||
@Data
|
||||
public class ProductImageInitializeDTO {
|
||||
private List<Long> libraryIds;
|
||||
|
||||
private Long brandId;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -81,4 +82,10 @@ public interface UserLikeGroupService extends IService<UserLikeGroup> {
|
||||
ModuleChooseVO saveModuleContent(ModuleSaveDTO moduleSaveDTO);
|
||||
|
||||
LibraryModelPoint getMannequinDetail(MannequinDTO mannequinDTO);
|
||||
|
||||
String brandLogoUpload(MultipartFile file);
|
||||
|
||||
Boolean brandDNASaveOrUpdate(BrandDNADTO brandDNADTO);
|
||||
|
||||
String brandDNAUpload(MultipartFile file, Long brandId) throws IOException;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user