Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-platform-auth
Overview
Overview
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
base_platform_enterprise
gic-platform-auth
Commits
ded784e4
Commit
ded784e4
authored
Mar 17, 2021
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提供账号分组需要的接口
parent
1dd1d937
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
160 additions
and
0 deletions
+160
-0
AccountGroupUnionDTO.java
...a/com/gic/auth/dto/accountgroup/AccountGroupUnionDTO.java
+58
-0
UserApiService.java
...pi/src/main/java/com/gic/auth/service/UserApiService.java
+17
-0
UserApiServiceImpl.java
...a/com/gic/auth/service/outer/impl/UserApiServiceImpl.java
+85
-0
No files found.
gic-platform-auth-api/src/main/java/com/gic/auth/dto/accountgroup/AccountGroupUnionDTO.java
0 → 100644
View file @
ded784e4
package
com
.
gic
.
auth
.
dto
.
accountgroup
;
import
java.io.Serializable
;
/**
* 账号分组
* @ClassName:
* @Description:
* @author guojuxing
* @date 2021/3/17 3:53 PM
*/
public
class
AccountGroupUnionDTO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
540104578542245703L
;
private
Integer
accountGroupId
;
private
String
accountGroupName
;
/**
* 授权出去的联合商户ID
*/
private
Integer
unionEnterpriseId
;
public
Integer
getAccountGroupId
()
{
return
accountGroupId
;
}
public
AccountGroupUnionDTO
setAccountGroupId
(
Integer
accountGroupId
)
{
this
.
accountGroupId
=
accountGroupId
;
return
this
;
}
public
String
getAccountGroupName
()
{
return
accountGroupName
;
}
public
AccountGroupUnionDTO
setAccountGroupName
(
String
accountGroupName
)
{
this
.
accountGroupName
=
accountGroupName
;
return
this
;
}
public
Integer
getUnionEnterpriseId
()
{
return
unionEnterpriseId
;
}
public
AccountGroupUnionDTO
setUnionEnterpriseId
(
Integer
unionEnterpriseId
)
{
this
.
unionEnterpriseId
=
unionEnterpriseId
;
return
this
;
}
@Override
public
String
toString
()
{
return
"AccountGroupUnionDTO{"
+
"accountGroupId="
+
accountGroupId
+
", accountGroupName='"
+
accountGroupName
+
'\''
+
", unionEnterpriseId="
+
unionEnterpriseId
+
'}'
;
}
}
gic-platform-auth-api/src/main/java/com/gic/auth/service/UserApiService.java
View file @
ded784e4
...
...
@@ -7,6 +7,7 @@ import com.gic.api.base.commons.ServiceResponse;
import
com.gic.auth.dto.UserDTO
;
import
com.gic.auth.dto.UserDataShowDTO
;
import
com.gic.auth.dto.UserListDTO
;
import
com.gic.auth.dto.accountgroup.AccountGroupUnionDTO
;
import
com.gic.auth.dto.wechat.WechatUserDTO
;
import
com.gic.auth.qo.UserListQO
;
...
...
@@ -120,6 +121,22 @@ public interface UserApiService {
ServiceResponse
<
List
<
Integer
>>
listAccountGroupByUserId
(
Integer
userId
);
/**
* 账号分组组件需要的接口
* @param userId
* @param accountGroupIdList 如果有值,查询并集
* @return
*/
ServiceResponse
<
List
<
AccountGroupUnionDTO
>>
listAccountGroupByUserId
(
Integer
userId
,
List
<
Integer
>
accountGroupIdList
);
/**
* 查询授权的账号分组数据
* @param ownEnterpriseId
* @param unionEnterpriseId
* @return
*/
ServiceResponse
<
List
<
AccountGroupUnionDTO
>>
listUnionAuthAccountGroup
(
Integer
ownEnterpriseId
,
Integer
unionEnterpriseId
);
/**
* 用户基本信息
* @Title: getUserInfoById
* @Description:
...
...
gic-platform-auth-service/src/main/java/com/gic/auth/service/outer/impl/UserApiServiceImpl.java
View file @
ded784e4
...
...
@@ -5,8 +5,11 @@ import java.text.SimpleDateFormat;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
com.gic.auth.dto.accountgroup.AccountGroupUnionDTO
;
import
com.gic.auth.dto.wechat.WechatUserDTO
;
import
com.gic.enterprise.dto.union.UnionEnterpriseAuthDTO
;
import
com.gic.enterprise.exception.CommonException
;
import
com.gic.enterprise.service.UnionEnterpriseAuthApiService
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
...
...
@@ -68,6 +71,8 @@ public class UserApiServiceImpl implements UserApiService {
private
UserMoveApiService
userMoveApiService
;
@Autowired
private
AuditorApiService
auditorApiService
;
@Autowired
private
UnionEnterpriseAuthApiService
unionEnterpriseAuthApiService
;
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
...
...
@@ -386,6 +391,86 @@ public class UserApiServiceImpl implements UserApiService {
}
@Override
public
ServiceResponse
<
List
<
AccountGroupUnionDTO
>>
listAccountGroupByUserId
(
Integer
userId
,
List
<
Integer
>
accountGroupIdList
)
{
TabSysUser
user
=
checkUser
(
userId
);
boolean
isAdmin
=
user
.
getSuperAdmin
()
==
1
;
//结果集查询ID集合
List
<
Integer
>
accountGroupIdListResult
=
new
ArrayList
<>();
if
(
isAdmin
)
{
List
<
TabSysAccountGroup
>
list
=
accountGroupService
.
listAccountGroupByEnterpriseId
(
user
.
getEnterpriseId
());
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
accountGroupIdListResult
=
list
.
stream
().
mapToInt
(
e
->
e
.
getAccountGroupId
()).
boxed
().
collect
(
Collectors
.
toList
());
}
}
else
{
List
<
TabSysAccountGroupRel
>
tabSysAccountGroupRelList
=
accountGroupRelService
.
listByUserId
(
userId
,
AccountGroupMemberTypeEnum
.
ADMIN
.
getCode
());
if
(
CollectionUtils
.
isNotEmpty
(
tabSysAccountGroupRelList
))
{
accountGroupIdListResult
=
tabSysAccountGroupRelList
.
stream
().
mapToInt
(
e
->
e
.
getAccountGroupId
()).
boxed
().
collect
(
Collectors
.
toList
());
}
}
//取并集(去重)
CollectionUtils
.
union
(
accountGroupIdListResult
,
accountGroupIdList
);
List
<
TabSysAccountGroup
>
result
=
accountGroupService
.
listByIdList
(
accountGroupIdListResult
);
if
(
CollectionUtils
.
isNotEmpty
(
result
))
{
//查询已经授权的商户ID
Map
<
Integer
,
Integer
>
accountGroupIdMapEnterpriseId
=
new
HashMap
<>();
ServiceResponse
<
List
<
UnionEnterpriseAuthDTO
>>
unionResponse
=
unionEnterpriseAuthApiService
.
listUnionEnterpriseAuth
(
user
.
getEnterpriseId
());
if
(
unionResponse
.
isSuccess
())
{
List
<
UnionEnterpriseAuthDTO
>
unionList
=
unionResponse
.
getResult
();
if
(
CollectionUtils
.
isNotEmpty
(
unionList
))
{
for
(
UnionEnterpriseAuthDTO
temp
:
unionList
)
{
String
accountGroup
=
temp
.
getAccountGroup
();
if
(
StringUtils
.
isNotBlank
(
accountGroup
))
{
Arrays
.
stream
(
accountGroup
.
split
(
","
)).
forEach
(
e
->
{
if
(
StringUtils
.
isNotBlank
(
e
))
{
accountGroupIdMapEnterpriseId
.
put
(
Integer
.
valueOf
(
e
),
temp
.
getUnionEnterpriseId
());
}
});
}
}
}
}
return
ServiceResponse
.
success
(
result
.
stream
()
.
map
(
e
->
new
AccountGroupUnionDTO
()
.
setAccountGroupId
(
e
.
getAccountGroupId
())
.
setAccountGroupName
(
e
.
getAccountGroupName
())
.
setUnionEnterpriseId
(
accountGroupIdMapEnterpriseId
.
get
(
e
.
getAccountGroupId
())))
.
collect
(
Collectors
.
toList
()));
}
return
ServiceResponse
.
success
();
}
@Override
public
ServiceResponse
<
List
<
AccountGroupUnionDTO
>>
listUnionAuthAccountGroup
(
Integer
ownEnterpriseId
,
Integer
unionEnterpriseId
)
{
ServiceResponse
<
UnionEnterpriseAuthDTO
>
unionResponse
=
unionEnterpriseAuthApiService
.
getUnionEnterpriseAuth
(
ownEnterpriseId
,
unionEnterpriseId
);
if
(
unionResponse
.
isSuccess
())
{
UnionEnterpriseAuthDTO
union
=
unionResponse
.
getResult
();
String
accountGroup
=
union
.
getAccountGroup
();
if
(
StringUtils
.
isNotBlank
(
accountGroup
))
{
List
<
Integer
>
accountGroupIdListResult
=
Arrays
.
stream
(
accountGroup
.
split
(
","
))
.
mapToInt
(
e
->
Integer
.
valueOf
(
e
)).
boxed
()
.
collect
(
Collectors
.
toList
());
List
<
TabSysAccountGroup
>
result
=
accountGroupService
.
listByIdList
(
accountGroupIdListResult
);
if
(
CollectionUtils
.
isNotEmpty
(
result
))
{
return
ServiceResponse
.
success
(
result
.
stream
()
.
map
(
e
->
new
AccountGroupUnionDTO
()
.
setAccountGroupId
(
e
.
getAccountGroupId
())
.
setAccountGroupName
(
e
.
getAccountGroupName
())
.
setUnionEnterpriseId
(
unionEnterpriseId
))
.
collect
(
Collectors
.
toList
()));
}
}
return
ServiceResponse
.
success
();
}
return
ServiceResponse
.
failure
(
unionResponse
.
getCode
(),
unionResponse
.
getMessage
());
}
@Override
public
ServiceResponse
<
UserDTO
>
getUserInfoById
(
Integer
userId
)
{
TabSysUser
tabUser
=
userService
.
getUserById
(
userId
);
if
(
tabUser
==
null
)
{
...
...
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