Procházet zdrojové kódy

身份证审核

(cherry picked from commit 0379f45074fa63091883bd99825bdb2c7f8072d4)
licailing před 4 roky
rodič
revize
1f0ba5ef9c

+ 2 - 0
src/main/java/com/izouma/nineth/repo/IdentityAuthRepo.java

@@ -47,4 +47,6 @@ public interface IdentityAuthRepo extends JpaRepository<IdentityAuth, Long>, Jpa
     int deleteDuplicated(Long userId, Long id);
 
     List<IdentityAuth> findByUserIdInAndStatus(Iterable<Long> userId, AuthStatus status);
+
+    IdentityAuth findFirstByUserId(Long userId);
 }

+ 8 - 1
src/main/java/com/izouma/nineth/web/IdentityAuthController.java

@@ -27,7 +27,7 @@ public class IdentityAuthController extends BaseController {
     private IdentityAuthService identityAuthService;
     private IdentityAuthRepo    identityAuthRepo;
 
-    //    @PreAuthorize("hasAnyRole('ADMIN','OPERATOR')")
+    @PreAuthorize("hasAnyRole('ADMIN','OPERATOR')")
     @PostMapping("/all")
     public Page<IdentityAuth> all(@RequestBody PageQuery pageQuery) {
         return identityAuthService.all(pageQuery);
@@ -71,6 +71,7 @@ public class IdentityAuthController extends BaseController {
         identityAuthService.audit(id, AuthStatus.FAIL, reason);
     }
 
+    @PreAuthorize("hasAnyRole('ADMIN', 'OPERATOR')")
     @ApiOperation("查找重复身份证")
     @PostMapping("/repeat")
     public List<User> repeat(@RequestParam String idNo, @RequestParam Long userId) {
@@ -82,6 +83,7 @@ public class IdentityAuthController extends BaseController {
         identityAuthService.removeDuplicated();
     }
 
+    @PreAuthorize("hasAnyRole('ADMIN', 'OPERATOR')")
     @PostMapping("/autoAuth")
     public Object authAuth(@RequestParam Long id) {
         IdentityAuth identityAuth = identityAuthRepo.findById(id).orElseThrow(new BusinessException("无记录"));
@@ -89,5 +91,10 @@ public class IdentityAuthController extends BaseController {
         identityAuthService.audit(identityAuth.getId(), (AuthStatus) map.get("status"), (String) map.get("reason"));
         return map;
     }
+
+    @PostMapping("/my")
+    public String my(){
+        return identityAuthRepo.findFirstByUserId(SecurityUtils.getAuthenticatedUser().getId()).getStatus().toString();
+    }
 }