应急ws调整

This commit is contained in:
tiger_zhou 2023-02-14 13:25:38 +08:00
parent 8eaf0206d0
commit a0419ab218

View File

@ -85,7 +85,8 @@ public class WebsocketConfig implements WebSocketMessageBrokerConfigurer {
@Override
protected Principal determineUser(ServerHttpRequest request, WebSocketHandler wsHandler,
Map<String, Object> attributes) {
return new MyPrincipal((LoginUserInfoVO) attributes.get(VSimpleInterceptor.ATT_USER_KEY),true);
// return new MyPrincipal((LoginUserInfoVO) attributes.get(VSimpleInterceptor.ATT_USER_KEY),true);
return new TrainPositionPrincipal((LoginUserInfoVO) attributes.get(VSimpleInterceptor.ATT_USER_KEY));
}
})
@ -145,5 +146,20 @@ public class WebsocketConfig implements WebSocketMessageBrokerConfigurer {
}
}
@Getter
public class TrainPositionPrincipal implements Principal {
private LoginUserInfoVO user;
public TrainPositionPrincipal(LoginUserInfoVO user) {
Objects.requireNonNull(user, "用户不能为null");
this.user = user;
}
@Override
public String getName() {
return this.user.getAccountVO().getMobile();
}
}
}