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
13006d6c
Commit
13006d6c
authored
Nov 13, 2019
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
管理员判断类型:GIC管理员和运营管理员
parent
bf44195a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
68 additions
and
9 deletions
+68
-9
UserService.java
...rvice/src/main/java/com/gic/auth/service/UserService.java
+9
-0
UserServiceImpl.java
.../main/java/com/gic/auth/service/impl/UserServiceImpl.java
+18
-0
UserApiServiceImpl.java
...a/com/gic/auth/service/outer/impl/UserApiServiceImpl.java
+32
-8
TabSysUserMapper.xml
...th-service/src/main/resources/mapper/TabSysUserMapper.xml
+9
-1
No files found.
gic-platform-auth-service/src/main/java/com/gic/auth/service/UserService.java
View file @
13006d6c
...
...
@@ -20,6 +20,15 @@ public interface UserService {
* @return
*/
int
saveUser
(
UserDTO
userDTO
);
/**
* 新增运营实施管理员
* @Title: saveOperationUser
* @Description:
* @author guojuxing
* @param userDTO
* @return int
*/
int
saveOperationUser
(
UserDTO
userDTO
);
void
editUser
(
UserDTO
userDTO
);
...
...
gic-platform-auth-service/src/main/java/com/gic/auth/service/impl/UserServiceImpl.java
View file @
13006d6c
package
com
.
gic
.
auth
.
service
.
impl
;
import
com.gic.auth.constant.LoginUserTypeEnum
;
import
com.gic.auth.dao.mapper.TabSysUserMapper
;
import
com.gic.auth.dto.UserDTO
;
import
com.gic.auth.dto.UserListDTO
;
...
...
@@ -29,11 +30,28 @@ public class UserServiceImpl implements UserService {
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
int
saveUser
(
UserDTO
userDTO
)
{
userDTO
.
setLoginType
(
LoginUserTypeEnum
.
GIC_USER
.
getCode
());
userDTO
.
setCreateTime
(
new
Date
());
userDTO
.
setUpdateTime
(
new
Date
());
userDTO
.
setStatus
(
1
);
TabSysUser
tabUser
=
EntityUtil
.
changeEntityNew
(
TabSysUser
.
class
,
userDTO
);
tabSysUserMapper
.
insert
(
tabUser
);
return
tabUser
.
getUserId
();
}
@Override
public
int
saveOperationUser
(
UserDTO
userDTO
)
{
userDTO
.
setLoginType
(
LoginUserTypeEnum
.
OPERATION_USER
.
getCode
());
userDTO
.
setCreateTime
(
new
Date
());
userDTO
.
setUpdateTime
(
new
Date
());
userDTO
.
setStatus
(
1
);
//设置超管权限
userDTO
.
setSuperAdmin
(
1
);
TabSysUser
tabUser
=
EntityUtil
.
changeEntityNew
(
TabSysUser
.
class
,
userDTO
);
tabSysUserMapper
.
insertSelective
(
tabUser
);
return
tabUser
.
getUserId
();
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
void
editUser
(
UserDTO
userDTO
)
{
...
...
gic-platform-auth-service/src/main/java/com/gic/auth/service/outer/impl/UserApiServiceImpl.java
View file @
13006d6c
...
...
@@ -4,6 +4,7 @@ import java.util.ArrayList;
import
java.util.Date
;
import
java.util.List
;
import
com.gic.auth.constant.LoginUserTypeEnum
;
import
com.gic.auth.entity.*
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang.StringUtils
;
...
...
@@ -95,9 +96,6 @@ public class UserApiServiceImpl implements UserApiService {
if
(
StringUtils
.
isBlank
(
userDTO
.
getPhoneAreaCode
()))
{
userDTO
.
setPhoneAreaCode
(
"86"
);
}
userDTO
.
setCreateTime
(
new
Date
());
userDTO
.
setUpdateTime
(
new
Date
());
userDTO
.
setStatus
(
1
);
Integer
userId
=
userService
.
saveUser
(
userDTO
);
userRoleService
.
deleteByUserId
(
userId
);
...
...
@@ -119,6 +117,23 @@ public class UserApiServiceImpl implements UserApiService {
}
@Override
public
ServiceResponse
<
Integer
>
saveOperationUser
(
UserDTO
userDTO
)
{
if
(
StringUtils
.
isBlank
(
userDTO
.
getPhoneNumber
()))
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"手机号不能为空"
);
}
if
(
StringUtils
.
isBlank
(
userDTO
.
getUserName
()))
{
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"用户名称不能为空"
);
}
if
(
userDTO
.
getEnterpriseId
()
==
null
)
{
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"商户ID不能为空"
);
}
if
(
userService
.
isPhoneRepeat
(
null
,
userDTO
.
getPhoneNumber
(),
userDTO
.
getEnterpriseId
()))
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"手机号码不能重复"
);
}
return
ServiceResponse
.
success
(
userService
.
saveOperationUser
(
userDTO
));
}
@Override
public
ServiceResponse
<
Integer
>
saveAdmin
(
UserDTO
userDTO
)
{
//valid param
ServiceResponse
paramResult
=
ValidUtil
.
allCheckValidate
(
userDTO
,
UserDTO
.
SaveUserValid
.
class
);
...
...
@@ -136,9 +151,6 @@ public class UserApiServiceImpl implements UserApiService {
if
(
StringUtils
.
isBlank
(
userDTO
.
getPhoneAreaCode
()))
{
userDTO
.
setPhoneAreaCode
(
"86"
);
}
userDTO
.
setCreateTime
(
new
Date
());
userDTO
.
setUpdateTime
(
new
Date
());
userDTO
.
setStatus
(
1
);
Integer
userId
=
userService
.
saveUser
(
userDTO
);
return
ServiceResponse
.
success
(
userId
);
}
...
...
@@ -158,8 +170,9 @@ public class UserApiServiceImpl implements UserApiService {
if
(
userService
.
isPhoneRepeat
(
userDTO
.
getUserId
(),
userDTO
.
getPhoneNumber
(),
tabUser
.
getEnterpriseId
()))
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"手机号码不能重复"
);
}
if
(
userDTO
.
getSuperAdmin
()
!=
null
&&
userDTO
.
getSuperAdmin
().
intValue
()
==
1
)
{
//gic管理员只有一个超管
if
(
userDTO
.
getSuperAdmin
()
!=
null
&&
userDTO
.
getSuperAdmin
().
intValue
()
==
1
&&
tabUser
.
getLoginType
().
intValue
()
==
LoginUserTypeEnum
.
GIC_USER
.
getCode
())
{
//超级官员
TabSysUser
adminUser
=
userService
.
getUserByEnterpriseId
(
userDTO
.
getEnterpriseId
());
if
(
adminUser
!=
null
&&
adminUser
.
getUserId
().
intValue
()
!=
tabUser
.
getUserId
().
intValue
())
{
...
...
@@ -218,6 +231,9 @@ public class UserApiServiceImpl implements UserApiService {
if
(
tabUser
==
null
)
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"用户ID输入有误"
);
}
if
(
tabUser
.
getLoginType
().
intValue
()
!=
LoginUserTypeEnum
.
GIC_USER
.
getCode
())
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"用户类型错误,不是GIC管理员"
);
}
UserDTO
result
=
EntityUtil
.
changeEntityNew
(
UserDTO
.
class
,
tabUser
);
//角色集
List
<
UserRoleDTO
>
userRoleDTOList
=
userRoleService
.
listUserRoleByUserId
(
userId
);
...
...
@@ -267,6 +283,10 @@ public class UserApiServiceImpl implements UserApiService {
if
(
tabUser
==
null
)
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"用户ID输入有误,无此数据"
);
}
if
(
tabUser
.
getLoginType
().
intValue
()
!=
LoginUserTypeEnum
.
GIC_USER
.
getCode
())
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"用户类型错误,不是"
+
LoginUserTypeEnum
.
GIC_USER
.
getMessage
());
}
//删除角色关联
userRoleService
.
deleteByUserId
(
userId
);
//删除资源关联
...
...
@@ -372,6 +392,10 @@ public class UserApiServiceImpl implements UserApiService {
if
(
tabUser
==
null
)
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"用户ID输入有误,无此数据"
);
}
if
(
tabUser
.
getLoginType
().
intValue
()
!=
LoginUserTypeEnum
.
GIC_USER
.
getCode
())
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"用户类型错误,不是"
+
LoginUserTypeEnum
.
GIC_USER
.
getMessage
());
}
TabSysAccountGroup
tabSysAccountGroup
=
accountGroupService
.
getById
(
accountGroupId
);
if
(
tabSysAccountGroup
==
null
)
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"账号分组ID输入有误,无此数据"
);
...
...
gic-platform-auth-service/src/main/resources/mapper/TabSysUserMapper.xml
View file @
13006d6c
...
...
@@ -43,7 +43,7 @@
#{passwordType,jdbcType=INTEGER}
)
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.gic.auth.entity.TabSysUser"
>
<insert
id=
"insertSelective"
parameterType=
"com.gic.auth.entity.TabSysUser"
useGeneratedKeys=
"true"
keyProperty=
"userId"
>
insert into tab_sys_user
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"userId != null"
>
...
...
@@ -205,6 +205,7 @@
where enterprise_id = #{enterpriseId,jdbcType=INTEGER}
and status = 1
and super_admin = 1
and login_type = 0
</select>
<select
id=
"listAllUserByPhoneNumber"
resultMap=
"BaseResultMap"
>
...
...
@@ -223,6 +224,7 @@
and status = 1
and enterprise_id = #{enterpriseId}
and password = #{password}
and login_type = 0
</select>
...
...
@@ -241,6 +243,7 @@
and a.status = 1
and b.status = 1
and c.status = 1
and a.login_type = 0
<if
test=
"search != null and search != '' "
>
and ( a.user_name like concat('%', #{search}, '%') or a.phone_number like concat('%', #{search}, '%') )
</if>
...
...
@@ -268,6 +271,7 @@
update tab_sys_user set status = 0
where user_id = #{userId}
and status = 1
and login_type = 0
</update>
<select
id=
"getFirstNotInUserId"
resultType=
"java.lang.Integer"
>
...
...
@@ -275,6 +279,7 @@
1
from tab_sys_user
where status = 1
and login_type = 0
<if
test=
"enterpriseId != null "
>
and enterprise_id = #{enterpriseId}
</if>
...
...
@@ -288,6 +293,7 @@
</select>
<select
id=
"countUserByUserIds"
resultType=
"java.lang.Integer"
>
select count(1) from tab_sys_user where status = 1
and login_type = 0
and user_id in
<foreach
collection=
"ids"
index=
"index"
item=
"item"
open=
"("
separator=
","
close=
")"
>
#{item}
...
...
@@ -300,6 +306,7 @@
<include
refid=
"Base_Column_List"
/>
from tab_sys_user
where status = 1
and login_type = 0
<if
test=
"ids != null and ids.size() > 0"
>
and user_id in
<foreach
collection=
"ids"
index=
"index"
item=
"item"
open=
"("
separator=
","
close=
")"
>
...
...
@@ -314,6 +321,7 @@
from tab_sys_user
where status = 1
and enterprise_id = #{enterpriseId}
and login_type = 0
<if
test=
"search != null and search != '' "
>
and ( user_name like concat('%', #{search}, '%') or phone_number like concat('%', #{search}, '%') )
</if>
...
...
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