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
829cd2bd
You need to sign in or sign up before continuing.
Commit
829cd2bd
authored
Feb 02, 2021
by
陶光胜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
门店会员转移
parent
9dd2ed8c
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
50 additions
and
12 deletions
+50
-12
ClerkApiService.java
.../src/main/java/com/gic/store/service/ClerkApiService.java
+2
-1
pom.xml
gic-store-service/pom.xml
+5
-0
ClerkApiServiceImpl.java
...com/gic/store/service/outer/impl/ClerkApiServiceImpl.java
+23
-11
StoreApiServiceImpl.java
...com/gic/store/service/outer/impl/StoreApiServiceImpl.java
+19
-0
dubbo-gic-store-service.xml
...re-service/src/main/resources/dubbo-gic-store-service.xml
+1
-0
No files found.
gic-store-api/src/main/java/com/gic/store/service/ClerkApiService.java
View file @
829cd2bd
...
...
@@ -177,10 +177,11 @@ public interface ClerkApiService {
* @param enterpriseId 企业id
* @param clerkIds 导购ids
* @param status 状态
* @param userId
* @return com.gic.api.base.commons.ServiceResponse
* @throws
*/
ServiceResponse
<
Void
>
updateClerkStatus
(
Integer
enterpriseId
,
String
clerkIds
,
Integer
status
);
ServiceResponse
<
Void
>
updateClerkStatus
(
Integer
enterpriseId
,
String
clerkIds
,
Integer
status
,
Integer
userId
);
/**
* 查询list通过id
...
...
gic-store-service/pom.xml
View file @
829cd2bd
...
...
@@ -156,6 +156,11 @@
<artifactId>
gic-member-config-api
</artifactId>
<version>
${gic-member-config-api}
</version>
</dependency>
<dependency>
<groupId>
com.gic
</groupId>
<artifactId>
gic-member-api
</artifactId>
<version>
${gic-member-api}
</version>
</dependency>
</dependencies>
<build>
...
...
gic-store-service/src/main/java/com/gic/store/service/outer/impl/ClerkApiServiceImpl.java
View file @
829cd2bd
...
...
@@ -11,6 +11,7 @@ import com.gic.enterprise.error.ErrorCode;
import
com.gic.enterprise.response.EnterpriseServiceResponse
;
import
com.gic.enterprise.service.EnterpriseApiService
;
import
com.gic.enterprise.service.WmStoreSyncLogApiService
;
import
com.gic.member.api.service.StoreUpdateApiService
;
import
com.gic.member.config.api.dto.UserOwnerDefaultDTO
;
import
com.gic.member.config.api.service.CardAscriptionConfigService
;
import
com.gic.mq.sdk.GicMQClient
;
...
...
@@ -36,6 +37,7 @@ import org.springframework.stereotype.Service;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.atomic.AtomicBoolean
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
...
...
@@ -74,6 +76,8 @@ public class ClerkApiServiceImpl implements ClerkApiService {
private
SparkJobApiService
sparkJobApiService
;
@Autowired
private
CardAscriptionConfigService
cardAscriptionConfigService
;
@Autowired
private
StoreUpdateApiService
storeUpdateApiService
;
@Override
public
ServiceResponse
saveOrUpdate
(
ClerkDTO
clerkDTO
)
{
...
...
@@ -476,7 +480,8 @@ public class ClerkApiServiceImpl implements ClerkApiService {
}
@Override
public
ServiceResponse
updateClerkStatus
(
Integer
enterpriseId
,
String
clerkIds
,
Integer
status
)
{
public
ServiceResponse
updateClerkStatus
(
Integer
enterpriseId
,
String
clerkIds
,
Integer
status
,
Integer
userId
)
{
StringBuilder
messageBuiler
=
new
StringBuilder
();
List
<
Integer
>
clerkIdList
;
if
(
StringUtils
.
isNotBlank
(
clerkIds
))
{
if
(
StringUtils
.
equals
(
com
.
gic
.
store
.
constant
.
Constants
.
ALL
,
clerkIds
))
{
...
...
@@ -485,12 +490,16 @@ public class ClerkApiServiceImpl implements ClerkApiService {
String
[]
split
=
clerkIds
.
split
(
GlobalInfo
.
FLAG_COMMA
);
clerkIdList
=
Stream
.
of
(
split
).
map
(
Integer:
:
parseInt
).
collect
(
Collectors
.
toList
());
}
List
<
TabClerk
>
clerkList
=
this
.
clerkService
.
listClerkByIds
(
clerkIdList
);
Map
<
Integer
,
TabClerk
>
clerkIdMap
=
clerkList
.
stream
().
collect
(
Collectors
.
toMap
(
TabClerk:
:
getClerkId
,
TabClerk
->
TabClerk
));
//过滤掉默认导购
if
(
StoreStatusEnum
.
INONLINE
.
getCode
()
==
status
){
List
<
UserOwnerDefaultDTO
>
result
=
this
.
cardAscriptionConfigService
.
getDefaultUserOwner
(
enterpriseId
).
getResult
();
if
(
CollectionUtils
.
isNotEmpty
(
result
)){
clerkIdList
=
clerkIdList
.
stream
().
filter
(
clerkId
->
{
for
(
UserOwnerDefaultDTO
dto
:
result
){
if
(
clerkId
.
intValue
()
==
dto
.
getClerkId
().
intValue
()){
messageBuiler
.
append
(
clerkIdMap
.
get
(
clerkId
).
getClerkName
()).
append
(
",默认导购不能下线;"
);
return
false
;
}
}
...
...
@@ -499,20 +508,23 @@ public class ClerkApiServiceImpl implements ClerkApiService {
}
}
if
(
CollectionUtils
.
isNotEmpty
(
clerkIdList
)){
Integer
i
=
clerkService
.
updateClerkStatus
(
enterpriseId
,
clerkIdList
,
status
);
for
(
Integer
clerkId
:
clerkIdList
)
{
sparkJobApiService
.
updateClerkStatus
(
enterpriseId
,
clerkId
.
longValue
(),
1
==
status
?
0
:
1
);
/**判断门店下是否还有启用导购**/
try
{
GICMQClientUtil
.
getClientInstance
().
sendCommonMessage
(
"commonRouter"
,
clerkId
+
","
+
enterpriseId
,
"com.gic.store.service.ClerkApiService"
,
"checkStoreRealStatus"
);
}
catch
(
Exception
e
)
{
logger
.
warn
(
"异常"
,
e
);
List
<
Integer
>
needDealClerkIdList
=
new
ArrayList
<>();
for
(
Integer
clerkId
:
clerkIdList
){
List
<
TabClerk
>
list
=
this
.
clerkService
.
listClerkByStoreInfoId
(
Arrays
.
asList
(
clerkIdMap
.
get
(
clerkId
).
getStoreInfoId
()));
if
(
list
.
size
()
>
1
){
needDealClerkIdList
.
add
(
clerkId
);
}
else
{
messageBuiler
.
append
(
"当前门店下只有 "
).
append
(
clerkIdMap
.
get
(
clerkId
).
getClerkName
()).
append
(
" 是上线状态;"
);
}
}
Integer
i
=
clerkService
.
updateClerkStatus
(
enterpriseId
,
needDealClerkIdList
,
status
);
if
(
StoreStatusEnum
.
INONLINE
.
getCode
()
==
status
){
//导购下线重算导购归属
this
.
storeUpdateApiService
.
clerkOffline
(
enterpriseId
,
needDealClerkIdList
,
userId
);
}
}
}
return
ServiceResponse
.
success
();
return
ServiceResponse
.
success
(
messageBuiler
.
toString
());
}
@Override
...
...
gic-store-service/src/main/java/com/gic/store/service/outer/impl/StoreApiServiceImpl.java
View file @
829cd2bd
...
...
@@ -23,6 +23,7 @@ import com.gic.enterprise.service.CustomStoreApiService;
import
com.gic.enterprise.service.EnterpriseApiService
;
import
com.gic.enterprise.service.WmStoreSyncLogApiService
;
import
com.gic.enterprise.utils.LicenseUtils
;
import
com.gic.member.api.service.StoreUpdateApiService
;
import
com.gic.mq.sdk.GicMQClient
;
import
com.gic.redis.data.util.RedisUtil
;
import
com.gic.search.business.api.constant.enums.OperateEnum
;
...
...
@@ -133,6 +134,8 @@ public class StoreApiServiceImpl implements StoreApiService {
private
UserApiService
userApiService
;
@Autowired
private
UserResourceApiService
userResourceApiService
;
@Autowired
private
StoreUpdateApiService
storeUpdateApiService
;
private
Map
<
String
,
BulkUpdateStoreStrtegy
>
storeStrtegyMap
=
new
ConcurrentHashMap
<>();
...
...
@@ -194,6 +197,7 @@ public class StoreApiServiceImpl implements StoreApiService {
// 记录门店日志
saveAddLog
(
storeDTO
);
}
else
{
boolean
hasChangeBrand
=
checkBrandHasChange
(
storeDTO
.
getBrandIds
(),
storeDTO
.
getStoreId
(),
storeDTO
.
getEnterpriseId
());
String
lock
=
"lock:"
+
storeDTO
.
getEnterpriseId
()
+
":"
+
storeDTO
.
getStoreId
();
RedisUtil
.
lock
(
lock
,
500
l
,
TimeUnit
.
MILLISECONDS
,
500
l
);
try
{
...
...
@@ -204,6 +208,11 @@ public class StoreApiServiceImpl implements StoreApiService {
if
(
update
==
0
)
{
return
ServiceResponse
.
failure
(
ErrorCode
.
NOTEXISTS
.
getCode
(),
ErrorCode
.
NOTEXISTS
.
getMsg
());
}
if
(
hasChangeBrand
){
//调用归属重算
this
.
storeUpdateApiService
.
storeBrandChange
(
storeDTO
.
getEnterpriseId
(),
Collections
.
singletonList
(
storeDTO
.
getStoreInfoId
()),
storeDTO
.
getOperatorId
());
logger
.
info
(
"调用会员接口进行归属重算, {}"
,
storeDTO
.
getStoreInfoId
());
}
// 记录门店日志
try
{
saveUpdateLog
(
existStore
.
getResult
(),
storeDTO
);
...
...
@@ -560,6 +569,16 @@ public class StoreApiServiceImpl implements StoreApiService {
return
null
;
}
private
boolean
checkBrandHasChange
(
String
brandIds
,
Integer
storeId
,
Integer
enterpriseId
){
StoreDTO
result
=
this
.
getStoreById
(
enterpriseId
,
storeId
).
getResult
();
if
(
result
!=
null
){
if
(
brandIds
.
equals
(
result
.
getBrandIds
())){
return
false
;
}
}
return
true
;
}
private
void
refreshIndex
(
Integer
storeId
,
Integer
enterpriseId
)
{
this
.
addStoreToIndex
(
enterpriseId
,
storeId
);
}
...
...
gic-store-service/src/main/resources/dubbo-gic-store-service.xml
View file @
829cd2bd
...
...
@@ -73,4 +73,5 @@
<dubbo:reference
interface=
"com.gic.auth.service.UserApiService"
id=
"userApiService"
timeout=
"6000"
/>
<dubbo:reference
interface=
"com.gic.auth.service.ResourceGroupApiService"
id=
"resourceGroupApiService"
timeout=
"6000"
/>
<dubbo:reference
interface=
"com.gic.auth.service.UserResourceApiService"
id=
"userResourceApiService"
timeout=
"6000"
/>
<dubbo:reference
interface=
"com.gic.member.api.service.StoreUpdateApiService"
id=
"storeUpdateApiService"
timeout=
"6000"
/>
</beans>
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