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
349978d3
Commit
349978d3
authored
May 28, 2020
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
微盟商城回调
parent
71a356a9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
6 deletions
+28
-6
WmMallStoreController.java
...c/enterprise/web/controller/wm/WmMallStoreController.java
+27
-6
dubbo-gic-platform-enterprise-web.xml
.../src/main/resources/dubbo-gic-platform-enterprise-web.xml
+1
-0
No files found.
gic-platform-enterprise-web/src/main/java/com/gic/enterprise/web/controller/wm/WmMallStoreController.java
View file @
349978d3
...
...
@@ -5,8 +5,12 @@ import java.util.*;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
import
com.gic.enterprise.base.UserInfo
;
import
com.gic.enterprise.error.ErrorCode
;
import
com.gic.goods.pump.api.service.WeiMobGoodsService
;
import
com.gic.member.config.api.enums.OrderPointCalculationPartyEnum
;
import
com.gic.member.config.api.service.OrderPointCalculationPartyApiService
;
import
com.gic.redis.data.util.RedisUtil
;
import
com.gic.weimob.api.service.WeimobBaseService
;
import
com.gic.weimob.api.service.WeimobMemberService
;
import
org.apache.commons.collections.CollectionUtils
;
...
...
@@ -57,10 +61,14 @@ public class WmMallStoreController {
private
WeimobBaseService
weimobBaseService
;
@Autowired
private
WeiMobGoodsService
weiMobGoodsService
;
@Autowired
private
OrderPointCalculationPartyApiService
orderPointCalculationPartyApiService
;
@RequestMapping
(
"/save-wm-store"
)
public
RestResponse
save
(
WmStoreDTO
dto
)
{
dto
.
setEnterpriseId
(
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
());
UserInfo
userInfo
=
UserDetailUtils
.
getUserDetail
().
getUserInfo
();
Integer
enterpriseId
=
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
();
dto
.
setEnterpriseId
(
enterpriseId
);
ServiceResponse
<
Integer
>
result
=
wmStoreApiService
.
saveWmStore
(
dto
);
if
(
result
.
isSuccess
())
{
//创建微盟gic关联
...
...
@@ -69,6 +77,10 @@ public class WmMallStoreController {
dto
.
getWmMainAccount
(),
Long
.
valueOf
(
dto
.
getWmPid
()),
Long
.
valueOf
(
dto
.
getWmStoreId
()),
MallModeEnum
.
mapToWm
(
dto
.
getMallMode
()));
LOGGER
.
info
(
"微盟商城店铺-微盟结果:{}"
,
JSON
.
toJSONString
(
saveStoreInfo
));
ServiceResponse
<
Void
>
response
=
orderPointCalculationPartyApiService
.
saveOrderPointCalculationParty
(
enterpriseId
,
Long
.
valueOf
(
result
.
getResult
()),
dto
.
getWmPidName
(),
userInfo
.
getUserId
(),
userInfo
.
getUserName
(),
OrderPointCalculationPartyEnum
.
WEIMO
.
getCode
());
LOGGER
.
info
(
"微盟商城店铺-会员组初始化结果:{}"
,
JSON
.
toJSONString
(
response
));
}
return
OperationResultUtils
.
operationResult
(
result
,
OperationResultUtils
.
LOG_NEW
+
"微盟商城店铺"
,
dto
.
getWmPidName
());
...
...
@@ -145,7 +157,10 @@ public class WmMallStoreController {
ServiceResponse
<
String
>
response
=
weimobMerchantService
.
getAuthUrl
();
if
(
response
.
isSuccess
())
{
String
authUrl
=
response
.
getResult
();
String
mainHost
=
DomainUtils
.
getCurrentDomain
()
+
"/wm-mall-store/auth-callback?wmMallStoreId="
+
wmMallStoreId
;
String
mainHost
=
DomainUtils
.
getCurrentDomain
()
+
"/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
());
...
...
@@ -315,20 +330,26 @@ public class WmMallStoreController {
* @param code
*/
@RequestMapping
(
"auth-callback"
)
@ResponseBody
public
void
authCallBack
(
String
code
,
Integer
wmMallStoreId
)
throws
IOException
{
public
void
authCallBack
(
String
code
)
throws
IOException
{
try
{
ServiceResponse
<
Void
>
authWmResponse
=
weimobMerchantService
.
weimobStoreAuth
(
wmMallStoreId
,
code
);
Object
obj
=
RedisUtil
.
getCache
(
"enterprise:wm:auth:"
+
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
());
if
(
obj
==
null
)
{
LOGGER
.
warn
(
"微盟授权-店铺ID缓存不存在"
);
}
ServiceResponse
<
Void
>
authWmResponse
=
weimobMerchantService
.
weimobStoreAuth
((
Integer
)
obj
,
code
);
LOGGER
.
info
(
"微盟中间件返回结果:{}"
,
JSON
.
toJSONString
(
authWmResponse
));
if
(
authWmResponse
.
isSuccess
())
{
//更新gic侧店铺授权状态
ServiceResponse
<
String
>
wmMallStoreResponse
=
wmStoreApiService
.
authWmStore
(
wmMallStoreId
);
ServiceResponse
<
String
>
wmMallStoreResponse
=
wmStoreApiService
.
authWmStore
(
(
Integer
)
obj
);
if
(!
wmMallStoreResponse
.
isSuccess
())
{
LOGGER
.
warn
(
"企业侧微盟店铺授权结果:{}"
,
JSON
.
toJSONString
(
wmMallStoreResponse
));
}
}
}
catch
(
Exception
e
)
{
LOGGER
.
warn
(
"微盟授权返回结果:{}"
,
e
.
getMessage
(),
e
);
}
finally
{
//清空缓存
RedisUtil
.
delCache
(
"enterprise:wm:auth:"
+
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
());
}
}
...
...
gic-platform-enterprise-web/src/main/resources/dubbo-gic-platform-enterprise-web.xml
View file @
349978d3
...
...
@@ -135,4 +135,5 @@
<dubbo:reference
interface=
"com.gic.store.service.ClerkApiService"
id=
"clerkApiService"
timeout=
"60000"
/>
<dubbo:reference
interface=
"com.gic.goods.pump.api.service.WeiMobGoodsService"
id=
"weiMobGoodsService"
timeout=
"60000"
/>
<dubbo:reference
interface=
"com.gic.member.config.api.service.OrderPointCalculationPartyApiService"
id=
"orderPointCalculationPartyApiService"
timeout=
"60000"
/>
</beans>
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