Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
O
operate-customer-service
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
沈振路
operate-customer-service
Commits
4af437ae
提交
4af437ae
authored
3月 20, 2023
作者:
沈振路
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
关键词回复接口
上级
3a62eb96
隐藏空白字符变更
内嵌
并排
正在显示
18 个修改的文件
包含
1230 行增加
和
31 行删除
+1230
-31
CustomerKeywordComponent.java
...aoyaozw/customer/components/CustomerKeywordComponent.java
+313
-0
FollowReplyComponent.java
...om/yaoyaozw/customer/components/FollowReplyComponent.java
+4
-9
CustomerMaterialConstant.java
...yaoyaozw/customer/constants/CustomerMaterialConstant.java
+2
-1
CustomerKeywordController.java
...oyaozw/customer/controller/CustomerKeywordController.java
+71
-0
TestController.java
...java/com/yaoyaozw/customer/controller/TestController.java
+2
-8
CustomerKeywordCopyDTO.java
...yaoyaozw/customer/dto/keyword/CustomerKeywordCopyDTO.java
+20
-0
CustomerKeywordQueryDTO.java
...aoyaozw/customer/dto/keyword/CustomerKeywordQueryDTO.java
+16
-0
CustomerKeywordSaveDTO.java
...yaoyaozw/customer/dto/keyword/CustomerKeywordSaveDTO.java
+38
-0
CustomerKeyword.java
...in/java/com/yaoyaozw/customer/entity/CustomerKeyword.java
+128
-0
CustomerKeywordMapper.java
...a/com/yaoyaozw/customer/mapper/CustomerKeywordMapper.java
+29
-0
CustomerKeywordService.java
...com/yaoyaozw/customer/service/CustomerKeywordService.java
+76
-0
CustomerFollowReplyServiceImpl.java
...customer/service/impl/CustomerFollowReplyServiceImpl.java
+10
-10
CustomerKeywordServiceImpl.java
...ozw/customer/service/impl/CustomerKeywordServiceImpl.java
+384
-0
FollowReplyListVO.java
...va/com/yaoyaozw/customer/vo/follow/FollowReplyListVO.java
+2
-3
CustomerKeywordCopyResultVO.java
...aozw/customer/vo/keyword/CustomerKeywordCopyResultVO.java
+24
-0
CustomerKeywordInfoVO.java
...m/yaoyaozw/customer/vo/keyword/CustomerKeywordInfoVO.java
+51
-0
CustomerKeywordListVO.java
...m/yaoyaozw/customer/vo/keyword/CustomerKeywordListVO.java
+35
-0
CustomerKeywordMapper.xml
src/main/resources/mapper/CustomerKeywordMapper.xml
+25
-0
没有找到文件。
src/main/java/com/yaoyaozw/customer/components/CustomerKeywordComponent.java
0 → 100644
浏览文件 @
4af437ae
package
com
.
yaoyaozw
.
customer
.
components
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.TypeReference
;
import
com.yaoyaozw.customer.common.R
;
import
com.yaoyaozw.customer.constants.ApiResultConstant
;
import
com.yaoyaozw.customer.constants.CustomerCommonConstant
;
import
com.yaoyaozw.customer.constants.CustomerMaterialConstant
;
import
com.yaoyaozw.customer.entity.CommonReferralBody
;
import
com.yaoyaozw.customer.entity.CustomerKeyword
;
import
com.yaoyaozw.customer.entity.ReferralEntity
;
import
com.yaoyaozw.customer.feigns.ReferralFeignClient
;
import
com.yaoyaozw.customer.service.AuthorizerInfoService
;
import
com.yaoyaozw.customer.service.ReferralEntityService
;
import
com.yaoyaozw.customer.utils.TencentCustomerUtil
;
import
com.yaoyaozw.customer.vo.AuthInfoVO
;
import
com.yaoyaozw.customer.vo.TencentMediaResponseVO
;
import
com.yaoyaozw.customer.vo.keyword.CustomerKeywordCopyResultVO
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
/**
* @author darker
* @date 2023/3/14 14:36
*/
@Component
public
class
CustomerKeywordComponent
{
private
final
static
Logger
localLog
=
LoggerFactory
.
getLogger
(
CustomerKeywordComponent
.
class
);
@Autowired
private
ReferralEntityService
referralEntityService
;
@Autowired
private
TencentCustomerUtil
tencentCustomerUtil
;
@Autowired
private
ReferralFeignClient
referralFeignClient
;
@Autowired
private
SnowflakeComponent
snowflakeComponent
;
/**
* 获取链接实体
* @param referralBody 链接参数
* @return 转化之后的链接实体
*/
public
ReferralEntity
getCreateReferralEntity
(
CommonReferralBody
referralBody
)
{
ReferralEntity
referralEntity
=
new
ReferralEntity
();
// 赋值链接参数
BeanUtil
.
copyProperties
(
referralBody
,
referralEntity
);
Integer
newsType
=
referralEntity
.
getNewsType
();
// 判断是否需要获取书城链接
if
(
CustomerCommonConstant
.
REMOTE_LINK_NEWS_TYPE_LIST
.
contains
(
referralBody
.
getNewsType
()))
{
// 处理链接名称
if
(
CustomerCommonConstant
.
BOOK_NEWS_TYPE
.
equals
(
newsType
)
||
CustomerCommonConstant
.
ACTIVITY_NEWS_TYPE
.
equals
(
newsType
))
{
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyy/MM/dd"
);
String
dateStr
=
format
.
format
(
new
Date
());
handleReferralName
(
dateStr
,
referralBody
.
getAccountName
(),
referralEntity
);
}
// 获取链接
doGetReferral
(
referralEntity
);
}
return
referralEntity
;
}
/**
* 获取复用时的链接数据
*
* @param sourceAccountName 源公众号名称
* @param dateStr 日期
* @param authInfoVo 目标公众号
* @param sourceReferral 链接参数
* @return {@link ReferralEntity}
*/
public
ReferralEntity
getCopyReferralEntity
(
String
sourceAccountName
,
String
dateStr
,
AuthInfoVO
authInfoVo
,
ReferralEntity
sourceReferral
)
{
ReferralEntity
targetReferral
=
new
ReferralEntity
();
BeanUtil
.
copyProperties
(
sourceReferral
,
targetReferral
,
"id"
,
"accountId"
,
"name"
,
"referral"
,
"materialGraphicsId"
,
"infoId"
);
// 为参数设置公众号相关参数
targetReferral
.
setAccountId
(
authInfoVo
.
getAccountId
());
targetReferral
.
setInfoId
(
authInfoVo
.
getId
());
String
textContent
=
targetReferral
.
getTextContent
();
if
(
StringUtils
.
isNotEmpty
(
textContent
))
{
targetReferral
.
setTextContent
(
textContent
.
replace
(
sourceAccountName
,
authInfoVo
.
getAccountName
()));
}
Integer
newsType
=
targetReferral
.
getNewsType
();
if
(
CustomerCommonConstant
.
REMOTE_LINK_NEWS_TYPE_LIST
.
contains
(
newsType
))
{
// 需要获取第三方链接的类型
if
(
CustomerCommonConstant
.
USUAL_LINK_NEWS_TYPE
.
equals
(
newsType
))
{
// 常用链接延用name
targetReferral
.
setName
(
sourceReferral
.
getName
());
}
else
{
// 书籍、活动 类型, 重新构造name
handleReferralName
(
dateStr
,
authInfoVo
.
getAccountName
(),
targetReferral
);
}
doGetReferral
(
targetReferral
);
}
else
if
(
newsType
.
equals
(-
1
))
{
targetReferral
.
setReferral
(
sourceReferral
.
getReferral
());
}
return
targetReferral
;
}
/**
* 素材复用到目标公众号
*
* @param targetAuth 目标公众号
* @param sourceMaterialList 源素材列表
* @return 执行结果
*/
public
CustomerKeywordCopyResultVO
copyMaterialToTarget
(
String
sourceAccountName
,
AuthInfoVO
targetAuth
,
List
<
CustomerKeyword
>
sourceMaterialList
)
{
CustomerKeywordCopyResultVO
result
=
new
CustomerKeywordCopyResultVO
();
result
.
setHasError
(
false
);
List
<
CustomerKeyword
>
finalMaterialList
=
new
ArrayList
<>(
sourceMaterialList
.
size
());
List
<
ReferralEntity
>
finalReferralList
=
new
ArrayList
<>();
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyy/MM/dd"
);
String
dateStr
=
format
.
format
(
new
Date
());
int
idx
=
1
;
for
(
CustomerKeyword
sourceMaterial
:
sourceMaterialList
)
{
localLog
.
info
(
"素材处理进度: {}/{}"
,
idx
++,
sourceMaterialList
.
size
());
CustomerKeyword
entity
=
new
CustomerKeyword
();
int
status
=
1
;
// 主体赋值
entity
.
setId
(
snowflakeComponent
.
snowflakeId
());
entity
.
setAppid
(
targetAuth
.
getAppId
());
entity
.
setKeyword
(
sourceMaterial
.
getKeyword
());
entity
.
setType
(
sourceMaterial
.
getType
());
entity
.
setOriginMediaUrl
(
sourceMaterial
.
getOriginMediaUrl
());
entity
.
setExtendTitle
(
sourceMaterial
.
getExtendTitle
());
entity
.
setExtendDesc
(
sourceMaterial
.
getExtendDesc
());
if
(
CustomerMaterialConstant
.
needUpload
(
entity
.
getType
()))
{
// 向腾讯后台上传素材文件
TencentMediaResponseVO
uploadResult
=
tencentCustomerUtil
.
uploadTencentMedia
(
targetAuth
.
getAppId
(),
entity
.
getOriginMediaUrl
(),
entity
.
getType
());
if
(
StringUtils
.
isNotEmpty
(
uploadResult
.
getErrmsg
()))
{
localLog
.
warn
(
"公众号: {} 上传素材失败"
,
targetAuth
.
getAccountName
());
}
entity
.
setTxMediaUrl
(
uploadResult
.
getUrl
());
entity
.
setTxMediaId
(
uploadResult
.
getMedia_id
());
// 需要上传后台的类型不需要处理链接
entity
.
setStatus
(
status
);
finalMaterialList
.
add
(
entity
);
continue
;
}
// 处理 图文、文本 链接
List
<
ReferralEntity
>
referralEntityList
=
sourceMaterial
.
getReferralEntityList
();
if
(
CollectionUtil
.
isNotEmpty
(
referralEntityList
))
{
List
<
ReferralEntity
>
singleMaterialReferralList
=
new
ArrayList
<>(
referralEntityList
.
size
());
for
(
ReferralEntity
sourceReferral
:
referralEntityList
)
{
try
{
ReferralEntity
finalReferral
=
getCopyReferralEntity
(
sourceAccountName
,
dateStr
,
targetAuth
,
sourceReferral
);
finalReferral
.
setMaterialGraphicsId
(
entity
.
getId
());
singleMaterialReferralList
.
add
(
finalReferral
);
finalReferralList
.
add
(
finalReferral
);
}
catch
(
Exception
e
)
{
// 获取链接出现异常, 修改状态, 修改标识
status
=
0
;
result
.
setHasError
(
true
);
}
}
if
(
CollectionUtil
.
isNotEmpty
(
singleMaterialReferralList
))
{
// 处理链接的后续操作
if
(
CustomerMaterialConstant
.
TENCENT_MEDIA_TYPE_NEWS
.
equals
(
entity
.
getType
()))
{
// 图文, 将链接处理结果设置到主题表中
ReferralEntity
referralEntity
=
singleMaterialReferralList
.
get
(
0
);
entity
.
setSourceUrl
(
referralEntity
.
getReferral
());
}
else
if
(
CustomerMaterialConstant
.
TENCENT_MEDIA_TYPE_TEXT
.
equals
(
entity
.
getType
()))
{
// 文本, 构造H5
StringBuilder
builder
=
new
StringBuilder
();
for
(
ReferralEntity
referralEntity
:
singleMaterialReferralList
)
{
builder
.
append
(
structH5Line
(
false
,
referralEntity
)).
append
(
"\n\n"
);
}
entity
.
setContent
(
builder
.
toString
().
trim
());
}
}
}
entity
.
setStatus
(
status
);
finalMaterialList
.
add
(
entity
);
}
result
.
setMaterialList
(
finalMaterialList
);
result
.
setReferralEntityList
(
finalReferralList
);
return
result
;
}
/**
* 重新排序和保存文本子素材
*
* @param referralList 文本子素材列表
* @return {@link String}
*/
public
String
reSortAndSaveTextItem
(
List
<
ReferralEntity
>
referralList
)
{
// 遍历进行排序,并且构造H5
int
idx
=
1
;
StringBuilder
builder
=
new
StringBuilder
();
for
(
ReferralEntity
referral
:
referralList
)
{
referral
.
setSort
(
idx
);
builder
.
append
(
structH5Line
(
false
,
referral
));
if
(
idx
<
referralList
.
size
())
{
builder
.
append
(
"\n\n"
);
idx
++;
}
}
// 保存排序之后的referral列表
referralEntityService
.
updateBatchById
(
referralList
);
return
builder
.
toString
();
}
public
void
contractH5ContentBatch
(
List
<
ReferralEntity
>
referralEntityList
)
{
referralEntityList
.
forEach
(
item
->
item
.
setH5Content
(
structH5Line
(
true
,
item
)));
}
/**
* 构造 h5
*
* @param referralEntity 链接实体
* @return {@link String}
*/
private
String
structH5Line
(
Boolean
needStyle
,
ReferralEntity
referralEntity
)
{
Integer
newsType
=
referralEntity
.
getNewsType
();
// 文本类型替换h5链接
String
context
=
null
;
if
(
CustomerCommonConstant
.
REPLACE_LINK_NEWS_TYPE_LIST
.
contains
(
newsType
))
{
context
=
CustomerCommonConstant
.
CUSTOMER_TEXT_LINK_TEMPLATE
.
replace
(
CustomerCommonConstant
.
CUSTOMER_TEXT_CONTENT_PLACEHOLDER
,
referralEntity
.
getTextContent
());
context
=
context
.
replace
(
CustomerCommonConstant
.
CUSTOMER_TEXT_URL_PLACEHOLDER
,
referralEntity
.
getReferral
());
if
(!
needStyle
)
{
context
=
context
.
replace
(
CustomerCommonConstant
.
H5_STYLE_CODE
,
""
);
}
}
else
if
(
CustomerCommonConstant
.
COMMON_NEWS_TYPE_LIST
.
contains
(
newsType
)){
context
=
referralEntity
.
getTextContent
();
}
return
context
;
}
/**
* 处理链接名称
* @param dateStr 处理日期
* @param accountName 公众号名称
* @param referral 链接参数实体
*/
private
void
handleReferralName
(
String
dateStr
,
String
accountName
,
ReferralEntity
referral
)
{
Integer
newsType
=
referral
.
getNewsType
();
// 书籍、活动 类型, 重新构造name
String
name
=
CustomerCommonConstant
.
getLinkNameModel
(
newsType
,
referral
.
getConfigName
());
String
newsTypeName
=
CustomerCommonConstant
.
getNewsTypeName
(
newsType
);
name
=
name
.
replace
(
"{newsType}"
,
newsTypeName
).
replace
(
"{accountNickName}"
,
accountName
)
.
replace
(
"{storeType}"
,
referral
.
getStoreTypeName
()).
replace
(
"{currentDate}"
,
dateStr
);
if
(
newsType
.
equals
(
CustomerCommonConstant
.
BOOK_NEWS_TYPE
))
{
// 系统-客服-{newsType}-{accountNickName}-{storeType}-{currentDate}-{bookName}
name
=
name
.
replace
(
"{bookName}"
,
referral
.
getBookName
());
}
else
if
(
newsType
.
equals
(
CustomerCommonConstant
.
ACTIVITY_NEWS_TYPE
))
{
// 系统-客服-{newsType}-{accountNickName}-{storeType}-{currentDate}-充{recharge}送{gift}
name
=
name
.
replace
(
"{recharge}"
,
referral
.
getRechargeAmount
().
stripTrailingZeros
().
toPlainString
()).
replace
(
"{gift}"
,
referral
.
getGiftAmount
().
toString
());
if
(
StringUtils
.
isNotEmpty
(
referral
.
getConfigName
()))
{
name
=
name
.
replace
(
"{configName}"
,
referral
.
getConfigName
());
}
}
name
=
name
.
replace
(
"客服"
,
"关回"
);
referral
.
setName
(
name
+
"-"
+
System
.
currentTimeMillis
()
%
100000
);
}
/**
* 获取链接
*
* @param referralEntity 链接参数
*/
private
void
doGetReferral
(
ReferralEntity
referralEntity
)
{
// 获取链接
R
r
=
referralFeignClient
.
productReferral
(
referralEntity
);
if
(!
r
.
getCode
().
equals
(
ApiResultConstant
.
SUCCESS_CODE
))
{
localLog
.
warn
(
"获取链接异常, 异常信息: {}, 参数: {}"
,
r
.
getMessage
(),
referralEntity
);
throw
new
RuntimeException
(
r
.
getMessage
());
}
String
res
=
r
.
getData
(
"storeReferral"
,
new
TypeReference
<
String
>()
{});
JSONObject
jsonObject1
=
JSON
.
parseObject
(
res
);
String
referral
=
jsonObject1
.
getString
(
"referral"
);
referralEntity
.
setPromoteId
(
jsonObject1
.
getString
(
"promoteId"
));
referralEntity
.
setReferral
(
referral
);
}
}
src/main/java/com/yaoyaozw/customer/components/FollowReplyComponent.java
浏览文件 @
4af437ae
...
@@ -2,19 +2,16 @@ package com.yaoyaozw.customer.components;
...
@@ -2,19 +2,16 @@ 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.core.util.ObjectUtil
;
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
;
import
com.yaoyaozw.customer.common.R
;
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.FollowReplyCommonConstant
;
import
com.yaoyaozw.customer.constants.CustomerMaterialConstant
;
import
com.yaoyaozw.customer.entity.AuthorizerInfo
;
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.ReferralEntity
;
import
com.yaoyaozw.customer.entity.ReferralEntity
;
import
com.yaoyaozw.customer.enums.CustomerStoreTemplateEnum
;
import
com.yaoyaozw.customer.feigns.ReferralFeignClient
;
import
com.yaoyaozw.customer.feigns.ReferralFeignClient
;
import
com.yaoyaozw.customer.service.AuthorizerInfoService
;
import
com.yaoyaozw.customer.service.AuthorizerInfoService
;
import
com.yaoyaozw.customer.service.ReferralEntityService
;
import
com.yaoyaozw.customer.service.ReferralEntityService
;
...
@@ -50,8 +47,6 @@ public class FollowReplyComponent {
...
@@ -50,8 +47,6 @@ public class FollowReplyComponent {
private
ReferralFeignClient
referralFeignClient
;
private
ReferralFeignClient
referralFeignClient
;
@Autowired
@Autowired
private
SnowflakeComponent
snowflakeComponent
;
private
SnowflakeComponent
snowflakeComponent
;
@Autowired
private
AuthorizerInfoService
authorizerInfoService
;
/**
/**
* 获取链接实体
* 获取链接实体
...
@@ -156,7 +151,7 @@ public class FollowReplyComponent {
...
@@ -156,7 +151,7 @@ public class FollowReplyComponent {
entity
.
setExtendDesc
(
sourceMaterial
.
getExtendDesc
());
entity
.
setExtendDesc
(
sourceMaterial
.
getExtendDesc
());
entity
.
setSort
(
sourceMaterial
.
getSort
());
entity
.
setSort
(
sourceMaterial
.
getSort
());
if
(
FollowReplyCommon
Constant
.
needUpload
(
entity
.
getType
()))
{
if
(
CustomerMaterial
Constant
.
needUpload
(
entity
.
getType
()))
{
// 向腾讯后台上传素材文件
// 向腾讯后台上传素材文件
TencentMediaResponseVO
uploadResult
=
tencentCustomerUtil
.
uploadTencentMedia
(
targetAuth
.
getAppId
(),
entity
.
getOriginMediaUrl
(),
entity
.
getType
());
TencentMediaResponseVO
uploadResult
=
tencentCustomerUtil
.
uploadTencentMedia
(
targetAuth
.
getAppId
(),
entity
.
getOriginMediaUrl
(),
entity
.
getType
());
if
(
StringUtils
.
isNotEmpty
(
uploadResult
.
getErrmsg
()))
{
if
(
StringUtils
.
isNotEmpty
(
uploadResult
.
getErrmsg
()))
{
...
@@ -189,11 +184,11 @@ public class FollowReplyComponent {
...
@@ -189,11 +184,11 @@ public class FollowReplyComponent {
}
}
if
(
CollectionUtil
.
isNotEmpty
(
singleMaterialReferralList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
singleMaterialReferralList
))
{
// 处理链接的后续操作
// 处理链接的后续操作
if
(
FollowReplyCommon
Constant
.
TENCENT_MEDIA_TYPE_NEWS
.
equals
(
entity
.
getType
()))
{
if
(
CustomerMaterial
Constant
.
TENCENT_MEDIA_TYPE_NEWS
.
equals
(
entity
.
getType
()))
{
// 图文, 将链接处理结果设置到主题表中
// 图文, 将链接处理结果设置到主题表中
ReferralEntity
referralEntity
=
singleMaterialReferralList
.
get
(
0
);
ReferralEntity
referralEntity
=
singleMaterialReferralList
.
get
(
0
);
entity
.
setSourceUrl
(
referralEntity
.
getReferral
());
entity
.
setSourceUrl
(
referralEntity
.
getReferral
());
}
else
if
(
FollowReplyCommon
Constant
.
TENCENT_MEDIA_TYPE_TEXT
.
equals
(
entity
.
getType
()))
{
}
else
if
(
CustomerMaterial
Constant
.
TENCENT_MEDIA_TYPE_TEXT
.
equals
(
entity
.
getType
()))
{
// 文本, 构造H5
// 文本, 构造H5
StringBuilder
builder
=
new
StringBuilder
();
StringBuilder
builder
=
new
StringBuilder
();
for
(
ReferralEntity
referralEntity
:
singleMaterialReferralList
)
{
for
(
ReferralEntity
referralEntity
:
singleMaterialReferralList
)
{
...
...
src/main/java/com/yaoyaozw/customer/constants/
FollowReplyCommon
Constant.java
→
src/main/java/com/yaoyaozw/customer/constants/
CustomerMaterial
Constant.java
浏览文件 @
4af437ae
...
@@ -9,9 +9,10 @@ import java.util.List;
...
@@ -9,9 +9,10 @@ import java.util.List;
* @author darker
* @author darker
* @date 2023/3/14 11:56
* @date 2023/3/14 11:56
*/
*/
public
class
FollowReplyCommon
Constant
{
public
class
CustomerMaterial
Constant
{
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
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"
;
...
...
src/main/java/com/yaoyaozw/customer/controller/CustomerKeywordController.java
0 → 100644
浏览文件 @
4af437ae
package
com
.
yaoyaozw
.
customer
.
controller
;
import
com.yaoyaozw.customer.annotations.OperateLog
;
import
com.yaoyaozw.customer.common.BaseResult
;
import
com.yaoyaozw.customer.common.GenericsResult
;
import
com.yaoyaozw.customer.dto.keyword.CustomerKeywordCopyDTO
;
import
com.yaoyaozw.customer.dto.keyword.CustomerKeywordQueryDTO
;
import
com.yaoyaozw.customer.dto.keyword.CustomerKeywordSaveDTO
;
import
com.yaoyaozw.customer.entity.CommonReferralBody
;
import
com.yaoyaozw.customer.service.CustomerKeywordService
;
import
com.yaoyaozw.customer.vo.keyword.CustomerKeywordInfoVO
;
import
com.yaoyaozw.customer.vo.keyword.CustomerKeywordListVO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
/**
* @author darker
* @date 2023/3/20 11:14
*/
@RestController
@RequestMapping
(
"/keyword"
)
public
class
CustomerKeywordController
{
@Autowired
private
CustomerKeywordService
keywordService
;
@PostMapping
(
"/list"
)
public
GenericsResult
<
List
<
CustomerKeywordListVO
>>
list
(
@RequestBody
CustomerKeywordQueryDTO
queryDto
)
{
return
keywordService
.
list
(
queryDto
);
}
@PostMapping
(
"/create"
)
@OperateLog
(
module
=
"客服-关回"
,
desc
=
"创建素材"
)
public
GenericsResult
<
String
>
create
(
@RequestBody
@Validated
CustomerKeywordSaveDTO
saveDto
)
{
return
keywordService
.
create
(
saveDto
);
}
@PostMapping
(
"/createTextItem"
)
@OperateLog
(
module
=
"客服-关回"
,
desc
=
"创建文本子素材"
)
public
GenericsResult
<
List
<
CommonReferralBody
>>
createTextItem
(
@RequestBody
CommonReferralBody
referralBody
)
{
return
keywordService
.
createTextItem
(
referralBody
);
}
@GetMapping
(
"/info/{id}"
)
public
GenericsResult
<
CustomerKeywordInfoVO
>
getInfo
(
@PathVariable
(
"id"
)
Long
id
)
{
return
keywordService
.
getInfo
(
id
);
}
@GetMapping
(
"/remove/{id}"
)
@OperateLog
(
module
=
"客服-关回"
,
desc
=
"删除素材"
)
public
BaseResult
remove
(
@PathVariable
(
"id"
)
Long
id
)
{
return
keywordService
.
remove
(
id
);
}
@GetMapping
(
"/removeTextItem/{id}"
)
@OperateLog
(
module
=
"客服-关回"
,
desc
=
"删除文本子素材"
)
public
GenericsResult
<
List
<
CommonReferralBody
>>
removeTextItem
(
@PathVariable
(
"id"
)
Long
id
)
{
return
keywordService
.
removeTextItem
(
id
);
}
@PostMapping
(
"/copy"
)
@OperateLog
(
module
=
"客服-关回"
,
desc
=
"关回复用"
)
public
BaseResult
copy
(
@RequestBody
CustomerKeywordCopyDTO
copyDto
)
{
return
keywordService
.
copy
(
copyDto
);
}
}
src/main/java/com/yaoyaozw/customer/controller/TestController.java
浏览文件 @
4af437ae
...
@@ -2,11 +2,7 @@ package com.yaoyaozw.customer.controller;
...
@@ -2,11 +2,7 @@ package com.yaoyaozw.customer.controller;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.json.JSONUtil
;
import
cn.hutool.json.JSONUtil
;
import
com.rabbitmq.client.AMQP
;
import
com.yaoyaozw.customer.constants.CustomerMaterialConstant
;
import
com.rabbitmq.client.Channel
;
import
com.yaoyaozw.customer.constants.CustomerCommonConstant
;
import
com.yaoyaozw.customer.constants.FollowReplyCommonConstant
;
import
com.yaoyaozw.customer.constants.RabbitCommonNameConstant
;
import
com.yaoyaozw.customer.dto.integration.IntegrationRequestDTO
;
import
com.yaoyaozw.customer.dto.integration.IntegrationRequestDTO
;
import
com.yaoyaozw.customer.entity.CustomerFollowReply
;
import
com.yaoyaozw.customer.entity.CustomerFollowReply
;
import
com.yaoyaozw.customer.mapper.KanbanCommonMapper
;
import
com.yaoyaozw.customer.mapper.KanbanCommonMapper
;
...
@@ -15,8 +11,6 @@ import com.yaoyaozw.customer.service.CustomerDelayPublishService;
...
@@ -15,8 +11,6 @@ import com.yaoyaozw.customer.service.CustomerDelayPublishService;
import
com.yaoyaozw.customer.service.CustomerGraphicsService
;
import
com.yaoyaozw.customer.service.CustomerGraphicsService
;
import
com.yaoyaozw.customer.vo.AuthInfoVO
;
import
com.yaoyaozw.customer.vo.AuthInfoVO
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.amqp.rabbit.annotation.RabbitListener
;
import
org.springframework.amqp.rabbit.core.ChannelCallback
;
import
org.springframework.amqp.rabbit.core.RabbitTemplate
;
import
org.springframework.amqp.rabbit.core.RabbitTemplate
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.data.redis.core.RedisTemplate
;
...
@@ -107,7 +101,7 @@ public class TestController {
...
@@ -107,7 +101,7 @@ public class TestController {
@GetMapping
(
"/testFollowReply"
)
@GetMapping
(
"/testFollowReply"
)
public
void
testFollowReply
()
{
public
void
testFollowReply
()
{
Object
obj
=
redisTemplate
.
opsForHash
().
get
(
FollowReplyCommon
Constant
.
FOLLOW_REPLY_REDIS_KEY
,
"wx9f460fa46420016c"
);
Object
obj
=
redisTemplate
.
opsForHash
().
get
(
CustomerMaterial
Constant
.
FOLLOW_REPLY_REDIS_KEY
,
"wx9f460fa46420016c"
);
if
(
ObjectUtil
.
isNotNull
(
obj
))
{
if
(
ObjectUtil
.
isNotNull
(
obj
))
{
List
<
CustomerFollowReply
>
list
=
JSONUtil
.
toList
(
JSONUtil
.
parseArray
(
obj
.
toString
()),
CustomerFollowReply
.
class
);
List
<
CustomerFollowReply
>
list
=
JSONUtil
.
toList
(
JSONUtil
.
parseArray
(
obj
.
toString
()),
CustomerFollowReply
.
class
);
...
...
src/main/java/com/yaoyaozw/customer/dto/keyword/CustomerKeywordCopyDTO.java
0 → 100644
浏览文件 @
4af437ae
package
com
.
yaoyaozw
.
customer
.
dto
.
keyword
;
import
com.yaoyaozw.customer.vo.AuthInfoVO
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.List
;
/**
* @author darker
* @date 2023/3/13 19:59
*/
@Data
public
class
CustomerKeywordCopyDTO
implements
Serializable
{
private
AuthInfoVO
sourceAuth
;
private
List
<
AuthInfoVO
>
targetAuthList
;
}
src/main/java/com/yaoyaozw/customer/dto/keyword/CustomerKeywordQueryDTO.java
0 → 100644
浏览文件 @
4af437ae
package
com
.
yaoyaozw
.
customer
.
dto
.
keyword
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @author darker
* @date 2023/3/13 19:59
*/
@Data
public
class
CustomerKeywordQueryDTO
implements
Serializable
{
private
String
appId
;
}
src/main/java/com/yaoyaozw/customer/dto/keyword/CustomerKeywordSaveDTO.java
0 → 100644
浏览文件 @
4af437ae
package
com
.
yaoyaozw
.
customer
.
dto
.
keyword
;
import
com.yaoyaozw.customer.entity.CommonReferralBody
;
import
lombok.Data
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
/**
* @author darker
* @date 2023/3/13 19:59
*/
@Data
public
class
CustomerKeywordSaveDTO
implements
Serializable
{
private
Long
id
;
@NotEmpty
(
message
=
"appid不能为空"
)
private
String
appid
;
@NotEmpty
(
message
=
"关键词不能为空"
)
private
String
keyword
;
@NotEmpty
(
message
=
"素材类型不能为空"
)
private
String
type
;
private
String
originMediaUrl
;
private
String
extendTitle
;
private
String
extendDesc
;
@NotNull
(
message
=
"素材排序不能为空"
)
private
Integer
sort
;
private
CommonReferralBody
referralBody
;
}
src/main/java/com/yaoyaozw/customer/entity/CustomerKeyword.java
0 → 100644
浏览文件 @
4af437ae
package
com
.
yaoyaozw
.
customer
.
entity
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
import
com.baomidou.mybatisplus.annotation.*
;
import
lombok.Data
;
import
org.springframework.data.annotation.Id
;
/**
* 客户关键字
*
* @author darker
* @date 2023/03/20
*/
@Data
public
class
CustomerKeyword
implements
Serializable
{
/**
* 主键
*/
@Id
@TableId
(
value
=
"id"
,
type
=
IdType
.
ID_WORKER
)
private
Long
id
;
/**
* 公众号appid
*/
@TableField
(
"appid"
)
private
String
appid
;
/**
* 关键词
*/
@TableField
(
"keyword"
)
private
String
keyword
;
/**
* 类型
*/
@TableField
(
"type"
)
private
String
type
;
/**
* 原始文件地址
*/
@TableField
(
"origin_media_url"
)
private
String
originMediaUrl
;
/**
* 腾讯media地址
*/
@TableField
(
"tx_media_url"
)
private
String
txMediaUrl
;
/**
* 腾讯mediaId
*/
@TableField
(
"tx_media_id"
)
private
String
txMediaId
;
/**
* 图文标题
*/
@TableField
(
"extend_title"
)
private
String
extendTitle
;
/**
* 图文描述
*/
@TableField
(
"extend_desc"
)
private
String
extendDesc
;
/**
* 跳转链接
*/
@TableField
(
"source_url"
)
private
String
sourceUrl
;
/**
* H5文本
*/
@TableField
(
"content"
)
private
String
content
;
/**
* 状态
*/
@TableField
(
"status"
)
private
Integer
status
;
/**
* 逻辑删除
*/
@TableField
(
value
=
"is_deleted"
,
fill
=
FieldFill
.
INSERT
)
@TableLogic
private
Integer
isDeleted
;
/**
* 创建人
*/
@TableField
(
value
=
"create_user"
,
fill
=
FieldFill
.
INSERT
)
private
Long
createUser
;
/**
* 创建时间
*/
@TableField
(
value
=
"gmt_create"
,
fill
=
FieldFill
.
INSERT
)
private
Date
gmtCreate
;
/**
* 更新人
*/
@TableField
(
value
=
"modified_user"
,
fill
=
FieldFill
.
INSERT_UPDATE
)
private
Long
modifiedUser
;
/**
* 更新时间
*/
@TableField
(
value
=
"gmt_modified"
,
fill
=
FieldFill
.
INSERT_UPDATE
)
private
Date
gmtModified
;
@TableField
(
exist
=
false
)
private
List
<
ReferralEntity
>
referralEntityList
;
private
static
final
long
serialVersionUID
=
1L
;
}
src/main/java/com/yaoyaozw/customer/mapper/CustomerKeywordMapper.java
0 → 100644
浏览文件 @
4af437ae
package
com
.
yaoyaozw
.
customer
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yaoyaozw.customer.dto.follow.FollowReplyQueryDTO
;
import
com.yaoyaozw.customer.dto.keyword.CustomerKeywordQueryDTO
;
import
com.yaoyaozw.customer.entity.CustomerKeyword
;
import
com.yaoyaozw.customer.vo.follow.FollowReplyListVO
;
import
com.yaoyaozw.customer.vo.keyword.CustomerKeywordListVO
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
/**
* @author darker
* @date 2023/3/20 11:07
*/
@Repository
public
interface
CustomerKeywordMapper
extends
BaseMapper
<
CustomerKeyword
>
{
/**
* 得到列表
*
* @param queryDto 查询dto
* @return {@link List}<{@link CustomerKeywordListVO}>
*/
List
<
CustomerKeywordListVO
>
getList
(
@Param
(
"queryDto"
)
CustomerKeywordQueryDTO
queryDto
);
}
src/main/java/com/yaoyaozw/customer/service/CustomerKeywordService.java
0 → 100644
浏览文件 @
4af437ae
package
com
.
yaoyaozw
.
customer
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yaoyaozw.customer.common.BaseResult
;
import
com.yaoyaozw.customer.common.GenericsResult
;
import
com.yaoyaozw.customer.dto.keyword.CustomerKeywordCopyDTO
;
import
com.yaoyaozw.customer.dto.keyword.CustomerKeywordQueryDTO
;
import
com.yaoyaozw.customer.dto.keyword.CustomerKeywordSaveDTO
;
import
com.yaoyaozw.customer.entity.CommonReferralBody
;
import
com.yaoyaozw.customer.entity.CustomerKeyword
;
import
com.yaoyaozw.customer.vo.keyword.CustomerKeywordInfoVO
;
import
com.yaoyaozw.customer.vo.keyword.CustomerKeywordListVO
;
import
java.util.List
;
/**
* @author darker
* @date 2023/3/20 11:08
*/
public
interface
CustomerKeywordService
extends
IService
<
CustomerKeyword
>
{
/**
* 列表
*
* @param queryDto 查询dto
* @return {@link GenericsResult}<{@link List}<{@link CustomerKeywordListVO}>>
*/
GenericsResult
<
List
<
CustomerKeywordListVO
>>
list
(
CustomerKeywordQueryDTO
queryDto
);
/**
* 创建
*
* @param saveDto 保存dto
* @return {@link GenericsResult}<{@link String}>
*/
GenericsResult
<
String
>
create
(
CustomerKeywordSaveDTO
saveDto
);
/**
* 创建文本项
*
* @param referralBody 推荐身体
* @return {@link GenericsResult}<{@link List}<{@link CommonReferralBody}>>
*/
GenericsResult
<
List
<
CommonReferralBody
>>
createTextItem
(
CommonReferralBody
referralBody
);
/**
* 得到信息
*
* @param id id
* @return {@link GenericsResult}<{@link CustomerKeywordInfoVO}>
*/
GenericsResult
<
CustomerKeywordInfoVO
>
getInfo
(
Long
id
);
/**
* 删除
*
* @param id id
* @return {@link BaseResult}
*/
BaseResult
remove
(
Long
id
);
/**
* 删除文本项
*
* @param id id
* @return {@link GenericsResult}<{@link List}<{@link CommonReferralBody}>>
*/
GenericsResult
<
List
<
CommonReferralBody
>>
removeTextItem
(
Long
id
);
/**
* 复制
*
* @param copyDto 复制dto
* @return {@link BaseResult}
*/
BaseResult
copy
(
CustomerKeywordCopyDTO
copyDto
);
}
src/main/java/com/yaoyaozw/customer/service/impl/CustomerFollowReplyServiceImpl.java
浏览文件 @
4af437ae
...
@@ -11,7 +11,7 @@ import com.yaoyaozw.customer.common.BaseResult;
...
@@ -11,7 +11,7 @@ import com.yaoyaozw.customer.common.BaseResult;
import
com.yaoyaozw.customer.common.GenericsResult
;
import
com.yaoyaozw.customer.common.GenericsResult
;
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.
FollowReplyCommon
Constant
;
import
com.yaoyaozw.customer.constants.
CustomerMaterial
Constant
;
import
com.yaoyaozw.customer.dto.follow.FollowReplyCopyDTO
;
import
com.yaoyaozw.customer.dto.follow.FollowReplyCopyDTO
;
import
com.yaoyaozw.customer.dto.follow.FollowReplyQueryDTO
;
import
com.yaoyaozw.customer.dto.follow.FollowReplyQueryDTO
;
import
com.yaoyaozw.customer.dto.follow.FollowReplySaveDTO
;
import
com.yaoyaozw.customer.dto.follow.FollowReplySaveDTO
;
...
@@ -91,14 +91,14 @@ public class CustomerFollowReplyServiceImpl extends ServiceImpl<CustomerFollowRe
...
@@ -91,14 +91,14 @@ public class CustomerFollowReplyServiceImpl extends ServiceImpl<CustomerFollowRe
if
(
isCreate
)
{
if
(
isCreate
)
{
// 新增的id
// 新增的id
entity
.
setId
(
snowflakeComponent
.
snowflakeId
());
entity
.
setId
(
snowflakeComponent
.
snowflakeId
());
}
else
if
(!
entity
.
getType
().
equals
(
sourceEntity
.
getType
())
&&
FollowReplyCommon
Constant
.
needReferral
(
sourceEntity
.
getType
()))
{
}
else
if
(!
entity
.
getType
().
equals
(
sourceEntity
.
getType
())
&&
CustomerMaterial
Constant
.
needReferral
(
sourceEntity
.
getType
()))
{
// 如果编辑更换过类型,清除掉referral数据
// 如果编辑更换过类型,清除掉referral数据
referralEntityService
.
remove
(
new
QueryWrapper
<
ReferralEntity
>().
eq
(
ReferralEntity
.
COL_MATERIAL_GRAPHICS_ID
,
sourceEntity
.
getId
()));
referralEntityService
.
remove
(
new
QueryWrapper
<
ReferralEntity
>().
eq
(
ReferralEntity
.
COL_MATERIAL_GRAPHICS_ID
,
sourceEntity
.
getId
()));
}
}
entity
.
setStatus
(
1
);
entity
.
setStatus
(
1
);
// 判断是否需要上传文件(图片、语音)
// 判断是否需要上传文件(图片、语音)
if
(
FollowReplyCommon
Constant
.
needUpload
(
entity
.
getType
()))
{
if
(
CustomerMaterial
Constant
.
needUpload
(
entity
.
getType
()))
{
// 编辑的时候,删除原来的media
// 编辑的时候,删除原来的media
if
(!
isCreate
)
{
if
(!
isCreate
)
{
if
(
StringUtils
.
isNotBlank
(
sourceEntity
.
getTxMediaId
()))
{
if
(
StringUtils
.
isNotBlank
(
sourceEntity
.
getTxMediaId
()))
{
...
@@ -116,7 +116,7 @@ public class CustomerFollowReplyServiceImpl extends ServiceImpl<CustomerFollowRe
...
@@ -116,7 +116,7 @@ public class CustomerFollowReplyServiceImpl extends ServiceImpl<CustomerFollowRe
}
}
entity
.
setTxMediaUrl
(
uploadResponse
.
getUrl
());
entity
.
setTxMediaUrl
(
uploadResponse
.
getUrl
());
entity
.
setTxMediaId
(
uploadResponse
.
getMedia_id
());
entity
.
setTxMediaId
(
uploadResponse
.
getMedia_id
());
}
else
if
(!
FollowReplyCommon
Constant
.
TENCENT_MEDIA_TYPE_TEXT
.
equals
(
entity
.
getType
())){
}
else
if
(!
CustomerMaterial
Constant
.
TENCENT_MEDIA_TYPE_TEXT
.
equals
(
entity
.
getType
())){
// 获取书城公众号链接(图文)
// 获取书城公众号链接(图文)
ReferralEntity
referralEntity
;
ReferralEntity
referralEntity
;
try
{
try
{
...
@@ -268,13 +268,13 @@ public class CustomerFollowReplyServiceImpl extends ServiceImpl<CustomerFollowRe
...
@@ -268,13 +268,13 @@ public class CustomerFollowReplyServiceImpl extends ServiceImpl<CustomerFollowRe
BeanUtil
.
copyProperties
(
entity
,
infoVo
);
BeanUtil
.
copyProperties
(
entity
,
infoVo
);
// 获取素材的链接数据
// 获取素材的链接数据
if
(
FollowReplyCommon
Constant
.
needReferral
(
entity
.
getType
()))
{
if
(
CustomerMaterial
Constant
.
needReferral
(
entity
.
getType
()))
{
// 是需要设置referral的类型
// 是需要设置referral的类型
if
(
FollowReplyCommon
Constant
.
TENCENT_MEDIA_TYPE_TEXT
.
equals
(
entity
.
getType
()))
{
if
(
CustomerMaterial
Constant
.
TENCENT_MEDIA_TYPE_TEXT
.
equals
(
entity
.
getType
()))
{
// 文本类型
// 文本类型
List
<
ReferralEntity
>
referralList
=
referralEntityService
.
list
(
new
QueryWrapper
<
ReferralEntity
>().
eq
(
ReferralEntity
.
COL_MATERIAL_GRAPHICS_ID
,
id
).
orderByAsc
(
"sort"
));
List
<
ReferralEntity
>
referralList
=
referralEntityService
.
list
(
new
QueryWrapper
<
ReferralEntity
>().
eq
(
ReferralEntity
.
COL_MATERIAL_GRAPHICS_ID
,
id
).
orderByAsc
(
"sort"
));
infoVo
.
setTextBodyList
(
getReferralBodyFromEntity
(
referralList
));
infoVo
.
setTextBodyList
(
getReferralBodyFromEntity
(
referralList
));
}
else
if
(
FollowReplyCommon
Constant
.
TENCENT_MEDIA_TYPE_NEWS
.
equals
(
entity
.
getType
()))
{
}
else
if
(
CustomerMaterial
Constant
.
TENCENT_MEDIA_TYPE_NEWS
.
equals
(
entity
.
getType
()))
{
try
{
try
{
// 设置图文类型的链接数据
// 设置图文类型的链接数据
ReferralEntity
referralEntity
=
referralEntityService
.
getOne
(
new
QueryWrapper
<
ReferralEntity
>().
eq
(
ReferralEntity
.
COL_MATERIAL_GRAPHICS_ID
,
id
));
ReferralEntity
referralEntity
=
referralEntityService
.
getOne
(
new
QueryWrapper
<
ReferralEntity
>().
eq
(
ReferralEntity
.
COL_MATERIAL_GRAPHICS_ID
,
id
));
...
@@ -355,7 +355,7 @@ public class CustomerFollowReplyServiceImpl extends ServiceImpl<CustomerFollowRe
...
@@ -355,7 +355,7 @@ public class CustomerFollowReplyServiceImpl extends ServiceImpl<CustomerFollowRe
}
}
private
String
checkNecessary
(
FollowReplySaveDTO
saveDto
)
{
private
String
checkNecessary
(
FollowReplySaveDTO
saveDto
)
{
if
(!
FollowReplyCommon
Constant
.
TENCENT_MEDIA_TYPE_TEXT
.
equals
(
saveDto
.
getType
()))
{
if
(!
CustomerMaterial
Constant
.
TENCENT_MEDIA_TYPE_TEXT
.
equals
(
saveDto
.
getType
()))
{
// 非文本类型的都需要文件
// 非文本类型的都需要文件
if
(
StringUtils
.
isEmpty
(
saveDto
.
getOriginMediaUrl
()))
{
if
(
StringUtils
.
isEmpty
(
saveDto
.
getOriginMediaUrl
()))
{
return
"请选择素材文件"
;
return
"请选择素材文件"
;
...
@@ -373,9 +373,9 @@ public class CustomerFollowReplyServiceImpl extends ServiceImpl<CustomerFollowRe
...
@@ -373,9 +373,9 @@ public class CustomerFollowReplyServiceImpl extends ServiceImpl<CustomerFollowRe
}
}
if
(
CollectionUtil
.
isNotEmpty
(
entityList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
entityList
))
{
String
jsonStr
=
JSONUtil
.
toJsonStr
(
entityList
);
String
jsonStr
=
JSONUtil
.
toJsonStr
(
entityList
);
redisTemplate
.
opsForHash
().
put
(
FollowReplyCommon
Constant
.
FOLLOW_REPLY_REDIS_KEY
,
appid
,
jsonStr
);
redisTemplate
.
opsForHash
().
put
(
CustomerMaterial
Constant
.
FOLLOW_REPLY_REDIS_KEY
,
appid
,
jsonStr
);
}
else
{
}
else
{
redisTemplate
.
opsForHash
().
delete
(
FollowReplyCommon
Constant
.
FOLLOW_REPLY_REDIS_KEY
,
appid
);
redisTemplate
.
opsForHash
().
delete
(
CustomerMaterial
Constant
.
FOLLOW_REPLY_REDIS_KEY
,
appid
);
}
}
}
}
...
...
src/main/java/com/yaoyaozw/customer/service/impl/CustomerKeywordServiceImpl.java
0 → 100644
浏览文件 @
4af437ae
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
cn.hutool.json.JSONArray
;
import
cn.hutool.json.JSONUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yaoyaozw.customer.common.BaseResult
;
import
com.yaoyaozw.customer.common.GenericsResult
;
import
com.yaoyaozw.customer.components.CustomerKeywordComponent
;
import
com.yaoyaozw.customer.components.SnowflakeComponent
;
import
com.yaoyaozw.customer.constants.CustomerMaterialConstant
;
import
com.yaoyaozw.customer.dto.keyword.CustomerKeywordCopyDTO
;
import
com.yaoyaozw.customer.dto.keyword.CustomerKeywordQueryDTO
;
import
com.yaoyaozw.customer.dto.keyword.CustomerKeywordSaveDTO
;
import
com.yaoyaozw.customer.entity.CommonReferralBody
;
import
com.yaoyaozw.customer.entity.CustomerKeyword
;
import
com.yaoyaozw.customer.entity.ReferralEntity
;
import
com.yaoyaozw.customer.mapper.CustomerKeywordMapper
;
import
com.yaoyaozw.customer.service.AuthorizerInfoService
;
import
com.yaoyaozw.customer.service.CustomerKeywordService
;
import
com.yaoyaozw.customer.service.ReferralEntityService
;
import
com.yaoyaozw.customer.utils.TencentCustomerUtil
;
import
com.yaoyaozw.customer.vo.AuthInfoVO
;
import
com.yaoyaozw.customer.vo.TencentMediaResponseVO
;
import
com.yaoyaozw.customer.vo.keyword.CustomerKeywordCopyResultVO
;
import
com.yaoyaozw.customer.vo.keyword.CustomerKeywordInfoVO
;
import
com.yaoyaozw.customer.vo.keyword.CustomerKeywordListVO
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
* @author darker
* @date 2023/3/20 11:09
*/
@Service
public
class
CustomerKeywordServiceImpl
extends
ServiceImpl
<
CustomerKeywordMapper
,
CustomerKeyword
>
implements
CustomerKeywordService
{
private
final
static
Logger
localLog
=
LoggerFactory
.
getLogger
(
CustomerKeywordServiceImpl
.
class
);
@Autowired
private
TencentCustomerUtil
tencentCustomerUtil
;
@Autowired
private
SnowflakeComponent
snowflakeComponent
;
@Autowired
private
CustomerKeywordComponent
keywordComponent
;
@Autowired
private
ReferralEntityService
referralEntityService
;
@Autowired
private
AuthorizerInfoService
authorizerInfoService
;
@Autowired
private
RedisTemplate
<
String
,
Object
>
redisTemplate
;
@Override
public
GenericsResult
<
List
<
CustomerKeywordListVO
>>
list
(
CustomerKeywordQueryDTO
queryDto
)
{
List
<
CustomerKeywordListVO
>
list
=
this
.
baseMapper
.
getList
(
queryDto
);
return
new
GenericsResult
<>(
list
);
}
@Override
public
GenericsResult
<
String
>
create
(
CustomerKeywordSaveDTO
saveDto
)
{
String
result
=
checkNecessary
(
saveDto
);
if
(
StringUtils
.
isNotEmpty
(
result
))
{
return
new
GenericsResult
<>(
false
,
result
);
}
CustomerKeyword
entity
=
new
CustomerKeyword
();
BeanUtil
.
copyProperties
(
saveDto
,
entity
);
CustomerKeyword
sourceEntity
=
null
;
boolean
isCreate
=
ObjectUtil
.
isNull
(
entity
.
getId
());
if
(!
isCreate
)
{
sourceEntity
=
this
.
getById
(
entity
.
getId
());
if
(
ObjectUtil
.
isNull
(
sourceEntity
))
{
return
new
GenericsResult
<>(
false
,
""
);
}
}
if
(
isCreate
)
{
// 新增的id
entity
.
setId
(
snowflakeComponent
.
snowflakeId
());
}
else
if
(!
entity
.
getType
().
equals
(
sourceEntity
.
getType
())
&&
CustomerMaterialConstant
.
needReferral
(
sourceEntity
.
getType
()))
{
// 如果编辑更换过类型,清除掉referral数据
referralEntityService
.
remove
(
new
QueryWrapper
<
ReferralEntity
>().
eq
(
ReferralEntity
.
COL_MATERIAL_GRAPHICS_ID
,
sourceEntity
.
getId
()));
}
entity
.
setStatus
(
1
);
// 判断是否需要上传文件(图片、语音)
if
(
CustomerMaterialConstant
.
needUpload
(
entity
.
getType
()))
{
// 编辑的时候,删除原来的media
if
(!
isCreate
)
{
if
(
StringUtils
.
isNotBlank
(
sourceEntity
.
getTxMediaId
()))
{
TencentMediaResponseVO
removeResponse
=
tencentCustomerUtil
.
removePermanentMedia
(
sourceEntity
.
getAppid
(),
sourceEntity
.
getTxMediaId
());
if
(
ObjectUtil
.
isNull
(
removeResponse
.
getErrcode
())
||
removeResponse
.
getErrcode
()
!=
0
)
{
return
new
GenericsResult
<>(
false
,
"删除原本素材失败: "
+
removeResponse
.
getErrmsg
());
}
}
}
// 上传文件
TencentMediaResponseVO
uploadResponse
=
tencentCustomerUtil
.
uploadTencentMedia
(
entity
.
getAppid
(),
entity
.
getOriginMediaUrl
(),
entity
.
getType
());
if
(
StringUtils
.
isNotBlank
(
uploadResponse
.
getErrmsg
()))
{
// 上传失败
return
new
GenericsResult
<>(
false
,
uploadResponse
.
getErrmsg
());
}
entity
.
setTxMediaUrl
(
uploadResponse
.
getUrl
());
entity
.
setTxMediaId
(
uploadResponse
.
getMedia_id
());
}
else
if
(!
CustomerMaterialConstant
.
TENCENT_MEDIA_TYPE_TEXT
.
equals
(
entity
.
getType
())){
// 获取书城公众号链接(图文)
ReferralEntity
referralEntity
;
try
{
referralEntity
=
keywordComponent
.
getCreateReferralEntity
(
saveDto
.
getReferralBody
());
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"获取链接异常: "
+
e
.
getMessage
());
}
referralEntity
.
setMaterialGraphicsId
(
entity
.
getId
());
entity
.
setSourceUrl
(
referralEntity
.
getReferral
());
entity
.
setContent
(
""
);
// 保存链接数据
if
(
ObjectUtil
.
isNull
(
referralEntity
.
getId
()))
{
referralEntityService
.
save
(
referralEntity
);
}
else
{
referralEntityService
.
updateById
(
referralEntity
);
}
}
// 保存主体数据
if
(
isCreate
)
{
this
.
save
(
entity
);
}
else
{
this
.
updateById
(
entity
);
}
putMaterialToRedis
(
entity
.
getAppid
(),
null
);
return
new
GenericsResult
<>(
String
.
valueOf
(
entity
.
getId
()));
}
@Override
public
GenericsResult
<
List
<
CommonReferralBody
>>
createTextItem
(
CommonReferralBody
referralBody
)
{
CustomerKeyword
entity
=
this
.
getById
(
referralBody
.
getMaterialGraphicsId
());
if
(
ObjectUtil
.
isNull
(
entity
))
{
return
new
GenericsResult
<>(
false
,
"找不到主体数据"
);
}
ReferralEntity
referralEntity
;
try
{
referralEntity
=
keywordComponent
.
getCreateReferralEntity
(
referralBody
);
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"获取链接异常: "
+
e
.
getMessage
());
}
// 保存链接数据
if
(
ObjectUtil
.
isNull
(
referralEntity
.
getId
()))
{
referralEntityService
.
save
(
referralEntity
);
}
else
{
referralEntityService
.
updateById
(
referralEntity
);
}
List
<
ReferralEntity
>
referralList
=
referralEntityService
.
list
(
new
QueryWrapper
<
ReferralEntity
>().
eq
(
ReferralEntity
.
COL_MATERIAL_GRAPHICS_ID
,
entity
.
getId
()).
orderByAsc
(
ReferralEntity
.
COL_GMT_CREATE
));
String
content
=
keywordComponent
.
reSortAndSaveTextItem
(
referralList
);
entity
.
setContent
(
content
);
// 保存主体
this
.
updateById
(
entity
);
return
new
GenericsResult
<>(
getReferralBodyFromEntity
(
referralList
));
}
@Override
public
BaseResult
remove
(
Long
id
)
{
// 从腾讯删除文件
CustomerKeyword
entity
=
this
.
getById
(
id
);
if
(
ObjectUtil
.
isNull
(
entity
))
{
return
new
BaseResult
().
error
(
"找不到实体数据"
);
}
if
(
StringUtils
.
isNotEmpty
(
entity
.
getTxMediaId
()))
{
tencentCustomerUtil
.
removePermanentMedia
(
entity
.
getAppid
(),
entity
.
getTxMediaId
());
}
// 删除本体
this
.
removeById
(
id
);
// 删除相关链接
referralEntityService
.
remove
(
new
QueryWrapper
<
ReferralEntity
>().
eq
(
ReferralEntity
.
COL_MATERIAL_GRAPHICS_ID
,
id
));
// 重置redis中的素材
putMaterialToRedis
(
entity
.
getAppid
(),
null
);
return
new
BaseResult
().
success
(
"删除"
);
}
@Override
public
GenericsResult
<
List
<
CommonReferralBody
>>
removeTextItem
(
Long
id
)
{
ReferralEntity
referralEntity
=
referralEntityService
.
getById
(
id
);
if
(
ObjectUtil
.
isNull
(
referralEntity
))
{
return
new
GenericsResult
<>(
false
,
"未找到该文本子素材"
);
}
// 查询子素材所属素材
CustomerKeyword
entity
=
this
.
getById
(
referralEntity
.
getMaterialGraphicsId
());
if
(
ObjectUtil
.
isNull
(
entity
))
{
return
new
GenericsResult
<>(
false
,
"未找到该文本所属素材"
);
}
// 删除子文本
referralEntityService
.
removeById
(
id
);
// 重新排序构造
List
<
ReferralEntity
>
referralList
=
referralEntityService
.
list
(
new
QueryWrapper
<
ReferralEntity
>().
eq
(
ReferralEntity
.
COL_MATERIAL_GRAPHICS_ID
,
referralEntity
.
getMaterialGraphicsId
()).
orderByAsc
(
ReferralEntity
.
COL_GMT_CREATE
));
String
content
=
keywordComponent
.
reSortAndSaveTextItem
(
referralList
);
entity
.
setContent
(
content
);
// 保存实体
this
.
updateById
(
entity
);
return
new
GenericsResult
<>(
getReferralBodyFromEntity
(
referralList
));
}
@Override
public
BaseResult
copy
(
CustomerKeywordCopyDTO
copyDto
)
{
AuthInfoVO
sourceAuth
=
copyDto
.
getSourceAuth
();
List
<
AuthInfoVO
>
targetAuthList
=
copyDto
.
getTargetAuthList
();
long
copyFlag
=
System
.
currentTimeMillis
();
localLog
.
info
(
"关回复用, 复用批次号: {}, 源公众号: {}, 目标公众号: {}条"
,
copyFlag
,
sourceAuth
.
getAccountName
(),
targetAuthList
.
size
());
List
<
CustomerKeyword
>
sourceMaterialList
=
getSourceMaterialList
(
sourceAuth
.
getAppId
());
if
(
CollectionUtil
.
isEmpty
(
sourceMaterialList
))
{
return
new
BaseResult
().
error
(
"源公众号找不到素材"
);
}
// 删除目标公众号现有的素材和链接
removeOriginMaterialList
(
targetAuthList
);
List
<
String
>
errorAuthList
=
null
;
int
idx
=
1
;
for
(
AuthInfoVO
targetAuth
:
targetAuthList
)
{
localLog
.
info
(
"批次号: {}, 公众号处理进度: {}/{}"
,
copyFlag
,
idx
++,
targetAuthList
.
size
());
// 调用复用
CustomerKeywordCopyResultVO
result
=
keywordComponent
.
copyMaterialToTarget
(
sourceAuth
.
getAccountName
(),
targetAuth
,
sourceMaterialList
);
if
(
result
.
getHasError
())
{
if
(
errorAuthList
==
null
)
{
errorAuthList
=
new
ArrayList
<>();
}
errorAuthList
.
add
(
targetAuth
.
getAccountName
());
}
else
{
if
(
CollectionUtil
.
isNotEmpty
(
result
.
getMaterialList
()))
{
this
.
saveBatch
(
result
.
getMaterialList
());
// 复用之后的结果存储到 redis
putMaterialToRedis
(
targetAuth
.
getAppId
(),
result
.
getMaterialList
());
}
if
(
CollectionUtil
.
isNotEmpty
(
result
.
getReferralEntityList
()))
{
referralEntityService
.
saveBatch
(
result
.
getReferralEntityList
());
}
}
}
if
(
CollectionUtil
.
isNotEmpty
(
errorAuthList
))
{
return
new
BaseResult
().
error
(
"部分成功; 复用异常公众号: "
+
errorAuthList
);
}
return
new
BaseResult
().
success
(
"复用完成"
);
}
@Override
public
GenericsResult
<
CustomerKeywordInfoVO
>
getInfo
(
Long
id
)
{
CustomerKeyword
entity
=
this
.
getById
(
id
);
CustomerKeywordInfoVO
infoVo
=
new
CustomerKeywordInfoVO
();
BeanUtil
.
copyProperties
(
entity
,
infoVo
);
// 获取素材的链接数据
if
(
CustomerMaterialConstant
.
needReferral
(
entity
.
getType
()))
{
// 是需要设置referral的类型
if
(
CustomerMaterialConstant
.
TENCENT_MEDIA_TYPE_TEXT
.
equals
(
entity
.
getType
()))
{
// 文本类型
List
<
ReferralEntity
>
referralList
=
referralEntityService
.
list
(
new
QueryWrapper
<
ReferralEntity
>().
eq
(
ReferralEntity
.
COL_MATERIAL_GRAPHICS_ID
,
id
).
orderByAsc
(
"sort"
));
infoVo
.
setTextBodyList
(
getReferralBodyFromEntity
(
referralList
));
}
else
if
(
CustomerMaterialConstant
.
TENCENT_MEDIA_TYPE_NEWS
.
equals
(
entity
.
getType
()))
{
try
{
// 设置图文类型的链接数据
ReferralEntity
referralEntity
=
referralEntityService
.
getOne
(
new
QueryWrapper
<
ReferralEntity
>().
eq
(
ReferralEntity
.
COL_MATERIAL_GRAPHICS_ID
,
id
));
if
(
ObjectUtil
.
isNotNull
(
referralEntity
))
{
CommonReferralBody
referralBody
=
new
CommonReferralBody
();
BeanUtil
.
copyProperties
(
referralEntity
,
referralBody
);
infoVo
.
setReferralBody
(
referralBody
);
}
}
catch
(
Exception
e
)
{
return
new
GenericsResult
<>(
false
,
"获取图文链接实体异常"
);
}
}
}
// 根据appid获取公众号信息
AuthInfoVO
authInfo
=
authorizerInfoService
.
getAuthInfoByAppid
(
infoVo
.
getAppid
());
if
(
ObjectUtil
.
isNull
(
authInfo
))
{
return
new
GenericsResult
<>(
false
,
"无法获取公众号信息"
);
}
infoVo
.
setAuthInfo
(
authInfo
);
return
new
GenericsResult
<>(
infoVo
);
}
private
List
<
CommonReferralBody
>
getReferralBodyFromEntity
(
List
<
ReferralEntity
>
referralList
)
{
keywordComponent
.
contractH5ContentBatch
(
referralList
);
JSONArray
referralJsonArray
=
JSONUtil
.
parseArray
(
referralList
);
return
JSONUtil
.
toList
(
referralJsonArray
,
CommonReferralBody
.
class
);
}
private
List
<
CustomerKeyword
>
getSourceMaterialList
(
String
appid
)
{
List
<
CustomerKeyword
>
sourceMaterialList
=
this
.
list
(
new
QueryWrapper
<
CustomerKeyword
>().
eq
(
"appid"
,
appid
));
if
(
CollectionUtil
.
isEmpty
(
sourceMaterialList
))
{
return
null
;
}
localLog
.
info
(
"获取到源公众号素材: {}条"
,
sourceMaterialList
.
size
());
// 获取链接
List
<
Long
>
materialIdList
=
sourceMaterialList
.
stream
().
map
(
CustomerKeyword:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
ReferralEntity
>
referralEntityList
=
referralEntityService
.
list
(
new
QueryWrapper
<
ReferralEntity
>().
in
(
ReferralEntity
.
COL_MATERIAL_GRAPHICS_ID
,
materialIdList
));
localLog
.
info
(
"获取到源公众号链接数据: {}条"
,
referralEntityList
.
size
());
Map
<
Long
,
List
<
ReferralEntity
>>
referralMap
=
referralEntityList
.
stream
().
collect
(
Collectors
.
groupingBy
(
ReferralEntity:
:
getMaterialGraphicsId
));
// 分配referral
for
(
CustomerKeyword
sourceEntity
:
sourceMaterialList
)
{
List
<
ReferralEntity
>
referralEntities
=
referralMap
.
get
(
sourceEntity
.
getId
());
if
(
CollectionUtil
.
isNotEmpty
(
referralEntities
))
{
referralEntities
=
referralEntities
.
stream
().
sorted
(
Comparator
.
comparingInt
(
ReferralEntity:
:
getSort
)).
collect
(
Collectors
.
toList
());
sourceEntity
.
setReferralEntityList
(
referralEntities
);
}
}
return
sourceMaterialList
;
}
private
void
removeOriginMaterialList
(
List
<
AuthInfoVO
>
targetList
)
{
List
<
String
>
targetAppidList
=
targetList
.
stream
().
map
(
AuthInfoVO:
:
getAppId
).
collect
(
Collectors
.
toList
());
List
<
CustomerKeyword
>
sourceMaterialList
=
this
.
list
(
new
QueryWrapper
<
CustomerKeyword
>().
in
(
"appid"
,
targetAppidList
));
// 原来没有
if
(
CollectionUtil
.
isEmpty
(
sourceMaterialList
))
{
return
;
}
List
<
Long
>
sourceMaterialIdList
=
new
ArrayList
<>();
for
(
CustomerKeyword
sourceMaterial
:
sourceMaterialList
)
{
sourceMaterialIdList
.
add
(
sourceMaterial
.
getId
());
if
(
StringUtils
.
isNotEmpty
(
sourceMaterial
.
getTxMediaId
()))
{
// 删除公众号后台的素材
tencentCustomerUtil
.
removePermanentMedia
(
sourceMaterial
.
getAppid
(),
sourceMaterial
.
getTxMediaId
());
}
}
// 删除主体
this
.
removeByIds
(
sourceMaterialIdList
);
// 删除链接
referralEntityService
.
remove
(
new
QueryWrapper
<
ReferralEntity
>().
in
(
ReferralEntity
.
COL_MATERIAL_GRAPHICS_ID
,
sourceMaterialIdList
));
}
private
String
checkNecessary
(
CustomerKeywordSaveDTO
saveDto
)
{
if
(!
CustomerMaterialConstant
.
TENCENT_MEDIA_TYPE_TEXT
.
equals
(
saveDto
.
getType
()))
{
// 非文本类型的都需要文件
if
(
StringUtils
.
isEmpty
(
saveDto
.
getOriginMediaUrl
()))
{
return
"请选择素材文件"
;
}
}
return
null
;
}
private
void
putMaterialToRedis
(
String
appid
,
List
<
CustomerKeyword
>
entityList
)
{
if
(
StringUtils
.
isNotEmpty
(
appid
)
&&
CollectionUtil
.
isEmpty
(
entityList
))
{
// 传参没传实体, 现查
entityList
=
this
.
list
(
new
QueryWrapper
<
CustomerKeyword
>().
eq
(
"appid"
,
appid
));
}
if
(
CollectionUtil
.
isNotEmpty
(
entityList
))
{
String
jsonStr
=
JSONUtil
.
toJsonStr
(
entityList
);
redisTemplate
.
opsForHash
().
put
(
CustomerMaterialConstant
.
CUSTOMER_KEYWORD_REDIS_KEY
,
appid
,
jsonStr
);
}
else
{
redisTemplate
.
opsForHash
().
delete
(
CustomerMaterialConstant
.
CUSTOMER_KEYWORD_REDIS_KEY
,
appid
);
}
}
}
src/main/java/com/yaoyaozw/customer/vo/follow/FollowReplyListVO.java
浏览文件 @
4af437ae
...
@@ -2,9 +2,8 @@ package com.yaoyaozw.customer.vo.follow;
...
@@ -2,9 +2,8 @@ package com.yaoyaozw.customer.vo.follow;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
com.fasterxml.jackson.databind.ser.std.ToStringSerializer
;
import
com.fasterxml.jackson.databind.ser.std.ToStringSerializer
;
import
com.yaoyaozw.customer.constants.
FollowReplyCommon
Constant
;
import
com.yaoyaozw.customer.constants.
CustomerMaterial
Constant
;
import
lombok.Data
;
import
lombok.Data
;
import
org.apache.commons.lang3.StringUtils
;
import
java.io.Serializable
;
import
java.io.Serializable
;
...
@@ -31,6 +30,6 @@ public class FollowReplyListVO implements Serializable {
...
@@ -31,6 +30,6 @@ public class FollowReplyListVO implements Serializable {
private
Integer
sort
;
private
Integer
sort
;
public
String
getTypeDesc
()
{
public
String
getTypeDesc
()
{
return
FollowReplyCommon
Constant
.
getTypeDesc
(
this
.
type
);
return
CustomerMaterial
Constant
.
getTypeDesc
(
this
.
type
);
}
}
}
}
src/main/java/com/yaoyaozw/customer/vo/keyword/CustomerKeywordCopyResultVO.java
0 → 100644
浏览文件 @
4af437ae
package
com
.
yaoyaozw
.
customer
.
vo
.
keyword
;
import
com.yaoyaozw.customer.entity.CustomerFollowReply
;
import
com.yaoyaozw.customer.entity.CustomerKeyword
;
import
com.yaoyaozw.customer.entity.ReferralEntity
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.List
;
/**
* @author darker
* @date 2023/3/14 16:48
*/
@Data
public
class
CustomerKeywordCopyResultVO
implements
Serializable
{
private
Boolean
hasError
;
private
List
<
CustomerKeyword
>
materialList
;
private
List
<
ReferralEntity
>
referralEntityList
;
}
src/main/java/com/yaoyaozw/customer/vo/keyword/CustomerKeywordInfoVO.java
0 → 100644
浏览文件 @
4af437ae
package
com
.
yaoyaozw
.
customer
.
vo
.
keyword
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
com.fasterxml.jackson.databind.ser.std.ToStringSerializer
;
import
com.yaoyaozw.customer.entity.CommonReferralBody
;
import
com.yaoyaozw.customer.vo.AuthInfoVO
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* @author darker
* @date 2023/3/13 20:07
*/
@Data
public
class
CustomerKeywordInfoVO
implements
Serializable
{
@JsonSerialize
(
using
=
ToStringSerializer
.
class
)
private
Long
id
;
private
String
appid
;
private
String
keyword
;
private
String
type
;
private
String
originMediaUrl
;
private
String
extendTitle
;
private
String
extendDesc
;
private
Integer
sort
;
private
AuthInfoVO
authInfo
;
private
CommonReferralBody
referralBody
;
private
List
<
CommonReferralBody
>
textBodyList
;
public
CommonReferralBody
getReferralBody
()
{
return
ObjectUtil
.
isNull
(
referralBody
)
?
new
CommonReferralBody
()
:
referralBody
;
}
public
List
<
CommonReferralBody
>
getTextBodyList
()
{
return
textBodyList
==
null
?
new
ArrayList
<>(
4
)
:
textBodyList
;
}
}
src/main/java/com/yaoyaozw/customer/vo/keyword/CustomerKeywordListVO.java
0 → 100644
浏览文件 @
4af437ae
package
com
.
yaoyaozw
.
customer
.
vo
.
keyword
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
com.fasterxml.jackson.databind.ser.std.ToStringSerializer
;
import
com.yaoyaozw.customer.constants.CustomerMaterialConstant
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @author darker
* @date 2023/3/13 20:07
*/
@Data
public
class
CustomerKeywordListVO
implements
Serializable
{
@JsonSerialize
(
using
=
ToStringSerializer
.
class
)
private
Long
id
;
private
String
keyword
;
private
String
authName
;
private
String
typeDesc
;
private
String
statusDesc
;
private
String
type
;
private
Integer
sort
;
public
String
getTypeDesc
()
{
return
CustomerMaterialConstant
.
getTypeDesc
(
this
.
type
);
}
}
src/main/resources/mapper/CustomerKeywordMapper.xml
0 → 100644
浏览文件 @
4af437ae
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.yaoyaozw.customer.mapper.CustomerKeywordMapper"
>
<select
id=
"getList"
resultType=
"com.yaoyaozw.customer.vo.keyword.CustomerKeywordListVO"
>
select
ck.id,
ck.keyword,
ck.type,
ai.nick_name as authName,
if(ck.status = 1, '正常', '异常') as statusDesc
from customer_keyword ck
left join authorizer_info ai
on ck.appid = ai.appid
where ck.is_deleted = 0
and ck.appid = #{queryDto.appId}
</select>
</mapper>
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论