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
afada94c
Commit
afada94c
authored
Jul 04, 2025
by
wujipeng
Browse files
月初-短信通知
parent
b85b09c8
Changes
1
Show whitespace changes
Inline
Side-by-side
src/main/java/com/ruzhoukj/sms/task/InTheEarlyTask.java
View file @
afada94c
package
com.ruzhoukj.sms.task
;
import
cn.hutool.core.bean.BeanUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.ruzhoukj.sms.entity.EmailRecordEntity
;
import
com.ruzhoukj.sms.entity.ScheduleEntity
;
import
com.ruzhoukj.sms.entity.SmsInformEntity
;
...
...
@@ -9,12 +10,15 @@ import com.ruzhoukj.sms.service.ScheduleService;
import
com.ruzhoukj.sms.service.SmsInformService
;
import
com.ruzhoukj.sms.util.DateUtils
;
import
com.ruzhoukj.sms.util.EmailUtil
;
import
com.ruzhoukj.sms.util.SmsUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* @author : wujipeng
...
...
@@ -50,15 +54,27 @@ public class InTheEarlyTask {
.
info
(
"月初通知"
)
.
createTime
(
new
Date
())
.
build
());
//保存短信信息
}
}
//短信通知
// @Scheduled(cron = "0/10 * * * * ?")
@Scheduled
(
cron
=
"0 0 9 1 * ?"
)
public
void
inTheEarlySms
()
{
Date
[]
dates
=
DateUtils
.
getStartAndEndDateOfCurrentMonth
();
//查询本月维护人的信息
ScheduleEntity
scheduleEntity
=
scheduleService
.
getUser
(
dates
[
0
],
dates
[
1
]);
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"name"
,
scheduleEntity
.
getName
());
SmsUtil
.
sendMsg
(
scheduleEntity
.
getPhone
(),
"SMS_490030330"
,
map
);
//保存短信发送历史记录
smsInformService
.
save
(
SmsInformEntity
.
builder
()
.
date
(
new
Date
())
.
name
(
scheduleEntity
.
getName
())
.
num
(
1
)
.
phone
(
scheduleEntity
.
getPhone
())
.
createTime
(
new
Date
())
.
serviceName
(
"月初通知"
)
.
isDelete
(
1
)
.
build
());
}
}
}
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