Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
仟微科技
Link Wechat
提交
1a96e807
Link Wechat
项目概览
仟微科技
/
Link Wechat
通知
48
Star
3
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Link Wechat
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1a96e807
编写于
1月 30, 2021
作者:
孙
孙喜旺
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
回调处理裂变客户
上级
7b6652fa
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
88 addition
and
22 deletion
+88
-22
linkwe-wecom/src/main/java/com/linkwechat/wecom/factory/impl/customer/WeCallBackAddExternalContactImpl.java
...ctory/impl/customer/WeCallBackAddExternalContactImpl.java
+73
-20
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeTaskFissionRecordMapper.java
...om/linkwechat/wecom/mapper/WeTaskFissionRecordMapper.java
+2
-1
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeTaskFissionRecordService.java
...linkwechat/wecom/service/IWeTaskFissionRecordService.java
+3
-0
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeTaskFissionRecordServiceImpl.java
...at/wecom/service/impl/WeTaskFissionRecordServiceImpl.java
+10
-1
未找到文件。
linkwe-wecom/src/main/java/com/linkwechat/wecom/factory/impl/customer/WeCallBackAddExternalContactImpl.java
浏览文件 @
1a96e807
...
...
@@ -4,10 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.linkwechat.common.enums.MediaType
;
import
com.linkwechat.common.utils.StringUtils
;
import
com.linkwechat.common.utils.Threads
;
import
com.linkwechat.wecom.domain.WeEmpleCodeTag
;
import
com.linkwechat.wecom.domain.WeFlowerCustomerRel
;
import
com.linkwechat.wecom.domain.WeFlowerCustomerTagRel
;
import
com.linkwechat.wecom.domain.*
;
import
com.linkwechat.wecom.domain.dto.WeEmpleCodeDto
;
import
com.linkwechat.wecom.domain.dto.WeMediaDto
;
import
com.linkwechat.wecom.domain.dto.WeWelcomeMsg
;
...
...
@@ -18,6 +15,7 @@ import lombok.extern.slf4j.Slf4j;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -43,30 +41,73 @@ public class WeCallBackAddExternalContactImpl extends WeEventStrategy {
private
IWeFlowerCustomerTagRelService
weFlowerCustomerTagRelService
;
@Autowired
private
IWeMaterialService
weMaterialService
;
@Autowired
private
IWeTaskFissionRecordService
weTaskFissionRecordService
;
@Autowired
private
IWeTaskFissionService
weTaskFissionService
;
@Override
public
void
eventHandle
(
WxCpXmlMessageVO
message
)
{
try
{
if
(
message
.
getExternalUserId
()
!=
null
)
{
weCustomerService
.
getCustomersInfoAndSynchWeCustomer
(
message
.
getExternalUserId
());
if
(
message
.
getExternalUserId
()
!=
null
)
{
weCustomerService
.
getCustomersInfoAndSynchWeCustomer
(
message
.
getExternalUserId
());
}
if
(
message
.
getState
()
!=
null
&&
message
.
getWelcomeCode
()
!=
null
)
{
if
(
isNumeric
(
message
.
getState
()))
{
taskFissionRecordHandle
(
message
.
getState
(),
message
.
getWelcomeCode
(),
message
.
getExternalUserId
());
}
//向扫码客户发送欢迎语
if
(
message
.
getState
()
!=
null
&&
message
.
getWelcomeCode
()
!=
null
)
{
log
.
info
(
"执行发送欢迎语>>>>>>>>>>>>>>>"
);
WeWelcomeMsg
.
WeWelcomeMsgBuilder
weWelcomeMsgBuilder
=
WeWelcomeMsg
.
builder
().
welcome_code
(
message
.
getWelcomeCode
());
WeEmpleCodeDto
messageMap
=
weEmpleCodeService
.
selectWelcomeMsgByActivityScene
(
message
.
getState
(),
message
.
getUserId
());
empleCodeHandle
(
message
.
getState
(),
message
.
getWelcomeCode
(),
message
.
getUserId
(),
message
.
getExternalUserId
());
}
}
//裂变任务处理
private
void
taskFissionRecordHandle
(
String
state
,
String
wecomCode
,
String
externalUserId
)
{
//查询裂变客户任务记录
WeTaskFissionRecord
weTaskFissionRecord
=
weTaskFissionRecordService
.
selectWeTaskFissionRecordByIdAndCustomerId
(
Long
.
valueOf
(
state
),
externalUserId
);
if
(
weTaskFissionRecord
!=
null
)
{
weTaskFissionRecord
.
setFissNum
(
weTaskFissionRecord
.
getFissNum
()
+
1
);
weTaskFissionRecordService
.
updateWeTaskFissionRecord
(
weTaskFissionRecord
);
//查询裂变任务详情
WeTaskFission
weTaskFission
=
weTaskFissionService
.
selectWeTaskFissionById
(
weTaskFissionRecord
.
getTaskFissionId
());
if
(
weTaskFission
!=
null
){
//发送欢迎语
String
welcomeMsg
=
weTaskFission
.
getWelcomeMsg
();
WeWelcomeMsg
.
WeWelcomeMsgBuilder
weWelcomeMsgBuilder
=
JSONObject
.
parseObject
(
welcomeMsg
,
WeWelcomeMsg
.
WeWelcomeMsgBuilder
.
class
);
weWelcomeMsgBuilder
.
welcome_code
(
wecomCode
);
weCustomerService
.
sendWelcomeMsg
(
weWelcomeMsgBuilder
.
build
());
}
}
}
/**
* 活码欢迎语发送
*
* @param state 渠道
* @param wecomCode 欢迎语code
* @param userId 成员id
* @param externalUserId 客户id
*/
private
void
empleCodeHandle
(
String
state
,
String
wecomCode
,
String
userId
,
String
externalUserId
)
{
try
{
log
.
info
(
"执行发送欢迎语>>>>>>>>>>>>>>>"
);
WeWelcomeMsg
.
WeWelcomeMsgBuilder
weWelcomeMsgBuilder
=
WeWelcomeMsg
.
builder
().
welcome_code
(
wecomCode
);
WeEmpleCodeDto
messageMap
=
weEmpleCodeService
.
selectWelcomeMsgByActivityScene
(
state
,
userId
);
if
(
messageMap
!=
null
)
{
String
empleCodeId
=
messageMap
.
getEmpleCodeId
();
//查询活码对应标签
List
<
WeEmpleCodeTag
>
tagList
=
weEmpleCodeTagService
.
list
(
new
LambdaQueryWrapper
<
WeEmpleCodeTag
>()
.
eq
(
WeEmpleCodeTag:
:
getEmpleCodeId
,
empleCodeId
));
//查询外部联系人与通讯录关系数据
WeFlowerCustomerRel
weFlowerCustomerRel
=
weFlowerCustomerRelService
.
getOne
(
new
LambdaQueryWrapper
<
WeFlowerCustomerRel
>()
.
eq
(
WeFlowerCustomerRel:
:
getUserId
,
message
.
getUserId
()
)
.
eq
(
WeFlowerCustomerRel:
:
getExternalUserid
,
message
.
getExternalUserId
()
));
.
eq
(
WeFlowerCustomerRel:
:
getUserId
,
userId
)
.
eq
(
WeFlowerCustomerRel:
:
getExternalUserid
,
externalUserId
));
//为外部联系人添加员工活码标签
List
<
WeFlowerCustomerTagRel
>
weFlowerCustomerTagRels
=
new
ArrayList
<>();
Optional
.
ofNullable
(
weFlowerCustomerRel
).
ifPresent
(
weFlowerCustomerRel1
->
{
Optional
.
ofNullable
(
tagList
).
orElseGet
(
ArrayList:
:
new
).
forEach
(
tag
->{
Optional
.
ofNullable
(
tagList
).
orElseGet
(
ArrayList:
:
new
).
forEach
(
tag
->
{
weFlowerCustomerTagRels
.
add
(
WeFlowerCustomerTagRel
.
builder
()
.
flowerCustomerRelId
(
weFlowerCustomerRel
.
getId
())
...
...
@@ -79,14 +120,14 @@ public class WeCallBackAddExternalContactImpl extends WeEventStrategy {
});
log
.
debug
(
">>>>>>>>>欢迎语查询结果:{}"
,
JSONObject
.
toJSONString
(
messageMap
));
if
(
messageMap
!=
null
)
{
if
(
StringUtils
.
isNotEmpty
(
messageMap
.
getWelcomeMsg
())){
if
(
StringUtils
.
isNotEmpty
(
messageMap
.
getWelcomeMsg
()))
{
weWelcomeMsgBuilder
.
text
(
WeWelcomeMsg
.
Text
.
builder
()
.
content
(
messageMap
.
getWelcomeMsg
()).
build
());
}
if
(
StringUtils
.
isNotEmpty
(
messageMap
.
getCategoryId
()))
{
if
(
StringUtils
.
isNotEmpty
(
messageMap
.
getCategoryId
()))
{
WeMediaDto
weMediaDto
=
weMaterialService
.
uploadTemporaryMaterial
(
messageMap
.
getMaterialUrl
(),
messageMap
.
getMaterialName
(),
MediaType
.
IMAGE
.
getMediaType
());
Optional
.
ofNullable
(
weMediaDto
).
ifPresent
(
media
->{
.
uploadTemporaryMaterial
(
messageMap
.
getMaterialUrl
(),
messageMap
.
getMaterialName
(),
MediaType
.
IMAGE
.
getMediaType
());
Optional
.
ofNullable
(
weMediaDto
).
ifPresent
(
media
->
{
weWelcomeMsgBuilder
.
image
(
WeWelcomeMsg
.
Image
.
builder
().
media_id
(
media
.
getMedia_id
())
.
pic_url
(
media
.
getUrl
()).
build
());
});
...
...
@@ -96,7 +137,19 @@ public class WeCallBackAddExternalContactImpl extends WeEventStrategy {
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
log
.
error
(
"执行发送欢迎语失败!"
,
e
);
log
.
error
(
"执行发送欢迎语失败!"
,
e
);
}
}
private
boolean
isNumeric
(
String
str
)
{
try
{
new
BigDecimal
(
str
);
}
catch
(
Exception
e
)
{
//异常 说明包含非数字。
return
false
;
}
return
true
;
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeTaskFissionRecordMapper.java
浏览文件 @
1a96e807
package
com.linkwechat.wecom.mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.linkwechat.wecom.domain.WeTaskFissionRecord
;
import
java.util.List
;
...
...
@@ -10,7 +11,7 @@ import java.util.List;
* @author ruoyi
* @date 2021-01-27
*/
public
interface
WeTaskFissionRecordMapper
{
public
interface
WeTaskFissionRecordMapper
extends
BaseMapper
<
WeTaskFissionRecord
>
{
/**
* 查询裂变任务记录
*
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeTaskFissionRecordService.java
浏览文件 @
1a96e807
...
...
@@ -58,4 +58,7 @@ public interface IWeTaskFissionRecordService {
* @return 结果
*/
public
int
deleteWeTaskFissionRecordById
(
Long
id
);
public
WeTaskFissionRecord
selectWeTaskFissionRecordByIdAndCustomerId
(
Long
id
,
String
customerId
);
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeTaskFissionRecordServiceImpl.java
浏览文件 @
1a96e807
package
com.linkwechat.wecom.service.impl
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.linkwechat.wecom.domain.WeTaskFissionRecord
;
import
com.linkwechat.wecom.mapper.WeTaskFissionRecordMapper
;
import
com.linkwechat.wecom.service.IWeTaskFissionRecordService
;
...
...
@@ -15,7 +17,7 @@ import java.util.List;
* @date 2021-01-27
*/
@Service
public
class
WeTaskFissionRecordServiceImpl
implements
IWeTaskFissionRecordService
{
public
class
WeTaskFissionRecordServiceImpl
extends
ServiceImpl
<
WeTaskFissionRecordMapper
,
WeTaskFissionRecord
>
implements
IWeTaskFissionRecordService
{
@Autowired
private
WeTaskFissionRecordMapper
weTaskFissionRecordMapper
;
...
...
@@ -84,4 +86,11 @@ public class WeTaskFissionRecordServiceImpl implements IWeTaskFissionRecordServi
public
int
deleteWeTaskFissionRecordById
(
Long
id
)
{
return
weTaskFissionRecordMapper
.
deleteWeTaskFissionRecordById
(
id
);
}
@Override
public
WeTaskFissionRecord
selectWeTaskFissionRecordByIdAndCustomerId
(
Long
id
,
String
customerId
)
{
return
weTaskFissionRecordMapper
.
selectOne
(
new
LambdaQueryWrapper
<
WeTaskFissionRecord
>()
.
eq
(
WeTaskFissionRecord:
:
getId
,
id
)
.
eq
(
WeTaskFissionRecord:
:
getCustomerId
,
customerId
));
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录