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
d670cce5
Commit
d670cce5
authored
Apr 19, 2024
by
chenzhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加自定义格式器用来处理动态日期入参
parent
61c6356f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
2 deletions
+39
-2
FlexibleDateFormatter.java
...s/boot/module/jxiop/biz/config/FlexibleDateFormatter.java
+37
-0
TDBigScreenAnalyseController.java
...le/jxiop/biz/controller/TDBigScreenAnalyseController.java
+2
-2
No files found.
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/config/FlexibleDateFormatter.java
0 → 100644
View file @
d670cce5
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
config
;
import
org.springframework.format.Formatter
;
import
org.springframework.stereotype.Component
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.Locale
;
@Component
public
class
FlexibleDateFormatter
implements
Formatter
<
Date
>
{
private
static
final
String
FORMAT_WITH_SECONDS
=
"yyyy-MM-dd HH:mm:ss"
;
private
static
final
String
FORMAT_WITH_HOURS
=
"yyyy-MM-dd HH"
;
private
static
final
String
FORMAT_WITHOUT_TIME
=
"yyyy-MM-dd"
;
@Override
public
Date
parse
(
String
text
,
Locale
locale
)
throws
ParseException
{
for
(
String
format
:
new
String
[]{
FORMAT_WITH_SECONDS
,
FORMAT_WITH_HOURS
,
FORMAT_WITHOUT_TIME
})
{
SimpleDateFormat
dateFormat
=
new
SimpleDateFormat
(
format
);
dateFormat
.
setLenient
(
false
);
try
{
return
dateFormat
.
parse
(
text
);
}
catch
(
ParseException
e
)
{
}
}
throw
new
ParseException
(
"Unable to parse date: "
+
text
,
0
);
}
@Override
public
String
print
(
Date
object
,
Locale
locale
)
{
return
null
;
}
}
\ No newline at end of file
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/controller/TDBigScreenAnalyseController.java
View file @
d670cce5
...
...
@@ -133,8 +133,8 @@ public class TDBigScreenAnalyseController extends BaseController {
public
ResponseModel
<
Map
<
String
,
Object
>>
getHealthListInfo
(
@RequestParam
(
required
=
false
)
String
areaCode
,
@RequestParam
(
required
=
false
)
String
stationCode
,
@RequestParam
(
required
=
false
)
String
area
,
@RequestParam
(
required
=
false
)
String
station
,
@RequestParam
(
required
=
false
)
String
analysisType
,
@RequestParam
(
required
=
false
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
Date
startTime
,
@RequestParam
(
required
=
false
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
Date
endTime
)
{
@RequestParam
(
required
=
false
)
Date
startTime
,
@RequestParam
(
required
=
false
)
Date
endTime
)
{
if
(
StrUtil
.
isNotEmpty
(
stationCode
))
{
StationBasic
stationBasic
=
stationBasicMapper
.
selectById
(
stationCode
);
...
...
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