style: 代码初始化

server_five_liuyunhu
lijiayao 2024-03-26 18:45:36 +08:00
parent 10341472e9
commit 1dce28afa3
197 changed files with 89 additions and 89 deletions

View File

@ -2,16 +2,16 @@
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.muyu</groupId>
<artifactId>muyu</artifactId>
<groupId>com.couplet</groupId>
<artifactId>couplet</artifactId>
<version>3.6.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>muyu-gateway</artifactId>
<artifactId>couplet-gateway</artifactId>
<description>
muyu-gateway网关模块
couplet-gateway网关模块
</description>
<dependencies>
@ -72,8 +72,8 @@
<!-- MuYu Common Redis-->
<dependency>
<groupId>com.muyu</groupId>
<artifactId>muyu-common-redis</artifactId>
<groupId>com.couplet</groupId>
<artifactId>couplet-common-redis</artifactId>
</dependency>
<!-- Swagger -->

View File

@ -1,4 +1,4 @@
package com.muyu.gateway;
package com.couplet.gateway;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@ -7,7 +7,7 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
/**
*
*
* @author muyu
* @author couplet
*/
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
public class MuYuGatewayApplication {

View File

@ -1,4 +1,4 @@
package com.muyu.gateway.config;
package com.couplet.gateway.config;
import com.google.code.kaptcha.impl.DefaultKaptcha;
import com.google.code.kaptcha.util.Config;
@ -12,7 +12,7 @@ import static com.google.code.kaptcha.Constants.*;
/**
*
*
* @author muyu
* @author couplet
*/
@Configuration
public class CaptchaConfig {
@ -62,7 +62,7 @@ public class CaptchaConfig {
// KAPTCHA_SESSION_KEY
properties.setProperty(KAPTCHA_SESSION_CONFIG_KEY, "kaptchaCodeMath");
// 验证码文本生成器
properties.setProperty(KAPTCHA_TEXTPRODUCER_IMPL, "com.muyu.gateway.config.KaptchaTextCreator");
properties.setProperty(KAPTCHA_TEXTPRODUCER_IMPL, "com.couplet.gateway.config.KaptchaTextCreator");
// 验证码文本字符间距 默认为2
properties.setProperty(KAPTCHA_TEXTPRODUCER_CHAR_SPACE, "3");
// 验证码文本字符长度 默认为5

View File

@ -1,6 +1,6 @@
package com.muyu.gateway.config;
package com.couplet.gateway.config;
import com.muyu.gateway.handler.SentinelFallbackHandler;
import com.couplet.gateway.handler.SentinelFallbackHandler;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
@ -9,7 +9,7 @@ import org.springframework.core.annotation.Order;
/**
*
*
* @author muyu
* @author couplet
*/
@Configuration
public class GatewayConfig {

View File

@ -1,4 +1,4 @@
package com.muyu.gateway.config;
package com.couplet.gateway.config;
import com.google.code.kaptcha.text.impl.DefaultTextCreator;
@ -7,7 +7,7 @@ import java.util.Random;
/**
*
*
* @author muyu
* @author couplet
*/
public class KaptchaTextCreator extends DefaultTextCreator {
private static final String[] CNUMBERS = "0,1,2,3,4,5,6,7,8,9,10".split(",");

View File

@ -1,6 +1,6 @@
package com.muyu.gateway.config;
package com.couplet.gateway.config;
import com.muyu.gateway.handler.ValidateCodeHandler;
import com.couplet.gateway.handler.ValidateCodeHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@ -12,7 +12,7 @@ import org.springframework.web.reactive.function.server.RouterFunctions;
/**
*
*
* @author muyu
* @author couplet
*/
@Configuration
public class RouterFunctionConfiguration {

View File

@ -1,4 +1,4 @@
package com.muyu.gateway.config;
package com.couplet.gateway.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.gateway.config.GatewayProperties;
@ -17,7 +17,7 @@ import java.util.List;
/**
*
*
* @author muyu
* @author couplet
*/
@Component
public class SwaggerProvider implements SwaggerResourcesProvider, WebFluxConfigurer {
@ -52,7 +52,7 @@ public class SwaggerProvider implements SwaggerResourcesProvider, WebFluxConfigu
.contains(routeDefinition.getId()))
.forEach(routeDefinition -> routeDefinition.getPredicates().stream()
.filter(predicateDefinition -> "Path".equalsIgnoreCase(predicateDefinition.getName()))
.filter(predicateDefinition -> !"muyu-auth".equalsIgnoreCase(routeDefinition.getId()))
.filter(predicateDefinition -> !"couplet-auth".equalsIgnoreCase(routeDefinition.getId()))
.forEach(predicateDefinition -> resourceList
.add(swaggerResource(routeDefinition.getId(), predicateDefinition.getArgs()
.get(NameUtils.GENERATED_NAME_PREFIX + "0").replace("/**", SWAGGER2URL)))));

View File

@ -1,4 +1,4 @@
package com.muyu.gateway.config.properties;
package com.couplet.gateway.config.properties;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
@ -7,7 +7,7 @@ import org.springframework.context.annotation.Configuration;
/**
*
*
* @author muyu
* @author couplet
*/
@Configuration
@RefreshScope

View File

@ -1,4 +1,4 @@
package com.muyu.gateway.config.properties;
package com.couplet.gateway.config.properties;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
@ -10,7 +10,7 @@ import java.util.List;
/**
*
*
* @author muyu
* @author couplet
*/
@Configuration
@RefreshScope

View File

@ -1,4 +1,4 @@
package com.muyu.gateway.config.properties;
package com.couplet.gateway.config.properties;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
@ -10,7 +10,7 @@ import java.util.List;
/**
* XSS
*
* @author muyu
* @author couplet
*/
@Configuration
@RefreshScope

View File

@ -1,14 +1,14 @@
package com.muyu.gateway.filter;
package com.couplet.gateway.filter;
import com.muyu.common.core.constant.CacheConstants;
import com.muyu.common.core.constant.HttpStatus;
import com.muyu.common.core.constant.SecurityConstants;
import com.muyu.common.core.constant.TokenConstants;
import com.muyu.common.core.utils.JwtUtils;
import com.muyu.common.core.utils.ServletUtils;
import com.muyu.common.core.utils.StringUtils;
import com.muyu.common.redis.service.RedisService;
import com.muyu.gateway.config.properties.IgnoreWhiteProperties;
import com.couplet.common.core.constant.CacheConstants;
import com.couplet.common.core.constant.HttpStatus;
import com.couplet.common.core.constant.SecurityConstants;
import com.couplet.common.core.constant.TokenConstants;
import com.couplet.common.core.utils.JwtUtils;
import com.couplet.common.core.utils.ServletUtils;
import com.couplet.common.core.utils.StringUtils;
import com.couplet.common.redis.service.RedisService;
import com.couplet.gateway.config.properties.IgnoreWhiteProperties;
import io.jsonwebtoken.Claims;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -24,7 +24,7 @@ import reactor.core.publisher.Mono;
/**
*
*
* @author muyu
* @author couplet
*/
@Component
public class AuthFilter implements GlobalFilter, Ordered {

View File

@ -1,6 +1,6 @@
package com.muyu.gateway.filter;
package com.couplet.gateway.filter;
import com.muyu.common.core.utils.ServletUtils;
import com.couplet.common.core.utils.ServletUtils;
import org.springframework.cloud.gateway.filter.GatewayFilter;
import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory;
import org.springframework.stereotype.Component;
@ -12,7 +12,7 @@ import java.util.regex.Pattern;
/**
*
*
* @author muyu
* @author couplet
*/
@Component
public class BlackListUrlFilter extends AbstractGatewayFilterFactory<BlackListUrlFilter.Config> {

View File

@ -1,4 +1,4 @@
package com.muyu.gateway.filter;
package com.couplet.gateway.filter;
import org.springframework.cloud.gateway.filter.GatewayFilter;
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
@ -16,7 +16,7 @@ import java.util.List;
/**
* body
*
* @author muyu
* @author couplet
*/
@Component
public class CacheRequestFilter extends AbstractGatewayFilterFactory<CacheRequestFilter.Config> {

View File

@ -1,11 +1,11 @@
package com.muyu.gateway.filter;
package com.couplet.gateway.filter;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.muyu.common.core.utils.ServletUtils;
import com.muyu.common.core.utils.StringUtils;
import com.muyu.gateway.config.properties.CaptchaProperties;
import com.muyu.gateway.service.ValidateCodeService;
import com.couplet.common.core.utils.ServletUtils;
import com.couplet.common.core.utils.StringUtils;
import com.couplet.gateway.config.properties.CaptchaProperties;
import com.couplet.gateway.service.ValidateCodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.gateway.filter.GatewayFilter;
import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory;
@ -22,7 +22,7 @@ import java.util.concurrent.atomic.AtomicReference;
/**
*
*
* @author muyu
* @author couplet
*/
@Component
public class ValidateCodeFilter extends AbstractGatewayFilterFactory<Object> {

View File

@ -1,8 +1,8 @@
package com.muyu.gateway.filter;
package com.couplet.gateway.filter;
import com.muyu.common.core.utils.StringUtils;
import com.muyu.common.core.utils.html.EscapeUtil;
import com.muyu.gateway.config.properties.XssProperties;
import com.couplet.common.core.utils.StringUtils;
import com.couplet.common.core.utils.html.EscapeUtil;
import com.couplet.gateway.config.properties.XssProperties;
import io.netty.buffer.ByteBufAllocator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
@ -25,7 +25,7 @@ import java.nio.charset.StandardCharsets;
/**
*
*
* @author muyu
* @author couplet
*/
@Component
@ConditionalOnProperty(value = "security.xss.enabled", havingValue = "true")

View File

@ -1,6 +1,6 @@
package com.muyu.gateway.handler;
package com.couplet.gateway.handler;
import com.muyu.common.core.utils.ServletUtils;
import com.couplet.common.core.utils.ServletUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.web.reactive.error.ErrorWebExceptionHandler;
@ -15,7 +15,7 @@ import reactor.core.publisher.Mono;
/**
*
*
* @author muyu
* @author couplet
*/
@Order(-1)
@Configuration

View File

@ -1,8 +1,8 @@
package com.muyu.gateway.handler;
package com.couplet.gateway.handler;
import com.alibaba.csp.sentinel.adapter.gateway.sc.callback.GatewayCallbackManager;
import com.alibaba.csp.sentinel.slots.block.BlockException;
import com.muyu.common.core.utils.ServletUtils;
import com.couplet.common.core.utils.ServletUtils;
import org.springframework.web.reactive.function.server.ServerResponse;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.server.WebExceptionHandler;
@ -11,7 +11,7 @@ import reactor.core.publisher.Mono;
/**
*
*
* @author muyu
* @author couplet
*/
public class SentinelFallbackHandler implements WebExceptionHandler {
private Mono<Void> writeResponse (ServerResponse response, ServerWebExchange exchange) {

View File

@ -1,4 +1,4 @@
package com.muyu.gateway.handler;
package com.couplet.gateway.handler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;

View File

@ -1,8 +1,8 @@
package com.muyu.gateway.handler;
package com.couplet.gateway.handler;
import com.muyu.common.core.exception.CaptchaException;
import com.muyu.common.core.domain.Result;
import com.muyu.gateway.service.ValidateCodeService;
import com.couplet.common.core.exception.CaptchaException;
import com.couplet.common.core.domain.Result;
import com.couplet.gateway.service.ValidateCodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
@ -17,7 +17,7 @@ import java.io.IOException;
/**
*
*
* @author muyu
* @author couplet
*/
@Component
public class ValidateCodeHandler implements HandlerFunction<ServerResponse> {

View File

@ -1,4 +1,4 @@
package com.muyu.gateway.model.resp;
package com.couplet.gateway.model.resp;
import lombok.AllArgsConstructor;
import lombok.Builder;

View File

@ -1,14 +1,14 @@
package com.muyu.gateway.service;
package com.couplet.gateway.service;
import com.muyu.common.core.exception.CaptchaException;
import com.muyu.common.core.domain.Result;
import com.couplet.common.core.exception.CaptchaException;
import com.couplet.common.core.domain.Result;
import java.io.IOException;
/**
*
*
* @author muyu
* @author couplet
*/
public interface ValidateCodeService {
/**

View File

@ -1,17 +1,17 @@
package com.muyu.gateway.service.impl;
package com.couplet.gateway.service.impl;
import com.google.code.kaptcha.Producer;
import com.muyu.common.core.constant.CacheConstants;
import com.muyu.common.core.constant.Constants;
import com.muyu.common.core.exception.CaptchaException;
import com.muyu.common.core.utils.StringUtils;
import com.muyu.common.core.utils.sign.Base64;
import com.muyu.common.core.utils.uuid.IdUtils;
import com.muyu.common.core.domain.Result;
import com.muyu.common.redis.service.RedisService;
import com.muyu.gateway.config.properties.CaptchaProperties;
import com.muyu.gateway.model.resp.CaptchaCodeResp;
import com.muyu.gateway.service.ValidateCodeService;
import com.couplet.common.core.constant.CacheConstants;
import com.couplet.common.core.constant.Constants;
import com.couplet.common.core.exception.CaptchaException;
import com.couplet.common.core.utils.StringUtils;
import com.couplet.common.core.utils.sign.Base64;
import com.couplet.common.core.utils.uuid.IdUtils;
import com.couplet.common.core.domain.Result;
import com.couplet.common.redis.service.RedisService;
import com.couplet.gateway.config.properties.CaptchaProperties;
import com.couplet.gateway.model.resp.CaptchaCodeResp;
import com.couplet.gateway.service.ValidateCodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.FastByteArrayOutputStream;
@ -25,7 +25,7 @@ import java.util.concurrent.TimeUnit;
/**
*
*
* @author muyu
* @author couplet
*/
@Service
public class ValidateCodeServiceImpl implements ValidateCodeService {

View File

@ -6,7 +6,7 @@ server:
spring:
application:
# 应用名称
name: muyu-gateway
name: couplet-gateway
profiles:
# 环境配置
active: dev
@ -34,7 +34,7 @@ spring:
ds1:
nacos:
server-addr: 127.0.0.1:8848
dataId: sentinel-muyu-gateway
dataId: sentinel-couplet-gateway
groupId: DEFAULT_GROUP
data-type: json
rule-type: gw-flow

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 日志存放路径 -->
<property name="log.path" value="logs/muyu-gateway"/>
<property name="log.path" value="logs/couplet-gateway"/>
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
@ -58,7 +58,7 @@
</appender>
<!-- 系统模块日志级别控制 -->
<logger name="com.muyu" level="info"/>
<logger name="com.couplet" level="info"/>
<!-- Spring日志级别控制 -->
<logger name="org.springframework" level="warn"/>

Some files were not shown because too many files have changed in this diff Show More