Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
O
operate-customer-service
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
沈振路
operate-customer-service
Commits
a8a134cb
提交
a8a134cb
authored
8月 08, 2024
作者:
卢宇
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
发送客服消息适配小程序
上级
8acace10
隐藏空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
104 行增加
和
10 行删除
+104
-10
ReferralEntity.java
...ain/java/com/yaoyaozw/customer/entity/ReferralEntity.java
+4
-0
ReferralEntityMapper.java
...va/com/yaoyaozw/customer/mapper/ReferralEntityMapper.java
+3
-0
ReferralEntityService.java
.../com/yaoyaozw/customer/service/ReferralEntityService.java
+7
-0
CustomerGraphicsMiniProgramServiceImpl.java
.../service/impl/CustomerGraphicsMiniProgramServiceImpl.java
+7
-2
CustomerGraphicsServiceImpl.java
...zw/customer/service/impl/CustomerGraphicsServiceImpl.java
+23
-8
ReferralEntityServiceImpl.java
...aozw/customer/service/impl/ReferralEntityServiceImpl.java
+6
-0
CustomerMiniProgram.java
...ce/wechat/entity/customerRequest/CustomerMiniProgram.java
+20
-0
WeChatCustomerRequestEntity.java
...t/entity/customerRequest/WeChatCustomerRequestEntity.java
+8
-0
WeChatServiceImpl.java
...zw/customer/service/wechat/service/WeChatServiceImpl.java
+8
-0
ReferralEntityVo.java
...a/com/yaoyaozw/customer/vo/referral/ReferralEntityVo.java
+10
-0
ReferralEntityMapper.xml
src/main/resources/mapper/ReferralEntityMapper.xml
+8
-0
没有找到文件。
src/main/java/com/yaoyaozw/customer/entity/ReferralEntity.java
浏览文件 @
a8a134cb
...
...
@@ -226,6 +226,10 @@ public class ReferralEntity implements Serializable {
@ApiModelProperty
(
"小程序跳转路径"
)
private
String
mpPath
;
@TableField
(
value
=
"media_id"
)
@ApiModelProperty
(
"图片公众号后台id"
)
private
String
mediaId
;
@TableField
(
exist
=
false
)
private
String
h5Content
;
...
...
src/main/java/com/yaoyaozw/customer/mapper/ReferralEntityMapper.java
浏览文件 @
a8a134cb
...
...
@@ -36,4 +36,6 @@ public interface ReferralEntityMapper extends BaseMapper<ReferralEntity> {
* @param extraCondition 特殊条件表达式
*/
void
ultimateDeleteReferralsBatch
(
@Param
(
"sourceIdList"
)
List
<
Long
>
sourceIdList
,
@Param
(
"extraCondition"
)
String
extraCondition
);
List
<
ReferralEntityVo
>
findReferralMiniByCustomerGraphicsId
(
@Param
(
"graphicsId"
)
Long
graphicsId
);
}
\ No newline at end of file
src/main/java/com/yaoyaozw/customer/service/ReferralEntityService.java
浏览文件 @
a8a134cb
...
...
@@ -35,4 +35,11 @@ public interface ReferralEntityService extends IService<ReferralEntity> {
* @return
*/
List
<
ReferralEntityVo
>
findReferralByCustomerGraphicsId
(
Long
graphicsId
);
/**
* 根据客服id找小程序链接
* @param graphicsId 客服主体id
* @return
*/
List
<
ReferralEntityVo
>
findReferralMiniByCustomerGraphicsId
(
Long
graphicsId
);
}
src/main/java/com/yaoyaozw/customer/service/impl/CustomerGraphicsMiniProgramServiceImpl.java
浏览文件 @
a8a134cb
package
com
.
yaoyaozw
.
customer
.
service
.
impl
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
...
...
@@ -24,6 +25,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
@Service
public
class
CustomerGraphicsMiniProgramServiceImpl
extends
ServiceImpl
<
CustomerGraphicsMapper
,
CustomerGraphics
>
implements
CustomerGraphicsMiniProgramService
{
...
...
@@ -84,11 +87,13 @@ public class CustomerGraphicsMiniProgramServiceImpl extends ServiceImpl<Customer
miniProgramDTO
.
setPostTime
(
customerGraphics
.
getPostTimeStr
());
// 获取链接数据
ReferralEntity
referralEntity
=
referralEntityService
.
getOne
(
new
QueryWrapper
<
ReferralEntity
>().
eq
(
"material_graphics_id"
,
id
).
isNull
(
"account_id"
));
List
<
ReferralEntity
>
referralEntityList
=
referralEntityService
.
list
(
new
QueryWrapper
<
ReferralEntity
>().
eq
(
"material_graphics_id"
,
id
).
eq
(
"is_deleted"
,
0
).
isNull
(
"account_id"
));
if
(
ObjectUtil
.
isNull
(
referralEntity
))
{
if
(
CollectionUtil
.
isEmpty
(
referralEntityList
))
{
return
new
GenericsResult
<>(
false
,
"找不到链接数据"
);
}
ReferralEntity
referralEntity
=
referralEntityList
.
get
(
0
);
miniProgramDTO
.
setMpAppId
(
referralEntity
.
getMpAppId
());
miniProgramDTO
.
setMpTitle
(
referralEntity
.
getMpTitle
());
miniProgramDTO
.
setMpPath
(
referralEntity
.
getMpPath
());
...
...
src/main/java/com/yaoyaozw/customer/service/impl/CustomerGraphicsServiceImpl.java
浏览文件 @
a8a134cb
...
...
@@ -42,6 +42,8 @@ import com.yaoyaozw.customer.service.CustomerGraphicsService;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.interceptor.TransactionAspectSupport
;
import
static
com
.
yaoyaozw
.
customer
.
constants
.
CustomerCommonConstant
.
CUSTOMER_TYPE_VALUE_MINI_PROGRAM
;
import
static
com
.
yaoyaozw
.
customer
.
constants
.
CustomerMaterialConstant
.
TENCENT_MEDIA_TYPE_MINI_PROGRAM
;
import
static
java
.
util
.
stream
.
Collectors
.
toCollection
;
/**
...
...
@@ -260,21 +262,34 @@ public class CustomerGraphicsServiceImpl extends ServiceImpl<CustomerGraphicsMap
.
collect
(
Collectors
.
groupingBy
(
CrowdPackageUserVO:
:
getAppId
,
Collectors
.
collectingAndThen
(
toCollection
(()
->
new
TreeSet
<>(
Comparator
.
comparing
(
CrowdPackageUserVO:
:
getOpenId
))),
ArrayList:
:
new
)));
//根据客服id找不同公众号的链接,并按appId分组
List
<
ReferralEntityVo
>
referralList
=
referralEntityService
.
findReferralByCustomerGraphicsId
(
customerGraphics
.
getId
());
Map
<
String
,
List
<
ReferralEntityVo
>>
referralMap
=
referralList
.
stream
().
filter
(
a
->
StringUtils
.
isNotBlank
(
a
.
getReferral
())).
collect
(
Collectors
.
groupingBy
(
ReferralEntityVo:
:
getAppid
));
List
<
ReferralEntityVo
>
referralList
=
new
ArrayList
<>();
Map
<
String
,
List
<
ReferralEntityVo
>>
referralMap
=
new
HashMap
<>();
if
(
customerGraphics
.
getType
().
equals
(
CUSTOMER_TYPE_VALUE_MINI_PROGRAM
)){
referralList
=
referralEntityService
.
findReferralMiniByCustomerGraphicsId
(
customerGraphics
.
getId
());
}
else
{
referralList
=
referralEntityService
.
findReferralByCustomerGraphicsId
(
customerGraphics
.
getId
());
referralMap
=
referralList
.
stream
().
filter
(
a
->
StringUtils
.
isNotBlank
(
a
.
getReferral
())).
collect
(
Collectors
.
groupingBy
(
ReferralEntityVo:
:
getAppid
));
}
//循环该人群包下的所有素材
int
singleUserCount
=
0
;
for
(
Map
.
Entry
<
String
,
List
<
CrowdPackageUserVO
>>
usersEntry
:
appidUserMap
.
entrySet
())
{
String
appid
=
usersEntry
.
getKey
();
try
{
//获取该号的链接实体
List
<
ReferralEntityVo
>
referralEntityVo
=
referralMap
.
get
(
appid
);
//获取该号的openid
List
<
CrowdPackageUserVO
>
packageUserVo
=
usersEntry
.
getValue
();
singleUserCount
+=
packageUserVo
.
size
();
weChatService
.
sendCustomerMessage
(
appid
,
customerGraphics
,
packageUserVo
,
referralEntityVo
);
if
(
customerGraphics
.
getType
().
equals
(
CUSTOMER_TYPE_VALUE_MINI_PROGRAM
)){
//获取该号的openid
List
<
CrowdPackageUserVO
>
packageUserVo
=
usersEntry
.
getValue
();
singleUserCount
+=
packageUserVo
.
size
();
weChatService
.
sendCustomerMessage
(
appid
,
customerGraphics
,
packageUserVo
,
referralList
);
}
else
{
List
<
ReferralEntityVo
>
referralEntityVo
=
referralMap
.
get
(
appid
);
//获取该号的openid
List
<
CrowdPackageUserVO
>
packageUserVo
=
usersEntry
.
getValue
();
singleUserCount
+=
packageUserVo
.
size
();
weChatService
.
sendCustomerMessage
(
appid
,
customerGraphics
,
packageUserVo
,
referralEntityVo
);
}
}
catch
(
Exception
e
){
LOCAL_LOG
.
error
(
"{} send CustomerMessage failed for {}"
,
appid
,
e
.
getStackTrace
()[
0
]);
}
...
...
src/main/java/com/yaoyaozw/customer/service/impl/ReferralEntityServiceImpl.java
浏览文件 @
a8a134cb
...
...
@@ -9,6 +9,7 @@ import com.yaoyaozw.customer.service.ReferralEntityService;
import
com.yaoyaozw.customer.vo.referral.ReferralEntityVo
;
import
org.springframework.stereotype.Service
;
import
java.util.Collections
;
import
java.util.List
;
/**
...
...
@@ -39,4 +40,9 @@ public class ReferralEntityServiceImpl extends ServiceImpl<ReferralEntityMapper,
return
baseMapper
.
findByMaterialGraphicsId
(
graphicsId
);
}
@Override
public
List
<
ReferralEntityVo
>
findReferralMiniByCustomerGraphicsId
(
Long
graphicsId
)
{
return
baseMapper
.
findReferralMiniByCustomerGraphicsId
(
graphicsId
);
}
}
src/main/java/com/yaoyaozw/customer/service/wechat/entity/customerRequest/CustomerMiniProgram.java
0 → 100644
浏览文件 @
a8a134cb
package
com
.
yaoyaozw
.
customer
.
service
.
wechat
.
entity
.
customerRequest
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
@Data
@NoArgsConstructor
@AllArgsConstructor
public
class
CustomerMiniProgram
{
private
String
title
;
private
String
appId
;
private
String
pagepath
;
private
String
thumb_media_id
;
}
src/main/java/com/yaoyaozw/customer/service/wechat/entity/customerRequest/WeChatCustomerRequestEntity.java
浏览文件 @
a8a134cb
...
...
@@ -22,6 +22,8 @@ public class WeChatCustomerRequestEntity implements Serializable {
private
CustomerTextItem
text
;
private
CustomerMiniProgram
miniprogrampage
;
public
WeChatCustomerRequestEntity
(
String
msgtype
,
String
title
,
String
description
,
String
url
,
String
picurl
)
{
this
.
msgtype
=
msgtype
;
...
...
@@ -34,6 +36,12 @@ public class WeChatCustomerRequestEntity implements Serializable {
this
.
text
=
new
CustomerTextItem
(
content
);
}
public
WeChatCustomerRequestEntity
(
String
msgtype
,
String
mpTitle
,
String
mpAppId
,
String
mpPath
,
String
mediaId
,
String
id
)
{
this
.
msgtype
=
msgtype
;
this
.
miniprogrampage
=
new
CustomerMiniProgram
(
mpTitle
,
mpAppId
,
mpPath
,
mediaId
);
}
public
WeChatCustomerRequestEntity
()
{
}
...
...
src/main/java/com/yaoyaozw/customer/service/wechat/service/WeChatServiceImpl.java
浏览文件 @
a8a134cb
...
...
@@ -15,6 +15,8 @@ import com.yaoyaozw.customer.vo.customer.CrowdPackageUserVO;
import
com.yaoyaozw.customer.vo.customer.CustomerDelayItemVO
;
import
com.yaoyaozw.customer.vo.referral.ReferralEntityVo
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.amqp.rabbit.core.RabbitTemplate
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisTemplate
;
...
...
@@ -35,6 +37,8 @@ public class WeChatServiceImpl implements WeChatService{
private
static
final
String
CUSTOMER_NEWS
=
"news"
;
private
static
final
String
MINI_PROGRAM
=
"miniProgram"
;
private
static
final
int
THREAD_SIZE
=
1000
;
private
static
final
Integer
SUCCESS_CODE
=
0
;
...
...
@@ -228,6 +232,10 @@ public class WeChatServiceImpl implements WeChatService{
if
(
urlList
!=
null
&&!
urlList
.
isEmpty
()){
return
new
WeChatCustomerRequestEntity
(
CUSTOMER_NEWS
,
customerGraphics
.
getExtendTitle
(),
customerGraphics
.
getContent
(),
urlList
.
get
(
0
).
getReferral
(),
customerGraphics
.
getCoverUrl
());
}
}
else
if
(
MINI_PROGRAM
.
equals
(
customerGraphics
.
getType
())){
if
(
urlList
!=
null
&&!
urlList
.
isEmpty
()){
return
new
WeChatCustomerRequestEntity
(
MINI_PROGRAM
,
urlList
.
get
(
0
).
getMpTitle
(),
urlList
.
get
(
0
).
getMpAppId
(),
urlList
.
get
(
0
).
getMpPath
(),
urlList
.
get
(
0
).
getMediaId
(),
null
);
}
}
return
null
;
}
...
...
src/main/java/com/yaoyaozw/customer/vo/referral/ReferralEntityVo.java
浏览文件 @
a8a134cb
package
com
.
yaoyaozw
.
customer
.
vo
.
referral
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
...
...
@@ -21,5 +23,13 @@ public class ReferralEntityVo implements Serializable {
private
Integer
sort
;
private
String
mpTitle
;
private
String
mpAppId
;
private
String
mpPath
;
private
String
mediaId
;
}
src/main/resources/mapper/ReferralEntityMapper.xml
浏览文件 @
a8a134cb
...
...
@@ -48,6 +48,14 @@
</select>
<select
id=
"findReferralMiniByCustomerGraphicsId"
resultType=
"com.yaoyaozw.customer.vo.referral.ReferralEntityVo"
>
select material_graphics_id ,referral.account_id,referral.referral,referral.sort,referral.mp_title,referral.mp_app_id,referral.mp_path,
referral.media_id
from referral_entity referral
where referral.material_graphics_id=#{graphicsId} and referral.is_deleted=0
</select>
<delete
id=
"ultimateDeleteReferralsBatch"
>
delete from referral_entity
where material_graphics_id in
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论