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
b5c58818
Commit
b5c58818
authored
Oct 29, 2019
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
账号分组接口
parent
1f10d8e3
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
168 additions
and
5 deletions
+168
-5
AccountGroupService.java
...c/main/java/com/gic/auth/service/AccountGroupService.java
+11
-0
AccountGroupServiceImpl.java
...va/com/gic/auth/service/impl/AccountGroupServiceImpl.java
+42
-5
AccountGroupApiServiceImpl.java
...c/auth/service/outer/impl/AccountGroupApiServiceImpl.java
+14
-0
AccountGroupController.java
...a/com/gic/auth/web/controller/AccountGroupController.java
+57
-0
AccountGroupListVO.java
...src/main/java/com/gic/auth/web/vo/AccountGroupListVO.java
+44
-0
No files found.
gic-platform-auth-service/src/main/java/com/gic/auth/service/AccountGroupService.java
View file @
b5c58818
...
...
@@ -84,4 +84,15 @@ public interface AccountGroupService {
* @return int
*/
int
updateStatusByAccountGroupId
(
Integer
accountGroupId
);
/**
* 排序
* @Title: setSort
* @Description:
* @author guojuxing
* @param record
* @param sortValue
* @return void
*/
void
setSort
(
TabSysAccountGroup
record
,
Integer
sortValue
);
}
gic-platform-auth-service/src/main/java/com/gic/auth/service/impl/AccountGroupServiceImpl.java
View file @
b5c58818
package
com
.
gic
.
auth
.
service
.
impl
;
import
java.util.Date
;
import
java.util.List
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
com.gic.auth.dao.mapper.TabSysAccountGroupMapper
;
import
com.gic.auth.dto.AccountGroupDTO
;
import
com.gic.auth.entity.TabSysAccountGroup
;
import
com.gic.auth.service.AccountGroupService
;
import
com.gic.commons.util.EntityUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.List
;
@Service
(
"AccountGroupService"
)
public
class
AccountGroupServiceImpl
implements
AccountGroupService
{
...
...
@@ -55,6 +57,7 @@ public class AccountGroupServiceImpl implements AccountGroupService{
return
tabSysAccountGroupMapper
.
listAccountGroupByEnterpriseId
(
enterpriseId
);
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
int
updateStatusByAccountGroupId
(
Integer
accountGroupId
)
{
TabSysAccountGroup
record
=
new
TabSysAccountGroup
();
...
...
@@ -62,4 +65,38 @@ public class AccountGroupServiceImpl implements AccountGroupService{
record
.
setStatus
(
0
);
return
tabSysAccountGroupMapper
.
updateByPrimaryKeySelective
(
record
);
}
@Override
public
void
setSort
(
TabSysAccountGroup
record
,
Integer
sortValue
)
{
List
<
TabSysAccountGroup
>
list
=
tabSysAccountGroupMapper
.
listAccountGroupByEnterpriseId
(
record
.
getEnterpriseId
());
Integer
fromSortValue
=
record
.
getSort
();
if
(
fromSortValue
>
sortValue
)
{
//向上拖拽
for
(
int
i
=
0
,
length
=
list
.
size
();
i
<
length
;
i
++)
{
TabSysAccountGroup
temp
=
list
.
get
(
i
);
//如果大于sortValue,都需要降低排序值,往后推
boolean
isNeedDown
=
temp
.
getSort
()
>=
sortValue
&&
temp
.
getSort
()
<
fromSortValue
;
if
(
isNeedDown
)
{
updateSort
(
list
.
get
(
i
+
1
).
getSort
(),
temp
.
getAccountGroupId
());
}
}
}
else
if
(
fromSortValue
<
sortValue
)
{
//向下拖拽
for
(
int
i
=
0
,
length
=
list
.
size
();
i
<
length
;
i
++)
{
TabSysAccountGroup
temp
=
list
.
get
(
i
);
boolean
isNeedUp
=
temp
.
getSort
()
<=
sortValue
&&
temp
.
getSort
()
>
fromSortValue
;
if
(
isNeedUp
)
{
updateSort
(
list
.
get
(
i
-
1
).
getSort
(),
temp
.
getAccountGroupId
());
}
}
}
updateSort
(
sortValue
,
record
.
getAccountGroupId
());
}
private
void
updateSort
(
Integer
sort
,
Integer
accountGroupId
)
{
TabSysAccountGroup
record
=
new
TabSysAccountGroup
();
record
.
setAccountGroupId
(
accountGroupId
);
record
.
setSort
(
sort
);
tabSysAccountGroupMapper
.
updateByPrimaryKeySelective
(
record
);
}
}
gic-platform-auth-service/src/main/java/com/gic/auth/service/outer/impl/AccountGroupApiServiceImpl.java
View file @
b5c58818
...
...
@@ -12,6 +12,7 @@ import com.gic.auth.dto.AccountGroupDTO;
import
com.gic.auth.service.AccountGroupApiService
;
import
com.gic.auth.service.AccountGroupService
;
import
com.gic.enterprise.utils.valid.ValidParamsUtils
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -22,6 +23,7 @@ public class AccountGroupApiServiceImpl implements AccountGroupApiService{
private
AccountGroupService
accountGroupService
;
@Override
public
ServiceResponse
<
Integer
>
save
(
AccountGroupDTO
dto
)
{
//参数校验
ServiceResponse
paramValid
=
ValidParamsUtils
.
allCheckValidate
(
AccountGroupDTO
.
class
,
AccountGroupDTO
.
SaveValid
.
class
);
if
(!
paramValid
.
isSuccess
())
{
return
paramValid
;
...
...
@@ -41,6 +43,7 @@ public class AccountGroupApiServiceImpl implements AccountGroupApiService{
if
(
record
==
null
)
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"账号分组id有误,查无数据"
);
}
//参数校验
ServiceResponse
paramValid
=
ValidParamsUtils
.
allCheckValidate
(
AccountGroupDTO
.
class
,
AccountGroupDTO
.
EditValid
.
class
);
if
(!
paramValid
.
isSuccess
())
{
return
paramValid
;
...
...
@@ -63,6 +66,7 @@ public class AccountGroupApiServiceImpl implements AccountGroupApiService{
return
ServiceResponse
.
success
(
new
ArrayList
<>());
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
ServiceResponse
<
Void
>
deleteByAccountGroupId
(
Integer
accountGroupId
)
{
TabSysAccountGroup
record
=
accountGroupService
.
getById
(
accountGroupId
);
...
...
@@ -75,4 +79,14 @@ public class AccountGroupApiServiceImpl implements AccountGroupApiService{
return
ServiceResponse
.
success
();
}
@Override
public
ServiceResponse
<
Void
>
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
();
}
}
gic-platform-auth-web/src/main/java/com/gic/auth/web/controller/AccountGroupController.java
0 → 100644
View file @
b5c58818
package
com
.
gic
.
auth
.
web
.
controller
;
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.auth.dto.AccountGroupDTO
;
import
com.gic.auth.service.AccountGroupApiService
;
import
com.gic.auth.web.vo.AccountGroupListVO
;
import
com.gic.commons.webapi.reponse.RestResponse
;
import
com.gic.enterprise.utils.ResultControllerUtils
;
import
com.gic.enterprise.utils.UserDetailUtils
;
@RestController
@RequestMapping
(
"/account-group"
)
public
class
AccountGroupController
{
private
final
static
Logger
LOGGER
=
LogManager
.
getLogger
(
AccountGroupApiService
.
class
);
@Autowired
private
AccountGroupApiService
accountGroupApiService
;
/**
* 新增账号分组
* @Title: saveAccountGroup
* @Description:
* @author guojuxing
* @param dto
* @return com.gic.commons.webapi.reponse.RestResponse
*/
@RequestMapping
(
"/save"
)
public
RestResponse
saveAccountGroup
(
AccountGroupDTO
dto
)
{
return
ResultControllerUtils
.
commonResult
(
accountGroupApiService
.
save
(
dto
));
}
@RequestMapping
(
"/edit"
)
public
RestResponse
editAccountGroup
(
AccountGroupDTO
dto
)
{
return
ResultControllerUtils
.
commonResult
(
accountGroupApiService
.
update
(
dto
));
}
@RequestMapping
(
"/list"
)
public
RestResponse
listAccountGroup
()
{
Integer
enterpriseId
=
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
();
return
ResultControllerUtils
.
commonResult
(
accountGroupApiService
.
listAccountGroupByEnterpriseId
(
enterpriseId
),
AccountGroupListVO
.
class
);
}
@RequestMapping
(
"/delete"
)
public
RestResponse
deleteAccountGroup
(
Integer
accountGroupId
)
{
return
ResultControllerUtils
.
commonResult
(
accountGroupApiService
.
deleteByAccountGroupId
(
accountGroupId
));
}
@RequestMapping
(
"/sort"
)
public
RestResponse
sortAccountGroup
(
Integer
accountGroupId
,
Integer
sort
)
{
return
ResultControllerUtils
.
commonResult
(
accountGroupApiService
.
sort
(
accountGroupId
,
sort
));
}
}
gic-platform-auth-web/src/main/java/com/gic/auth/web/vo/AccountGroupListVO.java
0 → 100644
View file @
b5c58818
package
com
.
gic
.
auth
.
web
.
vo
;
import
java.io.Serializable
;
/**
* 账号分组列表
* @ClassName: AccountGroupListVO
* @Description:
* @author guojuxing
* @date 2019/10/29 9:44 AM
*/
public
class
AccountGroupListVO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
2848584820559101482L
;
private
Integer
accountGroupId
;
private
String
accountGroupName
;
private
Integer
enterpriseId
;
public
Integer
getAccountGroupId
()
{
return
accountGroupId
;
}
public
void
setAccountGroupId
(
Integer
accountGroupId
)
{
this
.
accountGroupId
=
accountGroupId
;
}
public
String
getAccountGroupName
()
{
return
accountGroupName
;
}
public
void
setAccountGroupName
(
String
accountGroupName
)
{
this
.
accountGroupName
=
accountGroupName
;
}
public
Integer
getEnterpriseId
()
{
return
enterpriseId
;
}
public
void
setEnterpriseId
(
Integer
enterpriseId
)
{
this
.
enterpriseId
=
enterpriseId
;
}
}
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