xiongzhu 4 years ago
parent
commit
a63b6c8ab4
1 changed files with 7 additions and 2 deletions
  1. 7 2
      src/main/java/com/izouma/nineth/service/IdentityAuthService.java

+ 7 - 2
src/main/java/com/izouma/nineth/service/IdentityAuthService.java

@@ -125,8 +125,13 @@ public class IdentityAuthService {
             list.parallelStream().forEach(identityAuth -> {
                 boolean success = false;
                 String reason = null;
-
-                if (!Pattern.matches("[1-9]{1}[0-9]{5}(19|20)[0-9]{2}((0[1-9]{1})|(1[0-2]{1}))((0[1-9]{1})|([1-2]{1}[0-9]{1}|(3[0-1]{1})))[0-9]{3}[0-9x]{1}", identityAuth.getIdNo().toLowerCase())) {
+                User user = userRepo.findById(identityAuth.getUserId()).orElseThrow(new BusinessException("用户不存在"));
+                if (user.getAuthStatus() == AuthStatus.SUCCESS) {
+                    audit(identityAuth.getId(), AuthStatus.SUCCESS, null);
+                    return;
+                }
+                if (!Pattern.matches("[1-9]{1}[0-9]{5}(19|20)[0-9]{2}((0[1-9]{1})|(1[0-2]{1}))((0[1-9]{1})|([1-2]{1}[0-9]{1}|(3[0-1]{1})))[0-9]{3}[0-9x]{1}", identityAuth.getIdNo()
+                        .toLowerCase())) {
                     audit(identityAuth.getId(), AuthStatus.FAIL, "身份证格式错误");
                     return;
                 } else {