Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-platform-enterprise
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-enterprise
Commits
50ea25d4
Commit
50ea25d4
authored
Nov 05, 2020
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
运维后台淡点登录到gic后台sdk
parent
0638cd2a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
75 deletions
+9
-75
pom.xml
gic-platform-operation-web/pom.xml
+5
-0
Main.java
...eration-web/src/main/java/com/gic/operation/web/Main.java
+2
-1
LoginController.java
...ava/com/gic/operation/web/controller/LoginController.java
+2
-74
No files found.
gic-platform-operation-web/pom.xml
View file @
50ea25d4
...
@@ -159,6 +159,11 @@
...
@@ -159,6 +159,11 @@
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
com.gic
</groupId>
<groupId>
com.gic
</groupId>
<artifactId>
gic-enterprise-sso
</artifactId>
<version>
${gic-enterprise-sso}
</version>
</dependency>
<dependency>
<groupId>
com.gic
</groupId>
<artifactId>
gic-platform-finance-api
</artifactId>
<artifactId>
gic-platform-finance-api
</artifactId>
<version>
${gic-platform-finance-api}
</version>
<version>
${gic-platform-finance-api}
</version>
</dependency>
</dependency>
...
...
gic-platform-operation-web/src/main/java/com/gic/operation/web/Main.java
View file @
50ea25d4
...
@@ -27,7 +27,8 @@ import com.gic.dubbo.util.DubboContextUtil;
...
@@ -27,7 +27,8 @@ import com.gic.dubbo.util.DubboContextUtil;
"classpath*:dubbo-setting.xml"
,
"classpath*:dubbo-setting.xml"
,
"classpath*:dubbo-gic-platform-operation-web.xml"
,
"classpath*:dubbo-gic-platform-operation-web.xml"
,
"classpath*:spring-interceptor.xml"
,
"classpath*:spring-interceptor.xml"
,
"classpath*:redis-init.xml"
"classpath*:redis-init.xml"
,
"classpath*:dubbo-gic-enterprise-sso-service.xml"
})
})
@EnableApolloConfig
({
"application"
,
"BUZ.oauth.4.0"
})
@EnableApolloConfig
({
"application"
,
"BUZ.oauth.4.0"
})
@EnableGicOAuth2Sso
@EnableGicOAuth2Sso
...
...
gic-platform-operation-web/src/main/java/com/gic/operation/web/controller/LoginController.java
View file @
50ea25d4
...
@@ -7,6 +7,7 @@ import java.util.stream.Collectors;
...
@@ -7,6 +7,7 @@ import java.util.stream.Collectors;
import
com.ctrip.framework.apollo.Config
;
import
com.ctrip.framework.apollo.Config
;
import
com.ctrip.framework.apollo.ConfigService
;
import
com.ctrip.framework.apollo.ConfigService
;
import
com.gic.redis.data.util.RedisUtil
;
import
com.gic.redis.data.util.RedisUtil
;
import
com.gic.sso.utils.LoginGicSsoUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.LogManager
;
...
@@ -60,7 +61,6 @@ public class LoginController {
...
@@ -60,7 +61,6 @@ public class LoginController {
private
static
final
String
MENU_LOCAL_CACHE_KEY
=
"auth:menu:list:all"
;
private
static
final
String
MENU_LOCAL_CACHE_KEY
=
"auth:menu:list:all"
;
/**
/**
* 商户绑定服务市场
* 商户绑定服务市场
* @Title: bind
* @Title: bind
...
@@ -102,79 +102,7 @@ public class LoginController {
...
@@ -102,79 +102,7 @@ public class LoginController {
@RequestMapping
(
"login-gic"
)
@RequestMapping
(
"login-gic"
)
public
RestResponse
login
(
Integer
enterpriseId
,
String
redirectUrl
)
throws
IOException
{
public
RestResponse
login
(
Integer
enterpriseId
,
String
redirectUrl
)
throws
IOException
{
long
startTime
=
System
.
currentTimeMillis
();
return
RestResponse
.
success
(
LoginGicSsoUtils
.
sso
(
enterpriseId
,
redirectUrl
));
String
nameSpace
=
"COMMON.4.0-gic-properties"
;
Config
config
=
ConfigService
.
getConfig
(
nameSpace
);
String
url
=
config
.
getProperty
(
"service_host"
,
""
).
replace
(
"/gic"
,
""
);
if
(
StringUtils
.
isBlank
(
redirectUrl
))
{
redirectUrl
=
url
+
"/damo-system"
;
// redirectUrl = "https://four.gicdev.com/cost-center/billing-center/overview";
}
String
token
;
UserDetailsVO
userDetailsVO
=
UserUtils
.
getUser
();
String
phone
=
userDetailsVO
.
getUserMobile
();
//运营人员国内,默认数据
ServiceResponse
<
UserDTO
>
userResult
=
userApiService
.
getUserByPhoneNumber
(
Constants
.
NATION_CODE
,
phone
,
enterpriseId
);
if
(
userResult
.
isSuccess
())
{
//获取运营实施信息
UserDTO
user
=
userResult
.
getResult
();
if
(
user
==
null
)
{
//新建运营实施账号
UserDTO
temp
=
new
UserDTO
();
temp
.
setEnterpriseId
(
enterpriseId
);
temp
.
setPhoneNumber
(
phone
);
temp
.
setUserName
(
userDetailsVO
.
getRealName
());
temp
.
setPhoneAreaCode
(
Constants
.
NATION_CODE
);
temp
.
setSuperAdmin
(
1
);
temp
.
setLoginType
(
1
);
ServiceResponse
<
Integer
>
saveResult
=
userApiService
.
saveOperationUser
(
temp
);
user
=
temp
;
user
.
setUserId
(
saveResult
.
getResult
());
}
else
{
//更新运营人名称
if
(!
user
.
getUserName
().
equals
(
userDetailsVO
.
getRealName
()))
{
userApiService
.
updateOperationUser
(
user
.
getUserId
(),
userDetailsVO
.
getRealName
());
}
}
//gic用户信息塞入
UserDetail
userDetail
=
new
UserDetail
();
//设置登录用户信息
userDetail
.
setUserId
(
user
.
getUserId
());
userDetail
.
setUserInfo
(
EntityUtil
.
changeEntityNew
(
UserInfo
.
class
,
user
));
//设置企业资料
ServiceResponse
<
EnterpriseDTO
>
enterprise
=
this
.
enterpriseApiService
.
getEnterpriseById
(
enterpriseId
);
if
(
enterprise
.
isSuccess
())
{
EnterpriseDTO
enterpriseDTO
=
enterprise
.
getResult
();
if
(
enterpriseDTO
!=
null
)
{
userDetail
.
setEnterpriseInfo
(
EntityUtil
.
changeEntityNew
(
EnterpriseInfo
.
class
,
enterpriseDTO
));
}
//设置权限
ServiceResponse
<
List
<
MenuDTO
>>
menuResult
=
menuApiService
.
listUserMenu
(
user
.
getUserId
(),
enterpriseDTO
.
getVersionCode
());
if
(
menuResult
.
isSuccess
())
{
List
<
MenuDTO
>
menuList
=
menuResult
.
getResult
();
Set
<
Integer
>
menuIdSet
=
new
HashSet
<>(
2
);
if
(
CollectionUtils
.
isNotEmpty
(
menuList
))
{
menuIdSet
=
menuList
.
stream
().
filter
(
e
->
StringUtils
.
isNotBlank
(
e
.
getMenuUrl
()))
.
map
(
e
->
e
.
getMenuId
()).
collect
(
Collectors
.
toSet
());
}
//塞用户权限菜单值
userDetail
.
setMenuIdSet
(
menuIdSet
);
//塞本地缓存
setAllMenuToLocaleCache
();
}
}
//塞缓存
token
=
UserDetailUtils
.
setUserDetail
(
userDetail
);
LOGGER
.
info
(
"单点登录所花时间:{}"
,
System
.
currentTimeMillis
()
-
startTime
);
String
ssoLoginUrl
=
url
+
"/gic-auth-web/login-for-operation"
;
return
RestResponse
.
success
(
ssoLoginUrl
+
"?token="
+
token
+
"&redirectUrl="
+
redirectUrl
);
}
return
RestResponse
.
success
();
}
}
/**
/**
...
...
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