Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
fill-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
廖旭伟
fill-system
Commits
420a901e
Commit
420a901e
authored
Nov 16, 2023
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
同步接口
parent
d200201e
Pipeline
#2681
canceled with stages
Changes
9
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
396 additions
and
848 deletions
+396
-848
fill-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
fill-manager/src/main/java/com/mortals/xhx/base/system/user/model/UserEntity.java
...va/com/mortals/xhx/base/system/user/model/UserEntity.java
+236
-394
fill-manager/src/main/java/com/mortals/xhx/base/system/user/model/UserEntityExt.java
...com/mortals/xhx/base/system/user/model/UserEntityExt.java
+0
-50
fill-manager/src/main/java/com/mortals/xhx/base/system/user/model/UserQuery.java
...ava/com/mortals/xhx/base/system/user/model/UserQuery.java
+0
-1
fill-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
+5
-7
fill-manager/src/main/java/com/mortals/xhx/base/system/user/service/UserService.java
...com/mortals/xhx/base/system/user/service/UserService.java
+7
-62
fill-manager/src/main/java/com/mortals/xhx/base/system/user/service/impl/UserServiceImpl.java
...ls/xhx/base/system/user/service/impl/UserServiceImpl.java
+117
-188
fill-manager/src/main/java/com/mortals/xhx/base/system/user/web/UserController.java
.../com/mortals/xhx/base/system/user/web/UserController.java
+29
-97
fill-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
No files found.
fill-manager/src/main/java/com/mortals/xhx/base/system/user/dao/ibatis/UserDaoImpl.java
View file @
420a901e
...
@@ -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
;
...
...
fill-manager/src/main/java/com/mortals/xhx/base/system/user/model/UserEntity.java
View file @
420a901e
package
com.mortals.xhx.base.system.user.model
;
package
com.mortals.xhx.base.system.user.model
;
import
com.mortals.framework.ap.SysConstains
;
import
com.mortals.framework.ap.SysConstains
;
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
;
import
java.util.Date
;
import
java.util.Objects
;
/**
/**
*
* 用户信息业务实体对象
* Description:User
*
* date: 2021-9-26 16:11:48
* @author zxfei
*/
* @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双次加密
* 登录限制地址,多个IP地址用逗号分隔,可以使用IP段匹配,如:172.17.*非空:则只能该值内的IP可以登录
*/
*/
private
String
loginPwd3
;
/**
* 登录限制地址,多个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双次加密
* 获取 登录限制地址,多个IP地址用逗号分隔,可以使用IP段匹配,如:172.17.*非空:则只能该值内的IP可以登录
* @return loginPwd1
* @return String
*/
*/
public
String
getLoginPwd1
()
{
public
String
getLoginLimitAddress
(){
return
this
.
loginPwd1
;
return
loginLimitAddress
;
}
/**
* 设置 最近一次使用密码,使用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双次加密
* 设置 登录限制地址,多个IP地址用逗号分隔,可以使用IP段匹配,如:172.17.*非空:则只能该值内的IP可以登录
* @return loginPwd3
* @param loginLimitAddress
*/
*/
public
String
getLoginPwd3
()
{
public
void
setLoginLimitAddress
(
String
loginLimitAddress
){
return
this
.
loginPwd3
;
}
/**
* 设置 最近三次使用密码,使用md5双次加密
* @param loginPwd3
*/
public
void
setLoginPwd3
(
String
loginPwd3
)
{
this
.
loginPwd3
=
loginPwd3
;
}
/**
* 获取 登录限制地址,多个IP地址用逗号分隔,可以使用IP段匹配,如:172.17.*非空:则只能该值内的IP可以登录
* @return loginLimitAddress
*/
public
String
getLoginLimitAddress
()
{
return
this
.
loginLimitAddress
;
}
/**
* 设置 登录限制地址,多个IP地址用逗号分隔,可以使用IP段匹配,如:172.17.*非空:则只能该值内的IP可以登录
* @param 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
...
@@ -236,149 +145,111 @@ public class UserEntity extends UserEntityExt implements IUser {
...
@@ -236,149 +145,111 @@ 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
;
...
@@ -390,123 +261,96 @@ public class UserEntity extends UserEntityExt implements IUser {
...
@@ -390,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
;
}
}
}
}
...
@@ -515,56 +359,54 @@ public class UserEntity extends UserEntityExt implements IUser {
...
@@ -515,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
.
userType
=
null
;
this
.
phone
=
""
;
this
.
siteId
=
null
;
this
.
status
=
1
;
this
.
email
=
""
;
this
.
customerId
=
null
;
this
.
createTime
=
null
;
this
.
qq
=
""
;
this
.
createUserId
=
null
;
this
.
createUserName
=
null
;
this
.
userType
=
null
;
this
.
lastLoginTime
=
null
;
this
.
lastLoginAddress
=
null
;
this
.
siteIds
=
""
;
this
.
lastModPwdTime
=
null
;
this
.
lastModPwdAddr
=
null
;
this
.
areaCodes
=
""
;
this
.
status
=
1
;
this
.
createUserName
=
""
;
this
.
lastLoginTime
=
null
;
this
.
lastLoginAddress
=
""
;
}
}
}
}
\ No newline at end of file
fill-manager/src/main/java/com/mortals/xhx/base/system/user/model/UserEntityExt.java
deleted
100644 → 0
View file @
d200201e
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
;
/**
* 菜单栏
*/
private
String
menuUrl
;
/**
* 所属区域code,多个逗号分隔
*/
private
String
areaCodes
;
}
\ No newline at end of file
fill-manager/src/main/java/com/mortals/xhx/base/system/user/model/UserQuery.java
View file @
420a901e
package
com.mortals.xhx.base.system.user.model
;
package
com.mortals.xhx.base.system.user.model
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
/**
/**
* 用户信息业务查询对象
* 用户信息业务查询对象
...
...
fill-manager/src/main/java/com/mortals/xhx/base/system/user/model/vo/UserVo.java
View file @
420a901e
...
@@ -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
;
/**
/**
* 用户信息业务视图对象
* 用户信息业务视图对象
*
*
...
@@ -15,12 +12,13 @@ import java.util.List;
...
@@ -15,12 +12,13 @@ import java.util.List;
*/
*/
@Data
@Data
public
class
UserVo
extends
BaseEntityLong
{
public
class
UserVo
extends
BaseEntityLong
{
/**
/**
* 站点名称
* 站点名称
*/
*/
private
String
siteName
;
private
String
siteName
;
private
List
<
Long
>
roleIds
;
private
String
roleIds
;
/**
/**
* 唯一标识
* 唯一标识
*/
*/
...
@@ -40,7 +38,7 @@ public class UserVo extends BaseEntityLong {
...
@@ -40,7 +38,7 @@ public class UserVo extends BaseEntityLong {
*/
*/
private
Long
expireTime
;
private
Long
expireTime
;
private
Long
siteI
d
;
private
String
oldPasswor
d
;
private
String
newPassword
;
private
Long
customerId
;
private
String
siteIds
;
}
}
\ No newline at end of file
fill-manager/src/main/java/com/mortals/xhx/base/system/user/service/UserService.java
View file @
420a901e
...
@@ -8,8 +8,8 @@
...
@@ -8,8 +8,8 @@
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.service.ICRUDCacheService
;
import
com.mortals.framework.service.ICRUDCacheService
;
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
;
...
@@ -29,16 +29,8 @@ import java.util.Set;
...
@@ -29,16 +29,8 @@ import java.util.Set;
*/
*/
public
interface
UserService
extends
ICRUDCacheService
<
UserEntity
,
Long
>
{
public
interface
UserService
extends
ICRUDCacheService
<
UserEntity
,
Long
>
{
/**
* 用户登录
*
* @param loginName 登录用户名
* @param password 登录密码
* @param loginIp 登录IP
* @return
* @throws AppException
*/
public
UserEntity
doLogin
(
String
loginName
,
String
password
,
String
loginIp
)
throws
AppException
;
/**
/**
* 校验用户名与密码是否正确
* 校验用户名与密码是否正确
...
@@ -48,16 +40,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
...
@@ -48,16 +40,7 @@ public interface UserService extends ICRUDCacheService<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
;
/**
* 检查用户是否存在
*
* @param loginName 登录用户名
* @param userId 密码
* @return
*/
public
boolean
existUser
(
String
loginName
,
Long
userId
)
throws
AppException
;
/**
/**
* 通过登录用户获取菜单功能权限
* 通过登录用户获取菜单功能权限
...
@@ -65,7 +48,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
...
@@ -65,7 +48,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
* @param user
* @param user
* @return
* @return
*/
*/
public
List
<
MenuEntity
>
findOutlookBarList
(
IUser
user
);
List
<
MenuEntity
>
findOutlookBarList
(
IUser
user
);
/**
/**
* 查询用户所有有权限的菜单ID
* 查询用户所有有权限的菜单ID
...
@@ -73,47 +56,9 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
...
@@ -73,47 +56,9 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
* @param userEntity
* @param userEntity
* @return
* @return
*/
*/
public
Set
<
Long
>
findAllAuthIds
(
UserEntity
userEntity
)
throws
AppException
;
Set
<
Long
>
findAllAuthIds
(
UserEntity
userEntity
)
throws
AppException
;
/**
* 查询用户记录
*
* @param platformId
* @param params
* @param currPage
* @param prePageResult
* @return
* @throws AppException
*/
public
Result
<
UserEntity
>
find
(
Long
platformId
,
UserEntity
params
,
int
currPage
,
int
prePageResult
)
throws
AppException
;
/**
* 为客户创建用户
*
* @param currUser 当前用户
* @param customerId 客户ID
* @param customerName 客户名称
* @param loginName
* @param password
* @param userName
* @param mobile
* @return
* @throws AppException
*/
public
UserEntity
createUser
(
IUser
currUser
,
Long
customerId
,
String
customerName
,
String
loginName
,
String
password
,
String
userName
,
String
mobile
)
throws
AppException
;
/**
* 用户修改密码
*
* @param loginName
* @param oldPwd
* @param newPwd
* @return
* @throws AppException
*/
public
boolean
updateUserPwd
(
String
loginName
,
String
oldPwd
,
String
newPwd
)
throws
AppException
;
Rest
<
Void
>
refreshUser
();
UserDao
getUserDao
();
UserDao
getUserDao
();
...
...
fill-manager/src/main/java/com/mortals/xhx/base/system/user/service/impl/UserServiceImpl.java
View file @
420a901e
...
@@ -9,11 +9,10 @@
...
@@ -9,11 +9,10 @@
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.
code.UserType
;
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.model.Context
;
import
com.mortals.framework.model.PageInfo
;
import
com.mortals.framework.model.PageInfo
;
import
com.mortals.framework.model.Result
;
import
com.mortals.framework.service.IUser
;
import
com.mortals.framework.service.IUser
;
import
com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl
;
import
com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl
;
import
com.mortals.framework.util.SecurityUtil
;
import
com.mortals.framework.util.SecurityUtil
;
...
@@ -22,27 +21,37 @@ import com.mortals.xhx.base.system.menu.model.MenuEntity;
...
@@ -22,27 +21,37 @@ 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.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"
)
@Slf4j
public
class
UserServiceImpl
extends
AbstractCRUDCacheServiceImpl
<
UserDao
,
UserEntity
,
Long
>
implements
UserService
{
public
class
UserServiceImpl
extends
AbstractCRUDCacheServiceImpl
<
UserDao
,
UserEntity
,
Long
>
implements
UserService
{
...
@@ -50,8 +59,12 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
...
@@ -50,8 +59,12 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
private
MenuService
menuService
;
private
MenuService
menuService
;
@Autowired
@Autowired
private
ResourceService
resourceService
;
private
ResourceService
resourceService
;
@Autowired
private
RoleUserService
roleUserService
;
@Autowired
@Autowired
private
RoleUserDao
roleUserDao
;
private
IUserFeign
userFeign
;
@Override
@Override
protected
String
getExtKey
(
UserEntity
data
)
{
protected
String
getExtKey
(
UserEntity
data
)
{
...
@@ -59,147 +72,57 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
...
@@ -59,147 +72,57 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
}
}
@Override
public
UserEntity
doCheckUser
(
String
loginName
,
String
password
)
throws
AppException
{
private
void
doHandlerUser
(
UserEntity
entity
)
throws
AppException
{
UserQuery
params
=
new
UserQuery
();
if
(
StringUtils
.
isNotEmpty
(
entity
.
getLoginPwd
()))
{
params
.
setLoginName
(
loginName
);
try
{
UserEntity
sysUser
=
this
.
selectOne
(
params
);
entity
.
setLoginPwd
(
SecurityUtil
.
md5DoubleEncoding
(
entity
.
getLoginPwd
()));
if
(
sysUser
==
null
||
!
sysUser
.
getLoginName
().
equals
(
loginName
))
{
}
catch
(
Exception
e
)
{
return
null
;
throw
new
AppException
(
"密码转换异常"
);
}
try
{
if
(!
sysUser
.
getLoginPwd
().
equals
(
SecurityUtil
.
md5DoubleEncoding
(
password
)))
{
return
null
;
}
}
}
else
{
}
catch
(
Exception
e
)
{
entity
.
setLoginPwd
(
null
);
log
.
error
(
"查询用户异常,loginName:"
+
loginName
,
e
);
return
null
;
}
}
// if (entity.isSystemUser()) {
return
sysUser
;
// entity.setUserType(UserType.SYSTEM.getValue());
// } else {
// entity.setUserType(UserType.CUSTOMER.getValue());
// }
}
}
@Override
protected
void
saveBefore
(
UserEntity
entity
,
Context
context
)
throws
AppException
{
this
.
doHandlerUser
(
entity
);
}
@Override
@Override
protected
void
saveAfter
(
UserEntity
entity
,
Context
context
)
throws
AppException
{
protected
void
saveAfter
(
UserEntity
entity
,
Context
context
)
throws
AppException
{
if
(
CollectionUtils
.
isNotEmpty
(
entity
.
getRoleIds
())){
updateUserRole
(
entity
);
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
protected
void
updateBefore
(
UserEntity
entity
,
Context
context
)
throws
AppException
{
if
(
entity
.
getId
().
longValue
()
==
SysConstains
.
ADMIN_ID
&&
!
context
.
getUser
().
isAdmin
())
{
throw
new
AppException
(
"你没有权限执行该操作"
);
}
this
.
doHandlerUser
(
entity
);
}
}
@Override
@Override
protected
void
updateAfter
(
UserEntity
entity
,
Context
context
)
throws
AppException
{
protected
void
updateAfter
(
UserEntity
entity
,
Context
context
)
throws
AppException
{
if
(
CollectionUtils
.
isNotEmpty
(
entity
.
getRoleIds
())){
updateUserRole
(
entity
);
List
<
RoleUserEntity
>
roleUserEntityList
=
new
ArrayList
<>();
entity
.
getRoleIds
().
stream
().
forEach
(
item
->{
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
protected
UserEntity
findBefore
(
UserEntity
params
,
Context
context
)
throws
AppException
{
// if (StringUtils.isNotEmpty(params.getDeptIds())) {
// params.setDeptIds(StringUtils.fillWithMark(params.getDeptIds(), ","));
// }
return
super
.
findBefore
(
params
,
context
);
}
@Override
protected
UserEntity
findBefore
(
UserEntity
params
,
PageInfo
pageInfo
,
Context
context
)
throws
AppException
{
// if (StringUtils.isNotEmpty(params.getDeptIds())) {
// params.setDeptIds(StringUtils.fillWithMark(params.getDeptIds(), ","));
// }
return
super
.
findBefore
(
params
,
pageInfo
,
context
);
}
@Override
protected
void
findAfter
(
UserEntity
params
,
PageInfo
pageInfo
,
Context
context
,
List
<
UserEntity
>
list
)
throws
AppException
{
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
list
.
stream
().
forEach
(
item
->{
RoleUserEntity
query
=
new
RoleUserEntity
();
query
.
setUserId
(
item
.
getId
());
List
<
RoleUserEntity
>
roleUserEntityList
=
roleUserDao
.
getList
(
query
);
List
<
Long
>
roleIds
=
new
ArrayList
<>();
roleUserEntityList
.
stream
().
forEach
(
role
->{
roleIds
.
add
(
role
.
getRoleId
());
});
item
.
setRoleIds
(
roleIds
);
});
//List<RoleUserEntity> roleUserEntityList =
}
}
}
public
UserEntity
findByLoginName
(
String
loginName
)
{
private
void
updateUserRole
(
UserEntity
entity
)
{
UserQuery
params
=
new
UserQuery
();
if
(!
ObjectUtils
.
isEmpty
(
entity
.
getId
())
&&
entity
.
getId
().
longValue
()
!=
SysConstains
.
ADMIN_ID
&&
!
ObjectUtils
.
isEmpty
(
entity
.
getRoleIds
()))
{
params
.
setLoginName
(
loginName
);
RoleUserQuery
roleUserQuery
=
new
RoleUserQuery
();
List
<
UserEntity
>
userList
=
super
.
dao
.
getList
(
params
);
roleUserQuery
.
setUserId
(
entity
.
getId
());
if
(
userList
!=
null
&&
userList
.
size
()
>
0
)
{
List
<
Long
>
idList
=
Arrays
.
asList
(
entity
.
getRoleIds
().
split
(
","
)).
stream
().
map
(
Long:
:
parseLong
).
collect
(
Collectors
.
toList
());
return
userList
.
get
(
0
);
roleUserQuery
.
setRoleIdList
(
idList
);
roleUserService
.
doDistributionRole
(
roleUserQuery
);
}
}
return
null
;
}
}
@Override
@Override
public
UserEntity
doLogin
(
String
loginName
,
String
password
,
String
loginIp
)
throws
AppException
{
protected
void
findAfter
(
UserEntity
params
,
PageInfo
pageInfo
,
Context
context
,
List
<
UserEntity
>
list
)
throws
AppException
{
UserEntity
sysUser
=
this
.
findByLoginName
(
loginName
);
list
.
stream
().
peek
(
item
->
{
if
(
sysUser
==
null
||
!
sysUser
.
getLoginName
().
equals
(
loginName
))
{
RoleUserQuery
roleUserQuery
=
new
RoleUserQuery
();
throw
new
AppException
(
"用户名不存在!"
);
roleUserQuery
.
setUserId
(
item
.
getId
());
}
String
roleIds
=
roleUserService
.
find
(
roleUserQuery
).
stream
().
map
(
RoleUserEntity:
:
getRoleId
).
map
(
String:
:
valueOf
).
collect
(
Collectors
.
joining
(
","
));
try
{
item
.
setRoleIds
(
roleIds
);
if
(!
sysUser
.
getLoginPwd
().
equals
(
SecurityUtil
.
md5DoubleEncoding
(
password
)))
{
}).
count
();
throw
new
AppException
(
"登录密码错误!"
);
}
}
catch
(
Exception
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
;
}
}
@Override
public
UserEntity
doCheckUser
(
String
loginName
,
String
password
)
throws
AppException
{
UserEntity
sysUser
=
this
.
findByLoginName
(
loginName
);
if
(
sysUser
==
null
||
!
sysUser
.
getLoginName
().
equals
(
loginName
))
{
return
null
;
}
try
{
if
(!
sysUser
.
getLoginPwd
().
equals
(
SecurityUtil
.
md5DoubleEncoding
(
password
)))
{
return
null
;
}
}
catch
(
Exception
e
)
{
return
null
;
}
return
sysUser
;
}
@Override
@Override
public
Set
<
Long
>
findAllAuthIds
(
UserEntity
userEntity
)
throws
AppException
{
public
Set
<
Long
>
findAllAuthIds
(
UserEntity
userEntity
)
throws
AppException
{
...
@@ -267,77 +190,83 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
...
@@ -267,77 +190,83 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
}
}
@Override
@Override
public
Result
<
UserEntity
>
find
(
Long
platformId
,
UserEntity
params
,
int
currPage
,
int
prePageResult
)
throws
AppException
{
public
Rest
<
Void
>
refreshUser
()
{
PageInfo
pageInfo
=
new
PageInfo
(
prePageResult
);
UserPdu
userPdu
=
new
UserPdu
();
pageInfo
.
setCurrPage
(
currPage
);
userPdu
.
setPage
(
1
);
return
super
.
find
(
params
,
pageInfo
,
null
);
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
());
@Override
List
<
UserEntity
>
saveUpdateUserList
=
newUserList
.
parallelStream
().
map
(
item
->
{
public
UserEntity
createUser
(
IUser
currUser
,
Long
customerId
,
String
customerName
,
String
loginName
,
String
password
,
UserEntity
extCache
=
this
.
getExtCache
(
item
.
getLoginName
());
String
userName
,
String
mobile
)
throws
AppException
{
if
(
ObjectUtils
.
isEmpty
(
extCache
))
{
try
{
item
.
setCreateUserId
(
1L
);
UserEntity
entity
=
new
UserEntity
();
item
.
setCreateUserName
(
"系统管理员"
);
entity
.
initAttrValue
();
item
.
setCreateTime
(
new
Date
());
entity
.
setLoginName
(
loginName
);
return
item
;
entity
.
setRealName
(
userName
);
}
else
{
entity
.
setCustomerId
(
customerId
);
//更新用户列表
entity
.
setLoginPwd
(
password
);
item
.
setId
(
extCache
.
getId
());
entity
.
setMobile
(
mobile
);
item
.
setUpdateUserId
(
1L
);
entity
.
setUserType
(
UserType
.
CUSTOMER
.
getValue
());
item
.
setUpdateUserName
(
"系统管理员"
);
entity
.
setCreateTime
(
new
Date
());
item
.
setUpdateTime
(
new
Date
());
if
(
currUser
!=
null
)
{
return
item
;
entity
.
setCreateUser
(
currUser
.
getLoginName
());
}
entity
.
setCreateUserName
(
currUser
.
getRealName
());
}).
collect
(
Collectors
.
toList
());
}
Map
<
Boolean
,
List
<
UserEntity
>>
saveUpdateCollect
=
saveUpdateUserList
.
stream
().
collect
(
Collectors
.
partitioningBy
(
x
->
x
.
getId
()
==
null
));
this
.
doHandlerUser
(
entity
);
if
(!
ObjectUtils
.
isEmpty
(
saveUpdateCollect
.
get
(
true
)))
{
dao
.
insert
(
entity
);
//需要新增的用户
return
entity
;
log
.
info
(
"需要新增用户数量:{}"
,
saveUpdateCollect
.
get
(
true
).
size
());
}
catch
(
Exception
e
)
{
saveUpdateCollect
.
get
(
true
).
stream
().
forEach
(
item
->
{
log
.
error
(
"给客户创建用户异常-->customerId:"
+
customerId
+
",customerName:"
+
customerName
+
",loginName:"
+
loginName
+
this
.
getUserDao
().
insert
(
item
);
"-->原因:"
+
e
.
getMessage
());
this
.
putCache
(
item
.
getId
()
==
null
?
""
:
item
.
getId
().
toString
(),
item
);
return
null
;
RoleUserQuery
roleUserQuery
=
new
RoleUserQuery
();
}
roleUserQuery
.
setUserId
(
item
.
getId
());
}
roleUserQuery
.
setRoleIdList
(
Arrays
.
asList
(
1L
));
roleUserService
.
doDistributionRole
(
roleUserQuery
);
});
}
@Override
if
(!
ObjectUtils
.
isEmpty
(
saveUpdateCollect
.
get
(
false
)))
{
public
boolean
existUser
(
String
loginName
,
Long
userId
)
throws
AppException
{
//需要新增的用户
UserEntity
sysUser
=
this
.
findByLoginName
(
loginName
);
log
.
info
(
"需要更新用户数量:{}"
,
saveUpdateCollect
.
get
(
false
).
size
());
boolean
bRet
=
false
;
saveUpdateCollect
.
get
(
false
).
stream
().
forEach
(
item
->
{
if
(
sysUser
!=
null
)
{
this
.
getUserDao
().
update
(
item
);
if
(
userId
==
null
||
userId
==
0
||
userId
.
longValue
()
!=
sysUser
.
getId
().
longValue
())
{
this
.
putCache
(
item
.
getId
()
==
null
?
""
:
item
.
getId
().
toString
(),
item
);
bRet
=
true
;
});
}
//差集删除
Set
<
String
>
collectSet
=
newUserList
.
parallelStream
().
map
(
x
->
x
.
getLoginName
()).
collect
(
Collectors
.
toSet
());
Long
[]
removeUserIds
=
this
.
getCacheList
().
parallelStream
().
filter
(
f
->
!
collectSet
.
contains
(
f
.
getLoginName
())).
map
(
i
->
i
.
getId
()).
distinct
().
toArray
(
Long
[]::
new
);
if
(!
ObjectUtils
.
isEmpty
(
removeUserIds
))
{
log
.
info
(
"需要删除的本地用户数量:{}"
,
removeUserIds
.
length
);
this
.
remove
(
removeUserIds
,
null
);
}
}
}
//查找新增 与更新
}
}
return
bRet
;
return
Rest
.
ok
()
;
}
}
@Override
@Override
public
boolean
updateUserPwd
(
String
loginName
,
String
oldPwd
,
String
newPwd
)
throws
AppException
{
protected
void
removeAfter
(
Long
[]
ids
,
Context
context
,
int
result
)
throws
AppException
{
UserEntity
sysUser
=
this
.
findByLoginName
(
loginName
);
super
.
removeAfter
(
ids
,
context
,
result
);
if
(
sysUser
==
null
||
!
sysUser
.
getLoginName
().
equals
(
loginName
))
{
RoleUserQuery
roleUserQuery
=
new
RoleUserQuery
();
throw
new
AppException
(
"帐号错误!"
);
roleUserQuery
.
setUserIdList
(
Arrays
.
asList
(
ids
));
}
Long
[]
userIds
=
roleUserService
.
find
(
roleUserQuery
).
stream
().
map
(
RoleUserEntity:
:
getId
).
toArray
(
Long
[]::
new
);
try
{
roleUserService
.
remove
(
userIds
,
context
);
if
(!
sysUser
.
getLoginPwd
().
equals
(
SecurityUtil
.
md5DoubleEncoding
(
oldPwd
)))
{
throw
new
AppException
(
"原始密码错误!"
);
}
}
catch
(
Exception
e
)
{
throw
new
AppException
(
"密码验认出错!"
,
e
);
}
try
{
sysUser
.
setLoginPwd
(
SecurityUtil
.
md5DoubleEncoding
(
newPwd
));
sysUser
.
setLoginPwd3
(
sysUser
.
getLoginPwd2
());
sysUser
.
setLoginPwd2
(
sysUser
.
getLoginPwd1
());
sysUser
.
setLoginPwd1
(
sysUser
.
getLoginPwd
());
sysUser
.
setLastModPwdTime
(
new
Date
());
}
catch
(
Exception
e
)
{
throw
new
AppException
(
"密码转换异常!"
,
e
);
}
dao
.
update
(
sysUser
);
return
true
;
}
}
@Override
@Override
public
UserDao
getUserDao
()
{
public
UserDao
getUserDao
()
{
return
this
.
getDao
();
return
this
.
getDao
();
...
...
fill-manager/src/main/java/com/mortals/xhx/base/system/user/web/UserController.java
View file @
420a901e
/**
* 文件: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
com.
alibaba.fastjson.JSONObject
;
import
com.
mortals.framework.annotation.UnAuth
;
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.Context
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.framework.web.BaseCRUDJsonMappingController
;
import
com.mortals.xhx.base.system.role.model.RoleEntity
;
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.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
com.mortals.xhx.common.code.UserStatus
;
import
io.jsonwebtoken.Claims
;
import
io.jsonwebtoken.Jwts
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.Base64
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
/**
/**
* 用户信息
* <p>Title: 用户信息</p>
*
* <p>Description: UserController </p>
* @author: zxfei
* <p>Copyright: Copyright ® </p>
* @date: 2022/5/7 15:42
* <p>Company: </p>
* @author
* @version 1.0.0
*/
*/
@RestController
@RestController
@RequestMapping
(
"user"
)
@RequestMapping
(
"user"
)
...
@@ -47,91 +42,28 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic
...
@@ -47,91 +42,28 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic
@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
())));
}
@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
protected
int
editAfter
(
Long
id
,
Map
<
String
,
Object
>
model
,
UserEntity
entity
,
Context
context
)
throws
AppException
{
RoleUserQuery
roleUserQuery
=
new
RoleUserQuery
();
roleUserQuery
.
setUserId
(
entity
.
getId
());
List
<
Long
>
roleIds
=
roleUserService
.
find
(
roleUserQuery
).
stream
().
map
(
RoleUserEntity:
:
getRoleId
).
collect
(
Collectors
.
toList
());
entity
.
setRoleIds
(
roleIds
);
return
super
.
editAfter
(
id
,
model
,
entity
,
context
);
}
@Override
protected
int
saveAfter
(
UserEntity
entity
,
Map
<
String
,
Object
>
model
,
Context
context
)
throws
AppException
{
if
(
entity
.
getId
()
==
getCurUser
().
getId
())
{
// TODO: 2022/8/15 更新redis session信息
//saveCurrUserForSession(request, response, userService.get(form.getEntity().getId(), false));
}
return
super
.
saveAfter
(
entity
,
model
,
context
);
}
// @Override
// 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);
// }
this
.
addDict
(
model
,
"userType"
,
IBaseEnum
.
getEnumMap
(
UserType
.
class
));
@RequestMapping
(
value
=
"change/password"
,
method
=
RequestMethod
.
POST
)
this
.
addDict
(
model
,
"status"
,
UserStatus
.
getEnumMap
());
@Operlog
(
msg
=
"密码修改成功!"
)
List
<
RoleEntity
>
roleList
=
roleService
.
find
(
new
RoleEntity
());
public
String
changePassword
(
@RequestParam
String
oldPwd
,
@RequestParam
String
newPwd
)
{
this
.
addDict
(
model
,
"roleId"
,
roleList
.
stream
().
collect
(
Collectors
.
toMap
(
e
->
e
.
getId
().
toString
(),
e
->
e
.
getName
())));
JSONObject
ret
=
new
JSONObject
();
super
.
init
(
model
,
context
);
try
{
service
.
updateUserPwd
(
super
.
getCurUser
().
getLoginName
(),
oldPwd
,
newPwd
);
ret
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_SUCCESS
);
ret
.
put
(
KEY_RESULT_MSG
,
"密码修改成功!"
);
}
catch
(
Exception
e
)
{
ret
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_FAILURE
);
ret
.
put
(
KEY_RESULT_MSG
,
super
.
convertException
(
e
));
}
return
ret
.
toJSONString
();
}
}
public
static
void
main
(
String
[]
args
)
{
@PostMapping
({
"refreshUser"
})
@UnAuth
String
token
=
"eyJhbGciOiJIUzI1NiJ9.eyJsb2dpbl91c2VyX2tleSI6IjIzNGE5NDA5ZDVhOTQ3MWNhMzdkYjZkYmMwY2JjZTc5In0.MWyQW40HYDxyUz7PJRf_nRsFPWx3Hr811Ime984nixs"
;
public
Rest
<
Object
>
refreshUser
()
{
String
secret
=
"026db82420614469897fcc2dc1b4ce38"
;
log
.
info
(
"刷新用户"
);
Claims
claims
=
Jwts
.
parser
()
this
.
service
.
refreshUser
();
.
setSigningKey
(
Base64
.
getEncoder
().
encodeToString
(
secret
.
getBytes
()))
return
Rest
.
ok
(
"用户同步刷新操作成功"
);
.
parseClaimsJws
(
token
)
.
getBody
();
String
uuid
=
(
String
)
claims
.
get
(
"login_user_key"
);
System
.
out
.
println
(
uuid
);
}
}
}
}
\ No newline at end of file
fill-manager/src/main/java/com/mortals/xhx/base/system/user/web/UserForm.java
deleted
100644 → 0
View file @
d200201e
/**
* 文件: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
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