mirror of
https://gitee.com/log4j/pig.git
synced 2024-12-23 13:03:42 +08:00
Merge branch 'dev'
This commit is contained in:
commit
465a594b47
@ -15,7 +15,9 @@
|
|||||||
|
|
||||||
## 文档视频
|
## 文档视频
|
||||||
|
|
||||||
[文档视频 wiki.pig4cloud.com](https://wiki.pig4cloud.com)
|
[ 配套文档 wiki.pig4cloud.com](https://wiki.pig4cloud.com)
|
||||||
|
|
||||||
|
[ 配套视频 bilibili.com/video/BV12t411B7e9](https://www.bilibili.com/video/BV12t411B7e9)
|
||||||
|
|
||||||
[PIGX 在线体验 pigx.pig4cloud.com](http://pigx.pig4cloud.com)
|
[PIGX 在线体验 pigx.pig4cloud.com](http://pigx.pig4cloud.com)
|
||||||
|
|
||||||
@ -23,7 +25,7 @@
|
|||||||
|
|
||||||
## 微信群 [禁广告]
|
## 微信群 [禁广告]
|
||||||
|
|
||||||
![1628762721](https://minio.pigx.vip/oss/1628762721.png)
|
![](https://minio.pigx.vip/oss/1628762721.png)
|
||||||
|
|
||||||
## 快速开始
|
## 快速开始
|
||||||
|
|
||||||
@ -35,7 +37,7 @@
|
|||||||
| Spring Cloud | 2020.0.4 |
|
| Spring Cloud | 2020.0.4 |
|
||||||
| Spring Cloud Alibaba | 2021.1 |
|
| Spring Cloud Alibaba | 2021.1 |
|
||||||
| Spring Security OAuth2 | 2.3.6 |
|
| Spring Security OAuth2 | 2.3.6 |
|
||||||
| Mybatis Plus | 3.4.3.5 |
|
| Mybatis Plus | 3.4.3.4 |
|
||||||
| hutool | 5.7.15 |
|
| hutool | 5.7.15 |
|
||||||
| Avue | 2.6.18 |
|
| Avue | 2.6.18 |
|
||||||
|
|
||||||
|
@ -13,11 +13,10 @@ DROP TABLE IF EXISTS `gen_datasource_conf`;
|
|||||||
CREATE TABLE `gen_datasource_conf` (
|
CREATE TABLE `gen_datasource_conf` (
|
||||||
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
|
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||||
`name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '数据源名称',
|
`name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '数据源名称',
|
||||||
`url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'jdbc-url',
|
`url` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'jdbc-url',
|
||||||
`username` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '用户名',
|
`username` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '用户名',
|
||||||
`password` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '密码',
|
`password` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '密码',
|
||||||
`del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记',
|
`del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记',
|
||||||
`driver_class_name` varchar (255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '数据驱动名称',
|
|
||||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||||
`create_by` varchar(64) DEFAULT NULL COMMENT '创建人',
|
`create_by` varchar(64) DEFAULT NULL COMMENT '创建人',
|
||||||
`update_time` datetime DEFAULT NULL COMMENT '修改时间',
|
`update_time` datetime DEFAULT NULL COMMENT '修改时间',
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig</artifactId>
|
<artifactId>pig</artifactId>
|
||||||
<version>3.4.0</version>
|
<version>3.4.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>pig-auth</artifactId>
|
<artifactId>pig-auth</artifactId>
|
||||||
|
@ -21,6 +21,7 @@ import com.pig4cloud.pig.common.security.component.PigWebResponseExceptionTransl
|
|||||||
import com.pig4cloud.pig.common.security.grant.ResourceOwnerCustomeAppTokenGranter;
|
import com.pig4cloud.pig.common.security.grant.ResourceOwnerCustomeAppTokenGranter;
|
||||||
import com.pig4cloud.pig.common.security.service.PigClientDetailsService;
|
import com.pig4cloud.pig.common.security.service.PigClientDetailsService;
|
||||||
import com.pig4cloud.pig.common.security.service.PigCustomTokenServices;
|
import com.pig4cloud.pig.common.security.service.PigCustomTokenServices;
|
||||||
|
import com.pig4cloud.pig.common.security.service.PigUser;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
@ -101,6 +102,17 @@ public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdap
|
|||||||
return (accessToken, authentication) -> {
|
return (accessToken, authentication) -> {
|
||||||
final Map<String, Object> additionalInfo = new HashMap<>(4);
|
final Map<String, Object> additionalInfo = new HashMap<>(4);
|
||||||
additionalInfo.put(SecurityConstants.DETAILS_LICENSE, SecurityConstants.PROJECT_LICENSE);
|
additionalInfo.put(SecurityConstants.DETAILS_LICENSE, SecurityConstants.PROJECT_LICENSE);
|
||||||
|
String clientId = authentication.getOAuth2Request().getClientId();
|
||||||
|
additionalInfo.put(SecurityConstants.CLIENT_ID, clientId);
|
||||||
|
|
||||||
|
// 客户端模式不返回具体用户信息
|
||||||
|
if (SecurityConstants.CLIENT_CREDENTIALS.equals(authentication.getOAuth2Request().getGrantType())) {
|
||||||
|
((DefaultOAuth2AccessToken) accessToken).setAdditionalInformation(additionalInfo);
|
||||||
|
return accessToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
PigUser pigUser = (PigUser) authentication.getUserAuthentication().getPrincipal();
|
||||||
|
additionalInfo.put(SecurityConstants.DETAILS_USER, pigUser);
|
||||||
((DefaultOAuth2AccessToken) accessToken).setAdditionalInformation(additionalInfo);
|
((DefaultOAuth2AccessToken) accessToken).setAdditionalInformation(additionalInfo);
|
||||||
return accessToken;
|
return accessToken;
|
||||||
};
|
};
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig-common-bom</artifactId>
|
<artifactId>pig-common-bom</artifactId>
|
||||||
<version>3.4.0</version>
|
<version>3.4.1</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
<name>pig-common-bom</name>
|
<name>pig-common-bom</name>
|
||||||
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<pig.common.version>${project.version}</pig.common.version>
|
<pig.common.version>${project.version}</pig.common.version>
|
||||||
<spring-boot.version>2.5.5</spring-boot.version>
|
<spring-boot.version>2.5.6</spring-boot.version>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<security.oauth.version>2.1.8.RELEASE</security.oauth.version>
|
<security.oauth.version>2.1.8.RELEASE</security.oauth.version>
|
||||||
<maven.compiler.source>1.8</maven.compiler.source>
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig-common</artifactId>
|
<artifactId>pig-common</artifactId>
|
||||||
<version>3.4.0</version>
|
<version>3.4.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>pig-common-core</artifactId>
|
<artifactId>pig-common-core</artifactId>
|
||||||
|
@ -23,8 +23,7 @@ import org.springframework.context.annotation.Bean;
|
|||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||||
import org.springframework.data.redis.core.*;
|
import org.springframework.data.redis.core.*;
|
||||||
import org.springframework.data.redis.serializer.JdkSerializationRedisSerializer;
|
import org.springframework.data.redis.serializer.RedisSerializer;
|
||||||
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author lengleng
|
* @author lengleng
|
||||||
@ -38,10 +37,10 @@ public class RedisTemplateConfiguration {
|
|||||||
@Bean
|
@Bean
|
||||||
public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factory) {
|
public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factory) {
|
||||||
RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();
|
RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();
|
||||||
redisTemplate.setKeySerializer(new StringRedisSerializer());
|
redisTemplate.setKeySerializer(RedisSerializer.string());
|
||||||
redisTemplate.setHashKeySerializer(new StringRedisSerializer());
|
redisTemplate.setHashKeySerializer(RedisSerializer.string());
|
||||||
redisTemplate.setValueSerializer(new JdkSerializationRedisSerializer());
|
redisTemplate.setValueSerializer(RedisSerializer.java());
|
||||||
redisTemplate.setHashValueSerializer(new JdkSerializationRedisSerializer());
|
redisTemplate.setHashValueSerializer(RedisSerializer.java());
|
||||||
redisTemplate.setConnectionFactory(factory);
|
redisTemplate.setConnectionFactory(factory);
|
||||||
return redisTemplate;
|
return redisTemplate;
|
||||||
}
|
}
|
||||||
|
@ -95,30 +95,15 @@ public interface SecurityConstants {
|
|||||||
String RESOURCE_SERVER_CONFIGURER = "resourceServerConfigurerAdapter";
|
String RESOURCE_SERVER_CONFIGURER = "resourceServerConfigurerAdapter";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户ID字段
|
* 用户信息
|
||||||
*/
|
*/
|
||||||
String DETAILS_USER_ID = "user_id";
|
String DETAILS_USER = "user_info";
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户名字段
|
|
||||||
*/
|
|
||||||
String DETAILS_USERNAME = "username";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户部门字段
|
|
||||||
*/
|
|
||||||
String DETAILS_DEPT_ID = "dept_id";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 协议字段
|
* 协议字段
|
||||||
*/
|
*/
|
||||||
String DETAILS_LICENSE = "license";
|
String DETAILS_LICENSE = "license";
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户数据权限信息
|
|
||||||
*/
|
|
||||||
String DETAILS_USER_DATA_SCOPE = "user_data_scope";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 验证码有效期,默认 60秒
|
* 验证码有效期,默认 60秒
|
||||||
*/
|
*/
|
||||||
@ -129,4 +114,14 @@ public interface SecurityConstants {
|
|||||||
*/
|
*/
|
||||||
String CODE_SIZE = "6";
|
String CODE_SIZE = "6";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户端模式
|
||||||
|
*/
|
||||||
|
String CLIENT_CREDENTIALS = "client_credentials";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户端ID
|
||||||
|
*/
|
||||||
|
String CLIENT_ID = "clientId";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>pig-common</artifactId>
|
<artifactId>pig-common</artifactId>
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<version>3.4.0</version>
|
<version>3.4.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -61,9 +61,7 @@ public class JdbcDynamicDataSourceProvider extends AbstractJdbcDataSourceProvide
|
|||||||
String username = rs.getString(DataSourceConstants.DS_USER_NAME);
|
String username = rs.getString(DataSourceConstants.DS_USER_NAME);
|
||||||
String password = rs.getString(DataSourceConstants.DS_USER_PWD);
|
String password = rs.getString(DataSourceConstants.DS_USER_PWD);
|
||||||
String url = rs.getString(DataSourceConstants.DS_JDBC_URL);
|
String url = rs.getString(DataSourceConstants.DS_JDBC_URL);
|
||||||
String driverClassName = rs.getString(DataSourceConstants.DS_DRIVER_CLASS_NAME);
|
|
||||||
DataSourceProperty property = new DataSourceProperty();
|
DataSourceProperty property = new DataSourceProperty();
|
||||||
property.setDriverClassName(driverClassName);
|
|
||||||
property.setUsername(username);
|
property.setUsername(username);
|
||||||
property.setLazy(true);
|
property.setLazy(true);
|
||||||
property.setPassword(stringEncryptor.decrypt(password));
|
property.setPassword(stringEncryptor.decrypt(password));
|
||||||
@ -77,7 +75,6 @@ public class JdbcDynamicDataSourceProvider extends AbstractJdbcDataSourceProvide
|
|||||||
property.setPassword(properties.getPassword());
|
property.setPassword(properties.getPassword());
|
||||||
property.setUrl(properties.getUrl());
|
property.setUrl(properties.getUrl());
|
||||||
property.setLazy(true);
|
property.setLazy(true);
|
||||||
property.setDriverClassName(property.getDriverClassName());
|
|
||||||
map.put(DataSourceConstants.DS_MASTER, property);
|
map.put(DataSourceConstants.DS_MASTER, property);
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig-common</artifactId>
|
<artifactId>pig-common</artifactId>
|
||||||
<version>3.4.0</version>
|
<version>3.4.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig-common</artifactId>
|
<artifactId>pig-common</artifactId>
|
||||||
<version>3.4.0</version>
|
<version>3.4.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>pig-common-job</artifactId>
|
<artifactId>pig-common-job</artifactId>
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig-common</artifactId>
|
<artifactId>pig-common</artifactId>
|
||||||
<version>3.4.0</version>
|
<version>3.4.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>pig-common-log</artifactId>
|
<artifactId>pig-common-log</artifactId>
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig-common</artifactId>
|
<artifactId>pig-common</artifactId>
|
||||||
<version>3.4.0</version>
|
<version>3.4.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>pig-common-mybatis</artifactId>
|
<artifactId>pig-common-mybatis</artifactId>
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig-common</artifactId>
|
<artifactId>pig-common</artifactId>
|
||||||
<version>3.4.0</version>
|
<version>3.4.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>pig-common-security</artifactId>
|
<artifactId>pig-common-security</artifactId>
|
||||||
|
@ -93,7 +93,7 @@ public class PigRedisTokenStore implements TokenStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private byte[] serializeKey(String object) {
|
private byte[] serializeKey(String object) {
|
||||||
return serialize(object);
|
return serialize(prefix + object);
|
||||||
}
|
}
|
||||||
|
|
||||||
private OAuth2AccessToken deserializeAccessToken(byte[] bytes) {
|
private OAuth2AccessToken deserializeAccessToken(byte[] bytes) {
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig-common</artifactId>
|
<artifactId>pig-common</artifactId>
|
||||||
<version>3.4.0</version>
|
<version>3.4.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>pig-common-swagger</artifactId>
|
<artifactId>pig-common-swagger</artifactId>
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig-common</artifactId>
|
<artifactId>pig-common</artifactId>
|
||||||
<version>3.4.0</version>
|
<version>3.4.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>pig-common-test</artifactId>
|
<artifactId>pig-common-test</artifactId>
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig</artifactId>
|
<artifactId>pig</artifactId>
|
||||||
<version>3.4.0</version>
|
<version>3.4.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>pig-common</artifactId>
|
<artifactId>pig-common</artifactId>
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig</artifactId>
|
<artifactId>pig</artifactId>
|
||||||
<version>3.4.0</version>
|
<version>3.4.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>pig-gateway</artifactId>
|
<artifactId>pig-gateway</artifactId>
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig</artifactId>
|
<artifactId>pig</artifactId>
|
||||||
<version>3.4.0</version>
|
<version>3.4.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>pig-register</artifactId>
|
<artifactId>pig-register</artifactId>
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig-upms</artifactId>
|
<artifactId>pig-upms</artifactId>
|
||||||
<version>3.4.0</version>
|
<version>3.4.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>pig-upms-api</artifactId>
|
<artifactId>pig-upms-api</artifactId>
|
||||||
|
@ -53,8 +53,8 @@ public interface RemoteUserService {
|
|||||||
* @param from 调用标志
|
* @param from 调用标志
|
||||||
* @return R
|
* @return R
|
||||||
*/
|
*/
|
||||||
@GetMapping("/app/info/{mobile}")
|
@GetMapping("/app/info/{phone}")
|
||||||
R<UserInfo> infoByMobile(@PathVariable("mobile") String mobile, @RequestHeader(SecurityConstants.FROM) String from);
|
R<UserInfo> infoByMobile(@PathVariable("phone") String phone, @RequestHeader(SecurityConstants.FROM) String from);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据部门id,查询对应的用户 id 集合
|
* 根据部门id,查询对应的用户 id 集合
|
||||||
|
@ -56,8 +56,8 @@ public class RemoteUserServiceFallbackImpl implements RemoteUserService {
|
|||||||
* @return R
|
* @return R
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public R<UserInfo> infoByMobile(String mobile, String from) {
|
public R<UserInfo> infoByMobile(String phone, String from) {
|
||||||
log.error("feign 查询用户信息失败手机号码:{}", mobile, cause);
|
log.error("feign 查询用户信息失败手机号码:{}", phone, cause);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig-upms</artifactId>
|
<artifactId>pig-upms</artifactId>
|
||||||
<version>3.4.0</version>
|
<version>3.4.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>pig-upms-biz</artifactId>
|
<artifactId>pig-upms-biz</artifactId>
|
||||||
|
@ -39,11 +39,11 @@ public class AppController {
|
|||||||
* @return 用户信息
|
* @return 用户信息
|
||||||
*/
|
*/
|
||||||
@Inner
|
@Inner
|
||||||
@GetMapping("/info/{mobile}")
|
@GetMapping("/info/{phone}")
|
||||||
public R infoByMobile(@PathVariable String mobile) {
|
public R infoByMobile(@PathVariable String phone) {
|
||||||
SysUser user = userService.getOne(Wrappers.<SysUser>query().lambda().eq(SysUser::getPhone, mobile));
|
SysUser user = userService.getOne(Wrappers.<SysUser>query().lambda().eq(SysUser::getPhone, phone));
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return R.failed(String.format("用户信息为空 %s", mobile));
|
return R.failed(String.format("用户信息为空 %s", phone));
|
||||||
}
|
}
|
||||||
return R.ok(userService.getUserInfo(user));
|
return R.ok(userService.getUserInfo(user));
|
||||||
}
|
}
|
||||||
|
@ -16,8 +16,6 @@
|
|||||||
|
|
||||||
package com.pig4cloud.pig.admin.controller;
|
package com.pig4cloud.pig.admin.controller;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.pig4cloud.pig.admin.api.entity.SysMenu;
|
import com.pig4cloud.pig.admin.api.entity.SysMenu;
|
||||||
import com.pig4cloud.pig.admin.service.SysMenuService;
|
import com.pig4cloud.pig.admin.service.SysMenuService;
|
||||||
import com.pig4cloud.pig.common.core.util.R;
|
import com.pig4cloud.pig.common.core.util.R;
|
||||||
@ -29,6 +27,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -52,9 +51,9 @@ public class MenuController {
|
|||||||
@GetMapping
|
@GetMapping
|
||||||
public R getUserMenu(Integer parentId) {
|
public R getUserMenu(Integer parentId) {
|
||||||
// 获取符合条件的菜单
|
// 获取符合条件的菜单
|
||||||
Set<SysMenu> sysMenuList = sysMenuService
|
Set<SysMenu> menuSet = SecurityUtils.getRoles().stream().map(sysMenuService::findMenuByRoleId)
|
||||||
.findMenuByRoleId(CollUtil.join(SecurityUtils.getRoles(), StrUtil.COMMA));
|
.flatMap(Collection::stream).collect(Collectors.toSet());
|
||||||
return R.ok(sysMenuService.filterMenu(sysMenuList, parentId));
|
return R.ok(sysMenuService.filterMenu(menuSet, parentId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -75,8 +74,8 @@ public class MenuController {
|
|||||||
*/
|
*/
|
||||||
@GetMapping("/tree/{roleId}")
|
@GetMapping("/tree/{roleId}")
|
||||||
public R getRoleTree(@PathVariable Integer roleId) {
|
public R getRoleTree(@PathVariable Integer roleId) {
|
||||||
return R.ok(sysMenuService.findMenuByRoleId(String.valueOf(roleId)).stream().map(SysMenu::getMenuId)
|
return R.ok(
|
||||||
.collect(Collectors.toList()));
|
sysMenuService.findMenuByRoleId(roleId).stream().map(SysMenu::getMenuId).collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -47,7 +47,7 @@ public class OauthClientDetailsController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过ID查询
|
* 通过ID查询
|
||||||
* @param id clientId
|
* @param clientId 客户端id
|
||||||
* @return SysOauthClientDetails
|
* @return SysOauthClientDetails
|
||||||
*/
|
*/
|
||||||
@GetMapping("/{clientId}")
|
@GetMapping("/{clientId}")
|
||||||
|
@ -38,6 +38,6 @@ public interface SysMenuMapper extends BaseMapper<SysMenu> {
|
|||||||
* @param roleId 角色ID
|
* @param roleId 角色ID
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Set<SysMenu> listMenusByRoleId(String roleIds);
|
Set<SysMenu> listMenusByRoleId(Integer roleIds);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -50,29 +50,28 @@ public class AppServiceImpl implements AppService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送手机验证码 TODO: 调用短信网关发送验证码,测试返回前端
|
* 发送手机验证码 TODO: 调用短信网关发送验证码,测试返回前端
|
||||||
* @param mobile mobile
|
* @param phone 手机号
|
||||||
* @return code
|
* @return code
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public R<Boolean> sendSmsCode(String mobile) {
|
public R<Boolean> sendSmsCode(String phone) {
|
||||||
List<SysUser> userList = userMapper
|
List<SysUser> userList = userMapper.selectList(Wrappers.<SysUser>query().lambda().eq(SysUser::getPhone, phone));
|
||||||
.selectList(Wrappers.<SysUser>query().lambda().eq(SysUser::getPhone, mobile));
|
|
||||||
|
|
||||||
if (CollUtil.isEmpty(userList)) {
|
if (CollUtil.isEmpty(userList)) {
|
||||||
log.info("手机号未注册:{}", mobile);
|
log.info("手机号未注册:{}", phone);
|
||||||
return R.ok(Boolean.FALSE, "手机号未注册");
|
return R.ok(Boolean.FALSE, "手机号未注册");
|
||||||
}
|
}
|
||||||
|
|
||||||
Object codeObj = redisTemplate.opsForValue().get(CacheConstants.DEFAULT_CODE_KEY + mobile);
|
Object codeObj = redisTemplate.opsForValue().get(CacheConstants.DEFAULT_CODE_KEY + phone);
|
||||||
|
|
||||||
if (codeObj != null) {
|
if (codeObj != null) {
|
||||||
log.info("手机号验证码未过期:{},{}", mobile, codeObj);
|
log.info("手机号验证码未过期:{},{}", phone, codeObj);
|
||||||
return R.ok(Boolean.FALSE, "验证码发送过频繁");
|
return R.ok(Boolean.FALSE, "验证码发送过频繁");
|
||||||
}
|
}
|
||||||
|
|
||||||
String code = RandomUtil.randomNumbers(Integer.parseInt(SecurityConstants.CODE_SIZE));
|
String code = RandomUtil.randomNumbers(Integer.parseInt(SecurityConstants.CODE_SIZE));
|
||||||
log.info("手机号生成验证码成功:{},{}", mobile, code);
|
log.info("手机号生成验证码成功:{},{}", phone, code);
|
||||||
redisTemplate.opsForValue().set(CacheConstants.DEFAULT_CODE_KEY + mobile, code, SecurityConstants.CODE_TIME,
|
redisTemplate.opsForValue().set(CacheConstants.DEFAULT_CODE_KEY + phone, code, SecurityConstants.CODE_TIME,
|
||||||
TimeUnit.SECONDS);
|
TimeUnit.SECONDS);
|
||||||
return R.ok(Boolean.TRUE, code);
|
return R.ok(Boolean.TRUE, code);
|
||||||
}
|
}
|
||||||
|
@ -35,10 +35,10 @@ public interface SysMenuService extends IService<SysMenu> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过角色编号查询URL 权限
|
* 通过角色编号查询URL 权限
|
||||||
* @param roleIds 角色ID
|
* @param roleId 角色ID
|
||||||
* @return 菜单列表
|
* @return 菜单列表
|
||||||
*/
|
*/
|
||||||
Set<SysMenu> findMenuByRoleId(String roleIds);
|
Set<SysMenu> findMenuByRoleId(Integer roleId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 级联删除菜单
|
* 级联删除菜单
|
||||||
|
@ -61,9 +61,9 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||||||
private final SysRoleMenuMapper sysRoleMenuMapper;
|
private final SysRoleMenuMapper sysRoleMenuMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Cacheable(value = CacheConstants.MENU_DETAILS, key = "#roleIds + '_menu'", unless = "#result == null")
|
@Cacheable(value = CacheConstants.MENU_DETAILS, key = "#roleId + '_menu'", unless = "#result == null")
|
||||||
public Set<SysMenu> findMenuByRoleId(String roleIds) {
|
public Set<SysMenu> findMenuByRoleId(Integer roleId) {
|
||||||
return baseMapper.listMenusByRoleId(roleIds);
|
return baseMapper.listMenusByRoleId(roleId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -25,11 +25,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.pig4cloud.pig.admin.api.dto.UserDTO;
|
import com.pig4cloud.pig.admin.api.dto.UserDTO;
|
||||||
import com.pig4cloud.pig.admin.api.dto.UserInfo;
|
import com.pig4cloud.pig.admin.api.dto.UserInfo;
|
||||||
import com.pig4cloud.pig.admin.api.entity.SysDept;
|
import com.pig4cloud.pig.admin.api.entity.*;
|
||||||
import com.pig4cloud.pig.admin.api.entity.SysMenu;
|
|
||||||
import com.pig4cloud.pig.admin.api.entity.SysRole;
|
|
||||||
import com.pig4cloud.pig.admin.api.entity.SysUser;
|
|
||||||
import com.pig4cloud.pig.admin.api.entity.SysUserRole;
|
|
||||||
import com.pig4cloud.pig.admin.api.vo.UserExcelVO;
|
import com.pig4cloud.pig.admin.api.vo.UserExcelVO;
|
||||||
import com.pig4cloud.pig.admin.api.vo.UserVO;
|
import com.pig4cloud.pig.admin.api.vo.UserVO;
|
||||||
import com.pig4cloud.pig.admin.mapper.SysDeptMapper;
|
import com.pig4cloud.pig.admin.mapper.SysDeptMapper;
|
||||||
@ -55,10 +51,7 @@ import org.springframework.util.Assert;
|
|||||||
import org.springframework.validation.BindingResult;
|
import org.springframework.validation.BindingResult;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.HashSet;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -118,10 +111,9 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||||||
List<Integer> roleIds = roleList.stream().map(SysRole::getRoleId).collect(Collectors.toList());
|
List<Integer> roleIds = roleList.stream().map(SysRole::getRoleId).collect(Collectors.toList());
|
||||||
userInfo.setRoles(ArrayUtil.toArray(roleIds, Integer.class));
|
userInfo.setRoles(ArrayUtil.toArray(roleIds, Integer.class));
|
||||||
// 设置权限列表(menu.permission)
|
// 设置权限列表(menu.permission)
|
||||||
Set<String> permissions = sysMenuService.findMenuByRoleId(CollUtil.join(roleIds, StrUtil.COMMA)).stream()
|
Set<String> permissions = roleIds.stream().map(sysMenuService::findMenuByRoleId).flatMap(Collection::stream)
|
||||||
.filter(m -> MenuTypeEnum.BUTTON.getType().equals(m.getType()))
|
.filter(m -> MenuTypeEnum.BUTTON.getType().equals(m.getType())).map(SysMenu::getPermission)
|
||||||
.filter(m -> StrUtil.isNotBlank(m.getPermission())).map(SysMenu::getPermission)
|
.filter(StrUtil::isNotBlank).collect(Collectors.toSet());
|
||||||
.collect(Collectors.toSet());
|
|
||||||
userInfo.setPermissions(ArrayUtil.toArray(permissions, String.class));
|
userInfo.setPermissions(ArrayUtil.toArray(permissions, String.class));
|
||||||
|
|
||||||
return userInfo;
|
return userInfo;
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
LEFT JOIN sys_role_menu ON sys_menu.menu_id = sys_role_menu.menu_id
|
LEFT JOIN sys_role_menu ON sys_menu.menu_id = sys_role_menu.menu_id
|
||||||
WHERE
|
WHERE
|
||||||
sys_menu.del_flag = 0
|
sys_menu.del_flag = 0
|
||||||
AND sys_role_menu.role_id IN (#{roleIds})
|
AND sys_role_menu.role_id = #{roleId}
|
||||||
ORDER BY
|
ORDER BY
|
||||||
sys_menu.sort DESC
|
sys_menu.sort DESC
|
||||||
</select>
|
</select>
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig</artifactId>
|
<artifactId>pig</artifactId>
|
||||||
<version>3.4.0</version>
|
<version>3.4.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>pig-upms</artifactId>
|
<artifactId>pig-upms</artifactId>
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig-visual</artifactId>
|
<artifactId>pig-visual</artifactId>
|
||||||
<version>3.4.0</version>
|
<version>3.4.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>pig-codegen</artifactId>
|
<artifactId>pig-codegen</artifactId>
|
||||||
|
@ -59,11 +59,6 @@ public class GenDatasourceConf extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
/**
|
|
||||||
* 驱动类型
|
|
||||||
*/
|
|
||||||
private String driverClassName;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除标记
|
* 删除标记
|
||||||
*/
|
*/
|
||||||
|
@ -119,7 +119,6 @@ public class GenDatasourceConfServiceImpl extends ServiceImpl<GenDatasourceConfM
|
|||||||
dataSourceProperty.setUrl(conf.getUrl());
|
dataSourceProperty.setUrl(conf.getUrl());
|
||||||
dataSourceProperty.setUsername(conf.getUsername());
|
dataSourceProperty.setUsername(conf.getUsername());
|
||||||
dataSourceProperty.setPassword(conf.getPassword());
|
dataSourceProperty.setPassword(conf.getPassword());
|
||||||
dataSourceProperty.setDriverClassName(conf.getDriverClassName());
|
|
||||||
dataSourceProperty.setLazy(true);
|
dataSourceProperty.setLazy(true);
|
||||||
DataSource dataSource = hikariDataSourceCreator.createDataSource(dataSourceProperty);
|
DataSource dataSource = hikariDataSourceCreator.createDataSource(dataSourceProperty);
|
||||||
SpringContextHolder.getBean(DynamicRoutingDataSource.class).addDataSource(dataSourceProperty.getPoolName(),
|
SpringContextHolder.getBean(DynamicRoutingDataSource.class).addDataSource(dataSourceProperty.getPoolName(),
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
#set($excludeColumns = ["create_time","update_time","create_by","update_by"])
|
|
||||||
|
|
||||||
export const tableOption = {
|
export const tableOption = {
|
||||||
"border": true,
|
"border": true,
|
||||||
"index": true,
|
"index": true,
|
||||||
@ -9,6 +7,7 @@ export const tableOption = {
|
|||||||
"align": "center",
|
"align": "center",
|
||||||
"searchMenuSpan": 6,
|
"searchMenuSpan": 6,
|
||||||
"column": [
|
"column": [
|
||||||
|
#set($excludeColumns = ["create_time","update_time","create_by","update_by"])
|
||||||
#foreach ($column in $columns)
|
#foreach ($column in $columns)
|
||||||
## 当列是主键 或者 列是审计字段时候, 新增不显示,编辑的时候显示单不能编辑
|
## 当列是主键 或者 列是审计字段时候, 新增不显示,编辑的时候显示单不能编辑
|
||||||
#if($column.columnName == $pk.columnName || $excludeColumns.contains($column.columnName))
|
#if($column.columnName == $pk.columnName || $excludeColumns.contains($column.columnName))
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig-visual</artifactId>
|
<artifactId>pig-visual</artifactId>
|
||||||
<version>3.4.0</version>
|
<version>3.4.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>pig-monitor</artifactId>
|
<artifactId>pig-monitor</artifactId>
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig-visual</artifactId>
|
<artifactId>pig-visual</artifactId>
|
||||||
<version>3.4.0</version>
|
<version>3.4.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>pig-sentinel-dashboard</artifactId>
|
<artifactId>pig-sentinel-dashboard</artifactId>
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig-visual</artifactId>
|
<artifactId>pig-visual</artifactId>
|
||||||
<version>3.4.0</version>
|
<version>3.4.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>pig-xxl-job-admin</artifactId>
|
<artifactId>pig-xxl-job-admin</artifactId>
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig</artifactId>
|
<artifactId>pig</artifactId>
|
||||||
<version>3.4.0</version>
|
<version>3.4.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>pig-visual</artifactId>
|
<artifactId>pig-visual</artifactId>
|
||||||
|
6
pom.xml
6
pom.xml
@ -22,7 +22,7 @@
|
|||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig</artifactId>
|
<artifactId>pig</artifactId>
|
||||||
<name>${project.artifactId}</name>
|
<name>${project.artifactId}</name>
|
||||||
<version>3.4.0</version>
|
<version>3.4.1</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<url>https://www.pig4cloud.com</url>
|
<url>https://www.pig4cloud.com</url>
|
||||||
|
|
||||||
@ -33,8 +33,8 @@
|
|||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<maven.compiler.source>1.8</maven.compiler.source>
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
<maven.compiler.target>1.8</maven.compiler.target>
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
<spring-boot-admin.version>2.5.2</spring-boot-admin.version>
|
<spring-boot-admin.version>2.5.4</spring-boot-admin.version>
|
||||||
<hutool.version>5.7.15</hutool.version>
|
<hutool.version>5.7.16</hutool.version>
|
||||||
<dynamic-ds.version>3.4.1</dynamic-ds.version>
|
<dynamic-ds.version>3.4.1</dynamic-ds.version>
|
||||||
<captcha.version>2.2.1</captcha.version>
|
<captcha.version>2.2.1</captcha.version>
|
||||||
<velocity.version>1.7</velocity.version>
|
<velocity.version>1.7</velocity.version>
|
||||||
|
Loading…
Reference in New Issue
Block a user