灌溉器历史数据和流量计历史数据的列表接口和导出接口添加时间筛选;添加灌溉控制器瞬时流量和累计流量的图表接口
This commit is contained in:
@ -0,0 +1,54 @@
|
||||
package com.fastbee.iot.domain.dto;
|
||||
|
||||
import com.fastbee.common.annotation.Excel;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
@Data
|
||||
public class NgFlowDeviceDataDto {
|
||||
private Long id;
|
||||
|
||||
/** shun'shi */
|
||||
@Excel(name = "shun'shi")
|
||||
@ApiModelProperty("shun'shi")
|
||||
private String inFlow;
|
||||
|
||||
/** 累计流量 */
|
||||
@Excel(name = "累计流量")
|
||||
@ApiModelProperty("累计流量")
|
||||
private String sumFlow;
|
||||
|
||||
/** 设备编码 */
|
||||
@Excel(name = "设备编码")
|
||||
@ApiModelProperty("设备编码")
|
||||
private String deviceNumber;
|
||||
|
||||
/** 实时时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "实时时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty("实时时间")
|
||||
private Date realTime;
|
||||
|
||||
/** 设备状态 0未启用1离线2在线 */
|
||||
@Excel(name = "设备状态 0未启用1离线2在线")
|
||||
@ApiModelProperty("设备状态 0未启用1离线2在线")
|
||||
private Long status;
|
||||
|
||||
/** 保存时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "保存时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty("保存时间")
|
||||
private Date saveTime;
|
||||
|
||||
/** ji'gou */
|
||||
@Excel(name = "ji'gou")
|
||||
@ApiModelProperty("ji'gou")
|
||||
private Long deptId;
|
||||
|
||||
/** 时间选择器开始时间*/
|
||||
private Date startTime;
|
||||
/**时间选择器结束时间*/
|
||||
private Date endTime;
|
||||
}
|
@ -4,6 +4,7 @@ import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.fastbee.iot.domain.NgFlowDeviceData;
|
||||
import com.fastbee.iot.domain.dto.NgFlowDeviceDataDto;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
@ -15,6 +16,13 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
@Mapper
|
||||
public interface NgFlowDeviceDataMapper extends BaseMapper<NgFlowDeviceData>
|
||||
{
|
||||
/**
|
||||
* 根据时间查询流量计历史数据
|
||||
* @param ngFlowDeviceDataDto
|
||||
* @return
|
||||
*/
|
||||
public List<NgFlowDeviceData> selectNgFlowDeviceDataListByTime(NgFlowDeviceDataDto ngFlowDeviceDataDto);
|
||||
|
||||
/**
|
||||
* 查询流量计设备数据
|
||||
*
|
||||
|
@ -4,6 +4,7 @@ import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.fastbee.iot.domain.NgFlowDeviceData;
|
||||
import com.fastbee.iot.domain.dto.NgFlowDeviceDataDto;
|
||||
|
||||
/**
|
||||
* 流量计设备数据Service接口
|
||||
@ -13,6 +14,14 @@ import com.fastbee.iot.domain.NgFlowDeviceData;
|
||||
*/
|
||||
public interface INgFlowDeviceDataService extends IService<NgFlowDeviceData>
|
||||
{
|
||||
/**
|
||||
* 查询流量计设备数据列表
|
||||
*
|
||||
* @param ngFlowDeviceData 流量计设备数据
|
||||
* @return 流量计设备数据集合
|
||||
*/
|
||||
public List<NgFlowDeviceData> selectNgFlowDeviceDataListByTime(NgFlowDeviceDataDto ngFlowDeviceData);
|
||||
|
||||
/**
|
||||
* 查询流量计设备数据
|
||||
*
|
||||
|
@ -1,10 +1,13 @@
|
||||
package com.fastbee.iot.service.impl;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fastbee.deviceData.domain.DeviceRealtimedataMeteorology;
|
||||
import com.fastbee.deviceData.mapper.DeviceRealtimedataMeteorologyMapper;
|
||||
import com.fastbee.iot.domain.dto.NgFlowDeviceDataDto;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.fastbee.iot.mapper.NgFlowDeviceDataMapper;
|
||||
@ -23,6 +26,28 @@ public class NgFlowDeviceDataServiceImpl extends ServiceImpl<NgFlowDeviceDataMap
|
||||
@Autowired
|
||||
private NgFlowDeviceDataMapper ngFlowDeviceDataMapper;
|
||||
|
||||
/**
|
||||
* 根据时间查询流量计历史数据
|
||||
* @param ngFlowDeviceData 流量计设备数据
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<NgFlowDeviceData> selectNgFlowDeviceDataListByTime(NgFlowDeviceDataDto ngFlowDeviceData) {
|
||||
if(ngFlowDeviceData.getStartTime() != null && ngFlowDeviceData.getEndTime() != null)
|
||||
{
|
||||
//设置结束时间加一天
|
||||
Date searchEndTime = ngFlowDeviceData.getEndTime();
|
||||
// 使用 Calendar 给日期加一天
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(searchEndTime);
|
||||
calendar.add(Calendar.DATE, 1); // 给日期加一天
|
||||
// 将计算后的日期设置回 userIrrigationRecord 对象
|
||||
ngFlowDeviceData.setEndTime(calendar.getTime());
|
||||
}
|
||||
|
||||
return ngFlowDeviceDataMapper.selectNgFlowDeviceDataListByTime(ngFlowDeviceData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询流量计设备数据
|
||||
*
|
||||
|
@ -19,6 +19,21 @@
|
||||
select id, in_flow, sum_flow, device_number, real_time, status, save_time, dept_id from ng_flow_device_data
|
||||
</sql>
|
||||
|
||||
<select id="selectNgFlowDeviceDataListByTime" parameterType="NgFlowDeviceDataDto" resultMap="NgFlowDeviceDataResult">
|
||||
<include refid="selectNgFlowDeviceDataVo"/>
|
||||
<where>
|
||||
<if test="startTime != null and endTime != null"> and real_time between #{startTime} and #{endTime}</if>
|
||||
<if test="inFlow != null "> and in_flow = #{inFlow}</if>
|
||||
<if test="sumFlow != null and sumFlow != ''"> and sum_flow = #{sumFlow}</if>
|
||||
<if test="deviceNumber != null and deviceNumber != ''"> and device_number = #{deviceNumber}</if>
|
||||
<if test="realTime != null "> and real_time = #{realTime}</if>
|
||||
<if test="status != null "> and status = #{status}</if>
|
||||
<if test="saveTime != null "> and save_time = #{saveTime}</if>
|
||||
<if test="deptId != null "> and dept_id = #{deptId}</if>
|
||||
</where>
|
||||
order by real_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectNgFlowDeviceDataList" parameterType="NgFlowDeviceData" resultMap="NgFlowDeviceDataResult">
|
||||
<include refid="selectNgFlowDeviceDataVo"/>
|
||||
<where>
|
||||
|
Reference in New Issue
Block a user