Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张雷
/
fmboot
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
构建
提交
问题看板
文件
提交
网络
比较
分支
标签
49d66248
由
张雷
编写于
2023-04-24 11:20:21 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
奥体项目实时数据接口开发
1 个父辈
85d87b7a
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
164 行增加
和
13 行删除
fm-product/src/main/java/com/skua/modules/business/entity/WhatStructData.java
fm-product/src/main/java/com/skua/modules/business/service/impl/OlympicCenterServiceImpl.java
fm-product/src/main/java/com/skua/modules/business/entity/WhatStructData.java
0 → 100644
查看文件 @
49d6624
package
com
.
skua
.
modules
.
business
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
org.jeecgframework.poi.excel.annotation.Excel
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.util.Date
;
/**
* 奥体资产管理
*/
@Data
@TableName
(
"what_struct_data"
)
@ApiModel
(
value
=
"what_struct_data对象"
,
description
=
"奥体资产管理"
)
public
class
WhatStructData
{
/**主键id*/
@TableId
(
type
=
IdType
.
UUID
)
@ApiModelProperty
(
value
=
"主键id"
)
private
String
id
;
/**设备编码*/
@ApiModelProperty
(
value
=
"设备编码"
)
private
String
equipCode
;
/**设备类型*/
@ApiModelProperty
(
value
=
"设备类型"
)
private
String
equipType
;
/**所属系统*/
@ApiModelProperty
(
value
=
"所属系统"
)
private
String
systemCode
;
/**点表ID*/
@ApiModelProperty
(
value
=
"点表ID"
)
private
String
monitorId
;
/**点类型*/
@ApiModelProperty
(
value
=
"点类型"
)
private
String
monitorType
;
/**点实时值*/
@ApiModelProperty
(
value
=
"点实时值"
)
private
String
monitorValue
;
/**所属泵站*/
@ApiModelProperty
(
value
=
"所属泵站"
)
private
String
pumpCode
;
/**备注*/
@ApiModelProperty
(
value
=
"备注"
)
private
String
remark
;
/**创建人id*/
@ApiModelProperty
(
value
=
"创建人id"
)
private
String
createBy
;
/**创建时间*/
@JsonFormat
(
timezone
=
"GMT+8"
,
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@ApiModelProperty
(
value
=
"创建时间"
)
private
Date
createTime
;
/**修改人id*/
@ApiModelProperty
(
value
=
"修改人id"
)
private
String
updateBy
;
/**修改时间*/
@JsonFormat
(
timezone
=
"GMT+8"
,
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@ApiModelProperty
(
value
=
"修改时间"
)
private
Date
updateTime
;
/**所属部门*/
@ApiModelProperty
(
value
=
"所属部门"
)
private
String
createDept
;
/**所属公司*/
@ApiModelProperty
(
value
=
"所属公司"
)
private
String
createCmpy
;
/**删除标识*/
@ApiModelProperty
(
value
=
"删除标识"
)
private
Integer
delFlag
;
}
fm-product/src/main/java/com/skua/modules/business/service/impl/OlympicCenterServiceImpl.java
查看文件 @
49d6624
...
...
@@ -7,15 +7,19 @@ import com.skua.modules.business.mapper.WhatStructDataMapper;
import
com.skua.modules.business.service.IOlympicCenterService
;
import
com.skua.modules.business.vo.EchartResult
;
import
com.skua.modules.business.vo.TextResult
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.text.DateFormat
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
/**
* 武汉奥体中心接口
*/
@Slf4j
@Service
public
class
OlympicCenterServiceImpl
implements
IOlympicCenterService
{
...
...
@@ -224,11 +228,30 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
@Override
public
List
<
EchartResult
>
getWaterChart
(
String
sourceType
,
String
dateType
,
String
start
,
String
end
)
{
DateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
List
<
EchartResult
>
list
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
30
;
i
++)
{
if
(
"30"
.
equals
(
dateType
))
{
Calendar
date
=
Calendar
.
getInstance
();
date
.
add
(
Calendar
.
DATE
,
i
-
30
);
String
newDate
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
date
.
getTime
()).
substring
(
5
,
10
);
date
.
add
(
Calendar
.
DATE
,
-
30
);
start
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
date
.
getTime
());
end
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
new
Date
());
}
else
{
if
(
start
==
null
||
end
==
null
){
Calendar
date
=
Calendar
.
getInstance
();
date
.
add
(
Calendar
.
DATE
,
-
30
);
start
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
date
.
getTime
());
end
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
new
Date
());
}
}
try
{
Long
startTime
=
df
.
parse
(
start
).
getTime
();
Long
endTime
=
df
.
parse
(
end
).
getTime
();
Long
oneDay
=
1000
*
60
*
60
*
24
l
;
Long
time
=
startTime
;
if
(
"feed"
.
equals
(
sourceType
)){
while
(
time
<=
endTime
)
{
Date
d
=
new
Date
(
time
);
String
newDate
=
df
.
format
(
d
).
substring
(
5
,
10
);
EchartResult
rgsResult
=
new
EchartResult
();
rgsResult
.
setName
(
newDate
);
rgsResult
.
setValue
(
formatDouble
(
100
*
getRandom
(
2.00
,
3.00
)).
toString
());
...
...
@@ -237,13 +260,56 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
EchartResult
shResult
=
new
EchartResult
();
shResult
.
setName
(
newDate
);
shResult
.
setValue
(
formatDouble
(
getRandom
(
4.00
,
8.00
)).
toString
());
shResult
.
setSeries
(
"生活用水
"
);
shResult
.
setSeries
(
"生活用水1
"
);
list
.
add
(
shResult
);
EchartResult
xzResult
=
new
EchartResult
();
xzResult
.
setName
(
newDate
);
xzResult
.
setValue
(
formatDouble
(
getRandom
(
4.00
,
8.00
)).
toString
());
xzResult
.
setSeries
(
"行政用水
"
);
xzResult
.
setSeries
(
"生活用水2
"
);
list
.
add
(
xzResult
);
time
+=
oneDay
;
}
}
else
if
(
"hot"
.
equals
(
sourceType
)){
while
(
time
<=
endTime
)
{
Date
d
=
new
Date
(
time
);
String
newDate
=
df
.
format
(
d
).
substring
(
5
,
10
);
EchartResult
rgsResult
=
new
EchartResult
();
rgsResult
.
setName
(
newDate
);
rgsResult
.
setValue
(
formatDouble
(
100
*
getRandom
(
2.00
,
3.00
)).
toString
());
rgsResult
.
setSeries
(
"日供水量"
);
list
.
add
(
rgsResult
);
time
+=
oneDay
;
}
}
else
if
(
"fire"
.
equals
(
sourceType
)){
while
(
time
<=
endTime
)
{
Date
d
=
new
Date
(
time
);
String
newDate
=
df
.
format
(
d
).
substring
(
5
,
10
);
EchartResult
shResult
=
new
EchartResult
();
shResult
.
setName
(
newDate
);
shResult
.
setValue
(
formatDouble
(
getRandom
(
4.00
,
8.00
)).
toString
());
shResult
.
setSeries
(
"表1"
);
list
.
add
(
shResult
);
EchartResult
xzResult
=
new
EchartResult
();
xzResult
.
setName
(
newDate
);
xzResult
.
setValue
(
formatDouble
(
getRandom
(
4.00
,
8.00
)).
toString
());
xzResult
.
setSeries
(
"表2"
);
list
.
add
(
xzResult
);
time
+=
oneDay
;
}
}
else
{
while
(
time
<=
endTime
)
{
Date
d
=
new
Date
(
time
);
String
newDate
=
df
.
format
(
d
).
substring
(
5
,
10
);
EchartResult
rgsResult
=
new
EchartResult
();
rgsResult
.
setName
(
newDate
);
rgsResult
.
setValue
(
"--"
);
rgsResult
.
setSeries
(
"--"
);
list
.
add
(
rgsResult
);
time
+=
oneDay
;
}
}
}
catch
(
Exception
e
){
log
.
error
(
e
.
getMessage
());
}
return
list
;
}
...
...
@@ -305,14 +371,21 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
return
list
;
}
public
static
void
main
(
String
[]
args
)
{
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
add
(
Calendar
.
DATE
,
-
7
);
String
startDate
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
cal
.
getTime
());
String
start
=
startDate
+
" 00:00:00"
;
String
endDate
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
new
Date
());
String
end
=
endDate
+
" 23:59:59"
;
System
.
out
.
println
(
start
+
"-----"
+
end
);
public
static
void
main
(
String
[]
args
)
throws
ParseException
{
DateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
String
start
=
"2023-04-01"
;
String
end
=
"2023-04-24"
;
Long
startTime
=
df
.
parse
(
start
).
getTime
();
Long
endTime
=
df
.
parse
(
end
).
getTime
();
Long
oneDay
=
1000
*
60
*
60
*
24
l
;
Long
time
=
startTime
;
while
(
time
<=
endTime
)
{
Date
d
=
new
Date
(
time
);
System
.
out
.
println
(
df
.
format
(
d
));
time
+=
oneDay
;
}
}
@Override
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论