增加用户登录校验

master
heminjian502 2 years ago
parent d500f7b18d
commit e90b009c65

@ -16,6 +16,8 @@ import javax.servlet.*;
import javax.servlet.annotation.WebFilter; import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects; import java.util.Objects;
@Order(1) @Order(1)
@ -36,7 +38,14 @@ public class LoginFilter implements Filter {
@Override @Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
String currentUrl = ((HttpServletRequest) servletRequest).getServletPath(); String currentUrl = ((HttpServletRequest) servletRequest).getServletPath();
if (!currentUrl.equals("/api/app/hospital/list")) { List<String> filterUrlList = new ArrayList<>();
filterUrlList.add("/api/app/hospital/list");
filterUrlList.add("/api/app/patient/makeAnAppointment");
filterUrlList.add("/api/app/doctor/info");
filterUrlList.add("/api/app/patient/info");
filterUrlList.add("/api/app/patient/modify");
if (!filterUrlList.contains(currentUrl)) {
LoginUser loginUser = userTokenService.getLoginUser((HttpServletRequest) servletRequest); LoginUser loginUser = userTokenService.getLoginUser((HttpServletRequest) servletRequest);
SysUser user = loginUser.getUser(); SysUser user = loginUser.getUser();
TDoctor tDoctor = tDoctorService.selectTDoctorByPhone(user.getPhonenumber()); TDoctor tDoctor = tDoctorService.selectTDoctorByPhone(user.getPhonenumber());

Loading…
Cancel
Save