add - 振动传感器整点报表
parent
f8f81ae44a
commit
c061e679ad
@ -0,0 +1,57 @@
|
||||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.system.domain.TVibrationSensorHourlyReport;
|
||||
import com.ruoyi.system.service.ITVibrationSensorHourlyReportService;
|
||||
|
||||
/**
|
||||
* 振动传感器整点报表
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/system/TVibrationSensorHourlyReport")
|
||||
public class TVibrationSensorHourlyReportController extends BaseController {
|
||||
|
||||
private final String prefix = "system/TVibrationSensorHourlyReport";
|
||||
|
||||
@Autowired
|
||||
private ITVibrationSensorHourlyReportService tVibrationSensorHourlyReportService;
|
||||
|
||||
@GetMapping()
|
||||
public String index() {
|
||||
return prefix + "/TVibrationSensorHourlyReport";
|
||||
}
|
||||
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(TVibrationSensorHourlyReport query) {
|
||||
startPage();
|
||||
List<TVibrationSensorHourlyReport> list = tVibrationSensorHourlyReportService.selectTVibrationSensorHourlyReportList(query);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "振动传感器整点报表", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(TVibrationSensorHourlyReport query) {
|
||||
List<TVibrationSensorHourlyReport> list = tVibrationSensorHourlyReportService.selectTVibrationSensorHourlyReportList(query);
|
||||
ExcelUtil<TVibrationSensorHourlyReport> util = new ExcelUtil<>(TVibrationSensorHourlyReport.class);
|
||||
return util.exportExcel(list, "振动传感器整点报表");
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,229 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
|
||||
<head>
|
||||
<th:block th:include="include :: header('振动传感器整点报表')" />
|
||||
<th:block th:include="include :: layout-latest-css"/>
|
||||
<th:block th:include="include :: ztree-css"/>
|
||||
<th:block th:include="include :: datetimepicker-css"/>
|
||||
</head>
|
||||
<body class="gray-bg">
|
||||
|
||||
<div class="ui-layout-west">
|
||||
<div class="box box-main">
|
||||
<div class="box-header">
|
||||
<div class="box-title">
|
||||
<i class="fa icon-grid"></i> 测控点信息
|
||||
</div>
|
||||
<div class="box-tools pull-right">
|
||||
<a type="button" class="btn btn-box-tool" href="#" onclick="dept()" title="测控点信息"><i
|
||||
class="fa fa-edit"></i></a>
|
||||
<button type="button" class="btn btn-box-tool" id="btnExpand" title="展开" style="display:none;"><i
|
||||
class="fa fa-chevron-up"></i></button>
|
||||
<button type="button" class="btn btn-box-tool" id="btnCollapse" title="折叠"><i
|
||||
class="fa fa-chevron-down"></i></button>
|
||||
<button type="button" class="btn btn-box-tool" id="btnRefresh" title="刷新"><i class="fa fa-refresh"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui-layout-content">
|
||||
<div id="tree" class="ztree"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ui-layout-center">
|
||||
<div class="container-div">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 search-collapse">
|
||||
<form id="formId">
|
||||
<input type="hidden" id="sensorId" name="sensorId">
|
||||
<div class="select-list">
|
||||
<ul>
|
||||
<li class="select-time">
|
||||
<label>采集时间:</label>
|
||||
<input type="text" style="width: 150px" class="form-control" id="laydate-demo-3" placeholder="开始时间" name="params[beginCollectTime]"/>
|
||||
<span>-</span>
|
||||
<input type="text" style="width: 150px" class="form-control" id="laydate-demo-4" placeholder="结束时间" name="params[endCollectTime]"/>
|
||||
</li>
|
||||
<li>
|
||||
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i> 搜索</a>
|
||||
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i> 重置</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="btn-group-sm" id="toolbar" role="group">
|
||||
<a class="btn btn-warning" onclick="$.table.exportExcel()" >
|
||||
<i class="fa fa-download"></i> 导出
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-sm-12 select-table table-striped">
|
||||
<table id="bootstrap-table"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<th:block th:include="include :: footer"/>
|
||||
<th:block th:include="include :: layout-latest-js"/>
|
||||
<th:block th:include="include :: ztree-js"/>
|
||||
<th:block th:include="include :: datetimepicker-js"/>
|
||||
<script th:inline="javascript">
|
||||
var prefix = ctx + "system/TVibrationSensorHourlyReport";
|
||||
|
||||
$(function () {
|
||||
var panehHidden = false;
|
||||
if ($(this).width() < 769) {
|
||||
panehHidden = true;
|
||||
}
|
||||
$('body').layout({initClosed: panehHidden, west__size: 245});
|
||||
initDefaultCollectTime();
|
||||
queryUserList();
|
||||
queryDeptTree();
|
||||
$.table.search();
|
||||
});
|
||||
|
||||
function initDefaultCollectTime() {
|
||||
var now = new Date();
|
||||
var start = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0);
|
||||
var end = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 0, 0);
|
||||
$("#laydate-demo-3").val(formatDateTime(start));
|
||||
$("#laydate-demo-4").val(formatDateTime(end));
|
||||
}
|
||||
|
||||
function formatDateTime(date) {
|
||||
var y = date.getFullYear();
|
||||
var m = String(date.getMonth() + 1).padStart(2, '0');
|
||||
var d = String(date.getDate()).padStart(2, '0');
|
||||
var hh = String(date.getHours()).padStart(2, '0');
|
||||
var mm = String(date.getMinutes()).padStart(2, '0');
|
||||
var ss = String(date.getSeconds()).padStart(2, '0');
|
||||
return y + '-' + m + '-' + d + ' ' + hh + ':' + mm + ':' + ss;
|
||||
}
|
||||
|
||||
function queryUserList() {
|
||||
var options = {
|
||||
url: prefix + "/list",
|
||||
exportUrl: prefix + "/export",
|
||||
modalName: "振动传感器整点报表",
|
||||
columns: [{
|
||||
field: 'objId',
|
||||
title: '主键',
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
field: 'monitorName',
|
||||
title: '测点名称'
|
||||
},
|
||||
{
|
||||
field: 'sensorId',
|
||||
title: '传感器ID'
|
||||
},
|
||||
{
|
||||
field: 'reportTime',
|
||||
title: '报表小时',
|
||||
formatter: function (value, row, index) {
|
||||
if (!value) {
|
||||
return '';
|
||||
}
|
||||
var dt = new Date(value.replace(/-/g, '/'));
|
||||
if (isNaN(dt.getTime())) {
|
||||
return value;
|
||||
}
|
||||
var y = dt.getFullYear();
|
||||
var m = String(dt.getMonth() + 1).padStart(2, '0');
|
||||
var d = String(dt.getDate()).padStart(2, '0');
|
||||
var hh = String(dt.getHours()).padStart(2, '0');
|
||||
return y + '-' + m + '-' + d + ' ' + hh + ':00:00';
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'collectTime',
|
||||
title: '采集时间',
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
field: 'speed',
|
||||
title: '速度(mm/s)'
|
||||
},
|
||||
{
|
||||
field: 'displacement',
|
||||
title: '位移(um)'
|
||||
},
|
||||
{
|
||||
field: 'acceleration',
|
||||
title: '加速度(g)'
|
||||
},
|
||||
{
|
||||
field: 'temperature',
|
||||
title: '温度(℃)'
|
||||
},
|
||||
{
|
||||
field: 'recodeTime',
|
||||
title: '写入时间',
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
field: 'remark',
|
||||
title: '备注'
|
||||
}]
|
||||
};
|
||||
$.table.init(options);
|
||||
}
|
||||
|
||||
function queryDeptTree() {
|
||||
var url = ctx + "system/Monitor/treeData?monitorType=" + 20;
|
||||
var options = {
|
||||
url: url,
|
||||
expandLevel: 1,
|
||||
onClick: zOnClick
|
||||
};
|
||||
$.tree.init(options);
|
||||
|
||||
function zOnClick(event, treeId, treeNode) {
|
||||
$("#sensorId").val(treeNode.id);
|
||||
$.table.search();
|
||||
}
|
||||
}
|
||||
|
||||
$('#btnExpand').click(function () {
|
||||
$._tree.expandAll(true);
|
||||
$(this).hide();
|
||||
$('#btnCollapse').show();
|
||||
});
|
||||
|
||||
$('#btnCollapse').click(function () {
|
||||
$._tree.expandAll(false);
|
||||
$(this).hide();
|
||||
$('#btnExpand').show();
|
||||
});
|
||||
|
||||
$('#btnRefresh').click(function () {
|
||||
queryDeptTree();
|
||||
});
|
||||
|
||||
function dept() {
|
||||
var url = ctx + "system/Monitor?id=20";
|
||||
$.modal.openTab("测控点信息", url);
|
||||
}
|
||||
|
||||
layui.use('laydate', function () {
|
||||
var laydate = layui.laydate;
|
||||
|
||||
laydate.render({
|
||||
elem: '#laydate-demo-3',
|
||||
type: 'datetime',
|
||||
trigger: 'click'
|
||||
});
|
||||
|
||||
laydate.render({
|
||||
elem: '#laydate-demo-4',
|
||||
type: 'datetime',
|
||||
trigger: 'click'
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,146 @@
|
||||
package com.ruoyi.system.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 振动传感器整点报表 T_VibrationSensor_Hourly_Report
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class TVibrationSensorHourlyReport extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long objId;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "报表小时", width = 20, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date reportTime;
|
||||
|
||||
@Excel(name = "振动传感器ID")
|
||||
private String sensorId;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "采集时间", width = 20, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date collectTime;
|
||||
|
||||
@Excel(name = "速度(mm/s)")
|
||||
private BigDecimal speed;
|
||||
|
||||
@Excel(name = "位移(um)")
|
||||
private BigDecimal displacement;
|
||||
|
||||
@Excel(name = "加速度(g)")
|
||||
private BigDecimal acceleration;
|
||||
|
||||
@Excel(name = "温度(℃)")
|
||||
private BigDecimal temperature;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "记录时间", width = 20, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date recodeTime;
|
||||
|
||||
private String monitorName;
|
||||
|
||||
public String getMonitorName() {
|
||||
return monitorName;
|
||||
}
|
||||
|
||||
public void setMonitorName(String monitorName) {
|
||||
this.monitorName = monitorName;
|
||||
}
|
||||
|
||||
public Long getObjId() {
|
||||
return objId;
|
||||
}
|
||||
|
||||
public void setObjId(Long objId) {
|
||||
this.objId = objId;
|
||||
}
|
||||
|
||||
public Date getReportTime() {
|
||||
return reportTime;
|
||||
}
|
||||
|
||||
public void setReportTime(Date reportTime) {
|
||||
this.reportTime = reportTime;
|
||||
}
|
||||
|
||||
public String getSensorId() {
|
||||
return sensorId;
|
||||
}
|
||||
|
||||
public void setSensorId(String sensorId) {
|
||||
this.sensorId = sensorId;
|
||||
}
|
||||
|
||||
public Date getCollectTime() {
|
||||
return collectTime;
|
||||
}
|
||||
|
||||
public void setCollectTime(Date collectTime) {
|
||||
this.collectTime = collectTime;
|
||||
}
|
||||
|
||||
public BigDecimal getSpeed() {
|
||||
return speed;
|
||||
}
|
||||
|
||||
public void setSpeed(BigDecimal speed) {
|
||||
this.speed = speed;
|
||||
}
|
||||
|
||||
public BigDecimal getDisplacement() {
|
||||
return displacement;
|
||||
}
|
||||
|
||||
public void setDisplacement(BigDecimal displacement) {
|
||||
this.displacement = displacement;
|
||||
}
|
||||
|
||||
public BigDecimal getAcceleration() {
|
||||
return acceleration;
|
||||
}
|
||||
|
||||
public void setAcceleration(BigDecimal acceleration) {
|
||||
this.acceleration = acceleration;
|
||||
}
|
||||
|
||||
public BigDecimal getTemperature() {
|
||||
return temperature;
|
||||
}
|
||||
|
||||
public void setTemperature(BigDecimal temperature) {
|
||||
this.temperature = temperature;
|
||||
}
|
||||
|
||||
public Date getRecodeTime() {
|
||||
return recodeTime;
|
||||
}
|
||||
|
||||
public void setRecodeTime(Date recodeTime) {
|
||||
this.recodeTime = recodeTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("objId", getObjId())
|
||||
.append("reportTime", getReportTime())
|
||||
.append("sensorId", getSensorId())
|
||||
.append("collectTime", getCollectTime())
|
||||
.append("speed", getSpeed())
|
||||
.append("displacement", getDisplacement())
|
||||
.append("acceleration", getAcceleration())
|
||||
.append("temperature", getTemperature())
|
||||
.append("recodeTime", getRecodeTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.system.domain.TVibrationSensorHourlyReport;
|
||||
|
||||
/**
|
||||
* 振动传感器整点报表Service
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface ITVibrationSensorHourlyReportService {
|
||||
|
||||
List<TVibrationSensorHourlyReport> selectTVibrationSensorHourlyReportList(TVibrationSensorHourlyReport query);
|
||||
|
||||
}
|
||||
@ -0,0 +1,41 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.ruoyi.system.domain.TVibrationSensorHourlyReport;
|
||||
import com.ruoyi.system.mapper.TVibrationSensorHourlyReportMapper;
|
||||
import com.ruoyi.system.service.ITVibrationSensorHourlyReportService;
|
||||
|
||||
/**
|
||||
* 振动传感器整点报表Service实现
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service
|
||||
public class TVibrationSensorHourlyReportServiceImpl implements ITVibrationSensorHourlyReportService {
|
||||
|
||||
@Autowired
|
||||
private TVibrationSensorHourlyReportMapper tVibrationSensorHourlyReportMapper;
|
||||
|
||||
@Override
|
||||
public List<TVibrationSensorHourlyReport> selectTVibrationSensorHourlyReportList(TVibrationSensorHourlyReport query) {
|
||||
if (query != null && query.getSensorId() != null && !query.getSensorId().trim().isEmpty()) {
|
||||
List<String> sensorIdList = Arrays.stream(query.getSensorId().split(","))
|
||||
.map(String::trim)
|
||||
.filter(item -> !item.isEmpty())
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
if (!sensorIdList.isEmpty()) {
|
||||
query.getParams().put("sensorIdList", sensorIdList);
|
||||
}
|
||||
}
|
||||
return tVibrationSensorHourlyReportMapper.selectTVibrationSensorHourlyReportList(query);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,61 @@
|
||||
<?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.ruoyi.system.mapper.TVibrationSensorHourlyReportMapper">
|
||||
|
||||
<resultMap type="TVibrationSensorHourlyReport" id="TVibrationSensorHourlyReportResult">
|
||||
<result property="objId" column="objId"/>
|
||||
<result property="reportTime" column="reportTime"/>
|
||||
<result property="sensorId" column="sensor_id"/>
|
||||
<result property="collectTime" column="collectTime"/>
|
||||
<result property="speed" column="speed"/>
|
||||
<result property="displacement" column="displacement"/>
|
||||
<result property="acceleration" column="acceleration"/>
|
||||
<result property="temperature" column="temperature"/>
|
||||
<result property="recodeTime" column="recodeTime"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="monitorName" column="monitorName"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectTVibrationSensorHourlyReportList" parameterType="TVibrationSensorHourlyReport"
|
||||
resultMap="TVibrationSensorHourlyReportResult">
|
||||
select m.monitorName,
|
||||
r.objId,
|
||||
r.reportTime,
|
||||
r.sensor_id,
|
||||
r.collectTime,
|
||||
r.speed,
|
||||
r.displacement,
|
||||
r.acceleration,
|
||||
r.temperature,
|
||||
r.recodeTime,
|
||||
r.remark
|
||||
from T_VibrationSensor_Hourly_Report r
|
||||
left join T_Monitor m on m.monitorId = r.sensor_id
|
||||
<where>
|
||||
<if test="params.beginCollectTime != null and params.beginCollectTime != '' and params.endCollectTime != null and params.endCollectTime != ''">
|
||||
and r.collectTime between #{params.beginCollectTime} and #{params.endCollectTime}
|
||||
</if>
|
||||
<if test="params.beginReportTime != null and params.beginReportTime != '' and params.endReportTime != null and params.endReportTime != ''">
|
||||
and r.reportTime between #{params.beginReportTime} and #{params.endReportTime}
|
||||
</if>
|
||||
<if test="params.sensorIdList != null and params.sensorIdList.size > 0">
|
||||
and r.sensor_id in
|
||||
<foreach collection="params.sensorIdList" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="(params.sensorIdList == null or params.sensorIdList.size == 0) and sensorId != null and sensorId != ''">and r.sensor_id = #{sensorId}</if>
|
||||
<if test="speed != null">and r.speed = #{speed}</if>
|
||||
<if test="displacement != null">and r.displacement = #{displacement}</if>
|
||||
<if test="acceleration != null">and r.acceleration = #{acceleration}</if>
|
||||
<if test="temperature != null">and r.temperature = #{temperature}</if>
|
||||
</where>
|
||||
order by r.reportTime desc, r.sensor_id
|
||||
</select>
|
||||
|
||||
<select id="insertHourlyReportByProcedure" statementType="CALLABLE">
|
||||
{call dbo.sp_InsertVibrationSensorHourlyReport(#{hourEnd, jdbcType=TIMESTAMP, mode=IN})}
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue