Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-platform-message
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-message
Commits
f8f68720
Commit
f8f68720
authored
Feb 09, 2021
by
陶光胜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
门店变更
parent
ff678a35
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
10 deletions
+23
-10
StoreMessageHandler.java
...ava/com/gic/message/service/impl/StoreMessageHandler.java
+23
-10
No files found.
src/main/java/com/gic/message/service/impl/StoreMessageHandler.java
View file @
f8f68720
...
...
@@ -38,6 +38,8 @@ public class StoreMessageHandler implements MessageHandler {
public
static
final
String
NEW_STATUS
=
"new_status"
;
public
static
final
String
NEW_OWN_TYPE
=
"new_own_type"
;
public
static
final
Integer
NEW_STATUS_VALUE
=
2
;
private
static
final
String
OLD_DELETE_FLAG
=
"old_delete_flag"
;
private
static
final
String
NEW_DELETE_FALG
=
"new_delete_flag"
;
@Autowired
private
StoreApiService
storeApiService
;
...
...
@@ -69,16 +71,13 @@ public class StoreMessageHandler implements MessageHandler {
enterpriseId
=
Integer
.
valueOf
(
fieldMap
.
get
(
"new_enterprise_id"
).
getValue
());
storeId
=
Integer
.
valueOf
(
fieldMap
.
get
(
"new_store_id"
).
getValue
());
storeInfoId
=
Integer
.
valueOf
(
fieldMap
.
get
(
"new_store_info_id"
).
getValue
());
if
(
Integer
.
valueOf
(
fieldMap
.
get
(
OLD_
STATUS
).
getValue
())
==
1
&&
Integer
.
valueOf
(
fieldMap
.
get
(
NEW_STATUS
).
getValue
())
==
0
)
{
//删除
if
(
Integer
.
valueOf
(
fieldMap
.
get
(
OLD_
DELETE_FLAG
).
getValue
())
==
0
&&
Integer
.
valueOf
(
fieldMap
.
get
(
NEW_DELETE_FALG
).
getValue
())
==
1
)
{
//删除
this
.
storeApiService
.
deleteStoreFromEs
(
enterpriseId
,
storeId
);
}
else
if
(
Integer
.
valueOf
(
fieldMap
.
get
(
OLD_STATUS
).
getValue
())
==
1
&&
Integer
.
valueOf
(
fieldMap
.
get
(
NEW_STATUS
).
getValue
()).
equals
(
NEW_STATUS_VALUE
)){
//下线
//todo 通知会员组(积分成本转移)
}
else
{
//todo 刷新es改为同步
this
.
storeIndexRefreshHandler
.
refreshStoreIndex
(
enterpriseId
,
storeId
);
}
if
(
StoreOwnTypeEnum
.
OWNER
.
getCode
()
==
Integer
.
valueOf
(
fieldMap
.
get
(
NEW_OWN_TYPE
).
getValue
()))
{
this
.
dealStoreChange
(
enterpriseId
,
storeId
,
storeInfoId
,
GicRecordType
.
UPDATE
.
value
());
}
this
.
dealStoreChange
(
enterpriseId
,
storeId
,
storeInfoId
,
GicRecordType
.
UPDATE
.
value
());
}
if
(
GicRecordType
.
DELETE
.
value
()
==
value
.
getRecordType
().
value
()){
enterpriseId
=
Integer
.
valueOf
(
fieldMap
.
get
(
"enterprise_id"
).
getValue
());
...
...
@@ -93,6 +92,11 @@ public class StoreMessageHandler implements MessageHandler {
}
private
void
dealStoreChange
(
Integer
enterpriseId
,
Integer
storeId
,
Integer
storeInfoId
,
int
recordType
){
/****
* 1 判断当前门店是否在联合商户资源组中 存在 判断联合商户中是否存在 不存在需要进行同步
* 2 判断当前门店是否在联合商户资源组中 不存在 判断联合商户中是否存在 存在需要进行取消同步
* ****/
ServiceResponse
<
List
<
UnionEnterpriseResourceDTO
>>
resourceResponse
=
this
.
unionEnterpriseApiService
.
listStoreResourceByEnterpriseId
(
enterpriseId
);
if
(
CollectionUtils
.
isNotEmpty
(
resourceResponse
.
getResult
())){
for
(
UnionEnterpriseResourceDTO
dto
:
resourceResponse
.
getResult
()){
...
...
@@ -107,11 +111,19 @@ public class StoreMessageHandler implements MessageHandler {
storeSearchDTO
.
setStoreIds
(
String
.
valueOf
(
storeId
));
storeSearchDTO
.
setSearchJson
(
storeWidgetDTO
.
getSearchParam
());
storeSearchDTO
.
setEnterpriseId
(
enterpriseId
);
ServiceResponse
<
Page
<
StoreDTO
>>
response
=
this
.
storeApiService
.
listStore
(
storeSearchDTO
,
1
,
1
);
if
(!
response
.
isSuccess
()){
continue
;
Long
count
=
this
.
storeApiService
.
queryStoreCountFromEs
(
storeSearchDTO
).
getResult
();
boolean
ownExist
=
count
>
0
?
true
:
false
;
Integer
unionEnterpriseId
=
1
;
storeSearchDTO
.
setEnterpriseId
(
unionEnterpriseId
);
count
=
this
.
storeApiService
.
queryStoreCountFromEs
(
storeSearchDTO
).
getResult
();
boolean
unionExist
=
count
>
0
?
true
:
false
;
if
(
ownExist
&&
!
unionExist
){
//todo 进行联合同步 记录表更日志
}
if
(
CollectionUtils
.
isNotEmpty
(
response
.
getResult
().
getResult
())){
if
(!
ownExist
&&
unionExist
){
//// TODO: 2021/2/9 取消授权 记录表更日志
}
if
(
count
>
0
){
if
(
GicRecordType
.
DELETE
.
value
()
==
recordType
){
this
.
storeAuthorizationApiService
.
cancelStore
(
storeInfoId
,
dto
.
getUnionEnterpriseId
());
}
else
{
...
...
@@ -124,6 +136,7 @@ public class StoreMessageHandler implements MessageHandler {
}
else
{
this
.
storeAuthorizationApiService
.
cancelStore
(
storeInfoId
,
dto
.
getUnionEnterpriseId
());
}
}
}
}
...
...
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