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
57a3f1fe
Commit
57a3f1fe
authored
Aug 03, 2022
by
李灿灿
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature-licancan' into 'develop'
Feature licancan See merge request fangxinjiang/yifu!100
parents
62c09bbd
75b172b8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
9 deletions
+45
-9
LocalDateUtil.java
...ifu/cloud/plus/v1/yifu/insurances/util/LocalDateUtil.java
+38
-2
TInsuranceDetailServiceImpl.java
.../insurances/service/impl/TInsuranceDetailServiceImpl.java
+7
-7
No files found.
yifu-insurances/yifu-insurances-api/src/main/java/com/yifu/cloud/plus/v1/yifu/insurances/util/LocalDateUtil.java
View file @
57a3f1fe
...
@@ -119,6 +119,43 @@ public class LocalDateUtil {
...
@@ -119,6 +119,43 @@ public class LocalDateUtil {
return
flag
;
return
flag
;
}
}
/**
* 定时任务判断是否过期专用方法
*
* @author licancan
* @param strDate
* @return {@link boolean}
*/
public
static
boolean
isOverdueDate
(
String
strDate
){
boolean
flag
=
false
;
//在日期字符串非空时执行
if
(!
Common
.
isEmpty
(
strDate
))
{
//这里需要把传进来的日期加上23:59:59,来判断是否过期
strDate
=
strDate
+
" 23:59:59"
;
//今日的开始时间
Date
nowDate
=
new
Date
();
Date
pastDate
=
null
;
//格式化日期
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
NORM_DATETIME_PATTERN
,
Locale
.
CHINA
);
try
{
//将字符串转为日期格式,如果此处字符串为非合法日期就会抛出异常。
pastDate
=
sdf
.
parse
(
strDate
);
//调用Date里面的after方法来做判断
flag
=
pastDate
.
after
(
nowDate
);
if
(
flag
)
{
System
.
out
.
println
(
"该日期晚于今日"
);
}
else
{
System
.
out
.
println
(
"该日期早于今日"
);
}
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
}
else
{
System
.
out
.
println
(
"日期参数不可为空"
);
}
return
flag
;
}
/**
/**
* 比较两个时间的早晚
* 比较两个时间的早晚
*
*
...
@@ -300,7 +337,6 @@ public class LocalDateUtil {
...
@@ -300,7 +337,6 @@ public class LocalDateUtil {
}
}
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
boolean
hasOverlap
=
hasOverlap
(
parseLocalDate
(
"2022-08-03"
),
parseLocalDate
(
"2022-08-04"
),
parseLocalDate
(
"2022-08-03"
),
parseLocalDate
(
"2022-08-04"
));
System
.
out
.
println
(
isOverdueDate
(
"2022-08-03"
));
System
.
out
.
println
(
hasOverlap
);
}
}
}
}
yifu-insurances/yifu-insurances-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/insurances/service/impl/TInsuranceDetailServiceImpl.java
View file @
57a3f1fe
...
@@ -94,22 +94,22 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
...
@@ -94,22 +94,22 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
*/
*/
@Override
@Override
public
void
updateOverdueByTask
()
{
public
void
updateOverdueByTask
()
{
// 获取未
失效
的所有明细数据
// 获取未
过期
的所有明细数据
List
<
TInsuranceDetail
>
list
=
this
.
baseMapper
.
selectList
(
Wrappers
.<
TInsuranceDetail
>
query
().
lambda
()
List
<
TInsuranceDetail
>
list
=
this
.
baseMapper
.
selectList
(
Wrappers
.<
TInsuranceDetail
>
query
().
lambda
()
.
eq
(
TInsuranceDetail:
:
getIs
Effect
,
CommonConstants
.
ZERO_INT
)
.
eq
(
TInsuranceDetail:
:
getIs
Overdue
,
CommonConstants
.
ZERO_INT
)
.
eq
(
TInsuranceDetail:
:
getDeleteFlag
,
CommonConstants
.
ZERO_INT
)
.
eq
(
TInsuranceDetail:
:
getDeleteFlag
,
CommonConstants
.
ZERO_INT
)
);
);
if
(
CollectionUtils
.
isNotEmpty
(
list
)){
if
(
CollectionUtils
.
isNotEmpty
(
list
)){
log
.
info
(
"定时任务扫描到的
有效
数据是:{}条"
,
list
.
size
());
log
.
info
(
"定时任务扫描到的
未过期
数据是:{}条"
,
list
.
size
());
list
.
stream
().
forEach
(
e
->
{
list
.
stream
().
forEach
(
e
->
{
if
(!
LocalDateUtil
.
is
Futur
eDate
(
e
.
getPolicyEnd
().
toString
())){
if
(!
LocalDateUtil
.
is
Overdu
eDate
(
e
.
getPolicyEnd
().
toString
())){
e
.
setIs
Effect
(
CommonConstants
.
ONE_INT
);
e
.
setIs
Overdue
(
CommonConstants
.
ONE_INT
);
e
.
setUpdateTime
(
LocalDateTime
.
now
());
e
.
setUpdateTime
(
LocalDateTime
.
now
());
}
}
});
});
List
<
TInsuranceDetail
>
collect
=
list
.
stream
().
filter
(
e
->
e
.
getIs
Effect
()
==
CommonConstants
.
ONE_INT
).
collect
(
Collectors
.
toList
());
List
<
TInsuranceDetail
>
collect
=
list
.
stream
().
filter
(
e
->
e
.
getIs
Overdue
()
==
CommonConstants
.
ONE_INT
).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isNotEmpty
(
collect
)){
if
(
CollectionUtils
.
isNotEmpty
(
collect
)){
log
.
info
(
"定时任务扫描到的已
失效
数据是:{}条"
,
collect
.
size
());
log
.
info
(
"定时任务扫描到的已
过期
数据是:{}条"
,
collect
.
size
());
this
.
updateBatchById
(
collect
);
this
.
updateBatchById
(
collect
);
}
}
}
}
...
...
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