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
451589be
Commit
451589be
authored
May 28, 2020
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
微盟授权加日志
parent
a1edd21f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
14 deletions
+4
-14
WmMallStoreController.java
...c/enterprise/web/controller/wm/WmMallStoreController.java
+4
-14
No files found.
gic-platform-enterprise-web/src/main/java/com/gic/enterprise/web/controller/wm/WmMallStoreController.java
View file @
451589be
...
...
@@ -154,13 +154,11 @@ public class WmMallStoreController {
@RequestMapping
(
"/get-auth-url"
)
public
RestResponse
getAuthUrl
(
Integer
wmMallStoreId
)
{
//
ServiceResponse
<
String
>
response
=
weimobMerchantService
.
getAuthUrl
();
ServiceResponse
<
String
>
response
=
weimobMerchantService
.
getAuthUrl
(
wmMallStoreId
);
if
(
response
.
isSuccess
())
{
String
authUrl
=
response
.
getResult
();
String
mainHost
=
DomainUtils
.
getCurrentDomain
()
+
"/gic-enterprise-web/wm-mall-store/auth-callback"
;
//为了授权回调取用的店铺主键ID
RedisUtil
.
setCache
(
"enterprise:wm:auth:"
+
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
(),
wmMallStoreId
);
return
RestResponse
.
success
(
authUrl
+
"&redirect_uri="
+
mainHost
);
}
else
{
return
RestResponse
.
failure
(
response
.
getCode
(),
response
.
getMessage
());
...
...
@@ -374,17 +372,13 @@ public class WmMallStoreController {
* @param code
*/
@RequestMapping
(
"auth-callback"
)
public
RestResponse
authCallBack
(
String
code
)
throws
IOException
{
Object
obj
=
RedisUtil
.
getCache
(
"enterprise:wm:auth:"
+
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
());
public
RestResponse
authCallBack
(
String
code
,
Integer
state
)
throws
IOException
{
try
{
if
(
obj
==
null
)
{
return
RestResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"微盟授权-店铺ID缓存不存在"
);
}
ServiceResponse
<
Void
>
authWmResponse
=
weimobMerchantService
.
weimobStoreAuth
((
Integer
)
obj
,
code
);
ServiceResponse
<
Void
>
authWmResponse
=
weimobMerchantService
.
weimobStoreAuth
(
state
,
code
);
LOGGER
.
info
(
"微盟中间件返回结果:{}"
,
JSON
.
toJSONString
(
authWmResponse
));
if
(
authWmResponse
.
isSuccess
())
{
//更新gic侧店铺授权状态
ServiceResponse
<
String
>
wmMallStoreResponse
=
wmStoreApiService
.
authWmStore
(
(
Integer
)
obj
);
ServiceResponse
<
String
>
wmMallStoreResponse
=
wmStoreApiService
.
authWmStore
(
state
);
if
(!
wmMallStoreResponse
.
isSuccess
())
{
LOGGER
.
warn
(
"企业侧微盟店铺授权结果:{}"
,
JSON
.
toJSONString
(
wmMallStoreResponse
));
}
...
...
@@ -394,10 +388,6 @@ public class WmMallStoreController {
}
catch
(
Exception
e
)
{
LOGGER
.
warn
(
"微盟授权返回结果:{}"
,
e
.
getMessage
(),
e
);
return
RestResponse
.
failure
(
ErrorCode
.
SYSTEM_ERROR
.
getCode
(),
e
.
getMessage
());
}
finally
{
//清空缓存
LOGGER
.
warn
(
"微盟授权-缓存:{}"
,
obj
);
RedisUtil
.
delCache
(
"enterprise:wm:auth:"
+
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
());
}
}
...
...
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