|
|
|
|
@@ -7,8 +7,6 @@ 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.response.PageBaseResponse;
|
|
|
|
|
import com.ai.da.common.response.Response;
|
|
|
|
|
import com.ai.da.common.response.ResultEnum;
|
|
|
|
|
import com.ai.da.common.utils.*;
|
|
|
|
|
import com.ai.da.mapper.primary.*;
|
|
|
|
|
@@ -109,6 +107,12 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|
|
|
|
private PortfolioService portfolioService;
|
|
|
|
|
@Resource
|
|
|
|
|
private LibraryModelPointMapper libraryModelPointMapper;
|
|
|
|
|
@Resource
|
|
|
|
|
private LibraryService libraryService;
|
|
|
|
|
@Resource
|
|
|
|
|
private BrandDNAMapper brandDNAMapper;
|
|
|
|
|
@Resource
|
|
|
|
|
private BrandRelLibraryMapper brandRelLibraryMapper;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void deleteUserGroup(Long userGroupId) {
|
|
|
|
|
@@ -153,7 +157,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Long insertUserGroup(Long userId, Long collectionId, String timeZone) {
|
|
|
|
|
public Long insertUserGroup(Long userId, Long collectionId, String timeZone, Long projectId) {
|
|
|
|
|
UserLikeGroup userLikeGroup = new UserLikeGroup();
|
|
|
|
|
//默认当前时间
|
|
|
|
|
userLikeGroup.setName(DateUtil.dateToStr(new Date(), DateUtil.YYYY_MM_DD_HH_MM_SS));
|
|
|
|
|
@@ -162,6 +166,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|
|
|
|
userLikeGroup.setAccountId(userId);
|
|
|
|
|
userLikeGroup.setCollectionId(collectionId);
|
|
|
|
|
userLikeGroup.setOriginal(1);
|
|
|
|
|
userLikeGroup.setProjectId(projectId);
|
|
|
|
|
userLikeGroupMapper.insertUserLikeGroup(userLikeGroup);
|
|
|
|
|
return userLikeGroup.getId();
|
|
|
|
|
}
|
|
|
|
|
@@ -309,7 +314,8 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|
|
|
|
return new ProjectChooseVO(projectDTO.getId(), workspaceVO, process);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private UserLikeGroup getByProjectId(Long projectId) {
|
|
|
|
|
@Override
|
|
|
|
|
public UserLikeGroup getByProjectId(Long projectId) {
|
|
|
|
|
QueryWrapper<UserLikeGroup> qw = new QueryWrapper<>();
|
|
|
|
|
qw.lambda().eq(UserLikeGroup::getProjectId, projectId);
|
|
|
|
|
List<UserLikeGroup> userLikeGroupList = userLikeGroupMapper.selectList(qw);
|
|
|
|
|
@@ -387,9 +393,16 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AuthPrincipalVo userHolder = UserContext.getUserHolder();
|
|
|
|
|
Long userLikeGroupId = toProductImageDTO.getUserLikeGroupId();
|
|
|
|
|
Long projectId = toProductImageDTO.getProjectId();
|
|
|
|
|
UserLikeGroup userLikeGroup = getByProjectId(projectId);
|
|
|
|
|
Long userLikeGroupId = null;
|
|
|
|
|
ToProductImageRecord toProductImageRecord = new ToProductImageRecord();
|
|
|
|
|
toProductImageRecord.setUserLikeGroupId(userLikeGroupId);
|
|
|
|
|
toProductImageRecord.setProjectId(projectId);
|
|
|
|
|
if (Objects.nonNull(userLikeGroup)) {
|
|
|
|
|
userLikeGroupId = userLikeGroup.getId();
|
|
|
|
|
toProductImageRecord.setUserLikeGroupId(userLikeGroupId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
toProductImageRecord.setCreateTime(LocalDateTime.now());
|
|
|
|
|
if (!StringUtils.isEmpty(toProductImageDTO.getPrompt())) {
|
|
|
|
|
toProductImageRecord.setPrompt(toProductImageDTO.getPrompt());
|
|
|
|
|
@@ -450,7 +463,10 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|
|
|
|
// toProductImageResult.setUrl(productImageUrl);
|
|
|
|
|
toProductImageResult.setIsLike(0);
|
|
|
|
|
toProductImageResult.setTaskId(taskId);
|
|
|
|
|
toProductImageResult.setUserLikeGroupId(userLikeGroupId);
|
|
|
|
|
toProductImageResult.setProjectId(projectId);
|
|
|
|
|
if (userLikeGroupId != null) {
|
|
|
|
|
toProductImageResult.setUserLikeGroupId(userLikeGroupId);
|
|
|
|
|
}
|
|
|
|
|
toProductImageResult.setImageStrength(toProductImageDTO.getImageStrength());
|
|
|
|
|
toProductImageResultMapper.insert(toProductImageResult);
|
|
|
|
|
// toProductImageResult.setUrl(minioUtil.getPresignedUrl(toProductImageResult.getUrl(), 24 * 60));
|
|
|
|
|
@@ -474,7 +490,10 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|
|
|
|
// toProductImageResult.setUrl(productImageUrl);
|
|
|
|
|
toProductImageResult.setIsLike(0);
|
|
|
|
|
toProductImageResult.setTaskId(taskId);
|
|
|
|
|
toProductImageResult.setUserLikeGroupId(userLikeGroupId);
|
|
|
|
|
toProductImageResult.setProjectId(projectId);
|
|
|
|
|
if (userLikeGroupId != null) {
|
|
|
|
|
toProductImageResult.setUserLikeGroupId(userLikeGroupId);
|
|
|
|
|
}
|
|
|
|
|
toProductImageResult.setImageStrength(toProductImageDTO.getImageStrength());
|
|
|
|
|
toProductImageResultMapper.insert(toProductImageResult);
|
|
|
|
|
// toProductImageResult.setUrl(minioUtil.getPresignedUrl(toProductImageResult.getUrl(), 24 * 60));
|
|
|
|
|
@@ -554,19 +573,20 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public ToProductElementVO toProductImageElementUpload(MultipartFile file, Long userLikeGroupId) {
|
|
|
|
|
public ToProductElementVO toProductImageElementUpload(MultipartFile file, Long projectId) {
|
|
|
|
|
if (null == file || StringUtils.isEmpty(file.getOriginalFilename())) {
|
|
|
|
|
throw new BusinessException("file.cannot.be.empty");
|
|
|
|
|
}
|
|
|
|
|
if (userLikeGroupId == null) {
|
|
|
|
|
throw new BusinessException("userLikeGroupId.cannot.be.empty");
|
|
|
|
|
if (projectId == null) {
|
|
|
|
|
throw new BusinessException("projectId.cannot.be.empty");
|
|
|
|
|
}
|
|
|
|
|
AuthPrincipalVo userHolder = UserContext.getUserHolder();
|
|
|
|
|
String bucketName = "aida-users";
|
|
|
|
|
String minioUrl = minioUtil.upload(bucketName, userHolder.getId() + "/toProductImageElement", file);
|
|
|
|
|
ToProductElement toProductElement = new ToProductElement();
|
|
|
|
|
toProductElement.setUrl(minioUrl);
|
|
|
|
|
toProductElement.setUserLikeGroupId(userLikeGroupId);
|
|
|
|
|
// toProductElement.setUserLikeGroupId(userLikeGroupId);
|
|
|
|
|
toProductElement.setProjectId(projectId);
|
|
|
|
|
toProductElement.setCreateTime(LocalDateTime.now());
|
|
|
|
|
toProductElementMapper.insert(toProductElement);
|
|
|
|
|
ToProductElementVO toProductElementVO = CopyUtil.copyObject(toProductElement, ToProductElementVO.class);
|
|
|
|
|
@@ -674,7 +694,12 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|
|
|
|
public List<ToProductImageResultVO> productImageLikeList(ToProductImageDTO toProductImageDTO) {
|
|
|
|
|
QueryWrapper<ToProductImageResult> qw = new QueryWrapper<>();
|
|
|
|
|
qw.lambda().eq(ToProductImageResult::getIsLike, 1);
|
|
|
|
|
qw.lambda().eq(ToProductImageResult::getUserLikeGroupId, toProductImageDTO.getUserLikeGroupId());
|
|
|
|
|
|
|
|
|
|
Long projectId = toProductImageDTO.getProjectId();
|
|
|
|
|
// UserLikeGroup userLikeGroup = getByProjectId(projectId);
|
|
|
|
|
// Long userLikeGroupId = null;
|
|
|
|
|
|
|
|
|
|
qw.lambda().eq(ToProductImageResult::getProjectId, projectId);
|
|
|
|
|
List<ToProductImageResult> toProductImageResults = toProductImageResultMapper.selectList(qw);
|
|
|
|
|
for (ToProductImageResult toProductImageResult : toProductImageResults) {
|
|
|
|
|
toProductImageResult.setUrl(minioUtil.getPreSignedUrl(toProductImageResult.getUrl(), 24 * 60));
|
|
|
|
|
@@ -758,9 +783,17 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AuthPrincipalVo userHolder = UserContext.getUserHolder();
|
|
|
|
|
Long userLikeGroupId = toProductImageDTO.getUserLikeGroupId();
|
|
|
|
|
Long projectId = toProductImageDTO.getProjectId();
|
|
|
|
|
UserLikeGroup userLikeGroup = getByProjectId(projectId);
|
|
|
|
|
Long userLikeGroupId = null;
|
|
|
|
|
|
|
|
|
|
ToProductImageRecord toProductImageRecord = new ToProductImageRecord();
|
|
|
|
|
toProductImageRecord.setUserLikeGroupId(userLikeGroupId);
|
|
|
|
|
toProductImageRecord.setProjectId(projectId);
|
|
|
|
|
if (Objects.nonNull(userLikeGroup)) {
|
|
|
|
|
userLikeGroupId = userLikeGroup.getId();
|
|
|
|
|
toProductImageRecord.setUserLikeGroupId(userLikeGroupId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
toProductImageRecord.setCreateTime(LocalDateTime.now());
|
|
|
|
|
if (!StringUtils.isEmpty(toProductImageDTO.getPrompt())) {
|
|
|
|
|
toProductImageRecord.setPrompt(toProductImageDTO.getPrompt());
|
|
|
|
|
@@ -803,7 +836,10 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|
|
|
|
// toProductImageResult.setUrl(productImageUrl);
|
|
|
|
|
toProductImageResult.setIsLike(0);
|
|
|
|
|
toProductImageResult.setTaskId(taskId);
|
|
|
|
|
toProductImageResult.setUserLikeGroupId(userLikeGroupId);
|
|
|
|
|
toProductImageResult.setProjectId(projectId);
|
|
|
|
|
if (null != userLikeGroupId) {
|
|
|
|
|
toProductImageResult.setUserLikeGroupId(userLikeGroupId);
|
|
|
|
|
}
|
|
|
|
|
if (toProductImageDTO.getBrightenValue() != null) {
|
|
|
|
|
toProductImageResult.setBrightenValue(toProductImageDTO.getBrightenValue());
|
|
|
|
|
}
|
|
|
|
|
@@ -823,7 +859,10 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|
|
|
|
// toProductImageResult.setUrl(productImageUrl);
|
|
|
|
|
toProductImageResult.setIsLike(0);
|
|
|
|
|
toProductImageResult.setTaskId(taskId);
|
|
|
|
|
toProductImageResult.setUserLikeGroupId(userLikeGroupId);
|
|
|
|
|
toProductImageResult.setProjectId(projectId);
|
|
|
|
|
if (null != userLikeGroupId) {
|
|
|
|
|
toProductImageResult.setUserLikeGroupId(userLikeGroupId);
|
|
|
|
|
}
|
|
|
|
|
if (toProductImageDTO.getBrightenValue() != null) {
|
|
|
|
|
toProductImageResult.setBrightenValue(toProductImageDTO.getBrightenValue());
|
|
|
|
|
}
|
|
|
|
|
@@ -1086,15 +1125,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
|
|
|
|
|
JSONObject sketchList = pythonService.segProduct(url);
|
|
|
|
|
String clothCategory = pythonService.getClothCategory(url, gender);
|
|
|
|
|
JSONObject attributeRecognition = pythonService.getAttributeRecognition(url, clothCategory, gender);
|
|
|
|
|
JSONObject data = attributeRecognition.getJSONObject("data");
|
|
|
|
|
@@ -1347,6 +1394,23 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|
|
|
|
list.add(collectionElementVO);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
List<CollectionSketchVO> voList = new ArrayList<>();
|
|
|
|
|
for (CollectionElement collectionElement : collectionElements) {
|
|
|
|
|
CollectionSketchVO vo = CopyUtil.copyObject(collectionElement, CollectionSketchVO.class);
|
|
|
|
|
String url = collectionElement.getUrl();
|
|
|
|
|
if (url.contains(".")) {
|
|
|
|
|
String[] split = url.split("\\.");
|
|
|
|
|
vo.setUrlWithWhiteSide(minioUtil.getPreSignedUrl(split[0] + "-show." + split[1], 24 * 60, true));
|
|
|
|
|
}else {
|
|
|
|
|
vo.setUrlWithWhiteSide(minioUtil.getPreSignedUrl(url + "-show", 24 * 60, true));
|
|
|
|
|
}
|
|
|
|
|
vo.setIsPin(collectionElement.getHasPin());
|
|
|
|
|
vo.setLevel2Type(collectionElement.getLevel2Type());
|
|
|
|
|
vo.setDesignType("Collection");
|
|
|
|
|
vo.setSketchBoardId(collectionElement.getId());
|
|
|
|
|
voList.add(vo);
|
|
|
|
|
}
|
|
|
|
|
moduleChooseVO.setBoundingBox(voList);
|
|
|
|
|
moduleChooseVO.setSketchBoard(list);
|
|
|
|
|
}else if (module.equals(Module.design.name())) {
|
|
|
|
|
DesignModuleChooseVO vo = new DesignModuleChooseVO();
|
|
|
|
|
@@ -1426,12 +1490,13 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|
|
|
|
vo.setPortfolioDTO(portfolioDTO);
|
|
|
|
|
moduleChooseVO.setCanvas(vo);
|
|
|
|
|
}else if (module.equals(Module.toProduct.name())) {
|
|
|
|
|
UserLikeGroup userLikeGroup = getByProjectId(projectDTO.getId());
|
|
|
|
|
Long userLikeGroupId = userLikeGroup.getId();
|
|
|
|
|
Long projectId = projectDTO.getId();
|
|
|
|
|
// UserLikeGroup userLikeGroup = getByProjectId(projectDTO.getId());
|
|
|
|
|
// Long userLikeGroupId = userLikeGroup.getId();
|
|
|
|
|
|
|
|
|
|
QueryWrapper<ToProductImageResult> qw = new QueryWrapper<>();
|
|
|
|
|
qw.lambda().eq(ToProductImageResult::getIsLike, 1);
|
|
|
|
|
qw.lambda().eq(ToProductImageResult::getUserLikeGroupId, userLikeGroupId);
|
|
|
|
|
qw.lambda().eq(ToProductImageResult::getProjectId, projectId);
|
|
|
|
|
qw.lambda().eq(ToProductImageResult::getResultType, "ToProductImage");
|
|
|
|
|
List<ToProductImageResult> toProductImageResults = toProductImageResultMapper.selectList(qw);
|
|
|
|
|
for (ToProductImageResult toProductImageResult : toProductImageResults) {
|
|
|
|
|
@@ -1452,12 +1517,13 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|
|
|
|
}
|
|
|
|
|
moduleChooseVO.setToProduct(toProductImageResultVOS);
|
|
|
|
|
}else if (module.equals(Module.relight.name())) {
|
|
|
|
|
UserLikeGroup userLikeGroup = getByProjectId(projectDTO.getId());
|
|
|
|
|
Long userLikeGroupId = userLikeGroup.getId();
|
|
|
|
|
Long projectId = projectDTO.getId();
|
|
|
|
|
// UserLikeGroup userLikeGroup = getByProjectId(projectDTO.getId());
|
|
|
|
|
// Long userLikeGroupId = userLikeGroup.getId();
|
|
|
|
|
|
|
|
|
|
QueryWrapper<ToProductImageResult> qw = new QueryWrapper<>();
|
|
|
|
|
qw.lambda().eq(ToProductImageResult::getIsLike, 1);
|
|
|
|
|
qw.lambda().eq(ToProductImageResult::getUserLikeGroupId, userLikeGroupId);
|
|
|
|
|
qw.lambda().eq(ToProductImageResult::getProjectId, projectId);
|
|
|
|
|
qw.lambda().eq(ToProductImageResult::getResultType, "Relight");
|
|
|
|
|
List<ToProductImageResult> toProductImageResults = toProductImageResultMapper.selectList(qw);
|
|
|
|
|
for (ToProductImageResult toProductImageResult : toProductImageResults) {
|
|
|
|
|
@@ -1476,7 +1542,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|
|
|
|
toProductImageResultVO.setSourceUrl(minioUtil.getPreSignedUrl(toProductImageResult1.getUrl(), 24 * 60));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
moduleChooseVO.setToProduct(toProductImageResultVOS);
|
|
|
|
|
moduleChooseVO.setRelight(toProductImageResultVOS);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return moduleChooseVO;
|
|
|
|
|
@@ -1485,8 +1551,10 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional
|
|
|
|
|
public ModuleChooseVO saveModuleContent(ModuleSaveDTO moduleSaveDTO) {
|
|
|
|
|
ModuleChooseVO result = new ModuleChooseVO();
|
|
|
|
|
Long accountId = UserContext.getUserHolder().getId();
|
|
|
|
|
Long projectId = moduleSaveDTO.getProjectId();
|
|
|
|
|
boolean boundingBox = false;
|
|
|
|
|
if (Objects.nonNull(moduleSaveDTO.getMoodBoard())) {
|
|
|
|
|
MoodBoardModuleSaveDTO moodBoard = moduleSaveDTO.getMoodBoard();
|
|
|
|
|
if (moodBoard.getMoodTemplateId() != null) {
|
|
|
|
|
@@ -1562,7 +1630,9 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
collectionElementMapper.deleteBatchIds(old);
|
|
|
|
|
if (!CollectionUtils.isEmpty(old)) {
|
|
|
|
|
collectionElementMapper.deleteBatchIds(old);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!CollectionUtils.isEmpty(moduleSaveDTO.getPrintBoard())){
|
|
|
|
|
@@ -1617,7 +1687,9 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
collectionElementMapper.deleteBatchIds(old);
|
|
|
|
|
if (!CollectionUtils.isEmpty(old)) {
|
|
|
|
|
collectionElementMapper.deleteBatchIds(old);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!CollectionUtils.isEmpty(moduleSaveDTO.getColorBoard())){
|
|
|
|
|
List<CollectionColorDTO> colorBoards = moduleSaveDTO.getColorBoard();
|
|
|
|
|
@@ -1634,7 +1706,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|
|
|
|
CollectionElement collectionElement = new CollectionElement();
|
|
|
|
|
collectionElement.setAccountId(accountId);
|
|
|
|
|
collectionElement.setProjectId(projectId);
|
|
|
|
|
collectionElement.setLevel2Type(CollectionLevel1TypeEnum.COLOR_BOARD.getRealName());
|
|
|
|
|
collectionElement.setLevel1Type(CollectionLevel1TypeEnum.COLOR_BOARD.getRealName());
|
|
|
|
|
collectionElement.setName(board.getName());
|
|
|
|
|
collectionElement.setHasPin((byte) 0);
|
|
|
|
|
collectionElement.setColorRgb(board.getRgbValue());
|
|
|
|
|
@@ -1644,9 +1716,12 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|
|
|
|
collectionElementMapper.insert(collectionElement);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
collectionElementMapper.deleteBatchIds(old);
|
|
|
|
|
if (!CollectionUtils.isEmpty(old)) {
|
|
|
|
|
collectionElementMapper.deleteBatchIds(old);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!CollectionUtils.isEmpty(moduleSaveDTO.getSketchBoard())){
|
|
|
|
|
boundingBox = true;
|
|
|
|
|
QueryWrapper<CollectionElement> qw = new QueryWrapper<>();
|
|
|
|
|
qw.lambda().eq(CollectionElement::getProjectId, projectId);
|
|
|
|
|
qw.lambda().eq(CollectionElement::getLevel1Type, CollectionLevel1TypeEnum.SKETCH_BOARD.getRealName());
|
|
|
|
|
@@ -1659,7 +1734,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|
|
|
|
CollectionElement collectionElement = new CollectionElement();
|
|
|
|
|
collectionElement.setAccountId(accountId);
|
|
|
|
|
collectionElement.setProjectId(projectId);
|
|
|
|
|
collectionElement.setLevel1Type(CollectionLevel1TypeEnum.PRINT_BOARD.getRealName());
|
|
|
|
|
collectionElement.setLevel1Type(CollectionLevel1TypeEnum.SKETCH_BOARD.getRealName());
|
|
|
|
|
collectionElement.setLevel2Type(board.getLevel2Type());
|
|
|
|
|
collectionElement.setName(library.getName());
|
|
|
|
|
collectionElement.setUrl(library.getUrl());
|
|
|
|
|
@@ -1672,7 +1747,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|
|
|
|
CollectionElement collectionElement = new CollectionElement();
|
|
|
|
|
collectionElement.setAccountId(accountId);
|
|
|
|
|
collectionElement.setProjectId(projectId);
|
|
|
|
|
collectionElement.setLevel1Type(CollectionLevel1TypeEnum.PRINT_BOARD.getRealName());
|
|
|
|
|
collectionElement.setLevel1Type(CollectionLevel1TypeEnum.SKETCH_BOARD.getRealName());
|
|
|
|
|
collectionElement.setLevel2Type(board.getLevel2Type());
|
|
|
|
|
// collectionElement.setName(generateDetail.get());
|
|
|
|
|
collectionElement.setUrl(generateDetail.getUrl());
|
|
|
|
|
@@ -1698,13 +1773,56 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
collectionElementMapper.deleteBatchIds(old);
|
|
|
|
|
if (!CollectionUtils.isEmpty(old)) {
|
|
|
|
|
collectionElementMapper.deleteBatchIds(old);
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
if (boundingBox) {
|
|
|
|
|
QueryWrapper<CollectionElement> qw = new QueryWrapper<>();
|
|
|
|
|
qw.lambda().eq(CollectionElement::getLevel1Type, CollectionLevel1TypeEnum.SKETCH_BOARD.getRealName());
|
|
|
|
|
qw.lambda().eq(CollectionElement::getProjectId, projectId);
|
|
|
|
|
List<CollectionElement> collectionElements = collectionElementMapper.selectList(qw);
|
|
|
|
|
|
|
|
|
|
List<CollectionSketchVO> voList = new ArrayList<>();
|
|
|
|
|
for (CollectionElement collectionElement : collectionElements) {
|
|
|
|
|
CollectionSketchVO vo = CopyUtil.copyObject(collectionElement, CollectionSketchVO.class);
|
|
|
|
|
String url = collectionElement.getUrl();
|
|
|
|
|
libraryService.processSketchBoards(url, collectionElement.getLevel2Type());
|
|
|
|
|
if (url.contains(".")) {
|
|
|
|
|
String[] split = url.split("\\.");
|
|
|
|
|
vo.setUrlWithWhiteSide(minioUtil.getPreSignedUrl(split[0] + "-show." + split[1], 24 * 60, true));
|
|
|
|
|
}else {
|
|
|
|
|
vo.setUrlWithWhiteSide(minioUtil.getPreSignedUrl(url + "-show", 24 * 60, true));
|
|
|
|
|
}
|
|
|
|
|
vo.setIsPin(collectionElement.getHasPin());
|
|
|
|
|
vo.setLevel2Type(collectionElement.getLevel2Type());
|
|
|
|
|
vo.setDesignType("Collection");
|
|
|
|
|
vo.setSketchBoardId(collectionElement.getId());
|
|
|
|
|
voList.add(vo);
|
|
|
|
|
}
|
|
|
|
|
result.setBoundingBox(voList);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public LibraryModelPoint getMannequinDetail(MannequinDTO mannequinDTO) {
|
|
|
|
|
public QueryLibraryPageVO getMannequinDetail(MannequinDTO mannequinDTO) {
|
|
|
|
|
QueryLibraryPageVO vo = new QueryLibraryPageVO();
|
|
|
|
|
if (mannequinDTO.getType().equals("System")) {
|
|
|
|
|
SysFile sysFile = sysFileMapper.selectById(mannequinDTO.getId());
|
|
|
|
|
vo.setDesignType("System");
|
|
|
|
|
vo.setLevel1Type(sysFile.getLevel1Type());
|
|
|
|
|
vo.setLevel2Type(sysFile.getLevel2Type());
|
|
|
|
|
vo.setName(sysFile.getName());
|
|
|
|
|
vo.setMinIOPath(minioUtil.getPreSignedUrl(sysFile.getUrl(), 24 * 60));
|
|
|
|
|
}else {
|
|
|
|
|
Library library = libraryMapper.selectById(mannequinDTO.getId());
|
|
|
|
|
vo.setDesignType("Library");
|
|
|
|
|
vo.setLevel1Type(library.getLevel1Type());
|
|
|
|
|
vo.setLevel2Type(library.getLevel2Type());
|
|
|
|
|
vo.setName(library.getName());
|
|
|
|
|
vo.setMinIOPath(minioUtil.getPreSignedUrl(library.getUrl(), 24 * 60));
|
|
|
|
|
}
|
|
|
|
|
QueryWrapper<LibraryModelPoint> qw = new QueryWrapper<>();
|
|
|
|
|
qw.lambda().eq(LibraryModelPoint::getRelationId, mannequinDTO.getId());
|
|
|
|
|
qw.lambda().eq(LibraryModelPoint::getModelType, mannequinDTO.getType());
|
|
|
|
|
@@ -1712,6 +1830,51 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|
|
|
|
if (CollectionUtil.isEmpty(libraryModelPoints)) {
|
|
|
|
|
throw new BusinessException("No model doting information available.");
|
|
|
|
|
}
|
|
|
|
|
return libraryModelPoints.get(0);
|
|
|
|
|
LibraryModelPoint libraryModelPoint = libraryModelPoints.get(0);
|
|
|
|
|
LibraryModelPointVO libraryModelPointVO = CopyUtil.copyObject(libraryModelPoint, LibraryModelPointVO.class);
|
|
|
|
|
libraryModelPointVO.setTemplateId(libraryModelPoint.getId());
|
|
|
|
|
vo.setLibraryModelPoint(libraryModelPointVO);
|
|
|
|
|
return vo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|