|
@@ -25,6 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.data.mongodb.core.MongoTemplate;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
+import org.springframework.util.ObjectUtils;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
import org.springframework.web.context.request.RequestContextHolder;
|
|
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
|
@@ -81,11 +82,14 @@ public class VisitLogInterceptor {
|
|
|
|
|
|
//放行
|
|
|
Object result = pjp.proceed();
|
|
|
- String resultStr = JSON.toJSONString(result);
|
|
|
- JSONObject jsonObject = JSON.parseObject(resultStr);
|
|
|
- String msg = "操作失败";
|
|
|
- if(jsonObject.getInteger("code")== null || jsonObject.getInteger("code").equals(ServerCode.SUCCESS.code())){
|
|
|
- msg = "操作成功";
|
|
|
+ String msg = null;
|
|
|
+ if(!ObjectUtils.isEmpty(result)){
|
|
|
+ msg = "操作失败";
|
|
|
+ String resultStr = JSON.toJSONString(result);
|
|
|
+ JSONObject jsonObject = JSON.parseObject(resultStr);
|
|
|
+ if(jsonObject.getInteger("code")== null || jsonObject.getInteger("code").equals(ServerCode.SUCCESS.code())){
|
|
|
+ msg = "操作成功";
|
|
|
+ }
|
|
|
}
|
|
|
//获取用户信息 如果已登录,从token中获取用户信息,如果是登录接口,查询数据库获取用户信息
|
|
|
Long userId =null;
|
|
@@ -170,6 +174,9 @@ public class VisitLogInterceptor {
|
|
|
|
|
|
Map<String, Object> paramMap = new HashMap<>();
|
|
|
String contentType = request.getContentType();
|
|
|
+ if(StringUtils.isEmpty(contentType)){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
if(ContentType.JSON.getValue().equals(contentType)){
|
|
|
return JSON.toJSONString(args[0]);
|
|
|
}else{
|