Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Springboot Plus
Commits
18144407
Commit
18144407
authored
Sep 04, 2019
by
trumansdo
Browse files
应用codestyle
千万千万要用vscode打开前端项目,或者关闭eslint,移除它 Signed-off-by:
trumansdo
<
1012243881@qq.com
>
parent
9b3d96a6
Changes
178
Hide whitespace changes
Inline
Side-by-side
plus-admin/admin-core/src/main/java/com/ibeetl/admin/core/service/CoreDictService.java
View file @
18144407
...
...
@@ -17,116 +17,107 @@ import com.ibeetl.admin.core.util.enums.DelFlagEnum;
/**
* 描述: 字典 service,包含常规字典和级联字典的操作。
*
* @author : xiandafu
*/
@Service
@Transactional
public
class
CoreDictService
extends
CoreBaseService
<
CoreDict
>
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
CoreDictService
.
class
);
@Autowired
private
CoreDictDao
dictDao
;
@Autowired
CorePlatformService
platformService
;
@Autowired
CoreDictService
self
;
/**
* 根据类型获取字典集合
* @param type 字典类型,
* @return List
*/
@Cacheable
(
value
=
CorePlatformService
.
DICT_CACHE_TYPE
)
public
List
<
CoreDict
>
findAllByType
(
String
type
)
{
return
dictDao
.
findAllList
(
type
);
}
/**
* 级联字典查询,必须提供一个字典类型
* @param group
* @param value
* @return
*/
@Cacheable
(
value
=
CorePlatformService
.
DICT_CACHE_CHILDREN
)
public
List
<
CoreDict
>
findAllByGroup
(
String
type
,
String
value
)
{
List
<
CoreDict
>
list
=
self
.
findAllByType
(
type
);
return
_search
(
list
,
value
);
}
/**
* 级联字段下一级的字段列表
* @param parentValue
* @return
*/
@Cacheable
(
value
=
CorePlatformService
.
DICT_CACHE_CHILDREN
)
public
List
<
CoreDict
>
findChildByParent
(
Long
id
)
{
return
dictDao
.
findChildByParent
(
id
);
}
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
CoreDictService
.
class
);
@Cacheable
(
value
=
CorePlatformService
.
DICT_CACHE_VALUE
)
public
CoreDict
findCoreDict
(
String
type
,
String
value
)
{
List
<
CoreDict
>
list
=
self
.
findAllByGroup
(
type
,
value
);
if
(
list
==
null
)
{
return
null
;
}
for
(
CoreDict
dict:
list
)
{
if
(
dict
.
getValue
().
equals
(
value
))
{
return
dict
;
}
}
return
null
;
}
/*通过名字反向查找数据字典,通常用于excel导入*/
public
Map
<
String
,
CoreDict
>
mapDictByName
(
String
type
){
List
<
CoreDict
>
list
=
self
.
findAllByType
(
type
);
Map
<
String
,
CoreDict
>
map
=
new
HashMap
<
String
,
CoreDict
>();
for
(
CoreDict
dict:
list
)
{
map
.
put
(
dict
.
getName
(),
dict
);
}
return
map
;
@Autowired
private
CoreDictDao
dictDao
;
@Autowired
CorePlatformService
platformService
;
@Autowired
CoreDictService
self
;
/**
* 根据类型获取字典集合
*
* @param type 字典类型,
* @return List
*/
@Cacheable
(
value
=
CorePlatformService
.
DICT_CACHE_TYPE
)
public
List
<
CoreDict
>
findAllByType
(
String
type
)
{
return
dictDao
.
findAllList
(
type
);
}
/**
* 级联字典查询,必须提供一个字典类型
*
* @param group
* @param value
* @return
*/
@Cacheable
(
value
=
CorePlatformService
.
DICT_CACHE_CHILDREN
)
public
List
<
CoreDict
>
findAllByGroup
(
String
type
,
String
value
)
{
List
<
CoreDict
>
list
=
self
.
findAllByType
(
type
);
return
_search
(
list
,
value
);
}
/**
* 级联字段下一级的字段列表
*
* @param parentValue
* @return
*/
@Cacheable
(
value
=
CorePlatformService
.
DICT_CACHE_CHILDREN
)
public
List
<
CoreDict
>
findChildByParent
(
Long
id
)
{
return
dictDao
.
findChildByParent
(
id
);
}
@Cacheable
(
value
=
CorePlatformService
.
DICT_CACHE_VALUE
)
public
CoreDict
findCoreDict
(
String
type
,
String
value
)
{
List
<
CoreDict
>
list
=
self
.
findAllByGroup
(
type
,
value
);
if
(
list
==
null
)
{
return
null
;
}
/*递归查找*/
private
List
<
CoreDict
>
_search
(
List
<
CoreDict
>
list
,
String
value
)
{
for
(
CoreDict
dict:
list
)
{
if
(
dict
.
getValue
().
equals
(
value
))
{
return
list
;
}
else
{
List
<
CoreDict
>
children
=
findChildByParent
(
dict
.
getId
());
if
(
children
.
isEmpty
())
{
continue
;
}
else
{
List
<
CoreDict
>
ret
=
_search
(
children
,
value
);
if
(
ret
!=
null
)
{
return
ret
;
}
}
}
}
return
null
;
for
(
CoreDict
dict
:
list
)
{
if
(
dict
.
getValue
().
equals
(
value
))
{
return
dict
;
}
}
/**
* 查询字段类型列表
* @return
*/
public
List
<
Map
<
String
,
String
>>
findTypeList
()
{
return
dictDao
.
findTypeList
(
DelFlagEnum
.
NORMAL
.
getValue
());
return
null
;
}
/*通过名字反向查找数据字典,通常用于excel导入*/
public
Map
<
String
,
CoreDict
>
mapDictByName
(
String
type
)
{
List
<
CoreDict
>
list
=
self
.
findAllByType
(
type
);
Map
<
String
,
CoreDict
>
map
=
new
HashMap
<
String
,
CoreDict
>();
for
(
CoreDict
dict
:
list
)
{
map
.
put
(
dict
.
getName
(),
dict
);
}
return
map
;
}
/*递归查找*/
private
List
<
CoreDict
>
_search
(
List
<
CoreDict
>
list
,
String
value
)
{
for
(
CoreDict
dict
:
list
)
{
if
(
dict
.
getValue
().
equals
(
value
))
{
return
list
;
}
else
{
List
<
CoreDict
>
children
=
findChildByParent
(
dict
.
getId
());
if
(
children
.
isEmpty
())
{
continue
;
}
else
{
List
<
CoreDict
>
ret
=
_search
(
children
,
value
);
if
(
ret
!=
null
)
{
return
ret
;
}
}
}
}
return
null
;
}
/**
* 查询字段类型列表
*
* @return
*/
public
List
<
Map
<
String
,
String
>>
findTypeList
()
{
return
dictDao
.
findTypeList
(
DelFlagEnum
.
NORMAL
.
getValue
());
}
}
plus-admin/admin-core/src/main/java/com/ibeetl/admin/core/service/CorePlatformService.java
View file @
18144407
...
...
@@ -39,372 +39,349 @@ import com.ibeetl.admin.core.util.enums.DelFlagEnum;
/**
* 系统平台功能访问入口,所有方法应该支持缓存或者快速访问
*
* @author xiandafu
*/
@Service
public
class
CorePlatformService
{
// 菜单树,组织机构树,功能树缓存标记
public
static
final
String
MENU_TREE_CACHE
=
"cache:core:menuTree"
;
public
static
final
String
ORG_TREE_CACHE
=
"cache:core:orgTree"
;
public
static
final
String
FUNCTION_TREE_CACHE
=
"cache:core:functionTree"
;
// 字典列表
public
static
final
String
DICT_CACHE_TYPE
=
"cache:core:dictType"
;
public
static
final
String
DICT_CACHE_VALUE
=
"cache:core:dictValue"
;
public
static
final
String
DICT_CACHE_SAME_LEVEL
=
"cache:core:ditcSameLevel"
;
public
static
final
String
DICT_CACHE_CHILDREN
=
"cache:core:dictChildren"
;
public
static
final
String
USER_FUNCTION_ACCESS_CACHE
=
"cache:core:userFunctionAccess"
;
public
static
final
String
USER_FUNCTION_CHIDREN_CACHE
=
"ccache:core:functionChildren"
;
public
static
final
String
FUNCTION_CACHE
=
"cache:core:function"
;
//菜单树,组织机构树,功能树缓存标记
public
static
final
String
MENU_TREE_CACHE
=
"cache:core:menuTree"
;
public
static
final
String
ORG_TREE_CACHE
=
"cache:core:orgTree"
;
public
static
final
String
FUNCTION_TREE_CACHE
=
"cache:core:functionTree"
;
//字典列表
public
static
final
String
DICT_CACHE_TYPE
=
"cache:core:dictType"
;
public
static
final
String
DICT_CACHE_VALUE
=
"cache:core:dictValue"
;
public
static
final
String
DICT_CACHE_SAME_LEVEL
=
"cache:core:ditcSameLevel"
;
public
static
final
String
DICT_CACHE_CHILDREN
=
"cache:core:dictChildren"
;
public
static
final
String
USER_FUNCTION_ACCESS_CACHE
=
"cache:core:userFunctionAccess"
;
public
static
final
String
USER_FUNCTION_CHIDREN_CACHE
=
"ccache:core:functionChildren"
;
public
static
final
String
FUNCTION_CACHE
=
"cache:core:function"
;
public
static
final
String
USER_DATA_ACCESS_CACHE
=
"cache:core:userDataAccess"
;
public
static
final
String
USER_MENU_CACHE
=
"cache:core:userMenu"
;
public
static
final
String
USER_DATA_ACCESS_CACHE
=
"cache:core:userDataAccess"
;
public
static
final
String
USER_MENU_CACHE
=
"cache:core:userMenu"
;
/*当前用户会话*/
public
static
final
String
ACCESS_CURRENT_USER
=
"core:user"
;
/*当前登录用户所在部门*/
public
static
final
String
ACCESS_CURRENT_ORG
=
"core:currentOrg"
;
/*用户可选部门*/
public
static
final
String
ACCESS_USER_ORGS
=
"core:orgs"
;
/*当前用户会话*/
public
static
final
String
ACCESS_CURRENT_USER
=
"core:user"
;
/*当前登录用户所在部门*/
public
static
final
String
ACCESS_CURRENT_ORG
=
"core:currentOrg"
;
/*用户可选部门*/
public
static
final
String
ACCESS_USER_ORGS
=
"core:orgs"
;
public
static
final
String
ACCESS_SUPPER_ADMIN
=
"admin"
;
public
static
final
String
ACCESS_SUPPER_ADMIN
=
"admin"
;
@Autowired
HttpRequestLocal
httpRequestLocal
;
@Autowired
HttpRequestLocal
httpRequestLocal
;
@Autowired
CoreRoleFunctionDao
roleFunctionDao
;
@Autowired
CoreRoleFunctionDao
roleFunctionDao
;
@Autowired
CoreRoleMenuDao
sysRoleMenuDao
;
@Autowired
CoreRoleMenuDao
sysRoleMenuDao
;
@Autowired
CoreOrgDao
sysOrgDao
;
@Autowired
CoreOrgDao
sysOrgDao
;
@Autowired
CoreRoleFunctionDao
sysRoleFunctionDao
;
@Autowired
CoreRoleFunctionDao
sysRoleFunctionDao
;
@Autowired
CoreMenuDao
sysMenuDao
;
@Autowired
CoreMenuDao
sysMenuDao
;
@Autowired
CoreUserDao
sysUserDao
;
@Autowired
CoreUserDao
sysUserDao
;
@Autowired
CoreFunctionDao
sysFunctionDao
;
@Autowired
CoreFunctionDao
sysFunctionDao
;
@Autowired
SQLManager
sqlManager
;
@Autowired
SQLManager
sqlManager
;
@Autowired
DataAccessFunction
dataAccessFunction
;
@Autowired
DataAccessF
unction
dataAccessF
unction
;
@Autowired
CorePlatformService
self
;
@Autowired
DataAccessF
actory
dataAccessF
actory
;
@Autowired
CorePlatformService
self
;
@Autowired
DataAccessFactory
dataAccessFactory
;
@PostConstruct
@SuppressWarnings
(
"unchecked"
)
public
void
init
()
{
SQLPlaceholderST
.
textFunList
.
add
(
"function"
);
// sql语句里带有此函数来判断数据权限
sqlManager
.
getBeetl
().
getGroupTemplate
().
registerFunction
(
"function"
,
dataAccessFunction
);
sqlManager
.
getBeetl
().
getGroupTemplate
().
registerFunction
(
"nextDay"
,
new
NextDayFunction
());
}
@PostConstruct
@SuppressWarnings
(
"unchecked"
)
public
void
init
()
{
SQLPlaceholderST
.
textFunList
.
add
(
"function"
);
//sql语句里带有此函数来判断数据权限
sqlManager
.
getBeetl
().
getGroupTemplate
().
registerFunction
(
"function"
,
dataAccessFunction
);
sqlManager
.
getBeetl
().
getGroupTemplate
().
registerFunction
(
"nextDay"
,
new
NextDayFunction
());
}
public
CoreUser
getCurrentUser
()
{
checkSession
();
CoreUser
user
=
(
CoreUser
)
httpRequestLocal
.
getSessionValue
(
ACCESS_CURRENT_USER
);
return
user
;
public
CoreUser
getCurrentUser
()
{
checkSession
();
CoreUser
user
=
(
CoreUser
)
httpRequestLocal
.
getSessionValue
(
ACCESS_CURRENT_USER
);
return
user
;
}
public
void
changeOrg
(
Long
orgId
)
{
List
<
CoreOrg
>
orgs
=
this
.
getCurrentOrgs
();
for
(
CoreOrg
org
:
orgs
)
{
if
(
org
.
getId
().
equals
(
orgId
))
{
httpRequestLocal
.
setSessionValue
(
CorePlatformService
.
ACCESS_CURRENT_ORG
,
org
);
}
}
public
void
changeOrg
(
Long
orgId
)
{
List
<
CoreOrg
>
orgs
=
this
.
getCurrentOrgs
();
for
(
CoreOrg
org:
orgs
)
{
if
(
org
.
getId
().
equals
(
orgId
))
{
httpRequestLocal
.
setSessionValue
(
CorePlatformService
.
ACCESS_CURRENT_ORG
,
org
);
}
}
}
public
Long
getCurrentOrgId
()
{
checkSession
();
CoreOrg
org
=
(
CoreOrg
)
httpRequestLocal
.
getSessionValue
(
ACCESS_CURRENT_ORG
);
return
org
.
getId
();
}
public
Long
getCurrentOrgId
()
{
checkSession
();
CoreOrg
org
=
(
CoreOrg
)
httpRequestLocal
.
getSessionValue
(
ACCESS_CURRENT_ORG
);
return
org
.
getId
();
}
public
CoreOrg
getCurrentOrg
()
{
checkSession
();
CoreOrg
org
=
(
CoreOrg
)
httpRequestLocal
.
getSessionValue
(
ACCESS_CURRENT_ORG
);
return
org
;
}
public
List
<
CoreOrg
>
getCurrentOrgs
()
{
List
<
CoreOrg
>
orgs
=
(
List
<
CoreOrg
>)
httpRequestLocal
.
getSessionValue
(
ACCESS_USER_ORGS
);
return
orgs
;
}
protected
void
checkSession
()
{
CoreOrg
org
=
(
CoreOrg
)
httpRequestLocal
.
getSessionValue
(
ACCESS_CURRENT_ORG
);
if
(
org
==
null
)
{
throw
new
PlatformException
(
"会话过期,重新登录"
);
}
public
CoreOrg
getCurrentOrg
()
{
checkSession
();
CoreOrg
org
=
(
CoreOrg
)
httpRequestLocal
.
getSessionValue
(
ACCESS_CURRENT_ORG
);
return
org
;
}
public
void
setLoginUser
(
CoreUser
user
,
CoreOrg
currentOrg
,
List
<
CoreOrg
>
orgs
)
{
httpRequestLocal
.
setSessionValue
(
CorePlatformService
.
ACCESS_CURRENT_USER
,
user
);
httpRequestLocal
.
setSessionValue
(
CorePlatformService
.
ACCESS_CURRENT_ORG
,
currentOrg
);
httpRequestLocal
.
setSessionValue
(
CorePlatformService
.
ACCESS_USER_ORGS
,
orgs
);
}
public
MenuItem
getMenuItem
(
long
userId
,
long
orgId
)
{
CoreUser
user
=
this
.
sysUserDao
.
unique
(
userId
);
if
(
this
.
isSupperAdmin
(
user
))
{
return
self
.
buildMenu
();
}
public
List
<
CoreOrg
>
getCurrentOrgs
()
{
List
<
CoreOrg
>
orgs
=
(
List
<
CoreOrg
>)
httpRequestLocal
.
getSessionValue
(
ACCESS_USER_ORGS
);
return
orgs
;
}
protected
void
checkSession
()
{
CoreOrg
org
=
(
CoreOrg
)
httpRequestLocal
.
getSessionValue
(
ACCESS_CURRENT_ORG
);
if
(
org
==
null
)
{
throw
new
PlatformException
(
"会话过期,重新登录"
);
}
Set
<
Long
>
allows
=
self
.
getCurrentMenuIds
(
userId
,
orgId
);
MenuItem
menu
=
this
.
buildMenu
();
menu
.
filter
(
allows
);
return
menu
;
}
public
OrgItem
getUserOrgTree
()
{
if
(
this
.
isCurrentSupperAdmin
())
{
OrgItem
root
=
self
.
buildOrg
();
return
root
;
}
OrgItem
current
=
getCurrentOrgItem
();
OrgItem
item
=
dataAccessFactory
.
getUserOrgTree
(
current
);
public
void
setLoginUser
(
CoreUser
user
,
CoreOrg
currentOrg
,
List
<
CoreOrg
>
orgs
)
{
httpRequestLocal
.
setSessionValue
(
CorePlatformService
.
ACCESS_CURRENT_USER
,
user
);
httpRequestLocal
.
setSessionValue
(
CorePlatformService
.
ACCESS_CURRENT_ORG
,
currentOrg
);
httpRequestLocal
.
setSessionValue
(
CorePlatformService
.
ACCESS_USER_ORGS
,
orgs
);
return
item
;
}
}
@Cacheable
(
FUNCTION_CACHE
)
public
CoreFunction
getFunction
(
String
functionCode
)
{
public
MenuItem
getMenuItem
(
long
userId
,
long
orgId
)
{
CoreUser
user
=
this
.
sysUserDao
.
unique
(
userId
);
if
(
this
.
isSupperAdmin
(
user
))
{
return
self
.
buildMenu
();
}
Set
<
Long
>
allows
=
self
.
getCurrentMenuIds
(
userId
,
orgId
);
MenuItem
menu
=
this
.
buildMenu
();
menu
.
filter
(
allows
);
return
menu
;
return
sysFunctionDao
.
getFunctionByCode
(
functionCode
);
}
public
OrgItem
getCurrentOrgItem
()
{
// @TODO 无法缓存orgItem,因为组织机构在调整
OrgItem
root
=
buildOrg
();
OrgItem
item
=
root
.
findChild
(
getCurrentOrgId
());
if
(
item
==
null
)
{
throw
new
PlatformException
(
"未找到组织机构"
);
}
public
OrgItem
getUserOrgTree
()
{
if
(
this
.
isCurrentSupperAdmin
())
{
OrgItem
root
=
self
.
buildOrg
();
return
root
;
}
OrgItem
current
=
getCurrentOrgItem
();
OrgItem
item
=
dataAccessFactory
.
getUserOrgTree
(
current
);
return
item
;
return
item
;
}
/**
* 判断用户是否是超级管理员
*
* @param user
* @return
*/
public
boolean
isSupperAdmin
(
CoreUser
user
)
{
return
user
.
getCode
().
startsWith
(
ACCESS_SUPPER_ADMIN
);
}
public
boolean
isCurrentSupperAdmin
()
{
CoreUser
user
=
this
.
getCurrentUser
();
return
isSupperAdmin
(
user
);
}
public
boolean
isAllowUserName
(
String
name
)
{
return
!
name
.
startsWith
(
ACCESS_SUPPER_ADMIN
);
}
/**
* 获取用户在指定功能点的数据权限配置,如果没有,返回空集合
*
* @param userId
* @param orgId
* @param fucntionCode
* @return
*/
@Cacheable
(
USER_DATA_ACCESS_CACHE
)
public
List
<
CoreRoleFunction
>
getRoleFunction
(
Long
userId
,
Long
orgId
,
String
fucntionCode
)
{
List
<
CoreRoleFunction
>
list
=
sysRoleFunctionDao
.
getRoleFunction
(
userId
,
orgId
,
fucntionCode
);
return
list
;
}
/**
* 当前用户是否能访问功能,用于后台功能验证,functionCode 目前只支持二级域名方式,不支持更多级别
*
* @param functionCode "user.add","user"
* @return
*/
@Cacheable
(
USER_FUNCTION_ACCESS_CACHE
)
public
boolean
canAcessFunction
(
Long
userId
,
Long
orgId
,
String
functionCode
)
{
CoreUser
user
=
getCurrentUser
();
if
(
user
.
getId
()
==
userId
&&
isSupperAdmin
(
user
))
{
return
true
;
}
@Cacheable
(
FUNCTION_CACHE
)
public
CoreFunction
getFunction
(
String
functionCode
)
{
return
sysFunctionDao
.
getFunctionByCode
(
functionCode
);
String
str
=
functionCode
;
List
<
CoreRoleFunction
>
list
=
sysRoleFunctionDao
.
getRoleFunction
(
userId
,
orgId
,
str
);
boolean
canAccess
=
!
list
.
isEmpty
();
if
(
canAccess
)
{
return
true
;
}
else
{
return
false
;
}
public
OrgItem
getCurrentOrgItem
()
{
//@TODO 无法缓存orgItem,因为组织机构在调整
OrgItem
root
=
buildOrg
();
OrgItem
item
=
root
.
findChild
(
getCurrentOrgId
());
if
(
item
==
null
)
{
throw
new
PlatformException
(
"未找到组织机构"
);
}
return
item
;
}
/**
* 当前功能的子功能,如果有,则页面需要做按钮级别的过滤
*
* @param userId
* @param orgId
* @param parentFunction 菜单对应的function
* @return
*/
@Cacheable
(
USER_FUNCTION_CHIDREN_CACHE
)
public
List
<
String
>
getChildrenFunction
(
Long
userId
,
Long
orgId
,
String
parentFunction
)
{
CoreFunction
template
=
new
CoreFunction
();
template
.
setCode
(
parentFunction
);
List
<
CoreFunction
>
list
=
sysFunctionDao
.
template
(
template
);
if
(
list
.
size
()
!=
1
)
{
throw
new
PlatformException
(
"访问权限未配置"
);
}
/**
* 判断用户是否是超级管理员
* @param user
* @return
*/
public
boolean
isSupperAdmin
(
CoreUser
user
)
{
return
user
.
getCode
().
startsWith
(
ACCESS_SUPPER_ADMIN
);
}
public
boolean
isCurrentSupperAdmin
()
{
CoreUser
user
=
this
.
getCurrentUser
();
return
isSupperAdmin
(
user
);
}
public
boolean
isAllowUserName
(
String
name
){
return
!
name
.
startsWith
(
ACCESS_SUPPER_ADMIN
);
}
/**
* 获取用户在指定功能点的数据权限配置,如果没有,返回空集合
* @param userId
* @param orgId
* @param fucntionCode
* @return
*/
@Cacheable
(
USER_DATA_ACCESS_CACHE
)
public
List
<
CoreRoleFunction
>
getRoleFunction
(
Long
userId
,
Long
orgId
,
String
fucntionCode
)
{
List
<
CoreRoleFunction
>
list
=
sysRoleFunctionDao
.
getRoleFunction
(
userId
,
orgId
,
fucntionCode
);
return
list
;
Long
id
=
list
.
get
(
0
).
getId
();
return
sysRoleFunctionDao
.
getRoleChildrenFunction
(
userId
,
orgId
,
id
);
}
/**
* 查询当前用户有用的菜单项目,可以在随后验证是否能显示某项菜单
*
* @return
*/
@Cacheable
(
USER_MENU_CACHE
)
public
Set
<
Long
>
getCurrentMenuIds
(
Long
userId
,
Long
orgId
)
{
List
<
Long
>
list
=
sysRoleMenuDao
.
queryMenuByUser
(
userId
,
orgId
);
return
new
HashSet
<
Long
>(
list
);
}
/**
* 验证菜单是否能被显示
*
* @param item
* @param allows
* @return
*/
public
boolean
canShowMenu
(
CoreUser
user
,
MenuItem
item
,
Set
<
Long
>
allows
)
{
if
(
isSupperAdmin
(
user
))
{
return
true
;
}
/**
* 当前用户是否能访问功能,用于后台功能验证,functionCode 目前只支持二级域名方式,不支持更多级别
* @param functionCode "user.add","user"
* @return
*/
@Cacheable
(
USER_FUNCTION_ACCESS_CACHE
)
public
boolean
canAcessFunction
(
Long
userId
,
Long
orgId
,
String
functionCode
)
{
CoreUser
user
=
getCurrentUser
();
if
(
user
.
getId
()
==
userId
&&
isSupperAdmin
(
user
))
{
return
true
;
}
String
str
=
functionCode
;
List
<
CoreRoleFunction
>
list
=
sysRoleFunctionDao
.
getRoleFunction
(
userId
,
orgId
,
str
);
boolean
canAccess
=
!
list
.
isEmpty
();
if
(
canAccess
)
{
return
true
;
}
else
{
return
false
;
}
return
allows
.
contains
(
item
.
getData
().
getId
());
}
@Cacheable
(
MENU_TREE_CACHE
)
public
MenuItem
buildMenu
()
{
List
<
CoreMenu
>
list
=
sysMenuDao
.
allMenuWithURL
();
return
MenuBuildUtil
.
buildMenuTree
(
list
);
}
@Cacheable
(
ORG_TREE_CACHE
)
public
OrgItem
buildOrg
()
{
CoreOrg
root
=
sysOrgDao
.
getRoot
();
OrgItem
rootItem
=
new
OrgItem
(
root
);
CoreOrg
org
=
new
CoreOrg
();
org
.
setDelFlag
(
DelFlagEnum
.
NORMAL
.
getValue
());
List
<
CoreOrg
>
list
=
sysOrgDao
.
template
(
org
);
OrgBuildUtil
.
buildTreeNode
(
rootItem
,
list
);
// 集团
return
rootItem
;
}
@Cacheable
(
FUNCTION_TREE_CACHE
)
public
FunctionItem
buildFunction
()
{
List
<
CoreFunction
>
list
=
sysFunctionDao
.
all
();
return
FunctionBuildUtil
.
buildOrgTree
(
list
);
}
/**
* 用户信息被管理员修改,重置会话,让用户操作重新登录
*
* @param name
*/
public
void
restUserSession
(
String
name
)
{
// TODO
}
@CacheEvict
(
cacheNames
=
{
FUNCTION_CACHE
,
FUNCTION_TREE_CACHE
,
/*功能点本身缓存*/
MENU_TREE_CACHE
,
USER_MENU_CACHE
,
/*功能点关联菜单缓存*/
USER_FUNCTION_ACCESS_CACHE
,
USER_FUNCTION_CHIDREN_CACHE
,
USER_DATA_ACCESS_CACHE
,
/*功能点相关权限缓存*/
},
allEntries
=
true
)
public
void
clearFunctionCache
()
{
// 没有做任何事情,交给spring cache来处理了
}
@CacheEvict
(
cacheNames
=
{
CorePlatformService
.
MENU_TREE_CACHE
,
CorePlatformService
.
USER_MENU_CACHE
},
allEntries
=
true
)
public
void
clearMenuCache
()
{
// 没有做任何事情,交给spring cache来处理了
}
@CacheEvict
(
cacheNames
=
{
CorePlatformService
.
DICT_CACHE_CHILDREN
,
CorePlatformService
.
DICT_CACHE_SAME_LEVEL
,
CorePlatformService
.
DICT_CACHE_TYPE
,
CorePlatformService
.
DICT_CACHE_VALUE
},
allEntries
=
true
)
public
void
clearDictCache
()
{}
@CacheEvict
(
cacheNames
=
{
CorePlatformService
.
ORG_TREE_CACHE
},
allEntries
=
true
)
public
void
clearOrgCache
()
{}
/**
* 得到类型为系统的菜单,通常就是根菜单下面
*
* @return
*/
public
List
<
MenuItem
>
getSysMenu
()
{
MenuItem
root
=
buildMenu
();
List
<
MenuItem
>
list
=
root
.
getChildren
();
for
(
MenuItem
item
:
list
)
{
if
(!
item
.
getData
().
getType
().
equals
(
CoreMenu
.
TYPE_SYSTEM
))
{
throw
new
IllegalArgumentException
(
"本系统没有系统模块"
);
}
}
/**
* 当前功能的子功能,如果有,则页面需要做按钮级别的过滤
* @param userId
* @param orgId
* @param parentFunction 菜单对应的function
* @return
*/
@Cacheable
(
USER_FUNCTION_CHIDREN_CACHE
)
public
List
<
String
>
getChildrenFunction
(
Long
userId
,
Long
orgId
,
String
parentFunction
)
{
CoreFunction
template
=
new
CoreFunction
();
template
.
setCode
(
parentFunction
);
List
<
CoreFunction
>
list
=
sysFunctionDao
.
template
(
template
);
if
(
list
.
size
()
!=
1
)
{
throw
new
PlatformException
(
"访问权限未配置"
);
}
Long
id
=
list
.
get
(
0
).
getId
();
return
sysRoleFunctionDao
.
getRoleChildrenFunction
(
userId
,
orgId
,
id
);
}
/**
* 查询当前用户有用的菜单项目,可以在随后验证是否能显示某项菜单
* @return
*/
@Cacheable
(
USER_MENU_CACHE
)
public
Set
<
Long
>
getCurrentMenuIds
(
Long
userId
,
Long
orgId
)
{
List
<
Long
>
list
=
sysRoleMenuDao
.
queryMenuByUser
(
userId
,
orgId
);
return
new
HashSet
<
Long
>(
list
);
}
/**
* 验证菜单是否能被显示
* @param item
* @param allows
* @return
*/
public
boolean
canShowMenu
(
CoreUser
user
,
MenuItem
item
,
Set
<
Long
>
allows
)
{
if
(
isSupperAdmin
(
user
))
{
return
true
;
}
return
allows
.
contains
(
item
.
getData
().
getId
());
}
@Cacheable
(
MENU_TREE_CACHE
)
public
MenuItem
buildMenu
()
{
List
<
CoreMenu
>
list
=
sysMenuDao
.
allMenuWithURL
();
return
MenuBuildUtil
.
buildMenuTree
(
list
);
}
@Cacheable
(
ORG_TREE_CACHE
)
public
OrgItem
buildOrg
()
{
CoreOrg
root
=
sysOrgDao
.
getRoot
();
OrgItem
rootItem
=
new
OrgItem
(
root
);
CoreOrg
org
=
new
CoreOrg
();
org
.
setDelFlag
(
DelFlagEnum
.
NORMAL
.
getValue
());
List
<
CoreOrg
>
list
=
sysOrgDao
.
template
(
org
);
OrgBuildUtil
.
buildTreeNode
(
rootItem
,
list
);
//集团
return
rootItem
;
}
@Cacheable
(
FUNCTION_TREE_CACHE
)
public
FunctionItem
buildFunction
()
{
List
<
CoreFunction
>
list
=
sysFunctionDao
.
all
();
return
FunctionBuildUtil
.
buildOrgTree
(
list
);
}
/**
* 用户信息被管理员修改,重置会话,让用户操作重新登录
* @param name
*/
public
void
restUserSession
(
String
name
){
//TODO
}
@CacheEvict
(
cacheNames
=
{
FUNCTION_CACHE
,
FUNCTION_TREE_CACHE
,
/*功能点本身缓存*/
MENU_TREE_CACHE
,
USER_MENU_CACHE
,
/*功能点关联菜单缓存*/
USER_FUNCTION_ACCESS_CACHE
,
USER_FUNCTION_CHIDREN_CACHE
,
USER_DATA_ACCESS_CACHE
,
/*功能点相关权限缓存*/
},
allEntries
=
true
)
public
void
clearFunctionCache
()
{
//没有做任何事情,交给spring cache来处理了
}
@CacheEvict
(
cacheNames
=
{
CorePlatformService
.
MENU_TREE_CACHE
,
CorePlatformService
.
USER_MENU_CACHE
},
allEntries
=
true
)
public
void
clearMenuCache
()
{
//没有做任何事情,交给spring cache来处理了
}
@CacheEvict
(
cacheNames
=
{
CorePlatformService
.
DICT_CACHE_CHILDREN
,
CorePlatformService
.
DICT_CACHE_SAME_LEVEL
,
CorePlatformService
.
DICT_CACHE_TYPE
,
CorePlatformService
.
DICT_CACHE_VALUE
},
allEntries
=
true
)
public
void
clearDictCache
()
{
}
@CacheEvict
(
cacheNames
=
{
CorePlatformService
.
ORG_TREE_CACHE
},
allEntries
=
true
)
public
void
clearOrgCache
()
{
}
/**
* 得到类型为系统的菜单,通常就是根菜单下面
* @return
*/
public
List
<
MenuItem
>
getSysMenu
()
{
MenuItem
root
=
buildMenu
();
List
<
MenuItem
>
list
=
root
.
getChildren
();
for
(
MenuItem
item
:
list
)
{
if
(!
item
.
getData
().
getType
()
.
equals
(
CoreMenu
.
TYPE_SYSTEM
))
{
throw
new
IllegalArgumentException
(
"本系统没有系统模块"
);
}
}
return
list
;
}
/**
* 得到菜单的子菜单
* @param menuId
* @return
*/
public
List
<
MenuItem
>
getChildMenu
(
Long
menuId
)
{
MenuItem
root
=
buildMenu
();
List
<
MenuItem
>
list
=
root
.
findChild
(
menuId
).
getChildren
();
return
list
;
}
return
list
;
}
/**
* 得到菜单的子菜单
*
* @param menuId
* @return
*/
public
List
<
MenuItem
>
getChildMenu
(
Long
menuId
)
{
MenuItem
root
=
buildMenu
();
List
<
MenuItem
>
list
=
root
.
findChild
(
menuId
).
getChildren
();
return
list
;
}
}
plus-admin/admin-core/src/main/java/com/ibeetl/admin/core/service/CoreRoleService.java
View file @
18144407
...
...
@@ -13,26 +13,20 @@ import com.ibeetl.admin.core.entity.CoreRole;
/**
* 描述: 字典 service,包含常规字典和级联字典的操作。
*
* @author : xiandafu
*/
@Service
@Transactional
public
class
CoreRoleService
extends
CoreBaseService
<
CoreRole
>
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
CoreRoleService
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
CoreRoleService
.
class
);
@Autowired
private
CoreRoleDao
roleDao
;
public
List
<
CoreRole
>
getAllRoles
(
String
type
){
CoreRole
template
=
new
CoreRole
();
template
.
setType
(
type
);
return
roleDao
.
template
(
template
);
}
@Autowired
private
CoreRoleDao
roleDao
;
public
List
<
CoreRole
>
getAllRoles
(
String
type
)
{
CoreRole
template
=
new
CoreRole
();
template
.
setType
(
type
);
return
roleDao
.
template
(
template
);
}
}
plus-admin/admin-core/src/main/java/com/ibeetl/admin/core/service/CoreUserService.java
View file @
18144407
...
...
@@ -21,80 +21,75 @@ import com.ibeetl.admin.core.util.enums.GeneralStateEnum;
@Service
@Transactional
public
class
CoreUserService
{
@Autowired
CoreUserDao
userDao
;
@Autowired
CoreOrgDao
orgDao
;
@Autowired
PasswordEncryptService
passwordEncryptService
;
@Autowired
SQLManager
sqlManager
;
public
UserLoginInfo
login
(
String
userName
,
String
password
){
CoreUser
query
=
new
CoreUser
();
query
.
setCode
(
userName
);
query
.
setPassword
(
passwordEncryptService
.
password
(
password
));
query
.
setState
(
GeneralStateEnum
.
ENABLE
.
getValue
());
CoreUser
user
=
userDao
.
createLambdaQuery
().
andEq
(
CoreUser:
:
getCode
,
userName
).
andEq
(
CoreUser:
:
getPassword
,
passwordEncryptService
.
password
(
password
)).
single
();
if
(
user
==
null
)
{
throw
new
PlatformException
(
"用户"
+
userName
+
"不存在或者密码错误"
);
}
if
(!
user
.
getState
().
equals
(
GeneralStateEnum
.
ENABLE
.
getValue
())){
throw
new
PlatformException
(
"用户"
+
userName
+
"已经失效"
);
}
if
(
user
.
getDelFlag
()==
DelFlagEnum
.
DELETED
.
getValue
())
{
throw
new
PlatformException
(
"用户"
+
userName
+
"已经删除"
);
}
List
<
CoreOrg
>
orgs
=
getUserOrg
(
user
.
getId
(),
user
.
getOrgId
());
UserLoginInfo
loginInfo
=
new
UserLoginInfo
();
loginInfo
.
setOrgs
(
orgs
);
loginInfo
.
setUser
(
user
);
return
loginInfo
;
}
public
List
<
CoreOrg
>
getUserOrg
(
long
userId
,
long
orgId
){
List
<
CoreOrg
>
orgs
=
orgDao
.
queryOrgByUser
(
userId
);
if
(
orgs
.
isEmpty
()){
//没有赋值任何角色,默认给一个所在部门
CoreOrg
userOrg
=
orgDao
.
unique
(
orgId
);
orgs
.
add
(
userOrg
);
}
return
orgs
;
}
public
List
<
CoreUser
>
getAllUsersByRole
(
String
role
){
return
userDao
.
getUserByRole
(
role
);
}
public
CoreUser
getUserByCode
(
String
userName
){
CoreUser
user
=
new
CoreUser
();
user
.
setCode
(
userName
);
return
userDao
.
templateOne
(
user
);
}
public
void
update
(
CoreUser
user
){
userDao
.
updateById
(
user
);
}
public
CoreOrg
getOrgById
(
Long
orgId
){
return
orgDao
.
unique
(
orgId
);
}
public
CoreUser
getUserById
(
Long
userId
){
return
userDao
.
unique
(
userId
);
}
public
List
<
String
>
getOrgCode
(
List
<
Long
>
orgIds
){
return
orgDao
.
queryAllOrgCode
(
orgIds
);
}
@Autowired
CoreUserDao
userDao
;
@Autowired
CoreOrgDao
orgDao
;
@Autowired
PasswordEncryptService
passwordEncryptService
;
@Autowired
SQLManager
sqlManager
;
public
UserLoginInfo
login
(
String
userName
,
String
password
)
{
CoreUser
query
=
new
CoreUser
();
query
.
setCode
(
userName
);
query
.
setPassword
(
passwordEncryptService
.
password
(
password
));
query
.
setState
(
GeneralStateEnum
.
ENABLE
.
getValue
());
CoreUser
user
=
userDao
.
createLambdaQuery
()
.
andEq
(
CoreUser:
:
getCode
,
userName
)
.
andEq
(
CoreUser:
:
getPassword
,
passwordEncryptService
.
password
(
password
))
.
single
();
if
(
user
==
null
)
{
throw
new
PlatformException
(
"用户"
+
userName
+
"不存在或者密码错误"
);
}
if
(!
user
.
getState
().
equals
(
GeneralStateEnum
.
ENABLE
.
getValue
()))
{
throw
new
PlatformException
(
"用户"
+
userName
+
"已经失效"
);
}
if
(
user
.
getDelFlag
()
==
DelFlagEnum
.
DELETED
.
getValue
())
{
throw
new
PlatformException
(
"用户"
+
userName
+
"已经删除"
);
}
List
<
CoreOrg
>
orgs
=
getUserOrg
(
user
.
getId
(),
user
.
getOrgId
());
UserLoginInfo
loginInfo
=
new
UserLoginInfo
();
loginInfo
.
setOrgs
(
orgs
);
loginInfo
.
setUser
(
user
);
return
loginInfo
;
}
public
List
<
CoreOrg
>
getUserOrg
(
long
userId
,
long
orgId
)
{
List
<
CoreOrg
>
orgs
=
orgDao
.
queryOrgByUser
(
userId
);
if
(
orgs
.
isEmpty
())
{
// 没有赋值任何角色,默认给一个所在部门
CoreOrg
userOrg
=
orgDao
.
unique
(
orgId
);
orgs
.
add
(
userOrg
);
}
return
orgs
;
}
public
List
<
CoreUser
>
getAllUsersByRole
(
String
role
)
{
return
userDao
.
getUserByRole
(
role
);
}
public
CoreUser
getUserByCode
(
String
userName
)
{
CoreUser
user
=
new
CoreUser
();
user
.
setCode
(
userName
);
return
userDao
.
templateOne
(
user
);
}
public
void
update
(
CoreUser
user
)
{
userDao
.
updateById
(
user
);
}
public
CoreOrg
getOrgById
(
Long
orgId
)
{
return
orgDao
.
unique
(
orgId
);
}
public
CoreUser
getUserById
(
Long
userId
)
{
return
userDao
.
unique
(
userId
);
}
public
List
<
String
>
getOrgCode
(
List
<
Long
>
orgIds
)
{
return
orgDao
.
queryAllOrgCode
(
orgIds
);
}
}
plus-admin/admin-core/src/main/java/com/ibeetl/admin/core/util/AnnotationUtil.java
View file @
18144407
...
...
@@ -15,41 +15,40 @@ import java.util.Map;
*/
public
class
AnnotationUtil
{
private
AnnotationUtil
()
{
private
AnnotationUtil
()
{}
public
static
AnnotationUtil
getInstance
()
{
return
AnnotationUtilHolder
.
instance
;
}
/**
* 获取一个类注解的名称和值
*
* @param annotationClasss 注解定义类
* @param useAnnotationClass 使用注解的类
* @return List<Map<String, Object>>
* @throws Exception
*/
public
List
<
Map
<
String
,
Object
>>
getAnnotations
(
Class
annotationClasss
,
Class
useAnnotationClass
)
{
List
<
Map
<
String
,
Object
>>
annotationMapList
=
new
ArrayList
<>();
Field
[]
fields
=
useAnnotationClass
.
getDeclaredFields
();
for
(
Field
field
:
fields
)
{
if
(
field
.
isAnnotationPresent
(
annotationClasss
))
{
Annotation
p
=
field
.
getAnnotation
(
annotationClasss
);
Map
map
=
AnnotationUtils
.
getAnnotationAttributes
(
p
);
map
.
put
(
"fieldName"
,
field
.
getName
());
annotationMapList
.
add
(
map
);
}
}
public
static
AnnotationUtil
getInstance
()
{
return
AnnotationUtilHolder
.
instance
;
}
/**
* 获取一个类注解的名称和值
*
* @param annotationClasss 注解定义类
* @param useAnnotationClass 使用注解的类
* @return List<Map<String, Object>>
* @throws Exception
*/
public
List
<
Map
<
String
,
Object
>>
getAnnotations
(
Class
annotationClasss
,
Class
useAnnotationClass
)
{
List
<
Map
<
String
,
Object
>>
annotationMapList
=
new
ArrayList
<>();
Field
[]
fields
=
useAnnotationClass
.
getDeclaredFields
();
for
(
Field
field
:
fields
)
{
if
(
field
.
isAnnotationPresent
(
annotationClasss
))
{
Annotation
p
=
field
.
getAnnotation
(
annotationClasss
);
Map
map
=
AnnotationUtils
.
getAnnotationAttributes
(
p
);
map
.
put
(
"fieldName"
,
field
.
getName
());
annotationMapList
.
add
(
map
);
}
}
return
annotationMapList
;
}
return
annotationMapList
;
}
private
static
class
AnnotationUtilHolder
{
private
static
AnnotationUtil
instance
=
new
AnnotationUtil
();
private
static
class
AnnotationUtilHolder
{
private
static
AnnotationUtil
instance
=
new
AnnotationUtil
();
private
AnnotationUtilHolder
()
{
}
}
private
AnnotationUtilHolder
()
{}
}
}
plus-admin/admin-core/src/main/java/com/ibeetl/admin/core/util/ClassLoaderUtil.java
View file @
18144407
...
...
@@ -6,30 +6,29 @@ import org.slf4j.LoggerFactory;
import
com.ibeetl.admin.core.conf.RbacAnnotationConfig
;
public
class
ClassLoaderUtil
{
private
ClassLoaderUtil
(){
}
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
RbacAnnotationConfig
.
class
);
public
static
Class
loadClass
(
String
clsName
){
Class
cls
=
null
;
try
{
cls
=
ClassLoaderUtil
.
class
.
getClassLoader
().
loadClass
(
clsName
);
}
catch
(
ClassNotFoundException
e
)
{
log
.
info
(
e
.
getMessage
());
ClassLoader
loader
=
Thread
.
currentThread
().
getContextClassLoader
();
try
{
return
loader
.
loadClass
(
clsName
);
}
catch
(
ClassNotFoundException
e1
)
{
log
.
info
(
e1
.
getMessage
());
}
}
if
(
cls
==
null
){
log
.
error
(
"params:{},message:{}"
,
clsName
,
"无法加载类"
);
throw
new
IllegalArgumentException
(
"不能加载"
+
clsName
);
}
return
cls
;
}
private
ClassLoaderUtil
()
{}
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
RbacAnnotationConfig
.
class
);
public
static
Class
loadClass
(
String
clsName
)
{
Class
cls
=
null
;
try
{
cls
=
ClassLoaderUtil
.
class
.
getClassLoader
().
loadClass
(
clsName
);
}
catch
(
ClassNotFoundException
e
)
{
log
.
info
(
e
.
getMessage
());
ClassLoader
loader
=
Thread
.
currentThread
().
getContextClassLoader
();
try
{
return
loader
.
loadClass
(
clsName
);
}
catch
(
ClassNotFoundException
e1
)
{
log
.
info
(
e1
.
getMessage
());
}
}
if
(
cls
==
null
)
{
log
.
error
(
"params:{},message:{}"
,
clsName
,
"无法加载类"
);
throw
new
IllegalArgumentException
(
"不能加载"
+
clsName
);
}
return
cls
;
}
}
plus-admin/admin-core/src/main/java/com/ibeetl/admin/core/util/ConvertUtil.java
View file @
18144407
...
...
@@ -6,30 +6,30 @@ import java.util.List;
/**
* 数据格式转化类
* @author xiandafu
*
* @author xiandafu
*/
public
class
ConvertUtil
{
/**
* 转化逗号分隔的id到long数组,通常用于批量操作
* @param str
* @
return
*/
public
static
List
<
Long
>
str2longs
(
String
str
){
if
(
str
.
length
()==
0
)
{
return
Collections
.
EMPTY_LIST
;
}
String
[]
array
=
str
.
split
(
","
);
List
<
Long
>
rets
=
new
ArrayList
(
array
.
length
);
int
i
=
0
;
for
(
Str
in
g
i
d:
array
){
try
{
rets
.
add
(
Long
.
parseLong
(
id
));
}
catch
(
Exception
ex
){
throw
new
RuntimeException
(
"转化 "
+
str
+
" 到Long数组出错"
);
}
}
return
rets
;
}
/**
* 转化逗号分隔的id到long数组,通常用于批量操作
*
* @
param str
* @return
*/
public
static
List
<
Long
>
str2longs
(
String
str
)
{
if
(
str
.
length
()
==
0
)
{
return
Collections
.
EMPTY_LIST
;
}
String
[]
array
=
str
.
split
(
","
);
List
<
Long
>
rets
=
new
ArrayList
(
array
.
length
)
;
in
t
i
=
0
;
for
(
String
id
:
array
)
{
try
{
rets
.
add
(
Long
.
parseLong
(
id
));
}
catch
(
Exception
ex
)
{
throw
new
RuntimeException
(
"转化 "
+
str
+
" 到Long数组出错"
);
}
}
return
rets
;
}
}
plus-admin/admin-core/src/main/java/com/ibeetl/admin/core/util/DateUtil.java
View file @
18144407
...
...
@@ -5,27 +5,25 @@ import java.text.SimpleDateFormat;
import
java.util.Date
;
public
class
DateUtil
{
public
static
Date
MAX_DATE
=
maxDate
();
public
static
String
now
()
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
return
sdf
.
format
(
new
Date
());
}
public
static
String
now
(
String
format
)
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
format
);
return
sdf
.
format
(
new
Date
());
}
private
static
Date
maxDate
()
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
try
{
return
sdf
.
parse
(
"9999-12-31 23:59:59"
);
}
catch
(
ParseException
e
)
{
throw
new
RuntimeException
(
e
);
}
public
static
Date
MAX_DATE
=
maxDate
();
public
static
String
now
()
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
return
sdf
.
format
(
new
Date
());
}
public
static
String
now
(
String
format
)
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
format
);
return
sdf
.
format
(
new
Date
());
}
private
static
Date
maxDate
()
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
try
{
return
sdf
.
parse
(
"9999-12-31 23:59:59"
);
}
catch
(
ParseException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
}
plus-admin/admin-core/src/main/java/com/ibeetl/admin/core/util/ExcelError.java
View file @
18144407
package
com.ibeetl.admin.core.util
;
public
class
ExcelError
{
String
cell
;
String
msg
;
public
String
getCell
()
{
return
cell
;
}
public
void
setCell
(
String
cell
)
{
this
.
cell
=
cell
;
}
public
String
getMsg
()
{
return
msg
;
}
public
void
setMsg
(
String
msg
)
{
this
.
msg
=
msg
;
}
String
cell
;
String
msg
;
public
String
getCell
()
{
return
cell
;
}
public
void
setCell
(
String
cell
)
{
this
.
cell
=
cell
;
}
public
String
getMsg
()
{
return
msg
;
}
public
void
setMsg
(
String
msg
)
{
this
.
msg
=
msg
;
}
}
plus-admin/admin-core/src/main/java/com/ibeetl/admin/core/util/FileDownloadUtil.java
View file @
18144407
...
...
@@ -6,9 +6,10 @@ import java.io.OutputStream;
import
javax.servlet.http.HttpServletResponse
;
public
class
FileDownloadUtil
{
public
static
OutputStream
getDownLoad
(
HttpServletResponse
response
,
String
fileName
)
throws
IOException
{
response
.
setContentType
(
"text/html; charset = UTF-8"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment; filename="
+
fileName
);
return
response
.
getOutputStream
();
}
public
static
OutputStream
getDownLoad
(
HttpServletResponse
response
,
String
fileName
)
throws
IOException
{
response
.
setContentType
(
"text/html; charset = UTF-8"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment; filename="
+
fileName
);
return
response
.
getOutputStream
();
}
}
plus-admin/admin-core/src/main/java/com/ibeetl/admin/core/util/FileUtil.java
View file @
18144407
...
...
@@ -6,26 +6,24 @@ import java.io.InputStream;
import
java.io.OutputStream
;
public
class
FileUtil
{
public
static
void
copy
(
InputStream
input
,
OutputStream
os
)
{
try
{
byte
[]
buf
=
new
byte
[
1024
];
int
bytesRead
;
while
((
bytesRead
=
input
.
read
(
buf
))
>
0
)
{
os
.
write
(
buf
,
0
,
bytesRead
);
}
}
catch
(
Exception
ex
)
{
throw
new
PlatformException
(
"文件复制出错"
+
ex
);
}
finally
{
try
{
input
.
close
();
os
.
close
();
}
catch
(
IOException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
}
public
static
void
copy
(
InputStream
input
,
OutputStream
os
)
{
try
{
byte
[]
buf
=
new
byte
[
1024
];
int
bytesRead
;
while
((
bytesRead
=
input
.
read
(
buf
))
>
0
)
{
os
.
write
(
buf
,
0
,
bytesRead
);
}
}
catch
(
Exception
ex
)
{
throw
new
PlatformException
(
"文件复制出错"
+
ex
);
}
finally
{
try
{
input
.
close
();
os
.
close
();
}
catch
(
IOException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
}
}
}
plus-admin/admin-core/src/main/java/com/ibeetl/admin/core/util/FormFieldException.java
View file @
18144407
...
...
@@ -6,27 +6,23 @@ import java.util.List;
import
org.springframework.validation.FieldError
;
public
class
FormFieldException
extends
PlatformException
{
List
<
FieldError
>
errors
=
new
ArrayList
<
FieldError
>();
public
FormFieldException
()
{
super
();
}
List
<
FieldError
>
errors
=
new
ArrayList
<
FieldError
>();
public
FormFieldException
()
{
super
();
}
public
FormFieldException
(
String
objectName
,
String
field
,
String
error
)
{
super
(
"field "
+
field
+
" "
+
error
);
FieldError
fields
=
new
FieldError
(
objectName
,
field
,
error
);
errors
.
add
(
fields
);
}
public
FormFieldException
(
String
objectName
,
String
field
,
String
error
)
{
super
(
"field "
+
field
+
" "
+
error
);
FieldError
fields
=
new
FieldError
(
objectName
,
field
,
error
);
errors
.
add
(
fields
);
}
public
List
<
FieldError
>
getErrors
()
{
return
errors
;
}
public
List
<
FieldError
>
getErrors
()
{
return
errors
;
}
public
void
setErrors
(
List
<
FieldError
>
errors
)
{
this
.
errors
=
errors
;
}
public
void
setErrors
(
List
<
FieldError
>
errors
)
{
this
.
errors
=
errors
;
}
}
plus-admin/admin-core/src/main/java/com/ibeetl/admin/core/util/FunctionBuildUtil.java
View file @
18144407
...
...
@@ -8,41 +8,39 @@ import com.ibeetl.admin.core.rbac.tree.FunctionItem;
/**
* 创建一个功能树,用于前端选择
* @author xiandafu
*
* @author xiandafu
*/
public
class
FunctionBuildUtil
{
private
FunctionBuildUtil
(){
}
public
static
FunctionItem
buildOrgTree
(
List
<
CoreFunction
>
list
){
CoreFunction
root
=
new
CoreFunction
();
root
.
setId
(
0L
);
FunctionItem
rootOrg
=
new
FunctionItem
(
root
);
buildTreeNode
(
rootOrg
,
list
);
return
rootOrg
;
}
private
static
void
buildTreeNode
(
FunctionItem
parent
,
List
<
CoreFunction
>
list
){
long
id
=
parent
.
getId
();
List
<
CoreFunction
>
dels
=
new
ArrayList
<>();
for
(
CoreFunction
SysFunction:
list
){
if
(
SysFunction
.
getParentId
()!=
null
&&
SysFunction
.
getParentId
()==
id
){
FunctionItem
item
=
new
FunctionItem
(
SysFunction
);
item
.
setParent
(
parent
);
dels
.
add
(
SysFunction
);
}
}
list
.
removeAll
(
dels
);
if
(
list
.
isEmpty
()){
return
;
}
for
(
FunctionItem
child:
parent
.
getChildren
()){
buildTreeNode
(
child
,
list
);
}
}
private
FunctionBuildUtil
()
{}
public
static
FunctionItem
buildOrgTree
(
List
<
CoreFunction
>
list
)
{
CoreFunction
root
=
new
CoreFunction
();
root
.
setId
(
0L
);
FunctionItem
rootOrg
=
new
FunctionItem
(
root
);
buildTreeNode
(
rootOrg
,
list
);
return
rootOrg
;
}
private
static
void
buildTreeNode
(
FunctionItem
parent
,
List
<
CoreFunction
>
list
)
{
long
id
=
parent
.
getId
();
List
<
CoreFunction
>
dels
=
new
ArrayList
<>();
for
(
CoreFunction
SysFunction
:
list
)
{
if
(
SysFunction
.
getParentId
()
!=
null
&&
SysFunction
.
getParentId
()
==
id
)
{
FunctionItem
item
=
new
FunctionItem
(
SysFunction
);
item
.
setParent
(
parent
);
dels
.
add
(
SysFunction
);
}
}
list
.
removeAll
(
dels
);
if
(
list
.
isEmpty
())
{
return
;
}
for
(
FunctionItem
child
:
parent
.
getChildren
())
{
buildTreeNode
(
child
,
list
);
}
}
}
plus-admin/admin-core/src/main/java/com/ibeetl/admin/core/util/FunctionLocal.java
View file @
18144407
...
...
@@ -3,31 +3,27 @@ package com.ibeetl.admin.core.util;
import
javax.servlet.http.HttpSession
;
/**
* 用户Controller对应的功能
* {@link MVCConf}
* @author lijiazhi
* 用户Controller对应的功能 {@link MVCConf}
*
* @author lijiazhi
*/
public
class
FunctionLocal
{
private
FunctionLocal
(){
}
private
static
final
ThreadLocal
<
String
>
sessions
=
new
ThreadLocal
<
String
>()
{
@Override
protected
String
initialValue
()
{
return
null
;
}
};
public
static
String
get
(){
return
sessions
.
get
();
}
public
static
void
set
(
String
session
){
sessions
.
set
(
session
);
}
private
FunctionLocal
()
{}
private
static
final
ThreadLocal
<
String
>
sessions
=
new
ThreadLocal
<
String
>()
{
@Override
protected
String
initialValue
()
{
return
null
;
}
};
public
static
String
get
()
{
return
sessions
.
get
();
}
public
static
void
set
(
String
session
)
{
sessions
.
set
(
session
);
}
}
plus-admin/admin-core/src/main/java/com/ibeetl/admin/core/util/HttpRequestLocal.java
View file @
18144407
...
...
@@ -10,83 +10,80 @@ import org.springframework.stereotype.Component;
import
com.ibeetl.admin.core.conf.MVCConf
;
/**
* 保留用户会话,以方便在业务代码任何地方调用
* {@link MVCConf}
* @author lijiazhi
* 保留用户会话,以方便在业务代码任何地方调用 {@link MVCConf}
*
* @author lijiazhi
*/
@Component
public
class
HttpRequestLocal
{
public
HttpRequestLocal
(){
}
private
static
final
ThreadLocal
<
HttpServletRequest
>
requests
=
new
ThreadLocal
<
HttpServletRequest
>()
{
@Override
protected
HttpServletRequest
initialValue
()
{
return
null
;
}
};
public
Object
getSessionValue
(
String
attr
){
return
requests
.
get
().
getSession
().
getAttribute
(
attr
);
}
public
void
setSessionValue
(
String
attr
,
Object
obj
){
requests
.
get
().
getSession
().
setAttribute
(
attr
,
obj
);
}
public
Object
getRequestValue
(
String
attr
){
return
requests
.
get
().
getAttribute
(
attr
);
}
public
String
getRequestURI
(){
return
requests
.
get
().
getRequestURI
();
}
public
String
getRequestIP
(){
return
getIpAddr
(
requests
.
get
());
}
public
void
set
(
HttpServletRequest
request
){
requests
.
set
(
request
);
}
/**
* 获取当前网络ip
* @param request
* @return
*/
public
String
getIpAddr
(
HttpServletRequest
request
){
String
ipAddress
=
request
.
getHeader
(
"x-forwarded-for"
);
if
(
ipAddress
==
null
||
ipAddress
.
length
()
==
0
||
"unknown"
.
equalsIgnoreCase
(
ipAddress
))
{
ipAddress
=
request
.
getHeader
(
"Proxy-Client-IP"
);
}
if
(
ipAddress
==
null
||
ipAddress
.
length
()
==
0
||
"unknown"
.
equalsIgnoreCase
(
ipAddress
))
{
ipAddress
=
request
.
getHeader
(
"WL-Proxy-Client-IP"
);
}
if
(
ipAddress
==
null
||
ipAddress
.
length
()
==
0
||
"unknown"
.
equalsIgnoreCase
(
ipAddress
))
{
ipAddress
=
request
.
getRemoteAddr
();
if
(
ipAddress
.
equals
(
"127.0.0.1"
)
||
ipAddress
.
equals
(
"0:0:0:0:0:0:0:1"
)){
//根据网卡取本机配置的IP
InetAddress
inet
=
null
;
try
{
inet
=
InetAddress
.
getLocalHost
();
}
catch
(
UnknownHostException
e
)
{
e
.
printStackTrace
();
}
ipAddress
=
inet
.
getHostAddress
();
}
}
//对于通过多个代理的情况,第一个IP为客户端真实IP,多个IP按照','分割
if
(
ipAddress
!=
null
&&
ipAddress
.
length
()>
15
){
//"***.***.***.***".length() = 15
if
(
ipAddress
.
indexOf
(
","
)>
0
){
ipAddress
=
ipAddress
.
substring
(
0
,
ipAddress
.
indexOf
(
","
));
}
}
return
ipAddress
;
}
public
HttpRequestLocal
()
{}
private
static
final
ThreadLocal
<
HttpServletRequest
>
requests
=
new
ThreadLocal
<
HttpServletRequest
>()
{
@Override
protected
HttpServletRequest
initialValue
()
{
return
null
;
}
};
public
Object
getSessionValue
(
String
attr
)
{
return
requests
.
get
().
getSession
().
getAttribute
(
attr
);
}
public
void
setSessionValue
(
String
attr
,
Object
obj
)
{
requests
.
get
().
getSession
().
setAttribute
(
attr
,
obj
);
}
public
Object
getRequestValue
(
String
attr
)
{
return
requests
.
get
().
getAttribute
(
attr
);
}
public
String
getRequestURI
()
{
return
requests
.
get
().
getRequestURI
();
}
public
String
getRequestIP
()
{
return
getIpAddr
(
requests
.
get
());
}
public
void
set
(
HttpServletRequest
request
)
{
requests
.
set
(
request
);
}
/**
* 获取当前网络ip
*
* @param request
* @return
*/
public
String
getIpAddr
(
HttpServletRequest
request
)
{
String
ipAddress
=
request
.
getHeader
(
"x-forwarded-for"
);
if
(
ipAddress
==
null
||
ipAddress
.
length
()
==
0
||
"unknown"
.
equalsIgnoreCase
(
ipAddress
))
{
ipAddress
=
request
.
getHeader
(
"Proxy-Client-IP"
);
}
if
(
ipAddress
==
null
||
ipAddress
.
length
()
==
0
||
"unknown"
.
equalsIgnoreCase
(
ipAddress
))
{
ipAddress
=
request
.
getHeader
(
"WL-Proxy-Client-IP"
);
}
if
(
ipAddress
==
null
||
ipAddress
.
length
()
==
0
||
"unknown"
.
equalsIgnoreCase
(
ipAddress
))
{
ipAddress
=
request
.
getRemoteAddr
();
if
(
ipAddress
.
equals
(
"127.0.0.1"
)
||
ipAddress
.
equals
(
"0:0:0:0:0:0:0:1"
))
{
// 根据网卡取本机配置的IP
InetAddress
inet
=
null
;
try
{
inet
=
InetAddress
.
getLocalHost
();
}
catch
(
UnknownHostException
e
)
{
e
.
printStackTrace
();
}
ipAddress
=
inet
.
getHostAddress
();
}
}
// 对于通过多个代理的情况,第一个IP为客户端真实IP,多个IP按照','分割
if
(
ipAddress
!=
null
&&
ipAddress
.
length
()
>
15
)
{
// "***.***.***.***".length() = 15
if
(
ipAddress
.
indexOf
(
","
)
>
0
)
{
ipAddress
=
ipAddress
.
substring
(
0
,
ipAddress
.
indexOf
(
","
));
}
}
return
ipAddress
;
}
}
plus-admin/admin-core/src/main/java/com/ibeetl/admin/core/util/MenuBuildUtil.java
View file @
18144407
...
...
@@ -9,60 +9,55 @@ import com.ibeetl.admin.core.entity.CoreMenu;
import
com.ibeetl.admin.core.rbac.tree.MenuItem
;
public
class
MenuBuildUtil
{
private
MenuBuildUtil
()
{
private
MenuBuildUtil
()
{}
public
static
MenuItem
buildMenuTree
(
List
<
CoreMenu
>
list
)
{
CoreMenu
root
=
new
CoreMenu
();
root
.
setId
(
0L
);
root
.
setType
(
""
);
root
.
setName
(
"主菜单"
);
MenuItem
rootMenu
=
new
MenuItem
(
root
);
buildTreeNode
(
rootMenu
,
list
);
return
rootMenu
;
}
private
static
void
buildTreeNode
(
MenuItem
parent
,
List
<
CoreMenu
>
list
)
{
if
(
parent
.
getData
().
getType
().
equals
(
CoreMenu
.
TYPE_MENUITEM
))
{
return
;
}
public
static
MenuItem
buildMenuTree
(
List
<
CoreMenu
>
list
)
{
CoreMenu
root
=
new
CoreMenu
();
root
.
setId
(
0L
);
root
.
setType
(
""
);
root
.
setName
(
"主菜单"
);
MenuItem
rootMenu
=
new
MenuItem
(
roo
t
);
buildTreeNode
(
rootMenu
,
list
);
return
rootMenu
;
long
id
=
parent
.
getId
();
List
<
CoreMenu
>
dels
=
new
ArrayList
<>
();
for
(
CoreMenu
sysMenu
:
list
)
{
if
(
sysMenu
.
getParentMenuId
()
==
id
)
{
MenuItem
item
=
new
MenuItem
(
sysMenu
);
item
.
setParent
(
paren
t
);
dels
.
add
(
sysMenu
);
}
}
list
.
removeAll
(
dels
);
private
static
void
buildTreeNode
(
MenuItem
parent
,
List
<
CoreMenu
>
list
)
{
if
(
parent
.
getData
().
getType
().
equals
(
CoreMenu
.
TYPE_MENUITEM
))
{
return
;
}
long
id
=
parent
.
getId
();
List
<
CoreMenu
>
dels
=
new
ArrayList
<>();
for
(
CoreMenu
sysMenu
:
list
)
{
if
(
sysMenu
.
getParentMenuId
()
==
id
)
{
MenuItem
item
=
new
MenuItem
(
sysMenu
);
item
.
setParent
(
parent
);
dels
.
add
(
sysMenu
);
}
}
list
.
removeAll
(
dels
);
if
(
list
.
isEmpty
())
{
return
;
}
sortMenu
(
parent
.
getChildren
());
for
(
MenuItem
child
:
parent
.
getChildren
())
{
buildTreeNode
(
child
,
list
);
}
if
(
list
.
isEmpty
())
{
return
;
}
private
static
void
sortMenu
(
List
<
MenuItem
>
children
)
{
Collections
.
sort
(
children
,
new
Comparator
<
MenuItem
>()
{
@Override
public
int
compare
(
MenuItem
o1
,
MenuItem
o2
)
{
return
o1
.
getSeq
().
compareTo
(
o2
.
getSeq
());
}
});
}
sortMenu
(
parent
.
getChildren
());
for
(
MenuItem
child
:
parent
.
getChildren
())
{
buildTreeNode
(
child
,
list
);
}
}
private
static
void
sortMenu
(
List
<
MenuItem
>
children
)
{
Collections
.
sort
(
children
,
new
Comparator
<
MenuItem
>()
{
@Override
public
int
compare
(
MenuItem
o1
,
MenuItem
o2
)
{
return
o1
.
getSeq
().
compareTo
(
o2
.
getSeq
());
}
});
}
}
plus-admin/admin-core/src/main/java/com/ibeetl/admin/core/util/OrgBuildUtil.java
View file @
18144407
...
...
@@ -7,32 +7,26 @@ import com.ibeetl.admin.core.entity.CoreOrg;
import
com.ibeetl.admin.core.rbac.tree.OrgItem
;
public
class
OrgBuildUtil
{
private
OrgBuildUtil
(){
}
public
static
void
buildTreeNode
(
OrgItem
parent
,
List
<
CoreOrg
>
list
){
long
id
=
parent
.
getId
();
List
<
CoreOrg
>
dels
=
new
ArrayList
<>();
for
(
CoreOrg
sysOrg:
list
){
if
(
sysOrg
.
getParentOrgId
()!=
null
&&
sysOrg
.
getParentOrgId
()==
id
){
OrgItem
item
=
new
OrgItem
(
sysOrg
);
item
.
setParent
(
parent
);
dels
.
add
(
sysOrg
);
}
}
list
.
removeAll
(
dels
);
if
(
list
.
isEmpty
()){
return
;
}
for
(
OrgItem
child:
parent
.
getChildren
()){
buildTreeNode
(
child
,
list
);
}
}
private
OrgBuildUtil
()
{}
public
static
void
buildTreeNode
(
OrgItem
parent
,
List
<
CoreOrg
>
list
)
{
long
id
=
parent
.
getId
();
List
<
CoreOrg
>
dels
=
new
ArrayList
<>();
for
(
CoreOrg
sysOrg
:
list
)
{
if
(
sysOrg
.
getParentOrgId
()
!=
null
&&
sysOrg
.
getParentOrgId
()
==
id
)
{
OrgItem
item
=
new
OrgItem
(
sysOrg
);
item
.
setParent
(
parent
);
dels
.
add
(
sysOrg
);
}
}
list
.
removeAll
(
dels
);
if
(
list
.
isEmpty
())
{
return
;
}
for
(
OrgItem
child
:
parent
.
getChildren
())
{
buildTreeNode
(
child
,
list
);
}
}
}
plus-admin/admin-core/src/main/java/com/ibeetl/admin/core/util/PlatformException.java
View file @
18144407
package
com.ibeetl.admin.core.util
;
public
class
PlatformException
extends
RuntimeException
{
public
PlatformException
()
{
super
();
}
public
PlatformException
()
{
super
();
}
public
PlatformException
(
String
message
)
{
super
(
message
);
}
public
PlatformException
(
String
message
)
{
super
(
message
);
}
public
PlatformException
(
String
message
,
Throwable
e
){
super
(
message
,
e
);
}
public
PlatformException
(
String
message
,
Throwable
e
)
{
super
(
message
,
e
);
}
}
plus-admin/admin-core/src/main/java/com/ibeetl/admin/core/util/Tool.java
View file @
18144407
...
...
@@ -7,41 +7,40 @@ import java.util.Date;
/**
* 常用工具类方法
*
* @author lijiazhi
*
* @author lijiazhi
*/
public
class
Tool
{
static
final
String
DATE_FORAMT
=
"yyyy-MM-dd"
;
static
final
String
DATETIME_FORAMT
=
"yyyy-MM-dd HH:mm:ss"
;
public
static
Date
[]
parseDataRange
(
String
str
)
{
//查询范围
String
[]
arrays
=
str
.
split
(
"至"
);
Date
min
=
parseDate
(
arrays
[
0
]);
Date
max
=
parseDate
(
arrays
[
1
]);
return
new
Date
[]
{
min
,
max
};
}
public
static
Date
[]
parseDataTimeRange
(
String
str
)
{
//查询范围
String
[]
arrays
=
str
.
split
(
"至"
);
Date
min
=
parseDateWithPattern
(
arrays
[
0
],
DATETIME_FORAMT
);
Date
max
=
parseDateWithPattern
(
arrays
[
1
],
DATETIME_FORAMT
);
return
new
Date
[]
{
min
,
max
};
}
public
static
Date
parseDate
(
String
str
)
{
return
parseDateWithPattern
(
str
,
DATE_FORAMT
);
}
public
static
Date
parseDateWithPattern
(
String
str
,
String
pattern
)
{
try
{
return
DateUtils
.
parseDate
(
str
.
trim
(),
pattern
);
}
catch
(
ParseException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
static
final
String
DATE_FORAMT
=
"yyyy-MM-dd"
;
static
final
String
DATETIME_FORAMT
=
"yyyy-MM-dd HH:mm:ss"
;
public
static
Date
[]
parseDataRange
(
String
str
)
{
//
查询范围
String
[]
arrays
=
str
.
split
(
"至"
);
Date
min
=
parseDate
(
arrays
[
0
]);
Date
max
=
parseDate
(
arrays
[
1
]);
return
new
Date
[]
{
min
,
max
};
}
public
static
Date
[]
parseDataTimeRange
(
String
str
)
{
//
查询范围
String
[]
arrays
=
str
.
split
(
"至"
);
Date
min
=
parseDateWithPattern
(
arrays
[
0
],
DATETIME_FORAMT
);
Date
max
=
parseDateWithPattern
(
arrays
[
1
],
DATETIME_FORAMT
);
return
new
Date
[]
{
min
,
max
};
}
public
static
Date
parseDate
(
String
str
)
{
return
parseDateWithPattern
(
str
,
DATE_FORAMT
);
}
public
static
Date
parseDateWithPattern
(
String
str
,
String
pattern
)
{
try
{
return
DateUtils
.
parseDate
(
str
.
trim
(),
pattern
);
}
catch
(
ParseException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
}
plus-admin/admin-core/src/main/java/com/ibeetl/admin/core/util/UUIDUtil.java
View file @
18144407
...
...
@@ -3,10 +3,9 @@ package com.ibeetl.admin.core.util;
import
java.util.UUID
;
public
class
UUIDUtil
{
public
static
String
uuid
()
{
UUID
uuid
=
UUID
.
randomUUID
();
String
randomUUIDString
=
uuid
.
toString
();
return
randomUUIDString
;
}
public
static
String
uuid
()
{
UUID
uuid
=
UUID
.
randomUUID
();
String
randomUUIDString
=
uuid
.
toString
();
return
randomUUIDString
;
}
}
Prev
1
…
3
4
5
6
7
8
9
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment