Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张雷
/
fmboot
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
构建
提交
问题看板
文件
提交
网络
比较
分支
标签
f8d3f276
由
张雷
编写于
2023-08-14 16:57:39 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
奥体项目接口修改
1 个父辈
035378aa
全部展开
显示空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
122 行增加
和
15 行删除
fm-product/src/main/java/com/skua/modules/business/controller/OlympicCenterController.java
fm-product/src/main/java/com/skua/modules/business/service/IOlympicCenterService.java
fm-product/src/main/java/com/skua/modules/business/service/impl/OlympicCenterServiceImpl.java
fm-product/src/main/java/com/skua/modules/business/vo/SumFlowParams.java
fm-product/src/main/java/com/skua/modules/monitor/service/IFmPgQueryService.java
fm-product/src/main/java/com/skua/modules/monitor/service/impl/FmPgQueryServiceImpl.java
fm-system/src/main/resources/application-prod.yml
fm-system/src/main/resources/application.yml
fm-product/src/main/java/com/skua/modules/business/controller/OlympicCenterController.java
查看文件 @
f8d3f27
...
...
@@ -261,4 +261,26 @@ public class OlympicCenterController {
result
.
setSuccess
(
true
);
return
result
;
}
@ApiOperation
(
value
=
"获取相同月份的累计流量数据"
,
notes
=
"获取相同月份的累计流量数据"
)
@GetMapping
(
value
=
"/getYearMonthSumFlow"
)
public
Result
<
Map
<
String
,
Object
>>
getYearMonthSumFlow
(
SumFlowParams
sumFlowParams
){
Result
<
Map
<
String
,
Object
>>
result
=
new
Result
<
Map
<
String
,
Object
>>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
=
olympicCenterService
.
getYearMonthSumFlow
(
sumFlowParams
);
result
.
setResult
(
map
);
result
.
setSuccess
(
true
);
return
result
;
}
@ApiOperation
(
value
=
"获取年度的累计流量数据"
,
notes
=
"获取年度的累计流量数据"
)
@GetMapping
(
value
=
"/getYearSumFlow"
)
public
Result
<
Map
<
String
,
Object
>>
getYearSumFlow
(
SumFlowParams
sumFlowParams
){
Result
<
Map
<
String
,
Object
>>
result
=
new
Result
<
Map
<
String
,
Object
>>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
=
olympicCenterService
.
getYearSumFlow
(
sumFlowParams
);
result
.
setResult
(
map
);
result
.
setSuccess
(
true
);
return
result
;
}
}
...
...
fm-product/src/main/java/com/skua/modules/business/service/IOlympicCenterService.java
查看文件 @
f8d3f27
...
...
@@ -49,4 +49,8 @@ public interface IOlympicCenterService {
List
<
Map
<
String
,
Object
>>
getAlarmList
(
AlarmParams
alarmParams
);
Map
<
String
,
Object
>
getSumFlowData
(
SumFlowParams
sumFlowParams
);
Map
<
String
,
Object
>
getYearMonthSumFlow
(
SumFlowParams
sumFlowParams
);
Map
<
String
,
Object
>
getYearSumFlow
(
SumFlowParams
sumFlowParams
);
}
...
...
fm-product/src/main/java/com/skua/modules/business/service/impl/OlympicCenterServiceImpl.java
查看文件 @
f8d3f27
此文件的差异被折叠,
点击展开。
fm-product/src/main/java/com/skua/modules/business/vo/SumFlowParams.java
查看文件 @
f8d3f27
...
...
@@ -10,9 +10,16 @@ public class SumFlowParams {
/**聚合类型 日:day, 月:month,年:year*/
private
String
sumType
;
/**开始时间 yyyy-MM-DD*/
private
String
start
;
/**结束时间 yyyy-MM-DD*/
private
String
end
;
/**时间 年月 yyyy-MM*/
private
String
yearMonth
;
/**时间 年 yyyy*/
private
String
year
;
}
...
...
fm-product/src/main/java/com/skua/modules/monitor/service/IFmPgQueryService.java
查看文件 @
f8d3f27
...
...
@@ -21,10 +21,13 @@ public interface IFmPgQueryService {
* @param tableType 表类型 0实时 1计算
* @return
*/
public
List
<
Map
<
String
,
Object
>>
queryFactoryInfos
(
String
departId
,
String
fields
,
String
startTime
,
String
endTime
,
String
tableType
);
List
<
Map
<
String
,
Object
>>
queryFactoryInfos
(
String
departId
,
String
fields
,
String
startTime
,
String
endTime
,
String
tableType
);
public
List
<
Map
<
String
,
Object
>>
queryReportData
(
String
departId
,
String
fields
,
String
startTime
,
String
endTime
,
String
reportType
);
List
<
Map
<
String
,
Object
>>
queryReportData
(
String
departId
,
String
fields
,
String
startTime
,
String
endTime
,
String
reportType
);
public
List
<
Map
<
String
,
Object
>>
queryAotiCurveData
(
String
fields
,
String
startTime
,
String
endTime
,
String
sumType
,
int
strCount
);
List
<
Map
<
String
,
Object
>>
queryAotiCurveData
(
String
fields
,
String
startTime
,
String
endTime
,
String
sumType
,
int
strCount
);
List
<
Map
<
String
,
Object
>>
queryAotiCurveDataByMonth
(
String
fields
,
String
startTime
,
String
endTime
,
String
month
);
List
<
Map
<
String
,
Object
>>
queryAotiCurveDataByYear
(
String
fields
,
String
startTime
,
String
endTime
);
}
...
...
fm-product/src/main/java/com/skua/modules/monitor/service/impl/FmPgQueryServiceImpl.java
查看文件 @
f8d3f27
...
...
@@ -393,4 +393,75 @@ public class FmPgQueryServiceImpl implements IFmPgQueryService {
}
return
dataList
;
}
@Override
public
List
<
Map
<
String
,
Object
>>
queryAotiCurveDataByMonth
(
String
fields
,
String
startTime
,
String
endTime
,
String
month
)
{
List
<
Map
<
String
,
Object
>>
dataList
=
new
ArrayList
<>();
//获取数据采集pg数据库,实时数据获取统一从数据采集pg库获取
JdbcTemplate
pgDB
=
(
JdbcTemplate
)
SpringContextUtils
.
getBean
(
"pg-db"
);
String
countTableName
=
"a01a21a03_count"
;
//获取要查询的指标
String
fieldSqlPart
=
""
;
String
[]
fieldsArr
=
fields
.
split
(
","
);
for
(
int
i
=
0
;
i
<
fieldsArr
.
length
;
++
i
){
fieldSqlPart
=
fieldSqlPart
+
(
",'"
+
fieldsArr
[
i
]+
"'"
);
}
if
(!
StringUtils
.
isEmpty
(
fieldSqlPart
))
{
fieldSqlPart
=
fieldSqlPart
.
substring
(
1
);
}
try
{
String
tsStartTime
=
String
.
valueOf
(
DateUtils
.
getMillis
(
DateUtils
.
parseDate
(
startTime
,
"yyyy-MM-dd HH:mm:ss"
))/
1000
);
String
tsEndTime
=
String
.
valueOf
(
DateUtils
.
getMillis
(
DateUtils
.
parseDate
(
endTime
,
"yyyy-MM-dd HH:mm:ss"
))/
1000
);
String
sql
=
"SELECT * FROM ("
+
"SELECT nm, "
+
" LEFT(TO_CHAR(TO_TIMESTAMP(CAST(ts AS INTEGER)), 'YYYY-MM-DD HH24:MI:SS'), 7) AS time, "
+
" SUM(v::numeric) AS value "
+
" FROM "
+
countTableName
+
" WHERE nm in ("
+
fieldSqlPart
+
")"
+
" AND type = 'def'"
+
" AND ts >= ? AND ts < ? "
+
" GROUP BY nm, time "
+
" ORDER BY time"
+
") a "
+
"WHERE RIGHT(a.time,2) = '"
+
month
+
"' "
;
dataList
=
pgDB
.
queryForList
(
sql
,
tsStartTime
,
tsEndTime
);
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
return
dataList
;
}
@Override
public
List
<
Map
<
String
,
Object
>>
queryAotiCurveDataByYear
(
String
fields
,
String
startTime
,
String
endTime
)
{
List
<
Map
<
String
,
Object
>>
dataList
=
new
ArrayList
<>();
//获取数据采集pg数据库,实时数据获取统一从数据采集pg库获取
JdbcTemplate
pgDB
=
(
JdbcTemplate
)
SpringContextUtils
.
getBean
(
"pg-db"
);
String
countTableName
=
"a01a21a03_count"
;
//获取要查询的指标
String
fieldSqlPart
=
""
;
String
[]
fieldsArr
=
fields
.
split
(
","
);
for
(
int
i
=
0
;
i
<
fieldsArr
.
length
;
++
i
){
fieldSqlPart
=
fieldSqlPart
+
(
",'"
+
fieldsArr
[
i
]+
"'"
);
}
if
(!
StringUtils
.
isEmpty
(
fieldSqlPart
))
{
fieldSqlPart
=
fieldSqlPart
.
substring
(
1
);
}
try
{
String
tsStartTime
=
String
.
valueOf
(
DateUtils
.
getMillis
(
DateUtils
.
parseDate
(
startTime
,
"yyyy-MM-dd HH:mm:ss"
))/
1000
);
String
tsEndTime
=
String
.
valueOf
(
DateUtils
.
getMillis
(
DateUtils
.
parseDate
(
endTime
,
"yyyy-MM-dd HH:mm:ss"
))/
1000
);
String
sql
=
"SELECT nm, "
+
" LEFT(TO_CHAR(TO_TIMESTAMP(CAST(ts AS INTEGER)), 'YYYY-MM-DD HH24:MI:SS'), 4) AS time, "
+
" SUM(v::numeric) AS value "
+
" FROM "
+
countTableName
+
" WHERE nm in ("
+
fieldSqlPart
+
")"
+
" AND type = 'def'"
+
" AND ts >= ? AND ts < ? "
+
" GROUP BY nm, time "
+
" ORDER BY time"
;
dataList
=
pgDB
.
queryForList
(
sql
,
tsStartTime
,
tsEndTime
);
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
return
dataList
;
}
}
...
...
fm-system/src/main/resources/application-prod.yml
查看文件 @
f8d3f27
...
...
@@ -96,17 +96,17 @@ spring:
username
:
jk_test
password
:
Jk_test1211rw
driver-class-name
:
com.mysql.jdbc.Driver
#
mysql-alarm:
#
url: jdbc:mysql://47.104.99.86:3306/intelligent-devices?characterEncoding=UTF-8&useUnicode=true&useSSL=false
#
username: id_rw
#
password: s2eCvUEPO2Vk3U1w
#
driver-class-name: com.mysql.jdbc.Driver
#
# 多数据源配置
#
pg-db:
#
url: jdbc:postgresql://47.104.99.86:10086/postgres?useUnicode=true&characterEncoding=UTF8
#
username: postgres
#
password: JKjnf9713xt
#
driver-class-name: org.postgresql.Driver
mysql-alarm
:
url
:
jdbc:mysql://47.104.99.86:3306/intelligent-devices?characterEncoding=UTF-8&useUnicode=true&useSSL=false
username
:
id_rw
password
:
s2eCvUEPO2Vk3U1w
driver-class-name
:
com.mysql.jdbc.Driver
# 多数据源配置
pg-db
:
url
:
jdbc:postgresql://47.104.99.86:10086/postgres?useUnicode=true&characterEncoding=UTF8
username
:
postgres
password
:
JKjnf9713xt
driver-class-name
:
org.postgresql.Driver
#redis 配置
redis
:
database
:
0
...
...
fm-system/src/main/resources/application.yml
查看文件 @
f8d3f27
spring
:
profiles
:
active
:
dev
active
:
prod
# 信息安全
security
:
csrf
:
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论