Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
O
operate-customer-service
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
沈振路
operate-customer-service
Commits
855b21cb
提交
855b21cb
authored
2月 05, 2026
作者:
沈振路
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
公众号延时客服添加小程序类型的发文素材【初测】
上级
47775cd2
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
64 行增加
和
6 行删除
+64
-6
CustomerServiceCommonAsyncComponent.java
...tomer/components/CustomerServiceCommonAsyncComponent.java
+10
-5
CustomerGraphicsDelayServiceImpl.java
...stomer/service/impl/CustomerGraphicsDelayServiceImpl.java
+54
-1
没有找到文件。
src/main/java/com/yaoyaozw/customer/components/CustomerServiceCommonAsyncComponent.java
浏览文件 @
855b21cb
...
@@ -168,7 +168,7 @@ public class CustomerServiceCommonAsyncComponent {
...
@@ -168,7 +168,7 @@ public class CustomerServiceCommonAsyncComponent {
referralEntity
.
setMediaOriginUrl
(
customerGraphics
.
getCoverUrl
());
referralEntity
.
setMediaOriginUrl
(
customerGraphics
.
getCoverUrl
());
referralEntity
.
setCustomerMsgType
(
customerGraphics
.
getType
());
referralEntity
.
setCustomerMsgType
(
customerGraphics
.
getType
());
// 获取链接
// 获取链接
if
(
CustomerCommonConstant
.
REMOTE_LINK_NEWS_TYPE_LIST
.
contains
(
referralEntity
.
getNewsType
())
||
if
(
CustomerCommonConstant
.
REMOTE_LINK_NEWS_TYPE_LIST
.
contains
(
referralEntity
.
getNewsType
())
||
CustomerCommonConstant
.
ACQUISITION_LINK_NEWS_TYPE
.
equals
(
referralEntity
.
getNewsType
()))
{
CustomerCommonConstant
.
ACQUISITION_LINK_NEWS_TYPE
.
equals
(
referralEntity
.
getNewsType
()))
{
getMessageAuthListLink
(
storeGroupMap
,
customerGraphics
,
referralEntity
);
getMessageAuthListLink
(
storeGroupMap
,
customerGraphics
,
referralEntity
);
}
else
{
}
else
{
...
@@ -408,7 +408,7 @@ public class CustomerServiceCommonAsyncComponent {
...
@@ -408,7 +408,7 @@ public class CustomerServiceCommonAsyncComponent {
private
void
generateMessageAcquisitionLink
(
Map
<
String
,
List
<
CrowdPackageUserVO
>>
storeGroupMap
,
ReferralEntity
customerReferral
)
{
private
void
generateMessageAcquisitionLink
(
Map
<
String
,
List
<
CrowdPackageUserVO
>>
storeGroupMap
,
ReferralEntity
customerReferral
)
{
LOCAL_LOG
.
info
(
"开始处理获客链接"
);
LOCAL_LOG
.
info
(
"开始处理获客链接"
);
Map
<
String
,
String
>
storeEntityMap
=
getStoreEntityMap
(
storeGroupMap
.
keySet
());
Map
<
String
,
String
>
storeEntityMap
=
getStoreEntityMap
(
storeGroupMap
.
keySet
());
// 缓存公众号appId对应的获客链接,避免重复查询数据库
// 缓存公众号appId对应的获客链接,避免重复查询数据库
Map
<
String
,
String
>
appIdAcquisitionLinkMap
=
new
HashMap
<>();
Map
<
String
,
String
>
appIdAcquisitionLinkMap
=
new
HashMap
<>();
...
@@ -468,7 +468,7 @@ public class CustomerServiceCommonAsyncComponent {
...
@@ -468,7 +468,7 @@ public class CustomerServiceCommonAsyncComponent {
// 缓存中没有,查询数据库
// 缓存中没有,查询数据库
try
{
try
{
List
<
String
>
acquisitionLinkList
=
companyAcquisitionLinkService
.
getAcquisitionLinksByAppId
(
appId
,
"OPERATE"
);
List
<
String
>
acquisitionLinkList
=
companyAcquisitionLinkService
.
getAcquisitionLinksByAppId
(
appId
,
"OPERATE"
);
String
acquisitionLink
=
null
;
String
acquisitionLink
=
null
;
if
(
CollectionUtil
.
isNotEmpty
(
acquisitionLinkList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
acquisitionLinkList
))
{
// 取第一个可用的获客链接
// 取第一个可用的获客链接
...
@@ -498,7 +498,7 @@ public class CustomerServiceCommonAsyncComponent {
...
@@ -498,7 +498,7 @@ public class CustomerServiceCommonAsyncComponent {
CustomerGraphicsDelay
targetCustomerGraphics
=
new
CustomerGraphicsDelay
();
CustomerGraphicsDelay
targetCustomerGraphics
=
new
CustomerGraphicsDelay
();
List
<
ReferralEntity
>
targetReferralEntityList
=
new
ArrayList
<>();
List
<
ReferralEntity
>
targetReferralEntityList
=
new
ArrayList
<>();
BeanUtil
.
copyProperties
(
sourceGraphics
,
targetCustomerGraphics
,
"sourceUrl"
);
BeanUtil
.
copyProperties
(
sourceGraphics
,
targetCustomerGraphics
,
"sourceUrl"
,
"mpPath"
,
"mpAppIds"
);
long
mainId
=
snowflakeComponent
.
snowflakeId
();
long
mainId
=
snowflakeComponent
.
snowflakeId
();
targetCustomerGraphics
.
setId
(
mainId
);
targetCustomerGraphics
.
setId
(
mainId
);
targetCustomerGraphics
.
setAuthorizerInfo
(
targetAuthInfo
);
targetCustomerGraphics
.
setAuthorizerInfo
(
targetAuthInfo
);
...
@@ -516,7 +516,7 @@ public class CustomerServiceCommonAsyncComponent {
...
@@ -516,7 +516,7 @@ public class CustomerServiceCommonAsyncComponent {
for
(
ReferralEntity
sourceReferralEntity
:
sourceReferralList
)
{
for
(
ReferralEntity
sourceReferralEntity
:
sourceReferralList
)
{
// 生成新的链接数据
// 生成新的链接数据
ReferralEntity
targetReferralEntity
=
new
ReferralEntity
();
ReferralEntity
targetReferralEntity
=
new
ReferralEntity
();
BeanUtil
.
copyProperties
(
sourceReferralEntity
,
targetReferralEntity
,
"referral"
);
BeanUtil
.
copyProperties
(
sourceReferralEntity
,
targetReferralEntity
,
"referral"
,
"mpAppId"
,
"mpPath"
);
if
(
sourceReferralEntity
.
getNewsType
().
equals
(-
1
))
{
if
(
sourceReferralEntity
.
getNewsType
().
equals
(-
1
))
{
// 自定义链接延用链接
// 自定义链接延用链接
targetReferralEntity
.
setReferral
(
companyAcquisitionLinkService
.
checkAndSearchTargetReferral
(
sourceReferralEntity
.
getReferral
(),
targetAuthInfo
.
getId
()));
targetReferralEntity
.
setReferral
(
companyAcquisitionLinkService
.
checkAndSearchTargetReferral
(
sourceReferralEntity
.
getReferral
(),
targetAuthInfo
.
getId
()));
...
@@ -550,6 +550,11 @@ public class CustomerServiceCommonAsyncComponent {
...
@@ -550,6 +550,11 @@ public class CustomerServiceCommonAsyncComponent {
normal
=
false
;
normal
=
false
;
}
}
targetCustomerGraphics
.
setSourceUrl
(
referral
);
targetCustomerGraphics
.
setSourceUrl
(
referral
);
if
(
CUSTOMER_TYPE_VALUE_MINI_PROGRAM
.
equals
(
targetCustomerGraphics
.
getType
()))
{
// 小程序类型
targetCustomerGraphics
.
setMpPath
(
targetReferralEntity
.
getMpPath
());
targetCustomerGraphics
.
setMpAppId
(
targetReferralEntity
.
getMpAppId
());
}
if
(
type
.
equals
(
CustomerCommonConstant
.
CUSTOMER_TYPE_VALUE_TEXT
))
{
if
(
type
.
equals
(
CustomerCommonConstant
.
CUSTOMER_TYPE_VALUE_TEXT
))
{
// 文本类型替换h5链接
// 文本类型替换h5链接
String
context
=
null
;
String
context
=
null
;
...
...
src/main/java/com/yaoyaozw/customer/service/impl/CustomerGraphicsDelayServiceImpl.java
浏览文件 @
855b21cb
...
@@ -13,12 +13,14 @@ import com.yaoyaozw.customer.components.CustomerServiceCommonAsyncComponent;
...
@@ -13,12 +13,14 @@ import com.yaoyaozw.customer.components.CustomerServiceCommonAsyncComponent;
import
com.yaoyaozw.customer.components.SnowflakeComponent
;
import
com.yaoyaozw.customer.components.SnowflakeComponent
;
import
com.yaoyaozw.customer.components.TokenManager
;
import
com.yaoyaozw.customer.components.TokenManager
;
import
com.yaoyaozw.customer.constants.CustomerCommonConstant
;
import
com.yaoyaozw.customer.constants.CustomerCommonConstant
;
import
com.yaoyaozw.customer.constants.CustomerMaterialConstant
;
import
com.yaoyaozw.customer.dto.customer.CustomerDelayQueryDTO
;
import
com.yaoyaozw.customer.dto.customer.CustomerDelayQueryDTO
;
import
com.yaoyaozw.customer.dto.customer.CustomerDelaySaveDTO
;
import
com.yaoyaozw.customer.dto.customer.CustomerDelaySaveDTO
;
import
com.yaoyaozw.customer.entity.CommonReferralBody
;
import
com.yaoyaozw.customer.entity.CommonReferralBody
;
import
com.yaoyaozw.customer.entity.AuthorizerInfo
;
import
com.yaoyaozw.customer.entity.AuthorizerInfo
;
import
com.yaoyaozw.customer.entity.CustomerGraphicsDelay
;
import
com.yaoyaozw.customer.entity.CustomerGraphicsDelay
;
import
com.yaoyaozw.customer.entity.ReferralEntity
;
import
com.yaoyaozw.customer.entity.ReferralEntity
;
import
com.yaoyaozw.customer.exception.BaseException
;
import
com.yaoyaozw.customer.mapper.AuthorizerTokenMapper
;
import
com.yaoyaozw.customer.mapper.AuthorizerTokenMapper
;
import
com.yaoyaozw.customer.mapper.CustomerGraphicsDelayMapper
;
import
com.yaoyaozw.customer.mapper.CustomerGraphicsDelayMapper
;
import
com.yaoyaozw.customer.mapper.KanbanCommonMapper
;
import
com.yaoyaozw.customer.mapper.KanbanCommonMapper
;
...
@@ -26,7 +28,9 @@ import com.yaoyaozw.customer.mapper.MaterialCommonMapper;
...
@@ -26,7 +28,9 @@ import com.yaoyaozw.customer.mapper.MaterialCommonMapper;
import
com.yaoyaozw.customer.service.AuthorizerInfoService
;
import
com.yaoyaozw.customer.service.AuthorizerInfoService
;
import
com.yaoyaozw.customer.service.CustomerGraphicsDelayService
;
import
com.yaoyaozw.customer.service.CustomerGraphicsDelayService
;
import
com.yaoyaozw.customer.service.ReferralEntityService
;
import
com.yaoyaozw.customer.service.ReferralEntityService
;
import
com.yaoyaozw.customer.utils.TencentCustomerUtil
;
import
com.yaoyaozw.customer.vo.AuthInfoVO
;
import
com.yaoyaozw.customer.vo.AuthInfoVO
;
import
com.yaoyaozw.customer.vo.TencentMediaResponseVO
;
import
com.yaoyaozw.customer.vo.kanban.AccountSetupVO
;
import
com.yaoyaozw.customer.vo.kanban.AccountSetupVO
;
import
com.yaoyaozw.customer.vo.kanban.CommonOptionResponseVO
;
import
com.yaoyaozw.customer.vo.kanban.CommonOptionResponseVO
;
import
com.yaoyaozw.customer.vo.customer.CustomerDelayGraphicsDetailVO
;
import
com.yaoyaozw.customer.vo.customer.CustomerDelayGraphicsDetailVO
;
...
@@ -48,6 +52,8 @@ import java.util.function.Function;
...
@@ -48,6 +52,8 @@ import java.util.function.Function;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
import
java.util.stream.Stream
;
import
static
com
.
yaoyaozw
.
customer
.
constants
.
CustomerCommonConstant
.
CUSTOMER_TYPE_VALUE_MINI_PROGRAM
;
/**
/**
* @author darker
* @author darker
* @date 2022/9/15 11:13
* @date 2022/9/15 11:13
...
@@ -79,6 +85,8 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi
...
@@ -79,6 +85,8 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi
private
RedisTemplate
<
String
,
Object
>
redisTemplate
;
private
RedisTemplate
<
String
,
Object
>
redisTemplate
;
@Autowired
@Autowired
private
AuthorizerTokenMapper
authorizerTokenMapper
;
private
AuthorizerTokenMapper
authorizerTokenMapper
;
@Autowired
private
TencentCustomerUtil
tencentCustomerUtil
;
@Override
@Override
...
@@ -122,8 +130,16 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi
...
@@ -122,8 +130,16 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi
localLog
.
info
(
"生成referral数据"
);
localLog
.
info
(
"生成referral数据"
);
ReferralEntity
referralEntity
=
new
ReferralEntity
();
ReferralEntity
referralEntity
=
new
ReferralEntity
();
BeanUtil
.
copyProperties
(
saveDto
.
getCustomerReferralDto
(),
referralEntity
);
// 将标题字段,赋值给referral体
CommonReferralBody
commonReferralBody
=
saveDto
.
getCustomerReferralDto
();
if
(
CUSTOMER_TYPE_VALUE_MINI_PROGRAM
.
equals
(
customerGraphicsDelay
.
getType
()))
{
customerGraphicsDelay
.
setMpTitle
(
customerGraphicsDelay
.
getExtendTitle
());
commonReferralBody
.
setMpTitle
(
customerGraphicsDelay
.
getMpTitle
());
}
BeanUtil
.
copyProperties
(
commonReferralBody
,
referralEntity
);
referralEntity
.
setMaterialGraphicsId
(
customerGraphicsDelay
.
getId
());
referralEntity
.
setMaterialGraphicsId
(
customerGraphicsDelay
.
getId
());
referralEntity
.
setCustomerMsgType
(
customerGraphicsDelay
.
getType
());
// 非自定义获取链接
// 非自定义获取链接
if
(!
referralEntity
.
getNewsType
().
equals
(-
1
))
{
if
(!
referralEntity
.
getNewsType
().
equals
(-
1
))
{
...
@@ -146,6 +162,11 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi
...
@@ -146,6 +162,11 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi
commonAsyncComponent
.
dispatchDelay
(
dateStr
,
authInfoVO
,
referralEntity
);
commonAsyncComponent
.
dispatchDelay
(
dateStr
,
authInfoVO
,
referralEntity
);
customerGraphicsDelay
.
setSendStatus
(
CustomerCommonConstant
.
SEND_STATUS_ACTIVE
);
customerGraphicsDelay
.
setSendStatus
(
CustomerCommonConstant
.
SEND_STATUS_ACTIVE
);
localLog
.
info
(
"链接获取完成"
);
localLog
.
info
(
"链接获取完成"
);
try
{
handleTxMedia
(
customerGraphicsDelay
,
authorizerInfo
);
}
catch
(
Exception
e
)
{
return
new
BaseResult
().
error
(
"上传素材异常:"
+
e
.
getMessage
());
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
localLog
.
info
(
"获取链接异常"
);
localLog
.
info
(
"获取链接异常"
);
return
new
BaseResult
().
error
(
"获取链接异常"
+
e
.
getMessage
());
return
new
BaseResult
().
error
(
"获取链接异常"
+
e
.
getMessage
());
...
@@ -153,6 +174,10 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi
...
@@ -153,6 +174,10 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi
}
}
try
{
try
{
customerGraphicsDelay
.
setSourceUrl
(
referralEntity
.
getReferral
());
customerGraphicsDelay
.
setSourceUrl
(
referralEntity
.
getReferral
());
if
(
CUSTOMER_TYPE_VALUE_MINI_PROGRAM
.
equals
(
customerGraphicsDelay
.
getType
()))
{
customerGraphicsDelay
.
setMpPath
(
referralEntity
.
getMpPath
());
}
customerGraphicsDelay
.
setMpAppId
(
referralEntity
.
getMpAppId
());
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
return
new
BaseResult
().
error
(
e
.
getMessage
());
return
new
BaseResult
().
error
(
e
.
getMessage
());
}
}
...
@@ -172,6 +197,29 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi
...
@@ -172,6 +197,29 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi
return
new
BaseResult
().
success
();
return
new
BaseResult
().
success
();
}
}
private
void
handleTxMedia
(
CustomerGraphicsDelay
entity
,
AuthorizerInfo
authorizerInfo
)
{
if
(
CustomerMaterialConstant
.
needUpload
(
entity
.
getType
()))
{
// 编辑的时候,删除原来的media
if
(
entity
.
getId
()
!=
null
)
{
if
(
StringUtils
.
isNotBlank
(
entity
.
getTxMediaId
()))
{
TencentMediaResponseVO
removeResponse
=
tencentCustomerUtil
.
removePermanentMedia
(
authorizerInfo
.
getAppid
(),
entity
.
getTxMediaId
());
if
(
ObjectUtil
.
isNull
(
removeResponse
.
getErrcode
())
||
removeResponse
.
getErrcode
()
!=
0
)
{
throw
new
BaseException
(
"删除原本素材失败: "
+
removeResponse
.
getErrmsg
());
}
}
}
// 上传文件
TencentMediaResponseVO
uploadResponse
=
tencentCustomerUtil
.
uploadTencentMedia
(
authorizerInfo
.
getAppid
(),
entity
.
getCoverUrl
(),
entity
.
getType
());
if
(
StringUtils
.
isNotBlank
(
uploadResponse
.
getErrmsg
()))
{
// 上传失败
throw
new
BaseException
(
"上传素材失败: "
+
uploadResponse
.
getErrmsg
());
}
entity
.
setTxMediaUrl
(
uploadResponse
.
getUrl
());
entity
.
setTxMediaId
(
uploadResponse
.
getMedia_id
());
}
}
@Override
@Override
public
GenericsResult
<
CustomerDelayGraphicsDetailVO
>
getCustomerDelayDetail
(
Long
id
)
{
public
GenericsResult
<
CustomerDelayGraphicsDetailVO
>
getCustomerDelayDetail
(
Long
id
)
{
CustomerGraphicsDelay
customerGraphicsDelay
=
super
.
getById
(
id
);
CustomerGraphicsDelay
customerGraphicsDelay
=
super
.
getById
(
id
);
...
@@ -296,6 +344,11 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi
...
@@ -296,6 +344,11 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi
// 遍历要复用的素材
// 遍历要复用的素材
for
(
CustomerGraphicsDelay
item
:
sourceCustomerList
)
{
for
(
CustomerGraphicsDelay
item
:
sourceCustomerList
)
{
// 清空原本的链接等公众号专属字段
item
.
setSourceUrl
(
null
);
item
.
setMpPath
(
null
);
item
.
setMpAppId
(
null
);
// 设置所属链接
// 设置所属链接
item
.
setBelongReferralList
(
referralGroupMap
.
get
(
item
.
getId
()));
item
.
setBelongReferralList
(
referralGroupMap
.
get
(
item
.
getId
()));
// 为公众号设置书城名
// 为公众号设置书城名
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论