Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
T
tcm-system
Project
Project
Details
Activity
Releases
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
TCM
tcm-system
Commits
33defe4c
Commit
33defe4c
authored
Mar 24, 2020
by
tangf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改权限管理查询逻辑
修改余额常量字段
parent
12d57f00
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
363 additions
and
238 deletions
+363
-238
RoleAuthorityDao.java
...java/com/pangding/web/authority/dao/RoleAuthorityDao.java
+0
-3
UserRoleDao.java
...main/java/com/pangding/web/authority/dao/UserRoleDao.java
+3
-0
RoleAuthorityDaoImpl.java
...pangding/web/authority/dao/impl/RoleAuthorityDaoImpl.java
+9
-1
UserRoleDaoImpl.java
.../com/pangding/web/authority/dao/impl/UserRoleDaoImpl.java
+14
-2
AuthorityServiceImpl.java
...ding/web/authority/service/impl/AuthorityServiceImpl.java
+168
-124
CompanyServiceImpl.java
...ngding/web/authority/service/impl/CompanyServiceImpl.java
+6
-5
RegisterServiceImpl.java
...gding/web/authority/service/impl/RegisterServiceImpl.java
+93
-90
RoleServiceImpl.java
.../pangding/web/authority/service/impl/RoleServiceImpl.java
+13
-12
IRoleAuthorityVo.java
.../java/com/pangding/web/authority/vo/IRoleAuthorityVo.java
+14
-0
RoleAuthorityGetReqVo.java
...angding/web/authority/vo/reqvo/RoleAuthorityGetReqVo.java
+20
-0
UserRoleGetReqVo.java
...com/pangding/web/authority/vo/reqvo/UserRoleGetReqVo.java
+12
-0
AuthorityListByLevelResVo.java
...ing/web/authority/vo/resvo/AuthorityListByLevelResVo.java
+3
-1
AuthorityListResVo.java
...m/pangding/web/authority/vo/resvo/AuthorityListResVo.java
+8
-0
No files found.
src/main/java/com/pangding/web/authority/dao/RoleAuthorityDao.java
View file @
33defe4c
package
com
.
pangding
.
web
.
authority
.
dao
;
import
com.pangding.web.authority.vo.reqvo.RoleAuthorityGetReqVo
;
import
com.pangding.web.authority.vo.RoleAuthorityVo
;
import
com.yanzuoguang.dao.BaseDao
;
import
java.util.List
;
/**
* @author zhangjinyao
...
...
src/main/java/com/pangding/web/authority/dao/UserRoleDao.java
View file @
33defe4c
...
...
@@ -2,6 +2,7 @@ package com.pangding.web.authority.dao;
import
com.pangding.web.authority.vo.reqvo.UserRoleGetReqVo
;
import
com.pangding.web.authority.vo.UserRoleVo
;
import
com.pangding.web.authority.vo.resvo.WebRoleResVo
;
import
com.yanzuoguang.dao.BaseDao
;
import
java.util.List
;
...
...
@@ -19,4 +20,6 @@ public interface UserRoleDao extends BaseDao {
*/
List
<
UserRoleVo
>
getUserRoleList
(
UserRoleGetReqVo
reqVo
);
List
<
WebRoleResVo
>
getUserNum
(
UserRoleGetReqVo
reqVo
);
}
src/main/java/com/pangding/web/authority/dao/impl/RoleAuthorityDaoImpl.java
View file @
33defe4c
...
...
@@ -3,6 +3,7 @@ package com.pangding.web.authority.dao.impl;
import
com.pangding.web.authority.dao.RoleAuthorityDao
;
import
com.pangding.web.authority.vo.reqvo.RoleAuthorityGetReqVo
;
import
com.pangding.web.authority.vo.RoleAuthorityVo
;
import
com.yanzuoguang.dao.DaoConst
;
import
com.yanzuoguang.dao.impl.BaseDaoImpl
;
import
org.springframework.stereotype.Component
;
...
...
@@ -16,9 +17,16 @@ public class RoleAuthorityDaoImpl extends BaseDaoImpl implements RoleAuthorityDa
@Override
protected
void
init
()
{
register
(
RoleAuthorityVo
.
class
);
getSql
(
DaoConst
.
LOAD
).
setSql
(
"select ra.role_id,a.* from pd_authority a "
+
"LEFT JOIN pd_role_authority ra on ra.authority_id = a.id {INNER} "
+
"where 1=1 {WHERE} ORDER BY a.pid,a.sort"
)
.
add
(
"userId"
,
"AND b.user_id = @userId"
,
"{INNER}"
,
"INNER JOIN pd_user_role AS b ON ra.role_id = b.role_id"
)
.
add
(
"role"
,
" AND ra.role_id = @role"
)
;
}
}
src/main/java/com/pangding/web/authority/dao/impl/UserRoleDaoImpl.java
View file @
33defe4c
...
...
@@ -3,6 +3,7 @@ package com.pangding.web.authority.dao.impl;
import
com.pangding.web.authority.dao.UserRoleDao
;
import
com.pangding.web.authority.vo.reqvo.UserRoleGetReqVo
;
import
com.pangding.web.authority.vo.UserRoleVo
;
import
com.pangding.web.authority.vo.resvo.WebRoleResVo
;
import
com.yanzuoguang.dao.impl.BaseDaoImpl
;
import
org.springframework.stereotype.Component
;
...
...
@@ -16,14 +17,20 @@ public class UserRoleDaoImpl extends BaseDaoImpl implements UserRoleDao {
private
static
final
String
GET_USER_ROLE_LIST
=
"GET_USER_ROLE_LIST"
;
private
static
final
String
GET_ROLE_USER_NUMBER
=
"GET_ROLE_USER_NUMBER"
;
@Override
protected
void
init
()
{
register
(
UserRoleVo
.
class
);
table
.
add
(
GET_USER_ROLE_LIST
,
"select * from pd_user_role where 1=1 "
)
.
add
(
"userId"
,
"and user_id = ?"
)
.
add
(
"roleId"
,
"and role_id = ?"
);
.
add
(
"userId"
,
"and user_id = ? "
)
.
add
(
"roleId"
,
"and role_id = ? "
);
table
.
add
(
GET_ROLE_USER_NUMBER
,
"select count(*),role_id from pd_user_role where 1=1 {WHERE} group by role_id "
)
.
add
(
"userId"
,
"and user_id = ? "
)
.
add
(
"roleIds"
,
"and role_id in ? "
);
}
...
...
@@ -32,4 +39,9 @@ public class UserRoleDaoImpl extends BaseDaoImpl implements UserRoleDao {
return
this
.
query
(
UserRoleVo
.
class
,
GET_USER_ROLE_LIST
,
reqVo
);
}
@Override
public
List
<
WebRoleResVo
>
getUserNum
(
UserRoleGetReqVo
reqVo
)
{
return
this
.
query
(
WebRoleResVo
.
class
,
GET_ROLE_USER_NUMBER
,
reqVo
);
}
}
src/main/java/com/pangding/web/authority/service/impl/AuthorityServiceImpl.java
View file @
33defe4c
...
...
@@ -9,6 +9,7 @@ import com.pangding.web.authority.vo.resvo.AuthorityListByLevelResVo;
import
com.pangding.web.authority.vo.resvo.AuthorityListResVo
;
import
com.pangding.web.authority.vo.resvo.AuthorityResVo
;
import
com.pangding.web.authority.vo.resvo.WebAuthorityResVo
;
import
com.pangding.web.vo.system.res.authority.RoleAuthorityLoadResVo
;
import
com.yanzuoguang.util.base.ObjectHelper
;
import
com.yanzuoguang.util.exception.CodeException
;
import
com.yanzuoguang.util.helper.StringHelper
;
...
...
@@ -48,7 +49,7 @@ public class AuthorityServiceImpl implements AuthorityService {
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
AuthorityListResVo
save
(
AuthorityVo
authorityVo
)
{
/*this.checkValid(authorityVo);*/
if
(
null
==
authorityVo
.
getPid
()
||
authorityVo
.
getPid
().
isEmpty
()){
if
(
null
==
authorityVo
.
getPid
()
||
authorityVo
.
getPid
().
isEmpty
())
{
authorityVo
.
setPid
(
""
);
}
afterPlus
(
authorityVo
);
...
...
@@ -69,38 +70,39 @@ public class AuthorityServiceImpl implements AuthorityService {
/**
* 将权限新排序后面所有的权限排序+1
*
* @param authorityVo 权限对象
*/
private
void
afterPlus
(
AuthorityVo
authorityVo
){
private
void
afterPlus
(
AuthorityVo
authorityVo
)
{
AuthorityGetReqVo
reqVo
=
new
AuthorityGetReqVo
();
reqVo
.
setPid
(
authorityVo
.
getPid
());
reqVo
.
setSort
(
authorityVo
.
getSort
());
reqVo
.
setAttribute
(
authorityVo
.
getAttribute
());
AuthorityVo
authorityVo1
=
authorityDao
.
load
(
reqVo
,
AuthorityVo
.
class
);
if
(
authorityVo1
!=
null
){
AuthorityVo
authorityVo1
=
authorityDao
.
load
(
reqVo
,
AuthorityVo
.
class
);
if
(
authorityVo1
!=
null
)
{
AuthorityAfterReqVo
afterReqVo
=
new
AuthorityAfterReqVo
();
ObjectHelper
.
writeWithFrom
(
afterReqVo
,
authorityVo
);
ObjectHelper
.
writeWithFrom
(
afterReqVo
,
authorityVo
);
List
<
AuthorityVo
>
authorityVoList
=
authorityDao
.
after
(
afterReqVo
);
for
(
AuthorityVo
authorityVo2
:
authorityVoList
)
{
for
(
AuthorityVo
authorityVo2
:
authorityVoList
)
{
Integer
sort
=
authorityVo2
.
getSort
();
Integer
newSort
=
sort
+
1
;
Integer
newSort
=
sort
+
1
;
authorityVo2
.
setSort
(
newSort
);
authorityDao
.
update
(
authorityVo2
);
}
}
}
private
void
afterSub
(
AuthorityVo
authorityVo
){
private
void
afterSub
(
AuthorityVo
authorityVo
)
{
AuthorityGetReqVo
getReqVo
=
new
AuthorityGetReqVo
();
getReqVo
.
setId
(
authorityVo
.
getId
());
AuthorityVo
authorityVo1
=
authorityDao
.
load
(
getReqVo
,
AuthorityVo
.
class
);
if
(
authorityVo1
!=
null
){
AuthorityVo
authorityVo1
=
authorityDao
.
load
(
getReqVo
,
AuthorityVo
.
class
);
if
(
authorityVo1
!=
null
)
{
AuthorityAfterReqVo
afterReqVo
=
new
AuthorityAfterReqVo
();
ObjectHelper
.
writeWithFrom
(
afterReqVo
,
authorityVo
);
ObjectHelper
.
writeWithFrom
(
afterReqVo
,
authorityVo
);
List
<
AuthorityVo
>
authorityVoList
=
authorityDao
.
after
(
afterReqVo
);
for
(
AuthorityVo
authorityVo2
:
authorityVoList
)
{
for
(
AuthorityVo
authorityVo2
:
authorityVoList
)
{
Integer
sort
=
authorityVo2
.
getSort
();
Integer
newSort
=
sort
-
1
;
Integer
newSort
=
sort
-
1
;
authorityVo2
.
setSort
(
newSort
);
authorityDao
.
update
(
authorityVo2
);
}
...
...
@@ -117,7 +119,7 @@ public class AuthorityServiceImpl implements AuthorityService {
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
AuthorityListResVo
update
(
AuthorityVo
authorityVo
)
{
/*this.checkValid(authorityVo);*/
if
(
null
==
authorityVo
.
getPid
()
||
authorityVo
.
getPid
().
isEmpty
()){
if
(
null
==
authorityVo
.
getPid
()
||
authorityVo
.
getPid
().
isEmpty
())
{
authorityVo
.
setPid
(
""
);
}
updateSort
(
authorityVo
);
...
...
@@ -130,8 +132,8 @@ public class AuthorityServiceImpl implements AuthorityService {
private
void
updateSort
(
AuthorityVo
authorityVo
)
{
AuthorityGetReqVo
authorityGetReqVo
=
new
AuthorityGetReqVo
();
authorityGetReqVo
.
setId
(
authorityVo
.
getId
());
AuthorityVo
old
=
authorityDao
.
load
(
authorityGetReqVo
,
AuthorityVo
.
class
);
if
(
old
.
getSort
()
>
authorityVo
.
getSort
())
{
AuthorityVo
old
=
authorityDao
.
load
(
authorityGetReqVo
,
AuthorityVo
.
class
);
if
(
old
.
getSort
()
>
authorityVo
.
getSort
())
{
AuthorityBetweenSortReqVo
reqVo
=
new
AuthorityBetweenSortReqVo
();
reqVo
.
setPid
(
authorityVo
.
getPid
());
reqVo
.
setSmallSort
(
authorityVo
.
getSort
());
...
...
@@ -143,7 +145,7 @@ public class AuthorityServiceImpl implements AuthorityService {
authorityDao
.
update
(
authorityVo1
);
}
}
if
(
old
.
getSort
()
<
authorityVo
.
getSort
()){
if
(
old
.
getSort
()
<
authorityVo
.
getSort
())
{
AuthorityBetweenSortReqVo
reqVo
=
new
AuthorityBetweenSortReqVo
();
reqVo
.
setPid
(
authorityVo
.
getPid
());
reqVo
.
setSmallSort
(
old
.
getSort
());
...
...
@@ -178,19 +180,19 @@ public class AuthorityServiceImpl implements AuthorityService {
public
AuthorityResVo
getAuthorityById
(
WebAuthorityReqVo
reqVo
)
{
AuthorityGetReqVo
authorityGetReqVo
=
new
AuthorityGetReqVo
();
authorityGetReqVo
.
setId
(
reqVo
.
getId
());
AuthorityVo
authorityVo
=
authorityDao
.
load
(
authorityGetReqVo
,
AuthorityVo
.
class
);
if
(
authorityVo
==
null
){
AuthorityVo
authorityVo
=
authorityDao
.
load
(
authorityGetReqVo
,
AuthorityVo
.
class
);
if
(
authorityVo
==
null
)
{
throw
new
CodeException
(
"该权限不存在"
);
}
AuthorityResVo
resVo
=
new
AuthorityResVo
();
ObjectHelper
.
writeWithFrom
(
resVo
,
authorityVo
);
ObjectHelper
.
writeWithFrom
(
resVo
,
authorityVo
);
if
(
null
!=
authorityVo
.
getPid
()
&&
!
authorityVo
.
getPid
().
isEmpty
()){
if
(
null
!=
authorityVo
.
getPid
()
&&
!
authorityVo
.
getPid
().
isEmpty
())
{
AuthorityGetReqVo
getReqVo
=
new
AuthorityGetReqVo
();
getReqVo
.
setId
(
authorityVo
.
getPid
());
AuthorityVo
parent
=
authorityDao
.
load
(
getReqVo
,
AuthorityVo
.
class
);
if
(
null
!=
parent
){
AuthorityVo
parent
=
authorityDao
.
load
(
getReqVo
,
AuthorityVo
.
class
);
if
(
null
!=
parent
)
{
resVo
.
setParentName
(
parent
.
getName
());
}
}
...
...
@@ -210,16 +212,16 @@ public class AuthorityServiceImpl implements AuthorityService {
/*将该权限排序后的权限排序-1*/
AuthorityGetReqVo
getReqVo
=
new
AuthorityGetReqVo
();
getReqVo
.
setId
(
reqVo
.
getId
());
AuthorityVo
authority
=
authorityDao
.
load
(
getReqVo
,
AuthorityVo
.
class
);
if
(
null
!=
authority
){
AuthorityVo
authority
=
authorityDao
.
load
(
getReqVo
,
AuthorityVo
.
class
);
if
(
null
!=
authority
)
{
afterSub
(
authority
);
}
AuthorityGetReqVo
reqVo1
=
new
AuthorityGetReqVo
();
reqVo1
.
setPid
(
reqVo
.
getId
());
List
<
AuthorityVo
>
childList
=
authorityDao
.
loadList
(
reqVo1
,
AuthorityVo
.
class
);
if
(
childList
!=
null
&&
!
childList
.
isEmpty
()){
for
(
AuthorityVo
child
:
childList
)
{
List
<
AuthorityVo
>
childList
=
authorityDao
.
loadList
(
reqVo1
,
AuthorityVo
.
class
);
if
(
childList
!=
null
&&
!
childList
.
isEmpty
())
{
for
(
AuthorityVo
child
:
childList
)
{
WebAuthorityReqVo
reqVo2
=
new
WebAuthorityReqVo
();
reqVo2
.
setId
(
child
.
getId
());
this
.
deleteAuthorityById
(
reqVo2
);
...
...
@@ -232,8 +234,8 @@ public class AuthorityServiceImpl implements AuthorityService {
RoleAuthorityGetReqVo
roleAuthorityGetReqVo
=
new
RoleAuthorityGetReqVo
();
roleAuthorityGetReqVo
.
setAuthorityId
(
reqVo
.
getId
());
List
<
RoleAuthorityVo
>
roleAuthorityList
=
roleAuthorityDao
.
loadList
(
roleAuthorityGetReqVo
,
RoleAuthorityVo
.
class
);
for
(
RoleAuthorityVo
roleAuthority
:
roleAuthorityList
)
{
List
<
RoleAuthorityVo
>
roleAuthorityList
=
roleAuthorityDao
.
loadList
(
roleAuthorityGetReqVo
,
RoleAuthorityVo
.
class
);
for
(
RoleAuthorityVo
roleAuthority
:
roleAuthorityList
)
{
roleAuthorityDao
.
remove
(
roleAuthority
);
}
}
...
...
@@ -249,27 +251,27 @@ public class AuthorityServiceImpl implements AuthorityService {
PageSizeData
<
AuthorityVo
>
authorityVoPageSizeData
=
authorityDao
.
getAuthorityList
(
reqVo
);
PageSizeData
<
WebAuthorityResVo
>
webAuthorityResVoPageSizeData
=
new
PageSizeData
();
List
<
AuthorityVo
>
authorityVoList
=
authorityVoPageSizeData
.
getList
();
if
(
authorityVoList
==
null
||
authorityVoList
.
isEmpty
()){
if
(
authorityVoList
==
null
||
authorityVoList
.
isEmpty
())
{
throw
new
CodeException
(
"没有更多权限"
);
}
List
<
WebAuthorityResVo
>
webAuthorityResVoList
=
new
ArrayList
(
authorityVoList
.
size
());
for
(
AuthorityVo
authorityVo
:
authorityVoList
)
{
for
(
AuthorityVo
authorityVo
:
authorityVoList
)
{
WebAuthorityResVo
resVo
=
new
WebAuthorityResVo
();
ObjectHelper
.
writeWithFrom
(
resVo
,
authorityVo
);
if
(
null
!=
authorityVo
.
getPid
()
&&
!
authorityVo
.
getPid
().
isEmpty
())
{
AuthorityGetReqVo
authorityGetReqVo
=
new
AuthorityGetReqVo
();
authorityGetReqVo
.
setId
(
authorityVo
.
getPid
());
AuthorityVo
parent
=
authorityDao
.
load
(
authorityGetReqVo
,
AuthorityVo
.
class
);
if
(!
StringHelper
.
isEmpty
(
parent
))
{
resVo
.
setParentName
(
parent
.
getName
());
}
else
{
System
.
out
.
println
(
"id:"
+
authorityVo
.
getPid
());
}
}
ObjectHelper
.
writeWithFrom
(
resVo
,
authorityVo
);
// if (null != authorityVo.getPid() && !authorityVo.getPid().isEmpty())
{
//
AuthorityGetReqVo authorityGetReqVo = new AuthorityGetReqVo();
//
authorityGetReqVo.setId(authorityVo.getPid());
// AuthorityVo parent = authorityDao.load(authorityGetReqVo,
AuthorityVo.class);
// if (!StringHelper.isEmpty(parent))
{
//
resVo.setParentName(parent.getName());
// } else
{
//
System.out.println("id:" + authorityVo.getPid());
//
}
//
//
}
webAuthorityResVoList
.
add
(
resVo
);
}
ObjectHelper
.
writeWithFrom
(
webAuthorityResVoPageSizeData
,
authorityVoPageSizeData
);
ObjectHelper
.
writeWithFrom
(
webAuthorityResVoPageSizeData
,
authorityVoPageSizeData
);
webAuthorityResVoPageSizeData
.
setList
(
webAuthorityResVoList
);
return
webAuthorityResVoPageSizeData
;
...
...
@@ -277,12 +279,13 @@ public class AuthorityServiceImpl implements AuthorityService {
/**
* 查询不分页权限列表
*
* @return
*/
@Override
public
List
<
AuthorityVo
>
getAuthorityList
(
AuthorityListReqVo
reqVo
)
{
List
<
AuthorityVo
>
authorityVoList
=
authorityDao
.
loadList
(
reqVo
,
AuthorityVo
.
class
);
if
(
null
==
authorityVoList
||
authorityVoList
.
isEmpty
()){
List
<
AuthorityVo
>
authorityVoList
=
authorityDao
.
loadList
(
reqVo
,
AuthorityVo
.
class
);
if
(
null
==
authorityVoList
||
authorityVoList
.
isEmpty
())
{
throw
new
CodeException
(
"暂无权限,请先添加"
);
}
return
authorityVoList
;
...
...
@@ -290,91 +293,132 @@ public class AuthorityServiceImpl implements AuthorityService {
@Override
public
AuthorityListResVo
getListByLevel
(
AuthorityListReqVo
reqVo
)
{
AuthorityListResVo
authorityListResVo
=
new
AuthorityListResVo
();
// 找到该公司管理员角色
RoleGetReqVo
roleGetReqVo
=
new
RoleGetReqVo
();
roleGetReqVo
.
setCompanyId
(
reqVo
.
getCompanyId
());
roleGetReqVo
.
setIsAdmin
(
1
);
RoleVo
roleVo
=
roleDaoImpl
.
load
(
roleGetReqVo
,
RoleVo
.
class
);
if
(
StringHelper
.
isEmpty
(
roleVo
)){
RoleVo
roleVo
=
roleDaoImpl
.
load
(
roleGetReqVo
,
RoleVo
.
class
);
if
(
StringHelper
.
isEmpty
(
roleVo
))
{
throw
new
CodeException
(
"该公司用户未设置管理员角色"
);
}
Set
authorityIdSet
=
new
HashSet
();
RoleAuthorityGetReqVo
roleAuthorityGetReqVo
=
new
RoleAuthorityGetReqVo
();
roleAuthorityGetReqVo
.
setRoleId
(
roleVo
.
getId
());
List
<
RoleAuthorityVo
>
roleAuthorityVoList
=
roleAuthorityDao
.
loadList
(
roleAuthorityGetReqVo
,
RoleAuthorityVo
.
class
);
for
(
RoleAuthorityVo
roleAuthorityVo:
roleAuthorityVoList
)
{
authorityIdSet
.
add
(
roleAuthorityVo
.
getAuthorityId
());
}
roleAuthorityGetReqVo
.
setRole
(
roleVo
.
getId
());
List
<
AuthorityListByLevelResVo
>
roleAuthorityVoList
=
roleAuthorityDao
.
loadList
(
roleAuthorityGetReqVo
,
AuthorityListByLevelResVo
.
class
);
authorityListResVo
.
setAuthorityListByLevel
(
getChildList
(
roleAuthorityVoList
,
false
));
List
<
String
>
authorityIdList
=
new
ArrayList
<>();
Object
[]
objs
=
authorityIdSet
.
toArray
();
for
(
Object
obj:
objs
)
{
authorityIdList
.
add
((
String
)
obj
);
}
List
<
AuthorityVo
>
levelOneList
=
new
ArrayList
();
for
(
int
i
=
0
;
i
<
authorityIdList
.
size
();
i
++)
{
AuthorityGetReqVo
authorityGetReqVo
=
new
AuthorityGetReqVo
();
authorityGetReqVo
.
setId
(
authorityIdList
.
get
(
i
));
AuthorityVo
authorityVo
=
authorityDao
.
load
(
authorityGetReqVo
,
AuthorityVo
.
class
);
if
(!
StringHelper
.
isEmpty
(
authorityVo
)
&&
StringHelper
.
isEmpty
(
authorityVo
.
getPid
())){
levelOneList
.
add
(
authorityVo
);
authorityIdList
.
set
(
i
,
""
);
}
}
List
<
String
>
authorityIds
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
authorityIdList
.
size
();
i
++)
{
if
(!
""
.
equals
(
authorityIdList
.
get
(
i
))){
authorityIds
.
add
(
authorityIdList
.
get
(
i
));
}
}
Collections
.
sort
(
levelOneList
);
if
(
levelOneList
.
isEmpty
()){
throw
new
CodeException
(
"该用户暂无权限,请添加"
);
RoleAuthorityGetReqVo
roleAuthorityGetReqVo1
=
new
RoleAuthorityGetReqVo
();
roleAuthorityGetReqVo1
.
setRole
(
reqVo
.
getRoleId
());
List
<
AuthorityVo
>
roleAuthorityVoList1
=
roleAuthorityDao
.
loadList
(
roleAuthorityGetReqVo
,
AuthorityVo
.
class
);
authorityListResVo
.
setAuthorityListByRole
(
roleAuthorityVoList1
);
// for (RoleAuthorityVo roleAuthorityVo:roleAuthorityVoList) {
// authorityIdSet.add(roleAuthorityVo.getAuthorityId());
// }
// List<String> authorityIdList = new ArrayList<>();
// Object[] objs = authorityIdSet.toArray();
// for (Object obj:objs) {
// authorityIdList.add((String) obj);
// }
// List<AuthorityVo> levelOneList = new ArrayList();
// for (int i = 0; i < authorityIdList.size(); i++) {
// AuthorityGetReqVo authorityGetReqVo = new AuthorityGetReqVo();
// authorityGetReqVo.setId(authorityIdList.get(i));
// AuthorityVo authorityVo = authorityDao.load(authorityGetReqVo,AuthorityVo.class);
// if (!StringHelper.isEmpty(authorityVo) && StringHelper.isEmpty(authorityVo.getPid())){
// levelOneList.add(authorityVo);
// authorityIdList.set(i,"");
// }
// }
// List<String> authorityIds = new ArrayList<>();
// for (int i = 0; i < authorityIdList.size(); i++) {
// if (!"".equals(authorityIdList.get(i))){
// authorityIds.add(authorityIdList.get(i));
// }
// }
// Collections.sort(levelOneList);
// if (levelOneList.isEmpty()){
// throw new CodeException("该用户暂无权限,请添加");
// }
// List<AuthorityListByLevelResVo> authorityListByLevel = new ArrayList<>();
// for (AuthorityVo authorityVo:levelOneList) {
// AuthorityListByLevelResVo resVo1 = new AuthorityListByLevelResVo();
// ObjectHelper.writeWithFrom(resVo1,authorityVo);
// List<AuthorityListByLevelResVo> childList = registerServiceImpl.getChildList(authorityVo,authorityIds);
// resVo1.setChildList(childList);
// authorityListByLevel.add(resVo1);
// }
// Collections.sort(authorityListByLevel);
// AuthorityListResVo authorityListResVo = new AuthorityListResVo();
// authorityListResVo.setAuthorityListByLevel(authorityListByLevel);
// /*若roleId存在,则需要返回该角色拥有的权限列表*/
// if (null != reqVo.getRoleId() && !reqVo.getRoleId().isEmpty()){
// RoleAuthorityGetReqVo roleAuthorityGetReqVo1 = new RoleAuthorityGetReqVo();
// roleAuthorityGetReqVo1.setRoleId(reqVo.getRoleId());
// List<RoleAuthorityVo> roleAuthorityVos = roleAuthorityDao.loadList(roleAuthorityGetReqVo1,RoleAuthorityVo.class);
// List<AuthorityVo> authorityVoList = new ArrayList<>();
// if (null != roleAuthorityVos && !roleAuthorityVos.isEmpty()){
// for (RoleAuthorityVo roleAuthorityVo:roleAuthorityVos) {
// AuthorityGetReqVo getReqVo = new AuthorityGetReqVo();
// getReqVo.setId(roleAuthorityVo.getAuthorityId());
// AuthorityVo authorityVo = authorityDao.load(getReqVo,AuthorityVo.class);
// if (null != authorityVo){
// authorityVoList.add(authorityVo);
// }
// }
// }
// authorityListResVo.setAuthorityListByRole(authorityVoList);
// }
return
authorityListResVo
;
}
public
static
<
T
extends
AuthorityListByLevelResVo
>
List
<
T
>
getChildList
(
List
<
T
>
list
,
boolean
check
)
{
if
(
list
==
null
||
list
.
isEmpty
())
{
return
list
;
}
List
<
AuthorityListByLevelResVo
>
authorityListByLevel
=
new
ArrayList
<>();
for
(
AuthorityVo
authorityVo:
levelOneList
)
{
AuthorityListByLevelResVo
resVo1
=
new
AuthorityListByLevelResVo
();
ObjectHelper
.
writeWithFrom
(
resVo1
,
authorityVo
);
List
<
AuthorityListByLevelResVo
>
childList
=
registerServiceImpl
.
getChildList
(
authorityVo
,
authorityIds
);
resVo1
.
setChildList
(
childList
);
authorityListByLevel
.
add
(
resVo1
);
Map
<
String
,
T
>
idMap
=
new
HashMap
<>(
list
.
size
());
List
<
T
>
root
=
new
ArrayList
<>();
// 将所有对象进行映射
for
(
T
vo
:
list
)
{
String
id
=
vo
.
getId
();
idMap
.
put
(
id
,
vo
);
}
Collections
.
sort
(
authorityListByLevel
);
AuthorityListResVo
authorityListResVo
=
new
AuthorityListResVo
();
authorityListResVo
.
setAuthorityListByLevel
(
authorityListByLevel
);
/*若roleId存在,则需要返回该角色拥有的权限列表*/
if
(
null
!=
reqVo
.
getRoleId
()
&&
!
reqVo
.
getRoleId
().
isEmpty
()){
RoleAuthorityGetReqVo
roleAuthorityGetReqVo1
=
new
RoleAuthorityGetReqVo
();
roleAuthorityGetReqVo1
.
setRoleId
(
reqVo
.
getRoleId
());
List
<
RoleAuthorityVo
>
roleAuthorityVos
=
roleAuthorityDao
.
loadList
(
roleAuthorityGetReqVo1
,
RoleAuthorityVo
.
class
);
List
<
AuthorityVo
>
authorityVoList
=
new
ArrayList
<>();
if
(
null
!=
roleAuthorityVos
&&
!
roleAuthorityVos
.
isEmpty
()){
for
(
RoleAuthorityVo
roleAuthorityVo:
roleAuthorityVos
)
{
AuthorityGetReqVo
getReqVo
=
new
AuthorityGetReqVo
();
getReqVo
.
setId
(
roleAuthorityVo
.
getAuthorityId
());
AuthorityVo
authorityVo
=
authorityDao
.
load
(
getReqVo
,
AuthorityVo
.
class
);
if
(
null
!=
authorityVo
){
authorityVoList
.
add
(
authorityVo
);
}
}
// 组合成父子级关系
for
(
T
vo
:
list
)
{
String
pid
=
StringHelper
.
getFirst
(
vo
.
getPid
());
String
id
=
vo
.
getId
();
//当前对象的父对象不存在则创建一个临时的父对象
if
(
StringHelper
.
isEmpty
(
pid
))
{
root
.
add
(
vo
);
}
else
if
(
idMap
.
containsKey
(
pid
))
{
// List<AuthorityListByLevelResVo> childList = idMap.get(pid).getChildList();
// if (null == childList) {
// childList = new ArrayList<>();
// }
// childList.add(vo);
idMap
.
get
(
pid
).
getChildList
().
add
(
vo
);
}
else
if
(
check
)
{
throw
new
CodeException
(
String
.
format
(
"存在数据不合理,子节点[%s]父id[%s]不存在"
,
id
,
pid
));
}
authorityListResVo
.
setAuthorityListByRole
(
authorityVoList
);
}
return
authorityListResVo
;
return
root
;
}
private
List
<
AuthorityListByLevelResVo
>
getChildList
(
String
id
){
private
List
<
AuthorityListByLevelResVo
>
getChildList
(
String
id
)
{
AuthorityGetReqVo
reqVo
=
new
AuthorityGetReqVo
();
reqVo
.
setPid
(
id
);
List
<
AuthorityVo
>
childList
=
authorityDao
.
listBySort
(
reqVo
);
List
<
AuthorityListByLevelResVo
>
childResList
=
new
ArrayList
();
if
(
null
!=
childList
&&
!
childList
.
isEmpty
()){
for
(
AuthorityVo
authorityVo
:
childList
)
{
if
(
null
!=
childList
&&
!
childList
.
isEmpty
())
{
for
(
AuthorityVo
authorityVo
:
childList
)
{
AuthorityListByLevelResVo
resVo
=
new
AuthorityListByLevelResVo
();
ObjectHelper
.
writeWithFrom
(
resVo
,
authorityVo
);
ObjectHelper
.
writeWithFrom
(
resVo
,
authorityVo
);
List
<
AuthorityListByLevelResVo
>
grandchildList
=
getChildList
(
authorityVo
.
getId
());
resVo
.
setChildList
(
grandchildList
);
childResList
.
add
(
resVo
);
...
...
@@ -388,42 +432,42 @@ public class AuthorityServiceImpl implements AuthorityService {
UserGetReqVo
userGetReqVo
=
new
UserGetReqVo
();
userGetReqVo
.
setCompanyId
(
reqVo
.
getCompanyId
());
userGetReqVo
.
setIsFirst
(
1
);
UserVo
superAdmin
=
userDaoImpl
.
load
(
userGetReqVo
,
UserVo
.
class
);
if
(
null
==
superAdmin
){
UserVo
superAdmin
=
userDaoImpl
.
load
(
userGetReqVo
,
UserVo
.
class
);
if
(
null
==
superAdmin
)
{
throw
new
CodeException
(
"暂无超级管理员"
);
}
UserRoleGetReqVo
getReqVo
=
new
UserRoleGetReqVo
();
getReqVo
.
setUserId
(
superAdmin
.
getId
());
List
<
UserRoleVo
>
userRoleVoList
=
userRoleDaoImpl
.
loadList
(
getReqVo
,
UserRoleVo
.
class
);
if
(
null
==
userRoleVoList
||
userRoleVoList
.
isEmpty
()){
List
<
UserRoleVo
>
userRoleVoList
=
userRoleDaoImpl
.
loadList
(
getReqVo
,
UserRoleVo
.
class
);
if
(
null
==
userRoleVoList
||
userRoleVoList
.
isEmpty
())
{
throw
new
CodeException
(
"暂无权限"
);
}
List
<
RoleAuthorityVo
>
roleAuthorityVoList
=
new
ArrayList
();
for
(
UserRoleVo
userRoleVo
:
userRoleVoList
)
{
for
(
UserRoleVo
userRoleVo
:
userRoleVoList
)
{
RoleAuthorityGetReqVo
roleAuthorityGetReqVo
=
new
RoleAuthorityGetReqVo
();
roleAuthorityGetReqVo
.
setRoleId
(
userRoleVo
.
getRoleId
());
List
<
RoleAuthorityVo
>
roleAuthorityVos
=
roleAuthorityDao
.
loadList
(
roleAuthorityGetReqVo
,
RoleAuthorityVo
.
class
);
List
<
RoleAuthorityVo
>
roleAuthorityVos
=
roleAuthorityDao
.
loadList
(
roleAuthorityGetReqVo
,
RoleAuthorityVo
.
class
);
roleAuthorityVoList
.
addAll
(
roleAuthorityVos
);
}
if
(
null
==
roleAuthorityVoList
||
roleAuthorityVoList
.
isEmpty
()){
if
(
null
==
roleAuthorityVoList
||
roleAuthorityVoList
.
isEmpty
())
{
throw
new
CodeException
(
"暂无权限"
);
}
List
<
AuthorityVo
>
authorityVoList
=
new
ArrayList
();
for
(
RoleAuthorityVo
roleAuthorityVo
:
roleAuthorityVoList
)
{
for
(
RoleAuthorityVo
roleAuthorityVo
:
roleAuthorityVoList
)
{
AuthorityGetReqVo
authorityGetReqVo
=
new
AuthorityGetReqVo
();
authorityGetReqVo
.
setId
(
roleAuthorityVo
.
getAuthorityId
());
AuthorityVo
authorityVo
=
authorityDao
.
load
(
authorityGetReqVo
,
AuthorityVo
.
class
);
if
(
authorityVo
!=
null
){
AuthorityVo
authorityVo
=
authorityDao
.
load
(
authorityGetReqVo
,
AuthorityVo
.
class
);
if
(
authorityVo
!=
null
)
{
authorityVoList
.
add
(
authorityVo
);
}
}
if
(
null
==
authorityVoList
||
authorityVoList
.
isEmpty
()){
if
(
null
==
authorityVoList
||
authorityVoList
.
isEmpty
())
{
throw
new
CodeException
(
"暂无权限"
);
}
List
<
AuthorityListByLevelResVo
>
resVoList
=
new
ArrayList
();
for
(
AuthorityVo
authorityVo
:
authorityVoList
)
{
for
(
AuthorityVo
authorityVo
:
authorityVoList
)
{
AuthorityListByLevelResVo
resVo
=
new
AuthorityListByLevelResVo
();
ObjectHelper
.
writeWithFrom
(
resVo
,
authorityVo
);
ObjectHelper
.
writeWithFrom
(
resVo
,
authorityVo
);
List
<
AuthorityListByLevelResVo
>
childList
=
getChildList
(
authorityVo
.
getId
());
resVo
.
setChildList
(
childList
);
resVoList
.
add
(
resVo
);
...
...
src/main/java/com/pangding/web/authority/service/impl/CompanyServiceImpl.java
View file @
33defe4c
...
...
@@ -13,6 +13,7 @@ import com.pangding.web.authority.util.RsaConstant;
import
com.pangding.web.authority.vo.*
;
import
com.pangding.web.authority.vo.reqvo.*
;
import
com.pangding.web.authority.vo.resvo.*
;
import
com.pangding.web.constant.OrderConstant
;
import
com.pangding.web.util.RSAUtils
;
import
com.pangding.web.vo.system.req.company.CompanyMoneyDetailReqVo
;
import
com.pangding.web.vo.system.req.company.CompanyMoneyUpdateReqVo
;
...
...
@@ -977,14 +978,14 @@ public class CompanyServiceImpl implements CompanyService {
// req = new UpdateCompanyMoneyReqVo();
// req.setCompanyId(companyVo.getId());
if
(
CompanyConstant
.
MONEY_TYPE_FZ
==
req
.
getMoneyType
()
||
CompanyConstant
.
MONEY_TYPE_ZZ
==
req
.
getMoneyType
()
||
CompanyConstant
.
MONEY_TYPE_CZ
==
req
.
getMoneyType
())
{
if
(
OrderConstant
.
CATEGORY_ENTRY
==
req
.
getMoneyType
()
||
OrderConstant
.
CATEGORY_DIVIDEND
==
req
.
getMoneyType
()
||
OrderConstant
.
CATEGORY_RECHARGE
==
req
.
getMoneyType
())
{
// 分账 转账 充值
companyMoney
+=
req
.
getMoney
();
}
if
(
CompanyConstant
.
MONEY_TYPE
_REFUND
==
req
.
getMoneyType
()
||
CompanyConstant
.
MONEY_TYPE_TX
==
req
.
getMoneyType
())
{
if
(
OrderConstant
.
CATEGORY
_REFUND
==
req
.
getMoneyType
()
||
OrderConstant
.
CATEGORY_WITHDRAWAL
==
req
.
getMoneyType
())
{
// 退款 提现
companyMoney
-=
req
.
getMoney
();
}
...
...
src/main/java/com/pangding/web/authority/service/impl/RegisterServiceImpl.java
View file @
33defe4c
...
...
@@ -378,19 +378,14 @@ public class RegisterServiceImpl implements RegisterService {
}
String
token
=
TokenUtil
.
createToken
(
reqVo
.
getAccountOrPhone
());
// 登录返回参数
LoginResVo
resVo
=
new
LoginResVo
();
resVo
.
setToken
(
token
);
userVo
.
setPassword
(
""
);
userVo
.
setRemark
(
""
);
resVo
.
setUserVo
(
userVo
);
CompanyGetReqVo
companyGetReqVo
=
new
CompanyGetReqVo
();
companyGetReqVo
.
setId
(
userVo
.
getCompanyId
());
CompanyVo
companyVo
=
companyDaoImpl
.
load
(
companyGetReqVo
,
CompanyVo
.
class
);
LoginCompanyResVo
loginCompanyResVo
=
new
LoginCompanyResVo
();
loginCompanyResVo
.
setCompanyVo
(
companyVo
);
resVo
.
setCompanyResVo
(
loginCompanyResVo
);
reqVo
.
setToken
(
token
);
// 保存登录token
LoginTokenVo
loginVo
=
new
LoginTokenVo
();
loginVo
.
setToken
(
token
);
loginVo
.
setDataPwd
(
token
);
...
...
@@ -398,39 +393,18 @@ public class RegisterServiceImpl implements RegisterService {
loginVo
.
setExpairTime
(
DateHelper
.
getNow
());
tokenService
.
save
(
loginVo
);
TokenHelper
.
write
(
token
,
loginVo
);
// TODO
// LoginTokenVo longVo1 = TokenHelper.get(false,LoginTokenVo.class);
// System.out.println("loning=====" + JsonHelper.serialize(longVo1));
CompanyBankCardGetReqVo
getReqVo
=
new
CompanyBankCardGetReqVo
();
getReqVo
.
setCompanyId
(
companyVo
.
getId
());
List
<
CompanyBankCardVo
>
companyBankCardVoList
=
companyBankCardDaoImpl
.
loadList
(
getReqVo
,
CompanyBankCardVo
.
class
);
if
(
companyBankCardVoList
!=
null
&&
!
companyBankCardVoList
.
isEmpty
()){
loginCompanyResVo
.
setBankCardVoList
(
companyBankCardVoList
);
}
resVo
.
setCompanyResVo
(
loginCompanyResVo
);
/*获取商家信息*/
CompanyScenicInfoReqVo
companyScenicInfoReqVo
=
new
CompanyScenicInfoReqVo
();
companyScenicInfoReqVo
.
setReqId
(
StringHelper
.
getNewID
());
companyScenicInfoReqVo
.
setCompanyId
(
companyVo
.
getId
());
companyScenicInfoReqVo
.
setProductOrInterface
(
0
);
ResponseResult
result
=
new
ResponseResult
();
try
{
result
=
storeFeign
.
getCompanyScenicInfo
(
companyScenicInfoReqVo
);
}
catch
(
Exception
e
){
resVo
.
setMerchant
(
null
);
}
Merchant
merchant
=
(
Merchant
)
result
.
getData
();
resVo
.
setMerchant
(
merchant
);
/*判断基本信息是否完善,及状态是否为2,且为个人用户,若不完善则跳转个人完善页面*/
// 找到登录用户公司信息
CompanyGetReqVo
companyGetReqVo
=
new
CompanyGetReqVo
();
companyGetReqVo
.
setId
(
userVo
.
getCompanyId
());
CompanyVo
companyVo
=
companyDaoImpl
.
load
(
companyGetReqVo
,
CompanyVo
.
class
);
// 判断基本信息是否完善,及状态是否为2,且为个人用户,若不完善则跳转个人完善页面
if
(
companyVo
.
getStatus
()
<
(
CompanyConstant
.
COMPANY_STATUS_BIND_PHONE
)
&&
CompanyConstant
.
COMPANY_TYPE_PERSON
==(
companyVo
.
getCompanyType
())){
resVo
.
setCode
(
"01"
);
resVo
.
setMsg
(
"个人基本信息未完善,跳转个人完善页面"
);
return
resVo
;
}
/
*判断基本信息是否完善,及状态是否为2,且为公司用户,若不完善则跳转个人完善页面*/
/
/ 判断基本信息是否完善,及状态是否为2,且为公司用户,若不完善则跳转个人完善页面
else
if
(
companyVo
.
getStatus
()
<
(
CompanyConstant
.
COMPANY_STATUS_BIND_PHONE
)
&&
(
CompanyConstant
.
COMPANY_TYPE_COMPANY
==(
companyVo
.
getCompanyType
()))){
resVo
.
setCode
(
"02"
);
resVo
.
setMsg
(
"公司基本信息未完善,跳转公司完善页面"
);
...
...
@@ -453,71 +427,100 @@ public class RegisterServiceImpl implements RegisterService {
resVo.setUrl(companyReqVo1.getSignUrl());
return resVo;
}*/
LoginCompanyResVo
loginCompanyResVo
=
new
LoginCompanyResVo
();
loginCompanyResVo
.
setCompanyVo
(
companyVo
);
resVo
.
setCompanyResVo
(
loginCompanyResVo
);
reqVo
.
setToken
(
token
);
// 找到公司银行信息
CompanyBankCardGetReqVo
getReqVo
=
new
CompanyBankCardGetReqVo
();
getReqVo
.
setCompanyId
(
companyVo
.
getId
());
List
<
CompanyBankCardVo
>
companyBankCardVoList
=
companyBankCardDaoImpl
.
loadList
(
getReqVo
,
CompanyBankCardVo
.
class
);
if
(
companyBankCardVoList
==
null
||
companyBankCardVoList
.
isEmpty
()){
/*该公司没有银行卡,需要跳转添加银行卡*/
resVo
.
setCode
(
"03"
);
resVo
.
setMsg
(
"还未添加银行卡,跳转添加银行卡页面"
);
return
resVo
;
}
/*获取用户权限列表*/
UserRoleGetReqVo
userRoleGetReqVo
=
new
UserRoleGetReqVo
();
userRoleGetReqVo
.
setUserId
(
userVo
.
getId
());
List
<
UserRoleVo
>
userRoleVoList
=
userRoleDaoImpl
.
loadList
(
userRoleGetReqVo
,
UserRoleVo
.
class
);
if
(
null
!=
userRoleVoList
&&
!
userRoleVoList
.
isEmpty
()){
List
<
String
>
roleIdList
=
new
ArrayList
();
for
(
UserRoleVo
userRoleVo:
userRoleVoList
)
{
roleIdList
.
add
(
userRoleVo
.
getRoleId
());
}
Set
authorityIdSet
=
new
HashSet
();
for
(
String
roleId:
roleIdList
)
{
RoleAuthorityGetReqVo
roleAuthorityGetReqVo
=
new
RoleAuthorityGetReqVo
();
roleAuthorityGetReqVo
.
setRoleId
(
roleId
);
List
<
RoleAuthorityVo
>
roleAuthorityVoList
=
roleAuthorityDaoImpl
.
loadList
(
roleAuthorityGetReqVo
,
RoleAuthorityVo
.
class
);
if
(
roleAuthorityVoList
!=
null
&&
!
roleAuthorityVoList
.
isEmpty
()){
for
(
RoleAuthorityVo
roleAuthorityVo:
roleAuthorityVoList
)
{
authorityIdSet
.
add
(
roleAuthorityVo
.
getAuthorityId
());
}
}
}
List
<
String
>
authorityIdList
=
new
ArrayList
();
Object
[]
objs
=
authorityIdSet
.
toArray
();
for
(
Object
obj:
objs
)
{
authorityIdList
.
add
((
String
)
obj
);
}
List
<
AuthorityVo
>
levelOneList
=
new
ArrayList
();
for
(
int
i
=
0
;
i
<
authorityIdList
.
size
();
i
++)
{
AuthorityGetReqVo
authorityGetReqVo
=
new
AuthorityGetReqVo
();
authorityGetReqVo
.
setId
(
authorityIdList
.
get
(
i
));
AuthorityVo
authorityVo
=
authorityDaoImpl
.
load
(
authorityGetReqVo
,
AuthorityVo
.
class
);
if
(!
StringHelper
.
isEmpty
(
authorityVo
)
&&
StringHelper
.
isEmpty
(
authorityVo
.
getPid
())){
levelOneList
.
add
(
authorityVo
);
authorityIdList
.
set
(
i
,
""
);
}
}
List
<
String
>
authorityIds
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
authorityIdList
.
size
();
i
++)
{
if
(!
""
.
equals
(
authorityIdList
.
get
(
i
))){
authorityIds
.
add
(
authorityIdList
.
get
(
i
));
}
}
Collections
.
sort
(
levelOneList
);
if
(
null
==
levelOneList
||
levelOneList
.
isEmpty
()){
throw
new
CodeException
(
"该用户暂无权限,请添加"
);
}
List
<
AuthorityListByLevelResVo
>
authorityListByLevel
=
new
ArrayList
<>();
for
(
AuthorityVo
authorityVo:
levelOneList
)
{
AuthorityListByLevelResVo
resVo1
=
new
AuthorityListByLevelResVo
();
ObjectHelper
.
writeWithFrom
(
resVo1
,
authorityVo
);
List
<
AuthorityListByLevelResVo
>
childList
=
getChildList
(
authorityVo
,
authorityIds
);
resVo1
.
setChildList
(
childList
);
authorityListByLevel
.
add
(
resVo1
);
}
Collections
.
sort
(
authorityListByLevel
);
resVo
.
setAuthorityListByLevel
(
authorityListByLevel
);
loginCompanyResVo
.
setBankCardVoList
(
companyBankCardVoList
);
resVo
.
setCompanyResVo
(
loginCompanyResVo
);
/*获取商家信息*/
CompanyScenicInfoReqVo
companyScenicInfoReqVo
=
new
CompanyScenicInfoReqVo
();
companyScenicInfoReqVo
.
setReqId
(
StringHelper
.
getNewID
());
companyScenicInfoReqVo
.
setCompanyId
(
companyVo
.
getId
());
companyScenicInfoReqVo
.
setProductOrInterface
(
0
);
ResponseResult
result
=
new
ResponseResult
();
try
{
result
=
storeFeign
.
getCompanyScenicInfo
(
companyScenicInfoReqVo
);
}
catch
(
Exception
e
){
resVo
.
setMerchant
(
null
);
}
Merchant
merchant
=
(
Merchant
)
result
.
getData
();
resVo
.
setMerchant
(
merchant
);
/*获取用户权限列表*/
RoleAuthorityGetReqVo
roleAuthorityGetReqVo
=
new
RoleAuthorityGetReqVo
();
roleAuthorityGetReqVo
.
setUserId
(
userVo
.
getId
());
List
<
AuthorityListByLevelResVo
>
roleAuthorityVoList
=
roleAuthorityDaoImpl
.
loadList
(
roleAuthorityGetReqVo
,
AuthorityListByLevelResVo
.
class
);
resVo
.
setAuthorityListByLevel
(
AuthorityServiceImpl
.
getChildList
(
roleAuthorityVoList
,
false
));
//
// UserRoleGetReqVo userRoleGetReqVo = new UserRoleGetReqVo();
// userRoleGetReqVo.setUserId(userVo.getId());
// List<UserRoleVo> userRoleVoList = userRoleDaoImpl.loadList(userRoleGetReqVo,UserRoleVo.class);
// if (null != userRoleVoList && !userRoleVoList.isEmpty()){
// List<String> roleIdList = new ArrayList();
// for (UserRoleVo userRoleVo:userRoleVoList) {
// roleIdList.add(userRoleVo.getRoleId());
// }
// Set authorityIdSet = new HashSet();
//
// for (String roleId:roleIdList) {
// RoleAuthorityGetReqVo roleAuthorityGetReqVo = new RoleAuthorityGetReqVo();
// roleAuthorityGetReqVo.setRoleId(roleId);
// List<RoleAuthorityVo> roleAuthorityVoList = roleAuthorityDaoImpl.loadList(roleAuthorityGetReqVo,RoleAuthorityVo.class);
// if (roleAuthorityVoList != null && !roleAuthorityVoList.isEmpty()){
// for (RoleAuthorityVo roleAuthorityVo:roleAuthorityVoList) {
// authorityIdSet.add(roleAuthorityVo.getAuthorityId());
// }
// }
// }
// List<String> authorityIdList = new ArrayList();
// Object[] objs = authorityIdSet.toArray();
// for (Object obj:objs) {
// authorityIdList.add((String) obj);
// }
// List<AuthorityVo> levelOneList = new ArrayList();
// for (int i = 0; i < authorityIdList.size(); i++) {
// AuthorityGetReqVo authorityGetReqVo = new AuthorityGetReqVo();
// authorityGetReqVo.setId(authorityIdList.get(i));
// AuthorityVo authorityVo = authorityDaoImpl.load(authorityGetReqVo,AuthorityVo.class);
// if (!StringHelper.isEmpty(authorityVo) && StringHelper.isEmpty(authorityVo.getPid())){
// levelOneList.add(authorityVo);
// authorityIdList.set(i,"");
// }
// }
// List<String> authorityIds = new ArrayList<>();
// for (int i = 0; i < authorityIdList.size(); i++) {
// if (!"".equals(authorityIdList.get(i))){
// authorityIds.add(authorityIdList.get(i));
// }
// }
// Collections.sort(levelOneList);
// if (null == levelOneList || levelOneList.isEmpty()){
// throw new CodeException("该用户暂无权限,请添加");
// }
// List<AuthorityListByLevelResVo> authorityListByLevel = new ArrayList<>();
// for (AuthorityVo authorityVo:levelOneList) {
// AuthorityListByLevelResVo resVo1 = new AuthorityListByLevelResVo();
// ObjectHelper.writeWithFrom(resVo1,authorityVo);
// List<AuthorityListByLevelResVo> childList = getChildList(authorityVo,authorityIds);
// resVo1.setChildList(childList);
// authorityListByLevel.add(resVo1);
// }
// Collections.sort(authorityListByLevel);
// resVo.setAuthorityListByLevel(authorityListByLevel);
// }
resVo
.
setCode
(
"00"
);
System
.
out
.
println
(
JsonHelper
.
serialize
(
resVo
));
return
resVo
;
...
...
src/main/java/com/pangding/web/authority/service/impl/RoleServiceImpl.java
View file @
33defe4c
...
...
@@ -178,9 +178,10 @@ public class RoleServiceImpl implements RoleService {
List
<
WebRoleResVo
>
webRoleResVoList
=
new
ArrayList
();
for
(
RoleVo
roleVo
:
roleVoList
)
{
WebRoleResVo
resVo
=
new
WebRoleResVo
();
List
<
AuthorityVo
>
authorityVoList
=
this
.
getAuthorityListByRoleId
(
roleVo
.
getId
());
ObjectHelper
.
writeWithFrom
(
resVo
,
roleVo
);
resVo
.
setAuthorityList
(
authorityVoList
);
// List<AuthorityVo> authorityVoList = this.getAuthorityListByRoleId(roleVo.getId());
// resVo.setAuthorityList(authorityVoList);
CountByRoleReqVo
countByRoleReqVo
=
new
CountByRoleReqVo
();
countByRoleReqVo
.
setCompanyId
(
req
.
getCompanyId
());
...
...
@@ -237,17 +238,17 @@ public class RoleServiceImpl implements RoleService {
@Override
public
List
<
AuthorityVo
>
getAuthorityListByRoleId
(
String
roleId
)
{
RoleAuthorityGetReqVo
reqVo
=
new
RoleAuthorityGetReqVo
();
reqVo
.
setRole
Id
(
roleId
);
List
<
RoleAuthorityVo
>
roleAuthorityRelationList
=
roleAuthorityDaoImpl
.
loadList
(
reqVo
,
Role
AuthorityVo
.
class
);
reqVo
.
setRole
(
roleId
);
List
<
AuthorityVo
>
roleAuthorityRelationList
=
roleAuthorityDaoImpl
.
loadList
(
reqVo
,
AuthorityVo
.
class
);
if
(
roleAuthorityRelationList
!=
null
&&
!
roleAuthorityRelationList
.
isEmpty
())
{
List
<
AuthorityVo
>
authorityList
=
new
ArrayList
(
roleAuthorityRelationList
.
size
());
for
(
RoleAuthorityVo
roleAuthorityRelation
:
roleAuthorityRelationList
)
{
AuthorityGetReqVo
authorityGetReqVo
=
new
AuthorityGetReqVo
();
authorityGetReqVo
.
setId
(
roleAuthorityRelation
.
getAuthorityId
());
AuthorityVo
authorityVo
=
authorityDaoImpl
.
load
(
authorityGetReqVo
,
AuthorityVo
.
class
);
authorityList
.
add
(
authorityVo
);
}
return
authority
List
;
//
List<AuthorityVo> authorityList = new ArrayList(roleAuthorityRelationList.size());
//
for (RoleAuthorityVo roleAuthorityRelation : roleAuthorityRelationList) {
//
AuthorityGetReqVo authorityGetReqVo = new AuthorityGetReqVo();
//
authorityGetReqVo.setId(roleAuthorityRelation.getAuthorityId());
//
AuthorityVo authorityVo = authorityDaoImpl.load(authorityGetReqVo, AuthorityVo.class);
//
authorityList.add(authorityVo);
//
}
return
roleAuthorityRelation
List
;
}
return
null
;
}
...
...
src/main/java/com/pangding/web/authority/vo/IRoleAuthorityVo.java
0 → 100644
View file @
33defe4c
package
com
.
pangding
.
web
.
authority
.
vo
;
import
java.util.List
;
public
interface
IRoleAuthorityVo
<
T
extends
IRoleAuthorityVo
>
{
String
getId
();
String
getPid
();
List
<
T
>
getChildList
();
}
src/main/java/com/pangding/web/authority/vo/reqvo/RoleAuthorityGetReqVo.java
View file @
33defe4c
...
...
@@ -11,6 +11,18 @@ public class RoleAuthorityGetReqVo {
private
String
roleId
;
private
String
role
;
private
String
userId
;
public
String
getUserId
()
{
return
userId
;
}
public
void
setUserId
(
String
userId
)
{
this
.
userId
=
userId
;
}
public
String
getReqId
()
{
return
reqId
;
}
...
...
@@ -34,4 +46,12 @@ public class RoleAuthorityGetReqVo {
public
void
setAuthorityId
(
String
authorityId
)
{
this
.
authorityId
=
authorityId
;
}
public
String
getRole
()
{
return
role
;
}
public
void
setRole
(
String
role
)
{
this
.
role
=
role
;
}
}
src/main/java/com/pangding/web/authority/vo/reqvo/UserRoleGetReqVo.java
View file @
33defe4c
package
com
.
pangding
.
web
.
authority
.
vo
.
reqvo
;
import
java.util.List
;
/**
* @Author zhangjinyao
* @create 2019/5/11 15:37
...
...
@@ -11,6 +13,8 @@ public class UserRoleGetReqVo {
private
String
userId
;
private
List
<
String
>
roleIds
;
public
String
getReqId
()
{
return
reqId
;
}
...
...
@@ -34,4 +38,12 @@ public class UserRoleGetReqVo {
public
void
setRoleId
(
String
roleId
)
{
this
.
roleId
=
roleId
;
}
public
List
<
String
>
getRoleIds
()
{
return
roleIds
;
}
public
void
setRoleIds
(
List
<
String
>
roleIds
)
{
this
.
roleIds
=
roleIds
;
}
}
src/main/java/com/pangding/web/authority/vo/resvo/AuthorityListByLevelResVo.java
View file @
33defe4c
package
com
.
pangding
.
web
.
authority
.
vo
.
resvo
;
import
com.pangding.web.authority.vo.AuthorityVo
;
import
com.pangding.web.authority.vo.IRoleAuthorityVo
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
...
...
@@ -10,7 +12,7 @@ import java.util.List;
*/
public
class
AuthorityListByLevelResVo
extends
AuthorityVo
{
List
<
AuthorityListByLevelResVo
>
childList
;
List
<
AuthorityListByLevelResVo
>
childList
=
new
ArrayList
<>()
;
public
List
<
AuthorityListByLevelResVo
>
getChildList
()
{
return
childList
;
...
...
src/main/java/com/pangding/web/authority/vo/resvo/AuthorityListResVo.java
View file @
33defe4c
...
...
@@ -28,4 +28,12 @@ public class AuthorityListResVo {
public
void
setAuthorityListByRole
(
List
<
AuthorityVo
>
authorityListByRole
)
{
this
.
authorityListByRole
=
authorityListByRole
;
}
// public List<AuthorityListByLevelResVo> getAuthorityListByRole() {
// return authorityListByRole;
// }
//
// public void setAuthorityListByRole(List<AuthorityListByLevelResVo> authorityListByRole) {
// this.authorityListByRole = authorityListByRole;
// }
}
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