Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
JSH ERP
Commits
e36d2c5d
Commit
e36d2c5d
authored
Jan 09, 2022
by
季圣华
Browse files
优化登录接口中按钮权限的格式,将id换为url
parent
b7ef95ab
Changes
1
Hide whitespace changes
Inline
Side-by-side
jshERP-boot/src/main/java/com/jsh/erp/service/user/UserService.java
View file @
e36d2c5d
package
com.jsh.erp.service.user
;
import
com.jsh.erp.datasource.entities.*
;
import
com.jsh.erp.service.functions.FunctionService
;
import
com.jsh.erp.service.redis.RedisService
;
import
com.jsh.erp.service.role.RoleService
;
import
org.springframework.util.StringUtils
;
...
...
@@ -31,10 +32,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
java.security.NoSuchAlgorithmException
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.*
;
@Service
public
class
UserService
{
...
...
@@ -63,6 +61,8 @@ public class UserService {
@Resource
private
RoleService
roleService
;
@Resource
private
FunctionService
functionService
;
@Resource
private
RedisService
redisService
;
public
User
getUser
(
long
id
)
throws
Exception
{
...
...
@@ -797,7 +797,24 @@ public class UserService {
}
}
}
return
btnStrArr
;
//将数组中的funId转为url
JSONArray
btnStrWithUrlArr
=
new
JSONArray
();
if
(
btnStrArr
.
size
()>
0
)
{
List
<
Function
>
functionList
=
functionService
.
getFunction
();
Map
<
Long
,
String
>
functionMap
=
new
HashMap
<>();
for
(
Function
function:
functionList
)
{
functionMap
.
put
(
function
.
getId
(),
function
.
getUrl
());
}
for
(
Object
obj
:
btnStrArr
)
{
JSONObject
btnStrObj
=
JSONObject
.
parseObject
(
obj
.
toString
());
Long
funId
=
btnStrObj
.
getLong
(
"funId"
);
JSONObject
btnStrWithUrlObj
=
new
JSONObject
();
btnStrWithUrlObj
.
put
(
"url"
,
functionMap
.
get
(
funId
));
btnStrWithUrlObj
.
put
(
"btnStr"
,
btnStrObj
.
getString
(
"btnStr"
));
btnStrWithUrlArr
.
add
(
btnStrWithUrlObj
);
}
}
return
btnStrWithUrlArr
;
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment