提交 db50272f 编写于 作者: pig_冷冷's avatar pig_冷冷

Merge branch 'dev'

<p align="center">
<img src="https://img.shields.io/badge/Avue-1.5.0-green.svg" alt="Build Status">
<img src="https://img.shields.io/badge/Spring%20Cloud-Greenwich.RELEASE-blue.svg" alt="Coverage Status">
<img src="https://img.shields.io/badge/Spring%20Boot-2.1.5.RELEASE-blue.svg" alt="Downloads">
<img src="https://img.shields.io/badge/Avue-1.6.0-green.svg" alt="Build Status">
<img src="https://img.shields.io/badge/Spring%20Cloud-Greenwich.SR1-blue.svg" alt="Coverage Status">
<img src="https://img.shields.io/badge/Spring%20Boot-2.1.6.RELEASE-blue.svg" alt="Downloads">
</p>
**Pig Microservice Architecture**
......@@ -24,12 +24,12 @@
依赖 | 版本
---|---
Spring Boot | 2.1.5.RELEASE
Spring Cloud | Greenwich.RELEASE
Spring Security OAuth2 | 2.3.3
Spring Boot | 2.1.6.RELEASE
Spring Cloud | Greenwich.SR1
Spring Security OAuth2 | 2.3.5
Mybatis Plus | 3.1.0
hutool | 4.5.10
Avue | 1.5.0
hutool | 4.5.13
Avue | 1.6.0
......
......@@ -21,7 +21,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig</artifactId>
<version>2.2.2</version>
<version>2.3.0</version>
</parent>
<artifactId>pig-auth</artifactId>
......@@ -39,13 +39,13 @@
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-upms-api</artifactId>
<version>2.2.2</version>
<version>2.3.0</version>
</dependency>
<!--security-->
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common-security</artifactId>
<version>2.2.2</version>
<version>2.3.0</version>
</dependency>
<!--JDBC相关-->
<dependency>
......
......@@ -21,7 +21,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common</artifactId>
<version>2.2.2</version>
<version>2.3.0</version>
</parent>
<artifactId>pig-common-core</artifactId>
......@@ -80,5 +80,10 @@
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
......@@ -17,6 +17,8 @@
package com.pig4cloud.pig.common.core.config;
import lombok.AllArgsConstructor;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
......@@ -33,7 +35,8 @@ import org.springframework.data.redis.serializer.StringRedisSerializer;
@EnableCaching
@Configuration
@AllArgsConstructor
public class RedisConfig {
@AutoConfigureBefore(RedisAutoConfiguration.class)
public class RedisTemplateConfig {
private final RedisConnectionFactory factory;
@Bean
......
......@@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.pig4cloud.pig.common.core.datascope;
package com.pig4cloud.pig.common.core.mybatis;
import lombok.Data;
import lombok.EqualsAndHashCode;
......
......@@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.pig4cloud.pig.common.core.datascope;
package com.pig4cloud.pig.common.core.mybatis;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
......
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the pig4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.pig4cloud.pig.common.core.mybatis;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pig4cloud.pig.common.core.exception.CheckedException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.MethodParameter;
import org.springframework.web.bind.support.WebDataBinderFactory;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.method.support.ModelAndViewContainer;
import javax.servlet.http.HttpServletRequest;
/**
* @author lengleng
* @date 2019-06-24
* <p>
* 解决Mybatis Plus Order By SQL注入问题
*/
@Slf4j
public class SqlFilterArgumentResolver implements HandlerMethodArgumentResolver {
private final static String[] KEYWORDS = {"master", "truncate", "insert", "select"
, "delete", "update", "declare", "alter", "drop", "sleep"};
/**
* 判断Controller是否包含page 参数
*
* @param parameter 参数
* @return 是否过滤
*/
@Override
public boolean supportsParameter(MethodParameter parameter) {
return parameter.getParameterType().equals(Page.class);
}
/**
* @param parameter 入参集合
* @param mavContainer model 和 view
* @param webRequest web相关
* @param binderFactory 入参解析
* @return 检查后新的page对象
* <p>
* page 只支持查询 GET .如需解析POST获取请求报文体处理
*/
@Override
public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer
, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) {
HttpServletRequest request = webRequest.getNativeRequest(HttpServletRequest.class);
String[] ascs = request.getParameterValues("ascs");
String[] descs = request.getParameterValues("descs");
String current = request.getParameter("current");
String size = request.getParameter("size");
Page page = new Page();
if (StrUtil.isNotBlank(current)) {
page.setCurrent(Long.parseLong(current));
}
if (StrUtil.isNotBlank(size)) {
page.setCurrent(Long.parseLong(size));
}
page.setAsc(sqlInject(ascs));
page.setDesc(sqlInject(descs));
return page;
}
/**
* SQL注入过滤
*
* @param str 待验证的字符串
*/
public static String[] sqlInject(String[] str) {
if (ArrayUtil.isEmpty(str)) {
return null;
}
//转换成小写
String inStr = ArrayUtil.join(str, StrUtil.COMMA).toLowerCase();
//判断是否包含非法字符
for (String keyword : KEYWORDS) {
if (inStr.contains(keyword)) {
log.error("查询包含非法字符 {}", keyword);
throw new CheckedException(keyword + "包含非法字符");
}
}
return str;
}
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the pig4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.pig4cloud.pig.common.core.mybatis;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import java.util.List;
/**
* @author lengleng
* @date 2019-06-24
* <p>
* 注入自自定义SQL 过滤
*/
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
argumentResolvers.add(new SqlFilterArgumentResolver());
}
}
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.pig4cloud.pig.common.core.config.JacksonConfig,\
com.pig4cloud.pig.common.core.config.RedisConfig,\
com.pig4cloud.pig.common.core.config.RedisTemplateConfig,\
com.pig4cloud.pig.common.core.config.RestTemplateConfig,\
com.pig4cloud.pig.common.core.config.FilterIgnorePropertiesConfig,\
com.pig4cloud.pig.common.core.exception.GlobalExceptionHandler,\
......
......@@ -21,7 +21,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common</artifactId>
<version>2.2.2</version>
<version>2.3.0</version>
</parent>
<artifactId>pig-common-log</artifactId>
......@@ -35,13 +35,13 @@
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common-core</artifactId>
<version>2.2.2</version>
<version>2.3.0</version>
</dependency>
<!--UPMS接口模块-->
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-upms-api</artifactId>
<version>2.2.2</version>
<version>2.3.0</version>
</dependency>
<!--安全依赖获取上下文信息-->
<dependency>
......
......@@ -21,7 +21,6 @@ import com.pig4cloud.pig.common.log.aspect.SysLogAspect;
import com.pig4cloud.pig.common.log.event.SysLogListener;
import lombok.AllArgsConstructor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;
......@@ -35,7 +34,6 @@ import org.springframework.scheduling.annotation.EnableAsync;
@Configuration
@AllArgsConstructor
@ConditionalOnWebApplication
@EnableFeignClients({"com.pig4cloud.pig.admin.api.feign"})
public class LogAutoConfiguration {
private final RemoteLogService remoteLogService;
......
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the pig4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.pig4cloud.pig.common.log.init;
import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;
/**
* @author lengleng
* @date 2019-06-25
* <p>
* 通过环境变量的形式注入 logging.file
* 自动维护 Spring Boot Admin Logger Viewer
*/
public class ApplicationLoggerInitializer implements ApplicationContextInitializer<ConfigurableApplicationContext> {
@Override
public void initialize(ConfigurableApplicationContext applicationContext) {
ConfigurableEnvironment environment = applicationContext.getEnvironment();
String appName = environment.getProperty("spring.application.name");
String logBase = environment.getProperty("LOGGING_PATH", "logs");
// spring boot admin 直接加载日志
System.setProperty("logging.file", String.format("%s/%s/debug.log", logBase, appName));
}
}
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.pig4cloud.pig.common.log.LogAutoConfiguration
org.springframework.context.ApplicationContextInitializer=\
com.pig4cloud.pig.common.log.init.ApplicationLoggerInitializer
......@@ -21,7 +21,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common</artifactId>
<version>2.2.2</version>
<version>2.3.0</version>
</parent>
<artifactId>pig-common-security</artifactId>
......@@ -35,7 +35,7 @@
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common-core</artifactId>
<version>2.2.2</version>
<version>2.3.0</version>
</dependency>
<!--安全模块-->
<dependency>
......@@ -50,7 +50,7 @@
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-upms-api</artifactId>
<version>2.2.2</version>
<version>2.3.0</version>
</dependency>
</dependencies>
</project>
......@@ -21,7 +21,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig</artifactId>
<version>2.2.2</version>
<version>2.3.0</version>
</parent>
<artifactId>pig-common</artifactId>
......
......@@ -21,7 +21,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig</artifactId>
<version>2.2.2</version>
<version>2.3.0</version>
</parent>
<artifactId>pig-config</artifactId>
......
......@@ -21,7 +21,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig</artifactId>
<version>2.2.2</version>
<version>2.3.0</version>
</parent>
<artifactId>pig-eureka</artifactId>
......
......@@ -21,7 +21,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig</artifactId>
<version>2.2.2</version>
<version>2.3.0</version>
</parent>
<artifactId>pig-gateway</artifactId>
......@@ -54,7 +54,7 @@
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common-core</artifactId>
<version>2.2.2</version>
<version>2.3.0</version>
</dependency>
</dependencies>
......
......@@ -21,7 +21,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-upms</artifactId>
<version>2.2.2</version>
<version>2.3.0</version>
</parent>
<artifactId>pig-upms-api</artifactId>
......@@ -35,7 +35,7 @@
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common-core</artifactId>
<version>2.2.2</version>
<version>2.3.0</version>
</dependency>
</dependencies>
</project>
......@@ -30,7 +30,7 @@ import org.springframework.web.bind.annotation.RequestHeader;
* @author lengleng
* @date 2019/2/1
*/
@FeignClient(value = ServiceNameConstants.UMPS_SERVICE, fallbackFactory = RemoteLogServiceFallbackFactory.class)
@FeignClient(contextId = "remoteLogService", value = ServiceNameConstants.UMPS_SERVICE, fallbackFactory = RemoteLogServiceFallbackFactory.class)
public interface RemoteLogService {
/**
* 保存日志
......
......@@ -29,7 +29,7 @@ import java.util.Map;
* @author lengleng
* @date 2019/2/1
*/
@FeignClient(value = ServiceNameConstants.AUTH_SERVICE, fallbackFactory = RemoteTokenServiceFallbackFactory.class)
@FeignClient(contextId = "remoteTokenService", value = ServiceNameConstants.AUTH_SERVICE, fallbackFactory = RemoteTokenServiceFallbackFactory.class)
public interface RemoteTokenService {
/**
* 分页查询token 信息
......
......@@ -30,7 +30,7 @@ import org.springframework.web.bind.annotation.RequestHeader;
* @author lengleng
* @date 2019/2/1
*/
@FeignClient(value = ServiceNameConstants.UMPS_SERVICE, fallbackFactory = RemoteUserServiceFallbackFactory.class)
@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.UMPS_SERVICE, fallbackFactory = RemoteUserServiceFallbackFactory.class)
public interface RemoteUserService {
/**
* 通过用户名查询用户、角色信息
......
......@@ -21,7 +21,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-upms</artifactId>
<version>2.2.2</version>
<version>2.3.0</version>
</parent>
<artifactId>pig-upms-biz</artifactId>
......@@ -34,19 +34,19 @@
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-upms-api</artifactId>
<version>2.2.2</version>
<version>2.3.0</version>
</dependency>
<!--安全模块-->
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common-security</artifactId>
<version>2.2.2</version>
<version>2.3.0</version>
</dependency>
<!--日志处理-->
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common-log</artifactId>
<version>2.2.2</version>
<version>2.3.0</version>
</dependency>
<!--配置中心客户端-->
<dependency>
......
......@@ -19,7 +19,7 @@ package com.pig4cloud.pig.admin.config;
import com.baomidou.mybatisplus.core.injector.ISqlInjector;
import com.baomidou.mybatisplus.extension.injector.LogicSqlInjector;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.pig4cloud.pig.common.core.datascope.DataScopeInterceptor;
import com.pig4cloud.pig.common.core.mybatis.DataScopeInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
......
......@@ -21,7 +21,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig</artifactId>
<version>2.2.2</version>
<version>2.3.0</version>
</parent>
<artifactId>pig-upms</artifactId>
......
......@@ -22,7 +22,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-visual</artifactId>
<version>2.2.2</version>
<version>2.3.0</version>
</parent>
<artifactId>pig-codegen</artifactId>
......@@ -50,13 +50,13 @@
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common-core</artifactId>
<version>2.2.2</version>
<version>2.3.0</version>
</dependency>
<!--安全模块-->
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common-security</artifactId>
<version>2.2.2</version>
<version>2.3.0</version>
</dependency>
<!--代码生成模板引擎-->
<dependency>
......
......@@ -21,7 +21,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-visual</artifactId>
<version>2.2.2</version>
<version>2.3.0</version>
</parent>
<artifactId>pig-monitor</artifactId>
......
......@@ -5,7 +5,7 @@
<parent>
<artifactId>pig-visual</artifactId>
<groupId>com.pig4cloud</groupId>
<version>2.2.2</version>
<version>2.3.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......
......@@ -21,7 +21,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig</artifactId>
<version>2.2.2</version>
<version>2.3.0</version>
</parent>
<artifactId>pig-visual</artifactId>
......
......@@ -21,33 +21,30 @@
<groupId>com.pig4cloud</groupId>
<artifactId>pig</artifactId>
<version>2.2.2</version>
<version>2.3.0</version>
<name>${project.artifactId}</name>
<packaging>pom</packaging>
<url>https://www.pig4cloud.com</url>
<properties>
<spring-boot.version>2.1.5.RELEASE</spring-boot.version>
<spring-cloud.version>Greenwich.RELEASE</spring-cloud.version>
<spring-platform.version>Cairo-SR7</spring-platform.version>
<spring-boot.version>2.1.6.RELEASE</spring-boot.version>
<spring-cloud.version>Greenwich.SR1</spring-cloud.version>
<spring-platform.version>Cairo-SR8</spring-platform.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<spring-boot-admin.version>2.1.4</spring-boot-admin.version>
<hutool.version>4.5.10</hutool.version>
<spring-boot-admin.version>2.1.5</spring-boot-admin.version>
<hutool.version>4.5.13</hutool.version>
<mybatis-plus.version>3.1.0</mybatis-plus.version>
<kaptcha.version>0.0.9</kaptcha.version>
<velocity.version>1.7</velocity.version>
<jasypt.version>2.1.0</jasypt.version>
<security.oauth.version>2.3.5.RELEASE</security.oauth.version>
<security.oauth.auto.version>2.1.2.RELEASE</security.oauth.auto.version>
<security.oauth.version>2.3.6.RELEASE</security.oauth.version>
<jackson.modules>2.9.8</jackson.modules>
<!--zipkin2.12.x需要此版本jooq-->
<jooq.version>3.11.9</jooq.version>
<zipkin.version>2.12.2</zipkin.version>
<zipkin-storage-mysql.version>2.8.4</zipkin-storage-mysql.version>
<docker.url>http://192.168.0.13:4243</docker.url>
<registry.url>192.168.0.13:5000</registry.url>
</properties>
<dependencies>
......@@ -145,11 +142,6 @@
<artifactId>spring-security-oauth2</artifactId>
<version>${security.oauth.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security.oauth.boot</groupId>
<artifactId>spring-security-oauth2-autoconfigure</artifactId>
<version>${security.oauth.auto.version}</version>
</dependency>
<!--jackson模块-->
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
......@@ -163,6 +155,12 @@
<build>
<finalName>${project.name}</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<pluginManagement>
<plugins>
<plugin>
......@@ -180,25 +178,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.4.12</version>
<configuration>
<imageName>${registry.url}/${project.name}:0.0.1</imageName>
<dockerHost>${docker.url}</dockerHost>
<dockerDirectory>${project.basedir}</dockerDirectory>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
<serverId>docker-hub</serverId>
<registryUrl>https://index.docker.io/v1/</registryUrl>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册