diff --git a/src/main/java/com/ai/da/service/impl/PortfolioServiceImpl.java b/src/main/java/com/ai/da/service/impl/PortfolioServiceImpl.java index a00e2da6..e4a85177 100644 --- a/src/main/java/com/ai/da/service/impl/PortfolioServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/PortfolioServiceImpl.java @@ -136,7 +136,7 @@ public class PortfolioServiceImpl extends ServiceImpl tags) { + public Boolean hasParticipatedRCAWorkshop(Long accountId, List tags, Long portfolioId, Long userLikeGroupId) { List collect = tags.stream().map(Tags::getTagName).collect(Collectors.toList()); if (!collect.contains(CommonConstant.RCA_WORKSHOP_TAG)){ return false; }else { + UserLikeGroup userLikeGroup = userLikeGroupService.getById(userLikeGroupId); + // 不是原创的作品不能参与活动 + if (userLikeGroup.getOriginal().equals(0)){ + throw new BusinessException("only.original.works.can.participate.in.the.event", ResultEnum.PROMPT.getCode()); + } List byTag = baseMapper.getByTag(accountId, CommonConstant.RCA_WORKSHOP_TAG); - return !byTag.isEmpty(); + if (byTag.isEmpty()){ + return false; + }else if (!Objects.isNull(portfolioId)){ + boolean contains = byTag.stream().map(Portfolio::getId).collect(Collectors.toList()).contains(portfolioId); + return !contains; + }else { + return true; + } } } diff --git a/src/main/resources/messages_en.properties b/src/main/resources/messages_en.properties index fa348dcb..f3f2bd85 100644 --- a/src/main/resources/messages_en.properties +++ b/src/main/resources/messages_en.properties @@ -140,6 +140,7 @@ slogan.image.cannot.be.empty=Slogan image cannot be empty. questionnaire.filled.out=You have filled out the current questionnaire. user.has.no.account=The current user has no account! you.have.participated.in.the.event=You have participated in the event. +only.original.works.can.participate.in.the.event=Sorry, only original works can participate in the event. # 可能会报异常 # Informative: diff --git a/src/main/resources/messages_zh.properties b/src/main/resources/messages_zh.properties index 6f07d92a..1a7d4e0f 100644 --- a/src/main/resources/messages_zh.properties +++ b/src/main/resources/messages_zh.properties @@ -134,7 +134,8 @@ slogan.style.cannot.be.empty=标语风格文本不能为空。 slogan.image.cannot.be.empty=标语图片不能为空。 questionnaire.filled.out=您已填写过当前问卷。 user.has.no.account=当前用户没有账号。 -you.have.participated.in.the.event=您已经参与活动 +you.have.participated.in.the.event=您已经参与活动。 +only.original.works.can.participate.in.the.event=抱歉,只有原创作品能参与活动。 # 可能会报异常 # Informative: