TASK:作品更新接口,将通过projectId替换userLikeGroupId

This commit is contained in:
2025-07-17 17:21:14 +08:00
parent 0155154664
commit 20f7dc0ef9
2 changed files with 16 additions and 6 deletions

View File

@@ -1,7 +1,10 @@
package com.ai.da.model.dto; package com.ai.da.model.dto;
import com.ai.da.mapper.primary.entity.Portfolio; import com.ai.da.mapper.primary.entity.Portfolio;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.List; import java.util.List;
@Data @Data
@@ -10,5 +13,7 @@ public class PortfolioDTO extends Portfolio {
private List<TagsDTO> tagsDTO; private List<TagsDTO> tagsDTO;
@ApiModelProperty("项目id")
@NotNull
private Long projectId; private Long projectId;
} }

View File

@@ -147,9 +147,9 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
throw new BusinessException("The title of the published work has been used."); throw new BusinessException("The title of the published work has been used.");
} }
// 判断用户是否参与#RCAworkshop_2024的活动 // 判断用户是否参与#RCAworkshop_2024的活动
if (hasParticipatedRCAWorkshop(authPrincipalVo.getId(), portfolioDTO.getTagsDTO(), portfolioDTO.getId(), portfolioDTO.getUserLikeGroupId())){ // if (hasParticipatedRCAWorkshop(authPrincipalVo.getId(), portfolioDTO.getTagsDTO(), portfolioDTO.getId(), portfolioDTO.getUserLikeGroupId())){
throw new BusinessException("you.have.participated.in.the.event", ResultEnum.PROMPT.getCode()); // throw new BusinessException("you.have.participated.in.the.event", ResultEnum.PROMPT.getCode());
} // }
if (file != null && file.getOriginalFilename() != null) { if (file != null && file.getOriginalFilename() != null) {
Long portfolioId; Long portfolioId;
// 上传画布到minio // 上传画布到minio
@@ -295,7 +295,12 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
throw new BusinessException("The title of the published work has been used."); throw new BusinessException("The title of the published work has been used.");
} }
if (portfolioDTO.getPortfolioType().equals("History")) { if (portfolioDTO.getPortfolioType().equals("History")) {
UserLikeGroup userLikeGroup = userLikeGroupMapper.selectById(portfolioDTO.getUserLikeGroupId()); UserLikeGroup likeGroup = userLikeGroupMapper.selectOne(new QueryWrapper<UserLikeGroup>().eq("project_id", portfolioDTO.getProjectId()));
if (Objects.isNull(likeGroup)){
return null;
}
Long userLikeGroupId = likeGroup.getId();
UserLikeGroup userLikeGroup = userLikeGroupMapper.selectById(userLikeGroupId);
UserLikeGroup userLikeGroupNew = userLikeGroup.setId(null); UserLikeGroup userLikeGroupNew = userLikeGroup.setId(null);
userLikeGroupNew.setAccountId(-1L); userLikeGroupNew.setAccountId(-1L);
Long collectionIdOld = userLikeGroup.getCollectionId(); Long collectionIdOld = userLikeGroup.getCollectionId();
@@ -316,7 +321,7 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
collectionElementRelationNew.setElementId(element.getId()); collectionElementRelationNew.setElementId(element.getId());
collectionElementRelationMapper.insert(collectionElementRelationNew); collectionElementRelationMapper.insert(collectionElementRelationNew);
} }
Portfolio portfolio = getPortfolioByUserGroupIdSource(portfolioDTO.getUserLikeGroupId()); Portfolio portfolio = getPortfolioByUserGroupIdSource(userLikeGroupId);
Long coverIdOld = portfolioDTO.getCoverId(); Long coverIdOld = portfolioDTO.getCoverId();
portfolio.setPortfolioName(portfolioDTO.getPortfolioName()); portfolio.setPortfolioName(portfolioDTO.getPortfolioName());
// portfolio.setPortfolioType("History"); // portfolio.setPortfolioType("History");
@@ -328,7 +333,7 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
portfolio.setIsDeleted(0); portfolio.setIsDeleted(0);
portfolioMapper.updateById(portfolio); portfolioMapper.updateById(portfolio);
List<UserLike> userLikeList = userLikeService.getUserLikeList(portfolioDTO.getUserLikeGroupId()); List<UserLike> userLikeList = userLikeService.getUserLikeList(userLikeGroupId);
Long coverIdNew = null; Long coverIdNew = null;
Boolean flag = false; Boolean flag = false;