diff --git a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/asserts/OtherErrorCode.java b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/asserts/OtherErrorCode.java index 6c916ac6..e97b57b7 100644 --- a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/asserts/OtherErrorCode.java +++ b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/asserts/OtherErrorCode.java @@ -148,6 +148,12 @@ public enum OtherErrorCode implements IResponseErrorCode { * 红包过期时间配置错误 */ RED_PACKET_EXPIRE_TIME_ERROR(3271, "Invalid expire time configuration"), + + /** + * 靓号已存在 + */ + SPECIAL_ID_ALREADY_EXISTS(3272, "Special numbers already exist"), + ; private final int code; diff --git a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/user/user/impl/UserBeautifulNumberClientServiceImpl.java b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/user/user/impl/UserBeautifulNumberClientServiceImpl.java index bf05c3b9..90241bb3 100644 --- a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/user/user/impl/UserBeautifulNumberClientServiceImpl.java +++ b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/user/user/impl/UserBeautifulNumberClientServiceImpl.java @@ -17,6 +17,7 @@ import com.red.circle.other.infra.database.rds.entity.user.user.UserBeautifulNum import com.red.circle.other.infra.database.rds.service.user.user.UserBeautifulNumberApplyService; import com.red.circle.other.infra.database.rds.service.user.user.UserBeautifulNumberService; import com.red.circle.other.app.inner.convertor.user.UserProfileInnerConvertor; +import com.red.circle.other.inner.asserts.OtherErrorCode; import com.red.circle.other.inner.model.cmd.user.BeautifulNumberQryCmd; import com.red.circle.other.inner.model.cmd.user.UserBeautifulNumberApplyQryCmd; import com.red.circle.other.inner.model.cmd.user.UserBeautifulNumberCmd; @@ -78,6 +79,9 @@ public class UserBeautifulNumberClientServiceImpl implements userSpecialIdService.remove(userSpecialId.getId()); } + boolean exists = userSpecialIdService.exists(userRegion.getSysOrigin(), beautifulNumberApply.getApplyAccount()); + ResponseAssert.isFalse(OtherErrorCode.SPECIAL_ID_ALREADY_EXISTS, exists); + // 创建新靓号 UserSpecialId specialIdCmd = new UserSpecialId(); specialIdCmd.setSysOrigin(beautifulNumberApply.getSysOrigin());