|  |  |  | 
|---|
|  |  |  | public String SsoCurUserUrl ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private LogService logSv; | 
|---|
|  |  |  | @Value("${pms.global.dev}") | 
|---|
|  |  |  | public String isDevStage ;//是否为开发阶段 | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | public void setLogSv(LogService logSv){ | 
|---|
|  |  |  | this.logSv = logSv; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @AfterReturning(pointcut = "@annotation(com.dy.pmsGlobal.aop.Log)", returning = "result") | 
|---|
|  |  |  | public void logAfterReturning(JoinPoint joinPoint, BaseResponse result) { | 
|---|
|  |  |  | if(isDevStage != null && !isDevStage.trim().equals("") && isDevStage.trim().equalsIgnoreCase("true")){ | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | try{ | 
|---|
|  |  |  | // 获取用户信息 | 
|---|
|  |  |  | BaUser user = (BaUser)getCurUser(result); | 
|---|
|  |  |  | if(user!=null && user.id !=null && !StringUtils.isNullOrEmpty(user.name)){ | 
|---|
|  |  |  | Long operator = user.id; | 
|---|
|  |  |  | // 获取方法的中文描述 | 
|---|
|  |  |  | MethodSignature sign = (MethodSignature) joinPoint.getSignature(); | 
|---|
|  |  |  | Log logDesc = sign.getMethod().getAnnotation(Log.class); | 
|---|
|  |  |  | 
|---|
|  |  |  | // 获取IP地址 | 
|---|
|  |  |  | String ip = getRemoteHost(); | 
|---|
|  |  |  | // 记录日志 | 
|---|
|  |  |  | logSv.save(operator, operationName,ip,result.getCode(),result.getMsg()); | 
|---|
|  |  |  | logSv.save(user.id,user.name, operationName,ip,result.getCode(),result.getMsg()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  | log.error("记录日志异常:"+e.getMessage()); | 
|---|