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
932dda28
Commit
932dda28
authored
Dec 16, 2022
by
徐高华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
群发
parent
dcf8e802
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
21 deletions
+44
-21
GroupChatHmServiceImpl.java
...age/service/service/chat/impl/GroupChatHmServiceImpl.java
+1
-1
GroupChatPlanServiceImpl.java
...e/service/service/chat/impl/GroupChatPlanServiceImpl.java
+38
-17
GroupChatPlanMapper.xml
...ce/src/main/resources/mapper/chat/GroupChatPlanMapper.xml
+1
-1
GroupChatPlanOwnerLogMapper.xml
...ain/resources/mapper/chat/GroupChatPlanOwnerLogMapper.xml
+4
-2
No files found.
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/chat/impl/GroupChatHmServiceImpl.java
View file @
932dda28
...
...
@@ -281,7 +281,7 @@ public class GroupChatHmServiceImpl implements GroupChatHmService {
if
(
CollectionUtils
.
isNotEmpty
(
relationList
))
{
this
.
groupChatHmRelationMapper
.
insertBatch
(
relationList
);
// 更新群的企业id到活码的企业ID
logger
.
info
(
"自动更新群关联的GIC企业ID,eid={},addIdList={}"
,
hm
.
getEnterpriseId
(),
addIdList
);
logger
.
info
(
"自动更新群关联的GIC企业ID,eid={},addIdList={}"
,
hm
.
getEnterpriseId
(),
addIdList
);
this
.
groupChatMapper
.
updateChatEnterpriseId
(
wxEnterpriseId
,
hm
.
getEnterpriseId
(),
addIdList
);
}
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/chat/impl/GroupChatPlanServiceImpl.java
View file @
932dda28
...
...
@@ -27,8 +27,10 @@ import com.gic.commons.util.EntityUtil;
import
com.gic.commons.util.GICMQClientUtil
;
import
com.gic.commons.util.PageHelperUtils
;
import
com.gic.commons.util.UniqueIdUtils
;
import
com.gic.dubbo.entity.ProviderLocalTag
;
import
com.gic.enterprise.api.dto.StoreDTO
;
import
com.gic.enterprise.api.service.StoreService
;
import
com.gic.haoban.common.utils.DingUtils
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO
;
import
com.gic.haoban.manage.api.dto.chat.GroupChatPlanDTO
;
import
com.gic.haoban.manage.api.dto.chat.GroupChatPlanLogDTO
;
...
...
@@ -175,6 +177,7 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService {
@Override
public
void
doPlan
(
Long
planId
)
{
logger
.
info
(
"开始群群发发送{}"
,
planId
);
DingUtils
.
send
(
"开始群群发发送,planId="
+
planId
+
",tranceid="
+
ProviderLocalTag
.
tag
.
get
().
traceId
,
false
);
TabGroupChatPlan
plan
=
this
.
groupChatPlanMapper
.
selectById
(
planId
);
if
(
null
==
plan
)
{
logger
.
info
(
"计划不存在,planid={}"
,
planId
);
...
...
@@ -190,17 +193,23 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService {
String
chatContent
=
plan
.
getChatContent
();
JSONArray
jsonArr
=
JSONArray
.
parseArray
(
chatContent
);
List
<
String
>
madidList
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
jsonArr
.
size
();
i
++)
{
JSONObject
json
=
jsonArr
.
getJSONObject
(
i
);
madidList
.
add
(
json
.
getString
(
"relation_id"
));
}
int
currentPage
=
1
;
GroupChatPlanSearchQDTO
qdto
=
new
GroupChatPlanSearchQDTO
();
qdto
.
setWxEnterpriseId
(
wxEnterpriseId
);
BasePageInfo
basePageInfo
=
new
BasePageInfo
();
basePageInfo
.
setPageNum
(
1
);
// todo
basePageInfo
.
setPageSize
(
1000
);
basePageInfo
.
setPageNum
(
currentPage
);
basePageInfo
.
setPageSize
(
1
);
Page
<
GroupChatPlanOwnerLogDTO
>
page
=
this
.
groupChatPlanOwnerLogService
.
listPage
(
planId
,
qdto
,
basePageInfo
);
for
(
int
i
=
0
;
i
<
jsonArr
.
size
();
i
++)
{
JSONObject
json
=
jsonArr
.
getJSONObject
(
i
);
madidList
.
add
(
json
.
getString
(
"relation_id"
));
while
(
page
.
getTotalPage
()
>=
currentPage
)
{
if
(
currentPage
>
1
)
{
basePageInfo
.
setPageNum
(
currentPage
);
page
=
this
.
groupChatPlanOwnerLogService
.
listPage
(
planId
,
qdto
,
basePageInfo
);
}
currentPage
++;
List
<
GroupChatPlanOwnerLogDTO
>
ownerList
=
page
.
getResult
();
for
(
GroupChatPlanOwnerLogDTO
dto
:
ownerList
)
{
String
staffId
=
dto
.
getStaffId
();
...
...
@@ -221,6 +230,8 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService {
this
.
savePendTask
(
dto
,
plan
);
}
}
}
}
private
void
savePendTask
(
GroupChatPlanOwnerLogDTO
ownerDTO
,
TabGroupChatPlan
plan
)
{
...
...
@@ -241,6 +252,7 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService {
@Override
public
void
doPlanSendInfoTimer
(
String
params
)
{
DingUtils
.
send
(
"开始群群发统计(定时),params="
+
params
+
",tranceid="
+
ProviderLocalTag
.
tag
.
get
().
traceId
,
false
);
Long
planId
=
Long
.
parseLong
(
params
);
List
<
Long
>
idList
=
this
.
groupChatPlanOwnerLogService
.
listForTimer
(
planId
);
logger
.
info
(
"定时处理群发结果,条数={}"
,
idList
.
size
());
...
...
@@ -276,8 +288,27 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService {
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
int
sendCount
=
0
;
int
failCount
=
0
;
Long
planId
=
ownerLog
.
getPlanId
();
TabGroupChatPlan
plan
=
this
.
groupChatPlanMapper
.
selectById
(
planId
);
for
(
QywxSendMessageResultDTO
item
:
list
)
{
TabGroupChatPlanLog
entity
=
new
TabGroupChatPlanLog
();
Date
sendTime
=
item
.
getSendTime
();
String
wxChatId
=
item
.
getChatId
();
// 如果企微的发送时间晚于计划的结束时间,不记录此类数据
if
(
sendTime
.
after
(
plan
.
getEndTime
()))
{
logger
.
info
(
"发送时间晚计划结束时间"
);
continue
;
}
GroupChatBO
chat
=
this
.
groupChatService
.
getByWxChatId
(
wxEnterpriseId
,
wxChatId
);
if
(
null
==
chat
||
StringUtils
.
isBlank
(
chat
.
getEnterpriseId
()))
{
logger
.
info
(
"群不存在,或未认领,wxChatId={}"
,
wxChatId
);
continue
;
}
if
(!
chat
.
getEnterpriseId
().
equals
(
plan
.
getEnterpriseId
()))
{
logger
.
info
(
"群的商户id和计划的商户id不一致{},{}"
,
chat
.
getEnterpriseId
(),
plan
.
getEnterpriseId
());
continue
;
}
entity
.
setGroupChatId
(
chat
.
getGroupChatId
());
// 企微返回成功
// 0-未发送 1-已发送 2-因客户不是好友导致发送失败 3-因客户已经收到其他群发消息导致发送失败
if
(
item
.
getStatus
()
==
1
)
{
...
...
@@ -289,22 +320,12 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService {
// 发送失败
entity
.
setSendStatus
(
0
);
}
String
wxChatId
=
item
.
getChatId
();
Date
sendTime
=
item
.
getSendTime
();
entity
.
setLogId
(
UniqueIdUtils
.
uniqueLong
());
entity
.
setPlanId
(
ownerLog
.
getPlanId
());
entity
.
setOwnLogId
(
ownerLog
.
getOwnerLogId
());
entity
.
setWxEnterpriseId
(
wxEnterpriseId
);
entity
.
setEnterpriseId
(
enterpriseId
);
entity
.
setStaffId
(
staffId
);
GroupChatBO
chat
=
this
.
groupChatService
.
getByWxChatId
(
wxEnterpriseId
,
wxChatId
);
if
(
null
==
chat
||
StringUtils
.
isBlank
(
chat
.
getEnterpriseId
()))
{
logger
.
info
(
"群不存在,或未认领,wxChatId={}"
,
wxChatId
);
continue
;
}
if
(
null
!=
chat
)
{
entity
.
setGroupChatId
(
chat
.
getGroupChatId
());
}
entity
.
setSendTime
(
sendTime
);
this
.
groupChatPlanLogMapper
.
insert
(
entity
);
}
...
...
@@ -327,8 +348,8 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService {
@Override
public
void
stop
(
String
clerkId
,
String
clerkName
,
Long
planId
)
{
logger
.
info
(
"终止计划,并触发统计planId={}"
,
planId
);
this
.
groupChatPlanMapper
.
stopById
(
planId
,
clerkId
,
clerkName
);
logger
.
info
(
"触发统计"
);
this
.
putMQForData
(
planId
);
}
...
...
haoban-manage3-service/src/main/resources/mapper/chat/GroupChatPlanMapper.xml
View file @
932dda28
...
...
@@ -111,7 +111,7 @@
<update
id=
"stopById"
>
UPDATE
tab_haoban_group_chat_plan SET status_flag = 0 , modifier_id =
#{clerkId} , modifier_name = #{clerkName} ,
s
end_time = now() , update_time=now() WHERE plan_id = #{planId}
#{clerkId} , modifier_name = #{clerkName} , end_time = now() , update_time=now() WHERE plan_id = #{planId}
</update>
<update
id=
"updateSendFlag"
>
...
...
haoban-manage3-service/src/main/resources/mapper/chat/GroupChatPlanOwnerLogMapper.xml
View file @
932dda28
...
...
@@ -104,7 +104,8 @@
<select
id=
"listForTimer"
resultType=
"long"
>
SELECT a.owner_log_id FROM tab_haoban_group_chat_plan_owner_log a left join tab_haoban_group_chat_plan b on a.plan_id = b.plan_id
WHERE b.end_time >= DATE_ADD(NOW(),INTERVAL -12 hour) and a.done_flag = 0 and a.delete_flag = 0 and b.delete_flag = 0 and a.msgid is not null
WHERE b.end_time >= DATE_ADD(NOW(),INTERVAL -6 hour) and a.done_flag = 0 and a.delete_flag = 0 and b.delete_flag = 0 and a.msgid is not null
and b.status_flag = 0
<if
test=
"null != planId and -1 != planId"
>
and a.plan_id = #{planId}
</if>
...
...
@@ -127,7 +128,8 @@
a.msgid msgid
from tab_haoban_group_chat_plan_owner_log a left join tab_haoban_staff b on a.staff_id = b.staff_id
where
a.wx_enterprise_id = #{wxEnterpriseId} and a.plan_id = #{planId}
a.wx_enterprise_id = #{wxEnterpriseId} and a.plan_id = #{planId} and a.delete_flag = 0
order by a.create_time , a.owner_log_id
</select>
<select
id=
"listOwnerLogPageForWxaTotal"
parameterType=
"com.gic.haoban.manage.api.dto.qdto.chat.GroupChatPlanSearchQDTO"
resultType=
"com.gic.haoban.manage.api.dto.chat.ChatOwnerTotalDTO"
>
...
...
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