Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yq-scrm-backend
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Members
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
朱广松
yq-scrm-backend
Commits
7ba4210f
Commit
7ba4210f
authored
Oct 26, 2026
by
wuchao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复bug
parent
841d207f
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
25 行增加
和
7 行删除
+25
-7
scrm-module/scrm-business/src/main/java/org/scrm/service/impl/WeAgentMsgServiceImpl.java
+25
-7
没有找到文件。
scrm-module/scrm-business/src/main/java/org/scrm/service/impl/WeAgentMsgServiceImpl.java
View file @
7ba4210f
package
org
.
scrm
.
service
.
impl
;
package
org
.
scrm
.
service
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
me.chanjar.weixin.cp.api.WxCpService
;
import
me.chanjar.weixin.cp.bean.message.WxCpMessage
;
import
me.chanjar.weixin.cp.bean.message.WxCpMessage
;
import
me.chanjar.weixin.cp.bean.message.WxCpMessageSendResult
;
import
me.chanjar.weixin.cp.bean.message.WxCpMessageSendResult
;
import
me.chanjar.weixin.cp.config.impl.WxCpDefaultConfigImpl
;
import
org.scrm.base.constant.Constants
;
import
org.scrm.base.constant.Constants
;
import
org.scrm.base.exception.wecom.WeComException
;
import
org.scrm.base.exception.wecom.WeComException
;
import
org.scrm.base.utils.StringUtils
;
import
org.scrm.base.utils.StringUtils
;
...
@@ -56,7 +59,7 @@ public class WeAgentMsgServiceImpl extends ServiceImpl<WeAgentMsgMapper, WeAgent
...
@@ -56,7 +59,7 @@ public class WeAgentMsgServiceImpl extends ServiceImpl<WeAgentMsgMapper, WeAgent
try
{
try
{
WeAgentMsg
weAgentMsg
=
WeAgentMsg
.
builder
(
query
);
WeAgentMsg
weAgentMsg
=
WeAgentMsg
.
builder
(
query
);
log
.
info
(
"应用消息WeAgentMsg:{}"
,
JSONObject
.
toJSONString
(
weAgentMsg
));
this
.
sendMsg
(
weAgentMsg
,
query
.
getPromotionEntity
(),
weAgentMsg
.
getSendType
().
equals
(
1
));
this
.
sendMsg
(
weAgentMsg
,
query
.
getPromotionEntity
(),
weAgentMsg
.
getSendType
().
equals
(
1
));
return
weAgentMsg
;
return
weAgentMsg
;
...
@@ -71,14 +74,23 @@ public class WeAgentMsgServiceImpl extends ServiceImpl<WeAgentMsgMapper, WeAgent
...
@@ -71,14 +74,23 @@ public class WeAgentMsgServiceImpl extends ServiceImpl<WeAgentMsgMapper, WeAgent
public
void
sendMsg
(
WeAgentMsg
weAgentMsg
,
PromotionEntity
promotionEntity
,
boolean
isSendMsg
)
throws
Exception
{
public
void
sendMsg
(
WeAgentMsg
weAgentMsg
,
PromotionEntity
promotionEntity
,
boolean
isSendMsg
)
throws
Exception
{
try
{
try
{
if
(
saveOrUpdate
(
weAgentMsg
)
&&
Objects
.
equals
(
1
,
weAgentMsg
.
getStatus
()))
{
boolean
saveResult
=
saveOrUpdate
(
weAgentMsg
);
log
.
info
(
"应用发送消息,保存或更新结果1,saveResult:{}, weAgentMsg:{}, isSendMsg:{}"
,
saveResult
,
JSONObject
.
toJSONString
(
weAgentMsg
),
isSendMsg
);
if
(
saveResult
&&
Objects
.
equals
(
1
,
weAgentMsg
.
getStatus
()))
{
log
.
info
(
"应用发送消息,开始构建发送实体2"
);
WxCpMessage
wxCpMessage
=
WeAgentMsg
.
buildAgentMsg
(
weAgentMsg
);
WxCpMessage
wxCpMessage
=
WeAgentMsg
.
buildAgentMsg
(
weAgentMsg
);
log
.
info
(
"应用消息发送实体
:"
+
wxCpMessage
);
log
.
info
(
"应用消息发送实体
3:{}"
,
JSONObject
.
toJSONString
(
wxCpMessage
)
);
if
(
null
!=
wxCpMessage
){
if
(
null
!=
wxCpMessage
){
if
(
isSendMsg
){
if
(
isSendMsg
){
WxCpMessageSendResult
sendResult
=
weCorpAccountService
.
findWxcpserviceByAgentId
(
weAgentMsg
.
getAgentId
()).
getMessageService
().
send
(
wxCpMessage
);
log
.
info
(
"应用消息开始发送消息4"
);
log
.
info
(
"应用消息结果实体:"
+
wxCpMessage
);
// WxCpMessageSendResult sendResult = weCorpAccountService.findWxcpserviceByAgentId(weAgentMsg.getAgentId()).getMessageService().send(wxCpMessage);
WxCpService
wxCpService
=
weCorpAccountService
.
findWxcpserviceByAgentId
(
weAgentMsg
.
getAgentId
());
WxCpDefaultConfigImpl
config
=
(
WxCpDefaultConfigImpl
)
wxCpService
.
getWxCpConfigStorage
();
config
.
setBaseApiUrl
(
"http://192.168.166.6:8243"
);
WxCpMessageSendResult
sendResult
=
wxCpService
.
getMessageService
().
send
(
wxCpMessage
);
log
.
info
(
"应用消息结果实体5:{}"
,
JSONObject
.
toJSONString
(
sendResult
));
if
(
StringUtils
.
isNotEmpty
(
sendResult
.
getMsgId
())){
if
(
StringUtils
.
isNotEmpty
(
sendResult
.
getMsgId
())){
weAgentMsg
.
setMsgId
(
sendResult
.
getMsgId
());
weAgentMsg
.
setMsgId
(
sendResult
.
getMsgId
());
weAgentMsg
.
setStatus
(
2
);
weAgentMsg
.
setStatus
(
2
);
...
@@ -86,13 +98,19 @@ public class WeAgentMsgServiceImpl extends ServiceImpl<WeAgentMsgMapper, WeAgent
...
@@ -86,13 +98,19 @@ public class WeAgentMsgServiceImpl extends ServiceImpl<WeAgentMsgMapper, WeAgent
}
else
{
}
else
{
weAgentMsg
.
setStatus
(
3
);
weAgentMsg
.
setStatus
(
3
);
}
}
}
else
{
log
.
info
(
"应用消息构不发送信息6"
);
}
}
this
.
updateById
(
weAgentMsg
);
this
.
updateById
(
weAgentMsg
);
}
else
{
log
.
info
(
"应用消息构建发送实体失败7"
);
}
}
}
else
{
log
.
info
(
"应用发送消息失败保存或更新失败,或者发送状态不为1,weAgentMsg: {}"
,
JSONObject
.
toJSONString
(
weAgentMsg
));
}
}
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
log
.
error
(
"应用消息发送失败"
,
e
);
log
.
error
(
"应用消息发送失败
8
"
,
e
);
throw
e
;
throw
e
;
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论