Commit e176fceb authored by 赵啸非's avatar 赵啸非

修改普通列表

parent 683c8f07
...@@ -46,7 +46,7 @@ public class SkinCategoryServiceImpl extends AbstractCRUDServiceImpl<SkinCategor ...@@ -46,7 +46,7 @@ public class SkinCategoryServiceImpl extends AbstractCRUDServiceImpl<SkinCategor
@Override @Override
protected void findAfter(SkinCategoryEntity entity, PageInfo pageInfo, Context context, List<SkinCategoryEntity> list) throws AppException { protected void findAfter(SkinCategoryEntity entity, PageInfo pageInfo, Context context, List<SkinCategoryEntity> list) throws AppException {
list.stream().forEach(item -> { list.stream().forEach(item -> {
List<SkinBaseEntity> skinBaseEntities = skinBaseService.find(new SkinBaseQuery().categoryId(entity.getId())); List<SkinBaseEntity> skinBaseEntities = skinBaseService.find(new SkinBaseQuery().categoryId(item.getId()));
item.setSkinBaseList(skinBaseEntities); item.setSkinBaseList(skinBaseEntities);
}); });
super.findAfter(entity, pageInfo, context, list); super.findAfter(entity, pageInfo, context, list);
......
package com.mortals.xhx.base.framework.interceptor; package com.mortals.xhx.base.framework.interceptor;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.service.IAuthTokenService; import com.mortals.framework.service.IAuthTokenService;
import com.mortals.framework.service.IUser; import com.mortals.framework.service.IUser;
import com.mortals.framework.util.AESUtil; import com.mortals.framework.util.AESUtil;
...@@ -10,9 +11,11 @@ import com.mortals.xhx.base.framework.config.InterceptorConfig; ...@@ -10,9 +11,11 @@ import com.mortals.xhx.base.framework.config.InterceptorConfig;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.web.method.HandlerMethod;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.Method;
/** /**
* 用户权限验证,基于token * 用户权限验证,基于token
...@@ -37,6 +40,13 @@ public class AuthUserInterceptor extends BaseInterceptor { ...@@ -37,6 +40,13 @@ public class AuthUserInterceptor extends BaseInterceptor {
throws Exception { throws Exception {
JSONObject ret = new JSONObject(); JSONObject ret = new JSONObject();
try { try {
HandlerMethod handlerMethod = (HandlerMethod) handler;
Method method = handlerMethod.getMethod();
UnAuth annotation = method.getAnnotation(UnAuth.class);
if (annotation != null) {
//取消校验
return true;
}
String uri = request.getServletPath(); String uri = request.getServletPath();
//校验配置的请求路径是否需要检查权限 //校验配置的请求路径是否需要检查权限
if (config.needCheckAuth(uri)) { if (config.needCheckAuth(uri)) {
...@@ -45,7 +55,6 @@ public class AuthUserInterceptor extends BaseInterceptor { ...@@ -45,7 +55,6 @@ public class AuthUserInterceptor extends BaseInterceptor {
if (!auth) { if (!auth) {
//不存在时候 如果是管理员也不做拦截 //不存在时候 如果是管理员也不做拦截
IUser loginUser = authTokenService.getLoginUser(request); IUser loginUser = authTokenService.getLoginUser(request);
//loginUser.isManager()
if(ObjectUtils.isEmpty(loginUser)){ if(ObjectUtils.isEmpty(loginUser)){
ret.put("code", -1); ret.put("code", -1);
ret.put("msg", "用户未登录或登录失效,请重新登录"); ret.put("msg", "用户未登录或登录失效,请重新登录");
...@@ -59,7 +68,6 @@ public class AuthUserInterceptor extends BaseInterceptor { ...@@ -59,7 +68,6 @@ public class AuthUserInterceptor extends BaseInterceptor {
ServletUtils.renderString(response, JSONObject.toJSONString(ret)); ServletUtils.renderString(response, JSONObject.toJSONString(ret));
return false; return false;
} }
} }
} }
} catch (Exception e) { } catch (Exception e) {
......
//package com.mortals.xhx.base.framework.security.filter;
//
//import com.alibaba.fastjson.JSONObject;
//import com.mortals.framework.util.StringUtils;
//import com.mortals.framework.web.interceptor.BaseInterceptor;
//import com.mortals.xhx.base.DeviceAuth;
//import com.mortals.xhx.busiz.security.SecurityUtils;
//import com.mortals.xhx.busiz.security.DeviceTokenService;
//import com.mortals.xhx.common.code.ApiRespCodeEnum;
//import com.mortals.xhx.module.device.model.DeviceEntity;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//import org.springframework.web.method.HandlerMethod;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.lang.reflect.Method;
//
///**
// * 设备上报验证
// *
// * @author: zxfei
// * @date: 2022/4/11 15:50
// */
//@Component
//public class DeviceSubmitInterceptor extends BaseInterceptor {
//
// @Autowired
// private DeviceTokenService deviceTokenService;
//
// @Override
// public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
// if (handler instanceof HandlerMethod) {
// HandlerMethod handlerMethod = (HandlerMethod) handler;
// Method method = handlerMethod.getMethod();
// DeviceAuth annotation = method.getAnnotation(DeviceAuth.class);
// if (annotation != null) {
// //校验
// if (this.verifyDevice(request)) {
// JSONObject ret = new JSONObject();
// ret.put("code", ApiRespCodeEnum.TOKEN_FAILED.getValue());
// ret.put("msg", ApiRespCodeEnum.TOKEN_FAILED.getLabel());
// super.writeJsonResponse(response, 200, JSONObject.toJSONString(ret));
// return false;
// }
// }
// return true;
// } else {
// return super.preHandle(request, response, handler);
// }
// }
//
// public boolean verifyDevice(HttpServletRequest request) {
// DeviceEntity device = deviceTokenService.getLoginDevice(request);
// if (StringUtils.isNotNull(device) && StringUtils.isNull(SecurityUtils.getAuthentication())) {
// deviceTokenService.verifyToken(device);
// return true;
// }
// return false;
//
// }
//
//
//}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment