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
1984a656
Commit
1984a656
authored
Oct 16, 2025
by
wujipeng
Browse files
企业微信运维定时通知
parent
6586bf8f
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/com/ruzhoukj/sms/task/InTheEarlyTask.java
View file @
1984a656
...
...
@@ -2,6 +2,8 @@ package com.ruzhoukj.sms.task;
import
cn.hutool.core.bean.BeanUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.platform.model.resp.Result
;
import
com.ruzhoukj.sms.common.WeChatRobotSender
;
import
com.ruzhoukj.sms.entity.EmailRecordEntity
;
import
com.ruzhoukj.sms.entity.ScheduleEntity
;
import
com.ruzhoukj.sms.entity.SmsInformEntity
;
...
...
@@ -14,6 +16,7 @@ import com.ruzhoukj.sms.util.SmsUtil;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.ObjectUtils
;
import
javax.annotation.Resource
;
import
java.util.Date
;
...
...
@@ -77,4 +80,23 @@ public class InTheEarlyTask {
.
isDelete
(
1
)
.
build
());
}
// @Scheduled(cron = "0/10 * * * * ?")
@Scheduled
(
cron
=
"0 0 9 1 * ?"
)
public
void
inTheEarlyEnterprise
()
{
Date
[]
dates
=
DateUtils
.
getStartAndEndDateOfCurrentMonth
();
//查询本月维护人的信息
ScheduleEntity
scheduleEntity
=
scheduleService
.
getUser
(
dates
[
0
],
dates
[
1
]);
if
(!
ObjectUtils
.
isEmpty
(
scheduleEntity
))
{
String
phone
=
scheduleEntity
.
getPhone
();
String
name
=
scheduleEntity
.
getName
();
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
(
name
+
"你好"
+
"公司本月运维工作将由你负责,你需要前往oa系统完成运维项目的维护,确保阿里云账户余额不低于1000元"
,
null
,
new
String
[]{
phone
});
}
catch
(
Exception
ignored
)
{
}
}
}
}
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