|
|
@@ -34,10 +34,7 @@ import org.springframework.web.bind.annotation.*;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.IOException;
|
|
|
import java.time.LocalDateTime;
|
|
|
-import java.util.Collections;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
|
|
|
@AllArgsConstructor
|
|
|
@RestController
|
|
|
@@ -434,15 +431,19 @@ public class UserController extends BaseController {
|
|
|
|
|
|
@GetMapping("/topTen")
|
|
|
public List<User> topTen() {
|
|
|
- Long id = SecurityUtils.getAuthenticatedUser().getId();
|
|
|
+
|
|
|
LocalDateTime time = LocalDateTime.now().plusDays(-7);
|
|
|
List<Map<String, String>> map = tokenHistoryRepo.top(time);
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
|
jsonArray.addAll(map);
|
|
|
List<User> users = jsonArray.toJavaList(User.class);
|
|
|
+ if (Objects.isNull(SecurityUtils.getAuthenticatedUser())) {
|
|
|
+ return users;
|
|
|
+ }
|
|
|
if (CollectionUtils.isEmpty(users)) {
|
|
|
return users;
|
|
|
}
|
|
|
+ Long id = SecurityUtils.getAuthenticatedUser().getId();
|
|
|
users.forEach(user -> {
|
|
|
List<Follow> follows = followRepo.findByUserIdAndFollowUserId(id, user.getId());
|
|
|
if (CollectionUtils.isNotEmpty(follows)) {
|