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
6c56d9c7
Commit
6c56d9c7
authored
Nov 15, 2019
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
操作模块初始化修改:查询全部
parent
5d1e9008
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
151 additions
and
17 deletions
+151
-17
MenuApiServiceImpl.java
...a/com/gic/auth/service/outer/impl/MenuApiServiceImpl.java
+11
-2
LoginController.java
...ain/java/com/gic/auth/web/controller/LoginController.java
+16
-2
RoleController.java
...main/java/com/gic/auth/web/controller/RoleController.java
+5
-13
UserController.java
...main/java/com/gic/auth/web/controller/UserController.java
+44
-0
LoginUserVO.java
...th-web/src/main/java/com/gic/auth/web/vo/LoginUserVO.java
+75
-0
No files found.
gic-platform-auth-service/src/main/java/com/gic/auth/service/outer/impl/MenuApiServiceImpl.java
View file @
6c56d9c7
...
...
@@ -2,6 +2,7 @@ package com.gic.auth.service.outer.impl;
import
java.util.*
;
import
com.gic.enterprise.service.EnterpriseApiService
;
import
com.gic.open.api.service.ServeApiService
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang.StringUtils
;
...
...
@@ -53,6 +54,8 @@ public class MenuApiServiceImpl implements MenuApiService {
private
AppTokenApiService
appTokenApiService
;
@Autowired
private
ServeApiService
serveApiService
;
@Autowired
private
EnterpriseApiService
enterpriseApiService
;
@Override
public
ServiceResponse
<
List
<
MenuDTO
>>
listByMenuIdList
(
List
<
Integer
>
menuIdList
)
{
...
...
@@ -102,8 +105,14 @@ public class MenuApiServiceImpl implements MenuApiService {
}
@Override
public
ServiceResponse
<
List
<
MenuDTO
>>
getSuperAdminMenu
(
Integer
userId
,
String
versionCode
)
{
return
this
.
getUserMenuOfGic
(
userId
,
null
,
versionCode
);
public
ServiceResponse
<
List
<
MenuDTO
>>
getSuperAdminGicMenu
(
Integer
enterpriseId
)
{
//查询超级管理员
TabSysUser
tabSysUser
=
userService
.
getUserByEnterpriseId
(
enterpriseId
);
if
(
tabSysUser
==
null
)
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"没有超级管理员,数据错误"
);
}
String
versionCode
=
enterpriseApiService
.
getEnterpriseById
(
enterpriseId
).
getResult
().
getVersionCode
();
return
this
.
getUserMenuOfGic
(
tabSysUser
.
getUserId
(),
null
,
versionCode
);
}
@Override
...
...
gic-platform-auth-web/src/main/java/com/gic/auth/web/controller/LoginController.java
View file @
6c56d9c7
...
...
@@ -112,16 +112,30 @@ public class LoginController {
List
<
MenuDTO
>
menuList
=
menuResult
.
getResult
();
List
<
MenuInfo
>
menuInfoList
=
EntityUtil
.
changeEntityListNew
(
MenuInfo
.
class
,
menuList
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>(
16
);
Map
<
String
,
MenuInfo
>
moduleMap
=
new
HashMap
<>(
16
);
if
(
CollectionUtils
.
isNotEmpty
(
menuInfoList
))
{
for
(
MenuInfo
menuDTO
:
menuInfoList
)
{
if
(
StringUtils
.
isBlank
(
menuDTO
.
getMenuUrl
()))
{
continue
;
}
moduleMap
.
put
(
menuDTO
.
getProjectUrlForWeb
()
+
menuDTO
.
getMenuUrl
(),
menuDTO
);
map
.
put
(
menuDTO
.
getMenuUrl
(),
menuDTO
);
}
}
//查询全部的操作模块
Map
<
String
,
MenuInfo
>
moduleMap
=
new
HashMap
<>(
16
);
ServiceResponse
<
List
<
MenuDTO
>>
allGicMenu
=
menuApiService
.
getSuperAdminGicMenu
(
enterpriseId
);
if
(
allGicMenu
.
isSuccess
())
{
List
<
MenuDTO
>
temp
=
allGicMenu
.
getResult
();
List
<
MenuInfo
>
tempMenuInfoList
=
EntityUtil
.
changeEntityListNew
(
MenuInfo
.
class
,
temp
);
if
(
CollectionUtils
.
isNotEmpty
(
tempMenuInfoList
))
{
for
(
MenuInfo
menuDTO
:
menuInfoList
)
{
if
(
StringUtils
.
isBlank
(
menuDTO
.
getMenuUrl
()))
{
continue
;
}
moduleMap
.
put
(
menuDTO
.
getProjectUrlForWeb
()
+
menuDTO
.
getMenuUrl
(),
menuDTO
);
}
}
}
//塞值
userDetail
.
setMenuInfoList
(
menuInfoList
);
userDetail
.
setMenuUrlMap
(
map
);
userDetail
.
setModuleUrlMap
(
moduleMap
);
...
...
gic-platform-auth-web/src/main/java/com/gic/auth/web/controller/RoleController.java
View file @
6c56d9c7
...
...
@@ -113,20 +113,12 @@ public class RoleController {
@RequestMapping
(
"/list-menu"
)
public
RestResponse
listMenu
()
{
Integer
enterpriseId
=
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
();
ServiceResponse
<
UserDTO
>
userResponse
=
userApiService
.
getUserByEnterpriseId
(
enterpriseId
);
if
(
userResponse
.
isSuccess
())
{
UserDTO
admin
=
userResponse
.
getResult
();
Integer
userId
=
admin
.
getUserId
();
ServiceResponse
<
List
<
MenuDTO
>>
menuResponse
=
menuApiService
.
getSuperAdminMenu
(
userId
,
UserDetailUtils
.
getUserDetail
().
getEnterpriseInfo
().
getVersionCode
());
if
(
menuResponse
.
isSuccess
())
{
return
RestResponse
.
success
(
menuResponse
.
getResult
());
}
else
{
return
EnterpriseRestResponse
.
failure
(
menuResponse
);
}
ServiceResponse
<
List
<
MenuDTO
>>
menuResponse
=
menuApiService
.
getSuperAdminGicMenu
(
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
());
if
(
menuResponse
.
isSuccess
())
{
return
RestResponse
.
success
(
menuResponse
.
getResult
());
}
else
{
return
EnterpriseRestResponse
.
failure
(
user
Response
);
return
EnterpriseRestResponse
.
failure
(
menu
Response
);
}
}
...
...
gic-platform-auth-web/src/main/java/com/gic/auth/web/controller/UserController.java
View file @
6c56d9c7
package
com
.
gic
.
auth
.
web
.
controller
;
import
com.gic.auth.constant.UserConstants
;
import
com.gic.auth.dto.AuthCodeDTO
;
import
com.gic.auth.service.AuthCodeApiService
;
import
com.gic.auth.web.vo.LoginUserVO
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.enterprise.utils.CreateRandomUtils
;
import
com.gic.marketing.process.api.service.sms.SmsSendApiService
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.log4j.LogManager
;
...
...
@@ -34,6 +39,8 @@ public class UserController {
private
UserApiService
userApiService
;
@Autowired
private
SmsSendApiService
smsSendApiService
;
@Autowired
private
AuthCodeApiService
authCodeApiService
;
@RequestMapping
(
"/save-or-update-user"
)
public
RestResponse
editUser
(
@Validated
({
UserDTO
.
UserQoValid
.
class
})
UserDTO
userDTO
)
{
...
...
@@ -115,6 +122,43 @@ public class UserController {
return
ResultControllerUtils
.
commonResult
(
userApiService
.
pageUser
(
params
));
}
/**
* 个人资料
* @Title: getLoginUser
* @Description:
* @author guojuxing
* @return com.gic.commons.webapi.reponse.RestResponse
*/
@RequestMapping
(
"/get-login-user"
)
public
RestResponse
getLoginUser
()
{
LoginUserVO
vo
=
EntityUtil
.
changeEntityNew
(
LoginUserVO
.
class
,
UserDetailUtils
.
getUserDetail
().
getUserInfo
());
//商户logo
vo
.
setLogo
(
UserDetailUtils
.
getUserDetail
().
getEnterpriseInfo
().
getLogo
());
return
RestResponse
.
success
(
vo
);
}
@RequestMapping
(
"send-auth-code"
)
public
RestResponse
sendAuthCode
(
String
phone
,
String
nationCode
)
{
AuthCodeDTO
authCodeDTO
=
new
AuthCodeDTO
();
authCodeDTO
.
setEnterpriseId
(
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
());
//生成4位数字验证码
authCodeDTO
.
setAuthCode
(
CreateRandomUtils
.
getStringRandom
(
4
));
ServiceResponse
<
Integer
>
result
=
authCodeApiService
.
saveAuth
(
authCodeDTO
);
if
(
result
.
isSuccess
())
{
Integer
authCodeId
=
result
.
getResult
();
//发送手机验证码
String
[]
smsArr
=
new
String
[]{};
ServiceResponse
<
Void
>
smsSendResult
=
smsSendApiService
.
sendPlatformSms
(
"GICpassword001"
,
UserDetailUtils
.
getUserDetail
().
getEnterpriseInfo
().
getEnterpriseId
(),
nationCode
,
phone
,
smsArr
);
if
(!
smsSendResult
.
isSuccess
())
{
return
EnterpriseRestResponse
.
failure
(
smsSendResult
);
}
else
{
return
RestResponse
.
success
(
authCodeId
);
}
}
return
EnterpriseRestResponse
.
failure
(
result
);
}
@RequestMapping
(
"/list-user-nopage"
)
public
RestResponse
listUserNoPage
(
UserListQO
params
)
{
params
.
setEnterpriseId
(
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
());
...
...
gic-platform-auth-web/src/main/java/com/gic/auth/web/vo/LoginUserVO.java
0 → 100644
View file @
6c56d9c7
package
com
.
gic
.
auth
.
web
.
vo
;
import
java.io.Serializable
;
/**
* 登录用户的个人信息
* @ClassName: LoginUserVO
* @Description:
* @author guojuxing
* @date 2019/11/15 1:57 PM
*/
public
class
LoginUserVO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
8950007139503351315L
;
/**
* 用户id
*/
private
Integer
userId
;
/**
* 用户名
*/
private
String
userName
;
/**
* 手机号码
*/
private
String
phoneNumber
;
/**
* 国际区号,如中国 86
*/
private
String
phoneAreaCode
;
private
String
logo
;
public
Integer
getUserId
()
{
return
userId
;
}
public
void
setUserId
(
Integer
userId
)
{
this
.
userId
=
userId
;
}
public
String
getUserName
()
{
return
userName
;
}
public
void
setUserName
(
String
userName
)
{
this
.
userName
=
userName
;
}
public
String
getPhoneNumber
()
{
return
phoneNumber
;
}
public
void
setPhoneNumber
(
String
phoneNumber
)
{
this
.
phoneNumber
=
phoneNumber
;
}
public
String
getPhoneAreaCode
()
{
return
phoneAreaCode
;
}
public
void
setPhoneAreaCode
(
String
phoneAreaCode
)
{
this
.
phoneAreaCode
=
phoneAreaCode
;
}
public
String
getLogo
()
{
return
logo
;
}
public
void
setLogo
(
String
logo
)
{
this
.
logo
=
logo
;
}
}
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