Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
zlt2000
microservices-platform
提交
110bdc5a
microservices-platform
项目概览
zlt2000
/
microservices-platform
大约 1 年 前同步成功
通知
16
Star
4
Fork
3
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
microservices-platform
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
110bdc5a
编写于
2月 04, 2019
作者:
zlt2000
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加sonar测试并修复sonar测试的问题
上级
e16d8f5d
变更
58
隐藏空白更改
内联
并排
Showing
58 changed file
with
181 addition
and
233 deletion
+181
-233
.gitignore
.gitignore
+2
-1
README.md
README.md
+1
-1
pom.xml
pom.xml
+11
-0
zlt-business/code-generator/src/main/java/com/central/generator/controller/SysGeneratorController.java
.../central/generator/controller/SysGeneratorController.java
+6
-9
zlt-business/code-generator/src/main/java/com/central/generator/utils/GenUtils.java
...r/src/main/java/com/central/generator/utils/GenUtils.java
+20
-12
zlt-business/file-center/src/main/java/com/central/file/config/AliyunOSSConfig.java
...rc/main/java/com/central/file/config/AliyunOSSConfig.java
+0
-1
zlt-business/file-center/src/main/java/com/central/file/config/OssServiceFactory.java
.../main/java/com/central/file/config/OssServiceFactory.java
+2
-1
zlt-business/file-center/src/main/java/com/central/file/service/impl/AbstractIFileService.java
...a/com/central/file/service/impl/AbstractIFileService.java
+0
-1
zlt-business/file-center/src/main/java/com/central/file/service/impl/AliyunOssServiceImplI.java
.../com/central/file/service/impl/AliyunOssServiceImplI.java
+0
-1
zlt-business/file-center/src/main/java/com/central/file/service/impl/QiniuOssServiceImplI.java
...a/com/central/file/service/impl/QiniuOssServiceImplI.java
+0
-9
zlt-business/file-center/src/main/java/com/central/file/utils/FileUtil.java
...center/src/main/java/com/central/file/utils/FileUtil.java
+7
-2
zlt-business/user-center/src/main/java/com/central/user/controller/SysMenuController.java
...n/java/com/central/user/controller/SysMenuController.java
+3
-5
zlt-business/user-center/src/main/java/com/central/user/controller/SysUserController.java
...n/java/com/central/user/controller/SysUserController.java
+6
-4
zlt-business/user-center/src/main/java/com/central/user/service/impl/SysMenuServiceImpl.java
...ava/com/central/user/service/impl/SysMenuServiceImpl.java
+1
-3
zlt-business/user-center/src/main/java/com/central/user/service/impl/SysRoleServiceImpl.java
...ava/com/central/user/service/impl/SysRoleServiceImpl.java
+1
-0
zlt-business/user-center/src/main/java/com/central/user/service/impl/SysUserServiceImpl.java
...ava/com/central/user/service/impl/SysUserServiceImpl.java
+6
-12
zlt-commons/zlt-auth-client-spring-boot-starter/src/main/java/com/central/oauth2/common/config/DefaultSecurityHandlerConfig.java
...al/oauth2/common/config/DefaultSecurityHandlerConfig.java
+1
-3
zlt-commons/zlt-auth-client-spring-boot-starter/src/main/java/com/central/oauth2/common/store/RedisTemplateTokenStore.java
.../central/oauth2/common/store/RedisTemplateTokenStore.java
+8
-12
zlt-commons/zlt-auth-client-spring-boot-starter/src/main/java/com/central/oauth2/common/store/ResJwtTokenStore.java
...ava/com/central/oauth2/common/store/ResJwtTokenStore.java
+2
-2
zlt-commons/zlt-auth-client-spring-boot-starter/src/main/java/com/central/oauth2/common/util/AuthUtils.java
...c/main/java/com/central/oauth2/common/util/AuthUtils.java
+9
-4
zlt-commons/zlt-common-spring-boot-starter/src/main/java/com/central/common/constant/CommonConstant.java
...main/java/com/central/common/constant/CommonConstant.java
+0
-5
zlt-commons/zlt-common-spring-boot-starter/src/main/java/com/central/common/model/CodeEnum.java
...rter/src/main/java/com/central/common/model/CodeEnum.java
+0
-4
zlt-commons/zlt-common-spring-boot-starter/src/main/java/com/central/common/model/LoginAppUser.java
.../src/main/java/com/central/common/model/LoginAppUser.java
+1
-3
zlt-commons/zlt-common-spring-boot-starter/src/main/java/com/central/common/model/Result.java
...tarter/src/main/java/com/central/common/model/Result.java
+2
-2
zlt-commons/zlt-common-spring-boot-starter/src/main/java/com/central/common/utils/DateUtils.java
...ter/src/main/java/com/central/common/utils/DateUtils.java
+4
-0
zlt-commons/zlt-common-spring-boot-starter/src/main/java/com/central/common/utils/ExcelUtil.java
...ter/src/main/java/com/central/common/utils/ExcelUtil.java
+9
-6
zlt-commons/zlt-common-spring-boot-starter/src/main/java/com/central/common/utils/PhoneUtil.java
...ter/src/main/java/com/central/common/utils/PhoneUtil.java
+4
-0
zlt-commons/zlt-common-spring-boot-starter/src/main/java/com/central/common/utils/ResponseUtil.java
.../src/main/java/com/central/common/utils/ResponseUtil.java
+3
-0
zlt-commons/zlt-common-spring-boot-starter/src/main/java/com/central/common/utils/SpringUtil.java
...er/src/main/java/com/central/common/utils/SpringUtil.java
+1
-2
zlt-commons/zlt-common-spring-boot-starter/src/main/java/com/central/common/utils/SysUserUtil.java
...r/src/main/java/com/central/common/utils/SysUserUtil.java
+4
-8
zlt-commons/zlt-common-spring-boot-starter/src/main/java/com/central/common/utils/UUIDUtil.java
...rter/src/main/java/com/central/common/utils/UUIDUtil.java
+6
-3
zlt-commons/zlt-db-spring-boot-starter/src/main/java/com/central/db/config/DateMetaObjectHandler.java
...ain/java/com/central/db/config/DateMetaObjectHandler.java
+7
-5
zlt-commons/zlt-db-spring-boot-starter/src/main/java/com/central/db/config/DefaultMybatisPlusConfig.java
.../java/com/central/db/config/DefaultMybatisPlusConfig.java
+1
-2
zlt-commons/zlt-log-spring-boot-starter/src/main/java/com/central/log/monitor/PointUtil.java
...rter/src/main/java/com/central/log/monitor/PointUtil.java
+4
-0
zlt-commons/zlt-redis-spring-boot-starter/src/main/java/com/central/common/redis/RedisAutoConfigure.java
...ain/java/com/central/common/redis/RedisAutoConfigure.java
+1
-2
zlt-commons/zlt-redis-spring-boot-starter/src/main/java/com/central/common/redis/constant/RedisToolsConstant.java
...com/central/common/redis/constant/RedisToolsConstant.java
+3
-1
zlt-commons/zlt-redis-spring-boot-starter/src/main/java/com/central/common/redis/lock/RedisDistributedLock.java
...a/com/central/common/redis/lock/RedisDistributedLock.java
+2
-1
zlt-commons/zlt-redis-spring-boot-starter/src/main/java/com/central/common/redis/template/RedisRepository.java
...va/com/central/common/redis/template/RedisRepository.java
+2
-1
zlt-commons/zlt-redis-spring-boot-starter/src/main/java/com/central/common/redis/util/RedisObjectSerializer.java
.../com/central/common/redis/util/RedisObjectSerializer.java
+10
-6
zlt-commons/zlt-swagger2-spring-boot-starter/src/main/java/com/central/common/swagger2/SwaggerAutoConfiguration.java
...com/central/common/swagger2/SwaggerAutoConfiguration.java
+4
-3
zlt-commons/zlt-swagger2-spring-boot-starter/src/main/java/com/central/common/swagger2/SwaggerProperties.java
...n/java/com/central/common/swagger2/SwaggerProperties.java
+4
-42
zlt-gateway/zuul-gateway/src/main/java/com/central/gateway/feign/fallback/MenuServiceFallbackFactory.java
...al/gateway/feign/fallback/MenuServiceFallbackFactory.java
+0
-6
zlt-uaa/src/main/java/com/central/oauth/config/SecurityHandlerConfig.java
.../java/com/central/oauth/config/SecurityHandlerConfig.java
+0
-1
zlt-uaa/src/main/java/com/central/oauth/controller/OAuth2Controller.java
...n/java/com/central/oauth/controller/OAuth2Controller.java
+1
-1
zlt-uaa/src/main/java/com/central/oauth/controller/ValidateCodeController.java
.../com/central/oauth/controller/ValidateCodeController.java
+1
-2
zlt-uaa/src/main/java/com/central/oauth/filter/ValidateCodeFilter.java
...ain/java/com/central/oauth/filter/ValidateCodeFilter.java
+1
-1
zlt-uaa/src/main/java/com/central/oauth/handler/OauthLogoutHandler.java
...in/java/com/central/oauth/handler/OauthLogoutHandler.java
+0
-1
zlt-uaa/src/main/java/com/central/oauth/mapper/ClientMapper.java
.../src/main/java/com/central/oauth/mapper/ClientMapper.java
+0
-8
zlt-uaa/src/main/java/com/central/oauth/mobile/MobileAuthenticationProvider.java
...om/central/oauth/mobile/MobileAuthenticationProvider.java
+1
-1
zlt-uaa/src/main/java/com/central/oauth/mobile/MobileAuthenticationToken.java
...a/com/central/oauth/mobile/MobileAuthenticationToken.java
+1
-1
zlt-uaa/src/main/java/com/central/oauth/openid/OpenIdAuthenticationProvider.java
...om/central/oauth/openid/OpenIdAuthenticationProvider.java
+1
-1
zlt-uaa/src/main/java/com/central/oauth/openid/OpenIdAuthenticationToken.java
...a/com/central/oauth/openid/OpenIdAuthenticationToken.java
+1
-4
zlt-uaa/src/main/java/com/central/oauth/service/ZltUserDetailsService.java
...java/com/central/oauth/service/ZltUserDetailsService.java
+7
-1
zlt-uaa/src/main/java/com/central/oauth/service/impl/ClientServiceImpl.java
...ava/com/central/oauth/service/impl/ClientServiceImpl.java
+0
-1
zlt-uaa/src/main/java/com/central/oauth/service/impl/RedisClientDetailsService.java
...central/oauth/service/impl/RedisClientDetailsService.java
+5
-7
zlt-uaa/src/main/java/com/central/oauth/service/impl/UserDetailServiceImpl.java
...com/central/oauth/service/impl/UserDetailServiceImpl.java
+3
-3
zlt-uaa/src/main/java/com/central/oauth/service/impl/ValidateCodeServiceImpl.java
...m/central/oauth/service/impl/ValidateCodeServiceImpl.java
+1
-1
zlt-web/back-web/src/main/resources/static/pages/generator/list.html
...k-web/src/main/resources/static/pages/generator/list.html
+0
-14
未找到文件。
.gitignore
浏览文件 @
110bdc5a
/.idea/
/logs/
\ No newline at end of file
/logs/
/target/
\ No newline at end of file
README.md
浏览文件 @
110bdc5a
...
...
@@ -103,7 +103,7 @@ central-platform -- 父项目,公共依赖
<table>
<tr>
<td><img
src=
"https://gitee.com/zlt2000/images/raw/master/持续集成2.png"
/></td>
<td><img
src=
"https://gitee.com/zlt2000/images/raw/master/
持续集成
.png"
/></td>
<td><img
src=
"https://gitee.com/zlt2000/images/raw/master/
sonar结果
.png"
/></td>
</tr>
<tr>
<td><img
src=
"https://gitee.com/zlt2000/images/raw/master/elk.png"
/></td>
...
...
pom.xml
浏览文件 @
110bdc5a
...
...
@@ -40,6 +40,7 @@
<spring-boot-dependencies.version>
2.0.8.RELEASE
</spring-boot-dependencies.version>
<spring-cloud-dependencies.version>
Finchley.SR2
</spring-cloud-dependencies.version>
<spring-boot-maven-plugin.version>
2.1.1.RELEASE
</spring-boot-maven-plugin.version>
<sonar.exclusions>
zlt-job/**/*, zlt-register/**/*, zlt-web/**/*
</sonar.exclusions>
</properties>
<dependencies>
...
...
@@ -301,6 +302,16 @@
</pluginManagement>
</build>
<repositories>
<repository>
<id>
aliyun-repos
</id>
<url>
http://maven.aliyun.com/nexus/content/groups/public/
</url>
<snapshots>
<enabled>
false
</enabled>
</snapshots>
</repository>
</repositories>
<modules>
<!-- 公共 -->
<module>
zlt-commons
</module>
...
...
zlt-business/code-generator/src/main/java/com/central/generator/controller/SysGeneratorController.java
浏览文件 @
110bdc5a
...
...
@@ -9,10 +9,7 @@ import com.central.common.model.PageResult;
import
com.central.generator.service.SysGeneratorService
;
import
org.apache.commons.io.IOUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
io.swagger.annotations.Api
;
...
...
@@ -30,16 +27,16 @@ public class SysGeneratorController {
* 列表
*/
@ResponseBody
@
Reques
tMapping
(
"/list"
)
public
PageResult
l
ist
(
@RequestParam
Map
<
String
,
Object
>
params
)
{
@
Ge
tMapping
(
"/list"
)
public
PageResult
getTableL
ist
(
@RequestParam
Map
<
String
,
Object
>
params
)
{
return
sysGeneratorService
.
queryList
(
params
);
}
/**
* 生成代码
* 生成代码
FileUtil
*/
@
Reques
tMapping
(
"/code"
)
public
void
c
ode
(
String
tables
,
HttpServletResponse
response
)
throws
IOException
{
@
Ge
tMapping
(
"/code"
)
public
void
makeC
ode
(
String
tables
,
HttpServletResponse
response
)
throws
IOException
{
byte
[]
data
=
sysGeneratorService
.
generatorCode
(
tables
.
split
(
","
));
response
.
reset
();
response
.
setHeader
(
"Content-Disposition"
,
"attachment; filename=\"generator.zip\""
);
...
...
zlt-business/code-generator/src/main/java/com/central/generator/utils/GenUtils.java
浏览文件 @
110bdc5a
...
...
@@ -3,6 +3,7 @@ package com.central.generator.utils;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.StringWriter
;
import
java.nio.charset.StandardCharsets
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashMap
;
...
...
@@ -33,6 +34,10 @@ import org.apache.velocity.app.Velocity;
*/
@Slf4j
public
class
GenUtils
{
private
GenUtils
()
{
throw
new
IllegalStateException
(
"Utility class"
);
}
private
final
static
String
FILE_NAME_MODEL
=
"Model.java.vm"
;
private
final
static
String
FILE_NAME_MAPPER
=
"Mapper.java.vm"
;
private
final
static
String
FILE_NAME_MAPPERXML
=
"Mapper.xml.vm"
;
...
...
@@ -40,17 +45,20 @@ public class GenUtils {
private
final
static
String
FILE_NAME_SERVICEIMPL
=
"ServiceImpl.java.vm"
;
private
final
static
String
FILE_NAME_CONTROLLER
=
"Controller.java.vm"
;
private
final
static
String
FILE_NAME_PAGE
=
"index.html.vm"
;
private
final
static
String
TEMPLATE_PATH
=
"template/"
;
private
final
static
String
PACKAGE
=
"package"
;
private
final
static
String
MODULE_NAME
=
"moduleName"
;
public
static
List
<
String
>
getTemplates
()
{
List
<
String
>
templates
=
new
ArrayList
<
String
>();
templates
.
add
(
"template/"
+
FILE_NAME_MODEL
);
templates
.
add
(
"template/"
+
FILE_NAME_MAPPER
);
templates
.
add
(
"template/"
+
FILE_NAME_MAPPERXML
);
templates
.
add
(
"template/"
+
FILE_NAME_SERVICE
);
templates
.
add
(
"template/"
+
FILE_NAME_SERVICEIMPL
);
templates
.
add
(
"template/"
+
FILE_NAME_CONTROLLER
);
List
<
String
>
templates
=
new
ArrayList
<>();
templates
.
add
(
TEMPLATE_PATH
+
FILE_NAME_MODEL
);
templates
.
add
(
TEMPLATE_PATH
+
FILE_NAME_MAPPER
);
templates
.
add
(
TEMPLATE_PATH
+
FILE_NAME_MAPPERXML
);
templates
.
add
(
TEMPLATE_PATH
+
FILE_NAME_SERVICE
);
templates
.
add
(
TEMPLATE_PATH
+
FILE_NAME_SERVICEIMPL
);
templates
.
add
(
TEMPLATE_PATH
+
FILE_NAME_CONTROLLER
);
templates
.
add
(
"template/"
+
FILE_NAME_PAGE
);
templates
.
add
(
TEMPLATE_PATH
+
FILE_NAME_PAGE
);
return
templates
;
}
...
...
@@ -123,8 +131,8 @@ public class GenUtils {
map
.
put
(
"columns"
,
tableEntity
.
getColumns
());
map
.
put
(
"hasBigDecimal"
,
hasBigDecimal
);
map
.
put
(
"mainPath"
,
mainPath
);
map
.
put
(
"package"
,
config
.
getString
(
"package"
));
map
.
put
(
"moduleName"
,
config
.
getString
(
"moduleName"
));
map
.
put
(
PACKAGE
,
config
.
getString
(
PACKAGE
));
map
.
put
(
MODULE_NAME
,
config
.
getString
(
MODULE_NAME
));
map
.
put
(
"author"
,
config
.
getString
(
"author"
));
map
.
put
(
"email"
,
config
.
getString
(
"email"
));
map
.
put
(
"datetime"
,
DateUtils
.
format
(
new
Date
(),
DateUtils
.
DATE_TIME_PATTERN
));
...
...
@@ -141,8 +149,8 @@ public class GenUtils {
tpl
.
merge
(
context
,
sw
);
//添加到zip
zip
.
putNextEntry
(
new
ZipEntry
(
getFileName
(
template
,
tableEntity
.
getClassName
(),
config
.
getString
(
"package"
),
config
.
getString
(
"moduleName"
))));
IOUtils
.
write
(
sw
.
toString
(),
zip
,
"UTF-8"
);
zip
.
putNextEntry
(
new
ZipEntry
(
getFileName
(
template
,
tableEntity
.
getClassName
(),
config
.
getString
(
PACKAGE
),
config
.
getString
(
MODULE_NAME
))));
IOUtils
.
write
(
sw
.
toString
(),
zip
,
StandardCharsets
.
UTF_8
);
zip
.
closeEntry
();
}
catch
(
IOException
e
)
{
log
.
error
(
"generatorCode-error"
,
e
);
...
...
zlt-business/file-center/src/main/java/com/central/file/config/AliyunOSSConfig.java
浏览文件 @
110bdc5a
package
com.central.file.config
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
...
...
zlt-business/file-center/src/main/java/com/central/file/config/OssServiceFactory.java
浏览文件 @
110bdc5a
package
com.central.file.config
;
import
java.util.EnumMap
;
import
java.util.HashMap
;
import
java.util.Map
;
...
...
@@ -19,7 +20,7 @@ import com.central.file.model.FileType;
@Configuration
public
class
OssServiceFactory
{
private
Map
<
FileType
,
IFileService
>
map
=
new
HashMap
<>(
);
private
Map
<
FileType
,
IFileService
>
map
=
new
EnumMap
<>(
FileType
.
class
);
@Autowired
private
IFileService
aliyunOssServiceImpl
;
...
...
zlt-business/file-center/src/main/java/com/central/file/service/impl/AbstractIFileService.java
浏览文件 @
110bdc5a
...
...
@@ -5,7 +5,6 @@ import java.util.Map;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.central.common.model.SysUser
;
import
org.apache.commons.collections4.MapUtils
;
import
org.springframework.web.multipart.MultipartFile
;
...
...
zlt-business/file-center/src/main/java/com/central/file/service/impl/AliyunOssServiceImplI.java
浏览文件 @
110bdc5a
...
...
@@ -6,7 +6,6 @@ import org.springframework.stereotype.Service;
import
org.springframework.web.multipart.MultipartFile
;
import
com.aliyun.oss.OSSClient
;
import
com.central.file.mapper.FileMapper
;
import
com.central.file.model.FileInfo
;
import
com.central.file.model.FileType
;
...
...
zlt-business/file-center/src/main/java/com/central/file/service/impl/QiniuOssServiceImplI.java
浏览文件 @
110bdc5a
...
...
@@ -40,15 +40,6 @@ public class QiniuOssServiceImplI extends AbstractIFileService implements Initia
return
FileType
.
QINIU
;
}
/**
* 获取上传凭证
*
* @return
*/
private
String
getUploadToken
()
{
return
this
.
auth
.
uploadToken
(
bucket
,
null
,
3600
,
putPolicy
);
}
@Override
protected
void
uploadFile
(
MultipartFile
file
,
FileInfo
fileInfo
)
throws
Exception
{
// 调用put方法上传
...
...
zlt-business/file-center/src/main/java/com/central/file/utils/FileUtil.java
浏览文件 @
110bdc5a
...
...
@@ -6,6 +6,7 @@ import java.io.InputStream;
import
java.util.Date
;
import
com.central.file.model.FileInfo
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.codec.digest.DigestUtils
;
import
org.springframework.web.multipart.MultipartFile
;
...
...
@@ -13,7 +14,11 @@ import org.springframework.web.multipart.MultipartFile;
* @author zlt
* 文件工具类
*/
@Slf4j
public
class
FileUtil
{
private
FileUtil
()
{
throw
new
IllegalStateException
(
"Utility class"
);
}
public
static
FileInfo
getFileInfo
(
MultipartFile
file
)
throws
Exception
{
String
md5
=
fileMd5
(
file
.
getInputStream
());
...
...
@@ -37,7 +42,7 @@ public class FileUtil {
try
{
return
DigestUtils
.
md5Hex
(
inputStream
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
(
);
log
.
error
(
"fileMd5-error"
,
e
);
}
return
null
;
}
...
...
@@ -54,7 +59,7 @@ public class FileUtil {
file
.
transferTo
(
targetFile
);
return
path
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
);
log
.
error
(
"saveFile-error"
,
e
);
}
return
null
;
}
...
...
zlt-business/user-center/src/main/java/com/central/user/controller/SysMenuController.java
浏览文件 @
110bdc5a
...
...
@@ -75,9 +75,8 @@ public class SysMenuController {
@ApiOperation
(
value
=
"根据roleId获取对应的菜单"
)
@GetMapping
(
"/{roleId}/menus"
)
public
List
<
Map
<
String
,
Object
>>
findMenusByRoleId
(
@PathVariable
Long
roleId
)
{
Set
<
Long
>
roleIds
=
new
HashSet
<
Long
>()
{{
add
(
roleId
);
}};
Set
<
Long
>
roleIds
=
new
HashSet
<>();
roleIds
.
add
(
roleId
);
//获取该角色对应的菜单
List
<
SysMenu
>
roleMenus
=
menuService
.
findByRoles
(
roleIds
);
//全部的菜单列表
...
...
@@ -169,7 +168,6 @@ public class SysMenuController {
return
Collections
.
emptyList
();
}
List
<
SysMenu
>
menus
=
menuService
.
findByRoleCodes
(
roles
.
parallelStream
().
map
(
SysRole:
:
getCode
).
collect
(
Collectors
.
toSet
()),
CommonConstant
.
MENU
);
List
<
SysMenu
>
sysMenus
=
treeBuilder
(
menus
);
return
sysMenus
;
return
treeBuilder
(
menus
);
}
}
zlt-business/user-center/src/main/java/com/central/user/controller/SysUserController.java
浏览文件 @
110bdc5a
...
...
@@ -39,6 +39,8 @@ import javax.servlet.http.HttpServletResponse;
@RestController
@Api
(
tags
=
"用户模块api"
)
public
class
SysUserController
{
private
static
final
String
ADMIN_CHANGE_MSG
=
"超级管理员不给予修改"
;
@Autowired
private
ISysUserService
appUserService
;
...
...
@@ -163,7 +165,7 @@ public class SysUserController {
public
Result
updateEnabled
(
@RequestParam
Map
<
String
,
Object
>
params
)
{
Long
id
=
MapUtils
.
getLong
(
params
,
"id"
);
if
(
checkAdmin
(
id
))
{
return
Result
.
failed
(
"超级管理员不给予修改"
);
return
Result
.
failed
(
ADMIN_CHANGE_MSG
);
}
return
appUserService
.
updateEnabled
(
params
);
}
...
...
@@ -176,7 +178,7 @@ public class SysUserController {
@PutMapping
(
value
=
"/users/{id}/password"
)
public
Result
resetPassword
(
@PathVariable
Long
id
)
{
if
(
checkAdmin
(
id
))
{
return
Result
.
failed
(
"超级管理员不给予修改"
);
return
Result
.
failed
(
ADMIN_CHANGE_MSG
);
}
appUserService
.
updatePassword
(
id
,
null
,
null
);
return
Result
.
succeed
(
"重置成功"
);
...
...
@@ -188,7 +190,7 @@ public class SysUserController {
@PutMapping
(
value
=
"/users/password"
)
public
Result
resetPassword
(
@RequestBody
SysUser
sysUser
)
{
if
(
checkAdmin
(
sysUser
.
getId
()))
{
return
Result
.
failed
(
"超级管理员不给予修改"
);
return
Result
.
failed
(
ADMIN_CHANGE_MSG
);
}
appUserService
.
updatePassword
(
sysUser
.
getId
(),
sysUser
.
getOldPassword
(),
sysUser
.
getNewPassword
());
return
Result
.
succeed
(
"重置成功"
);
...
...
@@ -202,7 +204,7 @@ public class SysUserController {
@DeleteMapping
(
value
=
"/users/{id}"
)
public
Result
delete
(
@PathVariable
Long
id
)
{
if
(
checkAdmin
(
id
))
{
return
Result
.
failed
(
"超级管理员不给予修改"
);
return
Result
.
failed
(
ADMIN_CHANGE_MSG
);
}
appUserService
.
delUser
(
id
);
return
Result
.
succeed
(
"删除成功"
);
...
...
zlt-business/user-center/src/main/java/com/central/user/service/impl/SysMenuServiceImpl.java
浏览文件 @
110bdc5a
...
...
@@ -33,9 +33,7 @@ public class SysMenuServiceImpl extends SuperServiceImpl<SysMenuMapper, SysMenu>
sysRoleMenuMapper
.
delete
(
roleId
,
null
);
if
(!
CollectionUtils
.
isEmpty
(
menuIds
))
{
menuIds
.
forEach
(
menuId
->
{
sysRoleMenuMapper
.
save
(
roleId
,
menuId
);
});
menuIds
.
forEach
(
menuId
->
sysRoleMenuMapper
.
save
(
roleId
,
menuId
));
}
}
...
...
zlt-business/user-center/src/main/java/com/central/user/service/impl/SysRoleServiceImpl.java
浏览文件 @
110bdc5a
...
...
@@ -66,6 +66,7 @@ public class SysRoleServiceImpl extends SuperServiceImpl<SysRoleMapper, SysRole>
}
@Override
@Transactional
public
Result
saveOrUpdateRole
(
SysRole
sysRole
)
{
if
(
sysRole
.
getId
()
==
null
)
{
this
.
saveRole
(
sysRole
);
...
...
zlt-business/user-center/src/main/java/com/central/user/service/impl/SysUserServiceImpl.java
浏览文件 @
110bdc5a
...
...
@@ -80,7 +80,7 @@ public class SysUserServiceImpl extends SuperServiceImpl<SysUserMapper, SysUser>
loginAppUser
.
setRoles
(
sysRoles
);
if
(!
CollectionUtils
.
isEmpty
(
sysRoles
))
{
Set
<
Long
>
roleIds
=
sysRoles
.
parallelStream
().
map
(
r
->
r
.
getId
()
).
collect
(
Collectors
.
toSet
());
Set
<
Long
>
roleIds
=
sysRoles
.
parallelStream
().
map
(
SuperEntity:
:
getId
).
collect
(
Collectors
.
toSet
());
List
<
SysMenu
>
menus
=
roleMenuMapper
.
findMenusByRoleIds
(
roleIds
,
CommonConstant
.
PERMISSION
);
if
(!
CollectionUtils
.
isEmpty
(
menus
))
{
Set
<
String
>
permissions
=
menus
.
parallelStream
().
map
(
p
->
p
.
getPathMethod
()+
":"
+
p
.
getPath
())
...
...
@@ -154,9 +154,7 @@ public class SysUserServiceImpl extends SuperServiceImpl<SysUserMapper, SysUser>
userRoleMapper
.
deleteUserRole
(
id
,
null
);
if
(!
CollectionUtils
.
isEmpty
(
roleIds
))
{
roleIds
.
forEach
(
roleId
->
{
userRoleMapper
.
saveUserRoles
(
id
,
roleId
);
});
roleIds
.
forEach
(
roleId
->
userRoleMapper
.
saveUserRoles
(
id
,
roleId
));
}
}
...
...
@@ -188,10 +186,8 @@ public class SysUserServiceImpl extends SuperServiceImpl<SysUserMapper, SysUser>
List
<
Long
>
userIds
=
list
.
stream
().
map
(
SysUser:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
SysRole
>
sysRoles
=
userRoleMapper
.
findRolesByUserIds
(
userIds
);
list
.
forEach
(
u
->
{
u
.
setRoles
(
sysRoles
.
stream
().
filter
(
r
->
!
ObjectUtils
.
notEqual
(
u
.
getId
(),
r
.
getUserId
()))
.
collect
(
Collectors
.
toList
()));
});
list
.
forEach
(
u
->
u
.
setRoles
(
sysRoles
.
stream
().
filter
(
r
->
!
ObjectUtils
.
notEqual
(
u
.
getId
(),
r
.
getUserId
()))
.
collect
(
Collectors
.
toList
())));
}
return
PageResult
.<
SysUser
>
builder
().
data
(
list
).
code
(
0
).
count
(
total
).
build
();
}
...
...
@@ -238,9 +234,7 @@ public class SysUserServiceImpl extends SuperServiceImpl<SysUserMapper, SysUser>
userRoleMapper
.
deleteUserRole
(
sysUser
.
getId
(),
null
);
List
roleIds
=
Arrays
.
asList
(
sysUser
.
getRoleId
().
split
(
","
));
if
(!
CollectionUtils
.
isEmpty
(
roleIds
))
{
roleIds
.
forEach
(
roleId
->
{
userRoleMapper
.
saveUserRoles
(
sysUser
.
getId
(),
Long
.
parseLong
(
roleId
.
toString
()));
});
roleIds
.
forEach
(
roleId
->
userRoleMapper
.
saveUserRoles
(
sysUser
.
getId
(),
Long
.
parseLong
(
roleId
.
toString
())));
}
}
return
result
?
Result
.
succeed
(
sysUser
,
"操作成功"
)
:
Result
.
failed
(
"操作失败"
);
...
...
@@ -250,7 +244,7 @@ public class SysUserServiceImpl extends SuperServiceImpl<SysUserMapper, SysUser>
@Override
public
boolean
delUser
(
Long
id
)
{
userRoleMapper
.
deleteUserRole
(
id
,
null
);
return
baseMapper
.
deleteById
(
id
)
>
0
?
true
:
false
;
return
baseMapper
.
deleteById
(
id
)
>
0
;
}
@Override
...
...
zlt-commons/zlt-auth-client-spring-boot-starter/src/main/java/com/central/oauth2/common/config/DefaultSecurityHandlerConfig.java
浏览文件 @
110bdc5a
...
...
@@ -30,9 +30,7 @@ public class DefaultSecurityHandlerConfig {
*/
@Bean
public
AuthenticationEntryPoint
authenticationEntryPoint
()
{
return
(
request
,
response
,
authException
)
->
{
ResponseUtil
.
responseWriter
(
objectMapper
,
response
,
authException
.
getMessage
(),
HttpStatus
.
UNAUTHORIZED
.
value
());
};
return
(
request
,
response
,
authException
)
->
ResponseUtil
.
responseWriter
(
objectMapper
,
response
,
authException
.
getMessage
(),
HttpStatus
.
UNAUTHORIZED
.
value
());
}
@Bean
...
...
zlt-commons/zlt-auth-client-spring-boot-starter/src/main/java/com/central/oauth2/common/store/RedisTemplateTokenStore.java
浏览文件 @
110bdc5a
...
...
@@ -140,7 +140,7 @@ public class RedisTemplateTokenStore implements TokenStore {
ExpiringOAuth2RefreshToken
expiringRefreshToken
=
(
ExpiringOAuth2RefreshToken
)
refreshToken
;
Date
expiration
=
expiringRefreshToken
.
getExpiration
();
if
(
expiration
!=
null
)
{
int
seconds
=
Long
.
valueOf
((
expiration
.
getTime
()
-
System
.
currentTimeMillis
())
/
1000L
).
intValue
(
);
int
seconds
=
(
int
)((
expiration
.
getTime
()
-
System
.
currentTimeMillis
())
/
1000L
);
redisTemplate
.
expire
(
REFRESH_TO_ACCESS
+
token
.
getRefreshToken
().
getValue
(),
seconds
,
TimeUnit
.
SECONDS
);
redisTemplate
.
expire
(
ACCESS_TO_REFRESH
+
token
.
getValue
(),
seconds
,
TimeUnit
.
SECONDS
);
...
...
@@ -221,24 +221,20 @@ public class RedisTemplateTokenStore implements TokenStore {
@Override
public
Collection
<
OAuth2AccessToken
>
findTokensByClientIdAndUserName
(
String
clientId
,
String
userName
)
{
List
<
Object
>
result
=
redisTemplate
.
opsForList
().
range
(
UNAME_TO_ACCESS
+
getApprovalKey
(
clientId
,
userName
),
0
,
-
1
);
if
(
result
==
null
||
result
.
size
()
==
0
)
{
return
Collections
.
emptySet
();
}
List
<
OAuth2AccessToken
>
accessTokens
=
new
ArrayList
<
OAuth2AccessToken
>(
result
.
size
());
for
(
Iterator
<
Object
>
it
=
result
.
iterator
();
it
.
hasNext
();
)
{
OAuth2AccessToken
accessToken
=
(
OAuth2AccessToken
)
it
.
next
();
accessTokens
.
add
(
accessToken
);
}
return
Collections
.
unmodifiableCollection
(
accessTokens
);
return
getTokenColl
(
result
);
}
@Override
public
Collection
<
OAuth2AccessToken
>
findTokensByClientId
(
String
clientId
)
{
List
<
Object
>
result
=
redisTemplate
.
opsForList
().
range
((
CLIENT_ID_TO_ACCESS
+
clientId
),
0
,
-
1
);
if
(
result
==
null
||
result
.
size
()
==
0
)
{
return
getTokenColl
(
result
);
}
private
Collection
<
OAuth2AccessToken
>
getTokenColl
(
List
<
Object
>
result
)
{
if
(
result
==
null
||
result
.
isEmpty
())
{
return
Collections
.
emptySet
();
}
List
<
OAuth2AccessToken
>
accessTokens
=
new
ArrayList
<
OAuth2AccessToken
>(
result
.
size
());
List
<
OAuth2AccessToken
>
accessTokens
=
new
ArrayList
<>(
result
.
size
());
for
(
Iterator
<
Object
>
it
=
result
.
iterator
();
it
.
hasNext
();
)
{
OAuth2AccessToken
accessToken
=
(
OAuth2AccessToken
)
it
.
next
();
accessTokens
.
add
(
accessToken
);
...
...
zlt-commons/zlt-auth-client-spring-boot-starter/src/main/java/com/central/oauth2/common/store/ResJwtTokenStore.java
浏览文件 @
110bdc5a
...
...
@@ -50,8 +50,8 @@ public class ResJwtTokenStore {
* @return 公钥 Key
*/
private
String
getPubKey
()
{
Resource
res
ource
=
new
ClassPathResource
(
ResJwtTokenStore
.
PUBLIC_KEY
);
try
(
BufferedReader
br
=
new
BufferedReader
(
new
InputStreamReader
(
res
ource
.
getInputStream
())))
{
Resource
res
=
new
ClassPathResource
(
ResJwtTokenStore
.
PUBLIC_KEY
);
try
(
BufferedReader
br
=
new
BufferedReader
(
new
InputStreamReader
(
res
.
getInputStream
())))
{
return
br
.
lines
().
collect
(
Collectors
.
joining
(
"\n"
));
}
catch
(
IOException
ioe
)
{
return
getKeyFromAuthorizationServer
();
...
...
zlt-commons/zlt-auth-client-spring-boot-starter/src/main/java/com/central/oauth2/common/util/AuthUtils.java
浏览文件 @
110bdc5a
...
...
@@ -7,6 +7,7 @@ import org.springframework.security.oauth2.common.exceptions.UnapprovedClientAut
import
javax.servlet.http.HttpServletRequest
;
import
java.io.IOException
;
import
java.nio.charset.StandardCharsets
;
import
java.util.Base64
;
import
java.util.Enumeration
;
...
...
@@ -18,6 +19,10 @@ import java.util.Enumeration;
*/
@Slf4j
public
class
AuthUtils
{
private
AuthUtils
()
{
throw
new
IllegalStateException
(
"Utility class"
);
}
private
static
final
String
BASIC_
=
"Basic "
;
/**
...
...
@@ -60,7 +65,7 @@ public class AuthUtils {
/**
* *从header 请求中的clientId:clientSecret
*/
public
static
String
[]
extractClient
(
HttpServletRequest
request
)
throws
IOException
,
UnapprovedClientAuthenticationException
{
public
static
String
[]
extractClient
(
HttpServletRequest
request
)
{
String
header
=
request
.
getHeader
(
"Authorization"
);
if
(
header
==
null
||
!
header
.
startsWith
(
BASIC_
))
{
throw
new
UnapprovedClientAuthenticationException
(
"请求头中client信息为空"
);
...
...
@@ -73,10 +78,10 @@ public class AuthUtils {
*
* @param header header中的参数
*/
public
static
String
[]
extractHeaderClient
(
String
header
)
throws
IOException
{
byte
[]
base64Client
=
header
.
substring
(
BASIC_
.
length
()).
getBytes
(
CommonConstant
.
UTF
8
);
public
static
String
[]
extractHeaderClient
(
String
header
)
{
byte
[]
base64Client
=
header
.
substring
(
BASIC_
.
length
()).
getBytes
(
StandardCharsets
.
UTF_
8
);
byte
[]
decoded
=
Base64
.
getDecoder
().
decode
(
base64Client
);
String
clientStr
=
new
String
(
decoded
,
CommonConstant
.
UTF
8
);
String
clientStr
=
new
String
(
decoded
,
StandardCharsets
.
UTF_
8
);
String
[]
clientArr
=
clientStr
.
split
(
":"
);
if
(
clientArr
.
length
!=
2
)
{
throw
new
RuntimeException
(
"Invalid basic authentication token"
);
...
...
zlt-commons/zlt-common-spring-boot-starter/src/main/java/com/central/common/constant/CommonConstant.java
浏览文件 @
110bdc5a
...
...
@@ -72,11 +72,6 @@ public interface CommonConstant {
*/
String
DEL_FLAG
=
"is_del"
;
/**
* 编码
*/
String
UTF8
=
"UTF-8"
;
/**
* 超级管理员用户名
*/
...
...
zlt-commons/zlt-common-spring-boot-starter/src/main/java/com/central/common/model/CodeEnum.java
浏览文件 @
110bdc5a
...
...
@@ -15,8 +15,4 @@ public enum CodeEnum {
public
Integer
getCode
()
{
return
code
;
}
public
void
setCode
(
Integer
code
)
{
this
.
code
=
code
;
}
}
zlt-commons/zlt-common-spring-boot-starter/src/main/java/com/central/common/model/LoginAppUser.java
浏览文件 @
110bdc5a
...
...
@@ -33,9 +33,7 @@ public class LoginAppUser extends SysUser implements SocialUserDetails {
public
Collection
<?
extends
GrantedAuthority
>
getAuthorities
()
{
Collection
<
GrantedAuthority
>
collection
=
new
HashSet
<>();
if
(!
CollectionUtils
.
isEmpty
(
super
.
getRoles
()))
{
super
.
getRoles
().
parallelStream
().
forEach
(
role
->
{
collection
.
add
(
new
SimpleGrantedAuthority
(
role
.
getCode
()));
});
super
.
getRoles
().
parallelStream
().
forEach
(
role
->
collection
.
add
(
new
SimpleGrantedAuthority
(
role
.
getCode
())));
}
return
collection
;
}
...
...
zlt-commons/zlt-common-spring-boot-starter/src/main/java/com/central/common/model/Result.java
浏览文件 @
110bdc5a
...
...
@@ -27,7 +27,7 @@ public class Result<T> implements Serializable {
}
public
static
<
T
>
Result
<
T
>
succeedWith
(
T
datas
,
Integer
code
,
String
msg
)
{
return
new
Result
<
T
>(
datas
,
code
,
msg
);
return
new
Result
<>(
datas
,
code
,
msg
);
}
public
static
<
T
>
Result
<
T
>
failed
(
String
msg
)
{
...
...
@@ -39,7 +39,7 @@ public class Result<T> implements Serializable {
}
public
static
<
T
>
Result
<
T
>
failedWith
(
T
datas
,
Integer
code
,
String
msg
)
{
return
new
Result
<
T
>(
datas
,
code
,
msg
);
return
new
Result
<>(
datas
,
code
,
msg
);
}
}
zlt-commons/zlt-common-spring-boot-starter/src/main/java/com/central/common/utils/DateUtils.java
浏览文件 @
110bdc5a
...
...
@@ -9,6 +9,10 @@ import java.util.Date;
* @author zlt
*/
public
class
DateUtils
{
private
DateUtils
()
{
throw
new
IllegalStateException
(
"Utility class"
);
}
/** 时间格式(yyyy-MM-dd) */
public
final
static
String
DATE_PATTERN
=
"yyyy-MM-dd"
;
/** 时间格式(yyyy-MM-dd HH:mm:ss) */
...
...
zlt-commons/zlt-common-spring-boot-starter/src/main/java/com/central/common/utils/ExcelUtil.java
浏览文件 @
110bdc5a
...
...
@@ -13,6 +13,7 @@ import javax.servlet.http.HttpServletResponse;
import
java.io.File
;
import
java.io.IOException
;
import
java.net.URLEncoder
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -23,6 +24,10 @@ import java.util.Map;
* @date 2019/1/6
*/
public
class
ExcelUtil
{
private
ExcelUtil
()
{
throw
new
IllegalStateException
(
"Utility class"
);
}
/**
* 导出
*
...
...
@@ -95,23 +100,21 @@ public class ExcelUtil {
public
static
<
T
>
List
<
T
>
importExcel
(
String
filePath
,
Integer
titleRows
,
Integer
headerRows
,
Class
<
T
>
pojoClass
)
{
if
(
StringUtils
.
isBlank
(
filePath
))
{
return
null
;
return
Collections
.
emptyList
()
;
}
ImportParams
params
=
new
ImportParams
();
params
.
setTitleRows
(
titleRows
);
params
.
setHeadRows
(
headerRows
);
List
<
T
>
list
=
ExcelImportUtil
.
importExcel
(
new
File
(
filePath
),
pojoClass
,
params
);
return
list
;
return
ExcelImportUtil
.
importExcel
(
new
File
(
filePath
),
pojoClass
,
params
);
}
public
static
<
T
>
List
<
T
>
importExcel
(
MultipartFile
file
,
Integer
titleRows
,
Integer
headerRows
,
Class
<
T
>
pojoClass
)
throws
Exception
{
if
(
file
==
null
)
{
return
null
;
return
Collections
.
emptyList
()
;
}
ImportParams
params
=
new
ImportParams
();
params
.
setTitleRows
(
titleRows
);
params
.
setHeadRows
(
headerRows
);
List
<
T
>
list
=
ExcelImportUtil
.
importExcel
(
file
.
getInputStream
(),
pojoClass
,
params
);
return
list
;
return
ExcelImportUtil
.
importExcel
(
file
.
getInputStream
(),
pojoClass
,
params
);
}
}
zlt-commons/zlt-common-spring-boot-starter/src/main/java/com/central/common/utils/PhoneUtil.java
浏览文件 @
110bdc5a
...
...
@@ -8,6 +8,10 @@ import java.util.regex.Pattern;
* 正则表达式手机号码校验类
*/
public
class
PhoneUtil
{
private
PhoneUtil
()
{
throw
new
IllegalStateException
(
"Utility class"
);
}
private
static
String
REGEX
=
"^((13[0-9])|(14[5|7])|(15([0-3]|[5-9]))|(17[013678])|(18[0,5-9]))\\d{8}$"
;
private
static
Pattern
P
=
Pattern
.
compile
(
REGEX
);
...
...
zlt-commons/zlt-common-spring-boot-starter/src/main/java/com/central/common/utils/ResponseUtil.java
浏览文件 @
110bdc5a
...
...
@@ -14,6 +14,9 @@ import java.util.Map;
* @date 2018/12/20
*/
public
class
ResponseUtil
{
private
ResponseUtil
()
{
throw
new
IllegalStateException
(
"Utility class"
);
}
/**
* 通过流写到前端
*
...
...
zlt-commons/zlt-common-spring-boot-starter/src/main/java/com/central/common/utils/SpringUtil.java
浏览文件 @
110bdc5a
package
com.central.common.utils
;
import
org.springframework.beans.BeansException
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ApplicationContextAware
;
import
org.springframework.core.env.Environment
;
...
...
@@ -28,7 +27,7 @@ public class SpringUtil implements ApplicationContextAware {
}
@Override
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
throws
BeansException
{
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
{
SpringUtil
.
applicationContext
=
applicationContext
;
}
}
zlt-commons/zlt-common-spring-boot-starter/src/main/java/com/central/common/utils/SysUserUtil.java
浏览文件 @
110bdc5a
package
com.central.common.utils
;
import
cn.hutool.core.bean.BeanUtil
;
import
com.central.common.model.SysRole
;
import
com.central.common.model.SysUser
;
import
org.springframework.security.authentication.UsernamePasswordAuthenticationToken
;
import
org.springframework.security.core.Authentication
;
import
org.springframework.security.core.GrantedAuthority
;
import
org.springframework.security.core.context.SecurityContextHolder
;
import
org.springframework.security.oauth2.provider.OAuth2Authentication
;
import
org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationToken
;
import
com.central.common.model.LoginAppUser
;
import
java.util.*
;
/**
* 获取用户信息
*
* @author zlt
*/
public
class
SysUserUtil
{
private
SysUserUtil
()
{
throw
new
IllegalStateException
(
"Utility class"
);
}
public
static
LoginAppUser
getLoginAppUser
(
SysUser
user
)
{
LoginAppUser
login
=
new
LoginAppUser
();
BeanUtil
.
copyProperties
(
user
,
login
);
...
...
zlt-commons/zlt-common-spring-boot-starter/src/main/java/com/central/common/utils/UUIDUtil.java
浏览文件 @
110bdc5a
...
...
@@ -14,6 +14,10 @@ import java.util.UUID;
* @date 2017-3-28 下午1:11:31
*/
public
class
UUIDUtil
{
private
UUIDUtil
()
{
throw
new
IllegalStateException
(
"Utility class"
);
}
private
static
String
[]
chars
=
new
String
[]
{
"a"
,
"b"
,
"c"
,
"d"
,
"e"
,
"f"
,
"g"
,
"h"
,
"i"
,
"j"
,
"k"
,
"l"
,
"m"
,
"n"
,
"o"
,
"p"
,
"q"
,
"r"
,
"s"
,
"t"
,
"u"
,
"v"
,
"w"
,
"x"
,
"y"
,
"z"
,
"0"
,
"1"
,
"2"
,
"3"
,
"4"
,
"5"
,
...
...
@@ -27,7 +31,7 @@ public class UUIDUtil {
* @author wangfan
*/
public
static
String
randomUUID8
()
{
StringBu
ffer
shortBuffer
=
new
StringBuff
er
();
StringBu
ilder
shortBuffer
=
new
StringBuild
er
();
String
uuid
=
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
);
for
(
int
i
=
0
;
i
<
8
;
i
++)
{
String
str
=
uuid
.
substring
(
i
*
4
,
i
*
4
+
4
);
...
...
@@ -43,8 +47,7 @@ public class UUIDUtil {
* @author wangfan
*/
public
static
String
randomUUID32
(){
String
uuid
=
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
);
return
uuid
;
return
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
);
}
}
zlt-commons/zlt-db-spring-boot-starter/src/main/java/com/central/db/config/DateMetaObjectHandler.java
浏览文件 @
110bdc5a
...
...
@@ -12,21 +12,23 @@ import java.util.Date;
* @date 2018/12/11
*/
public
class
DateMetaObjectHandler
implements
MetaObjectHandler
{
private
final
static
String
UPDATE_TIME
=
"updateTime"
;
private
final
static
String
CREATE_TIME
=
"createTime"
;
/**
* 插入填充,字段为空自动填充
*/
@Override
public
void
insertFill
(
MetaObject
metaObject
)
{
Object
createTime
=
getFieldValByName
(
"createTime"
,
metaObject
);
Object
updateTime
=
getFieldValByName
(
"updateTime"
,
metaObject
);
Object
createTime
=
getFieldValByName
(
CREATE_TIME
,
metaObject
);
Object
updateTime
=
getFieldValByName
(
UPDATE_TIME
,
metaObject
);
if
(
createTime
==
null
||
updateTime
==
null
)
{
Date
date
=
new
Date
();
if
(
createTime
==
null
)
{
setFieldValByName
(
"createTime"
,
date
,
metaObject
);
setFieldValByName
(
CREATE_TIME
,
date
,
metaObject
);
}
if
(
updateTime
==
null
)
{
setFieldValByName
(
"updateTime"
,
date
,
metaObject
);
setFieldValByName
(
UPDATE_TIME
,
date
,
metaObject
);
}
}
}
...
...
@@ -39,6 +41,6 @@ public class DateMetaObjectHandler implements MetaObjectHandler {
@Override
public
void
updateFill
(
MetaObject
metaObject
)
{
//mybatis-plus版本2.0.9+
setFieldValByName
(
"updateTime"
,
new
Date
(),
metaObject
);
setFieldValByName
(
UPDATE_TIME
,
new
Date
(),
metaObject
);
}
}
\ No newline at end of file
zlt-commons/zlt-db-spring-boot-starter/src/main/java/com/central/db/config/DefaultMybatisPlusConfig.java
浏览文件 @
110bdc5a
...
...
@@ -28,7 +28,6 @@ public class DefaultMybatisPlusConfig {
@Bean
@Profile
({
"dev"
,
"test"
})
public
PerformanceInterceptor
performanceInterceptor
()
{
PerformanceInterceptor
performanceInterceptor
=
new
PerformanceInterceptor
();
return
performanceInterceptor
;
return
new
PerformanceInterceptor
();
}
}
zlt-commons/zlt-log-spring-boot-starter/src/main/java/com/central/log/monitor/PointUtil.java
浏览文件 @
110bdc5a
...
...
@@ -9,6 +9,10 @@ import lombok.extern.slf4j.Slf4j;
*/
@Slf4j
public
class
PointUtil
{
private
PointUtil
()
{
throw
new
IllegalStateException
(
"Utility class"
);
}
public
static
final
String
SPLIT
=
"|"
;
/**
...
...
zlt-commons/zlt-redis-spring-boot-starter/src/main/java/com/central/common/redis/RedisAutoConfigure.java
浏览文件 @
110bdc5a
...
...
@@ -101,11 +101,10 @@ public class RedisAutoConfigure {
}
private
RedisCacheConfiguration
getDefConf
()
{
RedisCacheConfiguration
cacheConfiguration
=
RedisCacheConfiguration
.
defaultCacheConfig
()
return
RedisCacheConfiguration
.
defaultCacheConfig
()
.
disableCachingNullValues
()
.
computePrefixWith
(
cacheName
->
"cache"
.
concat
(
":"
).
concat
(
cacheName
).
concat
(
":"
))
.
serializeKeysWith
(
RedisSerializationContext
.
SerializationPair
.
fromSerializer
(
new
StringRedisSerializer
()))
.
serializeValuesWith
(
RedisSerializationContext
.
SerializationPair
.
fromSerializer
(
new
RedisObjectSerializer
()));
return
cacheConfiguration
;
}
}
zlt-commons/zlt-redis-spring-boot-starter/src/main/java/com/central/common/redis/constant/RedisToolsConstant.java
浏览文件 @
110bdc5a
...
...
@@ -7,7 +7,9 @@ package com.central.common.redis.constant;
* @date 2018/5/21 11:59
*/
public
class
RedisToolsConstant
{
private
RedisToolsConstant
()
{
throw
new
IllegalStateException
(
"Utility class"
);
}
/**
* single Redis
*/
...
...
zlt-commons/zlt-redis-spring-boot-starter/src/main/java/com/central/common/redis/lock/RedisDistributedLock.java
浏览文件 @
110bdc5a
...
...
@@ -56,7 +56,8 @@ public class RedisDistributedLock extends AbstractDistributedLock {
log
.
debug
(
"get redisDistributeLock failed, retrying..."
+
retryTimes
);
Thread
.
sleep
(
sleepMillis
);
}
catch
(
InterruptedException
e
)
{
return
false
;
log
.
warn
(
"Interrupted!"
,
e
);
Thread
.
currentThread
().
interrupt
();
}
result
=
setRedis
(
key
,
expire
);
}
...
...
zlt-commons/zlt-redis-spring-boot-starter/src/main/java/com/central/common/redis/template/RedisRepository.java
浏览文件 @
110bdc5a
...
...
@@ -14,6 +14,7 @@ import org.springframework.data.redis.serializer.RedisSerializer;
import
org.springframework.data.redis.serializer.StringRedisSerializer
;
import
java.nio.charset.Charset
;
import
java.nio.charset.StandardCharsets
;
import
java.util.*
;
/**
...
...
@@ -27,7 +28,7 @@ public class RedisRepository {
/**
* 默认编码
*/
private
static
final
Charset
DEFAULT_CHARSET
=
Charset
.
forName
(
"UTF-8"
)
;
private
static
final
Charset
DEFAULT_CHARSET
=
StandardCharsets
.
UTF_8
;
/**
* key序列化
...
...
zlt-commons/zlt-redis-spring-boot-starter/src/main/java/com/central/common/redis/util/RedisObjectSerializer.java
浏览文件 @
110bdc5a
...
...
@@ -12,22 +12,26 @@ import org.springframework.data.redis.serializer.SerializationException;
* @author zlt
*/
public
class
RedisObjectSerializer
implements
RedisSerializer
<
Object
>
{
private
static
final
byte
[]
EMPTY_BYTE_ARRAY
=
new
byte
[
0
];
// 做一个空数组,不是null
// 做一个空数组,不是null
private
static
final
byte
[]
EMPTY_BYTE_ARRAY
=
new
byte
[
0
];
// 为了方便进行对象与字节数组的转换,所以应该首先准备出两个转换器
private
Converter
<
Object
,
byte
[]>
serializingConverter
=
new
SerializingConverter
();
private
Converter
<
byte
[],
Object
>
deserializingConverter
=
new
DeserializingConverter
();
@Override
public
byte
[]
serialize
(
Object
obj
)
throws
SerializationException
{
if
(
obj
==
null
)
{
// 这个时候没有要序列化的对象出现,所以返回的字节数组应该就是一个空数组
public
byte
[]
serialize
(
Object
obj
)
{
// 这个时候没有要序列化的对象出现,所以返回的字节数组应该就是一个空数组
if
(
obj
==
null
)
{
return
EMPTY_BYTE_ARRAY
;
}
return
this
.
serializingConverter
.
convert
(
obj
);
// 将对象变为字节数组
// 将对象变为字节数组
return
this
.
serializingConverter
.
convert
(
obj
);
}
@Override
public
Object
deserialize
(
byte
[]
data
)
throws
SerializationException
{
if
(
data
==
null
||
data
.
length
==
0
)
{
// 此时没有对象的内容信息
public
Object
deserialize
(
byte
[]
data
)
{
// 此时没有对象的内容信息
if
(
data
==
null
||
data
.
length
==
0
)
{
return
null
;
}
return
this
.
deserializingConverter
.
convert
(
data
);
...
...
zlt-commons/zlt-swagger2-spring-boot-starter/src/main/java/com/central/common/swagger2/SwaggerAutoConfiguration.java
浏览文件 @
110bdc5a
...
...
@@ -41,6 +41,7 @@ import java.util.stream.Collectors;
Swagger2Configuration
.
class
})
public
class
SwaggerAutoConfiguration
implements
BeanFactoryAware
{
private
static
final
String
AUTH_KEY
=
"Authorization"
;
private
BeanFactory
beanFactory
;
...
...
@@ -179,7 +180,7 @@ public class SwaggerAutoConfiguration implements BeanFactoryAware {
}
@Override
public
void
setBeanFactory
(
BeanFactory
beanFactory
)
throws
BeansException
{
public
void
setBeanFactory
(
BeanFactory
beanFactory
)
{
this
.
beanFactory
=
beanFactory
;
}
...
...
@@ -198,13 +199,13 @@ public class SwaggerAutoConfiguration implements BeanFactoryAware {
AuthorizationScope
[]
authorizationScopes
=
new
AuthorizationScope
[
1
];
authorizationScopes
[
0
]
=
authorizationScope
;
List
<
SecurityReference
>
references
=
new
ArrayList
<>(
1
);
references
.
add
(
new
SecurityReference
(
"Authorization"
,
authorizationScopes
));
references
.
add
(
new
SecurityReference
(
AUTH_KEY
,
authorizationScopes
));
return
references
;
}
private
List
<
ApiKey
>
securitySchemes
()
{
List
<
ApiKey
>
apiKeys
=
new
ArrayList
<>(
1
);
ApiKey
apiKey
=
new
ApiKey
(
"Authorization"
,
"Authorization"
,
"header"
);
ApiKey
apiKey
=
new
ApiKey
(
AUTH_KEY
,
AUTH_KEY
,
"header"
);
apiKeys
.
add
(
apiKey
);
return
apiKeys
;
}
...
...
zlt-commons/zlt-swagger2-spring-boot-starter/src/main/java/com/central/common/swagger2/SwaggerProperties.java
浏览文件 @
110bdc5a
package
com.central.common.swagger2
;
import
lombok.Data
;
import
lombok.Getter
;
import
lombok.Setter
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
java.util.ArrayList
;
...
...
@@ -51,7 +53,8 @@ public class SwaggerProperties {
/**全局参数配置**/
private
List
<
GlobalOperationParameter
>
globalOperationParameters
;
@Setter
@Getter
public
static
class
GlobalOperationParameter
{
/**参数名**/
private
String
name
;
...
...
@@ -67,46 +70,6 @@ public class SwaggerProperties {
/**参数是否必须传**/
private
String
required
;
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getDescription
()
{
return
description
;
}
public
void
setDescription
(
String
description
)
{
this
.
description
=
description
;
}
public
String
getModelRef
()
{
return
modelRef
;
}
public
void
setModelRef
(
String
modelRef
)
{
this
.
modelRef
=
modelRef
;
}
public
String
getParameterType
()
{
return
parameterType
;
}
public
void
setParameterType
(
String
parameterType
)
{
this
.
parameterType
=
parameterType
;
}
public
String
getRequired
()
{
return
required
;
}
public
void
setRequired
(
String
required
)
{
this
.
required
=
required
;
}
}
@Data
...
...
@@ -139,7 +102,6 @@ public class SwaggerProperties {
@Data
public
static
class
Contact
{
/**联系人**/
private
String
name
=
""
;
/**联系人url**/
...
...
zlt-gateway/zuul-gateway/src/main/java/com/central/gateway/feign/fallback/MenuServiceFallbackFactory.java
浏览文件 @
110bdc5a
package
com.central.gateway.feign.fallback
;
import
cn.hutool.core.collection.CollectionUtil
;
import
com.central.common.feign.UserService
;
import
com.central.common.model.LoginAppUser
;
import
com.central.common.model.SysMenu
;
import
com.central.common.model.SysUser
;
import
com.central.gateway.feign.MenuService
;
import
feign.hystrix.FallbackFactory
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
/**
* menuService降级工场
*
...
...
zlt-uaa/src/main/java/com/central/oauth/config/SecurityHandlerConfig.java
浏览文件 @
110bdc5a
...
...
@@ -4,7 +4,6 @@ import com.central.common.utils.ResponseUtil;
import
com.central.oauth.handler.OauthLogoutHandler
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.http.HttpStatus
;
...
...
zlt-uaa/src/main/java/com/central/oauth/controller/OAuth2Controller.java
浏览文件 @
110bdc5a
...
...
@@ -116,7 +116,7 @@ public class OAuth2Controller {
* @return
*/
@ApiOperation
(
value
=
"当前登陆用户信息"
)
@
Reques
tMapping
(
value
=
{
"/oauth/userinfo"
},
produces
=
"application/json"
)
// 获取用户信息。/auth/user
@
Ge
tMapping
(
value
=
{
"/oauth/userinfo"
},
produces
=
"application/json"
)
// 获取用户信息。/auth/user
public
Map
<
String
,
Object
>
getCurrentUserDetail
(
@LoginUser
SysUser
user
)
{
Map
<
String
,
Object
>
userInfo
=
new
HashMap
<>();
if
(
user
!=
null
)
{
...
...
zlt-uaa/src/main/java/com/central/oauth/controller/ValidateCodeController.java
浏览文件 @
110bdc5a
...
...
@@ -35,8 +35,7 @@ public class ValidateCodeController {
* @throws Exception
*/
@GetMapping
(
SecurityConstants
.
DEFAULT_VALIDATE_CODE_URL_PREFIX
+
"/{deviceId}"
)
public
void
createCode
(
@PathVariable
String
deviceId
,
HttpServletResponse
response
)
throws
Exception
{
public
void
createCode
(
@PathVariable
String
deviceId
,
HttpServletResponse
response
)
throws
Exception
{
Assert
.
notNull
(
deviceId
,
"机器码不能为空"
);
response
.
setHeader
(
"Cache-Control"
,
"no-store, no-cache"
);
response
.
setContentType
(
"image/jpeg"
);
...
...
zlt-uaa/src/main/java/com/central/oauth/filter/ValidateCodeFilter.java
浏览文件 @
110bdc5a
...
...
@@ -59,7 +59,7 @@ public class ValidateCodeFilter extends OncePerRequestFilter {
return
true
;
}
}
}
catch
(
IO
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"解析client信息失败"
,
e
);
}
}
...
...
zlt-uaa/src/main/java/com/central/oauth/handler/OauthLogoutHandler.java
浏览文件 @
110bdc5a
...
...
@@ -39,7 +39,6 @@ public class OauthLogoutHandler implements LogoutHandler {
log
.
info
(
"remove existingAccessToken!"
,
existingAccessToken
);
tokenStore
.
removeAccessToken
(
existingAccessToken
);
}
return
;
}
}
}
zlt-uaa/src/main/java/com/central/oauth/mapper/ClientMapper.java
浏览文件 @
110bdc5a
...
...
@@ -13,13 +13,5 @@ import com.central.oauth.model.Client;
* @author zlt
*/
public
interface
ClientMapper
extends
SuperMapper
<
Client
>
{
//int count(@Param("params") Map<String, Object> params);
List
<
Client
>
findList
(
Page
<
Client
>
page
,
@Param
(
"params"
)
Map
<
String
,
Object
>
params
);
/*@Select("select * from oauth_client_details t where t.client_id = #{clientId}")
Client getClient(String clientId);*/
/*@Update("update oauth_client_details t set t.client_secret = #{clientSecret},t.client_secret_str = #{clientSecretStr} where t.id = #{id}")
int update(Client client);*/
}
zlt-uaa/src/main/java/com/central/oauth/mobile/MobileAuthenticationProvider.java
浏览文件 @
110bdc5a
...
...
@@ -19,7 +19,7 @@ public class MobileAuthenticationProvider implements AuthenticationProvider {
private
PasswordEncoder
passwordEncoder
;
@Override
public
Authentication
authenticate
(
Authentication
authentication
)
throws
AuthenticationException
{
public
Authentication
authenticate
(
Authentication
authentication
)
{
MobileAuthenticationToken
authenticationToken
=
(
MobileAuthenticationToken
)
authentication
;
String
mobile
=
(
String
)
authenticationToken
.
getPrincipal
();
String
password
=
(
String
)
authenticationToken
.
getCredentials
();
...
...
zlt-uaa/src/main/java/com/central/oauth/mobile/MobileAuthenticationToken.java
浏览文件 @
110bdc5a
...
...
@@ -69,7 +69,7 @@ public class MobileAuthenticationToken extends AbstractAuthenticationToken {
}
@Override
public
void
setAuthenticated
(
boolean
isAuthenticated
)
throws
IllegalArgumentException
{
public
void
setAuthenticated
(
boolean
isAuthenticated
)
{
if
(
isAuthenticated
)
{
throw
new
IllegalArgumentException
(
"Cannot set this token to trusted - use constructor which takes a GrantedAuthority list instead"
);
...
...
zlt-uaa/src/main/java/com/central/oauth/openid/OpenIdAuthenticationProvider.java
浏览文件 @
110bdc5a
...
...
@@ -15,7 +15,7 @@ public class OpenIdAuthenticationProvider implements AuthenticationProvider {
private
SocialUserDetailsService
userDetailsService
;
@Override
public
Authentication
authenticate
(
Authentication
authentication
)
throws
AuthenticationException
{
public
Authentication
authenticate
(
Authentication
authentication
)
{
OpenIdAuthenticationToken
authenticationToken
=
(
OpenIdAuthenticationToken
)
authentication
;
String
openId
=
(
String
)
authenticationToken
.
getPrincipal
();
UserDetails
user
=
userDetailsService
.
loadUserByUserId
(
openId
);
...
...
zlt-uaa/src/main/java/com/central/oauth/openid/OpenIdAuthenticationToken.java
浏览文件 @
110bdc5a
/**
*
*/
package
com.central.oauth.openid
;
import
org.springframework.security.authentication.AbstractAuthenticationToken
;
...
...
@@ -66,7 +63,7 @@ public class OpenIdAuthenticationToken extends AbstractAuthenticationToken {
}
@Override
public
void
setAuthenticated
(
boolean
isAuthenticated
)
throws
IllegalArgumentException
{
public
void
setAuthenticated
(
boolean
isAuthenticated
)
{
if
(
isAuthenticated
)
{
throw
new
IllegalArgumentException
(
"Cannot set this token to trusted - use constructor which takes a GrantedAuthority list instead"
);
...
...
zlt-uaa/src/main/java/com/central/oauth/service/ZltUserDetailsService.java
浏览文件 @
110bdc5a
...
...
@@ -9,5 +9,11 @@ import org.springframework.security.core.userdetails.UsernameNotFoundException;
* @date 2018/12/28
*/
public
interface
ZltUserDetailsService
extends
UserDetailsService
{
UserDetails
loadUserByMobile
(
String
mobile
)
throws
UsernameNotFoundException
;
/**
* 根据电话号码查询用户
*
* @param mobile
* @return
*/
UserDetails
loadUserByMobile
(
String
mobile
);
}
zlt-uaa/src/main/java/com/central/oauth/service/impl/ClientServiceImpl.java
浏览文件 @
110bdc5a
...
...
@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.central.common.constant.CommonConstant
;
import
com.central.common.lock.DistributedLock
;
import
com.central.common.model.SysUser
;
import
com.central.common.redis.template.RedisRepository
;
import
com.central.common.constant.SecurityConstants
;
import
com.central.common.model.PageResult
;
...
...
zlt-uaa/src/main/java/com/central/oauth/service/impl/RedisClientDetailsService.java
浏览文件 @
110bdc5a
...
...
@@ -37,7 +37,7 @@ public class RedisClientDetailsService extends JdbcClientDetailsService {
}
@Override
public
ClientDetails
loadClientByClientId
(
String
clientId
)
throws
InvalidClientException
{
public
ClientDetails
loadClientByClientId
(
String
clientId
)
{
// 先从redis获取
ClientDetails
clientDetails
=
(
ClientDetails
)
redisTemplate
.
opsForValue
().
get
(
clientRedisKey
(
clientId
));
if
(
clientDetails
==
null
)
{
...
...
@@ -70,19 +70,19 @@ public class RedisClientDetailsService extends JdbcClientDetailsService {
}
@Override
public
void
updateClientDetails
(
ClientDetails
clientDetails
)
throws
NoSuchClientException
{
public
void
updateClientDetails
(
ClientDetails
clientDetails
)
{
super
.
updateClientDetails
(
clientDetails
);
cacheAndGetClient
(
clientDetails
.
getClientId
());
}
@Override
public
void
updateClientSecret
(
String
clientId
,
String
secret
)
throws
NoSuchClientException
{
public
void
updateClientSecret
(
String
clientId
,
String
secret
)
{
super
.
updateClientSecret
(
clientId
,
secret
);
cacheAndGetClient
(
clientId
);
}
@Override
public
void
removeClientDetails
(
String
clientId
)
throws
NoSuchClientException
{
public
void
removeClientDetails
(
String
clientId
)
{
super
.
removeClientDetails
(
clientId
);
removeRedisCache
(
clientId
);
}
...
...
@@ -106,9 +106,7 @@ public class RedisClientDetailsService extends JdbcClientDetailsService {
return
;
}
list
.
parallelStream
().
forEach
(
client
->
{
redisTemplate
.
opsForValue
().
set
(
clientRedisKey
(
client
.
getClientId
()),
client
);
});
list
.
parallelStream
().
forEach
(
client
->
redisTemplate
.
opsForValue
().
set
(
clientRedisKey
(
client
.
getClientId
()),
client
));
}
private
String
clientRedisKey
(
String
clientId
)
{
...
...
zlt-uaa/src/main/java/com/central/oauth/service/impl/UserDetailServiceImpl.java
浏览文件 @
110bdc5a
...
...
@@ -26,7 +26,7 @@ public class UserDetailServiceImpl implements ZltUserDetailsService, SocialUserD
private
UserService
userService
;
@Override
public
UserDetails
loadUserByUsername
(
String
username
)
throws
UsernameNotFoundException
{
public
UserDetails
loadUserByUsername
(
String
username
)
{
LoginAppUser
loginAppUser
=
userService
.
findByUsername
(
username
);
if
(
loginAppUser
==
null
)
{
throw
new
InternalAuthenticationServiceException
(
"用户名或密码错误"
);
...
...
@@ -35,13 +35,13 @@ public class UserDetailServiceImpl implements ZltUserDetailsService, SocialUserD
}
@Override
public
SocialUserDetails
loadUserByUserId
(
String
openId
)
throws
UsernameNotFoundException
{
public
SocialUserDetails
loadUserByUserId
(
String
openId
)
{
LoginAppUser
loginAppUser
=
userService
.
findByOpenId
(
openId
);
return
checkUser
(
loginAppUser
);
}
@Override
public
UserDetails
loadUserByMobile
(
String
mobile
)
throws
UsernameNotFoundException
{
public
UserDetails
loadUserByMobile
(
String
mobile
)
{
LoginAppUser
loginAppUser
=
userService
.
findByMobile
(
mobile
);
return
checkUser
(
loginAppUser
);
}
...
...
zlt-uaa/src/main/java/com/central/oauth/service/impl/ValidateCodeServiceImpl.java
浏览文件 @
110bdc5a
...
...
@@ -95,7 +95,7 @@ public class ValidateCodeServiceImpl implements IValidateCodeService {
* 验证验证码
*/
@Override
public
void
validate
(
HttpServletRequest
request
)
throws
ValidateCodeException
{
public
void
validate
(
HttpServletRequest
request
)
{
String
deviceId
=
request
.
getParameter
(
"deviceId"
);
if
(
StringUtils
.
isBlank
(
deviceId
))
{
throw
new
ValidateCodeException
(
"请在请求参数中携带deviceId参数"
);
...
...
zlt-web/back-web/src/main/resources/static/pages/generator/list.html
浏览文件 @
110bdc5a
...
...
@@ -75,20 +75,6 @@
// layer.msg("演示阶段", {icon: 1});
var
url
=
config
.
base_server
+
'
api-generator/generator/code?access_token=
'
+
config
.
getToken
().
access_token
+
"
&tables=
"
+
obj
.
data
.
tableName
;
window
.
location
.
href
=
url
;
// var xhr = new XMLHttpRequest();
// xhr.open('GET', url, true);
// xhr.responseType = "blob";
// xhr.setRequestHeader("client_type", "DESKTOP_WEB");
// xhr.onload = function() {
// if (this.status == 200) {
// var blob = this.response;
// var objecturl = URL.createObjectURL(blob);
// window.location.href = objecturl;
// }
// }
// xhr.send();
};
});
</script>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录