Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
江名洋
/
linkwe-scrm
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 9303401b
authored
Dec 09, 2021
by
danmo
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
1、修复活码已知bug
2、修复客户回调等bug
1 parent
2354915d
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
94 additions
and
235 deletions
linkwe-quartz/src/main/java/com/linkwechat/quartz/task/WeQrCodeUpdateTask.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/query/qr/WeQrAddQuery.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/factory/impl/customer/WeCallBackAddExternalContactImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/factory/impl/customer/WeCallBackAddHalfExternalContactImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/factory/impl/customer/WeCallBackDelExternalContactImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/factory/impl/customer/WeCallBackDelFollowUserImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/interceptor/WeAccessTokenInterceptor.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerServiceImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/welcome/WelcomeService.java
linkwe-wecom/src/main/resources/mapper/wecom/WeQrScopeMapper.xml
linkwe-quartz/src/main/java/com/linkwechat/quartz/task/WeQrCodeUpdateTask.java
View file @
9303401
...
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
...
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.date.Week
;
import
cn.hutool.core.date.Week
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.linkwechat.common.utils.StringUtils
;
import
com.linkwechat.common.utils.StringUtils
;
import
com.linkwechat.wecom.client.WeExternalContactClient
;
import
com.linkwechat.wecom.client.WeExternalContactClient
;
import
com.linkwechat.wecom.domain.WeQrCode
;
import
com.linkwechat.wecom.domain.WeQrCode
;
...
@@ -47,7 +48,7 @@ public class WeQrCodeUpdateTask {
...
@@ -47,7 +48,7 @@ public class WeQrCodeUpdateTask {
String
formatTime
=
DateUtil
.
formatTime
(
date
);
String
formatTime
=
DateUtil
.
formatTime
(
date
);
List
<
WeQrScopeVo
>
weQrScopeList
=
weQrScopeService
.
getWeQrScopeByTime
(
week
.
getValue
(),
formatTime
);
List
<
WeQrScopeVo
>
weQrScopeList
=
weQrScopeService
.
getWeQrScopeByTime
(
week
.
getValue
(),
formatTime
);
log
.
info
(
"活码使用范围修改任务 weQrScopeList {}"
,
JSONObject
.
toJSONString
(
weQrScopeList
));
if
(
CollectionUtil
.
isNotEmpty
(
weQrScopeList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
weQrScopeList
))
{
List
<
WeQrScopeVo
>
weCustomizeQrScopeList
=
weQrScopeList
.
stream
().
filter
(
item
->
ObjectUtil
.
equal
(
1
,
item
.
getType
())).
collect
(
Collectors
.
toList
());
List
<
WeQrScopeVo
>
weCustomizeQrScopeList
=
weQrScopeList
.
stream
().
filter
(
item
->
ObjectUtil
.
equal
(
1
,
item
.
getType
())).
collect
(
Collectors
.
toList
());
if
(
CollectionUtil
.
isNotEmpty
(
weCustomizeQrScopeList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
weCustomizeQrScopeList
))
{
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/query/qr/WeQrAddQuery.java
View file @
9303401
...
@@ -80,8 +80,8 @@ public class WeQrAddQuery {
...
@@ -80,8 +80,8 @@ public class WeQrAddQuery {
//根据类型生成相应的活码
//根据类型生成相应的活码
if
(
this
.
qrId
==
null
){
if
(
this
.
qrId
==
null
){
Snowflake
snowflake
=
IdUtil
.
getSnowflake
(
RandomUtil
.
randomLong
(
6
),
RandomUtil
.
randomInt
(
6
));
Snowflake
snowflake
=
IdUtil
.
getSnowflake
(
RandomUtil
.
randomLong
(
6
),
RandomUtil
.
randomInt
(
6
));
this
.
state
=
snowflake
.
nextIdStr
();
this
.
state
=
WeConstans
.
WE_QR_CODE_PREFIX
+
snowflake
.
nextIdStr
();
weContactWay
.
setState
(
WeConstans
.
WE_QR_CODE_PREFIX
+
"_"
+
state
);
weContactWay
.
setState
(
state
);
}
}
weContactWay
.
setConfig_id
(
this
.
configId
);
weContactWay
.
setConfig_id
(
this
.
configId
);
weContactWay
.
setType
(
this
.
qrType
);
weContactWay
.
setType
(
this
.
qrType
);
...
@@ -90,14 +90,14 @@ public class WeQrAddQuery {
...
@@ -90,14 +90,14 @@ public class WeQrAddQuery {
if
(
CollectionUtil
.
isNotEmpty
(
qrUserInfos
))
{
if
(
CollectionUtil
.
isNotEmpty
(
qrUserInfos
))
{
//员工列表
//员工列表
String
[]
userIdArr
=
qrUserInfos
.
stream
().
filter
(
item
->
String
[]
userIdArr
=
qrUserInfos
.
stream
().
filter
(
item
->
ObjectUtil
.
equal
(
1
,
item
.
getType
())
&&
CollectionUtil
.
isNotEmpty
(
item
.
getUserIds
()))
ObjectUtil
.
equal
(
0
,
item
.
getType
())
&&
CollectionUtil
.
isNotEmpty
(
item
.
getUserIds
()))
.
map
(
WeQrUserInfoQuery:
:
getUserIds
).
flatMap
(
Collection:
:
stream
).
toArray
(
String
[]::
new
);
.
map
(
WeQrUserInfoQuery:
:
getUserIds
).
flatMap
(
Collection:
:
stream
).
toArray
(
String
[]::
new
);
if
(
userIdArr
.
length
>
0
)
{
if
(
userIdArr
.
length
>
0
)
{
weContactWay
.
setUser
(
userIdArr
);
weContactWay
.
setUser
(
userIdArr
);
}
}
//部门列表
//部门列表
Long
[]
partyArr
=
qrUserInfos
.
stream
().
filter
(
item
->
Long
[]
partyArr
=
qrUserInfos
.
stream
().
filter
(
item
->
ObjectUtil
.
equal
(
1
,
item
.
getType
())
&&
CollectionUtil
.
isNotEmpty
(
item
.
getPartys
()))
ObjectUtil
.
equal
(
0
,
item
.
getType
())
&&
CollectionUtil
.
isNotEmpty
(
item
.
getPartys
()))
.
map
(
WeQrUserInfoQuery:
:
getPartys
).
flatMap
(
Collection:
:
stream
).
toArray
(
Long
[]::
new
);
.
map
(
WeQrUserInfoQuery:
:
getPartys
).
flatMap
(
Collection:
:
stream
).
toArray
(
Long
[]::
new
);
if
(
partyArr
.
length
>
0
)
{
if
(
partyArr
.
length
>
0
)
{
weContactWay
.
setParty
(
partyArr
);
weContactWay
.
setParty
(
partyArr
);
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/factory/impl/customer/WeCallBackAddExternalContactImpl.java
View file @
9303401
...
@@ -50,12 +50,9 @@ public class WeCallBackAddExternalContactImpl extends WeEventStrategy {
...
@@ -50,12 +50,9 @@ public class WeCallBackAddExternalContactImpl extends WeEventStrategy {
weCustomerService
.
getCustomersInfoAndSynchWeCustomer
(
customerInfo
.
getExternalUserID
(),
customerInfo
.
getUserID
());
weCustomerService
.
getCustomersInfoAndSynchWeCustomer
(
customerInfo
.
getExternalUserID
(),
customerInfo
.
getUserID
());
}
}
if
(
StringUtils
.
isNotEmpty
(
customerInfo
.
getState
())
&&
StringUtils
.
isNotEmpty
(
customerInfo
.
getWelcomeCode
()))
{
weEventPublisherService
.
register
(
customerInfo
.
getExternalUserID
(),
customerInfo
.
getUserID
(),
customerInfo
.
getWelcomeCode
(),
customerInfo
.
getState
());
if
(
isFission
(
customerInfo
.
getState
()))
{
if
(
StringUtils
.
isNotEmpty
(
customerInfo
.
getState
())
&&
isFission
(
customerInfo
.
getState
()))
{
taskFissionRecordHandle
(
customerInfo
.
getState
(),
customerInfo
.
getWelcomeCode
(),
customerInfo
.
getUserID
(),
customerInfo
.
getExternalUserID
());
taskFissionRecordHandle
(
customerInfo
.
getState
(),
customerInfo
.
getWelcomeCode
(),
customerInfo
.
getUserID
(),
customerInfo
.
getExternalUserID
());
}
else
{
weEventPublisherService
.
register
(
customerInfo
.
getState
(),
customerInfo
.
getWelcomeCode
(),
customerInfo
.
getUserID
(),
customerInfo
.
getExternalUserID
());
}
}
}
}
}
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/factory/impl/customer/WeCallBackAddHalfExternalContactImpl.java
View file @
9303401
...
@@ -2,6 +2,7 @@ package com.linkwechat.wecom.factory.impl.customer;
...
@@ -2,6 +2,7 @@ package com.linkwechat.wecom.factory.impl.customer;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.linkwechat.common.constant.WeConstans
;
import
com.linkwechat.common.constant.WeConstans
;
import
com.linkwechat.common.utils.StringUtils
;
import
com.linkwechat.wecom.domain.callback.WeBackBaseVo
;
import
com.linkwechat.wecom.domain.callback.WeBackBaseVo
;
import
com.linkwechat.wecom.domain.callback.WeBackCustomerVo
;
import
com.linkwechat.wecom.domain.callback.WeBackCustomerVo
;
import
com.linkwechat.wecom.domain.WeFlowerCustomerRel
;
import
com.linkwechat.wecom.domain.WeFlowerCustomerRel
;
...
@@ -54,12 +55,9 @@ public class WeCallBackAddHalfExternalContactImpl extends WeEventStrategy {
...
@@ -54,12 +55,9 @@ public class WeCallBackAddHalfExternalContactImpl extends WeEventStrategy {
weCustomerService
.
getCustomersInfoAndSynchWeCustomer
(
customerInfo
.
getExternalUserID
(),
customerInfo
.
getUserID
());
weCustomerService
.
getCustomersInfoAndSynchWeCustomer
(
customerInfo
.
getExternalUserID
(),
customerInfo
.
getUserID
());
}
}
if
(
customerInfo
.
getState
()
!=
null
&&
customerInfo
.
getWelcomeCode
()
!=
null
)
{
weEventPublisherService
.
register
(
customerInfo
.
getExternalUserID
(),
customerInfo
.
getUserID
(),
customerInfo
.
getWelcomeCode
(),
customerInfo
.
getState
());
if
(
isFission
(
customerInfo
.
getState
()))
{
if
(
StringUtils
.
isNotEmpty
(
customerInfo
.
getState
())
&&
isFission
(
customerInfo
.
getState
()))
{
taskFissionRecordHandle
(
customerInfo
.
getState
(),
customerInfo
.
getWelcomeCode
(),
customerInfo
.
getUserID
(),
customerInfo
.
getExternalUserID
());
taskFissionRecordHandle
(
customerInfo
.
getState
(),
customerInfo
.
getWelcomeCode
(),
customerInfo
.
getUserID
(),
customerInfo
.
getExternalUserID
());
}
else
{
weEventPublisherService
.
register
(
customerInfo
.
getExternalUserID
(),
customerInfo
.
getUserID
(),
customerInfo
.
getWelcomeCode
(),
customerInfo
.
getState
());
}
}
}
}
}
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/factory/impl/customer/WeCallBackDelExternalContactImpl.java
View file @
9303401
...
@@ -37,34 +37,31 @@ public class WeCallBackDelExternalContactImpl extends WeEventStrategy {
...
@@ -37,34 +37,31 @@ public class WeCallBackDelExternalContactImpl extends WeEventStrategy {
public
void
eventHandle
(
WeBackBaseVo
message
)
{
public
void
eventHandle
(
WeBackBaseVo
message
)
{
WeBackCustomerVo
customerInfo
=
(
WeBackCustomerVo
)
message
;
WeBackCustomerVo
customerInfo
=
(
WeBackCustomerVo
)
message
;
if
(
customerInfo
.
getExternalUserID
()
!=
null
)
{
if
(
customerInfo
.
getExternalUserID
()
!=
null
)
{
WeCustomer
weCustomer
=
weCustomerService
.
getOne
(
new
LambdaQueryWrapper
<
WeCustomer
>().
eq
(
WeCustomer:
:
getFirstUserId
,
customerInfo
.
getUserID
())
.
eq
(
WeCustomer:
:
getExternalUserid
,
customerInfo
.
getExternalUserID
()).
eq
(
WeCustomer:
:
getDelFlag
,
0
).
last
(
"limit 1"
));
if
(
weCustomer
==
null
){
return
;
}
//删除客户
//删除客户
if
(
weCustomerService
.
remove
(
new
LambdaQueryWrapper
<
WeCustomer
>()
WeCustomer
customer
=
new
WeCustomer
();
.
eq
(
WeCustomer:
:
getExternalUserid
,
customerInfo
.
getExternalUserID
())
customer
.
setDelFlag
(
1
);
.
eq
(
WeCustomer:
:
getFirstUserId
,
customerInfo
.
getUserID
()))){
weCustomerService
.
update
(
customer
,
new
LambdaQueryWrapper
<
WeCustomer
>().
eq
(
WeCustomer:
:
getFirstUserId
,
customerInfo
.
getUserID
())
//增加敏感行为记录,员工删除客户
.
eq
(
WeCustomer:
:
getExternalUserid
,
customerInfo
.
getExternalUserID
()).
eq
(
WeCustomer:
:
getDelFlag
,
0
));
WeSensitiveAct
weSensitiveAct
=
weSensitiveActHitService
.
getSensitiveActType
(
"拉黑/删除好友"
);
//增加敏感行为记录,员工删除客户
if
(
weSensitiveAct
!=
null
&&
weSensitiveAct
.
getEnableFlag
()
==
1
)
{
WeSensitiveAct
weSensitiveAct
=
weSensitiveActHitService
.
getSensitiveActType
(
"拉黑/删除好友"
);
WeSensitiveActHit
weSensitiveActHit
=
new
WeSensitiveActHit
();
if
(
weSensitiveAct
!=
null
&&
weSensitiveAct
.
getEnableFlag
()
==
1
)
{
weSensitiveActHit
.
setSensitiveActId
(
weSensitiveAct
.
getId
());
WeSensitiveActHit
weSensitiveActHit
=
new
WeSensitiveActHit
();
weSensitiveActHit
.
setSensitiveAct
(
weSensitiveAct
.
getActName
());
weSensitiveActHit
.
setSensitiveActId
(
weSensitiveAct
.
getId
());
weSensitiveActHit
.
setCreateTime
(
new
Date
(
customerInfo
.
getCreateTime
()));
weSensitiveActHit
.
setSensitiveAct
(
weSensitiveAct
.
getActName
());
weSensitiveActHit
.
setCreateBy
(
"admin"
);
weSensitiveActHit
.
setCreateTime
(
new
Date
(
customerInfo
.
getCreateTime
()));
weSensitiveActHit
.
setOperatorId
(
customerInfo
.
getUserID
());
weSensitiveActHit
.
setCreateBy
(
"admin"
);
WeUser
user
=
weUserService
.
getById
(
customerInfo
.
getUserID
());
weSensitiveActHit
.
setOperatorId
(
customerInfo
.
getUserID
());
weSensitiveActHit
.
setOperator
(
user
.
getName
());
WeUser
user
=
weUserService
.
getById
(
customerInfo
.
getUserID
());
weSensitiveActHit
.
setOperator
(
user
.
getName
());
WeCustomer
weCustomer
=
weCustomerService
.
getOne
(
new
LambdaQueryWrapper
<
WeCustomer
>()
weSensitiveActHit
.
setOperateTargetId
(
weCustomer
.
getFirstUserId
());
.
eq
(
WeCustomer:
:
getExternalUserid
,
customerInfo
.
getExternalUserID
())
weSensitiveActHit
.
setOperateTarget
(
weCustomer
.
getCustomerName
());
.
eq
(
WeCustomer:
:
getFirstUserId
,
customerInfo
.
getUserID
()));
weSensitiveActHitService
.
insertWeSensitiveActHit
(
weSensitiveActHit
);
weSensitiveActHit
.
setOperateTargetId
(
weCustomer
.
getFirstUserId
());
weSensitiveActHit
.
setOperateTarget
(
weCustomer
.
getCustomerName
());
weSensitiveActHitService
.
insertWeSensitiveActHit
(
weSensitiveActHit
);
}
}
}
}
}
}
}
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/factory/impl/customer/WeCallBackDelFollowUserImpl.java
View file @
9303401
...
@@ -50,54 +50,58 @@ public class WeCallBackDelFollowUserImpl extends WeEventStrategy {
...
@@ -50,54 +50,58 @@ public class WeCallBackDelFollowUserImpl extends WeEventStrategy {
WeBackCustomerVo
customerInfo
=
(
WeBackCustomerVo
)
message
;
WeBackCustomerVo
customerInfo
=
(
WeBackCustomerVo
)
message
;
try
{
try
{
if
(
customerInfo
.
getUserID
()
!=
null
&&
customerInfo
.
getExternalUserID
()
!=
null
)
{
if
(
customerInfo
.
getUserID
()
!=
null
&&
customerInfo
.
getExternalUserID
()
!=
null
)
{
WeCustomer
weCustomer
=
weCustomerService
.
getOne
(
new
LambdaQueryWrapper
<
WeCustomer
>().
eq
(
WeCustomer:
:
getFirstUserId
,
customerInfo
.
getUserID
())
.
eq
(
WeCustomer:
:
getExternalUserid
,
customerInfo
.
getExternalUserID
()).
eq
(
WeCustomer:
:
getDelFlag
,
0
).
last
(
"limit 1"
));
if
(
weCustomer
==
null
){
return
;
}
WeCustomer
customer
=
new
WeCustomer
();
customer
.
setDelFlag
(
1
);
weCustomerService
.
update
(
customer
,
new
LambdaQueryWrapper
<
WeCustomer
>().
eq
(
WeCustomer:
:
getFirstUserId
,
customerInfo
.
getUserID
())
.
eq
(
WeCustomer:
:
getExternalUserid
,
customerInfo
.
getExternalUserID
()).
eq
(
WeCustomer:
:
getDelFlag
,
0
));
if
(
weCustomerService
.
remove
(
new
LambdaQueryWrapper
<
WeCustomer
>()
WeCorpAccount
validWeCorpAccount
=
weCorpAccountService
.
findValidWeCorpAccount
();
.
eq
(
WeCustomer:
:
getExternalUserid
,
customerInfo
.
getExternalUserID
())
Optional
.
ofNullable
(
validWeCorpAccount
).
ifPresent
(
weCorpAccount
->
{
.
eq
(
WeCustomer:
:
getFirstUserId
,
customerInfo
.
getUserID
()))){
String
customerChurnNoticeSwitch
=
weCorpAccount
.
getCustomerChurnNoticeSwitch
();
if
(
WeConstans
.
DEL_FOLLOW_USER_SWITCH_OPEN
.
equals
(
customerChurnNoticeSwitch
))
{
WeCorpAccount
validWeCorpAccount
=
weCorpAccountService
.
findValidWeCorpAccount
();
String
content
=
"您已经被客户@"
+
weCustomer
.
getCustomerName
()
+
"删除!"
;
Optional
.
ofNullable
(
validWeCorpAccount
).
ifPresent
(
weCorpAccount
->
{
TextMessageDto
textMessageDto
=
new
TextMessageDto
();
String
customerChurnNoticeSwitch
=
weCorpAccount
.
getCustomerChurnNoticeSwitch
();
textMessageDto
.
setContent
(
content
);
if
(
WeConstans
.
DEL_FOLLOW_USER_SWITCH_OPEN
.
equals
(
customerChurnNoticeSwitch
))
{
WeMessagePushDto
weMessagePushDto
=
new
WeMessagePushDto
();
WeCustomer
weCustomer
=
weCustomerService
.
getOne
(
new
LambdaQueryWrapper
<
WeCustomer
>().
eq
(
WeCustomer:
:
getFirstUserId
,
customerInfo
.
getUserID
())
weMessagePushDto
.
setMsgtype
(
MessageType
.
TEXT
.
getMessageType
());
.
eq
(
WeCustomer:
:
getExternalUserid
,
customerInfo
.
getExternalUserID
()));
weMessagePushDto
.
setTouser
(
customerInfo
.
getUserID
());
weMessagePushDto
.
setText
(
textMessageDto
);
String
content
=
"您已经被客户@"
+
weCustomer
.
getCustomerName
()
+
"删除!"
;
TextMessageDto
textMessageDto
=
new
TextMessageDto
();
textMessageDto
.
setContent
(
content
);
WeMessagePushDto
weMessagePushDto
=
new
WeMessagePushDto
();
weMessagePushDto
.
setMsgtype
(
MessageType
.
TEXT
.
getMessageType
());
weMessagePushDto
.
setTouser
(
customerInfo
.
getUserID
());
weMessagePushDto
.
setText
(
textMessageDto
);
Optional
.
ofNullable
(
validWeCorpAccount
).
map
(
WeCorpAccount:
:
getAgentId
).
ifPresent
(
agentId
->
{
weMessagePushDto
.
setAgentid
(
Integer
.
valueOf
(
agentId
));
});
weMessagePushClient
.
sendMessageToUser
(
weMessagePushDto
,
weMessagePushDto
.
getAgentid
().
toString
());
Optional
.
ofNullable
(
validWeCorpAccount
).
map
(
WeCorpAccount:
:
getAgentId
).
ifPresent
(
agentId
->
{
weMessagePushDto
.
setAgentid
(
Integer
.
valueOf
(
agentId
));
});
//增加敏感行为记录,客户删除员工
weMessagePushClient
.
sendMessageToUser
(
weMessagePushDto
,
weMessagePushDto
.
getAgentid
().
toString
());
WeSensitiveAct
weSensitiveAct
=
weSensitiveActHitService
.
getSensitiveActType
(
"拉黑/删除好友"
);
}
if
(
weSensitiveAct
!=
null
&&
weSensitiveAct
.
getEnableFlag
()
==
1
)
{
});
WeSensitiveActHit
weSensitiveActHit
=
new
WeSensitiveActHit
();
weSensitiveActHit
.
setSensitiveActId
(
weSensitiveAct
.
getId
());
weSensitiveActHit
.
setSensitiveAct
(
weSensitiveAct
.
getActName
());
weSensitiveActHit
.
setCreateTime
(
new
Date
(
message
.
getCreateTime
()));
weSensitiveActHit
.
setCreateBy
(
"admin"
);
WeUser
user
=
weUserService
.
getById
(
customerInfo
.
getUserID
());
weSensitiveActHit
.
setOperatorId
(
weCustomer
.
getFirstUserId
());
weSensitiveActHit
.
setOperator
(
weCustomer
.
getCustomerName
());
weSensitiveActHit
.
setOperateTargetId
(
user
.
getUserId
());
weSensitiveActHit
.
setOperateTarget
(
user
.
getName
());
weSensitiveActHitService
.
insertWeSensitiveActHit
(
weSensitiveActHit
);
}
}
});
}
extracted
(
message
,
customerInfo
,
weCustomer
);
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"删除跟进成员事件>>>>>>>>>>>>>param:{},ex:{}"
,
JSONObject
.
toJSONString
(
message
),
e
);
log
.
error
(
"删除跟进成员事件>>>>>>>>>>>>>param:{},ex:{}"
,
JSONObject
.
toJSONString
(
message
),
e
);
}
}
}
}
private
void
extracted
(
WeBackBaseVo
message
,
WeBackCustomerVo
customerInfo
,
WeCustomer
weCustomer
)
{
//增加敏感行为记录,客户删除员工
WeSensitiveAct
weSensitiveAct
=
weSensitiveActHitService
.
getSensitiveActType
(
"拉黑/删除好友"
);
if
(
weSensitiveAct
!=
null
&&
weSensitiveAct
.
getEnableFlag
()
==
1
)
{
WeSensitiveActHit
weSensitiveActHit
=
new
WeSensitiveActHit
();
weSensitiveActHit
.
setSensitiveActId
(
weSensitiveAct
.
getId
());
weSensitiveActHit
.
setSensitiveAct
(
weSensitiveAct
.
getActName
());
weSensitiveActHit
.
setCreateTime
(
new
Date
(
message
.
getCreateTime
()));
weSensitiveActHit
.
setCreateBy
(
"admin"
);
WeUser
user
=
weUserService
.
getById
(
customerInfo
.
getUserID
());
weSensitiveActHit
.
setOperatorId
(
weCustomer
.
getFirstUserId
());
weSensitiveActHit
.
setOperator
(
weCustomer
.
getCustomerName
());
weSensitiveActHit
.
setOperateTargetId
(
user
.
getUserId
());
weSensitiveActHit
.
setOperateTarget
(
user
.
getName
());
weSensitiveActHitService
.
insertWeSensitiveActHit
(
weSensitiveActHit
);
}
}
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/interceptor/WeAccessTokenInterceptor.java
View file @
9303401
...
@@ -75,12 +75,10 @@ public class WeAccessTokenInterceptor implements Interceptor<WeResultDto> {
...
@@ -75,12 +75,10 @@ public class WeAccessTokenInterceptor implements Interceptor<WeResultDto> {
@Override
@Override
public
void
onSuccess
(
WeResultDto
resultDto
,
ForestRequest
forestRequest
,
ForestResponse
forestResponse
)
{
public
void
onSuccess
(
WeResultDto
resultDto
,
ForestRequest
forestRequest
,
ForestResponse
forestResponse
)
{
log
.
info
(
"url:{},result:{}"
,
forestRequest
.
getUrl
(),
forestResponse
.
getContent
());
log
.
info
(
"url:{},result:{}"
,
forestRequest
.
getUrl
(),
forestResponse
.
getContent
());
if
(
null
!=
resultDto
.
getErrcode
()
&&
!
ObjectUtil
.
equal
(
WeErrorCodeEnum
.
ERROR_CODE_0
.
getErrorCode
(),
resultDto
.
getErrcode
())
/*
if (null != resultDto.getErrcode() && !ObjectUtil.equal(WeErrorCodeEnum.ERROR_CODE_0.getErrorCode(), resultDto.getErrcode())
&& !weComeConfig.getWeNeedRetryErrorCodes().contains(resultDto.getErrcode())) {
&& !weComeConfig.getWeNeedRetryErrorCodes().contains(resultDto.getErrcode())) {
throw new ForestRuntimeException(WeErrorCodeEnum.parseEnum(resultDto.getErrcode()).getErrorMsg());
throw new ForestRuntimeException(WeErrorCodeEnum.parseEnum(resultDto.getErrcode()).getErrorMsg());
}
}*/
}
}
/**
/**
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerServiceImpl.java
View file @
9303401
...
@@ -401,6 +401,7 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
...
@@ -401,6 +401,7 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
WeCustomer
weCustomer
=
new
WeCustomer
();
WeCustomer
weCustomer
=
new
WeCustomer
();
BeanUtils
.
copyPropertiesASM
(
externalUserDetail
.
getExternal_contact
(),
weCustomer
);
BeanUtils
.
copyPropertiesASM
(
externalUserDetail
.
getExternal_contact
(),
weCustomer
);
weCustomer
.
setFirstUserId
(
userId
);
weCustomer
.
setFirstUserId
(
userId
);
weCustomer
.
setCustomerName
(
externalUserDetail
.
getExternal_contact
().
getName
());
List
<
ExternalUserDetail
.
FollowUser
>
follow_user
=
externalUserDetail
.
getFollow_user
();
List
<
ExternalUserDetail
.
FollowUser
>
follow_user
=
externalUserDetail
.
getFollow_user
();
if
(
CollectionUtil
.
isNotEmpty
(
follow_user
)){
if
(
CollectionUtil
.
isNotEmpty
(
follow_user
)){
ExternalUserDetail
.
FollowUser
followUser
=
follow_user
.
stream
().
filter
(
e
->
e
.
getUserid
().
equals
(
userId
)).
findFirst
().
get
();
ExternalUserDetail
.
FollowUser
followUser
=
follow_user
.
stream
().
filter
(
e
->
e
.
getUserid
().
equals
(
userId
)).
findFirst
().
get
();
...
@@ -428,152 +429,9 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
...
@@ -428,152 +429,9 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
});
});
iWeFlowerCustomerTagRelService
.
batchAddOrUpdate
(
tagRels
);
iWeFlowerCustomerTagRelService
.
batchAddOrUpdate
(
tagRels
);
}
}
}
}
}
}
}
}
// //判断该客户是否存在
// if(this.baseMapper.selectWeCustomerById(externalUserid) != null){//直接更新无需修改首位添加人和时间
// weCustomer.setDelFlag(new Integer(0));
// this.baseMapper.updateWeCustomer(weCustomer);
// }else {
// weCustomer.setFirstUserId(userId);
// weCustomer.setFirstAddTime(new Date());
// this.save(weCustomer);
// }
//
// //客户与通讯录客户关系
// List<WeTag> weTags = new ArrayList<>();
// List<WeTagGroup> weGroups = new ArrayList<>();
// List<WeFlowerCustomerTagRel> weFlowerCustomerTagRels = new ArrayList<>();
// List<WeFlowerCustomerRel> weFlowerCustomerRel = new ArrayList<>();
// externalUserDetail.getFollow_user().stream().forEach(kk -> {
//
// Long weFlowerCustomerRelId = SnowFlakeUtil.nextId();
// weFlowerCustomerRel.add(WeFlowerCustomerRel.builder()
// .id(weFlowerCustomerRelId)
// .userId(kk.getUserid())
// .description(kk.getDescription())
// .remarkCorpName(kk.getRemarkCorpName())
// .remarkMobiles(Arrays.stream(kk.getRemarkMobiles()).collect(Collectors.joining(",")))
// .operUserid(kk.getUserid())
// .addWay(kk.getAddWay())
// .state(kk.getState())
// .status("0")
// .externalUserid(weCustomer.getExternalUserid())
// .createTime(new Date(kk.getCreatetime() * 1000L))
// .build());
//
// List<ExternalUserTag> tags = kk.getTags();
// if (CollectionUtil.isNotEmpty(tags)) {
//
// //获取相关标签组
// WeCropGroupTagListDto weCropGroupTagListDto = weCropTagClient.getCorpTagListByTagIds(WeFindCropTagParam.builder()
// .tag_id(ArrayUtil.toArray(tags.stream().map(ExternalUserTag::getTag_id).collect(Collectors.toList()), String.class))
// .build());
//
// if (weCropGroupTagListDto.getErrcode().equals(WeConstans.WE_SUCCESS_CODE)) {
// List<WeCropGroupTagDto> tagGroups = weCropGroupTagListDto.getTag_group();
// if (CollectionUtil.isNotEmpty(tagGroups)) {
// tagGroups.stream().forEach(tagGroup -> {
// weGroups.add(
// WeTagGroup.builder()
// .groupId(tagGroup.getGroup_id())
// .gourpName(tagGroup.getGroup_name())
// .build()
// );
//
// List<WeCropTagDto> weCropTagDtos = tagGroup.getTag();
//
// if (CollectionUtil.isNotEmpty(weCropTagDtos)) {
// Set<String> tagIdsSet = weCropTagDtos.stream().map(WeCropTagDto::getId).collect(Collectors.toSet());
//
// tags.stream().forEach(tag -> {
//
// if (tagIdsSet.contains(tag.getTag_id())) {
//
// weTags.add(
// WeTag.builder()
// .groupId(tagGroup.getGroup_id())
// .tagId(tag.getTag_id())
// .name(tag.getTag_name())
// .build()
// );
//
// weFlowerCustomerTagRels.add(
// WeFlowerCustomerTagRel.builder()
// .tagId(tag.getTag_id())
// .createTime(new Date())
// .build()
// );
//
//
// }
//
//
// });
//
//
// }
//
//
// });
//
//
// }
// }
//
//
// }
// });
//
//
// List<WeFlowerCustomerRel> weFlowerCustomerRels = iWeFlowerCustomerRelService.list(new LambdaQueryWrapper<WeFlowerCustomerRel>()
// .eq(WeFlowerCustomerRel::getExternalUserid, weCustomer.getExternalUserid()));
//
// try {
// if (CollectionUtil.isNotEmpty(weFlowerCustomerRels)) {
// List<Long> weFlowerCustomerRelIds = weFlowerCustomerRels.stream().map(WeFlowerCustomerRel::getId).collect(Collectors.toList());
//
// iWeFlowerCustomerRelService.removeByIds(
// weFlowerCustomerRelIds
// );
// }
//
//
// iWeFlowerCustomerRelService.saveBatch(weFlowerCustomerRel);
//
// //设置标签跟客户关系,标签和标签组,saveOrUpdate,建立标签与添加人关系
// if (CollectionUtil.isNotEmpty(weTags) && CollectionUtil.isNotEmpty(weGroups)) {
// iWeTagService.saveOrUpdateBatch(weTags);
// iWeTagGroupService.saveOrUpdateBatch(weGroups);
//
//
// List<WeFlowerCustomerTagRel> tagRels
// = weFlowerCustomerTagRels.stream().filter(rel -> Objects.nonNull(rel.getUserId())).collect(Collectors.toList());
//
// if(CollectionUtil.isNotEmpty(tagRels)){
//
// iWeFlowerCustomerTagRelService.saveOrUpdateBatch(tagRels);
//
// }
//
// }
// } catch (Exception e) {
// e.printStackTrace();
// log.error("Exception:【{}】",e);
// TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
// }
// }
}
}
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/welcome/WelcomeService.java
View file @
9303401
...
@@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONObject;
...
@@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONObject;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.linkwechat.common.enums.MessageType
;
import
com.linkwechat.common.enums.MessageType
;
import
com.linkwechat.wecom.client.WeCustomerClient
;
import
com.linkwechat.wecom.client.WeCustomerClient
;
import
com.linkwechat.wecom.domain.WeCustomer
;
import
com.linkwechat.wecom.domain.WeQrAttachments
;
import
com.linkwechat.wecom.domain.WeQrAttachments
;
import
com.linkwechat.wecom.domain.WeQrCode
;
import
com.linkwechat.wecom.domain.WeQrCode
;
import
com.linkwechat.wecom.domain.WeTag
;
import
com.linkwechat.wecom.domain.WeTag
;
...
@@ -107,19 +108,25 @@ public class WelcomeService implements ApplicationListener<WeCustomerWelcomeQuer
...
@@ -107,19 +108,25 @@ public class WelcomeService implements ApplicationListener<WeCustomerWelcomeQuer
* @return
* @return
*/
*/
private
WeResultDto
sendWelcomeMsg
(
WeCustomerWelcomeQuery
query
,
List
<
WeQrAttachments
>
qrAttachments
)
{
private
WeResultDto
sendWelcomeMsg
(
WeCustomerWelcomeQuery
query
,
List
<
WeQrAttachments
>
qrAttachments
)
{
String
welcomText
=
"默认欢迎语"
;
WeWelcomeMsg
welcomeMsg
=
WeWelcomeMsg
.
builder
().
welcome_code
(
query
.
getWelcomeCode
()).
build
();
WeWelcomeMsg
welcomeMsg
=
WeWelcomeMsg
.
builder
().
welcome_code
(
query
.
getWelcomeCode
()).
build
();
if
(
CollectionUtil
.
isNotEmpty
(
qrAttachments
)){
if
(
CollectionUtil
.
isNotEmpty
(
qrAttachments
)){
WeQrAttachments
weQrAttachments
=
qrAttachments
.
stream
()
WeQrAttachments
weQrAttachments
=
qrAttachments
.
stream
()
.
filter
(
qrAttachment
->
ObjectUtil
.
equal
(
MessageType
.
TEXT
.
getMessageType
(),
qrAttachment
.
getMsgType
()))
.
filter
(
qrAttachment
->
ObjectUtil
.
equal
(
MessageType
.
TEXT
.
getMessageType
(),
qrAttachment
.
getMsgType
()))
.
findFirst
().
orElseGet
(
null
);
.
findFirst
().
orElseGet
(
null
);
if
(
weQrAttachments
!=
null
){
if
(
weQrAttachments
!=
null
){
welcom
eMsg
.
setText
(
WeWelcomeMsg
.
Text
.
builder
().
content
(
weQrAttachments
.
getContent
()).
build
()
);
welcom
Text
=
weQrAttachments
.
getContent
(
);
}
}
getMediaId
(
qrAttachments
);
getMediaId
(
qrAttachments
);
welcomeMsg
.
setAttachments
(
qrAttachments
);
welcomeMsg
.
setAttachments
(
qrAttachments
);
}
else
{
welcomeMsg
.
setText
(
WeWelcomeMsg
.
Text
.
builder
().
content
(
"默认欢迎语"
).
build
());
}
}
WeCustomer
weCustomer
=
weCustomerService
.
getOne
(
new
LambdaQueryWrapper
<
WeCustomer
>().
eq
(
WeCustomer:
:
getFirstUserId
,
query
.
getUserId
())
.
eq
(
WeCustomer:
:
getExternalUserid
,
query
.
getExternalUserId
()).
eq
(
WeCustomer:
:
getDelFlag
,
0
).
last
(
"limit 1"
));
if
(
weCustomer
!=
null
){
String
customerName
=
weCustomer
.
getCustomerName
();
welcomText
=
welcomText
.
replaceAll
(
"#客户昵称#"
,
customerName
);
}
welcomeMsg
.
setText
(
WeWelcomeMsg
.
Text
.
builder
().
content
(
welcomText
).
build
());
return
weCustomerClient
.
sendWelcomeMsg
(
welcomeMsg
);
return
weCustomerClient
.
sendWelcomeMsg
(
welcomeMsg
);
}
}
...
...
linkwe-wecom/src/main/resources/mapper/wecom/WeQrScopeMapper.xml
View file @
9303401
...
@@ -79,7 +79,6 @@
...
@@ -79,7 +79,6 @@
where find_in_set(#{value},wqs.work_cycle)
where find_in_set(#{value},wqs.work_cycle)
and str_to_date(wqs.begin_time,'%H:%i:%S')
<
= str_to_date(#{formatTime},'%H:%i:%S')
and str_to_date(wqs.begin_time,'%H:%i:%S')
<
= str_to_date(#{formatTime},'%H:%i:%S')
and str_to_date(wqs.end_time ,'%H:%i:%S')
>
= str_to_date(#{formatTime},'%H:%i:%S')
and str_to_date(wqs.end_time ,'%H:%i:%S')
>
= str_to_date(#{formatTime},'%H:%i:%S')
/*and wqs.`type` = 1*/
and wqs.del_flag = 0
and wqs.del_flag = 0
</select>
</select>
</mapper>
</mapper>
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment