BUGFIX:aida;
This commit is contained in:
@@ -103,17 +103,27 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
|
||||
@Resource
|
||||
private SysFileMapper sysFileMapper;
|
||||
|
||||
@Resource
|
||||
private LibraryMapper libraryMapper;
|
||||
|
||||
@Resource
|
||||
private StyleMapper styleMapper;
|
||||
|
||||
@Resource
|
||||
private WorkspaceRelStyleMapper workspaceRelStyleMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean publish(MultipartFile file, String data) {
|
||||
AuthPrincipalVo authPrincipalVo = UserContext.getUserHolder();
|
||||
PortfolioDTO portfolioDTO = JSONObject.parseObject(data, PortfolioDTO.class);
|
||||
QueryWrapper<Portfolio> existSameNameQw = new QueryWrapper<>();
|
||||
existSameNameQw.lambda().eq(Portfolio::getPortfolioName, portfolioDTO.getPortfolioName());
|
||||
existSameNameQw.lambda().eq(Portfolio::getAccountId, authPrincipalVo.getId());
|
||||
List<Portfolio> portfoliosSameName = portfolioMapper.selectList(existSameNameQw);
|
||||
if (!CollectionUtils.isEmpty(portfoliosSameName)) {
|
||||
throw new BusinessException("The title of the published work has been used.");
|
||||
}
|
||||
AuthPrincipalVo authPrincipalVo = UserContext.getUserHolder();
|
||||
if (file != null && file.getOriginalFilename() != null) {
|
||||
String upload = minioUtil.upload("aida-canvas", String.valueOf(authPrincipalVo.getId()), file);
|
||||
Canvas canvas = new Canvas();
|
||||
@@ -128,11 +138,17 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
|
||||
userLikeGroupNew.setId(null);
|
||||
userLikeGroupNew.setAccountId(-1L);
|
||||
Long collectionIdOld = userLikeGroup.getCollectionId();
|
||||
QueryWrapper<Design> designQueryWrapper = new QueryWrapper<>();
|
||||
designQueryWrapper.lambda().eq(Design::getCollectionId, collectionIdOld);
|
||||
Design designOld = designMapper.selectOne(designQueryWrapper);
|
||||
Collection collectionOld = collectionMapper.selectById(collectionIdOld);
|
||||
List<CollectionElement> collectionElementListOld = collectionElementService.getByCollectionId(collectionIdOld);
|
||||
collectionOld.setId(null);
|
||||
collectionMapper.insert(collectionOld);
|
||||
Long collectionIdNew = collectionOld.getId();
|
||||
designOld.setCollectionId(collectionIdNew);
|
||||
designOld.setId(null);
|
||||
designMapper.insert(designOld);
|
||||
userLikeGroupNew.setCollectionId(collectionIdNew);
|
||||
userLikeGroupMapper.insert(userLikeGroupNew);
|
||||
for (CollectionElement element : collectionElementListOld) {
|
||||
@@ -179,17 +195,12 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
|
||||
}
|
||||
|
||||
List<UserLike> userLikeList = userLikeService.getUserLikeList(portfolioDTO.getUserLikeGroupId());
|
||||
// Long coverIdNew = null;
|
||||
// Boolean flag = false;
|
||||
for (UserLike userLike : userLikeList) {
|
||||
Long designOutfitIdOld = userLike.getDesignOutfitId();
|
||||
TDesignPythonOutfit designPythonOutfit = designPythonOutfitMapper.selectById(designOutfitIdOld);
|
||||
designPythonOutfit.setDesignId(-1L);
|
||||
designPythonOutfit.setDesignItemId(-1L);
|
||||
designPythonOutfit.setCollectionId(collectionIdNew);
|
||||
// if (designPythonOutfit.getId().equals(coverIdOld)) {
|
||||
// flag = true;
|
||||
// }
|
||||
designPythonOutfit.setId(null);
|
||||
Long designItemIdOld = userLike.getDesignItemId();
|
||||
DesignItem designItemOld = designItemMapper.selectById(designItemIdOld);
|
||||
@@ -208,21 +219,12 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
|
||||
qw.lambda().eq(TDesignPythonOutfitDetail::getDesignPythonOutfitId, designOutfitIdOld);
|
||||
List<TDesignPythonOutfitDetail> tDesignPythonOutfitDetails = designPythonOutfitDetailMapper.selectList(qw);
|
||||
for (TDesignPythonOutfitDetail tDesignPythonOutfitDetail : tDesignPythonOutfitDetails) {
|
||||
// Long designPythonOutfitDetailIdOld = tDesignPythonOutfitDetail.getId();
|
||||
tDesignPythonOutfitDetail.setId(null);
|
||||
tDesignPythonOutfitDetail.setDesignId(-1L);
|
||||
tDesignPythonOutfitDetail.setDesignPythonOutfitId(designOutfitIdNew);
|
||||
designPythonOutfitDetailMapper.insert(tDesignPythonOutfitDetail);
|
||||
}
|
||||
|
||||
// if (flag) {
|
||||
// coverIdNew = designOutfitIdNew;
|
||||
// portfolio.setCoverId(coverIdNew);
|
||||
// portfolioMapper.updateById(portfolio);
|
||||
// flag = false;
|
||||
// }
|
||||
// designPythonOutfitMapper.updateById(designPythonOutfit);
|
||||
|
||||
userLike.setDesignItemId(designItemIdNew);
|
||||
userLike.setId(null);
|
||||
userLike.setDesignId(-1L);
|
||||
@@ -283,15 +285,16 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public PortfolioVO update(PortfolioDTO portfolioDTO) {
|
||||
AuthPrincipalVo authPrincipalVo = UserContext.getUserHolder();
|
||||
QueryWrapper<Portfolio> existSameNameQw = new QueryWrapper<>();
|
||||
existSameNameQw.lambda().ne(Portfolio::getId, portfolioDTO.getId());
|
||||
existSameNameQw.lambda().eq(Portfolio::getPortfolioName, portfolioDTO.getPortfolioName());
|
||||
existSameNameQw.lambda().eq(Portfolio::getAccountId, authPrincipalVo.getId());
|
||||
List<Portfolio> portfoliosSameName = portfolioMapper.selectList(existSameNameQw);
|
||||
if (!CollectionUtils.isEmpty(portfoliosSameName)) {
|
||||
throw new BusinessException("The title of the published work has been used.");
|
||||
}
|
||||
if (portfolioDTO.getPortfolioType().equals("History")) {
|
||||
AuthPrincipalVo authPrincipalVo = UserContext.getUserHolder();
|
||||
UserLikeGroup userLikeGroup = userLikeGroupMapper.selectById(portfolioDTO.getUserLikeGroupId());
|
||||
UserLikeGroup userLikeGroupNew = userLikeGroup.setId(null);
|
||||
userLikeGroupNew.setAccountId(-1L);
|
||||
@@ -499,9 +502,9 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
|
||||
if (Objects.isNull(userLikeGroup)) {
|
||||
throw new BusinessException("");
|
||||
}
|
||||
// UserLikeGroup userLikeGroup = userLikeGroupMapper.selectById();
|
||||
UserLikeGroup userLikeGroupNew = CopyUtil.copyObject(userLikeGroup, UserLikeGroup.class);
|
||||
userLikeGroupNew.setId(null);
|
||||
userLikeGroupNew.setCreateDate(new Date());
|
||||
if (portfolio.getOriginal() == 1) {
|
||||
if (Objects.equals(portfolio.getAccountId(), authPrincipalVo.getId())) {
|
||||
userLikeGroupNew.setOriginal(0);
|
||||
@@ -546,7 +549,7 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
|
||||
designMapper.insert(design);
|
||||
|
||||
userLikeGroupNew.setCollectionId(collectionIdNew);
|
||||
userLikeGroupNew.setCreateDate(new Date());
|
||||
userLikeGroupNew.setUpdateDate(new Date());
|
||||
userLikeGroupMapper.insert(userLikeGroupNew);
|
||||
// List<TCollectionElementRelation> collectionElementRelationListNew = new ArrayList<>();
|
||||
for (CollectionElement element : collectionElementListOld) {
|
||||
@@ -638,34 +641,101 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
|
||||
if (!CollectionUtils.isEmpty(workspaces)) {
|
||||
Workspace workspace1 = workspaces.get(0);
|
||||
workspace1.setIsLastIndex(0);
|
||||
|
||||
workspaceMapper.updateById(workspace1);
|
||||
Workspace workspaceNew = new Workspace();
|
||||
workspaceNew.setWorkSpaceName("workspace of " + portfolio.getPortfolioName());
|
||||
workspaceNew.setAccountId(accountId);
|
||||
workspaceNew.setIsDeleted(0);
|
||||
workspaceNew.setIsLastIndex(1);
|
||||
workspaceNew.setCreateTime(LocalDateTime.now());
|
||||
workspaceNew.setSystemDesignerPercentage((design1.getSystemScale().multiply(BigDecimal.valueOf(100)).intValue()));
|
||||
if (design1.getSingleOverall().equals("overall")) {
|
||||
workspaceNew.setPosition("Overall");
|
||||
}else {
|
||||
workspaceNew.setPosition(design1.getSwitchCategory());
|
||||
}
|
||||
workspaceMapper.insert(workspaceNew);
|
||||
if (design1.getModelType().equals("System")) {
|
||||
SysFile sysFile = sysFileMapper.selectById(design1.getTemplateId());
|
||||
if (sysFile.getLevel2Type().equals("Female")) {
|
||||
workspaceNew.setSex("Female");
|
||||
workspaceNew.setMannequinFemaleId(design1.getTemplateId());
|
||||
workspaceNew.setMannequinFemaleType("System");
|
||||
QueryWrapper<SysFile> getAnotherOneQw = new QueryWrapper<>();
|
||||
getAnotherOneQw.lambda().eq(SysFile::getLevel1Type, "Models")
|
||||
getAnotherOneQw.lambda().eq(SysFile::getLevel1Type, "Models");
|
||||
getAnotherOneQw.lambda().eq(SysFile::getLevel2Type, "Male");
|
||||
if (!StringUtils.isEmpty(sysFile.getLevel3Type())) {
|
||||
getAnotherOneQw.lambda().eq(SysFile::getLevel3Type, sysFile.getLevel3Type());
|
||||
QueryWrapper<Style> styleQueryWrapper = new QueryWrapper<>();
|
||||
styleQueryWrapper.lambda().eq(Style::getName, sysFile.getLevel3Type());
|
||||
Style style = styleMapper.selectOne(styleQueryWrapper);
|
||||
WorkspaceRelStyle workspaceRelStyle = new WorkspaceRelStyle();
|
||||
workspaceRelStyle.setStyleId(style.getId());
|
||||
workspaceRelStyle.setWorkspaceId(workspaceNew.getId());
|
||||
workspaceRelStyleMapper.insert(workspaceRelStyle);
|
||||
}
|
||||
List<SysFile> anotherList = sysFileMapper.selectList(getAnotherOneQw);
|
||||
if (!CollectionUtils.isEmpty(anotherList)) {
|
||||
SysFile anotherOne = anotherList.get(0);
|
||||
workspaceNew.setMannequinMaleId(anotherOne.getId());
|
||||
workspaceNew.setMannequinMaleType("System");
|
||||
}
|
||||
}else {
|
||||
workspaceNew.setSex("Male");
|
||||
workspaceNew.setMannequinMaleId(design1.getTemplateId());
|
||||
workspaceNew.setMannequinMaleType("System");
|
||||
QueryWrapper<SysFile> getAnotherOneQw = new QueryWrapper<>();
|
||||
getAnotherOneQw.lambda().eq(SysFile::getLevel1Type, "Models");
|
||||
getAnotherOneQw.lambda().eq(SysFile::getLevel2Type, "Female");
|
||||
if (!StringUtils.isEmpty(sysFile.getLevel3Type())) {
|
||||
getAnotherOneQw.lambda().eq(SysFile::getLevel3Type, sysFile.getLevel3Type());
|
||||
QueryWrapper<Style> styleQueryWrapper = new QueryWrapper<>();
|
||||
styleQueryWrapper.lambda().eq(Style::getName, sysFile.getLevel3Type());
|
||||
Style style = styleMapper.selectOne(styleQueryWrapper);
|
||||
WorkspaceRelStyle workspaceRelStyle = new WorkspaceRelStyle();
|
||||
workspaceRelStyle.setStyleId(style.getId());
|
||||
workspaceRelStyle.setWorkspaceId(workspaceNew.getId());
|
||||
workspaceRelStyleMapper.insert(workspaceRelStyle);
|
||||
}
|
||||
List<SysFile> anotherList = sysFileMapper.selectList(getAnotherOneQw);
|
||||
if (!CollectionUtils.isEmpty(anotherList)) {
|
||||
SysFile anotherOne = anotherList.get(0);
|
||||
workspaceNew.setMannequinFemaleId(anotherOne.getId());
|
||||
workspaceNew.setMannequinFemaleType("System");
|
||||
}
|
||||
}
|
||||
if (design1.getSingleOverall().equals("overall")) {
|
||||
workspaceNew.setPosition("Overall");
|
||||
}else {
|
||||
Library library = libraryMapper.selectById(design1.getTemplateId());
|
||||
if (library.getLevel2Type().equals("Female")) {
|
||||
workspaceNew.setSex("Female");
|
||||
workspaceNew.setMannequinFemaleId(design1.getTemplateId());
|
||||
workspaceNew.setMannequinFemaleType("Library");
|
||||
QueryWrapper<SysFile> getAnotherOneQw = new QueryWrapper<>();
|
||||
getAnotherOneQw.lambda().eq(SysFile::getLevel1Type, "Models");
|
||||
getAnotherOneQw.lambda().eq(SysFile::getLevel2Type, "Male");
|
||||
List<SysFile> anotherList = sysFileMapper.selectList(getAnotherOneQw);
|
||||
if (!CollectionUtils.isEmpty(anotherList)) {
|
||||
SysFile anotherOne = anotherList.get(0);
|
||||
workspaceNew.setMannequinMaleId(anotherOne.getId());
|
||||
workspaceNew.setMannequinMaleType("System");
|
||||
}
|
||||
}else {
|
||||
workspaceNew.setPosition(design1.getSwitchCategory());
|
||||
workspaceNew.setSex("Male");
|
||||
workspaceNew.setMannequinMaleId(design1.getTemplateId());
|
||||
workspaceNew.setMannequinMaleType("Library");
|
||||
QueryWrapper<SysFile> getAnotherOneQw = new QueryWrapper<>();
|
||||
getAnotherOneQw.lambda().eq(SysFile::getLevel1Type, "Models");
|
||||
getAnotherOneQw.lambda().eq(SysFile::getLevel2Type, "Female");
|
||||
List<SysFile> anotherList = sysFileMapper.selectList(getAnotherOneQw);
|
||||
if (!CollectionUtils.isEmpty(anotherList)) {
|
||||
SysFile anotherOne = anotherList.get(0);
|
||||
workspaceNew.setMannequinFemaleId(anotherOne.getId());
|
||||
workspaceNew.setMannequinFemaleType("System");
|
||||
}
|
||||
}
|
||||
}
|
||||
workspaceNew.setSex();
|
||||
workspaceMapper.updateById(workspaceNew);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
return userLikeGroupService.choose(userLikeGroupNew.getId());
|
||||
|
||||
@@ -355,6 +355,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
if (Objects.isNull(toProductImageResult)) {
|
||||
throw new BusinessException("The source image does not exist.");
|
||||
}
|
||||
magicToolResultVO.setResultType(toProductImageResult.getResultType());
|
||||
if (toProductImageResult.getElementType().equals("ProductElement")) {
|
||||
ToProductElement toProductElement = toProductElementMapper.selectById(toProductImageResult.getElementId());
|
||||
magicToolResultVO.setSourceUrl(minioUtil.getPresignedUrl(toProductElement.getUrl(), 24 * 60));
|
||||
@@ -479,7 +480,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
i ++;
|
||||
ToProductImageResult toProductImageResult1 = toProductImageResultMapper.selectById(toProductImageVO.getElementId());
|
||||
// 走模型
|
||||
pythonService.relight(toProductImageResult1.getUrl(), taskId, s);
|
||||
pythonService.relight(toProductImageResult1.getUrl(), taskId, s, toProductImageDTO.getDirection());
|
||||
ToProductImageResult toProductImageResult = new ToProductImageResult();
|
||||
toProductImageResult.setElementId(toProductImageResult1.getId());
|
||||
toProductImageResult.setElementType("ToProductImage");
|
||||
@@ -496,7 +497,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
String taskId = UUID.randomUUID() + "-" + i + "-" + userHolder.getId();
|
||||
ToProductElement toProductElement = toProductElementMapper.selectById(toProductImageVO.getElementId());
|
||||
// 走模型
|
||||
pythonService.relight(toProductElement.getUrl(), taskId, s);
|
||||
pythonService.relight(toProductElement.getUrl(), taskId, s, toProductImageDTO.getDirection());
|
||||
ToProductImageResult toProductImageResult = new ToProductImageResult();
|
||||
toProductImageResult.setElementId(toProductElement.getId());
|
||||
toProductImageResult.setElementType("ProductElement");
|
||||
@@ -533,6 +534,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
if (Objects.isNull(toProductImageResult)) {
|
||||
throw new BusinessException("The source image does not exist.");
|
||||
}
|
||||
magicToolResultVO.setResultType(toProductImageResult.getResultType());
|
||||
if (toProductImageResult.getElementType().equals("ProductElement")) {
|
||||
ToProductElement toProductElement = toProductElementMapper.selectById(toProductImageResult.getElementId());
|
||||
magicToolResultVO.setSourceUrl(minioUtil.getPresignedUrl(toProductElement.getUrl(), 24 * 60));
|
||||
|
||||
Reference in New Issue
Block a user