[general] Fix all type mismatch with db

This commit is contained in:
samnyan
2020-12-25 14:15:04 +08:00
parent 6152e8ef0a
commit ff5eab48c7
78 changed files with 165 additions and 190 deletions

View File

@@ -28,15 +28,16 @@ public class CardService {
* @return Optional of a Card
*/
public Optional<Card> getCardByExtId(String extId) {
return cardRepository.findByExtId(Integer.parseInt(extId));
return cardRepository.findByExtId(Long.parseLong(extId));
}
/**
* Find a card by External Id
*
* @param extId External Id
* @return Optional of a Card
*/
public Optional<Card> getCardByExtId(int extId) {
public Optional<Card> getCardByExtId(Long extId) {
return cardRepository.findByExtId(extId);
}
@@ -57,9 +58,9 @@ public class CardService {
public Card registerByAccessCode(String accessCode) {
Card card = new Card();
card.setLuid(accessCode);
int extId = ThreadLocalRandom.current().nextInt(99999999);
long extId = ThreadLocalRandom.current().nextLong(99999999);
while (cardRepository.findByExtId(extId).isPresent()) {
extId = ThreadLocalRandom.current().nextInt(99999999);
extId = ThreadLocalRandom.current().nextLong(99999999);
}
card.setExtId(extId);
card.setRegisterTime(LocalDateTime.now());