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
6e9463ac
Commit
6e9463ac
authored
Mar 26, 2020
by
陶光胜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
门店保存修改
parent
35f5302d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
42 deletions
+46
-42
StoreDictApiServiceImpl.java
...gic/store/service/outer/impl/StoreDictApiServiceImpl.java
+46
-42
No files found.
gic-store-service/src/main/java/com/gic/store/service/outer/impl/StoreDictApiServiceImpl.java
View file @
6e9463ac
...
...
@@ -179,53 +179,57 @@ public class StoreDictApiServiceImpl implements StoreDictApiService {
List
<
String
>
newList
=
Arrays
.
asList
(
values
.
split
(
","
));
List
<
String
>
add
=
newList
.
stream
().
filter
(
s
->
!
existList
.
contains
(
s
)).
collect
(
Collectors
.
toList
());
List
<
String
>
del
=
existList
.
stream
().
filter
(
s
->
!
newList
.
contains
(
s
)).
collect
(
Collectors
.
toList
());
add
.
forEach
(
s
->
{
TabStoreField
tabStoreField
=
this
.
storeFieldService
.
getStoreFieldById
(
Integer
.
valueOf
(
s
));
if
(
tabStoreField
.
getStoreFieldType
()
!=
null
&&
tabStoreField
.
getStoreFieldType
().
intValue
()
==
1
){
return
;
}
TabStoreDict
tabStoreDict
=
new
TabStoreDict
();
tabStoreDict
.
setEnterpriseId
(
enterpriseId
);
tabStoreDict
.
setCreateTime
(
new
Date
());
tabStoreDict
.
setValue
(
s
);
this
.
storeDictService
.
saveStoreField
(
tabStoreDict
);
String
key
=
StoreRedisKeyUtils
.
getStoreFieldKey
(
enterpriseId
,
Integer
.
valueOf
(
s
));
Object
existObj
=
RedisUtil
.
getCache
(
key
);
if
(
existObj
==
null
){
for
(
int
i
=
1
;
i
<=
10
;
i
++){
Object
obj
=
RedisUtil
.
getCache
(
keyc
+
"c"
+
i
);
if
(
obj
==
null
){
RedisUtil
.
setCache
(
keyc
+
"c"
+
i
,
s
);
RedisUtil
.
setCache
(
key
,
"c"
+
i
);
break
;
}
if
(
CollectionUtils
.
isNotEmpty
(
add
)){
add
.
forEach
(
s
->
{
TabStoreField
tabStoreField
=
this
.
storeFieldService
.
getStoreFieldById
(
Integer
.
valueOf
(
s
));
if
(
tabStoreField
.
getStoreFieldType
()
!=
null
&&
tabStoreField
.
getStoreFieldType
().
intValue
()
==
1
){
return
;
}
}
});
del
.
forEach
(
s
->
{
String
key
=
StoreRedisKeyUtils
.
getStoreFieldKey
(
enterpriseId
,
Integer
.
valueOf
(
s
));
this
.
storeDictService
.
deleteStoreField
(
enterpriseId
,
s
);
Object
c
=
RedisUtil
.
getCache
(
key
);
String
storeListSourceKey
=
StoreRedisKeyUtils
.
getStoreListSourceKey
(
enterpriseId
,
userId
);
if
(
c
!=
null
){
RedisUtil
.
delCache
(
c
.
toString
());
//门店列表自定义字段配置,取消时需要删除当前已经配置的列表显示字段
Object
storeListSource
=
RedisUtil
.
getCache
(
storeListSourceKey
);
if
(
storeListSource
!=
null
){
String
[]
arr
=
storeListSource
.
toString
().
split
(
","
);
String
result
=
""
;
for
(
String
a
:
arr
){
if
(!
c
.
toString
().
equals
(
a
)){
result
+=
a
+
","
;
TabStoreDict
tabStoreDict
=
new
TabStoreDict
();
tabStoreDict
.
setEnterpriseId
(
enterpriseId
);
tabStoreDict
.
setCreateTime
(
new
Date
());
tabStoreDict
.
setValue
(
s
);
this
.
storeDictService
.
saveStoreField
(
tabStoreDict
);
String
key
=
StoreRedisKeyUtils
.
getStoreFieldKey
(
enterpriseId
,
Integer
.
valueOf
(
s
));
Object
existObj
=
RedisUtil
.
getCache
(
key
);
if
(
existObj
==
null
){
for
(
int
i
=
1
;
i
<=
10
;
i
++){
Object
obj
=
RedisUtil
.
getCache
(
keyc
+
"c"
+
i
);
if
(
obj
==
null
){
RedisUtil
.
setCache
(
keyc
+
"c"
+
i
,
s
);
RedisUtil
.
setCache
(
key
,
"c"
+
i
);
break
;
}
}
if
(
StringUtils
.
isNotBlank
(
result
)){
RedisUtil
.
setCache
(
storeListSourceKey
,
result
);
}
});
}
if
(
CollectionUtils
.
isNotEmpty
(
del
)){
del
.
forEach
(
s
->
{
String
key
=
StoreRedisKeyUtils
.
getStoreFieldKey
(
enterpriseId
,
Integer
.
valueOf
(
s
));
this
.
storeDictService
.
deleteStoreField
(
enterpriseId
,
s
);
Object
c
=
RedisUtil
.
getCache
(
key
);
String
storeListSourceKey
=
StoreRedisKeyUtils
.
getStoreListSourceKey
(
enterpriseId
,
userId
);
if
(
c
!=
null
){
RedisUtil
.
delCache
(
c
.
toString
());
//门店列表自定义字段配置,取消时需要删除当前已经配置的列表显示字段
Object
storeListSource
=
RedisUtil
.
getCache
(
storeListSourceKey
);
if
(
storeListSource
!=
null
){
String
[]
arr
=
storeListSource
.
toString
().
split
(
","
);
String
result
=
""
;
for
(
String
a
:
arr
){
if
(!
c
.
toString
().
equals
(
a
)){
result
+=
a
+
","
;
}
}
if
(
StringUtils
.
isNotBlank
(
result
)){
RedisUtil
.
setCache
(
storeListSourceKey
,
result
);
}
}
}
}
RedisUtil
.
delCache
(
key
);
}
);
RedisUtil
.
delCache
(
key
);
}
);
}
return
ServiceResponse
.
success
();
}
...
...
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