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
7069d297
Commit
7069d297
authored
Nov 04, 2019
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
协作人授权接口
parent
a2a5849d
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
744 additions
and
6 deletions
+744
-6
TabSysCollaboratorRoleRelMapper.java
.../gic/auth/dao/mapper/TabSysCollaboratorRoleRelMapper.java
+63
-0
TabSysCollaboratorRoleRel.java
...n/java/com/gic/auth/entity/TabSysCollaboratorRoleRel.java
+87
-0
CollaboratorRoleRelService.java
...java/com/gic/auth/service/CollaboratorRoleRelService.java
+36
-0
CollaboratorService.java
...c/main/java/com/gic/auth/service/CollaboratorService.java
+4
-0
CollaboratorRoleRelServiceImpl.java
...gic/auth/service/impl/CollaboratorRoleRelServiceImpl.java
+31
-0
CollaboratorServiceImpl.java
...va/com/gic/auth/service/impl/CollaboratorServiceImpl.java
+12
-0
CollaboratorApiServiceImpl.java
...c/auth/service/outer/impl/CollaboratorApiServiceImpl.java
+155
-3
dubbo-gic-platform-auth-service.xml
...ce/src/main/resources/dubbo-gic-platform-auth-service.xml
+1
-0
TabSysCollaboratorRoleRelMapper.xml
...main/resources/mapper/TabSysCollaboratorRoleRelMapper.xml
+139
-0
TabSysMenuMapper.xml
...th-service/src/main/resources/mapper/TabSysMenuMapper.xml
+3
-0
AccountGroupController.java
...a/com/gic/auth/web/controller/AccountGroupController.java
+40
-2
CollaboratorController.java
...a/com/gic/auth/web/controller/CollaboratorController.java
+85
-1
CollaboratorDetailVO.java
...c/main/java/com/gic/auth/web/vo/CollaboratorDetailVO.java
+88
-0
No files found.
gic-platform-auth-service/src/main/java/com/gic/auth/dao/mapper/TabSysCollaboratorRoleRelMapper.java
0 → 100644
View file @
7069d297
package
com
.
gic
.
auth
.
dao
.
mapper
;
import
com.gic.auth.entity.TabSysCollaboratorRoleRel
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
public
interface
TabSysCollaboratorRoleRelMapper
{
/**
* 根据主键删除
*
* @param collaboratorRoleRelId 主键
* @return 更新条目数
*/
int
deleteByPrimaryKey
(
Integer
collaboratorRoleRelId
);
/**
* 插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int
insert
(
TabSysCollaboratorRoleRel
record
);
/**
* 动态插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int
insertSelective
(
TabSysCollaboratorRoleRel
record
);
/**
* 根据主键查询
*
* @param collaboratorRoleRelId 主键
* @return 实体对象
*/
TabSysCollaboratorRoleRel
selectByPrimaryKey
(
Integer
collaboratorRoleRelId
);
/**
* 根据主键动态更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int
updateByPrimaryKeySelective
(
TabSysCollaboratorRoleRel
record
);
/**
* 根据主键更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int
updateByPrimaryKey
(
TabSysCollaboratorRoleRel
record
);
void
saveFetch
(
@Param
(
"list"
)
List
<
TabSysCollaboratorRoleRel
>
list
);
void
deleteByCollaboratorId
(
@Param
(
"collaboratorId"
)
Integer
collaboratorId
);
List
<
TabSysCollaboratorRoleRel
>
listByCollaboratorId
(
@Param
(
"collaboratorId"
)
Integer
collaboratorId
);
}
\ No newline at end of file
gic-platform-auth-service/src/main/java/com/gic/auth/entity/TabSysCollaboratorRoleRel.java
0 → 100644
View file @
7069d297
package
com
.
gic
.
auth
.
entity
;
import
java.util.Date
;
/**
* tab_sys_collaborator_role_rel
*/
public
class
TabSysCollaboratorRoleRel
{
/**
* ID
*/
private
Integer
collaboratorRoleRelId
;
/**
*
*/
private
Integer
collaboratorId
;
/**
* 权限菜单
*/
private
Integer
menuId
;
/**
* 0:无效2:有效
*/
private
Integer
status
;
/**
* 创建时间
*/
private
Date
createTime
;
/**
* 更新时间
*/
private
Date
updateTime
;
public
Integer
getCollaboratorRoleRelId
()
{
return
collaboratorRoleRelId
;
}
public
void
setCollaboratorRoleRelId
(
Integer
collaboratorRoleRelId
)
{
this
.
collaboratorRoleRelId
=
collaboratorRoleRelId
;
}
public
Integer
getCollaboratorId
()
{
return
collaboratorId
;
}
public
void
setCollaboratorId
(
Integer
collaboratorId
)
{
this
.
collaboratorId
=
collaboratorId
;
}
public
Integer
getMenuId
()
{
return
menuId
;
}
public
void
setMenuId
(
Integer
menuId
)
{
this
.
menuId
=
menuId
;
}
public
Integer
getStatus
()
{
return
status
;
}
public
void
setStatus
(
Integer
status
)
{
this
.
status
=
status
;
}
public
Date
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
public
Date
getUpdateTime
()
{
return
updateTime
;
}
public
void
setUpdateTime
(
Date
updateTime
)
{
this
.
updateTime
=
updateTime
;
}
}
\ No newline at end of file
gic-platform-auth-service/src/main/java/com/gic/auth/service/CollaboratorRoleRelService.java
0 → 100644
View file @
7069d297
package
com
.
gic
.
auth
.
service
;
import
com.gic.auth.entity.TabSysCollaboratorRoleRel
;
import
java.util.List
;
/**
* 协作人操作权限
* @ClassName: CollaboratorRoleRelService
* @Description:
* @author guojuxing
* @date 2019/11/4 2:55 PM
*/
public
interface
CollaboratorRoleRelService
{
/**
* 批量新增
* @Title: saveFetch
* @Description:
* @author guojuxing
* @param list
* @return void
*/
void
saveFetch
(
List
<
TabSysCollaboratorRoleRel
>
list
);
/**
* 删除协作人的操作权限
* @Title: deleteByCollaboratorId
* @Description:
* @author guojuxing
* @param collaboratorId
* @return void
*/
void
deleteByCollaboratorId
(
Integer
collaboratorId
);
List
<
TabSysCollaboratorRoleRel
>
listByCollaboratorId
(
Integer
collaboratorId
);
}
gic-platform-auth-service/src/main/java/com/gic/auth/service/CollaboratorService.java
View file @
7069d297
...
...
@@ -59,4 +59,8 @@ public interface CollaboratorService {
*/
List
<
TabSysCollaborator
>
listNotInCollaboratorIdList
(
List
<
Integer
>
collaboratorIdList
,
String
search
,
Integer
enterpriseId
);
TabSysCollaborator
getById
(
Integer
id
);
void
update
(
CollaboratorDTO
dto
);
}
gic-platform-auth-service/src/main/java/com/gic/auth/service/impl/CollaboratorRoleRelServiceImpl.java
0 → 100644
View file @
7069d297
package
com
.
gic
.
auth
.
service
.
impl
;
import
com.gic.auth.dao.mapper.TabSysCollaboratorRoleRelMapper
;
import
com.gic.auth.entity.TabSysCollaboratorRoleRel
;
import
com.gic.auth.service.CollaboratorRoleRelService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
@Service
(
"collaboratorRoleRelService"
)
public
class
CollaboratorRoleRelServiceImpl
implements
CollaboratorRoleRelService
{
@Autowired
private
TabSysCollaboratorRoleRelMapper
tabSysCollaboratorRoleRelMapper
;
@Override
public
void
saveFetch
(
List
<
TabSysCollaboratorRoleRel
>
list
)
{
tabSysCollaboratorRoleRelMapper
.
saveFetch
(
list
);
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
void
deleteByCollaboratorId
(
Integer
collaboratorId
)
{
tabSysCollaboratorRoleRelMapper
.
deleteByCollaboratorId
(
collaboratorId
);
}
@Override
public
List
<
TabSysCollaboratorRoleRel
>
listByCollaboratorId
(
Integer
collaboratorId
)
{
return
tabSysCollaboratorRoleRelMapper
.
listByCollaboratorId
(
collaboratorId
);
}
}
gic-platform-auth-service/src/main/java/com/gic/auth/service/impl/CollaboratorServiceImpl.java
View file @
7069d297
...
...
@@ -46,4 +46,16 @@ public class CollaboratorServiceImpl implements CollaboratorService {
Integer
enterpriseId
)
{
return
tabSysCollaboratorMapper
.
listNotInCollaboratorIdList
(
collaboratorIdList
,
search
,
enterpriseId
);
}
@Override
public
TabSysCollaborator
getById
(
Integer
id
)
{
return
tabSysCollaboratorMapper
.
selectByPrimaryKey
(
id
);
}
@Override
public
void
update
(
CollaboratorDTO
dto
)
{
dto
.
setUpdateTime
(
new
Date
());
TabSysCollaborator
record
=
EntityUtil
.
changeEntityNew
(
TabSysCollaborator
.
class
,
dto
);
tabSysCollaboratorMapper
.
updateByPrimaryKeySelective
(
record
);
}
}
gic-platform-auth-service/src/main/java/com/gic/auth/service/outer/impl/CollaboratorApiServiceImpl.java
View file @
7069d297
package
com
.
gic
.
auth
.
service
.
outer
.
impl
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
com.gic.enterprise.dto.EnterpriseDTO
;
import
com.gic.enterprise.service.EnterpriseApiService
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.auth.constant.SignConstants
;
import
com.gic.auth.dto.AppDTO
;
import
com.gic.auth.dto.CollaboratorDTO
;
import
com.gic.auth.dto.CollaboratorListDTO
;
import
com.gic.auth.entity.TabSysCollaborator
;
import
com.gic.auth.entity.TabSysCollaboratorRoleRel
;
import
com.gic.auth.qo.CollaboratorListQO
;
import
com.gic.auth.service.CollaboratorApiService
;
import
com.gic.auth.service.CollaboratorRoleRelService
;
import
com.gic.auth.service.CollaboratorService
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.commons.util.PageHelperUtils
;
import
com.gic.enterprise.error.ErrorCode
;
import
com.gic.enterprise.utils.valid.ValidParamsUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.gic.open.api.dto.ApplicationDTO
;
import
com.gic.open.api.dto.ApplicationSubDTO
;
import
com.gic.open.api.service.AppTokenApiService
;
import
com.gic.open.api.service.ApplicationSubApiService
;
@Service
(
"collaboratorApiService"
)
public
class
CollaboratorApiServiceImpl
implements
CollaboratorApiService
{
public
class
CollaboratorApiServiceImpl
implements
CollaboratorApiService
{
@Autowired
private
CollaboratorService
collaboratorService
;
@Autowired
private
AppTokenApiService
appTokenApiService
;
@Autowired
private
ApplicationSubApiService
applicationSubApiService
;
@Autowired
private
CollaboratorRoleRelService
collaboratorRoleRelService
;
@Autowired
private
EnterpriseApiService
enterpriseApiService
;
@Override
public
ServiceResponse
<
Integer
>
save
(
CollaboratorDTO
dto
)
{
//新增参数校验
...
...
@@ -34,4 +64,126 @@ public class CollaboratorApiServiceImpl implements CollaboratorApiService{
Page
<
CollaboratorListDTO
>
resultPage
=
PageHelperUtils
.
changePageHelperToCurrentPage
(
page
);
return
ServiceResponse
.
success
(
resultPage
);
}
@Override
public
ServiceResponse
<
List
<
AppDTO
>>
listApp
(
Integer
enterpriseId
)
{
ServiceResponse
<
List
<
ApplicationDTO
>>
appResult
=
appTokenApiService
.
listApplicationByEnterpriseId
(
Long
.
valueOf
(
enterpriseId
),
null
);
if
(
appResult
.
isSuccess
())
{
List
<
ApplicationDTO
>
appList
=
appResult
.
getResult
();
if
(
CollectionUtils
.
isNotEmpty
(
appList
))
{
List
<
AppDTO
>
result
=
new
ArrayList
<>(
appList
.
size
());
for
(
ApplicationDTO
app
:
appList
)
{
AppDTO
temp
=
new
AppDTO
();
temp
.
setAppId
(
app
.
getApplicationId
().
toString
());
temp
.
setAppName
(
app
.
getName
());
result
.
add
(
temp
);
}
return
ServiceResponse
.
success
(
result
);
}
}
return
ServiceResponse
.
success
(
new
ArrayList
<>());
}
@Override
public
ServiceResponse
<
List
<
AppDTO
>>
listSubApp
(
String
appId
,
Integer
enterpriseId
)
{
ServiceResponse
<
List
<
ApplicationSubDTO
>>
subAppResult
=
applicationSubApiService
.
listSubApp
(
enterpriseId
,
Long
.
valueOf
(
appId
));
if
(
subAppResult
.
isSuccess
())
{
List
<
ApplicationSubDTO
>
subAppList
=
subAppResult
.
getResult
();
if
(
CollectionUtils
.
isNotEmpty
(
subAppList
))
{
List
<
AppDTO
>
result
=
new
ArrayList
<>(
subAppList
.
size
());
for
(
ApplicationSubDTO
subApp
:
subAppList
)
{
AppDTO
temp
=
new
AppDTO
();
temp
.
setAppId
(
subApp
.
getApplicationId
().
toString
());
temp
.
setAppName
(
subApp
.
getSubAppName
());
result
.
add
(
temp
);
}
return
ServiceResponse
.
success
(
result
);
}
}
return
ServiceResponse
.
success
(
new
ArrayList
<>());
}
@Override
public
ServiceResponse
<
CollaboratorDTO
>
getDetail
(
Integer
collaboratorId
)
{
TabSysCollaborator
record
=
collaboratorService
.
getById
(
collaboratorId
);
if
(
record
==
null
)
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"协作人ID有误,查无数据"
);
}
CollaboratorDTO
result
=
EntityUtil
.
changeEntityNew
(
CollaboratorDTO
.
class
,
record
);
List
<
TabSysCollaboratorRoleRel
>
menuList
=
collaboratorRoleRelService
.
listByCollaboratorId
(
collaboratorId
);
if
(
CollectionUtils
.
isNotEmpty
(
menuList
))
{
List
<
Integer
>
menuIdList
=
new
ArrayList
<>(
menuList
.
size
());
for
(
TabSysCollaboratorRoleRel
menu
:
menuList
)
{
menuIdList
.
add
(
menu
.
getCollaboratorId
());
}
result
.
setMenuIdList
(
menuIdList
);
}
if
(
StringUtils
.
isNotBlank
(
result
.
getSubAppIds
()))
{
String
[]
subAppArr
=
result
.
getSubAppIds
().
split
(
SignConstants
.
UNDERLINE
);
List
<
String
>
subAppList
=
new
ArrayList
<>(
subAppArr
.
length
);
for
(
String
subApp
:
subAppArr
)
{
subAppList
.
add
(
subApp
);
}
result
.
setSubAppIdList
(
subAppList
);
}
ServiceResponse
<
EnterpriseDTO
>
enterpriseResult
=
enterpriseApiService
.
getEnterpriseById
(
record
.
getCollaborationEnterpriseId
());
if
(
enterpriseResult
.
isSuccess
())
{
result
.
setCollaborationEnterpriseName
(
enterpriseResult
.
getResult
().
getEnterpriseName
());
}
return
ServiceResponse
.
success
(
result
);
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
ServiceResponse
<
Void
>
auth
(
String
subAppIds
,
String
menuIds
,
Integer
collaboratorId
)
{
TabSysCollaborator
record
=
collaboratorService
.
getById
(
collaboratorId
);
if
(
record
==
null
)
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"协作人ID有误,查无数据"
);
}
//更新资源权限
if
(
StringUtils
.
isNotBlank
(
subAppIds
))
{
String
[]
subAppArr
=
subAppIds
.
split
(
SignConstants
.
COMMA
);
StringBuilder
sb
=
new
StringBuilder
(
SignConstants
.
UNDERLINE
);
for
(
String
str
:
subAppArr
)
{
sb
.
append
(
str
).
append
(
SignConstants
.
UNDERLINE
);
}
CollaboratorDTO
dto
=
new
CollaboratorDTO
();
dto
.
setCollaboratorId
(
collaboratorId
);
dto
.
setSubAppIds
(
sb
.
toString
());
collaboratorService
.
update
(
dto
);
}
//更新操作权限
if
(
StringUtils
.
isNotBlank
(
menuIds
))
{
String
[]
menuIdArr
=
menuIds
.
split
(
SignConstants
.
COMMA
);
List
<
TabSysCollaboratorRoleRel
>
list
=
new
ArrayList
<>(
menuIdArr
.
length
);
Date
now
=
new
Date
();
for
(
String
str
:
menuIdArr
)
{
TabSysCollaboratorRoleRel
temp
=
new
TabSysCollaboratorRoleRel
();
temp
.
setCollaboratorId
(
collaboratorId
);
temp
.
setCreateTime
(
now
);
temp
.
setUpdateTime
(
now
);
temp
.
setMenuId
(
Integer
.
parseInt
(
str
));
temp
.
setStatus
(
1
);
list
.
add
(
temp
);
}
collaboratorRoleRelService
.
deleteByCollaboratorId
(
collaboratorId
);
collaboratorRoleRelService
.
saveFetch
(
list
);
}
return
ServiceResponse
.
success
();
}
@Override
public
ServiceResponse
<
Void
>
cancel
(
Integer
collaboratorId
)
{
TabSysCollaborator
record
=
collaboratorService
.
getById
(
collaboratorId
);
if
(
record
==
null
)
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"协作人ID有误,查无数据"
);
}
CollaboratorDTO
dto
=
new
CollaboratorDTO
();
dto
.
setCollaboratorId
(
collaboratorId
);
dto
.
setStatus
(
0
);
collaboratorService
.
update
(
dto
);
return
ServiceResponse
.
success
();
}
}
gic-platform-auth-service/src/main/resources/dubbo-gic-platform-auth-service.xml
View file @
7069d297
...
...
@@ -32,6 +32,7 @@
<dubbo:reference
interface=
"com.gic.open.api.service.ApplicationApiService"
id=
"applicationApiService"
timeout=
"6000"
/>
<!--应用市场应用列表-->
<dubbo:reference
interface=
"com.gic.open.api.service.AppTokenApiService"
id=
"appTokenApiService"
timeout=
"6000"
/>
<dubbo:reference
interface=
"com.gic.open.api.service.ApplicationSubApiService"
id=
"applicationSubApiService"
timeout=
"6000"
/>
<dubbo:reference
interface=
"com.gic.open.api.service.ServeApiService"
id=
"serveApiService"
timeout=
"60000"
/>
<!--审核员-->
<dubbo:service
interface=
"com.gic.auth.service.AuditorApiService"
ref=
"auditorApiService"
timeout=
"6000"
/>
...
...
gic-platform-auth-service/src/main/resources/mapper/TabSysCollaboratorRoleRelMapper.xml
0 → 100644
View file @
7069d297
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.gic.auth.dao.mapper.TabSysCollaboratorRoleRelMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.gic.auth.entity.TabSysCollaboratorRoleRel"
>
<id
column=
"collaborator_role_rel_id"
jdbcType=
"INTEGER"
property=
"collaboratorRoleRelId"
/>
<result
column=
"collaborator_id"
jdbcType=
"INTEGER"
property=
"collaboratorId"
/>
<result
column=
"menu_id"
jdbcType=
"INTEGER"
property=
"menuId"
/>
<result
column=
"status"
jdbcType=
"INTEGER"
property=
"status"
/>
<result
column=
"create_time"
jdbcType=
"TIMESTAMP"
property=
"createTime"
/>
<result
column=
"update_time"
jdbcType=
"TIMESTAMP"
property=
"updateTime"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
collaborator_role_rel_id, collaborator_id, menu_id, status, create_time, update_time
</sql>
<select
id=
"selectByPrimaryKey"
parameterType=
"java.lang.Integer"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_sys_collaborator_role_rel
where collaborator_role_rel_id = #{collaboratorRoleRelId,jdbcType=INTEGER}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Integer"
>
delete from tab_sys_collaborator_role_rel
where collaborator_role_rel_id = #{collaboratorRoleRelId,jdbcType=INTEGER}
</delete>
<insert
id=
"insert"
parameterType=
"com.gic.auth.entity.TabSysCollaboratorRoleRel"
>
insert into tab_sys_collaborator_role_rel (collaborator_role_rel_id, collaborator_id,
menu_id, status, create_time,
update_time)
values (#{collaboratorRoleRelId,jdbcType=INTEGER}, #{collaboratorId,jdbcType=INTEGER},
#{menuId,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.gic.auth.entity.TabSysCollaboratorRoleRel"
>
insert into tab_sys_collaborator_role_rel
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"collaboratorRoleRelId != null"
>
collaborator_role_rel_id,
</if>
<if
test=
"collaboratorId != null"
>
collaborator_id,
</if>
<if
test=
"menuId != null"
>
menu_id,
</if>
<if
test=
"status != null"
>
status,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"updateTime != null"
>
update_time,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"collaboratorRoleRelId != null"
>
#{collaboratorRoleRelId,jdbcType=INTEGER},
</if>
<if
test=
"collaboratorId != null"
>
#{collaboratorId,jdbcType=INTEGER},
</if>
<if
test=
"menuId != null"
>
#{menuId,jdbcType=INTEGER},
</if>
<if
test=
"status != null"
>
#{status,jdbcType=INTEGER},
</if>
<if
test=
"createTime != null"
>
#{createTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"updateTime != null"
>
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"com.gic.auth.entity.TabSysCollaboratorRoleRel"
>
update tab_sys_collaborator_role_rel
<set>
<if
test=
"collaboratorId != null"
>
collaborator_id = #{collaboratorId,jdbcType=INTEGER},
</if>
<if
test=
"menuId != null"
>
menu_id = #{menuId,jdbcType=INTEGER},
</if>
<if
test=
"status != null"
>
status = #{status,jdbcType=INTEGER},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"updateTime != null"
>
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where collaborator_role_rel_id = #{collaboratorRoleRelId,jdbcType=INTEGER}
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"com.gic.auth.entity.TabSysCollaboratorRoleRel"
>
update tab_sys_collaborator_role_rel
set collaborator_id = #{collaboratorId,jdbcType=INTEGER},
menu_id = #{menuId,jdbcType=INTEGER},
status = #{status,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where collaborator_role_rel_id = #{collaboratorRoleRelId,jdbcType=INTEGER}
</update>
<insert
id=
"saveFetch"
parameterType=
"java.util.List"
>
insert into tab_sys_collaborator_role_rel (collaborator_role_rel_id, collaborator_id,
menu_id, status, create_time,
update_time)
VALUES
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
(
#{item.collaboratorRoleRelId},
#{item.collaboratorId},
#{item.menuId},
#{item.status},
#{item.createTime},
#{item.updateTime}
)
</foreach>
</insert>
<update
id=
"deleteByCollaboratorId"
>
update tab_sys_collaborator_role_rel set status = 0
where status = 1
and collaborator_id = #{collaboratorId}
</update>
<select
id=
"listByCollaboratorId"
resultMap=
"BaseResultMap"
>
SELECT
<include
refid=
"Base_Column_List"
></include>
from tab_sys_collaborator_role_rel
where status = 1
and collaborator_id = #{collaboratorId}
</select>
</mapper>
\ No newline at end of file
gic-platform-auth-service/src/main/resources/mapper/TabSysMenuMapper.xml
View file @
7069d297
...
...
@@ -303,6 +303,9 @@
<if
test=
"level != null"
>
and level = #{level}
</if>
<if
test=
"project != null"
>
and project = #{project}
</if>
order by level,sort
</select>
...
...
gic-platform-auth-web/src/main/java/com/gic/auth/web/controller/AccountGroupController.java
View file @
7069d297
...
...
@@ -6,8 +6,6 @@ import java.util.List;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
import
com.alibaba.fastjson.JSON
;
import
com.gic.auth.dto.AccountGroupMemberDTO
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
...
...
@@ -16,10 +14,20 @@ import org.springframework.validation.annotation.Validated;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.alibaba.fastjson.JSON
;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.auth.constant.AccountGroupMemberTypeEnum
;
import
com.gic.auth.constant.SignConstants
;
import
com.gic.auth.dto.AccountGroupDTO
;
import
com.gic.auth.dto.AccountGroupMemberDTO
;
import
com.gic.auth.dto.CollaboratorListDTO
;
import
com.gic.auth.dto.UserListDTO
;
import
com.gic.auth.qo.CollaboratorListQO
;
import
com.gic.auth.qo.UserListQO
;
import
com.gic.auth.service.AccountGroupApiService
;
import
com.gic.auth.service.CollaboratorApiService
;
import
com.gic.auth.service.UserApiService
;
import
com.gic.auth.web.vo.AccountGroupListVO
;
import
com.gic.commons.webapi.reponse.RestResponse
;
import
com.gic.enterprise.error.ErrorCode
;
...
...
@@ -33,6 +41,10 @@ public class AccountGroupController {
private
final
static
Logger
LOGGER
=
LogManager
.
getLogger
(
AccountGroupApiService
.
class
);
@Autowired
private
AccountGroupApiService
accountGroupApiService
;
@Autowired
private
CollaboratorApiService
collaboratorApiService
;
@Autowired
private
UserApiService
userApiService
;
/**
* 新增账号分组
...
...
@@ -78,6 +90,32 @@ public class AccountGroupController {
}
/**
* 全部账号数量
* @Title: allGroupMember
* @Description:
* @author guojuxing
* @return com.gic.commons.webapi.reponse.RestResponse
*/
@RequestMapping
(
"/all-group-member"
)
public
RestResponse
allGroupMember
()
{
int
groupMemberCount
=
0
;
Integer
enterpriseId
=
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
();
UserListQO
userListQO
=
new
UserListQO
();
userListQO
.
setEnterpriseId
(
enterpriseId
);
ServiceResponse
<
Page
<
UserListDTO
>>
userResult
=
userApiService
.
pageUser
(
userListQO
);
if
(
userResult
.
isSuccess
())
{
groupMemberCount
+=
userResult
.
getResult
().
getTotalCount
();
}
CollaboratorListQO
collaboratorListQO
=
new
CollaboratorListQO
();
collaboratorListQO
.
setEnterpriseId
(
enterpriseId
);
ServiceResponse
<
Page
<
CollaboratorListDTO
>>
collaboratorResult
=
collaboratorApiService
.
page
(
collaboratorListQO
);
if
(
collaboratorResult
.
isSuccess
())
{
groupMemberCount
+=
collaboratorResult
.
getResult
().
getTotalCount
();
}
return
RestResponse
.
success
(
groupMemberCount
);
}
/**
* 不在分组下的组员
* @Title: memberNotInGroup
* @Description:
...
...
gic-platform-auth-web/src/main/java/com/gic/auth/web/controller/CollaboratorController.java
View file @
7069d297
package
com
.
gic
.
auth
.
web
.
controller
;
import
com.gic.enterprise.utils.UserDetailUtils
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
com.gic.auth.web.vo.CollaboratorDetailVO
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.auth.constant.MenuLevelConstants
;
import
com.gic.auth.constant.MenuProjectConstants
;
import
com.gic.auth.dto.MenuDTO
;
import
com.gic.auth.qo.CollaboratorListQO
;
import
com.gic.auth.qo.MenuListQO
;
import
com.gic.auth.service.CollaboratorApiService
;
import
com.gic.auth.service.MenuApiService
;
import
com.gic.commons.webapi.reponse.RestResponse
;
import
com.gic.enterprise.response.EnterpriseRestResponse
;
import
com.gic.enterprise.utils.ResultControllerUtils
;
import
com.gic.enterprise.utils.UserDetailUtils
;
@RestController
@RequestMapping
(
"/collaborator"
)
...
...
@@ -19,10 +32,81 @@ public class CollaboratorController {
@Autowired
private
CollaboratorApiService
collaboratorApiService
;
@Autowired
private
MenuApiService
menuApiService
;
@RequestMapping
(
"/list"
)
public
RestResponse
list
(
CollaboratorListQO
params
)
{
params
.
setEnterpriseId
(
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
());
return
ResultControllerUtils
.
commonResult
(
collaboratorApiService
.
page
(
params
));
}
@RequestMapping
(
"/list-app"
)
public
RestResponse
listApp
()
{
return
ResultControllerUtils
.
commonResult
(
collaboratorApiService
.
listApp
(
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
()));
}
@RequestMapping
(
"/list-sub-app"
)
public
RestResponse
listSubApp
(
String
appId
)
{
return
ResultControllerUtils
.
commonResult
(
collaboratorApiService
.
listSubApp
(
appId
,
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
()));
}
@RequestMapping
(
"/get-detail"
)
public
RestResponse
getDetail
(
Integer
collaboratorId
)
{
return
ResultControllerUtils
.
commonResult
(
collaboratorApiService
.
getDetail
(
collaboratorId
),
CollaboratorDetailVO
.
class
);
}
/**
* 授权:操作授权、资源授权
* @Title: auth
* @Description:
* @author guojuxing
* @param collaboratorId
* @return com.gic.commons.webapi.reponse.RestResponse
*/
@RequestMapping
(
"/auth"
)
public
RestResponse
auth
(
String
subAppIds
,
String
menuIds
,
Integer
collaboratorId
)
{
return
ResultControllerUtils
.
commonResult
(
collaboratorApiService
.
auth
(
subAppIds
,
menuIds
,
collaboratorId
));
}
@RequestMapping
(
"/app-menu-tree"
)
public
RestResponse
appMenuTree
(
String
appId
)
{
MenuListQO
params
=
new
MenuListQO
();
params
.
setProject
(
appId
);
params
.
setIsGIC
(
MenuProjectConstants
.
APP_PROJECT_CODE
);
ServiceResponse
<
List
<
MenuDTO
>>
appMenuList
=
menuApiService
.
listMenuTree
(
params
);
if
(
appMenuList
.
isSuccess
())
{
return
RestResponse
.
success
(
changePageListToTree
(
MenuLevelConstants
.
FIRST_LEVEL_PARENT_ID
,
appMenuList
.
getResult
()));
}
return
EnterpriseRestResponse
.
failure
(
appMenuList
);
}
public
static
List
<
Map
<
String
,
Object
>>
changePageListToTree
(
int
storeGroupId
,
List
<
MenuDTO
>
list
)
{
List
<
Map
<
String
,
Object
>>
result
=
new
ArrayList
<>();
if
(
list
!=
null
)
{
for
(
int
j
=
0
,
length
=
list
.
size
();
j
<
length
;
j
++)
{
MenuDTO
menuDTO
=
list
.
get
(
j
);
if
(
storeGroupId
==
menuDTO
.
getParentId
())
{
Map
<
String
,
Object
>
data
=
new
HashMap
<>(
16
);
data
.
put
(
"menuId"
,
menuDTO
.
getMenuId
());
data
.
put
(
"menuName"
,
menuDTO
.
getMenuName
());
data
.
put
(
"menuCode"
,
menuDTO
.
getMenuCode
());
data
.
put
(
"parentCode"
,
menuDTO
.
getParentCode
());
data
.
put
(
"parentId"
,
menuDTO
.
getParentId
());
List
<
Map
<
String
,
Object
>>
children
=
changePageListToTree
(
menuDTO
.
getMenuId
(),
list
);
if
(
children
==
null
||
children
.
size
()
<
1
)
{
data
.
put
(
"children"
,
null
);
}
else
{
data
.
put
(
"children"
,
children
);
}
result
.
add
(
data
);
}
}
}
return
result
;
}
}
gic-platform-auth-web/src/main/java/com/gic/auth/web/vo/CollaboratorDetailVO.java
0 → 100644
View file @
7069d297
package
com
.
gic
.
auth
.
web
.
vo
;
import
java.io.Serializable
;
import
java.util.List
;
/**
* 协作人详情
* @ClassName: CollaboratorDetailVO
* @Description:
* @author guojuxing
* @date 2019/11/4 3:29 PM
*/
public
class
CollaboratorDetailVO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
3869612411018633754L
;
/**
* ID
*/
private
Integer
collaboratorId
;
private
String
collaboratorName
;
private
String
collaborationEnterpriseName
;
private
String
phone
;
private
String
appName
;
private
List
<
String
>
subAppIdList
;
private
List
<
Integer
>
menuIdList
;
public
Integer
getCollaboratorId
()
{
return
collaboratorId
;
}
public
void
setCollaboratorId
(
Integer
collaboratorId
)
{
this
.
collaboratorId
=
collaboratorId
;
}
public
String
getCollaboratorName
()
{
return
collaboratorName
;
}
public
void
setCollaboratorName
(
String
collaboratorName
)
{
this
.
collaboratorName
=
collaboratorName
;
}
public
String
getCollaborationEnterpriseName
()
{
return
collaborationEnterpriseName
;
}
public
void
setCollaborationEnterpriseName
(
String
collaborationEnterpriseName
)
{
this
.
collaborationEnterpriseName
=
collaborationEnterpriseName
;
}
public
String
getPhone
()
{
return
phone
;
}
public
void
setPhone
(
String
phone
)
{
this
.
phone
=
phone
;
}
public
String
getAppName
()
{
return
appName
;
}
public
void
setAppName
(
String
appName
)
{
this
.
appName
=
appName
;
}
public
List
<
String
>
getSubAppIdList
()
{
return
subAppIdList
;
}
public
void
setSubAppIdList
(
List
<
String
>
subAppIdList
)
{
this
.
subAppIdList
=
subAppIdList
;
}
public
List
<
Integer
>
getMenuIdList
()
{
return
menuIdList
;
}
public
void
setMenuIdList
(
List
<
Integer
>
menuIdList
)
{
this
.
menuIdList
=
menuIdList
;
}
}
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