Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gassafety
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
耿迪迪
gassafety
Commits
7a19c5cc
Commit
7a19c5cc
authored
Jan 12, 2022
by
耿迪迪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
设备上报统计 gengdidi
parent
e64e700e
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
473 additions
and
0 deletions
+473
-0
DeviceStatisticsContorller.java
...controller/dataMonitoring/DeviceStatisticsContorller.java
+52
-0
DeviceStatistics.java
.../main/java/com/zehong/system/domain/DeviceStatistics.java
+72
-0
DeviceStatisticsMapper.java
...java/com/zehong/system/mapper/DeviceStatisticsMapper.java
+28
-0
DeviceStatisticsService.java
...va/com/zehong/system/service/DeviceStatisticsService.java
+28
-0
DeviceStatisticsServiceImpl.java
...hong/system/service/impl/DeviceStatisticsServiceImpl.java
+42
-0
DeviceStatisticsMapper.xml
...c/main/resources/mapper/system/DeviceStatisticsMapper.xml
+65
-0
deviceStatistics.js
gassafety-web/src/api/dataMonitoring/deviceStatistics.js
+19
-0
index.vue
...y-web/src/views/dataMonitoring/deviceStatistics/index.vue
+167
-0
No files found.
gassafety-admin/src/main/java/com/zehong/web/controller/dataMonitoring/DeviceStatisticsContorller.java
0 → 100644
View file @
7a19c5cc
package
com
.
zehong
.
web
.
controller
.
dataMonitoring
;
import
com.github.pagehelper.PageInfo
;
import
com.zehong.common.core.controller.BaseController
;
import
com.zehong.common.core.page.TableDataInfo
;
import
com.zehong.system.domain.DeviceStatistics
;
import
com.zehong.system.service.DeviceStatisticsService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.List
;
@RestController
@RequestMapping
(
"/dataMonitoring/deviceStatistics"
)
public
class
DeviceStatisticsContorller
extends
BaseController
{
@Autowired
private
DeviceStatisticsService
deviceStatisticsService
;
@GetMapping
(
"/getDeviceStatisticsInfo"
)
public
TableDataInfo
getDeviceStatisticsInfo
(
DeviceStatistics
deviceStatistics
){
if
(
null
==
deviceStatistics
.
getStartTime
()){
Calendar
startTime
=
Calendar
.
getInstance
();
startTime
.
add
(
Calendar
.
DATE
,
-
7
);
deviceStatistics
.
setStartTime
(
startTime
.
getTime
());
}
if
(
null
==
deviceStatistics
.
getEndTime
()){
deviceStatistics
.
setEndTime
(
new
Date
());
}
startPage
();
//设备统计结束时间累计流量
PageInfo
<
DeviceStatistics
>
deviceStatisticsEndListInfo
=
deviceStatisticsService
.
getDeviceEndStandardConditionAccumulation
(
deviceStatistics
);
//设备统计开始时间累计流量
List
<
DeviceStatistics
>
deviceStatisticsStartListInfo
=
deviceStatisticsService
.
getDeviceStartStandardConditionAccumulation
(
deviceStatistics
);
for
(
DeviceStatistics
deviceStatisticsEndInfo
:
deviceStatisticsEndListInfo
.
getList
()){
for
(
DeviceStatistics
deviceStatisticsStartInfo
:
deviceStatisticsStartListInfo
){
if
(
deviceStatisticsEndInfo
.
getDeviceNum
().
equals
(
deviceStatisticsStartInfo
.
getDeviceNum
())){
deviceStatisticsEndInfo
.
setStartTime
(
deviceStatisticsStartInfo
.
getStartTime
());
deviceStatisticsEndInfo
.
setStandardConditionAccumulation
(
deviceStatisticsEndInfo
.
getStandardConditionAccumulation
().
subtract
(
deviceStatisticsStartInfo
.
getStandardConditionAccumulation
()));
}
}
}
return
getDataTable
(
deviceStatisticsEndListInfo
);
}
}
gassafety-system/src/main/java/com/zehong/system/domain/DeviceStatistics.java
0 → 100644
View file @
7a19c5cc
package
com
.
zehong
.
system
.
domain
;
import
java.math.BigDecimal
;
import
java.util.Date
;
public
class
DeviceStatistics
{
/**
* 设备编号
*/
private
String
deviceNum
;
/**
* 设备名称
*/
private
String
deviceName
;
/**
* 设备统计开始时间
*/
private
Date
startTime
;
/**
* 设备统计结束时间
*/
private
Date
endTime
;
/**
* 设备标况累计流量
*/
private
BigDecimal
standardConditionAccumulation
;
public
String
getDeviceNum
()
{
return
deviceNum
;
}
public
void
setDeviceNum
(
String
deviceNum
)
{
this
.
deviceNum
=
deviceNum
;
}
public
String
getDeviceName
()
{
return
deviceName
;
}
public
void
setDeviceName
(
String
deviceName
)
{
this
.
deviceName
=
deviceName
;
}
public
Date
getStartTime
()
{
return
startTime
;
}
public
void
setStartTime
(
Date
startTime
)
{
this
.
startTime
=
startTime
;
}
public
Date
getEndTime
()
{
return
endTime
;
}
public
void
setEndTime
(
Date
endTime
)
{
this
.
endTime
=
endTime
;
}
public
BigDecimal
getStandardConditionAccumulation
()
{
return
standardConditionAccumulation
;
}
public
void
setStandardConditionAccumulation
(
BigDecimal
standardConditionAccumulation
)
{
this
.
standardConditionAccumulation
=
standardConditionAccumulation
;
}
}
gassafety-system/src/main/java/com/zehong/system/mapper/DeviceStatisticsMapper.java
0 → 100644
View file @
7a19c5cc
package
com
.
zehong
.
system
.
mapper
;
import
com.zehong.system.domain.DeviceStatistics
;
import
java.util.Date
;
import
java.util.List
;
/**
* 设备流量统计
* @author gengd
*/
public
interface
DeviceStatisticsMapper
{
/**
* 根据统计时间获取开始标况累计流量
* @param deviceStatistics
* @return
*/
List
<
DeviceStatistics
>
getDeviceStartStandardConditionAccumulation
(
DeviceStatistics
deviceStatistics
);
/**
* 根据统计时间获取结束标况累计流量
* @param deviceStatistics
* @return
*/
List
<
DeviceStatistics
>
getDeviceEndStandardConditionAccumulation
(
DeviceStatistics
deviceStatistics
);
}
gassafety-system/src/main/java/com/zehong/system/service/DeviceStatisticsService.java
0 → 100644
View file @
7a19c5cc
package
com
.
zehong
.
system
.
service
;
import
com.github.pagehelper.PageInfo
;
import
com.zehong.system.domain.DeviceStatistics
;
import
java.util.List
;
/**
* 设备流量统计
* @author gengd
*/
public
interface
DeviceStatisticsService
{
/**
* 根据统计时间获取开始标况累计流量
* @param deviceStatistics
* @return
*/
List
<
DeviceStatistics
>
getDeviceStartStandardConditionAccumulation
(
DeviceStatistics
deviceStatistics
);
/**
* 根据统计时间获取结束标况累计流量
* @param deviceStatistics
* @return
*/
PageInfo
<
DeviceStatistics
>
getDeviceEndStandardConditionAccumulation
(
DeviceStatistics
deviceStatistics
);
}
gassafety-system/src/main/java/com/zehong/system/service/impl/DeviceStatisticsServiceImpl.java
0 → 100644
View file @
7a19c5cc
package
com
.
zehong
.
system
.
service
.
impl
;
import
com.github.pagehelper.PageInfo
;
import
com.zehong.system.domain.DeviceStatistics
;
import
com.zehong.system.mapper.DeviceStatisticsMapper
;
import
com.zehong.system.service.DeviceStatisticsService
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.List
;
/**
* 设备流量统计
* @author gengd
*/
@Service
public
class
DeviceStatisticsServiceImpl
implements
DeviceStatisticsService
{
@Resource
private
DeviceStatisticsMapper
deviceStatisticsMapper
;
/**
* 根据统计时间获取开始标况累计流量
* @param deviceStatistics
* @return
*/
@Override
public
List
<
DeviceStatistics
>
getDeviceStartStandardConditionAccumulation
(
DeviceStatistics
deviceStatistics
)
{
return
deviceStatisticsMapper
.
getDeviceStartStandardConditionAccumulation
(
deviceStatistics
);
}
/**
* 根据统计时间获取结束标况累计流量
* @param deviceStatistics
* @return
*/
@Override
public
PageInfo
<
DeviceStatistics
>
getDeviceEndStandardConditionAccumulation
(
DeviceStatistics
deviceStatistics
)
{
return
new
PageInfo
(
deviceStatisticsMapper
.
getDeviceEndStandardConditionAccumulation
(
deviceStatistics
));
}
}
gassafety-system/src/main/resources/mapper/system/DeviceStatisticsMapper.xml
0 → 100644
View file @
7a19c5cc
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.zehong.system.mapper.DeviceStatisticsMapper"
>
<sql
id=
"selectConfigVo"
>
select config_id, config_name, config_key, config_value, config_type, create_by, create_time, update_by, update_time, remark
from sys_config
</sql>
<select
id=
"getDeviceStartStandardConditionAccumulation"
parameterType=
"com.zehong.system.domain.DeviceStatistics"
resultType=
"com.zehong.system.domain.DeviceStatistics"
>
SELECT
t.device_num AS deviceNum,
t.device_name AS deviceName,
t.startTime,
re.standard_condition_accumulation AS standardConditionAccumulation
FROM
t_device_report_data re,
(
SELECT
device.iot_no AS device_num,
device.device_name,
MIN(d.create_time) as startTime
FROM
t_device_report_data d,t_device_info device
where d.create_time BETWEEN #{ startTime } AND #{ endTime }
AND d.device_num = device.iot_no
AND device.device_type = '3'
GROUP BY d.device_num
)t
WHERE
re.create_time = t.startTime AND re.device_num = t.device_num
</select>
<select
id=
"getDeviceEndStandardConditionAccumulation"
parameterType=
"com.zehong.system.domain.DeviceStatistics"
resultType=
"com.zehong.system.domain.DeviceStatistics"
>
SELECT
t.device_num AS deviceNum,
t.device_name AS deviceName,
t.endTime,
re.standard_condition_accumulation AS standardConditionAccumulation
FROM
t_device_report_data re,
(
SELECT
device.iot_no AS device_num,
device.device_name,
MAX(d.create_time) as endTime
FROM
t_device_report_data d,t_device_info device
where d.create_time BETWEEN #{ startTime } AND #{ endTime }
AND d.device_num = device.iot_no
AND device.device_type = '3'
GROUP BY d.device_num
)t
WHERE
re.create_time = t.endTime AND re.device_num = t.device_num
</select>
</mapper>
\ No newline at end of file
gassafety-web/src/api/dataMonitoring/deviceStatistics.js
0 → 100644
View file @
7a19c5cc
import
request
from
'@/utils/request'
// 查询设备监控列表
export
function
getDeviceStatisticsInfo
(
query
)
{
return
request
({
url
:
'/dataMonitoring/deviceStatistics/getDeviceStatisticsInfo'
,
method
:
'get'
,
params
:
query
})
}
// 导出设备监控
export
function
exportData
(
query
)
{
return
request
({
url
:
'/dataMonitoring/reportData/export'
,
method
:
'get'
,
params
:
query
})
}
gassafety-web/src/views/dataMonitoring/deviceStatistics/index.vue
0 → 100644
View file @
7a19c5cc
<
template
>
<div
class=
"app-container"
>
<el-form
:model=
"queryParams"
ref=
"queryForm"
:inline=
"true"
v-show=
"showSearch"
label-width=
"68px"
>
<el-form-item
label=
"设备编号"
prop=
"deviceThreshold"
>
<el-input
v-model=
"queryParams.deviceThreshold"
placeholder=
"请输入设备阈值"
clearable
size=
"small"
@
keyup
.
enter
.
native=
"handleQuery"
/>
</el-form-item>
<el-form-item
label=
"设备名称"
prop=
"deviceThreshold"
>
<el-input
v-model=
"queryParams.deviceThreshold"
placeholder=
"请输入设备阈值"
clearable
size=
"small"
@
keyup
.
enter
.
native=
"handleQuery"
/>
</el-form-item>
<el-form-item
label=
"开始时间"
prop=
"startCreateTime"
>
<el-date-picker
clearable
size=
"small"
v-model=
"queryParams.startCreateTime"
value-format=
"yyyy-MM-dd HH:mm:ss"
type=
"datetime"
placeholder=
"请选择起始时间"
align=
"right"
style=
"width: 200px"
>
</el-date-picker>
<font
color=
"#C0C4CC"
>
至
</font>
</el-form-item>
<el-form-item
label=
"结束时间"
prop=
"startCreateTime"
>
<el-date-picker
clearable
size=
"small"
v-model=
"queryParams.startCreateTime"
value-format=
"yyyy-MM-dd HH:mm:ss"
type=
"datetime"
placeholder=
"请选择起始时间"
align=
"right"
style=
"width: 200px"
>
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button
type=
"primary"
icon=
"el-icon-search"
size=
"mini"
@
click=
"handleQuery"
>
搜索
</el-button>
<el-button
icon=
"el-icon-refresh"
size=
"mini"
@
click=
"resetQuery"
>
重置
</el-button>
</el-form-item>
</el-form>
<el-row
:gutter=
"10"
class=
"mb8"
>
<el-col
:span=
"1.5"
>
<el-button
type=
"warning"
plain
icon=
"el-icon-download"
size=
"mini"
:loading=
"exportLoading"
@
click=
"handleExport"
v-hasPermi=
"['system:device:export']"
>
导出
</el-button>
</el-col>
<right-toolbar
:showSearch
.
sync=
"showSearch"
@
queryTable=
"getList"
></right-toolbar>
</el-row>
<el-table
v-loading=
"loading"
:data=
"deviceList"
>
<el-table-column
label=
"设备名称"
align=
"center"
prop=
"monitorId"
/>
<el-table-column
label=
"设备编号"
align=
"center"
prop=
"deviceName"
/>
<el-table-column
label=
"开始时间"
align=
"center"
prop=
"deviceThreshold"
/>
<el-table-column
label=
"结束时间"
align=
"center"
prop=
"relationPipeName"
/>
<el-table-column
label=
"标况累计流量(m³)"
align=
"center"
prop=
"relationPipeThreshold"
/>
</el-table>
<pagination
v-show=
"total>0"
:total=
"total"
:page
.
sync=
"queryParams.pageNum"
:limit
.
sync=
"queryParams.pageSize"
@
pagination=
"getList"
/>
</div>
</
template
>
<
script
>
import
{
getDeviceStatisticsInfo
}
from
"@/api/dataMonitoring/deviceStatistics"
;
export
default
{
data
()
{
return
{
// 遮罩层
loading
:
true
,
// 导出遮罩层
exportLoading
:
false
,
// 选中数组
ids
:
[],
// 非单个禁用
single
:
true
,
// 非多个禁用
multiple
:
true
,
// 显示搜索条件
showSearch
:
true
,
// 总条数
total
:
0
,
// 设备监控表格数据
deviceList
:
[],
// 弹出层标题
title
:
""
,
// 是否显示弹出层
open
:
false
,
// 查询参数
queryParams
:
{
pageNum
:
1
,
pageSize
:
10
,
deviceId
:
null
,
deviceThreshold
:
null
,
relationPipeId
:
null
,
relationPipeThreshold
:
null
,
relationDeviceId
:
null
,
relationDeviceThreshold
:
null
,
},
// 表单参数
form
:
{}
};
},
created
()
{
this
.
getList
();
},
methods
:
{
/** 查询设备监控列表 */
getList
()
{
this
.
loading
=
true
;
getDeviceStatisticsInfo
(
this
.
queryParams
).
then
(
response
=>
{
console
.
log
(
response
)
/*this.deviceList = response.rows;
this.total = response.total;*/
this
.
loading
=
false
;
});
},
/** 搜索按钮操作 */
handleQuery
()
{
this
.
queryParams
.
pageNum
=
1
;
this
.
getList
();
},
/** 重置按钮操作 */
resetQuery
()
{
this
.
resetForm
(
"queryForm"
);
this
.
handleQuery
();
},
/** 导出按钮操作 */
handleExport
()
{
const
queryParams
=
this
.
queryParams
;
this
.
$confirm
(
'是否确认导出所有设备监控数据项?'
,
"警告"
,
{
confirmButtonText
:
"确定"
,
cancelButtonText
:
"取消"
,
type
:
"warning"
}).
then
(()
=>
{
this
.
exportLoading
=
true
;
return
exportDevice
(
queryParams
);
}).
then
(
response
=>
{
this
.
download
(
response
.
msg
);
this
.
exportLoading
=
false
;
}).
catch
(()
=>
{});
}
}
};
</
script
>
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