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
5987dbf3
Commit
5987dbf3
authored
Nov 19, 2019
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新建管理员的时候,判断手机号码重复,想要区别管理员类别:gic管理员、运营实施管理员
parent
5287943f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
57 additions
and
5 deletions
+57
-5
TabSysUserMapper.java
...c/main/java/com/gic/auth/dao/mapper/TabSysUserMapper.java
+14
-0
UserService.java
...rvice/src/main/java/com/gic/auth/service/UserService.java
+13
-0
UserServiceImpl.java
.../main/java/com/gic/auth/service/impl/UserServiceImpl.java
+12
-0
UserApiServiceImpl.java
...a/com/gic/auth/service/outer/impl/UserApiServiceImpl.java
+7
-5
TabSysUserMapper.xml
...th-service/src/main/resources/mapper/TabSysUserMapper.xml
+11
-0
No files found.
gic-platform-auth-service/src/main/java/com/gic/auth/dao/mapper/TabSysUserMapper.java
View file @
5987dbf3
...
...
@@ -66,6 +66,20 @@ public interface TabSysUserMapper {
int
countByPhone
(
@Param
(
"phone"
)
String
phone
,
@Param
(
"userId"
)
Integer
userId
,
@Param
(
"enterpriseId"
)
Integer
enterpriseId
);
/**
* 手机号码查询个数
* @Title: countByPhoneAndLoginType
* @Description:
* @author guojuxing
* @param phone
* @param userId
* @param enterpriseId
* @param loginType
* @return int
*/
int
countByPhoneAndLoginType
(
@Param
(
"phone"
)
String
phone
,
@Param
(
"userId"
)
Integer
userId
,
@Param
(
"enterpriseId"
)
Integer
enterpriseId
,
@Param
(
"loginType"
)
Integer
loginType
);
TabSysUser
selectByEnterpriseId
(
@Param
(
"enterpriseId"
)
Integer
enterpriseId
);
List
<
TabSysUser
>
listAllUserByPhoneNumber
(
@Param
(
"phoneNumber"
)
String
phoneNumber
);
...
...
gic-platform-auth-service/src/main/java/com/gic/auth/service/UserService.java
View file @
5987dbf3
...
...
@@ -48,6 +48,19 @@ public interface UserService {
*/
boolean
isPhoneRepeat
(
Integer
userId
,
String
phone
,
Integer
enterpriseId
);
/**
* 手机号码是否重复
* @Title: isPhoneRepeat
* @Description:
* @author guojuxing
* @param userId
* @param phone 手机号码
* @param enterpriseId 商户ID
* @param loginType 管理员类别
* @return boolean
*/
boolean
isPhoneRepeat
(
Integer
userId
,
String
phone
,
Integer
enterpriseId
,
Integer
loginType
);
TabSysUser
getUserByEnterpriseId
(
Integer
enterpriseId
);
List
<
TabSysUser
>
listAllUserByPhoneNumber
(
String
phoneNumber
);
...
...
gic-platform-auth-service/src/main/java/com/gic/auth/service/impl/UserServiceImpl.java
View file @
5987dbf3
...
...
@@ -75,6 +75,18 @@ public class UserServiceImpl implements UserService {
}
@Override
public
boolean
isPhoneRepeat
(
Integer
userId
,
String
phone
,
Integer
enterpriseId
,
Integer
loginType
)
{
if
(
loginType
==
null
)
{
loginType
=
LoginUserTypeEnum
.
GIC_USER
.
getCode
();
}
int
count
=
tabSysUserMapper
.
countByPhoneAndLoginType
(
phone
,
userId
,
enterpriseId
,
loginType
);
if
(
count
>
0
)
{
return
true
;
}
return
false
;
}
@Override
public
TabSysUser
getUserByEnterpriseId
(
Integer
enterpriseId
)
{
return
tabSysUserMapper
.
selectByEnterpriseId
(
enterpriseId
);
}
...
...
gic-platform-auth-service/src/main/java/com/gic/auth/service/outer/impl/UserApiServiceImpl.java
View file @
5987dbf3
...
...
@@ -62,7 +62,7 @@ public class UserApiServiceImpl implements UserApiService {
if
(!
paramResult
.
isSuccess
())
{
return
paramResult
;
}
if
(
userService
.
isPhoneRepeat
(
null
,
userDTO
.
getPhoneNumber
(),
userDTO
.
getEnterpriseId
()))
{
if
(
userService
.
isPhoneRepeat
(
null
,
userDTO
.
getPhoneNumber
(),
userDTO
.
getEnterpriseId
()
,
null
))
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"手机号码不能重复"
);
}
...
...
@@ -127,7 +127,8 @@ public class UserApiServiceImpl implements UserApiService {
if
(
userDTO
.
getEnterpriseId
()
==
null
)
{
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"商户ID不能为空"
);
}
if
(
userService
.
isPhoneRepeat
(
null
,
userDTO
.
getPhoneNumber
(),
userDTO
.
getEnterpriseId
()))
{
if
(
userService
.
isPhoneRepeat
(
null
,
userDTO
.
getPhoneNumber
(),
userDTO
.
getEnterpriseId
(),
LoginUserTypeEnum
.
OPERATION_USER
.
getCode
()))
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"手机号码不能重复"
);
}
return
ServiceResponse
.
success
(
userService
.
saveOperationUser
(
userDTO
));
...
...
@@ -140,7 +141,7 @@ public class UserApiServiceImpl implements UserApiService {
if
(!
paramResult
.
isSuccess
())
{
return
paramResult
;
}
if
(
userService
.
isPhoneRepeat
(
null
,
userDTO
.
getPhoneNumber
(),
userDTO
.
getEnterpriseId
()))
{
if
(
userService
.
isPhoneRepeat
(
null
,
userDTO
.
getPhoneNumber
(),
userDTO
.
getEnterpriseId
()
,
null
))
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"手机号码不能重复"
);
}
if
(
userDTO
.
getPasswordType
()
==
null
)
{
...
...
@@ -167,7 +168,7 @@ public class UserApiServiceImpl implements UserApiService {
if
(
tabUser
==
null
)
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"用户ID输入有误"
);
}
if
(
userService
.
isPhoneRepeat
(
userDTO
.
getUserId
(),
userDTO
.
getPhoneNumber
(),
tabUser
.
getEnterpriseId
()))
{
if
(
userService
.
isPhoneRepeat
(
userDTO
.
getUserId
(),
userDTO
.
getPhoneNumber
(),
tabUser
.
getEnterpriseId
()
,
null
))
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"手机号码不能重复"
);
}
//gic管理员只有一个超管
...
...
@@ -405,7 +406,8 @@ public class UserApiServiceImpl implements UserApiService {
}
@Override
public
ServiceResponse
<
String
>
editPhoneOrPassword
(
Integer
userId
,
String
nationCode
,
String
phone
,
String
password
)
{
public
ServiceResponse
<
String
>
editPhoneOrPassword
(
Integer
userId
,
String
nationCode
,
String
phone
,
String
password
)
{
TabSysUser
tabUser
=
userService
.
getUserById
(
userId
);
if
(
tabUser
==
null
)
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"用户ID输入有误,无此数据"
);
...
...
gic-platform-auth-service/src/main/resources/mapper/TabSysUserMapper.xml
View file @
5987dbf3
...
...
@@ -197,6 +197,17 @@
and phone_number = #{phone}
</select>
<select
id=
"countByPhoneAndLoginType"
resultType=
"int"
>
select count(1) from tab_sys_user
where status = 1
<if
test=
"userId != null"
>
and user_id
<![CDATA[ <> ]]>
#{userId}
</if>
and enterprise_id = #{enterpriseId}
and phone_number = #{phone}
and login_type = #{loginType}
</select>
<select
id=
"selectByEnterpriseId"
parameterType=
"java.lang.Integer"
resultMap=
"BaseResultMap"
>
select
...
...
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