Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-manage3.0
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
haoban3.0
haoban-manage3.0
Commits
cba6398b
Commit
cba6398b
authored
Jul 21, 2022
by
徐高华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
店员需过滤主导购和店长
parent
ecc5d898
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
48 deletions
+54
-48
HmLinkApiServiceImpl.java
...age/service/service/out/impl/hm/HmLinkApiServiceImpl.java
+54
-48
No files found.
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/hm/HmLinkApiServiceImpl.java
View file @
cba6398b
...
...
@@ -96,9 +96,9 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
@Autowired
private
MemberClerkApiService
memberClerkApiService
;
@Autowired
private
HmPageService
hmPageService
;
private
HmPageService
hmPageService
;
@Autowired
private
StoreService
storeService
;
private
StoreService
storeService
;
@Override
public
ServiceResponse
<
String
>
getHmLinkUrl
()
{
...
...
@@ -158,9 +158,9 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
HmQrcodeBO
hm
=
null
;
HmLinkWxaDTO
retDTO
=
new
HmLinkWxaDTO
();
log
.
info
(
"小程序获取活码={},linkShortCode={},mixPhone={},memberId={},unionid={},门店={}{}"
,
enterpriseId
,
linkShortCode
,
mixPhone
,
memberId
,
unionid
,
inStoreId
,
whitchStore
);
mixPhone
,
memberId
,
unionid
,
inStoreId
,
whitchStore
);
HmLinkBO
link
=
this
.
hmLinkService
.
getByLinkShortCodeCache
(
linkShortCode
);
Map
<
String
,
String
>
remarkMap
=
new
HashMap
<>();
Map
<
String
,
String
>
remarkMap
=
new
HashMap
<>();
if
(
null
==
link
)
{
log
.
error
(
"链接记录不存,linkShortCode={}"
,
linkShortCode
);
return
ServiceResponse
.
failure
(
HaoBanErrCode
.
ERR_OTHER
.
getCode
(),
"链接记录不存"
);
...
...
@@ -189,12 +189,12 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
// 直接返回门店的导购活码,如果没有返回错误
if
(
null
==
hm
&&
StringUtils
.
isNotBlank
(
inStoreId
))
{
String
customRuleJson
=
link
.
getCustomRuleJson
();
log
.
info
(
"选门店后,whitchStore={},自定义规则={}"
,
whitchStore
,
customRuleJson
);
log
.
info
(
"选门店后,whitchStore={},自定义规则={}"
,
whitchStore
,
customRuleJson
);
JSONObject
storeRuleObj
=
JSONObject
.
parseObject
(
customRuleJson
);
int
openFlag
=
storeRuleObj
.
getIntValue
(
"open"
);
// whitchStore 1推荐门店 2附件门店 3省市区门店
if
(
null
==
whitchStore
)
{
whitchStore
=
1
;
if
(
null
==
whitchStore
)
{
whitchStore
=
1
;
}
if
(
openFlag
==
1
)
{
int
dz
=
0
,
dy
=
0
;
...
...
@@ -205,7 +205,7 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
HmLinkStoreSettingDTO
cityStore
=
storeRuleObj
.
getObject
(
"city_store"
,
HmLinkStoreSettingDTO
.
class
);
dz
=
cityStore
.
getDz
();
dy
=
cityStore
.
getDy
();
}
else
if
(
whitchStore
==
1
||
whitchStore
==
2
)
{
}
else
if
(
whitchStore
==
1
||
whitchStore
==
2
)
{
HmLinkStoreSettingDTO
store
=
storeRuleObj
.
getObject
(
"store"
,
HmLinkStoreSettingDTO
.
class
);
if
(
whitchStore
==
2
||
(
storeType
==
1
&&
whitchStore
==
1
))
{
// 附近门店 或者 推荐门店
...
...
@@ -217,12 +217,12 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
dy
=
store
.
getNdy
();
}
}
hm
=
this
.
getHmFormStore
(
wxEnterpriseId
,
inStoreId
,
dz
,
dy
);
hm
=
this
.
getHmFormStore
(
wxEnterpriseId
,
inStoreId
,
dz
,
dy
,
new
ArrayList
<>()
);
log
.
info
(
"获取到的门店配置dz={},dy={},获取的活码={}"
,
dz
,
dy
,
JSON
.
toJSONString
(
hm
));
if
(
null
==
hm
)
{
return
ServiceResponse
.
failure
(
HaoBanErrCode
.
ERR_OTHER
.
getCode
(),
"导购活码不存在"
);
}
remarkMap
.
put
(
"sm"
,
"会员选门店活码"
);
remarkMap
.
put
(
"sm"
,
"会员选门店活码"
);
}
}
// 会员门店
...
...
@@ -261,10 +261,11 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
hm
=
this
.
getHmFromClerk
(
mainClerkId
,
wxEnterpriseId
);
}
if
(
null
==
hm
&&
StringUtils
.
isNotBlank
(
mainStoreId
))
{
hm
=
this
.
getHmFormStore
(
wxEnterpriseId
,
mainStoreId
,
fwStore
.
getDz
(),
fwStore
.
getDy
());
hm
=
this
.
getHmFormStore
(
wxEnterpriseId
,
mainStoreId
,
fwStore
.
getDz
(),
fwStore
.
getDy
(),
Arrays
.
asList
(
mainClerkId
));
}
if
(
null
!=
hm
)
{
remarkMap
.
put
(
"sm"
,
"会员主门店活码"
);
if
(
null
!=
hm
)
{
remarkMap
.
put
(
"sm"
,
"会员主门店活码"
);
}
}
// 协管门店
...
...
@@ -275,6 +276,7 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
list
=
this
.
sortMemberClerk
(
enterpriseId
,
memberId
,
list
);
List
<
String
>
storeIdList
=
new
ArrayList
<>();
// 协管导购
List
<
String
>
clerkIdList
=
new
ArrayList
<>();
for
(
MemberStoreClerkDataDTO
item
:
list
)
{
String
clerkId
=
item
.
getClerkIdRel
();
if
(
mainStoreId
.
equals
(
item
.
getStoreIdRel
()))
{
...
...
@@ -287,12 +289,12 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
break
;
}
storeIdList
.
add
(
item
.
getStoreIdRel
());
clerkIdList
.
add
(
clerkId
);
}
log
.
info
(
""
);
// 店长
if
(
null
==
hm
&&
xgStore
.
getDz
()
==
1
&&
CollectionUtils
.
isNotEmpty
(
storeIdList
))
{
for
(
String
storeId
:
storeIdList
)
{
hm
=
this
.
getHmFormStore
(
wxEnterpriseId
,
storeId
,
1
,
0
);
hm
=
this
.
getHmFormStore
(
wxEnterpriseId
,
storeId
,
1
,
0
,
clerkIdList
);
if
(
null
!=
hm
)
{
break
;
}
...
...
@@ -301,14 +303,14 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
// 店员
if
(
null
==
hm
&&
xgStore
.
getDy
()
==
1
&&
CollectionUtils
.
isNotEmpty
(
storeIdList
))
{
for
(
String
storeId
:
storeIdList
)
{
hm
=
this
.
getHmFormStore
(
wxEnterpriseId
,
storeId
,
0
,
1
);
hm
=
this
.
getHmFormStore
(
wxEnterpriseId
,
storeId
,
0
,
1
,
clerkIdList
);
if
(
null
!=
hm
)
{
break
;
}
}
}
if
(
null
!=
hm
)
{
remarkMap
.
put
(
"sm"
,
"会员协管活码"
);
if
(
null
!=
hm
)
{
remarkMap
.
put
(
"sm"
,
"会员协管活码"
);
}
}
}
...
...
@@ -325,7 +327,7 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
// 活码的门店
List
<
HmLinkStoreDTO
>
storeList
=
this
.
hmLinkStoreService
.
listByLinkId
(
wxEnterpriseId
,
enterpriseId
,
linkId
);
this
.
setStoreAddress
(
enterpriseId
,
storeList
);
this
.
setStoreAddress
(
enterpriseId
,
storeList
);
log
.
info
(
"门店规则={},推荐门店列表={}"
,
storeType
,
JSON
.
toJSONString
(
storeList
));
HmLinkStoreSettingDTO
cityStore
=
storeRuleObj
.
getObject
(
"city_store"
,
HmLinkStoreSettingDTO
.
class
);
// 是否开启省市区门店查询
...
...
@@ -337,9 +339,9 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
}
}
if
(
null
!=
hm
)
{
log
.
info
(
"获取到单人活码={}"
,
JSON
.
toJSONString
(
hm
));
log
.
info
(
"获取到单人活码={}"
,
JSON
.
toJSONString
(
hm
));
retDTO
.
setHmId
(
hm
.
getHmId
());
remarkMap
.
put
(
"clerk"
,
hm
.
getClerkId
())
;
remarkMap
.
put
(
"clerk"
,
hm
.
getClerkId
());
// 判断是否已经是好友
boolean
isFriend
=
false
;
if
(
null
!=
memberId
)
{
...
...
@@ -350,7 +352,7 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
isFriend
=
true
;
log
.
info
(
"已经是好友,staffid={},memberId={}"
,
staffId
,
memberId
);
retDTO
.
setHmQrcode
(
hm
.
getWxQrcode
());
remarkMap
.
put
(
"sm"
,
"老好友,取单人活码"
);
remarkMap
.
put
(
"sm"
,
"老好友,取单人活码"
);
}
}
...
...
@@ -360,17 +362,17 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
bo
.
setLinkId
(
linkId
);
bo
.
setHmId
(
hm
.
getHmId
());
String
dthmKey
=
this
.
keyDataService
.
saveDataForLink
(
enterpriseId
,
bo
);
remarkMap
.
put
(
"dthmKey"
,
dthmKey
)
;
remarkMap
.
put
(
"dthmKey"
,
dthmKey
);
if
(
null
!=
dthmKey
)
{
ServiceResponse
<
String
>
addResp
=
this
.
addQrcode
(
hm
,
dthmKey
,
wxEnterpriseDTO
.
getCorpid
(),
retDTO
);
if
(!
addResp
.
isSuccess
())
{
remarkMap
.
put
(
"sm"
,
"创建动态活码失败,取单人活码"
);
if
(
StringUtils
.
isBlank
(
hm
.
getWxQrcode
()))
{
remarkMap
.
put
(
"sm"
,
"创建动态活码失败,取单人活码"
);
if
(
StringUtils
.
isBlank
(
hm
.
getWxQrcode
()))
{
return
ServiceResponse
.
failure
(
HaoBanErrCode
.
ERR_OTHER
.
getCode
(),
"导购活码不存在"
);
}
retDTO
.
setHmQrcode
(
hm
.
getWxQrcode
());
}
else
{
remarkMap
.
put
(
"动态"
,
"是"
)
;
remarkMap
.
put
(
"动态"
,
"是"
);
retDTO
.
setHmQrcode
(
addResp
.
getResult
());
}
}
...
...
@@ -378,22 +380,22 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
}
// 生成动态活码
retDTO
.
setRemarkMap
(
remarkMap
);
log
.
info
(
"活码数据返回={}"
,
JSON
.
toJSONString
(
retDTO
));
log
.
info
(
"活码数据返回={}"
,
JSON
.
toJSONString
(
retDTO
));
return
ServiceResponse
.
success
(
retDTO
);
}
private
void
setStoreAddress
(
String
enterpriseId
,
List
<
HmLinkStoreDTO
>
storeList
)
{
if
(
CollectionUtils
.
isNotEmpty
(
storeList
))
{
List
<
String
>
storeIdList
=
storeList
.
stream
().
map
(
dto
->
dto
.
getStoreId
()).
collect
(
Collectors
.
toList
())
;
String
[]
storeIds
=
new
String
[
storeIdList
.
size
()]
;
for
(
int
i
=
0
;
i
<
storeIdList
.
size
();
i
++)
{
storeIds
[
i
]
=
storeIdList
.
get
(
i
)
;
}
List
<
StoreDTO
>
dtoList
=
this
.
storeService
.
getStores
(
storeIds
)
;
Map
<
String
,
StoreDTO
>
map
=
dtoList
.
stream
().
collect
(
Collectors
.
toMap
(
StoreDTO:
:
getStoreId
,
dto
->
dto
,
(
k1
,
k2
)
->
k1
));
storeList
.
forEach
(
item
->
{
if
(
null
!=
map
.
get
(
item
.
getStoreId
()))
{
private
void
setStoreAddress
(
String
enterpriseId
,
List
<
HmLinkStoreDTO
>
storeList
)
{
if
(
CollectionUtils
.
isNotEmpty
(
storeList
)
)
{
List
<
String
>
storeIdList
=
storeList
.
stream
().
map
(
dto
->
dto
.
getStoreId
()).
collect
(
Collectors
.
toList
());
String
[]
storeIds
=
new
String
[
storeIdList
.
size
()]
;
for
(
int
i
=
0
;
i
<
storeIdList
.
size
();
i
++)
{
storeIds
[
i
]
=
storeIdList
.
get
(
i
);
}
List
<
StoreDTO
>
dtoList
=
this
.
storeService
.
getStores
(
storeIds
);
Map
<
String
,
StoreDTO
>
map
=
dtoList
.
stream
()
.
collect
(
Collectors
.
toMap
(
StoreDTO:
:
getStoreId
,
dto
->
dto
,
(
k1
,
k2
)
->
k1
));
storeList
.
forEach
(
item
->
{
if
(
null
!=
map
.
get
(
item
.
getStoreId
()))
{
item
.
setStoreAddress
(
map
.
get
(
item
.
getStoreId
()).
getStoreAddress
());
}
});
...
...
@@ -402,7 +404,6 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
private
List
<
MemberStoreClerkDataDTO
>
sortMemberClerk
(
String
enterpriseId
,
String
memberId
,
List
<
MemberStoreClerkDataDTO
>
list
)
{
System
.
out
.
println
(
""
);
System
.
out
.
println
(
""
);
ServiceResponse
<
List
<
MemberClerkDTO
>>
resp
=
this
.
memberClerkApiService
.
getMemberMainClerkList
(
enterpriseId
,
memberId
);
if
(!
resp
.
isSuccess
()
&&
CollectionUtils
.
isEmpty
(
resp
.
getResult
()))
{
...
...
@@ -477,29 +478,34 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
return
hm
;
}
private
HmQrcodeBO
getHmFormStore
(
String
wxEnterpriseId
,
String
inStoreId
,
int
dz
,
int
dy
)
{
private
HmQrcodeBO
getHmFormStore
(
String
wxEnterpriseId
,
String
inStoreId
,
int
dz
,
int
dy
,
List
<
String
>
clerkIdList
)
{
if
(
StringUtils
.
isBlank
(
inStoreId
)
||
"-1"
.
equals
(
inStoreId
))
{
return
null
;
}
HmQrcodeBO
hm
=
null
;
if
(
dz
==
1
)
{
ClerkDTO
dzClerk
=
this
.
clerkService
.
getClerkLeaderByStoreId
(
inStoreId
);
if
(
null
!=
dzClerk
)
{
clerkIdList
.
add
(
dzClerk
.
getClerkId
());
if
(
dz
==
1
)
{
hm
=
this
.
getHmFromClerk
(
dzClerk
.
getClerkId
(),
wxEnterpriseId
);
if
(
null
!=
hm
)
{
log
.
info
(
"选择门店后,获取到店长活码,clerkId={},inStoreId={}"
,
hm
.
getClerkId
(),
inStoreId
);
if
(
null
!=
hm
)
{
log
.
info
(
"选择门店后,获取到店长活码,clerkId={},inStoreId={}"
,
hm
.
getClerkId
(),
inStoreId
);
}
}
}
else
{
log
.
info
(
"店长不存在,storeId={}"
,
inStoreId
);
}
}
// 店员需要过滤主导购、店长
log
.
info
(
"过滤的导购={}"
,
clerkIdList
);
if
(
null
==
hm
&&
dy
==
1
)
{
List
<
HmQrcodeBO
>
list
=
this
.
hmQrcodeService
.
listByStoreId
(
wxEnterpriseId
,
inStoreId
,
0
);
list
=
list
.
stream
().
filter
(
dto
->
!
clerkIdList
.
contains
(
dto
.
getClerkId
())).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
log
.
info
(
"选择门店下{},导购数={}"
,
inStoreId
,
list
.
size
());
log
.
info
(
"选择门店下{},导购数={}"
,
inStoreId
,
list
.
size
());
hm
=
list
.
get
(
new
Random
().
nextInt
(
list
.
size
()));
if
(
null
!=
hm
)
{
log
.
info
(
"选择门店后,获取到店员活码,clerkId={},inStoreId={}"
,
hm
.
getClerkId
(),
inStoreId
);
if
(
null
!=
hm
)
{
log
.
info
(
"选择门店后,获取到店员活码,clerkId={},inStoreId={}"
,
hm
.
getClerkId
(),
inStoreId
);
}
}
}
...
...
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