diff --git a/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/family/FamilyRestController.java b/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/family/FamilyRestController.java index 51fd0958..52968b7b 100644 --- a/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/family/FamilyRestController.java +++ b/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/family/FamilyRestController.java @@ -63,7 +63,6 @@ public class FamilyRestController extends BaseController { * 创建家族. */ @PostMapping("/create") - @JsonSerialize(using = ToStringSerializer.class) public Long create(@RequestBody @Validated FamilyCreateCmd cmd) { return familyService.create(cmd); } diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/family/ApplyJoinFamilyExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/family/ApplyJoinFamilyExe.java index a9f1b1fb..bfb992e7 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/family/ApplyJoinFamilyExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/family/ApplyJoinFamilyExe.java @@ -13,12 +13,16 @@ 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.common.family.FamilyCommon; import com.red.circle.other.infra.database.cache.key.FamilyKeys; +import com.red.circle.other.infra.database.rds.entity.family.FamilyMemberInfo; import com.red.circle.other.infra.database.rds.entity.family.FamilyMessage; +import com.red.circle.other.infra.database.rds.service.family.FamilyBaseInfoService; 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.enums.family.FamilyMsgTypeEnum; +import com.red.circle.other.infra.enums.family.FamilyRoleEnum; import com.red.circle.other.inner.asserts.DynamicErrorCode; import com.red.circle.other.inner.asserts.FamilyErrorCode; +import com.red.circle.other.inner.asserts.user.UserRelationErrorCode; import com.red.circle.other.inner.enums.FamilyMessageStatusEnum; import com.red.circle.other.inner.model.dto.famliy.FamilyDetailsDTO; @@ -44,6 +48,7 @@ public class ApplyJoinFamilyExe { private final RedisService redisService; private final FamilyCommon familyCommon; + private final UserRegionGateway userRegionGateway; private final FamilyMessageService familyMessageService; private final FamilyMemberInfoService familyMemberInfoService; @@ -58,12 +63,16 @@ public class ApplyJoinFamilyExe { ResponseAssert.isFalse(FamilyErrorCode.REPEAT_APPLICATION, getExistApplyingMsg(cmd)); - FamilyDetailsDTO levelCacheCO = getFamilyLevel(cmd); + FamilyDetailsDTO familyDetails = familyCommon.getFamilyDetails(cmd.getReqSysOrigin().getOrigin(), cmd.getFamilyId()); - Integer familyMemberCount = getFamilyMemberCount(levelCacheCO); + FamilyMemberInfo admin = familyMemberInfoService.getAdmin(cmd.getFamilyId(), FamilyRoleEnum.ADMIN.name()); + boolean eqRegion = userRegionGateway.checkEqRegion(cmd.getReqUserId(), admin.getMemberUserId()); + ResponseAssert.isTrue(UserRelationErrorCode.UNAVAILABLE_NOT_REGION, eqRegion); + + Integer familyMemberCount = getFamilyMemberCount(familyDetails); ResponseAssert - .isTrue(FamilyErrorCode.FAMILY_MEMBER_MAX, levelCacheCO.getMaxMember() > familyMemberCount); + .isTrue(FamilyErrorCode.FAMILY_MEMBER_MAX, familyDetails.getMaxMember() > familyMemberCount); saveMsg(cmd); @@ -84,10 +93,6 @@ public class ApplyJoinFamilyExe { return familyMemberInfoService.getFamilyMemberCount(levelCacheCO.getFamilyId()); } - private FamilyDetailsDTO getFamilyLevel(ApplyJoinFamilyCmd cmd) { - return familyCommon.getFamilyDetails(cmd.getReqSysOrigin().getOrigin(), cmd.getFamilyId()); - } - private Boolean getExistApplyingMsg(ApplyJoinFamilyCmd cmd) { ResponseAssert.notNull(CommonErrorCode.DATA_ERROR, cmd.getFamilyId()); ResponseAssert.notNull(CommonErrorCode.DATA_ERROR, cmd.getReqUserId()); diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/family/FamilyCreateExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/family/FamilyCreateExe.java index a97ee416..ba465ffe 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/family/FamilyCreateExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/family/FamilyCreateExe.java @@ -211,7 +211,7 @@ public class FamilyCreateExe { private void checkParam(FamilyCreateCmd cmd) { ResponseAssert.isFalse(ResponseErrorCode.REQUEST_PARAMETER_ERROR, StringUtils.isBlanks( - cmd.getFamilyAvatar(), cmd.getFamilyIntro(), cmd.getFamilyName())); + cmd.getFamilyAvatar(), cmd.getFamilyName())); //敏感词 // ResponseAssert.isFalse(DynamicErrorCode.SENSITIVE_WORD_ERROR, SensitiveWordFilter.checkSensitiveWord(cmd.getFamilyName())); // ResponseAssert.isFalse(DynamicErrorCode.SENSITIVE_WORD_ERROR, SensitiveWordFilter.checkSensitiveWord(cmd.getFamilyIntro()));