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
d2a9ca2d
Commit
d2a9ca2d
authored
Nov 08, 2019
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
账号分组接口:添加日志操作
parent
ab05befc
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
81 additions
and
20 deletions
+81
-20
TabSysAccountGroupMapper.java
...ava/com/gic/auth/dao/mapper/TabSysAccountGroupMapper.java
+3
-0
AccountGroupService.java
...c/main/java/com/gic/auth/service/AccountGroupService.java
+2
-0
AccountGroupServiceImpl.java
...va/com/gic/auth/service/impl/AccountGroupServiceImpl.java
+5
-0
AccountGroupApiServiceImpl.java
...c/auth/service/outer/impl/AccountGroupApiServiceImpl.java
+36
-10
TabSysAccountGroupMapper.xml
...ce/src/main/resources/mapper/TabSysAccountGroupMapper.xml
+13
-0
AccountGroupController.java
...a/com/gic/auth/web/controller/AccountGroupController.java
+22
-10
No files found.
gic-platform-auth-service/src/main/java/com/gic/auth/dao/mapper/TabSysAccountGroupMapper.java
View file @
d2a9ca2d
...
...
@@ -87,4 +87,6 @@ public interface TabSysAccountGroupMapper {
* @return java.util.List<com.gic.auth.entity.TabSysAccountGroup>
*/
List
<
TabSysAccountGroup
>
listAccountGroupByEnterpriseId
(
@Param
(
"enterpriseId"
)
Integer
enterpriseId
);
List
<
TabSysAccountGroup
>
listByIdList
(
@Param
(
"list"
)
List
<
Integer
>
accountGroupIdList
);
}
\ No newline at end of file
gic-platform-auth-service/src/main/java/com/gic/auth/service/AccountGroupService.java
View file @
d2a9ca2d
...
...
@@ -66,6 +66,8 @@ public interface AccountGroupService {
* @return com.gic.auth.entity.TabSysAccountGroup
*/
TabSysAccountGroup
getById
(
Integer
accountGroupId
);
List
<
TabSysAccountGroup
>
listByIdList
(
List
<
Integer
>
accountGroupIdList
);
/**
* 查询列表
* @Title: listAccountGroupByEnterpriseId
...
...
gic-platform-auth-service/src/main/java/com/gic/auth/service/impl/AccountGroupServiceImpl.java
View file @
d2a9ca2d
...
...
@@ -54,6 +54,11 @@ public class AccountGroupServiceImpl implements AccountGroupService{
}
@Override
public
List
<
TabSysAccountGroup
>
listByIdList
(
List
<
Integer
>
accountGroupIdList
)
{
return
null
;
}
@Override
public
List
<
TabSysAccountGroup
>
listAccountGroupByEnterpriseId
(
Integer
enterpriseId
)
{
return
tabSysAccountGroupMapper
.
listAccountGroupByEnterpriseId
(
enterpriseId
);
}
...
...
gic-platform-auth-service/src/main/java/com/gic/auth/service/outer/impl/AccountGroupApiServiceImpl.java
View file @
d2a9ca2d
...
...
@@ -2,6 +2,7 @@ package com.gic.auth.service.outer.impl;
import
java.util.*
;
import
com.gic.auth.constant.SignConstants
;
import
com.gic.auth.dto.AccountGroupListDTO
;
import
com.gic.auth.dto.AccountGroupRelDTO
;
import
com.gic.auth.entity.TabSysCollaborator
;
...
...
@@ -110,7 +111,7 @@ public class AccountGroupApiServiceImpl implements AccountGroupApiService {
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
ServiceResponse
<
Void
>
deleteByAccountGroupId
(
Integer
accountGroupId
)
{
public
ServiceResponse
<
AccountGroupDTO
>
deleteByAccountGroupId
(
Integer
accountGroupId
)
{
TabSysAccountGroup
record
=
accountGroupService
.
getById
(
accountGroupId
);
if
(
record
==
null
)
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"账号分组id有误,查无数据"
);
...
...
@@ -119,17 +120,17 @@ public class AccountGroupApiServiceImpl implements AccountGroupApiService {
accountGroupService
.
updateStatusByAccountGroupId
(
accountGroupId
);
//删除组员分组关系数据
accountGroupRelService
.
deleteByAccountGroupId
(
accountGroupId
);
return
ServiceResponse
.
success
();
return
ServiceResponse
.
success
(
EntityUtil
.
changeEntityNew
(
AccountGroupDTO
.
class
,
record
)
);
}
@Override
public
ServiceResponse
<
Void
>
sort
(
Integer
accountGroupId
,
Integer
sort
)
{
public
ServiceResponse
<
AccountGroupDTO
>
sort
(
Integer
accountGroupId
,
Integer
sort
)
{
TabSysAccountGroup
record
=
accountGroupService
.
getById
(
accountGroupId
);
if
(
record
==
null
)
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"账号分组id有误,查无数据"
);
}
accountGroupService
.
setSort
(
record
,
sort
);
return
ServiceResponse
.
success
();
return
ServiceResponse
.
success
(
EntityUtil
.
changeEntityNew
(
AccountGroupDTO
.
class
,
record
)
);
}
@Override
...
...
@@ -178,12 +179,13 @@ public class AccountGroupApiServiceImpl implements AccountGroupApiService {
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
ServiceResponse
<
Void
>
saveAccountGroupRelFetch
(
List
<
AccountGroupMemberDTO
>
list
)
{
public
ServiceResponse
<
String
>
saveAccountGroupRelFetch
(
List
<
AccountGroupMemberDTO
>
list
)
{
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
//逻辑删除之前的数据,先删后增
//accountGroupRelService.deleteByAccountGroupId(list.get(0).getAccountGroupId());
//暂时不删除,因为是批量新增部分,而不是全部,所以不需要删除之前的数据
List
<
AccountGroupRelDTO
>
result
=
new
ArrayList
<>(
list
.
size
());
StringBuilder
operationObject
=
new
StringBuilder
();
Date
now
=
new
Date
();
for
(
AccountGroupMemberDTO
dto
:
list
)
{
AccountGroupRelDTO
temp
=
new
AccountGroupRelDTO
();
...
...
@@ -201,22 +203,31 @@ public class AccountGroupApiServiceImpl implements AccountGroupApiService {
temp
.
setType
(
dto
.
getType
());
temp
.
setEnterpriseId
(
dto
.
getEnterpriseId
());
result
.
add
(
temp
);
operationObject
.
append
(
dto
.
getMemberName
()).
append
(
SignConstants
.
COMMA
);
}
accountGroupRelService
.
insertFetch
(
result
);
TabSysAccountGroup
accountGroup
=
accountGroupService
.
getById
(
list
.
get
(
0
).
getAccountGroupId
());
if
(
accountGroup
!=
null
)
{
operationObject
.
append
(
"-分组到-"
).
append
(
accountGroup
.
getAccountGroupName
());
}
return
ServiceResponse
.
success
(
operationObject
.
toString
());
}
return
ServiceResponse
.
success
();
return
ServiceResponse
.
success
(
"无数据"
);
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
ServiceResponse
<
Void
>
groupingOfUser
(
List
<
Integer
>
userIdList
,
List
<
Integer
>
accountGroupId
,
public
ServiceResponse
<
String
>
groupingOfUser
(
List
<
Integer
>
userIdList
,
List
<
Integer
>
accountGroupId
,
Integer
enterpriseId
)
{
return
grouping
(
userIdList
,
accountGroupId
,
enterpriseId
,
AccountGroupMemberTypeEnum
.
ADMIN
.
getCode
());
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
ServiceResponse
<
Void
>
groupingOfCollaborator
(
List
<
Integer
>
collaboratorIdList
,
List
<
Integer
>
accountGroupId
,
public
ServiceResponse
<
String
>
groupingOfCollaborator
(
List
<
Integer
>
collaboratorIdList
,
List
<
Integer
>
accountGroupId
,
Integer
enterpriseId
)
{
return
grouping
(
collaboratorIdList
,
accountGroupId
,
enterpriseId
,
AccountGroupMemberTypeEnum
.
COLLABORATOR
.
getCode
());
...
...
@@ -307,7 +318,7 @@ public class AccountGroupApiServiceImpl implements AccountGroupApiService {
return
result
;
}
private
ServiceResponse
<
Void
>
grouping
(
List
<
Integer
>
userIdList
,
List
<
Integer
>
accountGroupId
,
Integer
enterpriseId
,
private
ServiceResponse
<
String
>
grouping
(
List
<
Integer
>
userIdList
,
List
<
Integer
>
accountGroupId
,
Integer
enterpriseId
,
int
type
)
{
//先删除
accountGroupRelService
.
deleteByUserId
(
userIdList
,
type
);
...
...
@@ -327,6 +338,21 @@ public class AccountGroupApiServiceImpl implements AccountGroupApiService {
}
accountGroupRelService
.
insertFetch
(
result
);
}
return
ServiceResponse
.
success
();
//获取日志操作对象内容
List
<
TabSysUser
>
userList
=
userService
.
listUserByIdList
(
userIdList
);
StringBuilder
sb
=
new
StringBuilder
();
if
(
CollectionUtils
.
isNotEmpty
(
userIdList
))
{
for
(
TabSysUser
user
:
userList
)
{
sb
.
append
(
user
.
getUserName
()).
append
(
SignConstants
.
COMMA
);
}
sb
.
append
(
"-分组到-"
);
List
<
TabSysAccountGroup
>
groupList
=
accountGroupService
.
listByIdList
(
accountGroupId
);
if
(
CollectionUtils
.
isNotEmpty
(
groupList
))
{
for
(
TabSysAccountGroup
group
:
groupList
)
{
sb
.
append
(
group
.
getAccountGroupName
()).
append
(
SignConstants
.
COMMA
);
}
}
}
return
ServiceResponse
.
success
(
sb
.
toString
());
}
}
gic-platform-auth-service/src/main/resources/mapper/TabSysAccountGroupMapper.xml
View file @
d2a9ca2d
...
...
@@ -141,4 +141,16 @@
and enterprise_id = #{enterpriseId}
order by sort
</select>
<select
id=
"listByIdList"
resultMap=
"BaseResultMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
from tab_sys_account_group
where status = 1
<if
test=
"list != null and list.size() > 0"
>
and account_group_id in
<foreach
collection=
"list"
index=
"index"
item=
"item"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</if>
</select>
</mapper>
\ No newline at end of file
gic-platform-auth-web/src/main/java/com/gic/auth/web/controller/AccountGroupController.java
View file @
d2a9ca2d
...
...
@@ -57,12 +57,14 @@ public class AccountGroupController {
@RequestMapping
(
"/save"
)
public
RestResponse
saveAccountGroup
(
AccountGroupDTO
dto
)
{
dto
.
setEnterpriseId
(
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
());
return
ResultControllerUtils
.
commonResult
(
accountGroupApiService
.
save
(
dto
));
return
ResultControllerUtils
.
operationResult
(
accountGroupApiService
.
save
(
dto
),
ResultControllerUtils
.
LOG_NEW
+
"账号分组"
,
dto
.
getAccountGroupName
());
}
@RequestMapping
(
"/edit"
)
public
RestResponse
editAccountGroup
(
AccountGroupDTO
dto
)
{
return
ResultControllerUtils
.
commonResult
(
accountGroupApiService
.
update
(
dto
));
return
ResultControllerUtils
.
operationResult
(
accountGroupApiService
.
update
(
dto
),
ResultControllerUtils
.
LOG_EDIT
+
"账号分组"
,
dto
.
getAccountGroupName
());
}
@RequestMapping
(
"/list"
)
...
...
@@ -81,12 +83,17 @@ public class AccountGroupController {
@RequestMapping
(
"/delete"
)
public
RestResponse
deleteAccountGroup
(
Integer
accountGroupId
)
{
return
ResultControllerUtils
.
commonResult
(
accountGroupApiService
.
deleteByAccountGroupId
(
accountGroupId
));
ServiceResponse
<
AccountGroupDTO
>
result
=
accountGroupApiService
.
deleteByAccountGroupId
(
accountGroupId
);
String
operationObject
=
result
.
isSuccess
()
?
result
.
getResult
().
getAccountGroupName
()
:
null
;
return
ResultControllerUtils
.
operationResult
(
result
,
ResultControllerUtils
.
LOG_DELETE
+
"账号分组"
,
operationObject
);
}
@RequestMapping
(
"/sort"
)
public
RestResponse
sortAccountGroup
(
Integer
accountGroupId
,
Integer
sort
)
{
return
ResultControllerUtils
.
commonResult
(
accountGroupApiService
.
sort
(
accountGroupId
,
sort
));
ServiceResponse
<
AccountGroupDTO
>
result
=
accountGroupApiService
.
sort
(
accountGroupId
,
sort
);
String
operationObject
=
result
.
isSuccess
()
?
result
.
getResult
().
getAccountGroupName
()
:
null
;
return
ResultControllerUtils
.
operationResult
(
result
,
ResultControllerUtils
.
LOG_SORT
+
"账号分组"
,
operationObject
);
}
/**
...
...
@@ -150,11 +157,15 @@ public class AccountGroupController {
}
Integer
enterpriseId
=
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
();
if
(
type
.
intValue
()
==
AccountGroupMemberTypeEnum
.
ADMIN
.
getCode
())
{
return
ResultControllerUtils
.
commonResult
(
accountGroupApiService
.
groupingOfUser
(
userIdList
,
accountGroupIdList
,
enterpriseId
));
ServiceResponse
<
String
>
result
=
accountGroupApiService
.
groupingOfUser
(
userIdList
,
accountGroupIdList
,
enterpriseId
);
String
operationObject
=
result
.
isSuccess
()
?
result
.
getResult
()
:
null
;
return
ResultControllerUtils
.
operationResult
(
result
,
"账号分组批量分组组员"
,
operationObject
);
}
else
if
(
type
.
intValue
()
==
AccountGroupMemberTypeEnum
.
COLLABORATOR
.
getCode
())
{
return
ResultControllerUtils
.
commonResult
(
accountGroupApiService
.
groupingOfCollaborator
(
userIdList
,
accountGroupIdList
,
enterpriseId
));
ServiceResponse
<
String
>
result
=
accountGroupApiService
.
groupingOfCollaborator
(
userIdList
,
accountGroupIdList
,
enterpriseId
);
String
operationObject
=
result
.
isSuccess
()
?
result
.
getResult
()
:
null
;
return
ResultControllerUtils
.
operationResult
(
result
,
"账号分组批量分组组员"
,
operationObject
);
}
return
RestResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"组员类型错误"
);
}
...
...
@@ -176,7 +187,8 @@ public class AccountGroupController {
temp
.
setEnterpriseId
(
enterpriseId
);
}
}
return
ResultControllerUtils
.
commonResult
(
accountGroupApiService
.
saveAccountGroupRelFetch
(
list
));
ServiceResponse
<
String
>
result
=
accountGroupApiService
.
saveAccountGroupRelFetch
(
list
);
String
operationObject
=
result
.
isSuccess
()
?
result
.
getResult
()
:
null
;
return
ResultControllerUtils
.
operationResult
(
result
,
"添加组员"
,
operationObject
);
}
}
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