Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
chnmuseum-party
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liqin
chnmuseum-party
Commits
bb9bed26
Commit
bb9bed26
authored
May 27, 2021
by
nie'hong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改用户信息限制管理员数量
parent
aac1e226
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
1 deletion
+55
-1
TInteractionController.java
...hnmuseum/party/web/controller/TInteractionController.java
+49
-0
TUserController.java
...va/cn/chnmuseum/party/web/controller/TUserController.java
+6
-1
No files found.
src/main/java/cn/chnmuseum/party/web/controller/TInteractionController.java
View file @
bb9bed26
...
@@ -2,11 +2,15 @@ package cn.chnmuseum.party.web.controller;
...
@@ -2,11 +2,15 @@ package cn.chnmuseum.party.web.controller;
import
cn.chnmuseum.party.auth.SHA256PasswordEncryptionService
;
import
cn.chnmuseum.party.auth.SHA256PasswordEncryptionService
;
import
cn.chnmuseum.party.auth.SecureRandomSaltService
;
import
cn.chnmuseum.party.auth.SecureRandomSaltService
;
import
cn.chnmuseum.party.auth.util.AESUtils
;
import
cn.chnmuseum.party.common.enums.AuditOperationEnum
;
import
cn.chnmuseum.party.common.log.MethodLog
;
import
cn.chnmuseum.party.common.log.MethodLog
;
import
cn.chnmuseum.party.common.log.OperModule
;
import
cn.chnmuseum.party.common.log.OperModule
;
import
cn.chnmuseum.party.common.log.OperType
;
import
cn.chnmuseum.party.common.log.OperType
;
import
cn.chnmuseum.party.common.util.DateUtil80
;
import
cn.chnmuseum.party.common.util.DateUtil80
;
import
cn.chnmuseum.party.model.Role
;
import
cn.chnmuseum.party.model.TUser
;
import
cn.chnmuseum.party.model.TUser
;
import
cn.chnmuseum.party.service.RoleService
;
import
cn.chnmuseum.party.service.impl.TUserServiceImpl
;
import
cn.chnmuseum.party.service.impl.TUserServiceImpl
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper
;
...
@@ -37,10 +41,12 @@ import org.springframework.stereotype.Controller;
...
@@ -37,10 +41,12 @@ import org.springframework.stereotype.Controller;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.NotNull
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.util.LinkedHashMap
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
/**
* <pre>
* <pre>
...
@@ -62,6 +68,9 @@ public class TInteractionController extends BaseController {
...
@@ -62,6 +68,9 @@ public class TInteractionController extends BaseController {
@Resource
@Resource
private
TUserServiceImpl
userService
;
private
TUserServiceImpl
userService
;
@Resource
private
RoleService
roleService
;
@PostMapping
(
"/add"
)
@PostMapping
(
"/add"
)
@RequiresAuthentication
//@RequiresPermissions("/interaction/add")
@RequiresAuthentication
//@RequiresPermissions("/interaction/add")
...
@@ -73,6 +82,46 @@ public class TInteractionController extends BaseController {
...
@@ -73,6 +82,46 @@ public class TInteractionController extends BaseController {
boolean
result
=
false
;
boolean
result
=
false
;
try
{
try
{
Map
<
String
,
Object
>
resultMap
=
new
LinkedHashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
resultMap
=
new
LinkedHashMap
<
String
,
Object
>();
// 验证互动审核员账号
if
(
StringUtils
.
isBlank
(
tInteraction
.
getName
())
||
StringUtils
.
isBlank
(
tInteraction
.
getPassword
()))
{
resultMap
.
put
(
"resultCode"
,
"400"
);
resultMap
.
put
(
"message"
,
"互动管理员账号或密码不能为空"
);
return
resultMap
;
}
TUser
tUser
=
userService
.
selectByUsername
(
tInteraction
.
getName
());
if
(
tUser
==
null
)
{
resultMap
.
put
(
"resultCode"
,
"400"
);
resultMap
.
put
(
"message"
,
"用户名不正确!"
);
return
resultMap
;
}
if
(
AuditOperationEnum
.
DISABLE
.
name
().
equals
(
user
.
getStatus
()))
{
resultMap
.
put
(
"resultCode"
,
"400"
);
resultMap
.
put
(
"message"
,
"此帐号已禁用,请联系管理员!"
);
return
resultMap
;
}
if
(
user
.
getPermanent
()
!=
null
&&
!
user
.
getPermanent
())
{
if
(
user
.
getEffectiveDate
()
!=
null
&&
user
.
getEffectiveDate
().
isAfter
(
LocalDate
.
now
())
||
user
.
getExiredDate
()
!=
null
&&
user
.
getExiredDate
().
isBefore
(
LocalDate
.
now
()))
{
resultMap
.
put
(
"resultCode"
,
"400"
);
resultMap
.
put
(
"message"
,
"此帐号已失效,请联系管理员!"
);
return
resultMap
;
}
}
//密码解密
String
s
=
AESUtils
.
aesDecrypt
(
tInteraction
.
getPassword
());
byte
[]
salt
=
user
.
getPasswordSalt
();
String
s1
=
new
String
(
SHA256PasswordEncryptionService
.
createPasswordHash
(
s
,
salt
));
if
(!
s1
.
equals
(
new
String
(
user
.
getPasswordHash
())))
{
resultMap
.
put
(
"resultCode"
,
"400"
);
resultMap
.
put
(
"message"
,
"密码不正确!"
);
return
resultMap
;
}
List
<
Role
>
roles
=
roleService
.
selectRoleByUserId
(
user
.
getId
());
List
<
String
>
roleIds
=
roles
.
stream
().
map
(
Role:
:
getId
).
collect
(
Collectors
.
toList
());
if
(!
roleIds
.
contains
(
"17"
))
{
resultMap
.
put
(
"resultCode"
,
"400"
);
resultMap
.
put
(
"message"
,
"所填写账号非互动审核员!"
);
return
resultMap
;
}
tInteraction
.
setUserId
(
user
.
getId
());
tInteraction
.
setUserId
(
user
.
getId
());
tInteraction
.
setCreateTime
(
LocalDateTime
.
now
());
tInteraction
.
setCreateTime
(
LocalDateTime
.
now
());
result
=
tInteractionService
.
save
(
tInteraction
);
result
=
tInteractionService
.
save
(
tInteraction
);
...
...
src/main/java/cn/chnmuseum/party/web/controller/TUserController.java
View file @
bb9bed26
...
@@ -426,9 +426,14 @@ public class TUserController extends BaseController {
...
@@ -426,9 +426,14 @@ public class TUserController extends BaseController {
resultMap
.
put
(
"message"
,
"机构已存在一个互动审核员!"
);
resultMap
.
put
(
"message"
,
"机构已存在一个互动审核员!"
);
return
resultMap
;
return
resultMap
;
}
}
if
(
StringUtils
.
isNotBlank
(
user
.
getRoleId
())
&&
!
CollectionUtils
.
isEmpty
(
user
.
getRoleList
()))
{
if
(!
CollectionUtils
.
isEmpty
(
user
.
getRoleList
()))
{
user
.
getRoleList
().
remove
(
ROLE_HDSHY
);
user
.
getRoleList
().
remove
(
ROLE_HDSHY
);
user
.
getRoleList
().
remove
(
ROLE_PTGLY
);
user
.
getRoleList
().
remove
(
ROLE_PTGLY
);
}
if
(
StringUtils
.
isNotBlank
(
user
.
getRoleId
())
)
{
if
(
CollectionUtils
.
isEmpty
(
user
.
getRoleList
()))
{
user
.
setRoleList
(
new
ArrayList
<
String
>());
}
user
.
getRoleList
().
add
(
user
.
getRoleId
());
user
.
getRoleList
().
add
(
user
.
getRoleId
());
}
}
}
}
...
...
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