Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
邬吉朋
ops
Commits
6586bf8f
Commit
6586bf8f
authored
Oct 16, 2025
by
wujipeng
Browse files
企业微信@指定人消息-优化
parent
bd088915
Changes
1
Show whitespace changes
Inline
Side-by-side
src/main/java/com/ruzhoukj/sms/controller/CertificateController.java
View file @
6586bf8f
package
com.ruzhoukj.sms.controller
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.platform.exception.BusinessException
;
import
com.platform.model.resp.Result
;
import
com.ruzhoukj.sms.common.WeChatRobotSender
;
import
com.ruzhoukj.sms.entity.CertificateEntity
;
import
com.ruzhoukj.sms.entity.DingUserEntity
;
import
com.ruzhoukj.sms.entity.kzReminderEntity
;
import
com.ruzhoukj.sms.pojo.dto.CertificateDTO
;
import
com.ruzhoukj.sms.pojo.vo.CertificateVO
;
import
com.ruzhoukj.sms.service.CertificateService
;
import
com.ruzhoukj.sms.service.DingUserService
;
import
com.ruzhoukj.sms.service.KzReminderService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.util.ObjectUtils
;
...
...
@@ -31,6 +34,8 @@ public class CertificateController {
private
CertificateService
certificateService
;
@Resource
private
KzReminderService
kzReminderService
;
@Resource
private
DingUserService
dingUserService
;
@PostMapping
(
"/reminder"
)
public
Result
<
String
>
reminder
(
@RequestBody
CertificateDTO
certificateDTO
)
{
...
...
@@ -138,12 +143,17 @@ public class CertificateController {
}
@GetMapping
(
"/specified/send"
)
public
Result
<
Boolean
>
send
(
@RequestParam
(
"phone"
)
String
phone
,
@RequestParam
(
"content"
)
String
content
)
{
public
Result
<
Boolean
>
send
(
@RequestParam
(
"name"
)
String
name
,
@RequestParam
(
"content"
)
String
content
)
{
//查询手机号
DingUserEntity
user
=
dingUserService
.
getOne
(
new
LambdaQueryWrapper
<
DingUserEntity
>().
eq
(
DingUserEntity:
:
getName
,
name
));
if
(
ObjectUtils
.
isEmpty
(
user
))
{
throw
new
BusinessException
(
"用户不存在"
);
}
String
webhookUrl
=
"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=04c5f353-33a7-4cb0-8d00-798dee5df953"
;
WeChatRobotSender
sender
=
new
WeChatRobotSender
(
webhookUrl
);
try
{
// 发送文本消息,并@指定手机号的成员
sender
.
sendTextMessage
(
content
,
null
,
new
String
[]{
phone
});
sender
.
sendTextMessage
(
content
,
null
,
new
String
[]{
user
.
getMobile
()
});
return
Result
.
data
(
true
);
}
catch
(
Exception
ignored
)
{
return
Result
.
data
(
false
);
...
...
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