Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-manage3.0
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
haoban3.0
haoban-manage3.0
Commits
e5ffdfd3
Commit
e5ffdfd3
authored
Jun 18, 2025
by
王祖波
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
解决企微群发重复调用问题
parent
1c13eb18
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
101 additions
and
4 deletions
+101
-4
TabContactFollowMapper.java
...ge/service/dao/mapper/contact/TabContactFollowMapper.java
+3
-0
listFollowCheckBO.java
...ban/manage/service/pojo/bo/contact/listFollowCheckBO.java
+55
-0
ContactFollowServiceImpl.java
...ervice/service/contact/impl/ContactFollowServiceImpl.java
+20
-4
TabContactFollowMapper.xml
.../main/resources/mapper/contact/TabContactFollowMapper.xml
+23
-0
No files found.
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/dao/mapper/contact/TabContactFollowMapper.java
View file @
e5ffdfd3
...
...
@@ -3,6 +3,7 @@ package com.gic.haoban.manage.service.dao.mapper.contact;
import
com.gic.haoban.manage.api.qdto.chat.GroupChatActivitySearchQDTO
;
import
com.gic.haoban.manage.api.qdto.contact.ContactFollowSearchQDTO
;
import
com.gic.haoban.manage.service.entity.contact.TabContactFollow
;
import
com.gic.haoban.manage.service.pojo.bo.contact.listFollowCheckBO
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.Date
;
...
...
@@ -32,6 +33,8 @@ public interface TabContactFollowMapper {
List
<
TabContactFollow
>
pageFollow
(
@Param
(
"enterpriseId"
)
String
enterpriseId
,
@Param
(
"search"
)
ContactFollowSearchQDTO
searchQDTO
);
List
<
String
>
listFollowCheck
(
@Param
(
"enterpriseId"
)
String
enterpriseId
,
@Param
(
"list"
)
List
<
listFollowCheckBO
>
list
);
/**
* 通过memberId查询最后一次跟进记录
* @param enterpriseId
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/pojo/bo/contact/listFollowCheckBO.java
0 → 100644
View file @
e5ffdfd3
package
com
.
gic
.
haoban
.
manage
.
service
.
pojo
.
bo
.
contact
;
import
java.io.Serializable
;
import
java.util.Date
;
public
class
listFollowCheckBO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
973688857967269974L
;
/**
* 会员id
*/
private
String
memberId
;
/**
* 导购id
*/
private
String
clerkId
;
/**
* 互动时间
*/
private
Date
followTime
;
public
listFollowCheckBO
()
{
}
public
listFollowCheckBO
(
String
memberId
,
String
clerkId
,
Date
followTime
)
{
this
.
memberId
=
memberId
;
this
.
clerkId
=
clerkId
;
this
.
followTime
=
followTime
;
}
public
String
getMemberId
()
{
return
memberId
;
}
public
void
setMemberId
(
String
memberId
)
{
this
.
memberId
=
memberId
;
}
public
String
getClerkId
()
{
return
clerkId
;
}
public
void
setClerkId
(
String
clerkId
)
{
this
.
clerkId
=
clerkId
;
}
public
Date
getFollowTime
()
{
return
followTime
;
}
public
void
setFollowTime
(
Date
followTime
)
{
this
.
followTime
=
followTime
;
}
}
\ No newline at end of file
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/contact/impl/ContactFollowServiceImpl.java
View file @
e5ffdfd3
...
...
@@ -20,6 +20,7 @@ import com.gic.haoban.manage.api.qdto.contact.ContactFollowSearchQDTO;
import
com.gic.haoban.manage.api.qdto.contact.ContactLogQDTO
;
import
com.gic.haoban.manage.service.dao.mapper.contact.TabContactFollowMapper
;
import
com.gic.haoban.manage.service.entity.contact.TabContactFollow
;
import
com.gic.haoban.manage.service.pojo.bo.contact.listFollowCheckBO
;
import
com.gic.haoban.manage.service.service.contact.ContactFollowService
;
import
com.gic.marketing.api.dto.member.MemberSmsLogDTO
;
import
com.gic.marketing.api.service.SmsService
;
...
...
@@ -74,6 +75,8 @@ public class ContactFollowServiceImpl implements ContactFollowService {
if
(
CollectionUtils
.
isEmpty
(
clerks
))
{
return
;
}
String
enterpriseId
=
list
.
get
(
0
).
getEnterpriseId
();
Integer
followType
=
list
.
get
(
0
).
getFollowType
();
Map
<
String
,
ClerkDTO
>
clerkMap
=
clerks
.
stream
().
collect
(
Collectors
.
toMap
(
ClerkDTO:
:
getClerkId
,
Function
.
identity
(),
(
v1
,
v2
)
->
v1
));
List
<
TabContactFollow
>
followList
=
list
.
stream
().
map
(
follow
->
{
TabContactFollow
contactFollow
=
EntityUtil
.
changeEntityNew
(
TabContactFollow
.
class
,
follow
);
...
...
@@ -90,14 +93,27 @@ public class ContactFollowServiceImpl implements ContactFollowService {
contactFollow
.
setGoodsInfo
(
JSON
.
toJSONString
(
follow
.
getGoodsInfoList
()));
}
// 兼容不传followType的老版本
Integer
followType
=
contactFollow
.
getFollowType
();
if
(
followType
==
null
)
{
Integer
followType
Old
=
contactFollow
.
getFollowType
();
if
(
followType
Old
==
null
)
{
ContactFollowTypeEnum
followTypeEnum
=
ContactFollowTypeEnum
.
fromTextMatch
(
contactFollow
.
getFollowRemark
());
followType
=
Optional
.
ofNullable
(
followTypeEnum
).
map
(
ContactFollowTypeEnum:
:
getCode
).
orElse
(
ContactFollowTypeEnum
.
CONTACT
.
getCode
());
contactFollow
.
setFollowType
(
followType
);
followType
Old
=
Optional
.
ofNullable
(
followTypeEnum
).
map
(
ContactFollowTypeEnum:
:
getCode
).
orElse
(
ContactFollowTypeEnum
.
CONTACT
.
getCode
());
contactFollow
.
setFollowType
(
followType
Old
);
}
return
contactFollow
;
}).
filter
(
Objects:
:
nonNull
).
collect
(
Collectors
.
toList
());
// 解决企微群发重复调用问题
if
(
Objects
.
equals
(
followType
,
ContactFollowTypeEnum
.
WECHAT_GROUP_SEND
.
getCode
()))
{
logger
.
info
(
"企微群发重复调用校验"
);
List
<
listFollowCheckBO
>
checkList
=
followList
.
stream
().
map
(
x
->
new
listFollowCheckBO
(
x
.
getMemberId
(),
x
.
getClerkId
(),
x
.
getFollowTime
())).
collect
(
Collectors
.
toList
());
List
<
String
>
checkMemberIdList
=
contactFollowMapper
.
listFollowCheck
(
enterpriseId
,
checkList
);
logger
.
info
(
"企微群发重复调用:{}"
,
JSON
.
toJSONString
(
checkMemberIdList
));
if
(
CollectionUtils
.
isNotEmpty
(
checkMemberIdList
))
{
followList
=
followList
.
stream
().
filter
(
x
->
checkMemberIdList
.
contains
(
x
.
getMemberId
())).
collect
(
Collectors
.
toList
());
}
}
if
(
CollectionUtils
.
isEmpty
(
followList
))
{
return
;
}
contactFollowMapper
.
insertBatch
(
followList
);
// 部分跟进发送自动建联
autoContactSend
(
followList
);
...
...
haoban-manage3-service/src/main/resources/mapper/contact/TabContactFollowMapper.xml
View file @
e5ffdfd3
...
...
@@ -105,6 +105,29 @@
ORDER BY follow_time DESC,follow_id DESC
</select>
<select
id=
"listFollowCheck"
resultType=
"java.lang.String"
>
SELECT
member_id
FROM tab_contact_follow
<where>
enterprise_id = #{enterpriseId}
AND delete_flag = 0
AND follow_time >= NOW() - INTERVAL 6 MONTH
<if
test=
"list != null and list.size() > 0"
>
AND (
<foreach
collection=
"list"
item=
"item"
separator=
" OR "
>
(
member_id = #{item.memberId}
AND follow_time = #{item.followTime}
AND clerk_id = #{item.clerkId}
AND follow_type = 4
)
</foreach>
)
</if>
</where>
</select>
<select
id=
"lastFollowByMemberId"
resultMap=
"BaseResultMap"
>
SELECT
<include
refid=
"Alias_Base_Column_List"
/>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment