注释规范

This commit is contained in:
Chopper
2021-06-21 14:14:07 +08:00
parent 8403db9e75
commit c7e4af6175
132 changed files with 994 additions and 994 deletions

View File

@@ -69,7 +69,7 @@ public class CategoryManagerController {
if (StringUtils.isNotEmpty(list)) {
throw new ServiceException(ResultCode.CATEGORY_NOT_EXIST);
}
// 非顶级分类
//非顶级分类
if (category.getParentId() != null && !category.getParentId().equals("0")) {
Category parent = categoryService.getById(category.getParentId());
if (parent == null) {
@@ -116,7 +116,7 @@ public class CategoryManagerController {
throw new ServiceException(ResultCode.CATEGORY_HAS_CHILDREN);
}
// 查询某商品分类的商品数量
//查询某商品分类的商品数量
Integer count = goodsService.getGoodsCountByCategory(id);
if (count > 0) {
throw new ServiceException(ResultCode.CATEGORY_HAS_GOODS);

View File

@@ -49,7 +49,7 @@ public class ManagerAuthenticationFilter extends BasicAuthenticationFilter {
//从header中获取jwt
String jwt = request.getHeader(SecurityEnum.HEADER_TOKEN.getValue());
// 如果没有token 则return
//如果没有token 则return
if (StrUtil.isBlank(jwt)) {
chain.doFilter(request, response);
return;
@@ -77,20 +77,20 @@ public class ManagerAuthenticationFilter extends BasicAuthenticationFilter {
} else {
//用户是否拥有权限判定œ
//获取数据权限
// if (request.getMethod().equals(RequestMethod.GET.name())) {
// if (!PatternMatchUtils.simpleMatch(permission.get(PermissionEnum.SUPER).toArray(new String[0]), request.getRequestURI()) ||
// PatternMatchUtils.simpleMatch(permission.get(PermissionEnum.QUERY).toArray(new String[0]), request.getRequestURI())) {
// if (request.getMethod().equals(RequestMethod.GET.name())) {
// if (!PatternMatchUtils.simpleMatch(permission.get(PermissionEnum.SUPER).toArray(new String[0]), request.getRequestURI()) ||
// PatternMatchUtils.simpleMatch(permission.get(PermissionEnum.QUERY).toArray(new String[0]), request.getRequestURI())) {
//
// ResponseUtil.output(response, ResponseUtil.resultMap(false, 401, "抱歉,您没有访问权限"));
// throw new NoPermissionException("权限不足");
// }
// } else {
// if (!PatternMatchUtils.simpleMatch(permission.get(PermissionEnum.SUPER).toArray(new String[0]), request.getRequestURI())) {
// ResponseUtil.output(response, ResponseUtil.resultMap(false, 401, "抱歉,您没有访问权限"));
// throw new NoPermissionException("权限不足");
// }
// } else {
// if (!PatternMatchUtils.simpleMatch(permission.get(PermissionEnum.SUPER).toArray(new String[0]), request.getRequestURI())) {
//
// ResponseUtil.output(response, ResponseUtil.resultMap(false, 401, "抱歉,您没有访问权限"));
// throw new NoPermissionException("权限不足");
// }
// }
// ResponseUtil.output(response, ResponseUtil.resultMap(false, 401, "抱歉,您没有访问权限"));
// throw new NoPermissionException("权限不足");
// }
// }
return;
}
}
@@ -113,7 +113,7 @@ public class ManagerAuthenticationFilter extends BasicAuthenticationFilter {
String json = claims.get(SecurityEnum.USER_CONTEXT.getValue()).toString();
AuthUser authUser = new Gson().fromJson(json, AuthUser.class);
// 校验redis中是否有权限
//校验redis中是否有权限
if (cache.hasKey(CachePrefix.ACCESS_TOKEN.getPrefix(UserEnums.MANAGER) + jwt)) {
//用户角色
List<GrantedAuthority> auths = new ArrayList<>();

View File

@@ -47,32 +47,32 @@ public class ManagerSecurityConfig extends WebSecurityConfigurerAdapter {
ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry registry = http
.authorizeRequests();
// 配置的url 不需要授权
//配置的url 不需要授权
for (String url : ignoredUrlsProperties.getUrls()) {
registry.antMatchers(url).permitAll();
}
registry
.and()
// 禁止网页iframe
//禁止网页iframe
.headers().frameOptions().disable()
.and()
.authorizeRequests()
// 任何请求
//任何请求
.anyRequest()
// 需要身份认证
//需要身份认证
.authenticated()
.and()
// 允许跨域
//允许跨域
.cors().configurationSource(corsConfigurationSource).and()
// 关闭跨站请求防护
//关闭跨站请求防护
.csrf().disable()
// 前后端分离采用JWT 不需要session
//前后端分离采用JWT 不需要session
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and()
// 自定义权限拒绝处理类
//自定义权限拒绝处理类
.exceptionHandling().accessDeniedHandler(accessDeniedHandler)
.and()
// 添加JWT认证过滤器
//添加JWT认证过滤器
.addFilter(new ManagerAuthenticationFilter(authenticationManager(), cache));
}