TASK:模块化;
This commit is contained in:
@@ -1385,9 +1385,9 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
|
||||
static {
|
||||
HikariConfig config = new HikariConfig();
|
||||
config.setJdbcUrl("jdbc:mysql://code-create.com.hk:3306/db1nfvsgmjp3b8");
|
||||
config.setUsername("uafqtz4gsvfrw");
|
||||
config.setPassword("aida123456.");
|
||||
config.setJdbcUrl("jdbc:mysql://18.167.251.121:33008/aida");
|
||||
config.setUsername("aida_con");
|
||||
config.setPassword("123456");
|
||||
// config.setJdbcUrl("jdbc:mysql://localhost:3306/code-create-local?serverTimezone=UTC");
|
||||
// config.setUsername("root");
|
||||
// config.setPassword("root");
|
||||
|
||||
@@ -308,8 +308,6 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
Long collectionId;
|
||||
if (null == collectionIdParam) {
|
||||
collectionId = collectionService.saveCollection(userInfo.getId(), designDTO.getTimeZone(), designDTO.getMoodTemplateId(), designDTO.getMoodboardPosition());
|
||||
// String moodboardPosition = designDTO.getMoodboardPosition();
|
||||
// parseMoodboardPosition(moodboardPosition, collectionId);
|
||||
}else {
|
||||
collectionId = collectionIdParam;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.ai.da.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.ai.da.common.config.exception.BusinessException;
|
||||
import com.ai.da.common.constant.CommonConstant;
|
||||
import com.ai.da.common.context.UserContext;
|
||||
@@ -25,6 +26,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.google.common.base.Function;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
@@ -135,7 +137,9 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
|
||||
AuthPrincipalVo authPrincipalVo = UserContext.getUserHolder();
|
||||
PortfolioDTO portfolioDTO = JSONObject.parseObject(data, PortfolioDTO.class);
|
||||
QueryWrapper<Portfolio> existSameNameQw = new QueryWrapper<>();
|
||||
existSameNameQw.lambda().ne(Portfolio::getId, portfolioDTO.getId());
|
||||
if (null != portfolioDTO.getId()) {
|
||||
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);
|
||||
@@ -148,6 +152,7 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
|
||||
}
|
||||
if (file != null && file.getOriginalFilename() != null) {
|
||||
Long portfolioId;
|
||||
// 上传画布到minio
|
||||
String upload = minioUtil.upload("aida-canvas", String.valueOf(authPrincipalVo.getId()), file);
|
||||
Canvas canvas = new Canvas();
|
||||
canvas.setUrl(upload);
|
||||
@@ -155,19 +160,18 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
|
||||
canvas.setAccountId(authPrincipalVo.getId());
|
||||
canvasMapper.insert(canvas);
|
||||
|
||||
// 创建portfolio
|
||||
Portfolio portfolio = new Portfolio();
|
||||
QueryWrapper<Portfolio> portfolioQueryWrapper = new QueryWrapper<>();
|
||||
portfolioQueryWrapper.lambda().eq(Portfolio::getProjectId, portfolioDTO.getProjectId());
|
||||
List<Portfolio> portfolioList = portfolioMapper.selectList(portfolioQueryWrapper);
|
||||
if (!CollectionUtils.isEmpty(portfolioList)) {
|
||||
portfolio = portfolioList.get(0);
|
||||
if (null != portfolioDTO.getId()) {
|
||||
portfolio = portfolioMapper.selectById(portfolioDTO.getId());
|
||||
}
|
||||
// 关联的项目ID
|
||||
Long projectId = portfolioDTO.getProjectId();
|
||||
// 复制project表
|
||||
Project project = projectMapper.selectById(projectId);
|
||||
if (project.getOriginal() == 0) {
|
||||
portfolio.setOriginal(0);
|
||||
portfolio.setOriginalAccountId(project.getOriginalAccountId());
|
||||
// TODO
|
||||
portfolio.setOriginalPortfolioId(project.getOriginalPortfolioId());
|
||||
} else {
|
||||
portfolio.setOriginal(1);
|
||||
@@ -178,132 +182,79 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
|
||||
portfolio.setUpdateDate(LocalDateTime.now());
|
||||
portfolio.setStatus(1);
|
||||
portfolio.setIsDeleted(0);
|
||||
portfolio.setUserLikeGroupSourceId(portfolioDTO.getUserLikeGroupId());
|
||||
portfolio.setCanvasId(canvas.getId());
|
||||
portfolio.setPortfolioDes(portfolioDTO.getPortfolioDes());
|
||||
|
||||
Long workspaceId = workspaceService.getByProjectId(project.getId());
|
||||
Workspace workspace = workspaceMapper.selectById(workspaceId);
|
||||
|
||||
project.setId(null);
|
||||
project.setAccountId(-1L);
|
||||
project.setCreateTime(LocalDateTime.now());
|
||||
projectMapper.insert(project);
|
||||
Long projectIdCopy = project.getId();
|
||||
|
||||
workspace.setProjectId(projectIdCopy);
|
||||
workspace.setAccountId(-1L);
|
||||
workspaceMapper.insert(workspace);
|
||||
|
||||
if (portfolioDTO.getOpenSource() == 1) {
|
||||
// 副本存储对象
|
||||
ProjectSnapshot projectSnapshot = new ProjectSnapshot();
|
||||
// 根据项目ID获取项目设置
|
||||
Long workspaceId = workspaceService.getByProjectId(projectId);
|
||||
Workspace workspace = workspaceMapper.selectById(workspaceId);
|
||||
|
||||
project.setId(null);
|
||||
projectSnapshot.setProject(project);
|
||||
workspace.setId(null);
|
||||
projectSnapshot.setWorkspace(workspace);
|
||||
|
||||
portfolio.setPortfolioType("History");
|
||||
portfolio.setOpenSource(1);
|
||||
|
||||
List<CollectionElement> collectionElementListOld = collectionElementService.getByProjectId(projectId);
|
||||
for (CollectionElement element : collectionElementListOld) {
|
||||
element.setProjectId(projectIdCopy);
|
||||
element.setId(null);
|
||||
collectionElementMapper.insert(element);
|
||||
}
|
||||
projectSnapshot.setCollectionElementList(collectionElementListOld);
|
||||
|
||||
UserLikeGroup userLikeGroup = userLikeService.getUserLikeGroupByProjectId(projectId);
|
||||
if (Objects.nonNull(userLikeGroup)) {
|
||||
UserLikeGroup userLikeGroupNew = CopyUtil.copyObject(userLikeGroup, UserLikeGroup.class);
|
||||
userLikeGroupNew.setId(null);
|
||||
userLikeGroupNew.setAccountId(-1L);
|
||||
userLikeGroupNew.setProjectId(projectIdCopy);
|
||||
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);
|
||||
projectSnapshot.setUserLikeGroup(userLikeGroup);
|
||||
|
||||
collectionOld.setId(null);
|
||||
collectionMapper.insert(collectionOld);
|
||||
Long collectionIdNew = collectionOld.getId();
|
||||
|
||||
portfolio.setCollectionId(collectionIdNew);
|
||||
|
||||
for (CollectionElement element : collectionElementListOld) {
|
||||
element.setCollectionId(collectionIdNew);
|
||||
collectionElementMapper.updateById(element);
|
||||
TCollectionElementRelation collectionElementRelationNew = new TCollectionElementRelation();
|
||||
collectionElementRelationNew.setCollectionId(collectionIdNew);
|
||||
collectionElementRelationNew.setElementId(element.getId());
|
||||
collectionElementRelationNew.setCreateDate(new Date());
|
||||
collectionElementRelationMapper.insert(collectionElementRelationNew);
|
||||
}
|
||||
|
||||
designOld.setCollectionId(collectionIdNew);
|
||||
designOld.setId(null);
|
||||
designMapper.insert(designOld);
|
||||
userLikeGroupNew.setCollectionId(collectionIdNew);
|
||||
userLikeGroupMapper.insert(userLikeGroupNew);
|
||||
List<UserLike> userLikeList = userLikeService.getUserLikeList(portfolioDTO.getUserLikeGroupId());
|
||||
List<UserLikeSnapshot> list = new ArrayList<>();
|
||||
for (UserLike userLike : userLikeList) {
|
||||
UserLikeSnapshot userLikeSnapshot = CopyUtil.copyObject(userLike, UserLikeSnapshot.class);
|
||||
|
||||
Long designOutfitIdOld = userLike.getDesignOutfitId();
|
||||
TDesignPythonOutfit designPythonOutfit = designPythonOutfitMapper.selectById(designOutfitIdOld);
|
||||
designPythonOutfit.setDesignId(-1L);
|
||||
designPythonOutfit.setDesignItemId(-1L);
|
||||
designPythonOutfit.setCollectionId(collectionIdNew);
|
||||
designPythonOutfit.setId(null);
|
||||
|
||||
Long designItemIdOld = userLike.getDesignItemId();
|
||||
DesignItem designItemOld = designItemMapper.selectById(designItemIdOld);
|
||||
designItemOld.setId(null);
|
||||
designItemOld.setAccountId(-1L);
|
||||
designItemOld.setDesignId(-1L);
|
||||
designItemOld.setCollectionId(collectionIdNew);
|
||||
designItemMapper.insert(designItemOld);
|
||||
Long designItemIdNew = designItemOld.getId();
|
||||
|
||||
designPythonOutfit.setDesignItemId(designItemIdNew);
|
||||
designPythonOutfitMapper.insert(designPythonOutfit);
|
||||
Long designOutfitIdNew = designPythonOutfit.getId();
|
||||
userLike.setDesignOutfitId(designOutfitIdNew);
|
||||
userLikeSnapshot.setDesignItem(designItemOld);
|
||||
userLikeSnapshot.setDesignPythonOutfit(designPythonOutfit);
|
||||
|
||||
QueryWrapper<TDesignPythonOutfitDetail> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(TDesignPythonOutfitDetail::getDesignPythonOutfitId, designOutfitIdOld);
|
||||
List<TDesignPythonOutfitDetail> tDesignPythonOutfitDetails = designPythonOutfitDetailMapper.selectList(qw);
|
||||
for (TDesignPythonOutfitDetail tDesignPythonOutfitDetail : tDesignPythonOutfitDetails) {
|
||||
tDesignPythonOutfitDetail.setId(null);
|
||||
tDesignPythonOutfitDetail.setDesignId(-1L);
|
||||
tDesignPythonOutfitDetail.setDesignPythonOutfitId(designOutfitIdNew);
|
||||
designPythonOutfitDetailMapper.insert(tDesignPythonOutfitDetail);
|
||||
}
|
||||
List<TDesignPythonOutfitDetail> tDesignPythonOutfitDetailList = designPythonOutfitDetailMapper.selectList(qw);
|
||||
userLikeSnapshot.setTDesignPythonOutfitDetailList(tDesignPythonOutfitDetailList);
|
||||
|
||||
|
||||
userLike.setDesignItemId(designItemIdNew);
|
||||
userLike.setId(null);
|
||||
userLike.setDesignId(-1L);
|
||||
userLike.setUserLikeGroupId(userLikeGroupNew.getId());
|
||||
userLikeMapper.insert(userLike);
|
||||
QueryWrapper<DesignItemDetail> designItemDetailQueryWrapper = new QueryWrapper<>();
|
||||
designItemDetailQueryWrapper.lambda().eq(DesignItemDetail::getDesignItemId, designItemIdOld);
|
||||
List<DesignItemDetail> designItemDetailListOld = designItemDetailMapper.selectList(designItemDetailQueryWrapper);
|
||||
List<DesignItemDetailSnapshot> designItemDetailSnapshotList = new ArrayList<>();
|
||||
for (DesignItemDetail designItemDetailOld : designItemDetailListOld) {
|
||||
DesignItemDetailSnapshot designItemDetailSnapshot = CopyUtil.copyObject(designItemDetailOld, DesignItemDetailSnapshot.class);
|
||||
Long designItemDetailIdOld = designItemDetailOld.getId();
|
||||
designItemDetailOld.setId(null);
|
||||
designItemDetailOld.setAccountId(-1L);
|
||||
designItemDetailOld.setDesignId(-1L);
|
||||
designItemDetailOld.setDesignItemId(designItemIdNew);
|
||||
designItemDetailMapper.insert(designItemDetailOld);
|
||||
Long designItemDetailIdNew = designItemDetailOld.getId();
|
||||
|
||||
QueryWrapper<DesignItemDetailPrint> designItemDetailPrintQueryWrapper = new QueryWrapper<>();
|
||||
designItemDetailPrintQueryWrapper.lambda().eq(DesignItemDetailPrint::getDesignItemDetailId, designItemDetailIdOld);
|
||||
List<DesignItemDetailPrint> designItemDetailPrints = designItemDetailPrintMapper.selectList(designItemDetailPrintQueryWrapper);
|
||||
for (DesignItemDetailPrint designItemDetailPrint : designItemDetailPrints) {
|
||||
designItemDetailPrint.setId(null);
|
||||
designItemDetailPrint.setDesignItemDetailId(designItemDetailIdNew);
|
||||
designItemDetailPrintMapper.insert(designItemDetailPrint);
|
||||
}
|
||||
List<DesignItemDetailPrint> designItemDetailPrintList = designItemDetailPrintMapper.selectList(designItemDetailPrintQueryWrapper);
|
||||
designItemDetailSnapshot.setDesignItemDetailPrintList(designItemDetailPrintList);
|
||||
designItemDetailSnapshotList.add(designItemDetailSnapshot);
|
||||
}
|
||||
userLikeSnapshot.setDesignItemDetailList(designItemDetailSnapshotList);
|
||||
list.add(userLikeSnapshot);
|
||||
}
|
||||
projectSnapshot.setUserLikeList(list);
|
||||
}
|
||||
String snapshotJson = JSONObject.toJSONString(projectSnapshot);
|
||||
portfolio.setSnapshot(snapshotJson);
|
||||
} else {
|
||||
|
||||
portfolio.setPortfolioType("Canvas");
|
||||
|
||||
portfolio.setOpenSource(0);
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(portfolioList)) {
|
||||
if (null != portfolioDTO.getId()) {
|
||||
portfolioMapper.updateById(portfolio);
|
||||
} else {
|
||||
portfolioMapper.insert(portfolio);
|
||||
@@ -636,14 +587,15 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
|
||||
AuthPrincipalVo authPrincipalVo = UserContext.getUserHolder();
|
||||
Portfolio portfolio = portfolioMapper.selectById(portfolioDTO.getId());
|
||||
|
||||
Long projectId = portfolio.getProjectId();
|
||||
String snapshot = portfolio.getSnapshot();
|
||||
ProjectSnapshot projectSnapshot = JSONObject.parseObject(snapshot, ProjectSnapshot.class);
|
||||
|
||||
// QueryWrapper<UserLikeGroup> userLikeGroupQueryWrapper = new QueryWrapper<>();
|
||||
// userLikeGroupQueryWrapper.lambda().eq(UserLikeGroup::getCollectionId, portfolio.getCollectionId());
|
||||
UserLikeGroup userLikeGroup = userLikeService.getUserLikeGroupByProjectId(projectId);
|
||||
Project project = projectSnapshot.getProject();
|
||||
|
||||
Long projectId = project.getId();
|
||||
|
||||
UserLikeGroup userLikeGroup = projectSnapshot.getUserLikeGroup();
|
||||
|
||||
Project project = projectMapper.selectById(projectId);
|
||||
// Long projectIdOld = project.getId();
|
||||
project.setCreateTime(LocalDateTime.now());
|
||||
project.setId(null);
|
||||
project.setAccountId(authPrincipalVo.getId());
|
||||
@@ -667,7 +619,7 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
|
||||
|
||||
Long projectIdNew = project.getId();
|
||||
|
||||
List<CollectionElement> collectionElementListOld = collectionElementService.getByProjectId(projectId);
|
||||
List<CollectionElement> collectionElementListOld = projectSnapshot.getCollectionElementList();
|
||||
for (CollectionElement element : collectionElementListOld) {
|
||||
element.setProjectId(projectIdNew);
|
||||
element.setId(null);
|
||||
@@ -677,7 +629,7 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
|
||||
if (Objects.nonNull(userLikeGroup)) {
|
||||
Long portfolioUserLikeGroupId = userLikeGroup.getId();
|
||||
|
||||
UserLikeGroup userLikeGroupNew = CopyUtil.copyObject(userLikeGroup, UserLikeGroup.class);
|
||||
UserLikeGroup userLikeGroupNew = projectSnapshot.getUserLikeGroup();
|
||||
userLikeGroupNew.setId(null);
|
||||
userLikeGroupNew.setCreateDate(new Date());
|
||||
userLikeGroupNew.setProjectId(projectIdNew);
|
||||
@@ -695,236 +647,78 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
|
||||
userLikeGroupNew.setOriginalPortfolioId(portfolio.getId());
|
||||
}
|
||||
userLikeGroupNew.setAccountId(authPrincipalVo.getId());
|
||||
Long collectionIdOld = userLikeGroup.getCollectionId();
|
||||
Collection collectionOld = collectionMapper.selectById(collectionIdOld);
|
||||
// List<CollectionElement> collectionElementListOld = collectionElementService.getByCollectionId(collectionIdOld);
|
||||
collectionOld.setId(null);
|
||||
collectionMapper.insert(collectionOld);
|
||||
Long collectionIdNew = collectionOld.getId();
|
||||
|
||||
Long workspaceServiceByProjectId = workspaceService.getByProjectId(projectId);
|
||||
Workspace workspace = workspaceMapper.selectById(workspaceServiceByProjectId);
|
||||
Design design = new Design();
|
||||
design.setCollectionId(collectionIdNew);
|
||||
design.setAccountId(authPrincipalVo.getId());
|
||||
if (workspace.getSex().equals(Sex.FEMALE.getValue())) {
|
||||
design.setTemplateId(workspace.getMannequinFemaleId());
|
||||
design.setModelType(workspace.getMannequinFemaleType());
|
||||
} else {
|
||||
design.setTemplateId(workspace.getMannequinMaleId());
|
||||
design.setModelType(workspace.getMannequinMaleType());
|
||||
}
|
||||
design.setSystemScale(BigDecimal.valueOf(workspace.getSystemDesignerPercentage()));
|
||||
if (workspace.getPosition().equals(Position.OVERALL.getValue())) {
|
||||
design.setSingleOverall("overall");
|
||||
design.setSwitchCategory("");
|
||||
} else {
|
||||
design.setSingleOverall("single");
|
||||
design.setSwitchCategory(workspace.getPosition());
|
||||
}
|
||||
design.setCreateDate(new Date());
|
||||
designMapper.insert(design);
|
||||
|
||||
userLikeGroupNew.setCollectionId(collectionIdNew);
|
||||
userLikeGroupNew.setCollectionId(null);
|
||||
userLikeGroupNew.setUpdateDate(new Date());
|
||||
userLikeGroupMapper.insert(userLikeGroupNew);
|
||||
// List<TCollectionElementRelation> collectionElementRelationListNew = new ArrayList<>();
|
||||
for (CollectionElement element : collectionElementListOld) {
|
||||
element.setCollectionId(collectionIdNew);
|
||||
collectionElementMapper.updateById(element);
|
||||
TCollectionElementRelation collectionElementRelationNew = new TCollectionElementRelation();
|
||||
collectionElementRelationNew.setCollectionId(collectionIdNew);
|
||||
collectionElementRelationNew.setElementId(element.getId());
|
||||
collectionElementRelationNew.setCreateDate(new Date());
|
||||
collectionElementRelationMapper.insert(collectionElementRelationNew);
|
||||
}
|
||||
|
||||
List<UserLikeSnapshot> userLikeList = projectSnapshot.getUserLikeList();
|
||||
if (CollectionUtil.isNotEmpty(userLikeList)) {
|
||||
for (UserLikeSnapshot userLike : userLikeList) {
|
||||
Long designOutfitIdOld = userLike.getDesignOutfitId();
|
||||
TDesignPythonOutfit designPythonOutfit = userLike.getDesignPythonOutfit();
|
||||
designPythonOutfit.setDesignId(null);
|
||||
designPythonOutfit.setDesignItemId(-1L);
|
||||
designPythonOutfit.setCollectionId(null);
|
||||
|
||||
List<UserLike> userLikeList = userLikeService.getUserLikeList(portfolioUserLikeGroupId);
|
||||
designPythonOutfit.setId(null);
|
||||
designPythonOutfitMapper.insert(designPythonOutfit);
|
||||
Long designOutfitIdNew = designPythonOutfit.getId();
|
||||
userLike.setDesignOutfitId(designOutfitIdNew);
|
||||
|
||||
for (UserLike userLike : userLikeList) {
|
||||
Long designOutfitIdOld = userLike.getDesignOutfitId();
|
||||
TDesignPythonOutfit designPythonOutfit = designPythonOutfitMapper.selectById(designOutfitIdOld);
|
||||
designPythonOutfit.setDesignId(design.getId());
|
||||
designPythonOutfit.setDesignItemId(-1L);
|
||||
designPythonOutfit.setCollectionId(collectionIdNew);
|
||||
QueryWrapper<TDesignPythonOutfitDetail> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(TDesignPythonOutfitDetail::getDesignPythonOutfitId, designOutfitIdOld);
|
||||
List<TDesignPythonOutfitDetail> tDesignPythonOutfitDetails = userLike.getTDesignPythonOutfitDetailList();
|
||||
if (CollectionUtil.isNotEmpty(tDesignPythonOutfitDetails)){
|
||||
for (TDesignPythonOutfitDetail tDesignPythonOutfitDetail : tDesignPythonOutfitDetails) {
|
||||
tDesignPythonOutfitDetail.setId(null);
|
||||
tDesignPythonOutfitDetail.setDesignId(null);
|
||||
tDesignPythonOutfitDetail.setDesignPythonOutfitId(designOutfitIdNew);
|
||||
designPythonOutfitDetailMapper.insert(tDesignPythonOutfitDetail);
|
||||
}
|
||||
}
|
||||
|
||||
designPythonOutfit.setId(null);
|
||||
designPythonOutfitMapper.insert(designPythonOutfit);
|
||||
Long designOutfitIdNew = designPythonOutfit.getId();
|
||||
userLike.setDesignOutfitId(designOutfitIdNew);
|
||||
QueryWrapper<TDesignPythonOutfitDetail> qw = new QueryWrapper<>();
|
||||
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(design.getId());
|
||||
tDesignPythonOutfitDetail.setDesignPythonOutfitId(designOutfitIdNew);
|
||||
designPythonOutfitDetailMapper.insert(tDesignPythonOutfitDetail);
|
||||
}
|
||||
DesignItem designItemOld = userLike.getDesignItem();
|
||||
designItemOld.setId(null);
|
||||
designItemOld.setAccountId(authPrincipalVo.getId());
|
||||
designItemOld.setDesignId(null);
|
||||
designItemOld.setCollectionId(null);
|
||||
designItemMapper.insert(designItemOld);
|
||||
Long designItemIdNew = designItemOld.getId();
|
||||
|
||||
Long designItemIdOld = userLike.getDesignItemId();
|
||||
DesignItem designItemOld = designItemMapper.selectById(designItemIdOld);
|
||||
designItemOld.setId(null);
|
||||
designItemOld.setAccountId(authPrincipalVo.getId());
|
||||
designItemOld.setDesignId(design.getId());
|
||||
designItemOld.setCollectionId(collectionIdNew);
|
||||
designItemMapper.insert(designItemOld);
|
||||
Long designItemIdNew = designItemOld.getId();
|
||||
designPythonOutfit.setDesignItemId(designItemIdNew);
|
||||
designPythonOutfitMapper.updateById(designPythonOutfit);
|
||||
|
||||
designPythonOutfit.setDesignItemId(designItemIdNew);
|
||||
designPythonOutfitMapper.updateById(designPythonOutfit);
|
||||
userLike.setDesignItemId(designItemIdNew);
|
||||
userLike.setId(null);
|
||||
userLike.setDesignId(null);
|
||||
userLike.setUserLikeGroupId(userLikeGroupNew.getId());
|
||||
userLikeMapper.insert(userLike);
|
||||
|
||||
userLike.setDesignItemId(designItemIdNew);
|
||||
userLike.setId(null);
|
||||
userLike.setDesignId(design.getId());
|
||||
userLike.setUserLikeGroupId(userLikeGroupNew.getId());
|
||||
userLikeMapper.insert(userLike);
|
||||
QueryWrapper<DesignItemDetail> designItemDetailQueryWrapper = new QueryWrapper<>();
|
||||
designItemDetailQueryWrapper.lambda().eq(DesignItemDetail::getDesignItemId, designItemIdOld);
|
||||
List<DesignItemDetail> designItemDetailListOld = designItemDetailMapper.selectList(designItemDetailQueryWrapper);
|
||||
for (DesignItemDetail designItemDetailOld : designItemDetailListOld) {
|
||||
Long designItemDetailIdOld = designItemDetailOld.getId();
|
||||
designItemDetailOld.setId(null);
|
||||
designItemDetailOld.setAccountId(authPrincipalVo.getId());
|
||||
designItemDetailOld.setDesignId(design.getId());
|
||||
designItemDetailOld.setDesignItemId(designItemIdNew);
|
||||
designItemDetailMapper.insert(designItemDetailOld);
|
||||
Long designItemDetailIdNew = designItemDetailOld.getId();
|
||||
QueryWrapper<DesignItemDetailPrint> designItemDetailPrintQueryWrapper = new QueryWrapper<>();
|
||||
designItemDetailPrintQueryWrapper.lambda().eq(DesignItemDetailPrint::getDesignItemDetailId, designItemDetailIdOld);
|
||||
List<DesignItemDetailPrint> designItemDetailPrintList = designItemDetailPrintMapper.selectList(designItemDetailPrintQueryWrapper);
|
||||
for (DesignItemDetailPrint designItemDetailPrint : designItemDetailPrintList) {
|
||||
designItemDetailPrint.setId(null);
|
||||
designItemDetailPrint.setDesignItemDetailId(designItemDetailIdNew);
|
||||
designItemDetailPrintMapper.insert(designItemDetailPrint);
|
||||
List<DesignItemDetailSnapshot> designItemDetailList = userLike.getDesignItemDetailList();
|
||||
if (CollectionUtil.isNotEmpty(designItemDetailList)) {
|
||||
for (DesignItemDetailSnapshot designItemDetailOld : designItemDetailList) {
|
||||
designItemDetailOld.setId(null);
|
||||
designItemDetailOld.setAccountId(authPrincipalVo.getId());
|
||||
designItemDetailOld.setDesignId(null);
|
||||
designItemDetailOld.setDesignItemId(designItemIdNew);
|
||||
designItemDetailMapper.insert(designItemDetailOld);
|
||||
Long designItemDetailIdNew = designItemDetailOld.getId();
|
||||
|
||||
List<DesignItemDetailPrint> designItemDetailPrintList = designItemDetailOld.getDesignItemDetailPrintList();
|
||||
if (CollectionUtil.isNotEmpty(designItemDetailPrintList)) {
|
||||
for (DesignItemDetailPrint designItemDetailPrint : designItemDetailPrintList) {
|
||||
designItemDetailPrint.setId(null);
|
||||
designItemDetailPrint.setDesignItemDetailId(designItemDetailIdNew);
|
||||
designItemDetailPrintMapper.insert(designItemDetailPrint);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Long collectionId = portfolio.getCollectionId();
|
||||
// QueryWrapper<Design> getWorkspaceQw = new QueryWrapper<>();
|
||||
// getWorkspaceQw.lambda().eq(Design::getCollectionId, collectionId);
|
||||
// List<Design> designs = designMapper.selectList(getWorkspaceQw);
|
||||
// if (!CollectionUtils.isEmpty(designs)) {
|
||||
// Design design1 = designs.get(0);
|
||||
// Long accountId = authPrincipalVo.getId();
|
||||
// QueryWrapper<Workspace> currentWorkspaceQw = new QueryWrapper<>();
|
||||
// currentWorkspaceQw.lambda().eq(Workspace::getAccountId, accountId);
|
||||
// currentWorkspaceQw.lambda().eq(Workspace::getIsLastIndex, 1);
|
||||
// List<Workspace> workspaces = workspaceMapper.selectList(currentWorkspaceQw);
|
||||
// if (!CollectionUtils.isEmpty(workspaces)) {
|
||||
// Workspace workspace1 = workspaces.get(0);
|
||||
// workspace1.setIsLastIndex(0);
|
||||
// workspaceMapper.updateById(workspace1);
|
||||
// Workspace workspaceNew = new Workspace();
|
||||
// String workspaceName = "workspace of " + accountMapper.selectById(portfolio.getAccountId()).getUserName() + portfolio.getPortfolioName();
|
||||
// QueryWrapper<Workspace> existSameNameQw = new QueryWrapper<>();
|
||||
// existSameNameQw.lambda().eq(Workspace::getWorkSpaceName, workspaceName);
|
||||
// existSameNameQw.lambda().eq(Workspace::getAccountId, authPrincipalVo.getId());
|
||||
// List<Workspace> existSameNameList = workspaceMapper.selectList(existSameNameQw);
|
||||
// if (!CollectionUtils.isEmpty(existSameNameList)) {
|
||||
// workspaceName = workspaceName + "_copy";
|
||||
// }
|
||||
// workspaceNew.setWorkSpaceName(workspaceName);
|
||||
// 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::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");
|
||||
// }
|
||||
// }
|
||||
// } 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.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");
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// workspaceMapper.updateById(workspaceNew);
|
||||
// }
|
||||
// }
|
||||
Long workspaceIdOld = workspaceService.getByProjectId(projectId);
|
||||
Workspace workspaceCopy = workspaceMapper.selectById(workspaceIdOld);
|
||||
Workspace workspaceCopy = projectSnapshot.getWorkspace();
|
||||
workspaceCopy.setAccountId(authPrincipalVo.getId());
|
||||
workspaceCopy.setProjectId(projectIdNew);
|
||||
workspaceCopy.setId(null);
|
||||
|
||||
Reference in New Issue
Block a user