Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
one-certificate-system
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
one-certificate-system
Commits
ee628cb0
Commit
ee628cb0
authored
Jul 27, 2024
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改登录等资源权限
parent
9a50bbd9
Changes
37
Hide whitespace changes
Inline
Side-by-side
Showing
37 changed files
with
1330 additions
and
1545 deletions
+1330
-1545
one-certificate-manager/pom.xml
one-certificate-manager/pom.xml
+0
-1
one-certificate-manager/src/main/java/com/mortals/xhx/base/framework/interceptor/AuthTokenServiceImpl.java
.../xhx/base/framework/interceptor/AuthTokenServiceImpl.java
+55
-13
one-certificate-manager/src/main/java/com/mortals/xhx/base/framework/interceptor/AuthUserInterceptor.java
...s/xhx/base/framework/interceptor/AuthUserInterceptor.java
+5
-3
one-certificate-manager/src/main/java/com/mortals/xhx/base/login/web/LoginController.java
.../java/com/mortals/xhx/base/login/web/LoginController.java
+86
-148
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/resource/dao/ResourceDao.java
...com/mortals/xhx/base/system/resource/dao/ResourceDao.java
+1
-1
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/resource/dao/ibatis/ResourceDaoImpl.java
.../xhx/base/system/resource/dao/ibatis/ResourceDaoImpl.java
+0
-1
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/resource/model/ResourceEntity.java
...ortals/xhx/base/system/resource/model/ResourceEntity.java
+2
-2
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/resource/service/ResourceService.java
...als/xhx/base/system/resource/service/ResourceService.java
+10
-4
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/resource/service/impl/ResourceServiceImpl.java
...ase/system/resource/service/impl/ResourceServiceImpl.java
+136
-14
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/resource/web/ResourceController.java
...tals/xhx/base/system/resource/web/ResourceController.java
+70
-44
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/resource/web/ResourceForm.java
...om/mortals/xhx/base/system/resource/web/ResourceForm.java
+0
-47
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/role/dao/ibatis/RoleAuthDaoImpl.java
...tals/xhx/base/system/role/dao/ibatis/RoleAuthDaoImpl.java
+0
-1
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/role/dao/ibatis/RoleDaoImpl.java
.../mortals/xhx/base/system/role/dao/ibatis/RoleDaoImpl.java
+0
-1
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/role/dao/ibatis/RoleUserDaoImpl.java
...tals/xhx/base/system/role/dao/ibatis/RoleUserDaoImpl.java
+0
-1
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/role/model/RoleEntity.java
...va/com/mortals/xhx/base/system/role/model/RoleEntity.java
+2
-2
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/role/service/impl/RoleAuthServiceImpl.java
...hx/base/system/role/service/impl/RoleAuthServiceImpl.java
+35
-14
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/role/service/impl/RoleServiceImpl.java
...ls/xhx/base/system/role/service/impl/RoleServiceImpl.java
+0
-1
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/role/service/impl/RoleUserServiceImpl.java
...hx/base/system/role/service/impl/RoleUserServiceImpl.java
+38
-13
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/role/web/RoleAuthController.java
.../mortals/xhx/base/system/role/web/RoleAuthController.java
+2
-8
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/role/web/RoleAuthForm.java
...va/com/mortals/xhx/base/system/role/web/RoleAuthForm.java
+0
-47
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/role/web/RoleController.java
.../com/mortals/xhx/base/system/role/web/RoleController.java
+5
-8
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/role/web/RoleForm.java
...n/java/com/mortals/xhx/base/system/role/web/RoleForm.java
+0
-58
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/role/web/RoleUserController.java
.../mortals/xhx/base/system/role/web/RoleUserController.java
+7
-12
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/role/web/RoleUserForm.java
...va/com/mortals/xhx/base/system/role/web/RoleUserForm.java
+0
-47
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/upload/service/impl/UploadServiceImpl.java
...hx/base/system/upload/service/impl/UploadServiceImpl.java
+7
-7
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/user/dao/ibatis/UserDaoImpl.java
.../mortals/xhx/base/system/user/dao/ibatis/UserDaoImpl.java
+2
-3
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/user/model/UserEntity.java
...va/com/mortals/xhx/base/system/user/model/UserEntity.java
+143
-302
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/user/model/UserEntityExt.java
...com/mortals/xhx/base/system/user/model/UserEntityExt.java
+0
-39
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/user/model/UserQuery.java
...ava/com/mortals/xhx/base/system/user/model/UserQuery.java
+105
-501
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/user/model/vo/UserVo.java
...ava/com/mortals/xhx/base/system/user/model/vo/UserVo.java
+0
-7
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/user/service/UserService.java
...com/mortals/xhx/base/system/user/service/UserService.java
+25
-17
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/user/service/impl/UserServiceImpl.java
...ls/xhx/base/system/user/service/impl/UserServiceImpl.java
+136
-75
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/user/web/UserController.java
.../com/mortals/xhx/base/system/user/web/UserController.java
+89
-53
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/user/web/UserForm.java
...n/java/com/mortals/xhx/base/system/user/web/UserForm.java
+0
-46
one-certificate-manager/src/main/java/com/mortals/xhx/common/key/RedisKey.java
...er/src/main/java/com/mortals/xhx/common/key/RedisKey.java
+1
-4
one-certificate-manager/src/main/java/com/mortals/xhx/common/utils/ControllerScanUtil.java
...java/com/mortals/xhx/common/utils/ControllerScanUtil.java
+338
-0
one-certificate-manager/src/main/java/com/mortals/xhx/common/utils/MenuEncodeUtil.java
...ain/java/com/mortals/xhx/common/utils/MenuEncodeUtil.java
+30
-0
No files found.
one-certificate-manager/pom.xml
View file @
ee628cb0
...
@@ -40,7 +40,6 @@
...
@@ -40,7 +40,6 @@
</profile>
</profile>
<profile>
<profile>
<id>
test
</id>
<id>
test
</id>
<properties>
<properties>
<profiles.active>
test
</profiles.active>
<profiles.active>
test
</profiles.active>
<profiles.server.debug>
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=15505
</profiles.server.debug>
<profiles.server.debug>
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=15505
</profiles.server.debug>
...
...
one-certificate-manager/src/main/java/com/mortals/xhx/base/framework/interceptor/AuthTokenServiceImpl.java
View file @
ee628cb0
...
@@ -7,31 +7,42 @@ import com.mortals.framework.service.ICacheService;
...
@@ -7,31 +7,42 @@ import com.mortals.framework.service.ICacheService;
import
com.mortals.framework.service.IUser
;
import
com.mortals.framework.service.IUser
;
import
com.mortals.framework.util.DateUtils
;
import
com.mortals.framework.util.DateUtils
;
import
com.mortals.framework.util.StringUtils
;
import
com.mortals.framework.util.StringUtils
;
import
com.mortals.xhx.base.system.resource.service.ResourceService
;
import
com.mortals.xhx.base.system.user.model.UserEntity
;
import
com.mortals.xhx.base.system.user.model.UserEntity
;
import
com.mortals.xhx.base.system.user.service.UserService
;
import
com.mortals.xhx.common.key.RedisKey
;
import
com.mortals.xhx.common.utils.MenuEncodeUtil
;
import
io.jsonwebtoken.Claims
;
import
io.jsonwebtoken.Claims
;
import
io.jsonwebtoken.Jwts
;
import
io.jsonwebtoken.Jwts
;
import
io.jsonwebtoken.SignatureAlgorithm
;
import
io.jsonwebtoken.SignatureAlgorithm
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Primary
;
import
org.springframework.core.annotation.Order
;
import
org.springframework.core.annotation.Order
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.Base64
;
import
java.util.Base64
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Set
;
/**
/**
* token验证处理
* token验证处理
*
*
* @author zxfei
* @author zxfei
*/
*/
@Primary
@Service
@Service
@Order
(
1
)
@Order
(
1
)
@Slf4j
@Slf4j
public
class
AuthTokenServiceImpl
implements
IAuthTokenService
{
public
class
AuthTokenServiceImpl
implements
IAuthTokenService
{
@Autowired
private
UserService
userService
;
// 令牌自定义标识
// 令牌自定义标识
@Value
(
"${token.header:Authorization}"
)
@Value
(
"${token.header:Authorization}"
)
private
String
header
;
private
String
header
;
...
@@ -54,9 +65,6 @@ public class AuthTokenServiceImpl implements IAuthTokenService {
...
@@ -54,9 +65,6 @@ public class AuthTokenServiceImpl implements IAuthTokenService {
@Value
(
"${token.database:0}"
)
@Value
(
"${token.database:0}"
)
private
Integer
portalDb
;
private
Integer
portalDb
;
@Value
(
"${platform.type:cloud}"
)
private
String
platFormType
;
//版本,默认云服务版本
protected
static
final
Long
SECOND
=
1
l
;
protected
static
final
Long
SECOND
=
1
l
;
protected
static
final
Long
SECOND_MINUTE
=
60
*
SECOND
;
protected
static
final
Long
SECOND_MINUTE
=
60
*
SECOND
;
...
@@ -72,6 +80,10 @@ public class AuthTokenServiceImpl implements IAuthTokenService {
...
@@ -72,6 +80,10 @@ public class AuthTokenServiceImpl implements IAuthTokenService {
@Autowired
@Autowired
private
ICacheService
cacheService
;
private
ICacheService
cacheService
;
@Autowired
private
ResourceService
resourceService
;
/**
/**
* 获取信息
* 获取信息
*
*
...
@@ -84,19 +96,42 @@ public class AuthTokenServiceImpl implements IAuthTokenService {
...
@@ -84,19 +96,42 @@ public class AuthTokenServiceImpl implements IAuthTokenService {
String
token
=
getToken
(
request
);
String
token
=
getToken
(
request
);
if
(
StringUtils
.
isNotEmpty
(
token
))
{
if
(
StringUtils
.
isNotEmpty
(
token
))
{
try
{
try
{
boolean
signed
=
Jwts
.
parser
().
isSigned
(
token
);
if
(!
signed
)
{
log
.
error
(
"token非法!=>{}"
,
token
);
return
null
;
}
Claims
claims
=
parseToken
(
token
);
Claims
claims
=
parseToken
(
token
);
String
uuid
=
(
String
)
claims
.
get
(
SysConstains
.
LOGIN_USER_KEY
);
String
uuid
=
(
String
)
claims
.
get
(
SysConstains
.
LOGIN_USER_KEY
);
String
userKey
=
getTokenKey
(
uuid
);
String
userKey
=
getTokenKey
(
uuid
);
cacheService
.
select
(
portalDb
);
//
cacheService.select(portalDb);
String
userStr
=
cacheService
.
get
(
userKey
);
String
userStr
=
cacheService
.
get
(
userKey
);
cacheService
.
select
(
db
);
/* RedisTemplate<String, String> redisTemplate = cacheService.selectDbRedisTemplate(portalDb);
if
(
StringUtils
.
isNotEmpty
(
userStr
))
{
String userStr =redisTemplate.opsForValue().get(userKey);
UserEntity
userEntity
=
JSONObject
.
parseObject
(
userStr
,
UserEntity
.
class
);
*/
userEntity
.
setToken
(
token
);
//刷新token时间
UserEntity
userEntity
=
JSONObject
.
parseObject
(
userStr
,
UserEntity
.
class
);
if
(!
ObjectUtils
.
isEmpty
(
userEntity
))
{
verifyToken
(
userEntity
);
}
// cacheService.select(db);
if
(!
ObjectUtils
.
isEmpty
(
userEntity
))
{
UserEntity
temp
=
userService
.
getExtCache
(
userEntity
.
getLoginName
());
if
(!
ObjectUtils
.
isEmpty
(
temp
))
{
userEntity
.
setId
(
temp
.
getId
());
}
//更新resource 路径
String
menuUrlCode
=
cacheService
.
hget
(
RedisKey
.
KEY_USER_MENU_CACHE
,
userEntity
.
getId
().
toString
(),
String
.
class
);
if
(
ObjectUtils
.
isEmpty
(
menuUrlCode
))
{
Set
<
String
>
urls
=
resourceService
.
findUrlSetByUserId
(
userEntity
.
getId
());
menuUrlCode
=
MenuEncodeUtil
.
generateMenuUrlCode
(
urls
);
cacheService
.
hset
(
RedisKey
.
KEY_USER_MENU_CACHE
,
userEntity
.
getId
().
toString
(),
menuUrlCode
);
}
userEntity
.
setMenuUrl
(
menuUrlCode
);
return
userEntity
;
return
userEntity
;
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"解析jwt token异常!
"
,
e
);
log
.
error
(
"解析jwt token异常!
,token:{}"
,
token
,
e
);
return
null
;
return
null
;
}
}
}
}
...
@@ -150,8 +185,8 @@ public class AuthTokenServiceImpl implements IAuthTokenService {
...
@@ -150,8 +185,8 @@ public class AuthTokenServiceImpl implements IAuthTokenService {
public
void
verifyToken
(
IUser
user
)
{
public
void
verifyToken
(
IUser
user
)
{
long
expireTime
=
user
.
getExpireTime
();
long
expireTime
=
user
.
getExpireTime
();
long
currentTime
=
System
.
currentTimeMillis
();
long
currentTime
=
System
.
currentTimeMillis
();
if
(
expireTime
-
currentTime
<=
SECOND_MINUTE_TEN
)
{
if
(
expireTime
-
currentTime
<=
SECOND_MINUTE_TEN
*
1000
)
{
log
.
info
(
"不足十分钟,刷新过期时间"
);
log
.
info
(
"不足
二
十分钟,刷新过期时间"
);
refreshToken
(
user
);
refreshToken
(
user
);
}
}
}
}
...
@@ -163,7 +198,7 @@ public class AuthTokenServiceImpl implements IAuthTokenService {
...
@@ -163,7 +198,7 @@ public class AuthTokenServiceImpl implements IAuthTokenService {
*/
*/
public
void
refreshToken
(
IUser
user
)
{
public
void
refreshToken
(
IUser
user
)
{
//user.setLoginTime(System.currentTimeMillis());
//user.setLoginTime(System.currentTimeMillis());
user
.
setExpireTime
(
user
.
getLoginTime
()
==
null
?
System
.
currentTimeMillis
()
:
user
.
getLoginTime
()
+
expireTime
*
SECOND_MINUTE
);
user
.
setExpireTime
(
user
.
getLoginTime
()
==
null
?
System
.
currentTimeMillis
()
:
user
.
getLoginTime
()
+
expireTime
*
SECOND_MINUTE
*
1000
);
// 根据uuid将user缓存
// 根据uuid将user缓存
String
userKey
=
getTokenKey
(
user
.
getToken
());
String
userKey
=
getTokenKey
(
user
.
getToken
());
//设置有效时间 单位秒
//设置有效时间 单位秒
...
@@ -230,4 +265,11 @@ public class AuthTokenServiceImpl implements IAuthTokenService {
...
@@ -230,4 +265,11 @@ public class AuthTokenServiceImpl implements IAuthTokenService {
private
String
getTokenKey
(
String
uuid
)
{
private
String
getTokenKey
(
String
uuid
)
{
return
SysConstains
.
LOGIN_TOKEN_KEY
+
uuid
;
return
SysConstains
.
LOGIN_TOKEN_KEY
+
uuid
;
}
}
public
static
void
main
(
String
[]
args
)
{
// boolean signed = Jwts.parser().isSigned("123");
boolean
signed
=
Jwts
.
parser
().
isSigned
(
"eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJuaW5naGFvLm5ldCIsImV4cCI6IjE0Mzg5NTU0NDUiLCJuYW1lIjoid2FuZ2hhbyIsImFkbWluIjp0cnVlfQ.SwyHTEx_RQppr97g4J5lKXtabJecpejuef8AqKYMAJc"
);
System
.
out
.
println
(
signed
);
}
}
}
one-certificate-manager/src/main/java/com/mortals/xhx/base/framework/interceptor/AuthUserInterceptor.java
View file @
ee628cb0
...
@@ -4,12 +4,12 @@ import com.alibaba.fastjson.JSONObject;
...
@@ -4,12 +4,12 @@ import com.alibaba.fastjson.JSONObject;
import
com.mortals.framework.annotation.UnAuth
;
import
com.mortals.framework.annotation.UnAuth
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.service.IAuthTokenService
;
import
com.mortals.framework.service.IAuthTokenService
;
import
com.mortals.framework.service.ICacheService
;
import
com.mortals.framework.service.IUser
;
import
com.mortals.framework.service.IUser
;
import
com.mortals.framework.util.AESUtil
;
import
com.mortals.framework.util.AESUtil
;
import
com.mortals.framework.utils.ServletUtils
;
import
com.mortals.framework.utils.ServletUtils
;
import
com.mortals.framework.web.interceptor.BaseInterceptor
;
import
com.mortals.framework.web.interceptor.BaseInterceptor
;
import
com.mortals.xhx.base.framework.config.InterceptorConfig
;
import
com.mortals.xhx.base.framework.config.InterceptorConfig
;
import
com.mortals.xhx.common.code.ApiRespCodeEnum
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.ObjectUtils
;
...
@@ -21,7 +21,6 @@ import javax.servlet.http.HttpServletResponse;
...
@@ -21,7 +21,6 @@ import javax.servlet.http.HttpServletResponse;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Method
;
import
static
com
.
mortals
.
xhx
.
common
.
key
.
ErrorCode
.*;
import
static
com
.
mortals
.
xhx
.
common
.
key
.
ErrorCode
.*;
import
static
com
.
mortals
.
xhx
.
common
.
key
.
ErrorCode
.
ERROR_USER_OPERATION_CONTENT
;
/**
/**
* 用户权限验证,基于token
* 用户权限验证,基于token
...
@@ -35,6 +34,8 @@ public class AuthUserInterceptor extends BaseInterceptor {
...
@@ -35,6 +34,8 @@ public class AuthUserInterceptor extends BaseInterceptor {
private
InterceptorConfig
config
;
private
InterceptorConfig
config
;
@Autowired
@Autowired
private
IAuthTokenService
authTokenService
;
private
IAuthTokenService
authTokenService
;
@Autowired
private
ICacheService
cacheService
;
@Override
@Override
public
int
getOrder
()
{
public
int
getOrder
()
{
...
@@ -74,7 +75,8 @@ public class AuthUserInterceptor extends BaseInterceptor {
...
@@ -74,7 +75,8 @@ public class AuthUserInterceptor extends BaseInterceptor {
if
(
ObjectUtils
.
isEmpty
(
loginUser
))
{
if
(
ObjectUtils
.
isEmpty
(
loginUser
))
{
ServletUtils
.
renderString
(
response
,
JSONObject
.
toJSONString
(
Rest
.
fail
(
ERROR_TOKEN_EXPIRED
,
ERROR_TOKEN_EXPIRED_CONTENT
)));
ServletUtils
.
renderString
(
response
,
JSONObject
.
toJSONString
(
Rest
.
fail
(
ERROR_TOKEN_EXPIRED
,
ERROR_TOKEN_EXPIRED_CONTENT
)));
return
false
;
return
false
;
}
else
if
(
loginUser
.
isAdmin
()
||
loginUser
.
getUserType
()
==
1
)
{
// } else if (loginUser.isAdmin() || loginUser.getUserType() == 1) {
}
else
if
(
loginUser
.
isAdmin
())
{
return
super
.
preHandle
(
request
,
response
,
handler
);
return
super
.
preHandle
(
request
,
response
,
handler
);
}
else
{
}
else
{
ServletUtils
.
renderString
(
response
,
JSONObject
.
toJSONString
(
Rest
.
fail
(
ERROR_USER_OPERATION
,
ERROR_USER_OPERATION_CONTENT
)));
ServletUtils
.
renderString
(
response
,
JSONObject
.
toJSONString
(
Rest
.
fail
(
ERROR_USER_OPERATION
,
ERROR_USER_OPERATION_CONTENT
)));
...
...
one-certificate-manager/src/main/java/com/mortals/xhx/base/login/web/LoginController.java
View file @
ee628cb0
package
com.mortals.xhx.base.login.web
;
package
com.mortals.xhx.base.login.web
;
import
cn.hutool.core.util.IdUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.mortals.framework.
ap.GlobalSysInfo
;
import
com.mortals.framework.
common.Rest
;
import
com.mortals.framework.
ap.SysConstains
;
import
com.mortals.framework.
service.IAuthTokenService
;
import
com.mortals.framework.service.ICacheService
;
import
com.mortals.framework.service.ICacheService
;
import
com.mortals.framework.service.ITokenService
;
import
com.mortals.framework.service.IUser
;
import
com.mortals.framework.service.IUser
;
import
com.mortals.framework.util.AESUtil
;
import
com.mortals.framework.util.DateUtils
;
import
com.mortals.framework.util.HttpUtil
;
import
com.mortals.framework.util.StringUtils
;
import
com.mortals.framework.util.StringUtils
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.xhx.base.system.menu.model.MenuEntity
;
import
com.mortals.xhx.base.system.menu.model.MenuEntity
;
...
@@ -15,12 +15,10 @@ import com.mortals.xhx.base.system.menu.service.MenuService;
...
@@ -15,12 +15,10 @@ import com.mortals.xhx.base.system.menu.service.MenuService;
import
com.mortals.xhx.base.system.resource.service.ResourceService
;
import
com.mortals.xhx.base.system.resource.service.ResourceService
;
import
com.mortals.xhx.base.system.user.model.UserEntity
;
import
com.mortals.xhx.base.system.user.model.UserEntity
;
import
com.mortals.xhx.base.system.user.service.UserService
;
import
com.mortals.xhx.base.system.user.service.UserService
;
import
com.mortals.xhx.base.system.valid.service.ValidCodeService
;
import
com.mortals.xhx.common.key.RedisKey
;
import
com.mortals.xhx.common.key.RedisKey
;
import
com.mortals.xhx.common.pdu.user.UserPdu
;
import
com.mortals.xhx.common.utils.MenuEncodeUtil
;
import
com.mortals.xhx.feign.user.IUserFeign
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.logging.Log
;
import
org.springframework.beans.factory.InitializingBean
;
import
org.apache.commons.logging.LogFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
@@ -31,193 +29,133 @@ import javax.servlet.http.HttpServletResponse;
...
@@ -31,193 +29,133 @@ import javax.servlet.http.HttpServletResponse;
import
java.util.List
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.Set
;
import
static
com
.
mortals
.
xhx
.
common
.
key
.
ErrorCode
.
ERROR_TOKEN_EXPIRED
;
import
static
com
.
mortals
.
xhx
.
common
.
key
.
ErrorCode
.
ERROR_TOKEN_EXPIRED_CONTENT
;
@RestController
@RestController
@Slf4j
@RequestMapping
(
"login"
)
@RequestMapping
(
"login"
)
public
class
LoginController
extends
BaseCRUDJsonBodyMappingController
<
UserService
,
UserEntity
,
Long
>
{
public
class
LoginController
extends
BaseCRUDJsonBodyMappingController
<
UserService
,
UserEntity
,
Long
>
implements
InitializingBean
{
@Autowired
private
UserService
userService
;
@Autowired
private
ValidCodeService
validCodeService
;
@Autowired
@Autowired
private
ResourceService
resourceService
;
private
ResourceService
resourceService
;
@Autowired
@Autowired
private
MenuService
menuService
;
private
MenuService
menuService
;
@Autowired
@Autowired
private
ITokenService
tokenService
;
@Autowired
private
ICacheService
cacheService
;
private
ICacheService
cacheService
;
@Autowired
@Autowired
private
IUserFeign
userFeign
;
private
IAuthTokenService
authTokenService
;
@Autowired
private
UserService
userService
;
private
static
Log
logger
=
LogFactory
.
getLog
(
LoginController
.
class
);
@RequestMapping
(
"login"
)
@RequestMapping
(
"login"
)
public
String
login
(
@RequestBody
LoginForm
loginForm
)
throws
Exception
{
public
String
login
(
@RequestBody
LoginForm
loginForm
)
throws
Exception
{
JSONObject
ret
=
new
JSONObject
();
JSONObject
data
=
new
JSONObject
();
String
loginName
=
loginForm
.
getLoginName
();
String
loginName
=
loginForm
.
getLoginName
();
String
password
=
loginForm
.
getPassword
();
String
password
=
loginForm
.
getPassword
();
// String securityCode = loginForm.getSecurityCode();
UserPdu
userPdu
=
new
UserPdu
();
String
ip
=
super
.
getRequestIP
(
request
);
userPdu
.
setLoginName
(
loginName
);
if
(
StringUtils
.
isEmpty
(
loginName
)
||
StringUtils
.
isEmpty
(
password
))
{
userPdu
.
setPassword
(
password
);
ret
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_FAILURE
);
String
resp
=
userFeign
.
portalLogin
(
userPdu
);
ret
.
put
(
KEY_RESULT_MSG
,
"未获取到用户信息,请重新登录"
);
return
ret
.
toJSONString
();
return
resp
;
}
UserEntity
userEntity
=
null
;
try
{
// JSONObject ret = new JSONObject();
// String loginName = loginForm.getLoginName();
// String password = loginForm.getPassword();
// //String securityCode = loginForm.getSecurityCode();
// String ip = super.getRequestIP(request);
// if (StringUtils.isEmpty(loginName) || StringUtils.isEmpty(password)) {
// ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
// ret.put(KEY_RESULT_MSG, "未获取到用户信息,请重新登录");
// return ret.toJSONString();
// }
// UserEntity userEntity = null;
// try {
// loginForm.validate();
// loginForm.validate();
//
// boolean result = validCodeService.doCheckImageValidCode(request.getSession().getId(), ip, securityCode);
// userEntity = userService.doLogin(loginName, password, ip);
// if (!result) {
// userEntity.setLastLoginAddress(ip);
// recordSysLog(request, userEntity, "登录验证码不正确或已过期!");
// //saveCurrUser(request, response, userEntity);
// ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
// recordSysLog(request, userEntity, "用户登录系统成功!");
// ret.put(KEY_RESULT_MSG, "登录验证码不正确或已过期!");
// // 返回拥有的菜单数据
// return ret.toJSONString();
// Set<String> urls = resourceService.findUrlSetByUserId(userEntity.getId());
// List<MenuEntity> outlookBarList = menuService.findTreeMenu(userEntity, urls);
// String currUserName = userEntity.getRealName();
// if (currUserName == null || currUserName.trim().length() == 0) {
// currUserName = "管理员";
// }
// userEntity.setLoginTime(System.currentTimeMillis());
// userEntity.setToken(IdUtil.fastSimpleUUID());
// userEntity.setExpireTime(DateUtils.addCurrDate(7).getTime());
// String token = authTokenService.createToken(userEntity);
// JSONObject data = new JSONObject();
// data.put("token", token);
// data.put("currUserName", currUserName);
// data.put("barList", outlookBarList);
// data.put("id", userEntity.getId());
// data.put("userType", userEntity.getUserType());
//
// //this.generateBlackCookie(request, response, loginName, urls);
// ret.put(KEY_RESULT_DATA, data);
// ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
// ret.put(KEY_RESULT_MSG, "用户登录系统成功!");
// ret.put("resources", urls);
//
// return ret.toJSONString();
// } catch (Exception e) {
// log.error("login error ", e);
// if (userEntity == null) {
// userEntity = new UserEntity();
// userEntity.setLoginName(loginName);
// }
// }
// ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
userEntity
=
userService
.
doLogin
(
loginName
,
password
,
ip
);
// ret.put(KEY_RESULT_MSG, super.convertException(e));
userEntity
.
setLastLoginAddress
(
ip
);
// return ret.toJSONString();
// saveCurrUser(request, response, userEntity);
// }
recordSysLog
(
request
,
userEntity
,
"用户登录系统成功!"
);
String
tmpToken
=
userEntity
.
getId
()
+
":"
+
IdUtil
.
fastSimpleUUID
();
userEntity
.
setToken
(
tmpToken
);
userEntity
.
setExpireTime
(
DateUtils
.
addCurrDate
(
1
).
getTime
());
String
token
=
authTokenService
.
createToken
(
userEntity
);
data
.
put
(
"token"
,
token
);
// 返回拥有的菜单数据
Set
<
String
>
urls
=
resourceService
.
findUrlSetByUserId
(
userEntity
.
getId
());
List
<
MenuEntity
>
outlookBarList
=
menuService
.
findTreeMenu
(
userEntity
,
urls
);
String
currUserName
=
userEntity
.
getRealName
();
if
(
currUserName
==
null
||
currUserName
.
trim
().
length
()
==
0
)
{
currUserName
=
"管理员"
;
}
data
.
put
(
"currUserName"
,
currUserName
);
data
.
put
(
"barList"
,
outlookBarList
);
data
.
put
(
"id"
,
userEntity
.
getId
());
data
.
put
(
"userType"
,
userEntity
.
getUserType
());
ret
.
put
(
KEY_RESULT_DATA
,
data
);
ret
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_SUCCESS
);
ret
.
put
(
KEY_RESULT_MSG
,
"用户登录系统成功!"
);
ret
.
put
(
"resources"
,
urls
);
return
ret
.
toJSONString
();
}
catch
(
Exception
e
)
{
log
.
error
(
"login error "
,
e
);
if
(
userEntity
==
null
)
{
userEntity
=
new
UserEntity
();
userEntity
.
setLoginName
(
loginName
);
}
ret
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_FAILURE
);
ret
.
put
(
KEY_RESULT_MSG
,
super
.
convertException
(
e
));
return
ret
.
toJSONString
();
}
}
}
@RequestMapping
(
"logout"
)
@RequestMapping
(
"logout"
)
public
void
logout
()
throws
Exception
{
public
void
logout
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
Exception
{
recordSysLog
(
request
,
"退出登录"
);
recordSysLog
(
request
,
"退出登录"
);
super
.
removeCurrUser
(
request
);
super
.
removeCurrUser
(
request
);
}
}
@RequestMapping
(
"index"
)
@RequestMapping
(
"index"
)
public
String
index
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
Exception
{
public
String
index
()
throws
Exception
{
JSONObject
ret
=
new
JSONObject
();
JSONObject
ret
=
new
JSONObject
();
IUser
user
=
this
.
getCurUser
();
IUser
user
=
this
.
getCurUser
();
if
(
user
==
null
)
{
if
(
user
==
null
)
{
return
""
;
return
JSONObject
.
toJSONString
(
Rest
.
fail
(
ERROR_TOKEN_EXPIRED
,
ERROR_TOKEN_EXPIRED_CONTENT
))
;
}
}
Set
<
String
>
urls
=
resourceService
.
findUrlSetByUserId
(
user
.
getId
());
Set
<
String
>
urls
=
resourceService
.
findUrlSetByUserId
(
user
.
getId
());
log
.
info
(
"userId:{},urls:{}"
,
user
.
getId
(),
JSON
.
toJSONString
(
urls
));
List
<
MenuEntity
>
outlookBarList
=
menuService
.
findTreeMenu
(
user
,
urls
);
List
<
MenuEntity
>
outlookBarList
=
menuService
.
findTreeMenu
(
user
,
urls
);
String
currUserName
=
user
.
getRealName
();
String
currUserName
=
user
.
getRealName
();
if
(
currUserName
==
null
||
currUserName
.
trim
().
length
()
==
0
)
{
if
(
currUserName
==
null
||
currUserName
.
trim
().
length
()
==
0
)
{
currUserName
=
"管理员"
;
currUserName
=
"管理员"
;
}
}
JSONObject
data
=
new
JSONObject
();
JSONObject
data
=
new
JSONObject
();
String
token
=
authTokenService
.
getToken
(
request
);
data
.
put
(
"token"
,
token
);
data
.
put
(
"currUserName"
,
currUserName
);
data
.
put
(
"currUserName"
,
currUserName
);
data
.
put
(
"barList"
,
outlookBarList
);
data
.
put
(
"barList"
,
outlookBarList
);
data
.
put
(
"id"
,
user
.
getId
());
data
.
put
(
"id"
,
user
.
getId
());
data
.
put
(
"userType"
,
user
.
getUserType
());
data
.
put
(
"userType"
,
user
.
getUserType
());
ret
.
put
(
KEY_RESULT_DATA
,
data
);
ret
.
put
(
KEY_RESULT_DATA
,
data
);
//this.generateBlackCookie(request, response, user.getLoginName(), urls);
cacheService
.
hset
(
RedisKey
.
KEY_USER_MENU_CACHE
,
user
.
getId
().
toString
(),
MenuEncodeUtil
.
generateMenuUrlCode
(
urls
));
ret
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_SUCCESS
);
ret
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_SUCCESS
);
ret
.
put
(
KEY_RESULT_MSG
,
"用户登录系统成功!"
);
ret
.
put
(
KEY_RESULT_MSG
,
"用户登录系统成功!"
);
ret
.
put
(
"resources"
,
urls
);
ret
.
put
(
"resources"
,
urls
);
return
ret
.
toJSONString
();
return
ret
.
toJSONString
();
}
}
private
void
generateBlackCookie
(
HttpServletRequest
request
,
HttpServletResponse
response
,
String
loginName
,
Set
<
String
>
urls
)
{
try
{
String
cacheKey
=
RedisKey
.
KEY_MENU_CACHE
+
loginName
;
String
securityKey
=
GlobalSysInfo
.
getPropertyValue
(
SysConstains
.
PROP_COOKIE_SECURITY_KEY
);
//应为Cookie会超长,所以改为仅存储key将值放入redis
//CookieService.setCookieForAuth(request, response, securityKey, null);
StringBuilder
sb
=
new
StringBuilder
();
if
(
urls
!=
null
&&
urls
.
size
()
>
0
)
{
for
(
String
url
:
urls
)
{
int
index
=
url
.
hashCode
()
&
(
Integer
.
MAX_VALUE
-
1
);
sb
.
append
(
index
).
append
(
","
);
}
}
String
menuUrl
=
sb
.
toString
();
menuUrl
=
AESUtil
.
encrypt
(
menuUrl
,
securityKey
);
cacheService
.
set
(
cacheKey
,
menuUrl
,
604800
);
HttpUtil
.
setCookieValue
(
request
,
response
,
SysConstains
.
COOKIE_MENU
,
cacheKey
,
-
1
);
}
catch
(
Throwable
e
)
{
}
}
@RequestMapping
(
"validcode"
)
public
String
validCode
(
HttpServletRequest
request
,
HttpServletResponse
response
,
LoginForm
loginForm
)
{
JSONObject
ret
=
new
JSONObject
();
String
loginName
=
loginForm
.
getLoginName
();
String
password
=
loginForm
.
getPassword
();
if
(
StringUtils
.
isEmpty
(
loginName
)
||
StringUtils
.
isEmpty
(
password
))
{
ret
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_FAILURE
);
ret
.
put
(
KEY_RESULT_MSG
,
"登录名或密码为空"
);
}
UserEntity
user
=
null
;
try
{
user
=
userService
.
doCheckUser
(
loginName
,
password
);
if
(
user
==
null
)
{
ret
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_FAILURE
);
ret
.
put
(
KEY_RESULT_MSG
,
"用户名或密码不正确"
);
}
else
if
(
StringUtils
.
isEmpty
(
user
.
getMobile
()))
{
ret
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_FAILURE
);
ret
.
put
(
KEY_RESULT_MSG
,
"用户无正确的手机号"
);
}
else
{
String
mobile
=
StringUtils
.
trim
(
user
.
getMobile
());
String
sessionId
=
request
.
getSession
().
getId
();
String
ip
=
super
.
getRequestIP
(
request
);
boolean
result
=
validCodeService
.
createSmsValidCode
(
sessionId
,
ip
,
mobile
);
if
(
result
)
{
ret
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_SUCCESS
);
}
else
{
ret
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_FAILURE
);
ret
.
put
(
KEY_RESULT_MSG
,
"验证码发送失败,请稍后在试!"
);
}
}
}
catch
(
Exception
e
)
{
ret
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_FAILURE
);
ret
.
put
(
KEY_RESULT_MSG
,
"验证码发送失败:"
+
super
.
convertException
(
e
));
}
finally
{
if
(
user
==
null
)
{
user
=
new
UserEntity
();
user
.
setLoginName
(
loginName
);
}
recordSysLog
(
request
,
user
,
"用户获取短信验证码"
);
}
return
ret
.
toJSONString
();
}
@Override
public
void
afterPropertiesSet
()
throws
Exception
{
log
.
info
(
"初始化加载登录。。。"
);
}
}
}
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/resource/dao/ResourceDao.java
View file @
ee628cb0
...
@@ -24,7 +24,7 @@ import java.util.List;
...
@@ -24,7 +24,7 @@ import java.util.List;
*/
*/
public
interface
ResourceDao
extends
ICRUDDao
<
ResourceEntity
,
Long
>
{
public
interface
ResourceDao
extends
ICRUDDao
<
ResourceEntity
,
Long
>
{
public
List
<
ResourceEntity
>
getListByUserId
(
Long
userId
);
List
<
ResourceEntity
>
getListByUserId
(
Long
userId
);
List
<
ResourceEntity
>
getAll
(
int
userType
);
List
<
ResourceEntity
>
getAll
(
int
userType
);
}
}
\ No newline at end of file
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/resource/dao/ibatis/ResourceDaoImpl.java
View file @
ee628cb0
...
@@ -8,7 +8,6 @@ import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
...
@@ -8,7 +8,6 @@ import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import
com.mortals.framework.model.ParamDto
;
import
com.mortals.framework.model.ParamDto
;
import
com.mortals.xhx.base.system.resource.dao.ResourceDao
;
import
com.mortals.xhx.base.system.resource.dao.ResourceDao
;
import
com.mortals.xhx.base.system.resource.model.ResourceEntity
;
import
com.mortals.xhx.base.system.resource.model.ResourceEntity
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
import
java.util.HashMap
;
import
java.util.HashMap
;
...
...
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/resource/model/ResourceEntity.java
View file @
ee628cb0
...
@@ -8,10 +8,10 @@
...
@@ -8,10 +8,10 @@
package
com.mortals.xhx.base.system.resource.model
;
package
com.mortals.xhx.base.system.resource.model
;
import
java.util.Date
;
import
com.mortals.framework.model.BaseEntityLong
;
import
com.mortals.framework.model.BaseEntityLong
;
import
java.util.Date
;
/**
/**
* <p>Title: 资源信息</p>
* <p>Title: 资源信息</p>
* <p>Description: ResourceEntity </p>
* <p>Description: ResourceEntity </p>
...
...
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/resource/service/ResourceService.java
View file @
ee628cb0
...
@@ -9,7 +9,9 @@
...
@@ -9,7 +9,9 @@
package
com.mortals.xhx.base.system.resource.service
;
package
com.mortals.xhx.base.system.resource.service
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.service.ICRUDService
;
import
com.mortals.framework.service.ICRUDService
;
import
com.mortals.xhx.base.system.resource.model.ResourceEntity
;
import
com.mortals.xhx.base.system.resource.model.ResourceEntity
;
...
@@ -31,7 +33,7 @@ public interface ResourceService extends ICRUDService<ResourceEntity,Long> {
...
@@ -31,7 +33,7 @@ public interface ResourceService extends ICRUDService<ResourceEntity,Long> {
* @return
* @return
* @throws AppException
* @throws AppException
*/
*/
public
List
<
ResourceEntity
>
findAllEnable
()
throws
AppException
;
List
<
ResourceEntity
>
findAllEnable
()
throws
AppException
;
/**
/**
* 根据用户查询可用资源
* 根据用户查询可用资源
...
@@ -39,7 +41,7 @@ public interface ResourceService extends ICRUDService<ResourceEntity,Long> {
...
@@ -39,7 +41,7 @@ public interface ResourceService extends ICRUDService<ResourceEntity,Long> {
* @return
* @return
* @throws AppException
* @throws AppException
*/
*/
public
List
<
ResourceEntity
>
findListByUserId
(
Long
userId
)
throws
AppException
;
List
<
ResourceEntity
>
findListByUserId
(
Long
userId
)
throws
AppException
;
/**
/**
* 查询用户可用资源
* 查询用户可用资源
...
@@ -47,7 +49,7 @@ public interface ResourceService extends ICRUDService<ResourceEntity,Long> {
...
@@ -47,7 +49,7 @@ public interface ResourceService extends ICRUDService<ResourceEntity,Long> {
* @return 字符串,多个以逗号分隔
* @return 字符串,多个以逗号分隔
* @throws AppException
* @throws AppException
*/
*/
public
String
findUrlByUserId
(
Long
userId
)
throws
AppException
;
String
findUrlByUserId
(
Long
userId
)
throws
AppException
;
/**
/**
* 查询用户用资源集合
* 查询用户用资源集合
...
@@ -55,7 +57,7 @@ public interface ResourceService extends ICRUDService<ResourceEntity,Long> {
...
@@ -55,7 +57,7 @@ public interface ResourceService extends ICRUDService<ResourceEntity,Long> {
* @return
* @return
* @throws AppException
* @throws AppException
*/
*/
public
Set
<
String
>
findUrlSetByUserId
(
Long
userId
)
throws
AppException
;
Set
<
String
>
findUrlSetByUserId
(
Long
userId
)
throws
AppException
;
/**
/**
* 获取所有资源,不分页
* 获取所有资源,不分页
...
@@ -63,4 +65,8 @@ public interface ResourceService extends ICRUDService<ResourceEntity,Long> {
...
@@ -63,4 +65,8 @@ public interface ResourceService extends ICRUDService<ResourceEntity,Long> {
* @param userType
* @param userType
*/
*/
List
<
ResourceEntity
>
findAll
(
int
userType
);
List
<
ResourceEntity
>
findAll
(
int
userType
);
Rest
<
String
>
refreshResourceUrl
(
String
packageName
,
Context
context
);
}
}
\ No newline at end of file
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/resource/service/impl/ResourceServiceImpl.java
View file @
ee628cb0
/**
/**
* 文件:ResourceServiceImpl.java
* 文件:ResourceServiceImpl.java
* 版本:1.0.0
* 版本:1.0.0
* 日期:
* 日期:
* Copyright ®
* Copyright ®
* All right reserved.
* All right reserved.
*/
*/
package
com.mortals.xhx.base.system.resource.service.impl
;
package
com.mortals.xhx.base.system.resource.service.impl
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.service.ICacheService
;
import
com.mortals.framework.service.impl.AbstractCRUDServiceImpl
;
import
com.mortals.framework.service.impl.AbstractCRUDServiceImpl
;
import
com.mortals.framework.util.DataUtil
;
import
com.mortals.framework.util.StringUtils
;
import
com.mortals.framework.util.StringUtils
;
import
com.mortals.xhx.base.system.resource.dao.ResourceDao
;
import
com.mortals.xhx.base.system.resource.dao.ResourceDao
;
import
com.mortals.xhx.base.system.resource.model.ResourceEntity
;
import
com.mortals.xhx.base.system.resource.model.ResourceEntity
;
import
com.mortals.xhx.base.system.resource.model.ResourceQuery
;
import
com.mortals.xhx.base.system.resource.model.ResourceQuery
;
import
com.mortals.xhx.base.system.resource.service.ResourceService
;
import
com.mortals.xhx.base.system.resource.service.ResourceService
;
import
com.mortals.xhx.base.system.role.model.RoleAuthEntity
;
import
com.mortals.xhx.base.system.role.model.RoleAuthQuery
;
import
com.mortals.xhx.base.system.role.service.RoleAuthService
;
import
com.mortals.xhx.common.key.RedisKey
;
import
com.mortals.xhx.common.utils.ControllerScanUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
import
java.util.HashSet
;
import
java.util.*
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
java.util.Set
;
import
static
com
.
mortals
.
xhx
.
common
.
utils
.
MenuEncodeUtil
.
generateMenuUrlCode
;
/**
/**
* <p>Title: 资源信息</p>
* <p>Title: 资源信息</p>
* <p>Description: ResourceServiceImpl service接口 </p>
* <p>Description: ResourceServiceImpl service接口 </p>
* <p>Copyright: Copyright ® </p>
* <p>Copyright: Copyright ® </p>
* <p>Company: </p>
* <p>Company: </p>
* @author
*
* @author
* @version 1.0.0
* @version 1.0.0
*/
*/
@Service
(
"resourceService"
)
@Service
(
"resourceService"
)
public
class
ResourceServiceImpl
extends
AbstractCRUDServiceImpl
<
ResourceDao
,
ResourceEntity
,
Long
>
implements
ResourceService
{
public
class
ResourceServiceImpl
extends
AbstractCRUDServiceImpl
<
ResourceDao
,
ResourceEntity
,
Long
>
implements
ResourceService
{
@Autowired
private
ICacheService
cacheService
;
@Autowired
@Lazy
private
RoleAuthService
roleAuthService
;
@Override
@Override
public
List
<
ResourceEntity
>
findAllEnable
()
throws
AppException
{
public
List
<
ResourceEntity
>
findAllEnable
()
throws
AppException
{
...
@@ -52,7 +72,7 @@ public class ResourceServiceImpl extends AbstractCRUDServiceImpl<ResourceDao,Res
...
@@ -52,7 +72,7 @@ public class ResourceServiceImpl extends AbstractCRUDServiceImpl<ResourceDao,Res
@Override
@Override
public
Set
<
String
>
findUrlSetByUserId
(
Long
userId
)
throws
AppException
{
public
Set
<
String
>
findUrlSetByUserId
(
Long
userId
)
throws
AppException
{
Set
<
String
>
urls
=
new
HashSet
<
String
>();
Set
<
String
>
urls
=
new
HashSet
<>();
List
<
ResourceEntity
>
resList
=
this
.
findListByUserId
(
userId
);
List
<
ResourceEntity
>
resList
=
this
.
findListByUserId
(
userId
);
for
(
ResourceEntity
res
:
resList
)
{
for
(
ResourceEntity
res
:
resList
)
{
String
url
=
res
.
getUrl
();
String
url
=
res
.
getUrl
();
...
@@ -69,5 +89,107 @@ public class ResourceServiceImpl extends AbstractCRUDServiceImpl<ResourceDao,Res
...
@@ -69,5 +89,107 @@ public class ResourceServiceImpl extends AbstractCRUDServiceImpl<ResourceDao,Res
public
List
<
ResourceEntity
>
findAll
(
int
userType
)
{
public
List
<
ResourceEntity
>
findAll
(
int
userType
)
{
return
dao
.
getAll
(
userType
);
return
dao
.
getAll
(
userType
);
}
}
@Override
public
Rest
<
String
>
refreshResourceUrl
(
String
packageName
,
Context
context
)
{
List
<
Class
<?>>
classList
=
ControllerScanUtil
.
getAllClassByPackageName
(
packageName
);
//System.out.println(classList); //获取到了所有的类
List
<
ResourceEntity
>
newResourcelist
=
ControllerScanUtil
.
getAnnotationInfo
(
classList
).
stream
().
filter
(
f
->!
ObjectUtils
.
isEmpty
(
f
.
getUrl
())).
collect
(
Collectors
.
toList
());
Map
<
String
,
List
<
ResourceEntity
>>
localResourceMap
=
this
.
find
(
new
ResourceQuery
()).
stream
().
collect
(
Collectors
.
groupingBy
(
x
->
x
.
getName
()));
Map
<
String
,
List
<
ResourceEntity
>>
newResourceMap
=
newResourcelist
.
stream
().
collect
(
Collectors
.
groupingBy
(
x
->
x
.
getName
()));
//更新 与新增 新加的;
newResourceMap
.
entrySet
().
forEach
(
item
->
{
List
<
ResourceEntity
>
resourceEntities
=
item
.
getValue
();
if
(
ObjectUtils
.
isEmpty
(
resourceEntities
))
return
;
if
(
resourceEntities
.
size
()
==
1
)
{
ResourceEntity
resourceEntity
=
resourceEntities
.
get
(
0
);
saveUpdateResourceEntity
(
context
,
localResourceMap
,
resourceEntity
);
}
else
if
(
resourceEntities
.
size
()
>
1
)
{
//原始扫描 有多个资源列表针对一个名称的
for
(
ResourceEntity
resourceEntity
:
resourceEntities
)
{
saveUpdateResourceEntity
(
context
,
localResourceMap
,
resourceEntity
);
}
}
});
return
Rest
.
ok
();
}
private
void
saveUpdateResourceEntity
(
Context
context
,
Map
<
String
,
List
<
ResourceEntity
>>
localResourceMap
,
ResourceEntity
resourceEntity
)
{
//查找 本地是否已经存在了
List
<
ResourceEntity
>
tempResourceList
=
localResourceMap
.
getOrDefault
(
resourceEntity
.
getName
(),
new
ArrayList
<>());
if
(
tempResourceList
.
size
()
==
0
)
{
//新增 resource;
resourceEntity
.
setCreateUserId
(
this
.
getContextUserId
(
context
));
resourceEntity
.
setCreateTime
(
new
Date
());
this
.
save
(
resourceEntity
,
context
);
}
else
if
(
tempResourceList
.
size
()
==
1
)
{
//更新
ResourceEntity
tempResource
=
tempResourceList
.
get
(
0
);
Set
<
String
>
setUrl
=
Arrays
.
stream
(
resourceEntity
.
getUrl
().
split
(
","
)).
collect
(
Collectors
.
toSet
());
Arrays
.
stream
(
tempResource
.
getUrl
().
split
(
","
)).
forEach
(
i
->
{
setUrl
.
add
(
i
);
});
tempResource
.
setUrl
(
setUrl
.
stream
().
collect
(
Collectors
.
joining
(
","
)));
this
.
update
(
tempResource
,
context
);
}
else
if
(
tempResourceList
.
size
()
>
1
)
{
//找到多个同名的 资源配置
for
(
ResourceEntity
tempResource
:
tempResourceList
)
{
//模糊匹配到路径有一个存在的
Set
<
String
>
setUrl
=
Arrays
.
stream
(
resourceEntity
.
getUrl
().
split
(
","
)).
collect
(
Collectors
.
toSet
());
String
[]
splitUrl
=
tempResource
.
getUrl
().
split
(
","
);
Boolean
bool
=
false
;
for
(
int
i
=
0
;
i
<
splitUrl
.
length
;
i
++)
{
if
(
setUrl
.
contains
(
splitUrl
[
i
]))
{
bool
=
true
;
break
;
}
}
if
(
bool
)
{
//匹配到了,更新当前这个资源
Arrays
.
stream
(
tempResource
.
getUrl
().
split
(
","
)).
forEach
(
i
->
{
setUrl
.
add
(
i
);
});
tempResource
.
setUrl
(
setUrl
.
stream
().
collect
(
Collectors
.
joining
(
","
)));
this
.
update
(
tempResource
,
context
);
}
}
}
}
@Override
protected
void
updateAfter
(
ResourceEntity
entity
,
Context
context
)
throws
AppException
{
updateUserMenuUrlCache
();
}
@Override
protected
void
saveAfter
(
ResourceEntity
entity
,
Context
context
)
throws
AppException
{
updateUserMenuUrlCache
();
}
@Override
protected
void
removeAfter
(
Long
[]
ids
,
Context
context
,
int
result
)
throws
AppException
{
//删除关联表中数据
if
(!
ObjectUtils
.
isEmpty
(
ids
))
{
RoleAuthQuery
query
=
new
RoleAuthQuery
();
query
.
setResourceIdList
(
Arrays
.
asList
(
ids
));
List
<
RoleAuthEntity
>
roleAuthEntities
=
roleAuthService
.
find
(
query
);
if
(!
ObjectUtils
.
isEmpty
(
roleAuthEntities
))
{
roleAuthService
.
remove
(
roleAuthEntities
.
stream
().
map
(
m
->
m
.
getId
()).
toArray
(
Long
[]::
new
),
context
);
updateUserMenuUrlCache
();
}
}
}
private
void
updateUserMenuUrlCache
()
{
//更新用户菜单
Set
<
String
>
hkeys
=
cacheService
.
hkeys
(
RedisKey
.
KEY_USER_MENU_CACHE
);
for
(
String
userId
:
hkeys
)
{
Set
<
String
>
urls
=
this
.
findUrlSetByUserId
(
DataUtil
.
converStr2Long
(
userId
,
0L
));
String
menuUrlCode
=
generateMenuUrlCode
(
urls
);
cacheService
.
hset
(
RedisKey
.
KEY_USER_MENU_CACHE
,
userId
,
menuUrlCode
);
}
}
}
}
\ No newline at end of file
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/resource/web/ResourceController.java
View file @
ee628cb0
package
com.mortals.xhx.base.system.resource.web
;
package
com.mortals.xhx.base.system.resource.web
;
import
java.util.HashMap
;
import
com.alibaba.fastjson.JSONObject
;
import
java.util.Map
;
import
com.mortals.framework.annotation.UnAuth
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
com.mortals.framework.common.IBaseEnum
;
import
com.mortals.framework.common.IBaseEnum
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.common.code.UserType
;
import
com.mortals.framework.common.code.UserType
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.model.OrderCol
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.xhx.base.system.resource.model.ResourceEntity
;
import
com.mortals.xhx.base.system.resource.service.ResourceService
;
import
com.mortals.xhx.common.code.AuthType
;
import
com.mortals.xhx.common.code.SourceType
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.alibaba.fastjson.JSONObject
;
import
java.util.Arrays
;
import
com.mortals.framework.model.Context
;
import
java.util.HashMap
;
import
com.mortals.framework.web.BaseCRUDJsonMappingController
;
import
java.util.Map
;
import
com.mortals.xhx.base.system.resource.model.ResourceEntity
;
import
com.mortals.xhx.base.system.resource.service.ResourceService
;
import
com.mortals.xhx.common.code.AuthType
;
import
com.mortals.xhx.common.code.SourceType
;
/**
/**
* 资源信息
* 资源信息
...
@@ -32,38 +33,63 @@ import com.mortals.xhx.common.code.SourceType;
...
@@ -32,38 +33,63 @@ import com.mortals.xhx.common.code.SourceType;
@Slf4j
@Slf4j
@RestController
@RestController
@RequestMapping
(
"resource"
)
@RequestMapping
(
"resource"
)
public
class
ResourceController
extends
BaseCRUDJsonBodyMappingController
<
ResourceService
,
ResourceEntity
,
Long
>
{
public
class
ResourceController
extends
BaseCRUDJsonBodyMappingController
<
ResourceService
,
ResourceEntity
,
Long
>
{
public
ResourceController
()
{
super
.
setModuleDesc
(
"资源信息"
);
}
@Override
protected
void
init
(
Map
<
String
,
Object
>
model
,
Context
context
)
{
Map
<
String
,
Object
>
statsus
=
new
HashMap
<
String
,
Object
>();
statsus
.
put
(
"authType"
,
AuthType
.
getEnumMap
());
statsus
.
put
(
"sourceType"
,
SourceType
.
getEnumMap
());
if
(
getCurUser
().
isAdmin
())
{
statsus
.
put
(
"userType"
,
IBaseEnum
.
getEnumMap
(
UserType
.
class
));
}
else
{
statsus
.
put
(
"userType"
,
UserType
.
findByValue
(
getCurUser
().
getUserType
()));
}
model
.
put
(
KEY_RESULT_DICT
,
statsus
);
}
/**
* 获取所有资源
*
* @return
*/
@PostMapping
(
"allResources"
)
public
String
allResources
(
int
userType
)
{
JSONObject
ret
=
new
JSONObject
();
ret
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_SUCCESS
);
ret
.
put
(
KEY_RESULT_MSG
,
"所有的customer以及user"
);
ret
.
put
(
KEY_RESULT_DATA
,
service
.
findAll
(
userType
));
return
ret
.
toJSONString
();
}
public
ResourceController
(){
@Override
super
.
setFormClass
(
ResourceForm
.
class
);
protected
void
doListBefore
(
ResourceEntity
query
,
Map
<
String
,
Object
>
model
,
Context
context
)
throws
AppException
{
super
.
setModuleDesc
(
"资源信息"
);
query
.
setOrderColList
(
Arrays
.
asList
(
new
OrderCol
(
"sourceType"
)));
}
super
.
doListBefore
(
query
,
model
,
context
);
}
@Override
/**
protected
void
init
(
Map
<
String
,
Object
>
model
,
Context
context
)
{
* 资源路径刷新
Map
<
String
,
Object
>
statsus
=
new
HashMap
<
String
,
Object
>();
*/
statsus
.
put
(
"authType"
,
AuthType
.
getEnumMap
());
@PostMapping
(
value
=
"refreshUrl"
)
statsus
.
put
(
"sourceType"
,
SourceType
.
getEnumMap
());
@UnAuth
if
(
getCurUser
().
isAdmin
())
{
public
Rest
<
String
>
refreshUrl
(
@RequestParam
(
name
=
"packageName"
,
defaultValue
=
"com.mortals.xhx"
)
String
packageName
)
{
statsus
.
put
(
"userType"
,
IBaseEnum
.
getEnumMap
(
UserType
.
class
));
log
.
info
(
"刷新资源路径,packageName"
,
packageName
);
}
else
{
String
busiDesc
=
this
.
getModuleDesc
()
+
"资源路径刷新"
;
statsus
.
put
(
"userType"
,
UserType
.
findByValue
(
getCurUser
().
getUserType
()));
Rest
<
String
>
rest
=
Rest
.
ok
(
busiDesc
+
" 【成功】"
);
}
try
{
model
.
put
(
KEY_RESULT_DICT
,
statsus
);
this
.
service
.
refreshResourceUrl
(
packageName
,
getContext
());
}
recordSysLog
(
request
,
busiDesc
+
" 【成功】"
);
}
catch
(
Exception
e
)
{
log
.
error
(
busiDesc
,
e
);
rest
=
Rest
.
fail
(
super
.
convertException
(
e
));
}
return
rest
;
}
/**
* 获取所有资源
*
* @return
*/
@PostMapping
(
"allResources"
)
public
String
allResources
(
int
userType
)
{
JSONObject
ret
=
new
JSONObject
();
ret
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_SUCCESS
);
ret
.
put
(
KEY_RESULT_MSG
,
"所有的customer以及user"
);
ret
.
put
(
KEY_RESULT_DATA
,
service
.
findAll
(
userType
));
return
ret
.
toJSONString
();
}
}
}
\ No newline at end of file
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/resource/web/ResourceForm.java
deleted
100644 → 0
View file @
9a50bbd9
/**
* 文件:ResourceForm.java
* 版本:1.0.0
* 日期:
* Copyright ®
* All right reserved.
*/
package
com.mortals.xhx.base.system.resource.web
;
import
com.mortals.framework.web.BaseCRUDFormLong
;
import
com.mortals.xhx.base.system.resource.model.ResourceEntity
;
import
com.mortals.xhx.base.system.resource.model.ResourceQuery
;
/**
* <p>Title: 资源信息</p>
* <p>Description: ResourceForm </p>
* <p>Copyright: Copyright ® </p>
* <p>Company: </p>
* @author
* @version 1.0.0
*/
public
class
ResourceForm
extends
BaseCRUDFormLong
<
ResourceEntity
>
{
private
ResourceEntity
entity
=
new
ResourceEntity
();
private
ResourceQuery
query
=
new
ResourceQuery
();
public
ResourceForm
(){
}
@Override
public
ResourceEntity
getEntity
()
{
return
entity
;
}
public
void
setEntity
(
ResourceEntity
entity
)
{
this
.
entity
=
entity
;
}
@Override
public
ResourceQuery
getQuery
()
{
return
query
;
}
public
void
setQuery
(
ResourceQuery
query
)
{
this
.
query
=
query
;
}
}
\ No newline at end of file
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/role/dao/ibatis/RoleAuthDaoImpl.java
View file @
ee628cb0
...
@@ -11,7 +11,6 @@ package com.mortals.xhx.base.system.role.dao.ibatis;
...
@@ -11,7 +11,6 @@ package com.mortals.xhx.base.system.role.dao.ibatis;
import
com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis
;
import
com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis
;
import
com.mortals.xhx.base.system.role.dao.RoleAuthDao
;
import
com.mortals.xhx.base.system.role.dao.RoleAuthDao
;
import
com.mortals.xhx.base.system.role.model.RoleAuthEntity
;
import
com.mortals.xhx.base.system.role.model.RoleAuthEntity
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
/**
/**
...
...
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/role/dao/ibatis/RoleDaoImpl.java
View file @
ee628cb0
...
@@ -11,7 +11,6 @@ package com.mortals.xhx.base.system.role.dao.ibatis;
...
@@ -11,7 +11,6 @@ package com.mortals.xhx.base.system.role.dao.ibatis;
import
com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis
;
import
com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis
;
import
com.mortals.xhx.base.system.role.dao.RoleDao
;
import
com.mortals.xhx.base.system.role.dao.RoleDao
;
import
com.mortals.xhx.base.system.role.model.RoleEntity
;
import
com.mortals.xhx.base.system.role.model.RoleEntity
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
/**
/**
...
...
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/role/dao/ibatis/RoleUserDaoImpl.java
View file @
ee628cb0
...
@@ -11,7 +11,6 @@ package com.mortals.xhx.base.system.role.dao.ibatis;
...
@@ -11,7 +11,6 @@ package com.mortals.xhx.base.system.role.dao.ibatis;
import
com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis
;
import
com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis
;
import
com.mortals.xhx.base.system.role.dao.RoleUserDao
;
import
com.mortals.xhx.base.system.role.dao.RoleUserDao
;
import
com.mortals.xhx.base.system.role.model.RoleUserEntity
;
import
com.mortals.xhx.base.system.role.model.RoleUserEntity
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
/**
/**
...
...
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/role/model/RoleEntity.java
View file @
ee628cb0
...
@@ -8,10 +8,10 @@
...
@@ -8,10 +8,10 @@
package
com.mortals.xhx.base.system.role.model
;
package
com.mortals.xhx.base.system.role.model
;
import
java.util.Date
;
import
com.mortals.framework.model.BaseEntityLong
;
import
com.mortals.framework.model.BaseEntityLong
;
import
java.util.Date
;
/**
/**
* <p>Title: 角色信息</p>
* <p>Title: 角色信息</p>
* <p>Description: RoleEntity </p>
* <p>Description: RoleEntity </p>
...
...
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/role/service/impl/RoleAuthServiceImpl.java
View file @
ee628cb0
/**
/**
* 文件:RoleAuthServiceImpl.java
* 文件:RoleAuthServiceImpl.java
* 版本:1.0.0
* 版本:1.0.0
* 日期:
* 日期:
* Copyright ®
* Copyright ®
* All right reserved.
* All right reserved.
*/
*/
package
com.mortals.xhx.base.system.role.service.impl
;
package
com.mortals.xhx.base.system.role.service.impl
;
import
com.mortals.framework.service.ICacheService
;
import
com.mortals.framework.service.impl.AbstractCRUDServiceImpl
;
import
com.mortals.framework.service.impl.AbstractCRUDServiceImpl
;
import
com.mortals.framework.util.DataUtil
;
import
com.mortals.xhx.base.system.resource.service.ResourceService
;
import
com.mortals.xhx.base.system.role.dao.RoleAuthDao
;
import
com.mortals.xhx.base.system.role.dao.RoleAuthDao
;
import
com.mortals.xhx.base.system.role.model.RoleAuthEntity
;
import
com.mortals.xhx.base.system.role.model.RoleAuthEntity
;
import
com.mortals.xhx.base.system.role.model.RoleAuthQuery
;
import
com.mortals.xhx.base.system.role.model.RoleAuthQuery
;
import
com.mortals.xhx.base.system.role.service.RoleAuthService
;
import
com.mortals.xhx.base.system.role.service.RoleAuthService
;
import
com.mortals.xhx.common.key.RedisKey
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.HashMap
;
import
java.util.List
;
import
static
com
.
mortals
.
xhx
.
common
.
utils
.
MenuEncodeUtil
.
generateMenuUrlCode
;
import
java.util.Map
;
/**
/**
* <p>Title: 角色资源权限</p>
* <p>Title: 角色资源权限</p>
* <p>Description: RoleAuthServiceImpl service接口 </p>
* <p>Description: RoleAuthServiceImpl service接口 </p>
* <p>Copyright: Copyright ® </p>
* <p>Copyright: Copyright ® </p>
* <p>Company: </p>
* <p>Company: </p>
* @author
* @author
* @version 1.0.0
* @version 1.0.0
*/
*/
@Service
(
"roleAuthService"
)
@Service
(
"roleAuthService"
)
public
class
RoleAuthServiceImpl
extends
AbstractCRUDServiceImpl
<
RoleAuthDao
,
RoleAuthEntity
,
Long
>
implements
RoleAuthService
{
public
class
RoleAuthServiceImpl
extends
AbstractCRUDServiceImpl
<
RoleAuthDao
,
RoleAuthEntity
,
Long
>
implements
RoleAuthService
{
@Autowired
private
ICacheService
cacheService
;
@Autowired
@Lazy
private
ResourceService
resourceService
;
@Override
@Override
public
void
doDistributionSource
(
RoleAuthQuery
query
)
{
public
void
doDistributionSource
(
RoleAuthQuery
query
)
{
...
@@ -49,6 +58,18 @@ public class RoleAuthServiceImpl extends AbstractCRUDServiceImpl<RoleAuthDao,Rol
...
@@ -49,6 +58,18 @@ public class RoleAuthServiceImpl extends AbstractCRUDServiceImpl<RoleAuthDao,Rol
list
.
add
(
entity
);
list
.
add
(
entity
);
}
}
this
.
dao
.
insertBatch
(
list
);
this
.
dao
.
insertBatch
(
list
);
this
.
updateUserMenuUrlCache
();
}
}
private
void
updateUserMenuUrlCache
()
{
//更新用户菜单
Set
<
String
>
hkeys
=
cacheService
.
hkeys
(
RedisKey
.
KEY_USER_MENU_CACHE
);
for
(
String
userId
:
hkeys
)
{
Set
<
String
>
urls
=
resourceService
.
findUrlSetByUserId
(
DataUtil
.
converStr2Long
(
userId
,
0L
));
String
menuUrlCode
=
generateMenuUrlCode
(
urls
);
cacheService
.
hset
(
RedisKey
.
KEY_USER_MENU_CACHE
,
userId
,
menuUrlCode
);
}
}
}
}
\ No newline at end of file
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/role/service/impl/RoleServiceImpl.java
View file @
ee628cb0
...
@@ -15,7 +15,6 @@ import com.mortals.xhx.base.system.role.dao.RoleDao;
...
@@ -15,7 +15,6 @@ import com.mortals.xhx.base.system.role.dao.RoleDao;
import
com.mortals.xhx.base.system.role.model.*
;
import
com.mortals.xhx.base.system.role.model.*
;
import
com.mortals.xhx.base.system.role.service.RoleAuthService
;
import
com.mortals.xhx.base.system.role.service.RoleAuthService
;
import
com.mortals.xhx.base.system.role.service.RoleService
;
import
com.mortals.xhx.base.system.role.service.RoleService
;
import
com.mortals.xhx.base.system.role.service.RoleUserService
;
import
com.mortals.xhx.base.system.role.service.RoleUserService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
...
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/role/service/impl/RoleUserServiceImpl.java
View file @
ee628cb0
/**
/**
* 文件:RoleUserServiceImpl.java
* 文件:RoleUserServiceImpl.java
* 版本:1.0.0
* 版本:1.0.0
* 日期:
* 日期:
* Copyright ®
* Copyright ®
* All right reserved.
* All right reserved.
*/
*/
package
com.mortals.xhx.base.system.role.service.impl
;
package
com.mortals.xhx.base.system.role.service.impl
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.service.ICacheService
;
import
com.mortals.framework.service.impl.AbstractCRUDServiceImpl
;
import
com.mortals.framework.service.impl.AbstractCRUDServiceImpl
;
import
com.mortals.framework.util.DataUtil
;
import
com.mortals.xhx.base.system.resource.service.ResourceService
;
import
com.mortals.xhx.base.system.role.dao.RoleUserDao
;
import
com.mortals.xhx.base.system.role.dao.RoleUserDao
;
import
com.mortals.xhx.base.system.role.model.RoleUserEntity
;
import
com.mortals.xhx.base.system.role.model.RoleUserEntity
;
import
com.mortals.xhx.base.system.role.model.RoleUserQuery
;
import
com.mortals.xhx.base.system.role.model.RoleUserQuery
;
import
com.mortals.xhx.base.system.role.service.RoleUserService
;
import
com.mortals.xhx.base.system.role.service.RoleUserService
;
import
com.mortals.xhx.common.key.RedisKey
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.HashMap
;
import
java.util.List
;
import
static
com
.
mortals
.
xhx
.
common
.
utils
.
MenuEncodeUtil
.
generateMenuUrlCode
;
import
java.util.Map
;
/**
/**
* <p>Title: 角色用户</p>
* <p>Title: 角色用户</p>
* <p>Description: RoleUserServiceImpl service接口 </p>
* <p>Description: RoleUserServiceImpl service接口 </p>
* <p>Copyright: Copyright ® </p>
* <p>Copyright: Copyright ® </p>
* <p>Company: </p>
* <p>Company: </p>
* @author
* @author
* @version 1.0.0
* @version 1.0.0
*/
*/
@Service
(
"roleUserService"
)
@Service
(
"roleUserService"
)
public
class
RoleUserServiceImpl
extends
AbstractCRUDServiceImpl
<
RoleUserDao
,
RoleUserEntity
,
Long
>
implements
RoleUserService
{
public
class
RoleUserServiceImpl
extends
AbstractCRUDServiceImpl
<
RoleUserDao
,
RoleUserEntity
,
Long
>
implements
RoleUserService
{
@Autowired
private
ICacheService
cacheService
;
@Autowired
private
ResourceService
resourceService
;
@Override
@Override
public
void
doDistributionUser
(
RoleUserQuery
query
)
{
public
void
doDistributionUser
(
RoleUserQuery
query
)
{
...
@@ -50,6 +60,7 @@ public class RoleUserServiceImpl extends AbstractCRUDServiceImpl<RoleUserDao,Rol
...
@@ -50,6 +60,7 @@ public class RoleUserServiceImpl extends AbstractCRUDServiceImpl<RoleUserDao,Rol
list
.
add
(
rolseUser
);
list
.
add
(
rolseUser
);
}
}
this
.
dao
.
insertBatch
(
list
);
this
.
dao
.
insertBatch
(
list
);
updateUserMenuUrlCache
();
}
}
@Override
@Override
...
@@ -68,8 +79,22 @@ public class RoleUserServiceImpl extends AbstractCRUDServiceImpl<RoleUserDao,Rol
...
@@ -68,8 +79,22 @@ public class RoleUserServiceImpl extends AbstractCRUDServiceImpl<RoleUserDao,Rol
list
.
add
(
rolseUser
);
list
.
add
(
rolseUser
);
}
}
this
.
dao
.
insertBatch
(
list
);
this
.
dao
.
insertBatch
(
list
);
updateUserMenuUrlCache
();
}
}
@Override
protected
void
removeAfter
(
Long
[]
ids
,
Context
context
,
int
result
)
throws
AppException
{
updateUserMenuUrlCache
();
}
private
void
updateUserMenuUrlCache
()
{
//更新用户菜单
Set
<
String
>
hkeys
=
cacheService
.
hkeys
(
RedisKey
.
KEY_USER_MENU_CACHE
);
for
(
String
userId
:
hkeys
)
{
Set
<
String
>
urls
=
resourceService
.
findUrlSetByUserId
(
DataUtil
.
converStr2Long
(
userId
,
0L
));
String
menuUrlCode
=
generateMenuUrlCode
(
urls
);
cacheService
.
hset
(
RedisKey
.
KEY_USER_MENU_CACHE
,
userId
,
menuUrlCode
);
}
}
}
}
\ No newline at end of file
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/role/web/RoleAuthController.java
View file @
ee628cb0
...
@@ -3,20 +3,15 @@ package com.mortals.xhx.base.system.role.web;
...
@@ -3,20 +3,15 @@ package com.mortals.xhx.base.system.role.web;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.xhx.base.system.role.model.RoleAuthEntity
;
import
com.mortals.xhx.base.system.role.model.RoleAuthQuery
;
import
com.mortals.xhx.base.system.role.model.RoleAuthQuery
;
import
com.mortals.xhx.base.system.role.service.RoleAuthService
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.mortals.framework.web.BaseCRUDJsonMappingController
;
import
com.mortals.xhx.base.system.role.model.RoleAuthEntity
;
import
com.mortals.xhx.base.system.role.service.RoleAuthService
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
/**
/**
* 角色资源权限
* 角色资源权限
*
*
...
@@ -29,7 +24,6 @@ import javax.servlet.http.HttpServletResponse;
...
@@ -29,7 +24,6 @@ import javax.servlet.http.HttpServletResponse;
public
class
RoleAuthController
extends
BaseCRUDJsonBodyMappingController
<
RoleAuthService
,
RoleAuthEntity
,
Long
>
{
public
class
RoleAuthController
extends
BaseCRUDJsonBodyMappingController
<
RoleAuthService
,
RoleAuthEntity
,
Long
>
{
public
RoleAuthController
()
{
public
RoleAuthController
()
{
super
.
setFormClass
(
RoleAuthForm
.
class
);
super
.
setModuleDesc
(
"角色资源权限"
);
super
.
setModuleDesc
(
"角色资源权限"
);
}
}
...
...
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/role/web/RoleAuthForm.java
deleted
100644 → 0
View file @
9a50bbd9
/**
* 文件:RoleAuthForm.java
* 版本:1.0.0
* 日期:
* Copyright ®
* All right reserved.
*/
package
com.mortals.xhx.base.system.role.web
;
import
com.mortals.framework.web.BaseCRUDFormLong
;
import
com.mortals.xhx.base.system.role.model.RoleAuthEntity
;
import
com.mortals.xhx.base.system.role.model.RoleAuthQuery
;
/**
* <p>Title: 角色资源权限</p>
* <p>Description: RoleAuthForm </p>
* <p>Copyright: Copyright ® </p>
* <p>Company: </p>
* @author
* @version 1.0.0
*/
public
class
RoleAuthForm
extends
BaseCRUDFormLong
<
RoleAuthEntity
>
{
private
RoleAuthEntity
entity
=
new
RoleAuthEntity
();
private
RoleAuthQuery
query
=
new
RoleAuthQuery
();
public
RoleAuthForm
(){
}
@Override
public
RoleAuthEntity
getEntity
()
{
return
entity
;
}
public
void
setEntity
(
RoleAuthEntity
entity
)
{
this
.
entity
=
entity
;
}
@Override
public
RoleAuthQuery
getQuery
()
{
return
query
;
}
public
void
setQuery
(
RoleAuthQuery
query
)
{
this
.
query
=
query
;
}
}
\ No newline at end of file
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/role/web/RoleController.java
View file @
ee628cb0
...
@@ -5,20 +5,18 @@ import com.alibaba.fastjson.JSONObject;
...
@@ -5,20 +5,18 @@ import com.alibaba.fastjson.JSONObject;
import
com.mortals.framework.common.IBaseEnum
;
import
com.mortals.framework.common.IBaseEnum
;
import
com.mortals.framework.common.code.UserType
;
import
com.mortals.framework.common.code.UserType
;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.xhx.base.system.role.model.RoleQuery
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
com.mortals.framework.web.BaseCRUDJsonMappingController
;
import
com.mortals.xhx.base.system.role.model.RoleEntity
;
import
com.mortals.xhx.base.system.role.model.RoleEntity
;
import
com.mortals.xhx.base.system.role.model.RoleUserEntity
;
import
com.mortals.xhx.base.system.role.model.RoleUserEntity
;
import
com.mortals.xhx.base.system.role.service.RoleService
;
import
com.mortals.xhx.base.system.role.service.RoleService
;
import
com.mortals.xhx.base.system.role.service.RoleUserService
;
import
com.mortals.xhx.base.system.role.service.RoleUserService
;
import
com.mortals.xhx.common.code.RoleType
;
import
com.mortals.xhx.common.code.RoleType
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
...
@@ -38,7 +36,6 @@ public class RoleController extends BaseCRUDJsonBodyMappingController<RoleServic
...
@@ -38,7 +36,6 @@ public class RoleController extends BaseCRUDJsonBodyMappingController<RoleServic
private
RoleUserService
roleUserService
;
private
RoleUserService
roleUserService
;
public
RoleController
(){
public
RoleController
(){
super
.
setFormClass
(
RoleForm
.
class
);
super
.
setModuleDesc
(
"角色信息"
);
super
.
setModuleDesc
(
"角色信息"
);
}
}
...
...
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/role/web/RoleForm.java
deleted
100644 → 0
View file @
9a50bbd9
/**
* 文件:RoleForm.java
* 版本:1.0.0
* 日期:
* Copyright ®
* All right reserved.
*/
package
com.mortals.xhx.base.system.role.web
;
import
com.mortals.framework.web.BaseCRUDFormLong
;
import
com.mortals.xhx.base.system.role.model.RoleEntity
;
import
com.mortals.xhx.base.system.role.model.RoleQuery
;
/**
* <p>Title: 角色信息</p>
* <p>Description: RoleForm </p>
* <p>Copyright: Copyright ® </p>
* <p>Company: </p>
* @author
* @version 1.0.0
*/
public
class
RoleForm
extends
BaseCRUDFormLong
<
RoleEntity
>
{
private
RoleEntity
entity
=
new
RoleEntity
();
private
RoleQuery
query
=
new
RoleQuery
();
/** 用户ID */
private
Long
userId
;
public
RoleForm
(){
}
@Override
public
RoleEntity
getEntity
()
{
return
entity
;
}
public
void
setEntity
(
RoleEntity
entity
)
{
this
.
entity
=
entity
;
}
@Override
public
RoleQuery
getQuery
()
{
return
query
;
}
public
void
setQuery
(
RoleQuery
query
)
{
this
.
query
=
query
;
}
public
Long
getUserId
()
{
return
userId
;
}
public
void
setUserId
(
Long
userId
)
{
this
.
userId
=
userId
;
}
}
\ No newline at end of file
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/role/web/RoleUserController.java
View file @
ee628cb0
...
@@ -7,26 +7,22 @@ import com.mortals.framework.ap.SysConstains;
...
@@ -7,26 +7,22 @@ import com.mortals.framework.ap.SysConstains;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.BaseEntityLong
;
import
com.mortals.framework.model.BaseEntityLong
;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.xhx.base.system.role.model.RoleUserQuery
;
import
org.apache.commons.beanutils.MethodUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.mortals.framework.web.BaseCRUDJsonMappingController
;
import
com.mortals.xhx.base.system.role.model.RoleEntity
;
import
com.mortals.xhx.base.system.role.model.RoleEntity
;
import
com.mortals.xhx.base.system.role.model.RoleUserEntity
;
import
com.mortals.xhx.base.system.role.model.RoleUserEntity
;
import
com.mortals.xhx.base.system.role.model.RoleUserQuery
;
import
com.mortals.xhx.base.system.role.service.RoleService
;
import
com.mortals.xhx.base.system.role.service.RoleService
;
import
com.mortals.xhx.base.system.role.service.RoleUserService
;
import
com.mortals.xhx.base.system.role.service.RoleUserService
;
import
com.mortals.xhx.base.system.user.model.UserEntity
;
import
com.mortals.xhx.base.system.user.model.UserEntity
;
import
com.mortals.xhx.base.system.user.model.UserQuery
;
import
com.mortals.xhx.base.system.user.model.UserQuery
;
import
com.mortals.xhx.base.system.user.service.UserService
;
import
com.mortals.xhx.base.system.user.service.UserService
;
import
org.apache.commons.beanutils.MethodUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -49,7 +45,6 @@ public class RoleUserController extends BaseCRUDJsonBodyMappingController<RoleUs
...
@@ -49,7 +45,6 @@ public class RoleUserController extends BaseCRUDJsonBodyMappingController<RoleUs
private
UserService
userService
;
private
UserService
userService
;
public
RoleUserController
()
{
public
RoleUserController
()
{
super
.
setFormClass
(
RoleUserForm
.
class
);
super
.
setModuleDesc
(
"角色用户"
);
super
.
setModuleDesc
(
"角色用户"
);
}
}
...
...
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/role/web/RoleUserForm.java
deleted
100644 → 0
View file @
9a50bbd9
/**
* 文件:RoleUserForm.java
* 版本:1.0.0
* 日期:
* Copyright ®
* All right reserved.
*/
package
com.mortals.xhx.base.system.role.web
;
import
com.mortals.framework.web.BaseCRUDFormLong
;
import
com.mortals.xhx.base.system.role.model.RoleUserEntity
;
import
com.mortals.xhx.base.system.role.model.RoleUserQuery
;
/**
* <p>Title: 角色用户</p>
* <p>Description: RoleUserForm </p>
* <p>Copyright: Copyright ® </p>
* <p>Company: </p>
* @author
* @version 1.0.0
*/
public
class
RoleUserForm
extends
BaseCRUDFormLong
<
RoleUserEntity
>
{
private
RoleUserEntity
entity
=
new
RoleUserEntity
();
private
RoleUserQuery
query
=
new
RoleUserQuery
();
public
RoleUserForm
(){
}
@Override
public
RoleUserEntity
getEntity
()
{
return
entity
;
}
public
void
setEntity
(
RoleUserEntity
entity
)
{
this
.
entity
=
entity
;
}
@Override
public
RoleUserQuery
getQuery
()
{
return
query
;
}
public
void
setQuery
(
RoleUserQuery
query
)
{
this
.
query
=
query
;
}
}
\ No newline at end of file
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/upload/service/impl/UploadServiceImpl.java
View file @
ee628cb0
package
com.mortals.xhx.base.system.upload.service.impl
;
package
com.mortals.xhx.base.system.upload.service.impl
;
import
cn.hutool.core.io.FileUtil
;
import
cn.hutool.core.io.FileUtil
;
import
cn.hutool.core.util.
Id
Util
;
import
cn.hutool.core.util.
Str
Util
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.service.IUser
;
import
com.mortals.framework.service.IUser
;
import
com.mortals.framework.util.StringUtils
;
import
com.mortals.framework.util.StringUtils
;
...
@@ -48,9 +48,7 @@ public class UploadServiceImpl implements UploadService {
...
@@ -48,9 +48,7 @@ public class UploadServiceImpl implements UploadService {
if
(
tempFile
==
null
||
tempFile
.
getSize
()
==
0
)
{
if
(
tempFile
==
null
||
tempFile
.
getSize
()
==
0
)
{
throw
new
AppException
(
"没有要上传的文件!"
);
throw
new
AppException
(
"没有要上传的文件!"
);
}
}
if
(
StringUtils
.
isEmpty
(
prePath
)){
prePath
=
"file/uploadfile"
;
}
String
fileName
=
tempFile
.
getOriginalFilename
();
String
fileName
=
tempFile
.
getOriginalFilename
();
String
extension
=
FilenameUtils
.
getExtension
(
fileName
);
String
extension
=
FilenameUtils
.
getExtension
(
fileName
);
UploadFileType
type
=
UploadFileType
.
getFileType
(
extension
);
UploadFileType
type
=
UploadFileType
.
getFileType
(
extension
);
...
@@ -58,7 +56,7 @@ public class UploadServiceImpl implements UploadService {
...
@@ -58,7 +56,7 @@ public class UploadServiceImpl implements UploadService {
log
.
error
(
"文件上传大小超过限制,当前文件---"
+
tempFile
.
getSize
()
+
",允许大小----------"
+
type
.
getMaxSize
());
log
.
error
(
"文件上传大小超过限制,当前文件---"
+
tempFile
.
getSize
()
+
",允许大小----------"
+
type
.
getMaxSize
());
throw
new
AppException
(
"文件上传大小超过限制!"
);
throw
new
AppException
(
"文件上传大小超过限制!"
);
}
}
if
(
null
!=
fileName
&&
fileName
.
length
()
>
50
)
{
if
(
null
!=
fileName
&&
fileName
.
length
()
>
50
0
)
{
throw
new
AppException
(
"文件名称过长,无法上传!"
);
throw
new
AppException
(
"文件名称过长,无法上传!"
);
}
}
...
@@ -84,7 +82,9 @@ public class UploadServiceImpl implements UploadService {
...
@@ -84,7 +82,9 @@ public class UploadServiceImpl implements UploadService {
@Override
@Override
public
String
getFilePath
(
String
path
)
{
public
String
getFilePath
(
String
path
)
{
String
filePath
=
this
.
filePath
.
endsWith
(
"/"
)
?
this
.
filePath
:
this
.
filePath
+
"/"
;
String
filePath
=
StrUtil
.
appendIfMissing
(
this
.
filePath
,
"/"
);
path
=
StrUtil
.
removePrefix
(
path
,
"/"
);
StrUtil
.
prependIfMissing
(
path
,
"/"
,
"/"
);
return
filePath
+
path
;
return
filePath
+
path
;
}
}
...
@@ -152,7 +152,7 @@ public class UploadServiceImpl implements UploadService {
...
@@ -152,7 +152,7 @@ public class UploadServiceImpl implements UploadService {
@Override
@Override
public
void
uploadDownload
(
String
fileName
,
HttpServletResponse
response
)
{
public
void
uploadDownload
(
String
fileName
,
HttpServletResponse
response
)
{
String
filePath
=
this
.
filePath
+
fileName
;
String
filePath
=
this
.
getFilePath
(
fileName
)
;
try
{
try
{
response
.
setContentType
(
MediaType
.
APPLICATION_OCTET_STREAM_VALUE
);
response
.
setContentType
(
MediaType
.
APPLICATION_OCTET_STREAM_VALUE
);
setAttachmentResponseHeader
(
response
,
fileName
);
setAttachmentResponseHeader
(
response
,
fileName
);
...
...
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/user/dao/ibatis/UserDaoImpl.java
View file @
ee628cb0
...
@@ -8,11 +8,10 @@
...
@@ -8,11 +8,10 @@
package
com.mortals.xhx.base.system.user.dao.ibatis
;
package
com.mortals.xhx.base.system.user.dao.ibatis
;
import
com.mortals.xhx.base.system.user.dao.UserDao
;
import
com.mortals.xhx.base.system.user.model.UserEntity
;
import
com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis
;
import
com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis
;
import
com.mortals.framework.model.ParamDto
;
import
com.mortals.framework.model.ParamDto
;
import
com.mortals.xhx.base.system.user.dao.UserDao
;
import
com.mortals.xhx.base.system.user.model.UserEntity
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
import
java.util.List
;
...
...
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/user/model/UserEntity.java
View file @
ee628cb0
package
com.mortals.xhx.base.system.user.model
;
package
com.mortals.xhx.base.system.user.model
;
import
java.util.Date
;
import
java.util.Objects
;
import
com.mortals.framework.ap.SysConstains
;
import
com.mortals.framework.ap.SysConstains
;
import
com.mortals.framework.model.BaseEntityLong
;
import
com.mortals.framework.service.IUser
;
import
com.mortals.framework.service.IUser
;
import
com.mortals.xhx.base.system.user.model.vo.UserVo
;
import
java.util.Date
;
/**
/**
* 用户信息业务实体对象
*
*
*
Description:User
*
@author zxfei
*
date: 2021-9-26 16:11:48
*
@date 2022-07-05
*/
*/
public
class
UserEntity
extends
UserEntityExt
implements
IUser
{
private
static
final
long
serialVersionUID
=
1632643908537L
;
public
class
UserEntity
extends
UserVo
implements
IUser
{
private
static
final
long
serialVersionUID
=
1L
;
/**
/**
* 登录名
* 登录名
*/
*/
private
String
loginName
;
private
String
loginName
;
/**
/**
* 登录密码,使用md5双次加密
* 登录密码,使用md5双次加密
*/
*/
private
String
loginPwd
;
private
String
loginPwd
;
/**
* 最近一次使用密码,使用md5双次加密
*/
private
String
loginPwd1
;
/**
* 最近二次使用密码,使用md5双次加密
*/
private
String
loginPwd2
;
/**
* 最近三次使用密码,使用md5双次加密
*/
private
String
loginPwd3
;
/**
/**
* 登录限制地址,多个IP地址用逗号分隔,可以使用IP段匹配,如:172.17.*非空:则只能该值内的IP可以登录
* 登录限制地址,多个IP地址用逗号分隔,可以使用IP段匹配,如:172.17.*非空:则只能该值内的IP可以登录
*/
*/
private
String
loginLimitAddress
;
private
String
loginLimitAddress
;
/**
/**
* 用户名
* 用户名
*/
*/
private
String
realName
;
private
String
realName
;
/**
/**
* 用户手机号
* 用户手机号
*/
*/
private
String
mobile
;
private
String
mobile
;
/**
/**
* 用户联系电话
* 用户联系电话
*/
*/
private
String
phone
;
private
String
phone
;
/**
/**
* 用户邮箱
* 用户邮箱
*/
*/
private
String
email
;
private
String
email
;
/**
/**
* QQ号码
* QQ号码
*/
*/
private
String
qq
;
private
String
qq
;
/**
/**
* 用户类型
,0:系统用户 1:普通用户 2:工作人员,默认2
* 用户类型
(0.系统用户,1.普通用户,2.工作人员)
*/
*/
private
Integer
userType
;
private
Integer
userType
;
/**
* 站点id
*/
private
Long
siteId
;
/**
* 用户状态,0:停用,1:正常,2:冻结,3:销户,4:离职,默认1
*/
private
Integer
status
;
/**
/**
*
客户ID
*
所属站点id,多个逗号分隔
*/
*/
private
Long
customerId
;
private
String
siteIds
;
/**
/**
*
创建时间
*
所属区域code,多个逗号分隔
*/
*/
private
Date
createTime
;
private
String
areaCodes
;
/**
/**
*
创建用户
*
用户状态(0.停用,1.正常,2.冻结,3.销户,4.离职)
*/
*/
private
Long
createUserId
;
private
Integer
status
;
/**
/**
* 创建用户名称
* 创建用户名称
*/
*/
private
String
createUserName
;
private
String
createUserName
;
/**
/**
* 最后一次登录时间
* 最后一次登录时间
*/
*/
private
Date
lastLoginTime
;
private
Date
lastLoginTime
;
/**
/**
* 最后一次登录地址
* 最后一次登录地址
*/
*/
private
String
lastLoginAddress
;
private
String
lastLoginAddress
;
/**
* 最后修改密码时间
*/
private
Date
lastModPwdTime
;
/**
* 最后修改密码地址
*/
private
String
lastModPwdAddr
;
public
UserEntity
(){
}
public
UserEntity
(){
}
/**
/**
* 获取 登录名
* 获取 登录名
* @return
loginName
* @return
String
*/
*/
public
String
getLoginName
()
{
public
String
getLoginName
(){
return
this
.
loginName
;
return
loginName
;
}
}
/**
/**
* 设置 登录名
* 设置 登录名
* @param loginName
* @param loginName
*/
*/
public
void
setLoginName
(
String
loginName
)
{
public
void
setLoginName
(
String
loginName
){
this
.
loginName
=
loginName
;
this
.
loginName
=
loginName
;
}
}
/**
/**
* 获取 登录密码,使用md5双次加密
* 获取 登录密码,使用md5双次加密
* @return
loginPwd
* @return
String
*/
*/
public
String
getLoginPwd
()
{
public
String
getLoginPwd
(){
return
this
.
loginPwd
;
return
loginPwd
;
}
}
/**
/**
* 设置 登录密码,使用md5双次加密
* 设置 登录密码,使用md5双次加密
* @param loginPwd
* @param loginPwd
*/
*/
public
void
setLoginPwd
(
String
loginPwd
)
{
public
void
setLoginPwd
(
String
loginPwd
){
this
.
loginPwd
=
loginPwd
;
this
.
loginPwd
=
loginPwd
;
}
}
/**
* 获取 最近一次使用密码,使用md5双次加密
* @return loginPwd1
*/
public
String
getLoginPwd1
()
{
return
this
.
loginPwd1
;
}
/**
* 设置 最近一次使用密码,使用md5双次加密
* @param loginPwd1
*/
public
void
setLoginPwd1
(
String
loginPwd1
)
{
this
.
loginPwd1
=
loginPwd1
;
}
/**
* 获取 最近二次使用密码,使用md5双次加密
* @return loginPwd2
*/
public
String
getLoginPwd2
()
{
return
this
.
loginPwd2
;
}
/**
* 设置 最近二次使用密码,使用md5双次加密
* @param loginPwd2
*/
public
void
setLoginPwd2
(
String
loginPwd2
)
{
this
.
loginPwd2
=
loginPwd2
;
}
/**
* 获取 最近三次使用密码,使用md5双次加密
* @return loginPwd3
*/
public
String
getLoginPwd3
()
{
return
this
.
loginPwd3
;
}
/**
* 设置 最近三次使用密码,使用md5双次加密
* @param loginPwd3
*/
public
void
setLoginPwd3
(
String
loginPwd3
)
{
this
.
loginPwd3
=
loginPwd3
;
}
/**
/**
* 获取 登录限制地址,多个IP地址用逗号分隔,可以使用IP段匹配,如:172.17.*非空:则只能该值内的IP可以登录
* 获取 登录限制地址,多个IP地址用逗号分隔,可以使用IP段匹配,如:172.17.*非空:则只能该值内的IP可以登录
* @return
loginLimitAddress
* @return
String
*/
*/
public
String
getLoginLimitAddress
()
{
public
String
getLoginLimitAddress
(){
return
this
.
loginLimitAddress
;
return
loginLimitAddress
;
}
}
/**
/**
* 设置 登录限制地址,多个IP地址用逗号分隔,可以使用IP段匹配,如:172.17.*非空:则只能该值内的IP可以登录
* 设置 登录限制地址,多个IP地址用逗号分隔,可以使用IP段匹配,如:172.17.*非空:则只能该值内的IP可以登录
* @param loginLimitAddress
* @param loginLimitAddress
*/
*/
public
void
setLoginLimitAddress
(
String
loginLimitAddress
)
{
public
void
setLoginLimitAddress
(
String
loginLimitAddress
){
this
.
loginLimitAddress
=
loginLimitAddress
;
this
.
loginLimitAddress
=
loginLimitAddress
;
}
}
/**
/**
* 获取 用户名
* 获取 用户名
* @return
realName
* @return
String
*/
*/
public
String
getRealName
()
{
public
String
getRealName
(){
return
this
.
realName
;
return
realName
;
}
}
@Override
@Override
...
@@ -240,146 +148,108 @@ public class UserEntity extends UserEntityExt implements IUser {
...
@@ -240,146 +148,108 @@ public class UserEntity extends UserEntityExt implements IUser {
* 设置 用户名
* 设置 用户名
* @param realName
* @param realName
*/
*/
public
void
setRealName
(
String
realName
)
{
public
void
setRealName
(
String
realName
){
this
.
realName
=
realName
;
this
.
realName
=
realName
;
}
}
/**
/**
* 获取 用户手机号
* 获取 用户手机号
* @return
mobile
* @return
String
*/
*/
public
String
getMobile
()
{
public
String
getMobile
(){
return
this
.
mobile
;
return
mobile
;
}
}
/**
/**
* 设置 用户手机号
* 设置 用户手机号
* @param mobile
* @param mobile
*/
*/
public
void
setMobile
(
String
mobile
)
{
public
void
setMobile
(
String
mobile
){
this
.
mobile
=
mobile
;
this
.
mobile
=
mobile
;
}
}
/**
/**
* 获取 用户联系电话
* 获取 用户联系电话
* @return
phone
* @return
String
*/
*/
public
String
getPhone
()
{
public
String
getPhone
(){
return
this
.
phone
;
return
phone
;
}
}
/**
/**
* 设置 用户联系电话
* 设置 用户联系电话
* @param phone
* @param phone
*/
*/
public
void
setPhone
(
String
phone
)
{
public
void
setPhone
(
String
phone
){
this
.
phone
=
phone
;
this
.
phone
=
phone
;
}
}
/**
/**
* 获取 用户邮箱
* 获取 用户邮箱
* @return
email
* @return
String
*/
*/
public
String
getEmail
()
{
public
String
getEmail
(){
return
this
.
email
;
return
email
;
}
}
/**
/**
* 设置 用户邮箱
* 设置 用户邮箱
* @param email
* @param email
*/
*/
public
void
setEmail
(
String
email
)
{
public
void
setEmail
(
String
email
){
this
.
email
=
email
;
this
.
email
=
email
;
}
}
/**
/**
* 获取 QQ号码
* 获取 QQ号码
* @return
qq
* @return
String
*/
*/
public
String
getQq
()
{
public
String
getQq
(){
return
this
.
qq
;
return
qq
;
}
}
/**
/**
* 设置 QQ号码
* 设置 QQ号码
* @param qq
* @param qq
*/
*/
public
void
setQq
(
String
qq
)
{
public
void
setQq
(
String
qq
){
this
.
qq
=
qq
;
this
.
qq
=
qq
;
}
}
/**
/**
* 获取 用户类型
,0:系统用户 1:普通用户 2:工作人员,默认2
* 获取 用户类型
(0.系统用户,1.普通用户,2.工作人员)
* @return
userType
* @return
Integer
*/
*/
public
Integer
getUserType
()
{
public
Integer
getUserType
(){
return
this
.
userType
;
return
userType
;
}
}
@Override
public
String
getMenuUrl
()
{
return
null
;
}
/**
/**
* 设置 用户类型
,0:系统用户 1:普通用户 2:工作人员,默认2
* 设置 用户类型
(0.系统用户,1.普通用户,2.工作人员)
* @param userType
* @param userType
*/
*/
public
void
setUserType
(
Integer
userType
)
{
public
void
setUserType
(
Integer
userType
){
this
.
userType
=
userType
;
this
.
userType
=
userType
;
}
}
/**
* 获取 站点id
* @return siteId
*/
public
Long
getSiteId
()
{
return
this
.
siteId
;
}
@Override
@Override
public
String
getSiteIds
()
{
public
Long
getDeptId
()
{
return
super
.
getSiteIds
()
;
return
null
;
}
}
@Override
@Override
public
String
get
AreaCodes
()
{
public
String
get
DeptName
()
{
return
null
;
return
null
;
}
}
/**
* 设置 站点id
* @param siteId
*/
public
void
setSiteId
(
Long
siteId
)
{
this
.
siteId
=
siteId
;
}
/**
* 获取 用户状态,0:停用,1:正常,2:冻结,3:销户,4:离职,默认1
* @return status
*/
public
Integer
getStatus
()
{
return
this
.
status
;
}
/**
* 设置 用户状态,0:停用,1:正常,2:冻结,3:销户,4:离职,默认1
* @param status
*/
public
void
setStatus
(
Integer
status
)
{
this
.
status
=
status
;
}
@Override
@Override
public
Long
get
Dept
Id
()
{
public
Long
get
Customer
Id
()
{
return
null
;
return
null
;
}
}
@Override
@Override
public
String
getDeptName
()
{
public
Long
getSiteId
()
{
return
null
;
return
null
;
}
}
/**
/**
* 获取
客户ID
* 获取
所属站点id,多个逗号分隔
* @return
customerId
* @return
String
*/
*/
public
Long
getCustomerId
()
{
public
String
getSiteIds
()
{
return
this
.
customerId
;
return
siteIds
;
}
}
@Override
@Override
public
Long
getCustomerJoinId
()
{
public
Long
getCustomerJoinId
()
{
return
null
;
return
null
;
...
@@ -391,123 +261,96 @@ public class UserEntity extends UserEntityExt implements IUser {
...
@@ -391,123 +261,96 @@ public class UserEntity extends UserEntityExt implements IUser {
}
}
/**
/**
* 设置
客户ID
* 设置
所属站点id,多个逗号分隔
* @param
customerId
* @param
siteIds
*/
*/
public
void
set
CustomerId
(
Long
customerId
)
{
public
void
set
SiteIds
(
String
siteIds
)
{
this
.
customerId
=
customerId
;
this
.
siteIds
=
siteIds
;
}
}
/**
/**
* 获取
创建时间
* 获取
所属区域code,多个逗号分隔
* @return
createTime
* @return
String
*/
*/
public
Date
getCreateTime
()
{
public
String
getAreaCodes
()
{
return
this
.
createTime
;
return
areaCodes
;
}
}
/**
/**
* 设置
创建时间
* 设置
所属区域code,多个逗号分隔
* @param
createTime
* @param
areaCodes
*/
*/
public
void
set
CreateTime
(
Date
createTime
)
{
public
void
set
AreaCodes
(
String
areaCodes
)
{
this
.
createTime
=
createTime
;
this
.
areaCodes
=
areaCodes
;
}
}
/**
/**
* 获取
创建用户
* 获取
用户状态(0.停用,1.正常,2.冻结,3.销户,4.离职)
* @return
createUserId
* @return
Integer
*/
*/
public
Long
getCreateUserId
()
{
public
Integer
getStatus
()
{
return
this
.
createUserId
;
return
status
;
}
}
/**
/**
* 设置
创建用户
* 设置
用户状态(0.停用,1.正常,2.冻结,3.销户,4.离职)
* @param
createUserId
* @param
status
*/
*/
public
void
set
CreateUserId
(
Long
createUserId
)
{
public
void
set
Status
(
Integer
status
)
{
this
.
createUserId
=
createUserId
;
this
.
status
=
status
;
}
}
/**
/**
* 获取 创建用户名称
* 获取 创建用户名称
* @return
createUserName
* @return
String
*/
*/
public
String
getCreateUserName
()
{
public
String
getCreateUserName
(){
return
this
.
createUserName
;
return
createUserName
;
}
}
/**
/**
* 设置 创建用户名称
* 设置 创建用户名称
* @param createUserName
* @param createUserName
*/
*/
public
void
setCreateUserName
(
String
createUserName
)
{
public
void
setCreateUserName
(
String
createUserName
){
this
.
createUserName
=
createUserName
;
this
.
createUserName
=
createUserName
;
}
}
/**
/**
* 获取 最后一次登录时间
* 获取 最后一次登录时间
* @return
lastLoginTim
e
* @return
Dat
e
*/
*/
public
Date
getLastLoginTime
()
{
public
Date
getLastLoginTime
(){
return
this
.
lastLoginTime
;
return
lastLoginTime
;
}
}
/**
/**
* 设置 最后一次登录时间
* 设置 最后一次登录时间
* @param lastLoginTime
* @param lastLoginTime
*/
*/
public
void
setLastLoginTime
(
Date
lastLoginTime
)
{
public
void
setLastLoginTime
(
Date
lastLoginTime
){
this
.
lastLoginTime
=
lastLoginTime
;
this
.
lastLoginTime
=
lastLoginTime
;
}
}
/**
/**
* 获取 最后一次登录地址
* 获取 最后一次登录地址
* @return
lastLoginAddress
* @return
String
*/
*/
public
String
getLastLoginAddress
()
{
public
String
getLastLoginAddress
(){
return
this
.
lastLoginAddress
;
return
lastLoginAddress
;
}
}
/**
/**
* 设置 最后一次登录地址
* 设置 最后一次登录地址
* @param lastLoginAddress
* @param lastLoginAddress
*/
*/
public
void
setLastLoginAddress
(
String
lastLoginAddress
)
{
public
void
setLastLoginAddress
(
String
lastLoginAddress
){
this
.
lastLoginAddress
=
lastLoginAddress
;
this
.
lastLoginAddress
=
lastLoginAddress
;
}
}
/**
* 获取 最后修改密码时间
* @return lastModPwdTime
*/
public
Date
getLastModPwdTime
()
{
return
this
.
lastModPwdTime
;
}
/**
* 设置 最后修改密码时间
* @param lastModPwdTime
*/
public
void
setLastModPwdTime
(
Date
lastModPwdTime
)
{
this
.
lastModPwdTime
=
lastModPwdTime
;
}
/**
* 获取 最后修改密码地址
* @return lastModPwdAddr
*/
public
String
getLastModPwdAddr
()
{
return
this
.
lastModPwdAddr
;
}
/**
* 设置 最后修改密码地址
* @param lastModPwdAddr
*/
public
void
setLastModPwdAddr
(
String
lastModPwdAddr
)
{
this
.
lastModPwdAddr
=
lastModPwdAddr
;
}
@Override
@Override
public
int
hashCode
()
{
public
int
hashCode
()
{
return
Objects
.
hash
(
super
.
hashCode
(),
loginName
,
loginPwd
,
loginPwd1
,
loginPwd2
,
loginPwd3
,
loginLimitAddress
,
realName
,
mobile
,
phone
,
email
,
qq
,
userType
,
status
,
customerId
,
createTime
,
createUserId
,
createUserName
,
lastLoginTime
,
lastLoginAddress
,
lastModPwdTime
,
lastModPwdAddr
);
return
this
.
getId
().
hashCode
();
}
}
@Override
@Override
public
boolean
equals
(
Object
obj
)
{
public
boolean
equals
(
Object
obj
)
{
if
(
obj
==
null
)
if
(
obj
==
null
)
return
false
;
return
false
;
if
(
obj
instanceof
UserEntity
)
{
if
(
obj
instanceof
UserEntity
)
{
UserEntity
tmp
=
(
UserEntity
)
obj
;
UserEntity
tmp
=
(
UserEntity
)
obj
;
if
(
this
.
getId
()
.
longValue
()
==
tmp
.
getId
().
longValue
())
{
if
(
this
.
getId
()
==
tmp
.
getId
())
{
return
true
;
return
true
;
}
}
}
}
...
@@ -516,56 +359,54 @@ public class UserEntity extends UserEntityExt implements IUser {
...
@@ -516,56 +359,54 @@ public class UserEntity extends UserEntityExt implements IUser {
public
String
toString
(){
public
String
toString
(){
StringBuilder
sb
=
new
StringBuilder
(
""
);
StringBuilder
sb
=
new
StringBuilder
(
""
);
sb
sb
.
append
(
",loginName:"
).
append
(
getLoginName
());
.
append
(
",id:"
).
append
(
getId
())
sb
.
append
(
",loginPwd:"
).
append
(
getLoginPwd
());
.
append
(
",loginName:"
).
append
(
getLoginName
())
sb
.
append
(
",loginLimitAddress:"
).
append
(
getLoginLimitAddress
());
.
append
(
",loginPwd:"
).
append
(
getLoginPwd
())
sb
.
append
(
",realName:"
).
append
(
getRealName
());
.
append
(
",loginPwd1:"
).
append
(
getLoginPwd1
())
sb
.
append
(
",mobile:"
).
append
(
getMobile
());
.
append
(
",loginPwd2:"
).
append
(
getLoginPwd2
())
sb
.
append
(
",phone:"
).
append
(
getPhone
());
.
append
(
",loginPwd3:"
).
append
(
getLoginPwd3
())
sb
.
append
(
",email:"
).
append
(
getEmail
());
.
append
(
",loginLimitAddress:"
).
append
(
getLoginLimitAddress
())
sb
.
append
(
",qq:"
).
append
(
getQq
());
.
append
(
",realName:"
).
append
(
getRealName
())
sb
.
append
(
",userType:"
).
append
(
getUserType
());
.
append
(
",mobile:"
).
append
(
getMobile
())
sb
.
append
(
",siteIds:"
).
append
(
getSiteIds
());
.
append
(
",phone:"
).
append
(
getPhone
())
sb
.
append
(
",areaCodes:"
).
append
(
getAreaCodes
());
.
append
(
",email:"
).
append
(
getEmail
())
sb
.
append
(
",status:"
).
append
(
getStatus
());
.
append
(
",qq:"
).
append
(
getQq
())
sb
.
append
(
",createUserName:"
).
append
(
getCreateUserName
());
.
append
(
",userType:"
).
append
(
getUserType
())
sb
.
append
(
",lastLoginTime:"
).
append
(
getLastLoginTime
());
.
append
(
",siteId:"
).
append
(
getSiteId
())
sb
.
append
(
",lastLoginAddress:"
).
append
(
getLastLoginAddress
());
.
append
(
",status:"
).
append
(
getStatus
())
.
append
(
",customerId:"
).
append
(
getCustomerId
())
.
append
(
",createTime:"
).
append
(
getCreateTime
())
.
append
(
",createUserId:"
).
append
(
getCreateUserId
())
.
append
(
",createUserName:"
).
append
(
getCreateUserName
())
.
append
(
",lastLoginTime:"
).
append
(
getLastLoginTime
())
.
append
(
",lastLoginAddress:"
).
append
(
getLastLoginAddress
())
.
append
(
",lastModPwdTime:"
).
append
(
getLastModPwdTime
())
.
append
(
",lastModPwdAddr:"
).
append
(
getLastModPwdAddr
())
;
return
sb
.
toString
();
return
sb
.
toString
();
}
}
public
void
initAttrValue
(){
public
void
initAttrValue
(){
this
.
loginName
=
null
;
this
.
loginPwd
=
null
;
this
.
loginName
=
""
;
this
.
loginPwd1
=
null
;
this
.
loginPwd2
=
null
;
this
.
loginPwd
=
""
;
this
.
loginPwd3
=
null
;
this
.
loginLimitAddress
=
null
;
this
.
loginLimitAddress
=
""
;
this
.
realName
=
null
;
this
.
mobile
=
null
;
this
.
realName
=
""
;
this
.
phone
=
null
;
this
.
email
=
null
;
this
.
mobile
=
""
;
this
.
qq
=
null
;
this
.
phone
=
""
;
this
.
email
=
""
;
this
.
qq
=
""
;
this
.
userType
=
null
;
this
.
userType
=
null
;
this
.
siteId
=
null
;
this
.
siteIds
=
""
;
this
.
areaCodes
=
""
;
this
.
status
=
1
;
this
.
status
=
1
;
this
.
customerId
=
null
;
this
.
createTime
=
null
;
this
.
createUserName
=
""
;
this
.
createUserId
=
null
;
this
.
createUserName
=
null
;
this
.
lastLoginTime
=
null
;
this
.
lastLoginTime
=
null
;
this
.
lastLoginAddress
=
null
;
this
.
lastModPwdTime
=
null
;
this
.
lastLoginAddress
=
""
;
this
.
lastModPwdAddr
=
null
;
}
}
}
}
\ No newline at end of file
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/user/model/UserEntityExt.java
deleted
100644 → 0
View file @
9a50bbd9
package
com.mortals.xhx.base.system.user.model
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.mortals.framework.model.BaseEntityLong
;
import
lombok.Data
;
import
java.util.List
;
/**
*
* Description:User
* date: 2021-9-26 16:11:48
*/
@Data
public
class
UserEntityExt
extends
BaseEntityLong
{
/**
* 唯一标识
*/
@JSONField
(
serialize
=
false
)
private
String
token
;
/**
* 登录时间
*/
private
Long
loginTime
;
/**
* 过期时间
*/
private
Long
expireTime
;
private
String
siteName
;
private
List
<
Long
>
roleIds
;
private
String
siteCode
;
private
String
oldPassword
;
private
String
newPassword
;
private
String
siteIds
;
}
\ No newline at end of file
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/user/model/UserQuery.java
View file @
ee628cb0
package
com.mortals.xhx.base.system.user.model
;
package
com.mortals.xhx.base.system.user.model
;
import
java.util.List
;
import
java.util.Date
;
import
java.util.List
;
/**
/**
* 用户信息业务查询对象
*
*
*
Description:User
*
@author zxfei
*
date: 2021-9-26 16:11:48
*
@date 2022-07-06
*/
*/
public
class
UserQuery
extends
UserEntity
{
public
class
UserQuery
extends
UserEntity
{
private
static
final
long
serialVersionUID
=
1632643908887L
;
/** 开始 用户ID,主键,自增长 */
/** 开始 用户ID,主键,自增长 */
private
Long
idStart
;
private
Long
idStart
;
...
@@ -19,25 +18,15 @@ public class UserQuery extends UserEntity{
...
@@ -19,25 +18,15 @@ public class UserQuery extends UserEntity{
/** 增加 用户ID,主键,自增长 */
/** 增加 用户ID,主键,自增长 */
private
Long
idIncrement
;
private
Long
idIncrement
;
/** 用户ID,主键,自增长 */
/** 用户ID,主键,自增长
列表
*/
private
List
<
Long
>
idList
;
private
List
<
Long
>
idList
;
/** 登录名 */
/** 登录名 */
private
List
<
String
>
loginNameList
;
private
List
<
String
>
loginNameList
;
/** 登录密码,使用md5双次加密 */
/** 登录密码,使用md5双次加密 */
private
List
<
String
>
loginPwdList
;
private
List
<
String
>
loginPwdList
;
/** 最近一次使用密码,使用md5双次加密 */
private
List
<
String
>
loginPwd1List
;
/** 最近二次使用密码,使用md5双次加密 */
private
List
<
String
>
loginPwd2List
;
/** 最近三次使用密码,使用md5双次加密 */
private
List
<
String
>
loginPwd3List
;
/** 登录限制地址,多个IP地址用逗号分隔,可以使用IP段匹配,如:172.17.*非空:则只能该值内的IP可以登录 */
/** 登录限制地址,多个IP地址用逗号分隔,可以使用IP段匹配,如:172.17.*非空:则只能该值内的IP可以登录 */
private
List
<
String
>
loginLimitAddressList
;
private
List
<
String
>
loginLimitAddressList
;
...
@@ -56,58 +45,42 @@ public class UserQuery extends UserEntity{
...
@@ -56,58 +45,42 @@ public class UserQuery extends UserEntity{
/** QQ号码 */
/** QQ号码 */
private
List
<
String
>
qqList
;
private
List
<
String
>
qqList
;
/** 开始 用户类型
,0:系统用户 1:普通用户 2:工作人员,默认2
*/
/** 开始 用户类型
(0.系统用户,1.普通用户,2.工作人员)
*/
private
Integer
userTypeStart
;
private
Integer
userTypeStart
;
/** 结束 用户类型
,0:系统用户 1:普通用户 2:工作人员,默认2
*/
/** 结束 用户类型
(0.系统用户,1.普通用户,2.工作人员)
*/
private
Integer
userTypeEnd
;
private
Integer
userTypeEnd
;
/** 增加 用户类型
,0:系统用户 1:普通用户 2:工作人员,默认2
*/
/** 增加 用户类型
(0.系统用户,1.普通用户,2.工作人员)
*/
private
Integer
userTypeIncrement
;
private
Integer
userTypeIncrement
;
/** 用户类型
,0:系统用户 1:普通用户 2:工作人员,默认2
*/
/** 用户类型
(0.系统用户,1.普通用户,2.工作人员)列表
*/
private
List
<
Integer
>
userTypeList
;
private
List
<
Integer
>
userTypeList
;
/** 开始 站点id */
private
Long
siteIdStart
;
/** 结束 站点id */
private
Long
siteIdEnd
;
/** 增加 站点id */
private
Long
siteIdIncrement
;
/**
站点id
*/
/**
所属站点id,多个逗号分隔
*/
private
List
<
Long
>
siteId
List
;
private
List
<
String
>
siteIds
List
;
/** 所属区域code,多个逗号分隔 */
private
List
<
String
>
areaCodesList
;
/** 开始 用户状态
,0:停用,1:正常,2:冻结,3:销户,4:离职,默认1
*/
/** 开始 用户状态
(0.停用,1.正常,2.冻结,3.销户,4.离职)
*/
private
Integer
statusStart
;
private
Integer
statusStart
;
/** 结束 用户状态
,0:停用,1:正常,2:冻结,3:销户,4:离职,默认1
*/
/** 结束 用户状态
(0.停用,1.正常,2.冻结,3.销户,4.离职)
*/
private
Integer
statusEnd
;
private
Integer
statusEnd
;
/** 增加 用户状态
,0:停用,1:正常,2:冻结,3:销户,4:离职,默认1
*/
/** 增加 用户状态
(0.停用,1.正常,2.冻结,3.销户,4.离职)
*/
private
Integer
statusIncrement
;
private
Integer
statusIncrement
;
/** 用户状态
,0:停用,1:正常,2:冻结,3:销户,4:离职,默认1
*/
/** 用户状态
(0.停用,1.正常,2.冻结,3.销户,4.离职)列表
*/
private
List
<
Integer
>
statusList
;
private
List
<
Integer
>
statusList
;
/** 开始 客户ID */
private
Long
customerIdStart
;
/** 结束 客户ID */
private
Long
customerIdEnd
;
/** 增加 客户ID */
private
Long
customerIdIncrement
;
/** 客户ID */
private
List
<
Long
>
customerIdList
;
/** 开始 创建时间 */
/** 开始 创建时间 */
private
String
createTimeStart
;
private
String
createTimeStart
;
/** 结束 创建时间 */
/** 结束 创建时间 */
private
String
createTimeEnd
;
private
String
createTimeEnd
;
/** 开始 创建用户 */
/** 开始 创建用户 */
private
Long
createUserIdStart
;
private
Long
createUserIdStart
;
...
@@ -117,12 +90,12 @@ public class UserQuery extends UserEntity{
...
@@ -117,12 +90,12 @@ public class UserQuery extends UserEntity{
/** 增加 创建用户 */
/** 增加 创建用户 */
private
Long
createUserIdIncrement
;
private
Long
createUserIdIncrement
;
/** 创建用户 */
/** 创建用户
列表
*/
private
List
<
Long
>
createUserIdList
;
private
List
<
Long
>
createUserIdList
;
/** 创建用户名称 */
/** 创建用户名称 */
private
List
<
String
>
createUserNameList
;
private
List
<
String
>
createUserNameList
;
/** 开始 最后一次登录时间 */
/** 开始 最后一次登录时间 */
private
String
lastLoginTimeStart
;
private
String
lastLoginTimeStart
;
...
@@ -131,14 +104,6 @@ public class UserQuery extends UserEntity{
...
@@ -131,14 +104,6 @@ public class UserQuery extends UserEntity{
/** 最后一次登录地址 */
/** 最后一次登录地址 */
private
List
<
String
>
lastLoginAddressList
;
private
List
<
String
>
lastLoginAddressList
;
/** 开始 最后修改密码时间 */
private
String
lastModPwdTimeStart
;
/** 结束 最后修改密码时间 */
private
String
lastModPwdTimeEnd
;
/** 最后修改密码地址 */
private
List
<
String
>
lastModPwdAddrList
;
/** OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) */
/** OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) */
private
List
<
UserQuery
>
orConditionList
;
private
List
<
UserQuery
>
orConditionList
;
...
@@ -146,9 +111,7 @@ public class UserQuery extends UserEntity{
...
@@ -146,9 +111,7 @@ public class UserQuery extends UserEntity{
/** AND条件集合,列表项之间是AND,项内容之间是OR,如:(list[0].1 or list[0].2) and (list[1].3 or list[1].4) */
/** AND条件集合,列表项之间是AND,项内容之间是OR,如:(list[0].1 or list[0].2) and (list[1].3 or list[1].4) */
private
List
<
UserQuery
>
andConditionList
;
private
List
<
UserQuery
>
andConditionList
;
public
UserQuery
(){}
public
UserQuery
(){
}
/**
/**
* 获取 开始 用户ID,主键,自增长
* 获取 开始 用户ID,主键,自增长
...
@@ -168,7 +131,7 @@ public class UserQuery extends UserEntity{
...
@@ -168,7 +131,7 @@ public class UserQuery extends UserEntity{
/**
/**
* 获取 结束 用户ID,主键,自增长
* 获取 结束 用户ID,主键,自增长
* @return idEnd
* @return
$
idEnd
*/
*/
public
Long
getIdEnd
(){
public
Long
getIdEnd
(){
return
this
.
idEnd
;
return
this
.
idEnd
;
...
@@ -213,6 +176,7 @@ public class UserQuery extends UserEntity{
...
@@ -213,6 +176,7 @@ public class UserQuery extends UserEntity{
public
void
setIdList
(
List
<
Long
>
idList
){
public
void
setIdList
(
List
<
Long
>
idList
){
this
.
idList
=
idList
;
this
.
idList
=
idList
;
}
}
/**
/**
* 获取 登录名
* 获取 登录名
* @return loginNameList
* @return loginNameList
...
@@ -243,51 +207,6 @@ public class UserQuery extends UserEntity{
...
@@ -243,51 +207,6 @@ public class UserQuery extends UserEntity{
public
void
setLoginPwdList
(
List
<
String
>
loginPwdList
){
public
void
setLoginPwdList
(
List
<
String
>
loginPwdList
){
this
.
loginPwdList
=
loginPwdList
;
this
.
loginPwdList
=
loginPwdList
;
}
}
/**
* 获取 最近一次使用密码,使用md5双次加密
* @return loginPwd1List
*/
public
List
<
String
>
getLoginPwd1List
(){
return
this
.
loginPwd1List
;
}
/**
* 设置 最近一次使用密码,使用md5双次加密
* @param loginPwd1List
*/
public
void
setLoginPwd1List
(
List
<
String
>
loginPwd1List
){
this
.
loginPwd1List
=
loginPwd1List
;
}
/**
* 获取 最近二次使用密码,使用md5双次加密
* @return loginPwd2List
*/
public
List
<
String
>
getLoginPwd2List
(){
return
this
.
loginPwd2List
;
}
/**
* 设置 最近二次使用密码,使用md5双次加密
* @param loginPwd2List
*/
public
void
setLoginPwd2List
(
List
<
String
>
loginPwd2List
){
this
.
loginPwd2List
=
loginPwd2List
;
}
/**
* 获取 最近三次使用密码,使用md5双次加密
* @return loginPwd3List
*/
public
List
<
String
>
getLoginPwd3List
(){
return
this
.
loginPwd3List
;
}
/**
* 设置 最近三次使用密码,使用md5双次加密
* @param loginPwd3List
*/
public
void
setLoginPwd3List
(
List
<
String
>
loginPwd3List
){
this
.
loginPwd3List
=
loginPwd3List
;
}
/**
/**
* 获取 登录限制地址,多个IP地址用逗号分隔,可以使用IP段匹配,如:172.17.*非空:则只能该值内的IP可以登录
* 获取 登录限制地址,多个IP地址用逗号分隔,可以使用IP段匹配,如:172.17.*非空:则只能该值内的IP可以登录
* @return loginLimitAddressList
* @return loginLimitAddressList
...
@@ -379,7 +298,7 @@ public class UserQuery extends UserEntity{
...
@@ -379,7 +298,7 @@ public class UserQuery extends UserEntity{
this
.
qqList
=
qqList
;
this
.
qqList
=
qqList
;
}
}
/**
/**
* 获取 开始 用户类型
,0:系统用户 1:普通用户 2:工作人员,默认2
* 获取 开始 用户类型
(0.系统用户,1.普通用户,2.工作人员)
* @return userTypeStart
* @return userTypeStart
*/
*/
public
Integer
getUserTypeStart
(){
public
Integer
getUserTypeStart
(){
...
@@ -387,7 +306,7 @@ public class UserQuery extends UserEntity{
...
@@ -387,7 +306,7 @@ public class UserQuery extends UserEntity{
}
}
/**
/**
* 设置 开始 用户类型
,0:系统用户 1:普通用户 2:工作人员,默认2
* 设置 开始 用户类型
(0.系统用户,1.普通用户,2.工作人员)
* @param userTypeStart
* @param userTypeStart
*/
*/
public
void
setUserTypeStart
(
Integer
userTypeStart
){
public
void
setUserTypeStart
(
Integer
userTypeStart
){
...
@@ -395,15 +314,15 @@ public class UserQuery extends UserEntity{
...
@@ -395,15 +314,15 @@ public class UserQuery extends UserEntity{
}
}
/**
/**
* 获取 结束 用户类型
,0:系统用户 1:普通用户 2:工作人员,默认2
* 获取 结束 用户类型
(0.系统用户,1.普通用户,2.工作人员)
* @return userTypeEnd
* @return
$
userTypeEnd
*/
*/
public
Integer
getUserTypeEnd
(){
public
Integer
getUserTypeEnd
(){
return
this
.
userTypeEnd
;
return
this
.
userTypeEnd
;
}
}
/**
/**
* 设置 结束 用户类型
,0:系统用户 1:普通用户 2:工作人员,默认2
* 设置 结束 用户类型
(0.系统用户,1.普通用户,2.工作人员)
* @param userTypeEnd
* @param userTypeEnd
*/
*/
public
void
setUserTypeEnd
(
Integer
userTypeEnd
){
public
void
setUserTypeEnd
(
Integer
userTypeEnd
){
...
@@ -411,7 +330,7 @@ public class UserQuery extends UserEntity{
...
@@ -411,7 +330,7 @@ public class UserQuery extends UserEntity{
}
}
/**
/**
* 获取 增加 用户类型
,0:系统用户 1:普通用户 2:工作人员,默认2
* 获取 增加 用户类型
(0.系统用户,1.普通用户,2.工作人员)
* @return userTypeIncrement
* @return userTypeIncrement
*/
*/
public
Integer
getUserTypeIncrement
(){
public
Integer
getUserTypeIncrement
(){
...
@@ -419,7 +338,7 @@ public class UserQuery extends UserEntity{
...
@@ -419,7 +338,7 @@ public class UserQuery extends UserEntity{
}
}
/**
/**
* 设置 增加 用户类型
,0:系统用户 1:普通用户 2:工作人员,默认2
* 设置 增加 用户类型
(0.系统用户,1.普通用户,2.工作人员)
* @param userTypeIncrement
* @param userTypeIncrement
*/
*/
public
void
setUserTypeIncrement
(
Integer
userTypeIncrement
){
public
void
setUserTypeIncrement
(
Integer
userTypeIncrement
){
...
@@ -427,7 +346,7 @@ public class UserQuery extends UserEntity{
...
@@ -427,7 +346,7 @@ public class UserQuery extends UserEntity{
}
}
/**
/**
* 获取 用户类型
,0:系统用户 1:普通用户 2:工作人员,默认2
* 获取 用户类型
(0.系统用户,1.普通用户,2.工作人员)
* @return userTypeList
* @return userTypeList
*/
*/
public
List
<
Integer
>
getUserTypeList
(){
public
List
<
Integer
>
getUserTypeList
(){
...
@@ -435,77 +354,45 @@ public class UserQuery extends UserEntity{
...
@@ -435,77 +354,45 @@ public class UserQuery extends UserEntity{
}
}
/**
/**
* 设置 用户类型
,0:系统用户 1:普通用户 2:工作人员,默认2
* 设置 用户类型
(0.系统用户,1.普通用户,2.工作人员)
* @param userTypeList
* @param userTypeList
*/
*/
public
void
setUserTypeList
(
List
<
Integer
>
userTypeList
){
public
void
setUserTypeList
(
List
<
Integer
>
userTypeList
){
this
.
userTypeList
=
userTypeList
;
this
.
userTypeList
=
userTypeList
;
}
}
/**
* 获取 开始 站点id
* @return siteIdStart
*/
public
Long
getSiteIdStart
(){
return
this
.
siteIdStart
;
}
/**
* 设置 开始 站点id
* @param siteIdStart
*/
public
void
setSiteIdStart
(
Long
siteIdStart
){
this
.
siteIdStart
=
siteIdStart
;
}
/**
* 获取 结束 站点id
* @return siteIdEnd
*/
public
Long
getSiteIdEnd
(){
return
this
.
siteIdEnd
;
}
/**
* 设置 结束 站点id
* @param siteIdEnd
*/
public
void
setSiteIdEnd
(
Long
siteIdEnd
){
this
.
siteIdEnd
=
siteIdEnd
;
}
/**
/**
* 获取
增加 站点id
* 获取
所属站点id,多个逗号分隔
* @return siteId
Incremen
t
* @return siteId
sLis
t
*/
*/
public
L
ong
getSiteIdIncremen
t
(){
public
L
ist
<
String
>
getSiteIdsLis
t
(){
return
this
.
siteId
Incremen
t
;
return
this
.
siteId
sLis
t
;
}
}
/**
/**
* 设置
增加 站点id
* 设置
所属站点id,多个逗号分隔
* @param siteId
Incremen
t
* @param siteId
sLis
t
*/
*/
public
void
setSiteId
Increment
(
Long
siteIdIncremen
t
){
public
void
setSiteId
sList
(
List
<
String
>
siteIdsLis
t
){
this
.
siteId
Increment
=
siteIdIncremen
t
;
this
.
siteId
sList
=
siteIdsLis
t
;
}
}
/**
/**
* 获取
站点id
* 获取
所属区域code,多个逗号分隔
* @return
siteId
List
* @return
areaCodes
List
*/
*/
public
List
<
Long
>
getSiteId
List
(){
public
List
<
String
>
getAreaCodes
List
(){
return
this
.
siteId
List
;
return
this
.
areaCodes
List
;
}
}
/**
/**
* 设置
站点id
* 设置
所属区域code,多个逗号分隔
* @param
siteId
List
* @param
areaCodes
List
*/
*/
public
void
set
SiteIdList
(
List
<
Long
>
siteId
List
){
public
void
set
AreaCodesList
(
List
<
String
>
areaCodes
List
){
this
.
siteIdList
=
siteId
List
;
this
.
areaCodesList
=
areaCodes
List
;
}
}
/**
/**
* 获取 开始 用户状态
,0:停用,1:正常,2:冻结,3:销户,4:离职,默认1
* 获取 开始 用户状态
(0.停用,1.正常,2.冻结,3.销户,4.离职)
* @return statusStart
* @return statusStart
*/
*/
public
Integer
getStatusStart
(){
public
Integer
getStatusStart
(){
...
@@ -513,7 +400,7 @@ public class UserQuery extends UserEntity{
...
@@ -513,7 +400,7 @@ public class UserQuery extends UserEntity{
}
}
/**
/**
* 设置 开始 用户状态
,0:停用,1:正常,2:冻结,3:销户,4:离职,默认1
* 设置 开始 用户状态
(0.停用,1.正常,2.冻结,3.销户,4.离职)
* @param statusStart
* @param statusStart
*/
*/
public
void
setStatusStart
(
Integer
statusStart
){
public
void
setStatusStart
(
Integer
statusStart
){
...
@@ -521,15 +408,15 @@ public class UserQuery extends UserEntity{
...
@@ -521,15 +408,15 @@ public class UserQuery extends UserEntity{
}
}
/**
/**
* 获取 结束 用户状态
,0:停用,1:正常,2:冻结,3:销户,4:离职,默认1
* 获取 结束 用户状态
(0.停用,1.正常,2.冻结,3.销户,4.离职)
* @return statusEnd
* @return
$
statusEnd
*/
*/
public
Integer
getStatusEnd
(){
public
Integer
getStatusEnd
(){
return
this
.
statusEnd
;
return
this
.
statusEnd
;
}
}
/**
/**
* 设置 结束 用户状态
,0:停用,1:正常,2:冻结,3:销户,4:离职,默认1
* 设置 结束 用户状态
(0.停用,1.正常,2.冻结,3.销户,4.离职)
* @param statusEnd
* @param statusEnd
*/
*/
public
void
setStatusEnd
(
Integer
statusEnd
){
public
void
setStatusEnd
(
Integer
statusEnd
){
...
@@ -537,7 +424,7 @@ public class UserQuery extends UserEntity{
...
@@ -537,7 +424,7 @@ public class UserQuery extends UserEntity{
}
}
/**
/**
* 获取 增加 用户状态
,0:停用,1:正常,2:冻结,3:销户,4:离职,默认1
* 获取 增加 用户状态
(0.停用,1.正常,2.冻结,3.销户,4.离职)
* @return statusIncrement
* @return statusIncrement
*/
*/
public
Integer
getStatusIncrement
(){
public
Integer
getStatusIncrement
(){
...
@@ -545,7 +432,7 @@ public class UserQuery extends UserEntity{
...
@@ -545,7 +432,7 @@ public class UserQuery extends UserEntity{
}
}
/**
/**
* 设置 增加 用户状态
,0:停用,1:正常,2:冻结,3:销户,4:离职,默认1
* 设置 增加 用户状态
(0.停用,1.正常,2.冻结,3.销户,4.离职)
* @param statusIncrement
* @param statusIncrement
*/
*/
public
void
setStatusIncrement
(
Integer
statusIncrement
){
public
void
setStatusIncrement
(
Integer
statusIncrement
){
...
@@ -553,7 +440,7 @@ public class UserQuery extends UserEntity{
...
@@ -553,7 +440,7 @@ public class UserQuery extends UserEntity{
}
}
/**
/**
* 获取 用户状态
,0:停用,1:正常,2:冻结,3:销户,4:离职,默认1
* 获取 用户状态
(0.停用,1.正常,2.冻结,3.销户,4.离职)
* @return statusList
* @return statusList
*/
*/
public
List
<
Integer
>
getStatusList
(){
public
List
<
Integer
>
getStatusList
(){
...
@@ -561,75 +448,13 @@ public class UserQuery extends UserEntity{
...
@@ -561,75 +448,13 @@ public class UserQuery extends UserEntity{
}
}
/**
/**
* 设置 用户状态
,0:停用,1:正常,2:冻结,3:销户,4:离职,默认1
* 设置 用户状态
(0.停用,1.正常,2.冻结,3.销户,4.离职)
* @param statusList
* @param statusList
*/
*/
public
void
setStatusList
(
List
<
Integer
>
statusList
){
public
void
setStatusList
(
List
<
Integer
>
statusList
){
this
.
statusList
=
statusList
;
this
.
statusList
=
statusList
;
}
}
/**
* 获取 开始 客户ID
* @return customerIdStart
*/
public
Long
getCustomerIdStart
(){
return
this
.
customerIdStart
;
}
/**
* 设置 开始 客户ID
* @param customerIdStart
*/
public
void
setCustomerIdStart
(
Long
customerIdStart
){
this
.
customerIdStart
=
customerIdStart
;
}
/**
* 获取 结束 客户ID
* @return customerIdEnd
*/
public
Long
getCustomerIdEnd
(){
return
this
.
customerIdEnd
;
}
/**
* 设置 结束 客户ID
* @param customerIdEnd
*/
public
void
setCustomerIdEnd
(
Long
customerIdEnd
){
this
.
customerIdEnd
=
customerIdEnd
;
}
/**
* 获取 增加 客户ID
* @return customerIdIncrement
*/
public
Long
getCustomerIdIncrement
(){
return
this
.
customerIdIncrement
;
}
/**
* 设置 增加 客户ID
* @param customerIdIncrement
*/
public
void
setCustomerIdIncrement
(
Long
customerIdIncrement
){
this
.
customerIdIncrement
=
customerIdIncrement
;
}
/**
* 获取 客户ID
* @return customerIdList
*/
public
List
<
Long
>
getCustomerIdList
(){
return
this
.
customerIdList
;
}
/**
* 设置 客户ID
* @param customerIdList
*/
public
void
setCustomerIdList
(
List
<
Long
>
customerIdList
){
this
.
customerIdList
=
customerIdList
;
}
/**
/**
* 获取 开始 创建时间
* 获取 开始 创建时间
* @return createTimeStart
* @return createTimeStart
...
@@ -661,6 +486,7 @@ public class UserQuery extends UserEntity{
...
@@ -661,6 +486,7 @@ public class UserQuery extends UserEntity{
public
void
setCreateTimeEnd
(
String
createTimeEnd
){
public
void
setCreateTimeEnd
(
String
createTimeEnd
){
this
.
createTimeEnd
=
createTimeEnd
;
this
.
createTimeEnd
=
createTimeEnd
;
}
}
/**
/**
* 获取 开始 创建用户
* 获取 开始 创建用户
* @return createUserIdStart
* @return createUserIdStart
...
@@ -679,7 +505,7 @@ public class UserQuery extends UserEntity{
...
@@ -679,7 +505,7 @@ public class UserQuery extends UserEntity{
/**
/**
* 获取 结束 创建用户
* 获取 结束 创建用户
* @return createUserIdEnd
* @return
$
createUserIdEnd
*/
*/
public
Long
getCreateUserIdEnd
(){
public
Long
getCreateUserIdEnd
(){
return
this
.
createUserIdEnd
;
return
this
.
createUserIdEnd
;
...
@@ -724,6 +550,7 @@ public class UserQuery extends UserEntity{
...
@@ -724,6 +550,7 @@ public class UserQuery extends UserEntity{
public
void
setCreateUserIdList
(
List
<
Long
>
createUserIdList
){
public
void
setCreateUserIdList
(
List
<
Long
>
createUserIdList
){
this
.
createUserIdList
=
createUserIdList
;
this
.
createUserIdList
=
createUserIdList
;
}
}
/**
/**
* 获取 创建用户名称
* 获取 创建用户名称
* @return createUserNameList
* @return createUserNameList
...
@@ -770,6 +597,7 @@ public class UserQuery extends UserEntity{
...
@@ -770,6 +597,7 @@ public class UserQuery extends UserEntity{
public
void
setLastLoginTimeEnd
(
String
lastLoginTimeEnd
){
public
void
setLastLoginTimeEnd
(
String
lastLoginTimeEnd
){
this
.
lastLoginTimeEnd
=
lastLoginTimeEnd
;
this
.
lastLoginTimeEnd
=
lastLoginTimeEnd
;
}
}
/**
/**
* 获取 最后一次登录地址
* 获取 最后一次登录地址
* @return lastLoginAddressList
* @return lastLoginAddressList
...
@@ -785,54 +613,6 @@ public class UserQuery extends UserEntity{
...
@@ -785,54 +613,6 @@ public class UserQuery extends UserEntity{
public
void
setLastLoginAddressList
(
List
<
String
>
lastLoginAddressList
){
public
void
setLastLoginAddressList
(
List
<
String
>
lastLoginAddressList
){
this
.
lastLoginAddressList
=
lastLoginAddressList
;
this
.
lastLoginAddressList
=
lastLoginAddressList
;
}
}
/**
* 获取 开始 最后修改密码时间
* @return lastModPwdTimeStart
*/
public
String
getLastModPwdTimeStart
(){
return
this
.
lastModPwdTimeStart
;
}
/**
* 设置 开始 最后修改密码时间
* @param lastModPwdTimeStart
*/
public
void
setLastModPwdTimeStart
(
String
lastModPwdTimeStart
){
this
.
lastModPwdTimeStart
=
lastModPwdTimeStart
;
}
/**
* 获取 结束 最后修改密码时间
* @return lastModPwdTimeEnd
*/
public
String
getLastModPwdTimeEnd
(){
return
this
.
lastModPwdTimeEnd
;
}
/**
* 设置 结束 最后修改密码时间
* @param lastModPwdTimeEnd
*/
public
void
setLastModPwdTimeEnd
(
String
lastModPwdTimeEnd
){
this
.
lastModPwdTimeEnd
=
lastModPwdTimeEnd
;
}
/**
* 获取 最后修改密码地址
* @return lastModPwdAddrList
*/
public
List
<
String
>
getLastModPwdAddrList
(){
return
this
.
lastModPwdAddrList
;
}
/**
* 设置 最后修改密码地址
* @param lastModPwdAddrList
*/
public
void
setLastModPwdAddrList
(
List
<
String
>
lastModPwdAddrList
){
this
.
lastModPwdAddrList
=
lastModPwdAddrList
;
}
/**
/**
* 设置 用户ID,主键,自增长
* 设置 用户ID,主键,自增长
* @param id
* @param id
...
@@ -877,6 +657,8 @@ public class UserQuery extends UserEntity{
...
@@ -877,6 +657,8 @@ public class UserQuery extends UserEntity{
this
.
idList
=
idList
;
this
.
idList
=
idList
;
return
this
;
return
this
;
}
}
/**
/**
* 设置 登录名
* 设置 登录名
* @param loginName
* @param loginName
...
@@ -886,7 +668,6 @@ public class UserQuery extends UserEntity{
...
@@ -886,7 +668,6 @@ public class UserQuery extends UserEntity{
return
this
;
return
this
;
}
}
/**
/**
* 设置 登录名
* 设置 登录名
* @param loginNameList
* @param loginNameList
...
@@ -895,6 +676,8 @@ public class UserQuery extends UserEntity{
...
@@ -895,6 +676,8 @@ public class UserQuery extends UserEntity{
this
.
loginNameList
=
loginNameList
;
this
.
loginNameList
=
loginNameList
;
return
this
;
return
this
;
}
}
/**
/**
* 设置 登录密码,使用md5双次加密
* 设置 登录密码,使用md5双次加密
* @param loginPwd
* @param loginPwd
...
@@ -904,7 +687,6 @@ public class UserQuery extends UserEntity{
...
@@ -904,7 +687,6 @@ public class UserQuery extends UserEntity{
return
this
;
return
this
;
}
}
/**
/**
* 设置 登录密码,使用md5双次加密
* 设置 登录密码,使用md5双次加密
* @param loginPwdList
* @param loginPwdList
...
@@ -913,60 +695,8 @@ public class UserQuery extends UserEntity{
...
@@ -913,60 +695,8 @@ public class UserQuery extends UserEntity{
this
.
loginPwdList
=
loginPwdList
;
this
.
loginPwdList
=
loginPwdList
;
return
this
;
return
this
;
}
}
/**
* 设置 最近一次使用密码,使用md5双次加密
* @param loginPwd1
*/
public
UserQuery
loginPwd1
(
String
loginPwd1
){
setLoginPwd1
(
loginPwd1
);
return
this
;
}
/**
* 设置 最近一次使用密码,使用md5双次加密
* @param loginPwd1List
*/
public
UserQuery
loginPwd1List
(
List
<
String
>
loginPwd1List
){
this
.
loginPwd1List
=
loginPwd1List
;
return
this
;
}
/**
* 设置 最近二次使用密码,使用md5双次加密
* @param loginPwd2
*/
public
UserQuery
loginPwd2
(
String
loginPwd2
){
setLoginPwd2
(
loginPwd2
);
return
this
;
}
/**
* 设置 最近二次使用密码,使用md5双次加密
* @param loginPwd2List
*/
public
UserQuery
loginPwd2List
(
List
<
String
>
loginPwd2List
){
this
.
loginPwd2List
=
loginPwd2List
;
return
this
;
}
/**
* 设置 最近三次使用密码,使用md5双次加密
* @param loginPwd3
*/
public
UserQuery
loginPwd3
(
String
loginPwd3
){
setLoginPwd3
(
loginPwd3
);
return
this
;
}
/**
* 设置 最近三次使用密码,使用md5双次加密
* @param loginPwd3List
*/
public
UserQuery
loginPwd3List
(
List
<
String
>
loginPwd3List
){
this
.
loginPwd3List
=
loginPwd3List
;
return
this
;
}
/**
/**
* 设置 登录限制地址,多个IP地址用逗号分隔,可以使用IP段匹配,如:172.17.*非空:则只能该值内的IP可以登录
* 设置 登录限制地址,多个IP地址用逗号分隔,可以使用IP段匹配,如:172.17.*非空:则只能该值内的IP可以登录
* @param loginLimitAddress
* @param loginLimitAddress
...
@@ -976,7 +706,6 @@ public class UserQuery extends UserEntity{
...
@@ -976,7 +706,6 @@ public class UserQuery extends UserEntity{
return
this
;
return
this
;
}
}
/**
/**
* 设置 登录限制地址,多个IP地址用逗号分隔,可以使用IP段匹配,如:172.17.*非空:则只能该值内的IP可以登录
* 设置 登录限制地址,多个IP地址用逗号分隔,可以使用IP段匹配,如:172.17.*非空:则只能该值内的IP可以登录
* @param loginLimitAddressList
* @param loginLimitAddressList
...
@@ -985,6 +714,8 @@ public class UserQuery extends UserEntity{
...
@@ -985,6 +714,8 @@ public class UserQuery extends UserEntity{
this
.
loginLimitAddressList
=
loginLimitAddressList
;
this
.
loginLimitAddressList
=
loginLimitAddressList
;
return
this
;
return
this
;
}
}
/**
/**
* 设置 用户名
* 设置 用户名
* @param realName
* @param realName
...
@@ -994,7 +725,6 @@ public class UserQuery extends UserEntity{
...
@@ -994,7 +725,6 @@ public class UserQuery extends UserEntity{
return
this
;
return
this
;
}
}
/**
/**
* 设置 用户名
* 设置 用户名
* @param realNameList
* @param realNameList
...
@@ -1003,6 +733,8 @@ public class UserQuery extends UserEntity{
...
@@ -1003,6 +733,8 @@ public class UserQuery extends UserEntity{
this
.
realNameList
=
realNameList
;
this
.
realNameList
=
realNameList
;
return
this
;
return
this
;
}
}
/**
/**
* 设置 用户手机号
* 设置 用户手机号
* @param mobile
* @param mobile
...
@@ -1012,7 +744,6 @@ public class UserQuery extends UserEntity{
...
@@ -1012,7 +744,6 @@ public class UserQuery extends UserEntity{
return
this
;
return
this
;
}
}
/**
/**
* 设置 用户手机号
* 设置 用户手机号
* @param mobileList
* @param mobileList
...
@@ -1021,6 +752,8 @@ public class UserQuery extends UserEntity{
...
@@ -1021,6 +752,8 @@ public class UserQuery extends UserEntity{
this
.
mobileList
=
mobileList
;
this
.
mobileList
=
mobileList
;
return
this
;
return
this
;
}
}
/**
/**
* 设置 用户联系电话
* 设置 用户联系电话
* @param phone
* @param phone
...
@@ -1030,7 +763,6 @@ public class UserQuery extends UserEntity{
...
@@ -1030,7 +763,6 @@ public class UserQuery extends UserEntity{
return
this
;
return
this
;
}
}
/**
/**
* 设置 用户联系电话
* 设置 用户联系电话
* @param phoneList
* @param phoneList
...
@@ -1039,6 +771,8 @@ public class UserQuery extends UserEntity{
...
@@ -1039,6 +771,8 @@ public class UserQuery extends UserEntity{
this
.
phoneList
=
phoneList
;
this
.
phoneList
=
phoneList
;
return
this
;
return
this
;
}
}
/**
/**
* 设置 用户邮箱
* 设置 用户邮箱
* @param email
* @param email
...
@@ -1048,7 +782,6 @@ public class UserQuery extends UserEntity{
...
@@ -1048,7 +782,6 @@ public class UserQuery extends UserEntity{
return
this
;
return
this
;
}
}
/**
/**
* 设置 用户邮箱
* 设置 用户邮箱
* @param emailList
* @param emailList
...
@@ -1057,6 +790,8 @@ public class UserQuery extends UserEntity{
...
@@ -1057,6 +790,8 @@ public class UserQuery extends UserEntity{
this
.
emailList
=
emailList
;
this
.
emailList
=
emailList
;
return
this
;
return
this
;
}
}
/**
/**
* 设置 QQ号码
* 设置 QQ号码
* @param qq
* @param qq
...
@@ -1066,7 +801,6 @@ public class UserQuery extends UserEntity{
...
@@ -1066,7 +801,6 @@ public class UserQuery extends UserEntity{
return
this
;
return
this
;
}
}
/**
/**
* 设置 QQ号码
* 设置 QQ号码
* @param qqList
* @param qqList
...
@@ -1077,7 +811,7 @@ public class UserQuery extends UserEntity{
...
@@ -1077,7 +811,7 @@ public class UserQuery extends UserEntity{
}
}
/**
/**
* 设置 用户类型
,0:系统用户 1:普通用户 2:工作人员,默认2
* 设置 用户类型
(0.系统用户,1.普通用户,2.工作人员)
* @param userType
* @param userType
*/
*/
public
UserQuery
userType
(
Integer
userType
){
public
UserQuery
userType
(
Integer
userType
){
...
@@ -1086,7 +820,7 @@ public class UserQuery extends UserEntity{
...
@@ -1086,7 +820,7 @@ public class UserQuery extends UserEntity{
}
}
/**
/**
* 设置 开始 用户类型
,0:系统用户 1:普通用户 2:工作人员,默认2
* 设置 开始 用户类型
(0.系统用户,1.普通用户,2.工作人员)
* @param userTypeStart
* @param userTypeStart
*/
*/
public
UserQuery
userTypeStart
(
Integer
userTypeStart
){
public
UserQuery
userTypeStart
(
Integer
userTypeStart
){
...
@@ -1094,9 +828,8 @@ public class UserQuery extends UserEntity{
...
@@ -1094,9 +828,8 @@ public class UserQuery extends UserEntity{
return
this
;
return
this
;
}
}
/**
/**
* 设置 结束 用户类型
,0:系统用户 1:普通用户 2:工作人员,默认2
* 设置 结束 用户类型
(0.系统用户,1.普通用户,2.工作人员)
* @param userTypeEnd
* @param userTypeEnd
*/
*/
public
UserQuery
userTypeEnd
(
Integer
userTypeEnd
){
public
UserQuery
userTypeEnd
(
Integer
userTypeEnd
){
...
@@ -1104,9 +837,8 @@ public class UserQuery extends UserEntity{
...
@@ -1104,9 +837,8 @@ public class UserQuery extends UserEntity{
return
this
;
return
this
;
}
}
/**
/**
* 设置 增加 用户类型
,0:系统用户 1:普通用户 2:工作人员,默认2
* 设置 增加 用户类型
(0.系统用户,1.普通用户,2.工作人员)
* @param userTypeIncrement
* @param userTypeIncrement
*/
*/
public
UserQuery
userTypeIncrement
(
Integer
userTypeIncrement
){
public
UserQuery
userTypeIncrement
(
Integer
userTypeIncrement
){
...
@@ -1114,9 +846,8 @@ public class UserQuery extends UserEntity{
...
@@ -1114,9 +846,8 @@ public class UserQuery extends UserEntity{
return
this
;
return
this
;
}
}
/**
/**
* 设置 用户类型
,0:系统用户 1:普通用户 2:工作人员,默认2
* 设置 用户类型
(0.系统用户,1.普通用户,2.工作人员)
* @param userTypeList
* @param userTypeList
*/
*/
public
UserQuery
userTypeList
(
List
<
Integer
>
userTypeList
){
public
UserQuery
userTypeList
(
List
<
Integer
>
userTypeList
){
...
@@ -1124,53 +855,46 @@ public class UserQuery extends UserEntity{
...
@@ -1124,53 +855,46 @@ public class UserQuery extends UserEntity{
return
this
;
return
this
;
}
}
/**
* 设置 站点id
* @param siteId
*/
public
UserQuery
siteId
(
Long
siteId
){
setSiteId
(
siteId
);
return
this
;
}
/**
/**
* 设置
开始 站点id
* 设置
所属站点id,多个逗号分隔
* @param siteId
Start
* @param siteId
s
*/
*/
public
UserQuery
siteId
Start
(
Long
siteIdStart
){
public
UserQuery
siteId
s
(
String
siteIds
){
this
.
siteIdStart
=
siteIdStart
;
setSiteIds
(
siteIds
)
;
return
this
;
return
this
;
}
}
/**
/**
* 设置
结束 站点id
* 设置
所属站点id,多个逗号分隔
* @param siteId
End
* @param siteId
sList
*/
*/
public
UserQuery
siteId
End
(
Long
siteIdEnd
){
public
UserQuery
siteId
sList
(
List
<
String
>
siteIdsList
){
this
.
siteId
End
=
siteIdEnd
;
this
.
siteId
sList
=
siteIdsList
;
return
this
;
return
this
;
}
}
/**
/**
* 设置
增加 站点id
* 设置
所属区域code,多个逗号分隔
* @param
siteIdIncrement
* @param
areaCodes
*/
*/
public
UserQuery
siteIdIncrement
(
Long
siteIdIncrement
){
public
UserQuery
areaCodes
(
String
areaCodes
){
this
.
siteIdIncrement
=
siteIdIncrement
;
setAreaCodes
(
areaCodes
)
;
return
this
;
return
this
;
}
}
/**
/**
* 设置
站点id
* 设置
所属区域code,多个逗号分隔
* @param
siteId
List
* @param
areaCodes
List
*/
*/
public
UserQuery
siteIdList
(
List
<
Long
>
siteId
List
){
public
UserQuery
areaCodesList
(
List
<
String
>
areaCodes
List
){
this
.
siteIdList
=
siteId
List
;
this
.
areaCodesList
=
areaCodes
List
;
return
this
;
return
this
;
}
}
/**
/**
* 设置 用户状态
,0:停用,1:正常,2:冻结,3:销户,4:离职,默认1
* 设置 用户状态
(0.停用,1.正常,2.冻结,3.销户,4.离职)
* @param status
* @param status
*/
*/
public
UserQuery
status
(
Integer
status
){
public
UserQuery
status
(
Integer
status
){
...
@@ -1179,7 +903,7 @@ public class UserQuery extends UserEntity{
...
@@ -1179,7 +903,7 @@ public class UserQuery extends UserEntity{
}
}
/**
/**
* 设置 开始 用户状态
,0:停用,1:正常,2:冻结,3:销户,4:离职,默认1
* 设置 开始 用户状态
(0.停用,1.正常,2.冻结,3.销户,4.离职)
* @param statusStart
* @param statusStart
*/
*/
public
UserQuery
statusStart
(
Integer
statusStart
){
public
UserQuery
statusStart
(
Integer
statusStart
){
...
@@ -1187,9 +911,8 @@ public class UserQuery extends UserEntity{
...
@@ -1187,9 +911,8 @@ public class UserQuery extends UserEntity{
return
this
;
return
this
;
}
}
/**
/**
* 设置 结束 用户状态
,0:停用,1:正常,2:冻结,3:销户,4:离职,默认1
* 设置 结束 用户状态
(0.停用,1.正常,2.冻结,3.销户,4.离职)
* @param statusEnd
* @param statusEnd
*/
*/
public
UserQuery
statusEnd
(
Integer
statusEnd
){
public
UserQuery
statusEnd
(
Integer
statusEnd
){
...
@@ -1197,9 +920,8 @@ public class UserQuery extends UserEntity{
...
@@ -1197,9 +920,8 @@ public class UserQuery extends UserEntity{
return
this
;
return
this
;
}
}
/**
/**
* 设置 增加 用户状态
,0:停用,1:正常,2:冻结,3:销户,4:离职,默认1
* 设置 增加 用户状态
(0.停用,1.正常,2.冻结,3.销户,4.离职)
* @param statusIncrement
* @param statusIncrement
*/
*/
public
UserQuery
statusIncrement
(
Integer
statusIncrement
){
public
UserQuery
statusIncrement
(
Integer
statusIncrement
){
...
@@ -1207,9 +929,8 @@ public class UserQuery extends UserEntity{
...
@@ -1207,9 +929,8 @@ public class UserQuery extends UserEntity{
return
this
;
return
this
;
}
}
/**
/**
* 设置 用户状态
,0:停用,1:正常,2:冻结,3:销户,4:离职,默认1
* 设置 用户状态
(0.停用,1.正常,2.冻结,3.销户,4.离职)
* @param statusList
* @param statusList
*/
*/
public
UserQuery
statusList
(
List
<
Integer
>
statusList
){
public
UserQuery
statusList
(
List
<
Integer
>
statusList
){
...
@@ -1217,69 +938,6 @@ public class UserQuery extends UserEntity{
...
@@ -1217,69 +938,6 @@ public class UserQuery extends UserEntity{
return
this
;
return
this
;
}
}
/**
* 设置 客户ID
* @param customerId
*/
public
UserQuery
customerId
(
Long
customerId
){
setCustomerId
(
customerId
);
return
this
;
}
/**
* 设置 开始 客户ID
* @param customerIdStart
*/
public
UserQuery
customerIdStart
(
Long
customerIdStart
){
this
.
customerIdStart
=
customerIdStart
;
return
this
;
}
/**
* 设置 结束 客户ID
* @param customerIdEnd
*/
public
UserQuery
customerIdEnd
(
Long
customerIdEnd
){
this
.
customerIdEnd
=
customerIdEnd
;
return
this
;
}
/**
* 设置 增加 客户ID
* @param customerIdIncrement
*/
public
UserQuery
customerIdIncrement
(
Long
customerIdIncrement
){
this
.
customerIdIncrement
=
customerIdIncrement
;
return
this
;
}
/**
* 设置 客户ID
* @param customerIdList
*/
public
UserQuery
customerIdList
(
List
<
Long
>
customerIdList
){
this
.
customerIdList
=
customerIdList
;
return
this
;
}
/**
* 设置 开始 创建时间
* @param createTimeStart
*/
public
UserQuery
createTimeStart
(
String
createTimeStart
){
this
.
createTimeStart
=
createTimeStart
;
return
this
;
}
/**
* 设置 结束 创建时间
* @param createTimeEnd
*/
public
UserQuery
createTimeEnd
(
String
createTimeEnd
){
this
.
createTimeEnd
=
createTimeEnd
;
return
this
;
}
/**
/**
* 设置 创建用户
* 设置 创建用户
...
@@ -1325,6 +983,8 @@ public class UserQuery extends UserEntity{
...
@@ -1325,6 +983,8 @@ public class UserQuery extends UserEntity{
this
.
createUserIdList
=
createUserIdList
;
this
.
createUserIdList
=
createUserIdList
;
return
this
;
return
this
;
}
}
/**
/**
* 设置 创建用户名称
* 设置 创建用户名称
* @param createUserName
* @param createUserName
...
@@ -1334,7 +994,6 @@ public class UserQuery extends UserEntity{
...
@@ -1334,7 +994,6 @@ public class UserQuery extends UserEntity{
return
this
;
return
this
;
}
}
/**
/**
* 设置 创建用户名称
* 设置 创建用户名称
* @param createUserNameList
* @param createUserNameList
...
@@ -1344,24 +1003,8 @@ public class UserQuery extends UserEntity{
...
@@ -1344,24 +1003,8 @@ public class UserQuery extends UserEntity{
return
this
;
return
this
;
}
}
/**
* 设置 开始 最后一次登录时间
* @param lastLoginTimeStart
*/
public
UserQuery
lastLoginTimeStart
(
String
lastLoginTimeStart
){
this
.
lastLoginTimeStart
=
lastLoginTimeStart
;
return
this
;
}
/**
* 设置 结束 最后一次登录时间
* @param lastLoginTimeEnd
*/
public
UserQuery
lastLoginTimeEnd
(
String
lastLoginTimeEnd
){
this
.
lastLoginTimeEnd
=
lastLoginTimeEnd
;
return
this
;
}
/**
/**
* 设置 最后一次登录地址
* 设置 最后一次登录地址
* @param lastLoginAddress
* @param lastLoginAddress
...
@@ -1371,7 +1014,6 @@ public class UserQuery extends UserEntity{
...
@@ -1371,7 +1014,6 @@ public class UserQuery extends UserEntity{
return
this
;
return
this
;
}
}
/**
/**
* 设置 最后一次登录地址
* 设置 最后一次登录地址
* @param lastLoginAddressList
* @param lastLoginAddressList
...
@@ -1381,44 +1023,6 @@ public class UserQuery extends UserEntity{
...
@@ -1381,44 +1023,6 @@ public class UserQuery extends UserEntity{
return
this
;
return
this
;
}
}
/**
* 设置 开始 最后修改密码时间
* @param lastModPwdTimeStart
*/
public
UserQuery
lastModPwdTimeStart
(
String
lastModPwdTimeStart
){
this
.
lastModPwdTimeStart
=
lastModPwdTimeStart
;
return
this
;
}
/**
* 设置 结束 最后修改密码时间
* @param lastModPwdTimeEnd
*/
public
UserQuery
lastModPwdTimeEnd
(
String
lastModPwdTimeEnd
){
this
.
lastModPwdTimeEnd
=
lastModPwdTimeEnd
;
return
this
;
}
/**
* 设置 最后修改密码地址
* @param lastModPwdAddr
*/
public
UserQuery
lastModPwdAddr
(
String
lastModPwdAddr
){
setLastModPwdAddr
(
lastModPwdAddr
);
return
this
;
}
/**
* 设置 最后修改密码地址
* @param lastModPwdAddrList
*/
public
UserQuery
lastModPwdAddrList
(
List
<
String
>
lastModPwdAddrList
){
this
.
lastModPwdAddrList
=
lastModPwdAddrList
;
return
this
;
}
/**
/**
* 获取 OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4)
* 获取 OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4)
* @return orConditionList
* @return orConditionList
...
...
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/user/model/vo/UserVo.java
View file @
ee628cb0
...
@@ -4,9 +4,6 @@ package com.mortals.xhx.base.system.user.model.vo;
...
@@ -4,9 +4,6 @@ package com.mortals.xhx.base.system.user.model.vo;
import
com.mortals.framework.model.BaseEntityLong
;
import
com.mortals.framework.model.BaseEntityLong
;
import
lombok.Data
;
import
lombok.Data
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
/**
* 用户信息业务视图对象
* 用户信息业务视图对象
*
*
...
@@ -39,8 +36,4 @@ public class UserVo extends BaseEntityLong {
...
@@ -39,8 +36,4 @@ public class UserVo extends BaseEntityLong {
* 过期时间
* 过期时间
*/
*/
private
Long
expireTime
;
private
Long
expireTime
;
private
Long
siteId
;
private
Long
customerId
;
}
}
\ No newline at end of file
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/user/service/UserService.java
View file @
ee628cb0
/**
/**
* 文件:UserService.java
* 文件:UserService.java
* 版本:1.0.0
* 版本:1.0.0
* 日期:
* 日期:
* Copyright ®
* Copyright ®
* All right reserved.
* All right reserved.
*/
*/
package
com.mortals.xhx.base.system.user.service
;
package
com.mortals.xhx.base.system.user.service
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.Result
;
import
com.mortals.framework.model.Result
;
import
com.mortals.framework.service.ICRUDService
;
import
com.mortals.framework.service.ICRUD
Cache
Service
;
import
com.mortals.framework.service.IUser
;
import
com.mortals.framework.service.IUser
;
import
com.mortals.xhx.base.system.menu.model.MenuEntity
;
import
com.mortals.xhx.base.system.menu.model.MenuEntity
;
import
com.mortals.xhx.base.system.user.dao.UserDao
;
import
com.mortals.xhx.base.system.user.model.UserEntity
;
import
com.mortals.xhx.base.system.user.model.UserEntity
;
import
java.util.List
;
import
java.util.List
;
...
@@ -23,11 +25,11 @@ import java.util.Set;
...
@@ -23,11 +25,11 @@ import java.util.Set;
* <p>Description: UserService service接口 </p>
* <p>Description: UserService service接口 </p>
* <p>Copyright: Copyright ® </p>
* <p>Copyright: Copyright ® </p>
* <p>Company: </p>
* <p>Company: </p>
* @author
* @author
* @version 1.0.0
* @version 1.0.0
*/
*/
public
interface
UserService
extends
ICRUDService
<
UserEntity
,
Long
>
{
public
interface
UserService
extends
ICRUD
Cache
Service
<
UserEntity
,
Long
>
{
/**
/**
* 用户登录
* 用户登录
*
*
...
@@ -37,7 +39,7 @@ public interface UserService extends ICRUDService<UserEntity,Long> {
...
@@ -37,7 +39,7 @@ public interface UserService extends ICRUDService<UserEntity,Long> {
* @return
* @return
* @throws AppException
* @throws AppException
*/
*/
public
UserEntity
doLogin
(
String
loginName
,
String
password
,
String
loginIp
)
throws
AppException
;
UserEntity
doLogin
(
String
loginName
,
String
password
,
String
loginIp
)
throws
AppException
;
/**
/**
* 校验用户名与密码是否正确
* 校验用户名与密码是否正确
...
@@ -47,7 +49,7 @@ public interface UserService extends ICRUDService<UserEntity,Long> {
...
@@ -47,7 +49,7 @@ public interface UserService extends ICRUDService<UserEntity,Long> {
* @return
* @return
* @throws AppException
* @throws AppException
*/
*/
public
UserEntity
doCheckUser
(
String
loginName
,
String
password
)
throws
AppException
;
UserEntity
doCheckUser
(
String
loginName
,
String
password
)
throws
AppException
;
/**
/**
* 检查用户是否存在
* 检查用户是否存在
...
@@ -56,7 +58,7 @@ public interface UserService extends ICRUDService<UserEntity,Long> {
...
@@ -56,7 +58,7 @@ public interface UserService extends ICRUDService<UserEntity,Long> {
* @param userId 密码
* @param userId 密码
* @return
* @return
*/
*/
public
boolean
existUser
(
String
loginName
,
Long
userId
)
throws
AppException
;
boolean
existUser
(
String
loginName
,
Long
userId
)
throws
AppException
;
/**
/**
* 通过登录用户获取菜单功能权限
* 通过登录用户获取菜单功能权限
...
@@ -64,7 +66,7 @@ public interface UserService extends ICRUDService<UserEntity,Long> {
...
@@ -64,7 +66,7 @@ public interface UserService extends ICRUDService<UserEntity,Long> {
* @param user
* @param user
* @return
* @return
*/
*/
public
List
<
MenuEntity
>
findOutlookBarList
(
IUser
user
);
List
<
MenuEntity
>
findOutlookBarList
(
IUser
user
);
/**
/**
* 查询用户所有有权限的菜单ID
* 查询用户所有有权限的菜单ID
...
@@ -72,7 +74,7 @@ public interface UserService extends ICRUDService<UserEntity,Long> {
...
@@ -72,7 +74,7 @@ public interface UserService extends ICRUDService<UserEntity,Long> {
* @param userEntity
* @param userEntity
* @return
* @return
*/
*/
public
Set
<
Long
>
findAllAuthIds
(
UserEntity
userEntity
)
throws
AppException
;
Set
<
Long
>
findAllAuthIds
(
UserEntity
userEntity
)
throws
AppException
;
/**
/**
* 查询用户记录
* 查询用户记录
...
@@ -84,7 +86,7 @@ public interface UserService extends ICRUDService<UserEntity,Long> {
...
@@ -84,7 +86,7 @@ public interface UserService extends ICRUDService<UserEntity,Long> {
* @return
* @return
* @throws AppException
* @throws AppException
*/
*/
public
Result
<
UserEntity
>
find
(
Long
platformId
,
UserEntity
params
,
int
currPage
,
int
prePageResult
)
throws
AppException
;
Result
<
UserEntity
>
find
(
Long
platformId
,
UserEntity
params
,
int
currPage
,
int
prePageResult
)
throws
AppException
;
/**
/**
* 为客户创建用户
* 为客户创建用户
...
@@ -99,7 +101,7 @@ public interface UserService extends ICRUDService<UserEntity,Long> {
...
@@ -99,7 +101,7 @@ public interface UserService extends ICRUDService<UserEntity,Long> {
* @return
* @return
* @throws AppException
* @throws AppException
*/
*/
public
UserEntity
createUser
(
IUser
currUser
,
Long
customerId
,
String
customerName
,
String
loginName
,
String
password
,
UserEntity
createUser
(
IUser
currUser
,
Long
customerId
,
String
customerName
,
String
loginName
,
String
password
,
String
userName
,
String
mobile
)
throws
AppException
;
String
userName
,
String
mobile
)
throws
AppException
;
/**
/**
...
@@ -111,5 +113,11 @@ public interface UserService extends ICRUDService<UserEntity,Long> {
...
@@ -111,5 +113,11 @@ public interface UserService extends ICRUDService<UserEntity,Long> {
* @return
* @return
* @throws AppException
* @throws AppException
*/
*/
public
boolean
updateUserPwd
(
String
loginName
,
String
oldPwd
,
String
newPwd
)
throws
AppException
;
boolean
updateUserPwd
(
String
loginName
,
String
oldPwd
,
String
newPwd
)
throws
AppException
;
Rest
<
Void
>
refreshUser
();
UserDao
getUserDao
();
}
}
\ No newline at end of file
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/user/service/impl/UserServiceImpl.java
View file @
ee628cb0
...
@@ -9,41 +9,53 @@
...
@@ -9,41 +9,53 @@
package
com.mortals.xhx.base.system.user.service.impl
;
package
com.mortals.xhx.base.system.user.service.impl
;
import
com.mortals.framework.ap.SysConstains
;
import
com.mortals.framework.ap.SysConstains
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.common.code.UserType
;
import
com.mortals.framework.common.code.UserType
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.model.PageInfo
;
import
com.mortals.framework.model.PageInfo
;
import
com.mortals.framework.model.Result
;
import
com.mortals.framework.model.Result
;
import
com.mortals.framework.service.IUser
;
import
com.mortals.framework.service.IUser
;
import
com.mortals.framework.service.impl.AbstractCRUDServiceImpl
;
import
com.mortals.framework.service.impl.AbstractCRUD
Cache
ServiceImpl
;
import
com.mortals.framework.util.SecurityUtil
;
import
com.mortals.framework.util.SecurityUtil
;
import
com.mortals.framework.util.StringUtils
;
import
com.mortals.framework.util.StringUtils
;
import
com.mortals.xhx.base.system.menu.model.MenuEntity
;
import
com.mortals.xhx.base.system.menu.model.MenuEntity
;
import
com.mortals.xhx.base.system.menu.service.MenuService
;
import
com.mortals.xhx.base.system.menu.service.MenuService
;
import
com.mortals.xhx.base.system.resource.model.ResourceEntity
;
import
com.mortals.xhx.base.system.resource.model.ResourceEntity
;
import
com.mortals.xhx.base.system.resource.service.ResourceService
;
import
com.mortals.xhx.base.system.resource.service.ResourceService
;
import
com.mortals.xhx.base.system.role.dao.RoleUserDao
;
import
com.mortals.xhx.base.system.role.model.RoleUserEntity
;
import
com.mortals.xhx.base.system.role.model.RoleUserEntity
;
import
com.mortals.xhx.base.system.role.model.RoleUserQuery
;
import
com.mortals.xhx.base.system.role.service.RoleUserService
;
import
com.mortals.xhx.base.system.user.dao.UserDao
;
import
com.mortals.xhx.base.system.user.dao.UserDao
;
import
com.mortals.xhx.base.system.user.model.UserEntity
;
import
com.mortals.xhx.base.system.user.model.UserEntity
;
import
com.mortals.xhx.base.system.user.model.UserQuery
;
import
com.mortals.xhx.base.system.user.model.UserQuery
;
import
com.mortals.xhx.base.system.user.service.UserService
;
import
com.mortals.xhx.base.system.user.service.UserService
;
import
org.apache.commons.collections4.CollectionUtils
;
import
com.mortals.xhx.common.code.YesNoEnum
;
import
com.mortals.xhx.common.pdu.RespData
;
import
com.mortals.xhx.common.pdu.user.UserPdu
;
import
com.mortals.xhx.feign.user.IUserFeign
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
/**
* <p>Title: 用户信息</p>
* <p>Title: 用户信息</p>
* <p>Description: UserServiceImpl service接口 </p>
* <p>Description: UserServiceImpl service接口 </p>
* <p>Copyright: Copyright ® </p>
* <p>Copyright: Copyright ® </p>
* <p>Company: </p>
* <p>Company: </p>
*
* @author
* @author
* @version 1.0.0
* @version 1.0.0
*/
*/
@Service
(
"userService"
)
@Service
(
"userService"
)
public
class
UserServiceImpl
extends
AbstractCRUDServiceImpl
<
UserDao
,
UserEntity
,
Long
>
implements
UserService
{
@Slf4j
public
class
UserServiceImpl
extends
AbstractCRUDCacheServiceImpl
<
UserDao
,
UserEntity
,
Long
>
implements
UserService
{
@Autowired
@Autowired
...
@@ -51,7 +63,16 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity
...
@@ -51,7 +63,16 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity
@Autowired
@Autowired
private
ResourceService
resourceService
;
private
ResourceService
resourceService
;
@Autowired
@Autowired
private
RoleUserDao
roleUserDao
;
private
RoleUserService
roleUserService
;
@Lazy
@Autowired
private
IUserFeign
userFeign
;
@Override
protected
String
getExtKey
(
UserEntity
data
)
{
return
data
.
getLoginName
();
}
private
void
doHandlerUser
(
UserEntity
entity
)
throws
AppException
{
private
void
doHandlerUser
(
UserEntity
entity
)
throws
AppException
{
if
(
StringUtils
.
isNotEmpty
(
entity
.
getLoginPwd
()))
{
if
(
StringUtils
.
isNotEmpty
(
entity
.
getLoginPwd
()))
{
...
@@ -63,90 +84,63 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity
...
@@ -63,90 +84,63 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity
}
else
{
}
else
{
entity
.
setLoginPwd
(
null
);
entity
.
setLoginPwd
(
null
);
}
}
// if (entity.isSystemUser()) {
// entity.setUserType(UserType.SYSTEM.getValue());
// } else {
// entity.setUserType(UserType.CUSTOMER.getValue());
// }
}
}
@Override
@Override
protected
void
saveBefore
(
UserEntity
entity
,
Context
context
)
throws
AppException
{
protected
void
saveBefore
(
UserEntity
entity
,
Context
context
)
throws
AppException
{
if
(!
ObjectUtils
.
isEmpty
(
entity
.
getLoginName
())
&&
existUser
(
entity
.
getLoginName
(),
entity
.
getId
()))
{
throw
new
AppException
(
"登录名已存在!"
);
}
this
.
doHandlerUser
(
entity
);
this
.
doHandlerUser
(
entity
);
}
@Override
protected
void
saveAfter
(
UserEntity
entity
,
Context
context
)
throws
AppException
{
if
(
CollectionUtils
.
isNotEmpty
(
entity
.
getRoleIds
())){
List
<
RoleUserEntity
>
roleUserEntityList
=
new
ArrayList
<>();
entity
.
getRoleIds
().
stream
().
forEach
(
item
->{
RoleUserEntity
roleUserEntity
=
new
RoleUserEntity
();
roleUserEntity
.
setUserId
(
entity
.
getId
());
roleUserEntity
.
setRoleId
(
item
);
roleUserEntityList
.
add
(
roleUserEntity
);
});
roleUserDao
.
insertBatch
(
roleUserEntityList
);
}
}
}
@Override
@Override
protected
void
updateBefore
(
UserEntity
entity
,
Context
context
)
throws
AppException
{
protected
void
updateBefore
(
UserEntity
entity
,
Context
context
)
throws
AppException
{
if
(
entity
.
getId
().
longValue
()
==
SysConstains
.
ADMIN_ID
&&
!
context
.
getUser
().
isAdmin
())
{
// if (entity.getId().longValue() == SysConstains.ADMIN_ID && !context.getUser().isAdmin()) {
throw
new
AppException
(
"你没有权限执行该操作"
);
// throw new AppException("你没有权限执行该操作");
}
// }
//更新不更新密码字段
entity
.
setLoginPwd
(
null
);
this
.
doHandlerUser
(
entity
);
this
.
doHandlerUser
(
entity
);
}
}
@Override
@Override
protected
void
updateAfter
(
UserEntity
entity
,
Context
context
)
throws
AppException
{
protected
void
saveAfter
(
UserEntity
entity
,
Context
context
)
throws
AppException
{
if
(
CollectionUtils
.
isNotEmpty
(
entity
.
getRoleIds
())){
//新增角色
List
<
RoleUserEntity
>
roleUserEntityList
=
new
ArrayList
<>();
updateUserRole
(
entity
);
entity
.
getRoleIds
().
stream
().
forEach
(
item
->{
super
.
saveAfter
(
entity
,
context
);
RoleUserEntity
roleUserEntity
=
new
RoleUserEntity
();
roleUserEntity
.
setUserId
(
entity
.
getId
());
roleUserEntity
.
setRoleId
(
item
);
roleUserEntityList
.
add
(
roleUserEntity
);
});
RoleUserEntity
condition
=
new
RoleUserEntity
();
condition
.
setUserId
(
entity
.
getId
());
roleUserDao
.
delete
(
condition
);
roleUserDao
.
insertBatch
(
roleUserEntityList
);
}
}
}
@Override
@Override
protected
UserEntity
findBefore
(
UserEntity
params
,
Context
context
)
throws
AppException
{
protected
void
updateAfter
(
UserEntity
entity
,
Context
context
)
throws
AppException
{
// if (StringUtils.isNotEmpty(params.getDeptIds())) {
updateUserRole
(
entity
);
// params.setDeptIds(StringUtils.fillWithMark(params.getDeptIds(), ","));
super
.
updateAfter
(
entity
,
context
);
// }
return
super
.
findBefore
(
params
,
context
);
}
}
@Override
private
void
updateUserRole
(
UserEntity
entity
)
{
protected
UserEntity
findBefore
(
UserEntity
params
,
PageInfo
pageInfo
,
Context
context
)
throws
AppException
{
if
(!
ObjectUtils
.
isEmpty
(
entity
.
getId
())
&&
entity
.
getId
().
longValue
()
!=
SysConstains
.
ADMIN_ID
&&
!
ObjectUtils
.
isEmpty
(
entity
.
getRoleIds
()))
{
// if (StringUtils.isNotEmpty(params.getDeptIds())) {
RoleUserQuery
roleUserQuery
=
new
RoleUserQuery
();
// params.setDeptIds(StringUtils.fillWithMark(params.getDeptIds(), ","));
roleUserQuery
.
setUserId
(
entity
.
getId
());
// }
List
<
Long
>
idList
=
Arrays
.
asList
(
entity
.
getRoleIds
().
split
(
","
)).
stream
().
map
(
Long:
:
parseLong
).
collect
(
Collectors
.
toList
());
return
super
.
findBefore
(
params
,
pageInfo
,
context
);
roleUserQuery
.
setRoleIdList
(
idList
);
roleUserService
.
doDistributionRole
(
roleUserQuery
);
}
}
}
@Override
@Override
protected
void
findAfter
(
UserEntity
params
,
PageInfo
pageInfo
,
Context
context
,
List
<
UserEntity
>
list
)
throws
AppException
{
protected
void
findAfter
(
UserEntity
params
,
PageInfo
pageInfo
,
Context
context
,
List
<
UserEntity
>
list
)
throws
AppException
{
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
list
.
stream
().
peek
(
item
->
{
list
.
stream
().
forEach
(
item
->{
RoleUserQuery
roleUserQuery
=
new
RoleUserQuery
();
RoleUserEntity
query
=
new
RoleUserEntity
();
roleUserQuery
.
setUserId
(
item
.
getId
());
query
.
setUserId
(
item
.
getId
());
String
roleIds
=
roleUserService
.
find
(
roleUserQuery
).
stream
().
map
(
RoleUserEntity:
:
getRoleId
).
map
(
String:
:
valueOf
).
collect
(
Collectors
.
joining
(
","
));
List
<
RoleUserEntity
>
roleUserEntityList
=
roleUserDao
.
getList
(
query
);
item
.
setRoleIds
(
roleIds
);
List
<
Long
>
roleIds
=
new
ArrayList
<>();
}).
count
();
roleUserEntityList
.
stream
().
forEach
(
role
->{
super
.
findAfter
(
params
,
pageInfo
,
context
,
list
);
roleIds
.
add
(
role
.
getRoleId
());
});
item
.
setRoleIds
(
roleIds
);
});
//List<RoleUserEntity> roleUserEntityList =
}
}
}
public
UserEntity
findByLoginName
(
String
loginName
)
{
public
UserEntity
findByLoginName
(
String
loginName
)
{
UserQuery
params
=
new
UserQuery
();
UserQuery
params
=
new
UserQuery
();
params
.
setLoginName
(
loginName
);
params
.
setLoginName
(
loginName
);
...
@@ -170,11 +164,6 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity
...
@@ -170,11 +164,6 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
AppException
(
"密码验认出错!"
,
e
);
throw
new
AppException
(
"密码验认出错!"
,
e
);
}
}
UserEntity
update
=
new
UserEntity
();
update
.
setId
(
sysUser
.
getId
());
update
.
setLastLoginAddress
(
loginIp
);
update
.
setLastLoginTime
(
new
Date
());
this
.
dao
.
update
(
update
);
return
sysUser
;
return
sysUser
;
}
}
...
@@ -218,7 +207,7 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity
...
@@ -218,7 +207,7 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity
urls
.
addAll
(
StringUtils
.
converStr2Set
(
url
));
urls
.
addAll
(
StringUtils
.
converStr2Set
(
url
));
}
}
}
}
Set
<
Long
>
authIds
=
new
HashSet
<
Long
>();
Set
<
Long
>
authIds
=
new
HashSet
<>();
Map
<
Long
,
MenuEntity
>
menuMap
=
new
HashMap
<
Long
,
MenuEntity
>();
Map
<
Long
,
MenuEntity
>
menuMap
=
new
HashMap
<
Long
,
MenuEntity
>();
List
<
MenuEntity
>
userModuleList
=
this
.
menuService
.
findAllEnable
();
List
<
MenuEntity
>
userModuleList
=
this
.
menuService
.
findAllEnable
();
for
(
MenuEntity
sysModule
:
userModuleList
)
{
for
(
MenuEntity
sysModule
:
userModuleList
)
{
...
@@ -226,6 +215,7 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity
...
@@ -226,6 +215,7 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity
continue
;
continue
;
}
}
menuMap
.
put
(
sysModule
.
getId
(),
sysModule
);
menuMap
.
put
(
sysModule
.
getId
(),
sysModule
);
if
(!
user
.
isAdmin
()
&&
urls
.
contains
(
StringUtils
.
trim
(
sysModule
.
getUrl
())))
{
if
(!
user
.
isAdmin
()
&&
urls
.
contains
(
StringUtils
.
trim
(
sysModule
.
getUrl
())))
{
authIds
.
add
(
sysModule
.
getId
());
authIds
.
add
(
sysModule
.
getId
());
}
}
...
@@ -274,7 +264,6 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity
...
@@ -274,7 +264,6 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity
entity
.
initAttrValue
();
entity
.
initAttrValue
();
entity
.
setLoginName
(
loginName
);
entity
.
setLoginName
(
loginName
);
entity
.
setRealName
(
userName
);
entity
.
setRealName
(
userName
);
entity
.
setCustomerId
(
customerId
);
entity
.
setLoginPwd
(
password
);
entity
.
setLoginPwd
(
password
);
entity
.
setMobile
(
mobile
);
entity
.
setMobile
(
mobile
);
entity
.
setUserType
(
UserType
.
CUSTOMER
.
getValue
());
entity
.
setUserType
(
UserType
.
CUSTOMER
.
getValue
());
...
@@ -320,14 +309,86 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity
...
@@ -320,14 +309,86 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity
}
}
try
{
try
{
sysUser
.
setLoginPwd
(
SecurityUtil
.
md5DoubleEncoding
(
newPwd
));
sysUser
.
setLoginPwd
(
SecurityUtil
.
md5DoubleEncoding
(
newPwd
));
sysUser
.
setLoginPwd3
(
sysUser
.
getLoginPwd2
());
sysUser
.
setLoginPwd2
(
sysUser
.
getLoginPwd1
());
sysUser
.
setLoginPwd1
(
sysUser
.
getLoginPwd
());
sysUser
.
setLastModPwdTime
(
new
Date
());
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
AppException
(
"密码转换异常!"
,
e
);
throw
new
AppException
(
"密码转换异常!"
,
e
);
}
}
dao
.
update
(
sysUser
);
dao
.
update
(
sysUser
);
return
true
;
return
true
;
}
}
@Override
public
Rest
<
Void
>
refreshUser
()
{
UserPdu
userPdu
=
new
UserPdu
();
userPdu
.
setPage
(
1
);
userPdu
.
setSize
(-
1
);
Rest
<
RespData
<
List
<
UserPdu
>>>
resp
=
userFeign
.
list
(
userPdu
);
if
(
resp
.
getCode
()
==
YesNoEnum
.
YES
.
getValue
())
{
List
<
UserPdu
>
userPduList
=
resp
.
getData
().
getData
();
log
.
info
(
"用户总数量:{}"
,
userPduList
.
size
());
if
(!
ObjectUtils
.
isEmpty
(
userPduList
))
{
List
<
UserEntity
>
newUserList
=
userPduList
.
stream
().
map
(
newUser
->
{
UserEntity
userEntity
=
new
UserEntity
();
userEntity
.
initAttrValue
();
BeanUtils
.
copyProperties
(
newUser
,
userEntity
,
new
String
[]{
"id"
,
"lastLoginTime"
,
"lastLoginAddress"
});
return
userEntity
;
}).
collect
(
Collectors
.
toList
());
List
<
UserEntity
>
saveUpdateUserList
=
newUserList
.
parallelStream
().
map
(
item
->
{
UserEntity
extCache
=
this
.
getExtCache
(
item
.
getLoginName
());
if
(
ObjectUtils
.
isEmpty
(
extCache
))
{
item
.
setCreateUserId
(
1L
);
item
.
setCreateUserName
(
"系统管理员"
);
item
.
setCreateTime
(
new
Date
());
return
item
;
}
else
{
//更新用户列表
item
.
setId
(
extCache
.
getId
());
item
.
setUpdateUserId
(
1L
);
item
.
setUpdateUserName
(
"系统管理员"
);
item
.
setUpdateTime
(
new
Date
());
return
item
;
}
}).
collect
(
Collectors
.
toList
());
Map
<
Boolean
,
List
<
UserEntity
>>
saveUpdateCollect
=
saveUpdateUserList
.
stream
().
collect
(
Collectors
.
partitioningBy
(
x
->
x
.
getId
()
==
null
));
if
(!
ObjectUtils
.
isEmpty
(
saveUpdateCollect
.
get
(
true
)))
{
//需要新增的用户
log
.
info
(
"需要新增用户数量:{}"
,
saveUpdateCollect
.
get
(
true
).
size
());
saveUpdateCollect
.
get
(
true
).
stream
().
forEach
(
item
->
{
this
.
getUserDao
().
insert
(
item
);
this
.
putCache
(
item
.
getId
()
==
null
?
""
:
item
.
getId
().
toString
(),
item
);
//更新默认用户角色
RoleUserQuery
roleUserQuery
=
new
RoleUserQuery
();
roleUserQuery
.
setUserId
(
item
.
getId
());
roleUserQuery
.
setRoleIdList
(
Arrays
.
asList
(
1L
));
roleUserService
.
doDistributionRole
(
roleUserQuery
);
});
}
if
(!
ObjectUtils
.
isEmpty
(
saveUpdateCollect
.
get
(
false
)))
{
//需要新增的用户
log
.
info
(
"需要更新用户数量:{}"
,
saveUpdateCollect
.
get
(
false
).
size
());
saveUpdateCollect
.
get
(
false
).
stream
().
forEach
(
item
->
{
this
.
getUserDao
().
update
(
item
);
this
.
putCache
(
item
.
getId
()
==
null
?
""
:
item
.
getId
().
toString
(),
item
);
});
}
}
//查找新增 与更新
}
return
Rest
.
ok
();
}
@Override
public
UserDao
getUserDao
()
{
return
getDao
();
}
@Override
protected
void
removeAfter
(
Long
[]
ids
,
Context
context
,
int
result
)
throws
AppException
{
super
.
removeAfter
(
ids
,
context
,
result
);
RoleUserQuery
roleUserQuery
=
new
RoleUserQuery
();
roleUserQuery
.
setUserIdList
(
Arrays
.
asList
(
ids
));
Long
[]
userIds
=
roleUserService
.
find
(
roleUserQuery
).
stream
().
map
(
RoleUserEntity:
:
getId
).
toArray
(
Long
[]::
new
);
roleUserService
.
remove
(
userIds
,
context
);
}
}
}
\ No newline at end of file
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/user/web/UserController.java
View file @
ee628cb0
/**
* 文件:UserController.java
* 版本:1.0.0
* 日期:
* Copyright ®
* All right reserved.
*/
package
com.mortals.xhx.base.system.user.web
;
package
com.mortals.xhx.base.system.user.web
;
import
java.util.HashMap
;
import
com.alibaba.fastjson.JSONObject
;
import
java.util.List
;
import
com.mortals.framework.annotation.UnAuth
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
com.mortals.framework.service.IUser
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.xhx.base.system.role.model.RoleEntity
;
import
com.mortals.xhx.base.system.role.service.RoleService
;
import
com.mortals.xhx.common.code.UserStatus
;
import
com.mortals.framework.common.IBaseEnum
;
import
com.mortals.framework.common.IBaseEnum
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.common.code.UserType
;
import
com.mortals.framework.common.code.UserType
;
import
com.mortals.xhx.common.key.Constant
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.bind.annotation.*
;
import
com.alibaba.fastjson.JSONObject
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.web.BaseCRUDJsonMappingController
;
import
com.mortals.framework.web.BaseCRUDJson
Body
MappingController
;
import
com.mortals.xhx.base.framework.annotation.Operlog
;
import
com.mortals.xhx.base.framework.annotation.Operlog
;
import
com.mortals.xhx.base.system.role.model.RoleQuery
;
import
com.mortals.xhx.base.system.role.model.RoleUserEntity
;
import
com.mortals.xhx.base.system.role.model.RoleUserQuery
;
import
com.mortals.xhx.base.system.role.service.RoleService
;
import
com.mortals.xhx.base.system.role.service.RoleUserService
;
import
com.mortals.xhx.base.system.user.model.UserEntity
;
import
com.mortals.xhx.base.system.user.model.UserEntity
;
import
com.mortals.xhx.base.system.user.service.UserService
;
import
com.mortals.xhx.base.system.user.service.UserService
;
import
com.mortals.xhx.common.code.UserStatus
;
import
io.jsonwebtoken.Claims
;
import
io.jsonwebtoken.Jwts
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.Base64
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
/**
* <p>Title: 用户信息</p>
* 用户信息
* <p>Description: UserController </p>
*
* <p>Copyright: Copyright ® </p>
* @author: zxfei
* <p>Company: </p>
* @date: 2022/5/7 15:42
* @author
* @version 1.0.0
*/
*/
@RestController
@RestController
@RequestMapping
(
"user"
)
@RequestMapping
(
"user"
)
public
class
UserController
extends
BaseCRUDJsonBodyMappingController
<
UserService
,
UserEntity
,
Long
>
{
public
class
UserController
extends
BaseCRUDJsonBodyMappingController
<
UserService
,
UserEntity
,
Long
>
{
@Autowired
private
UserService
userService
;
@Autowired
@Autowired
private
RoleService
roleService
;
private
RoleService
roleService
;
@Autowired
private
RoleUserService
roleUserService
;
public
UserController
()
{
public
UserController
()
{
super
.
setFormClass
(
UserForm
.
class
);
super
.
setModuleDesc
(
"用户信息"
);
super
.
setModuleDesc
(
"用户信息"
);
}
}
@Override
@Override
protected
void
init
(
Map
<
String
,
Object
>
model
,
Context
context
)
{
protected
void
init
(
Map
<
String
,
Object
>
model
,
Context
context
)
{
this
.
addDict
(
model
,
"userType"
,
IBaseEnum
.
getEnumMap
(
UserType
.
class
));
this
.
addDict
(
model
,
"status"
,
UserStatus
.
getEnumMap
());
this
.
addDict
(
model
,
"roleIds"
,
roleService
.
find
(
new
RoleQuery
()).
stream
().
collect
(
Collectors
.
toMap
(
x
->
x
.
getId
().
toString
(),
y
->
y
.
getName
())));
this
.
addDict
(
model
,
"userType"
,
IBaseEnum
.
getEnumMap
(
UserType
.
class
));
this
.
addDict
(
model
,
"status"
,
UserStatus
.
getEnumMap
());
List
<
RoleEntity
>
roleList
=
roleService
.
find
(
new
RoleEntity
());
this
.
addDict
(
model
,
"roleId"
,
roleList
.
stream
().
collect
(
Collectors
.
toMap
(
e
->
e
.
getId
().
toString
(),
e
->
e
.
getName
())));
super
.
init
(
model
,
context
);
}
}
@Override
protected
void
doListBefore
(
UserEntity
query
,
Map
<
String
,
Object
>
model
,
Context
context
)
throws
AppException
{
if
(!
StringUtils
.
isEmpty
(
query
.
getRealName
()))
{
query
.
setRealName
(
"%"
.
concat
(
query
.
getRealName
()).
concat
(
"%"
));
}
if
(!
StringUtils
.
isEmpty
(
query
.
getLoginName
()))
{
query
.
setLoginName
(
"%"
.
concat
(
query
.
getLoginName
()).
concat
(
"%"
));
}
}
@Override
@Override
protected
int
editAfter
(
Long
id
,
Map
<
String
,
Object
>
model
,
UserEntity
entity
,
Context
context
)
throws
AppException
{
protected
int
editAfter
(
Long
id
,
Map
<
String
,
Object
>
model
,
UserEntity
entity
,
Context
context
)
throws
AppException
{
entity
.
setLoginPwd
(
null
);
RoleUserQuery
roleUserQuery
=
new
RoleUserQuery
(
);
entity
.
setLoginPwd1
(
null
);
roleUserQuery
.
setUserId
(
entity
.
getId
()
);
entity
.
setLoginPwd2
(
null
);
String
roleIds
=
roleUserService
.
find
(
roleUserQuery
).
stream
().
map
(
RoleUserEntity:
:
getRoleId
).
map
(
String:
:
valueOf
).
collect
(
Collectors
.
joining
(
","
)
);
entity
.
set
LoginPwd3
(
null
);
entity
.
set
RoleIds
(
roleIds
);
return
1
;
return
super
.
editAfter
(
id
,
model
,
entity
,
context
)
;
}
}
@RequestMapping
(
value
=
"change/password"
,
method
=
RequestMethod
.
POST
)
@Override
public
String
changePassword
(
@RequestBody
UserEntity
entity
)
{
protected
int
saveAfter
(
UserEntity
entity
,
Map
<
String
,
Object
>
model
,
Context
context
)
throws
AppException
{
return
super
.
saveAfter
(
entity
,
model
,
context
);
}
IUser
user
=
this
.
getCurUser
();
if
(
user
==
null
){
// @Override
return
this
.
createFailJsonResp
(
"请先登录"
);
// protected void saveBefore(UserEntity entity, Map<String, Object> model, Context context) throws AppException {
}
// if (!ObjectUtils.isEmpty(entity.getLoginName()) && service.existUser(entity.getLoginName(), entity.getId())) {
// throw new AppException("登录名已存在!");
// }
// super.saveBefore(entity, model, context);
// }
@RequestMapping
(
value
=
"change/password"
,
method
=
RequestMethod
.
POST
)
@Operlog
(
msg
=
"密码修改成功!"
)
public
String
changePassword
(
@RequestParam
String
oldPwd
,
@RequestParam
String
newPwd
)
{
JSONObject
ret
=
new
JSONObject
();
JSONObject
ret
=
new
JSONObject
();
try
{
try
{
service
.
updateUserPwd
(
super
.
getCurUser
().
getLoginName
(),
entity
.
getOldPassword
(),
entity
.
getNewPassword
()
);
service
.
updateUserPwd
(
super
.
getCurUser
().
getLoginName
(),
oldPwd
,
newPwd
);
ret
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_SUCCESS
);
ret
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_SUCCESS
);
ret
.
put
(
KEY_RESULT_MSG
,
"密码修改成功!"
);
ret
.
put
(
KEY_RESULT_MSG
,
"密码修改成功!"
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -95,4 +104,31 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic
...
@@ -95,4 +104,31 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic
}
}
return
ret
.
toJSONString
();
return
ret
.
toJSONString
();
}
}
@PostMapping
({
"refreshUser"
})
@UnAuth
public
Rest
<
Object
>
refreshUser
()
{
log
.
info
(
"刷新用户"
);
this
.
service
.
refreshUser
();
return
Rest
.
ok
(
"用户同步刷新操作成功"
);
}
public
static
void
main
(
String
[]
args
)
{
String
token
=
"eyJhbGciOiJIUzI1NiJ9.eyJsb2dpbl91c2VyX2tleSI6IjIzNGE5NDA5ZDVhOTQ3MWNhMzdkYjZkYmMwY2JjZTc5In0.MWyQW40HYDxyUz7PJRf_nRsFPWx3Hr811Ime984nixs"
;
String
secret
=
"026db82420614469897fcc2dc1b4ce38"
;
Claims
claims
=
Jwts
.
parser
()
.
setSigningKey
(
Base64
.
getEncoder
().
encodeToString
(
secret
.
getBytes
()))
.
parseClaimsJws
(
token
)
.
getBody
();
String
uuid
=
(
String
)
claims
.
get
(
"login_user_key"
);
System
.
out
.
println
(
uuid
);
}
}
}
\ No newline at end of file
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/user/web/UserForm.java
deleted
100644 → 0
View file @
9a50bbd9
/**
* 文件:UserForm.java
* 版本:1.0.0
* 日期:
* Copyright ®
* All right reserved.
*/
package
com.mortals.xhx.base.system.user.web
;
import
com.mortals.framework.web.BaseCRUDFormLong
;
import
com.mortals.xhx.base.system.user.model.UserEntity
;
import
com.mortals.xhx.base.system.user.model.UserQuery
;
/**
* <p>Title: 用户信息</p>
* <p>Description: UserForm </p>
* <p>Copyright: Copyright ® </p>
* <p>Company: </p>
* @author
* @version 1.0.0
*/
public
class
UserForm
extends
BaseCRUDFormLong
<
UserEntity
>
{
private
UserEntity
entity
=
new
UserEntity
();
private
UserQuery
query
=
new
UserQuery
();
public
UserForm
(){
}
@Override
public
UserEntity
getEntity
()
{
return
entity
;
}
public
void
setEntity
(
UserEntity
entity
)
{
this
.
entity
=
entity
;
}
@Override
public
UserQuery
getQuery
()
{
return
query
;
}
public
void
setQuery
(
UserQuery
query
)
{
this
.
query
=
query
;
}
}
\ No newline at end of file
one-certificate-manager/src/main/java/com/mortals/xhx/common/key/RedisKey.java
View file @
ee628cb0
...
@@ -5,9 +5,6 @@ package com.mortals.xhx.common.key;
...
@@ -5,9 +5,6 @@ package com.mortals.xhx.common.key;
*/
*/
public
class
RedisKey
{
public
class
RedisKey
{
/**
public
static
final
String
KEY_USER_MENU_CACHE
=
"user:menu"
;
* 登录 cookies key
*/
public
static
final
String
KEY_MENU_CACHE
=
"iot:base:MenuCacheKey:"
;
}
}
one-certificate-manager/src/main/java/com/mortals/xhx/common/utils/ControllerScanUtil.java
0 → 100644
View file @
ee628cb0
package
com.mortals.xhx.common.utils
;
import
cn.hutool.core.util.StrUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.mortals.framework.annotation.UnAuth
;
import
com.mortals.xhx.base.system.resource.model.ResourceEntity
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.io.File
;
import
java.io.FileFilter
;
import
java.io.IOException
;
import
java.lang.reflect.Method
;
import
java.net.JarURLConnection
;
import
java.net.URL
;
import
java.net.URLDecoder
;
import
java.util.*
;
import
java.util.jar.JarEntry
;
import
java.util.jar.JarFile
;
import
java.util.stream.Collectors
;
public
class
ControllerScanUtil
{
/**
* 查看类路径
*/
public
static
final
String
[]
ULR_VIEW
=
{
"view"
,
"info"
,
"list"
,
"get"
,
"find"
,
"export"
,
"download"
,
"index"
,
"bill"
};
public
static
final
String
[]
WHITE_URL
=
{
"login"
,
"test"
,
"file"
,
"securitycode"
};
public
static
void
main
(
String
[]
args
)
{
List
<
Class
<?>>
classList
=
getAllClassByPackageName
(
"com.mortals.xhx"
);
//System.out.println(classList); //获取到了所有的类
getAnnotationInfo
(
classList
);
}
public
static
List
<
ResourceEntity
>
getAnnotationInfo
(
List
<
Class
<?>>
clsList
)
{
List
<
ResourceEntity
>
resourceArrayList
=
new
ArrayList
<>();
if
(
clsList
!=
null
&&
clsList
.
size
()
>
0
)
{
for
(
Class
<?>
cls
:
clsList
)
{
boolean
exits
=
cls
.
isAnnotationPresent
(
RestController
.
class
);
if
(!
exits
)
{
continue
;
}
//白名单地址的 也不需要
ResourceEntity
resourceViewEntity
=
new
ResourceEntity
();
resourceViewEntity
.
initAttrValue
();
ResourceEntity
resourceEditEntity
=
new
ResourceEntity
();
resourceEditEntity
.
initAttrValue
();
resourceEditEntity
.
setSourceType
(
1
);
Method
substringMethod
=
null
;
String
result
=
""
;
try
{
String
packName
=
cls
.
getPackage
().
getName
();
if
(
StrUtil
.
contains
(
packName
,
"system"
))
{
//系统管理-xx管理-
substringMethod
=
cls
.
getMethod
(
"getModuleDesc"
);
result
=
(
String
)
substringMethod
.
invoke
(
cls
.
newInstance
());
resourceViewEntity
.
setName
(
"系统管理-"
+
result
+
"管理-查看"
);
resourceEditEntity
.
setName
(
"系统管理-"
+
result
+
"管理-维护"
);
}
else
{
substringMethod
=
cls
.
getMethod
(
"getModuleDesc"
);
result
=
(
String
)
substringMethod
.
invoke
(
cls
.
newInstance
());
resourceViewEntity
.
setName
(
result
+
"-查看"
);
resourceEditEntity
.
setName
(
result
+
"-维护"
);
}
}
catch
(
Exception
e
)
{
}
RequestMapping
requestMappingCls
=
cls
.
getAnnotation
(
RequestMapping
.
class
);
String
prefix
=
""
;
if
(
requestMappingCls
!=
null
)
{
prefix
=
"/"
+
requestMappingCls
.
value
()[
0
];
boolean
b
=
false
;
for
(
String
s
:
WHITE_URL
)
{
if
(
StrUtil
.
contains
(
requestMappingCls
.
value
()[
0
].
toLowerCase
(),
s
))
{
b
=
true
;
break
;
}
}
if
(
b
)
{
continue
;
}
}
if
(
ObjectUtils
.
isEmpty
(
result
))
{
if
(
requestMappingCls
!=
null
)
{
result
=
StrUtil
.
removeSuffix
(
StrUtil
.
removePrefix
(
requestMappingCls
.
value
()[
0
].
toUpperCase
(),
"/"
),
"/"
)
+
"接口模块"
;
}
resourceViewEntity
.
setName
(
result
+
"-查看"
);
resourceEditEntity
.
setName
(
result
+
"-维护"
);
}
Set
<
String
>
urlSet
=
new
HashSet
<>();
//获取类中的所有的方法
Method
[]
methods
=
cls
.
getDeclaredMethods
();
if
(
methods
!=
null
&&
methods
.
length
>
0
)
{
for
(
Method
method
:
methods
)
{
boolean
unAuth
=
method
.
isAnnotationPresent
(
UnAuth
.
class
);
if
(
unAuth
)
{
continue
;
}
boolean
mExits
=
method
.
isAnnotationPresent
(
RequestMapping
.
class
);
if
(
mExits
)
{
RequestMapping
requestMapping
=
method
.
getAnnotation
(
RequestMapping
.
class
);
String
url
=
prefix
+
"/"
+
requestMapping
.
value
()[
0
];
url
=
url
.
replaceAll
(
"/+"
,
"/"
);
urlSet
.
add
(
url
);
}
boolean
mExits1
=
method
.
isAnnotationPresent
(
GetMapping
.
class
);
if
(
mExits1
)
{
GetMapping
getMapping
=
method
.
getAnnotation
(
GetMapping
.
class
);
String
url
=
prefix
+
"/"
+
getMapping
.
value
()[
0
];
url
=
url
.
replaceAll
(
"/+"
,
"/"
);
urlSet
.
add
(
url
);
}
boolean
mExits2
=
method
.
isAnnotationPresent
(
PostMapping
.
class
);
if
(
mExits2
)
{
PostMapping
postMapping
=
method
.
getAnnotation
(
PostMapping
.
class
);
String
url
=
prefix
+
"/"
+
postMapping
.
value
()[
0
];
url
=
url
.
replaceAll
(
"/+"
,
"/"
);
urlSet
.
add
(
url
);
}
}
}
//获取超类中的方法
Method
[]
superMethods
=
cls
.
getSuperclass
().
getDeclaredMethods
();
if
(
superMethods
!=
null
&&
superMethods
.
length
>
0
)
{
for
(
Method
method
:
superMethods
)
{
boolean
unAuth
=
method
.
isAnnotationPresent
(
UnAuth
.
class
);
if
(
unAuth
)
{
continue
;
}
boolean
mExits
=
method
.
isAnnotationPresent
(
RequestMapping
.
class
);
if
(
mExits
)
{
RequestMapping
requestMapping
=
method
.
getAnnotation
(
RequestMapping
.
class
);
String
url
=
prefix
+
"/"
+
requestMapping
.
value
()[
0
];
url
=
url
.
replaceAll
(
"/+"
,
"/"
);
urlSet
.
add
(
url
);
}
boolean
mExits1
=
method
.
isAnnotationPresent
(
GetMapping
.
class
);
if
(
mExits1
)
{
GetMapping
getMapping
=
method
.
getAnnotation
(
GetMapping
.
class
);
String
url
=
prefix
+
"/"
+
getMapping
.
value
()[
0
];
url
=
url
.
replaceAll
(
"/+"
,
"/"
);
urlSet
.
add
(
url
);
}
boolean
mExits2
=
method
.
isAnnotationPresent
(
PostMapping
.
class
);
if
(
mExits2
)
{
PostMapping
postMapping
=
method
.
getAnnotation
(
PostMapping
.
class
);
String
url
=
prefix
+
"/"
+
postMapping
.
value
()[
0
];
url
=
url
.
replaceAll
(
"/+"
,
"/"
);
urlSet
.
add
(
url
);
}
}
}
if
(!
ObjectUtils
.
isEmpty
(
urlSet
))
{
Set
<
String
>
UrlViewSet
=
new
HashSet
<>();
Set
<
String
>
UrlEditSet
=
new
HashSet
<>();
for
(
String
url
:
urlSet
)
{
String
str
=
StrUtil
.
subAfter
(
url
,
"/"
,
true
);
boolean
bool
=
false
;
for
(
String
checkStr
:
ULR_VIEW
)
{
boolean
contains
=
StrUtil
.
contains
(
str
.
toLowerCase
(),
checkStr
);
if
(
contains
)
{
UrlViewSet
.
add
(
url
);
bool
=
true
;
break
;
}
}
if
(!
bool
)
{
UrlEditSet
.
add
(
url
);
}
}
resourceViewEntity
.
setUrl
(
UrlViewSet
.
stream
().
collect
(
Collectors
.
joining
(
","
)));
System
.
out
.
println
(
JSONObject
.
toJSONString
(
resourceViewEntity
));
resourceArrayList
.
add
(
resourceViewEntity
);
resourceEditEntity
.
setUrl
(
UrlEditSet
.
stream
().
collect
(
Collectors
.
joining
(
","
)));
System
.
out
.
println
(
JSONObject
.
toJSONString
(
resourceEditEntity
));
resourceArrayList
.
add
(
resourceEditEntity
);
}
}
}
return
resourceArrayList
;
}
public
static
List
<
Class
<?>>
getAllClassByPackageName
(
String
packageName
)
{
// 获取当前包下以及子包下所以的类
List
<
Class
<?>>
returnClassList
=
getClasses
(
packageName
);
return
returnClassList
;
}
/**
* 从包package中获取所有的Class
*
* @param packageName
* @return
*/
private
static
List
<
Class
<?>>
getClasses
(
String
packageName
)
{
// 第一个class类的集合
List
<
Class
<?>>
classes
=
new
ArrayList
<
Class
<?>>();
// 是否循环迭代
boolean
recursive
=
true
;
// 获取包的名字 并进行替换
String
packageDirName
=
packageName
.
replace
(
'.'
,
'/'
);
// 定义一个枚举的集合 并进行循环来处理这个目录下的things
Enumeration
<
URL
>
dirs
;
try
{
dirs
=
Thread
.
currentThread
().
getContextClassLoader
().
getResources
(
packageDirName
);
// 循环迭代下去
while
(
dirs
.
hasMoreElements
())
{
// 获取下一个元素
URL
url
=
dirs
.
nextElement
();
// 得到协议的名称
String
protocol
=
url
.
getProtocol
();
//System.out.println(url.getFile());
// 如果是以文件的形式保存在服务器上
if
(
"file"
.
equals
(
protocol
))
{
// 获取包的物理路径
String
filePath
=
URLDecoder
.
decode
(
url
.
getFile
(),
"UTF-8"
);
// 以文件的方式扫描整个包下的文件 并添加到集合中
findAndAddClassesInPackageByFile
(
packageName
,
filePath
,
recursive
,
classes
);
}
else
if
(
"jar"
.
equals
(
protocol
))
{
// 如果是jar包文件
// 定义一个JarFile
JarFile
jar
;
try
{
// 获取jar
jar
=
((
JarURLConnection
)
url
.
openConnection
()).
getJarFile
();
// 从此jar包 得到一个枚举类
Enumeration
<
JarEntry
>
entries
=
jar
.
entries
();
// 同样的进行循环迭代
while
(
entries
.
hasMoreElements
())
{
// 获取jar里的一个实体 可以是目录 和一些jar包里的其他文件 如META-INF等文件
JarEntry
entry
=
entries
.
nextElement
();
String
name
=
entry
.
getName
();
// 如果是以/开头的
if
(
name
.
charAt
(
0
)
==
'/'
)
{
// 获取后面的字符串
name
=
name
.
substring
(
1
);
}
// 如果前半部分和定义的包名相同
if
(
name
.
startsWith
(
packageDirName
))
{
int
idx
=
name
.
lastIndexOf
(
'/'
);
// 如果以"/"结尾 是一个包
if
(
idx
!=
-
1
)
{
// 获取包名 把"/"替换成"."
packageName
=
name
.
substring
(
0
,
idx
).
replace
(
'/'
,
'.'
);
}
// 如果可以迭代下去 并且是一个包
if
((
idx
!=
-
1
)
||
recursive
)
{
// 如果是一个.class文件 而且不是目录
if
(
name
.
endsWith
(
".class"
)
&&
!
entry
.
isDirectory
())
{
// 去掉后面的".class" 获取真正的类名
String
className
=
name
.
substring
(
packageName
.
length
()
+
1
,
name
.
length
()
-
6
);
try
{
// 添加到classes
classes
.
add
(
Class
.
forName
(
packageName
+
'.'
+
className
));
}
catch
(
ClassNotFoundException
e
)
{
e
.
printStackTrace
();
}
}
}
}
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
return
classes
;
}
/**
* 以文件的形式来获取包下的所有Class
*
* @param packageName
* @param packagePath
* @param recursive
* @param classes
*/
private
static
void
findAndAddClassesInPackageByFile
(
String
packageName
,
String
packagePath
,
final
boolean
recursive
,
List
<
Class
<?>>
classes
)
{
// 获取此包的目录 建立一个File
File
dir
=
new
File
(
packagePath
);
// 如果不存在或者 也不是目录就直接返回
if
(!
dir
.
exists
()
||
!
dir
.
isDirectory
())
{
return
;
}
// 如果存在 就获取包下的所有文件 包括目录
File
[]
dirFiles
=
dir
.
listFiles
(
new
FileFilter
()
{
// 自定义过滤规则 如果可以循环(包含子目录) 或则是以.class结尾的文件(编译好的java类文件)
public
boolean
accept
(
File
file
)
{
return
(
recursive
&&
file
.
isDirectory
())
||
(
file
.
getName
().
endsWith
(
".class"
));
}
});
assert
dirFiles
!=
null
;
// 循环所有文件
for
(
File
file
:
dirFiles
)
{
// 如果是目录 则继续扫描
if
(
file
.
isDirectory
())
{
findAndAddClassesInPackageByFile
(
packageName
+
"."
+
file
.
getName
(),
file
.
getAbsolutePath
(),
recursive
,
classes
);
}
else
{
// 如果是java类文件 去掉后面的.class 只留下类名
String
className
=
file
.
getName
().
substring
(
0
,
file
.
getName
().
length
()
-
6
);
try
{
// 添加到集合中去
classes
.
add
(
Class
.
forName
(
packageName
+
'.'
+
className
));
}
catch
(
ClassNotFoundException
e
)
{
e
.
printStackTrace
();
}
}
}
}
}
one-certificate-manager/src/main/java/com/mortals/xhx/common/utils/MenuEncodeUtil.java
0 → 100644
View file @
ee628cb0
package
com.mortals.xhx.common.utils
;
import
com.mortals.framework.ap.GlobalSysInfo
;
import
com.mortals.framework.ap.SysConstains
;
import
com.mortals.framework.util.AESUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
java.util.Set
;
@Slf4j
public
class
MenuEncodeUtil
{
public
static
String
generateMenuUrlCode
(
Set
<
String
>
urls
)
{
try
{
String
securityKey
=
GlobalSysInfo
.
getPropertyValue
(
SysConstains
.
PROP_COOKIE_SECURITY_KEY
);
StringBuilder
sb
=
new
StringBuilder
();
if
(
urls
!=
null
&&
urls
.
size
()
>
0
)
{
for
(
String
url
:
urls
)
{
int
index
=
url
.
hashCode
()
&
(
Integer
.
MAX_VALUE
-
1
);
sb
.
append
(
index
).
append
(
","
);
}
}
String
menuUrl
=
sb
.
toString
();
return
AESUtil
.
encrypt
(
menuUrl
,
securityKey
);
}
catch
(
Throwable
e
)
{
log
.
error
(
"编码异常"
,
e
);
return
null
;
}
}
}
Write
Preview
Markdown
is supported
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