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
4c68b6eb
Commit
4c68b6eb
authored
Aug 28, 2024
by
wujipeng
Browse files
优化
parent
749e0d05
Changes
3
Show whitespace changes
Inline
Side-by-side
src/main/java/com/ruzhoukj/sms/task/ProjectTask.java
View file @
4c68b6eb
...
...
@@ -33,7 +33,7 @@ public class ProjectTask {
public
void
projectRemind
()
{
List
<
ProjectEntity
>
sevenDaysProject
=
projectService
.
selectSevenDaysProject
();
//有要到期的合同,需要邮箱提醒
if
(
CollUtil
.
isNotEmpty
(
sevenDaysProject
)
&&
sevenDaysProject
.
size
()
>
0
)
{
if
(
CollUtil
.
isNotEmpty
(
sevenDaysProject
)
&&
!
sevenDaysProject
.
isEmpty
()
)
{
for
(
ProjectEntity
projectEntity
:
sevenDaysProject
)
{
UserEntity
user
=
userService
.
getUserByLeader
(
projectEntity
.
getProjectLeader
());
if
(
BeanUtil
.
isNotEmpty
(
user
))
{
...
...
src/main/java/com/ruzhoukj/sms/util/DateUtils.java
View file @
4c68b6eb
package
com.ruzhoukj.sms.util
;
import
java.text.SimpleDateFormat
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.ZoneId
;
...
...
@@ -35,6 +36,20 @@ public class DateUtils {
return
new
Date
[]{
startDate
,
endDate
};
}
/**
* 将Date类型的日期转换为"yyyy-MM-dd"格式的字符串.
*
* @param date 需要被转换的日期
* @return 转换后的字符串,如果输入的date为null则返回null
*/
public
static
String
formatDate
(
Date
date
)
{
if
(
date
==
null
)
{
return
null
;
}
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
return
sdf
.
format
(
date
);
}
public
static
void
main
(
String
[]
args
)
{
Date
[]
dates
=
getStartAndEndDateOfCurrentMonth
();
System
.
out
.
println
(
"Start date of this month: "
+
dates
[
0
]);
...
...
src/main/java/com/ruzhoukj/sms/util/EmailUtil.java
View file @
4c68b6eb
...
...
@@ -147,6 +147,7 @@ public class EmailUtil {
try
{
Message
message
=
new
MimeMessage
(
session
);
message
.
setSubject
(
"项目到期提醒"
);
message
.
setFrom
(
new
InternetAddress
(
username
));
// 添加多个收件人
...
...
@@ -157,8 +158,8 @@ public class EmailUtil {
StringJoiner
stringJoiner
=
new
StringJoiner
(
"\n"
);
stringJoiner
.
add
(
name
+
"您好,以下项目即将在七天内到期"
);
stringJoiner
.
add
(
"项目名:"
+
projectEntity
.
getProjectName
());
stringJoiner
.
add
(
"项目开始时间:"
+
projectEntity
.
getStartTime
());
stringJoiner
.
add
(
"项目结束时间:"
+
projectEntity
.
getEndTime
());
stringJoiner
.
add
(
"项目开始时间:"
+
DateUtils
.
formatDate
(
projectEntity
.
getStartTime
())
)
;
stringJoiner
.
add
(
"项目结束时间:"
+
DateUtils
.
formatDate
(
projectEntity
.
getEndTime
())
)
;
stringJoiner
.
add
(
"备注:"
+
projectEntity
.
getDescribe
());
stringJoiner
.
add
(
"请及时处理"
);
...
...
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