Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
O
operate-customer-service
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
沈振路
operate-customer-service
Commits
cc2b5253
提交
cc2b5253
authored
10月 10, 2022
作者:
gh
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
客服发送
上级
39d1c46f
隐藏空白字符变更
内嵌
并排
正在显示
21 个修改的文件
包含
337 行增加
和
45 行删除
+337
-45
jarRepositories.xml
.idea/jarRepositories.xml
+5
-0
CustomerGraphics.java
...n/java/com/yaoyaozw/customer/entity/CustomerGraphics.java
+4
-10
ReferralEntityMapper.java
...va/com/yaoyaozw/customer/mapper/ReferralEntityMapper.java
+7
-0
CustomerGraphicsService.java
...om/yaoyaozw/customer/service/CustomerGraphicsService.java
+5
-0
ReferralEntityService.java
.../com/yaoyaozw/customer/service/ReferralEntityService.java
+4
-0
RegisterUserEntityService.java
.../yaoyaozw/customer/service/RegisterUserEntityService.java
+0
-4
CustomerGraphicsServiceImpl.java
...zw/customer/service/impl/CustomerGraphicsServiceImpl.java
+62
-8
ReferralEntityServiceImpl.java
...aozw/customer/service/impl/ReferralEntityServiceImpl.java
+8
-0
RegisterUserEntityServiceImpl.java
.../customer/service/impl/RegisterUserEntityServiceImpl.java
+0
-17
WeChatResponseEntity.java
.../customer/service/wechat/entity/WeChatResponseEntity.java
+1
-1
CustomerNewsArticleItem.java
...echat/entity/customerRequest/CustomerNewsArticleItem.java
+32
-0
CustomerNewsItem.java
...rvice/wechat/entity/customerRequest/CustomerNewsItem.java
+27
-0
CustomerTextItem.java
...rvice/wechat/entity/customerRequest/CustomerTextItem.java
+22
-0
WeChatCustomerRequestEntity.java
...t/entity/customerRequest/WeChatCustomerRequestEntity.java
+40
-0
WeChatRestService.java
...zw/customer/service/wechat/service/WeChatRestService.java
+13
-0
WeChatService.java
...oyaozw/customer/service/wechat/service/WeChatService.java
+5
-0
WeChatServiceImpl.java
...zw/customer/service/wechat/service/WeChatServiceImpl.java
+56
-5
CrowdPackageUserVO.java
...com/yaoyaozw/customer/vo/customer/CrowdPackageUserVO.java
+2
-0
ReferralEntityVo.java
...a/com/yaoyaozw/customer/vo/referral/ReferralEntityVo.java
+21
-0
ReferralEntityMapper.xml
src/main/resources/mapper/ReferralEntityMapper.xml
+17
-0
RegisterUserEntityMapper.xml
src/main/resources/mapper/RegisterUserEntityMapper.xml
+6
-0
没有找到文件。
.idea/jarRepositories.xml
浏览文件 @
cc2b5253
...
@@ -8,6 +8,11 @@
...
@@ -8,6 +8,11 @@
</remote-repository>
</remote-repository>
<remote-repository>
<remote-repository>
<option
name=
"id"
value=
"central"
/>
<option
name=
"id"
value=
"central"
/>
<option
name=
"name"
value=
"Central Repository"
/>
<option
name=
"url"
value=
"https://maven.aliyun.com/nexus/content/groups/public/"
/>
</remote-repository>
<remote-repository>
<option
name=
"id"
value=
"central"
/>
<option
name=
"name"
value=
"Maven Central repository"
/>
<option
name=
"name"
value=
"Maven Central repository"
/>
<option
name=
"url"
value=
"https://repo1.maven.org/maven2"
/>
<option
name=
"url"
value=
"https://repo1.maven.org/maven2"
/>
</remote-repository>
</remote-repository>
...
...
src/main/java/com/yaoyaozw/customer/entity/CustomerGraphics.java
浏览文件 @
cc2b5253
...
@@ -29,20 +29,14 @@ public class CustomerGraphics implements Serializable {
...
@@ -29,20 +29,14 @@ public class CustomerGraphics implements Serializable {
/**
/**
* 标题
* 标题
*/
*/
@TableField
(
value
=
"
titl
e"
)
@TableField
(
value
=
"
nam
e"
)
private
String
titl
e
;
private
String
nam
e
;
/**
/**
* 类型
0-文本 1
-图文
* 类型
text-文本 news
-图文
*/
*/
@TableField
(
value
=
"type"
)
@TableField
(
value
=
"type"
)
private
Integer
type
;
private
String
type
;
/**
* 是否支付 0-否 1-是
*/
@TableField
(
value
=
"is_pay"
)
private
Integer
isPay
;
/**
/**
* 推广标题
* 推广标题
...
...
src/main/java/com/yaoyaozw/customer/mapper/ReferralEntityMapper.java
浏览文件 @
cc2b5253
...
@@ -2,9 +2,12 @@ package com.yaoyaozw.customer.mapper;
...
@@ -2,9 +2,12 @@ package com.yaoyaozw.customer.mapper;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yaoyaozw.customer.entity.ReferralEntity
;
import
com.yaoyaozw.customer.entity.ReferralEntity
;
import
com.yaoyaozw.customer.vo.referral.ReferralEntityVo
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
/**
* @author Admin
* @author Admin
...
@@ -19,4 +22,7 @@ public interface ReferralEntityMapper extends BaseMapper<ReferralEntity> {
...
@@ -19,4 +22,7 @@ public interface ReferralEntityMapper extends BaseMapper<ReferralEntity> {
* @param sourceId 素材主体ID
* @param sourceId 素材主体ID
*/
*/
void
ultimateDeleteReferrals
(
@Param
(
"sourceId"
)
Long
sourceId
);
void
ultimateDeleteReferrals
(
@Param
(
"sourceId"
)
Long
sourceId
);
List
<
ReferralEntityVo
>
findByMaterialGraphicsId
(
@Param
(
"graphicsId"
)
Long
graphicsId
);
}
}
\ No newline at end of file
src/main/java/com/yaoyaozw/customer/service/CustomerGraphicsService.java
浏览文件 @
cc2b5253
...
@@ -4,6 +4,7 @@ import com.yaoyaozw.customer.common.BaseResult;
...
@@ -4,6 +4,7 @@ import com.yaoyaozw.customer.common.BaseResult;
import
com.yaoyaozw.customer.common.GenericsResult
;
import
com.yaoyaozw.customer.common.GenericsResult
;
import
com.yaoyaozw.customer.dto.customer.CustomerMessageQueryDTO
;
import
com.yaoyaozw.customer.dto.customer.CustomerMessageQueryDTO
;
import
com.yaoyaozw.customer.dto.customer.CustomerMessageSaveDTO
;
import
com.yaoyaozw.customer.dto.customer.CustomerMessageSaveDTO
;
import
com.yaoyaozw.customer.dto.integration.IntegrationRequestDTO
;
import
com.yaoyaozw.customer.entity.CustomerGraphics
;
import
com.yaoyaozw.customer.entity.CustomerGraphics
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yaoyaozw.customer.vo.customer.CustomerDelayListVO
;
import
com.yaoyaozw.customer.vo.customer.CustomerDelayListVO
;
...
@@ -54,5 +55,9 @@ public interface CustomerGraphicsService extends IService<CustomerGraphics> {
...
@@ -54,5 +55,9 @@ public interface CustomerGraphicsService extends IService<CustomerGraphics> {
*/
*/
BaseResult
removeCustomerMessage
(
Long
id
);
BaseResult
removeCustomerMessage
(
Long
id
);
void
sendCustomerMessage
(
IntegrationRequestDTO
integrationRequestDTO
);
}
}
src/main/java/com/yaoyaozw/customer/service/ReferralEntityService.java
浏览文件 @
cc2b5253
...
@@ -2,6 +2,9 @@ package com.yaoyaozw.customer.service;
...
@@ -2,6 +2,9 @@ package com.yaoyaozw.customer.service;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yaoyaozw.customer.entity.ReferralEntity
;
import
com.yaoyaozw.customer.entity.ReferralEntity
;
import
com.yaoyaozw.customer.vo.referral.ReferralEntityVo
;
import
java.util.List
;
/**
/**
...
@@ -18,4 +21,5 @@ public interface ReferralEntityService extends IService<ReferralEntity> {
...
@@ -18,4 +21,5 @@ public interface ReferralEntityService extends IService<ReferralEntity> {
void
ultimateDeleteReferrals
(
Long
sourceId
);
void
ultimateDeleteReferrals
(
Long
sourceId
);
List
<
ReferralEntityVo
>
findReferralByCustomerGraphicsId
(
Long
graphicsId
);
}
}
src/main/java/com/yaoyaozw/customer/service/RegisterUserEntityService.java
浏览文件 @
cc2b5253
...
@@ -10,10 +10,6 @@ import java.util.List;
...
@@ -10,10 +10,6 @@ import java.util.List;
public
interface
RegisterUserEntityService
extends
IService
<
RegisterUserEntity
>{
public
interface
RegisterUserEntityService
extends
IService
<
RegisterUserEntity
>{
void
sendCustomerMessage
(
IntegrationRequestDTO
integrationRequestDTO
);
/**
/**
* 获取符合动态条件的用户
* 获取符合动态条件的用户
*
*
...
...
src/main/java/com/yaoyaozw/customer/service/impl/CustomerGraphicsServiceImpl.java
浏览文件 @
cc2b5253
package
com
.
yaoyaozw
.
customer
.
service
.
impl
;
package
com
.
yaoyaozw
.
customer
.
service
.
impl
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.bean.BeanUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.yaoyaozw.customer.common.BaseResult
;
import
com.yaoyaozw.customer.common.BaseResult
;
import
com.yaoyaozw.customer.common.GenericsResult
;
import
com.yaoyaozw.customer.common.GenericsResult
;
import
com.yaoyaozw.customer.components.CustomerServiceCommonAsyncComponent
;
import
com.yaoyaozw.customer.components.CustomerServiceCommonAsyncComponent
;
...
@@ -8,24 +9,26 @@ import com.yaoyaozw.customer.components.TokenManager;
...
@@ -8,24 +9,26 @@ import com.yaoyaozw.customer.components.TokenManager;
import
com.yaoyaozw.customer.constants.CustomerCommonConstant
;
import
com.yaoyaozw.customer.constants.CustomerCommonConstant
;
import
com.yaoyaozw.customer.dto.customer.CustomerMessageQueryDTO
;
import
com.yaoyaozw.customer.dto.customer.CustomerMessageQueryDTO
;
import
com.yaoyaozw.customer.dto.customer.CustomerMessageSaveDTO
;
import
com.yaoyaozw.customer.dto.customer.CustomerMessageSaveDTO
;
import
com.yaoyaozw.customer.dto.integration.IntegrationRequestDTO
;
import
com.yaoyaozw.customer.entity.AuthorizerToken
;
import
com.yaoyaozw.customer.entity.ReferralEntity
;
import
com.yaoyaozw.customer.entity.ReferralEntity
;
import
com.yaoyaozw.customer.service.CrowdPackageConditionMatchService
;
import
com.yaoyaozw.customer.service.*
;
import
com.yaoyaozw.customer.service.ReferralEntityService
;
import
com.yaoyaozw.customer.service.wechat.service.WeChatService
;
import
com.yaoyaozw.customer.service.RegisterUserEntityService
;
import
com.yaoyaozw.customer.vo.customer.CrowdPackageUserVO
;
import
com.yaoyaozw.customer.vo.customer.CrowdPackageUserVO
;
import
com.yaoyaozw.customer.vo.customer.CustomerMessageListVO
;
import
com.yaoyaozw.customer.vo.customer.CustomerMessageListVO
;
import
com.yaoyaozw.customer.vo.referral.ReferralEntityVo
;
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.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.*
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yaoyaozw.customer.entity.CustomerGraphics
;
import
com.yaoyaozw.customer.entity.CustomerGraphics
;
import
com.yaoyaozw.customer.mapper.CustomerGraphicsMapper
;
import
com.yaoyaozw.customer.mapper.CustomerGraphicsMapper
;
import
com.yaoyaozw.customer.service.CustomerGraphicsService
;
/**
/**
* 客户图形服务impl
* 客户图形服务impl
...
@@ -46,6 +49,13 @@ public class CustomerGraphicsServiceImpl extends ServiceImpl<CustomerGraphicsMap
...
@@ -46,6 +49,13 @@ public class CustomerGraphicsServiceImpl extends ServiceImpl<CustomerGraphicsMap
private
CustomerServiceCommonAsyncComponent
commonAsyncComponent
;
private
CustomerServiceCommonAsyncComponent
commonAsyncComponent
;
@Autowired
@Autowired
private
ReferralEntityService
referralEntityService
;
private
ReferralEntityService
referralEntityService
;
@Autowired
private
WeChatService
weChatService
;
@Autowired
private
RegisterUserEntityService
registerUserEntityService
;
@Autowired
private
AuthorizerTokenService
authorizerTokenService
;
@Override
@Override
public
BaseResult
insertCustomerMessage
(
CustomerMessageSaveDTO
saveDto
)
{
public
BaseResult
insertCustomerMessage
(
CustomerMessageSaveDTO
saveDto
)
{
...
@@ -64,8 +74,6 @@ public class CustomerGraphicsServiceImpl extends ServiceImpl<CustomerGraphicsMap
...
@@ -64,8 +74,6 @@ public class CustomerGraphicsServiceImpl extends ServiceImpl<CustomerGraphicsMap
referralEntityService
.
save
(
referralEntity
);
referralEntityService
.
save
(
referralEntity
);
return
new
BaseResult
().
success
();
return
new
BaseResult
().
success
();
}
}
...
@@ -83,5 +91,51 @@ public class CustomerGraphicsServiceImpl extends ServiceImpl<CustomerGraphicsMap
...
@@ -83,5 +91,51 @@ public class CustomerGraphicsServiceImpl extends ServiceImpl<CustomerGraphicsMap
public
BaseResult
removeCustomerMessage
(
Long
id
)
{
public
BaseResult
removeCustomerMessage
(
Long
id
)
{
return
null
;
return
null
;
}
}
@Override
public
void
sendCustomerMessage
(
IntegrationRequestDTO
integrationRequestDTO
)
{
Date
requestDate
=
integrationRequestDTO
.
getRequestDate
();
//当前时刻发送的客服(需要加启用禁用)
List
<
CustomerGraphics
>
customerGraphicsList
=
list
(
new
QueryWrapper
<
CustomerGraphics
>().
eq
(
CustomerGraphics
.
COL_POST_TIME
,
requestDate
));
for
(
CustomerGraphics
customerGraphics
:
customerGraphicsList
)
{
Long
packId
=
customerGraphics
.
getPackId
();
/*
根据人群包找人
*/
List
<
CrowdPackageUserVO
>
userList
=
new
ArrayList
<>();
Map
<
String
,
List
<
CrowdPackageUserVO
>>
appidUserMap
=
userList
.
stream
().
collect
(
Collectors
.
groupingBy
(
CrowdPackageUserVO:
:
getAppId
));
//根据公众号找具体素材和链接
List
<
ReferralEntityVo
>
referralList
=
referralEntityService
.
findReferralByCustomerGraphicsId
(
customerGraphics
.
getId
());
Map
<
String
,
List
<
ReferralEntityVo
>>
referralMap
=
referralList
.
stream
().
collect
(
Collectors
.
groupingBy
(
ReferralEntityVo:
:
getAppid
));
//循环该客服下的所有素材
for
(
Map
.
Entry
<
String
,
List
<
ReferralEntityVo
>>
referralEntry
:
referralMap
.
entrySet
())
{
String
appid
=
referralEntry
.
getKey
();
//获取token
AuthorizerToken
authorizerToken
=
authorizerTokenService
.
findTokenByAppid
(
appid
);
if
(
authorizerToken
!=
null
&&
authorizerToken
.
getAuthorizerAccessToken
()!=
null
){
//获取该号的链接实体
List
<
ReferralEntityVo
>
referralEntityVo
=
referralMap
.
get
(
appid
);
//获取该号的openid
List
<
CrowdPackageUserVO
>
packageUserVo
=
appidUserMap
.
get
(
appid
);
if
(
referralEntityVo
!=
null
&&!
referralEntityVo
.
isEmpty
()){
weChatService
.
sendCustomerMessage
(
appid
,
authorizerToken
.
getAuthorizerAccessToken
(),
customerGraphics
,
packageUserVo
,
referralEntityVo
);
}
}
}
}
}
}
}
src/main/java/com/yaoyaozw/customer/service/impl/ReferralEntityServiceImpl.java
浏览文件 @
cc2b5253
...
@@ -4,8 +4,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
...
@@ -4,8 +4,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import
com.yaoyaozw.customer.entity.ReferralEntity
;
import
com.yaoyaozw.customer.entity.ReferralEntity
;
import
com.yaoyaozw.customer.mapper.ReferralEntityMapper
;
import
com.yaoyaozw.customer.mapper.ReferralEntityMapper
;
import
com.yaoyaozw.customer.service.ReferralEntityService
;
import
com.yaoyaozw.customer.service.ReferralEntityService
;
import
com.yaoyaozw.customer.vo.referral.ReferralEntityVo
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
/**
/**
* @Author didi
* @Author didi
* @Create 2022/3/23 16:14
* @Create 2022/3/23 16:14
...
@@ -18,4 +21,9 @@ public class ReferralEntityServiceImpl extends ServiceImpl<ReferralEntityMapper,
...
@@ -18,4 +21,9 @@ public class ReferralEntityServiceImpl extends ServiceImpl<ReferralEntityMapper,
super
.
baseMapper
.
ultimateDeleteReferrals
(
materialId
);
super
.
baseMapper
.
ultimateDeleteReferrals
(
materialId
);
}
}
@Override
public
List
<
ReferralEntityVo
>
findReferralByCustomerGraphicsId
(
Long
graphicsId
)
{
return
baseMapper
.
findByMaterialGraphicsId
(
graphicsId
);
}
}
}
src/main/java/com/yaoyaozw/customer/service/impl/RegisterUserEntityServiceImpl.java
浏览文件 @
cc2b5253
...
@@ -29,23 +29,6 @@ import java.util.stream.Collectors;
...
@@ -29,23 +29,6 @@ import java.util.stream.Collectors;
@Service
@Service
public
class
RegisterUserEntityServiceImpl
extends
ServiceImpl
<
RegisterUserEntityMapper
,
RegisterUserEntity
>
implements
RegisterUserEntityService
{
public
class
RegisterUserEntityServiceImpl
extends
ServiceImpl
<
RegisterUserEntityMapper
,
RegisterUserEntity
>
implements
RegisterUserEntityService
{
@Autowired
private
AuthorizerTokenService
authorizerTokenService
;
@Autowired
private
WeChatService
weChatService
;
@Override
public
void
sendCustomerMessage
(
IntegrationRequestDTO
integrationRequestDTO
)
{
//1.读取人群包
List
<
RegisterUserEntity
>
list
=
list
();
//2.发送客服消息
}
@Override
@Override
public
List
<
CrowdPackageUserVO
>
getUserMatchDynamicExpress
(
List
<
String
>
dynamicExpressList
,
String
openId
)
{
public
List
<
CrowdPackageUserVO
>
getUserMatchDynamicExpress
(
List
<
String
>
dynamicExpressList
,
String
openId
)
{
...
...
src/main/java/com/yaoyaozw/customer/service/wechat/entity/We
c
hatResponseEntity.java
→
src/main/java/com/yaoyaozw/customer/service/wechat/entity/We
C
hatResponseEntity.java
浏览文件 @
cc2b5253
...
@@ -5,7 +5,7 @@ import lombok.Data;
...
@@ -5,7 +5,7 @@ import lombok.Data;
import
java.io.Serializable
;
import
java.io.Serializable
;
@Data
@Data
public
class
We
c
hatResponseEntity
implements
Serializable
{
public
class
We
C
hatResponseEntity
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
7200832532059064880L
;
private
static
final
long
serialVersionUID
=
-
7200832532059064880L
;
private
Integer
errcode
;
private
Integer
errcode
;
...
...
src/main/java/com/yaoyaozw/customer/service/wechat/entity/customerRequest/CustomerNewsArticleItem.java
0 → 100644
浏览文件 @
cc2b5253
package
com
.
yaoyaozw
.
customer
.
service
.
wechat
.
entity
.
customerRequest
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @author wgh
* @date 2022/10/8 19:22
*/
@Data
public
class
CustomerNewsArticleItem
implements
Serializable
{
private
String
title
;
private
String
description
;
private
String
url
;
private
String
picurl
;
public
CustomerNewsArticleItem
(
String
title
,
String
description
,
String
url
,
String
picurl
)
{
this
.
title
=
title
;
this
.
description
=
description
;
this
.
url
=
url
;
this
.
picurl
=
picurl
;
}
public
CustomerNewsArticleItem
()
{
}
}
src/main/java/com/yaoyaozw/customer/service/wechat/entity/customerRequest/CustomerNewsItem.java
0 → 100644
浏览文件 @
cc2b5253
package
com
.
yaoyaozw
.
customer
.
service
.
wechat
.
entity
.
customerRequest
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* @author wgh
* @date 2022/10/8 19:15
*/
@Data
public
class
CustomerNewsItem
implements
Serializable
{
List
<
CustomerNewsArticleItem
>
articles
;
public
CustomerNewsItem
()
{
}
public
CustomerNewsItem
(
CustomerNewsArticleItem
articles
)
{
List
<
CustomerNewsArticleItem
>
articleItemList
=
new
ArrayList
<>();
articleItemList
.
add
(
articles
);
this
.
articles
=
articleItemList
;
}
}
src/main/java/com/yaoyaozw/customer/service/wechat/entity/customerRequest/CustomerTextItem.java
0 → 100644
浏览文件 @
cc2b5253
package
com
.
yaoyaozw
.
customer
.
service
.
wechat
.
entity
.
customerRequest
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @author wgh
* @date 2022/10/8 19:32
*/
@Data
public
class
CustomerTextItem
implements
Serializable
{
private
String
content
;
public
CustomerTextItem
()
{
}
public
CustomerTextItem
(
String
content
)
{
this
.
content
=
content
;
}
}
src/main/java/com/yaoyaozw/customer/service/wechat/entity/customerRequest/WeChatCustomerRequestEntity.java
0 → 100644
浏览文件 @
cc2b5253
package
com
.
yaoyaozw
.
customer
.
service
.
wechat
.
entity
.
customerRequest
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* @author wgh
* @date 2022/10/8 19:04
*/
@Data
public
class
WeChatCustomerRequestEntity
implements
Serializable
{
private
String
touser
;
private
String
msgtype
;
private
CustomerNewsItem
news
;
private
CustomerTextItem
text
;
public
WeChatCustomerRequestEntity
(
String
msgtype
,
String
title
,
String
description
,
String
url
,
String
picurl
)
{
this
.
msgtype
=
msgtype
;
this
.
news
=
new
CustomerNewsItem
(
new
CustomerNewsArticleItem
(
title
,
description
,
url
,
picurl
));
}
public
WeChatCustomerRequestEntity
(
String
msgtype
,
String
content
)
{
this
.
msgtype
=
msgtype
;
this
.
text
=
new
CustomerTextItem
(
content
);
}
public
WeChatCustomerRequestEntity
()
{
}
}
src/main/java/com/yaoyaozw/customer/service/wechat/service/WeChatRestService.java
浏览文件 @
cc2b5253
...
@@ -8,6 +8,8 @@ import org.springframework.web.client.RestTemplate;
...
@@ -8,6 +8,8 @@ import org.springframework.web.client.RestTemplate;
import
org.springframework.web.util.UriComponents
;
import
org.springframework.web.util.UriComponents
;
import
org.springframework.web.util.UriComponentsBuilder
;
import
org.springframework.web.util.UriComponentsBuilder
;
import
java.net.URI
;
import
java.net.URISyntaxException
;
import
java.util.Map
;
import
java.util.Map
;
@Service
@Service
...
@@ -42,4 +44,15 @@ public class WeChatRestService {
...
@@ -42,4 +44,15 @@ public class WeChatRestService {
return
result
;
return
result
;
}
}
public
<
T
>
ResponseEntity
<
T
>
sendPostRequest
(
String
fullPath
,
Class
<
T
>
responseEntity
,
Object
requestEntity
)
throws
URISyntaxException
,
RestClientException
{
RestTemplate
restTemplate
=
new
RestTemplate
();
URI
uri
=
new
URI
(
fullPath
);
ResponseEntity
<
T
>
result
=
restTemplate
.
postForEntity
(
uri
,
requestEntity
,
responseEntity
);
return
result
;
}
}
}
src/main/java/com/yaoyaozw/customer/service/wechat/service/WeChatService.java
浏览文件 @
cc2b5253
package
com
.
yaoyaozw
.
customer
.
service
.
wechat
.
service
;
package
com
.
yaoyaozw
.
customer
.
service
.
wechat
.
service
;
import
com.yaoyaozw.customer.entity.CustomerDelayPublish
;
import
com.yaoyaozw.customer.entity.CustomerDelayPublish
;
import
com.yaoyaozw.customer.entity.CustomerGraphics
;
import
com.yaoyaozw.customer.entity.RegisterUserEntity
;
import
com.yaoyaozw.customer.entity.RegisterUserEntity
;
import
com.yaoyaozw.customer.vo.customer.CrowdPackageUserVO
;
import
com.yaoyaozw.customer.vo.customer.CustomerDelayItemVO
;
import
com.yaoyaozw.customer.vo.customer.CustomerDelayItemVO
;
import
com.yaoyaozw.customer.vo.referral.ReferralEntityVo
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.concurrent.Future
;
import
java.util.concurrent.Future
;
...
@@ -14,5 +18,6 @@ public interface WeChatService {
...
@@ -14,5 +18,6 @@ public interface WeChatService {
*/
*/
Future
<
CustomerDelayPublish
>
sendCustomerDelayMessage
(
String
token
,
CustomerDelayPublish
user
,
Map
<
Integer
,
CustomerDelayItemVO
>
delaySortMap
);
Future
<
CustomerDelayPublish
>
sendCustomerDelayMessage
(
String
token
,
CustomerDelayPublish
user
,
Map
<
Integer
,
CustomerDelayItemVO
>
delaySortMap
);
void
sendCustomerMessage
(
String
appid
,
String
token
,
CustomerGraphics
customerGraphics
,
List
<
CrowdPackageUserVO
>
openidList
,
List
<
ReferralEntityVo
>
referralEntityVo
);
}
}
src/main/java/com/yaoyaozw/customer/service/wechat/service/WeChatServiceImpl.java
浏览文件 @
cc2b5253
...
@@ -2,30 +2,44 @@ package com.yaoyaozw.customer.service.wechat.service;
...
@@ -2,30 +2,44 @@ package com.yaoyaozw.customer.service.wechat.service;
import
com.yaoyaozw.customer.entity.CustomerDelayPublish
;
import
com.yaoyaozw.customer.entity.CustomerDelayPublish
;
import
com.yaoyaozw.customer.entity.RegisterUserEntity
;
import
com.yaoyaozw.customer.entity.CustomerGraphics
;
import
com.yaoyaozw.customer.service.ReferralEntityService
;
import
com.yaoyaozw.customer.service.wechat.entity.WeChatResponseEntity
;
import
com.yaoyaozw.customer.service.wechat.entity.customerRequest.CustomerNewsArticleItem
;
import
com.yaoyaozw.customer.service.wechat.entity.customerRequest.CustomerNewsItem
;
import
com.yaoyaozw.customer.service.wechat.entity.customerRequest.WeChatCustomerRequestEntity
;
import
com.yaoyaozw.customer.vo.customer.CrowdPackageUserVO
;
import
com.yaoyaozw.customer.vo.customer.CustomerDelayItemVO
;
import
com.yaoyaozw.customer.vo.customer.CustomerDelayItemVO
;
import
com.yaoyaozw.customer.vo.referral.ReferralEntityVo
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.AsyncResult
;
import
org.springframework.scheduling.annotation.AsyncResult
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.net.URISyntaxException
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.concurrent.Future
;
import
java.util.concurrent.Future
;
import
java.util.stream.Collectors
;
@Service
@Service
public
class
WeChatServiceImpl
implements
WeChatService
{
public
class
WeChatServiceImpl
implements
WeChatService
{
private
String
customerPath
=
""
;
private
static
final
String
CUSTOMER_TEXT
=
"text"
;
private
static
final
String
CUSTOMER_NEWS
=
"news"
;
@Autowired
@Autowired
private
WeChatRestService
weChatRestService
;
private
WeChatRestService
weChatRestService
;
@Async
(
"myExecutor"
)
@Async
(
"myExecutor"
)
@Override
@Override
public
Future
<
CustomerDelayPublish
>
sendCustomerDelayMessage
(
String
token
,
CustomerDelayPublish
user
,
Map
<
Integer
,
CustomerDelayItemVO
>
delaySortMap
)
{
public
Future
<
CustomerDelayPublish
>
sendCustomerDelayMessage
(
String
token
,
CustomerDelayPublish
user
,
Map
<
Integer
,
CustomerDelayItemVO
>
delaySortMap
)
{
//根据公众号发送客服
//当前时间批次发文素材的用户关注时间一致
//当前时间批次发文素材的用户关注时间一致
Long
subscribeTimestamp
=
user
.
getGmtCreate
().
getTime
();
Long
subscribeTimestamp
=
user
.
getGmtCreate
().
getTime
();
...
@@ -41,4 +55,41 @@ public class WeChatServiceImpl implements WeChatService{
...
@@ -41,4 +55,41 @@ public class WeChatServiceImpl implements WeChatService{
}
}
return
new
AsyncResult
<>(
user
);
return
new
AsyncResult
<>(
user
);
}
}
@Override
public
void
sendCustomerMessage
(
String
appid
,
String
token
,
CustomerGraphics
customerGraphics
,
List
<
CrowdPackageUserVO
>
openidList
,
List
<
ReferralEntityVo
>
referralEntityVo
)
{
//根据公众号发送客服
String
fullPath
=
customerPath
+
"?"
+
token
;
//构建请求参数(文本/图文)
WeChatCustomerRequestEntity
customerRequest
=
buildCustomerRequest
(
customerGraphics
,
referralEntityVo
);
try
{
ResponseEntity
<
WeChatResponseEntity
>
response
=
weChatRestService
.
sendPostRequest
(
fullPath
,
WeChatResponseEntity
.
class
,
customerRequest
);
WeChatResponseEntity
body
=
response
.
getBody
();
System
.
err
.
println
(
body
);
}
catch
(
URISyntaxException
e
)
{
e
.
printStackTrace
();
}
}
private
WeChatCustomerRequestEntity
buildCustomerRequest
(
CustomerGraphics
customerGraphics
,
List
<
ReferralEntityVo
>
urlList
){
//类型判断
if
(
CUSTOMER_TEXT
.
equals
(
customerGraphics
.
getType
())){
return
new
WeChatCustomerRequestEntity
(
CUSTOMER_TEXT
,
customerGraphics
.
getContent
());
}
else
if
(
CUSTOMER_NEWS
.
equals
(
customerGraphics
.
getType
())){
return
new
WeChatCustomerRequestEntity
(
CUSTOMER_NEWS
,
customerGraphics
.
getExtendTitle
(),
urlList
.
get
(
0
).
getReferral
(),
customerGraphics
.
getContent
(),
customerGraphics
.
getCoverUrl
());
}
return
null
;
}
}
}
src/main/java/com/yaoyaozw/customer/vo/customer/CrowdPackageUserVO.java
浏览文件 @
cc2b5253
...
@@ -17,6 +17,8 @@ public class CrowdPackageUserVO implements Serializable {
...
@@ -17,6 +17,8 @@ public class CrowdPackageUserVO implements Serializable {
private
String
accountId
;
private
String
accountId
;
private
String
appId
;
private
String
openId
;
private
String
openId
;
private
Long
setupId
;
private
Long
setupId
;
...
...
src/main/java/com/yaoyaozw/customer/vo/referral/ReferralEntityVo.java
0 → 100644
浏览文件 @
cc2b5253
package
com
.
yaoyaozw
.
customer
.
vo
.
referral
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @author wgh
* @date 2022/10/9 11:10
*/
@Data
public
class
ReferralEntityVo
implements
Serializable
{
private
Long
materialGraphicsId
;
private
Long
accountId
;
private
String
appid
;
private
String
referral
;
}
src/main/resources/mapper/ReferralEntityMapper.xml
浏览文件 @
cc2b5253
...
@@ -29,4 +29,20 @@
...
@@ -29,4 +29,20 @@
delete from referral_entity where material_graphics_id = #{sourceId}
delete from referral_entity where material_graphics_id = #{sourceId}
</delete>
</delete>
<select
id=
"findByMaterialGraphicsId"
resultType=
"com.yaoyaozw.customer.vo.referral.ReferralEntityVo"
>
select material_graphics_id ,referral.account_id,authInfo.appid,referral.referral
from referral_entity referral left join authorizer_info authInfo
on referral.account_id=authInfo.account_id
where referral.material_graphics_id=#{graphicsId} and referral.is_deleted=0
</select>
</mapper>
</mapper>
\ No newline at end of file
src/main/resources/mapper/RegisterUserEntityMapper.xml
浏览文件 @
cc2b5253
...
@@ -64,4 +64,9 @@
...
@@ -64,4 +64,9 @@
on rue.app_id = ai.appid
on rue.app_id = ai.appid
where find_in_set(#{packageId}, in_package)
where find_in_set(#{packageId}, in_package)
</select>
</select>
</mapper>
</mapper>
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论