Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yifu-mvp
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fangxinjiang
yifu-mvp
Commits
74e983fc
Commit
74e983fc
authored
Jan 07, 2026
by
fangxinjiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
版本切换-fxj
parent
95a0457f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
4 deletions
+17
-4
DateUtil.java
...om/yifu/cloud/plus/v1/yifu/common/core/util/DateUtil.java
+17
-4
No files found.
yifu-common/yifu-common-core/src/main/java/com/yifu/cloud/plus/v1/yifu/common/core/util/DateUtil.java
View file @
74e983fc
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
common
.
core
.
util
;
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
common
.
core
.
util
;
import
com.alibaba.excel.converters.date.DateDateConverter
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.sms.MonthObject
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.sms.MonthObject
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -1984,6 +1983,20 @@ public class DateUtil {
...
@@ -1984,6 +1983,20 @@ public class DateUtil {
return
false
;
return
false
;
}
}
/**
* @Author fxj
* @Description 判断 日期 date 是否在 registDate 之后,在返回true,否则返回false
* @Date 15:10 2025/12/12
* @Param
* @return
**/
public
static
boolean
isBefore
(
Date
date
,
Date
registDate
)
{
if
(
date
.
getTime
()
<
registDate
.
getTime
())
{
return
true
;
}
return
false
;
}
/**
/**
* 日期月份类型枚举
* 日期月份类型枚举
*/
*/
...
@@ -2014,7 +2027,7 @@ public class DateUtil {
...
@@ -2014,7 +2027,7 @@ public class DateUtil {
}
}
// 获取当前月份的第一天
// 获取当前月份的第一天
Date
currentMonthFirstDay
=
DateUtil
.
setDayByDate
(
new
Date
(
),
1
);
Date
currentMonthFirstDay
=
DateUtil
.
setDayByDate
(
DateUtil
.
formatDateByPatten
(
new
Date
(),
DateUtil
.
ISO_EXPANDED_DATE_FORMAT
),
1
);
// 获取下个月的第一天
// 获取下个月的第一天
Date
nextMonthFirstDay
=
DateUtil
.
addMonthByDate
(
currentMonthFirstDay
,
1
);
Date
nextMonthFirstDay
=
DateUtil
.
addMonthByDate
(
currentMonthFirstDay
,
1
);
...
@@ -2023,11 +2036,11 @@ public class DateUtil {
...
@@ -2023,11 +2036,11 @@ public class DateUtil {
Date
nextNextMonthFirstDay
=
DateUtil
.
addMonthByDate
(
currentMonthFirstDay
,
2
);
Date
nextNextMonthFirstDay
=
DateUtil
.
addMonthByDate
(
currentMonthFirstDay
,
2
);
// 判断目标日期是否早于下个月第一天
// 判断目标日期是否早于下个月第一天
if
(
!
DateUtil
.
isAfter
(
targetDate
,
nextMonthFirstDay
))
{
if
(
DateUtil
.
isBefore
(
targetDate
,
nextMonthFirstDay
))
{
return
MonthType
.
CURRENT_OR_BEFORE
;
return
MonthType
.
CURRENT_OR_BEFORE
;
}
}
// 判断目标日期是否早于下下个月第一天
// 判断目标日期是否早于下下个月第一天
else
if
(
!
DateUtil
.
isAfter
(
targetDate
,
nextNextMonthFirstDay
))
{
else
if
(
DateUtil
.
isBefore
(
targetDate
,
nextNextMonthFirstDay
))
{
return
MonthType
.
NEXT_MONTH
;
return
MonthType
.
NEXT_MONTH
;
}
}
// 其他情况为次次月及之后
// 其他情况为次次月及之后
...
...
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