Quellcode durchsuchen

任务提交 部分详情页查询接口

qinguocai vor 1 Jahr
Ursprung
Commit
02cfb79fb2

+ 38 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/CarPosition.java

@@ -0,0 +1,38 @@
+package com.ruoyi.system.domain;
+
+import java.util.Date;
+import java.io.Serializable;
+import lombok.Data;
+
+/**
+ * 小车位置(CarPosition)实体类
+ *
+ * @author makejava
+ * @since 2024-04-19 15:01:33
+ */
+@Data
+public class CarPosition implements Serializable {
+    private static final long serialVersionUID = -45743883392910299L;
+/**
+     * 小车位置id
+     */
+    private Long carId;
+/**
+     * 离起点位置
+     */
+    private Double position;
+/**
+     * 创建时间
+     */
+    private Date createTime;
+/**
+     * 站点ID
+     */
+    private Long siteId;
+/**
+     * 状态 0.位置上报 1.任务完成 2.开始返航
+     */
+    private Integer status;
+
+}
+

+ 62 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/HeartBeat.java

@@ -0,0 +1,62 @@
+package com.ruoyi.system.domain;
+
+import java.util.Date;
+import java.io.Serializable;
+import lombok.Data;
+
+/**
+ * 小车心跳数据(HeartBeat)实体类
+ *
+ * @author makejava
+ * @since 2024-04-19 15:26:15
+ */
+@Data
+public class HeartBeat implements Serializable {
+    private static final long serialVersionUID = -52814715837878820L;
+/**
+     * 心跳ID
+     */
+    private Long heartId;
+/**
+     * 设备类型,0:移动测流;1:固定测流
+     */
+    private Integer type;
+/**
+     * 站码
+     */
+    private String id;
+/**
+     * 小车状态,0:充电中;1:测流中
+     */
+    private Integer status;
+/**
+     * 电量百分比(%)
+     */
+    private Double eq;
+/**
+     * 电流 单位:A
+     */
+    private Double current;
+/**
+     * 电压 单位:V
+     */
+    private Double voltage;
+/**
+     * 信号强度
+     */
+    private Double signalstrength;
+/**
+     * 温度
+     */
+    private Double temperature;
+/**
+     * 创建时间
+     */
+    private Date createTime;
+/**
+     * 站点ID
+     */
+    private Long siteId;
+
+}
+

+ 54 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/TaskNotice.java

@@ -0,0 +1,54 @@
+package com.ruoyi.system.domain;
+
+import java.util.Date;
+import java.io.Serializable;
+import lombok.Data;
+
+/**
+ * 任务通知(TaskNotice)实体类
+ *
+ * @author makejava
+ * @since 2024-04-19 16:28:16
+ */
+@Data
+public class TaskNotice implements Serializable {
+    private static final long serialVersionUID = 789003852227667912L;
+/**
+     * 任务开始id
+     */
+    private Long startId;
+/**
+     * 任务编号
+     */
+    private String taskid;
+/**
+     * 1为时间触发测流,2为变幅测流,3为手动测流
+     */
+    private Integer workmode;
+/**
+     * 停泊点策略编号
+     */
+    private Long planid;
+/**
+     * 创建时间
+     */
+    private Date createTime;
+/**
+     * 站点ID
+     */
+    private Long siteId;
+/**
+     * 站码
+     */
+    private String id;
+/**
+     * 备注 信息内容
+     */
+    private String remark;
+/**
+     * 异常编码
+     */
+    private String code;
+
+}
+

+ 38 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/WaterLevel.java

@@ -0,0 +1,38 @@
+package com.ruoyi.system.domain;
+
+import java.util.Date;
+import java.io.Serializable;
+import lombok.Data;
+
+/**
+ * 水位信息(WaterLevel)实体类
+ *
+ * @author makejava
+ * @since 2024-04-19 16:45:33
+ */
+@Data
+public class WaterLevel implements Serializable {
+    private static final long serialVersionUID = 899179909133350118L;
+/**
+     * 水位ID
+     */
+    private Long waterId;
+/**
+     * 站码
+     */
+    private String id;
+/**
+     * 水位值
+     */
+    private Double waterlevel;
+/**
+     * 站点ID
+     */
+    private Long siteId;
+/**
+     * 创建时间
+     */
+    private Date createTime;
+
+}
+

+ 44 - 0
ruoyi-system/src/main/java/com/ruoyi/system/dto/SiteRealTimeDTO.java

@@ -0,0 +1,44 @@
+package com.ruoyi.system.dto;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+
+/**
+ * 站点基本信息(SiteInfo)实体类
+ *
+ * @author makejava
+ * @since 2024-04-08 14:02:20
+ */
+@Data
+public class SiteRealTimeDTO implements Serializable {
+
+
+    /**
+     * 站点ID
+     */
+    private Long siteId;
+
+/**
+     * 站点名称
+     */
+    private String siteName;
+
+
+    /**
+     * 当前状态 0.空闲 1.测流中
+     */
+    private String siteStatus;
+
+
+    /**
+     * 下次测流时间
+     */
+    private String nextTime;
+
+
+
+}
+

+ 92 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/CarPositionMapper.java

@@ -0,0 +1,92 @@
+package com.ruoyi.system.mapper;
+
+import com.ruoyi.system.domain.CarPosition;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.data.domain.Pageable;
+import java.util.List;
+
+/**
+ * 小车位置(CarPosition)表数据库访问层
+ *
+ * @author makejava
+ * @since 2024-04-19 15:01:33
+ */
+public interface CarPositionMapper {
+
+    /**
+     * 通过ID查询单条数据
+     *
+     * @param carId 主键
+     * @return 实例对象
+     */
+    CarPosition queryById(Long carId);
+
+
+    /**
+     * 通过ID查询单条数据
+     *
+     * @param siteId 主键
+     * @return 实例对象
+     */
+    CarPosition queryBysiteId(Long siteId);
+
+    /**
+     * 查询指定行数据
+     *
+     * @param carPosition 查询条件
+     * @param pageable         分页对象
+     * @return 对象列表
+     */
+    List<CarPosition> queryAllByLimit(CarPosition carPosition, @Param("pageable") Pageable pageable);
+
+    /**
+     * 统计总行数
+     *
+     * @param carPosition 查询条件
+     * @return 总行数
+     */
+    long count(CarPosition carPosition);
+
+    /**
+     * 新增数据
+     *
+     * @param carPosition 实例对象
+     * @return 影响行数
+     */
+    int insert(CarPosition carPosition);
+
+    /**
+     * 批量新增数据(MyBatis原生foreach方法)
+     *
+     * @param entities List<CarPosition> 实例对象列表
+     * @return 影响行数
+     */
+    int insertBatch(@Param("entities") List<CarPosition> entities);
+
+    /**
+     * 批量新增或按主键更新数据(MyBatis原生foreach方法)
+     *
+     * @param entities List<CarPosition> 实例对象列表
+     * @return 影响行数
+     * @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参
+     */
+    int insertOrUpdateBatch(@Param("entities") List<CarPosition> entities);
+
+    /**
+     * 修改数据
+     *
+     * @param carPosition 实例对象
+     * @return 影响行数
+     */
+    int update(CarPosition carPosition);
+
+    /**
+     * 通过主键删除数据
+     *
+     * @param carId 主键
+     * @return 影响行数
+     */
+    int deleteById(Long carId);
+
+}
+

+ 92 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/HeartBeatMapper.java

@@ -0,0 +1,92 @@
+package com.ruoyi.system.mapper;
+
+import com.ruoyi.system.domain.HeartBeat;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.data.domain.Pageable;
+import java.util.List;
+
+/**
+ * 小车心跳数据(HeartBeat)表数据库访问层
+ *
+ * @author makejava
+ * @since 2024-04-19 15:26:15
+ */
+public interface HeartBeatMapper {
+
+    /**
+     * 通过ID查询单条数据
+     *
+     * @param heartId 主键
+     * @return 实例对象
+     */
+    HeartBeat queryById(Long heartId);
+
+
+    /**
+     * 通过ID查询单条数据
+     *
+     * @param siteId 主键
+     * @return 实例对象
+     */
+    HeartBeat queryBysiteId(Long siteId);
+
+    /**
+     * 查询指定行数据
+     *
+     * @param heartBeat 查询条件
+     * @param pageable         分页对象
+     * @return 对象列表
+     */
+    List<HeartBeat> queryAllByLimit(HeartBeat heartBeat, @Param("pageable") Pageable pageable);
+
+    /**
+     * 统计总行数
+     *
+     * @param heartBeat 查询条件
+     * @return 总行数
+     */
+    long count(HeartBeat heartBeat);
+
+    /**
+     * 新增数据
+     *
+     * @param heartBeat 实例对象
+     * @return 影响行数
+     */
+    int insert(HeartBeat heartBeat);
+
+    /**
+     * 批量新增数据(MyBatis原生foreach方法)
+     *
+     * @param entities List<HeartBeat> 实例对象列表
+     * @return 影响行数
+     */
+    int insertBatch(@Param("entities") List<HeartBeat> entities);
+
+    /**
+     * 批量新增或按主键更新数据(MyBatis原生foreach方法)
+     *
+     * @param entities List<HeartBeat> 实例对象列表
+     * @return 影响行数
+     * @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参
+     */
+    int insertOrUpdateBatch(@Param("entities") List<HeartBeat> entities);
+
+    /**
+     * 修改数据
+     *
+     * @param heartBeat 实例对象
+     * @return 影响行数
+     */
+    int update(HeartBeat heartBeat);
+
+    /**
+     * 通过主键删除数据
+     *
+     * @param heartId 主键
+     * @return 影响行数
+     */
+    int deleteById(Long heartId);
+
+}
+

+ 84 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TaskNoticeMapper.java

@@ -0,0 +1,84 @@
+package com.ruoyi.system.mapper;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.system.domain.TaskNotice;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.data.domain.Pageable;
+import java.util.List;
+
+/**
+ * 任务通知(TaskNotice)表数据库访问层
+ *
+ * @author makejava
+ * @since 2024-04-19 16:28:16
+ */
+public interface TaskNoticeMapper {
+
+    /**
+     * 通过ID查询单条数据
+     *
+     * @param startId 主键
+     * @return 实例对象
+     */
+    TaskNotice queryById(Long startId);
+
+    /**
+     * 查询指定行数据
+     *
+     * @param taskNotice 查询条件
+     * @param pageable         分页对象
+     * @return 对象列表
+     */
+    Page<TaskNotice> queryAllByLimit(Long siteId, Page page);
+
+    /**
+     * 统计总行数
+     *
+     * @param taskNotice 查询条件
+     * @return 总行数
+     */
+    long count(TaskNotice taskNotice);
+
+    /**
+     * 新增数据
+     *
+     * @param taskNotice 实例对象
+     * @return 影响行数
+     */
+    int insert(TaskNotice taskNotice);
+
+    /**
+     * 批量新增数据(MyBatis原生foreach方法)
+     *
+     * @param entities List<TaskNotice> 实例对象列表
+     * @return 影响行数
+     */
+    int insertBatch(@Param("entities") List<TaskNotice> entities);
+
+    /**
+     * 批量新增或按主键更新数据(MyBatis原生foreach方法)
+     *
+     * @param entities List<TaskNotice> 实例对象列表
+     * @return 影响行数
+     * @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参
+     */
+    int insertOrUpdateBatch(@Param("entities") List<TaskNotice> entities);
+
+    /**
+     * 修改数据
+     *
+     * @param taskNotice 实例对象
+     * @return 影响行数
+     */
+    int update(TaskNotice taskNotice);
+
+    /**
+     * 通过主键删除数据
+     *
+     * @param startId 主键
+     * @return 影响行数
+     */
+    int deleteById(Long startId);
+
+}
+

+ 93 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/WaterLevelMapper.java

@@ -0,0 +1,93 @@
+package com.ruoyi.system.mapper;
+
+import com.ruoyi.system.domain.WaterLevel;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.data.domain.Pageable;
+import java.util.List;
+
+/**
+ * 水位信息(WaterLevel)表数据库访问层
+ *
+ * @author makejava
+ * @since 2024-04-19 16:45:33
+ */
+public interface WaterLevelMapper {
+
+    /**
+     * 通过ID查询单条数据
+     *
+     * @param waterId 主键
+     * @return 实例对象
+     */
+    WaterLevel queryById(Long waterId);
+
+
+
+    /**
+     * 通过ID查询单条数据
+     *
+     * @param siteId 主键
+     * @return 实例对象
+     */
+    WaterLevel queryBySiteId(Long siteId);
+
+    /**
+     * 查询指定行数据
+     *
+     * @param waterLevel 查询条件
+     * @param pageable         分页对象
+     * @return 对象列表
+     */
+    List<WaterLevel> queryAllByLimit(WaterLevel waterLevel, @Param("pageable") Pageable pageable);
+
+    /**
+     * 统计总行数
+     *
+     * @param waterLevel 查询条件
+     * @return 总行数
+     */
+    long count(WaterLevel waterLevel);
+
+    /**
+     * 新增数据
+     *
+     * @param waterLevel 实例对象
+     * @return 影响行数
+     */
+    int insert(WaterLevel waterLevel);
+
+    /**
+     * 批量新增数据(MyBatis原生foreach方法)
+     *
+     * @param entities List<WaterLevel> 实例对象列表
+     * @return 影响行数
+     */
+    int insertBatch(@Param("entities") List<WaterLevel> entities);
+
+    /**
+     * 批量新增或按主键更新数据(MyBatis原生foreach方法)
+     *
+     * @param entities List<WaterLevel> 实例对象列表
+     * @return 影响行数
+     * @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参
+     */
+    int insertOrUpdateBatch(@Param("entities") List<WaterLevel> entities);
+
+    /**
+     * 修改数据
+     *
+     * @param waterLevel 实例对象
+     * @return 影响行数
+     */
+    int update(WaterLevel waterLevel);
+
+    /**
+     * 通过主键删除数据
+     *
+     * @param waterId 主键
+     * @return 影响行数
+     */
+    int deleteById(Long waterId);
+
+}
+

+ 24 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/ReportDataService.java

@@ -0,0 +1,24 @@
+package com.ruoyi.system.service;
+
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.system.domain.CarPosition;
+import com.ruoyi.system.domain.HeartBeat;
+import com.ruoyi.system.domain.TaskNotice;
+import com.ruoyi.system.domain.WaterLevel;
+import com.ruoyi.system.dto.ManualMeasureDTO;
+import com.ruoyi.system.dto.SiteRealTimeDTO;
+
+
+public interface ReportDataService {
+
+    CarPosition carLocation(Long siteId);
+
+    HeartBeat carInfo(Long siteId);
+
+    SiteRealTimeDTO siteRealTime(Long siteId);
+
+    Page<TaskNotice> taskNotice(Long siteId, Long page, Long size);
+
+    WaterLevel getWaterLevel(Long siteId);
+}

+ 90 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ReportDataServiceImpl.java

@@ -0,0 +1,90 @@
+package com.ruoyi.system.service.impl;
+
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.exception.base.BaseException;
+import com.ruoyi.system.domain.*;
+import com.ruoyi.system.dto.SiteRealTimeDTO;
+import com.ruoyi.system.mapper.*;
+import com.ruoyi.system.service.ReportDataService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+
+
+/**
+ * classname: 站点信息
+ * description  服务实现类
+ */
+@Service
+@Slf4j
+public class ReportDataServiceImpl implements ReportDataService {
+
+    @Resource
+    private CarPositionMapper carPositionMapper;
+
+
+    @Resource
+    private HeartBeatMapper heartBeatMapper;
+
+
+    @Resource
+    private SiteInfoMapper siteInfoMapper;
+
+
+    @Resource
+    private TaskNoticeMapper taskNoticeMapper;
+
+    @Resource
+    private WaterLevelMapper waterLevelMapper;
+
+    @Override
+    public CarPosition carLocation(Long siteId){
+        return carPositionMapper.queryBysiteId(siteId);
+    }
+
+    @Override
+    public HeartBeat carInfo(Long siteId){
+        return heartBeatMapper.queryBysiteId(siteId);
+    }
+
+
+    @Override
+    public SiteRealTimeDTO siteRealTime(Long siteId){
+
+        SiteRealTimeDTO siteRealTimeDTO = new SiteRealTimeDTO();
+        //查询站点名称
+        SiteInfo siteInfo = siteInfoMapper.queryById(siteId);
+        if (siteInfo == null){
+            throw new BaseException("站点不存在");
+        }
+        siteRealTimeDTO.setSiteName(siteInfo.getSiteName());
+        //查询状态
+
+        //计算下次测量时间
+
+        return siteRealTimeDTO;
+    }
+
+
+    @Override
+    public Page<TaskNotice> taskNotice(Long siteId, Long page, Long size){
+        if (siteId == null){
+            throw new BaseException("站点不存在");
+        }
+        if (page == null || size == null){
+            page = 1L;
+            size = 10L;
+        }
+        return taskNoticeMapper.queryAllByLimit(siteId, new Page(page,size));
+    }
+
+
+    @Override
+    public WaterLevel getWaterLevel(Long siteId){
+        return waterLevelMapper.queryBySiteId(siteId);
+    }
+
+
+}

+ 132 - 0
ruoyi-system/src/main/resources/mapper/CarPositionMapper.xml

@@ -0,0 +1,132 @@
+<?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.CarPositionMapper">
+
+    <resultMap type="com.ruoyi.system.domain.CarPosition" id="CarPositionMap">
+        <result property="carId" column="car_id" jdbcType="INTEGER"/>
+        <result property="position" column="position" jdbcType="NUMERIC"/>
+        <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+        <result property="siteId" column="site_id" jdbcType="INTEGER"/>
+        <result property="status" column="status" jdbcType="INTEGER"/>
+    </resultMap>
+
+    <!--查询单个-->
+    <select id="queryById" resultMap="CarPositionMap">
+        select
+            car_id, position, create_time, site_id, status
+        from car_position
+        where car_id = #{carId}
+    </select>
+
+    <!--查询单个-->
+    <select id="queryBysiteId" resultMap="CarPositionMap">
+        select
+            car_id, position, create_time, site_id, status
+        from car_position
+        where site_id = #{siteId}
+        order by create_time desc
+        limit 1
+    </select>
+
+    <!--查询指定行数据-->
+    <select id="queryAllByLimit" resultMap="CarPositionMap">
+        select
+car_id, position, create_time, site_id, status
+        from car_position
+        <where>
+            <if test="carId != null">
+                and car_id = #{carId}
+            </if>
+            <if test="position != null">
+                and position = #{position}
+            </if>
+            <if test="createTime != null">
+                and create_time = #{createTime}
+            </if>
+            <if test="siteId != null">
+                and site_id = #{siteId}
+            </if>
+            <if test="status != null">
+                and status = #{status}
+            </if>
+        </where>
+        limit #{pageable.offset}, #{pageable.pageSize}
+    </select>
+
+    <!--统计总行数-->
+    <select id="count" resultType="java.lang.Long">
+        select count(1)
+        from car_position
+        <where>
+            <if test="carId != null">
+                and car_id = #{carId}
+            </if>
+            <if test="position != null">
+                and position = #{position}
+            </if>
+            <if test="createTime != null">
+                and create_time = #{createTime}
+            </if>
+            <if test="siteId != null">
+                and site_id = #{siteId}
+            </if>
+            <if test="status != null">
+                and status = #{status}
+            </if>
+        </where>
+    </select>
+
+    <!--新增所有列-->
+    <insert id="insert" keyProperty="carId" useGeneratedKeys="true">
+        insert into car_position(position, create_time, site_id, status)
+        values (#{position}, #{createTime}, #{siteId}, #{status})
+    </insert>
+
+    <insert id="insertBatch" keyProperty="carId" useGeneratedKeys="true">
+        insert into car_position(position, create_time, site_id, status)
+        values
+        <foreach collection="entities" item="entity" separator=",">
+        (#{entity.position}, #{entity.createTime}, #{entity.siteId}, #{entity.status})
+        </foreach>
+    </insert>
+
+    <insert id="insertOrUpdateBatch" keyProperty="carId" useGeneratedKeys="true">
+        insert into car_position(position, create_time, site_id, status)
+        values
+        <foreach collection="entities" item="entity" separator=",">
+            (#{entity.position}, #{entity.createTime}, #{entity.siteId}, #{entity.status})
+        </foreach>
+        on duplicate key update
+position = values(position),
+create_time = values(create_time),
+site_id = values(site_id),
+status = values(status)
+    </insert>
+
+    <!--通过主键修改数据-->
+    <update id="update">
+        update car_position
+        <set>
+            <if test="position != null">
+                position = #{position},
+            </if>
+            <if test="createTime != null">
+                create_time = #{createTime},
+            </if>
+            <if test="siteId != null">
+                site_id = #{siteId},
+            </if>
+            <if test="status != null">
+                status = #{status},
+            </if>
+        </set>
+        where car_id = #{carId}
+    </update>
+
+    <!--通过主键删除-->
+    <delete id="deleteById">
+        delete from car_position where car_id = #{carId}
+    </delete>
+
+</mapper>
+

+ 198 - 0
ruoyi-system/src/main/resources/mapper/HeartBeatMapper.xml

@@ -0,0 +1,198 @@
+<?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.HeartBeatMapper">
+
+    <resultMap type="com.ruoyi.system.domain.HeartBeat" id="HeartBeatMap">
+        <result property="heartId" column="heart_id" jdbcType="INTEGER"/>
+        <result property="type" column="type" jdbcType="INTEGER"/>
+        <result property="id" column="id" jdbcType="VARCHAR"/>
+        <result property="status" column="status" jdbcType="INTEGER"/>
+        <result property="eq" column="eq" jdbcType="NUMERIC"/>
+        <result property="current" column="current" jdbcType="NUMERIC"/>
+        <result property="voltage" column="voltage" jdbcType="NUMERIC"/>
+        <result property="signalstrength" column="signalstrength" jdbcType="NUMERIC"/>
+        <result property="temperature" column="temperature" jdbcType="NUMERIC"/>
+        <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+        <result property="siteId" column="site_id" jdbcType="INTEGER"/>
+    </resultMap>
+
+    <!--查询单个-->
+    <select id="queryById" resultMap="HeartBeatMap">
+        select
+heart_id, type, id, status, eq, current, voltage, signalstrength, temperature, create_time, site_id
+        from heart_beat
+        where heart_id = #{heartId}
+    </select>
+
+    <!--查询单个-->
+    <select id="queryBysiteId" resultMap="HeartBeatMap">
+        select
+            heart_id, type, id, status, eq, current, voltage, signalstrength, temperature, create_time, site_id
+        from heart_beat
+        where site_id = #{siteId}
+        order by create_time desc
+        limit 1
+    </select>
+
+    <!--查询指定行数据-->
+    <select id="queryAllByLimit" resultMap="HeartBeatMap">
+        select
+heart_id, type, id, status, eq, current, voltage, signalstrength, temperature, create_time, site_id
+        from heart_beat
+        <where>
+            <if test="heartId != null">
+                and heart_id = #{heartId}
+            </if>
+            <if test="type != null">
+                and type = #{type}
+            </if>
+            <if test="id != null and id != ''">
+                and id = #{id}
+            </if>
+            <if test="status != null">
+                and status = #{status}
+            </if>
+            <if test="eq != null">
+                and eq = #{eq}
+            </if>
+            <if test="current != null">
+                and current = #{current}
+            </if>
+            <if test="voltage != null">
+                and voltage = #{voltage}
+            </if>
+            <if test="signalstrength != null">
+                and signalstrength = #{signalstrength}
+            </if>
+            <if test="temperature != null">
+                and temperature = #{temperature}
+            </if>
+            <if test="createTime != null">
+                and create_time = #{createTime}
+            </if>
+            <if test="siteId != null">
+                and site_id = #{siteId}
+            </if>
+        </where>
+        limit #{pageable.offset}, #{pageable.pageSize}
+    </select>
+
+    <!--统计总行数-->
+    <select id="count" resultType="java.lang.Long">
+        select count(1)
+        from heart_beat
+        <where>
+            <if test="heartId != null">
+                and heart_id = #{heartId}
+            </if>
+            <if test="type != null">
+                and type = #{type}
+            </if>
+            <if test="id != null and id != ''">
+                and id = #{id}
+            </if>
+            <if test="status != null">
+                and status = #{status}
+            </if>
+            <if test="eq != null">
+                and eq = #{eq}
+            </if>
+            <if test="current != null">
+                and current = #{current}
+            </if>
+            <if test="voltage != null">
+                and voltage = #{voltage}
+            </if>
+            <if test="signalstrength != null">
+                and signalstrength = #{signalstrength}
+            </if>
+            <if test="temperature != null">
+                and temperature = #{temperature}
+            </if>
+            <if test="createTime != null">
+                and create_time = #{createTime}
+            </if>
+            <if test="siteId != null">
+                and site_id = #{siteId}
+            </if>
+        </where>
+    </select>
+
+    <!--新增所有列-->
+    <insert id="insert" keyProperty="heartId" useGeneratedKeys="true">
+        insert into heart_beat(type, id, status, eq, current, voltage, signalstrength, temperature, create_time, site_id)
+        values (#{type}, #{id}, #{status}, #{eq}, #{current}, #{voltage}, #{signalstrength}, #{temperature}, #{createTime}, #{siteId})
+    </insert>
+
+    <insert id="insertBatch" keyProperty="heartId" useGeneratedKeys="true">
+        insert into heart_beat(type, id, status, eq, current, voltage, signalstrength, temperature, create_time, site_id)
+        values
+        <foreach collection="entities" item="entity" separator=",">
+        (#{entity.type}, #{entity.id}, #{entity.status}, #{entity.eq}, #{entity.current}, #{entity.voltage}, #{entity.signalstrength}, #{entity.temperature}, #{entity.createTime}, #{entity.siteId})
+        </foreach>
+    </insert>
+
+    <insert id="insertOrUpdateBatch" keyProperty="heartId" useGeneratedKeys="true">
+        insert into heart_beat(type, id, status, eq, current, voltage, signalstrength, temperature, create_time, site_id)
+        values
+        <foreach collection="entities" item="entity" separator=",">
+            (#{entity.type}, #{entity.id}, #{entity.status}, #{entity.eq}, #{entity.current}, #{entity.voltage}, #{entity.signalstrength}, #{entity.temperature}, #{entity.createTime}, #{entity.siteId})
+        </foreach>
+        on duplicate key update
+type = values(type),
+id = values(id),
+status = values(status),
+eq = values(eq),
+current = values(current),
+voltage = values(voltage),
+signalstrength = values(signalstrength),
+temperature = values(temperature),
+create_time = values(create_time),
+site_id = values(site_id)
+    </insert>
+
+    <!--通过主键修改数据-->
+    <update id="update">
+        update heart_beat
+        <set>
+            <if test="type != null">
+                type = #{type},
+            </if>
+            <if test="id != null and id != ''">
+                id = #{id},
+            </if>
+            <if test="status != null">
+                status = #{status},
+            </if>
+            <if test="eq != null">
+                eq = #{eq},
+            </if>
+            <if test="current != null">
+                current = #{current},
+            </if>
+            <if test="voltage != null">
+                voltage = #{voltage},
+            </if>
+            <if test="signalstrength != null">
+                signalstrength = #{signalstrength},
+            </if>
+            <if test="temperature != null">
+                temperature = #{temperature},
+            </if>
+            <if test="createTime != null">
+                create_time = #{createTime},
+            </if>
+            <if test="siteId != null">
+                site_id = #{siteId},
+            </if>
+        </set>
+        where heart_id = #{heartId}
+    </update>
+
+    <!--通过主键删除-->
+    <delete id="deleteById">
+        delete from heart_beat where heart_id = #{heartId}
+    </delete>
+
+</mapper>
+

+ 142 - 0
ruoyi-system/src/main/resources/mapper/TaskNoticeMapper.xml

@@ -0,0 +1,142 @@
+<?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.TaskNoticeMapper">
+
+    <resultMap type="com.ruoyi.system.domain.TaskNotice" id="TaskNoticeMap">
+        <result property="startId" column="start_id" jdbcType="INTEGER"/>
+        <result property="taskid" column="taskid" jdbcType="VARCHAR"/>
+        <result property="workmode" column="workmode" jdbcType="INTEGER"/>
+        <result property="planid" column="planid" jdbcType="INTEGER"/>
+        <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+        <result property="siteId" column="site_id" jdbcType="INTEGER"/>
+        <result property="id" column="id" jdbcType="VARCHAR"/>
+        <result property="remark" column="remark" jdbcType="VARCHAR"/>
+        <result property="code" column="code" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <!--查询单个-->
+    <select id="queryById" resultMap="TaskNoticeMap">
+        select
+start_id, taskid, workmode, planid, create_time, site_id, id, remark, code
+        from task_notice
+        where start_id = #{startId}
+    </select>
+
+    <!--查询指定行数据-->
+    <select id="queryAllByLimit" resultMap="TaskNoticeMap">
+        select
+            start_id, taskid, workmode, planid, create_time, site_id, id, remark, code
+        from task_notice
+        <where>
+            <if test="siteId != null">
+                and site_id= #{siteId}
+            </if>
+        </where>
+        order by create_time desc
+    </select>
+
+    <!--统计总行数-->
+    <select id="count" resultType="java.lang.Long">
+        select count(1)
+        from task_notice
+        <where>
+            <if test="startId != null">
+                and start_id = #{startId}
+            </if>
+            <if test="taskid != null and taskid != ''">
+                and taskid = #{taskid}
+            </if>
+            <if test="workmode != null">
+                and workmode = #{workmode}
+            </if>
+            <if test="planid != null">
+                and planid = #{planid}
+            </if>
+            <if test="createTime != null">
+                and create_time = #{createTime}
+            </if>
+            <if test="siteId != null">
+                and site_id = #{siteId}
+            </if>
+            <if test="id != null and id != ''">
+                and id = #{id}
+            </if>
+            <if test="remark != null and remark != ''">
+                and remark = #{remark}
+            </if>
+            <if test="code != null and code != ''">
+                and code = #{code}
+            </if>
+        </where>
+    </select>
+
+    <!--新增所有列-->
+    <insert id="insert" keyProperty="startId" useGeneratedKeys="true">
+        insert into task_notice(taskid, workmode, planid, create_time, site_id, id, remark, code)
+        values (#{taskid}, #{workmode}, #{planid}, #{createTime}, #{siteId}, #{id}, #{remark}, #{code})
+    </insert>
+
+    <insert id="insertBatch" keyProperty="startId" useGeneratedKeys="true">
+        insert into task_notice(taskid, workmode, planid, create_time, site_id, id, remark, code)
+        values
+        <foreach collection="entities" item="entity" separator=",">
+        (#{entity.taskid}, #{entity.workmode}, #{entity.planid}, #{entity.createTime}, #{entity.siteId}, #{entity.id}, #{entity.remark}, #{entity.code})
+        </foreach>
+    </insert>
+
+    <insert id="insertOrUpdateBatch" keyProperty="startId" useGeneratedKeys="true">
+        insert into task_notice(taskid, workmode, planid, create_time, site_id, id, remark, code)
+        values
+        <foreach collection="entities" item="entity" separator=",">
+            (#{entity.taskid}, #{entity.workmode}, #{entity.planid}, #{entity.createTime}, #{entity.siteId}, #{entity.id}, #{entity.remark}, #{entity.code})
+        </foreach>
+        on duplicate key update
+taskid = values(taskid),
+workmode = values(workmode),
+planid = values(planid),
+create_time = values(create_time),
+site_id = values(site_id),
+id = values(id),
+remark = values(remark),
+code = values(code)
+    </insert>
+
+    <!--通过主键修改数据-->
+    <update id="update">
+        update task_notice
+        <set>
+            <if test="taskid != null and taskid != ''">
+                taskid = #{taskid},
+            </if>
+            <if test="workmode != null">
+                workmode = #{workmode},
+            </if>
+            <if test="planid != null">
+                planid = #{planid},
+            </if>
+            <if test="createTime != null">
+                create_time = #{createTime},
+            </if>
+            <if test="siteId != null">
+                site_id = #{siteId},
+            </if>
+            <if test="id != null and id != ''">
+                id = #{id},
+            </if>
+            <if test="remark != null and remark != ''">
+                remark = #{remark},
+            </if>
+            <if test="code != null and code != ''">
+                code = #{code},
+            </if>
+        </set>
+        where start_id = #{startId}
+    </update>
+
+    <!--通过主键删除-->
+    <delete id="deleteById">
+        delete from task_notice where start_id = #{startId}
+    </delete>
+
+</mapper>
+

+ 133 - 0
ruoyi-system/src/main/resources/mapper/WaterLevelMapper.xml

@@ -0,0 +1,133 @@
+<?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.WaterLevelMapper">
+
+    <resultMap type="com.ruoyi.system.domain.WaterLevel" id="WaterLevelMap">
+        <result property="waterId" column="water_id" jdbcType="INTEGER"/>
+        <result property="id" column="id" jdbcType="VARCHAR"/>
+        <result property="waterlevel" column="waterlevel" jdbcType="NUMERIC"/>
+        <result property="siteId" column="site_id" jdbcType="INTEGER"/>
+        <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+    </resultMap>
+
+    <!--查询单个-->
+    <select id="queryById" resultMap="WaterLevelMap">
+        select
+            water_id, id, waterlevel, site_id, create_time
+        from water_level
+        where water_id = #{waterId}
+    </select>
+
+
+    <!--查询单个-->
+    <select id="queryBySiteId" resultMap="WaterLevelMap">
+        select
+            water_id, id, waterlevel, site_id, create_time
+        from water_level
+        where site_id = #{siteId}
+        order by create_time desc
+        limit 1
+    </select>
+
+    <!--查询指定行数据-->
+    <select id="queryAllByLimit" resultMap="WaterLevelMap">
+        select
+water_id, id, waterlevel, site_id, create_time
+        from water_level
+        <where>
+            <if test="waterId != null">
+                and water_id = #{waterId}
+            </if>
+            <if test="id != null and id != ''">
+                and id = #{id}
+            </if>
+            <if test="waterlevel != null">
+                and waterlevel = #{waterlevel}
+            </if>
+            <if test="siteId != null">
+                and site_id = #{siteId}
+            </if>
+            <if test="createTime != null">
+                and create_time = #{createTime}
+            </if>
+        </where>
+        limit #{pageable.offset}, #{pageable.pageSize}
+    </select>
+
+    <!--统计总行数-->
+    <select id="count" resultType="java.lang.Long">
+        select count(1)
+        from water_level
+        <where>
+            <if test="waterId != null">
+                and water_id = #{waterId}
+            </if>
+            <if test="id != null and id != ''">
+                and id = #{id}
+            </if>
+            <if test="waterlevel != null">
+                and waterlevel = #{waterlevel}
+            </if>
+            <if test="siteId != null">
+                and site_id = #{siteId}
+            </if>
+            <if test="createTime != null">
+                and create_time = #{createTime}
+            </if>
+        </where>
+    </select>
+
+    <!--新增所有列-->
+    <insert id="insert" keyProperty="waterId" useGeneratedKeys="true">
+        insert into water_level(id, waterlevel, site_id, create_time)
+        values (#{id}, #{waterlevel}, #{siteId}, #{createTime})
+    </insert>
+
+    <insert id="insertBatch" keyProperty="waterId" useGeneratedKeys="true">
+        insert into water_level(id, waterlevel, site_id, create_time)
+        values
+        <foreach collection="entities" item="entity" separator=",">
+        (#{entity.id}, #{entity.waterlevel}, #{entity.siteId}, #{entity.createTime})
+        </foreach>
+    </insert>
+
+    <insert id="insertOrUpdateBatch" keyProperty="waterId" useGeneratedKeys="true">
+        insert into water_level(id, waterlevel, site_id, create_time)
+        values
+        <foreach collection="entities" item="entity" separator=",">
+            (#{entity.id}, #{entity.waterlevel}, #{entity.siteId}, #{entity.createTime})
+        </foreach>
+        on duplicate key update
+id = values(id),
+waterlevel = values(waterlevel),
+site_id = values(site_id),
+create_time = values(create_time)
+    </insert>
+
+    <!--通过主键修改数据-->
+    <update id="update">
+        update water_level
+        <set>
+            <if test="id != null and id != ''">
+                id = #{id},
+            </if>
+            <if test="waterlevel != null">
+                waterlevel = #{waterlevel},
+            </if>
+            <if test="siteId != null">
+                site_id = #{siteId},
+            </if>
+            <if test="createTime != null">
+                create_time = #{createTime},
+            </if>
+        </set>
+        where water_id = #{waterId}
+    </update>
+
+    <!--通过主键删除-->
+    <delete id="deleteById">
+        delete from water_level where water_id = #{waterId}
+    </delete>
+
+</mapper>
+

+ 45 - 17
waterAffairs-admin/src/main/java/com/ruoyi/web/controller/tool/ReportDataController.java

@@ -1,53 +1,81 @@
 package com.ruoyi.web.controller.tool;
 
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ruoyi.common.annotation.Anonymous;
 import com.ruoyi.common.utils.R;
-import com.ruoyi.system.dto.ManualMeasureDTO;
-import com.ruoyi.system.service.DirectiveService;
+import com.ruoyi.system.domain.CarPosition;
+import com.ruoyi.system.domain.HeartBeat;
+import com.ruoyi.system.domain.TaskNotice;
+import com.ruoyi.system.domain.WaterLevel;
+import com.ruoyi.system.dto.SiteRealTimeDTO;
+import com.ruoyi.system.service.ReportDataService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
-import javax.validation.Valid;
+
+
 
 /**
  * Create By Spring-2022/10/29
  */
-@Controller
+@RestController
 @RequestMapping(value = "/reportData")
-@Api(value = "ReportDataController", tags = {"数据查询"})
+@Api(tags = {"数据查询"})
 @Slf4j
 @Anonymous
 public class ReportDataController {
 
-    //小车位置
-
-    //小车状态
-
-    //站点信息 有无任务
+    @Resource
+    ReportDataService reportDataService;
 
+    //小车位置
+    @PostMapping(value = "/carLocation")
+    @ApiOperation("获取小车实时位置")
+    public R<CarPosition> carLocation(Long siteId)  {
+        return R.ok(reportDataService.carLocation(siteId));
+    }
+
+    //小车信息
+    @PostMapping(value = "/carInfo")
+    @ApiOperation("获取小车实时信息")
+    public R<HeartBeat> carInfo(Long siteId)  {
+        return R.ok(reportDataService.carInfo(siteId));
+    }
+
+    //站点实时信息
+    @PostMapping(value = "/siteRealTime")
+    @ApiOperation("获取站点实时信息")
+    public R<SiteRealTimeDTO> siteRealTime(Long siteId)  {
+        return R.ok(reportDataService.siteRealTime(siteId));
+    }
     //即时信息
-
+    @PostMapping(value = "/taskNotice")
+    @ApiOperation("获取任务通知(及时消息)")
+    public R<Page<TaskNotice>> taskNotice(Long siteId, Long page, Long size)  {
+        return R.ok(reportDataService.taskNotice(siteId,page,size));
+    }
     //当前水位
 
+    @PostMapping(value = "/getWaterLevel")
+    @ApiOperation("获取实时水位")
+    public R<WaterLevel> getWaterLevel(Long siteId)  {
+        return R.ok(reportDataService.getWaterLevel(siteId));
+    }
+
     //水位趋势
 
     //垂线点对应流量图
 
-    //通知消息
-
     //成果列表
 
     //成果导出
 
     //散点图
 
-
-
 }