Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
O
operate-customer-service
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
沈振路
operate-customer-service
Commits
473af6da
提交
473af6da
authored
3月 14, 2023
作者:
沈振路
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
关回接口(完成-未测试)
上级
8b1bd7ac
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
20 个修改的文件
包含
492 行增加
和
54 行删除
+492
-54
FollowReplyComponent.java
...om/yaoyaozw/customer/components/FollowReplyComponent.java
+0
-0
MyMetaObjectHandler.java
...va/com/yaoyaozw/customer/configs/MyMetaObjectHandler.java
+6
-7
CustomerCommonConstant.java
...m/yaoyaozw/customer/constants/CustomerCommonConstant.java
+4
-4
FollowReplyCommonConstant.java
...aoyaozw/customer/constants/FollowReplyCommonConstant.java
+27
-0
FollowReplyController.java
...m/yaoyaozw/customer/controller/FollowReplyController.java
+28
-18
FollowReplyCopyDTO.java
.../com/yaoyaozw/customer/dto/follow/FollowReplyCopyDTO.java
+8
-1
FollowReplyQueryDTO.java
...com/yaoyaozw/customer/dto/follow/FollowReplyQueryDTO.java
+5
-1
FollowReplySaveDTO.java
.../com/yaoyaozw/customer/dto/follow/FollowReplySaveDTO.java
+23
-1
CommonReferralBody.java
...java/com/yaoyaozw/customer/entity/CommonReferralBody.java
+2
-0
CustomerFollowReply.java
...ava/com/yaoyaozw/customer/entity/CustomerFollowReply.java
+135
-0
CustomerFollowReplyMapper.java
...m/yaoyaozw/customer/mapper/CustomerFollowReplyMapper.java
+13
-0
CustomerFollowReplyService.java
...yaoyaozw/customer/service/CustomerFollowReplyService.java
+77
-0
CustomerFollowReplyServiceImpl.java
...customer/service/impl/CustomerFollowReplyServiceImpl.java
+0
-0
HttpClientUtil.java
...main/java/com/yaoyaozw/customer/utils/HttpClientUtil.java
+0
-0
TencentCustomerUtil.java
...java/com/yaoyaozw/customer/utils/TencentCustomerUtil.java
+96
-6
TencentMediaResponseVO.java
...java/com/yaoyaozw/customer/vo/TencentMediaResponseVO.java
+4
-0
FollowReplyCopyResultVO.java
.../yaoyaozw/customer/vo/follow/FollowReplyCopyResultVO.java
+12
-2
FollowReplyInfoVO.java
...va/com/yaoyaozw/customer/vo/follow/FollowReplyInfoVO.java
+39
-0
FollowReplyListVO.java
...va/com/yaoyaozw/customer/vo/follow/FollowReplyListVO.java
+13
-1
FollowReturnTextItemVO.java
...m/yaoyaozw/customer/vo/follow/FollowReturnTextItemVO.java
+0
-13
没有找到文件。
src/main/java/com/yaoyaozw/customer/components/FollowReplyComponent.java
0 → 100644
浏览文件 @
473af6da
差异被折叠。
点击展开。
src/main/java/com/yaoyaozw/customer/configs/MyMetaObjectHandler.java
浏览文件 @
473af6da
...
...
@@ -22,13 +22,13 @@ public class MyMetaObjectHandler implements MetaObjectHandler {
@Override
public
void
insertFill
(
MetaObject
metaObject
)
{
Long
userId
=
tokenManager
.
getUserIdFromToken
();
if
(
ObjectUtil
.
isNull
(
userId
)){
this
.
setFieldValByName
(
"gmtModifiedUser"
,
"0"
,
metaObject
);
this
.
setFieldValByName
(
"gmtCreateUser"
,
"0"
,
metaObject
);
}
else
{
if
(
ObjectUtil
.
isNotNull
(
userId
)){
String
userIdStr
=
userId
.
toString
();
this
.
setFieldValByName
(
"gmtModifiedUser"
,
userIdStr
,
metaObject
);
this
.
setFieldValByName
(
"gmtCreateUser"
,
userIdStr
,
metaObject
);
this
.
setFieldValByName
(
"modifiedUser"
,
userId
,
metaObject
);
this
.
setFieldValByName
(
"createUser"
,
userId
,
metaObject
);
}
this
.
setFieldValByName
(
"gmtCreate"
,
new
Date
(),
metaObject
);
this
.
setFieldValByName
(
"gmtModified"
,
new
Date
(),
metaObject
);
...
...
@@ -41,10 +41,9 @@ public class MyMetaObjectHandler implements MetaObjectHandler {
public
void
updateFill
(
MetaObject
metaObject
)
{
this
.
setFieldValByName
(
"gmtModified"
,
new
Date
(),
metaObject
);
Long
userId
=
tokenManager
.
getUserIdFromToken
();
if
(
ObjectUtil
.
isNull
(
userId
)){
this
.
setFieldValByName
(
"gmtModifiedUser"
,
"0"
,
metaObject
);
}
else
{
if
(
ObjectUtil
.
isNotNull
(
userId
)){
this
.
setFieldValByName
(
"gmtModifiedUser"
,
userId
.
toString
(),
metaObject
);
this
.
setFieldValByName
(
"modifiedUser"
,
userId
,
metaObject
);
}
}
}
src/main/java/com/yaoyaozw/customer/constants/CustomerCommonConstant.java
浏览文件 @
473af6da
...
...
@@ -89,7 +89,7 @@ public class CustomerCommonConstant {
public
static
String
getNewsTypeName
(
Integer
code
)
{
if
(
ObjectUtil
.
isNull
(
code
))
{
return
null
;
return
""
;
}
if
(
code
.
equals
(
BOOK_NEWS_TYPE
))
{
return
BOOK_NEWS_TYPE_NAME
;
...
...
@@ -100,12 +100,12 @@ public class CustomerCommonConstant {
if
(
code
.
equals
(
USUAL_LINK_NEWS_TYPE
))
{
return
USUAL_LINK_NEWS_TYPE_NAME
;
}
return
null
;
return
""
;
}
public
static
String
getLinkNameModel
(
Integer
code
)
{
if
(
ObjectUtil
.
isNull
(
code
))
{
return
null
;
return
""
;
}
if
(
code
.
equals
(
BOOK_NEWS_TYPE
))
{
return
BOOK_NEWS_TYPE_NAME_MODEL
;
...
...
@@ -114,7 +114,7 @@ public class CustomerCommonConstant {
return
ACTIVITY_NEWS_TYPE_NAME_MODEL
;
}
return
null
;
return
""
;
}
}
src/main/java/com/yaoyaozw/customer/constants/FollowReplyCommonConstant.java
0 → 100644
浏览文件 @
473af6da
package
com
.
yaoyaozw
.
customer
.
constants
;
import
java.util.Arrays
;
import
java.util.List
;
/**
* @author darker
* @date 2023/3/14 11:56
*/
public
class
FollowReplyCommonConstant
{
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_NEWS
=
"news"
;
public
final
static
String
TENCENT_MEDIA_TYPE_TEXT
=
"text"
;
public
static
Boolean
needUpload
(
String
type
)
{
return
TENCENT_MEDIA_TYPE_PIC
.
equals
(
type
)
||
TENCENT_MEDIA_TYPE_VOICE
.
equals
(
type
);
}
public
static
Boolean
needReferral
(
String
type
)
{
return
TENCENT_MEDIA_TYPE_NEWS
.
equals
(
type
)
||
TENCENT_MEDIA_TYPE_TEXT
.
equals
(
type
);
}
}
src/main/java/com/yaoyaozw/customer/controller/FollowRe
turn
Controller.java
→
src/main/java/com/yaoyaozw/customer/controller/FollowRe
ply
Controller.java
浏览文件 @
473af6da
...
...
@@ -2,12 +2,14 @@ package com.yaoyaozw.customer.controller;
import
com.yaoyaozw.customer.common.BaseResult
;
import
com.yaoyaozw.customer.common.GenericsResult
;
import
com.yaoyaozw.customer.dto.follow.FollowRe
turn
CopyDTO
;
import
com.yaoyaozw.customer.dto.follow.FollowRe
ply
CopyDTO
;
import
com.yaoyaozw.customer.entity.CommonReferralBody
;
import
com.yaoyaozw.customer.dto.follow.FollowReturnQueryDTO
;
import
com.yaoyaozw.customer.dto.follow.FollowReturnSaveDTO
;
import
com.yaoyaozw.customer.vo.follow.FollowReturnListVO
;
import
com.yaoyaozw.customer.vo.follow.FollowReturnTextItemVO
;
import
com.yaoyaozw.customer.dto.follow.FollowReplyQueryDTO
;
import
com.yaoyaozw.customer.dto.follow.FollowReplySaveDTO
;
import
com.yaoyaozw.customer.service.CustomerFollowReplyService
;
import
com.yaoyaozw.customer.vo.follow.FollowReplyInfoVO
;
import
com.yaoyaozw.customer.vo.follow.FollowReplyListVO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
...
...
@@ -17,38 +19,46 @@ import java.util.List;
* @date 2023/3/13 19:47
*/
@RestController
@RequestMapping
(
"/follow-return"
)
public
class
FollowReturnController
{
@RequestMapping
(
"/follow-reply"
)
public
class
FollowReplyController
{
@Autowired
private
CustomerFollowReplyService
followReplyService
;
@PostMapping
(
"/list"
)
public
GenericsResult
<
List
<
FollowRe
turnListVO
>>
list
(
@RequestBody
FollowReturn
QueryDTO
queryDto
)
{
return
null
;
public
GenericsResult
<
List
<
FollowRe
plyListVO
>>
list
(
@RequestBody
FollowReply
QueryDTO
queryDto
)
{
return
followReplyService
.
list
(
queryDto
)
;
}
@PostMapping
(
"/create"
)
public
GenericsResult
<
String
>
create
(
@RequestBody
FollowRe
turn
SaveDTO
saveDto
)
{
return
null
;
public
GenericsResult
<
String
>
create
(
@RequestBody
FollowRe
ply
SaveDTO
saveDto
)
{
return
followReplyService
.
create
(
saveDto
)
;
}
@PostMapping
(
"/createTextItem"
)
public
GenericsResult
<
List
<
FollowReturnTextItemVO
>>
createTextItem
(
@RequestBody
CommonReferralBody
referralBody
)
{
return
null
;
public
GenericsResult
<
List
<
CommonReferralBody
>>
createTextItem
(
@RequestBody
CommonReferralBody
referralBody
)
{
return
followReplyService
.
createTextItem
(
referralBody
);
}
@GetMapping
(
"/info/{id}"
)
public
GenericsResult
<
FollowReplyInfoVO
>
getInfo
(
@PathVariable
(
"id"
)
Long
id
)
{
return
followReplyService
.
getInfo
(
id
);
}
@GetMapping
(
"/remove/{id}"
)
public
BaseResult
remove
(
@PathVariable
(
"id"
)
Long
id
)
{
return
null
;
return
followReplyService
.
remove
(
id
)
;
}
@GetMapping
(
"/removeTextItem/{id}"
)
public
GenericsResult
<
List
<
FollowReturnTextItemVO
>>
removeTextItem
(
@PathVariable
(
"id"
)
Long
id
)
{
return
null
;
public
GenericsResult
<
List
<
CommonReferralBody
>>
removeTextItem
(
@PathVariable
(
"id"
)
Long
id
)
{
return
followReplyService
.
removeTextItem
(
id
)
;
}
@PostMapping
(
"/copy"
)
public
BaseResult
copy
(
@RequestBody
FollowRe
turn
CopyDTO
copyDto
)
{
return
null
;
public
BaseResult
copy
(
@RequestBody
FollowRe
ply
CopyDTO
copyDto
)
{
return
followReplyService
.
copy
(
copyDto
)
;
}
...
...
src/main/java/com/yaoyaozw/customer/dto/follow/FollowRe
turnQuer
yDTO.java
→
src/main/java/com/yaoyaozw/customer/dto/follow/FollowRe
plyCop
yDTO.java
浏览文件 @
473af6da
package
com
.
yaoyaozw
.
customer
.
dto
.
follow
;
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
FollowReturnQueryDTO
implements
Serializable
{
public
class
FollowReplyCopyDTO
implements
Serializable
{
private
AuthInfoVO
sourceAuth
;
private
List
<
AuthInfoVO
>
targetAuthList
;
}
src/main/java/com/yaoyaozw/customer/dto/follow/FollowRe
turnCop
yDTO.java
→
src/main/java/com/yaoyaozw/customer/dto/follow/FollowRe
plyQuer
yDTO.java
浏览文件 @
473af6da
...
...
@@ -3,11 +3,15 @@ package com.yaoyaozw.customer.dto.follow;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.List
;
/**
* @author darker
* @date 2023/3/13 19:59
*/
@Data
public
class
FollowReturnCopyDTO
implements
Serializable
{
public
class
FollowReplyQueryDTO
implements
Serializable
{
private
String
appId
;
}
src/main/java/com/yaoyaozw/customer/dto/follow/FollowRe
turn
SaveDTO.java
→
src/main/java/com/yaoyaozw/customer/dto/follow/FollowRe
ply
SaveDTO.java
浏览文件 @
473af6da
package
com
.
yaoyaozw
.
customer
.
dto
.
follow
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.yaoyaozw.customer.entity.CommonReferralBody
;
import
com.yaoyaozw.customer.vo.AuthInfoVO
;
import
lombok.Data
;
import
java.io.Serializable
;
...
...
@@ -9,5 +12,24 @@ import java.io.Serializable;
* @date 2023/3/13 19:59
*/
@Data
public
class
FollowReturnSaveDTO
implements
Serializable
{
public
class
FollowReplySaveDTO
implements
Serializable
{
private
Long
id
;
private
String
appid
;
private
String
name
;
private
String
type
;
private
String
originMediaUrl
;
private
String
extendTitle
;
private
String
extendDesc
;
private
Integer
sort
;
private
CommonReferralBody
referralBody
;
}
src/main/java/com/yaoyaozw/customer/entity/CommonReferralBody.java
浏览文件 @
473af6da
...
...
@@ -36,6 +36,8 @@ public class CommonReferralBody implements Serializable {
@ApiModelProperty
(
"appId"
)
private
String
appId
;
private
Long
infoId
;
@ApiModelProperty
(
"链接类型"
)
private
Integer
newsType
;
...
...
src/main/java/com/yaoyaozw/customer/entity/CustomerFollowReply.java
0 → 100644
浏览文件 @
473af6da
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/14
*/
@Data
@TableName
(
"customer_follow_reply"
)
public
class
CustomerFollowReply
implements
Serializable
{
/**
* 主键id
*/
@Id
@TableId
(
value
=
"id"
,
type
=
IdType
.
ID_WORKER
)
private
Long
id
;
/**
* 公众号appid
*/
@TableField
(
"appid"
)
private
String
appid
;
/**
* 素材名称
*/
@TableField
(
"name"
)
private
String
name
;
/**
* 类型
*/
@TableField
(
"type"
)
private
String
type
;
/**
* 图片/音频 原文件地址
*/
@TableField
(
"origin_media_url"
)
private
String
originMediaUrl
;
/**
* 图片/音频 腾讯后台地址
*/
@TableField
(
"tx_media_url"
)
private
String
txMediaUrl
;
/**
* 图片/音频 腾讯后台标识
*/
@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
(
"sort"
)
private
Integer
sort
;
/**
* 状态
*/
@TableField
(
"status"
)
private
Integer
status
;
/**
* 逻辑删除
*/
@TableField
(
value
=
"is_deleted"
,
fill
=
FieldFill
.
INSERT
)
@TableLogic
private
Integer
isDeleted
;
/**
* 创建人
*/
@TableField
(
value
=
"gmt_create"
,
fill
=
FieldFill
.
INSERT
)
private
Long
createUser
;
/**
* 创建时间
*/
@TableField
(
value
=
"gmt_create"
,
fill
=
FieldFill
.
INSERT
)
private
Date
gmtCreate
;
/**
* 更新人
*/
@TableField
(
value
=
"gmt_modified"
,
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/CustomerFollowReplyMapper.java
0 → 100644
浏览文件 @
473af6da
package
com
.
yaoyaozw
.
customer
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yaoyaozw.customer.entity.CustomerFollowReply
;
import
org.springframework.stereotype.Repository
;
/**
* @author darker
* @date 2023/3/14 11:14
*/
@Repository
public
interface
CustomerFollowReplyMapper
extends
BaseMapper
<
CustomerFollowReply
>
{
}
src/main/java/com/yaoyaozw/customer/service/CustomerFollowReplyService.java
0 → 100644
浏览文件 @
473af6da
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.follow.FollowReplyCopyDTO
;
import
com.yaoyaozw.customer.dto.follow.FollowReplyQueryDTO
;
import
com.yaoyaozw.customer.dto.follow.FollowReplySaveDTO
;
import
com.yaoyaozw.customer.entity.CommonReferralBody
;
import
com.yaoyaozw.customer.entity.CustomerFollowReply
;
import
com.yaoyaozw.customer.vo.follow.FollowReplyInfoVO
;
import
com.yaoyaozw.customer.vo.follow.FollowReplyListVO
;
import
java.util.List
;
/**
* @author darker
* @date 2023/3/14 11:14
*/
public
interface
CustomerFollowReplyService
extends
IService
<
CustomerFollowReply
>
{
/**
* 列表
*
* @param queryDto 查询dto
* @return {@link GenericsResult}<{@link List}<{@link FollowReplyListVO}>>
*/
GenericsResult
<
List
<
FollowReplyListVO
>>
list
(
FollowReplyQueryDTO
queryDto
);
/**
* 创建
*
* @param saveDto 保存dto
* @return {@link GenericsResult}<{@link String}>
*/
GenericsResult
<
String
>
create
(
FollowReplySaveDTO
saveDto
);
/**
* 创建文本项
*
* @param referralBody 推荐身体
* @return {@link GenericsResult}<{@link List}<{@link CommonReferralBody}>>
*/
GenericsResult
<
List
<
CommonReferralBody
>>
createTextItem
(
CommonReferralBody
referralBody
);
/**
* 删除
*
* @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
(
FollowReplyCopyDTO
copyDto
);
/**
* 得到信息
*
* @param id id
* @return {@link GenericsResult}<{@link FollowReplyInfoVO}>
*/
GenericsResult
<
FollowReplyInfoVO
>
getInfo
(
Long
id
);
}
src/main/java/com/yaoyaozw/customer/service/impl/CustomerFollowReplyServiceImpl.java
0 → 100644
浏览文件 @
473af6da
差异被折叠。
点击展开。
src/main/java/com/yaoyaozw/customer/utils/HttpClientUtil.java
0 → 100644
浏览文件 @
473af6da
差异被折叠。
点击展开。
src/main/java/com/yaoyaozw/customer/utils/TencentCustomerUtil.java
浏览文件 @
473af6da
package
com
.
yaoyaozw
.
customer
.
utils
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.json.JSONObject
;
import
cn.hutool.json.JSONUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.yaoyaozw.customer.entity.AuthorizerToken
;
import
com.yaoyaozw.customer.entity.ReferralEntity
;
import
com.yaoyaozw.customer.service.AuthorizerTokenService
;
import
com.yaoyaozw.customer.service.ReferralEntityService
;
import
com.yaoyaozw.customer.vo.TencentMediaResponseVO
;
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.Component
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author darker
* @date 2023/3/13 20:11
*/
public
class
TencentCustomerUtil
{
@Component
public
class
TencentCustomerUtil
{
private
final
static
Logger
localLog
=
LoggerFactory
.
getLogger
(
TencentCustomerUtil
.
class
);
private
final
static
String
AUTH_ACCESS_TOKEN_REDIS_KEY
=
"AUTH_ACCESS_TOKEN"
;
private
final
static
String
MEDIA_ADD_URL
=
"https://api.weixin.qq.com/cgi-bin/material/add_material"
;
private
final
static
String
MEDIA_DEL_URL
=
"https://api.weixin.qq.com/cgi-bin/material/del_material"
;
@Autowired
private
AuthorizerTokenService
authorizerTokenService
;
@Autowired
private
RedisTemplate
<
String
,
Object
>
redisTemplate
;
/**
* 上传腾讯媒体
*
* @param appid 公众号
* @param fileUrl 文件url
* @param accessToken 访问令牌
* @return {@link TencentMediaResponseVO}
*/
public
static
TencentMediaResponseVO
uploadTencentMedia
(
String
fileUrl
,
String
accessToken
)
{
public
TencentMediaResponseVO
uploadTencentMedia
(
String
appid
,
String
fileUrl
,
String
mediaType
)
{
localLog
.
info
(
"上传媒体文件, 原始文件地址: {}"
,
fileUrl
);
// 获取公众号token
String
accessToken
=
getAccessTokenByAppid
(
appid
);
if
(
StringUtils
.
isEmpty
(
accessToken
))
{
localLog
.
warn
(
"appid: {} 没找到accessToken"
,
appid
);
TencentMediaResponseVO
response
=
new
TencentMediaResponseVO
();
response
.
setErrmsg
(
"appid: "
+
appid
+
"没找到accessToken"
);
return
response
;
}
// 根据文件地址获取文件
String
suffix
=
fileUrl
.
substring
(
fileUrl
.
lastIndexOf
(
"="
)
+
1
);
byte
[]
fileByte
=
HttpClientUtil
.
readInputStream
(
fileUrl
);
// 构造参数,上传到腾讯后台
Map
<
String
,
String
>
map
=
new
HashMap
<>(
4
);
map
.
put
(
"access_token"
,
accessToken
);
map
.
put
(
"type"
,
mediaType
);
String
json
=
HttpClientUtil
.
uploadFileByte
(
MEDIA_ADD_URL
,
fileByte
,
map
,
suffix
);
return
JSONUtil
.
toBean
(
JSONUtil
.
parseObj
(
json
),
TencentMediaResponseVO
.
class
);
}
/**
* 删除永久媒体
*
* @param appid appid
* @param mediaId 媒体id
* @return {@link TencentMediaResponseVO}
*/
public
TencentMediaResponseVO
removePermanentMedia
(
String
appid
,
String
mediaId
)
{
// 获取公众号token
String
accessToken
=
getAccessTokenByAppid
(
appid
);
// 构造参数,上传到腾讯后台
Map
<
String
,
String
>
map
=
new
HashMap
<>(
4
);
map
.
put
(
"access_token"
,
accessToken
);
JSONObject
json
=
new
JSONObject
();
json
.
put
(
"media_id"
,
mediaId
);
String
jsonStr
=
JSONUtil
.
toJsonStr
(
json
);
String
delResult
=
HttpClientUtil
.
doPostJson
(
MEDIA_DEL_URL
,
jsonStr
,
map
);
localLog
.
info
(
"删除素材结果: {}"
,
delResult
);
// 上传文件到腾讯后台
return
JSONUtil
.
toBean
(
JSONUtil
.
parseObj
(
delResult
),
TencentMediaResponseVO
.
class
);
}
/**
* 通过appid获取访问令牌
*
* @param appid appid
* @return {@link String}
*/
private
String
getAccessTokenByAppid
(
String
appid
)
{
return
null
;
Object
token
=
redisTemplate
.
opsForHash
().
get
(
AUTH_ACCESS_TOKEN_REDIS_KEY
,
appid
);
// 如果redis中没找到, 去数据库找
if
(
ObjectUtil
.
isNull
(
token
))
{
AuthorizerToken
authorizerToken
=
authorizerTokenService
.
findTokenByAppid
(
appid
);
return
ObjectUtil
.
isNull
(
authorizerToken
)
?
null
:
authorizerToken
.
getAuthorizerAccessToken
();
}
return
String
.
valueOf
(
token
);
}
}
src/main/java/com/yaoyaozw/customer/vo/TencentMediaResponseVO.java
浏览文件 @
473af6da
...
...
@@ -15,4 +15,8 @@ public class TencentMediaResponseVO implements Serializable {
private
String
url
;
private
Integer
errcode
;
private
String
errmsg
;
}
src/main/java/com/yaoyaozw/customer/vo/follow/FollowRe
turnLis
tVO.java
→
src/main/java/com/yaoyaozw/customer/vo/follow/FollowRe
plyCopyResul
tVO.java
浏览文件 @
473af6da
package
com
.
yaoyaozw
.
customer
.
vo
.
follow
;
import
com.yaoyaozw.customer.entity.CustomerFollowReply
;
import
com.yaoyaozw.customer.entity.ReferralEntity
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.List
;
/**
* @author darker
* @date 2023/3/1
3 20:07
* @date 2023/3/1
4 16:48
*/
@Data
public
class
FollowReturnListVO
implements
Serializable
{
public
class
FollowReplyCopyResultVO
implements
Serializable
{
private
Boolean
hasError
;
private
List
<
CustomerFollowReply
>
materialList
;
private
List
<
ReferralEntity
>
referralEntityList
;
}
src/main/java/com/yaoyaozw/customer/vo/follow/FollowReplyInfoVO.java
0 → 100644
浏览文件 @
473af6da
package
com
.
yaoyaozw
.
customer
.
vo
.
follow
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
com.fasterxml.jackson.databind.ser.std.ToStringSerializer
;
import
com.yaoyaozw.customer.entity.CommonReferralBody
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.List
;
/**
* @author darker
* @date 2023/3/13 20:07
*/
@Data
public
class
FollowReplyInfoVO
implements
Serializable
{
@JsonSerialize
(
using
=
ToStringSerializer
.
class
)
private
Long
id
;
private
String
appid
;
private
String
name
;
private
Integer
type
;
private
String
originMediaUrl
;
private
String
extendTitle
;
private
String
extendDesc
;
private
Integer
sort
;
private
CommonReferralBody
referralBody
;
private
List
<
CommonReferralBody
>
textBodyList
;
}
src/main/java/com/yaoyaozw/customer/vo/follow/FollowRe
turnInfo
VO.java
→
src/main/java/com/yaoyaozw/customer/vo/follow/FollowRe
plyList
VO.java
浏览文件 @
473af6da
package
com
.
yaoyaozw
.
customer
.
vo
.
follow
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
com.fasterxml.jackson.databind.ser.std.ToStringSerializer
;
import
lombok.Data
;
import
java.io.Serializable
;
...
...
@@ -9,5 +11,15 @@ import java.io.Serializable;
* @date 2023/3/13 20:07
*/
@Data
public
class
FollowReturnInfoVO
implements
Serializable
{
public
class
FollowReplyListVO
implements
Serializable
{
@JsonSerialize
(
using
=
ToStringSerializer
.
class
)
private
Long
id
;
private
String
authName
;
private
String
typeDesc
;
}
src/main/java/com/yaoyaozw/customer/vo/follow/FollowReturnTextItemVO.java
deleted
100644 → 0
浏览文件 @
8b1bd7ac
package
com
.
yaoyaozw
.
customer
.
vo
.
follow
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @author darker
* @date 2023/3/13 19:55
*/
@Data
public
class
FollowReturnTextItemVO
implements
Serializable
{
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论