销售日志+销售统计

yaoyao
lijiayao 2023-12-19 09:12:13 +08:00
parent 36ea8358da
commit f820822b9e
1 changed files with 85 additions and 85 deletions

View File

@ -1,85 +1,85 @@
//package com.bwie.gateway.filters; package com.bwie.gateway.filters;
//
//import com.bwie.common.constants.TokenConstants; import com.bwie.common.constants.TokenConstants;
//import com.bwie.common.utils.JwtUtils; import com.bwie.common.utils.JwtUtils;
//import com.bwie.common.utils.StringUtils; import com.bwie.common.utils.StringUtils;
//import com.bwie.gateway.config.IgnoreWhiteConfig; import com.bwie.gateway.config.IgnoreWhiteConfig;
//import com.bwie.gateway.utils.GatewayUtils; import com.bwie.gateway.utils.GatewayUtils;
//import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.cloud.gateway.filter.GatewayFilterChain; import org.springframework.cloud.gateway.filter.GatewayFilterChain;
//import org.springframework.cloud.gateway.filter.GlobalFilter; import org.springframework.cloud.gateway.filter.GlobalFilter;
//import org.springframework.core.Ordered; import org.springframework.core.Ordered;
//import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
//import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
//import org.springframework.http.server.reactive.ServerHttpRequest; import org.springframework.http.server.reactive.ServerHttpRequest;
//import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
//import org.springframework.web.server.ServerWebExchange; import org.springframework.web.server.ServerWebExchange;
//import reactor.core.publisher.Mono; import reactor.core.publisher.Mono;
//
//import java.util.List; import java.util.List;
//
///** /**
// * @ClassName: * @ClassName:
// * @Description: 鉴权过滤器 * @Description:
// * @Author: zhuwenqiang * @Author: zhuwenqiang
// * @Date: 2023/8/18 * @Date: 2023/8/18
// */ */
//@Component @Component
//public class AuthFilter implements GlobalFilter, Ordered { public class AuthFilter implements GlobalFilter, Ordered {
//
// @Autowired @Autowired
// private IgnoreWhiteConfig ignoreWhiteConfig; private IgnoreWhiteConfig ignoreWhiteConfig;
//
// @Autowired @Autowired
// private RedisTemplate<String, String> redisTemplate; private RedisTemplate<String, String> redisTemplate;
//
// /** /**
// * 过滤方法 验证 token * token
// * @param exchange 请求的上下文 通过这个参数 可以获取到 请求对象 以及 响应对象 * @param exchange
// * @param chain 网关过滤器链 chain 放行 或者 拦截 * @param chain chain
// * @return Mono * @return Mono
// */ */
// @Override @Override
// public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) { public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
// // 验证当前的请求 是否需要拦截 【配置白名单请求 不拦截的请求 】 将白名单请求配置到配置文件中 // 验证当前的请求 是否需要拦截 【配置白名单请求 不拦截的请求 】 将白名单请求配置到配置文件中
// // 获取系统白名单请求 // 获取系统白名单请求
// List<String> whites = ignoreWhiteConfig.getWhites(); List<String> whites = ignoreWhiteConfig.getWhites();
// // 获取当前的请求 URI // 获取当前的请求 URI
// ServerHttpRequest request = exchange.getRequest(); ServerHttpRequest request = exchange.getRequest();
// String path = request.getURI().getPath(); String path = request.getURI().getPath();
// boolean matches = StringUtils.matches(path, whites); boolean matches = StringUtils.matches(path, whites);
// if (matches) { // 放行 if (matches) { // 放行
// return chain.filter(exchange); return chain.filter(exchange);
// } }
// // 获取token // 获取token
// String token = request.getHeaders().getFirst(TokenConstants.TOKEN); String token = request.getHeaders().getFirst(TokenConstants.TOKEN);
// // token 非空验证 // token 非空验证
// if (StringUtils.isEmpty(token)) { if (StringUtils.isEmpty(token)) {
// // 不放行 提示错误信息 // 不放行 提示错误信息
// return GatewayUtils.errorResponse(exchange, "token不能为空", HttpStatus.UNAUTHORIZED); return GatewayUtils.errorResponse(exchange, "token不能为空", HttpStatus.UNAUTHORIZED);
// } }
// try { try {
// // token 合法性性 // token 合法性性
// JwtUtils.parseToken(token); JwtUtils.parseToken(token);
// } catch (Exception ex) { } catch (Exception ex) {
// return GatewayUtils.errorResponse(exchange, "token格式错误"); return GatewayUtils.errorResponse(exchange, "token格式错误");
// } }
// // token 是否过期 // token 是否过期
// // 获取 UserKey // 获取 UserKey
// String userKey = JwtUtils.getUserKey(token); String userKey = JwtUtils.getUserKey(token);
// if (!redisTemplate.hasKey(TokenConstants.LOGIN_TOKEN_KEY + userKey)) { if (!redisTemplate.hasKey(TokenConstants.LOGIN_TOKEN_KEY + userKey)) {
// return GatewayUtils.errorResponse(exchange, "token过期"); return GatewayUtils.errorResponse(exchange, "token过期");
// } }
// // 放行 // 放行
// return chain.filter(exchange); return chain.filter(exchange);
// } }
//
// /** /**
// * 当存在多个filter的时候 用来执行执行的优先级 * filter
// * @return 数字 数字的值越小 执行的优先级越高 * @return
// */ */
// @Override @Override
// public int getOrder() { public int getOrder() {
// return 0; return 0;
// } }
//} }