|
@@ -7,25 +7,29 @@ import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
-import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
|
+import com.ym.mec.auth.service.SysUserService;
|
|
|
+import com.ym.mec.common.security.AuthUser;
|
|
|
+import com.ym.mec.common.security.SecurityUtils;
|
|
|
import com.yonge.log.interceptor.AuditLogInterceptor;
|
|
|
|
|
|
@Component
|
|
|
public class OperationLogInterceptor extends AuditLogInterceptor {
|
|
|
|
|
|
@Autowired
|
|
|
- @Lazy
|
|
|
- private SysUserFeignService sysUserFeignService;
|
|
|
+ private SysUserService sysUserService;
|
|
|
|
|
|
@Override
|
|
|
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws ServletException, IOException {
|
|
|
- SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
- if (sysUser != null) {
|
|
|
- setUsername(sysUser.getRealName(),sysUser.getId());
|
|
|
+ AuthUser authUser = SecurityUtils.getUser();
|
|
|
+ if (authUser != null) {
|
|
|
+ SysUser sysUser = sysUserService.get(authUser.getUserId());
|
|
|
+
|
|
|
+ if (sysUser != null) {
|
|
|
+ setUsername(sysUser.getRealName(), sysUser.getId());
|
|
|
+ }
|
|
|
}
|
|
|
return true;
|
|
|
}
|