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
9b142dbe
Commit
9b142dbe
authored
Apr 04, 2023
by
王祖波
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/feature-content2' into feature-content2
parents
0ceaeef4
5ab16e5e
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
97 additions
and
47 deletions
+97
-47
PotentialCustomerNotifyContext.java
...jo/bo/content/context/PotentialCustomerNotifyContext.java
+16
-2
PotentialCustomerNotifyBuilder.java
...rvice/content/adaptor/PotentialCustomerNotifyBuilder.java
+55
-44
PotentialCustomerServiceImpl.java
...ce/service/content/impl/PotentialCustomerServiceImpl.java
+1
-0
InteractRecordTest.java
haoban-manage3-service/src/test/java/InteractRecordTest.java
+1
-1
WxEnterpriseInfoController.java
...ban/manage/web/controller/WxEnterpriseInfoController.java
+2
-0
ClerkMaterialShareController.java
.../web/controller/content/ClerkMaterialShareController.java
+12
-0
EnterpriseConfigVO.java
...java/com/gic/haoban/manage/web/vo/EnterpriseConfigVO.java
+10
-0
No files found.
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/pojo/bo/content/context/PotentialCustomerNotifyContext.java
View file @
9b142dbe
package
com
.
gic
.
haoban
.
manage
.
service
.
pojo
.
bo
.
content
.
context
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.haoban.manage.api.dto.StaffClerkRelationDTO
;
import
com.gic.haoban.manage.service.pojo.bo.NoticeMessageBO
;
import
com.gic.haoban.manage.service.pojo.bo.content.PotentialCustomerStaticsBO
;
...
...
@@ -61,9 +62,10 @@ public class PotentialCustomerNotifyContext {
/**
* 构建小程序消息通知
*
* @return
*/
public
List
<
NoticeMessageBO
>
buildNoticeMessage
()
{
public
List
<
NoticeMessageBO
>
build
HaoBan
NoticeMessage
()
{
if
(
CollectionUtils
.
isEmpty
(
this
.
customerStaticsBos
))
{
return
Collections
.
emptyList
();
}
...
...
@@ -88,9 +90,21 @@ public class PotentialCustomerNotifyContext {
noticeMessageBO
.
setDescription
(
String
.
format
(
"新增%s个客户的销售线索,请及时跟进"
,
customerStaticsMap
.
get
(
item
.
getClerkId
())));
noticeMessageBO
.
setEnterpriseId
(
this
.
enterpriseId
);
noticeMessageBO
.
setRelationId
(
item
.
getClerkId
());
noticeMessageBO
.
setMessageContent
(
""
);
noticeMessageBO
.
setMessageContent
(
this
.
buildExtendParams
(
item
.
getStoreId
(),
item
.
getClerkId
())
);
return
noticeMessageBO
;
})
.
collect
(
Collectors
.
toList
());
}
/**
* 构建跳转参数
* @param storeId
* @return
*/
public
String
buildExtendParams
(
String
storeId
,
String
clerkId
)
{
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"storeId"
,
storeId
);
jsonObject
.
put
(
"clerkId"
,
clerkId
);
return
jsonObject
.
toJSONString
();
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/content/adaptor/PotentialCustomerNotifyBuilder.java
View file @
9b142dbe
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
content
.
adaptor
;
import
com.alibaba.fastjson.JSON
;
import
com.gic.haoban.manage.api.dto.StaffClerkRelationDTO
;
import
com.gic.haoban.manage.api.dto.StaffDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO
;
...
...
@@ -30,6 +31,7 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.Optional
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
...
...
@@ -110,7 +112,7 @@ public class PotentialCustomerNotifyBuilder {
* @param context
*/
public
void
sendHaoBanNotifyMessage
(
PotentialCustomerNotifyContext
context
)
{
List
<
NoticeMessageBO
>
noticeMessageBos
=
context
.
buildNoticeMessage
();
List
<
NoticeMessageBO
>
noticeMessageBos
=
context
.
build
HaoBan
NoticeMessage
();
if
(
CollectionUtils
.
isEmpty
(
noticeMessageBos
))
{
log
.
info
(
"好办消息为空"
);
return
;
...
...
@@ -120,66 +122,75 @@ public class PotentialCustomerNotifyBuilder {
/**
* 发送应用消息
* 批次中存在导购主门店数据的话 推送主门店数据
* 不存在主门店数据的话 随机推送一个有数据的门店
*
* @param context
*/
public
void
sendApplicationMessage
(
PotentialCustomerNotifyContext
context
)
{
if
(
CollectionUtils
.
isEmpty
(
context
.
getCustomerStaticsBos
())
||
CollectionUtils
.
isEmpty
(
context
.
getStaffClerkRelations
())
)
{
log
.
info
(
"发送应用消息
参数缺失 {}
"
);
if
(
CollectionUtils
.
isEmpty
(
context
.
getCustomerStaticsBos
()))
{
log
.
info
(
"发送应用消息
不存在导购纬度的统计
"
);
return
;
}
if
(
CollectionUtils
.
isEmpty
(
context
.
getStaffClerkRelations
()))
{
log
.
info
(
"发送应用消息 不存在导购绑定关系 clerkIds: {}"
,
JSON
.
toJSONString
(
context
.
getClerkIds
()));
return
;
}
Map
<
String
,
WxEnterpriseQwDTO
>
clerkEnterpriseCacheMap
=
new
HashMap
<>();
Map
<
String
,
PotentialCustomerStaticsBO
>
customerStaticsBOMap
=
context
.
getCustomerStaticsBos
()
.
stream
()
.
collect
(
Collectors
.
toMap
(
PotentialCustomerStaticsBO:
:
getClerkId
,
Function
.
identity
(),
(
v1
,
v2
)
->
v1
));
Map
<
String
,
TabHaobanClerkMainStoreRelated
>
clerkMainStoreMap
=
new
HashMap
<>();
Map
<
String
,
WxEnterpriseQwDTO
>
clerkEnterpriseMap
=
new
HashMap
<>();
for
(
StaffClerkRelationDTO
staffClerkRelation
:
context
.
getStaffClerkRelations
())
{
PotentialCustomerStaticsBO
customerStaticsBO
=
customerStaticsBOMap
.
get
(
staffClerkRelation
.
getClerkId
());
if
(
customerStaticsBO
==
null
||
customerStaticsBO
.
getNum
()
==
null
||
customerStaticsBO
.
getNum
()
==
0
)
{
log
.
info
(
"导购不存在新访问"
);
// 按staffId 聚合
Map
<
String
,
List
<
StaffClerkRelationDTO
>>
staffRelationMap
=
context
.
getStaffClerkRelations
()
.
stream
()
.
filter
(
item
->
{
PotentialCustomerStaticsBO
staticsBO
=
customerStaticsBOMap
.
get
(
item
.
getClerkId
());
return
staticsBO
!=
null
&&
staticsBO
.
getNum
()
!=
null
&&
staticsBO
.
getNum
()
>
0
;
})
.
collect
(
Collectors
.
groupingBy
(
StaffClerkRelationDTO:
:
getStaffId
));
for
(
Map
.
Entry
<
String
,
List
<
StaffClerkRelationDTO
>>
entry
:
staffRelationMap
.
entrySet
())
{
if
(
CollectionUtils
.
isEmpty
(
entry
.
getValue
()))
{
log
.
info
(
"成员不存在有数值的绑定关系 staffIf:{}"
,
entry
.
getKey
());
continue
;
}
String
staffId
=
staffClerkRelation
.
getStaffId
();
TabHaobanClerkMainStoreRelated
temp
=
clerkMainStoreMap
.
get
(
staffId
);
if
(
temp
==
null
)
{
TabHaobanClerkMainStoreRelated
tabHaobanClerkMainStoreRelated
=
clerkMainStoreRelatedService
.
selectByWxEnterpriseIdAndStoreId
(
staffId
,
staffClerkRelation
.
getWxEnterpriseId
());
if
(
tabHaobanClerkMainStoreRelated
==
null
)
{
tabHaobanClerkMainStoreRelated
=
new
TabHaobanClerkMainStoreRelated
();
}
clerkMainStoreMap
.
put
(
staffId
,
tabHaobanClerkMainStoreRelated
);
temp
=
clerkMainStoreMap
.
get
(
staffId
);
String
staffId
=
entry
.
getKey
();
String
wxEnterpriseId
=
entry
.
getValue
().
get
(
0
).
getWxEnterpriseId
();
TabHaobanClerkMainStoreRelated
tabHaobanClerkMainStoreRelated
=
clerkMainStoreRelatedService
.
selectByWxEnterpriseIdAndStoreId
(
staffId
,
wxEnterpriseId
);
if
(
tabHaobanClerkMainStoreRelated
==
null
)
{
log
.
info
(
"成员无主门店信息,不做处理 {}"
,
staffId
);
continue
;
}
if
(
temp
!=
null
)
{
if
(
StringUtils
.
isBlank
(
temp
.
getStoreId
()))
{
// 该成员无主门店
log
.
info
(
"成员无主门店 {}"
,
staffId
);
continue
;
}
if
(
StringUtils
.
isBlank
(
temp
.
getStoreId
()))
{
log
.
info
(
"成员不存在主门店 {}"
,
staffId
);
continue
;
}
// 需要发送应用消息
WxEnterpriseQwDTO
wxEnterpriseQwDTO
=
clerkEnterpriseMap
.
get
(
staffClerkRelation
.
getWxEnterpriseId
());
if
(
wxEnterpriseQwDTO
==
null
)
{
wxEnterpriseQwDTO
=
wxEnterpriseService
.
getQwInfo
(
staffClerkRelation
.
getWxEnterpriseId
());
clerkEnterpriseMap
.
put
(
staffClerkRelation
.
getWxEnterpriseId
(),
wxEnterpriseQwDTO
);
}
wxEnterpriseQwDTO
=
clerkEnterpriseMap
.
get
(
staffClerkRelation
.
getWxEnterpriseId
());
if
(
wxEnterpriseQwDTO
==
null
)
{
log
.
info
(
"企业信息不存在 {}"
,
staffClerkRelation
.
getWxEnterpriseId
());
return
;
}
QywxXcxSendMessageDTO
messageDTO
=
this
.
buildApplicationMessage
(
staffClerkRelation
,
wxEnterpriseQwDTO
,
customerStaticsBO
.
getNum
());
boolean
sendMessage
=
qywxSuiteApiService
.
sendMessage
(
wxEnterpriseQwDTO
.
getThirdCorpid
(),
config
.
getWxSuiteid
(),
messageDTO
);
log
.
info
(
"发送应用消息结果 {}"
,
sendMessage
);
Optional
<
StaffClerkRelationDTO
>
mainStoreClerkRelation
=
entry
.
getValue
()
.
stream
()
.
filter
(
item
->
StringUtils
.
equals
(
item
.
getStoreId
(),
tabHaobanClerkMainStoreRelated
.
getStoreId
()))
.
findFirst
();
StaffClerkRelationDTO
staffClerkRelation
=
entry
.
getValue
().
get
(
0
);
if
(
mainStoreClerkRelation
.
isPresent
())
{
staffClerkRelation
=
mainStoreClerkRelation
.
get
();
}
log
.
info
(
"发送应用消息的导购绑定关系 {}"
,
JSON
.
toJSONString
(
staffClerkRelation
));
// 需要发送应用消息
WxEnterpriseQwDTO
wxEnterpriseQwDTO
=
clerkEnterpriseCacheMap
.
get
(
staffClerkRelation
.
getWxEnterpriseId
());
if
(
wxEnterpriseQwDTO
==
null
)
{
wxEnterpriseQwDTO
=
wxEnterpriseService
.
getQwInfo
(
staffClerkRelation
.
getWxEnterpriseId
());
clerkEnterpriseCacheMap
.
put
(
staffClerkRelation
.
getWxEnterpriseId
(),
wxEnterpriseQwDTO
);
}
wxEnterpriseQwDTO
=
clerkEnterpriseCacheMap
.
get
(
staffClerkRelation
.
getWxEnterpriseId
());
if
(
wxEnterpriseQwDTO
==
null
)
{
log
.
info
(
"企业信息不存在 {}"
,
staffClerkRelation
.
getWxEnterpriseId
());
continue
;
}
QywxXcxSendMessageDTO
messageDTO
=
this
.
buildApplicationMessage
(
staffClerkRelation
,
wxEnterpriseQwDTO
,
customerStaticsBOMap
.
get
(
staffClerkRelation
.
getClerkId
()).
getNum
(),
context
.
buildExtendParams
(
staffClerkRelation
.
getStoreId
(),
staffClerkRelation
.
getClerkId
()));
boolean
sendMessage
=
qywxSuiteApiService
.
sendMessage
(
wxEnterpriseQwDTO
.
getThirdCorpid
(),
config
.
getWxSuiteid
(),
messageDTO
);
log
.
info
(
"发送销售线索应用消息结果 {}"
,
sendMessage
);
}
}
public
QywxXcxSendMessageDTO
buildApplicationMessage
(
StaffClerkRelationDTO
staffClerkRelation
,
WxEnterpriseQwDTO
wxEnterpriseQwDTO
,
int
count
)
{
public
QywxXcxSendMessageDTO
buildApplicationMessage
(
StaffClerkRelationDTO
staffClerkRelation
,
WxEnterpriseQwDTO
wxEnterpriseQwDTO
,
int
count
,
String
extendParams
)
{
StaffDTO
staffDTO
=
staffApiService
.
selectById
(
staffClerkRelation
.
getStaffId
());
String
wxUserId
=
staffDTO
.
getWxUserId
();
...
...
@@ -194,7 +205,7 @@ public class PotentialCustomerNotifyBuilder {
list
.
add
(
wxUserId
);
messageDTO
.
setAppid
(
config
.
getAppid
());
messageDTO
.
setUserIds
(
list
);
messageDTO
.
setPage
(
NoticeMessageUtil
.
buildMiniAppUrl
(
NoticeMessageTypeEnum
.
MATERIAL_REPORT_NOTIFY
,
""
));
messageDTO
.
setPage
(
NoticeMessageUtil
.
buildMiniAppUrl
(
NoticeMessageTypeEnum
.
MATERIAL_REPORT_NOTIFY
,
extendParams
));
messageDTO
.
setTitle
(
"销售线索通知"
);
messageDTO
.
setItems
(
Collections
.
singletonList
(
itemDTO
));
return
messageDTO
;
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/content/impl/PotentialCustomerServiceImpl.java
View file @
9b142dbe
...
...
@@ -227,6 +227,7 @@ public class PotentialCustomerServiceImpl implements PotentialCustomerService {
// 构建应用内消息
potentialCustomerNotifyBuilder
.
sendHaoBanNotifyMessage
(
context
);
// 如果该导购id是成员在主门店时的导购id 发送应用消息
// 如果本批数据中无成员主门店数据 则不发送
potentialCustomerNotifyBuilder
.
sendApplicationMessage
(
context
);
}
...
...
haoban-manage3-service/src/test/java/InteractRecordTest.java
View file @
9b142dbe
...
...
@@ -69,7 +69,7 @@ public class InteractRecordTest {
message
.
setMemberId
(
memberId
);
message
.
setUnionId
(
memberId
);
message
.
setStoreId
(
"ff8080818499a54801849ce85f9f003f"
);
message
.
setMaterialId
(
"123213
9123912
"
);
message
.
setMaterialId
(
"123213"
);
message
.
setChannelSource
(
TriggerCustomerChannelType
.
PYQ
.
getCode
());
message
.
setEventType
(
MaterialInteractRecordEventType
.
VISIT_PRODUCT
.
getCode
());
message
.
setGoodsId
(
"fbc508e395f846ef9005852c420e1c23"
);
...
...
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/controller/WxEnterpriseInfoController.java
View file @
9b142dbe
...
...
@@ -712,6 +712,8 @@ public class WxEnterpriseInfoController extends WebBaseController {
EnterpriseConfigVO
configVO
=
EnterpriseConfigVO
.
builder
()
.
miniAppId
(
enterpriseInfo
.
getMallMiniprogramAppid
())
.
mallMiniProgramLogoUrl
(
enterpriseInfo
.
getMallMiniprogramLogoUrl
())
.
mallMiniProgramLogoName
(
"金华达摩"
)
.
build
();
return
RestResponse
.
successResult
(
configVO
);
}
...
...
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/controller/content/ClerkMaterialShareController.java
View file @
9b142dbe
...
...
@@ -13,8 +13,10 @@ import com.gic.haoban.manage.api.enums.content.ShareBizType;
import
com.gic.haoban.manage.api.service.content.MaterialShareLogApiService
;
import
com.gic.haoban.manage.web.qo.content.ContentMaterialBaseQO
;
import
com.gic.haoban.manage.web.qo.content.log.MaterialShareLogQO
;
import
com.gic.haoban.manage.web.vo.content.ContentMaterialInfoVO
;
import
com.gic.haoban.manage.web.vo.content.SimpleGoodsInfoVO
;
import
com.gic.haoban.manage.web.vo.content.share.ContentMaterialLandingPageVO
;
import
com.google.common.base.Splitter
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
...
...
@@ -88,6 +90,16 @@ public class ClerkMaterialShareController {
return
RestResponse
.
failure
(
serviceResponse
.
getCode
(),
serviceResponse
.
getMessage
());
}
ContentMaterialLandingPageVO
materialLandingPageVO
=
EntityUtil
.
changeEntityByJSON
(
ContentMaterialLandingPageVO
.
class
,
serviceResponse
.
getResult
());
if
(
serviceResponse
.
getResult
()
!=
null
&&
serviceResponse
.
getResult
().
getContentMaterialInfo
()
!=
null
)
{
ContentMaterialInfoVO
contentMaterialInfo
=
materialLandingPageVO
.
getContentMaterialInfo
();
if
(
StringUtils
.
isNotBlank
(
serviceResponse
.
getResult
().
getContentMaterialInfo
().
getMaterialImageUrls
()))
{
contentMaterialInfo
.
setMaterialImageUrls
(
Splitter
.
on
(
","
).
splitToList
(
serviceResponse
.
getResult
().
getContentMaterialInfo
().
getMaterialImageUrls
()));
}
if
(
StringUtils
.
isNotBlank
(
serviceResponse
.
getResult
().
getContentMaterialInfo
().
getMaterialThumbnailImageUrls
()))
{
contentMaterialInfo
.
setMaterialThumbnailImageUrls
(
Splitter
.
on
(
","
).
splitToList
(
serviceResponse
.
getResult
().
getContentMaterialInfo
().
getMaterialImageUrls
()));
}
}
List
<
ContentGoodsDTO
>
goodsInfos
=
serviceResponse
.
getResult
().
getGoodsInfos
();
if
(
CollectionUtils
.
isNotEmpty
(
goodsInfos
))
{
List
<
SimpleGoodsInfoVO
>
goodsInfoVOS
=
goodsInfos
.
stream
()
...
...
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/vo/EnterpriseConfigVO.java
View file @
9b142dbe
...
...
@@ -23,4 +23,14 @@ public class EnterpriseConfigVO implements Serializable {
* 小程序id
*/
private
String
miniAppId
;
/**
* 小程序logo
*/
private
String
mallMiniProgramLogoUrl
;
/**
* 小程序名称
*/
private
String
mallMiniProgramLogoName
;
}
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