{"record":{"id":"ce7283a405d3b7a5","repo":"paascloud/paascloud-master","slug":"uac10011013","errorCode":"UAC10011013","errorMessage":"手机号已存在","messagePattern":"手机号已存在","errorType":"error_code","errorClass":"UacBizException","httpStatus":null,"severity":"warning","filePath":"paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/UacUserServiceImpl.java","lineNumber":967,"sourceCode":"\t\tPreconditions.checkArgument(!StringUtils.isEmpty(registerDto.getEmail()), ErrorCodeEnum.UAC10011018.msg());\n\t\tPreconditions.checkArgument(!StringUtils.isEmpty(mobileNo), \"手机号不能为空\");\n\t\tPreconditions.checkArgument(!StringUtils.isEmpty(registerDto.getLoginPwd()), ErrorCodeEnum.UAC10011014.msg());\n\t\tPreconditions.checkArgument(!StringUtils.isEmpty(registerDto.getConfirmPwd()), ErrorCodeEnum.UAC10011009.msg());\n\t\tPreconditions.checkArgument(!StringUtils.isEmpty(registerDto.getRegisterSource()), \"验证类型错误\");\n\t\tPreconditions.checkArgument(registerDto.getLoginPwd().equals(registerDto.getConfirmPwd()), \"两次密码不一致\");\n\n\t\tUacUser uacUser = new UacUser();\n\t\tuacUser.setLoginName(registerDto.getLoginName());\n\t\tint count = uacUserMapper.selectCount(uacUser);\n\t\tif (count > 0) {\n\t\t\tthrow new UacBizException(ErrorCodeEnum.UAC10011012);\n\t\t}\n\n\t\tuacUser = new UacUser();\n\t\tuacUser.setMobileNo(registerDto.getMobileNo());\n\t\tcount = uacUserMapper.selectCount(uacUser);\n\t\tif (count > 0) {\n\t\t\tthrow new UacBizException(ErrorCodeEnum.UAC10011013);\n\t\t}\n\n\t\tuacUser = new UacUser();\n\t\tuacUser.setEmail(registerDto.getEmail());\n\t\tcount = uacUserMapper.selectCount(uacUser);\n\t\tif (count > 0) {\n\t\t\tthrow new UacBizException(ErrorCodeEnum.UAC10011019);\n\t\t}\n\n\t}\n}\n","sourceCodeStart":949,"sourceCodeEnd":979,"githubUrl":"https://github.com/paascloud/paascloud-master/blob/781281a9503332ed3cef44ea618349d14230a127/paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/UacUserServiceImpl.java#L949-L979","documentation":"UAC10011013 is thrown during registration when a UacUser template with the requested mobileNo yields selectCount > 0, i.e. another account already uses that phone number. Registration is rejected with '手机号已存在' to keep mobile numbers unique.","triggerScenarios":"Registering with a phone number already bound to an existing account; re-registering while an older account still holds the number; shared/corporate phone numbers; concurrent registrations with the same mobileNo.","commonSituations":"Users switching accounts but reusing a phone; recycled phone numbers from carriers; test suites reusing fixture phone numbers; data imported from legacy systems keeping the old binding.","solutions":["Check availability first (SELECT COUNT(*) FROM uac_user WHERE mobile_no = ?) or use the mobile-availability validation endpoint.","If the number belongs to your old account, log in with it or unbind the mobile from that account before registering.","In tests, generate unique mobile numbers per run instead of fixed fixtures.","Add a DB UNIQUE constraint on mobile_no to prevent race-condition duplicates."],"exampleFix":"// before\nUacUser q = new UacUser(); q.setMobileNo(registerDto.getMobileNo());\nif (uacUserMapper.selectCount(q) > 0) { throw new UacBizException(ErrorCodeEnum.UAC10011013); }\n// after (client-side pre-check)\nif (!uacUserService.checkMobileAvailable(registerDto.getMobileNo())) {\n    return response(\"mobile number already registered\");\n}","handlingStrategy":"validation","validationCode":"UacUser q = new UacUser();\nq.setMobileNo(requestedMobile.trim());\nif (uacUserMapper.selectCount(q) > 0) {\n    return Result.fail(\"mobile number already registered\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    uacUserService.register(registerDto);\n} catch (UacBizException e) {\n    if (\"UAC10011013\".equals(e.getCode())) { return Result.fail(409, \"mobile number already exists\"); }\n    throw e;\n}","preventionTips":["Provide mobile availability validation before final submit.","Support unbinding a mobile from an old account so numbers can be reused.","Generate unique mobile fixtures in tests.","Add a UNIQUE index on mobile_no in the database."],"tags":["registration","duplicate","mobile","validation"],"backgroundTag":"record-already-exists","analyzedSha":"781281a9503332ed3cef44ea618349d14230a127","analyzedAt":"2026-09-10T10:59:02.070Z","contentChangedAt":"2026-09-10T10:59:02.070Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}