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
3ab4c4d7
Commit
3ab4c4d7
authored
Jul 28, 2024
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加目录字段
parent
03610017
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
191 additions
and
910 deletions
+191
-910
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
+21
-38
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
-44
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
+19
-596
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
+1
-5
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/user/service/UserService.java
...com/mortals/xhx/base/system/user/service/UserService.java
+11
-31
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
+117
-162
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/user/web/UserController.java
.../com/mortals/xhx/base/system/user/web/UserController.java
+22
-34
No files found.
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/user/model/UserEntity.java
View file @
3ab4c4d7
package
com.mortals.xhx.base.system.user.model
;
import
com.mortals.framework.annotation.desensitization.MobileDesensitize
;
import
com.mortals.framework.ap.SysConstains
;
import
com.mortals.framework.service.IUser
;
import
com.mortals.xhx.base.system.user.model.vo.UserVo
;
...
...
@@ -35,7 +34,6 @@ public class UserEntity extends UserVo implements IUser {
/**
* 用户手机号
*/
@MobileDesensitize
private
String
mobile
;
/**
* 用户联系电话
...
...
@@ -49,20 +47,14 @@ public class UserEntity extends UserVo implements IUser {
* QQ号码
*/
private
String
qq
;
/**
* 用户类型(0.系统用户,1.普通用户,2.工作人员,3.巡查人员,4.窗口负责人)
*/
private
Integer
userType
;
/**
* 用户所属部门id
*/
private
Long
deptId
;
private
String
deptName
;
/**
*
所属部门名称
*
用户类型(0.系统用户,1.普通用户,2.工作人员)
*/
private
String
deptName
;
private
Integer
userType
;
/**
* 所属站点id,多个逗号分隔
*/
...
...
@@ -88,16 +80,20 @@ public class UserEntity extends UserVo implements IUser {
*/
private
String
lastLoginAddress
;
/**
* 员工id
*/
private
Long
customerId
;
/**
* 钉钉userId
*/
private
String
dingUserId
;
public
UserEntity
(){}
public
void
setDeptId
(
Long
deptId
)
{
this
.
deptId
=
deptId
;
}
public
void
setDeptName
(
String
deptName
)
{
this
.
deptName
=
deptName
;
}
public
String
getDingUserId
()
{
return
dingUserId
;
}
...
...
@@ -106,7 +102,6 @@ public class UserEntity extends UserVo implements IUser {
this
.
dingUserId
=
dingUserId
;
}
public
UserEntity
(){}
/**
* 获取 登录名
* @return String
...
...
@@ -128,15 +123,6 @@ public class UserEntity extends UserVo implements IUser {
public
String
getLoginPwd
(){
return
loginPwd
;
}
public
void
setDeptId
(
Long
deptId
)
{
this
.
deptId
=
deptId
;
}
public
void
setDeptName
(
String
deptName
)
{
this
.
deptName
=
deptName
;
}
/**
* 设置 登录密码,使用md5双次加密
* @param loginPwd
...
...
@@ -169,7 +155,6 @@ public class UserEntity extends UserVo implements IUser {
@Override
public
boolean
isAdmin
()
{
return
super
.
getId
()
==
null
?
false
:
super
.
getId
().
longValue
()
==
SysConstains
.
ADMIN_ID
;
// return true;
}
@Override
...
...
@@ -246,7 +231,7 @@ public class UserEntity extends UserVo implements IUser {
this
.
qq
=
qq
;
}
/**
* 获取 用户类型(0.系统用户,1.普通用户,2.工作人员
,3.普通员工
)
* 获取 用户类型(0.系统用户,1.普通用户,2.工作人员)
* @return Integer
*/
public
Integer
getUserType
(){
...
...
@@ -262,17 +247,17 @@ public class UserEntity extends UserVo implements IUser {
@Override
public
Long
getDeptId
()
{
return
this
.
deptId
;
return
deptId
;
}
@Override
public
String
getDeptName
()
{
return
this
.
deptName
;
return
deptName
;
}
@Override
public
Long
getCustomerId
()
{
return
this
.
customerId
;
return
null
;
}
@Override
...
...
@@ -377,9 +362,7 @@ public class UserEntity extends UserVo implements IUser {
}
public
void
setCustomerId
(
Long
customerId
)
{
this
.
customerId
=
customerId
;
}
@Override
public
int
hashCode
()
{
...
...
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/user/model/UserEntityExt.java
deleted
100644 → 0
View file @
03610017
package
com.mortals.xhx.base.system.user.model
;
import
com.mortals.framework.model.BaseEntityLong
;
import
lombok.Data
;
/**
* Description:User
* date: 2021-9-26 16:11:48
*/
@Data
public
class
UserEntityExt
extends
BaseEntityLong
{
/**
* 站点名称
*/
private
String
siteName
;
private
String
roleIds
;
/**
* 唯一标识
*/
private
String
token
;
/**
* 菜单栏
*/
private
String
menuUrl
;
/**
* 登录时间
*/
private
Long
loginTime
;
/**
* 过期时间
*/
private
Long
expireTime
;
private
Long
deptId
;
private
String
deptName
;
}
\ No newline at end of file
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/user/model/UserQuery.java
View file @
3ab4c4d7
package
com.mortals.xhx.base.system.user.model
;
import
java.util.List
;
import
java.util.List
;
/**
* 用户信息业务查询对象
*
* @author zxfei
* @date 202
3-03-09
* @date 202
2-07-06
*/
public
class
UserQuery
extends
UserEntity
{
/** 开始 用户ID,主键,自增长 */
...
...
@@ -21,94 +21,48 @@ public class UserQuery extends UserEntity {
/** 用户ID,主键,自增长列表 */
private
List
<
Long
>
idList
;
/** 用户ID,主键,自增长排除列表 */
private
List
<
Long
>
idNotList
;
/** 登录名 */
private
List
<
String
>
loginNameList
;
/** 登录名排除列表 */
private
List
<
String
>
loginNameNotList
;
/** 登录密码,使用md5双次加密 */
private
List
<
String
>
loginPwdList
;
/** 登录密码,使用md5双次加密排除列表 */
private
List
<
String
>
loginPwdNotList
;
/** 登录限制地址,多个IP地址用逗号分隔,可以使用IP段匹配,如:172.17.*非空:则只能该值内的IP可以登录 */
private
List
<
String
>
loginLimitAddressList
;
/** 登录限制地址,多个IP地址用逗号分隔,可以使用IP段匹配,如:172.17.*非空:则只能该值内的IP可以登录排除列表 */
private
List
<
String
>
loginLimitAddressNotList
;
/** 用户名 */
private
List
<
String
>
realNameList
;
/** 用户名排除列表 */
private
List
<
String
>
realNameNotList
;
/** 用户手机号 */
private
List
<
String
>
mobileList
;
/** 用户手机号排除列表 */
private
List
<
String
>
mobileNotList
;
/** 用户联系电话 */
private
List
<
String
>
phoneList
;
/** 用户联系电话排除列表 */
private
List
<
String
>
phoneNotList
;
/** 用户邮箱 */
private
List
<
String
>
emailList
;
/** 用户邮箱排除列表 */
private
List
<
String
>
emailNotList
;
/** QQ号码 */
private
List
<
String
>
qqList
;
/** QQ号码排除列表 */
private
List
<
String
>
qqNotList
;
/** 开始 用户类型(0.系统用户,1.后台管理,2.工作人员) */
/** 开始 用户类型(0.系统用户,1.普通用户,2.工作人员) */
private
Integer
userTypeStart
;
/** 结束 用户类型(0.系统用户,1.
后台管理
,2.工作人员) */
/** 结束 用户类型(0.系统用户,1.
普通用户
,2.工作人员) */
private
Integer
userTypeEnd
;
/** 增加 用户类型(0.系统用户,1.
后台管理
,2.工作人员) */
/** 增加 用户类型(0.系统用户,1.
普通用户
,2.工作人员) */
private
Integer
userTypeIncrement
;
/** 用户类型(0.系统用户,1.
后台管理
,2.工作人员)列表 */
/** 用户类型(0.系统用户,1.
普通用户
,2.工作人员)列表 */
private
List
<
Integer
>
userTypeList
;
/** 用户类型(0.系统用户,1.后台管理,2.工作人员)排除列表 */
private
List
<
Integer
>
userTypeNotList
;
/** 开始 用户所属部门id */
private
Long
deptIdStart
;
/** 结束 用户所属部门id */
private
Long
deptIdEnd
;
/** 增加 用户所属部门id */
private
Long
deptIdIncrement
;
/** 用户所属部门id列表 */
private
List
<
Long
>
deptIdList
;
/** 用户所属部门id排除列表 */
private
List
<
Long
>
deptIdNotList
;
/** 所属部门名称 */
private
List
<
String
>
deptNameList
;
/** 所属部门名称排除列表 */
private
List
<
String
>
deptNameNotList
;
/** 所属站点id,多个逗号分隔 */
private
List
<
String
>
siteIdsList
;
/** 所属站点id,多个逗号分隔排除列表 */
private
List
<
String
>
siteIdsNotList
;
/** 所属区域code,多个逗号分隔 */
private
List
<
String
>
areaCodesList
;
/** 所属区域code,多个逗号分隔排除列表 */
private
List
<
String
>
areaCodesNotList
;
/** 开始 用户状态(0.停用,1.正常,2.冻结,3.销户,4.离职) */
private
Integer
statusStart
;
...
...
@@ -121,9 +75,6 @@ public class UserQuery extends UserEntity {
/** 用户状态(0.停用,1.正常,2.冻结,3.销户,4.离职)列表 */
private
List
<
Integer
>
statusList
;
/** 用户状态(0.停用,1.正常,2.冻结,3.销户,4.离职)排除列表 */
private
List
<
Integer
>
statusNotList
;
/** 开始 创建时间 */
private
String
createTimeStart
;
...
...
@@ -142,14 +93,9 @@ public class UserQuery extends UserEntity {
/** 创建用户列表 */
private
List
<
Long
>
createUserIdList
;
/** 创建用户排除列表 */
private
List
<
Long
>
createUserIdNotList
;
/** 创建用户名称 */
private
List
<
String
>
createUserNameList
;
/** 创建用户名称排除列表 */
private
List
<
String
>
createUserNameNotList
;
/** 开始 最后一次登录时间 */
private
String
lastLoginTimeStart
;
...
...
@@ -159,16 +105,6 @@ public class UserQuery extends UserEntity {
/** 最后一次登录地址 */
private
List
<
String
>
lastLoginAddressList
;
/** 最后一次登录地址排除列表 */
private
List
<
String
>
lastLoginAddressNotList
;
/** 钉钉userId */
private
List
<
String
>
dingUserIdList
;
/** 钉钉userId排除列表 */
private
List
<
String
>
dingUserIdNotList
;
/** OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) */
private
List
<
UserQuery
>
orConditionList
;
...
...
@@ -241,23 +177,6 @@ public class UserQuery extends UserEntity {
this
.
idList
=
idList
;
}
/**
* 获取 用户ID,主键,自增长
* @return idNotList
*/
public
List
<
Long
>
getIdNotList
(){
return
this
.
idNotList
;
}
/**
* 设置 用户ID,主键,自增长
* @param idNotList
*/
public
void
setIdNotList
(
List
<
Long
>
idNotList
){
this
.
idNotList
=
idNotList
;
}
/**
* 获取 登录名
* @return loginNameList
...
...
@@ -273,23 +192,6 @@ public class UserQuery extends UserEntity {
public
void
setLoginNameList
(
List
<
String
>
loginNameList
){
this
.
loginNameList
=
loginNameList
;
}
/**
* 获取 登录名
* @return loginNameNotList
*/
public
List
<
String
>
getLoginNameNotList
(){
return
this
.
loginNameNotList
;
}
/**
* 设置 登录名
* @param loginNameNotList
*/
public
void
setLoginNameNotList
(
List
<
String
>
loginNameNotList
){
this
.
loginNameNotList
=
loginNameNotList
;
}
/**
* 获取 登录密码,使用md5双次加密
* @return loginPwdList
...
...
@@ -305,23 +207,6 @@ public class UserQuery extends UserEntity {
public
void
setLoginPwdList
(
List
<
String
>
loginPwdList
){
this
.
loginPwdList
=
loginPwdList
;
}
/**
* 获取 登录密码,使用md5双次加密
* @return loginPwdNotList
*/
public
List
<
String
>
getLoginPwdNotList
(){
return
this
.
loginPwdNotList
;
}
/**
* 设置 登录密码,使用md5双次加密
* @param loginPwdNotList
*/
public
void
setLoginPwdNotList
(
List
<
String
>
loginPwdNotList
){
this
.
loginPwdNotList
=
loginPwdNotList
;
}
/**
* 获取 登录限制地址,多个IP地址用逗号分隔,可以使用IP段匹配,如:172.17.*非空:则只能该值内的IP可以登录
* @return loginLimitAddressList
...
...
@@ -337,23 +222,6 @@ public class UserQuery extends UserEntity {
public
void
setLoginLimitAddressList
(
List
<
String
>
loginLimitAddressList
){
this
.
loginLimitAddressList
=
loginLimitAddressList
;
}
/**
* 获取 登录限制地址,多个IP地址用逗号分隔,可以使用IP段匹配,如:172.17.*非空:则只能该值内的IP可以登录
* @return loginLimitAddressNotList
*/
public
List
<
String
>
getLoginLimitAddressNotList
(){
return
this
.
loginLimitAddressNotList
;
}
/**
* 设置 登录限制地址,多个IP地址用逗号分隔,可以使用IP段匹配,如:172.17.*非空:则只能该值内的IP可以登录
* @param loginLimitAddressNotList
*/
public
void
setLoginLimitAddressNotList
(
List
<
String
>
loginLimitAddressNotList
){
this
.
loginLimitAddressNotList
=
loginLimitAddressNotList
;
}
/**
* 获取 用户名
* @return realNameList
...
...
@@ -369,23 +237,6 @@ public class UserQuery extends UserEntity {
public
void
setRealNameList
(
List
<
String
>
realNameList
){
this
.
realNameList
=
realNameList
;
}
/**
* 获取 用户名
* @return realNameNotList
*/
public
List
<
String
>
getRealNameNotList
(){
return
this
.
realNameNotList
;
}
/**
* 设置 用户名
* @param realNameNotList
*/
public
void
setRealNameNotList
(
List
<
String
>
realNameNotList
){
this
.
realNameNotList
=
realNameNotList
;
}
/**
* 获取 用户手机号
* @return mobileList
...
...
@@ -401,23 +252,6 @@ public class UserQuery extends UserEntity {
public
void
setMobileList
(
List
<
String
>
mobileList
){
this
.
mobileList
=
mobileList
;
}
/**
* 获取 用户手机号
* @return mobileNotList
*/
public
List
<
String
>
getMobileNotList
(){
return
this
.
mobileNotList
;
}
/**
* 设置 用户手机号
* @param mobileNotList
*/
public
void
setMobileNotList
(
List
<
String
>
mobileNotList
){
this
.
mobileNotList
=
mobileNotList
;
}
/**
* 获取 用户联系电话
* @return phoneList
...
...
@@ -433,23 +267,6 @@ public class UserQuery extends UserEntity {
public
void
setPhoneList
(
List
<
String
>
phoneList
){
this
.
phoneList
=
phoneList
;
}
/**
* 获取 用户联系电话
* @return phoneNotList
*/
public
List
<
String
>
getPhoneNotList
(){
return
this
.
phoneNotList
;
}
/**
* 设置 用户联系电话
* @param phoneNotList
*/
public
void
setPhoneNotList
(
List
<
String
>
phoneNotList
){
this
.
phoneNotList
=
phoneNotList
;
}
/**
* 获取 用户邮箱
* @return emailList
...
...
@@ -465,23 +282,6 @@ public class UserQuery extends UserEntity {
public
void
setEmailList
(
List
<
String
>
emailList
){
this
.
emailList
=
emailList
;
}
/**
* 获取 用户邮箱
* @return emailNotList
*/
public
List
<
String
>
getEmailNotList
(){
return
this
.
emailNotList
;
}
/**
* 设置 用户邮箱
* @param emailNotList
*/
public
void
setEmailNotList
(
List
<
String
>
emailNotList
){
this
.
emailNotList
=
emailNotList
;
}
/**
* 获取 QQ号码
* @return qqList
...
...
@@ -497,25 +297,8 @@ public class UserQuery extends UserEntity {
public
void
setQqList
(
List
<
String
>
qqList
){
this
.
qqList
=
qqList
;
}
/**
* 获取 QQ号码
* @return qqNotList
*/
public
List
<
String
>
getQqNotList
(){
return
this
.
qqNotList
;
}
/**
* 设置 QQ号码
* @param qqNotList
*/
public
void
setQqNotList
(
List
<
String
>
qqNotList
){
this
.
qqNotList
=
qqNotList
;
}
/**
* 获取 开始 用户类型(0.系统用户,1.
后台管理
,2.工作人员)
* 获取 开始 用户类型(0.系统用户,1.
普通用户
,2.工作人员)
* @return userTypeStart
*/
public
Integer
getUserTypeStart
(){
...
...
@@ -523,7 +306,7 @@ public class UserQuery extends UserEntity {
}
/**
* 设置 开始 用户类型(0.系统用户,1.
后台管理
,2.工作人员)
* 设置 开始 用户类型(0.系统用户,1.
普通用户
,2.工作人员)
* @param userTypeStart
*/
public
void
setUserTypeStart
(
Integer
userTypeStart
){
...
...
@@ -531,7 +314,7 @@ public class UserQuery extends UserEntity {
}
/**
* 获取 结束 用户类型(0.系统用户,1.
后台管理
,2.工作人员)
* 获取 结束 用户类型(0.系统用户,1.
普通用户
,2.工作人员)
* @return $userTypeEnd
*/
public
Integer
getUserTypeEnd
(){
...
...
@@ -539,7 +322,7 @@ public class UserQuery extends UserEntity {
}
/**
* 设置 结束 用户类型(0.系统用户,1.
后台管理
,2.工作人员)
* 设置 结束 用户类型(0.系统用户,1.
普通用户
,2.工作人员)
* @param userTypeEnd
*/
public
void
setUserTypeEnd
(
Integer
userTypeEnd
){
...
...
@@ -547,7 +330,7 @@ public class UserQuery extends UserEntity {
}
/**
* 获取 增加 用户类型(0.系统用户,1.
后台管理
,2.工作人员)
* 获取 增加 用户类型(0.系统用户,1.
普通用户
,2.工作人员)
* @return userTypeIncrement
*/
public
Integer
getUserTypeIncrement
(){
...
...
@@ -555,7 +338,7 @@ public class UserQuery extends UserEntity {
}
/**
* 设置 增加 用户类型(0.系统用户,1.
后台管理
,2.工作人员)
* 设置 增加 用户类型(0.系统用户,1.
普通用户
,2.工作人员)
* @param userTypeIncrement
*/
public
void
setUserTypeIncrement
(
Integer
userTypeIncrement
){
...
...
@@ -563,7 +346,7 @@ public class UserQuery extends UserEntity {
}
/**
* 获取 用户类型(0.系统用户,1.
后台管理
,2.工作人员)
* 获取 用户类型(0.系统用户,1.
普通用户
,2.工作人员)
* @return userTypeList
*/
public
List
<
Integer
>
getUserTypeList
(){
...
...
@@ -571,143 +354,13 @@ public class UserQuery extends UserEntity {
}
/**
* 设置 用户类型(0.系统用户,1.
后台管理
,2.工作人员)
* 设置 用户类型(0.系统用户,1.
普通用户
,2.工作人员)
* @param userTypeList
*/
public
void
setUserTypeList
(
List
<
Integer
>
userTypeList
){
this
.
userTypeList
=
userTypeList
;
}
/**
* 获取 用户类型(0.系统用户,1.后台管理,2.工作人员)
* @return userTypeNotList
*/
public
List
<
Integer
>
getUserTypeNotList
(){
return
this
.
userTypeNotList
;
}
/**
* 设置 用户类型(0.系统用户,1.后台管理,2.工作人员)
* @param userTypeNotList
*/
public
void
setUserTypeNotList
(
List
<
Integer
>
userTypeNotList
){
this
.
userTypeNotList
=
userTypeNotList
;
}
/**
* 获取 开始 用户所属部门id
* @return deptIdStart
*/
public
Long
getDeptIdStart
(){
return
this
.
deptIdStart
;
}
/**
* 设置 开始 用户所属部门id
* @param deptIdStart
*/
public
void
setDeptIdStart
(
Long
deptIdStart
){
this
.
deptIdStart
=
deptIdStart
;
}
/**
* 获取 结束 用户所属部门id
* @return $deptIdEnd
*/
public
Long
getDeptIdEnd
(){
return
this
.
deptIdEnd
;
}
/**
* 设置 结束 用户所属部门id
* @param deptIdEnd
*/
public
void
setDeptIdEnd
(
Long
deptIdEnd
){
this
.
deptIdEnd
=
deptIdEnd
;
}
/**
* 获取 增加 用户所属部门id
* @return deptIdIncrement
*/
public
Long
getDeptIdIncrement
(){
return
this
.
deptIdIncrement
;
}
/**
* 设置 增加 用户所属部门id
* @param deptIdIncrement
*/
public
void
setDeptIdIncrement
(
Long
deptIdIncrement
){
this
.
deptIdIncrement
=
deptIdIncrement
;
}
/**
* 获取 用户所属部门id
* @return deptIdList
*/
public
List
<
Long
>
getDeptIdList
(){
return
this
.
deptIdList
;
}
/**
* 设置 用户所属部门id
* @param deptIdList
*/
public
void
setDeptIdList
(
List
<
Long
>
deptIdList
){
this
.
deptIdList
=
deptIdList
;
}
/**
* 获取 用户所属部门id
* @return deptIdNotList
*/
public
List
<
Long
>
getDeptIdNotList
(){
return
this
.
deptIdNotList
;
}
/**
* 设置 用户所属部门id
* @param deptIdNotList
*/
public
void
setDeptIdNotList
(
List
<
Long
>
deptIdNotList
){
this
.
deptIdNotList
=
deptIdNotList
;
}
/**
* 获取 所属部门名称
* @return deptNameList
*/
public
List
<
String
>
getDeptNameList
(){
return
this
.
deptNameList
;
}
/**
* 设置 所属部门名称
* @param deptNameList
*/
public
void
setDeptNameList
(
List
<
String
>
deptNameList
){
this
.
deptNameList
=
deptNameList
;
}
/**
* 获取 所属部门名称
* @return deptNameNotList
*/
public
List
<
String
>
getDeptNameNotList
(){
return
this
.
deptNameNotList
;
}
/**
* 设置 所属部门名称
* @param deptNameNotList
*/
public
void
setDeptNameNotList
(
List
<
String
>
deptNameNotList
){
this
.
deptNameNotList
=
deptNameNotList
;
}
/**
* 获取 所属站点id,多个逗号分隔
* @return siteIdsList
...
...
@@ -723,23 +376,6 @@ public class UserQuery extends UserEntity {
public
void
setSiteIdsList
(
List
<
String
>
siteIdsList
){
this
.
siteIdsList
=
siteIdsList
;
}
/**
* 获取 所属站点id,多个逗号分隔
* @return siteIdsNotList
*/
public
List
<
String
>
getSiteIdsNotList
(){
return
this
.
siteIdsNotList
;
}
/**
* 设置 所属站点id,多个逗号分隔
* @param siteIdsNotList
*/
public
void
setSiteIdsNotList
(
List
<
String
>
siteIdsNotList
){
this
.
siteIdsNotList
=
siteIdsNotList
;
}
/**
* 获取 所属区域code,多个逗号分隔
* @return areaCodesList
...
...
@@ -755,23 +391,6 @@ public class UserQuery extends UserEntity {
public
void
setAreaCodesList
(
List
<
String
>
areaCodesList
){
this
.
areaCodesList
=
areaCodesList
;
}
/**
* 获取 所属区域code,多个逗号分隔
* @return areaCodesNotList
*/
public
List
<
String
>
getAreaCodesNotList
(){
return
this
.
areaCodesNotList
;
}
/**
* 设置 所属区域code,多个逗号分隔
* @param areaCodesNotList
*/
public
void
setAreaCodesNotList
(
List
<
String
>
areaCodesNotList
){
this
.
areaCodesNotList
=
areaCodesNotList
;
}
/**
* 获取 开始 用户状态(0.停用,1.正常,2.冻结,3.销户,4.离职)
* @return statusStart
...
...
@@ -836,23 +455,6 @@ public class UserQuery extends UserEntity {
this
.
statusList
=
statusList
;
}
/**
* 获取 用户状态(0.停用,1.正常,2.冻结,3.销户,4.离职)
* @return statusNotList
*/
public
List
<
Integer
>
getStatusNotList
(){
return
this
.
statusNotList
;
}
/**
* 设置 用户状态(0.停用,1.正常,2.冻结,3.销户,4.离职)
* @param statusNotList
*/
public
void
setStatusNotList
(
List
<
Integer
>
statusNotList
){
this
.
statusNotList
=
statusNotList
;
}
/**
* 获取 开始 创建时间
* @return createTimeStart
...
...
@@ -949,23 +551,6 @@ public class UserQuery extends UserEntity {
this
.
createUserIdList
=
createUserIdList
;
}
/**
* 获取 创建用户
* @return createUserIdNotList
*/
public
List
<
Long
>
getCreateUserIdNotList
(){
return
this
.
createUserIdNotList
;
}
/**
* 设置 创建用户
* @param createUserIdNotList
*/
public
void
setCreateUserIdNotList
(
List
<
Long
>
createUserIdNotList
){
this
.
createUserIdNotList
=
createUserIdNotList
;
}
/**
* 获取 创建用户名称
* @return createUserNameList
...
...
@@ -981,23 +566,6 @@ public class UserQuery extends UserEntity {
public
void
setCreateUserNameList
(
List
<
String
>
createUserNameList
){
this
.
createUserNameList
=
createUserNameList
;
}
/**
* 获取 创建用户名称
* @return createUserNameNotList
*/
public
List
<
String
>
getCreateUserNameNotList
(){
return
this
.
createUserNameNotList
;
}
/**
* 设置 创建用户名称
* @param createUserNameNotList
*/
public
void
setCreateUserNameNotList
(
List
<
String
>
createUserNameNotList
){
this
.
createUserNameNotList
=
createUserNameNotList
;
}
/**
* 获取 开始 最后一次登录时间
* @return lastLoginTimeStart
...
...
@@ -1045,23 +613,6 @@ public class UserQuery extends UserEntity {
public
void
setLastLoginAddressList
(
List
<
String
>
lastLoginAddressList
){
this
.
lastLoginAddressList
=
lastLoginAddressList
;
}
/**
* 获取 最后一次登录地址
* @return lastLoginAddressNotList
*/
public
List
<
String
>
getLastLoginAddressNotList
(){
return
this
.
lastLoginAddressNotList
;
}
/**
* 设置 最后一次登录地址
* @param lastLoginAddressNotList
*/
public
void
setLastLoginAddressNotList
(
List
<
String
>
lastLoginAddressNotList
){
this
.
lastLoginAddressNotList
=
lastLoginAddressNotList
;
}
/**
* 设置 用户ID,主键,自增长
* @param id
...
...
@@ -1107,15 +658,6 @@ public class UserQuery extends UserEntity {
return
this
;
}
/**
* 设置 用户ID,主键,自增长
* @param idNotList
*/
public
UserQuery
idNotList
(
List
<
Long
>
idNotList
){
this
.
idNotList
=
idNotList
;
return
this
;
}
/**
* 设置 登录名
...
...
@@ -1269,7 +811,7 @@ public class UserQuery extends UserEntity {
}
/**
* 设置 用户类型(0.系统用户,1.
后台管理
,2.工作人员)
* 设置 用户类型(0.系统用户,1.
普通用户
,2.工作人员)
* @param userType
*/
public
UserQuery
userType
(
Integer
userType
){
...
...
@@ -1278,7 +820,7 @@ public class UserQuery extends UserEntity {
}
/**
* 设置 开始 用户类型(0.系统用户,1.
后台管理
,2.工作人员)
* 设置 开始 用户类型(0.系统用户,1.
普通用户
,2.工作人员)
* @param userTypeStart
*/
public
UserQuery
userTypeStart
(
Integer
userTypeStart
){
...
...
@@ -1287,7 +829,7 @@ public class UserQuery extends UserEntity {
}
/**
* 设置 结束 用户类型(0.系统用户,1.
后台管理
,2.工作人员)
* 设置 结束 用户类型(0.系统用户,1.
普通用户
,2.工作人员)
* @param userTypeEnd
*/
public
UserQuery
userTypeEnd
(
Integer
userTypeEnd
){
...
...
@@ -1296,7 +838,7 @@ public class UserQuery extends UserEntity {
}
/**
* 设置 增加 用户类型(0.系统用户,1.
后台管理
,2.工作人员)
* 设置 增加 用户类型(0.系统用户,1.
普通用户
,2.工作人员)
* @param userTypeIncrement
*/
public
UserQuery
userTypeIncrement
(
Integer
userTypeIncrement
){
...
...
@@ -1305,7 +847,7 @@ public class UserQuery extends UserEntity {
}
/**
* 设置 用户类型(0.系统用户,1.
后台管理
,2.工作人员)
* 设置 用户类型(0.系统用户,1.
普通用户
,2.工作人员)
* @param userTypeList
*/
public
UserQuery
userTypeList
(
List
<
Integer
>
userTypeList
){
...
...
@@ -1313,88 +855,6 @@ public class UserQuery extends UserEntity {
return
this
;
}
/**
* 设置 用户类型(0.系统用户,1.后台管理,2.工作人员)
* @param userTypeNotList
*/
public
UserQuery
userTypeNotList
(
List
<
Integer
>
userTypeNotList
){
this
.
userTypeNotList
=
userTypeNotList
;
return
this
;
}
/**
* 设置 用户所属部门id
* @param deptId
*/
public
UserQuery
deptId
(
Long
deptId
){
setDeptId
(
deptId
);
return
this
;
}
/**
* 设置 开始 用户所属部门id
* @param deptIdStart
*/
public
UserQuery
deptIdStart
(
Long
deptIdStart
){
this
.
deptIdStart
=
deptIdStart
;
return
this
;
}
/**
* 设置 结束 用户所属部门id
* @param deptIdEnd
*/
public
UserQuery
deptIdEnd
(
Long
deptIdEnd
){
this
.
deptIdEnd
=
deptIdEnd
;
return
this
;
}
/**
* 设置 增加 用户所属部门id
* @param deptIdIncrement
*/
public
UserQuery
deptIdIncrement
(
Long
deptIdIncrement
){
this
.
deptIdIncrement
=
deptIdIncrement
;
return
this
;
}
/**
* 设置 用户所属部门id
* @param deptIdList
*/
public
UserQuery
deptIdList
(
List
<
Long
>
deptIdList
){
this
.
deptIdList
=
deptIdList
;
return
this
;
}
/**
* 设置 用户所属部门id
* @param deptIdNotList
*/
public
UserQuery
deptIdNotList
(
List
<
Long
>
deptIdNotList
){
this
.
deptIdNotList
=
deptIdNotList
;
return
this
;
}
/**
* 设置 所属部门名称
* @param deptName
*/
public
UserQuery
deptName
(
String
deptName
){
setDeptName
(
deptName
);
return
this
;
}
/**
* 设置 所属部门名称
* @param deptNameList
*/
public
UserQuery
deptNameList
(
List
<
String
>
deptNameList
){
this
.
deptNameList
=
deptNameList
;
return
this
;
}
/**
* 设置 所属站点id,多个逗号分隔
...
...
@@ -1478,15 +938,6 @@ public class UserQuery extends UserEntity {
return
this
;
}
/**
* 设置 用户状态(0.停用,1.正常,2.冻结,3.销户,4.离职)
* @param statusNotList
*/
public
UserQuery
statusNotList
(
List
<
Integer
>
statusNotList
){
this
.
statusNotList
=
statusNotList
;
return
this
;
}
/**
* 设置 创建用户
...
...
@@ -1533,15 +984,6 @@ public class UserQuery extends UserEntity {
return
this
;
}
/**
* 设置 创建用户
* @param createUserIdNotList
*/
public
UserQuery
createUserIdNotList
(
List
<
Long
>
createUserIdNotList
){
this
.
createUserIdNotList
=
createUserIdNotList
;
return
this
;
}
/**
* 设置 创建用户名称
...
...
@@ -1613,23 +1055,4 @@ public class UserQuery extends UserEntity {
this
.
andConditionList
=
andConditionList
;
}
/**
* 设置 钉钉userId
* @param dingUserId
*/
public
UserQuery
dingUserId
(
String
dingUserId
){
setDingUserId
(
dingUserId
);
return
this
;
}
/**
* 设置 钉钉userId
* @param dingUserIdList
*/
public
UserQuery
dingUserIdList
(
List
<
String
>
dingUserIdList
){
this
.
dingUserIdList
=
dingUserIdList
;
return
this
;
}
}
\ No newline at end of file
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/user/model/vo/UserVo.java
View file @
3ab4c4d7
...
...
@@ -4,8 +4,6 @@ package com.mortals.xhx.base.system.user.model.vo;
import
com.mortals.framework.model.BaseEntityLong
;
import
lombok.Data
;
import
java.util.List
;
/**
* 用户信息业务视图对象
*
...
...
@@ -19,7 +17,7 @@ public class UserVo extends BaseEntityLong {
*/
private
String
siteName
;
private
List
<
Long
>
roleIds
;
private
String
roleIds
;
/**
* 唯一标识
*/
...
...
@@ -38,6 +36,4 @@ public class UserVo extends BaseEntityLong {
* 过期时间
*/
private
Long
expireTime
;
String
roleIdStrs
;
}
\ No newline at end of file
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/user/service/UserService.java
View file @
3ab4c4d7
...
...
@@ -8,6 +8,7 @@
package
com.mortals.xhx.base.system.user.service
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.Result
;
import
com.mortals.framework.service.ICRUDCacheService
;
...
...
@@ -38,7 +39,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
* @return
* @throws AppException
*/
public
UserEntity
doLogin
(
String
loginName
,
String
password
,
String
loginIp
)
throws
AppException
;
UserEntity
doLogin
(
String
loginName
,
String
password
,
String
loginIp
)
throws
AppException
;
/**
* 校验用户名与密码是否正确
...
...
@@ -48,7 +49,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
* @return
* @throws AppException
*/
public
UserEntity
doCheckUser
(
String
loginName
,
String
password
)
throws
AppException
;
UserEntity
doCheckUser
(
String
loginName
,
String
password
)
throws
AppException
;
/**
* 检查用户是否存在
...
...
@@ -57,7 +58,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
* @param userId 密码
* @return
*/
public
boolean
existUser
(
String
loginName
,
Long
userId
)
throws
AppException
;
boolean
existUser
(
String
loginName
,
Long
userId
)
throws
AppException
;
/**
* 通过登录用户获取菜单功能权限
...
...
@@ -65,7 +66,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
* @param user
* @return
*/
public
List
<
MenuEntity
>
findOutlookBarList
(
IUser
user
);
List
<
MenuEntity
>
findOutlookBarList
(
IUser
user
);
/**
* 查询用户所有有权限的菜单ID
...
...
@@ -73,7 +74,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
* @param userEntity
* @return
*/
public
Set
<
Long
>
findAllAuthIds
(
UserEntity
userEntity
)
throws
AppException
;
Set
<
Long
>
findAllAuthIds
(
UserEntity
userEntity
)
throws
AppException
;
/**
* 查询用户记录
...
...
@@ -85,7 +86,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
* @return
* @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
;
/**
* 为客户创建用户
...
...
@@ -100,7 +101,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
* @return
* @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
;
/**
...
...
@@ -112,32 +113,11 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
* @return
* @throws AppException
*/
public
boolean
updateUserPwd
(
String
loginName
,
String
oldPwd
,
String
newPwd
)
throws
AppException
;
boolean
updateUserPwd
(
String
loginName
,
String
oldPwd
,
String
newPwd
)
throws
AppException
;
/**
*
* @param entity
*/
void
doHandlerUser
(
UserEntity
entity
);
Rest
<
Void
>
refreshUser
();
UserDao
getUserDao
();
/**
* 发送手机验证码
* @param mobileNumber
* @throws AppException
*/
void
sendSmsVerifyCode
(
String
mobileNumber
)
throws
AppException
;
/**
* 手机验证码登录
* @param mobileNumber
* @param verifyCode
* @param loginIp
* @return
* @throws AppException
*/
UserEntity
doSmsLogin
(
String
mobileNumber
,
String
verifyCode
,
String
loginIp
)
throws
AppException
;
}
\ No newline at end of file
one-certificate-manager/src/main/java/com/mortals/xhx/base/system/user/service/impl/UserServiceImpl.java
View file @
3ab4c4d7
...
...
@@ -8,10 +8,8 @@
package
com.mortals.xhx.base.system.user.service.impl
;
import
cn.hutool.core.util.PhoneUtil
;
import
cn.hutool.core.util.RandomUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.mortals.framework.ap.SysConstains
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.common.code.UserType
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.Context
;
...
...
@@ -19,26 +17,32 @@ import com.mortals.framework.model.PageInfo;
import
com.mortals.framework.model.Result
;
import
com.mortals.framework.service.IUser
;
import
com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl
;
import
com.mortals.framework.util.HttpUtil
;
import
com.mortals.framework.util.SecurityUtil
;
import
com.mortals.framework.util.StringUtils
;
import
com.mortals.xhx.base.system.menu.model.MenuEntity
;
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.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.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.model.UserEntity
;
import
com.mortals.xhx.base.system.user.model.UserQuery
;
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.Value
;
import
org.springframework.
context.annotation.Lazy
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
* <p>Title: 用户信息</p>
...
...
@@ -50,6 +54,7 @@ import java.util.*;
* @version 1.0.0
*/
@Service
(
"userService"
)
@Slf4j
public
class
UserServiceImpl
extends
AbstractCRUDCacheServiceImpl
<
UserDao
,
UserEntity
,
Long
>
implements
UserService
{
...
...
@@ -58,27 +63,18 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
@Autowired
private
ResourceService
resourceService
;
@Autowired
private
RoleUser
Dao
roleUserDao
;
private
RoleUser
Service
roleUserService
;
@Value
(
"${sms.smsSendUrl:http://sms.wx3.com.cn/api/index/index}"
)
private
String
smsApiUrl
;
@Value
(
"${sms.apiId:ADsUXLrS81vZDU95}"
)
private
String
appid
;
/**
* 短信模板ID
**/
private
static
String
SMS_TPYE
=
"30"
;
private
static
String
SMS_VERIFY_CODE_KEY
=
"login:sms:verify:"
;
@Lazy
@Autowired
private
IUserFeign
userFeign
;
@Override
protected
String
getExtKey
(
UserEntity
data
)
{
return
data
.
getLoginName
();
}
public
void
doHandlerUser
(
UserEntity
entity
)
throws
AppException
{
private
void
doHandlerUser
(
UserEntity
entity
)
throws
AppException
{
if
(
StringUtils
.
isNotEmpty
(
entity
.
getLoginPwd
()))
{
try
{
entity
.
setLoginPwd
(
SecurityUtil
.
md5DoubleEncoding
(
entity
.
getLoginPwd
()));
...
...
@@ -88,98 +84,63 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
}
else
{
entity
.
setLoginPwd
(
null
);
}
// if (entity.isSystemUser()) {
// entity.setUserType(UserType.SYSTEM.getValue());
// } else {
// entity.setUserType(UserType.CUSTOMER.getValue());
// }
}
@Override
protected
void
saveBefore
(
UserEntity
entity
,
Context
context
)
throws
AppException
{
this
.
doHandlerUser
(
entity
);
if
(!
ObjectUtils
.
isEmpty
(
entity
.
getLoginName
())
&&
existUser
(
entity
.
getLoginName
(),
entity
.
getId
()))
{
throw
new
AppException
(
"登录名已存在!"
);
}
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
protected
void
updateBefore
(
UserEntity
entity
,
Context
context
)
throws
AppException
{
/
*
if (entity.getId().longValue() == SysConstains.ADMIN_ID && !context.getUser().isAdmin()) {
throw new AppException("你没有权限执行该操作");
}*/
if
(
entity
.
getId
().
longValue
()
==
SysConstains
.
ADMIN_ID
)
{
throw
new
AppException
(
"你没有权限执行该操作"
);
}
/
/
if (entity.getId().longValue() == SysConstains.ADMIN_ID && !context.getUser().isAdmin()) {
//
throw new AppException("你没有权限执行该操作");
// }
//更新不更新密码字段
entity
.
setLoginPwd
(
null
);
this
.
doHandlerUser
(
entity
);
}
@Override
protected
void
updateAfter
(
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
);
});
RoleUserEntity
condition
=
new
RoleUserEntity
();
condition
.
setUserId
(
entity
.
getId
());
roleUserDao
.
delete
(
condition
);
roleUserDao
.
insertBatch
(
roleUserEntityList
);
}
protected
void
saveAfter
(
UserEntity
entity
,
Context
context
)
throws
AppException
{
//新增角色
updateUserRole
(
entity
);
super
.
saveAfter
(
entity
,
context
);
}
@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
);
protected
void
updateAfter
(
UserEntity
entity
,
Context
context
)
throws
AppException
{
updateUserRole
(
entity
);
super
.
updateAfter
(
entity
,
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
);
private
void
updateUserRole
(
UserEntity
entity
)
{
if
(!
ObjectUtils
.
isEmpty
(
entity
.
getId
())
&&
entity
.
getId
().
longValue
()
!=
SysConstains
.
ADMIN_ID
&&
!
ObjectUtils
.
isEmpty
(
entity
.
getRoleIds
()))
{
RoleUserQuery
roleUserQuery
=
new
RoleUserQuery
();
roleUserQuery
.
setUserId
(
entity
.
getId
());
List
<
Long
>
idList
=
Arrays
.
asList
(
entity
.
getRoleIds
().
split
(
","
)).
stream
().
map
(
Long:
:
parseLong
).
collect
(
Collectors
.
toList
());
roleUserQuery
.
setRoleIdList
(
idList
);
roleUserService
.
doDistributionRole
(
roleUserQuery
);
}
}
@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
);
String
roleIdStrs
=
StringUtils
.
join
(
roleIds
,
","
);
item
.
setRoleIdStrs
(
roleIdStrs
);
list
.
stream
().
peek
(
item
->
{
RoleUserQuery
roleUserQuery
=
new
RoleUserQuery
();
roleUserQuery
.
setUserId
(
item
.
getId
());
}
);
}
String
roleIds
=
roleUserService
.
find
(
roleUserQuery
).
stream
().
map
(
RoleUserEntity:
:
getRoleId
).
map
(
String:
:
valueOf
).
collect
(
Collectors
.
joining
(
","
));
item
.
setRoleIds
(
roleIds
);
}).
count
(
);
super
.
findAfter
(
params
,
pageInfo
,
context
,
list
);
}
public
UserEntity
findByLoginName
(
String
loginName
)
{
UserQuery
params
=
new
UserQuery
();
params
.
setLoginName
(
loginName
);
...
...
@@ -203,11 +164,6 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
}
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
;
}
...
...
@@ -251,7 +207,7 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
urls
.
addAll
(
StringUtils
.
converStr2Set
(
url
));
}
}
Set
<
Long
>
authIds
=
new
HashSet
<
Long
>();
Set
<
Long
>
authIds
=
new
HashSet
<>();
Map
<
Long
,
MenuEntity
>
menuMap
=
new
HashMap
<
Long
,
MenuEntity
>();
List
<
MenuEntity
>
userModuleList
=
this
.
menuService
.
findAllEnable
();
for
(
MenuEntity
sysModule
:
userModuleList
)
{
...
...
@@ -259,6 +215,7 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
continue
;
}
menuMap
.
put
(
sysModule
.
getId
(),
sysModule
);
if
(!
user
.
isAdmin
()
&&
urls
.
contains
(
StringUtils
.
trim
(
sysModule
.
getUrl
())))
{
authIds
.
add
(
sysModule
.
getId
());
}
...
...
@@ -307,7 +264,6 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
entity
.
initAttrValue
();
entity
.
setLoginName
(
loginName
);
entity
.
setRealName
(
userName
);
entity
.
setCustomerId
(
customerId
);
entity
.
setLoginPwd
(
password
);
entity
.
setMobile
(
mobile
);
entity
.
setUserType
(
UserType
.
CUSTOMER
.
getValue
());
...
...
@@ -353,7 +309,6 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
}
try
{
sysUser
.
setLoginPwd
(
SecurityUtil
.
md5DoubleEncoding
(
newPwd
));
}
catch
(
Exception
e
)
{
throw
new
AppException
(
"密码转换异常!"
,
e
);
}
...
...
@@ -362,78 +317,78 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
}
@Override
public
UserDao
getUserDao
()
{
return
this
.
getDao
();
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
);
});
}
@Override
public
void
sendSmsVerifyCode
(
String
mobileNumber
)
throws
AppException
{
if
(
StringUtils
.
isEmpty
(
mobileNumber
))
{
throw
new
AppException
(
"手机号不能为空"
);
}
if
(!
PhoneUtil
.
isPhone
(
mobileNumber
))
{
throw
new
AppException
(
"手机号码格式不正确"
);
}
UserEntity
user
=
this
.
selectOne
(
new
UserQuery
().
mobile
(
mobileNumber
));
if
(
user
==
null
)
{
throw
new
AppException
(
"手机号码:"
+
mobileNumber
+
"没有注册用户"
);
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
);
});
}
String
verifyCode
=
cacheService
.
get
(
SMS_VERIFY_CODE_KEY
+
mobileNumber
);
if
(
StringUtils
.
isNotEmpty
(
verifyCode
))
{
throw
new
AppException
(
"当前手机号码已发送验证码,请稍后重试"
);
}
try
{
Map
<
String
,
String
>
params
=
new
HashMap
<>();
params
.
put
(
"appid"
,
appid
);
params
.
put
(
"phone"
,
mobileNumber
);
params
.
put
(
"type"
,
SMS_TPYE
);
String
[]
json
=
new
String
[
2
];
String
vCode
=
RandomUtil
.
randomNumbers
(
6
);
json
[
0
]
=
vCode
;
json
[
1
]
=
"1"
;
params
.
put
(
"json"
,
JSONObject
.
toJSON
(
json
).
toString
());
String
resp
=
HttpUtil
.
doPost
(
smsApiUrl
,
params
);
JSONObject
respJson
=
JSONObject
.
parseObject
(
resp
);
if
(
respJson
.
getIntValue
(
"code"
)
==
0
)
{
throw
new
AppException
(
"短信发送失败:"
+
respJson
.
getString
(
"message"
));
}
//有效期60秒
cacheService
.
setnx
(
SMS_VERIFY_CODE_KEY
+
mobileNumber
,
vCode
,
60
);
}
catch
(
Exception
e
)
{
log
.
error
(
"短信发送异常"
,
e
);
throw
new
AppException
(
"短信发送异常"
);
//查找新增 与更新
}
return
Rest
.
ok
();
}
@Override
public
UserEntity
doSmsLogin
(
String
mobileNumber
,
String
verifyCode
,
String
loginIp
)
throws
AppException
{
if
(
StringUtils
.
isEmpty
(
mobileNumber
))
{
throw
new
AppException
(
"手机号不能为空"
);
}
if
(
StringUtils
.
isEmpty
(
verifyCode
))
{
throw
new
AppException
(
"验证码不能为空"
);
}
if
(!
PhoneUtil
.
isPhone
(
mobileNumber
))
{
throw
new
AppException
(
"手机号码格式不正确"
);
}
UserEntity
customer
=
this
.
selectOne
(
new
UserQuery
().
mobile
(
mobileNumber
));
if
(
customer
==
null
)
{
throw
new
AppException
(
"手机号码:"
+
mobileNumber
+
"没有注册用户"
);
}
String
vCode
=
cacheService
.
get
(
SMS_VERIFY_CODE_KEY
+
mobileNumber
);
if
(
StringUtils
.
isEmpty
(
vCode
))
{
throw
new
AppException
(
"验证码已失效"
);
}
if
(!
verifyCode
.
equals
(
vCode
))
{
throw
new
AppException
(
"验证码不正确"
);
}
UserEntity
update
=
new
UserEntity
();
update
.
setId
(
customer
.
getId
());
update
.
setLastLoginAddress
(
loginIp
);
update
.
setLastLoginTime
(
new
Date
());
this
.
update
(
update
);
return
customer
;
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 @
3ab4c4d7
...
...
@@ -2,6 +2,10 @@ 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.Rest
;
import
com.mortals.framework.common.code.UserType
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
...
...
@@ -14,8 +18,6 @@ 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.service.UserService
;
import
com.mortals.xhx.common.code.UserStatus
;
import
com.mortals.xhx.module.dept.model.DeptQuery
;
import
com.mortals.xhx.module.dept.service.DeptService
;
import
io.jsonwebtoken.Claims
;
import
io.jsonwebtoken.Jwts
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -23,7 +25,6 @@ import org.springframework.util.StringUtils;
import
org.springframework.web.bind.annotation.*
;
import
java.util.Base64
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
...
...
@@ -41,9 +42,6 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic
private
RoleService
roleService
;
@Autowired
private
RoleUserService
roleUserService
;
@Autowired
private
DeptService
deptService
;
public
UserController
()
{
super
.
setModuleDesc
(
"用户信息"
);
...
...
@@ -51,9 +49,9 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic
@Override
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
,
"deptId"
,
deptService
.
find
(
new
DeptQuery
()).
stream
().
collect
(
Collectors
.
toMap
(
x
->
x
.
getId
().
toString
(),
y
->
y
.
getDeptName
(),
(
o
,
n
)
->
n
)));
}
...
...
@@ -72,20 +70,26 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic
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
(
));
String
roleIds
=
roleUserService
.
find
(
roleUserQuery
).
stream
().
map
(
RoleUserEntity:
:
getRoleId
).
map
(
String:
:
valueOf
).
collect
(
Collectors
.
joining
(
","
));
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);
// }
@RequestMapping
(
value
=
"change/password"
,
method
=
RequestMethod
.
POST
)
@Operlog
(
msg
=
"密码修改成功!"
)
public
String
changePassword
(
@RequestParam
String
oldPwd
,
@RequestParam
String
newPwd
)
{
...
...
@@ -102,28 +106,12 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic
}
@RequestMapping
(
value
=
"repassword"
,
method
=
RequestMethod
.
POST
)
public
String
rePassword
(
@RequestBody
UserEntity
userEntity
)
{
JSONObject
ret
=
new
JSONObject
();
try
{
//查询用户是否存在
boolean
existUser
=
service
.
existUser
(
userEntity
.
getLoginName
(),
userEntity
.
getId
());
if
(!
existUser
)
throw
new
AppException
(
"用户不存在!"
);
//修改密码
//service.doHandlerUser(userEntity);
service
.
update
(
userEntity
,
getContext
());
//更新密码
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
();
@PostMapping
({
"refreshUser"
})
@UnAuth
public
Rest
<
Object
>
refreshUser
()
{
log
.
info
(
"刷新用户"
);
this
.
service
.
refreshUser
();
return
Rest
.
ok
(
"用户同步刷新操作成功"
);
}
...
...
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