From 84e90d400ca1b7dcd5e02b5cd6e3b8146fe3e97d Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Fri, 5 Dec 2025 11:02:31 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=80=E5=87=BA=E5=9B=A2=E9=98=9F=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E7=99=BD=E5=90=8D=E5=8D=95=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inner/enums/config/EnumConfigKey.java | 5 ++++ .../command/team/TeamUserApplyQuitExe.java | 27 ++++++++++++++++--- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/enums/config/EnumConfigKey.java b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/enums/config/EnumConfigKey.java index 393dd17a..6a3bb611 100644 --- a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/enums/config/EnumConfigKey.java +++ b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/enums/config/EnumConfigKey.java @@ -392,6 +392,11 @@ public enum EnumConfigKey { */ ROCKET_ROOM_LIST, + /** + * 退出团队白名单(不校验1号16号) + */ + QUIT_TEAM_WHITELIST, + ; diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/team/TeamUserApplyQuitExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/team/TeamUserApplyQuitExe.java index 23642789..0a5765eb 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/team/TeamUserApplyQuitExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/team/TeamUserApplyQuitExe.java @@ -1,5 +1,6 @@ package com.red.circle.other.app.command.team; +import com.alibaba.cloud.commons.lang.StringUtils; import com.red.circle.common.business.enums.OperationUserOrigin; import com.red.circle.framework.core.asserts.ResponseAssert; import com.red.circle.framework.core.response.CommonErrorCode; @@ -7,6 +8,7 @@ import com.red.circle.other.app.convertor.user.UserProfileAppConvertor; import com.red.circle.other.app.dto.cmd.team.TeamUserApplyCmd; import com.red.circle.other.domain.gateway.user.UserProfileGateway; import com.red.circle.other.domain.gateway.user.ability.UserRegionGateway; +import com.red.circle.other.infra.database.cache.service.other.EnumConfigCacheService; import com.red.circle.other.infra.database.mongo.entity.team.team.TeamApplicationProcess; import com.red.circle.other.infra.database.mongo.entity.team.team.TeamMember; import com.red.circle.other.infra.database.mongo.entity.team.team.TeamProfile; @@ -16,6 +18,7 @@ import com.red.circle.other.infra.database.mongo.service.team.team.TeamProfileSe import com.red.circle.other.infra.database.rds.entity.team.TeamTerminationFeeRecord; import com.red.circle.other.infra.database.rds.service.team.TeamTerminationFeeRecordService; import com.red.circle.other.inner.asserts.user.UserRelationErrorCode; +import com.red.circle.other.inner.enums.config.EnumConfigKey; import com.red.circle.other.inner.model.dto.user.UserProfileDTO; import com.red.circle.other.inner.model.dto.user.reigon.HostApplyQuitTeamCheckDTO; import com.red.circle.other.inner.asserts.team.TeamErrorCode; @@ -33,6 +36,7 @@ import com.red.circle.wallet.inner.model.dto.WalletReceiptResDTO; import com.red.circle.wallet.inner.model.enums.GoldOrigin; import java.math.BigDecimal; import java.time.LocalDate; +import java.util.Arrays; import java.util.Objects; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; @@ -55,13 +59,12 @@ public class TeamUserApplyQuitExe { private final UserProfileAppConvertor userProfileAppConvertor; private final TeamApplicationProcessService teamApplicationProcessService; private final TeamTerminationFeeRecordService teamTerminationFeeRecordService; + private final EnumConfigCacheService enumConfigCacheService; public String execute(TeamUserApplyCmd cmd) { - // 校验退出日期:只有每月1号和16号可以退出 - LocalDate now = ZonedDateTimeAsiaRiyadhUtils.now().toLocalDate(); - int dayOfMonth = now.getDayOfMonth(); - ResponseAssert.isTrue(TeamErrorCode.QUIT_DATE_INVALID, dayOfMonth == 1 || dayOfMonth == 16); + // 校验日期和白名单 + checkWhiteAndDate(cmd); UserProfileDTO userProfile = userProfileAppConvertor.toUserProfileDTO( userProfileGateway.getByUserId(cmd.getReqUserId())); @@ -100,6 +103,22 @@ public class TeamUserApplyQuitExe { return Objects.toString(messageId); } + private void checkWhiteAndDate(TeamUserApplyCmd cmd) { + String value = enumConfigCacheService.getValue(EnumConfigKey.QUIT_TEAM_WHITELIST, cmd.requireReqSysOrigin()); + if (StringUtils.isNotBlank(value)) { + String[] split = value.split(","); + boolean contains = Arrays.stream(split).toList().contains(String.valueOf(cmd.getReqUserId())); + if (contains) { + return; + } + } + + // 校验退出日期:只有每月1号和16号可以退出 + LocalDate now = ZonedDateTimeAsiaRiyadhUtils.now().toLocalDate(); + int dayOfMonth = now.getDayOfMonth(); + ResponseAssert.isTrue(TeamErrorCode.QUIT_DATE_INVALID, dayOfMonth == 1 || dayOfMonth == 16); + } + private void checkAndPaymentTerminationFee(TeamUserApplyCmd cmd, Long messageId) { HostApplyQuitTeamCheckDTO hostApplyQuitTeamCheckDTO = userRegionGateway.getHostApplyQuitTeamCheckByUserId(