Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
A
auth-master
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Members
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
吴超
auth-master
Commits
272c3fc7
Commit
272c3fc7
authored
Dec 03, 2025
by
周海峰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加公告角色方法
parent
5fc73721
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
170 行增加
和
99 行删除
+170
-99
src/main/java/com/metro/auth/platform/config/WebSecurityConfig.java
+1
-1
src/main/java/com/metro/auth/platform/controller/PlatformRoleUserController.java
+64
-29
src/main/java/com/metro/auth/platform/outlineapi/PlatformUrlManager.java
+11
-0
src/main/java/com/metro/auth/platform/service/PlatformApplicationsServiceImpl.java
+0
-5
src/main/java/com/metro/auth/platform/service/PlatformRoleUserService.java
+24
-3
src/main/java/com/metro/auth/platform/service/PlatformRoleUserServiceImpl.java
+66
-61
src/main/resources/application-prod.yml
+2
-0
src/main/resources/application-test153.yml
+2
-0
没有找到文件。
src/main/java/com/metro/auth/platform/config/WebSecurityConfig.java
View file @
272c3fc7
...
@@ -104,7 +104,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
...
@@ -104,7 +104,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
"/api/ps/account_sel/**"
,
"/znzl/file/**"
,
"/auth/v1/**"
,
"/auth/user/**"
,
"/api/ps/account_sel/**"
,
"/znzl/file/**"
,
"/auth/v1/**"
,
"/auth/user/**"
,
"/error/**"
,
"/weixin/wxuserinfo/**"
,
"/weixin/information/**"
,
"/auth/dt/**"
,
"/error/**"
,
"/weixin/wxuserinfo/**"
,
"/weixin/information/**"
,
"/auth/dt/**"
,
"/avatar/**"
,
"/user/updateWxPlatformPersonnelByAccount"
,
"/wechatApi/**"
,
"/avatar/**"
,
"/user/updateWxPlatformPersonnelByAccount"
,
"/wechatApi/**"
,
"/PlatformUserFavoriteAppsController/**"
"/PlatformUserFavoriteAppsController/**"
,
"/roleuser/addUserNoticeRole"
).
permitAll
()
).
permitAll
()
.
antMatchers
(
HttpMethod
.
OPTIONS
,
"/**"
).
permitAll
()
.
antMatchers
(
HttpMethod
.
OPTIONS
,
"/**"
).
permitAll
()
// 除上面外的所有请求全部需要鉴权认证
// 除上面外的所有请求全部需要鉴权认证
...
...
src/main/java/com/metro/auth/platform/controller/PlatformRoleUserController.java
View file @
272c3fc7
...
@@ -27,17 +27,19 @@ import com.metro.auth.platform.domain.ResultJson;
...
@@ -27,17 +27,19 @@ import com.metro.auth.platform.domain.ResultJson;
import
com.metro.auth.platform.domain.auth.PlatformPersonnel
;
import
com.metro.auth.platform.domain.auth.PlatformPersonnel
;
import
com.metro.auth.platform.domain.auth.PlatformSysRole
;
import
com.metro.auth.platform.domain.auth.PlatformSysRole
;
import
com.metro.auth.platform.domain.auth.PlatformSysUserRole
;
import
com.metro.auth.platform.domain.auth.PlatformSysUserRole
;
import
com.metro.auth.platform.outlineapi.PlatformUrlManager
;
import
com.metro.auth.platform.service.PlatformRoleUserService
;
import
com.metro.auth.platform.service.PlatformRoleUserService
;
import
org.apache.catalina.LifecycleState
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.UUID
;
import
java.util.stream.Collectors
;
/**
/**
* @ClassName: PlatformRoleUserController
* @ClassName: PlatformRoleUserController
* @Description: ${description}
* @Description: ${description}
* @Authror zhouy
* @Authror zhouy
* @Date 2019-09-11 17:17
* @Date 2019-09-11 17:17
*/
*/
...
@@ -49,10 +51,10 @@ public class PlatformRoleUserController {
...
@@ -49,10 +51,10 @@ public class PlatformRoleUserController {
@Resource
@Resource
PlatformRoleUserService
platformRoleUserService
;
PlatformRoleUserService
platformRoleUserService
;
/**
/**
* 功能描述: <br>权限-用户列表
* 功能描述: <br>权限-用户列表
* 〈〉
* 〈〉
*
* @Param: [pageNum, pageSize, platformSysRole]
* @Param: [pageNum, pageSize, platformSysRole]
* @Return: [pageNum, pageSize, platformSysRole]
* @Return: [pageNum, pageSize, platformSysRole]
* @Author: zhouy
* @Author: zhouy
...
@@ -60,16 +62,17 @@ public class PlatformRoleUserController {
...
@@ -60,16 +62,17 @@ public class PlatformRoleUserController {
*/
*/
@GetMapping
(
"/pagedlist"
)
@GetMapping
(
"/pagedlist"
)
public
ResultJson
pagedlist
(
@RequestParam
(
required
=
true
,
value
=
"pageNum"
,
defaultValue
=
"1"
)
int
pageNum
,
public
ResultJson
pagedlist
(
@RequestParam
(
required
=
true
,
value
=
"pageNum"
,
defaultValue
=
"1"
)
int
pageNum
,
@RequestParam
(
required
=
true
,
value
=
"pageSize"
,
defaultValue
=
"15"
)
int
pageSize
,
@RequestParam
(
required
=
true
,
value
=
"pageSize"
,
defaultValue
=
"15"
)
int
pageSize
,
PlatformSysRole
platformSysRole
){
PlatformSysRole
platformSysRole
)
{
PageInfo
<
PlatformSysRole
>
page
=
platformRoleUserService
.
pageRoledlist
(
platformSysRole
,
pageNum
,
pageSize
);
PageInfo
<
PlatformSysRole
>
page
=
platformRoleUserService
.
pageRoledlist
(
platformSysRole
,
pageNum
,
pageSize
);
return
ResultJson
.
ok
(
page
);
return
ResultJson
.
ok
(
page
);
}
}
/**
/**
* 功能描述: <br>权限-用户列表
* 功能描述: <br>权限-用户列表
* 〈〉
* 〈〉
*
* @Param: [pageNum, pageSize, platformSysRole]
* @Param: [pageNum, pageSize, platformSysRole]
* @Return: [pageNum, pageSize, platformSysRole]
* @Return: [pageNum, pageSize, platformSysRole]
* @Author: zhouy
* @Author: zhouy
...
@@ -77,10 +80,10 @@ public class PlatformRoleUserController {
...
@@ -77,10 +80,10 @@ public class PlatformRoleUserController {
*/
*/
@GetMapping
(
"/roleuserpagedlist"
)
@GetMapping
(
"/roleuserpagedlist"
)
public
ResultJson
roleuserpagedlist
(
@RequestParam
(
required
=
true
,
value
=
"pageNum"
,
defaultValue
=
"1"
)
int
pageNum
,
public
ResultJson
roleuserpagedlist
(
@RequestParam
(
required
=
true
,
value
=
"pageNum"
,
defaultValue
=
"1"
)
int
pageNum
,
@RequestParam
(
required
=
true
,
value
=
"pageSize"
,
defaultValue
=
"15"
)
int
pageSize
,
@RequestParam
(
required
=
true
,
value
=
"pageSize"
,
defaultValue
=
"15"
)
int
pageSize
,
PlatformPersonnel
platformPersonnel
)
{
PlatformPersonnel
platformPersonnel
)
{
PageInfo
<
PlatformPersonnel
>
page
=
platformRoleUserService
.
roleuserpagedlist
(
platformPersonnel
,
pageNum
,
pageSize
);
PageInfo
<
PlatformPersonnel
>
page
=
platformRoleUserService
.
roleuserpagedlist
(
platformPersonnel
,
pageNum
,
pageSize
);
return
ResultJson
.
ok
(
page
);
return
ResultJson
.
ok
(
page
);
}
}
...
@@ -88,18 +91,20 @@ public class PlatformRoleUserController {
...
@@ -88,18 +91,20 @@ public class PlatformRoleUserController {
/**
/**
* 周海峰
* 周海峰
* 获取角色下的所有用户
* 获取角色下的所有用户
*
* @param platformPersonnel
* @param platformPersonnel
* @return
* @return
*/
*/
@GetMapping
(
"/roleuserlist"
)
@GetMapping
(
"/roleuserlist"
)
public
ResultJson
roleuserpagedlist
(
PlatformPersonnel
platformPersonnel
){
public
ResultJson
roleuserpagedlist
(
PlatformPersonnel
platformPersonnel
)
{
List
<
PlatformSysUserRole
>
page
=
platformRoleUserService
.
roleuserlist
(
platformPersonnel
);
List
<
PlatformSysUserRole
>
page
=
platformRoleUserService
.
roleuserlist
(
platformPersonnel
);
return
ResultJson
.
ok
(
page
);
return
ResultJson
.
ok
(
page
);
}
}
/**
/**
* 功能描述: <br>更新权限角色
* 功能描述: <br>更新权限角色
* 〈〉
* 〈〉
*
* @Param: [platformSysRole]
* @Param: [platformSysRole]
* @Return: [platformSysRole]
* @Return: [platformSysRole]
* @Author: zhouy
* @Author: zhouy
...
@@ -107,32 +112,33 @@ public class PlatformRoleUserController {
...
@@ -107,32 +112,33 @@ public class PlatformRoleUserController {
*/
*/
@RequestMapping
(
"/editroleuser"
)
@RequestMapping
(
"/editroleuser"
)
public
ResultJson
editroleuser
(
@RequestBody
PlatformSysUserRole
platformSysUserRole
){
public
ResultJson
editroleuser
(
@RequestBody
PlatformSysUserRole
platformSysUserRole
)
{
int
count
=
platformRoleUserService
.
editroleuser
(
platformSysUserRole
);
int
count
=
platformRoleUserService
.
editroleuser
(
platformSysUserRole
);
if
(
count
>
0
)
{
if
(
count
>
0
)
{
return
ResultJson
.
ok
();
return
ResultJson
.
ok
();
}
else
{
}
else
{
return
ResultJson
.
failure
(
ResultCode
.
RESPONSE_ERROR
);
return
ResultJson
.
failure
(
ResultCode
.
RESPONSE_ERROR
);
}
}
}
}
@RequestMapping
(
"/delUserRole"
)
@RequestMapping
(
"/delUserRole"
)
public
ResultJson
delUserRole
(
@RequestBody
PlatformSysUserRole
platformSysUserRole
){
public
ResultJson
delUserRole
(
@RequestBody
PlatformSysUserRole
platformSysUserRole
)
{
int
count
=
platformRoleUserService
.
delUserRole
(
platformSysUserRole
);
int
count
=
platformRoleUserService
.
delUserRole
(
platformSysUserRole
);
if
(
count
>
0
)
{
if
(
count
>
0
)
{
return
ResultJson
.
ok
();
return
ResultJson
.
ok
();
}
else
{
}
else
{
return
ResultJson
.
failure
(
ResultCode
.
RESPONSE_ERROR
);
return
ResultJson
.
failure
(
ResultCode
.
RESPONSE_ERROR
);
}
}
}
}
@RequestMapping
(
"/addroleuser"
)
@RequestMapping
(
"/addroleuser"
)
public
ResultJson
addroleuser
(
@RequestBody
PlatformSysUserRole
platformSysUserRole
){
public
ResultJson
addroleuser
(
@RequestBody
PlatformSysUserRole
platformSysUserRole
)
{
int
count
=
platformRoleUserService
.
addroleuser
(
platformSysUserRole
);
int
count
=
platformRoleUserService
.
addroleuser
(
platformSysUserRole
);
if
(
count
>
0
)
{
if
(
count
>
0
)
{
return
ResultJson
.
ok
();
return
ResultJson
.
ok
();
}
else
{
}
else
{
return
ResultJson
.
failure
(
ResultCode
.
RESPONSE_ERROR
);
return
ResultJson
.
failure
(
ResultCode
.
RESPONSE_ERROR
);
}
}
...
@@ -141,18 +147,47 @@ public class PlatformRoleUserController {
...
@@ -141,18 +147,47 @@ public class PlatformRoleUserController {
/**
/**
* 周海峰20200307
* 周海峰20200307
* 保存角色用户信息(单角色多用户)
* 保存角色用户信息(单角色多用户)
*
* @param map
* @param map
* @return
* @return
*/
*/
@RequestMapping
(
"/editUserRoleList"
)
@RequestMapping
(
"/editUserRoleList"
)
public
ResultJson
editUserRoleList
(
@RequestBody
Map
<
String
,
String
>
map
)
{
public
ResultJson
editUserRoleList
(
@RequestBody
Map
<
String
,
String
>
map
)
{
int
count
=
platformRoleUserService
.
editUserRoleList
(
map
);
int
count
=
platformRoleUserService
.
editUserRoleList
(
map
);
if
(
count
>
0
)
{
if
(
count
>
0
)
{
return
ResultJson
.
ok
();
return
ResultJson
.
ok
();
}
else
{
}
else
{
return
ResultJson
.
failure
(
ResultCode
.
SERVER_ERROR
);
return
ResultJson
.
failure
(
ResultCode
.
SERVER_ERROR
);
}
}
}
}
/**
* 给用户添加公告角色
*
* @param map 用户ID
*/
@PostMapping
(
"/addUserNoticeRole"
)
public
ResultJson
addUserNoticeRole
(
@RequestBody
Map
<
String
,
String
>
map
)
{
String
roleId
=
PlatformUrlManager
.
notice_role_id
;
String
userId
=
map
.
get
(
"userId"
);
PlatformPersonnel
req
=
new
PlatformPersonnel
();
req
.
setId
(
Integer
.
parseInt
(
userId
));
List
<
PlatformSysUserRole
>
platformSysUserRoles
=
platformRoleUserService
.
userRoleList
(
req
);
List
<
String
>
collect
=
platformSysUserRoles
.
stream
()
.
map
(
PlatformSysUserRole:
:
getRoleId
)
.
collect
(
Collectors
.
toList
());
if
(!
collect
.
isEmpty
()
&&
collect
.
contains
(
roleId
))
{
// 用户已拥有该角色,直接返回成功
return
ResultJson
.
ok
();
}
String
id
=
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
);
PlatformSysUserRole
platformSysUserRole
=
new
PlatformSysUserRole
(
id
,
Integer
.
parseInt
(
userId
),
roleId
);
int
count
=
platformRoleUserService
.
addUserRole
(
platformSysUserRole
);
if
(
count
>
0
)
{
return
ResultJson
.
ok
();
}
else
{
return
ResultJson
.
failure
(
ResultCode
.
SERVER_ERROR
);
}
}
}
}
src/main/java/com/metro/auth/platform/outlineapi/PlatformUrlManager.java
View file @
272c3fc7
...
@@ -169,6 +169,17 @@ public class PlatformUrlManager {
...
@@ -169,6 +169,17 @@ public class PlatformUrlManager {
*/
*/
public
static
String
API_USER_LOGIN_URL
;
public
static
String
API_USER_LOGIN_URL
;
/**
* 公告发布角色ID
*/
public
static
String
notice_role_id
;
@Value
(
"${notice-manage.notice_role_id}"
)
public
void
setNotice_role_id
(
String
notice_role_id
)
{
PlatformUrlManager
.
notice_role_id
=
notice_role_id
;
}
@Value
(
"${weixin-params.wx_sToken}"
)
@Value
(
"${weixin-params.wx_sToken}"
)
public
void
setWxSToken
(
String
wxSToken
)
{
WX_sToken
=
wxSToken
;}
public
void
setWxSToken
(
String
wxSToken
)
{
WX_sToken
=
wxSToken
;}
...
...
src/main/java/com/metro/auth/platform/service/PlatformApplicationsServiceImpl.java
View file @
272c3fc7
...
@@ -95,11 +95,6 @@ public class PlatformApplicationsServiceImpl implements PlatformApplicationsServ
...
@@ -95,11 +95,6 @@ public class PlatformApplicationsServiceImpl implements PlatformApplicationsServ
example
.
createCriteria
().
andQyflagEqualTo
(
"1"
);
example
.
createCriteria
().
andQyflagEqualTo
(
"1"
);
List
<
PlatformApplications
>
allApplications
=
platformApplicationsMapper
.
selectByExample
(
example
);
List
<
PlatformApplications
>
allApplications
=
platformApplicationsMapper
.
selectByExample
(
example
);
// 2. 将所有应用转换为以ID为Key的Map,方便后续快速查找
// 使用 Collectors.toMap 是一个高效且清晰的做法
Map
<
Integer
,
PlatformApplications
>
appMap
=
allApplications
.
stream
()
.
collect
(
Collectors
.
toMap
(
PlatformApplications:
:
getId
,
app
->
app
));
// 3. 安全地解析userid并查询用户角色
// 3. 安全地解析userid并查询用户角色
Set
<
String
>
roleIds
=
new
HashSet
<>();
Set
<
String
>
roleIds
=
new
HashSet
<>();
int
userIdInt
=
Integer
.
parseInt
(
userid
);
int
userIdInt
=
Integer
.
parseInt
(
userid
);
...
...
src/main/java/com/metro/auth/platform/service/PlatformRoleUserService.java
View file @
272c3fc7
...
@@ -31,7 +31,7 @@ import java.util.Map;
...
@@ -31,7 +31,7 @@ import java.util.Map;
/**
/**
* @ClassName: PlatformRoleUserService
* @ClassName: PlatformRoleUserService
* @Description: ${description}
* @Description: ${description}
* @Authror zhouy
* @Authror zhouy
* @Date 2019-09-11 17:19
* @Date 2019-09-11 17:19
*/
*/
...
@@ -40,9 +40,30 @@ public interface PlatformRoleUserService {
...
@@ -40,9 +40,30 @@ public interface PlatformRoleUserService {
PageInfo
<
PlatformSysRole
>
pageRoledlist
(
PlatformSysRole
platformSysRole
,
int
pageNum
,
int
pageSize
);
PageInfo
<
PlatformSysRole
>
pageRoledlist
(
PlatformSysRole
platformSysRole
,
int
pageNum
,
int
pageSize
);
int
editroleuser
(
PlatformSysUserRole
platformSysUserRole
);
int
editroleuser
(
PlatformSysUserRole
platformSysUserRole
);
int
delUserRole
(
PlatformSysUserRole
platformSysUserRole
);
int
delUserRole
(
PlatformSysUserRole
platformSysUserRole
);
int
editUserRoleList
(
Map
<
String
,
String
>
map
);
PageInfo
<
PlatformPersonnel
>
roleuserpagedlist
(
PlatformPersonnel
platformPersonnel
,
int
pageNum
,
int
pageSize
);
int
editUserRoleList
(
Map
<
String
,
String
>
map
);
PageInfo
<
PlatformPersonnel
>
roleuserpagedlist
(
PlatformPersonnel
platformPersonnel
,
int
pageNum
,
int
pageSize
);
List
<
PlatformSysUserRole
>
roleuserlist
(
PlatformPersonnel
platformPersonnel
);
List
<
PlatformSysUserRole
>
roleuserlist
(
PlatformPersonnel
platformPersonnel
);
int
addroleuser
(
PlatformSysUserRole
platformSysUserRole
);
int
addroleuser
(
PlatformSysUserRole
platformSysUserRole
);
/**
* 功能描述: <br>根据用户查询用户角色列表
*
* @param platformPersonnel
* @return
*/
List
<
PlatformSysUserRole
>
userRoleList
(
PlatformPersonnel
platformPersonnel
);
/**
* 功能描述: <br>新增用户角色
*
* @param platformSysUserRole
* @return
*/
int
addUserRole
(
PlatformSysUserRole
platformSysUserRole
);
}
}
src/main/java/com/metro/auth/platform/service/PlatformRoleUserServiceImpl.java
View file @
272c3fc7
...
@@ -47,7 +47,7 @@ import java.util.UUID;
...
@@ -47,7 +47,7 @@ import java.util.UUID;
/**
/**
* @author zhouy
* @author zhouy
* @ClassName: PlatformRoleUserServiceImpl
* @ClassName: PlatformRoleUserServiceImpl
* @Description: ${description}
* @Description: ${description}
* @Date 2019-09-11 17:22
* @Date 2019-09-11 17:22
*/
*/
@Service
@Service
...
@@ -72,6 +72,7 @@ public class PlatformRoleUserServiceImpl implements PlatformRoleUserService {
...
@@ -72,6 +72,7 @@ public class PlatformRoleUserServiceImpl implements PlatformRoleUserService {
/**
/**
* 功能描述: <br>用户角色功能查询角色信息
* 功能描述: <br>用户角色功能查询角色信息
* 〈〉
* 〈〉
*
* @Param: [platformSysRole, pageNum, pageSize]
* @Param: [platformSysRole, pageNum, pageSize]
* @Return: [platformSysRole, pageNum, pageSize]
* @Return: [platformSysRole, pageNum, pageSize]
* @Author: zhouy
* @Author: zhouy
...
@@ -87,21 +88,21 @@ public class PlatformRoleUserServiceImpl implements PlatformRoleUserService {
...
@@ -87,21 +88,21 @@ public class PlatformRoleUserServiceImpl implements PlatformRoleUserService {
PlatformSysRoleExample
platformSysRoleExample
=
new
PlatformSysRoleExample
();
PlatformSysRoleExample
platformSysRoleExample
=
new
PlatformSysRoleExample
();
PlatformSysRoleExample
.
Criteria
criteria
=
platformSysRoleExample
.
createCriteria
();
PlatformSysRoleExample
.
Criteria
criteria
=
platformSysRoleExample
.
createCriteria
();
if
(
platformSysRole
!=
null
&&!
EmptyUtilHelper
.
isEmpty
(
platformSysRole
.
getName
()))
{
if
(
platformSysRole
!=
null
&&
!
EmptyUtilHelper
.
isEmpty
(
platformSysRole
.
getName
()))
{
criteria
.
andNameLike
(
"%"
+
platformSysRole
.
getName
()+
"%"
);
criteria
.
andNameLike
(
"%"
+
platformSysRole
.
getName
()
+
"%"
);
}
else
if
(
platformSysRole
!=
null
&&!
EmptyUtilHelper
.
isEmpty
(
platformSysRole
.
getNamezh
()))
{
}
else
if
(
platformSysRole
!=
null
&&
!
EmptyUtilHelper
.
isEmpty
(
platformSysRole
.
getNamezh
()))
{
criteria
.
andNamezhLike
(
"%"
+
platformSysRole
.
getNamezh
()+
"%"
);
criteria
.
andNamezhLike
(
"%"
+
platformSysRole
.
getNamezh
()
+
"%"
);
}
}
List
<
PlatformSysRole
>
list
=
platformSysRoleMapper
.
selectByExample
(
platformSysRoleExample
);
List
<
PlatformSysRole
>
list
=
platformSysRoleMapper
.
selectByExample
(
platformSysRoleExample
);
List
<
PlatformSysUserRole
>
userRoleList
=
this
.
userRolelist
();
List
<
PlatformSysUserRole
>
userRoleList
=
this
.
userRolelist
();
list
.
stream
().
forEach
(
t
->
{
list
.
stream
().
forEach
(
t
->
{
for
(
int
i
=
0
;
i
<
userRoleList
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
userRoleList
.
size
();
i
++)
{
if
(
t
.
getId
().
equals
(
userRoleList
.
get
(
i
).
getRoleId
())&&
userRoleList
.
get
(
i
).
getUserId
()==
platformSysRole
.
getUserId
())
{
if
(
t
.
getId
().
equals
(
userRoleList
.
get
(
i
).
getRoleId
())
&&
userRoleList
.
get
(
i
).
getUserId
()
==
platformSysRole
.
getUserId
())
{
t
.
setIsAdd
(
"1"
);
t
.
setIsAdd
(
"1"
);
break
;
break
;
}
else
{
}
else
{
t
.
setIsAdd
(
"2"
);
t
.
setIsAdd
(
"2"
);
}
}
}
}
...
@@ -114,6 +115,7 @@ public class PlatformRoleUserServiceImpl implements PlatformRoleUserService {
...
@@ -114,6 +115,7 @@ public class PlatformRoleUserServiceImpl implements PlatformRoleUserService {
/**
/**
* 功能描述: 修改用户角色权限信息
* 功能描述: 修改用户角色权限信息
* 〈〉
* 〈〉
*
* @Param: [platformSysUserRole]
* @Param: [platformSysUserRole]
* @Return: [platformSysUserRole]
* @Return: [platformSysUserRole]
* @Author: zhouy
* @Author: zhouy
...
@@ -122,23 +124,23 @@ public class PlatformRoleUserServiceImpl implements PlatformRoleUserService {
...
@@ -122,23 +124,23 @@ public class PlatformRoleUserServiceImpl implements PlatformRoleUserService {
@Override
@Override
public
int
editroleuser
(
PlatformSysUserRole
platformSysUserRole
)
{
public
int
editroleuser
(
PlatformSysUserRole
platformSysUserRole
)
{
int
count
=
0
;
int
count
=
0
;
//配置角色时候先删除原角色,不支持一个用户多个角色
//配置角色时候先删除原角色,不支持一个用户多个角色
PlatformSysUserRoleExample
platformSysUserRoleExample
=
new
PlatformSysUserRoleExample
();
PlatformSysUserRoleExample
platformSysUserRoleExample
=
new
PlatformSysUserRoleExample
();
platformSysUserRoleExample
.
createCriteria
()
//.andRoleIdEqualTo(platformSysUserRole.getRoleId())
platformSysUserRoleExample
.
createCriteria
()
//.andRoleIdEqualTo(platformSysUserRole.getRoleId())
.
andUserIdEqualTo
(
platformSysUserRole
.
getUserId
());
.
andUserIdEqualTo
(
platformSysUserRole
.
getUserId
());
if
(!
EmptyUtilHelper
.
isEmpty
(
platformSysUserRole
.
getUserId
()))
{
if
(!
EmptyUtilHelper
.
isEmpty
(
platformSysUserRole
.
getUserId
()))
{
// count = platformSysUserRoleMapper.deleteByExample(platformSysUserRoleExample);
// count = platformSysUserRoleMapper.deleteByExample(platformSysUserRoleExample);
}
}
if
(
platformSysUserRole
!=
null
&&
"1"
.
equals
(
platformSysUserRole
.
getAction
()))
{
if
(
platformSysUserRole
!=
null
&&
"1"
.
equals
(
platformSysUserRole
.
getAction
()))
{
platformSysUserRole
.
setId
(
StrUtil
.
makePramykey
());
platformSysUserRole
.
setId
(
StrUtil
.
makePramykey
());
count
=
platformSysUserRoleMapper
.
insert
(
platformSysUserRole
);
count
=
platformSysUserRoleMapper
.
insert
(
platformSysUserRole
);
if
(
count
>
0
)
{
if
(
count
>
0
)
{
platformPersonnelMapper
.
updateRoleByUserid
(
platformSysUserRole
.
getUserId
(),
platformSysUserRole
.
getRoleId
());
platformPersonnelMapper
.
updateRoleByUserid
(
platformSysUserRole
.
getUserId
(),
platformSysUserRole
.
getRoleId
());
}
}
}
else
{
}
else
{
if
(
count
>
0
)
{
if
(
count
>
0
)
{
platformPersonnelMapper
.
updateRoleByUserid
(
platformSysUserRole
.
getUserId
(),
""
);
platformPersonnelMapper
.
updateRoleByUserid
(
platformSysUserRole
.
getUserId
(),
""
);
}
}
}
}
...
@@ -146,10 +148,10 @@ public class PlatformRoleUserServiceImpl implements PlatformRoleUserService {
...
@@ -146,10 +148,10 @@ public class PlatformRoleUserServiceImpl implements PlatformRoleUserService {
}
}
@Override
@Override
public
int
addroleuser
(
PlatformSysUserRole
platformSysUserRole
){
public
int
addroleuser
(
PlatformSysUserRole
platformSysUserRole
)
{
platformSysUserRoleMapper
.
deleteByroleId
(
platformSysUserRole
.
getRoleId
());
platformSysUserRoleMapper
.
deleteByroleId
(
platformSysUserRole
.
getRoleId
());
List
<
PlatformSysUserRole
>
list
=
platformSysUserRole
.
getContactList
();
List
<
PlatformSysUserRole
>
list
=
platformSysUserRole
.
getContactList
();
if
(
list
.
size
()>
0
)
{
if
(
list
.
size
()
>
0
)
{
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
PlatformSysUserRole
contact
=
list
.
get
(
i
);
PlatformSysUserRole
contact
=
list
.
get
(
i
);
contact
.
setId
(
StrUtil
.
makePramykey
());
contact
.
setId
(
StrUtil
.
makePramykey
());
...
@@ -159,29 +161,30 @@ public class PlatformRoleUserServiceImpl implements PlatformRoleUserService {
...
@@ -159,29 +161,30 @@ public class PlatformRoleUserServiceImpl implements PlatformRoleUserService {
}
}
return
1
;
return
1
;
}
}
@Override
@Override
public
int
delUserRole
(
PlatformSysUserRole
platformSysUserRole
)
{
public
int
delUserRole
(
PlatformSysUserRole
platformSysUserRole
)
{
int
count
=
0
;
int
count
=
0
;
//配置角色时候先删除原角色,不支持一个用户多个角色
//配置角色时候先删除原角色,不支持一个用户多个角色
PlatformSysUserRoleExample
platformSysUserRoleExample
=
new
PlatformSysUserRoleExample
();
PlatformSysUserRoleExample
platformSysUserRoleExample
=
new
PlatformSysUserRoleExample
();
platformSysUserRoleExample
.
createCriteria
()
//.andRoleIdEqualTo(platformSysUserRole.getRoleId())
platformSysUserRoleExample
.
createCriteria
()
//.andRoleIdEqualTo(platformSysUserRole.getRoleId())
.
andUserIdEqualTo
(
platformSysUserRole
.
getUserId
()).
andRoleIdEqualTo
(
platformSysUserRole
.
getRoleId
());
.
andUserIdEqualTo
(
platformSysUserRole
.
getUserId
()).
andRoleIdEqualTo
(
platformSysUserRole
.
getRoleId
());
if
(!
EmptyUtilHelper
.
isEmpty
(
platformSysUserRole
.
getUserId
())
&&
!
EmptyUtilHelper
.
isEmpty
(
platformSysUserRole
.
getRoleId
()))
{
if
(!
EmptyUtilHelper
.
isEmpty
(
platformSysUserRole
.
getUserId
())
&&
!
EmptyUtilHelper
.
isEmpty
(
platformSysUserRole
.
getRoleId
()))
{
count
=
platformSysUserRoleMapper
.
deleteByExample
(
platformSysUserRoleExample
);
count
=
platformSysUserRoleMapper
.
deleteByExample
(
platformSysUserRoleExample
);
}
}
return
count
;
return
count
;
}
}
@Override
@Override
public
int
editUserRoleList
(
Map
<
String
,
String
>
map
)
{
public
int
editUserRoleList
(
Map
<
String
,
String
>
map
)
{
String
roleid
=
map
.
get
(
"roleId"
);
String
roleid
=
map
.
get
(
"roleId"
);
String
userids
=
map
.
get
(
"userIds"
);
String
userids
=
map
.
get
(
"userIds"
);
int
count
=
0
;
int
count
=
0
;
if
(
EmptyUtilHelper
.
isEmpty
(
roleid
))
{
if
(
EmptyUtilHelper
.
isEmpty
(
roleid
))
{
return
0
;
return
0
;
}
}
if
(
EmptyUtilHelper
.
isEmpty
(
userids
))
{
if
(
EmptyUtilHelper
.
isEmpty
(
userids
))
{
platformSysUserRoleMapper
.
deleteByroleId
(
roleid
);
platformSysUserRoleMapper
.
deleteByroleId
(
roleid
);
return
1
;
return
1
;
}
}
...
@@ -189,21 +192,21 @@ public class PlatformRoleUserServiceImpl implements PlatformRoleUserService {
...
@@ -189,21 +192,21 @@ public class PlatformRoleUserServiceImpl implements PlatformRoleUserService {
//获取数据库中当前的角色用户
//获取数据库中当前的角色用户
PlatformSysUserRoleExample
example
=
new
PlatformSysUserRoleExample
();
PlatformSysUserRoleExample
example
=
new
PlatformSysUserRoleExample
();
example
.
createCriteria
().
andRoleIdEqualTo
(
roleid
);
example
.
createCriteria
().
andRoleIdEqualTo
(
roleid
);
List
<
PlatformSysUserRole
>
cu_list
=
platformSysUserRoleMapper
.
selectByExample
(
example
);
List
<
PlatformSysUserRole
>
cu_list
=
platformSysUserRoleMapper
.
selectByExample
(
example
);
String
[]
strs
=
userids
.
split
(
","
);
String
[]
strs
=
userids
.
split
(
","
);
List
<
Integer
>
u_list
=
new
ArrayList
<>();
//前台传回的用户
List
<
Integer
>
u_list
=
new
ArrayList
<>();
//前台传回的用户
for
(
int
i
=
0
;
i
<
strs
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
strs
.
length
;
i
++)
{
int
u
=
Integer
.
parseInt
(
strs
[
i
]);
int
u
=
Integer
.
parseInt
(
strs
[
i
]);
u_list
.
add
(
u
);
u_list
.
add
(
u
);
}
}
//遍历两个结合重复的代表不用修改,移除
//遍历两个结合重复的代表不用修改,移除
for
(
int
i
=
0
;
i
<
cu_list
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
cu_list
.
size
();
i
++)
{
PlatformSysUserRole
ur
=
cu_list
.
get
(
i
);
PlatformSysUserRole
ur
=
cu_list
.
get
(
i
);
for
(
int
k
=
0
;
k
<
u_list
.
size
();
k
++)
{
for
(
int
k
=
0
;
k
<
u_list
.
size
();
k
++)
{
Integer
u
=
u_list
.
get
(
k
);
Integer
u
=
u_list
.
get
(
k
);
if
(
u
.
compareTo
(
ur
.
getUserId
())==
0
)
{
if
(
u
.
compareTo
(
ur
.
getUserId
())
==
0
)
{
cu_list
.
remove
(
ur
);
cu_list
.
remove
(
ur
);
i
--;
i
--;
u_list
.
remove
(
u
);
u_list
.
remove
(
u
);
...
@@ -214,15 +217,15 @@ public class PlatformRoleUserServiceImpl implements PlatformRoleUserService {
...
@@ -214,15 +217,15 @@ public class PlatformRoleUserServiceImpl implements PlatformRoleUserService {
}
}
//此时cu_list中剩余的删掉
//此时cu_list中剩余的删掉
if
(
cu_list
.
size
()>
0
)
{
if
(
cu_list
.
size
()
>
0
)
{
platformSysUserRoleMapper
.
batchDeleteById
(
cu_list
);
platformSysUserRoleMapper
.
batchDeleteById
(
cu_list
);
}
}
//此时u_list中剩余的新增
//此时u_list中剩余的新增
if
(
u_list
.
size
()>
0
)
{
if
(
u_list
.
size
()
>
0
)
{
List
<
PlatformSysUserRole
>
add_list
=
new
ArrayList
<>();
List
<
PlatformSysUserRole
>
add_list
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
u_list
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
u_list
.
size
();
i
++)
{
PlatformSysUserRole
entity
=
PlatformSysUserRole
entity
=
new
PlatformSysUserRole
(
StrUtil
.
makePramykey
(),
u_list
.
get
(
i
),
roleid
);
new
PlatformSysUserRole
(
StrUtil
.
makePramykey
(),
u_list
.
get
(
i
),
roleid
);
add_list
.
add
(
entity
);
add_list
.
add
(
entity
);
}
}
platformSysUserRoleMapper
.
batchInsert
(
add_list
);
platformSysUserRoleMapper
.
batchInsert
(
add_list
);
...
@@ -235,6 +238,7 @@ public class PlatformRoleUserServiceImpl implements PlatformRoleUserService {
...
@@ -235,6 +238,7 @@ public class PlatformRoleUserServiceImpl implements PlatformRoleUserService {
/**
/**
* 功能描述: <br>角色用户列表
* 功能描述: <br>角色用户列表
* 〈〉
* 〈〉
*
* @Param: [platformPersonnel, pageNum, pageSize]
* @Param: [platformPersonnel, pageNum, pageSize]
* @Return: [platformPersonnel, pageNum, pageSize]
* @Return: [platformPersonnel, pageNum, pageSize]
* @Author: zhouy
* @Author: zhouy
...
@@ -243,28 +247,9 @@ public class PlatformRoleUserServiceImpl implements PlatformRoleUserService {
...
@@ -243,28 +247,9 @@ public class PlatformRoleUserServiceImpl implements PlatformRoleUserService {
@Override
@Override
public
PageInfo
<
PlatformPersonnel
>
roleuserpagedlist
(
PlatformPersonnel
platformPersonnel
,
int
pageNum
,
int
pageSize
)
{
public
PageInfo
<
PlatformPersonnel
>
roleuserpagedlist
(
PlatformPersonnel
platformPersonnel
,
int
pageNum
,
int
pageSize
)
{
PageHelper
.
startPage
(
pageNum
,
pageSize
);
PageHelper
.
startPage
(
pageNum
,
pageSize
);
// PlatformPersonnelExample platformPersonnelExample = new PlatformPersonnelExample();
// PlatformPersonnelExample.Criteria criteria = platformPersonnelExample.createCriteria();
// if (platformPersonnel!=null){
// if (!EmptyUtilHelper.isEmpty(platformPersonnel.getAccount())){
// criteria.andAccountLike("%"+platformPersonnel.getAccount()+"%");
// }
// if (!EmptyUtilHelper.isEmpty(platformPersonnel.getUsername())){
// criteria.andUsernameLike("%"+platformPersonnel.getUsername()+"%");
// }
// if(!EmptyUtilHelper.isEmpty(platformPersonnel.getRole())){
// criteria.andRoleEqualTo(platformPersonnel.getRole());
// }
// }
// List<PlatformPersonnel> list=platformPersonnelMapper.selectByExample(platformPersonnelExample);
List
<
PlatformPersonnel
>
list
=
platformPersonnelMapper
.
selectByroleId
(
platformPersonnel
.
getRole
());
List
<
PlatformPersonnel
>
list
=
platformPersonnelMapper
.
selectByroleId
(
platformPersonnel
.
getRole
());
return
new
PageInfo
<>(
list
);
PageInfo
<
PlatformPersonnel
>
pageInfo
=
new
PageInfo
<>(
list
);
return
pageInfo
;
}
}
...
@@ -272,22 +257,42 @@ public class PlatformRoleUserServiceImpl implements PlatformRoleUserService {
...
@@ -272,22 +257,42 @@ public class PlatformRoleUserServiceImpl implements PlatformRoleUserService {
public
List
<
PlatformSysUserRole
>
roleuserlist
(
PlatformPersonnel
platformPersonnel
)
{
public
List
<
PlatformSysUserRole
>
roleuserlist
(
PlatformPersonnel
platformPersonnel
)
{
PlatformSysUserRoleExample
example
=
new
PlatformSysUserRoleExample
();
PlatformSysUserRoleExample
example
=
new
PlatformSysUserRoleExample
();
example
.
createCriteria
().
andRoleIdEqualTo
(
platformPersonnel
.
getRole
());
example
.
createCriteria
().
andRoleIdEqualTo
(
platformPersonnel
.
getRole
());
List
<
PlatformSysUserRole
>
list
=
platformSysUserRoleMapper
.
selectByExample
(
example
);
return
platformSysUserRoleMapper
.
selectByExample
(
example
);
return
list
;
}
}
/**
/**
* 功能描述: <b>用户角色信息
* 功能描述: <b>用户角色信息
* 〈〉
* 〈〉
*
* @Param: []
* @Param: []
* @Return: []
* @Return: []
* @Author: zhouy
* @Author: zhouy
* @Date: 2019-09-12 09:36
* @Date: 2019-09-12 09:36
*/
*/
public
List
<
PlatformSysUserRole
>
userRolelist
(){
public
List
<
PlatformSysUserRole
>
userRolelist
()
{
PlatformSysUserRoleExample
platformSysUserRoleExample
=
new
PlatformSysUserRoleExample
();
PlatformSysUserRoleExample
platformSysUserRoleExample
=
new
PlatformSysUserRoleExample
();
return
platformSysUserRoleMapper
.
selectByExample
(
platformSysUserRoleExample
);
return
platformSysUserRoleMapper
.
selectByExample
(
platformSysUserRoleExample
);
}
}
/**
* 功能描述: <br>根据用户查询用户角色列表
*
* @param platformPersonnel
* @return
*/
@Override
public
List
<
PlatformSysUserRole
>
userRoleList
(
PlatformPersonnel
platformPersonnel
)
{
PlatformSysUserRoleExample
example
=
new
PlatformSysUserRoleExample
();
example
.
createCriteria
().
andUserIdEqualTo
(
platformPersonnel
.
getId
());
return
platformSysUserRoleMapper
.
selectByExample
(
example
);
}
/**
* 功能描述: <br>新增用户角色
* @param platformSysUserRole
* @return
*/
public
int
addUserRole
(
PlatformSysUserRole
platformSysUserRole
){
return
platformSysUserRoleMapper
.
insert
(
platformSysUserRole
);
}
}
}
src/main/resources/application-prod.yml
View file @
272c3fc7
...
@@ -119,6 +119,8 @@ metro-daily:
...
@@ -119,6 +119,8 @@ metro-daily:
daily_entity_url
:
${IP.url-daily}/md/MetroDailyAssembleController/metroDailyAssemble
daily_entity_url
:
${IP.url-daily}/md/MetroDailyAssembleController/metroDailyAssemble
#公告
#公告
notice-manage
:
notice-manage
:
# 公告系统调用设置角色方法时,设置的角色id
notice_role_id
:
db0a394ec1af4ebba6cb85be1043eb7d
#栏目全部列表
#栏目全部列表
api_column_url
:
${IP.url-notice}/NoticeManage/api/portalController/listColumn
api_column_url
:
${IP.url-notice}/NoticeManage/api/portalController/listColumn
#栏目列表-可见范围内
#栏目列表-可见范围内
...
...
src/main/resources/application-test153.yml
View file @
272c3fc7
...
@@ -114,6 +114,8 @@ metro-daily:
...
@@ -114,6 +114,8 @@ metro-daily:
daily_entity_url
:
http://10.12.111.48:6107/znzl/MetroDailyAssembleController/metroDailyAssemble
daily_entity_url
:
http://10.12.111.48:6107/znzl/MetroDailyAssembleController/metroDailyAssemble
notice-manage
:
notice-manage
:
# 公告系统调用设置角色方法时,设置的角色id
notice_role_id
:
db0a394ec1af4ebba6cb85be1043eb7d
#栏目全部列表
#栏目全部列表
api_column_url
:
http://localhost:9083/NoticeManage/api/portalController/listColumn
api_column_url
:
http://localhost:9083/NoticeManage/api/portalController/listColumn
#栏目列表-可见范围内
#栏目列表-可见范围内
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论