Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张雷
/
fmboot
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
构建
提交
问题看板
文件
提交
网络
比较
分支
标签
e1e02a5c
由
张雷
编写于
2023-07-21 13:13:35 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
奥体项目时间粒度修改
1 个父辈
af6e5325
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
38 行增加
和
4 行删除
fm-product/src/main/java/com/skua/modules/business/service/impl/OlympicCenterServiceImpl.java
fm-product/src/main/java/com/skua/modules/business/service/impl/OlympicCenterServiceImpl.java
查看文件 @
e1e02a5
...
...
@@ -949,7 +949,9 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
if
(
dataList
.
size
()>
0
){
for
(
Map
<
String
,
Object
>
map:
dataList
)
{
EchartResult
echartResult
=
new
EchartResult
();
echartResult
.
setName
(
map
.
get
(
"time"
).
toString
());
String
datatime
=
map
.
get
(
"time"
).
toString
();
datatime
=
datatime
.
substring
(
5
,
16
);
echartResult
.
setName
(
datatime
);
if
(
"p"
.
equals
(
type
)){
if
(
map
.
get
(
wList
.
get
(
0
).
getMonitorId
())==
null
){
echartResult
.
setValue
(
""
);
...
...
@@ -962,7 +964,9 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
}
else
if
(
"f"
.
equals
(
type
)){
for
(
WhatStructData
whatStructData:
wList
)
{
EchartResult
eResult
=
new
EchartResult
();
eResult
.
setName
(
map
.
get
(
"time"
).
toString
());
String
dtime
=
map
.
get
(
"time"
).
toString
();
dtime
=
dtime
.
substring
(
5
,
16
);
eResult
.
setName
(
dtime
);
if
(
whatStructData
.
getMonitorId
()==
null
){
eResult
.
setValue
(
""
);
}
else
{
...
...
@@ -1593,7 +1597,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
String
timeType
=
inputQueryParams
.
getTimeType
();
if
(
"today"
.
equals
(
timeType
)){
timeStep
=
"hour"
;
start
=
endDate
+
" 00:00:00"
;
start
=
get24DateTime
(
new
Date
())
;
end
=
endDate
+
" 23:59:59"
;
}
else
if
(
"week"
.
equals
(
timeType
)){
timeStep
=
"hour"
;
...
...
@@ -1638,6 +1642,13 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
for
(
Map
.
Entry
<
String
,
Object
>
entry
:
bmap
.
entrySet
())
{
if
(
"time"
.
equals
(
entry
.
getKey
())){
time
=
entry
.
getValue
().
toString
();
if
(
"today"
.
equals
(
timeType
)){
time
=
time
.
substring
(
11
,
16
);
}
else
if
(
"week"
.
equals
(
timeType
)){
time
=
time
.
substring
(
5
,
16
);
}
else
{
time
=
time
.
substring
(
5
,
10
);
}
}
}
for
(
Map
.
Entry
<
String
,
Object
>
entry
:
bmap
.
entrySet
())
{
...
...
@@ -1658,6 +1669,13 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
for
(
Map
.
Entry
<
String
,
Object
>
entry
:
bmap
.
entrySet
())
{
if
(
"time"
.
equals
(
entry
.
getKey
())){
time
=
entry
.
getValue
().
toString
();
if
(
"today"
.
equals
(
timeType
)){
time
=
time
.
substring
(
11
,
16
);
}
else
if
(
"week"
.
equals
(
timeType
)){
time
=
time
.
substring
(
5
,
16
);
}
else
{
time
=
time
.
substring
(
5
,
10
);
}
}
}
for
(
Map
.
Entry
<
String
,
Object
>
entry
:
bmap
.
entrySet
())
{
...
...
@@ -1677,6 +1695,22 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
return
map
;
}
public
String
get24DateTime
(
Date
currentDate
){
// 创建 Calendar 对象,并设置为当前时间
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTime
(
currentDate
);
// 往前推 24 小时
calendar
.
add
(
Calendar
.
HOUR_OF_DAY
,
-
24
);
// 获取推算后的时间
Date
previousDate
=
calendar
.
getTime
();
// 格式化时间为 "yyyy-MM-dd" 形式
SimpleDateFormat
dateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
String
formattedDate
=
dateFormat
.
format
(
previousDate
);
// System.out.println("当前时间: " + dateFormat.format(currentDate));
// System.out.println("往前 24 小时的时间: " + formattedDate);
return
formattedDate
;
}
@Override
public
List
<
EchartResult
>
getHistoryTrendsByDate
(
InputQueryParams
inputQueryParams
)
{
List
<
EchartResult
>
list
=
new
ArrayList
<>();
...
...
@@ -1700,7 +1734,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
String
timeType
=
inputQueryParams
.
getTimeType
();
if
(
"today"
.
equals
(
timeType
)){
timeStep
=
"hour"
;
start
=
endDate
+
" 00:00:00"
;
start
=
get24DateTime
(
new
Date
())
;
end
=
endDate
+
" 23:59:59"
;
}
else
if
(
"week"
.
equals
(
timeType
)){
timeStep
=
"hour"
;
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论