创建家族去除校验 家族申请新增区域限制
This commit is contained in:
parent
a4b8da5a8f
commit
8228be28db
@ -63,7 +63,6 @@ public class FamilyRestController extends BaseController {
|
|||||||
* 创建家族.
|
* 创建家族.
|
||||||
*/
|
*/
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
@JsonSerialize(using = ToStringSerializer.class)
|
|
||||||
public Long create(@RequestBody @Validated FamilyCreateCmd cmd) {
|
public Long create(@RequestBody @Validated FamilyCreateCmd cmd) {
|
||||||
return familyService.create(cmd);
|
return familyService.create(cmd);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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.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.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.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.FamilyMemberInfoService;
|
||||||
import com.red.circle.other.infra.database.rds.service.family.FamilyMessageService;
|
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.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.DynamicErrorCode;
|
||||||
import com.red.circle.other.inner.asserts.FamilyErrorCode;
|
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.enums.FamilyMessageStatusEnum;
|
||||||
import com.red.circle.other.inner.model.dto.famliy.FamilyDetailsDTO;
|
import com.red.circle.other.inner.model.dto.famliy.FamilyDetailsDTO;
|
||||||
|
|
||||||
@ -44,6 +48,7 @@ public class ApplyJoinFamilyExe {
|
|||||||
|
|
||||||
private final RedisService redisService;
|
private final RedisService redisService;
|
||||||
private final FamilyCommon familyCommon;
|
private final FamilyCommon familyCommon;
|
||||||
|
private final UserRegionGateway userRegionGateway;
|
||||||
private final FamilyMessageService familyMessageService;
|
private final FamilyMessageService familyMessageService;
|
||||||
private final FamilyMemberInfoService familyMemberInfoService;
|
private final FamilyMemberInfoService familyMemberInfoService;
|
||||||
|
|
||||||
@ -58,12 +63,16 @@ public class ApplyJoinFamilyExe {
|
|||||||
|
|
||||||
ResponseAssert.isFalse(FamilyErrorCode.REPEAT_APPLICATION, getExistApplyingMsg(cmd));
|
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
|
ResponseAssert
|
||||||
.isTrue(FamilyErrorCode.FAMILY_MEMBER_MAX, levelCacheCO.getMaxMember() > familyMemberCount);
|
.isTrue(FamilyErrorCode.FAMILY_MEMBER_MAX, familyDetails.getMaxMember() > familyMemberCount);
|
||||||
|
|
||||||
saveMsg(cmd);
|
saveMsg(cmd);
|
||||||
|
|
||||||
@ -84,10 +93,6 @@ public class ApplyJoinFamilyExe {
|
|||||||
return familyMemberInfoService.getFamilyMemberCount(levelCacheCO.getFamilyId());
|
return familyMemberInfoService.getFamilyMemberCount(levelCacheCO.getFamilyId());
|
||||||
}
|
}
|
||||||
|
|
||||||
private FamilyDetailsDTO getFamilyLevel(ApplyJoinFamilyCmd cmd) {
|
|
||||||
return familyCommon.getFamilyDetails(cmd.getReqSysOrigin().getOrigin(), cmd.getFamilyId());
|
|
||||||
}
|
|
||||||
|
|
||||||
private Boolean getExistApplyingMsg(ApplyJoinFamilyCmd cmd) {
|
private Boolean getExistApplyingMsg(ApplyJoinFamilyCmd cmd) {
|
||||||
ResponseAssert.notNull(CommonErrorCode.DATA_ERROR, cmd.getFamilyId());
|
ResponseAssert.notNull(CommonErrorCode.DATA_ERROR, cmd.getFamilyId());
|
||||||
ResponseAssert.notNull(CommonErrorCode.DATA_ERROR, cmd.getReqUserId());
|
ResponseAssert.notNull(CommonErrorCode.DATA_ERROR, cmd.getReqUserId());
|
||||||
|
|||||||
@ -211,7 +211,7 @@ public class FamilyCreateExe {
|
|||||||
|
|
||||||
private void checkParam(FamilyCreateCmd cmd) {
|
private void checkParam(FamilyCreateCmd cmd) {
|
||||||
ResponseAssert.isFalse(ResponseErrorCode.REQUEST_PARAMETER_ERROR, StringUtils.isBlanks(
|
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.getFamilyName()));
|
||||||
// ResponseAssert.isFalse(DynamicErrorCode.SENSITIVE_WORD_ERROR, SensitiveWordFilter.checkSensitiveWord(cmd.getFamilyIntro()));
|
// ResponseAssert.isFalse(DynamicErrorCode.SENSITIVE_WORD_ERROR, SensitiveWordFilter.checkSensitiveWord(cmd.getFamilyIntro()));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user