fix:二创报错

This commit is contained in:
litianxiang
2025-09-16 11:07:54 +08:00
parent 630dfe98a4
commit fa74236035
2 changed files with 272 additions and 204 deletions

View File

@@ -3,8 +3,11 @@ package com.ai.da.mapper.primary;
import com.ai.da.common.config.mybatis.plus.CommonMapper; import com.ai.da.common.config.mybatis.plus.CommonMapper;
import com.ai.da.mapper.primary.entity.CollectionSort; import com.ai.da.mapper.primary.entity.CollectionSort;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update; import org.apache.ibatis.annotations.Update;
import java.util.List;
public interface CollectionSortMapper extends CommonMapper<CollectionSort> { public interface CollectionSortMapper extends CommonMapper<CollectionSort> {
@Update("UPDATE collection_sort SET sort = sort + 1 " + @Update("UPDATE collection_sort SET sort = sort + 1 " +
"WHERE parent_id = #{parentId} " + "WHERE parent_id = #{parentId} " +
@@ -15,4 +18,8 @@ public interface CollectionSortMapper extends CommonMapper<CollectionSort> {
@Param("relationType") String relationType, @Param("relationType") String relationType,
@Param("originalSort") int originalSort @Param("originalSort") int originalSort
); );
@Select("SELECT * FROM collection_sort WHERE parent_id IN (SELECT id FROM collection_sort WHERE relation_id = #{relationId})")
List<CollectionSort> queryCollectionSortsIsNotDesignByUserLikeRelationId(@Param("relationId") Long relationId);
} }

View File

@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
import com.ai.da.common.config.exception.BusinessException; import com.ai.da.common.config.exception.BusinessException;
import com.ai.da.common.constant.CommonConstant; import com.ai.da.common.constant.CommonConstant;
import com.ai.da.common.context.UserContext; import com.ai.da.common.context.UserContext;
import com.ai.da.common.enums.CollectionLevel1TypeEnum;
import com.ai.da.common.response.PageBaseResponse; import com.ai.da.common.response.PageBaseResponse;
import com.ai.da.common.response.ResultEnum; import com.ai.da.common.response.ResultEnum;
import com.ai.da.common.utils.CopyUtil; import com.ai.da.common.utils.CopyUtil;
@@ -13,6 +14,7 @@ import com.ai.da.mapper.primary.*;
import com.ai.da.mapper.primary.entity.*; import com.ai.da.mapper.primary.entity.*;
import com.ai.da.mapper.primary.entity.Collection; import com.ai.da.mapper.primary.entity.Collection;
import com.ai.da.model.dto.*; import com.ai.da.model.dto.*;
import com.ai.da.model.enums.CollectionType;
import com.ai.da.model.enums.DesignProcess; import com.ai.da.model.enums.DesignProcess;
import com.ai.da.model.enums.Position; import com.ai.da.model.enums.Position;
import com.ai.da.model.enums.Sex; import com.ai.da.model.enums.Sex;
@@ -57,6 +59,8 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
@Resource @Resource
private CollectionSortService collectionSortService; private CollectionSortService collectionSortService;
@Resource @Resource
private CollectionSortMapper collectionSortMapper;
@Resource
private TCollectionElementRelationMapper collectionElementRelationMapper; private TCollectionElementRelationMapper collectionElementRelationMapper;
@Resource @Resource
@@ -132,6 +136,15 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
@Resource @Resource
private ProjectMapper projectMapper; private ProjectMapper projectMapper;
@Resource
private CollectionElementRelModelMapper collectionElementRelModelMapper;
@Resource
private ToProductImageResultMapper toProductImageResultMapper;
@Resource
private ToProductImageRecordMapper toProductImageRecordMapper;
@Resource
private PoseTransformationMapper poseTransformationMapper;
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Long publish(MultipartFile file, String data) { public Long publish(MultipartFile file, String data) {
@@ -175,7 +188,7 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
portfolio.setOriginal(0); portfolio.setOriginal(0);
portfolio.setOriginalAccountId(project.getOriginalAccountId()); portfolio.setOriginalAccountId(project.getOriginalAccountId());
portfolio.setOriginalPortfolioId(project.getOriginalPortfolioId()); portfolio.setOriginalPortfolioId(project.getOriginalPortfolioId());
}else { } else {
portfolio.setOriginal(1); portfolio.setOriginal(1);
} }
portfolio.setPortfolioName(portfolioDTO.getPortfolioName()); portfolio.setPortfolioName(portfolioDTO.getPortfolioName());
@@ -186,9 +199,9 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
portfolio.setIsDeleted(0); portfolio.setIsDeleted(0);
portfolio.setCanvasId(canvas.getId()); portfolio.setCanvasId(canvas.getId());
portfolio.setPortfolioDes(portfolioDTO.getPortfolioDes()); portfolio.setPortfolioDes(portfolioDTO.getPortfolioDes());
if (Objects.isNull(portfolioDTO.getIsPublic())){ if (Objects.isNull(portfolioDTO.getIsPublic())) {
portfolio.setIsPublic(1); portfolio.setIsPublic(1);
}else { } else {
portfolio.setIsPublic(portfolioDTO.getIsPublic()); portfolio.setIsPublic(portfolioDTO.getIsPublic());
} }
portfolio.setOrganizationId(accountMapper.selectById(authPrincipalVo.getId()).getOrganizationId()); portfolio.setOrganizationId(accountMapper.selectById(authPrincipalVo.getId()).getOrganizationId());
@@ -200,7 +213,7 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
Long workspaceId = workspaceService.getByProjectId(projectId); Long workspaceId = workspaceService.getByProjectId(projectId);
Workspace workspace = workspaceMapper.selectById(workspaceId); Workspace workspace = workspaceMapper.selectById(workspaceId);
project.setId(null); project.setId(projectId);
projectSnapshot.setProject(project); projectSnapshot.setProject(project);
workspace.setId(null); workspace.setId(null);
projectSnapshot.setWorkspace(workspace); projectSnapshot.setWorkspace(workspace);
@@ -270,13 +283,13 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
resultPortfolioId = portfolio.getId(); resultPortfolioId = portfolio.getId();
portfolioId = portfolio.getId(); portfolioId = portfolio.getId();
// id不为空 表示更新发布;为空,表示新发布 // id不为空 表示更新发布;为空,表示新发布
if (!Objects.isNull(portfolioDTO.getId())){ if (!Objects.isNull(portfolioDTO.getId())) {
portfolioId = portfolioDTO.getId(); portfolioId = portfolioDTO.getId();
// 删除作品的所有与标签的关联关系 // 删除作品的所有与标签的关联关系
portfolioTagsMapper.deleteByPortfolioId(portfolioId); portfolioTagsMapper.deleteByPortfolioId(portfolioId);
} }
// 记录作品添加的标签 // 记录作品添加的标签
if (!portfolioDTO.getTagsDTO().isEmpty()){ if (!portfolioDTO.getTagsDTO().isEmpty()) {
addTagsForPortfolio(portfolioDTO.getTagsDTO(), portfolioId); addTagsForPortfolio(portfolioDTO.getTagsDTO(), portfolioId);
} }
} }
@@ -298,11 +311,11 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
} }
if (portfolioDTO.getPortfolioType().equals("History")) { if (portfolioDTO.getPortfolioType().equals("History")) {
Long userLikeGroupId; Long userLikeGroupId;
if (Objects.nonNull(portfolioDTO.getUserLikeGroupId())){ if (Objects.nonNull(portfolioDTO.getUserLikeGroupId())) {
userLikeGroupId = portfolioDTO.getUserLikeGroupId(); userLikeGroupId = portfolioDTO.getUserLikeGroupId();
} else if (Objects.nonNull(portfolioDTO.getProjectId())){ } else if (Objects.nonNull(portfolioDTO.getProjectId())) {
UserLikeGroup likeGroup = userLikeGroupMapper.selectOne(new QueryWrapper<UserLikeGroup>().eq("project_id", portfolioDTO.getProjectId())); UserLikeGroup likeGroup = userLikeGroupMapper.selectOne(new QueryWrapper<UserLikeGroup>().eq("project_id", portfolioDTO.getProjectId()));
if (Objects.isNull(likeGroup)){ if (Objects.isNull(likeGroup)) {
return null; return null;
} }
userLikeGroupId = likeGroup.getId(); userLikeGroupId = likeGroup.getId();
@@ -447,13 +460,13 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
} }
} }
if (!Objects.isNull(query.getTagId()) && !query.getTagId().equals(0L)){ if (!Objects.isNull(query.getTagId()) && !query.getTagId().equals(0L)) {
return queryPortfolioByTag(null, query.getTagId(), query.getPage(), query.getSize()); return queryPortfolioByTag(null, query.getTagId(), query.getPage(), query.getSize());
} }
if (Objects.nonNull(query.getOrganizationId())){ if (Objects.nonNull(query.getOrganizationId())) {
qw.eq("organization_id", query.getOrganizationId()); qw.eq("organization_id", query.getOrganizationId());
}else if (query.getGetMyPortfolio() == 0){ } else if (query.getGetMyPortfolio() == 0) {
qw.isNull("is_public").or().eq("is_public", 1); qw.isNull("is_public").or().eq("is_public", 1);
} }
@@ -525,7 +538,7 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
@Override @Override
public PortfolioVO detail(PortfolioDTO portfolioDTO) { public PortfolioVO detail(PortfolioDTO portfolioDTO) {
// AuthPrincipalVo userHolder = UserContext.getUserHolder(); AuthPrincipalVo userHolder = UserContext.getUserHolder();
Portfolio portfolio = portfolioMapper.selectById(portfolioDTO.getId()); Portfolio portfolio = portfolioMapper.selectById(portfolioDTO.getId());
PortfolioVO vo = CopyUtil.copyObject(portfolio, PortfolioVO.class); PortfolioVO vo = CopyUtil.copyObject(portfolio, PortfolioVO.class);
if (vo.getOpenSource() == 1) { if (vo.getOpenSource() == 1) {
@@ -540,7 +553,7 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
} }
vo.setCollectionElementList(collectionElementList); vo.setCollectionElementList(collectionElementList);
List<UserLikeSnapshot> userLikeList = projectSnapshot.getUserLikeList(); List<UserLikeSnapshot> userLikeList = projectSnapshot.getUserLikeList();
if (userLikeList != null && !userLikeList.isEmpty()){ if (userLikeList != null && !userLikeList.isEmpty()) {
List<TDesignPythonOutfit> list = new ArrayList<>(); List<TDesignPythonOutfit> list = new ArrayList<>();
for (UserLikeSnapshot userLikeSnapshot : userLikeList) { for (UserLikeSnapshot userLikeSnapshot : userLikeList) {
TDesignPythonOutfit designPythonOutfit = userLikeSnapshot.getDesignPythonOutfit(); TDesignPythonOutfit designPythonOutfit = userLikeSnapshot.getDesignPythonOutfit();
@@ -556,19 +569,19 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
vo.setLikeNum(redisUtil.getLikeCount(vo.getId())); vo.setLikeNum(redisUtil.getLikeCount(vo.getId()));
String avatar; String avatar;
Account account = accountMapper.selectById(vo.getAccountId()); Account account = accountMapper.selectById(vo.getAccountId());
if (Objects.isNull(portfolioDTO.getAccountId())) { if (userHolder == null) {
vo.setIsLike(0); vo.setIsLike(0);
vo.setIsFollow(0); vo.setIsFollow(0);
avatar = CommonConstant.DEFAULT_AVATAR; avatar = CommonConstant.DEFAULT_AVATAR;
} else { } else {
boolean postLikedByUser = redisUtil.isPostLikedByUser(portfolioDTO.getId(), portfolioDTO.getAccountId()); boolean postLikedByUser = redisUtil.isPostLikedByUser(portfolioDTO.getId(), userHolder.getId());
if (postLikedByUser) { if (postLikedByUser) {
vo.setIsLike(1); vo.setIsLike(1);
} else { } else {
vo.setIsLike(0); vo.setIsLike(0);
} }
// 设置当前用户是否关注了所查看作品的作者 // 设置当前用户是否关注了所查看作品的作者
Integer ifFollowed = getIfFollowed(portfolio.getAccountId(), portfolioDTO.getAccountId()); Integer ifFollowed = getIfFollowed(portfolio.getAccountId(), userHolder.getId());
vo.setIsFollow(ifFollowed); vo.setIsFollow(ifFollowed);
avatar = StringUtil.isNullOrEmpty(account.getAvatar()) ? CommonConstant.DEFAULT_AVATAR : account.getAvatar(); avatar = StringUtil.isNullOrEmpty(account.getAvatar()) ? CommonConstant.DEFAULT_AVATAR : account.getAvatar();
} }
@@ -589,17 +602,17 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
} }
} }
} }
if (Objects.isNull(portfolioDTO.getAccountId())) { if (userHolder == null) {
vo.setIsMine(0); vo.setIsMine(0);
vo.setSelected(0); vo.setSelected(0);
} else { } else {
if (Objects.equals(vo.getAccountId(), portfolioDTO.getAccountId()) || Objects.equals(vo.getOriginalAccountId(), portfolioDTO.getAccountId())) { if (Objects.equals(vo.getAccountId(), userHolder.getId()) || Objects.equals(vo.getOriginalAccountId(), userHolder.getId())) {
vo.setIsMine(1); vo.setIsMine(1);
vo.setSelected(1); vo.setSelected(1);
} else { } else {
vo.setIsMine(0); vo.setIsMine(0);
QueryWrapper<UserLikeGroup> getSelectedQw = new QueryWrapper<>(); QueryWrapper<UserLikeGroup> getSelectedQw = new QueryWrapper<>();
getSelectedQw.lambda().eq(UserLikeGroup::getAccountId, portfolioDTO.getAccountId()); getSelectedQw.lambda().eq(UserLikeGroup::getAccountId, userHolder.getId());
getSelectedQw.lambda().eq(UserLikeGroup::getOriginalPortfolioId, vo.getId()); getSelectedQw.lambda().eq(UserLikeGroup::getOriginalPortfolioId, vo.getId());
List<UserLikeGroup> userLikeGroups = userLikeGroupMapper.selectList(getSelectedQw); List<UserLikeGroup> userLikeGroups = userLikeGroupMapper.selectList(getSelectedQw);
if (CollectionUtils.isEmpty(userLikeGroups)) { if (CollectionUtils.isEmpty(userLikeGroups)) {
@@ -616,18 +629,17 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ProjectChooseVO choose(PortfolioDTO portfolioDTO) { public ProjectChooseVO choose(PortfolioDTO portfolioDTO) {
AuthPrincipalVo authPrincipalVo = UserContext.getUserHolder(); Long accountId = UserContext.getUserHolder().getId();
Long accountId = authPrincipalVo.getId();
Portfolio portfolio = portfolioMapper.selectById(portfolioDTO.getId()); Portfolio portfolio = portfolioMapper.selectById(portfolioDTO.getId());
String snapshot = portfolio.getSnapshot(); String snapshot = portfolio.getSnapshot();
ProjectSnapshot projectSnapshot = JSONObject.parseObject(snapshot, ProjectSnapshot.class); ProjectSnapshot projectSnapshot = JSONObject.parseObject(snapshot, ProjectSnapshot.class);
Project projectOld = projectSnapshot.getProject();
Project project = projectSnapshot.getProject(); Workspace workspaceOld = projectSnapshot.getWorkspace();
List<CollectionElement> collectionElementListOld = projectSnapshot.getCollectionElementList();
Long projectId = project.getId(); UserLikeGroup userLikeGroupOld = projectSnapshot.getUserLikeGroup();
List<UserLikeSnapshot> userLikeListOld = projectSnapshot.getUserLikeList();
UserLikeGroup userLikeGroup = projectSnapshot.getUserLikeGroup(); Project project = CopyUtil.copyObject(projectOld, Project.class);
project.setCreateTime(LocalDateTime.now()); project.setCreateTime(LocalDateTime.now());
project.setId(null); project.setId(null);
@@ -653,182 +665,230 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
Long projectIdNew = project.getId(); Long projectIdNew = project.getId();
Workspace workspaceCopy = projectSnapshot.getWorkspace(); workspaceOld.setAccountId(accountId);
workspaceCopy.setAccountId(accountId); workspaceOld.setProjectId(projectIdNew);
workspaceCopy.setProjectId(projectIdNew); workspaceOld.setId(null);
workspaceCopy.setId(null); workspaceMapper.insert(workspaceOld);
workspaceMapper.insert(workspaceCopy);
Workspace workspace = workspaceService.getCurrentWorkspace();
List<CollectionElement> collectionElementListOld = projectSnapshot.getCollectionElementList();
Long collectionIdNew;
if (collectionElementListOld.isEmpty()){
throw new BusinessException("No elements in collection.");
} else {
Long collectionIdOld = collectionElementListOld.get(0).getCollectionId();
Collection collection = collectionMapper.selectById(collectionIdOld);
if (Objects.nonNull(collection) && Objects.nonNull(collection.getMoodTemplateId())){
CollectionElement moodTemplateElement = collectionElementMapper.selectById(collection.getMoodTemplateId());
if (Objects.nonNull(moodTemplateElement)){
moodTemplateElement.setId(null);
moodTemplateElement.setAccountId(accountId);
moodTemplateElement.setProjectId(projectIdNew);
moodTemplateElement.setCreateDate(new Date());
collectionElementMapper.insert(moodTemplateElement);
collection.setMoodTemplateId(String.valueOf(moodTemplateElement.getId()));
}
}
collection.setId(null);
collection.setAccountId(accountId);
collection.setCreateDate(new Date());
collectionMapper.insert(collection);
collectionIdNew = collection.getId();
}
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("");
project.setProcess(DesignProcess.SERIES_DESIGN.name());
} else {
design.setSingleOverall("single");
design.setSwitchCategory(workspace.getPosition());
project.setProcess(DesignProcess.SINGLE_DESIGN.name());
}
design.setCreateDate(new Date());
designMapper.insert(design);
projectMapper.updateById(project);
// 复制collectionElement
for (CollectionElement element : collectionElementListOld) { for (CollectionElement element : collectionElementListOld) {
element.setCollectionId(collectionIdNew); if (element.getLevel1Type().equals(CollectionLevel1TypeEnum.MODEL.getRealName())) {
element.setProjectId(projectIdNew); LambdaQueryWrapper<CollectionElementRelModel> relModelLambdaQueryWrapper = new LambdaQueryWrapper<>();
element.setId(null); relModelLambdaQueryWrapper.eq(CollectionElementRelModel::getCollectionElementId, element.getId());
element.setCreateDate(new Date()); CollectionElementRelModel collectionElementRelModelCopy = collectionElementRelModelMapper.selectOne(relModelLambdaQueryWrapper);
element.setUpdateDate(null); // element.setCollectionId(collectionIdNew);
collectionElementMapper.insert(element); element.setId(null);
element.setCreateDate(new Date());
element.setUpdateDate(null);
element.setAccountId(accountId);
element.setProjectId(projectIdNew);
collectionElementMapper.insert(element);
Long collectionElementNewID = element.getId();
if (collectionElementRelModelCopy != null) {
collectionElementRelModelCopy.setId(null);
collectionElementRelModelCopy.setCollectionElementId(collectionElementNewID);
collectionElementRelModelMapper.insert(collectionElementRelModelCopy);
}
;
} else {
// element.setCollectionId(collectionIdNew);
element.setId(null);
element.setCreateDate(new Date());
element.setUpdateDate(null);
element.setAccountId(accountId);
element.setProjectId(projectIdNew);
collectionElementMapper.insert(element);
}
} }
if (Objects.nonNull(userLikeGroup)) {
Long portfolioUserLikeGroupId = userLikeGroup.getId();
UserLikeGroup userLikeGroupNew = projectSnapshot.getUserLikeGroup(); if (userLikeGroupOld != null) {
userLikeGroupNew.setId(null);
userLikeGroupNew.setCollectionId(collectionIdNew); Long collectionIdOld = userLikeGroupOld.getCollectionId();
userLikeGroupNew.setCreateDate(new Date()); Collection collectionCopy = collectionMapper.selectById(collectionIdOld);
userLikeGroupNew.setProjectId(projectIdNew); collectionCopy.setId(null);
collectionCopy.setAccountId(accountId);
collectionCopy.setCreateDate(new Date());
collectionMapper.insert(collectionCopy);
Long collectionIdNew = collectionCopy.getId();
userLikeGroupOld.setId(null);
userLikeGroupOld.setCollectionId(collectionIdNew);
userLikeGroupOld.setCreateDate(new Date());
userLikeGroupOld.setProjectId(projectIdNew);
if (portfolio.getOriginal() == 1) { if (portfolio.getOriginal() == 1) {
if (Objects.equals(portfolio.getAccountId(), accountId)) { if (Objects.equals(portfolio.getAccountId(), accountId)) {
userLikeGroupNew.setOriginal(1); userLikeGroupOld.setOriginal(1);
} else { } else {
userLikeGroupNew.setOriginal(0); userLikeGroupOld.setOriginal(0);
userLikeGroupNew.setOriginalAccountId(portfolio.getAccountId()); userLikeGroupOld.setOriginalAccountId(portfolio.getAccountId());
userLikeGroupNew.setOriginalPortfolioId(portfolio.getId()); userLikeGroupOld.setOriginalPortfolioId(portfolio.getId());
} }
} else { } else {
userLikeGroupNew.setOriginal(0); userLikeGroupOld.setOriginal(0);
userLikeGroupNew.setOriginalAccountId(portfolio.getOriginalAccountId()); userLikeGroupOld.setOriginalAccountId(portfolio.getOriginalAccountId());
userLikeGroupNew.setOriginalPortfolioId(portfolio.getId()); userLikeGroupOld.setOriginalPortfolioId(portfolio.getId());
} }
userLikeGroupNew.setAccountId(accountId); userLikeGroupOld.setAccountId(accountId);
userLikeGroupNew.setUpdateDate(new Date()); userLikeGroupOld.setUpdateDate(new Date());
userLikeGroupMapper.insert(userLikeGroupNew); userLikeGroupMapper.insert(userLikeGroupOld);
Long userLikeGroupIdNew = userLikeGroupOld.getId();
List<UserLikeSnapshot> userLikeList = projectSnapshot.getUserLikeList();
if (CollectionUtil.isNotEmpty(userLikeList)) {
for (UserLikeSnapshot userLike : userLikeList) {
Long designOutfitIdOld = userLike.getDesignOutfitId();
TDesignPythonOutfit designPythonOutfit = userLike.getDesignPythonOutfit();
designPythonOutfit.setDesignId(design.getId());
designPythonOutfit.setDesignItemId(-1L);
designPythonOutfit.setCollectionId(collectionIdNew);
designPythonOutfit.setCreateDate(LocalDateTime.now());
designPythonOutfit.setId(null); //根据designId进行分组
// 这里插入的accountId是原作者的二创是否需要修改 Map<Long, List<UserLikeSnapshot>> userLikeMapByDesignId = userLikeListOld.stream()
designPythonOutfitMapper.insert(designPythonOutfit); .filter(userLikeSnapshot -> userLikeSnapshot.getDesignItem() != null)
Long designOutfitIdNew = designPythonOutfit.getId(); .collect(Collectors.groupingBy(userLikeSnapshot -> userLikeSnapshot.getDesignItem().getDesignId()));
userLike.setDesignOutfitId(designOutfitIdNew); userLikeMapByDesignId.forEach((designId, userLikeListOld1) -> {
Design design = designMapper.selectById(designId);
design.setId(null);
design.setCollectionId(collectionIdNew);
design.setAccountId(accountId);
design.setCreateDate(new Date());
designMapper.insert(design);
QueryWrapper<TDesignPythonOutfitDetail> qw = new QueryWrapper<>(); for (UserLikeSnapshot userLikeSnapshot : userLikeListOld1) {
qw.lambda().eq(TDesignPythonOutfitDetail::getDesignPythonOutfitId, designOutfitIdOld);
List<TDesignPythonOutfitDetail> tDesignPythonOutfitDetails = userLike.getTDesignPythonOutfitDetailList();
if (CollectionUtil.isNotEmpty(tDesignPythonOutfitDetails)){
for (TDesignPythonOutfitDetail tDesignPythonOutfitDetail : tDesignPythonOutfitDetails) {
tDesignPythonOutfitDetail.setId(null);
tDesignPythonOutfitDetail.setUserId(accountId);
tDesignPythonOutfitDetail.setDesignId(design.getId());
tDesignPythonOutfitDetail.setDesignPythonOutfitId(designOutfitIdNew);
tDesignPythonOutfitDetail.setCreateDate(LocalDateTime.now());
designPythonOutfitDetailMapper.insert(tDesignPythonOutfitDetail);
}
}
DesignItem designItemOld = userLike.getDesignItem();
designItemOld.setId(null);
designItemOld.setAccountId(accountId);
designItemOld.setDesignId(design.getId());
designItemOld.setCollectionId(collectionIdNew);
designItemOld.setCreateDate(new Date());
designItemMapper.insert(designItemOld);
Long designItemIdNew = designItemOld.getId();
designPythonOutfit.setDesignItemId(designItemIdNew); // 4. 处理DesignItem数据
designPythonOutfitMapper.updateById(designPythonOutfit); DesignItem designItem = userLikeSnapshot.getDesignItem();
if (designItem != null) {
designItem.setId(null);
designItem.setAccountId(accountId);
designItem.setDesignId(design.getId());
designItem.setCollectionId(collectionIdNew);
designItem.setCreateDate(new Date());
designItemMapper.insert(designItem);
userLike.setDesignItemId(designItemIdNew); // 5. 处理DesignItemDetailSnapshot数据
userLike.setId(null); List<DesignItemDetailSnapshot> itemDetailSnapshots = userLikeSnapshot.getDesignItemDetailList();
userLike.setDesignId(design.getId()); if (itemDetailSnapshots != null && !itemDetailSnapshots.isEmpty()) {
userLike.setUserLikeGroupId(userLikeGroupNew.getId()); for (DesignItemDetailSnapshot itemDetailSnapshot : itemDetailSnapshots) {
userLike.setCreateDate(new Date()); //只复制未删除的
userLikeMapper.insert(userLike); if (itemDetailSnapshot.getIsDeleted() == 1) {
continue;
}
// 转换为原实体类
DesignItemDetail designItemDetail = CopyUtil.copyObject(itemDetailSnapshot, DesignItemDetail.class);
designItemDetail.setId(null);
// 更新外键为新插入的designItem的ID
designItemDetail.setDesignItemId(designItem.getId());
designItemDetail.setDesignId(design.getId());
designItemDetail.setCreateDate(new Date());
designItemDetail.setAccountId(accountId);
designItemDetailMapper.insert(designItemDetail);
// 加入collection_sort表 // 6. 处理DesignItemDetailPrint数据
collectionSortService.addCollectionSort(userLike.getId(), "Design", projectIdNew, null); List<DesignItemDetailPrint> prints = itemDetailSnapshot.getDesignItemDetailPrintList();
if (prints != null && !prints.isEmpty()) {
List<DesignItemDetailSnapshot> designItemDetailList = userLike.getDesignItemDetailList(); for (DesignItemDetailPrint print : prints) {
if (CollectionUtil.isNotEmpty(designItemDetailList)) { print.setId(null);
for (DesignItemDetailSnapshot designItemDetailOld : designItemDetailList) { print.setCreateDate(LocalDateTime.now());
designItemDetailOld.setId(null); // 更新外键为新插入的designItemDetail的ID
designItemDetailOld.setAccountId(accountId); print.setDesignItemDetailId(designItemDetail.getId());
designItemDetailOld.setDesignId(design.getId()); designItemDetailPrintMapper.insert(print);
designItemDetailOld.setDesignItemId(designItemIdNew); }
designItemDetailOld.setCreateDate(new Date());
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);
designItemDetailPrint.setCreateDate(LocalDateTime.now());
designItemDetailPrintMapper.insert(designItemDetailPrint);
} }
} }
} }
} }
// 2. 处理DesignPythonOutfit数据
TDesignPythonOutfit outfit = userLikeSnapshot.getDesignPythonOutfit();
if (outfit != null) {
// 清除原有ID使用新ID插入
outfit.setId(null);
outfit.setDesignId(design.getId());
outfit.setCollectionId(collectionIdNew);
outfit.setCreateDate(LocalDateTime.now());
outfit.setDesignItemId(designItem.getId());
designPythonOutfitMapper.insert(outfit);
// 3. 处理TDesignPythonOutfitDetail数据
List<TDesignPythonOutfitDetail> outfitDetails = userLikeSnapshot.getTDesignPythonOutfitDetailList();
if (outfitDetails != null && !outfitDetails.isEmpty()) {
for (TDesignPythonOutfitDetail detail : outfitDetails) {
detail.setId(null);
// 更新外键为新插入的outfit的ID
detail.setDesignPythonOutfitId(outfit.getId());
detail.setCreateDate(LocalDateTime.now());
detail.setUpdateDate(LocalDateTime.now());
detail.setUserId(accountId);
detail.setDesignId(design.getId());
designPythonOutfitDetailMapper.insert(detail);
}
}
}
UserLike userLike = CopyUtil.copyObject(userLikeSnapshot, UserLike.class);
userLike.setId(null);
userLike.setDesignId(design.getId());
userLike.setUserLikeGroupId(userLikeGroupIdNew);
userLike.setDesignItemId(designItem.getId());
userLike.setDesignOutfitId(outfit.getId());
userLikeService.save(userLike);
CollectionSort collectionSortDesign = new CollectionSort();
collectionSortDesign.setProjectId(project.getId());
collectionSortDesign.setRelationId(userLike.getId());
collectionSortDesign.setRelationType(CollectionType.DESIGN.getValue());
collectionSortDesign.setCreateTime(LocalDateTime.now());
int nextSort = collectionSortService.getNextSort(projectIdNew, null);
collectionSortDesign.setSort(nextSort);
collectionSortMapper.insert(collectionSortDesign);
//此集合为根据UserLikeId查询到的非Design类型的集合
List<CollectionSort> collectionSorts = collectionSortMapper.queryCollectionSortsIsNotDesignByUserLikeRelationId(userLikeSnapshot.getId());
if (collectionSorts != null && !collectionSorts.isEmpty()) {
for (CollectionSort collectionSort : collectionSorts) {
CollectionSort collectionSortNew = new CollectionSort();
if (collectionSort.getRelationType().equals(CollectionType.TO_PRODUCT_IMAGE.getValue()) || collectionSort.getRelationType().equals(CollectionType.RELIGHT.getValue())) {
ToProductImageResult toProductImageResult = toProductImageResultMapper.selectById(collectionSort.getRelationId());
ToProductImageRecord toProductImageRecord = toProductImageRecordMapper.selectById(toProductImageResult.getToProductImageRecordId());
toProductImageRecord.setId(null);
toProductImageRecord.setProjectId(projectIdNew);
toProductImageRecord.setCreateTime(LocalDateTime.now());
toProductImageRecord.setUserLikeGroupId(userLikeGroupIdNew);
toProductImageRecordMapper.insert(toProductImageRecord);
toProductImageResult.setId(null);
toProductImageResult.setProjectId(projectIdNew);
toProductImageResult.setToProductImageRecordId(toProductImageRecord.getId());
toProductImageResult.setCreateTime(LocalDateTime.now());
toProductImageResult.setUserLikeGroupId(userLikeGroupIdNew);
toProductImageResultMapper.insert(toProductImageResult);
collectionSortNew.setRelationId(toProductImageResult.getId());
} else if (collectionSort.getRelationType().equals(CollectionType.POSE_TRANSFORM.getValue())) {
PoseTransformation poseTransformation = poseTransformationMapper.selectById(collectionSort.getRelationId());
poseTransformation.setId(null);
poseTransformation.setProjectId(projectIdNew);
poseTransformation.setCreateTime(LocalDateTime.now());
poseTransformation.setUpdateTime(LocalDateTime.now());
poseTransformation.setAccountId(accountId);
poseTransformationMapper.insert(poseTransformation);
collectionSortNew.setRelationId(poseTransformation.getId());
}
collectionSortNew.setProjectId(project.getId());
collectionSortNew.setRelationType(collectionSort.getRelationType());
collectionSortNew.setCreateTime(LocalDateTime.now());
collectionSortNew.setParentId(collectionSortDesign.getId());
int nextSort2 = collectionSortService.getNextSort(projectIdNew, collectionSortDesign.getId());
collectionSortNew.setSort(nextSort2);
collectionSortMapper.insert(collectionSortNew);
}
}
} }
} });
} }
ProjectDTO projectDTO = new ProjectDTO(); ProjectDTO projectDTO = new ProjectDTO();
projectDTO.setId(project.getId()); projectDTO.setId(project.getId());
return userLikeGroupService.choose(projectDTO); return userLikeGroupService.choose(projectDTO);
} }
@@ -1045,7 +1105,7 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
} }
// Step 3: Find the top 3 portfolio IDs with the largest values // Step 3: Find the top 3 portfolio IDs with the largest values
if (!portfolioViews.isEmpty()){ if (!portfolioViews.isEmpty()) {
// System.out.println("Top 3 Portfolio IDs after exclusion: " + top3PortfolioIds); // System.out.println("Top 3 Portfolio IDs after exclusion: " + top3PortfolioIds);
return portfolioViews.entrySet().stream() return portfolioViews.entrySet().stream()
@@ -1060,21 +1120,21 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
// 验证该用户是否已参加活动 // 验证该用户是否已参加活动
public Boolean hasParticipatedRCAWorkshop(Long accountId, List<TagsDTO> tags, Long portfolioId, Long userLikeGroupId) { public Boolean hasParticipatedRCAWorkshop(Long accountId, List<TagsDTO> tags, Long portfolioId, Long userLikeGroupId) {
List<String> collect = tags.stream().map(Tags::getTagName).collect(Collectors.toList()); List<String> collect = tags.stream().map(Tags::getTagName).collect(Collectors.toList());
if (!collect.contains(CommonConstant.RCA_WORKSHOP_TAG)){ if (!collect.contains(CommonConstant.RCA_WORKSHOP_TAG)) {
return false; return false;
}else { } else {
UserLikeGroup userLikeGroup = userLikeGroupService.getById(userLikeGroupId); UserLikeGroup userLikeGroup = userLikeGroupService.getById(userLikeGroupId);
// 不是原创的作品不能参与活动 // 不是原创的作品不能参与活动
if (userLikeGroup.getOriginal().equals(0)){ if (userLikeGroup.getOriginal().equals(0)) {
throw new BusinessException("only.original.works.can.participate.in.the.event", ResultEnum.PROMPT.getCode()); throw new BusinessException("only.original.works.can.participate.in.the.event", ResultEnum.PROMPT.getCode());
} }
List<Portfolio> byTag = baseMapper.getByTag(accountId, CommonConstant.RCA_WORKSHOP_TAG); List<Portfolio> byTag = baseMapper.getByTag(accountId, CommonConstant.RCA_WORKSHOP_TAG);
if (byTag.isEmpty()){ if (byTag.isEmpty()) {
return false; return false;
}else if (!Objects.isNull(portfolioId)){ } else if (!Objects.isNull(portfolioId)) {
boolean contains = byTag.stream().map(Portfolio::getId).collect(Collectors.toList()).contains(portfolioId); boolean contains = byTag.stream().map(Portfolio::getId).collect(Collectors.toList()).contains(portfolioId);
return !contains; return !contains;
}else { } else {
return true; return true;
} }
} }
@@ -1084,10 +1144,10 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
// 遍历数组添加到t_portfolio_tags表中没有id的tag添加到t_tags表中 // 遍历数组添加到t_portfolio_tags表中没有id的tag添加到t_tags表中
tagsDTOS.forEach(tag -> { tagsDTOS.forEach(tag -> {
Long tagId; Long tagId;
if (Objects.isNull(tag.getId())){ if (Objects.isNull(tag.getId())) {
Tags tags = tagsService.addTag(tag.getTagName()); Tags tags = tagsService.addTag(tag.getTagName());
tagId = tags.getId(); tagId = tags.getId();
}else { } else {
tagId = tag.getId(); tagId = tag.getId();
} }
portfolioTagsMapper.insertIgnore(portfolioId, tagId, LocalDateTime.now()); portfolioTagsMapper.insertIgnore(portfolioId, tagId, LocalDateTime.now());
@@ -1096,12 +1156,12 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
public PageBaseResponse<PortfolioVO> queryPortfolioByTag(String tagName, Long tagId, Integer page, Integer size) { public PageBaseResponse<PortfolioVO> queryPortfolioByTag(String tagName, Long tagId, Integer page, Integer size) {
long bestMatchTagId; long bestMatchTagId;
if (Objects.isNull(tagId)){ if (Objects.isNull(tagId)) {
List<Map<String, String>> matchingTags = tagsMapper.getMatchingTags(tagName); List<Map<String, String>> matchingTags = tagsMapper.getMatchingTags(tagName);
Map<String, String> tagMap = matchingTags.get(0); Map<String, String> tagMap = matchingTags.get(0);
bestMatchTagId = Long.parseLong(tagMap.get("id")); bestMatchTagId = Long.parseLong(tagMap.get("id"));
}else { } else {
bestMatchTagId = tagId; bestMatchTagId = tagId;
} }
@@ -1111,7 +1171,7 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
List<PortfolioTags> portfolioTags = portfolioTagsMapper.selectList(queryWrapper); List<PortfolioTags> portfolioTags = portfolioTagsMapper.selectList(queryWrapper);
List<Long> portfolioIdList = portfolioTags.stream().map(PortfolioTags::getPortfolioId).collect(Collectors.toList()); List<Long> portfolioIdList = portfolioTags.stream().map(PortfolioTags::getPortfolioId).collect(Collectors.toList());
if (!portfolioIdList.isEmpty()){ if (!portfolioIdList.isEmpty()) {
QueryWrapper<Portfolio> qw = new QueryWrapper<>(); QueryWrapper<Portfolio> qw = new QueryWrapper<>();
qw.in("id", portfolioIdList); qw.in("id", portfolioIdList);
Page<Portfolio> portfolioPage = baseMapper.selectPage(new Page<>(page, size), qw); Page<Portfolio> portfolioPage = baseMapper.selectPage(new Page<>(page, size), qw);
@@ -1134,7 +1194,7 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
return null; return null;
}); });
return PageBaseResponse.success(convert); return PageBaseResponse.success(convert);
}else { } else {
return PageBaseResponse.success(new Page<>()); return PageBaseResponse.success(new Page<>());
} }
@@ -1194,16 +1254,16 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
// 1、判断是否有按用户名查询 // 1、判断是否有按用户名查询
List<AccountFollowVO> followeeList; List<AccountFollowVO> followeeList;
if (!StringUtil.isNullOrEmpty(getFollowListDTO.getSearchByName())) { if (!StringUtil.isNullOrEmpty(getFollowListDTO.getSearchByName())) {
followeeList = userFollowMapper.getFolloweeListByName(getFollowListDTO.getSearchByName(), accountId); followeeList = userFollowMapper.getFolloweeListByName(getFollowListDTO.getSearchByName(), accountId);
}else { } else {
// 2、查全部 分页查询 // 2、查全部 分页查询
String order = StringUtil.isNullOrEmpty(getFollowListDTO.getOrder()) ? "DESC" : getFollowListDTO.getOrder().equals("DESC") ? "DESC" : "ASC"; String order = StringUtil.isNullOrEmpty(getFollowListDTO.getOrder()) ? "DESC" : getFollowListDTO.getOrder().equals("DESC") ? "DESC" : "ASC";
Integer limit= getFollowListDTO.getSize() > 0 ? getFollowListDTO.getSize() : 20; Integer limit = getFollowListDTO.getSize() > 0 ? getFollowListDTO.getSize() : 20;
Integer offset = getFollowListDTO.getPage() > 0 ? (getFollowListDTO.getPage() - 1) * getFollowListDTO.getSize() : 0; Integer offset = getFollowListDTO.getPage() > 0 ? (getFollowListDTO.getPage() - 1) * getFollowListDTO.getSize() : 0;
followeeList = userFollowMapper.getFolloweeListByFollower(accountId, limit, offset, order); followeeList = userFollowMapper.getFolloweeListByFollower(accountId, limit, offset, order);
} }
if (!followeeList.isEmpty()){ if (!followeeList.isEmpty()) {
followeeList.forEach(followee -> { followeeList.forEach(followee -> {
String avatar = StringUtil.isNullOrEmpty(followee.getAvatar()) ? CommonConstant.DEFAULT_AVATAR : followee.getAvatar(); String avatar = StringUtil.isNullOrEmpty(followee.getAvatar()) ? CommonConstant.DEFAULT_AVATAR : followee.getAvatar();
followee.setAvatar(minioUtil.getPreSignedUrl(avatar, CommonConstant.MINIO_IMAGE_EXPIRE_TIME)); followee.setAvatar(minioUtil.getPreSignedUrl(avatar, CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
@@ -1225,7 +1285,7 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
// 获取当前用户的所有粉丝 // 获取当前用户的所有粉丝
QueryWrapper<UserFollow> qw = new QueryWrapper<>(); QueryWrapper<UserFollow> qw = new QueryWrapper<>();
qw.eq("follower_id", accountId).select("followee_id","create_time"); qw.eq("follower_id", accountId).select("followee_id", "create_time");
List<UserFollow> userFollows = userFollowMapper.selectList(qw); List<UserFollow> userFollows = userFollowMapper.selectList(qw);
Map<Long, LocalDateTime> followeeMap = userFollows.stream().collect(Collectors.toMap(UserFollow::getFolloweeId, UserFollow::getCreateTime)); Map<Long, LocalDateTime> followeeMap = userFollows.stream().collect(Collectors.toMap(UserFollow::getFolloweeId, UserFollow::getCreateTime));
@@ -1233,15 +1293,15 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
// 1、判断是否有按用户名查询粉丝 // 1、判断是否有按用户名查询粉丝
if (!StringUtil.isNullOrEmpty(getFollowListDTO.getSearchByName())) { if (!StringUtil.isNullOrEmpty(getFollowListDTO.getSearchByName())) {
followerList = userFollowMapper.getFollowerListByName(getFollowListDTO.getSearchByName(), accountId); followerList = userFollowMapper.getFollowerListByName(getFollowListDTO.getSearchByName(), accountId);
}else { } else {
// 2、查全部 分页查询 // 2、查全部 分页查询
String order = StringUtil.isNullOrEmpty(getFollowListDTO.getOrder()) ? "DESC" : getFollowListDTO.getOrder().equals("DESC") ? "DESC" : "ASC"; String order = StringUtil.isNullOrEmpty(getFollowListDTO.getOrder()) ? "DESC" : getFollowListDTO.getOrder().equals("DESC") ? "DESC" : "ASC";
Integer limit= getFollowListDTO.getSize() > 0 ? getFollowListDTO.getSize() : 20; Integer limit = getFollowListDTO.getSize() > 0 ? getFollowListDTO.getSize() : 20;
Integer offset = getFollowListDTO.getPage() > 0 ? (getFollowListDTO.getPage() - 1) * getFollowListDTO.getSize() : 0; Integer offset = getFollowListDTO.getPage() > 0 ? (getFollowListDTO.getPage() - 1) * getFollowListDTO.getSize() : 0;
followerList = userFollowMapper.getFollowerListByFollowee(accountId, limit,offset, order); followerList = userFollowMapper.getFollowerListByFollowee(accountId, limit, offset, order);
} }
if (!followerList.isEmpty()){ if (!followerList.isEmpty()) {
// 判断当前用户是否与粉丝互关 // 判断当前用户是否与粉丝互关
followerList.forEach(follower -> { followerList.forEach(follower -> {
String avatar = StringUtil.isNullOrEmpty(follower.getAvatar()) ? CommonConstant.DEFAULT_AVATAR : follower.getAvatar(); String avatar = StringUtil.isNullOrEmpty(follower.getAvatar()) ? CommonConstant.DEFAULT_AVATAR : follower.getAvatar();
@@ -1271,10 +1331,11 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
/** /**
* 获取关注列表 * 获取关注列表
*
* @param accountId * @param accountId
* @return * @return
*/ */
public List<Long> getFolloweeList(Long accountId){ public List<Long> getFolloweeList(Long accountId) {
QueryWrapper<UserFollow> qw = new QueryWrapper<>(); QueryWrapper<UserFollow> qw = new QueryWrapper<>();
qw.eq("follower_id", accountId).select("followee_id"); qw.eq("follower_id", accountId).select("followee_id");
@@ -1282,22 +1343,22 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
return userFollows.stream().map(UserFollow::getFolloweeId).collect(Collectors.toList()); return userFollows.stream().map(UserFollow::getFolloweeId).collect(Collectors.toList());
} }
public void setPortfolioToPublic(Long portfolioId){ public void setPortfolioToPublic(Long portfolioId) {
// 判断当前用户与作品用户是不是一家公司的 // 判断当前用户与作品用户是不是一家公司的
Long accountId = UserContext.getUserHolder().getId(); Long accountId = UserContext.getUserHolder().getId();
Account currentAccount = accountMapper.selectById(accountId); Account currentAccount = accountMapper.selectById(accountId);
Portfolio portfolio = baseMapper.selectById(portfolioId); Portfolio portfolio = baseMapper.selectById(portfolioId);
if (Objects.isNull(portfolio)){ if (Objects.isNull(portfolio)) {
throw new BusinessException("unknown portfolio"); throw new BusinessException("unknown portfolio");
} }
if (Objects.nonNull(portfolio.getOrganizationId()) if (Objects.nonNull(portfolio.getOrganizationId())
&& Objects.nonNull(currentAccount.getOrganizationId()) && Objects.nonNull(currentAccount.getOrganizationId())
&& portfolio.getOrganizationId().equals(currentAccount.getOrganizationId())){ && portfolio.getOrganizationId().equals(currentAccount.getOrganizationId())) {
portfolio.setIsPublic(1); portfolio.setIsPublic(1);
portfolio.setUpdateDate(LocalDateTime.now()); portfolio.setUpdateDate(LocalDateTime.now());
baseMapper.updateById(portfolio); baseMapper.updateById(portfolio);
}else { } else {
throw new BusinessException("have.no.permission", ResultEnum.PROMPT.getCode()); throw new BusinessException("have.no.permission", ResultEnum.PROMPT.getCode());
} }
} }