列表接口调整 退出接口联调

This commit is contained in:
tianfeng 2025-12-23 15:45:26 +08:00
parent b4a3aafd1b
commit 5b6c2c5f33
7 changed files with 33 additions and 8 deletions

View File

@ -73,6 +73,11 @@ public enum FamilyErrorCode implements IResponseErrorCode {
NOT_PERMISSION_VIEW(2512, "You do not have permission to view"), NOT_PERMISSION_VIEW(2512, "You do not have permission to view"),
/**
* 用户最近刚退出家族
*/
USER_RECENT_LEAVE(2513, "Your recently left a family. Please tryagain 1 day after leaving"),
; ;

View File

@ -12,6 +12,7 @@ import com.red.circle.other.app.util.OfficialNoticeUtils;
import com.red.circle.other.domain.gateway.user.UserProfileGateway; import com.red.circle.other.domain.gateway.user.UserProfileGateway;
import com.red.circle.other.domain.gateway.user.ability.UserRegionGateway; import com.red.circle.other.domain.gateway.user.ability.UserRegionGateway;
import com.red.circle.other.infra.common.family.FamilyCommon; import com.red.circle.other.infra.common.family.FamilyCommon;
import com.red.circle.other.infra.database.cache.key.FamilyKeys;
import com.red.circle.other.infra.database.rds.entity.family.FamilyMessage; import com.red.circle.other.infra.database.rds.entity.family.FamilyMessage;
import com.red.circle.other.infra.database.rds.service.family.FamilyMemberInfoService; import com.red.circle.other.infra.database.rds.service.family.FamilyMemberInfoService;
import com.red.circle.other.infra.database.rds.service.family.FamilyMessageService; import com.red.circle.other.infra.database.rds.service.family.FamilyMessageService;
@ -47,6 +48,8 @@ public class ApplyJoinFamilyExe {
public void execute(ApplyJoinFamilyCmd cmd) { public void execute(ApplyJoinFamilyCmd cmd) {
String string = redisService.getString(FamilyKeys.USER_LEAVE.getKey());
ResponseAssert.isNull(FamilyErrorCode.USER_RECENT_LEAVE, string);
ResponseAssert.isFalse(FamilyErrorCode.THERE_ARE_FAMILIES_ERROR, getExistFamilyByUserId(cmd)); ResponseAssert.isFalse(FamilyErrorCode.THERE_ARE_FAMILIES_ERROR, getExistFamilyByUserId(cmd));

View File

@ -19,6 +19,7 @@ import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
/** /**
* 家族列表查询. * 家族列表查询.
@ -34,7 +35,9 @@ public class FamilyListExe {
public PageResult<FamilyListCO> execute(FamilyListCmd cmd) { public PageResult<FamilyListCO> execute(FamilyListCmd cmd) {
Page<FamilyBaseInfo> page = new Page<>(); Page<FamilyBaseInfo> page = new Page<>();
IPage<FamilyBaseInfo> baseInfoIPage = familyBaseInfoService.page(page, IPage<FamilyBaseInfo> baseInfoIPage = familyBaseInfoService.page(page,
Wrappers.<FamilyBaseInfo>lambdaQuery().orderByDesc(TimestampBaseEntity::getCreateTime)); Wrappers.<FamilyBaseInfo>lambdaQuery()
.eq(StringUtils.hasText(cmd.getFamilyAccount()), FamilyBaseInfo::getFamilyAccount, cmd.getFamilyAccount())
.orderByDesc(TimestampBaseEntity::getCreateTime));
PageResult<FamilyListCO> pageResult = new PageResult<>(); PageResult<FamilyListCO> pageResult = new PageResult<>();
pageResult.setCurrent(page.getCurrent()); pageResult.setCurrent(page.getCurrent());

View File

@ -108,7 +108,8 @@ public class FamilyServiceImpl implements FamilyService {
@Override @Override
public Long create(FamilyCreateCmd cmd) { public Long create(FamilyCreateCmd cmd) {
return familyCreateExe.execute(cmd); String key = "FAMILY_CREATE_KEY" + ":" + cmd.getReqUserId();
return distributedLockUtil.executeWithLock(key, () -> familyCreateExe.execute(cmd));
} }
@Override @Override

View File

@ -11,4 +11,6 @@ import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class FamilyListCmd extends PageQueryCmd { public class FamilyListCmd extends PageQueryCmd {
private String familyAccount;
} }

View File

@ -3,6 +3,7 @@ package com.red.circle.other.infra.common.family;
import com.google.common.base.Throwables; import com.google.common.base.Throwables;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import com.red.circle.component.redis.service.RedisService;
import com.red.circle.external.inner.endpoint.message.ImGroupMemberClient; import com.red.circle.external.inner.endpoint.message.ImGroupMemberClient;
import com.red.circle.external.inner.model.cmd.message.GroupMemberAddCmd; import com.red.circle.external.inner.model.cmd.message.GroupMemberAddCmd;
import com.red.circle.external.inner.model.cmd.message.GroupMemberRemoveCmd; import com.red.circle.external.inner.model.cmd.message.GroupMemberRemoveCmd;
@ -10,6 +11,7 @@ import com.red.circle.framework.core.asserts.ResponseAssert;
import com.red.circle.other.domain.gateway.user.UserProfileGateway; import com.red.circle.other.domain.gateway.user.UserProfileGateway;
import com.red.circle.other.domain.gateway.user.ability.UserRegionGateway; import com.red.circle.other.domain.gateway.user.ability.UserRegionGateway;
import com.red.circle.other.infra.convertor.material.BadgeInfraConvertor; import com.red.circle.other.infra.convertor.material.BadgeInfraConvertor;
import com.red.circle.other.infra.database.cache.key.FamilyKeys;
import com.red.circle.other.infra.database.cache.service.other.FamilyLevelCacheService; import com.red.circle.other.infra.database.cache.service.other.FamilyLevelCacheService;
import com.red.circle.other.infra.database.rds.entity.badge.BadgeBackpack; import com.red.circle.other.infra.database.rds.entity.badge.BadgeBackpack;
import com.red.circle.other.infra.database.rds.entity.badge.BadgePictureConfig; import com.red.circle.other.infra.database.rds.entity.badge.BadgePictureConfig;
@ -49,6 +51,7 @@ import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.Optional; import java.util.Optional;
import java.util.Set; import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -83,6 +86,7 @@ public class FamilyCommon {
private final FamilyLevelConfigService familyLevelConfigService; private final FamilyLevelConfigService familyLevelConfigService;
private final BadgePictureConfigService badgePictureConfigService; private final BadgePictureConfigService badgePictureConfigService;
private final FamilyMemberWeekExpService familyMemberWeekExpService; private final FamilyMemberWeekExpService familyMemberWeekExpService;
private final RedisService redisService;
/** /**
@ -538,13 +542,13 @@ public class FamilyCommon {
familyMemberWeekExpService familyMemberWeekExpService
.deleteBySysOriginMemberId(member.getId(), member.getSysOrigin()); .deleteBySysOriginMemberId(member.getId(), member.getSysOrigin());
deleteFamilyAwardByUserId(member.getMemberUserId()); redisService.setString(FamilyKeys.USER_LEAVE.getKey(), member.getMemberUserId(), 1, TimeUnit.DAYS);
userProfileGateway.removeUseProps(member.getMemberUserId(), // deleteFamilyAwardByUserId(member.getMemberUserId());
PropsCommodityType.AVATAR_FRAME.name()); // userProfileGateway.removeUseProps(member.getMemberUserId(),PropsCommodityType.AVATAR_FRAME.name());
userProfileGateway.removeCacheAll(member.getMemberUserId()); // userProfileGateway.removeCacheAll(member.getMemberUserId());
removeGroup(member.getFamilyId(), member.getMemberUserId()); // removeGroup(member.getFamilyId(), member.getMemberUserId());
} }
/** /**

View File

@ -26,7 +26,14 @@ public enum FamilyKeys implements RedisKeys {
/** /**
* 周奖励开始结束时间 周一 / 周日. * 周奖励开始结束时间 周一 / 周日.
*/ */
FAMILY_WEEK_REWARD_TIME; FAMILY_WEEK_REWARD_TIME,
/**
* 用户离开家族
*/
USER_LEAVE,
;
@Override @Override
public String businessPrefix() { public String businessPrefix() {