|
|
@ -1,5 +1,6 @@ |
|
|
|
package com.daqing.financial.hrauth.aspect; |
|
|
|
package com.daqing.financial.hrauth.aspect; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.daqing.financial.hrauth.annotation.Log; |
|
|
|
import com.daqing.financial.hrauth.annotation.Log; |
|
|
@ -7,6 +8,7 @@ import com.daqing.financial.hrauth.service.TokenService; |
|
|
|
import com.daqing.financial.hrauth.service.UserLoginService; |
|
|
|
import com.daqing.financial.hrauth.service.UserLoginService; |
|
|
|
import com.daqing.framework.domain.hrms.Token; |
|
|
|
import com.daqing.framework.domain.hrms.Token; |
|
|
|
import com.daqing.framework.domain.hrms.UserEntity; |
|
|
|
import com.daqing.framework.domain.hrms.UserEntity; |
|
|
|
|
|
|
|
import com.daqing.framework.util.RedisUtil; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.aspectj.lang.JoinPoint; |
|
|
|
import org.aspectj.lang.JoinPoint; |
|
|
|
import org.aspectj.lang.ProceedingJoinPoint; |
|
|
|
import org.aspectj.lang.ProceedingJoinPoint; |
|
|
@ -63,8 +65,12 @@ public class SysLogAspect { |
|
|
|
//User systemUser = (User) SecurityUtils.getSubject().getPrincipal();
|
|
|
|
//User systemUser = (User) SecurityUtils.getSubject().getPrincipal();
|
|
|
|
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); |
|
|
|
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); |
|
|
|
String token = request.getHeader("token"); |
|
|
|
String token = request.getHeader("token"); |
|
|
|
Token userToken = tokenService.getOne(new QueryWrapper<Token>().eq("token", token)); |
|
|
|
String userId = RedisUtil.get("dq:token:"+token); |
|
|
|
UserEntity systemUser = userLoginService.getOne(new QueryWrapper<UserEntity>().eq("id",userToken.getUserId())); |
|
|
|
String userEntityStr = RedisUtil.get("dq:userId:"+userId); |
|
|
|
|
|
|
|
UserEntity systemUser = JSON.parseObject(userEntityStr,UserEntity.class); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Token userToken = tokenService.getOne(new QueryWrapper<Token>().eq("token", token));
|
|
|
|
|
|
|
|
//UserEntity systemUser = userLoginService.getOne(new QueryWrapper<UserEntity>().eq("id",userId));
|
|
|
|
operation.addOperationLog(joinPoint,res,time,systemUser); |
|
|
|
operation.addOperationLog(joinPoint,res,time,systemUser); |
|
|
|
//方法执行完成后增加日志
|
|
|
|
//方法执行完成后增加日志
|
|
|
|
// addOperationLog(joinPoint, res, time);
|
|
|
|
// addOperationLog(joinPoint, res, time);
|
|
|
|