mirror of
https://github.com/zongzibinbin/MallChat.git
synced 2026-03-13 21:53:41 +08:00
[fix] 修改了一些CollectionUtil.isEmpty()/Objects.equals()判断
This commit is contained in:
@@ -85,9 +85,9 @@ public class MessageAdapter {
|
||||
List<MessageMark> dislikeMarks = typeMap.getOrDefault(MessageMarkTypeEnum.DISLIKE.getType(), new ArrayList<>());
|
||||
ChatMessageResp.MessageMark mark = new ChatMessageResp.MessageMark();
|
||||
mark.setLikeCount(likeMarks.size());
|
||||
mark.setUserLike(Optional.ofNullable(receiveUid).filter(uid -> likeMarks.stream().anyMatch(a -> a.getUid().equals(uid))).map(a -> YesOrNoEnum.YES.getStatus()).orElse(YesOrNoEnum.NO.getStatus()));
|
||||
mark.setUserLike(Optional.ofNullable(receiveUid).filter(uid -> likeMarks.stream().anyMatch(a -> Objects.equals(a.getUid(), uid))).map(a -> YesOrNoEnum.YES.getStatus()).orElse(YesOrNoEnum.NO.getStatus()));
|
||||
mark.setDislikeCount(dislikeMarks.size());
|
||||
mark.setUserDislike(Optional.ofNullable(receiveUid).filter(uid -> dislikeMarks.stream().anyMatch(a -> a.getUid().equals(uid))).map(a -> YesOrNoEnum.YES.getStatus()).orElse(YesOrNoEnum.NO.getStatus()));
|
||||
mark.setUserDislike(Optional.ofNullable(receiveUid).filter(uid -> dislikeMarks.stream().anyMatch(a -> Objects.equals(a.getUid(), uid))).map(a -> YesOrNoEnum.YES.getStatus()).orElse(YesOrNoEnum.NO.getStatus()));
|
||||
return mark;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
@@ -72,7 +73,7 @@ public class SwaggerConfig {
|
||||
}
|
||||
|
||||
private boolean shouldRegisterLinksMapping(WebEndpointProperties webEndpointProperties, Environment environment, String basePath) {
|
||||
return webEndpointProperties.getDiscovery().isEnabled() && (StringUtils.hasText(basePath) || ManagementPortType.get(environment).equals(ManagementPortType.DIFFERENT));
|
||||
return webEndpointProperties.getDiscovery().isEnabled() && (StringUtils.hasText(basePath) || Objects.equals(ManagementPortType.get(environment), ManagementPortType.DIFFERENT));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.abin.mallchat.custom.common.intecepter;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.abin.mallchat.common.common.domain.dto.RequestInfo;
|
||||
import com.abin.mallchat.common.common.exception.HttpErrorEnum;
|
||||
import com.abin.mallchat.common.common.utils.RequestHolder;
|
||||
@@ -44,7 +45,7 @@ public class BlackInterceptor implements HandlerInterceptor {
|
||||
}
|
||||
|
||||
private boolean inBlackList(Object target, Set<String> blackSet) {
|
||||
if (Objects.isNull(target) || Objects.isNull(blackSet)) {
|
||||
if (Objects.isNull(target) || CollectionUtil.isEmpty(blackSet)) {
|
||||
return false;
|
||||
}
|
||||
return blackSet.contains(target.toString());
|
||||
|
||||
@@ -44,7 +44,7 @@ public class LoginServiceImpl implements LoginService {
|
||||
}
|
||||
String key = RedisKey.getKey(RedisKey.USER_TOKEN_STRING, uid);
|
||||
String realToken = RedisUtils.getStr(key);
|
||||
return token.equals(realToken);//有可能token失效了,需要校验是不是和最新token一致
|
||||
return Objects.equals(token, realToken);//有可能token失效了,需要校验是不是和最新token一致
|
||||
}
|
||||
|
||||
@Async
|
||||
|
||||
@@ -180,7 +180,7 @@ public class WebSocketServiceImpl implements WebSocketService {
|
||||
if (uidOptional.isPresent()) {
|
||||
CopyOnWriteArrayList<Channel> channels = ONLINE_UID_MAP.get(uidOptional.get());
|
||||
if (CollectionUtil.isNotEmpty(channels)) {
|
||||
channels.removeIf(channel1 -> channel1.equals(channel));
|
||||
channels.removeIf(ch -> Objects.equals(ch, channel));
|
||||
}
|
||||
return CollectionUtil.isEmpty(ONLINE_UID_MAP.get(uidOptional.get()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user