Commit 9dd2f0a7 authored by 王晓倩's avatar 王晓倩

实时数据、历史数据相关代码

parent f6bb8fc8
package com.zehong.web.controller.dataMonitoring;
import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.enums.BusinessType;
import com.zehong.system.domain.TDeviceReportData;
import com.zehong.system.service.ITDeviceReportDataService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
/**
* 设备监控Controller
*
* @author zehong
* @date 2021-08-09
*/
@RestController
@RequestMapping("/dataMonitoring/reportData")
public class TDeviceReportDataController extends BaseController
{
@Autowired
private ITDeviceReportDataService tDeviceReportDataService;
/**
* 查询设备监控列表
*/
@PreAuthorize("@ss.hasPermi('dataMonitoring:reportData:list')")
@GetMapping("/list")
public TableDataInfo list(TDeviceReportData tDeviceReportData)
{
startPage();
List<TDeviceReportData> list = tDeviceReportDataService.selectTDeviceReportDataList(tDeviceReportData);
return getDataTable(list);
}
/**
* 查询设备监控列表
*/
@PreAuthorize("@ss.hasPermi('dataMonitoring:reportData:realtimeList')")
@GetMapping("/realtimeList")
public TableDataInfo realtimeList(TDeviceReportData tDeviceReportData)
{
startPage();
List<TDeviceReportData> list = tDeviceReportDataService.selectTDeviceReportDataList(tDeviceReportData);
return getDataTable(list);
}
/**
* 导出设备监控列表
*/
@PreAuthorize("@ss.hasPermi('dataMonitoring:reportData:export')")
@Log(title = "设备监控", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(TDeviceReportData tDeviceReportData)
{
List<TDeviceReportData> list = tDeviceReportDataService.selectTDeviceReportDataList(tDeviceReportData);
ExcelUtil<TDeviceReportData> util = new ExcelUtil<TDeviceReportData>(TDeviceReportData.class);
return util.exportExcel(list, "设备监控数据");
}
/**
* 获取设备监控详细信息
*/
@PreAuthorize("@ss.hasPermi('dataMonitoring:reportData:query')")
@GetMapping(value = "/{deviceReportDataId}")
public AjaxResult getInfo(@PathVariable("deviceReportDataId") Long deviceReportDataId)
{
return AjaxResult.success(tDeviceReportDataService.selectTDeviceReportDataById(deviceReportDataId));
}
/**
* 新增设备监控
*/
@PreAuthorize("@ss.hasPermi('dataMonitoring:reportData:add')")
@Log(title = "设备监控", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TDeviceReportData tDeviceReportData)
{
return toAjax(tDeviceReportDataService.insertTDeviceReportData(tDeviceReportData));
}
/**
* 修改设备监控
*/
@PreAuthorize("@ss.hasPermi('dataMonitoring:reportData:edit')")
@Log(title = "设备监控", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TDeviceReportData tDeviceReportData)
{
return toAjax(tDeviceReportDataService.updateTDeviceReportData(tDeviceReportData));
}
/**
* 删除设备监控
*/
@PreAuthorize("@ss.hasPermi('dataMonitoring:reportData:remove')")
@Log(title = "设备监控", businessType = BusinessType.DELETE)
@DeleteMapping("/{deviceReportDataIds}")
public AjaxResult remove(@PathVariable Long[] deviceReportDataIds)
{
return toAjax(tDeviceReportDataService.deleteTDeviceReportDataByIds(deviceReportDataIds));
}
}
package com.zehong.system.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zehong.common.annotation.Excel;
import com.zehong.common.core.domain.BaseEntity;
/**
* 设备监控对象 t_device_report_data
*
* @author zehong
* @date 2021-08-09
*/
public class TDeviceReportData extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 设备上报id */
private Long deviceReportDataId;
/** 设备id */
@Excel(name = "设备id")
private Long deviceNum;
/** 标况累计量 */
@Excel(name = "标况累计量")
private BigDecimal standardConditionAccumulation;
/** 工况累计量 */
@Excel(name = "工况累计量")
private BigDecimal workingConditionAccumulation;
/** 剩余量 */
@Excel(name = "剩余量")
private BigDecimal residualQuantity;
/** 标况流量 */
@Excel(name = "标况流量")
private BigDecimal standardConditionFlow;
/** 工况流量 */
@Excel(name = "工况流量")
private BigDecimal workingConditionFlow;
/** 温度 */
@Excel(name = "温度")
private BigDecimal temperature;
/** 压力 */
@Excel(name = "压力")
private BigDecimal pressure;
/** 上报时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "上报时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date reportTime;
/** 通讯状态 */
@Excel(name = "通讯状态")
private String communicationStatus;
/** 设备状态 */
@Excel(name = "设备状态")
private String deviceStatus;
public void setDeviceReportDataId(Long deviceReportDataId)
{
this.deviceReportDataId = deviceReportDataId;
}
public Long getDeviceReportDataId()
{
return deviceReportDataId;
}
public void setDeviceNum(Long deviceNum)
{
this.deviceNum = deviceNum;
}
public Long getDeviceNum()
{
return deviceNum;
}
public void setStandardConditionAccumulation(BigDecimal standardConditionAccumulation)
{
this.standardConditionAccumulation = standardConditionAccumulation;
}
public BigDecimal getStandardConditionAccumulation()
{
return standardConditionAccumulation;
}
public void setWorkingConditionAccumulation(BigDecimal workingConditionAccumulation)
{
this.workingConditionAccumulation = workingConditionAccumulation;
}
public BigDecimal getWorkingConditionAccumulation()
{
return workingConditionAccumulation;
}
public void setResidualQuantity(BigDecimal residualQuantity)
{
this.residualQuantity = residualQuantity;
}
public BigDecimal getResidualQuantity()
{
return residualQuantity;
}
public void setStandardConditionFlow(BigDecimal standardConditionFlow)
{
this.standardConditionFlow = standardConditionFlow;
}
public BigDecimal getStandardConditionFlow()
{
return standardConditionFlow;
}
public void setWorkingConditionFlow(BigDecimal workingConditionFlow)
{
this.workingConditionFlow = workingConditionFlow;
}
public BigDecimal getWorkingConditionFlow()
{
return workingConditionFlow;
}
public void setTemperature(BigDecimal temperature)
{
this.temperature = temperature;
}
public BigDecimal getTemperature()
{
return temperature;
}
public void setPressure(BigDecimal pressure)
{
this.pressure = pressure;
}
public BigDecimal getPressure()
{
return pressure;
}
public void setReportTime(Date reportTime)
{
this.reportTime = reportTime;
}
public Date getReportTime()
{
return reportTime;
}
public void setCommunicationStatus(String communicationStatus)
{
this.communicationStatus = communicationStatus;
}
public String getCommunicationStatus()
{
return communicationStatus;
}
public void setDeviceStatus(String deviceStatus)
{
this.deviceStatus = deviceStatus;
}
public String getDeviceStatus()
{
return deviceStatus;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("deviceReportDataId", getDeviceReportDataId())
.append("deviceNum", getDeviceNum())
.append("standardConditionAccumulation", getStandardConditionAccumulation())
.append("workingConditionAccumulation", getWorkingConditionAccumulation())
.append("residualQuantity", getResidualQuantity())
.append("standardConditionFlow", getStandardConditionFlow())
.append("workingConditionFlow", getWorkingConditionFlow())
.append("temperature", getTemperature())
.append("pressure", getPressure())
.append("reportTime", getReportTime())
.append("communicationStatus", getCommunicationStatus())
.append("deviceStatus", getDeviceStatus())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.toString();
}
}
package com.zehong.system.mapper;
import java.util.List;
import com.zehong.system.domain.TDeviceReportData;
/**
* 设备监控Mapper接口
*
* @author zehong
* @date 2021-08-09
*/
public interface TDeviceReportDataMapper
{
/**
* 查询设备监控
*
* @param deviceReportDataId 设备监控ID
* @return 设备监控
*/
public TDeviceReportData selectTDeviceReportDataById(Long deviceReportDataId);
/**
* 查询设备监控列表
*
* @param tDeviceReportData 设备监控
* @return 设备监控集合
*/
public List<TDeviceReportData> selectTDeviceReportDataList(TDeviceReportData tDeviceReportData);
/**
* 新增设备监控
*
* @param tDeviceReportData 设备监控
* @return 结果
*/
public int insertTDeviceReportData(TDeviceReportData tDeviceReportData);
/**
* 修改设备监控
*
* @param tDeviceReportData 设备监控
* @return 结果
*/
public int updateTDeviceReportData(TDeviceReportData tDeviceReportData);
/**
* 删除设备监控
*
* @param deviceReportDataId 设备监控ID
* @return 结果
*/
public int deleteTDeviceReportDataById(Long deviceReportDataId);
/**
* 批量删除设备监控
*
* @param deviceReportDataIds 需要删除的数据ID
* @return 结果
*/
public int deleteTDeviceReportDataByIds(Long[] deviceReportDataIds);
}
package com.zehong.system.service;
import java.util.List;
import com.zehong.system.domain.TDeviceReportData;
/**
* 设备监控Service接口
*
* @author zehong
* @date 2021-08-09
*/
public interface ITDeviceReportDataService
{
/**
* 查询设备监控
*
* @param deviceReportDataId 设备监控ID
* @return 设备监控
*/
public TDeviceReportData selectTDeviceReportDataById(Long deviceReportDataId);
/**
* 查询设备监控列表
*
* @param tDeviceReportData 设备监控
* @return 设备监控集合
*/
public List<TDeviceReportData> selectTDeviceReportDataList(TDeviceReportData tDeviceReportData);
/**
* 新增设备监控
*
* @param tDeviceReportData 设备监控
* @return 结果
*/
public int insertTDeviceReportData(TDeviceReportData tDeviceReportData);
/**
* 修改设备监控
*
* @param tDeviceReportData 设备监控
* @return 结果
*/
public int updateTDeviceReportData(TDeviceReportData tDeviceReportData);
/**
* 批量删除设备监控
*
* @param deviceReportDataIds 需要删除的设备监控ID
* @return 结果
*/
public int deleteTDeviceReportDataByIds(Long[] deviceReportDataIds);
/**
* 删除设备监控信息
*
* @param deviceReportDataId 设备监控ID
* @return 结果
*/
public int deleteTDeviceReportDataById(Long deviceReportDataId);
}
package com.zehong.system.service.impl;
import java.util.List;
import com.zehong.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TDeviceReportDataMapper;
import com.zehong.system.domain.TDeviceReportData;
import com.zehong.system.service.ITDeviceReportDataService;
/**
* 设备监控Service业务层处理
*
* @author zehong
* @date 2021-08-09
*/
@Service
public class TDeviceReportDataServiceImpl implements ITDeviceReportDataService
{
@Autowired
private TDeviceReportDataMapper tDeviceReportDataMapper;
/**
* 查询设备监控
*
* @param deviceReportDataId 设备监控ID
* @return 设备监控
*/
@Override
public TDeviceReportData selectTDeviceReportDataById(Long deviceReportDataId)
{
return tDeviceReportDataMapper.selectTDeviceReportDataById(deviceReportDataId);
}
/**
* 查询设备监控列表
*
* @param tDeviceReportData 设备监控
* @return 设备监控
*/
@Override
public List<TDeviceReportData> selectTDeviceReportDataList(TDeviceReportData tDeviceReportData)
{
return tDeviceReportDataMapper.selectTDeviceReportDataList(tDeviceReportData);
}
/**
* 新增设备监控
*
* @param tDeviceReportData 设备监控
* @return 结果
*/
@Override
public int insertTDeviceReportData(TDeviceReportData tDeviceReportData)
{
tDeviceReportData.setCreateTime(DateUtils.getNowDate());
return tDeviceReportDataMapper.insertTDeviceReportData(tDeviceReportData);
}
/**
* 修改设备监控
*
* @param tDeviceReportData 设备监控
* @return 结果
*/
@Override
public int updateTDeviceReportData(TDeviceReportData tDeviceReportData)
{
tDeviceReportData.setUpdateTime(DateUtils.getNowDate());
return tDeviceReportDataMapper.updateTDeviceReportData(tDeviceReportData);
}
/**
* 批量删除设备监控
*
* @param deviceReportDataIds 需要删除的设备监控ID
* @return 结果
*/
@Override
public int deleteTDeviceReportDataByIds(Long[] deviceReportDataIds)
{
return tDeviceReportDataMapper.deleteTDeviceReportDataByIds(deviceReportDataIds);
}
/**
* 删除设备监控信息
*
* @param deviceReportDataId 设备监控ID
* @return 结果
*/
@Override
public int deleteTDeviceReportDataById(Long deviceReportDataId)
{
return tDeviceReportDataMapper.deleteTDeviceReportDataById(deviceReportDataId);
}
}
<?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.TDeviceReportDataMapper">
<resultMap type="TDeviceReportData" id="TDeviceReportDataResult">
<result property="deviceReportDataId" column="device_report_data_id" />
<result property="deviceNum" column="device_num" />
<result property="standardConditionAccumulation" column="standard_condition_accumulation" />
<result property="workingConditionAccumulation" column="working_condition_accumulation" />
<result property="residualQuantity" column="residual_quantity" />
<result property="standardConditionFlow" column="standard_condition_flow" />
<result property="workingConditionFlow" column="working_condition_flow" />
<result property="temperature" column="temperature" />
<result property="pressure" column="pressure" />
<result property="reportTime" column="report_time" />
<result property="communicationStatus" column="communication_status" />
<result property="deviceStatus" column="device_status" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectTDeviceReportDataVo">
select device_report_data_id, device_num, standard_condition_accumulation, working_condition_accumulation, residual_quantity, standard_condition_flow, working_condition_flow, temperature, pressure, report_time, communication_status, device_status, create_time, update_time from t_device_report_data
</sql>
<select id="selectTDeviceReportDataList" parameterType="TDeviceReportData" resultMap="TDeviceReportDataResult">
<include refid="selectTDeviceReportDataVo"/>
<where>
<if test="deviceNum != null "> and device_num = #{deviceNum}</if>
<if test="standardConditionAccumulation != null "> and standard_condition_accumulation = #{standardConditionAccumulation}</if>
<if test="workingConditionAccumulation != null "> and working_condition_accumulation = #{workingConditionAccumulation}</if>
<if test="residualQuantity != null "> and residual_quantity = #{residualQuantity}</if>
<if test="standardConditionFlow != null "> and standard_condition_flow = #{standardConditionFlow}</if>
<if test="workingConditionFlow != null "> and working_condition_flow = #{workingConditionFlow}</if>
<if test="temperature != null "> and temperature = #{temperature}</if>
<if test="pressure != null "> and pressure = #{pressure}</if>
<if test="reportTime != null "> and report_time = #{reportTime}</if>
<if test="communicationStatus != null and communicationStatus != ''"> and communication_status = #{communicationStatus}</if>
<if test="deviceStatus != null and deviceStatus != ''"> and device_status = #{deviceStatus}</if>
</where>
</select>
<select id="selectTDeviceReportDataById" parameterType="Long" resultMap="TDeviceReportDataResult">
<include refid="selectTDeviceReportDataVo"/>
where device_report_data_id = #{deviceReportDataId}
</select>
<insert id="insertTDeviceReportData" parameterType="TDeviceReportData" useGeneratedKeys="true" keyProperty="deviceReportDataId">
insert into t_device_report_data
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="deviceNum != null">device_num,</if>
<if test="standardConditionAccumulation != null">standard_condition_accumulation,</if>
<if test="workingConditionAccumulation != null">working_condition_accumulation,</if>
<if test="residualQuantity != null">residual_quantity,</if>
<if test="standardConditionFlow != null">standard_condition_flow,</if>
<if test="workingConditionFlow != null">working_condition_flow,</if>
<if test="temperature != null">temperature,</if>
<if test="pressure != null">pressure,</if>
<if test="reportTime != null">report_time,</if>
<if test="communicationStatus != null">communication_status,</if>
<if test="deviceStatus != null">device_status,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="deviceNum != null">#{deviceNum},</if>
<if test="standardConditionAccumulation != null">#{standardConditionAccumulation},</if>
<if test="workingConditionAccumulation != null">#{workingConditionAccumulation},</if>
<if test="residualQuantity != null">#{residualQuantity},</if>
<if test="standardConditionFlow != null">#{standardConditionFlow},</if>
<if test="workingConditionFlow != null">#{workingConditionFlow},</if>
<if test="temperature != null">#{temperature},</if>
<if test="pressure != null">#{pressure},</if>
<if test="reportTime != null">#{reportTime},</if>
<if test="communicationStatus != null">#{communicationStatus},</if>
<if test="deviceStatus != null">#{deviceStatus},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateTDeviceReportData" parameterType="TDeviceReportData">
update t_device_report_data
<trim prefix="SET" suffixOverrides=",">
<if test="deviceNum != null">device_num = #{deviceNum},</if>
<if test="standardConditionAccumulation != null">standard_condition_accumulation = #{standardConditionAccumulation},</if>
<if test="workingConditionAccumulation != null">working_condition_accumulation = #{workingConditionAccumulation},</if>
<if test="residualQuantity != null">residual_quantity = #{residualQuantity},</if>
<if test="standardConditionFlow != null">standard_condition_flow = #{standardConditionFlow},</if>
<if test="workingConditionFlow != null">working_condition_flow = #{workingConditionFlow},</if>
<if test="temperature != null">temperature = #{temperature},</if>
<if test="pressure != null">pressure = #{pressure},</if>
<if test="reportTime != null">report_time = #{reportTime},</if>
<if test="communicationStatus != null">communication_status = #{communicationStatus},</if>
<if test="deviceStatus != null">device_status = #{deviceStatus},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where device_report_data_id = #{deviceReportDataId}
</update>
<delete id="deleteTDeviceReportDataById" parameterType="Long">
delete from t_device_report_data where device_report_data_id = #{deviceReportDataId}
</delete>
<delete id="deleteTDeviceReportDataByIds" parameterType="String">
delete from t_device_report_data where device_report_data_id in
<foreach item="deviceReportDataId" collection="array" open="(" separator="," close=")">
#{deviceReportDataId}
</foreach>
</delete>
</mapper>
\ No newline at end of file
import request from '@/utils/request'
// 查询设备监控列表
export function listData(query) {
return request({
url: '/dataMonitoring/reportData/list',
method: 'get',
params: query
})
}
// 查询设备监控实时列表
export function realtimeData(query) {
return request({
url: '/dataMonitoring/reportData/realtimeList',
method: 'get',
params: query
})
}
// 查询设备监控详细
export function getData(deviceReportDataId) {
return request({
url: '/dataMonitoring/reportData/' + deviceReportDataId,
method: 'get'
})
}
// 新增设备监控
export function addData(data) {
return request({
url: '/dataMonitoring/data',
method: 'post',
data: data
})
}
// 修改设备监控
export function updateData(data) {
return request({
url: '/dataMonitoring/data',
method: 'put',
data: data
})
}
// 删除设备监控
export function delData(deviceReportDataId) {
return request({
url: '/dataMonitoring/reportData/' + deviceReportDataId,
method: 'delete'
})
}
// 导出设备监控
export function exportData(query) {
return request({
url: '/dataMonitoring/reportData/export',
method: 'get',
params: query
})
}
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment