|
|
@@ -624,7 +624,7 @@ public class ChatGptAccountServiceImpl implements ChatGptAccountService {
|
|
|
* 获取车队信息
|
|
|
*/
|
|
|
@Override
|
|
|
- public Set<ChatgptCarInfoView> getCarInfoList(String userToken) {
|
|
|
+ public Set<ChatgptCarInfoView> getCarInfoList(String userToken, Integer limit, Boolean isPlus) {
|
|
|
SearchResult<ChatGptUserConversationRecordHistoryView> search = beanSearcher.search(ChatGptUserConversationRecordHistoryView.class, MapUtils.builder().field("userToken", userToken).limit(0, 2).build());
|
|
|
Set<ChatgptCarInfoView> res = search.getDataList().stream()
|
|
|
.map((historyView) -> {
|
|
|
@@ -635,7 +635,7 @@ public class ChatGptAccountServiceImpl implements ChatGptAccountService {
|
|
|
return chatgptCarInfoView;
|
|
|
}).collect(Collectors.toCollection(LinkedHashSet::new));
|
|
|
|
|
|
- Set<ChatgptCarInfoView> lowestScoreFleets = getLowestScoreFleets(10);
|
|
|
+ Set<ChatgptCarInfoView> lowestScoreFleets = getLowestScoreFleets(limit, isPlus);
|
|
|
|
|
|
res.addAll(lowestScoreFleets);
|
|
|
|
|
|
@@ -685,7 +685,7 @@ public class ChatGptAccountServiceImpl implements ChatGptAccountService {
|
|
|
|
|
|
|
|
|
// 获取得分最低的N个车队的方法
|
|
|
- public Set<ChatgptCarInfoView> getLowestScoreFleets(int count) {
|
|
|
+ public Set<ChatgptCarInfoView> getLowestScoreFleets(int count, Boolean isPlus) {
|
|
|
Set<ZSetOperations.TypedTuple<Object>> lowestScorecarIds;
|
|
|
Long fleetsSize = redisService.zCard(RedisService.key.CHATGPT_CAR_SCORES.getName());
|
|
|
// 构建ChatgptCarInfoView集合
|
|
|
@@ -698,7 +698,7 @@ public class ChatGptAccountServiceImpl implements ChatGptAccountService {
|
|
|
}
|
|
|
lowestScorecarIds = redisService.zRangeWithScores(RedisService.key.CHATGPT_CAR_SCORES.getName(), 0L, count - 1);
|
|
|
Map<Object, Double> collect = lowestScorecarIds.stream().collect(Collectors.toMap(ZSetOperations.TypedTuple::getValue, ZSetOperations.TypedTuple::getScore));
|
|
|
- List<ChatgptSession> chatgptSessions = chatgptSessionMapper.selectList(Wrappers.lambdaQuery(ChatgptSession.class).in(ChatgptSession::getCarId, collect.keySet()));
|
|
|
+ List<ChatgptSession> chatgptSessions = chatgptSessionMapper.selectList(Wrappers.lambdaQuery(ChatgptSession.class).in(ChatgptSession::getCarId, collect.keySet()).eq(isPlus !=null && isPlus, ChatgptSession::getIsPlus, true));
|
|
|
return chatgptSessions.stream().map((chatgptSession)-> buildChatgptCarInfoView(chatgptSession.getCarId(),chatgptSession.getCarName(), chatgptSession.getIsPlus(), collect.get(chatgptSession.getCarId())))
|
|
|
.sorted(Comparator.comparing(ChatgptCarInfoView::getScore)).collect(Collectors.toCollection(LinkedHashSet::new));
|
|
|
}
|