Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
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
项目统一框架
amos-boot-biz
Commits
5f1667e4
Commit
5f1667e4
authored
Oct 15, 2023
by
tianyiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
气瓶充装信息存入es优化
parent
ac793df0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
13 deletions
+30
-13
DateUtils.java
...ava/com/yeejoin/amos/boot/biz/common/utils/DateUtils.java
+23
-6
CylinderFillingRecordServiceImpl.java
...lc/biz/service/impl/CylinderFillingRecordServiceImpl.java
+7
-7
No files found.
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/utils/DateUtils.java
View file @
5f1667e4
...
...
@@ -6,12 +6,8 @@ import java.text.ParseException;
import
java.text.ParsePosition
;
import
java.text.SimpleDateFormat
;
import
java.time.LocalDate
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Locale
;
import
java.util.TimeZone
;
import
java.util.*
;
/**
* @description: 时间工具类
* @author: DELL
...
...
@@ -219,6 +215,27 @@ public class DateUtils {
}
/**
* 字符串解析成时间对象
*
* @param dateTimeString String
* @param pattern StrUtils.DATE_TIME_PATTERN || StrUtils.DATE_PATTERN,如果为空,则为yyyy-MM-dd
* @return
* @throws ParseException
*/
public
static
Date
dateParseWithPattern
(
String
dateTimeString
)
throws
ParseException
{
List
<
String
>
dateFormats
=
Arrays
.
asList
(
DateUtils
.
DATE_TIME_PATTERN
,
DateUtils
.
DATE_PATTERN
);
for
(
String
format:
dateFormats
){
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
format
);
try
{
return
sdf
.
parse
(
dateTimeString
);
}
catch
(
ParseException
e
)
{
//intentionally empty
}
}
return
null
;
}
/**
* 将日期时间格式成只有日期的字符串(可以直接使用dateFormat,Pattern为Null进行格式化)
*
* @param dateTime Date
...
...
amos-boot-system-tzs/amos-boot-module-cylinder/amos-boot-module-cylinder-biz/src/main/java/com/yeejoin/amos/boot/module/cylinder/flc/biz/service/impl/CylinderFillingRecordServiceImpl.java
View file @
5f1667e4
...
...
@@ -152,8 +152,8 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
item
.
setCreditCode
(
collect
.
get
(
0
).
getCreditCode
());
item
.
setRegionCode
(
collect
.
get
(
0
).
getRegionCode
());
try
{
item
.
setInspectionDateMs
(
ObjectUtils
.
isEmpty
(
item
.
get
InspectionDate
())
?
0L
:
DateUtils
.
dateParse
(
item
.
getInspectionDate
(),
DateUtils
.
DATE_TIME_PATTERN
).
getTime
());
item
.
setInspectionDateAfterMS
(
ObjectUtils
.
isEmpty
(
item
.
get
InspectionDateAfter
())
?
0L
:
DateUtils
.
dateParse
(
item
.
getInspectionDateAfter
(),
DateUtils
.
DATE_TIME_PATTERN
).
getTime
());
item
.
setInspectionDateMs
(
ObjectUtils
.
isEmpty
(
item
.
get
FillingStartTime
())
?
0L
:
DateUtils
.
dateParseWithPattern
(
item
.
getFillingStartTime
()
).
getTime
());
item
.
setInspectionDateAfterMS
(
ObjectUtils
.
isEmpty
(
item
.
get
FillingEndTime
())
?
0L
:
DateUtils
.
dateParseWithPattern
(
item
.
getFillingEndTime
()
).
getTime
());
}
catch
(
ParseException
e
)
{
throw
new
RuntimeException
(
e
);
}
...
...
@@ -188,8 +188,8 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
item
.
setCreditCode
(
collect
.
get
(
0
).
getCreditCode
());
item
.
setRegionCode
(
collect
.
get
(
0
).
getRegionCode
());
try
{
item
.
setInspectionDateMs
(
ObjectUtils
.
isEmpty
(
item
.
get
InspectionDate
())
?
0L
:
DateUtils
.
dateParse
(
item
.
getInspectionDate
(),
DateUtils
.
DATE_TIME_PATTERN
).
getTime
());
item
.
setInspectionDateAfterMS
(
ObjectUtils
.
isEmpty
(
item
.
get
InspectionDateAfter
())
?
0L
:
DateUtils
.
dateParse
(
item
.
getInspectionDateAfter
(),
DateUtils
.
DATE_TIME_PATTERN
).
getTime
());
item
.
setInspectionDateMs
(
ObjectUtils
.
isEmpty
(
item
.
get
FillingStartTime
())
?
0L
:
DateUtils
.
dateParseWithPattern
(
item
.
getFillingStartTime
()
).
getTime
());
item
.
setInspectionDateAfterMS
(
ObjectUtils
.
isEmpty
(
item
.
get
FillingEndTime
())
?
0L
:
DateUtils
.
dateParseWithPattern
(
item
.
getFillingEndTime
()
).
getTime
());
}
catch
(
ParseException
e
)
{
throw
new
RuntimeException
(
e
);
}
...
...
@@ -223,7 +223,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
List
<
String
>
sequenceCodeS
=
cylinderFillingRecord
.
stream
().
map
(
ESCylinderFillingRecordDto:
:
getSequenceCode
).
collect
(
Collectors
.
toList
());
List
<
ESCylinderFillingRecordDto
>
cylinderFillingRecordInfo
=
cylinderFillingRecordMapper
.
getCylinderFillingRecordInfo
(
appIds
,
sequenceCodeS
);
cylinderFillingRecord
.
stream
().
map
(
item
->
{
List
<
ESCylinderFillingRecordDto
>
collect
=
cylinderFillingRecordInfo
.
stream
().
filter
(
e
->
item
.
getAppIdAndSequenceCode
().
equals
(
e
.
getAppIdAndSequenceCode
())).
collect
(
Collectors
.
toList
());
List
<
ESCylinderFillingRecordDto
>
collect
=
cylinderFillingRecordInfo
.
stream
().
filter
(
e
->
e
.
getAppIdAndSequenceCode
().
equals
(
item
.
getAppIdAndSequenceCode
())).
collect
(
Collectors
.
toList
());
if
(!
ObjectUtils
.
isEmpty
(
collect
))
{
item
.
setUnitName
(
collect
.
get
(
0
).
getUnitName
());
item
.
setFactoryNum
(
collect
.
get
(
0
).
getFactoryNum
());
...
...
@@ -237,8 +237,8 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
item
.
setCreditCode
(
collect
.
get
(
0
).
getCreditCode
());
item
.
setRegionCode
(
collect
.
get
(
0
).
getRegionCode
());
try
{
item
.
setInspectionDateMs
(
ObjectUtils
.
isEmpty
(
item
.
get
InspectionDate
())
?
0L
:
DateUtils
.
dateParse
(
item
.
getInspectionDate
(),
DateUtils
.
DATE_TIME_PATTERN
).
getTime
());
item
.
setInspectionDateAfterMS
(
ObjectUtils
.
isEmpty
(
item
.
get
InspectionDateAfter
())
?
0L
:
DateUtils
.
dateParse
(
item
.
getInspectionDateAfter
(),
DateUtils
.
DATE_TIME_PATTERN
).
getTime
());
item
.
setInspectionDateMs
(
ObjectUtils
.
isEmpty
(
item
.
get
FillingStartTime
())
?
0L
:
DateUtils
.
dateParseWithPattern
(
item
.
getFillingStartTime
()
).
getTime
());
item
.
setInspectionDateAfterMS
(
ObjectUtils
.
isEmpty
(
item
.
get
FillingEndTime
())
?
0L
:
DateUtils
.
dateParseWithPattern
(
item
.
getFillingEndTime
()
).
getTime
());
}
catch
(
ParseException
e
)
{
throw
new
RuntimeException
(
e
);
}
...
...
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