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
38ae55ab
Commit
38ae55ab
authored
Aug 24, 2020
by
陶光胜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
门店批量导入修改
parent
a58f3106
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
12 deletions
+38
-12
pom.xml
gic-store-service/pom.xml
+5
-0
StoreStatusStrategyImpl.java
.../com/gic/store/strategy/impl/StoreStatusStrategyImpl.java
+33
-12
No files found.
gic-store-service/pom.xml
View file @
38ae55ab
...
...
@@ -151,6 +151,11 @@
<artifactId>
gic-spark-run-api
</artifactId>
<version>
${gic-spark-run-api}
</version>
</dependency>
<dependency>
<groupId>
com.gic
</groupId>
<artifactId>
gic-member-config-api
</artifactId>
<version>
${gic-member-config-api}
</version>
</dependency>
</dependencies>
<build>
...
...
gic-store-service/src/main/java/com/gic/store/strategy/impl/StoreStatusStrategyImpl.java
View file @
38ae55ab
package
com
.
gic
.
store
.
strategy
.
impl
;
import
com.gic.member.config.api.dto.UserOwnerDefaultDTO
;
import
com.gic.member.config.api.service.CardAscriptionConfigService
;
import
com.gic.spark.api.service.SparkJobApiService
;
import
com.gic.store.constant.StoreStatusEnum
;
import
com.gic.store.service.StoreLogService
;
import
com.gic.store.service.StoreService
;
import
com.gic.store.strategy.BulkUpdateStoreStrtegy
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@Component
(
"1"
)
public
class
StoreStatusStrategyImpl
implements
BulkUpdateStoreStrtegy
{
...
...
@@ -18,27 +24,42 @@ public class StoreStatusStrategyImpl implements BulkUpdateStoreStrtegy {
private
StoreLogService
storeLogService
;
@Autowired
private
SparkJobApiService
sparkJobApiService
;
@Autowired
private
CardAscriptionConfigService
cardAscriptionConfigService
;
@Override
public
int
bulkUpdateStore
(
String
storeInfoIds
,
Integer
enterpriseId
,
String
value
,
StoreService
storeService
,
Integer
operatorId
,
String
operatorName
)
{
int
i
=
storeService
.
bulkUpdateStoreStatus
(
storeInfoIds
,
enterpriseId
,
value
);
if
(
i
>
0
)
{
List
<
Integer
>
storeInfoIdList
;
if
(
"all"
.
equals
(
storeInfoIds
))
{
storeInfoIdList
=
storeService
.
listAllStoreInfoId
(
enterpriseId
);
}
else
{
storeInfoIdList
=
new
ArrayList
<>();
String
[]
storeIdArr
=
storeInfoIds
.
split
(
","
);
for
(
String
s
:
storeIdArr
)
{
storeInfoIdList
.
add
(
Integer
.
valueOf
(
s
));
}
List
<
Integer
>
storeInfoIdList
=
new
ArrayList
<>();
List
<
Integer
>
storeInfoIdListNew
=
new
ArrayList
<>();
List
<
UserOwnerDefaultDTO
>
result
=
this
.
cardAscriptionConfigService
.
getDefaultUserOwner
(
enterpriseId
).
getResult
();
if
(
"all"
.
equals
(
storeInfoIds
))
{
storeInfoIdList
=
storeService
.
listAllStoreInfoId
(
enterpriseId
);
}
else
{
storeInfoIdList
=
new
ArrayList
<>();
String
[]
storeIdArr
=
storeInfoIds
.
split
(
","
);
for
(
String
s
:
storeIdArr
)
{
storeInfoIdList
.
add
(
Integer
.
valueOf
(
s
));
}
}
if
(
CollectionUtils
.
isNotEmpty
(
result
)
&&
StoreStatusEnum
.
INONLINE
.
getCode
()
==
Integer
.
valueOf
(
value
)){
storeInfoIdListNew
=
storeInfoIdList
.
stream
().
filter
(
storeInfoId
->
{
for
(
UserOwnerDefaultDTO
dto
:
result
){
if
(
storeInfoId
.
intValue
()
==
dto
.
getStoreInfoId
().
intValue
()){
return
false
;
}
}
return
true
;
}).
collect
(
Collectors
.
toList
());
}
String
storeInfoIdsNew
=
StringUtils
.
join
(
CollectionUtils
.
isNotEmpty
(
storeInfoIdListNew
)
?
storeInfoIdListNew
:
storeInfoIdList
,
","
);
int
i
=
storeService
.
bulkUpdateStoreStatus
(
storeInfoIdsNew
,
enterpriseId
,
value
);
if
(
i
>
0
)
{
int
valueCode
=
Integer
.
parseInt
(
value
);
storeLogService
.
saveBulkStoreStatusLog
(
storeInfoIdList
,
enterpriseId
,
operatorId
,
operatorName
,
"门店状态变更为【"
+
StoreStatusEnum
.
parseCode
(
valueCode
)
+
"】"
);
for
(
Integer
storeInfoId
:
storeInfoIdList
)
{
// 启用禁用的值和会员组取的不一致 需要转换下
sparkJobApiService
.
updateStoreStatus
(
enterpriseId
,
storeInfoId
,
StoreStatusEnum
.
ONLINE
.
getCode
()
==
valueCode
?
0
:
1
);
}
}
return
i
;
...
...
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