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
1c21910d
Commit
1c21910d
authored
Jan 09, 2020
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
登录添加国际区码
parent
64e9aebf
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
91 additions
and
38 deletions
+91
-38
UserApiService.java
...pi/src/main/java/com/gic/auth/service/UserApiService.java
+14
-3
TabSysUserMapper.java
...c/main/java/com/gic/auth/dao/mapper/TabSysUserMapper.java
+5
-4
UserService.java
...rvice/src/main/java/com/gic/auth/service/UserService.java
+5
-2
UserServiceImpl.java
.../main/java/com/gic/auth/service/impl/UserServiceImpl.java
+10
-4
UserApiServiceImpl.java
...a/com/gic/auth/service/outer/impl/UserApiServiceImpl.java
+19
-5
TabSysUserMapper.xml
...th-service/src/main/resources/mapper/TabSysUserMapper.xml
+12
-3
LoginController.java
...ain/java/com/gic/auth/web/controller/LoginController.java
+19
-9
UserController.java
...main/java/com/gic/auth/web/controller/UserController.java
+7
-8
No files found.
gic-platform-auth-api/src/main/java/com/gic/auth/service/UserApiService.java
View file @
1c21910d
...
...
@@ -94,10 +94,19 @@ public interface UserApiService {
*/
ServiceResponse
<
UserDTO
>
getUserByEnterpriseId
(
Integer
enterpriseId
);
ServiceResponse
<
List
<
UserDTO
>>
listUserByPhoneNumber
(
String
phoneNumber
);
/**
* 根据登录账号查询商户列
* @Title: listUserByPhoneNumber
* @Description:
* @author guojuxing
* @param phoneNumber
* @param nationCode 国际区码
* @return com.gic.api.base.commons.ServiceResponse<java.util.List<com.gic.auth.dto.UserDTO>>
*/
ServiceResponse
<
List
<
UserDTO
>>
listUserByPhoneNumber
(
String
phoneNumber
,
String
nationCode
);
/**
* 手机号和企业查询用户
* 手机号和企业查询用户
,给好办用的
* @Title: listUserByPhoneNumber
* @Description:
* @author guojuxing
...
...
@@ -107,7 +116,9 @@ public interface UserApiService {
*/
ServiceResponse
<
UserDTO
>
listUserByPhoneNumber
(
String
phoneNumber
,
Integer
enterpriseId
);
ServiceResponse
<
UserDTO
>
login
(
String
phoneNumber
,
Integer
enterpriseId
,
String
password
);
ServiceResponse
<
UserDTO
>
listUserByPhoneNumber
(
String
nationCode
,
String
phoneNumber
,
Integer
enterpriseId
);
ServiceResponse
<
UserDTO
>
login
(
String
nationCode
,
String
phoneNumber
,
Integer
enterpriseId
,
String
password
);
/**
* 分页查询管理员列表数据
...
...
gic-platform-auth-service/src/main/java/com/gic/auth/dao/mapper/TabSysUserMapper.java
View file @
1c21910d
...
...
@@ -78,14 +78,15 @@ public interface TabSysUserMapper {
* @return int
*/
int
countByPhoneAndLoginType
(
@Param
(
"phone"
)
String
phone
,
@Param
(
"userId"
)
Integer
userId
,
@Param
(
"enterpriseId"
)
Integer
enterpriseId
,
@Param
(
"loginType"
)
Integer
loginType
);
@Param
(
"enterpriseId"
)
Integer
enterpriseId
,
@Param
(
"loginType"
)
Integer
loginType
);
TabSysUser
selectByEnterpriseId
(
@Param
(
"enterpriseId"
)
Integer
enterpriseId
);
List
<
TabSysUser
>
listAllUserByPhoneNumber
(
@Param
(
"phoneNumber"
)
String
phoneNumber
);
List
<
TabSysUser
>
listUserByPhoneNumberAndEnterprise
(
@Param
(
"phoneNumber"
)
String
phoneNumber
,
@Param
(
"nationCode"
)
String
nationCode
,
@Param
(
"enterpriseId"
)
Integer
enterpriseId
);
TabSysUser
login
(
@Param
(
"
phoneNumber"
)
String
phoneNumber
,
@Param
(
"password"
)
String
password
,
@Param
(
"enterpriseId"
)
Integer
enterpriseId
);
TabSysUser
login
(
@Param
(
"
nationCode"
)
String
nationCode
,
@Param
(
"phoneNumber"
)
String
phoneNumber
,
@Param
(
"
password"
)
String
password
,
@Param
(
"
enterpriseId"
)
Integer
enterpriseId
);
/**
* 列表查询
...
...
gic-platform-auth-service/src/main/java/com/gic/auth/service/UserService.java
View file @
1c21910d
...
...
@@ -20,6 +20,7 @@ public interface UserService {
* @return
*/
int
saveUser
(
UserDTO
userDTO
);
/**
* 新增运营实施管理员
* @Title: saveOperationUser
...
...
@@ -63,9 +64,11 @@ public interface UserService {
TabSysUser
getUserByEnterpriseId
(
Integer
enterpriseId
);
List
<
TabSysUser
>
listAllUserByPhoneNumber
(
String
phoneNumber
);
List
<
TabSysUser
>
listAllUserByPhoneNumber
(
String
phoneNumber
,
String
nationCode
);
List
<
TabSysUser
>
listUserByPhoneNumberAndEnterprise
(
String
phoneNumber
,
String
nationCode
,
Integer
enterpriseId
);
TabSysUser
login
(
String
phoneNumber
,
Integer
enterpriseId
,
String
password
);
TabSysUser
login
(
String
nationCode
,
String
phoneNumber
,
Integer
enterpriseId
,
String
password
);
/**
* 查询管理员列表数据
...
...
gic-platform-auth-service/src/main/java/com/gic/auth/service/impl/UserServiceImpl.java
View file @
1c21910d
...
...
@@ -92,13 +92,19 @@ public class UserServiceImpl implements UserService {
}
@Override
public
List
<
TabSysUser
>
listAllUserByPhoneNumber
(
String
phoneNumber
)
{
return
t
his
.
tabSysUserMapper
.
listAllUserByPhoneNumber
(
phoneNumber
);
public
List
<
TabSysUser
>
listAllUserByPhoneNumber
(
String
phoneNumber
,
String
nationCode
)
{
return
t
abSysUserMapper
.
listUserByPhoneNumberAndEnterprise
(
phoneNumber
,
nationCode
,
null
);
}
@Override
public
TabSysUser
login
(
String
phoneNumber
,
Integer
enterpriseId
,
String
password
)
{
return
this
.
tabSysUserMapper
.
login
(
phoneNumber
,
password
,
enterpriseId
);
public
List
<
TabSysUser
>
listUserByPhoneNumberAndEnterprise
(
String
phoneNumber
,
String
nationCode
,
Integer
enterpriseId
)
{
return
tabSysUserMapper
.
listUserByPhoneNumberAndEnterprise
(
phoneNumber
,
nationCode
,
enterpriseId
);
}
@Override
public
TabSysUser
login
(
String
nationCode
,
String
phoneNumber
,
Integer
enterpriseId
,
String
password
)
{
return
this
.
tabSysUserMapper
.
login
(
nationCode
,
phoneNumber
,
password
,
enterpriseId
);
}
@Override
...
...
gic-platform-auth-service/src/main/java/com/gic/auth/service/outer/impl/UserApiServiceImpl.java
View file @
1c21910d
...
...
@@ -307,8 +307,8 @@ public class UserApiServiceImpl implements UserApiService {
}
@Override
public
ServiceResponse
<
List
<
UserDTO
>>
listUserByPhoneNumber
(
String
phoneNumber
)
{
List
<
TabSysUser
>
list
=
this
.
userService
.
listAllUserByPhoneNumber
(
phoneNumber
);
public
ServiceResponse
<
List
<
UserDTO
>>
listUserByPhoneNumber
(
String
phoneNumber
,
String
nationCode
)
{
List
<
TabSysUser
>
list
=
this
.
userService
.
listAllUserByPhoneNumber
(
phoneNumber
,
nationCode
);
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
return
ServiceResponse
.
success
(
EntityUtil
.
changeEntityListByJSON
(
UserDTO
.
class
,
list
));
}
...
...
@@ -320,7 +320,7 @@ public class UserApiServiceImpl implements UserApiService {
if
(
enterpriseId
==
null
)
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"商户数据为空"
);
}
List
<
TabSysUser
>
list
=
this
.
userService
.
listAllUserByPhoneNumber
(
phoneNumber
);
List
<
TabSysUser
>
list
=
this
.
userService
.
listAllUserByPhoneNumber
(
phoneNumber
,
Constants
.
NATION_CODE
);
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
for
(
TabSysUser
user
:
list
)
{
if
(
enterpriseId
.
intValue
()
==
user
.
getEnterpriseId
().
intValue
())
{
...
...
@@ -332,8 +332,22 @@ public class UserApiServiceImpl implements UserApiService {
}
@Override
public
ServiceResponse
<
UserDTO
>
login
(
String
phoneNumber
,
Integer
enterpriseId
,
String
password
)
{
TabSysUser
user
=
this
.
userService
.
login
(
phoneNumber
,
enterpriseId
,
password
);
public
ServiceResponse
<
UserDTO
>
listUserByPhoneNumber
(
String
nationCode
,
String
phoneNumber
,
Integer
enterpriseId
)
{
if
(
enterpriseId
==
null
)
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"商户数据为空"
);
}
List
<
TabSysUser
>
list
=
this
.
userService
.
listUserByPhoneNumberAndEnterprise
(
phoneNumber
,
nationCode
,
enterpriseId
);
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
return
ServiceResponse
.
success
(
EntityUtil
.
changeEntityNew
(
UserDTO
.
class
,
list
.
get
(
0
)));
}
return
ServiceResponse
.
success
();
}
@Override
public
ServiceResponse
<
UserDTO
>
login
(
String
nationCode
,
String
phoneNumber
,
Integer
enterpriseId
,
String
password
)
{
TabSysUser
user
=
this
.
userService
.
login
(
nationCode
,
phoneNumber
,
enterpriseId
,
password
);
return
ServiceResponse
.
success
(
EntityUtil
.
changeEntityByJSON
(
UserDTO
.
class
,
user
));
}
...
...
gic-platform-auth-service/src/main/resources/mapper/TabSysUserMapper.xml
View file @
1c21910d
...
...
@@ -219,12 +219,20 @@
and login_type = 0
</select>
<select
id=
"list
AllUserByPhoneNumber
"
resultMap=
"BaseResultMap"
>
<select
id=
"list
UserByPhoneNumberAndEnterprise
"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_sys_user
where phone_number = #{phoneNumber}
and status = 1
where status = 1
<if
test=
"enterpriseId != null"
>
and enterprise_id = #{enterpriseId}
</if>
<if
test=
"phoneNumber != null and phoneNumber != '' "
>
and phone_number = #{phoneNumber}
</if>
<if
test=
"nationCode != null and nationCode != '' "
>
and phone_area_code = #{nationCode}
</if>
</select>
<select
id=
"login"
resultMap=
"BaseResultMap"
>
...
...
@@ -235,6 +243,7 @@
and status = 1
and enterprise_id = #{enterpriseId}
and password = #{password}
and phone_area_code = #{nationCode}
and login_type = 0
</select>
...
...
gic-platform-auth-web/src/main/java/com/gic/auth/web/controller/LoginController.java
View file @
1c21910d
...
...
@@ -14,6 +14,7 @@ import com.gic.auth.dto.ResourceDTO;
import
com.gic.auth.dto.UserResourceDTO
;
import
com.gic.auth.service.*
;
import
com.gic.enterprise.base.UserResourceInfo
;
import
com.gic.enterprise.constants.Constants
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.log4j.LogManager
;
...
...
@@ -58,11 +59,15 @@ public class LoginController {
private
ResourceApiService
resourceApiService
;
@RequestMapping
(
"list-enterprise-by-phone"
)
public
RestResponse
listUserEnterprise
(
String
phoneNumber
)
{
public
RestResponse
listUserEnterprise
(
String
phoneNumber
,
String
nationCode
)
{
if
(
StringUtils
.
isBlank
(
phoneNumber
))
{
return
EnterpriseRestResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
);
}
ServiceResponse
<
List
<
UserDTO
>>
listServiceResponse
=
this
.
userApiService
.
listUserByPhoneNumber
(
phoneNumber
);
if
(
StringUtils
.
isBlank
(
nationCode
))
{
nationCode
=
Constants
.
NATION_CODE
;
}
ServiceResponse
<
List
<
UserDTO
>>
listServiceResponse
=
this
.
userApiService
.
listUserByPhoneNumber
(
phoneNumber
,
nationCode
);
if
(
listServiceResponse
.
isSuccess
())
{
List
<
UserDTO
>
result
=
listServiceResponse
.
getResult
();
if
(
CollectionUtils
.
isEmpty
(
result
))
{
...
...
@@ -91,16 +96,19 @@ public class LoginController {
}
@RequestMapping
(
"login"
)
public
RestResponse
login
(
String
phoneNumber
,
Integer
enterpriseId
,
String
password
)
{
public
RestResponse
login
(
String
nationCode
,
String
phoneNumber
,
Integer
enterpriseId
,
String
password
)
{
if
(
StringUtils
.
isBlank
(
password
)
||
StringUtils
.
isBlank
(
phoneNumber
)
||
enterpriseId
==
null
)
{
return
EnterpriseRestResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
);
}
if
(
StringUtils
.
isBlank
(
nationCode
))
{
nationCode
=
Constants
.
NATION_CODE
;
}
Md5Util
md5
=
new
Md5Util
();
// password 自身作为盐值
if
(
password
.
length
()
!=
32
)
{
password
=
md5
.
encrypt
(
password
+
password
);
}
ServiceResponse
<
UserDTO
>
login
=
this
.
userApiService
.
login
(
phoneNumber
,
enterpriseId
,
password
);
ServiceResponse
<
UserDTO
>
login
=
this
.
userApiService
.
login
(
nationCode
,
phoneNumber
,
enterpriseId
,
password
);
if
(
login
.
isSuccess
())
{
UserDTO
userDTO
=
login
.
getResult
();
if
(
userDTO
==
null
)
{
...
...
@@ -131,7 +139,8 @@ public class LoginController {
}
//查询全部的操作模块
Map
<
String
,
MenuInfo
>
moduleMap
=
new
HashMap
<>(
16
);
ServiceResponse
<
List
<
MenuDTO
>>
allGicMenu
=
menuApiService
.
getSuperAdminMenuNotTree
(
enterpriseId
);
ServiceResponse
<
List
<
MenuDTO
>>
allGicMenu
=
menuApiService
.
getSuperAdminMenuNotTree
(
enterpriseId
);
if
(
allGicMenu
.
isSuccess
())
{
List
<
MenuDTO
>
temp
=
allGicMenu
.
getResult
();
List
<
MenuInfo
>
tempMenuInfoList
=
EntityUtil
.
changeEntityListNew
(
MenuInfo
.
class
,
temp
);
...
...
@@ -196,12 +205,13 @@ public class LoginController {
return
RestResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"token错误"
);
}
private
void
setUserResource
(
UserDetail
detail
,
Integer
userId
){
private
void
setUserResource
(
UserDetail
detail
,
Integer
userId
)
{
ServiceResponse
<
UserResourceDTO
>
resource
=
this
.
userResourceApiService
.
getResourceByUserId
(
userId
);
detail
.
setUserResourceInfo
(
new
UserResourceInfo
());
if
(
resource
.
isSuccess
()
&&
resource
.
getResult
()
!=
null
){
ServiceResponse
<
ResourceDTO
>
serviceResource
=
this
.
resourceApiService
.
getResource
(
resource
.
getResult
().
getResourceId
());
if
(
serviceResource
.
isSuccess
()
&&
serviceResource
.
getResult
()
!=
null
){
if
(
resource
.
isSuccess
()
&&
resource
.
getResult
()
!=
null
)
{
ServiceResponse
<
ResourceDTO
>
serviceResource
=
this
.
resourceApiService
.
getResource
(
resource
.
getResult
().
getResourceId
());
if
(
serviceResource
.
isSuccess
()
&&
serviceResource
.
getResult
()
!=
null
)
{
UserResourceInfo
userResourceInfo
=
new
UserResourceInfo
();
userResourceInfo
.
setUserResource
(
serviceResource
.
getResult
().
getUserResource
());
userResourceInfo
.
setStoreResource
(
serviceResource
.
getResult
().
getStoreResource
());
...
...
gic-platform-auth-web/src/main/java/com/gic/auth/web/controller/UserController.java
View file @
1c21910d
...
...
@@ -186,8 +186,8 @@ public class UserController {
UserDetail
userDetail
=
UserDetailUtils
.
getUserDetail
();
// password 自身作为盐值
String
password
=
userDetail
.
getUserInfo
().
getPassword
();
ServiceResponse
<
UserDTO
>
login
=
this
.
userApiService
.
login
(
userDetail
.
getUserInfo
().
getPhoneNumber
()
,
userDetail
.
getEnterpriseId
(),
password
);
ServiceResponse
<
UserDTO
>
login
=
this
.
userApiService
.
login
(
nationCode
,
userDetail
.
get
UserInfo
().
getPhoneNumber
(),
userDetail
.
get
EnterpriseId
(),
password
);
ServiceResponse
<
String
>
result
=
userApiService
.
editPhoneOrPassword
(
login
.
getResult
().
getUserId
(),
nationCode
,
phone
,
null
);
if
(
result
.
isSuccess
())
{
...
...
@@ -234,18 +234,17 @@ public class UserController {
if
(
oldPassword
.
length
()
!=
32
)
{
oldPassword
=
md5
.
encrypt
(
oldPassword
+
oldPassword
);
}
ServiceResponse
<
UserDTO
>
login
=
this
.
userApiService
.
login
(
userDetail
.
getUserInfo
().
getPhone
Number
(),
userDetail
.
getEnterpriseId
(),
oldPassword
);
ServiceResponse
<
UserDTO
>
login
=
this
.
userApiService
.
login
(
userDetail
.
getUserInfo
().
getPhone
AreaCode
(),
userDetail
.
get
UserInfo
().
getPhoneNumber
(),
userDetail
.
get
EnterpriseId
(),
oldPassword
);
if
(!
login
.
isSuccess
())
{
return
EnterpriseRestResponse
.
failure
(
login
);
}
if
(
login
.
getResult
()
==
null
)
{
return
RestResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"旧密码错误"
);
}
ServiceResponse
<
String
>
result
=
userApiService
.
editPhoneOrPassword
(
login
.
getResult
().
getUserId
(),
null
,
null
,
md5
.
encrypt
(
newPassword
+
newPassword
));
return
OperationResultUtils
.
operationResult
(
result
,
"修改密码"
,
OperationResultUtils
.
getOperationObject
(
result
));
ServiceResponse
<
String
>
result
=
userApiService
.
editPhoneOrPassword
(
login
.
getResult
().
getUserId
(),
null
,
null
,
md5
.
encrypt
(
newPassword
+
newPassword
));
return
OperationResultUtils
.
operationResult
(
result
,
"修改密码"
,
OperationResultUtils
.
getOperationObject
(
result
));
}
@RequestMapping
(
"/list-user-nopage"
)
...
...
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