|
@ -3,8 +3,11 @@ package com.yihu.iot.aop;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.yihu.iot.dao.gateway.GcTokenDao;
|
|
|
import com.yihu.iot.service.platform.IotInterfaceLogService;
|
|
|
import com.yihu.iot.service.useragent.UserAgent;
|
|
|
import com.yihu.jw.entity.iot.gateway.GcToken;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.aspectj.lang.ProceedingJoinPoint;
|
|
|
import org.aspectj.lang.annotation.Around;
|
|
|
import org.aspectj.lang.annotation.Aspect;
|
|
@ -40,6 +43,8 @@ public class IntefaceLogRequiredAOP {
|
|
|
private UserAgent userAgent;
|
|
|
@Autowired
|
|
|
private IotInterfaceLogService iotInterfaceLogService;
|
|
|
@Autowired
|
|
|
private GcTokenDao gcTokenDaoDao;
|
|
|
|
|
|
//Controller层切点路径
|
|
|
@Pointcut("execution(* com.yihu.iot..*.*(..))")
|
|
@ -68,7 +73,14 @@ public class IntefaceLogRequiredAOP {
|
|
|
Integer state = responseJson.getInteger("status")==200?1:0;
|
|
|
Map<String,String> paramsMap = getMehtodParam(request);
|
|
|
try {
|
|
|
iotInterfaceLogService.saveLog(paramsMap.get("appId"),params,deleteSensitiveContent, request,state,method.getName());
|
|
|
String appid = paramsMap.get("appId");
|
|
|
if(StringUtils.isEmpty(appid)){
|
|
|
//如果没有传appid,则从token中取
|
|
|
String accesstoken = request.getHeader("accesstoken");
|
|
|
GcToken gcToken = gcTokenDaoDao.findByToken(accesstoken);
|
|
|
appid = gcToken.getAppid();
|
|
|
}
|
|
|
iotInterfaceLogService.saveLog(appid,params,deleteSensitiveContent, request,state,method.getName());
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|