This commit is contained in:
77
2024-08-13 17:28:27 +08:00
parent f4f47f6656
commit 27e37ba812

View File

@@ -24,6 +24,7 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@@ -111,8 +112,11 @@ public class RankAppController {
Set<Long> userIds = rankNodeList.stream().map(RankNode::getUserId).collect(Collectors.toSet()); Set<Long> userIds = rankNodeList.stream().map(RankNode::getUserId).collect(Collectors.toSet());
List<User> userList = userService.listByIds(userIds); List<User> userList = userService.listByIds(userIds);
Map<Long, User> userMap = userList.stream().collect(Collectors.toMap(User::getId, Function.identity())); Map<Long, User> userMap = userList.stream().collect(Collectors.toMap(User::getId, Function.identity()));
List<AnchorStatusDTO> anchorStatusList = anchorMapper.anchorStatus(userList); Map<Long, AnchorStatusDTO> anchorStatusMap = new HashMap<>();
Map<Long, AnchorStatusDTO> anchorStatusMap = anchorStatusList.stream().collect(Collectors.toMap(AnchorStatusDTO::getUserId, Function.identity())); if(CollectionUtils.isNotEmpty(userIds)){
List<AnchorStatusDTO> anchorStatusList = anchorMapper.anchorStatus(userList);
anchorStatusMap = anchorStatusList.stream().collect(Collectors.toMap(AnchorStatusDTO::getUserId, Function.identity()));
}
long lastLove = 0; long lastLove = 0;
for (int i = 0; i < rankNodeList.size(); i++) { for (int i = 0; i < rankNodeList.size(); i++) {
RankNode rankNode = rankNodeList.get(i); RankNode rankNode = rankNodeList.get(i);