Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-store
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-store
Commits
5d1e0bec
Commit
5d1e0bec
authored
Feb 03, 2021
by
陶光胜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
门店会员转移
parent
a4895e8d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
5 deletions
+55
-5
StoreBrandChangeDTO.java
.../src/main/java/com/gic/store/dto/StoreBrandChangeDTO.java
+34
-0
StoreApiServiceImpl.java
...com/gic/store/service/outer/impl/StoreApiServiceImpl.java
+21
-5
No files found.
gic-store-api/src/main/java/com/gic/store/dto/StoreBrandChangeDTO.java
0 → 100644
View file @
5d1e0bec
package
com
.
gic
.
store
.
dto
;
import
java.io.Serializable
;
import
java.util.List
;
public
class
StoreBrandChangeDTO
implements
Serializable
{
private
List
<
Integer
>
add
;
private
List
<
Integer
>
del
;
private
boolean
change
=
false
;
public
List
<
Integer
>
getAdd
()
{
return
add
;
}
public
void
setAdd
(
List
<
Integer
>
add
)
{
this
.
add
=
add
;
}
public
List
<
Integer
>
getDel
()
{
return
del
;
}
public
void
setDel
(
List
<
Integer
>
del
)
{
this
.
del
=
del
;
}
public
boolean
isChange
()
{
return
change
;
}
public
void
setChange
(
boolean
change
)
{
this
.
change
=
change
;
}
}
gic-store-service/src/main/java/com/gic/store/service/outer/impl/StoreApiServiceImpl.java
View file @
5d1e0bec
...
...
@@ -44,7 +44,10 @@ import com.gic.weimob.api.dto.WeimobPhysicalStoreDTO;
import
com.gic.weimob.api.dto.WeimobStoreAccountDTO
;
import
com.gic.weimob.api.service.WeimobStoreSiteApiService
;
import
com.google.common.base.Joiner
;
import
com.google.common.collect.MapDifference
;
import
com.google.common.collect.Maps
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
...
...
@@ -197,7 +200,7 @@ public class StoreApiServiceImpl implements StoreApiService {
// 记录门店日志
saveAddLog
(
storeDTO
);
}
else
{
boolean
hasChangeBrand
=
checkBrandHasChange
(
storeDTO
.
getBrandIds
(),
storeDTO
.
getStoreId
(),
storeDTO
.
getEnterpriseId
());
StoreBrandChangeDTO
storeBrandChangeDTO
=
checkBrandHasChange
(
storeDTO
.
getBrandIds
(),
storeDTO
.
getStoreId
(),
storeDTO
.
getEnterpriseId
());
String
lock
=
"lock:"
+
storeDTO
.
getEnterpriseId
()
+
":"
+
storeDTO
.
getStoreId
();
RedisUtil
.
lock
(
lock
,
500
l
,
TimeUnit
.
MILLISECONDS
,
500
l
);
try
{
...
...
@@ -208,7 +211,7 @@ public class StoreApiServiceImpl implements StoreApiService {
if
(
update
==
0
)
{
return
ServiceResponse
.
failure
(
ErrorCode
.
NOTEXISTS
.
getCode
(),
ErrorCode
.
NOTEXISTS
.
getMsg
());
}
if
(
hasChangeBrand
){
if
(
storeBrandChangeDTO
.
isChange
()
){
//调用归属重算
this
.
storeUpdateApiService
.
storeBrandChange
(
storeDTO
.
getEnterpriseId
(),
Collections
.
singletonList
(
storeDTO
.
getStoreInfoId
()),
storeDTO
.
getOperatorId
());
logger
.
info
(
"调用会员接口进行归属重算, {}"
,
storeDTO
.
getStoreInfoId
());
...
...
@@ -569,14 +572,27 @@ public class StoreApiServiceImpl implements StoreApiService {
return
null
;
}
private
boolean
checkBrandHasChange
(
String
brandIds
,
Integer
storeId
,
Integer
enterpriseId
){
private
StoreBrandChangeDTO
checkBrandHasChange
(
String
brandIds
,
Integer
storeId
,
Integer
enterpriseId
){
StoreBrandChangeDTO
storeBrandChangeDTO
=
new
StoreBrandChangeDTO
();
StoreDTO
result
=
this
.
getStoreById
(
enterpriseId
,
storeId
).
getResult
();
if
(
result
!=
null
){
if
(
brandIds
.
equals
(
result
.
getBrandIds
())){
return
false
;
return
storeBrandChangeDTO
;
}
}
return
true
;
storeBrandChangeDTO
.
setChange
(
true
);
Map
<
String
,
String
>
newBrandIdMap
=
Arrays
.
stream
(
brandIds
.
split
(
","
)).
collect
(
Collectors
.
toMap
(
id
->
id
,
id
->
id
));
Map
<
String
,
String
>
oldBrandIdMap
=
Arrays
.
stream
(
result
.
getBrandIds
().
split
(
","
)).
collect
(
Collectors
.
toMap
(
id
->
id
,
id
->
id
));
MapDifference
<
String
,
String
>
difference
=
Maps
.
difference
(
newBrandIdMap
,
oldBrandIdMap
);
Map
<
String
,
String
>
add
=
difference
.
entriesOnlyOnLeft
();
Map
<
String
,
String
>
del
=
difference
.
entriesOnlyOnRight
();
if
(
MapUtils
.
isNotEmpty
(
add
)){
storeBrandChangeDTO
.
setAdd
(
add
.
keySet
().
stream
().
map
(
s
->
Integer
.
valueOf
(
s
)).
collect
(
Collectors
.
toList
()));
}
if
(
MapUtils
.
isNotEmpty
(
del
)){
storeBrandChangeDTO
.
setDel
(
del
.
keySet
().
stream
().
map
(
s
->
Integer
.
valueOf
(
s
)).
collect
(
Collectors
.
toList
()));
}
return
storeBrandChangeDTO
;
}
private
void
refreshIndex
(
Integer
storeId
,
Integer
enterpriseId
)
{
...
...
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