xiongzhu 4 年之前
父节点
当前提交
f45efd4a80
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      src/main/java/com/izouma/nineth/service/IdentityAuthService.java

+ 3 - 0
src/main/java/com/izouma/nineth/service/IdentityAuthService.java

@@ -27,6 +27,7 @@ import java.util.Arrays;
 import java.util.List;
 import java.util.List;
 import java.util.Optional;
 import java.util.Optional;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
 import java.util.regex.Pattern;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
 
 
@@ -141,11 +142,13 @@ public class IdentityAuthService {
     public void removeDuplicated() {
     public void removeDuplicated() {
         boolean hasMore = true;
         boolean hasMore = true;
         int pageNum = 1;
         int pageNum = 1;
+        AtomicInteger count = new AtomicInteger();
         while (hasMore) {
         while (hasMore) {
             Page<Long> page = identityAuthRepo.listUserId(PageRequest.of(pageNum, 100));
             Page<Long> page = identityAuthRepo.listUserId(PageRequest.of(pageNum, 100));
             List<Long> userIds = page.getContent();
             List<Long> userIds = page.getContent();
             userIds.parallelStream().forEach(userId -> {
             userIds.parallelStream().forEach(userId -> {
                 userRepo.findById(userId).ifPresent(user -> {
                 userRepo.findById(userId).ifPresent(user -> {
+                    log.info("removeDuplicated {}/{} ", count.incrementAndGet(), page.getTotalElements());
                     List<IdentityAuth> list = identityAuthRepo.findByUserId(userId);
                     List<IdentityAuth> list = identityAuthRepo.findByUserId(userId);
                     if (list.size() > 1) {
                     if (list.size() > 1) {
                         IdentityAuth auth = list.stream()
                         IdentityAuth auth = list.stream()