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
bbeb5727
Commit
bbeb5727
authored
May 20, 2020
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
总店ID查询分店
parent
da86f32d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
100 additions
and
1 deletions
+100
-1
WmStoreSyncController.java
...c/enterprise/web/controller/wm/WmStoreSyncController.java
+48
-1
WmBranchVO.java
...rc/main/java/com/gic/enterprise/web/vo/wm/WmBranchVO.java
+52
-0
No files found.
gic-platform-enterprise-web/src/main/java/com/gic/enterprise/web/controller/wm/WmStoreSyncController.java
View file @
bbeb5727
...
...
@@ -11,6 +11,9 @@ import java.util.stream.Collectors;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.enterprise.web.vo.wm.WmBranchVO
;
import
com.gic.weimob.api.dto.WeimobStoreGicInfoDTO
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.lang.StringUtils
;
...
...
@@ -89,6 +92,37 @@ public class WmStoreSyncController {
*/
private
static
final
String
STORE_BRANCH_REDIS_KEY
=
"enterprise:weimob4:init:branch:"
;
@RequestMapping
(
"list-store"
)
public
RestResponse
listStore
(
StoreSearchDTO
storeSearchDTO
)
{
//todo 过滤已同步过的门店
return
ResultControllerUtils
.
commonResult
(
storeApiService
.
listStore
(
storeSearchDTO
,
0
,
1000
));
}
/**
* 查询分店
* @param wmMallStoreId
* @param storeId
* @return
*/
@RequestMapping
(
"list-sub-by-store-code"
)
public
RestResponse
listSubByStoreCode
(
Integer
wmMallStoreId
,
Integer
storeId
)
{
StoreDTO
storeDTO
=
getByStoreId
(
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
(),
storeId
);
if
(
storeDTO
==
null
)
{
return
RestResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"门店不存在"
);
}
List
<
StoreDTO
>
list
=
getStoreList
(
storeDTO
.
getStoreInfoId
().
toString
(),
true
);
Map
<
String
,
String
>
map
=
list
.
stream
().
collect
(
Collectors
.
toMap
(
e
->
e
.
getStoreInfoId
().
toString
(),
StoreDTO:
:
getStoreName
));
ServiceResponse
<
List
<
WeimobStoreGicInfoDTO
>>
result
=
weimobStoreSiteService
.
listStoreId
(
wmMallStoreId
,
storeDTO
.
getStoreInfoId
());
if
(
result
.
isSuccess
())
{
List
<
WeimobStoreGicInfoDTO
>
subStoreList
=
result
.
getResult
();
if
(
CollectionUtils
.
isNotEmpty
(
subStoreList
))
{
List
<
WmBranchVO
>
voList
=
EntityUtil
.
changeEntityListNew
(
WmBranchVO
.
class
,
subStoreList
);
voList
.
forEach
(
vo
->
vo
.
setStoreName
(
map
.
get
(
vo
.
getStoreInfoId
().
toString
())));
return
RestResponse
.
success
(
voList
);
}
}
return
RestResponse
.
success
();
}
/**
*
...
...
@@ -208,9 +242,14 @@ public class WmStoreSyncController {
if
(
storeId
==
null
)
{
return
RestResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"参数为空"
);
}
StoreDTO
storeDTO
=
getByStoreId
(
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
(),
storeId
);
if
(
storeDTO
==
null
)
{
return
RestResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"门店不存在"
);
}
wmStoreSyncLogApiService
.
deleteLogic
(
storeId
,
wmMallStoreId
);
ServiceResponse
<
Void
>
weimobResult
=
weimobStoreSiteService
.
deleteStoreRel
(
wmMallStoreId
,
store
Id
);
ServiceResponse
<
Void
>
weimobResult
=
weimobStoreSiteService
.
deleteStoreRel
(
wmMallStoreId
,
store
DTO
.
getStoreInfoId
()
);
LOGGER
.
info
(
"微盟中间件删除门店关联关系结果:{}"
,
JSON
.
toJSONString
(
weimobResult
));
if
(!
weimobResult
.
isSuccess
())
{
return
RestResponse
.
failure
(
weimobResult
.
getCode
(),
weimobResult
.
getMessage
());
...
...
@@ -895,4 +934,12 @@ public class WmStoreSyncController {
}
return
storeIdList
;
}
private
StoreDTO
getByStoreId
(
Integer
enterpriseId
,
Integer
storeId
)
{
ServiceResponse
<
StoreDTO
>
response
=
storeApiService
.
getStoreById
(
enterpriseId
,
storeId
);
if
(
response
.
isSuccess
())
{
return
response
.
getResult
();
}
return
null
;
}
}
gic-platform-enterprise-web/src/main/java/com/gic/enterprise/web/vo/wm/WmBranchVO.java
0 → 100644
View file @
bbeb5727
package
com
.
gic
.
enterprise
.
web
.
vo
.
wm
;
import
java.io.Serializable
;
import
java.util.Date
;
public
class
WmBranchVO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
2272635530786898016L
;
private
Integer
storeInfoId
;
private
String
storeCode
;
private
Date
time
;
private
String
storeName
;
public
Integer
getStoreInfoId
()
{
return
storeInfoId
;
}
public
WmBranchVO
setStoreInfoId
(
Integer
storeInfoId
)
{
this
.
storeInfoId
=
storeInfoId
;
return
this
;
}
public
String
getStoreCode
()
{
return
storeCode
;
}
public
WmBranchVO
setStoreCode
(
String
storeCode
)
{
this
.
storeCode
=
storeCode
;
return
this
;
}
public
Date
getTime
()
{
return
time
;
}
public
WmBranchVO
setTime
(
Date
time
)
{
this
.
time
=
time
;
return
this
;
}
public
String
getStoreName
()
{
return
storeName
;
}
public
WmBranchVO
setStoreName
(
String
storeName
)
{
this
.
storeName
=
storeName
;
return
this
;
}
}
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