[aimedb] Change extId type to integer

This commit is contained in:
samnyan
2020-01-31 11:27:21 +08:00
parent 95512aa843
commit 955e5727d5
26 changed files with 35 additions and 31 deletions

View File

@@ -52,7 +52,11 @@ public class RegisterHandler implements BaseHandler {
if(cardRepository.findByLuid((String) requestMap.get("luid")).isEmpty()) {
Card card = new Card();
card.setLuid((String) requestMap.get("luid"));
card.setExtId(ThreadLocalRandom.current().nextLong(99999999));
int extId = ThreadLocalRandom.current().nextInt(99999999);
while (cardRepository.findByExtId(extId).isPresent()) {
extId = ThreadLocalRandom.current().nextInt(99999999);
}
card.setExtId(extId);
card.setRegisterTime(LocalDateTime.now());
card.setAccessTime(LocalDateTime.now());