钻石兑换是否单独屏蔽公会长

This commit is contained in:
2025-04-16 11:55:50 +08:00
parent 9aebebbad5
commit 72467fecc2

View File

@@ -1,5 +1,7 @@
package com.accompany.business.service.exchange;
import com.accompany.business.constant.family.FamilyConstant;
import com.accompany.business.constant.guild.GuildConstant;
import com.accompany.business.dto.exchange.GoldExchangeDiamondConfigDto;
import com.accompany.business.model.HallGoldExchangeRecord;
import com.accompany.business.model.HallMember;
@@ -46,6 +48,7 @@ import java.io.IOException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Date;
import java.util.Set;
import java.util.concurrent.TimeUnit;
@Slf4j
@@ -114,20 +117,31 @@ public class GoldExchangeDiamondService {
throw new ServiceException(BusiStatus.GOLD_EXCHANGE_DIAMOND_CLOSE);
}
Set<Long> blockClanIds = exchangeDiamondConfigDto.getBlockClanIds();
if (Constant.ClanMode.FAMILY.equals(partitionInfo.getClanMode())) {
if (CollectionUtils.isNotEmpty(exchangeDiamondConfigDto.getBlockClanIds())) {
FamilyMember vaildFamilyMemberByUid = familyMemberService.getVaildFamilyMemberByUid(uid);
if (vaildFamilyMemberByUid != null && exchangeDiamondConfigDto.getBlockClanIds().contains(vaildFamilyMemberByUid.getFamilyId().longValue())) {
throw new ServiceException(BusiStatus.GOLD_EXCHANGE_DIAMOND_CLOSE);
}
FamilyMember vaildFamilyMemberByUid = familyMemberService.getVaildFamilyMemberByUid(uid);
if (CollectionUtils.isEmpty(blockClanIds) || vaildFamilyMemberByUid == null) {
return exchangeDiamondConfigDto;
}
Boolean blockClanElder = exchangeDiamondConfigDto.getBlockClanElder();
if (Boolean.FALSE.equals(blockClanElder) && FamilyConstant.RoleType.OWNER.equals(vaildFamilyMemberByUid.getRoleType())) {
return exchangeDiamondConfigDto;
}
if (blockClanIds.contains(vaildFamilyMemberByUid.getFamilyId().longValue())) {
throw new ServiceException(BusiStatus.GOLD_EXCHANGE_DIAMOND_CLOSE);
}
} else if (Constant.ClanMode.GUILD.equals(partitionInfo.getClanMode())) {
if (CollectionUtils.isNotEmpty(exchangeDiamondConfigDto.getBlockClanIds())) {
GuildMember vaildGuildMemberByUid = guildMemberService.getVaildGuildMemberByUid(uid);
if (vaildGuildMemberByUid != null && exchangeDiamondConfigDto.getBlockClanIds().contains(vaildGuildMemberByUid.getGuildId().longValue())) {
throw new ServiceException(BusiStatus.GOLD_EXCHANGE_DIAMOND_CLOSE);
}
GuildMember vaildGuildMemberByUid = guildMemberService.getVaildGuildMemberByUid(uid);
if (CollectionUtils.isEmpty(blockClanIds) || vaildGuildMemberByUid == null) {
return exchangeDiamondConfigDto;
}
Boolean blockClanElder = exchangeDiamondConfigDto.getBlockClanElder();
if (Boolean.FALSE.equals(blockClanElder) && GuildConstant.RoleType.OWNER.equals(vaildGuildMemberByUid.getRoleType())) {
return exchangeDiamondConfigDto;
}
if (blockClanIds.contains(vaildGuildMemberByUid.getGuildId().longValue())) {
throw new ServiceException(BusiStatus.GOLD_EXCHANGE_DIAMOND_CLOSE);
}
} else if (Constant.ClanMode.CLAN_HALL.equals(partitionInfo.getClanMode())) {
@@ -139,7 +153,7 @@ public class GoldExchangeDiamondService {
}
//01.09屏蔽指定公会id不给兑换
if (null != clan && CollectionUtils.isNotEmpty(exchangeDiamondConfigDto.getBlockClanIds())
if (null != clan && CollectionUtils.isNotEmpty(blockClanIds)
&& exchangeDiamondConfigDto.getBlockClanIds().contains(clan.getId())){
throw new ServiceException(BusiStatus.GOLD_EXCHANGE_DIAMOND_CLOSE);
}