Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
O
operate-customer-service
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
沈振路
operate-customer-service
Commits
1880b4a1
提交
1880b4a1
authored
11月 04, 2023
作者:
沈振路
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
关回多图文复用处理
上级
61ba3207
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
35 行增加
和
5 行删除
+35
-5
FollowReplyComponent.java
...om/yaoyaozw/customer/components/FollowReplyComponent.java
+10
-1
CustomerMaterialConstant.java
...yaoyaozw/customer/constants/CustomerMaterialConstant.java
+2
-0
CustomerFollowReplyMultiNewsServiceImpl.java
...service/impl/CustomerFollowReplyMultiNewsServiceImpl.java
+3
-3
CustomerFollowReplyServiceImpl.java
...customer/service/impl/CustomerFollowReplyServiceImpl.java
+20
-1
没有找到文件。
src/main/java/com/yaoyaozw/customer/components/FollowReplyComponent.java
浏览文件 @
1880b4a1
...
@@ -2,6 +2,7 @@ package com.yaoyaozw.customer.components;
...
@@ -2,6 +2,7 @@ package com.yaoyaozw.customer.components;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.json.JSONUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.TypeReference
;
import
com.alibaba.fastjson.TypeReference
;
...
@@ -9,6 +10,7 @@ import com.yaoyaozw.customer.common.R;
...
@@ -9,6 +10,7 @@ import com.yaoyaozw.customer.common.R;
import
com.yaoyaozw.customer.constants.ApiResultConstant
;
import
com.yaoyaozw.customer.constants.ApiResultConstant
;
import
com.yaoyaozw.customer.constants.CustomerCommonConstant
;
import
com.yaoyaozw.customer.constants.CustomerCommonConstant
;
import
com.yaoyaozw.customer.constants.CustomerMaterialConstant
;
import
com.yaoyaozw.customer.constants.CustomerMaterialConstant
;
import
com.yaoyaozw.customer.dto.follow.NewsMessageReplyEntity
;
import
com.yaoyaozw.customer.entity.CommonReferralBody
;
import
com.yaoyaozw.customer.entity.CommonReferralBody
;
import
com.yaoyaozw.customer.entity.CustomerFollowReply
;
import
com.yaoyaozw.customer.entity.CustomerFollowReply
;
import
com.yaoyaozw.customer.entity.CustomerFollowReplyMultiNews
;
import
com.yaoyaozw.customer.entity.CustomerFollowReplyMultiNews
;
...
@@ -24,6 +26,7 @@ import org.apache.commons.lang3.StringUtils;
...
@@ -24,6 +26,7 @@ import org.apache.commons.lang3.StringUtils;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
...
@@ -48,6 +51,8 @@ public class FollowReplyComponent {
...
@@ -48,6 +51,8 @@ public class FollowReplyComponent {
private
ReferralFeignClient
referralFeignClient
;
private
ReferralFeignClient
referralFeignClient
;
@Autowired
@Autowired
private
SnowflakeComponent
snowflakeComponent
;
private
SnowflakeComponent
snowflakeComponent
;
@Autowired
private
RedisTemplate
<
String
,
Object
>
redisTemplate
;
/**
/**
* 获取链接实体
* 获取链接实体
...
@@ -206,6 +211,7 @@ public class FollowReplyComponent {
...
@@ -206,6 +211,7 @@ public class FollowReplyComponent {
finalMaterialList
.
add
(
entity
);
finalMaterialList
.
add
(
entity
);
}
else
{
}
else
{
// 多图文
// 多图文
redisTemplate
.
opsForHash
().
delete
(
CustomerMaterialConstant
.
FOLLOW_REPLY_MULTI_NEWS_CACHE_KEY
,
targetAuth
.
getAppId
());
List
<
CustomerFollowReplyMultiNews
>
sourceMultiNewsList
=
sourceMaterial
.
getMultiNewsList
();
List
<
CustomerFollowReplyMultiNews
>
sourceMultiNewsList
=
sourceMaterial
.
getMultiNewsList
();
for
(
CustomerFollowReplyMultiNews
sourceMultiNews
:
sourceMultiNewsList
)
{
for
(
CustomerFollowReplyMultiNews
sourceMultiNews
:
sourceMultiNewsList
)
{
ReferralEntity
sourceReferralEntity
=
sourceMultiNews
.
getReferralEntity
();
ReferralEntity
sourceReferralEntity
=
sourceMultiNews
.
getReferralEntity
();
...
@@ -229,7 +235,10 @@ public class FollowReplyComponent {
...
@@ -229,7 +235,10 @@ public class FollowReplyComponent {
result
.
setMaterialList
(
finalMaterialList
);
result
.
setMaterialList
(
finalMaterialList
);
result
.
setReferralEntityList
(
finalReferralList
);
result
.
setReferralEntityList
(
finalReferralList
);
result
.
setMultiNewsList
(
finalMultiNewsList
);
result
.
setMultiNewsList
(
finalMultiNewsList
);
if
(
CollectionUtil
.
isNotEmpty
(
finalMultiNewsList
))
{
List
<
NewsMessageReplyEntity
>
cacheEntityList
=
JSONUtil
.
toList
(
JSONUtil
.
parseArray
(
finalMultiNewsList
),
NewsMessageReplyEntity
.
class
);
redisTemplate
.
opsForHash
().
put
(
CustomerMaterialConstant
.
FOLLOW_REPLY_MULTI_NEWS_CACHE_KEY
,
targetAuth
.
getAppId
(),
JSONUtil
.
toJsonStr
(
cacheEntityList
));
}
return
result
;
return
result
;
}
}
...
...
src/main/java/com/yaoyaozw/customer/constants/CustomerMaterialConstant.java
浏览文件 @
1880b4a1
...
@@ -14,6 +14,8 @@ public class CustomerMaterialConstant {
...
@@ -14,6 +14,8 @@ public class CustomerMaterialConstant {
public
final
static
String
FOLLOW_REPLY_REDIS_KEY
=
"followReplyMap"
;
public
final
static
String
FOLLOW_REPLY_REDIS_KEY
=
"followReplyMap"
;
public
final
static
String
CUSTOMER_KEYWORD_REDIS_KEY
=
"customerKeywordMap"
;
public
final
static
String
CUSTOMER_KEYWORD_REDIS_KEY
=
"customerKeywordMap"
;
public
final
static
String
FOLLOW_REPLY_MULTI_NEWS_CACHE_KEY
=
"followReplyMultiNews"
;
public
final
static
String
TENCENT_MEDIA_TYPE_PIC
=
"image"
;
public
final
static
String
TENCENT_MEDIA_TYPE_PIC
=
"image"
;
public
final
static
String
TENCENT_MEDIA_TYPE_VOICE
=
"voice"
;
public
final
static
String
TENCENT_MEDIA_TYPE_VOICE
=
"voice"
;
public
final
static
String
TENCENT_MEDIA_TYPE_NEWS
=
"news"
;
public
final
static
String
TENCENT_MEDIA_TYPE_NEWS
=
"news"
;
...
...
src/main/java/com/yaoyaozw/customer/service/impl/CustomerFollowReplyMultiNewsServiceImpl.java
浏览文件 @
1880b4a1
...
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
...
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yaoyaozw.customer.components.FollowReplyComponent
;
import
com.yaoyaozw.customer.components.FollowReplyComponent
;
import
com.yaoyaozw.customer.components.SnowflakeComponent
;
import
com.yaoyaozw.customer.components.SnowflakeComponent
;
import
com.yaoyaozw.customer.constants.CustomerMaterialConstant
;
import
com.yaoyaozw.customer.dto.follow.FollowReplyMultiNewsCreateDTO
;
import
com.yaoyaozw.customer.dto.follow.FollowReplyMultiNewsCreateDTO
;
import
com.yaoyaozw.customer.dto.follow.NewsMessageReplyEntity
;
import
com.yaoyaozw.customer.dto.follow.NewsMessageReplyEntity
;
import
com.yaoyaozw.customer.entity.CommonReferralBody
;
import
com.yaoyaozw.customer.entity.CommonReferralBody
;
...
@@ -35,7 +36,6 @@ import java.util.stream.Collectors;
...
@@ -35,7 +36,6 @@ import java.util.stream.Collectors;
public
class
CustomerFollowReplyMultiNewsServiceImpl
extends
ServiceImpl
<
CustomerFollowReplyMultiNewsMapper
,
CustomerFollowReplyMultiNews
>
implements
CustomerFollowReplyMultiNewsService
{
public
class
CustomerFollowReplyMultiNewsServiceImpl
extends
ServiceImpl
<
CustomerFollowReplyMultiNewsMapper
,
CustomerFollowReplyMultiNews
>
implements
CustomerFollowReplyMultiNewsService
{
private
final
static
Logger
localLog
=
LoggerFactory
.
getLogger
(
CustomerFollowReplyMultiNewsServiceImpl
.
class
);
private
final
static
Logger
localLog
=
LoggerFactory
.
getLogger
(
CustomerFollowReplyMultiNewsServiceImpl
.
class
);
private
final
static
String
FOLLOW_REPLY_MULTI_NEWS_CACHE_KEY
=
"followReplyMultiNews"
;
@Autowired
@Autowired
private
ReferralEntityService
referralEntityService
;
private
ReferralEntityService
referralEntityService
;
...
@@ -59,7 +59,7 @@ public class CustomerFollowReplyMultiNewsServiceImpl extends ServiceImpl<Custome
...
@@ -59,7 +59,7 @@ public class CustomerFollowReplyMultiNewsServiceImpl extends ServiceImpl<Custome
List
<
Long
>
multiNewsIdList
=
currentMultiNewsList
.
stream
().
map
(
CustomerFollowReplyMultiNews:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
Long
>
multiNewsIdList
=
currentMultiNewsList
.
stream
().
map
(
CustomerFollowReplyMultiNews:
:
getId
).
collect
(
Collectors
.
toList
());
referralEntityService
.
remove
(
new
QueryWrapper
<
ReferralEntity
>().
in
(
ReferralEntity
.
COL_MATERIAL_GRAPHICS_ID
,
multiNewsIdList
));
referralEntityService
.
remove
(
new
QueryWrapper
<
ReferralEntity
>().
in
(
ReferralEntity
.
COL_MATERIAL_GRAPHICS_ID
,
multiNewsIdList
));
this
.
removeByIds
(
multiNewsIdList
);
this
.
removeByIds
(
multiNewsIdList
);
redisTemplate
.
opsForHash
().
delete
(
FOLLOW_REPLY_MULTI_NEWS_CACHE_KEY
,
accountEntity
.
getAppId
());
redisTemplate
.
opsForHash
().
delete
(
CustomerMaterialConstant
.
FOLLOW_REPLY_MULTI_NEWS_CACHE_KEY
,
accountEntity
.
getAppId
());
}
}
List
<
ReferralEntity
>
referralEntityList
=
new
ArrayList
<>(
multiNewsList
.
size
());
List
<
ReferralEntity
>
referralEntityList
=
new
ArrayList
<>(
multiNewsList
.
size
());
List
<
CustomerFollowReplyMultiNews
>
entityList
=
new
ArrayList
<>(
multiNewsList
.
size
());
List
<
CustomerFollowReplyMultiNews
>
entityList
=
new
ArrayList
<>(
multiNewsList
.
size
());
...
@@ -89,7 +89,7 @@ public class CustomerFollowReplyMultiNewsServiceImpl extends ServiceImpl<Custome
...
@@ -89,7 +89,7 @@ public class CustomerFollowReplyMultiNewsServiceImpl extends ServiceImpl<Custome
localLog
.
info
(
"generate multi news size {}, referral entity size {}"
,
entityList
.
size
(),
referralEntityList
.
size
());
localLog
.
info
(
"generate multi news size {}, referral entity size {}"
,
entityList
.
size
(),
referralEntityList
.
size
());
// 将这些多图文信息转换到缓存
// 将这些多图文信息转换到缓存
List
<
NewsMessageReplyEntity
>
cacheEntityList
=
JSONUtil
.
toList
(
JSONUtil
.
parseArray
(
multiNewsList
),
NewsMessageReplyEntity
.
class
);
List
<
NewsMessageReplyEntity
>
cacheEntityList
=
JSONUtil
.
toList
(
JSONUtil
.
parseArray
(
multiNewsList
),
NewsMessageReplyEntity
.
class
);
redisTemplate
.
opsForHash
().
put
(
FOLLOW_REPLY_MULTI_NEWS_CACHE_KEY
,
accountEntity
.
getAppId
(),
JSONUtil
.
toJsonStr
(
cacheEntityList
));
redisTemplate
.
opsForHash
().
put
(
CustomerMaterialConstant
.
FOLLOW_REPLY_MULTI_NEWS_CACHE_KEY
,
accountEntity
.
getAppId
(),
JSONUtil
.
toJsonStr
(
cacheEntityList
));
this
.
saveBatch
(
entityList
);
this
.
saveBatch
(
entityList
);
referralEntityService
.
saveBatch
(
referralEntityList
);
referralEntityService
.
saveBatch
(
referralEntityList
);
}
}
...
...
src/main/java/com/yaoyaozw/customer/service/impl/CustomerFollowReplyServiceImpl.java
浏览文件 @
1880b4a1
...
@@ -125,7 +125,6 @@ public class CustomerFollowReplyServiceImpl extends ServiceImpl<CustomerFollowRe
...
@@ -125,7 +125,6 @@ public class CustomerFollowReplyServiceImpl extends ServiceImpl<CustomerFollowRe
List
<
FollowReplyMultiNewsCreateDTO
>
multiNewsList
=
saveDto
.
getMultiNewsList
();
List
<
FollowReplyMultiNewsCreateDTO
>
multiNewsList
=
saveDto
.
getMultiNewsList
();
localLog
.
info
(
"appId {} follow reply has multi news size {}"
,
saveDto
.
getAppid
(),
multiNewsList
.
size
());
localLog
.
info
(
"appId {} follow reply has multi news size {}"
,
saveDto
.
getAppid
(),
multiNewsList
.
size
());
followReplyMultiNewsService
.
saveFollowReplyMultiNews
(
entity
.
getId
(),
saveDto
.
getAccountEntity
(),
saveDto
.
getMultiNewsList
());
followReplyMultiNewsService
.
saveFollowReplyMultiNews
(
entity
.
getId
(),
saveDto
.
getAccountEntity
(),
saveDto
.
getMultiNewsList
());
// return new GenericsResult<>(true, "【测试】多图文关回设置成功");
}
else
if
(!
CustomerMaterialConstant
.
TENCENT_MEDIA_TYPE_TEXT
.
equals
(
entity
.
getType
())){
}
else
if
(!
CustomerMaterialConstant
.
TENCENT_MEDIA_TYPE_TEXT
.
equals
(
entity
.
getType
())){
// 获取书城公众号链接(图文)
// 获取书城公众号链接(图文)
ReferralEntity
referralEntity
;
ReferralEntity
referralEntity
;
...
@@ -196,6 +195,13 @@ public class CustomerFollowReplyServiceImpl extends ServiceImpl<CustomerFollowRe
...
@@ -196,6 +195,13 @@ public class CustomerFollowReplyServiceImpl extends ServiceImpl<CustomerFollowRe
// 删除本体
// 删除本体
this
.
removeById
(
id
);
this
.
removeById
(
id
);
// 查看是否有多图文素材
List
<
CustomerFollowReplyMultiNews
>
followReplyMultiNewsList
=
followReplyMultiNewsService
.
list
(
new
QueryWrapper
<
CustomerFollowReplyMultiNews
>().
eq
(
"reply_id"
,
id
));
if
(
CollectionUtil
.
isNotEmpty
(
followReplyMultiNewsList
))
{
List
<
Long
>
newsIdList
=
followReplyMultiNewsList
.
stream
().
map
(
CustomerFollowReplyMultiNews:
:
getId
).
collect
(
Collectors
.
toList
());
followReplyMultiNewsService
.
removeByIds
(
newsIdList
);
referralEntityService
.
remove
(
new
QueryWrapper
<
ReferralEntity
>().
in
(
ReferralEntity
.
COL_MATERIAL_GRAPHICS_ID
,
newsIdList
));
}
// 删除相关链接
// 删除相关链接
referralEntityService
.
remove
(
new
QueryWrapper
<
ReferralEntity
>().
eq
(
ReferralEntity
.
COL_MATERIAL_GRAPHICS_ID
,
id
));
referralEntityService
.
remove
(
new
QueryWrapper
<
ReferralEntity
>().
eq
(
ReferralEntity
.
COL_MATERIAL_GRAPHICS_ID
,
id
));
// 重置redis中的素材
// 重置redis中的素材
...
@@ -394,6 +400,14 @@ public class CustomerFollowReplyServiceImpl extends ServiceImpl<CustomerFollowRe
...
@@ -394,6 +400,14 @@ public class CustomerFollowReplyServiceImpl extends ServiceImpl<CustomerFollowRe
// 删除主体
// 删除主体
this
.
removeByIds
(
sourceMaterialIdList
);
this
.
removeByIds
(
sourceMaterialIdList
);
QueryWrapper
<
CustomerFollowReplyMultiNews
>
multiNewsQueryWrapper
=
new
QueryWrapper
<
CustomerFollowReplyMultiNews
>().
in
(
"reply_id"
,
sourceMaterialIdList
);
List
<
CustomerFollowReplyMultiNews
>
multiNewsList
=
followReplyMultiNewsService
.
list
(
multiNewsQueryWrapper
);
if
(
CollectionUtil
.
isNotEmpty
(
multiNewsList
))
{
followReplyMultiNewsService
.
remove
(
multiNewsQueryWrapper
);
List
<
Long
>
newsIdList
=
multiNewsList
.
stream
().
map
(
CustomerFollowReplyMultiNews:
:
getId
).
collect
(
Collectors
.
toList
());
// 把多图文的id添加到素材id列表中,一起删除referralEntity数据
sourceMaterialIdList
.
addAll
(
newsIdList
);
}
// 删除链接
// 删除链接
referralEntityService
.
remove
(
new
QueryWrapper
<
ReferralEntity
>().
in
(
ReferralEntity
.
COL_MATERIAL_GRAPHICS_ID
,
sourceMaterialIdList
));
referralEntityService
.
remove
(
new
QueryWrapper
<
ReferralEntity
>().
in
(
ReferralEntity
.
COL_MATERIAL_GRAPHICS_ID
,
sourceMaterialIdList
));
...
@@ -422,6 +436,11 @@ public class CustomerFollowReplyServiceImpl extends ServiceImpl<CustomerFollowRe
...
@@ -422,6 +436,11 @@ public class CustomerFollowReplyServiceImpl extends ServiceImpl<CustomerFollowRe
}
else
{
}
else
{
redisTemplate
.
opsForHash
().
delete
(
CustomerMaterialConstant
.
FOLLOW_REPLY_REDIS_KEY
,
appid
);
redisTemplate
.
opsForHash
().
delete
(
CustomerMaterialConstant
.
FOLLOW_REPLY_REDIS_KEY
,
appid
);
}
}
long
multiNewsCount
=
entityList
.
stream
().
filter
(
item
->
CustomerMaterialConstant
.
TENCENT_MEDIA_TYPE_MULTI_NEWS
.
equals
(
item
.
getType
())).
count
();
if
(
multiNewsCount
==
0
)
{
redisTemplate
.
opsForHash
().
delete
(
CustomerMaterialConstant
.
FOLLOW_REPLY_MULTI_NEWS_CACHE_KEY
,
appid
);
}
}
}
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论