From 66cccd08676b7f482a3e8f0fbc51143fc7ddc06a Mon Sep 17 00:00:00 2001 From: xupei Date: Wed, 9 Oct 2024 15:40:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=A0=A1=E9=AA=8C=EF=BC=8C?= =?UTF-8?q?=E4=BA=8C=E5=88=9B=E4=BD=9C=E5=93=81=E4=B8=8D=E8=83=BD=E5=8F=82?= =?UTF-8?q?=E4=B8=8E=E6=B4=BB=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../da/service/impl/PortfolioServiceImpl.java | 18 +++++++++++++++--- src/main/resources/messages_en.properties | 1 + src/main/resources/messages_zh.properties | 3 ++- 3 files changed, 18 insertions(+), 4 deletions(-) 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: