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
da86f32d
Commit
da86f32d
authored
May 20, 2020
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加导购同步微盟队列任务
parent
f56ffbd3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
9 deletions
+39
-9
WmStoreSyncController.java
...c/enterprise/web/controller/wm/WmStoreSyncController.java
+39
-9
No files found.
gic-platform-enterprise-web/src/main/java/com/gic/enterprise/web/controller/wm/WmStoreSyncController.java
View file @
da86f32d
...
...
@@ -130,14 +130,20 @@ public class WmStoreSyncController {
* @param wmMallStoreId 店铺逐渐ID
* @param headStoreId 总店ID
* @param storeIds 分店IDs
* @param isBranch 是否是添加分店入口场景
* @return com.gic.commons.webapi.reponse.RestResponse
*/
@RequestMapping
(
"sync-head-store"
)
public
RestResponse
syncHeadStore
(
Integer
wmMallStoreId
,
Integer
headStoreId
,
String
storeIds
)
{
public
RestResponse
syncHeadStore
(
Integer
wmMallStoreId
,
Integer
headStoreId
,
String
storeIds
,
Boolean
isBranch
)
{
if
(!
validWmMode
(
wmMallStoreId
))
{
return
RestResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"非"
+
MallModeEnum
.
SMART_RETAIL
.
getMsg
()
+
"不能同步门店"
);
}
if
(
isBranch
==
null
)
{
isBranch
=
false
;
}
Integer
enterpriseId
=
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
();
//查询总店
ServiceResponse
<
StoreDTO
>
storeResponse
=
storeApiService
.
getStoreById
(
enterpriseId
,
headStoreId
);
...
...
@@ -161,7 +167,13 @@ public class WmStoreSyncController {
.
addWeimobVirtualStore
(
wmMallStoreId
,
enterpriseId
,
weimobPhysicalStoreDTO
,
subStoreList
);
if
(
wmResult
.
isSuccess
())
{
wmStoreSyncLogApiService
.
saveWmStoreSyncLog
(
Arrays
.
asList
(
headStoreId
),
wmMallStoreId
,
1
,
enterpriseId
);
//todo 同步导购
//同步导购
List
<
Integer
>
storeIdList
=
new
ArrayList
<>();
if
(
isBranch
)
{
storeIdList
.
add
(
headStoreId
);
}
storeIdList
.
addAll
(
getListByStr
(
storeIds
));
clerkApiService
.
syncClerkToWeimob
(
wmMallStoreId
,
storeIdList
,
enterpriseId
);
return
RestResponse
.
success
();
}
return
RestResponse
.
failure
(
wmResult
.
getCode
(),
wmResult
.
getMessage
());
...
...
@@ -273,7 +285,9 @@ public class WmStoreSyncController {
this
.
wmStoreSyncLogApiService
.
saveWmStoreSyncLog
(
wmResult
.
getResult
(),
wmMallStoreId
,
2
,
enterpriseId
);
//todo 导购同步
//导购同步 成功部分门店进行导购同步
clerkApiService
.
syncClerkToWeimob
(
wmMallStoreId
,
wmResult
.
getResult
(),
enterpriseId
);
StringBuilder
errorMessageResult
=
new
StringBuilder
();
List
<
StoreDTO
>
hasSuccessStoreList
=
getStoreList
(
errorIds
.
toString
(),
true
);
hasSuccessStoreList
.
forEach
(
e
->
errorMessageResult
.
append
(
e
.
getRegionId
()
+
"-"
+
e
.
getStoreCode
()).
append
(
...
...
@@ -282,7 +296,8 @@ public class WmStoreSyncController {
}
else
{
this
.
wmStoreSyncLogApiService
.
saveWmStoreSyncLog
(
storeList
.
stream
().
map
(
e
->
e
.
getStoreId
()).
collect
(
Collectors
.
toList
()),
wmMallStoreId
,
2
,
enterpriseId
);
//todo 导购同步
//导购同步
clerkApiService
.
syncClerkToWeimob
(
wmMallStoreId
,
getListByStr
(
storeIds
),
enterpriseId
);
}
return
RestResponse
.
success
();
}
...
...
@@ -481,8 +496,9 @@ public class WmStoreSyncController {
//同步过的记录日志,不能再次同步
this
.
wmStoreSyncLogApiService
.
saveWmStoreSyncLog
(
Arrays
.
asList
(
storeDTO
.
getStoreId
()),
wmMallStoreId
,
2
,
enterpriseId
);
//
todo
导购同步
// 导购同步
rMap
.
put
(
regionName
+
"-"
+
storeCode
,
"微盟侧已存在"
);
clerkApiService
.
syncClerkToWeimob
(
wmMallStoreId
,
Arrays
.
asList
(
storeDTO
.
getStoreId
()),
enterpriseId
);
}
else
{
LOGGER
.
info
(
"实体门店同步到微盟的参数:{}"
,
JSON
.
toJSONString
(
list
));
ServiceResponse
<
List
<
Integer
>>
weimobResult
=
this
.
weimobStoreSiteService
...
...
@@ -498,7 +514,8 @@ public class WmStoreSyncController {
errorMessage
.
put
(
entry
.
getKey
(),
entry
.
getValue
());
}
//todo 导购同步
//因为是一条一条处理,所以失败了,就不会有成功的,不用 导购同步逻辑
List
<
StoreDTO
>
hasSuccessStoreList
=
getStoreList
(
errorIds
.
toString
());
hasSuccessStoreList
.
forEach
(
e
->
rMap
.
put
(
e
.
getRegionId
()
+
"-"
+
e
.
getStoreCode
(),
errorMessage
.
get
(
storeDTO
.
getStoreInfoId
())));
...
...
@@ -507,7 +524,8 @@ public class WmStoreSyncController {
//同步过的记录日志,不能再次同步
this
.
wmStoreSyncLogApiService
.
saveWmStoreSyncLog
(
Arrays
.
asList
(
storeDTO
.
getStoreId
()),
wmMallStoreId
,
2
,
enterpriseId
);
//todo 导购同步
// 导购同步
clerkApiService
.
syncClerkToWeimob
(
wmMallStoreId
,
Arrays
.
asList
(
storeDTO
.
getStoreId
()),
enterpriseId
);
}
}
...
...
@@ -552,8 +570,9 @@ public class WmStoreSyncController {
//新增企业侧日志
this
.
wmStoreSyncLogApiService
.
saveWmStoreSyncLog
(
Arrays
.
asList
(
headerStoreId
),
wmMallStoreId
,
1
,
enterpriseId
);
}
tempStoreId
.
add
(
storeDTO
.
getStoreInfoId
());
//todo 导购同步
tempStoreId
.
add
(
storeDTO
.
getStoreId
());
// 导购同步
clerkApiService
.
syncClerkToWeimob
(
wmMallStoreId
,
tempStoreId
,
enterpriseId
);
}
}
}
...
...
@@ -865,4 +884,15 @@ public class WmStoreSyncController {
}
return
result
;
}
private
static
List
<
Integer
>
getListByStr
(
String
storeIds
)
{
List
<
Integer
>
storeIdList
=
new
ArrayList
<>();
if
(
StringUtils
.
isNotBlank
(
storeIds
))
{
String
[]
arr
=
storeIds
.
split
(
","
);
for
(
String
s
:
arr
){
storeIdList
.
add
(
Integer
.
parseInt
(
s
));
}
}
return
storeIdList
;
}
}
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