退出团队新增白名单配置
This commit is contained in:
parent
2342be5b7d
commit
84e90d400c
@ -392,6 +392,11 @@ public enum EnumConfigKey {
|
||||
*/
|
||||
ROCKET_ROOM_LIST,
|
||||
|
||||
/**
|
||||
* 退出团队白名单(不校验1号16号)
|
||||
*/
|
||||
QUIT_TEAM_WHITELIST,
|
||||
|
||||
;
|
||||
|
||||
|
||||
|
||||
@ -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(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user