Commit e8fb276a authored by renjie's avatar renjie

子用户bug

parent 13ddf354
......@@ -690,19 +690,18 @@ public class AccountServiceImpl implements AccountService {
throw new ClientRequestException(AccountErrorCode.CHILDMAX, "account cannot have more children");
}
int nameNumber = existing.getChildCount();
int count = existing.getChildCount();
int time = subUsersRequestDto.getAmount();
for (int i = 0; i < time; i++) {
if (nameNumber >= 1000)
if (count >= 1000)
throw new ClientRequestException(AccountErrorCode.CHILDMAX, "account cannot have more children");
AccountDto user = new AccountDto();
nameNumber++;
if (nameNumber < 10)
user.setName(existing.getName() + "00" + nameNumber);
else if (nameNumber < 100)
user.setName(existing.getName() + "0" + nameNumber);
if (i < 10)
user.setName(existing.getName() + "00" + i);
else if (i< 100)
user.setName(existing.getName() + "0" + i);
else
user.setName(existing.getName() + nameNumber);
user.setName(existing.getName() + i);
Account child = repository.findByName(user.getName());
if (child != null) {
......@@ -746,9 +745,10 @@ public class AccountServiceImpl implements AccountService {
// emailService.sendEmailVerification(user.getUsername(), user.getEmail(), user.getVerificationCode());
log.info("new account has been created: " + account.getName());
count++;
}
existing.setChildCount(nameNumber);
existing.setChildCount(count);
repository.save(existing);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment